Skip to content

Commit 5aa4d13

Browse files
authored
Merge pull request #385 from kozistr/fix/scion-optimizer
[Fix] momentum in SCION optimizer
2 parents 9753eda + 64a7e7d commit 5aa4d13

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

docs/changelogs/v3.6.1.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
## Change Log
2+
3+
### Fix
4+
5+
* Fix to use `momentum buffer` instead of the gradient to calculate LMO. (#385)

pytorch_optimizer/optimizer/scion.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ def step(self, closure: CLOSURE = None) -> LOSS:
409409

410410
d.mul_(1.0 - group['momentum']).add_(grad, alpha=group['momentum'])
411411

412-
update = norm.lmo(grad).mul_(group['scale'])
412+
update = norm.lmo(d).mul_(group['scale'])
413413

414414
if group['constraint']:
415415
p.mul_(1.0 - group['lr'])

tests/constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,7 @@
640640
(Kron, {'lr': 1e0, 'weight_decay': 1e-3}, 3),
641641
(EXAdam, {'lr': 1e-1, 'weight_decay': 1e-3}, 5),
642642
(SCION, {'lr': 5e-1, 'constraint': False, 'weight_decay': 1e-3}, 5),
643-
(SCION, {'lr': 2e-1, 'constraint': True}, 5),
643+
(SCION, {'lr': 5e-1, 'constraint': True}, 20),
644644
(SCIONLight, {'lr': 5e-1, 'constraint': False, 'weight_decay': 1e-3}, 5),
645645
(SCIONLight, {'lr': 2e-1, 'constraint': True}, 5),
646646
(AdaGC, {'lr': 1e-1, 'warmup_steps': 2, 'weight_decay': 1e-3}, 5),

0 commit comments

Comments
 (0)