Simple text streamer that prints the token(s) to stdout as soon as entire words are formed.
Kind: static class of generation/streamers
| Param | Type |
|---|---|
| tokenizer | * |
Receives tokens, decodes them, and prints them to stdout as soon as they form entire words.
Kind: instance method of TextStreamer
| Param | Type |
|---|---|
| value | Array.<Array<bigint>> |
Flushes any remaining cache and prints a newline to stdout.
Kind: instance method of TextStreamer
Prints the new text to stdout. If the stream is ending, also prints a newline.
Kind: instance method of TextStreamer
| Param | Type |
|---|---|
| text | string |
| stream_end | boolean |
Utility class to handle streaming of tokens generated by whisper speech-to-text models. Callback functions are invoked when each of the following events occur:
Kind: static class of generation/streamers
| Param | Type | Default | Description |
|---|---|---|---|
| tokenizer | * | ||
| options | Object | ||
| [options.skip_prompt] | boolean | false | Whether to skip the prompt tokens |
| [options.callback_function] | function | | Function to call when a piece of text is ready to display |
| [options.token_callback_function] | function | | Function to call when a new token is generated |
| [options.on_chunk_start] | function | | Function to call when a new chunk starts |
| [options.on_chunk_end] | function | | Function to call when a chunk ends |
| [options.on_finalize] | function | | Function to call when the stream is finalized |
| [options.time_precision] | number | 0.02 | Precision of the timestamps |
| [options.skip_special_tokens] | boolean | true | Whether to skip special tokens when decoding |
| [options.decode_kwargs] | Object | {} | Additional keyword arguments to pass to the tokenizer's decode method |
Kind: instance method of WhisperTextStreamer
| Param | Type |
|---|---|
| value | Array.<Array<bigint>> |