mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-23 07:09:31 +00:00
huggingface: handle image-text-to-text pipeline task (#31611)
**Description:** Allows for HuggingFacePipeline to handle image-text-to-text pipeline
This commit is contained in:
parent
50f998a138
commit
cecfec5efa
@ -23,6 +23,7 @@ DEFAULT_TASK = "text-generation"
|
||||
VALID_TASKS = (
|
||||
"text2text-generation",
|
||||
"text-generation",
|
||||
"image-text-to-text",
|
||||
"summarization",
|
||||
"translation",
|
||||
)
|
||||
@ -38,8 +39,8 @@ class HuggingFacePipeline(BaseLLM):
|
||||
|
||||
To use, you should have the ``transformers`` python package installed.
|
||||
|
||||
Only supports `text-generation`, `text2text-generation`, `summarization` and
|
||||
`translation` for now.
|
||||
Only supports `text-generation`, `text2text-generation`, `image-text-to-text`,
|
||||
`summarization` and `translation` for now.
|
||||
|
||||
Example using from_model_id:
|
||||
.. code-block:: python
|
||||
@ -327,6 +328,8 @@ class HuggingFacePipeline(BaseLLM):
|
||||
text = response["generated_text"]
|
||||
elif self.pipeline.task == "text2text-generation":
|
||||
text = response["generated_text"]
|
||||
elif self.pipeline.task == "image-text-to-text":
|
||||
text = response["generated_text"]
|
||||
elif self.pipeline.task == "summarization":
|
||||
text = response["summary_text"]
|
||||
elif self.pipeline.task in "translation":
|
||||
|
Loading…
Reference in New Issue
Block a user