Views
No views yet
| Model | Backbone | Size |
|---|---|---|
| LIMO-v2 | Qwen2.5-32B-Instruct | 32B |
GAIR/LIMO1from transformers import AutoModelForCausalLM, AutoTokenizer
2import torch
3
4# Initialize model and tokenizer
5model = AutoModelForCausalLM.from_pretrained(
6 "GAIR/LIMO-v2",
7 torch_dtype="auto",
8 trust_remote_code=True,
9 device_map="auto"
10)
11tokenizer = AutoTokenizer.from_pretrained("GAIR/LIMO-v2", trust_remote_code=True)
12
13# Prepare input messages
14messages = [
15 {"role": "system", "content": "Please reason step by step, and put your final answer within \\boxed{}."},
16 {"role": "user", "content": "What is the result of 1+1?"}
17]
18
19# Format input using chat template
20text = tokenizer.apply_chat_template(
21 messages,
22 tokenize=False,
23 add_generation_prompt=True
24)
25
26# Tokenize input
27inputs = tokenizer(text, return_tensors="pt").to(model.device)
28
29# Generate response
30outputs = model.generate(
31 **inputs,
32 max_new_tokens=32768,
33 temperature=0.7,
34 top_p=0.95,
35 do_sample=True
36)
37
38# Decode and print response
39response = tokenizer.decode(outputs[0][inputs['input_ids'].shape[1]:], skip_special_tokens=True)
40print(response)1from vllm import LLM, SamplingParams
2from transformers import AutoTokenizer
3
4# Initialize the model
5llm = LLM(
6 model="GAIR/LIMO-v2",
7 tensor_parallel_size=4, # adjust based on available GPUs
8 trust_remote_code=True,
9 swap_space=60,
10 gpu_memory_utilization=0.96,
11)
12
13# Prepare input messages
14messages = [
15 {"role": "system", "content": "Please reason step by step, and put your final answer within \\boxed{}."},
16 {"role": "user", "content": "What is the result of 1+1?"}
17]
18
19# Setup tokenizer
20tokenizer = AutoTokenizer.from_pretrained("GAIR/LIMO-v2", trust_remote_code=True)
21text = tokenizer.apply_chat_template(
22 messages,
23 tokenize=False,
24 add_generation_prompt=True
25)
26
27# Configure generation parameters
28sampling_params = SamplingParams(
29 temperature=0.7,
30 max_tokens=32768,
31 top_p=0.95,
32)
33
34# Generate response
35output = llm.generate(text, sampling_params)
36print(output[0].outputs[0].text)1@misc{ye2025limoreasoning,
2 title={LIMO: Less is More for Reasoning},
3 author={Yixin Ye and Zhen Huang and Yang Xiao and Ethan Chern and Shijie Xia and Pengfei Liu},
4 year={2025},
5 eprint={2502.03387},
6 archivePrefix={arXiv},
7 primaryClass={cs.CL},
8 url={https://arxiv.org/abs/2502.03387},
9}