vllm.tokenizers ¶
Modules:
-
deepseek_v32– -
deepseek_v4– -
deepseek_v41– -
deepseek_v41_encoding–Text encoding adapted from the DeepSeek V4.1 reference encoder.
-
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
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 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 | |
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.