core.inference.text_generation_server.dynamic_text_gen_server.incremental_detokenizer#
Incremental detokenization for OpenAI-compatible streaming responses.
Module Contents#
Classes#
Incrementally decode generated tokens with a Hugging Face fast tokenizer. |
Data#
API#
- core.inference.text_generation_server.dynamic_text_gen_server.incremental_detokenizer.logger#
‘getLogger(…)’
- core.inference.text_generation_server.dynamic_text_gen_server.incremental_detokenizer._INVALID_PREFIX_ERROR#
‘Invalid prefix encountered’
- class core.inference.text_generation_server.dynamic_text_gen_server.incremental_detokenizer.HuggingFaceFastIncrementalDetokenizer(
- tokenizer: Any,
- prompt_token_ids: list[int],
Incrementally decode generated tokens with a Hugging Face fast tokenizer.
This implementation follows vLLM’s prompt-prefilled
DecodeStreamdesign. Streaming support is intentionally limited to Hugging Face fast tokenizers until equivalent incremental decoders exist for the other tokenizer backends.Initialization
- _new_decode_stream(prompt_token_ids: list[int] | None = None)#
- update(token_ids: list[int]) str#
Decode token IDs and return only newly stable text.
- _decode_next(token_id: int) str#
- property text: str#
Return all text emitted by the incremental decoder.
- property text_length: int#
Return the number of emitted characters.