Skip to content

Commit d3c1d97

Browse files
authored
disable progress bar by default (#363)
#362 TLDR: TQDM progress bars are annoying when shown every time you embed something. The default should be to turn these off for embedding calls. Not all packages use tqdm and instead a logger. I don't think redisvl should be in charge of setting loglevel and that should be developer configured but we can make a better base decision.
1 parent 04736f1 commit d3c1d97

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

redisvl/utils/vectorize/text/huggingface.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,10 @@ def _embed(self, text: str, **kwargs) -> List[float]:
128128
if not isinstance(text, str):
129129
raise TypeError("Must pass in a str value to embed.")
130130

131+
if "show_progress_bar" not in kwargs:
132+
# disable annoying tqdm by default
133+
kwargs["show_progress_bar"] = False
134+
131135
embedding = self._client.encode([text], **kwargs)[0]
132136
return embedding.tolist()
133137

@@ -151,6 +155,9 @@ def _embed_many(
151155
raise TypeError("Must pass in a list of str values to embed.")
152156
if len(texts) > 0 and not isinstance(texts[0], str):
153157
raise TypeError("Must pass in a list of str values to embed.")
158+
if "show_progress_bar" not in kwargs:
159+
# disable annoying tqdm by default
160+
kwargs["show_progress_bar"] = False
154161

155162
embeddings: List = []
156163
for batch in self.batchify(texts, batch_size, None):

0 commit comments

Comments
 (0)