TiGa-RCE commited on
Commit
209073a
·
verified ·
1 Parent(s): 789d622

Add bounded track/network GUI smoke test; no fallback or performance claim

Browse files
Files changed (4) hide show
  1. README.md +8 -2
  2. ZEROGPU_MANIFEST.json +4 -3
  3. app.py +21 -0
  4. training_smoke.py +89 -0
README.md CHANGED
@@ -10,7 +10,7 @@ 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.
@@ -22,6 +22,12 @@ 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.
 
 
 
 
 
 
 
10
  pinned: false
11
  ---
12
 
13
+ Private native CUDA compatibility probe and bounded upload smoke test, 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.
 
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, 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.
28
+
29
+ The upload test validates the exact supplied A01 track and a 6-4-2 Formula network
30
+ before leasing a GPU for at most 90 seconds. It repeats qualification, then runs
31
+ 4 vehicles for 1 generation of 60 physics ticks, seed 42, proton math profile.
32
+ The subprocess has a 25-second timeout. It exports a candidate and receipt, not
33
+ an improvement claim. Real-game import compatibility and physics parity remain unverified.
ZEROGPU_MANIFEST.json CHANGED
@@ -1,9 +1,10 @@
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
  }
 
1
  {
2
+ "README.md": "cd5ad5b4e2dd5230ecc0eb3083ea40e90c3665b5a9529a4286fbead2ed37bacb",
3
+ "app.py": "5d7e2fe152b0846f73a8383ef9e87c60925b4f7384221a4b04f639c5bdeb1e81",
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
+ "training_smoke.py": "91e278b8fdf1a025d2ce455f5a4e55b1751691be2689fadda92955fc6dcbb508"
10
  }
app.py CHANGED
@@ -1,6 +1,7 @@
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()
@@ -9,6 +10,14 @@ verify_artifacts()
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, "
@@ -17,6 +26,18 @@ with gr.Blocks() as demo:
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()
 
1
  import spaces # Must precede libraries that interact with CUDA.
2
  import gradio as gr
3
  from probe_core import qualify, verify_artifacts
4
+ from training_smoke import validate_uploads, execute_smoke
5
 
6
  # Integrity only: no device initialization or CUDA library loading at startup.
7
  verify_artifacts()
 
10
  def probe():
11
  return qualify()
12
 
13
+ @spaces.GPU(duration=90)
14
+ def leased_smoke(template):
15
+ return execute_smoke(template)
16
+
17
+ def smoke(track, network):
18
+ # Reject unsupported inputs on CPU before requesting a GPU lease.
19
+ return leased_smoke(validate_uploads(track, network))
20
+
21
  with gr.Blocks() as demo:
22
  gr.Markdown("# TAO · ZeroGPU compatibility check\n"
23
  "Private, bounded native-library qualification. No training, CPU fallback, "
 
26
  button = gr.Button("Run one compatibility check")
27
  result = gr.JSON(label="Qualification receipt")
28
  button.click(probe, inputs=[], outputs=result, api_name="probe", concurrency_limit=1)
29
+ gr.Markdown("## Bounded upload test\nUpload the supplied A01 track and a 6–4–2 Formula .evolution. "
30
+ "Fixed at 4 vehicles, 1 generation, 60 physics ticks, seed 42. "
31
+ "Checks compatibility again inside a new lease. Up to 90 seconds of included quota. "
32
+ "No CPU fallback, parity or performance claim. A candidate is not evidence of improvement.")
33
+ track = gr.File(label="A01 Beginner track", file_types=[".track"], type="filepath")
34
+ network = gr.File(label="Formula network", file_types=[".evolution"], type="filepath")
35
+ run = gr.Button("Run bounded training test")
36
+ report = gr.JSON(label="Training receipt")
37
+ candidate = gr.File(label="Candidate network")
38
+ receipt = gr.File(label="Download receipt")
39
+ run.click(smoke, inputs=[track, network], outputs=[report, candidate, receipt],
40
+ api_name="smoke", concurrency_limit=1)
41
 
42
  if __name__ == "__main__":
43
  demo.queue(max_size=1).launch()
training_smoke.py ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """One fixed, small GUI upload test. Not a general-purpose training endpoint."""
2
+ import gzip
3
+ import hashlib
4
+ import json
5
+ import os
6
+ from pathlib import Path
7
+ import subprocess
8
+ import tempfile
9
+ import time
10
+
11
+ ROOT = Path(__file__).parent
12
+
13
+ def validate_uploads(track, network):
14
+ if not track or not network:
15
+ raise ValueError('Upload both A01 Beginner.track and a Formula .evolution network')
16
+ track, network = Path(track), Path(network)
17
+ if track.stat().st_size > 1024*1024 or network.stat().st_size > 1024*1024:
18
+ raise ValueError('Smoke-test uploads must be at most 1 MB each')
19
+ expected = ROOT / 'tracks/A01 Beginner.track'
20
+ if hashlib.sha256(track.read_bytes()).digest() != hashlib.sha256(expected.read_bytes()).digest():
21
+ raise ValueError('This first smoke test accepts only the supplied A01 Beginner.track fixture')
22
+ # Reuse the deployed dashboard parser and all its shape/finite-value/sensor guards.
23
+ from server import parse_network
24
+ template, _ = parse_network(network.read_bytes())
25
+ if template['NeuralNetwork']['Shape'] != [6, 4, 2]:
26
+ raise ValueError('First smoke test requires a 6-4-2 Formula network')
27
+ return template
28
+
29
+ def execute_smoke(template):
30
+ from probe_core import qualify
31
+ qualification = qualify()
32
+ if not qualification['qualified_for_next_test']:
33
+ return {'status':'qualification_failed','qualification':qualification}, None, None
34
+ directory = Path(tempfile.mkdtemp(prefix='ald-smoke-'))
35
+ n = template['NeuralNetwork']
36
+ network = {'shape':n['Shape'],'weights':n['Weights'],'biases':n['Biases'],
37
+ 'inputs':[f'sensor-{i}' for i in range(6)], 'outputs':['Steering','Acceleration']}
38
+ model = {'sensor_layout':{'names':network['inputs'],'sensors':template['Sensors']}}
39
+ settings = {'population':4,'selection_algorithm':'best','selection_size':1,
40
+ 'crossover':'none','mutation_rate':0.01,'adaptive_mutation':False,'weight_decay':0,
41
+ 'preserve_parents':'on_custom','preserve_parents_size':1,
42
+ 'rewards':[{'metric':'total_score','type':'default','weight':1}]}
43
+ for name, data in [('network',network),('model',model),('settings',settings)]:
44
+ (directory/(name+'.json')).write_text(json.dumps(data))
45
+ binary = ROOT/'bin/altd-sim'
46
+ binary.chmod(0o755)
47
+ out = directory/'native'
48
+ cmd = [str(binary),'--math-profile','proton','--threads','1','train-scratch',
49
+ '--gpu','--scene',str(ROOT/'tracks/A01 Beginner.scene.json'),
50
+ '--spawn-trace',str(ROOT/'tracks/A01 Beginner.spawn.json'),
51
+ '--network',str(directory/'network.json'),'--init-network',str(directory/'network.json'),
52
+ '--model',str(directory/'model.json'),'--settings',str(directory/'settings.json'),
53
+ '--shape','6,4,2','--population','4','--generations','1','--ticks','60',
54
+ '--seed','42','--batch-count','2','--eliminate-on-wall','--idle-eliminate',
55
+ '--out-dir',str(out),'--mutation-start','0.01','--mutation-end','0.01',
56
+ '--schedule','linear','--checkpoint-every','1','--save-final-candidate']
57
+ start = time.perf_counter()
58
+ try:
59
+ result = subprocess.run(cmd, capture_output=True,text=True,timeout=25,
60
+ cwd=ROOT/'github-simulator/source',
61
+ env=dict(os.environ,ALTD_GPU_LIB=str(ROOT/'bin/libaltd_gpu.so')))
62
+ except subprocess.TimeoutExpired:
63
+ report = {'status':'timeout','qualification':qualification,'timeout_seconds':25,
64
+ 'parity_verified':False,'speedup_verified':False}
65
+ receipt = directory/'receipt.json'
66
+ receipt.write_text(json.dumps(report,indent=2)+'\n')
67
+ return report, None, str(receipt)
68
+ report = {'status':'failed','qualification':qualification,'population':4,'generations':1,
69
+ 'ticks':60,'seed':42,'math_profile':'proton','returncode':result.returncode,
70
+ 'wall_seconds':time.perf_counter()-start,'stdout':result.stdout[-8192:],
71
+ 'stderr':result.stderr[-8192:],'parity_verified':False,'speedup_verified':False,
72
+ 'network_sha256':hashlib.sha256((directory/'network.json').read_bytes()).hexdigest(),
73
+ 'scene_sha256':hashlib.sha256((ROOT/'tracks/A01 Beginner.scene.json').read_bytes()).hexdigest(),
74
+ 'command':cmd}
75
+ candidate = None
76
+ if result.returncode == 0 and (out/'candidate.json').exists():
77
+ trained = json.loads((out/'candidate.json').read_text())
78
+ template['NeuralNetwork']['Weights'] = trained['weights']
79
+ template['NeuralNetwork']['Biases'] = trained['biases']
80
+ template['Name'] = 'ZeroGPU smoke candidate — not benchmarked'
81
+ candidate = directory/'candidate.evolution'
82
+ candidate.write_bytes(gzip.compress(json.dumps(template).encode(),mtime=0))
83
+ from server import parse_network
84
+ parse_network(candidate.read_bytes())
85
+ report.update(status='candidate_created',candidate_sha256=hashlib.sha256(candidate.read_bytes()).hexdigest(),
86
+ history=[json.loads(line) for line in (out/'log.jsonl').read_text().splitlines()])
87
+ receipt = directory/'receipt.json'
88
+ receipt.write_text(json.dumps(report,indent=2)+'\n')
89
+ return report, str(candidate) if candidate else None, str(receipt)