Instructions to use Sameer2407/fine-tuned-distilgpt2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Sameer2407/fine-tuned-distilgpt2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Sameer2407/fine-tuned-distilgpt2")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Sameer2407/fine-tuned-distilgpt2") model = AutoModelForCausalLM.from_pretrained("Sameer2407/fine-tuned-distilgpt2") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use Sameer2407/fine-tuned-distilgpt2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Sameer2407/fine-tuned-distilgpt2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Sameer2407/fine-tuned-distilgpt2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Sameer2407/fine-tuned-distilgpt2
- SGLang
How to use Sameer2407/fine-tuned-distilgpt2 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 "Sameer2407/fine-tuned-distilgpt2" \ --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": "Sameer2407/fine-tuned-distilgpt2", "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 "Sameer2407/fine-tuned-distilgpt2" \ --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": "Sameer2407/fine-tuned-distilgpt2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Sameer2407/fine-tuned-distilgpt2 with Docker Model Runner:
docker model run hf.co/Sameer2407/fine-tuned-distilgpt2
Fine-Tuned DistilGPT2 on Restaurant Reviews
This is a fine-tuned version of DistilGPT2 using a small dataset of restaurant reviews. The model is trained to generate human-like review completions given a text prompt.
Model Details
Model Description
This model is a lightweight causal language model based on DistilGPT2, a distilled version of GPT2. It was fine-tuned on a small subset of restaurant reviews to help demonstrate how one can fine-tune and upload a model using Hugging Face and Google Colab with limited resources.
- Developed by: Sameer Jadaun (Fine-tuning)
- Shared by: [Sameer2407]
- Model type: Causal Language Model (Decoder-only transformer)
- Language(s): English
- License: Apache 2.0 (inherited from DistilGPT2)
- Finetuned from model: distilgpt2
Uses
Direct Use
You can use this model to generate restaurant reviews or autocomplete a review sentence given a starting prompt like:
"The food was"
Downstream Use
This model can be further fine-tuned on a larger corpus of restaurant, product, or service-related reviews to make it more robust and production-ready.
Out-of-Scope Use
- Not suitable for factual QA tasks.
- Should not be used to generate harmful, toxic, or biased content.
Bias, Risks, and Limitations
This model was trained on a tiny dataset of restaurant reviews and may reflect language biases or poor generation quality due to undertraining. It's only for educational/demo purposes.
Recommendations
- Avoid using in production.
- Fine-tune further with a more diverse and balanced dataset.
How to Get Started with the Model
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("your-username/fine-tuned-distilgpt2")
model = AutoModelForCausalLM.from_pretrained("your-username/fine-tuned-distilgpt2")
prompt = "The restaurant was"
inputs = tokenizer(prompt, return_tensors="pt")
outputs = model.generate(**inputs, max_length=50, do_sample=True)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
- Downloads last month
- 3