Views
No views yet
examples/ directory

vLLM == 0.6.21cd examples
2python run_inference.py1from vllm import SamplingParams
2from prefixLLM import PrefixLLM
3from template import SYSTEM_PROMPT, SHORT_TRIGGER
4
5llm = PrefixLLM(model="amandaa/AutoL2S-7b")
6max_tokens, temp = 32768, 0.7
7sampling_params_route = SamplingParams(max_tokens=max_tokens, temperature=temp, stop=["<specialLong>"], include_stop_str_in_output=True)
8sampling_params_force_think = SamplingParams(max_tokens=max_tokens, temperature=temp)
9
10question = "Convert the point $(0,3)$ in rectangular coordinates to polar coordinates. Enter your answer in the form $(r,\\theta),$ where $r > 0$ and $0 \\le \\theta < 2 \\pi.$"
11messages = [
12 {"role": "system", "content": SYSTEM_PROMPT},
13 {"role": "user", "content": question}
14]
15responses = llm.route_chat(messages=messages, sampling_params_route=sampling_params_route, sampling_params_force_think=sampling_params_force_think, use_tqdm=True, trigger_word=SHORT_TRIGGER)
16
17print(SHORT_TRIGGER + responses[0].outputs[0].text)1@article{luo2025autol2s,
2 title={AutoL2S: Auto Long-Short Reasoning for Efficient Large Language Models},
3 author={Luo, Feng and Chuang, Yu-Neng and Wang, Guanchu and Le, Hoang Anh Duy and Zhong, Shaochen and Liu, Hongyi and Yuan, Jiayi and Sui, Yang and Braverman, Vladimir and Chaudhary, Vipin and others},
4 journal={arXiv preprint arXiv:2505.22662},
5 year={2025}
6}