From 1c3044f5df54f887888bbf5707ead1d40ec25695 Mon Sep 17 00:00:00 2001 From: Piotr Czapla Date: Mon, 13 May 2019 03:44:35 +0200 Subject: [PATCH] fix issue with cls_best add lmseed to poleval --- ulmfit/__main__.py | 2 +- ulmfit/train_clas.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ulmfit/__main__.py b/ulmfit/__main__.py index 144c0be..18ccb16 100644 --- a/ulmfit/__main__.py +++ b/ulmfit/__main__.py @@ -92,7 +92,7 @@ class ULMFiT: self.poleval19_seeds(clsbase, seed_name='clsweightseed', **kwargs) self.poleval19_seeds(clsbase, seed_name='clstrainseed', **kwargs) - def poleval19_init(self, base, name=None, **kwargs): + def poleval19_init(self, base, name=None, lmseed=None, **kwargs): clstrainseed = clsweightseed = ftseed = lmseed = 0 if "wiki" in base: lmtype = "wiki" diff --git a/ulmfit/train_clas.py b/ulmfit/train_clas.py index 0f395c6..581a924 100644 --- a/ulmfit/train_clas.py +++ b/ulmfit/train_clas.py @@ -148,7 +148,7 @@ class CLSHyperParams(LMHyperParams): raise ValueError(f"Wrong lr_sched: {lr_sched}") print(f"Saving models at {learn.path / learn.model_dir}") - learn.save('cls_last', with_opt=False) + learn.save('cls_best', with_opt=False) #learn.save('cls_best', with_opt=False) # we don't use early stopping for the time being del learn return self.validate_cls('cls_best', bs=bs, data_tst=data_tst, learn=None) @@ -198,7 +198,7 @@ class CLSHyperParams(LMHyperParams): learn.freeze() learn.callback_fns += [partial(CSVLogger, filename=f"{learn.model_dir}/cls-history"), - partial(SaveModelCallback, every='improvement', name='cls_best', monitor="f_beta") + partial(SaveModelCallback, every='improvement', name='cls_best_tmp', monitor="f_beta") ] if label_smoothing_eps > 0.0: learn.loss_func = FlattenedLoss(LabelSmoothingCrossEntropy, eps=label_smoothing_eps)