Views
No views yet
Qwen/Qwen2.5-0.5B-Instruct, fine-tuned to excel at multi-step mathematical and logical reasoning. It was trained to first generate an internal monologue (<|begin_of_thought|>...) before providing a final, boxed answer (\boxed{...}).1from transformers import AutoTokenizer, AutoModelForCausalLM
2
3model_id = "oscarz511/NanoSOTA-Qwen-0.5B-GSM8K-v1"
4tokenizer = AutoTokenizer.from_pretrained(model_id)
5model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype="auto", device_map="auto")
6
7prompt = "A farmer has 15 sheep. All but 8 die. How many are left?"
8
9messages = [{"role": "user", "content": prompt}]
10input_text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
11inputs = tokenizer(input_text, return_tensors="pt").to(model.device)
12
13outputs = model.generate(**inputs, max_new_tokens=256)
14print(tokenizer.decode(outputs, skip_special_tokens=True))Qwen/Qwen2.5-0.5B-Instruct.HuggingFaceH4/Bespoke-Stratos-17k to learn the <|begin_of_thought|> reasoning structure.gsm8k (main) dataset to master the format and logic of word problems.