Download registry.py from DaisyChainAI/Daisychain-Genomics-Demo: direct link, hf CLI and curl.
- Browser
- Download file 2.55 kB
-
https://huggingface.co/spaces/DaisyChainAI/Daisychain-Genomics-Demo/resolve/0568a46486ca7c4e8537306046f894b185873a6b/registry.py
- Command line
-
hf download hf://spaces/DaisyChainAI/Daisychain-Genomics-Demo@0568a46486ca7c4e8537306046f894b185873a6b/registry.py
-
curl -L -o registry.py https://huggingface.co/spaces/DaisyChainAI/Daisychain-Genomics-Demo/resolve/0568a46486ca7c4e8537306046f894b185873a6b/registry.py
2.55 kB
| """ | |
| registry.py -- SINGLE SOURCE OF TRUTH for the GENOMIC specialists. | |
| The Carbon analogue of agents/modmind/registry.py. Each entry is one mini | |
| specialist trained on PURE domain data from HuggingFaceBio/carbon-pretraining-corpus | |
| (the same corpus the 500M / 3B / 8B Carbon models were pretrained on). | |
| The pitch: 4 dense ~80M DNA/RNA specialists (~320M total) + a zero-param | |
| orchestrator < Carbon-500M on parameter count, while keeping per-domain | |
| specialization crisp (one model never sees another domain's bases). | |
| All specialists share ONE tokenizer (genomics/tokenizer.json), a Carbon-style | |
| 6-mer + single-base "length-max" vocab, so their latents live in the same space | |
| and the RecursiveLink bridge / orchestrator can compare them directly. | |
| To add a domain: add ONE entry here, then | |
| python genomics/build_tokenizer.py # (only once; shared vocab) | |
| python genomics/train_specialist.py --domain <name> | |
| """ | |
| # Carbon corpus subsets -> mini specialists. | |
| # `config` : the dataset config (subset) name on the Hub | |
| # `field` : which column holds the sequence string (eukaryote uses `sequence`, | |
| # the evo2 subsets use `text`) | |
| # `molecule`: DNA or RNA -- metadata only (same ACGT/ACGU vocab, U folded to T) | |
| # `position`: chain slot (context-doubling order in the V2 config) | |
| DATASET = "HuggingFaceBio/carbon-pretraining-corpus" | |
| SPECIALISTS = { | |
| "eukaryote": dict(config="eukaryote_generator_10B_subset", field="sequence", | |
| molecule="DNA", vocab=4105, position=0), | |
| "prokaryote": dict(config="prokaryote_evo2", field="text", | |
| molecule="DNA", vocab=4105, position=1), | |
| "mrna": dict(config="mrna_evo2", field="text", | |
| molecule="RNA", vocab=4105, position=2), | |
| "mrna_splice": dict(config="mrna_splice_evo2", field="text", | |
| molecule="RNA", vocab=4105, position=3), | |
| } | |
| # The specialists we are actively training (the genomic "foundation" set). | |
| ACTIVE = ["eukaryote", "prokaryote", "mrna", "mrna_splice"] | |
| def spec(name): | |
| if name not in SPECIALISTS: | |
| raise KeyError(f"unknown genomic specialist {name!r}; add it to " | |
| f"registry.SPECIALISTS. known: {list(SPECIALISTS)}") | |
| return SPECIALISTS[name] | |
| def text_of(name_or_spec, ex): | |
| """Extract the raw sequence string from a streamed example.""" | |
| s = name_or_spec if isinstance(name_or_spec, dict) else spec(name_or_spec) | |
| return ex.get(s["field"], "") or "" | |