Skip to content

fix(txt2vid): callback kwargs are nested into get_timesteps_arr instead of make_clip_frames - #1843

Open
Anai-Guo wants to merge 1 commit into
Sygil-Dev:masterfrom
Anai-Guo:fix/txt2vid-callback-kwargs-misplaced
Open

fix(txt2vid): callback kwargs are nested into get_timesteps_arr instead of make_clip_frames#1843
Anai-Guo wants to merge 1 commit into
Sygil-Dev:masterfrom
Anai-Guo:fix/txt2vid-callback-kwargs-misplaced

Conversation

@Anai-Guo

@Anai-Guo Anai-Guo commented Sep 5, 2026

Copy link
Copy Markdown

Problem

In StableDiffusionWalkPipeline.walk, callback= and callback_steps= are indented one level too deep — they land inside the get_timesteps_arr(...) sub-expression that computes T, instead of staying on the enclosing self.make_clip_frames(...) call:

            self.make_clip_frames(
                ...
                skip=skip,
                T=get_timesteps_arr(
                    audio_filepath,
                    offset=audio_offset,
                    duration=audio_duration,
                    fps=fps,
                    margin=margin,
                    smooth=smooth,
                    callback=callback,               # <-- belongs to make_clip_frames
                    callback_steps=callback_steps,   # <-- belongs to make_clip_frames
                )
                if audio_filepath
                else None,
            )

get_timesteps_arr accepts neither:

def get_timesteps_arr(audio_filepath, offset, duration, fps=30, margin=1.0, smooth=0.0):

while make_clip_frames declares both (callback=None, callback_steps: int = 1).

This breaks the progress callback on both paths:

  • audio_filepath set → the get_timesteps_arr(...) call is evaluated and raises TypeError: get_timesteps_arr() got an unexpected keyword argument 'callback'. Every audio-driven walk() dies before the first frame.
  • no audio_filepath → the ternary short-circuits, so nothing raises, but make_clip_frames is called without callback/callback_steps. They fall back to None/1 and the caller's progress callback silently never fires.

The same block is duplicated verbatim in the streamlit copy, so both are fixed here.

  • scripts/txt2vid.py:964
  • webui/streamlit/scripts/txt2vid.py:959

Fix

Dedent the two kwargs by one level so they close on make_clip_frames(...) instead of get_timesteps_arr(...). No other change — 2 lines per file.

Verification

No Stable-Diffusion runtime on this box, so I checked it structurally: parse the live file with ast, build stubs carrying the real signatures of get_timesteps_arr and make_clip_frames, and replay every call site through inspect.Signature.bind, before and after the patch.

##### scripts/txt2vid.py
  master:
    make_clip_frames   line 949   OK        callback forwarded=False
    get_timesteps_arr  line 964   TypeError got an unexpected keyword argument 'callback'
  patched:
    make_clip_frames   line 949   OK        callback forwarded=True
    get_timesteps_arr  line 964   OK        kwargs=['offset', 'duration', 'fps', 'margin', 'smooth']

##### webui/streamlit/scripts/txt2vid.py
  master:
    make_clip_frames   line 944   OK        callback forwarded=False
    get_timesteps_arr  line 959   TypeError got an unexpected keyword argument 'callback'
  patched:
    make_clip_frames   line 944   OK        callback forwarded=True
    get_timesteps_arr  line 959   OK        kwargs=['offset', 'duration', 'fps', 'margin', 'smooth']

Both halves of the bug show up and both clear: the TypeError goes away, and callback forwarded flips FalseTrue, which is the silent half that the crash was masking.

🤖 Generated with Claude Code

…ip_frames

callback= and callback_steps= are indented into the get_timesteps_arr(...)
sub-expression that computes T, but get_timesteps_arr accepts neither, so any
audio-driven walk raises TypeError. They belong to the enclosing
make_clip_frames(...) call, which does declare both -- and which currently
never receives them, so the progress callback silently never fires even when
no audio file is given and the ternary short-circuits the crash.

Signed-off-by: Tai An <antai12232931@outlook.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant