Skip to content

Commit

Permalink
fix fastai/fastbook/issues/263 - fix generated file too
Browse files Browse the repository at this point in the history
potential fix for fastai/fastbook#263
  • Loading branch information
Tagar authored Sep 14, 2020
1 parent 92d8a92 commit 00a4792
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fastai/callback/schedule.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def combine_scheds(pcts, scheds):
assert torch.all(pcts >= 0)
pcts = torch.cumsum(pcts, 0)
def _inner(pos):
if pos == 1.: return scheds[-1](1.)
if int(pos) == 1: return scheds[-1](1.)
idx = (pos >= pcts).nonzero().max()
actual_pos = (pos-pcts[idx]) / (pcts[idx+1]-pcts[idx])
return scheds[idx](actual_pos.item())
Expand Down Expand Up @@ -233,4 +233,4 @@ def lr_find(self:Learner, start_lr=1e-7, end_lr=10, num_it=100, stop_div=True, s
lr_min = lrs[losses.argmin()].item()
grads = (losses[1:]-losses[:-1]) / (lrs[1:].log()-lrs[:-1].log())
lr_steep = lrs[grads.argmin()].item()
return SuggestedLRs(lr_min/10.,lr_steep)
return SuggestedLRs(lr_min/10.,lr_steep)

0 comments on commit 00a4792

Please sign in to comment.