Views
No views yet
<think> and <answer> tags1from transformers import AutoTokenizer, AutoModelForCausalLM
2
3tokenizer = AutoTokenizer.from_pretrained("thomasjhuang/qwen2-rloo-countdown-step350")
4model = AutoModelForCausalLM.from_pretrained("thomasjhuang/qwen2-rloo-countdown-step350")
5
6prompt = '''Using the numbers [8, 16, 80], create an equation that equals 72. You can use basic arithmetic operations (+, -, *, /) and each number can only be used once. Show your work in <think> </think> tags. And return the final answer in <answer> </answer> tags, for example <answer> (1 + 2) / 3 </answer>.'''
7
8inputs = tokenizer(prompt, return_tensors="pt")
9outputs = model.generate(**inputs, max_length=300, temperature=0.1)
10response = tokenizer.decode(outputs[0], skip_special_tokens=True)
11print(response)<think> tags<answer> tags