fix: resolve TypeError in BlockMinifloatQuantize backward pass#302
Open
Shreyas8612 wants to merge 1 commit intoDeepWok:mainfrom
Open
fix: resolve TypeError in BlockMinifloatQuantize backward pass#302Shreyas8612 wants to merge 1 commit intoDeepWok:mainfrom
Shreyas8612 wants to merge 1 commit intoDeepWok:mainfrom
Conversation
Removed unnecessary arguments from the backward method to match PyTorch autograd.Function requirements and fix TypeError.
There was a problem hiding this comment.
Pull request overview
This PR fixes a TypeError in the backward pass of BlockMinifloatQuantize by correcting the method signature. The backward method incorrectly defined additional positional arguments that PyTorch's autograd engine does not provide, causing crashes during training.
Changes:
- Removed incorrect positional arguments (
width,exponent_width,exponent_bias_width,block_size,skip_first_dim) from thebackwardmethod signature - Maintained the correct return statement with 6 values (gradient for input tensor + 5
Nonevalues for non-tensor parameters)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Description
This PR fixes a
TypeErroroccurring during the backward pass ofBlockMinifloatQuantize. Thebackwardmethod was defined with additional positional arguments (width,exponent_width, etc.) that are not provided by the PyTorch autograd engine, leading to a signature mismatch.Changes
BlockMinifloatQuantize.backward.Nonefor the non-tensor inputs of theforwardmethod).Testing
Verified that the training/inference loop no longer crashes with:
`TypeError: BlockMinifloatQuantize.backward() missing 3 required positional arguments