Leon4gr45 commited on
Commit
d83de18
·
verified ·
1 Parent(s): 836d996

Delete benchmarks/search/config.py

Browse files
Files changed (1) hide show
  1. benchmarks/search/config.py +0 -96
benchmarks/search/config.py DELETED
@@ -1,96 +0,0 @@
1
- from __future__ import annotations
2
-
3
- import os
4
- from dataclasses import dataclass
5
- from pathlib import Path
6
-
7
- from dotenv import load_dotenv
8
-
9
- BENCHMARKS_ROOT = Path(__file__).resolve().parent.parent
10
- DATA_DIR = BENCHMARKS_ROOT / "data"
11
- RUNS_DIR = BENCHMARKS_ROOT / "runs"
12
- DEFAULT_DATASET_PATH = DATA_DIR / "search_toy.jsonl"
13
- DEFAULT_BRAIN_ID = "searchbenchsmoke"
14
- REQUIRED_PREFIX = "searchbench"
15
- FORBIDDEN_BRAINS = frozenset(
16
- {
17
- "beam1m1clean",
18
- "demorecsys",
19
- "locomoconv26",
20
- "locomoconv26clean",
21
- "locomoconv26nostorm",
22
- }
23
- )
24
- FORBIDDEN_PREFIXES = (
25
- "beam",
26
- "demorecsys",
27
- "lme",
28
- "locomoconv",
29
- "longmemeval",
30
- )
31
- FROZEN_STRUCTURED_BRAINS = frozenset(
32
- {
33
- "searchbenchwands",
34
- "searchbenchesci74",
35
- "searchbenchescies",
36
- "searchbenchesciltr2",
37
- }
38
- )
39
- TERMINAL_TASK_STATUSES = frozenset({"completed", "failed", "partial_failed"})
40
-
41
-
42
- def validate_brain_id(brain_id: str) -> str:
43
- bid = (brain_id or "").strip()
44
- if not bid:
45
- raise SystemExit("brain_id is required.")
46
- lowered = bid.lower()
47
- forbidden = {item.lower() for item in FORBIDDEN_BRAINS}
48
- if lowered in forbidden or lowered.startswith(FORBIDDEN_PREFIXES):
49
- raise SystemExit(
50
- f"Refusing brain_id={bid!r}. Use a dedicated searchbench* brain "
51
- f"(default {DEFAULT_BRAIN_ID}). Never wipe eval memory or recsys brains."
52
- )
53
- if not lowered.startswith(REQUIRED_PREFIX):
54
- raise SystemExit(
55
- f"Refusing brain_id={bid!r}. Search eval brains must start with "
56
- f"{REQUIRED_PREFIX!r} (default {DEFAULT_BRAIN_ID})."
57
- )
58
- return bid
59
-
60
-
61
- @dataclass
62
- class Settings:
63
- brainapi_url: str
64
- brainpat_token: str
65
- dataset_path: Path
66
- runs_dir: Path
67
- brain_id: str
68
-
69
- @classmethod
70
- def load(cls, env_file: Path | None = None) -> "Settings":
71
- if env_file is None:
72
- env_file = BENCHMARKS_ROOT / ".env"
73
- if env_file.exists():
74
- load_dotenv(env_file, override=False)
75
- else:
76
- load_dotenv(override=False)
77
-
78
- brain_id = validate_brain_id(
79
- os.getenv("SEARCH_BRAIN_ID", DEFAULT_BRAIN_ID) or DEFAULT_BRAIN_ID
80
- )
81
- return cls(
82
- brainapi_url=os.getenv("BRAINAPI_URL", "http://localhost:8000").rstrip("/"),
83
- brainpat_token=os.getenv("BRAINPAT_TOKEN", ""),
84
- dataset_path=Path(
85
- os.getenv("SEARCH_DATASET_PATH", str(DEFAULT_DATASET_PATH))
86
- ),
87
- runs_dir=Path(os.getenv("BENCH_RUNS_DIR", str(RUNS_DIR))),
88
- brain_id=brain_id,
89
- )
90
-
91
- def require_brainapi(self) -> None:
92
- if not self.brainpat_token:
93
- raise SystemExit(
94
- "BRAINPAT_TOKEN is required. Copy benchmarks/.env.example to "
95
- "benchmarks/.env and set it."
96
- )