Text Generation
Transformers
Safetensors
English
qwen2
math
code
reasoning
gpqa
instruction-following
conversational
Eval Results
text-generation-inference
Instructions to use WeiboAI/VibeThinker-3B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use WeiboAI/VibeThinker-3B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="WeiboAI/VibeThinker-3B") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("WeiboAI/VibeThinker-3B") model = AutoModelForCausalLM.from_pretrained("WeiboAI/VibeThinker-3B") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Inference
- Local Apps Settings
- vLLM
How to use WeiboAI/VibeThinker-3B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "WeiboAI/VibeThinker-3B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "WeiboAI/VibeThinker-3B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/WeiboAI/VibeThinker-3B
- SGLang
How to use WeiboAI/VibeThinker-3B with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "WeiboAI/VibeThinker-3B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "WeiboAI/VibeThinker-3B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "WeiboAI/VibeThinker-3B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "WeiboAI/VibeThinker-3B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use WeiboAI/VibeThinker-3B with Docker Model Runner:
docker model run hf.co/WeiboAI/VibeThinker-3B
tokenizer_config.json中的聊天模板似乎不正确
#23
by Akias - opened
以下是使用llama-server加载原模板的效果,<think>标签以及思考内容会被直接在正文中
然后加载以下修改后的模板
{%- if tools %}
{{ '<|im_start|>system\n' }}
{%- if messages[0]['role'] == 'system' %}
{{ messages[0]['content'] }}
{%- else %}
{{ 'You are a helpful assistant.' }}
{%- endif %}
{{ "\n\n# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>" }}
{%- for tool in tools %}
{{ "\n" }}
{{ tool | tojson }}
{%- endfor %}
{{ "\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call><|im_end|>\n" }}
{%- else %}
{%- if messages[0]['role'] == 'system' %}
{{ '<|im_start|>system\n' + messages[0]['content'] + '<|im_end|>\n' }}
{%- else %}
{{ '<|im_start|>system\nYou are a helpful assistant.<|im_end|>\n' }}
{%- endif %}
{%- endif %}
{%- for message in messages %}
{%- if message.role == "user" or (message.role == "system" and not loop.first) %}
{{ '<|im_start|>' + message.role + '\n' + message.content + '<|im_end|>' + '\n' }}
{%- elif message.role == "assistant" and not message.tool_calls %}
{{ '<|im_start|>' + message.role + '\n' }}
{%- if message.reasoning_content is defined %}
{{ '<think>\n' + message.reasoning_content + '\n</think>\n' }}
{%- endif %}
{{ message.content + '<|im_end|>' + '\n' }}
{%- elif message.role == "assistant" %}
{{ '<|im_start|>' + message.role }}
{%- if message.content %}
{{ '\n' + message.content }}
{%- endif %}
{%- for tool_call in message.tool_calls %}
{%- if tool_call.function is defined %}
{%- set tool_call = tool_call.function %}
{%- endif %}
{{ '\n<tool_call>\n{"name": "' }}
{{ tool_call.name }}
{{ '", "arguments": ' }}
{{ tool_call.arguments | tojson }}
{{ '}\n</tool_call>' }}
{%- endfor %}
{{ '<|im_end|>\n' }}
{%- elif message.role == "tool" %}
{%- if (loop.index0 == 0) or (messages[loop.index0 - 1].role != "tool") %}
{{ '<|im_start|>user' }}
{%- endif %}
{{ '\n<tool_response>\n' }}
{{ message.content }}
{{ '\n</tool_response>' }}
{%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}
{{ '<|im_end|>\n' }}
{%- endif %}
{%- endif %}
{%- endfor %}
{%- if add_generation_prompt %}
{{ '<|im_start|>assistant\n' }}
{%- endif %}
Hi,我们确认了一下,目前用的就是 base模型原始的 chat template,没有针对 VibeThinker-3B 做额外修改。VibeThinker-3B 当前只支持 thinking mode,如果你希望 llama-server 把 reasoning content 和最终回答分开展示,可以根据自己的 runtime 自行修改 template。
感谢反馈。我们的模型沿用了原始 Qwen2.5-Coder 的 chat template,原模型并非推理模型,因此模版在序列化普通 assistant 消息时只处理 message.content,没有处理 message.reasoning_content。由于我们前期主要关注单轮推理能力,因此只做了让模型支持 thinking 推理所需的最小修改,没有完整添加reasoning 历史序列化逻辑。特别是历史 assistant 对话会以独立 reasoning_content 字段传回的多轮对话场景,确实存在问题。我们会在后续优化模型多轮对话支持时修复这个问题。再次感谢您发现这个问题。
