Repository navigation
fix(scalarization): Register tensor attributes as buffers - #842
Merged
ValerianRey merged 3 commits intoNov 5, 2026
Merged
ValerianRey merged 3 commits into
ValerianRey merged 3 commits into
Conversation
SajalDevX
requested review from
a team,
PierreQuinton,
ValerianRey and
ppraneth
as code owners
November 5, 2026 05:55
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
|
LGTM, tyvm. I also fixed an inconsistency: FAMO already had a user-provided buffer that was persistent. I just made it non-persistent like the others. |
ValerianRey
approved these changes
Nov 5, 2026
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.
Follow-up to #839, as suggested there: same change for the scalarizers.
Constant,STCH,PBIandCOSMOSstored theirweightsandreferencetensors as plain attributes, so.to()on the scalarizer did not move them. They are now registered as non-persistent buffers, so they follow the scalarizer's dtype and device and stay out of itsstate_dict. Attribute access (and reassigning, e.g.pbi.weights = ...) works as before.The other scalarizers either store no tensors or already use parameters/buffers (
FAMO,UW,IMTLL). I leftDWAalone since its tensors are running state computed from the losses, not user inputs.Testing: added a
test_to_moves_*test for each of the 4 classes. They fail on main and pass with the change.uv run pytest tests/unit/scalarization, ruff and ty pass.