feat(optim): add auditable parameter-group coverage - #186
Open
PinkTulips139 wants to merge 1 commit into
Open
Conversation
Contributor
Author
|
CI note: the only failing job is the legacy Python 3.8 / PyTorch 1.8.0 environment, which fails in the existing Mixture tests because |
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.
Summary
Adds a read-only optimizer parameter-group audit for validating how model parameters are assigned to
optimizer.param_groups.The audit makes optimizer construction more observable by checking trainable-parameter coverage, duplicate assignments, frozen parameters present in the optimizer, and optimizer parameters that cannot be mapped back to the model.
Changes
audit_optimizer_param_groups(model, optimizer, strict=False).OptimizerGroupAuditError.lr, optionalinitial_lr,weight_decay, and explicit group metadata.group_name,name, androle.Strictness
With
strict=False, all findings are returned as structured data without interrupting training.With
strict=True, missing trainable parameters, duplicate assignments, and unknown optimizer parameters raiseOptimizerGroupAuditError.Frozen parameters in optimizer groups are reported but are not automatically removed.
Behavior guarantees
This PR does not change:
initial_lror weight decay;The audit is a read-only snapshot of the current optimizer state.
Validation
20 passedin optimizer-group audit tests9 passedin PEFT optimizer-policy tests3 passedin LoRA layer-decay testsgit diff --checkpassedThe tests cover exactly-once coverage, missing and duplicate parameters, frozen and unknown parameters, strict versus reporting modes, JSON serialization, group statistics, scheduler-updated learning rates, and non-PEFT optimizers.