Downloads · 30 days
6
3% of all-time downloads
shehrozrafaqat/football-tinyllama-trl-lora
football-tinyllama-trl-lora is a text generation model from shehrozrafaqat. Use it when you need the model to write or continue text. It is set up for peft.
This repository contains the completed Lec 25 style fine-tuning route for the football assistant assignment.
Downloads · 30 days
6
3% of all-time downloads
All-time downloads
212
Public
Repo size
50.5 MB
Likes
0
Public
Click a slice to open those files.
.safetensors50.5 MB · 93%
From the Hugging Face model README
This repository contains the completed Lec 25 style fine-tuning route for the football assistant assignment.
SFTTrainer + PEFT LoRATinyLlama/TinyLlama-1.1B-Chat-v1.0The separate Lec 26 route uses Unsloth QLoRA with an 8B model and is resumable from Google Drive checkpoints because a free T4 GPU session may not finish it in one sitting.
The TRL TinyLlama run completed one full epoch on Google Colab T4.
The repository includes:
base_model_eval.jsonlfinetuned_model_eval.jsonlThe base model often gave generic or hallucinated football answers. The fine-tuned adapter produced short, grounded answers aligned with the dataset style, including warnings for live or time-sensitive football topics such as league tables, transfers, injuries and manager status.
This repository is a PEFT LoRA adapter. Load it together with the original TinyLlama base model:
pip install -q transformers peft accelerate safetensors torch
import torch
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer
base_model_id = "TinyLlama/TinyLlama-1.1B-Chat-v1.0"
adapter_id = "shehrozrafaqat/football-tinyllama-trl-lora"
tokenizer = AutoTokenizer.from_pretrained(adapter_id)
model_kwargs = {}
if torch.cuda.is_available():
model_kwargs = {"torch_dtype": torch.float16, "device_map": "auto"}
base_model = AutoModelForCausalLM.from_pretrained(base_model_id, **model_kwargs)
model = PeftModel.from_pretrained(base_model, adapter_id)
model.eval()
messages = [{"role": "user", "content": "Explain goal difference in football."}]
prompt = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True,
)
inputs = tokenizer(prompt, return_tensors="pt")
device = next(model.parameters()).device
inputs = {key: value.to(device) for key, value in inputs.items()}
with torch.no_grad():
output_ids = model.generate(
**inputs,
max_new_tokens=120,
do_sample=False,
pad_token_id=tokenizer.eos_token_id,
)
answer_ids = output_ids[0][inputs["input_ids"].shape[-1]:]
print(tokenizer.decode(answer_ids, skip_special_tokens=True).strip())
The dataset is source-backed and contains football facts from official or high-authority sources, including FIFA, IFAB, UEFA, Premier League, LALIGA, Bundesliga, Serie A, Ligue 1, MLS, AFC, CAF, CONMEBOL, CONCACAF and FIFA Training Centre pages.
The data uses ChatML-style rows:
{
"messages": [
{"role": "user", "content": "What is Goal difference?"},
{"role": "assistant", "content": "Goal difference is goals scored minus goals conceded, often used as a league table tiebreaker."}
]
}
This adapter is intended as an academic assignment artifact showing that a small chat model can be fine-tuned on a custom synthetic dataset. It is not a live football data source and should not be used to answer current scores, live standings, injuries, lineups, transfers, betting odds or disciplinary updates without checking official current sources.