Spaces:
Running on Zero
Running on Zero
Add bounded ZeroGPU native CUDA qualification; preserve Docker rollback
Browse files- .gitattributes +2 -0
- BINARY_PROVENANCE.json +22 -0
- README.md +18 -6
- ZEROGPU_MANIFEST.json +9 -0
- app.py +22 -0
- bin/altd-sim +3 -0
- bin/libaltd_gpu.so +3 -0
- probe_core.py +81 -0
- requirements.txt +1 -0
.gitattributes
CHANGED
|
@@ -37,3 +37,5 @@ tracks/R06[[:space:]]Mix.track filter=lfs diff=lfs merge=lfs -text
|
|
| 37 |
tracks/R07[[:space:]]Mirage[[:space:]]Marina.track filter=lfs diff=lfs merge=lfs -text
|
| 38 |
tracks/R09[[:space:]]Eau[[:space:]]Noir.track filter=lfs diff=lfs merge=lfs -text
|
| 39 |
tracks/The[[:space:]]Champions[[:space:]]Trial.track filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
| 37 |
tracks/R07[[:space:]]Mirage[[:space:]]Marina.track filter=lfs diff=lfs merge=lfs -text
|
| 38 |
tracks/R09[[:space:]]Eau[[:space:]]Noir.track filter=lfs diff=lfs merge=lfs -text
|
| 39 |
tracks/The[[:space:]]Champions[[:space:]]Trial.track filter=lfs diff=lfs merge=lfs -text
|
| 40 |
+
bin/altd-sim filter=lfs diff=lfs merge=lfs -text
|
| 41 |
+
bin/libaltd_gpu.so filter=lfs diff=lfs merge=lfs -text
|
BINARY_PROVENANCE.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"source_space": "TiGa-RCE/ald-tao-gpu",
|
| 3 |
+
"source_revision": "ba07e35a39211af7a0deda0ebd9adb2c554b4f38",
|
| 4 |
+
"upstream": "d8ab74c25df70b6a86ed101080e33d5fb785ea6f",
|
| 5 |
+
"image_config": "sha256:31f7854e5fac0b54679eed2899c8951cd96571650ea6c74c27e2400a8c4aa6d3",
|
| 6 |
+
"artifacts": [
|
| 7 |
+
{
|
| 8 |
+
"file": "bin/altd-sim",
|
| 9 |
+
"sha256": "2f2f2144ae14b0ef599ca8510f95712da00243c6875881491d384b394e7499f7",
|
| 10 |
+
"bytes": 13911800,
|
| 11 |
+
"layer": "sha256:d4f213ac74fe7556e8ef4d71aa6195a80dd619057697748f2f3863c0aa1cbca7",
|
| 12 |
+
"member": "app/github-simulator/source/target/release/altd-sim"
|
| 13 |
+
},
|
| 14 |
+
{
|
| 15 |
+
"file": "bin/libaltd_gpu.so",
|
| 16 |
+
"sha256": "279d6353b4c691686d6aeeae6abfd4a82b959e9b604f079a6c45f9823b48a87a",
|
| 17 |
+
"bytes": 3933424,
|
| 18 |
+
"layer": "sha256:c61e59a8a076ae00d64a4b8c55102f2ba9643dbe165cd66130ed662e131982ce",
|
| 19 |
+
"member": "app/libaltd_gpu.so"
|
| 20 |
+
}
|
| 21 |
+
]
|
| 22 |
+
}
|
README.md
CHANGED
|
@@ -1,15 +1,27 @@
|
|
| 1 |
---
|
| 2 |
-
title: TAO
|
| 3 |
emoji: 🏎️
|
| 4 |
colorFrom: green
|
| 5 |
colorTo: blue
|
| 6 |
-
sdk:
|
| 7 |
-
|
|
|
|
|
|
|
| 8 |
pinned: false
|
| 9 |
---
|
| 10 |
|
| 11 |
-
Private CUDA
|
|
|
|
|
|
|
|
|
|
| 12 |
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
title: TAO ZeroGPU Qualification
|
| 3 |
emoji: 🏎️
|
| 4 |
colorFrom: green
|
| 5 |
colorTo: blue
|
| 6 |
+
sdk: gradio
|
| 7 |
+
sdk_version: 6.29.1
|
| 8 |
+
python_version: '3.10'
|
| 9 |
+
app_file: app.py
|
| 10 |
pinned: false
|
| 11 |
---
|
| 12 |
|
| 13 |
+
Private native CUDA compatibility probe, not a qualified trainer.
|
| 14 |
+
Uses included ZeroGPU allowance through a 45-second leased call. No paid Jobs
|
| 15 |
+
or dedicated hardware requested. Check the authenticated caller's included quota
|
| 16 |
+
before each call; the app itself does not know account billing balances.
|
| 17 |
|
| 18 |
+
Original Docker source and dashboard remain in this repository but are inactive.
|
| 19 |
+
Rollback: restore README.md from revision ba07e35a39211af7a0deda0ebd9adb2c554b4f38
|
| 20 |
+
and request CPU Basic. BINARY_PROVENANCE.json pins the two exact HF-built binaries
|
| 21 |
+
to that revision and upstream d8ab74c25df70b6a86ed101080e33d5fb785ea6f.
|
| 22 |
|
| 23 |
+
No CUDA initialization outside the lease. First check device discovery and a
|
| 24 |
+
three-value sine kernel in process, then the normal Rust gpu-info subprocess.
|
| 25 |
+
No fallback, training, trajectory parity, speedup or H200 claim. A second lease
|
| 26 |
+
must independently pass before testing training. Retained PACKAGE_MANIFEST.json
|
| 27 |
+
describes the prior Docker snapshot only; ZEROGPU_MANIFEST.json covers this overlay.
|
ZEROGPU_MANIFEST.json
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"README.md": "2ed9310903d06964947ba9008a34f522a5cba48318b183318af938a859911b37",
|
| 3 |
+
"app.py": "60bbb765a5783bb9786aca0b3b910a42eb570fffc6b3072d5220895be978450a",
|
| 4 |
+
"probe_core.py": "97a36ad8cf8efec09d84bb4b2c1ee6794658ceedfd643cd9849ff3c6d85aca9d",
|
| 5 |
+
"requirements.txt": "d4a97517b799a94b3370ea2e11aee3e41304aa12b77bab9abecd0b37e961acaf",
|
| 6 |
+
"BINARY_PROVENANCE.json": "f2223c1c6e2bbf8f6101b46e11563f4d866f99094c529cd5584f3228309e6551",
|
| 7 |
+
"bin/altd-sim": "2f2f2144ae14b0ef599ca8510f95712da00243c6875881491d384b394e7499f7",
|
| 8 |
+
"bin/libaltd_gpu.so": "279d6353b4c691686d6aeeae6abfd4a82b959e9b604f079a6c45f9823b48a87a"
|
| 9 |
+
}
|
app.py
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import spaces # Must precede libraries that interact with CUDA.
|
| 2 |
+
import gradio as gr
|
| 3 |
+
from probe_core import qualify, verify_artifacts
|
| 4 |
+
|
| 5 |
+
# Integrity only: no device initialization or CUDA library loading at startup.
|
| 6 |
+
verify_artifacts()
|
| 7 |
+
|
| 8 |
+
@spaces.GPU(duration=45)
|
| 9 |
+
def probe():
|
| 10 |
+
return qualify()
|
| 11 |
+
|
| 12 |
+
with gr.Blocks() as demo:
|
| 13 |
+
gr.Markdown("# TAO · ZeroGPU compatibility check\n"
|
| 14 |
+
"Private, bounded native-library qualification. No training, CPU fallback, "
|
| 15 |
+
"or automatic runs. Uses up to 45 seconds of the caller's ZeroGPU allowance. "
|
| 16 |
+
"Check included quota before calling. Actual GPU identity is recorded; no H200 assumption.")
|
| 17 |
+
button = gr.Button("Run one compatibility check")
|
| 18 |
+
result = gr.JSON(label="Qualification receipt")
|
| 19 |
+
button.click(probe, inputs=[], outputs=result, api_name="probe", concurrency_limit=1)
|
| 20 |
+
|
| 21 |
+
if __name__ == "__main__":
|
| 22 |
+
demo.queue(max_size=1).launch()
|
bin/altd-sim
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2f2f2144ae14b0ef599ca8510f95712da00243c6875881491d384b394e7499f7
|
| 3 |
+
size 13911800
|
bin/libaltd_gpu.so
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:279d6353b4c691686d6aeeae6abfd4a82b959e9b604f079a6c45f9823b48a87a
|
| 3 |
+
size 3933424
|
probe_core.py
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Bounded native CUDA qualification; importing this module never initializes CUDA."""
|
| 2 |
+
import ctypes
|
| 3 |
+
import hashlib
|
| 4 |
+
import json
|
| 5 |
+
import math
|
| 6 |
+
import os
|
| 7 |
+
from pathlib import Path
|
| 8 |
+
import subprocess
|
| 9 |
+
import time
|
| 10 |
+
|
| 11 |
+
ROOT = Path(__file__).resolve().parent
|
| 12 |
+
|
| 13 |
+
def verify_artifacts(root=ROOT):
|
| 14 |
+
manifest = json.loads((root / "BINARY_PROVENANCE.json").read_text())
|
| 15 |
+
for item in manifest["artifacts"]:
|
| 16 |
+
path = root / item["file"]
|
| 17 |
+
if path.parent != root / "bin":
|
| 18 |
+
raise ValueError("Unexpected artifact path")
|
| 19 |
+
if hashlib.sha256(path.read_bytes()).hexdigest() != item["sha256"]:
|
| 20 |
+
raise ValueError("Artifact hash mismatch: " + item["file"])
|
| 21 |
+
return manifest
|
| 22 |
+
|
| 23 |
+
def accepted_cli(info):
|
| 24 |
+
return (info.get("platform") == "CUDA" and bool(info.get("device"))
|
| 25 |
+
and info.get("layout") == "ok" and info.get("kernels") == "ok")
|
| 26 |
+
|
| 27 |
+
def qualify(root=ROOT):
|
| 28 |
+
"""Call only inside the outer GPU lease. No training or user input execution."""
|
| 29 |
+
started = time.perf_counter()
|
| 30 |
+
manifest = verify_artifacts(root)
|
| 31 |
+
report = {"schema": "ald-zerogpu-qualification/1", "provenance": manifest,
|
| 32 |
+
"inprocess_ok": False, "subprocess_ok": False,
|
| 33 |
+
"training_verified": False, "parity_verified": False}
|
| 34 |
+
try:
|
| 35 |
+
lib = ctypes.CDLL(str(root / "bin/libaltd_gpu.so"))
|
| 36 |
+
lib.altd_gpu_version.restype = ctypes.c_int
|
| 37 |
+
lib.altd_gpu_platform.restype = ctypes.c_char_p
|
| 38 |
+
report["abi"] = lib.altd_gpu_version()
|
| 39 |
+
report["platform"] = lib.altd_gpu_platform().decode()
|
| 40 |
+
if report["abi"] != 10 or report["platform"] != "CUDA":
|
| 41 |
+
raise RuntimeError("Unexpected native ABI/platform")
|
| 42 |
+
lib.altd_gpu_device_name.argtypes = [ctypes.c_void_p, ctypes.c_int]
|
| 43 |
+
lib.altd_gpu_device_name.restype = ctypes.c_int
|
| 44 |
+
name = ctypes.create_string_buffer(256)
|
| 45 |
+
status = lib.altd_gpu_device_name(name, len(name))
|
| 46 |
+
report["device_status"] = status
|
| 47 |
+
if status:
|
| 48 |
+
raise RuntimeError("Device discovery failed: " + str(status))
|
| 49 |
+
report["device"] = name.value.decode()
|
| 50 |
+
status = lib.altd_gpu_probe()
|
| 51 |
+
report["kernel_probe_status"] = status
|
| 52 |
+
if status:
|
| 53 |
+
raise RuntimeError("Kernel availability failed: " + str(status))
|
| 54 |
+
lib.altd_gpu_math.argtypes = [ctypes.c_int, ctypes.c_int, ctypes.c_void_p,
|
| 55 |
+
ctypes.c_void_p, ctypes.c_void_p]
|
| 56 |
+
lib.altd_gpu_math.restype = ctypes.c_int
|
| 57 |
+
# Independent analytical expectations, not copied simulator output.
|
| 58 |
+
values = (ctypes.c_float * 3)(0.0, 0.5, -0.5)
|
| 59 |
+
outputs = (ctypes.c_float * 3)()
|
| 60 |
+
errors = (ctypes.c_uint32 * 3)()
|
| 61 |
+
status = lib.altd_gpu_math(0, 3, values, outputs, errors)
|
| 62 |
+
report["math"] = {"status": status, "outputs": list(outputs), "errors": list(errors)}
|
| 63 |
+
report["inprocess_ok"] = (status == 0 and not any(errors)
|
| 64 |
+
and all(math.isfinite(y) and abs(y - math.sin(x)) <= 1e-6 for x, y in zip(values, outputs)))
|
| 65 |
+
except Exception as exc:
|
| 66 |
+
report["inprocess_error"] = str(exc)
|
| 67 |
+
try:
|
| 68 |
+
binary = root / "bin/altd-sim"
|
| 69 |
+
binary.chmod(0o755)
|
| 70 |
+
env = dict(os.environ, ALTD_GPU_LIB=str(root / "bin/libaltd_gpu.so"))
|
| 71 |
+
result = subprocess.run([str(binary), "gpu-info"], env=env,
|
| 72 |
+
capture_output=True, text=True, timeout=20)
|
| 73 |
+
report["subprocess"] = {"returncode": result.returncode,
|
| 74 |
+
"stdout": result.stdout[-8192:], "stderr": result.stderr[-8192:]}
|
| 75 |
+
if result.returncode == 0:
|
| 76 |
+
report["subprocess_ok"] = accepted_cli(json.loads(result.stdout))
|
| 77 |
+
except Exception as exc:
|
| 78 |
+
report["subprocess_error"] = str(exc)
|
| 79 |
+
report["wall_seconds"] = time.perf_counter() - started
|
| 80 |
+
report["qualified_for_next_test"] = report["inprocess_ok"] and report["subprocess_ok"]
|
| 81 |
+
return report
|
requirements.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
spaces==0.51.3
|