Datasets:
Download code/scripts_seqroute/add_licenses.py from divy123/sequential-router-v2: direct link, hf CLI and curl.
- Browser
- Download file 3.72 kB
-
https://huggingface.co/datasets/divy123/sequential-router-v2/resolve/main/code/scripts_seqroute/add_licenses.py
- Command line
-
hf download hf://datasets/divy123/sequential-router-v2/code/scripts_seqroute/add_licenses.py
-
curl -L -o add_licenses.py https://huggingface.co/datasets/divy123/sequential-router-v2/resolve/main/code/scripts_seqroute/add_licenses.py
3.72 kB
| """Attach source repo / license / release tier to the query tables (idempotent) and write manifests/source_licenses.json.""" | |
| import json, os | |
| import pandas as pd | |
| ROOT = "/mnt/localssd/seqroute1m" | |
| L = { # source_dataset (prefix match) -> (repo, license, note) | |
| "gsm8k": ("openai/gsm8k", "mit", ""), "hendrycks_math": ("EleutherAI/hendrycks_math", "mit", ""), "mmlu_pro": ("TIGER-Lab/MMLU-Pro", "mit", ""), "mmlu_pro_stem": ("TIGER-Lab/MMLU-Pro", "mit", ""), | |
| "supergpqa": ("m-a-p/SuperGPQA", "odc-by", ""), "arc_challenge": ("allenai/ai2_arc", "cc-by-sa-4.0", ""), "bbh": ("lukaemon/bbh", "mit", "upstream BIG-Bench Hard (Suzgun et al.), MIT; hub card has no license tag"), | |
| "commonsenseqa": ("tau/commonsense_qa", "mit", ""), "humaneval": ("openai/openai_humaneval", "mit", ""), "mbpp": ("Muennighoff/mbpp", "cc-by-4.0", ""), "apps": ("likaixin/APPS-verified", "unspecified", "upstream APPS is MIT; the verified subset has no license tag"), | |
| "humanevalfix": ("bigcode/humanevalpack", "mit", ""), "mbpp_mutants": ("Muennighoff/mbpp", "cc-by-4.0", "programmatically mutated MBPP solutions (derived work)"), | |
| "cnn_dailymail": ("abisee/cnn_dailymail", "apache-2.0", "underlying articles are CNN / Daily Mail content"), "xsum": ("EdinburghNLP/xsum", "unknown", "BBC articles; research use"), | |
| "asset": ("facebook/asset", "cc-by-sa-4.0", "hub tag; check upstream terms (ASSET paper release)"), "wmt14": ("wmt/wmt14", "unknown", "WMT shared-task data; research use"), | |
| "conll2003": ("tomaarsen/conll2003", "other", "Reuters RCV1-derived; research agreement"), "ade_corpus_v2": ("ade-benchmark-corpus/ade_corpus_v2", "unknown", ""), | |
| "ag_news": ("fancyzhx/ag_news", "unknown", "academic, non-commercial use per source"), "emotion": ("dair-ai/emotion", "other", ""), "sst5": ("SetFit/sst5", "unknown", "Stanford Sentiment Treebank; research use"), | |
| "trec": ("CogComp/trec", "unknown", ""), "e2e_nlg": ("tuetschek/e2e_nlg", "cc-by-sa-4.0", ""), "ifeval": ("google/IFEval", "apache-2.0", ""), | |
| "ifeval_synth_norobots": ("HuggingFaceH4/no_robots", "cc-by-nc-4.0", "base prompts from No Robots (CC-BY-NC-4.0) + IFEval-style constraints generated with the IFEval instruction classes"), | |
| "longbench": ("zai-org/LongBench", "mit", "aggregates qasper / multifieldqa / hotpotqa / 2wikimqa / musique / narrativeqa, each with its own license"), | |
| "drop": ("ucinlp/drop", "cc-by-sa-4.0", ""), "squad_v2": ("rajpurkar/squad_v2", "cc-by-sa-4.0", ""), "tabfact": ("wenhu/tab_fact", "cc-by-4.0", ""), | |
| "blocksworld_synth": ("generated", "cc0-1.0", "generated by src/llmroute/seqroute/synth.py"), "hanoi_synth": ("generated", "cc0-1.0", "generated"), "sudoku_synth": ("generated", "cc0-1.0", "generated"), | |
| "mgsm": ("juletxara/mgsm", "cc-by-sa-4.0", ""), "global_mmlu_lite": ("CohereLabs/Global-MMLU-Lite", "apache-2.0", ""), | |
| } | |
| def look(s): | |
| if s in L: return L[s] | |
| for k in sorted(L, key=len, reverse=True): | |
| if s.startswith(k): return L[k] | |
| raise KeyError(s) | |
| def tier(lic): | |
| if lic in ("mit", "apache-2.0", "cc-by-4.0", "cc-by-sa-4.0", "odc-by", "cc0-1.0"): return "permissive_open" | |
| if "nc" in lic: return "noncommercial" | |
| return "restricted_or_unspecified" | |
| for f in ("master_queries.parquet", "queries_20k.parquet"): | |
| p = f"{ROOT}/queries/{f}"; d = pd.read_parquet(p) | |
| d["source_repo"] = d.source_dataset.map(lambda s: look(s)[0]); d["source_license"] = d.source_dataset.map(lambda s: look(s)[1]); d["license_tier"] = d.source_license.map(tier) | |
| d.to_parquet(p + ".tmp"); os.replace(p + ".tmp", p) | |
| print(f, d.license_tier.value_counts().to_dict()) | |
| json.dump({k: dict(repo=v[0], license=v[1], note=v[2], tier=tier(v[1])) for k, v in L.items()}, open(f"{ROOT}/manifests/source_licenses.json", "w"), indent=1) | |