Commit a5f3adbd authored by Muhammad Rizqi Nur's avatar Muhammad Rizqi Nur

Allow trailing comma in learning rate

parent 35c45df2
......@@ -11,7 +11,10 @@ class LearnScheduleIterator:
self.rates = []
self.it = 0
self.maxit = 0
try:
for i, pair in enumerate(pairs):
if not pair.strip():
continue
tmp = pair.split(':')
if len(tmp) == 2:
step = int(tmp[1])
......@@ -28,6 +31,10 @@ class LearnScheduleIterator:
self.rates.append((float(tmp[0]), max_steps))
self.maxit += 1
return
assert self.rates
except (ValueError, AssertionError):
raise Exception("Invalid learning rate schedule")
def __iter__(self):
return self
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment