import torchfrom transformers import AutoModelForCausalLM, AutoTokenizer model_id = "Huggyb/qwen3-1.7b-grpo-gsm8k"tokenizer = AutoTokenizer.from_pretrained(model_id)model = AutoModelForCausalLM.from_pretrained(model_id, dtype=torch.bfloat16, device_map="auto") system_prompt = ( "Solve the math problem below.\n" "First, reason step by step inside <think> </think> tags.\n" "Then give the final answer inside <answer> </answer> tags.\n" "The answer must contain only the final number, with no units, symbols, or commas.\n" "Format:\n" "<think>\n...\n</think>\n" "<answer>\n...\n</answer>")question = "Natalia sold clips to 48 of her friends in April, and then she sold half as many clips in May. How many clips did Natalia sell altogether in April and May?" messages = [ {"role": "system", "content": system_prompt}, {"role": "user", "content": question},]text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)inputs = tokenizer(text, return_tensors="pt").to(model.device) output = model.generate(**inputs, max_new_tokens=1024, do_sample=False)print(tokenizer.decode(output[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))