Spaces:
Running on Zero
Running on Zero
Upload app.py
Browse files
app.py
CHANGED
|
@@ -2213,9 +2213,15 @@ def get_inference_duration(
|
|
| 2213 |
# more RIFE time. No unconditional 60 s floor, 35/120 s adapter surcharge or 35% margin.
|
| 2214 |
rife_seconds = extra_frames * (0.06 if multiplier <= 2 else 0.10)
|
| 2215 |
requested = 10 + denoise_seconds + rife_seconds + _lora_loading_seconds(lora_groups)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2216 |
return _timing_estimate(_wan_timing_key(resized_image,processed_last_image,steps,guidance_scale,guidance_scale_2,
|
| 2217 |
scheduler_name,flow_shift,frame_multiplier,lora_groups),num_frames,requested,10,600,
|
| 2218 |
-
margin=1.35
|
| 2219 |
|
| 2220 |
|
| 2221 |
@spaces.GPU(duration=get_inference_duration, size="xlarge")
|
|
@@ -6063,7 +6069,7 @@ def _gpu_estimate_text(input_image, duration_seconds, steps, guidance_scale,
|
|
| 6063 |
"xlarge uses a 2× quota multiplier. Requested allowance is checked before generation; "
|
| 6064 |
"this is not a receipt for actual GPU usage. Normal mode restores smaller reservations; "
|
| 6065 |
"LoRA downloads finish on CPU before the GPU request; a size-based loading reserve is then added. "
|
| 6066 |
-
"Unknown adapter sizes are checked before generation. Safe Mode adds extra runtime margin. MP4 encoding runs after GPU release; RIFE remains on GPU.
|
| 6067 |
)
|
| 6068 |
return "\n".join(lines)
|
| 6069 |
|
|
@@ -7672,9 +7678,9 @@ with gr.Blocks(title="Wan 2.2 Studio | NEW AI Scene Planner · 64 Clips · 3 Aud
|
|
| 7672 |
safe_mode_checkbox = gr.Checkbox(
|
| 7673 |
label="🛠️ Safe Mode — extra time for slow or cold runs",
|
| 7674 |
value=False,
|
| 7675 |
-
info="Off
|
| 7676 |
-
"
|
| 7677 |
-
"
|
| 7678 |
)
|
| 7679 |
with gr.Group(elem_classes="panel"):
|
| 7680 |
video_output = gr.Video(
|
|
@@ -8571,9 +8577,10 @@ with gr.Blocks(title="Wan 2.2 Studio | NEW AI Scene Planner · 64 Clips · 3 Aud
|
|
| 8571 |
*ui_inputs[16:53],
|
| 8572 |
guidance_scale_2_input, scheduler_dropdown, flow_shift_slider, last_image_component,
|
| 8573 |
]
|
| 8574 |
-
#
|
| 8575 |
-
#
|
| 8576 |
-
#
|
|
|
|
| 8577 |
demo.load(_gpu_estimate_text, _ESTIMATE_INPUTS, gpu_estimate,
|
| 8578 |
show_progress="hidden", api_name=False)
|
| 8579 |
# Further recalculation is on demand and after preparation/Safe Mode changes;
|
|
|
|
| 2213 |
# more RIFE time. No unconditional 60 s floor, 35/120 s adapter surcharge or 35% margin.
|
| 2214 |
rife_seconds = extra_frames * (0.06 if multiplier <= 2 else 0.10)
|
| 2215 |
requested = 10 + denoise_seconds + rife_seconds + _lora_loading_seconds(lora_groups)
|
| 2216 |
+
# Normal keeps the established formula and whole-second SDK reservation.
|
| 2217 |
+
# Worker timing history must not silently turn this into a larger booking:
|
| 2218 |
+
# 3 matching 38 s samples previously changed 32 s runtime / 64 s allowance
|
| 2219 |
+
# into 54 s runtime / 108 s allowance, even with Safe Mode disabled.
|
| 2220 |
+
return max(10, min(600, int(requested)))
|
| 2221 |
+
# Opt-in Safe Mode retains adaptive headroom for slow/cold workers.
|
| 2222 |
return _timing_estimate(_wan_timing_key(resized_image,processed_last_image,steps,guidance_scale,guidance_scale_2,
|
| 2223 |
scheduler_name,flow_shift,frame_multiplier,lora_groups),num_frames,requested,10,600,
|
| 2224 |
+
margin=1.35)
|
| 2225 |
|
| 2226 |
|
| 2227 |
@spaces.GPU(duration=get_inference_duration, size="xlarge")
|
|
|
|
| 6069 |
"xlarge uses a 2× quota multiplier. Requested allowance is checked before generation; "
|
| 6070 |
"this is not a receipt for actual GPU usage. Normal mode restores smaller reservations; "
|
| 6071 |
"LoRA downloads finish on CPU before the GPU request; a size-based loading reserve is then added. "
|
| 6072 |
+
"Unknown adapter sizes are checked before generation. Normal uses the standard formula; worker timing history cannot increase its reservation. Safe Mode adds extra runtime margin and calibrates from 3 comparable completed runs. MP4 encoding runs after GPU release; RIFE remains on GPU. Joining and looping do not book a GPU.</sub>"
|
| 6073 |
)
|
| 6074 |
return "\n".join(lines)
|
| 6075 |
|
|
|
|
| 7678 |
safe_mode_checkbox = gr.Checkbox(
|
| 7679 |
label="🛠️ Safe Mode — extra time for slow or cold runs",
|
| 7680 |
value=False,
|
| 7681 |
+
info="Off uses the standard reservation formula, unaffected by past worker timings. "
|
| 7682 |
+
"On adds extra time and adjusts to measured runs. Enable it if a run reaches "
|
| 7683 |
+
"its time limit. Neither mode changes HF quota rates.",
|
| 7684 |
)
|
| 7685 |
with gr.Group(elem_classes="panel"):
|
| 7686 |
video_output = gr.Video(
|
|
|
|
| 8577 |
*ui_inputs[16:53],
|
| 8578 |
guidance_scale_2_input, scheduler_dropdown, flow_shift_slider, last_image_component,
|
| 8579 |
]
|
| 8580 |
+
# Populate the first rendered page from the actual component defaults, so it
|
| 8581 |
+
# already shows the Normal reservation without a refresh or a queued load job.
|
| 8582 |
+
# Re-read live values on page open as well; both paths use the same GPU formula.
|
| 8583 |
+
gpu_estimate.value = _gpu_estimate_text(*(component.value for component in _ESTIMATE_INPUTS))
|
| 8584 |
demo.load(_gpu_estimate_text, _ESTIMATE_INPUTS, gpu_estimate,
|
| 8585 |
show_progress="hidden", api_name=False)
|
| 8586 |
# Further recalculation is on demand and after preparation/Safe Mode changes;
|