Skip to content
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

Add support for HuggingFaceHub LLMs #19

Open
davidmigloz opened this issue Jun 12, 2023 · 11 comments
Open

Add support for HuggingFaceHub LLMs #19

davidmigloz opened this issue Jun 12, 2023 · 11 comments
Assignees
Labels
c:llms Models and integrations. f:good first issue Good for newcomers t:enhancement New feature or request

Comments

@davidmigloz
Copy link
Owner

The Hugging Face Hub is a platform with over 120k models, 20k datasets, and 50k demo apps (Spaces), all open source and publicly available, in an online platform where people can easily collaborate and build ML together.

https://python.langchain.com/en/latest/modules/models/llms/integrations/huggingface_hub.html

@davidmigloz davidmigloz added t:enhancement New feature or request c:llms Models and integrations. labels Jun 12, 2023
@github-project-automation github-project-automation bot moved this to 📋 Backlog in LangChain.dart Jun 12, 2023
@jtkeyva
Copy link

jtkeyva commented Feb 9, 2024

any update on this?

@davidmigloz
Copy link
Owner Author

No progress yet, unfortunately.

It should be pretty straightforward to integrate. There's already a Dart client (huggingface_dart), so it's just about implementing the LangChain.dart wrappers around it.

Happy to help if anyone wants to give it a try.

@davidmigloz davidmigloz added the f:good first issue Good for newcomers label Feb 9, 2024
@jtkeyva
Copy link

jtkeyva commented Feb 9, 2024

thanks for the update

@huzaifansari54
Copy link

hii! can i work on this task using huggingface_client: pkg i try (huggingface_dart) it is missing some api like audio and vision apis
can u assign me this task and kindly guide which pkg I should use i also mange hugging face client pkg recently i worked on it resolve some issue ,and add new text to image API

@jtkeyva
Copy link

jtkeyva commented Sep 29, 2024

@huzaifansari54 that would be great

@davidmigloz
Copy link
Owner Author

Hey @huzaifansari54,

That would be great 🙂

You can add the implementation to the langchain_huggingface package. You can check how other integrations are implemented (eg. ChatAnthropic), it should be pretty similar.

Let me know if you have any questions or issues!

@huzaifansari54
Copy link

Can suggest me docs of python or javascript of hugging face lang chain implementation it would be great 👍

@davidmigloz
Copy link
Owner Author

Let's start with the LLM integration (the Hugging Face Inference Endpoint):

In LangChain python, the wrapper is called HuggingFaceEndpoint:

In LangChain JS, the wrapper is called HuggingFaceInference:

Which name do you prefer? I would say HuggingFaceInference sounds better.

To start the implementation:

  1. Create a llm directory (langchain_huggingface/lib/src/llm)
  2. Create 3 files:
    a. huggingface_inference.dart: where the wrapper implementation will go
    b. types.dart: where to place the HuggingFaceInferenceOptions class
    c. mappers.dart: where to place all the mapping logic from the huggingface_client classes to the LangChain.dart ones.
  3. Add all the options HuggingFace supports in HuggingFaceInferenceOptions
  4. Implement the mapping logic
  5. Implement the HuggingFaceInference wrapper that calls the client with the passed options and maps the reponse to the LangChain.dart abstractions using the mappers.

You can check other integrations to have a reference.

@huzaifansari54
Copy link

huzaifansari54 commented Oct 1, 2024

thanks

@huzaifansari54
Copy link

hugging face llm is done but there is an issue in hugging_face_client pkg i resolved the issue and sent a pull request ASAP this
pull request 17 merge by owner of pkg .
also i start working on chat model support for Hugging face when it is complete i will start work on chat model for lang chain dart hugging face

@davidmigloz
Copy link
Owner Author

Great progress, thanks for the update!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c:llms Models and integrations. f:good first issue Good for newcomers t:enhancement New feature or request
Projects
Status: 📋 Backlog
Development

No branches or pull requests

3 participants