Views
No views yet
transformers library.1import torch
2from transformers import AutoModelForCausalLM, AutoTokenizer
3
4model_id = "sunblaze-ucb/Qwen2.5-3B-Intuitor-MATH-1EPOCH"
5
6tokenizer = AutoTokenizer.from_pretrained(model_id)
7model = AutoModelForCausalLM.from_pretrained(
8 model_id,
9 torch_dtype=torch.bfloat16, # or torch.float16 depending on your GPU
10 device_map="auto"
11)
12
13messages = [
14 {"role": "user", "content": "What is the capital of France?"},
15]
16
17text = tokenizer.apply_chat_template(
18 messages,
19 tokenize=False,
20 add_generation_prompt=True
21)
22
23model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
24
25generated_ids = model.generate(
26 model_inputs.input_ids,
27 max_new_tokens=50,
28 temperature=0.7,
29 do_sample=True
30)
31
32output = tokenizer.decode(generated_ids[0][model_inputs.input_ids.shape[1]:], skip_special_tokens=True)
33print(output)1@article{zhao2025learning,
2 title = {Learning to Reason without External Rewards},
3 author = {Zhao, Xuandong and Kang, Zhewei and Feng, Aosong and Levine, Sergey and Song, Dawn},
4 journal = {arXiv preprint arXiv:2505.19590},
5 year = {2025}
6}