Add --max_documents
Browse files
src/passage_entity/benchmark_runner.py
CHANGED
|
@@ -403,6 +403,8 @@ def main():
|
|
| 403 |
# Indexing
|
| 404 |
parser.add_argument("--force_index", action="store_true")
|
| 405 |
parser.add_argument("--force_openie", action="store_true")
|
|
|
|
|
|
|
| 406 |
|
| 407 |
# QAFD
|
| 408 |
parser.add_argument("--qafd_alpha", type=float, default=1.5)
|
|
@@ -585,6 +587,9 @@ def main():
|
|
| 585 |
with open(corpus_path) as f:
|
| 586 |
corpus = json.load(f)
|
| 587 |
docs = [f"{d['title']}\n{d['text']}" for d in corpus]
|
|
|
|
|
|
|
|
|
|
| 588 |
|
| 589 |
logger.info(f"Loading questions from {questions_path}")
|
| 590 |
with open(questions_path) as f:
|
|
|
|
| 403 |
# Indexing
|
| 404 |
parser.add_argument("--force_index", action="store_true")
|
| 405 |
parser.add_argument("--force_openie", action="store_true")
|
| 406 |
+
parser.add_argument("--max_documents", type=int, default=None,
|
| 407 |
+
help="Max documents for KG building (default: all)")
|
| 408 |
|
| 409 |
# QAFD
|
| 410 |
parser.add_argument("--qafd_alpha", type=float, default=1.5)
|
|
|
|
| 587 |
with open(corpus_path) as f:
|
| 588 |
corpus = json.load(f)
|
| 589 |
docs = [f"{d['title']}\n{d['text']}" for d in corpus]
|
| 590 |
+
if args.max_documents and args.max_documents < len(docs):
|
| 591 |
+
docs = docs[:args.max_documents]
|
| 592 |
+
logger.info(f"Limited to {args.max_documents} documents for KG building")
|
| 593 |
|
| 594 |
logger.info(f"Loading questions from {questions_path}")
|
| 595 |
with open(questions_path) as f:
|