vllm.tokenizers ¶
Modules:
-
deepseek_v32– -
deepseek_v4– -
deepseek_v4_encoding–DeepSeek-V4 Encoding
-
detokenizer_utils– -
fastokens–fastokensbackend patch. -
hf– -
kimi_audio–Tokenizer for Kimi-Audio using TikToken.
-
mistral– -
registry–
Functions:
-
get_tokenizer–Gets a tokenizer for the given model name via HuggingFace or ModelScope.
-
maybe_make_thread_pool–If
tokenizeris aTokenizersBackend, modify the tokenizer
get_tokenizer(tokenizer_name, *args, tokenizer_cls=TokenizerLike, trust_remote_code=False, revision=None, download_dir=None, **kwargs) ¶
Gets a tokenizer for the given model name via HuggingFace or ModelScope.
Source code in vllm/tokenizers/registry.py
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 | |
maybe_make_thread_pool(tokenizer, copies=1) ¶
If tokenizer is a TokenizersBackend, modify the tokenizer in-place to make the public interface thread-safe by routing calls through a deep-copied tokenizer pool.
Note that: - Only TokenizerLike's public interface is thread-safe. This doesn't include _tokenizer property nor any mutation methods like add_special_tokens or add_tokens. - Adjacent method calls could happen on different deep copies.