mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-07 20:15:40 +00:00
add tqdm to embeddings (#7205)
for longer running embeddings, can be helpful to visualize
This commit is contained in:
parent
6fc24743b7
commit
7b585c7585
@ -298,7 +298,13 @@ class OpenAIEmbeddings(BaseModel, Embeddings):
|
|||||||
|
|
||||||
batched_embeddings = []
|
batched_embeddings = []
|
||||||
_chunk_size = chunk_size or self.chunk_size
|
_chunk_size = chunk_size or self.chunk_size
|
||||||
for i in range(0, len(tokens), _chunk_size):
|
try:
|
||||||
|
import tqdm
|
||||||
|
|
||||||
|
_iter = tqdm.tqdm(range(0, len(tokens), _chunk_size))
|
||||||
|
except ImportError:
|
||||||
|
_iter = range(0, len(tokens), _chunk_size)
|
||||||
|
for i in _iter:
|
||||||
response = embed_with_retry(
|
response = embed_with_retry(
|
||||||
self,
|
self,
|
||||||
input=tokens[i : i + _chunk_size],
|
input=tokens[i : i + _chunk_size],
|
||||||
|
Loading…
Reference in New Issue
Block a user