Download scripts/descargar.py from antonn-dromundo/DignityAI-Validacion: direct link, hf CLI and curl.
- Browser
- Download file 1.3 kB
-
https://huggingface.co/datasets/antonn-dromundo/DignityAI-Validacion/resolve/main/scripts/descargar.py
- Command line
-
hf download hf://datasets/antonn-dromundo/DignityAI-Validacion/scripts/descargar.py
-
curl -L -o descargar.py https://huggingface.co/datasets/antonn-dromundo/DignityAI-Validacion/resolve/main/scripts/descargar.py
1.3 kB
| """Descarga datasets y modelos para la validación externa de DignityAI.""" | |
| from datasets import load_dataset | |
| from huggingface_hub import snapshot_download | |
| import os, json | |
| os.makedirs("data", exist_ok=True) | |
| DS = { | |
| "machismodetect": "antonn-dromundo/MachismoDetect", | |
| "sinodio_latam": "antonn-dromundo/SinOdio-LATAM-Regional-HateSpeech", | |
| "piuba_real": "piuba-bigdata/contextualized_hate_speech", | |
| "hatecheck_es": "Paul/hatecheck-spanish", | |
| "superset_es": "manueltonneau/spanish-hate-speech-superset", | |
| } | |
| info = {} | |
| for k, rid in DS.items(): | |
| try: | |
| d = load_dataset(rid) | |
| for split, part in d.items(): | |
| part.to_pandas().to_parquet(f"data/{k}__{split}.parquet") | |
| info[k] = {s: {"filas": len(p), "columnas": p.column_names} for s, p in d.items()} | |
| except Exception as e: | |
| info[k] = {"error": repr(e)[:300]} | |
| print(k, json.dumps(info[k], ensure_ascii=False)[:400], flush=True) | |
| for rid in ["piuba-bigdata/beto-contextualized-hate-speech", "antonn-dromundo/SinOdio-BETO-HateSpeech-Detector-v3"]: | |
| p = snapshot_download(rid, allow_patterns=["*.json", "*.safetensors", "*.txt", "*.md", "tokenizer*", "vocab*", "special*"]) | |
| print(rid, p, os.listdir(p), flush=True) | |
| json.dump(info, open("data/info.json", "w"), ensure_ascii=False, indent=2) | |