Spaces:
Running
on
Zero
Running
on
Zero
Update inpainting_module.py
Browse files- 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: ~
|
| 974 |
-
# - Blending & overhead: ~
|
| 975 |
# - Platform limit: 300s hard limit (Pro tier)
|
| 976 |
#
|
| 977 |
-
# Strategy with unified
|
| 978 |
# - Skip preview completely (done above)
|
| 979 |
-
# - Use
|
| 980 |
-
# - Time budget: 60s (load) +
|
| 981 |
-
# -
|
|
|
|
| 982 |
|
| 983 |
-
spaces_max_steps =
|
| 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
|
| 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,
|