someone-in-the-world Claude Sonnet 4.6 commited on
Commit
170974c
·
1 Parent(s): 961feed

Add granular startup logging to diagnose hang

Browse files

Adds flush=True and [startup] breadcrumbs between every import and
from_pretrained call so the log stream shows exactly where startup
stalls. Also splits from_pretrained into two named steps and prints
CUDA device_count at boot.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

Files changed (1) hide show
  1. app.py +23 -9
app.py CHANGED
@@ -21,33 +21,47 @@ MAX_OUTPUT_DIM = 2048
21
 
22
  device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
23
 
24
- print("CUDA_VISIBLE_DEVICES=", os.environ.get("CUDA_VISIBLE_DEVICES"))
25
- print("torch.__version__ =", torch.__version__)
26
- print("Using device:", device)
 
27
 
28
  # TF32 matmul: ~10-15% free speedup on Ampere/Hopper (bfloat16 accumulation paths benefit too)
29
  torch.backends.cuda.matmul.allow_tf32 = True
30
  torch.backends.cudnn.allow_tf32 = True
 
31
 
 
32
  from dimensions import compute_output_dimensions
 
33
  from diffusers import FlowMatchEulerDiscreteScheduler
 
34
  from qwenimage.pipeline_qwenimage_edit_plus import QwenImageEditPlusPipeline
 
35
  from qwenimage.transformer_qwenimage import QwenImageTransformer2DModel
 
36
  from qwenimage.qwen_fa3_processor import QwenDoubleStreamAttnProcessorFA3
 
37
 
38
  dtype = torch.bfloat16
39
 
 
 
 
 
 
 
 
 
 
40
  pipe = QwenImageEditPlusPipeline.from_pretrained(
41
  "FireRedTeam/FireRed-Image-Edit-1.1",
42
- transformer=QwenImageTransformer2DModel.from_pretrained(
43
- "prithivMLmods/Qwen-Image-Edit-Rapid-AIO-V23",
44
- torch_dtype=dtype,
45
- device_map="cuda",
46
- ),
47
  torch_dtype=dtype,
48
  ).to(device)
 
49
 
50
- print("Using default attention processor (FA3 skipped for ZeroGPU GPU-arch compatibility).")
51
 
52
  print("torch.compile skipped: lazy Triton kernel compilation inside @spaces.GPU always exceeds ZeroGPU's task timeout.")
53
 
 
21
 
22
  device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
23
 
24
+ print("CUDA_VISIBLE_DEVICES=", os.environ.get("CUDA_VISIBLE_DEVICES"), flush=True)
25
+ print("torch.__version__ =", torch.__version__, flush=True)
26
+ print("Using device:", device, flush=True)
27
+ print(f"CUDA device_count={torch.cuda.device_count()}, is_available={torch.cuda.is_available()}", flush=True)
28
 
29
  # TF32 matmul: ~10-15% free speedup on Ampere/Hopper (bfloat16 accumulation paths benefit too)
30
  torch.backends.cuda.matmul.allow_tf32 = True
31
  torch.backends.cudnn.allow_tf32 = True
32
+ print("[startup] TF32 enabled", flush=True)
33
 
34
+ print("[startup] importing dimensions...", flush=True)
35
  from dimensions import compute_output_dimensions
36
+ print("[startup] importing diffusers...", flush=True)
37
  from diffusers import FlowMatchEulerDiscreteScheduler
38
+ print("[startup] importing QwenImageEditPlusPipeline...", flush=True)
39
  from qwenimage.pipeline_qwenimage_edit_plus import QwenImageEditPlusPipeline
40
+ print("[startup] importing QwenImageTransformer2DModel...", flush=True)
41
  from qwenimage.transformer_qwenimage import QwenImageTransformer2DModel
42
+ print("[startup] importing QwenDoubleStreamAttnProcessorFA3...", flush=True)
43
  from qwenimage.qwen_fa3_processor import QwenDoubleStreamAttnProcessorFA3
44
+ print("[startup] all imports done", flush=True)
45
 
46
  dtype = torch.bfloat16
47
 
48
+ print("[startup] loading transformer from_pretrained (prithivMLmods/Qwen-Image-Edit-Rapid-AIO-V23)...", flush=True)
49
+ _transformer = QwenImageTransformer2DModel.from_pretrained(
50
+ "prithivMLmods/Qwen-Image-Edit-Rapid-AIO-V23",
51
+ torch_dtype=dtype,
52
+ device_map="cuda",
53
+ )
54
+ print("[startup] transformer loaded", flush=True)
55
+
56
+ print("[startup] loading pipeline from_pretrained (FireRedTeam/FireRed-Image-Edit-1.1)...", flush=True)
57
  pipe = QwenImageEditPlusPipeline.from_pretrained(
58
  "FireRedTeam/FireRed-Image-Edit-1.1",
59
+ transformer=_transformer,
 
 
 
 
60
  torch_dtype=dtype,
61
  ).to(device)
62
+ print("[startup] pipeline loaded and moved to device", flush=True)
63
 
64
+ print("Using default attention processor (FA3 skipped for ZeroGPU GPU-arch compatibility).", flush=True)
65
 
66
  print("torch.compile skipped: lazy Triton kernel compilation inside @spaces.GPU always exceeds ZeroGPU's task timeout.")
67