Instructions to use Susant-Achary/distilgpt2-finetuned-constitution-of-india with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Susant-Achary/distilgpt2-finetuned-constitution-of-india with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Susant-Achary/distilgpt2-finetuned-constitution-of-india")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Susant-Achary/distilgpt2-finetuned-constitution-of-india") model = AutoModelForCausalLM.from_pretrained("Susant-Achary/distilgpt2-finetuned-constitution-of-india", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Susant-Achary/distilgpt2-finetuned-constitution-of-india with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Susant-Achary/distilgpt2-finetuned-constitution-of-india" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Susant-Achary/distilgpt2-finetuned-constitution-of-india", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Susant-Achary/distilgpt2-finetuned-constitution-of-india
- SGLang
How to use Susant-Achary/distilgpt2-finetuned-constitution-of-india with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "Susant-Achary/distilgpt2-finetuned-constitution-of-india" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Susant-Achary/distilgpt2-finetuned-constitution-of-india", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "Susant-Achary/distilgpt2-finetuned-constitution-of-india" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Susant-Achary/distilgpt2-finetuned-constitution-of-india", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Susant-Achary/distilgpt2-finetuned-constitution-of-india with Docker Model Runner:
docker model run hf.co/Susant-Achary/distilgpt2-finetuned-constitution-of-india
Model Card for DistilGPT2 Fine-Tuned on the Indian Constitution
Model Summary
This is a fine-tuned version of DistilGPT2 on the Indian Constitution. It has been trained to generate text consistent with the style and language of the Indian Constitution, making it a useful resource for legal text generation and educational purposes.
Model Details
Model Description
This model is a fine-tuned version of the DistilGPT2 model, specifically trained on the text of the Indian Constitution. It can generate contextually accurate legal text and provides a demonstration of fine-tuning GPT-style models for domain-specific tasks.
- Developed by: Susant Achary
- Financed by: [No specific funding; self-driven project]
- Shared by: Susant Achary
- Model type: Causal Language Model (AutoRegressive Transformer)
- Language(s) (NLP): English
- License: Apache 2.0
- Fine-tuned from:
distilbert/distilgpt2
Model Sources
- Repository: Susant Achary's Hugging Face
- Demo: Use directly via Hugging Face Hub
Data Source Trained on
- Resository:[Susant-Achary/constitution-of-india-dataset]
Uses
Direct Use
The model is suitable for generating:
- Contextually accurate text resembling the Indian Constitution.
- Legal or constitutional examples for research or education.
- Domain-specific text generation tasks.
Downstream Use
The model can be further fine-tuned for:
- Other legal text corpora.
- Domain-specific legal or policy text generation.
Out-of-Scope Use
- Malicious or unethical use, including generating misleading or harmful legal text.
- Tasks requiring understanding or reasoning outside the scope of its training data (e.g., non-legal content).
Bias, Risks, and Limitations
Biases
- The model is limited to the specific style and content of the Indian Constitution, which may not generalize well to other legal systems or contexts.
Limitations
- Limited vocabulary: It was trained solely on the Indian Constitution, so it may struggle with prompts outside this domain.
- Lacks reasoning: The model cannot provide explanations or legal reasoning.
Recommendations
- Use responsibly in legal and educational contexts.
- Verify generated text before usage to avoid inaccuracies or misinterpretations.
How to Get Started with the Model
Use the code below to get started with the model:
from transformers import pipeline
model_name = "Susant-Achary/distilgpt2-constitution-of-india"
gen_pipeline = pipeline(
"text-generation",
model=model_name,
tokenizer=model_name
)
prompt = "We, the people of India"
output = gen_pipeline(
prompt,
max_length=100,
do_sample=True,
temperature=0.8,
top_k=100,
top_p=0.95,
num_return_sequences=1
)
print(output[0]['generated_text'])
- Downloads last month
- 17