specify learn_rate as "0.001:100, 0.00001:1000, 1e-5:10000" to have lr of 0.001 until step 100, 0.00001 until 1000, 1e-5:10000 until 10000
specify learn_rate as "0.001:100, 0.00001:1000, 1e-5:10000" to have lr of 0.001 until step 100, 0.00001 until 1000, and 1e-5 until 10000
"""
pairs=learn_rate.split(',')
self.rates=[]
self.it=0
self.maxit=0
try:
fori,pairinenumerate(pairs):
ifnotpair.strip():
continue
tmp=pair.split(':')
iflen(tmp)==2:
step=int(tmp[1])
...
...
@@ -28,6 +31,10 @@ class LearnScheduleIterator:
self.rates.append((float(tmp[0]),max_steps))
self.maxit+=1
return
assertself.rates
except(ValueError,AssertionError):
raiseException('Invalid learning rate schedule. It should be a number or, for example, like "0.001:100, 0.00001:1000, 1e-5:10000" to have lr of 0.001 until step 100, 0.00001 until 1000, and 1e-5 until 10000.')