Skip to content

Commit f77c09b

Browse files
committed
[Frontend] supports deepseekv32 chat template
Signed-off-by: chaunceyjiang <[email protected]>
1 parent 49c8f90 commit f77c09b

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

vllm/tokenizers/deepseekv32.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@ def __hash__(self) -> int:
9393
return hash(id(self))
9494

9595
def __len__(self) -> int:
96-
return self.vocab_size
96+
# </think> is an added token in DeepseekV32 tokenizer
97+
return self.vocab_size + len(self.get_added_vocab())
9798

9899
def __call__(
99100
self,
@@ -135,12 +136,13 @@ def convert_tokens_to_string(self, tokens: list[str]) -> str:
135136
return self.tokenizer.convert_tokens_to_string(tokens)
136137

137138
def decode(self, ids: list[int] | int, skip_special_tokens: bool = False) -> str:
138-
skip_special_tokens = False
139139
return self.tokenizer.decode(ids, skip_special_tokens=skip_special_tokens)
140140

141141
def convert_ids_to_tokens(
142142
self,
143143
ids: list[int],
144144
skip_special_tokens: bool = False,
145145
) -> list[str]:
146-
return [self.decode(ids, skip_special_tokens=skip_special_tokens)]
146+
return self.tokenizer.convert_ids_to_tokens(
147+
ids, skip_special_tokens=skip_special_tokens
148+
)

0 commit comments

Comments
 (0)