Streaming support?
gduteaud opened this issue · comments
Feature request
Add support for streaming generated outputs. This appears to be supported in the transformers library: https://huggingface.co/docs/transformers/v4.38.2/en/generation_strategies#streaming
Motivation
Because outputs take a certain time to generate, it is desirable from a user experience standpoint to be able to display outputs "live" as they are being generated, as opposed to waiting until generation is completed before displaying the output.
Your contribution
I really wish I could but unfortunately this is well beyond my ability to implement.
You can use the callback_function
generation parameter. For example:
transformers.js/examples/demo-site/src/worker.js
Lines 161 to 175 in 314b7f0
🤯 oh wow that's amazing, thank you!!
In typescript, the options give an error if you have callback_function
in options.