A LoRA adapter for
Qwen/Qwen2.5-0.5B-Instruct
trained on the
openai/gsm8k
math word-problem dataset (5,000-row training subset, ChatML format
terminated by
#### N).
This adapter is the winning configuration of a five-trial supervised
fine-tuning (SFT) sweep, selected at the end of Part 3 of the NLP
Assignment 4 pipeline. A subsequent GRPO reinforcement-learning sweep
(Part 4 / 5) did not beat this adapter on the held-out test set, so this
SFT adapter is the final shipped model.
1from peft import PeftModel
2from transformers import AutoModelForCausalLM, AutoTokenizer
3
4base_id = "Qwen/Qwen2.5-0.5B-Instruct"
5adapter_id = "tayyib-sayyid/qwen2.5-0.5b-gsm8k-lora"
6
7tok = AutoTokenizer.from_pretrained(adapter_id)
8base = AutoModelForCausalLM.from_pretrained(base_id, device_map="auto")
9model = PeftModel.from_pretrained(base, adapter_id)
10model.eval()
11
12prompt = (
13 "Natalia sold clips to 48 of her friends in April, and then she sold "
14 "half as many clips in May. How many clips did Natalia sell altogether "
15 "in April and May?"
16)
17messages = [{"role": "user", "content": prompt}]
18inputs = tok.apply_chat_template(messages, return_tensors="pt", add_generation_prompt=True).to(model.device)
19out = model.generate(inputs, max_new_tokens=256, do_sample=False)
20print(tok.decode(out[0][inputs.shape[-1]:], skip_special_tokens=True))
This adapter was produced as part of NLP Assignment 4 at IBA. The full
pipeline, hyperparameter sweep tables, and LaTeX report live in the
source repository.