Repository navigation
Conversation
Collaborator
|
Looks good, thanks @kiteretsu903! |
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
as I mentioned in #1854, I ran into an optimizer-parity failure during validation and wanted to look into it separately. I found that wrapping a model with no output bias still adds one as a trainable parameter. For DistilGPT2, that gives the optimizer 50,257 extra values to update.
I changed that synthetic bias to a buffer, so users can use
bridge.parameters()without having to filter it out themselves. Wrapping a layer with a real bias still preserves its parameter. Bias folding, saving/loading, and CPU/disk offloading are covered too, including removing and reattaching the offload hooks.In a small float64 reproduction, three AdamW steps caused the wrapped layer's logits to drift by about 0.003 from the original layer. With the fix, they matched exactly.
I kept the float64 optimizer test from #1867 and removed its manual bias filter. I also added FP32 training, cross-entropy training, and focused bias/offload regression checks. There's still some FP32 AdamW drift to investigate separately.
Validation
I ran these locally with Python 3.12 and the existing locked CPU dependencies:
make formatandmake check-formatType of change
Checklist: