community: fix HuggingFacePipeline pipeline_kwargs (#19920)

Fix handling of pipeline_kwargs to prioritize class attribute defaults.

#19770

Co-authored-by: jaizo <manuel.jaiczay@polygons.at>
Co-authored-by: Isaac Francisco <78627776+isahers1@users.noreply.github.com>
This commit is contained in:
Manuel Jaiczay 2024-08-23 00:29:46 +02:00 committed by GitHub
parent 4b63a217c2
commit 1c31234eed
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -261,7 +261,10 @@ class HuggingFacePipeline(BaseLLM):
) -> LLMResult:
# List to hold all results
text_generations: List[str] = []
pipeline_kwargs = kwargs.get("pipeline_kwargs", {})
default_pipeline_kwargs = self.pipeline_kwargs if self.pipeline_kwargs else {}
pipeline_kwargs = kwargs.get("pipeline_kwargs", default_pipeline_kwargs)
skip_prompt = kwargs.get("skip_prompt", False)
for i in range(0, len(prompts), self.batch_size):