The asyncio.as_completed() function does not guarantee that the results are ordered

This commit is contained in:
billvsme
2024-12-13 15:42:41 +08:00
parent b7552f35aa
commit cf0278ca43
2 changed files with 2 additions and 2 deletions

View File

@@ -59,7 +59,7 @@ class MilvusVectorDBStorge(BaseVectorStorage):
embedding_tasks = [self.embedding_func(batch) for batch in batches] embedding_tasks = [self.embedding_func(batch) for batch in batches]
embeddings_list = [] embeddings_list = []
for f in tqdm_async( for f in tqdm_async(
asyncio.as_completed(embedding_tasks), await asyncio.gather(*embedding_tasks),
total=len(embedding_tasks), total=len(embedding_tasks),
desc="Generating embeddings", desc="Generating embeddings",
unit="batch", unit="batch",

View File

@@ -99,7 +99,7 @@ class NanoVectorDBStorage(BaseVectorStorage):
embedding_tasks = [self.embedding_func(batch) for batch in batches] embedding_tasks = [self.embedding_func(batch) for batch in batches]
embeddings_list = [] embeddings_list = []
for f in tqdm_async( for f in tqdm_async(
asyncio.as_completed(embedding_tasks), await asyncio.gather(*embedding_tasks),
total=len(embedding_tasks), total=len(embedding_tasks),
desc="Generating embeddings", desc="Generating embeddings",
unit="batch", unit="batch",