Add option to skip db in evals
This commit is contained in:
parent
842e166041
commit
9a859c6ee5
2 changed files with 11 additions and 6 deletions
|
|
@ -263,24 +263,22 @@ async def run_qa_benchmark(
|
||||||
|
|
||||||
async def evaluate_dataset(
|
async def evaluate_dataset(
|
||||||
spec: DatasetSpec,
|
spec: DatasetSpec,
|
||||||
|
skip_db: bool,
|
||||||
skip_retrieval: bool,
|
skip_retrieval: bool,
|
||||||
skip_qa: bool,
|
skip_qa: bool,
|
||||||
qa_limit: int | None,
|
qa_limit: int | None,
|
||||||
) -> None:
|
) -> None:
|
||||||
|
if not skip_db:
|
||||||
console.print(f"Using dataset: {spec.key}", style="bold magenta")
|
console.print(f"Using dataset: {spec.key}", style="bold magenta")
|
||||||
await populate_db(spec)
|
await populate_db(spec)
|
||||||
|
|
||||||
if not skip_retrieval:
|
if not skip_retrieval:
|
||||||
console.print("Running retrieval benchmarks...", style="bold blue")
|
console.print("Running retrieval benchmarks...", style="bold blue")
|
||||||
await run_retrieval_benchmark(spec)
|
await run_retrieval_benchmark(spec)
|
||||||
else:
|
|
||||||
console.print("Skipping retrieval benchmark by request.")
|
|
||||||
|
|
||||||
if not skip_qa:
|
if not skip_qa:
|
||||||
console.print("\nRunning QA benchmarks...", style="bold yellow")
|
console.print("\nRunning QA benchmarks...", style="bold yellow")
|
||||||
await run_qa_benchmark(spec, qa_limit=qa_limit)
|
await run_qa_benchmark(spec, qa_limit=qa_limit)
|
||||||
else:
|
|
||||||
console.print("Skipping QA benchmark by request.")
|
|
||||||
|
|
||||||
|
|
||||||
app = typer.Typer(help="Run retrieval and QA benchmarks for configured datasets.")
|
app = typer.Typer(help="Run retrieval and QA benchmarks for configured datasets.")
|
||||||
|
|
@ -289,6 +287,9 @@ app = typer.Typer(help="Run retrieval and QA benchmarks for configured datasets.
|
||||||
@app.command()
|
@app.command()
|
||||||
def run(
|
def run(
|
||||||
dataset: str = typer.Argument(..., help="Dataset key to evaluate."),
|
dataset: str = typer.Argument(..., help="Dataset key to evaluate."),
|
||||||
|
skip_db: bool = typer.Option(
|
||||||
|
False, "--skip-db", help="Skip updateing the evaluation db."
|
||||||
|
),
|
||||||
skip_retrieval: bool = typer.Option(
|
skip_retrieval: bool = typer.Option(
|
||||||
False, "--skip-retrieval", help="Skip retrieval benchmark."
|
False, "--skip-retrieval", help="Skip retrieval benchmark."
|
||||||
),
|
),
|
||||||
|
|
@ -307,6 +308,7 @@ def run(
|
||||||
asyncio.run(
|
asyncio.run(
|
||||||
evaluate_dataset(
|
evaluate_dataset(
|
||||||
spec=spec,
|
spec=spec,
|
||||||
|
skip_db=skip_db,
|
||||||
skip_retrieval=skip_retrieval,
|
skip_retrieval=skip_retrieval,
|
||||||
skip_qa=skip_qa,
|
skip_qa=skip_qa,
|
||||||
qa_limit=qa_limit,
|
qa_limit=qa_limit,
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
import os
|
||||||
|
|
||||||
from haiku.rag.config import Config
|
from haiku.rag.config import Config
|
||||||
from haiku.rag.reranking.base import RerankerBase
|
from haiku.rag.reranking.base import RerankerBase
|
||||||
|
|
||||||
|
|
@ -17,6 +19,7 @@ def get_reranker() -> RerankerBase | None:
|
||||||
try:
|
try:
|
||||||
from haiku.rag.reranking.mxbai import MxBAIReranker
|
from haiku.rag.reranking.mxbai import MxBAIReranker
|
||||||
|
|
||||||
|
os.environ["TOKENIZERS_PARALLELISM"] = "true"
|
||||||
_reranker = MxBAIReranker()
|
_reranker = MxBAIReranker()
|
||||||
return _reranker
|
return _reranker
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue