Download verify_runtime.py from stokiz/fish-audio-s2-python-runtime-portable: direct link, hf CLI and curl.
- Browser
- Download file 1.15 kB
-
https://huggingface.co/datasets/stokiz/fish-audio-s2-python-runtime-portable/resolve/main/verify_runtime.py
- Command line
-
hf download hf://datasets/stokiz/fish-audio-s2-python-runtime-portable/verify_runtime.py
-
curl -L -o verify_runtime.py https://huggingface.co/datasets/stokiz/fish-audio-s2-python-runtime-portable/resolve/main/verify_runtime.py
1.15 kB
| from __future__ import annotations | |
| import importlib | |
| import json | |
| import sys | |
| from pathlib import Path | |
| import runtime_bootstrap | |
| root = runtime_bootstrap.activate(Path(__file__).resolve().parent) | |
| mods = [ | |
| "numpy", | |
| "soundfile", | |
| "torch", | |
| "transformers", | |
| "fish_audio_s2_runtime", | |
| ] | |
| optional_mods = [ | |
| "fish_speech", | |
| ] | |
| report = {"root": str(root), "imports": {}} | |
| for name in mods: | |
| try: | |
| module = importlib.import_module(name) | |
| report["imports"][name] = {"ok": True, "file": getattr(module, "__file__", None), "required": True} | |
| except Exception as exc: | |
| report["imports"][name] = {"ok": False, "error": repr(exc), "required": True} | |
| for name in optional_mods: | |
| try: | |
| module = importlib.import_module(name) | |
| report["imports"][name] = {"ok": True, "file": getattr(module, "__file__", None), "required": False} | |
| except Exception as exc: | |
| report["imports"][name] = {"ok": False, "error": repr(exc), "required": False} | |
| print(json.dumps(report, ensure_ascii=False, indent=2)) | |
| if not all(item["ok"] for item in report["imports"].values() if item.get("required", True)): | |
| sys.exit(1) |