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]

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.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Paper for DeerAi001/distilgpt2-imbd-finetunned