Download scripts/r5_vlma/make_draft_mix.py from treoa/turkic-ocr-code: direct link, hf CLI and curl.
- Browser
- Download file 1.84 kB
-
https://huggingface.co/treoa/turkic-ocr-code/resolve/main/scripts/r5_vlma/make_draft_mix.py
- Command line
-
hf download hf://treoa/turkic-ocr-code/scripts/r5_vlma/make_draft_mix.py
-
curl -L -o make_draft_mix.py https://huggingface.co/treoa/turkic-ocr-code/resolve/main/scripts/r5_vlma/make_draft_mix.py
1.84 kB
| """R5 VLMA: a DRAFT mix yaml for a dry run of build_sequence.py on the real manifests. NOT the frozen mix_v1.yaml | |
| (written separately). Shares from records/R5/DATA/mix_v1_shares.json effective_shares, with the | |
| change of 2026-11-20 ~23:40 UTC (typed_real 6% from print_real_train.tsv, typed_synth 6%). | |
| usage: make_draft_mix.py MANIFEST_DIR OUT_YAML | |
| """ | |
| import hashlib | |
| import os | |
| import sys | |
| import yaml | |
| mdir, out = sys.argv[1:3] | |
| def sha(p): | |
| h = hashlib.sha256() | |
| with open(p, "rb") as f: | |
| for b in iter(lambda: f.read(1 << 20), b""): | |
| h.update(b) | |
| return h.hexdigest() | |
| def leaf(name, share=None, **flt): | |
| p = os.path.join(mdir, name + ".tsv") | |
| d = {"name": name if not flt else name + "_" + "_".join(str(v) for v in flt.values()), "manifest": p, "sha256": sha(p)} | |
| if share is not None: | |
| d["share"] = share | |
| if flt: | |
| d["filter"] = flt | |
| return d | |
| cyr = ["kk", "ky", "uz_cyrl", "tt", "ba", "sah"] | |
| lat = ["uz_latn", "tr", "az", "tk"] | |
| mix = {"draft_note": "VLMA dry-run draft, not the frozen mix", "mix": {"groups": [ | |
| dict(leaf("kohtd_train"), name="hand_real_kk", share=0.35), | |
| {"name": "hand_real_other_cyrillic", "share": 0.15, "members": [leaf("hkr_train"), leaf("chd_train"), leaf("school_train")]}, | |
| {"name": "hand_synth", "share": 0.35, "members": [leaf("synth_hand_train", 0.03, lang=l) for l in cyr] + | |
| [leaf("synth_hand_train", 0.0425, lang=l) for l in lat]}, | |
| {"name": "typed_synth", "share": 0.06, "members": [leaf("synth_typed_train", lang=l) for l in cyr + lat]}, | |
| dict(leaf("print_real_train"), name="typed_real", share=0.06), | |
| dict(leaf("synth_clutter_train"), name="clutter", share=0.03), | |
| ]}} | |
| yaml.safe_dump(mix, open(out, "w"), allow_unicode=True, sort_keys=False) | |
| print("draft written", out) | |