[Fix] SeanetResnetBlock.reset_state doesn't reset StreamingAdd, breaking multi-call decode (#407) - #417
Open
yushuosun wants to merge 1 commit into
Open
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
In
moshi_mlx, repeated streaming decode calls produce corrupted output becauseSeanetResnetBlock.reset_state()does not reset the block'sStreamingAdd(#407).Root cause
SeanetResnetBlock.reset_state()resets the shortcut and the sub-blocks:but never resets
self.streaming_add.StreamingAddcarries_lhs/_rhsresidual buffers acrossstep()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 areset_state()method toStreamingAdd(clears_lhs/_rhs) and call it fromSeanetResnetBlock.reset_state(), consistent with how the block resets its other stateful submodules.Duplicate-check
gh api 'repos/kyutai-labs/moshi/pulls?state=open&per_page=100' --paginategrepped for407→ no open PR references it.