diff --git a/fastNLP/core/metrics/element.py b/fastNLP/core/metrics/element.py index 5a52e4fa..359df3b8 100644 --- a/fastNLP/core/metrics/element.py +++ b/fastNLP/core/metrics/element.py @@ -88,7 +88,7 @@ class Element: """ 重置 value """ - if self.backend.is_specified(): + if self.backend.is_specified() and self._value is not None: self._value = self.backend.fill_value(self._value, self.init_value) @property diff --git a/fastNLP/io/utils.py b/fastNLP/io/utils.py index a3af71f5..c53d6158 100644 --- a/fastNLP/io/utils.py +++ b/fastNLP/io/utils.py @@ -52,8 +52,8 @@ def check_loader_paths(paths: Union[str, Dict[str, str]]) -> Dict[str, str]: path_pair = ('test', filename) if path_pair: if path_pair[0] in files: - raise FileExistsError(f"Two files contain `{path_pair[0]}` were found, please specify the " - f"filepath for `{path_pair[0]}`.") + raise FileExistsError(f"Two files contain `{path_pair[0]}` were found in {paths}, please specify " + f"the filepath for `{path_pair[0]}`.") files[path_pair[0]] = os.path.join(paths, path_pair[1]) # if 'train' not in files: # raise KeyError(f"There is no train file in {paths}.")