-
-
Notifications
You must be signed in to change notification settings - Fork 325
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
Updated Hugging Face chat and magics processing with new APIs, clients #784
Conversation
(1) The API has changed and uses the HuggingFaceClient class instead of HuggingFaceHub, which is deprecated. (2) InferenceClient replaces InferenceAPI (3) Removed legacy code that does not work with the new APIs/
for more information, see https://pre-commit.ci
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.
Left a comment below, but didn't complete a full review.
We should try to preserve the image generation capability when this provider is used in magics. Dropping that feature, although minor, would constitute a breaking change. I'm looking into the options available to us to support this.
Added logic to branch to one of text-gen or text-to-image tasks based on the type of response received.
for more information, see https://pre-commit.ci
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.
Verified with images.ipynb
in the examples directory of the code. Thanks!
Used a different approach to check for task type
…into change_HF_client
for more information, see https://pre-commit.ci
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.
Awesome work @srdas!
Note: this PR will not be backported to 1.x as JupyterLab 3 reached end-of-maintenance yesterday. See #761. |
the overridden method is no longer overriding allowed task list since jupyterlab#784 but is only breaking streaming - it can be removed
the overridden method is no longer overriding allowed task list since jupyterlab#784 but is only breaking streaming - it can be removed
the overridden method is no longer overriding allowed task list since #784 but is only breaking streaming - it can be removed
jupyterlab#784) * Updated HF chat processing (1) The API has changed and uses the HuggingFaceClient class instead of HuggingFaceHub, which is deprecated. (2) InferenceClient replaces InferenceAPI (3) Removed legacy code that does not work with the new APIs/ * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Handle text gen and text_to_image tasks Added logic to branch to one of text-gen or text-to-image tasks based on the type of response received. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Reworking conditional branching for text vs image Used a different approach to check for task type * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
the overridden method is no longer overriding allowed task list since jupyterlab#784 but is only breaking streaming - it can be removed
Fixes #772
(1) The API has changed and uses the
HuggingFaceEndpoint
class instead ofHuggingFaceHub
, which is deprecated.(2)
InferenceClient
replacesInferenceAPI
(3) Removed legacy code that does not work with the new APIs
(4) Added logic to detect the
task
from the response type and handle text or images as needed.References to the new
langchain
source for the new classes and APIs:Test Example:
Use the
mistral
modelChat question: