Views
No views yet
subrit-legal-gpt2-quecto-v11from transformers import GPT2LMHeadModel, GPT2Tokenizer
2
3# 1. Load from Hugging Face
4model_name = "subrit/subrit-legal-gpt2-quecto-v1"
5tokenizer = GPT2Tokenizer.from_pretrained(model_name)
6model = GPT2LMHeadModel.from_pretrained(model_name)
7
8# 2. Ask a Question
9input_text = "Question: What is Article 14 of the Constitution?\nAnswer:"
10inputs = tokenizer(input_text, return_tensors="pt")
11
12# 3. Generate Answer
13outputs = model.generate(**inputs, max_new_tokens=50)
14print(tokenizer.decode(outputs[0], skip_special_tokens=True))pip install llama-cpp-python huggingface_hub1from huggingface_hub import hf_hub_download
2from llama_cpp import Llama
3
4# 1. Download the GGUF file
5model_path = hf_hub_download(
6 repo_id="subrit/subrit-legal-gpt2-quecto-v1",
7 filename="subrit_legal_gpt2_q8.gguf"
8)
9
10# 2. Load the Engine
11llm = Llama(model_path=model_path, n_ctx=512, verbose=False)
12
13# 3. Ask a Question
14question = "What is the punishment for murder under Section 302?"
15output = llm(f"Question: {question}\nAnswer:", max_tokens=60, stop=["Question:", "\n"])
16
17print(output['choices'][0]['text'])1@misc{dikshit2025legalgpt2,
2 author = {Dikshit, Subrit},
3 title = {Subrit's Legal AI (Quecto V1): A Quantized GPT-2 Fine-Tune on Indian Law},
4 year = {2025},
5 publisher = {Hugging Face},
6 journal = {Hugging Face Model Hub},
7 howpublished = {\url{[https://huggingface.co/subrit/subrit-legal-gpt2-quecto-v1](https://huggingface.co/subrit/subrit-legal-gpt2-quecto-v1)}}
8}@dataset{indian_legal_texts,
author = {Gupta, Akshat (Techmaestro369)},
title = {Indian Legal Texts Finetuning Dataset},
year = {2024},
publisher = {Hugging Face},
url = {[https://huggingface.co/datasets/Techmaestro369/indian-legal-texts-finetuning](https://huggingface.co/datasets/Techmaestro369/indian-legal-texts-finetuning)}
}
@article{radford2019language,
title={Language Models are Unsupervised Multitask Learners},
author={Radford, Alec and Wu, Jeffrey and Child, Rewon and Luan, David and Amodei, Dario and Sutskever, Ilya},
year={2019}
}