langchain icon indicating copy to clipboard operation
langchain copied to clipboard

Calling HuggingFacePipeline using TextGenerationPipeline results in an error.

Open if001 opened this issue 1 year ago • 0 comments

when I call langchain.llms.HuggingFacePipeline class using transformers.TextGenerationPipeline class, raise bellow error.

https://github.com/hwchase17/langchain/blob/master/langchain/llms/huggingface_pipeline.py#L157

pipe = TextGenerationPipeline(model=model, tokenizer=tokenizer)
hf = HuggingFacePipeline(pipeline=pipe)

Is this behavior expected?

I may call method that is not recommended. Calling it as pipeline("text-generation", ... ) as in example works fine.

This happens because self.model.task is not set in transformers.TextGenerationPipeline class.

if001 avatar Mar 06 '23 10:03 if001