Skip to content

vllm.tokenizers

Modules:

Functions:

  • get_tokenizer –

    Gets a tokenizer for the given model name via HuggingFace or ModelScope.

  • maybe_make_thread_pool –

    If tokenizer is a TokenizersBackend, 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.

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.