-
Notifications
You must be signed in to change notification settings - Fork 16k
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
feat(llms): support more tasks in HuggingFaceHub LLM and remove deprecated dep #14406
Merged
Merged
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
eee7e29
feat(llms): upgrade huggingface-hub llms, supporting more tasks
mspronesti de21c08
fmt
mspronesti 302a258
fix error message formatting
mspronesti dc02497
move to community
mspronesti 60958d6
fix imports after migration
mspronesti 5007601
Merge branch 'master' into feat/llm-hfhub
mspronesti f74d73f
Merge branch 'master' into feat/llm-hfhub
mspronesti File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Here I would use the task-specific methods instead of
client.post
directly. For the record,client.post(...)
is what's used internally by the client to make the calls. It is perfectly valid to use it but you also have higher-level method -likeclient.text_generation(...)
- that are more appropriate to handle inputs and outputs correctly. See supported tasks and their documentation on this page.So instead of those two lines, I would suggest something like
Inputs and outputs may vary depending on the selected task. It would also avoid the logic
if isinstance(response, list): ... else: ...
below that might be error prone.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.
Hi @Wauplin, thanks for your precious feedback! I had a look at the
InferenceClient
implementation in hf-hub, but I couldn't find any method handling 'text2text-generation'. This task is still supported bypost
though.Does this porting to the newer higher-level API look good to you?
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 good to me yes! It should be more robust as well. Thanks for making the change :)
About
text2text-generation
, we are trying to deprecate it in favor oftext-generation
(for harmonization) cc @osanseviero. I think that usingself.client.text_generation
should be fine but would be best to test it first. According to the docs, the API should be the same (see here).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.
The API is the same, but the underlying pipelines in
transformers
are different (one isencoder-decoder
while the other isdecoder
-only), so not sure they would work out of the box.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.
@hwchase17 @baskaryan Any thoughts/suggestions on this?