Upload benchmarks/text2sql/benchmark_text2sql.py with huggingface_hub
Browse files
benchmarks/text2sql/benchmark_text2sql.py
CHANGED
|
@@ -339,6 +339,17 @@ async def main():
|
|
| 339 |
db_filter = [args.db] if args.db else None
|
| 340 |
questions = benchmark.load_questions(data_path, db_filter)
|
| 341 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 342 |
print_header("QAFD-RAG Text2SQL Benchmark")
|
| 343 |
print_config({
|
| 344 |
"Benchmark": args.benchmark,
|
|
|
|
| 339 |
db_filter = [args.db] if args.db else None
|
| 340 |
questions = benchmark.load_questions(data_path, db_filter)
|
| 341 |
|
| 342 |
+
# Auto-detect benchmark: if --db is set but found 0 questions, try the other benchmark
|
| 343 |
+
if db_filter and len(questions) == 0:
|
| 344 |
+
other = "bird" if args.benchmark == "spider2-lite" else "spider2-lite"
|
| 345 |
+
other_path = str(jsonl_files[other])
|
| 346 |
+
if os.path.exists(other_path):
|
| 347 |
+
other_questions = benchmark.load_questions(other_path, db_filter)
|
| 348 |
+
if other_questions:
|
| 349 |
+
args.benchmark = other
|
| 350 |
+
data_path = other_path
|
| 351 |
+
questions = other_questions
|
| 352 |
+
|
| 353 |
print_header("QAFD-RAG Text2SQL Benchmark")
|
| 354 |
print_config({
|
| 355 |
"Benchmark": args.benchmark,
|