dina1/gpt2-wikitext2-lora-peft
07
GPT-2 WikiText-2 LoRA PEFT Fine-Tune
This repository contains a LoRA adapter (not a full merged model) for GPT-2, fine-tuned on the WikiText-2 raw v1 dataset for causal language modelling using the PEFT library.
Important: This repo contains only the LoRA adapter delta weights. Inference requires loading the GPT-2 base model separately and applying the adapter on top (see usage instructions below).
Model Details
Evaluation Results
Usage
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
# 1. Load the GPT-2 base model
base_model = AutoModelForCausalLM.from_pretrained("gpt2")
# 2. Load the tokenizer from this repo
tokenizer = AutoTokenizer.from_pretrained("dina1/gpt2-wikitext2-lora-peft",
subfolder="tokenizer")
# 3. Apply the LoRA adapter
model = PeftModel.from_pretrained(base_model, "dina1/gpt2-wikitext2-lora-peft")
model.eval()
# 4. Generate text
inputs = tokenizer("The history of artificial intelligence", return_tensors="pt")
outputs = model.generate(**inputs, max_new_tokens=100, do_sample=True, temperature=0.9)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))Reproducibility
Limitations
- Trained exclusively on WikiText-2 (English Wikipedia/news articles).
- Not instruction-tuned or chat-aligned.
- Not safety-aligned — outputs may be factually incorrect or biased.
- Intended for educational and experimental use only.
- Performance on domains outside WikiText-2 is not guaranteed.
Files in This Repository
Citation
If you use this adapter in your work, please credit the PEFT library:
@misc{peft,
author = {Sourab Mangrulkar and Sylvain Gugger and Lysandre Debut and
Younes Belkada and Sayak Paul},
title = {PEFT: State-of-the-art Parameter-Efficient Fine-Tuning methods},
year = {2022},
url = {https://github.com/huggingface/peft}
}