1
0
mirror of https://github.com/microsoft/qlib.git synced 2026-07-03 19:10:58 +08:00

fix tra when logdir is None

This commit is contained in:
Dong Zhou
2021-08-02 03:57:14 -07:00
committed by you-n-g
parent da1f4db968
commit e71e2f941c

View File

@@ -352,7 +352,8 @@ class TRAModel(Model):
"model": copy.deepcopy(self.model.state_dict()),
"tra": copy.deepcopy(self.tra.state_dict()),
}
torch.save(best_params, self.logdir + "/model.bin")
if self.logdir is not None:
torch.save(best_params, self.logdir + "/model.bin")
else:
stop_rounds += 1
if stop_rounds >= self.early_stop: