Downloads · 30 days
3
5% of all-time downloads
sanju2007/phi2-earnings-summarizer-qlora
phi2-earnings-summarizer-qlora is a text generation model from sanju2007. Use it when you need the model to write or continue text. It is set up for peft. The card lists the license as apache-2.0.
A QLoRA fine-tuned adapter on top of Microsoft's Phi-2 (2.7B) for summarizing financial earnings call excerpts into structured highlights.
Downloads · 30 days
3
5% of all-time downloads
All-time downloads
58
Public
Repo size
21 MB
Likes
0
Public
Click a slice to open those files.
.safetensors21 MB · 85%
From the Hugging Face model README
A QLoRA fine-tuned adapter on top of Microsoft's Phi-2 (2.7B) for summarizing financial earnings call excerpts into structured highlights.
| Epoch | Training Loss | Validation Loss |
|---|---|---|
| 1 | 1.9123 | 1.7098 |
| 2 | 1.7530 | 1.6598 |
| 3 | 1.6555 | 1.6539 |
Evaluated on a held-out earnings call excerpt against a reference summary.
| Metric | Base Phi-2 | Fine-tuned |
|---|---|---|
| ROUGE-1 | — | 0.7368 |
| ROUGE-2 | — | 0.5161 |
| ROUGE-L | — | 0.6316 |
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
from peft import PeftModel
import torch
bnb_config = BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_quant_type="nf4",
bnb_4bit_use_double_quant=True,
bnb_4bit_compute_dtype=torch.float16
)
tokenizer = AutoTokenizer.from_pretrained("sanju2007/phi2-earnings-summarizer-qlora")
base_model = AutoModelForCausalLM.from_pretrained(
"microsoft/phi-2",
quantization_config=bnb_config,
device_map="auto",
trust_remote_code=True
)
model = PeftModel.from_pretrained(base_model, "sanju2007/phi2-earnings-summarizer-qlora")
model.eval()
prompt = """### Instruction:
Summarize the key financial highlights from the following earnings call excerpt.
### Input:
Your earnings call text here.
### Response:"""
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
with torch.no_grad():
outputs = model.generate(**inputs, max_new_tokens=200,
temperature=0.7, do_sample=True,
pad_token_id=tokenizer.eos_token_id)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))