Reja1 Claude Opus 4.6 commited on
Commit
dd48820
Β·
1 Parent(s): f782ff0

Move metadata.jsonl to repo root for HuggingFace image resolution

Browse files

HuggingFace resolves image paths relative to the metadata file's
directory. With metadata.jsonl in data/, image paths like
"images/NEET_2024_T3/..." resolved to "data/images/..." which
doesn't exist, causing FileNotFoundError in the dataset viewer.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

.gitattributes CHANGED
@@ -1,4 +1,4 @@
1
  images/** filter=lfs diff=lfs merge=lfs -text
2
- data/metadata.jsonl filter=lfs diff=lfs merge=lfs -text
3
  images/**/*.png filter=lfs diff=lfs merge=lfs -text
4
  *.tar.gz filter=lfs diff=lfs merge=lfs -text
 
1
  images/** filter=lfs diff=lfs merge=lfs -text
2
+ metadata.jsonl filter=lfs diff=lfs merge=lfs -text
3
  images/**/*.png filter=lfs diff=lfs merge=lfs -text
4
  *.tar.gz filter=lfs diff=lfs merge=lfs -text
CLAUDE.md CHANGED
@@ -40,8 +40,8 @@ python src/llm_interface.py # API calls (requires .env and network)
40
  ```
41
  benchmark_runner.py ─── orchestrator / entry point
42
  β”œβ”€β”€ loads config from configs/benchmark_config.yaml
43
- β”œβ”€β”€ loads dataset directly from data/metadata.jsonl (JSONL β†’ HuggingFace Dataset)
44
- β”‚ β”œβ”€β”€ data/metadata.jsonl (question metadata, 578 questions)
45
  β”‚ └── images/ (question PNGs, stored in Git LFS)
46
  β”œβ”€β”€ calls llm_interface.py for each question
47
  β”‚ β”œβ”€β”€ prompts.py (prompt templates)
@@ -55,7 +55,7 @@ benchmark_runner.py ─── orchestrator / entry point
55
 
56
  ### Key data flow
57
 
58
- 1. Dataset loaded directly from `data/metadata.jsonl` into a HuggingFace `Dataset` object, filtered by exam/year
59
  2. Each question image is base64-encoded and sent to OpenRouter with a structured prompt
60
  3. If the response can't be parsed, a re-prompt is sent (text-only, with the bad response)
61
  4. If the API call fails, the question is queued for retry (up to 3 attempts, exponential backoff via `tenacity`)
@@ -71,7 +71,7 @@ benchmark_runner.py ─── orchestrator / entry point
71
 
72
  ## Important Notes
73
 
74
- - **Git LFS**: Images and `data/metadata.jsonl` are in LFS. Run `git lfs pull` after cloning.
75
  - **Working directory**: Scripts must be run from project root β€” config, data, and image paths are resolved relative to cwd.
76
  - **Python 3.10+**: Uses union type syntax (`list[str] | str | None`).
77
  - **Models**: Configured in `configs/benchmark_config.yaml` under `openrouter_models`. All must support vision input.
 
40
  ```
41
  benchmark_runner.py ─── orchestrator / entry point
42
  β”œβ”€β”€ loads config from configs/benchmark_config.yaml
43
+ β”œβ”€β”€ loads dataset directly from metadata.jsonl (JSONL β†’ HuggingFace Dataset)
44
+ β”‚ β”œβ”€β”€ metadata.jsonl (question metadata, 578 questions)
45
  β”‚ └── images/ (question PNGs, stored in Git LFS)
46
  β”œβ”€β”€ calls llm_interface.py for each question
47
  β”‚ β”œβ”€β”€ prompts.py (prompt templates)
 
55
 
56
  ### Key data flow
57
 
58
+ 1. Dataset loaded directly from `metadata.jsonl` into a HuggingFace `Dataset` object, filtered by exam/year
59
  2. Each question image is base64-encoded and sent to OpenRouter with a structured prompt
60
  3. If the response can't be parsed, a re-prompt is sent (text-only, with the bad response)
61
  4. If the API call fails, the question is queued for retry (up to 3 attempts, exponential backoff via `tenacity`)
 
71
 
72
  ## Important Notes
73
 
74
+ - **Git LFS**: Images and `metadata.jsonl` are in LFS. Run `git lfs pull` after cloning.
75
  - **Working directory**: Scripts must be run from project root β€” config, data, and image paths are resolved relative to cwd.
76
  - **Python 3.10+**: Uses union type syntax (`list[str] | str | None`).
77
  - **Models**: Configured in `configs/benchmark_config.yaml` under `openrouter_models`. All must support vision input.
README.md CHANGED
@@ -19,7 +19,7 @@ configs:
19
  - config_name: default
20
  data_files:
21
  - split: test
22
- path: data/metadata.jsonl
23
  dataset_info:
24
  features:
25
  - name: image
@@ -241,7 +241,7 @@ The benchmark implements authentic scoring systems for each exam type:
241
 
242
  ## Dataset Structure
243
 
244
- * **`data/metadata.jsonl`**: Contains metadata for each question image with fields:
245
  - `image`: Path to the question image
246
  - `question_id`: Unique identifier (e.g., "N24T3001")
247
  - `exam_name`: Exam type ("NEET", "JEE_MAIN", "JEE_ADVANCED")
 
19
  - config_name: default
20
  data_files:
21
  - split: test
22
+ path: metadata.jsonl
23
  dataset_info:
24
  features:
25
  - name: image
 
241
 
242
  ## Dataset Structure
243
 
244
+ * **`metadata.jsonl`**: Contains metadata for each question image with fields:
245
  - `image`: Path to the question image
246
  - `question_id`: Unique identifier (e.g., "N24T3001")
247
  - `exam_name`: Exam type ("NEET", "JEE_MAIN", "JEE_ADVANCED")
configs/benchmark_config.yaml CHANGED
@@ -15,7 +15,7 @@ openrouter_models:
15
  # - "anthropic/claude-3-haiku"
16
 
17
  # Path to the metadata JSONL file and base directory for image paths.
18
- metadata_path: "data/metadata.jsonl"
19
  images_base_dir: "."
20
 
21
  # Base directory where results for each model will be saved.
 
15
  # - "anthropic/claude-3-haiku"
16
 
17
  # Path to the metadata JSONL file and base directory for image paths.
18
+ metadata_path: "metadata.jsonl"
19
  images_base_dir: "."
20
 
21
  # Base directory where results for each model will be saved.
data/metadata.jsonl β†’ metadata.jsonl RENAMED
File without changes
src/benchmark_runner.py CHANGED
@@ -476,7 +476,7 @@ def run_benchmark(
476
  os.makedirs(base_output_dir, exist_ok=True)
477
 
478
  # Load dataset directly from metadata.jsonl and images/
479
- metadata_path = config.get("metadata_path", "data/metadata.jsonl")
480
  images_base_dir = config.get("images_base_dir", ".")
481
  try:
482
  records = []
@@ -501,7 +501,7 @@ def run_benchmark(
501
  logging.info(f"Dataset loaded successfully from {metadata_path}. Original number of questions: {len(dataset)}")
502
  except Exception as e:
503
  logging.error(f"Failed to load dataset from '{metadata_path}': {e}")
504
- logging.error("Ensure 'data/metadata.jsonl' exists and image paths are valid.")
505
  return
506
 
507
  # Filter dataset based on choices
@@ -736,7 +736,7 @@ if __name__ == "__main__":
736
  # Assuming benchmark_config.yaml is in a 'configs' directory relative to script or a fixed path
737
  # Assuming metadata.jsonl is in a 'data' directory relative to script or a fixed path
738
  default_config_path = "configs/benchmark_config.yaml"
739
- default_metadata_path = "data/metadata.jsonl"
740
 
741
  available_models = get_available_models(default_config_path)
742
  available_exam_names, available_exam_years = get_available_exam_details(default_metadata_path)
 
476
  os.makedirs(base_output_dir, exist_ok=True)
477
 
478
  # Load dataset directly from metadata.jsonl and images/
479
+ metadata_path = config.get("metadata_path", "metadata.jsonl")
480
  images_base_dir = config.get("images_base_dir", ".")
481
  try:
482
  records = []
 
501
  logging.info(f"Dataset loaded successfully from {metadata_path}. Original number of questions: {len(dataset)}")
502
  except Exception as e:
503
  logging.error(f"Failed to load dataset from '{metadata_path}': {e}")
504
+ logging.error("Ensure 'metadata.jsonl' exists and image paths are valid.")
505
  return
506
 
507
  # Filter dataset based on choices
 
736
  # Assuming benchmark_config.yaml is in a 'configs' directory relative to script or a fixed path
737
  # Assuming metadata.jsonl is in a 'data' directory relative to script or a fixed path
738
  default_config_path = "configs/benchmark_config.yaml"
739
+ default_metadata_path = "metadata.jsonl"
740
 
741
  available_models = get_available_models(default_config_path)
742
  available_exam_names, available_exam_years = get_available_exam_details(default_metadata_path)