Skip to content

Commit 1e296e8

Browse files
authored
Update ranger.py
beta default of .95 instead of .90 based on testing with ImageWoof Comments regarding default params and recommendations to try/test with.
1 parent 22e8bb6 commit 1e296e8

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

ranger.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
class Ranger(Optimizer):
1212

13-
def __init__(self, params, lr=1e-3, alpha=0.5, k=6, N_sma_threshhold=5, betas=(.9,0.999), eps=1e-8, weight_decay=0):
13+
def __init__(self, params, lr=1e-3, alpha=0.5, k=6, N_sma_threshhold=5, betas=(.95,0.999), eps=1e-8, weight_decay=0):
1414
#parameter checks
1515
if not 0.0 <= alpha <= 1.0:
1616
raise ValueError(f'Invalid slow update rate: {alpha}')
@@ -21,6 +21,11 @@ def __init__(self, params, lr=1e-3, alpha=0.5, k=6, N_sma_threshhold=5, betas=(.
2121
if not eps > 0:
2222
raise ValueError(f'Invalid eps: {eps}')
2323

24+
#parameter comments:
25+
# beta1 (momentum) of .95 seems to work better than .90...
26+
#N_sma_threshold of 5 seems better in testing than 4.
27+
#In both cases, worth testing on your dataset (.90 vs .95, 4 vs 5) to make sure which works best for you.
28+
2429
#prep defaults and init torch.optim base
2530
defaults = dict(lr=lr, betas=betas, eps=eps, weight_decay=weight_decay)
2631
super().__init__(params,defaults)

0 commit comments

Comments
 (0)