I am looking at the documentation (on GitHub repository).
Didn’t find it, but the method Learner.fit_one_cycle()
presumably is essentially the same as calling the function fit_one_cycle()
.
The signature of the function fit_one_cycle()
reads
def fit_one_cycle(learn:Learner, cyc_len:int, max_lr:Union[Floats,slice]=defaults.lr,
moms:Tuple[float,float]=(0.95,0.85), div_factor:float=25., pct_start:float=0.3, final_div:float=None,
wd:float=None, callbacks:Optional[CallbackList]=None, tot_epochs:int=None, start_epoch:i
This function fit_one_cycle()
ends with a call to the method Learner.fit()
:
learn.fit(cyc_len, max_lr, wd=wd, callbacks=callbacks)
noting that the argument cyc_len
is passed as the parameter epochs
, according to the signature of Learner.fit()
def fit(self, epochs:int, lr:Union[Floats,slice]=defaults.lr,
wd:Floats=None, callbacks:Collection[Callback]=None)->None:
In other words, the cycle length appears to be the same as the number of epochs.
The method Learner.fit()
ends with a call to the function fit()
:
fit(epochs, self, metrics=self.metrics, callbacks=self.callbacks+callbacks)
whose signature is:
def fit(epochs:int, learn:BasicLearner, callbacks:Optional[CallbackList]=None, metrics:OptMetrics=None)->None:
At this point, I would conclude that:
Whether learner.fit_one_cycle(3)
is different from calling learner.fit_one_cycle(1)
3 times boils down to whether learner.fit(3)
is different from calling learner.fit(1)
3 times.
Now, in the declaration of the function fit()
there is a loop over epochs
. I am not versed enough in callback functions to know what exactly they do, but on first inspection I didn’t see that this loop inside fit()
would do anything different from a loop “outside” fit()
.