Downloads · 30 days
5
45% of all-time downloads
mahi1432/gpt2-medium-LoRA
gpt2-medium-LoRA is a machine learning model from mahi1432. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for peft.
This model is a fine-tuned version of GPT-2 Medium on the BookCorpus dataset using PEFT (LoRA) for parameter-efficient training. It is intended for story generation tasks, producing creative and coherent narrative tex…
Downloads · 30 days
5
45% of all-time downloads
All-time downloads
11
Public
Repo size
1.2 MB
Likes
0
Public
Click a slice to open those files.
.json4.4 MB · 73%
From the Hugging Face model README
This model is a fine-tuned version of GPT-2 Medium on the BookCorpus dataset using PEFT (LoRA) for parameter-efficient training. It is intended for story generation tasks, producing creative and coherent narrative text given a prompt.
Users should review generated outputs before deployment in any real-world application.
Parameter-Efficient Fine-Tuning is a training approach designed to adapt large pre-trained models to new tasks without updating all their parameters. Instead of fine-tuning the full model, PEFT methods modify only a small set of additional parameters, keeping the rest of the model frozen. This reduces computational requirements, speeds up training, and allows the same base model to be adapted to many tasks efficiently.
Low-Rank Adaptation is a PEFT technique that inserts small, trainable rank-decomposition matrices into the transformer's architecture. Instead of updating the full weight matrices, LoRA learns a low-rank approximation of the weight updates while keeping the original model weights frozen.
Advantages of LoRA include:
from transformers import GPT2LMHeadModel, GPT2Tokenizer
model_name = "path_or_repo_id" # Replace with your repo path or Hugging Face model ID
tokenizer = GPT2Tokenizer.from_pretrained(model_name)
model = GPT2LMHeadModel.from_pretrained(model_name)
prompt = "Once upon a time in a distant galaxy,"
inputs = tokenizer(prompt, return_tensors="pt")
outputs = model.generate(**inputs, max_length=200, temperature=0.8, top_p=0.95, do_sample=True)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
Carbon emissions can be estimated using the Machine Learning Impact calculator.
BibTeX:
[Add citation if applicable]
APA:
[Add citation if applicable]
Mahesh Dindur
[N/A]