-
Notifications
You must be signed in to change notification settings - Fork 27.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement AsyncTextIteratorStreamer for asynchronous streaming #34931
Conversation
Was missing autodoc entry. |
@gante @ArthurZucker Ready for review. The |
@ArthurZucker @gante ping |
@ArthurZucker ping with sugar on top? Seems @gante is on holiday, anyone else who can review? |
Gentle ping @gante, or maybe @zucchini-nlp if I haven't totally overloaded her with pings at this point! |
@Rocketknight1 Thanks! BTW, know what's up with |
@CISC that's usually a code style thing. Try |
@Rocketknight1 It's not, it's complaining about the import order in |
@CISC |
@Rocketknight1 Sure, I changed the file, but I didn't change the sort order, it should already be sorted! :P |
Sorry @CISC reviewing! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks marvelous sorry for being so late. I actually wanted to wait because we added huggingface/tokenizers#1678 a decode stream api in tokenizers
that fixes some issues with prefix space, but the changes are for another PR and for the base Text streamer! 🤗 cc @gante
Do you want us to fix the CIs for you? I can push directlyu |
Yes please, thank you. :) |
thanks @CISC 🤗 |
Asynchronous text generation streaming
Added a new
AsyncTextIteratorStreamer
class that allows you to have fully asynchronous text generation streaming in your application. Works identically toTextIteratorStreamer
except that you iterate the stream as follows:Requires Python 3.11+ due to use ofFalls back toasyncio.timeout
to handle timeout.asyncio.wait_for
ifasyncio.timeout
is not available.Before submitting
Pull Request section?
to it if that's the case.
documentation guidelines, and
here are tips on formatting docstrings.
Any hints on how best to implement an async test would be appreciated. :)pytest-asyncio seems to be the way to go...Who can review?
@gante @ArthurZucker