I'm trying to do the following simple code:
from transformers import pipeline
import langchain
from langchain.llms import HuggingFacePipeline
model_name = "bert-base-uncased"
task = "question-answering"
hf_pipeline = pipeline(task, model=model_name)
langchain_pipeline = HuggingFacePipeline(hf_pipeline)
I get the following error:
TypeError: Serializable.__init__() takes 1 positional argument but 2 were given
langchain_pipeline = HuggingFacePipeline(hf_pipeline)
Haven't found anything online that actually helped me here
I'm using Databricks with the following cluster:
Here's the code example
# from transformers import pipeline
# import langchain
from langchain_community.llms import HuggingFacePipeline
model_name = "bert-base-uncased"
# task = "question-answering"
task = "text-generation"
# hf_pipeline = pipeline(task, model=model_name)
langchain_pipeline = HuggingFacePipeline.from_model_id(
model_name,
task,
)
And only ('text2text-generation', 'text-generation', 'summarization') are supported
HuggingFacePipeline
doc for reference > https://python.langchain.com/docs/integrations/llms/huggingface_pipelines