Download tools/check_licenses.py from RightNowAI/duplex-v0: direct link, hf CLI and curl.
- Browser
- Download file 1.83 kB
-
https://huggingface.co/RightNowAI/duplex-v0/resolve/main/tools/check_licenses.py
- Command line
-
hf download hf://RightNowAI/duplex-v0/tools/check_licenses.py
-
curl -L -o check_licenses.py https://huggingface.co/RightNowAI/duplex-v0/resolve/main/tools/check_licenses.py
1.83 kB
| """Re-read the licence of every model and dataset this repository uses from the Hugging Face | |
| API, and the licence of every installed Python package from its own metadata. Prints one | |
| line per item and exits 1 if a model or dataset is not Apache-2.0 or MIT. | |
| Packages are listed, not failed: docs/licenses.md says which non-Apache/MIT ones are | |
| tolerated and why. Copyleft ones are marked. | |
| python -m tools.check_licenses | |
| """ | |
| import json | |
| import sys | |
| import urllib.request | |
| from importlib import metadata | |
| MODELS = ["stepfun-ai/Step-Audio-R1.1", "stepfun-ai/Step-Audio-2-mini", "hexgrad/Kokoro-82M", "Qwen/Qwen3-32B"] | |
| DATASETS = ["ArtificialAnalysis/big_bench_audio"] | |
| ALLOWED = {"apache-2.0", "mit"} | |
| def hf_license(kind, repo): | |
| with urllib.request.urlopen(f"https://huggingface.co/api/{kind}/{repo}", timeout=30) as r: | |
| tags = json.load(r).get("tags", []) | |
| return next((t.split(":", 1)[1] for t in tags if t.startswith("license:")), None) | |
| def main(): | |
| bad = 0 | |
| for kind, repos in (("models", MODELS), ("datasets", DATASETS)): | |
| for repo in repos: | |
| lic = hf_license(kind, repo) | |
| ok = lic in ALLOWED | |
| bad += not ok | |
| print(f"{'ok ' if ok else 'FAIL'} {kind[:-1]:8s} {repo:42s} {lic}") | |
| print() | |
| for dist in sorted(metadata.distributions(), key=lambda d: (d.metadata["Name"] or "").lower()): | |
| m = dist.metadata | |
| lic = m.get("License-Expression") or " / ".join(c.split(" :: ")[-1] for c in m.get_all("Classifier") or [] if c.startswith("License")) \ | |
| or " ".join((m.get("License") or "").split())[:60] or "not stated" | |
| mark = "COPYLEFT" if any(w in lic.upper() for w in ("GPL", "AGPL")) else "" | |
| print(f" package {m['Name']:42s} {lic} {mark}") | |
| sys.exit(1 if bad else 0) | |
| if __name__ == "__main__": | |
| main() | |