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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mutating the state of a module (
self.mel_transform) during the forward pass is generally discouraged in PyTorch. This can lead to issues in distributed training environments like DeepSpeed (as mentioned in the PR title), especially with Stage 3 where parameters and buffers are managed and partitioned. Modifying them duringforwardcan cause synchronization errors or unexpected behavior.Additionally, the assignment
self.mel_transform = self.mel_transform.to(...)is redundant because.to()on annn.Moduleis an in-place operation. If you must ensure FP32 for FFT compatibility, consider ensuring the module is in the correct precision during initialization or setup, or at least avoid the redundant assignment.