multimodalart HF Staff commited on
Commit
e05ff03
·
verified ·
1 Parent(s): 3986911

Bisect switch

Browse files
Files changed (2) hide show
  1. app.py +4 -0
  2. probe_app.py +20 -0
app.py CHANGED
@@ -27,6 +27,10 @@ from pathlib import Path
27
  APP_DIR = Path(__file__).parent.resolve()
28
  sys.path.insert(0, str(APP_DIR))
29
 
 
 
 
 
30
  os.environ.setdefault("TORCH_CUDA_ARCH_LIST", "12.0")
31
  os.environ.setdefault("MAX_JOBS", str(min(32, (os.cpu_count() or 8))))
32
  os.environ.setdefault("WANDB_MODE", "disabled")
 
27
  APP_DIR = Path(__file__).parent.resolve()
28
  sys.path.insert(0, str(APP_DIR))
29
 
30
+ if os.environ.get("BISECT") == "minimal": # diagnostics: bare spaces+torch+gradio
31
+ exec(open(APP_DIR / "probe_app.py").read())
32
+ raise SystemExit(0)
33
+
34
  os.environ.setdefault("TORCH_CUDA_ARCH_LIST", "12.0")
35
  os.environ.setdefault("MAX_JOBS", str(min(32, (os.cpu_count() or 8))))
36
  os.environ.setdefault("WANDB_MODE", "disabled")
probe_app.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Minimal ZeroGPU probe (diagnostics only)."""
2
+ import os
3
+ import spaces
4
+ import torch
5
+ import gradio as gr
6
+
7
+ _t = torch.zeros(4).to("cuda")
8
+
9
+
10
+ @spaces.GPU(duration=20)
11
+ def gpu_probe() -> str:
12
+ """Report the GPU visible to the ZeroGPU worker."""
13
+ return f"{torch.cuda.get_device_name()} | {_t.device} | torch {torch.__version__}"
14
+
15
+
16
+ with gr.Blocks() as demo:
17
+ b = gr.Button("probe")
18
+ o = gr.Textbox()
19
+ b.click(gpu_probe, outputs=o, api_name="gpu_probe")
20
+ demo.launch()