TextIteratorStreamer & generate graceful interruption#29536
TextIteratorStreamer & generate graceful interruption#29536paulcjh wants to merge 2 commits intohuggingface:mainfrom
TextIteratorStreamer & generate graceful interruption#29536Conversation
|
FYI: it looks like you're including a lot of changes to generation/utils.py that are just formatting changes. I'm guessing this sort of thing is discouraged since it makes it difficult to identify the substantive changes you are proposing, and also is likely to cause merge conflicts for others. Concretely: I was curious to see what changes you had made in utils.py, but between the formatting changes and collapsing all of your work into a single commit, your substantive changes in that file are a needle in a haystack. |
|
@dmarx just removed all of the cleanup - the changes in |
|
@gante do you have any thoughts on this feature? |
|
This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread. Please note that issues that do not follow the contributing guidelines are likely to be ignored. |
What does this PR do?
This PR adds in functionality to stop the
generatefunction for LLMs when used in conjunction with a streamer. TheTextIteratorStreamertypically runs in a separate thread , per the example provided in its docstring, and if you need to terminate the generation there's currently no way to do this. This makes operating the models in an API environment challenging when things such as client disconnects occur.note: the file was also formatted with black, happy to remove and just keep the new interruption changes
Before submitting
Pull Request section?
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.
@gante