File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff 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+ )
You can’t perform that action at this time.
0 commit comments