add model.save

This commit is contained in:
Dun Liang 2020-05-16 15:03:41 +08:00
parent e45f5cb917
commit 498e10f715
1 changed files with 4 additions and 0 deletions

View File

@ -616,6 +616,10 @@ class Module:
with open(path, 'wb') as f:
pickle.dump(params_dict, f, pickle.HIGHEST_PROTOCOL)
def load(self, path):
with open(path, 'rb') as f:
self.load_parameters(pickle.load(f))
def eval(self):
def callback(parents, k, v, n):
if isinstance(v, Module) and hasattr(v, "is_train"):