Instructions to use DeerAi001/distilgpt2-imbd-finetunned with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use DeerAi001/distilgpt2-imbd-finetunned with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="DeerAi001/distilgpt2-imbd-finetunned")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("DeerAi001/distilgpt2-imbd-finetunned", device_map="auto") - PEFT
How to use DeerAi001/distilgpt2-imbd-finetunned with PEFT:
Task type is invalid.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use DeerAi001/distilgpt2-imbd-finetunned with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "DeerAi001/distilgpt2-imbd-finetunned" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "DeerAi001/distilgpt2-imbd-finetunned", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/DeerAi001/distilgpt2-imbd-finetunned
- SGLang
How to use DeerAi001/distilgpt2-imbd-finetunned 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 "DeerAi001/distilgpt2-imbd-finetunned" \ --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": "DeerAi001/distilgpt2-imbd-finetunned", "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 "DeerAi001/distilgpt2-imbd-finetunned" \ --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": "DeerAi001/distilgpt2-imbd-finetunned", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use DeerAi001/distilgpt2-imbd-finetunned with Docker Model Runner:
docker model run hf.co/DeerAi001/distilgpt2-imbd-finetunned
- Model Card for DistilGPT2-IMDb-LoRA-Finetuned
- Model Details
- Uses
- Bias, Risks, and Limitations
- How to Get Started with the Model
- Training Details
- Evaluation
- Model Examination [optional]
- Environmental Impact
- Technical Specifications [optional]
- Citation [optional]
- Glossary [optional]
- More Information [optional]
- Model Card Authors [optional]
- Model Card Contact
Model Card for DistilGPT2-IMDb-LoRA-Finetuned
A LoRA fine-tuned version of DistilGPT2 on IMDb movie review dataset for text generation.
Model Details
Model Description
This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model has been fine-tuned using LoRA (Low-Rank Adaptation) technique on IMDb dataset for movie review style text generation.
- Developed by: Anurag Pandey
- Funded by [optional]: Self-funded
- Shared by [optional]: DeerAI001
- Model type: Causal Language Model (Text Generation)
- Language(s) (NLP): English
- License: Apache-2.0
- Finetuned from model [optional]: distilgpt2
Model Sources [optional]
- Repository: https://huggingface.co/DeerAI001/distilgpt2-imbd-finetuned
- Paper [optional]: N/A
- Demo [optional]: N/A
Uses
Direct Use
This model can be used directly for text generation with movie review style completions.
Downstream Use [optional]
Can be further fine-tuned for specific sentiment analysis or review generation tasks.
Out-of-Scope Use
Not suitable for factual question answering or non-English text generation.
Bias, Risks, and Limitations
Model is trained on IMDb dataset which may contain biases present in movie reviews. Limited to English language only.
Recommendations
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. Use for creative text generation purposes only.
How to Get Started with the Model
Use the code below to get started with the model.
from transformers import AutoTokenizer, AutoModelForCausalLM, pipeline
from peft import PeftModel, PeftConfig
# Load adapter config
adapter_path = "DeerAI001/distilgpt2-imbd-finetuned"
peft_config = PeftConfig.from_pretrained(adapter_path)
# Load base model
base_model = AutoModelForCausalLM.from_pretrained(
peft_config.base_model_name_or_path,
trust_remote_code=True
)
# Load adapter on top of base model
model = PeftModel.from_pretrained(base_model, adapter_path)
model.eval()
# Tokenizer
tokenizer = AutoTokenizer.from_pretrained(peft_config.base_model_name_or_path)
tokenizer.pad_token = tokenizer.eos_token
# Inference pipeline
pipe = pipeline(
"text-generation",
model=model,
tokenizer=tokenizer,
max_new_tokens=100,
do_sample=True,
temperature=0.8
)
# Test input
prompt = "The movie was absolutely wonderful because"
result = pipe(prompt)
print(result[0]["generated_text"])
Training Details
Training Data
IMDb Movie Reviews Dataset - 500 samples subset used for training.
Training Procedure
Preprocessing [optional]
Tokenized with max_length=64, padding="max_length", truncation=True
Training Hyperparameters
- Training regime: fp32 (CPU training)
- Batch size: 1
- Gradient accumulation steps: 8
- Effective batch size: 8
- Epochs: 1
- LoRA rank (r): 4
- LoRA alpha: 8
- LoRA dropout: 0.1
- Target modules: c_attn, c_proj
Speeds, Sizes, Times [optional]
- Training time: ~30-60 minutes on CPU
- Checkpoint size: ~1 MB (LoRA adapters only)
Evaluation
Testing Data, Factors & Metrics
Testing Data
IMDb test split
Factors
Text coherence and movie review style generation
Metrics
Qualitative evaluation of generated text
Results
Model generates coherent movie review style text completions.
Summary
Successfully fine-tuned DistilGPT2 using LoRA for movie review text generation.
Model Examination [optional]
LoRA adapters applied to attention layers (c_attn, c_proj) with rank 4.
Environmental Impact
Carbon emissions can be estimated using the Machine Learning Impact calculator presented in Lacoste et al. (2019).
- Hardware Type: AMD Ryzen 5 5500U (CPU)
- Hours used: ~1 hour
- Cloud Provider: Local machine
- Compute Region: India
- Carbon Emitted: Minimal (CPU-only training)
Technical Specifications [optional]
Model Architecture and Objective
DistilGPT2 (82M parameters) with LoRA adapters (~50K trainable parameters)
Compute Infrastructure
Local CPU-based training
Hardware
- CPU: AMD Ryzen 5 5500U
- RAM: 8 GB
- GPU: None (CPU training)
Software
- transformers
- peft
- datasets
- torch
Citation [optional]
BibTeX:
@misc{distilgpt2-imdb-lora-2025,
author = {DeerAI001},
title = {DistilGPT2 Fine-tuned with LoRA on IMDb},
year = {2025},
publisher = {Hugging Face},
url = {https://huggingface.co/DeerAI001/distilgpt2-imbd-finetuned}
}
APA:
DeerAI001. (2025). DistilGPT2 Fine-tuned with LoRA on IMDb. Hugging Face. https://huggingface.co/DeerAI001/distilgpt2-imbd-finetuned
Glossary [optional]
- LoRA: Low-Rank Adaptation - efficient fine-tuning technique
- PEFT: Parameter-Efficient Fine-Tuning
More Information [optional]
For more details on LoRA fine-tuning, visit: https://huggingface.co/docs/peft
Model Card Authors [optional]
DeerAI001
Model Card Contact
Open an issue on the Hugging Face repository for questions or feedback.