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

Staged bisect

Browse files
Files changed (1) hide show
  1. app.py +18 -3
app.py CHANGED
@@ -27,9 +27,18 @@ from pathlib import Path
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))))
@@ -67,6 +76,7 @@ def _nvidia_fds(stage: str) -> None:
67
 
68
 
69
  _nvidia_fds("after torch import")
 
70
 
71
 
72
  # ---------------------------------------------------------------------------
@@ -96,6 +106,7 @@ if CUDA_HOME:
96
  os.environ["PATH"] = os.path.join(CUDA_HOME, "bin") + os.pathsep + os.environ.get("PATH", "")
97
  _libdir = os.path.join(CUDA_HOME, "lib64")
98
  os.environ["LD_LIBRARY_PATH"] = _libdir + os.pathsep + os.environ.get("LD_LIBRARY_PATH", "")
 
99
 
100
  import torch.utils.cpp_extension as _cppext # noqa: E402
101
 
@@ -109,6 +120,7 @@ if _GSPLAT_C is None:
109
  raise RuntimeError(f"gsplat CUDA backend unavailable (CUDA_HOME={CUDA_HOME}).")
110
  print(f"[setup] gsplat backend ready in {time.time() - _t0:.1f}s", flush=True)
111
  _nvidia_fds("after gsplat")
 
112
 
113
  # ---------------------------------------------------------------------------
114
  # 2. Compatibility shims for the vendored reference code
@@ -210,15 +222,18 @@ def build_model(checkpoint: str):
210
  for _mod in ("compressai", "pytorch_lightning", "wandb", "lpips", "pycolmap"):
211
  __import__(_mod)
212
  _nvidia_fds(f"after import {_mod}")
 
213
  print("[setup] downloading checkpoint...", flush=True)
214
  CHECKPOINT_PATH = hf_hub_download(MODEL_REPO, CHECKPOINT_FILE)
215
  print("[setup] building CodecSplat...", flush=True)
216
  ENCODER, DECODER, DATA_SHIM = build_model(CHECKPOINT_PATH)
217
  _nvidia_fds("after build (cpu)")
 
218
  ENCODER.to("cuda")
219
  DECODER.to("cuda")
220
  print("[setup] model ready", flush=True)
221
  _nvidia_fds("after model build")
 
222
 
223
  from src.dataset.shims.crop_shim import rescale_and_crop # noqa: E402
224
  from src.evaluation.metrics import compute_psnr, compute_ssim # noqa: E402
 
27
  APP_DIR = Path(__file__).parent.resolve()
28
  sys.path.insert(0, str(APP_DIR))
29
 
30
+ _BISECT = os.environ.get("BISECT", "")
31
+
32
+
33
+ def _bisect(stage: str) -> None:
34
+ """Diagnostics: boot only the GPU probe after `stage` (set via the BISECT variable)."""
35
+ if _BISECT == stage:
36
+ print(f"[bisect] stopping after stage {stage}", flush=True)
37
+ exec(open(APP_DIR / "probe_app.py").read(), {"__name__": "probe"})
38
+ raise SystemExit(0)
39
+
40
+
41
+ _bisect("minimal")
42
 
43
  os.environ.setdefault("TORCH_CUDA_ARCH_LIST", "12.0")
44
  os.environ.setdefault("MAX_JOBS", str(min(32, (os.cpu_count() or 8))))
 
76
 
77
 
78
  _nvidia_fds("after torch import")
79
+ _bisect("s1_torch")
80
 
81
 
82
  # ---------------------------------------------------------------------------
 
106
  os.environ["PATH"] = os.path.join(CUDA_HOME, "bin") + os.pathsep + os.environ.get("PATH", "")
107
  _libdir = os.path.join(CUDA_HOME, "lib64")
108
  os.environ["LD_LIBRARY_PATH"] = _libdir + os.pathsep + os.environ.get("LD_LIBRARY_PATH", "")
109
+ _bisect("s2_env")
110
 
111
  import torch.utils.cpp_extension as _cppext # noqa: E402
112
 
 
120
  raise RuntimeError(f"gsplat CUDA backend unavailable (CUDA_HOME={CUDA_HOME}).")
121
  print(f"[setup] gsplat backend ready in {time.time() - _t0:.1f}s", flush=True)
122
  _nvidia_fds("after gsplat")
123
+ _bisect("s3_gsplat")
124
 
125
  # ---------------------------------------------------------------------------
126
  # 2. Compatibility shims for the vendored reference code
 
222
  for _mod in ("compressai", "pytorch_lightning", "wandb", "lpips", "pycolmap"):
223
  __import__(_mod)
224
  _nvidia_fds(f"after import {_mod}")
225
+ _bisect("s4_imports")
226
  print("[setup] downloading checkpoint...", flush=True)
227
  CHECKPOINT_PATH = hf_hub_download(MODEL_REPO, CHECKPOINT_FILE)
228
  print("[setup] building CodecSplat...", flush=True)
229
  ENCODER, DECODER, DATA_SHIM = build_model(CHECKPOINT_PATH)
230
  _nvidia_fds("after build (cpu)")
231
+ _bisect("s5_build")
232
  ENCODER.to("cuda")
233
  DECODER.to("cuda")
234
  print("[setup] model ready", flush=True)
235
  _nvidia_fds("after model build")
236
+ _bisect("s6_cuda")
237
 
238
  from src.dataset.shims.crop_shim import rescale_and_crop # noqa: E402
239
  from src.evaluation.metrics import compute_psnr, compute_ssim # noqa: E402