lewtun HF Staff commited on
Commit
e766a5e
·
verified ·
1 Parent(s): d557d78

Remove the SFT and RL build scripts

Browse files
rl/scripts/create_dataset.py DELETED
@@ -1,62 +0,0 @@
1
- # /// script
2
- # dependencies = ["datasets>=4", "huggingface_hub"]
3
- # ///
4
- """Build FineDNA-RL from the Carbon-X GRPO prompt blend.
5
-
6
- The blend is a single subset with weight 1.0, so the trainer's mixture loader shuffles it twice with the mixture seed
7
- (once per subset, once after concatenation). This script does the same and labels each row with the domain of its
8
- `task_group`, so the published split holds the rows the trainer sees, in the same order.
9
-
10
- python scripts/create_dataset.py --output_dataset HuggingFaceBio/FineDNA-RL
11
- """
12
-
13
- import argparse
14
-
15
- from datasets import load_dataset
16
- from huggingface_hub import HfApi
17
-
18
-
19
- SEED = 0
20
- SOURCE = "HuggingFaceBio/Rollouts-Carbon-14B-SFT-v36.52-step-000019119"
21
- SOURCE_CONFIG = "blend_all_v0"
22
- SOURCE_REVISION = "205d8b22b8e29a364b8922eb3dc96728cb6f65d7"
23
- COLUMNS = ["prompt", "answer_text", "task_group", "task_type", "verifier_metadata", "gold_answer_json"]
24
- DOMAINS = {
25
- "basic_dna": "dna_computation",
26
- "dna_skills": "dna_computation",
27
- "seqrecqa_position": "dna_computation",
28
- "bioreason": "variant_effect_prediction",
29
- "vepqa": "variant_effect_prediction",
30
- "genomeqa": "sequence_classification",
31
- "bio_mcq": "biology_qa",
32
- "if": "instruction_following",
33
- }
34
-
35
-
36
- def build_dataset():
37
- ds = load_dataset(SOURCE, SOURCE_CONFIG, split="train", revision=SOURCE_REVISION).select_columns(COLUMNS)
38
- ds = ds.add_column("domain", [DOMAINS[group] for group in ds["task_group"]])
39
- return ds.shuffle(seed=SEED).shuffle(seed=SEED)
40
-
41
-
42
- def main():
43
- parser = argparse.ArgumentParser()
44
- parser.add_argument("--output_dataset", default="HuggingFaceBio/FineDNA-RL")
45
- args = parser.parse_args()
46
-
47
- dataset = build_dataset()
48
- print(dataset)
49
- dataset.push_to_hub(
50
- args.output_dataset, split="train", private=True, commit_message="Build FineDNA-RL from the Carbon-X GRPO blend"
51
- )
52
- HfApi().upload_file(
53
- path_or_fileobj=__file__,
54
- path_in_repo="scripts/create_dataset.py",
55
- repo_id=args.output_dataset,
56
- repo_type="dataset",
57
- commit_message="Publish the script that built this dataset",
58
- )
59
-
60
-
61
- if __name__ == "__main__":
62
- main()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
sft/scripts/create_dataset.py DELETED
@@ -1,76 +0,0 @@
1
- # /// script
2
- # dependencies = ["datasets>=4", "huggingface_hub"]
3
- # ///
4
- """Build FineDNA-SFT from the Carbon-X SFT data mixture.
5
-
6
- Each source subset is shuffled with the mixture seed and truncated to `int(len * weight)` rows, labelled with its
7
- domain, then all subsets are concatenated, shuffled again and split into train and a 100-row test set. This matches
8
- the SFT trainer's mixture loader exactly, so the published splits are the rows the trainer sees.
9
-
10
- python scripts/create_dataset.py --output_dataset HuggingFaceBio/FineDNA-SFT
11
- """
12
-
13
- import argparse
14
-
15
- from datasets import concatenate_datasets, load_dataset
16
- from huggingface_hub import HfApi
17
-
18
-
19
- SEED = 0
20
- TEST_SIZE = 100
21
- COLUMNS = ["messages", "chat_template_kwargs"]
22
- SUFFIX = "_decontaminated_ngram_dna_homology"
23
-
24
- # (dataset, config, revision, weight, domain), in mixture order
25
- SOURCES = [
26
- ("HuggingFaceBio/sequence-recovery-qa", "varlen", "e09cae720c1635c4764704a7bf355e2c8c8c6e55", 1.0, "sequence_continuation"),
27
- ("HuggingFaceBio/sequence-recovery-qa", "rewrite", "e09cae720c1635c4764704a7bf355e2c8c8c6e55", 0.1266728, "dna_computation"),
28
- ("HuggingFaceBio/carbon-format-if", "format_if_v2", "390592d0bbc099447235854bc9e6017361622fb3", 1.0, "instruction_following"),
29
- ("HuggingFaceBio/basic-dna-sft-data-v3", "all_diversify_30pct", "72dc7e731ff5de0ef4295c58ebaa3cffde488128", 0.151, "dna_computation"),
30
- ("HuggingFaceBio/carbon-sequence-contextfree-v8-regex-10k", "final", "5f17e938d75a7ca96305c5ad17c2e9b4a6fac764", 0.3, "sequence_analysis"),
31
- ("HuggingFaceBio/carbon-gemini-repair-sft", "default", "63cccfc7ddcdf5241d2adafc904e051160b8f18c", 0.3, "sequence_analysis"),
32
- ("HuggingFaceBio/carbon-sequence-contextfree-v6-1000", "final", "e279241716d0c36e1ffd299d619530e10e8ed120", 1.0, "sequence_analysis"),
33
- ("HuggingFaceBio/carbon-bioSE-sft", "final", "31dc6d39e35c125771de2f83ad11d64df367e9b4", 1.0, "biology_qa"),
34
- ("HuggingFaceBio/carbon-biostars-sft-v2", "final", "5014a6b616fcb564fd95a9978aad708e66179ee7", 1.0, "biology_qa"),
35
- ("HuggingFaceBio/wild-bio-prompts-luna-generated-verified-v1", "final", "35440c49a65a87d878125c95188748b6f8496e23", 1.0, "biology_qa"),
36
- ("HuggingFaceBio/seqqa2-luna-sft-structurednotags-dna8-clean-v3", "final", "38644f1f3b82d1d311aaf061ca5aa1754f3a5b5f", 1.0, "dna_computation"),
37
- ("HuggingFaceBio/genomeqa-sft", "enhancer_promoter_diversify_10pct", "398703a5938ed57eb51450ac8769590d0a00ee0c", 0.4, "sequence_classification"),
38
- ("HuggingFaceBio/genomeqa-sft", "eukaryote_cls_diversify_10pct", "398703a5938ed57eb51450ac8769590d0a00ee0c", 0.4, "sequence_classification"),
39
- ("HuggingFaceBio/genomeqa-sft", "tf_motif_diversify_10pct", "398703a5938ed57eb51450ac8769590d0a00ee0c", 0.4, "sequence_classification"),
40
- ("HuggingFaceBio/genomeqa-sft", "tfbs_diversify_10pct", "398703a5938ed57eb51450ac8769590d0a00ee0c", 0.4, "sequence_classification"),
41
- ("HuggingFaceBio/vepqa-sft-draft-loubna", "templated_reasoning_multiview_v2_all", "76e39513e6823db1da2c92c79620923daa78cbdc", 0.769, "variant_effect_prediction"),
42
- ("HuggingFaceBio/nemotron-data-filtered-carbon", "biology_en_max8704", "50df980c19caeaef9bfbcc22438410c886d29cb0", 0.1, "biology_qa"),
43
- ("HuggingFaceBio/nemotron-data-filtered-carbon", "instruction_following_bio_en_max8704", "50df980c19caeaef9bfbcc22438410c886d29cb0", 1.0, "instruction_following"),
44
- ("HuggingFaceBio/easy-dna-chat-v2", "all", "53923d9a68170203f0210b746143d9d28cf739d2", 0.7442, "chat"),
45
- ("HuggingFaceBio/carbon-dna-skills", "all", "d703e0cd6f933f7d872b074a7c45e5c673a6d52f", 0.8, "dna_computation"),
46
- ]
47
-
48
-
49
- def build_dataset():
50
- subsets = []
51
- for dataset_id, config, revision, weight, domain in SOURCES:
52
- ds = load_dataset(dataset_id, config + SUFFIX, split="train", revision=revision).select_columns(COLUMNS)
53
- ds = ds.add_column("domain", [domain] * len(ds))
54
- subsets.append(ds.shuffle(seed=SEED).select(range(int(len(ds) * weight))))
55
- return concatenate_datasets(subsets).shuffle(seed=SEED).train_test_split(test_size=TEST_SIZE, seed=SEED)
56
-
57
-
58
- def main():
59
- parser = argparse.ArgumentParser()
60
- parser.add_argument("--output_dataset", default="HuggingFaceBio/FineDNA-SFT")
61
- args = parser.parse_args()
62
-
63
- dataset = build_dataset()
64
- print(dataset)
65
- dataset.push_to_hub(args.output_dataset, private=True, commit_message="Build FineDNA-SFT from the Carbon-X SFT mixture")
66
- HfApi().upload_file(
67
- path_or_fileobj=__file__,
68
- path_in_repo="scripts/create_dataset.py",
69
- repo_id=args.output_dataset,
70
- repo_type="dataset",
71
- commit_message="Publish the script that built this dataset",
72
- )
73
-
74
-
75
- if __name__ == "__main__":
76
- main()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
sft/scripts/create_subset.py DELETED
@@ -1,52 +0,0 @@
1
- # /// script
2
- # dependencies = ["datasets>=4", "huggingface_hub"]
3
- # ///
4
- """Add one config per domain to FineDNA-SFT.
5
-
6
- Each config holds the `train` rows of the `default` config with that `domain`, in the same order, so it is exactly the
7
- part of the Carbon-X SFT mixture that the trainer sees for that domain. The domain configs have no test split.
8
-
9
- python scripts/create_subset.py --dataset HuggingFaceBio/FineDNA-SFT --revision 60b6e0d5c9af34bd97de521cc2cf5fb3e977771c
10
- """
11
-
12
- import argparse
13
-
14
- from datasets import load_dataset
15
- from huggingface_hub import HfApi
16
-
17
-
18
- # Largest first, which is the order of the configs in the card
19
- DOMAINS = [
20
- "sequence_continuation",
21
- "variant_effect_prediction",
22
- "dna_computation",
23
- "sequence_classification",
24
- "chat",
25
- "sequence_analysis",
26
- "instruction_following",
27
- "biology_qa",
28
- ]
29
-
30
-
31
- def main():
32
- parser = argparse.ArgumentParser()
33
- parser.add_argument("--dataset", default="HuggingFaceBio/FineDNA-SFT")
34
- parser.add_argument("--revision", required=True, help="Revision of the `default` config to split by domain")
35
- args = parser.parse_args()
36
-
37
- dataset = load_dataset(args.dataset, split="train", revision=args.revision)
38
- for domain in DOMAINS:
39
- subset = dataset.filter(lambda x: x == domain, input_columns="domain")
40
- print(f"{domain}: {len(subset)} rows")
41
- subset.push_to_hub(args.dataset, config_name=domain, split="train", commit_message=f"Add the {domain} config")
42
- HfApi().upload_file(
43
- path_or_fileobj=__file__,
44
- path_in_repo="scripts/create_subset.py",
45
- repo_id=args.dataset,
46
- repo_type="dataset",
47
- commit_message="Publish the script that built the domain configs",
48
- )
49
-
50
-
51
- if __name__ == "__main__":
52
- main()