Add a progress bar

This commit is contained in:
Larfii
2024-11-25 15:04:38 +08:00
parent 123811d651
commit 8562ecdebc
3 changed files with 57 additions and 21 deletions

View File

@@ -1,5 +1,6 @@
import asyncio
import os
from tqdm.asyncio import tqdm as tqdm_async
from dataclasses import asdict, dataclass, field
from datetime import datetime
from functools import partial
@@ -243,7 +244,9 @@ class LightRAG:
logger.info(f"[New Docs] inserting {len(new_docs)} docs")
inserting_chunks = {}
for doc_key, doc in new_docs.items():
for doc_key, doc in tqdm_async(
new_docs.items(), desc="Chunking documents", unit="doc"
):
chunks = {
compute_mdhash_id(dp["content"], prefix="chunk-"): {
**dp,