Skip to content

Add token streaming for text generation #130

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

Merged
merged 8 commits into from
Apr 7, 2023

Conversation

vvmnnnkv
Copy link
Contributor

@vvmnnnkv vvmnnnkv commented Apr 5, 2023

An attempt to fix #78 :-)

Added a separate method textGenerationStream (similar to python client).

Not using fetch-event-source because it doesn't play well with nodejs (Azure/fetch-event-source#20).
But should be easy to replace in the future.

@coyotte508
Copy link
Member

You can run pnpm -r format at the root to fix lint issues!

@coyotte508 coyotte508 requested a review from radames April 5, 2023 09:04
@julien-c
Copy link
Member

julien-c commented Apr 5, 2023

Not using fetch-event-source because it doesn't play well with nodejs (Azure/fetch-event-source#20).

Oh i missed that! We don't use it from Node in moon-landing, @SBrandeis?

Copy link
Member

@coyotte508 coyotte508 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for this PR @vvmnnnkv !

There's a big refacto request (streams => async generators), it's maybe more than you bargained for when opening the PR ^^

Copy link
Member

@coyotte508 coyotte508 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot! 🤗

cc @radames @TimMikeladze :)

@coyotte508 coyotte508 merged commit b033ad1 into huggingface:main Apr 7, 2023
@coyotte508
Copy link
Member

coyotte508 commented Apr 7, 2023

A demo is live with the feature: https://huggingface.co/spaces/huggingfacejs/streaming-text-generation

It's released in version 1.7.1.

Thanks again :)

@julien-c
Copy link
Member

nice demo!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enable token streaming for text-generation
4 participants