BoxOfColors Claude Sonnet 4.6 commited on
Commit
cc23c05
·
1 Parent(s): e3d955b

Fix xregen ZeroGPU TypeError: duration fns must accept all positional args

Browse files

When xregen_mmaudio/xregen_hunyuan call _mmaudio_gpu_infer / _hunyuan_gpu_infer
with clip_start_s and clip_dur_s as positional args (positions 12/13 and 15/16
respectively), ZeroGPU forwards all args to the duration fn before running the
GPU fn. The duration fns only had 9/10 explicit params + **_kwargs — but **_kwargs
only absorbs *keyword* args, not extra positionals. This caused:

TypeError: _mmaudio_duration() takes from 9 to 10 positional arguments but 13 given

which aborted the GPU task before inference even started, causing the Video slot
to show the red Gradio 'Error' component.

Fix: add silent_video, segments_json, clip_start_s, clip_dur_s (and total_dur_s
for hunyuan) to the duration fn signatures with safe defaults. These params are
ignored in the duration calculation — they only exist to match the GPU fn's full
positional signature so ZeroGPU's internal dispatch doesn't blow up.

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

Files changed (1) hide show
  1. app.py +12 -7
app.py CHANGED
@@ -1004,10 +1004,12 @@ def generate_taro(video_file, seed_val, cfg_scale, num_steps, mode,
1004
 
1005
  def _mmaudio_duration(video_file, prompt, negative_prompt, seed_val,
1006
  cfg_strength, num_steps, crossfade_s, crossfade_db, num_samples,
1007
- **_kwargs):
1008
- """Pre-GPU callable — must match _mmaudio_gpu_infer's input order exactly.
1009
- Extra kwargs (silent_video, segments_json) are absorbed by **_kwargs so the
1010
- duration fn signature stays in sync with the 9-input Gradio registration."""
 
 
1011
  return _estimate_gpu_duration("mmaudio", int(num_samples), int(num_steps),
1012
  video_file=video_file, crossfade_s=crossfade_s)
1013
 
@@ -1167,9 +1169,12 @@ def generate_mmaudio(video_file, prompt, negative_prompt, seed_val,
1167
 
1168
  def _hunyuan_duration(video_file, prompt, negative_prompt, seed_val,
1169
  guidance_scale, num_steps, model_size, crossfade_s, crossfade_db,
1170
- num_samples, **_kwargs):
1171
- """Pre-GPU callable — must match _hunyuan_gpu_infer's input order exactly.
1172
- Extra kwargs (silent_video, segments_json, total_dur_s) absorbed by **_kwargs."""
 
 
 
1173
  return _estimate_gpu_duration("hunyuan", int(num_samples), int(num_steps),
1174
  video_file=video_file, crossfade_s=crossfade_s)
1175
 
 
1004
 
1005
  def _mmaudio_duration(video_file, prompt, negative_prompt, seed_val,
1006
  cfg_strength, num_steps, crossfade_s, crossfade_db, num_samples,
1007
+ silent_video=None, segments_json=None,
1008
+ clip_start_s=0.0, clip_dur_s=None, **_kwargs):
1009
+ """Pre-GPU callable must match _mmaudio_gpu_infer's input signature exactly.
1010
+ silent_video, segments_json, clip_start_s, clip_dur_s are extra positional args
1011
+ that xregen passes; they must appear here so ZeroGPU doesn't raise TypeError
1012
+ when forwarding all args to this duration fn before the GPU fn runs."""
1013
  return _estimate_gpu_duration("mmaudio", int(num_samples), int(num_steps),
1014
  video_file=video_file, crossfade_s=crossfade_s)
1015
 
 
1169
 
1170
  def _hunyuan_duration(video_file, prompt, negative_prompt, seed_val,
1171
  guidance_scale, num_steps, model_size, crossfade_s, crossfade_db,
1172
+ num_samples, silent_video=None, segments_json=None, total_dur_s=None,
1173
+ clip_start_s=0.0, clip_dur_s=None, **_kwargs):
1174
+ """Pre-GPU callable must match _hunyuan_gpu_infer's input signature exactly.
1175
+ silent_video, segments_json, total_dur_s, clip_start_s, clip_dur_s are extra
1176
+ positional args that xregen passes; they must appear here so ZeroGPU doesn't
1177
+ raise TypeError when forwarding all args to this duration fn."""
1178
  return _estimate_gpu_duration("hunyuan", int(num_samples), int(num_steps),
1179
  video_file=video_file, crossfade_s=crossfade_s)
1180