The agent engineering platform.
Python agentsaiai-agentsanthropicchatgptdeepagentsenterpriseframeworkgeminigenerative-ailangchainlanggraphllmmultiagentopen-sourceopenaipydanticpythonragtypescript
community[patch]: Add Progress bar to HuggingFaceEmbeddings (#16758)
Tyler Titsworth304f3f5fc151
diff --git a/libs/community/langchain_community/embeddings/huggingface.py b/libs/community/langchain_community/embeddings/huggingface.pyindex 068aafa1fe..60f4ecb443 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()