Downloads · 30 days
6
32% of all-time downloads
masabhuq/stl_phone_summarizer
stl_phone_summarizer is a summarization model from masabhuq. Use it when you need a shorter version of a longer text. It is set up for peft. The card lists the license as apache-2.0.
A conversational LLM for summarizing phone specifications into concise, appealing descriptions for e-commerce. Model: LoRA fine-tuned Llama-3.2 Repo: masabhuq/stlphonesummarizer ---
Downloads · 30 days
6
32% of all-time downloads
All-time downloads
19
Public
Repo size
115 MB
Likes
0
Public
Click a slice to open those files.
.safetensors97.3 MB · 85%
From the Hugging Face model README
masabhuq/stl_phone_summarizerpip install unsloth torch
from unsloth import FastLanguageModel
from unsloth.chat_templates import get_chat_template
model, tokenizer = FastLanguageModel.from_pretrained(
"masabhuq/stl_phone_summarizer",
max_seq_length=2048,
dtype=None, # Auto-detect (bfloat16 if supported)
load_in_4bit=True, # 4-bit quantization for memory efficiency
)
FastLanguageModel.for_inference(model)
tokenizer = get_chat_template(
tokenizer,
chat_template="llama-3.2",
map_eos_token=True,
)
system_prompt = (
"You are an expert at summarizing phone specifications into short, appealing key descriptions for an e-commerce site. "
"Always output in exactly this format:\n"
"Display: [concise display summary]\n"
"Processor: [processor name]\n"
"Camera: [camera highlights]\n"
"Battery: [battery capacity and charging]\n"
"Others: [comma-separated unique features]. "
"Focus on desirable aspects like high refresh rates, zoom capabilities, fast charging, and unique features such as water resistance or special sensors. "
"Do not include complicated keyboards that don't make sense on their own. "
"Do not include words that are too technical to understand for someone who is not highly tech savvy. "
"Output should be within 280 characters. Don't include anything like IPDC or IP64 or any such features in the result. Words starting with IP are not to be considered display feature."
)
specs = "Build: Glass front (Gorilla Glass 5), silicone polymer back (eco leather), plastic frame\nWeight: 178 g ..."
prompt = [
{"role": "system", "content": system_prompt},
{"role": "user", "content": specs}
]
formatted_prompt = tokenizer.apply_chat_template(
prompt,
tokenize=False,
add_generation_prompt=True,
)
import torch
inputs = tokenizer(formatted_prompt, return_tensors="pt").to("cuda")
outputs = model.generate(
**inputs,
max_new_tokens=256,
do_sample=True,
temperature=0.7,
top_p=0.9,
)
generated_text = tokenizer.decode(outputs[0], skip_special_tokens=False)
# Extract the last paragraph and clean up
paragraphs = generated_text.strip().split("\n\n")
last_paragraph = paragraphs[-1]
clean_last_paragraph = last_paragraph.split("<|eot_id|>")[0].strip()
print(clean_last_paragraph)
Free GPU memory after inference:
model.cpu()
torch.cuda.empty_cache()
model.cpu()).model.cpu() and torch.cuda.empty_cache() to free GPU memory after inference, especially on low-VRAM GPUs.temperature and top_p for more or less creative outputs, and max_new_tokens for longer or shorter summaries.unsloth/Llama-3.2-3B-Instruct-bnb-4bitr=16, targeting modules: ["q_proj", "k_proj", "v_proj", "o_proj", "gate_proj", "up_proj", "down_proj"].specs) paired with concise summaries (output) in the format shown above.trl.SFTTrainer, train_on_responses_only to focus on assistant responses, and Llama-3.2 chat template for single-turn interactions.The model was trained on a custom dataset (specs_list.json) containing pairs of detailed phone specifications and their corresponding summaries. Each entry includes:
specs: Detailed technical specs (e.g., display size, chipset, camera details).output: A concise summary in the format:
Display: [summary]
Processor: [name]
Camera: [highlights]
Battery: [capacity and charging]
Others: [features]
This model is licensed under the Apache 2.0 License. See the LICENSE file in the repository for details.
If you use this model, please cite the repository:
@misc{stl_phone_summarizer,
author = {masabhuq},
title = {STL Phone Summarizer: A Fine-Tuned Llama-3.2 Model for Phone Specification Summaries},
year = {2025},
publisher = {Hugging Face},
howpublished = {\url{https://huggingface.co/masabhuq/stl_phone_summarizer}}
}
Free GPU memory after inference:
model.cpu()
torch.cuda.empty_cache()