未验证 提交 0296639d 编写于 作者: H Hui Zhang 提交者: GitHub

Merge pull request #701 from PaddlePaddle/ckpt

fix load param
...@@ -16,8 +16,8 @@ import json ...@@ -16,8 +16,8 @@ import json
import os import os
import re import re
from pathlib import Path from pathlib import Path
from typing import Union
from typing import Text from typing import Text
from typing import Union
import paddle import paddle
from paddle import distributed as dist from paddle import distributed as dist
...@@ -146,7 +146,7 @@ class Checkpoint(): ...@@ -146,7 +146,7 @@ class Checkpoint():
Returns: Returns:
configs (dict): epoch or step, lr and other meta info should be saved. configs (dict): epoch or step, lr and other meta info should be saved.
""" """
return self._load_parameters(model, optimizer, checkpoint_dir, return self.load_parameters(model, optimizer, checkpoint_dir,
checkpoint_path, "checkpoint_latest") checkpoint_path, "checkpoint_latest")
def load_best_parameters(self, def load_best_parameters(self,
...@@ -166,7 +166,7 @@ class Checkpoint(): ...@@ -166,7 +166,7 @@ class Checkpoint():
Returns: Returns:
configs (dict): epoch or step, lr and other meta info should be saved. configs (dict): epoch or step, lr and other meta info should be saved.
""" """
return self._load_parameters(model, optimizer, checkpoint_dir, return self.load_parameters(model, optimizer, checkpoint_dir,
checkpoint_path, "checkpoint_best") checkpoint_path, "checkpoint_best")
def _should_save_best(self, metric: float) -> bool: def _should_save_best(self, metric: float) -> bool:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册