Downloads · 30 days
8
11% of all-time downloads
Deepu1965/xsum-llama1b-instruct-lora
xsum-llama1b-instruct-lora is a summarization model from Deepu1965. Use it when you need a shorter version of a longer text. It is set up for transformers. The card lists the license as llama3.2.
This model is a LoRA fine-tuned version of meta-llama/Llama-3.2-1B-Instruct for extreme summarization on the XSum dataset.
Downloads · 30 days
8
11% of all-time downloads
All-time downloads
74
Public
Repo size
107 MB
Likes
0
Public
Click a slice to open those files.
.safetensors45.1 MB · 72%
From the Hugging Face model README
This model is a LoRA fine-tuned version of meta-llama/Llama-3.2-1B-Instruct for extreme summarization on the XSum dataset.
Evaluated on 200 validation samples:
| Metric | Score |
|---|---|
| ROUGE-1 | 0.1912 |
| ROUGE-2 | 0.0548 |
| ROUGE-L | 0.1374 |
| ROUGE-Lsum | 0.1415 |
from transformers import AutoTokenizer, AutoModelForCausalLM
from peft import PeftModel
import torch
# Load base model
model_name = "meta-llama/Llama-3.2-1B-Instruct"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(
model_name,
torch_dtype=torch.float16,
device_map="auto"
)
# Load LoRA adapters
model = PeftModel.from_pretrained(model, "Deepu1965/xsum-llama1b-instruct-lora")
# Prepare input
document = "Your news article here..."
prompt = (
"<|begin_of_text|><|start_header_id|>system<|end_header_id|>\n\n"
"You are a helpful assistant that summarizes news articles into one concise sentence.\n"
"<|eot_id|><|start_header_id|>user<|end_header_id|>\n\n"
f"Summarize this article in one sentence:\n\n{document}\n"
"<|eot_id|><|start_header_id|>assistant<|end_header_id|>\n\n"
)
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=128)
summary = tokenizer.decode(outputs[0], skip_special_tokens=True)
@misc{llama32-xsum-lora,
author = {Your Name},
title = {LLaMA 3.2 1B XSum LoRA},
year = {2025},
publisher = {HuggingFace},
url = {https://huggingface.co/Deepu1965/xsum-llama1b-instruct-lora}
}