Spaces:
Running
Running
Download scripts/export_config.py from RDS777/TARGET_SPACE: direct link, hf CLI and curl.
- Browser
- Download file 919 Bytes
-
https://huggingface.co/spaces/RDS777/TARGET_SPACE/resolve/main/scripts/export_config.py
- Command line
-
hf download hf://spaces/RDS777/TARGET_SPACE/scripts/export_config.py
-
curl -L -o export_config.py https://huggingface.co/spaces/RDS777/TARGET_SPACE/resolve/main/scripts/export_config.py
919 Bytes
| """Écrit config.json (preset par défaut ou celui demandé) à la racine du dépôt.""" | |
| import argparse | |
| import json | |
| import sys | |
| from pathlib import Path | |
| sys.path.insert(0, str(Path(__file__).resolve().parents[1])) | |
| from mouh.model import DEFAULT_PRESET, PRESETS, estimate_params, preset_config # noqa: E402 | |
| def main() -> None: | |
| ap = argparse.ArgumentParser() | |
| ap.add_argument("--preset", default=DEFAULT_PRESET, choices=sorted(PRESETS)) | |
| ap.add_argument("--out", default=str(Path(__file__).resolve().parents[1] / "config.json")) | |
| a = ap.parse_args() | |
| cfg = preset_config(a.preset) | |
| d = cfg.to_dict() | |
| d.pop("transformers_version", None) | |
| d["mouh_preset"] = a.preset | |
| d["mouh_parameter_report"] = estimate_params(cfg).as_dict() | |
| Path(a.out).write_text(json.dumps(d, indent=2, sort_keys=True) + "\n", encoding="utf-8") | |
| print(f"écrit {a.out}") | |
| if __name__ == "__main__": | |
| main() | |