💡 All-in-one AI framework for semantic search, LLM orchestration and language model workflows
Python agentsaiai-agentsembeddingsinformation-retrievallanguage-modellarge-language-modelsllmnlppythonragretrieval-augmented-generationsearchsearch-enginesemantic-searchsentence-embeddingstransformerstxtaivector-databasevector-search
Track indexing progress in benchmark script
davidmezzetticd784436efc6
diff --git a/examples/benchmarks.py b/examples/benchmarks.pyindex 506efd17..fc48bb2f 100644--- a/examples/benchmarks.py+++ b/examples/benchmarks.py@@ -23,6 +23,7 @@ from elasticsearch import Elasticsearchfrom elasticsearch.helpers import bulkfrom pytrec_eval import RelevanceEvaluatorfrom rank_bm25 import BM25Okapi+from tqdm.auto import tqdmfrom txtai.embeddings import Embeddingsfrom txtai.pipeline import LLM, RAG, Tokenizer@@ -111,8 +112,16 @@ class Index:Iterates over the dataset yielding a row at a time for indexing."""- with open(f"{self.path}/corpus.jsonl", encoding="utf-8") as f:- for line in f:+ # Data file+ path = f"{self.path}/corpus.jsonl"++ # Get total count+ with open(path, encoding="utf-8") as f:+ total = sum(1 for _ in f)++ # Yield data+ with open(path, encoding="utf-8") as f:+ for line in tqdm(f, total=total):row = json.loads(line)text = f'{row["title"]}. {row["text"]}' if row.get("title") else row["text"]if text: