Skip to content

[Fix] SeanetResnetBlock.reset_state doesn't reset StreamingAdd, breaking multi-call decode (#407) - #417

Open
yushuosun wants to merge 1 commit into
kyutai-labs:mainfrom
yushuosun:fix/seanet-reset-streaming-add
Open

[Fix] SeanetResnetBlock.reset_state doesn't reset StreamingAdd, breaking multi-call decode (#407)#417
yushuosun wants to merge 1 commit into
kyutai-labs:mainfrom
yushuosun:fix/seanet-reset-streaming-add

Conversation

@yushuosun

Copy link
Copy Markdown

Motivation

In moshi_mlx, repeated streaming decode calls produce corrupted output because SeanetResnetBlock.reset_state() does not reset the block's StreamingAdd (#407).

Root cause

SeanetResnetBlock.reset_state() resets the shortcut and the sub-blocks:

def reset_state(self):
    if self.shortcut is not None:
        self.shortcut.reset_state()
    for b in self.block:
        b.reset_state()

but never resets self.streaming_add. StreamingAdd carries _lhs/_rhs residual buffers across step() calls, so after the first streaming decode those stale buffers leak into the next decode, corrupting the result.

Modifications

moshi_mlx/moshi_mlx/modules/seanet.py: add a reset_state() method to StreamingAdd (clears _lhs/_rhs) and call it from SeanetResnetBlock.reset_state(), consistent with how the block resets its other stateful submodules.

Duplicate-check

SeanetResnetBlock.reset_state reset the sub-blocks and shortcut but not its
StreamingAdd, whose _lhs/_rhs buffers persisted across decode calls. After the
first streaming decode, the stale residual buffers corrupted subsequent decodes.
Add a reset_state() to StreamingAdd and call it from SeanetResnetBlock.reset_state.
Copilot AI review requested due to automatic review settings June 29, 2026 17:12

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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.

2 participants