diff --git a/libs/community/langchain_community/embeddings/huggingface.py b/libs/community/langchain_community/embeddings/huggingface.py index 068aafa1fe1..60f4ecb4435 100644 --- a/libs/community/langchain_community/embeddings/huggingface.py +++ b/libs/community/langchain_community/embeddings/huggingface.py @@ -49,6 +49,8 @@ class HuggingFaceEmbeddings(BaseModel, Embeddings): """Keyword arguments to pass when calling the `encode` method of the model.""" multi_process: bool = False """Run encode() on multiple GPUs.""" + show_progress: bool = False + """Whether to show a progress bar.""" def __init__(self, **kwargs: Any): """Initialize the sentence_transformer.""" @@ -88,7 +90,9 @@ class HuggingFaceEmbeddings(BaseModel, Embeddings): embeddings = self.client.encode_multi_process(texts, pool) sentence_transformers.SentenceTransformer.stop_multi_process_pool(pool) else: - embeddings = self.client.encode(texts, **self.encode_kwargs) + embeddings = self.client.encode( + texts, show_progress_bar=self.show_progress, **self.encode_kwargs + ) return embeddings.tolist()