File size: 749 Bytes
f43542c
 
 
 
 
 
 
 
 
ed8b0c6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
"""
## deepseek v3.1 解析错误,都放在了 reasoning_content 字段里了

- https://github.com/vllm-project/vllm/issues/23429
- 处理 https://github.com/vllm-project/vllm/pull/23437


"""

from transformers import AutoTokenizer

MODEL_PATH = "deepseek-ai/DeepSeek-V3.1"


tokenizer = AutoTokenizer.from_pretrained(MODEL_PATH)


messages = [
  {"role": "system", "content": "You are a bot that responds to weather queries."},
  {"role": "user", "content": "Hey, what's the temperature in Paris right now?"},
  {"role": "assistant", "content": "2"},
  {"role": "user", "content": "3"},
]

prompt = tokenizer.apply_chat_template(
    conversation=messages,
    tokenize=False,
    thinking=True,
    add_generation_prompt=True,
)

print(prompt)