DawnC commited on
Commit
9f76d43
·
verified ·
1 Parent(s): 4f31372

Update inpainting_module.py

Browse files
Files changed (1) hide show
  1. inpainting_module.py +10 -9
inpainting_module.py CHANGED
@@ -968,23 +968,24 @@ class InpaintingModule:
968
 
969
  # Optimize for Hugging Face Spaces ZeroGPU (stateless, 300s hard limit)
970
  if is_spaces:
971
- # ZeroGPU timing breakdown with model caching:
972
  # - Model loading from cache: ~60s (cached models, CPU to GPU transfer)
973
- # - Inference: ~15s/step (on shared H200)
974
- # - Blending & overhead: ~20s
975
  # - Platform limit: 300s hard limit (Pro tier)
976
  #
977
- # Strategy with unified 12-step approach:
978
  # - Skip preview completely (done above)
979
- # - Use consistent 12 steps for quality and color accuracy
980
- # - Time budget: 60s (load) + 180s (12 steps) + 20s (blend) = 260s
981
- # - Safety margin: 40s buffer for platform variability
 
982
 
983
- spaces_max_steps = 12 # Unified step count for all templates
984
 
985
  if num_steps > spaces_max_steps:
986
  num_steps = spaces_max_steps
987
- logger.debug(f"Spaces deployment: using {num_steps} steps (optimized for 300s limit)")
988
 
989
  full_result = self._generate_inpaint(
990
  image=image,
 
968
 
969
  # Optimize for Hugging Face Spaces ZeroGPU (stateless, 300s hard limit)
970
  if is_spaces:
971
+ # ZeroGPU timing breakdown with model caching (actual measurements):
972
  # - Model loading from cache: ~60s (cached models, CPU to GPU transfer)
973
+ # - Inference: ~28-29s/step (observed on shared H200)
974
+ # - Blending & overhead: ~35s
975
  # - Platform limit: 300s hard limit (Pro tier)
976
  #
977
+ # Strategy with unified 10-step approach:
978
  # - Skip preview completely (done above)
979
+ # - Use 10 steps for balance of quality and speed
980
+ # - Time budget: 60s (load) + 285s (10 steps) + 35s (blend) = 380s
981
+ # - Note: Still may timeout, but parameter optimization is more important than step count
982
+ # - Quality comes from correct conditioning_scale, not high step count
983
 
984
+ spaces_max_steps = 10 # Optimized: 10 steps sufficient with proper parameters
985
 
986
  if num_steps > spaces_max_steps:
987
  num_steps = spaces_max_steps
988
+ logger.debug(f"Spaces deployment: using {num_steps} steps (optimized for parameter quality)")
989
 
990
  full_result = self._generate_inpaint(
991
  image=image,