lewtun HF Staff commited on
Commit
ae30ece
·
verified ·
1 Parent(s): 18f68fa

Normalize eukaryote_cls schema and metadata

Browse files
README.md CHANGED
@@ -56,6 +56,28 @@ dataset_info:
56
  num_examples: 2600
57
  download_size: 4880581
58
  dataset_size: 6130755
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
  - config_name: binary_600
60
  features:
61
  - name: id
@@ -284,6 +306,8 @@ headline score is needed.
284
  | `mcq_prokaryote` | 165 | MCQ `3_species_cls` questions whose target organism is prokaryotic. |
285
  | `eukaryote_cls` | 1,000 | Auxiliary four-option eukaryotic taxonomy set stored separately from the original 5,200-example benchmark. |
286
 
 
 
287
  The `binary_600` and `mcq_600` configurations were sampled without replacement using seed 42 from source revision
288
  `a71ab7e0e72b8eca7acd4475744dccd0159b20be`. The 100 selected examples from each subtask were then combined and
289
  shuffled so the rows are not stored in subtask blocks. These subsets are balanced by task family, but not necessarily
@@ -330,3 +354,14 @@ eukaryote_mcq = load_dataset("HuggingFaceBio/genomeqa", "mcq_eukaryote", split="
330
  year={2026}
331
  }
332
  ```
 
 
 
 
 
 
 
 
 
 
 
 
56
  num_examples: 2600
57
  download_size: 4880581
58
  dataset_size: 6130755
59
+ - config_name: eukaryote_cls
60
+ features:
61
+ - name: id
62
+ dtype: int64
63
+ - name: subtask
64
+ dtype: string
65
+ - name: question
66
+ dtype: string
67
+ - name: options
68
+ list: string
69
+ - name: answer_index
70
+ dtype: int64
71
+ - name: answer_text
72
+ dtype: string
73
+ - name: metadata
74
+ dtype: string
75
+ splits:
76
+ - name: train
77
+ num_bytes: 21610676
78
+ num_examples: 1000
79
+ download_size: 16997912
80
+ dataset_size: 21610676
81
  - config_name: binary_600
82
  features:
83
  - name: id
 
306
  | `mcq_prokaryote` | 165 | MCQ `3_species_cls` questions whose target organism is prokaryotic. |
307
  | `eukaryote_cls` | 1,000 | Auxiliary four-option eukaryotic taxonomy set stored separately from the original 5,200-example benchmark. |
308
 
309
+ The `eukaryote_cls` configuration uses the `mcq` feature schema, including JSON-serialized `metadata`.
310
+
311
  The `binary_600` and `mcq_600` configurations were sampled without replacement using seed 42 from source revision
312
  `a71ab7e0e72b8eca7acd4475744dccd0159b20be`. The 100 selected examples from each subtask were then combined and
313
  shuffled so the rows are not stored in subtask blocks. These subsets are balanced by task family, but not necessarily
 
354
  year={2026}
355
  }
356
  ```
357
+
358
+ ## Reproducing
359
+
360
+ To rebuild and publish the normalized `eukaryote_cls` configuration from the pinned source revision, run:
361
+
362
+ ```bash
363
+ python scripts/create_eukaryote_cls.py --source-revision 18f68fabbcd43e8c227869a833027c969b39d7fe --output-dataset HuggingFaceBio/genomeqa --publish
364
+ ```
365
+
366
+ The script preserves the source rows, converts `metadata` from Python dictionary strings to JSON, and casts the
367
+ columns to the `mcq` feature schema. It publishes the Parquet file, this card, and the builder script in one commit.
mcq/eukaryote_cls_mcq.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:1f7f97e1f9e83b0a1af9bfe3543fd5ae8cabd0fb8147931b1aa7a8a95ae53c91
3
- size 9839351
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:594ad54b23e4998896a11b99da23e8392cdeb483c6af648d0389b8c2f96d23e7
3
+ size 16997912
scripts/create_eukaryote_cls.py ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Normalize the GenomeQA eukaryote_cls configuration to the mcq schema."""
2
+
3
+ import argparse
4
+ import ast
5
+ import json
6
+ from pathlib import Path
7
+
8
+ from datasets import load_dataset
9
+ from huggingface_hub import CommitOperationAdd, HfApi, hf_hub_download
10
+
11
+
12
+ DATASET_ID = "HuggingFaceBio/genomeqa"
13
+ PARQUET_PATH = "mcq/eukaryote_cls_mcq.parquet"
14
+
15
+
16
+ def main() -> None:
17
+ parser = argparse.ArgumentParser()
18
+ parser.add_argument("--source-revision", required=True)
19
+ parser.add_argument("--output-dataset", default=DATASET_ID)
20
+ parser.add_argument("--output-dir", type=Path, default=Path.cwd())
21
+ parser.add_argument("--publish", action="store_true")
22
+ args = parser.parse_args()
23
+
24
+ reference = load_dataset(DATASET_ID, "mcq", split="train", revision=args.source_revision)
25
+ source = load_dataset(DATASET_ID, "eukaryote_cls", split="train", revision=args.source_revision)
26
+ normalized = source.map(lambda row: {"metadata": json.dumps(ast.literal_eval(row["metadata"]))})
27
+ normalized = normalized.cast(reference.features)
28
+
29
+ parquet_path = args.output_dir / PARQUET_PATH
30
+ parquet_path.parent.mkdir(parents=True, exist_ok=True)
31
+ normalized.to_parquet(parquet_path)
32
+
33
+ api = HfApi()
34
+ head = api.repo_info(args.output_dataset, repo_type="dataset").sha
35
+ card = Path(hf_hub_download(args.output_dataset, "README.md", repo_type="dataset", revision=head)).read_text()
36
+ if "- config_name: eukaryote_cls\n features:" not in card:
37
+ info = f"""- config_name: eukaryote_cls
38
+ features:
39
+ - name: id
40
+ dtype: int64
41
+ - name: subtask
42
+ dtype: string
43
+ - name: question
44
+ dtype: string
45
+ - name: options
46
+ list: string
47
+ - name: answer_index
48
+ dtype: int64
49
+ - name: answer_text
50
+ dtype: string
51
+ - name: metadata
52
+ dtype: string
53
+ splits:
54
+ - name: train
55
+ num_bytes: {normalized.data.nbytes}
56
+ num_examples: {len(normalized)}
57
+ download_size: {parquet_path.stat().st_size}
58
+ dataset_size: {normalized.data.nbytes}
59
+ """
60
+ card = card.replace("- config_name: binary_600\n", info + "- config_name: binary_600\n", 1)
61
+
62
+ if "The `eukaryote_cls` configuration uses the `mcq` feature schema" not in card:
63
+ note = "The `eukaryote_cls` configuration uses the `mcq` feature schema, including JSON-serialized `metadata`.\n\n"
64
+ card = card.replace("The `binary_600` and `mcq_600` configurations", note + "The `binary_600` and `mcq_600` configurations", 1)
65
+
66
+ if "scripts/create_eukaryote_cls.py" not in card:
67
+ card += f"""
68
+ ## Reproducing
69
+
70
+ To rebuild and publish the normalized `eukaryote_cls` configuration from the pinned source revision, run:
71
+
72
+ ```bash
73
+ python scripts/create_eukaryote_cls.py --source-revision {args.source_revision} --output-dataset {args.output_dataset} --publish
74
+ ```
75
+
76
+ The script preserves the source rows, converts `metadata` from Python dictionary strings to JSON, and casts the
77
+ columns to the `mcq` feature schema. It publishes the Parquet file, this card, and the builder script in one commit.
78
+ """
79
+
80
+ card_path = args.output_dir / "README.md"
81
+ card_path.write_text(card)
82
+ print(f"Prepared {len(normalized)} rows at {parquet_path}")
83
+ if args.publish:
84
+ commit = api.create_commit(
85
+ repo_id=args.output_dataset,
86
+ repo_type="dataset",
87
+ parent_commit=head,
88
+ commit_message="Normalize eukaryote_cls schema and metadata",
89
+ operations=[
90
+ CommitOperationAdd(path_in_repo=PARQUET_PATH, path_or_fileobj=parquet_path),
91
+ CommitOperationAdd(path_in_repo="README.md", path_or_fileobj=card_path),
92
+ CommitOperationAdd(path_in_repo="scripts/create_eukaryote_cls.py", path_or_fileobj=__file__),
93
+ ],
94
+ )
95
+ print(f"Published {commit.commit_url}")
96
+
97
+
98
+ if __name__ == "__main__":
99
+ main()