Langchain-huggingface

marky2376
Fri, 14 Jun 2024 15:09:32 +0000

Hello, the langchain x huggingface framework seems perfect for what my team is trying to accomplish.

I installed langchain-huggingface with pip3 in a venv and following this guide, Hugging Face x LangChain : A new partner package I created a module like this but with a llma3 model:

from langchain_huggingface import HuggingFacePipeline

llm = HuggingFacePipeline.from_model_id(
    model_id="microsoft/Phi-3-mini-4k-instruct",
    task="text-generation",
    pipeline_kwargs={
        "max_new_tokens": 100,
        "top_k": 50,
        "temperature": 0.1,
    },
)
llm.invoke("Hugging Face is")

I get the following error when I try to run the script:

ModuleNotFoundError: No module named ‘langchain_huggingface’

I must be missing something or doing something very basic wrong.