def load_model(self, model):
if not os.path.exists(self.model_path):
raise Exception("model file directory does not exist.")
suffix = ".model"
keyword = model.__class__.__name__.lower()
candidates = []
for f in os.listdir(self.model_path):
if keyword in f and f.endswith(suffix):
candidates.append(f)
candidates.sort()
latest = candidates[-1]
#print("targets {}, pick up {}.".format(candidates, latest))
model_file = os.path.join(self.model_path, latest)
serializers.load_npz(model_file, model)
resource.py 文件源码
python
阅读 27
收藏 0
点赞 0
评论 0
评论列表
文章目录