Repository navigation
PSGDPro hyperparameter validation - #317
Merged
Merged
Conversation
Signed-off-by: August Vi <augustvilakia@gmail.com>
Contributor
[Low impact] The PR appears safe to merge. Summary
No actionable issues found. Tests were not run during this review. Reviews (1) · Last reviewed commit: "Validate PSGDPro hyperparameters at cons..." · Reviewed by Greptile |
skyw
approved these changes
Oct 21, 2026
skyw
left a comment
Contributor
There was a problem hiding this comment.
Thanks for the contribution.
We should probably unify optimizer argument validation at some point FWIW.
Contributor
|
/ok to test e01e212 |
This branch was successfully deployed
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
PSGDProstores every argument without checking it.warmup_steps=0is only noticed on the firststep(), as aZeroDivisionErrorfrom_get_precond_lr:Out-of-range values for the other arguments are accepted silently: a negative
lr,weight_decayorprecond_lr, or amomentumorbeta_lipof 1 or more. The scalar optimizers already reject the shared ones in_validate_common_hparams, and Shampoo checkslr(shampoo.py:346).This PR adds the same kind of checks at the top of
PSGDPro.__init__, with the sameInvalid ...messages:lr< 0weight_decay< 0momentum[0, 1)beta_lip[0, 1)precond_lr< 0min_precond_lr< 0warmup_steps<= 0Test
TestPSGDPro.test_invalid_arguments_raiseintests/test_psgd_pro.pyis parameterized over the seven cases, in the same shape astest_invalid_arguments_raiseintests/test_shampoo.py.On
main:With this change:
Verification
On CPU, torch 2.14.1, Python 3.12:
python tests/test_psgd_pro.py --device=cpuwith--seed=42and--seed=3735928559: 8 OKtests/test_psgd_utils.py31 OK,tests/test_procrustes_step.py28 OK,tests/test_psgd_contractions.py11 OKtests/convergence/psgd_convergence_test.py --device=cpu: 3 OKpre-commit run --files emerging_optimizers/psgd/psgd.py tests/test_psgd_pro.py: all hooks pass