Spaces:
Running on Zero
Running on Zero
Fix specs to show host vs ZeroGPU allocation
Browse files
app.py
CHANGED
|
@@ -91,14 +91,34 @@ API_SPECS = {
|
|
| 91 |
|
| 92 |
def _get_runtime_specs():
|
| 93 |
storage = shutil.disk_usage(os.getcwd())
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 94 |
return {
|
| 95 |
"platform": platform.platform(),
|
| 96 |
"python_version": platform.python_version(),
|
| 97 |
-
"
|
| 98 |
-
"
|
| 99 |
"storage_total_bytes": storage.total,
|
| 100 |
"storage_used_bytes": storage.used,
|
| 101 |
"storage_free_bytes": storage.free,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 102 |
}
|
| 103 |
|
| 104 |
|
|
|
|
| 91 |
|
| 92 |
def _get_runtime_specs():
|
| 93 |
storage = shutil.disk_usage(os.getcwd())
|
| 94 |
+
host_ram = _get_ram_bytes()
|
| 95 |
+
host_cores = os.cpu_count()
|
| 96 |
+
|
| 97 |
+
# ZeroGPU shares a large host machine. /proc/meminfo and
|
| 98 |
+
# os.cpu_count() report the *full host*, not the Space's slice.
|
| 99 |
+
# The actual allocation depends on ZeroGPU scheduling.
|
| 100 |
+
hardware = os.environ.get("SPACE_HARDWARE", "zero-a10g")
|
| 101 |
+
is_zerogpu = "zero" in hardware.lower()
|
| 102 |
+
|
| 103 |
return {
|
| 104 |
"platform": platform.platform(),
|
| 105 |
"python_version": platform.python_version(),
|
| 106 |
+
"host_cpu_cores": host_cores,
|
| 107 |
+
"host_ram_bytes": host_ram,
|
| 108 |
"storage_total_bytes": storage.total,
|
| 109 |
"storage_used_bytes": storage.used,
|
| 110 |
"storage_free_bytes": storage.free,
|
| 111 |
+
"hardware": hardware,
|
| 112 |
+
"gpu": {
|
| 113 |
+
"type": "NVIDIA RTX Pro 6000 Blackwell",
|
| 114 |
+
"vram_bytes": 48 * 1024**3 if is_zerogpu else None,
|
| 115 |
+
"shared_zero_gpu": is_zerogpu,
|
| 116 |
+
} if is_zerogpu else None,
|
| 117 |
+
"note": (
|
| 118 |
+
"Host machine resources shown; Space gets a shared slice "
|
| 119 |
+
"via ZeroGPU dynamic allocation."
|
| 120 |
+
if is_zerogpu else None
|
| 121 |
+
),
|
| 122 |
}
|
| 123 |
|
| 124 |
|