Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __enter__(self):
#silence progress bar
fastprogress.fastprogress.NO_BAR = True
fastai.basic_train.master_bar,fastai.basic_train.progress_bar = force_console_behavior()
self.orig_callback_fns = copy(self.learn.callback_fns)
rec_name = [x for x in self.learn.callback_fns if hasattr(x, 'func') and x.func == Recorder]
if len(rec_name):
rec_idx = self.learn.callback_fns.index(rec_name[0])
self.learn.callback_fns[rec_idx] = partial(Recorder, add_time=True, silent=True) #silence recorder
return self.learn