tatsu-lab/alpaca
Viewer • Updated • 52k • 92.2k • 1.4k
How to use Salmahaitham/SmolLM2-Sports-Analytics with PEFT:
Task type is invalid.
This model is a high-accuracy, parameter-efficient domain-specialized version of HuggingFaceTB/SmolLM2-1.7B-Instruct adapted into a specialized Sports Knowledge and Sports Analytics Assistant. It was fine-tuned using QLoRA (rank-32 adapters on all linear layers) with strict response-only completion masking.
HuggingFaceTB/SmolLM2-1.7B-Instructmerge_and_unload())q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj (All Linear Layers)Smol-Sports-Instruct (2,000 training samples, 250 validation samples) combining:PedroCJardim/QASports| Metric | Base Model (SmolLM2-1.7B-Instruct) |
Fine-Tuned Sports Model | Absolute Delta | Relative Delta |
|---|---|---|---|---|
| Average Loss | 1.5818 | 0.4500 | -1.1317 | -71.55% |
| Perplexity | 4.8635 | 1.5684 | -3.2952 | -67.75% |
| Token-Level Accuracy | 67.97% | 87.15% | +19.18% | +28.21% |
Note: Token-Level Accuracy measures next-token prediction under teacher-forcing over valid assistant response tokens only.
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
model_id = "your-username/SmolLM2-1.7B-Instruct-Sports-Analytics"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype=torch.float16,
device_map="auto"
)
prompt = "Calculate the True Shooting Percentage (TS%) for an NBA player who scored 32 points on 20 field goal attempts and 10 free throw attempts. Show all steps."
messages = [
{"role": "system", "content": "You are an expert sports analyst and statistician. Provide accurate factual answers, comprehensive statistical breakdowns, and clear domain insights."},
{"role": "user", "content": prompt}
]
inputs = tokenizer(tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True), return_tensors="pt").to(model.device)
prompt_len = inputs["input_ids"].shape[1]
with torch.no_grad():
outputs = model.generate(
**inputs,
max_new_tokens=256,
temperature=0.7,
top_p=0.9,
pad_token_id=tokenizer.eos_token_id
)
response = tokenizer.decode(outputs[0][prompt_len:], skip_special_tokens=True).strip()
print(response)
Base model
HuggingFaceTB/SmolLM2-1.7B