CocoBro commited on
Commit
b2d65b0
·
1 Parent(s): dabc4d4
Files changed (1) hide show
  1. app.py +8 -1
app.py CHANGED
@@ -230,7 +230,6 @@ def load_pipeline_cpu() -> Tuple[object, object, int]:
230
 
231
  logger.info(f"repo_root = {repo_root}")
232
  logger.info(f"qwen_root = {qwen_root}")
233
- logger.info(f"torch.cuda.is_available (startup) = {torch.cuda.is_available()}")
234
 
235
  exp_cfg = OmegaConf.load(repo_root / "config.yaml")
236
  exp_cfg = OmegaConf.to_container(exp_cfg, resolve=True)
@@ -281,6 +280,14 @@ def run_edit(
281
  # 1) 取 CPU 缓存
282
  model_cpu, scheduler, target_sr = load_pipeline_cpu()
283
 
 
 
 
 
 
 
 
 
284
  # 2) ZeroGPU 进入 GPU 区域后,cuda 才会 available
285
  if not torch.cuda.is_available():
286
  return None, "Error: ZeroGPU did not allocate CUDA. Please retry or check Space hardware."
 
230
 
231
  logger.info(f"repo_root = {repo_root}")
232
  logger.info(f"qwen_root = {qwen_root}")
 
233
 
234
  exp_cfg = OmegaConf.load(repo_root / "config.yaml")
235
  exp_cfg = OmegaConf.to_container(exp_cfg, resolve=True)
 
280
  # 1) 取 CPU 缓存
281
  model_cpu, scheduler, target_sr = load_pipeline_cpu()
282
 
283
+ try:
284
+ if not torch.cuda.is_available():
285
+ return None, "Error: ZeroGPU did not allocate CUDA. Please retry or restart Space."
286
+
287
+ except Exception as e:
288
+ logger.exception("run_edit failed")
289
+ return None, f"Error: {type(e).__name__}: {e}"
290
+
291
  # 2) ZeroGPU 进入 GPU 区域后,cuda 才会 available
292
  if not torch.cuda.is_available():
293
  return None, "Error: ZeroGPU did not allocate CUDA. Please retry or check Space hardware."