Download scripts/hardware_info.py from sroecker/seal-cell: direct link, hf CLI and curl.
- Browser
- Download file 1.03 kB
-
https://huggingface.co/spaces/sroecker/seal-cell/resolve/main/scripts/hardware_info.py
- Command line
-
hf download hf://spaces/sroecker/seal-cell/scripts/hardware_info.py
-
curl -L -o hardware_info.py https://huggingface.co/spaces/sroecker/seal-cell/resolve/main/scripts/hardware_info.py
1.03 kB
| """Record reproducible latency context without reading user/device identifiers.""" | |
| import json | |
| import platform | |
| import subprocess | |
| from pathlib import Path | |
| import torch | |
| info = { | |
| "platform": platform.platform(), | |
| "python": platform.python_version(), | |
| "machine": platform.machine(), | |
| "torch_threads": 4, | |
| "timing_context": "interactive workstation; not isolated; brief concurrent dashboard and MPS compatibility checks", | |
| } | |
| if platform.system() == "Darwin": | |
| for key, sysctl_name in [ | |
| ("cpu", "machdep.cpu.brand_string"), | |
| ("memory_bytes", "hw.memsize"), | |
| ("logical_cpus", "hw.ncpu"), | |
| ]: | |
| value = subprocess.check_output(["sysctl", "-n", sysctl_name], text=True).strip() | |
| info[key] = value if key == "cpu" else int(value) | |
| if torch.backends.mps.is_available(): | |
| info["gpu_name"] = torch.backends.mps.get_name() | |
| info["gpu_cores"] = torch.backends.mps.get_core_count() | |
| Path("reports/hardware.json").write_text(json.dumps(info, indent=2) + "\n") | |
| print(json.dumps(info)) | |