From e2c8aae79887059dc5f29255f2bcd1a4ff2d8312 Mon Sep 17 00:00:00 2001 From: yhcc Date: Sun, 21 Aug 2022 23:45:39 +0800 Subject: [PATCH] =?UTF-8?q?element=E5=A6=82=E6=9E=9C=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96=E5=9C=A8reset=E6=97=B6=E4=B8=8D?= =?UTF-8?q?=E8=B5=B7=E4=BD=9C=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fastNLP/core/metrics/element.py | 2 +- fastNLP/io/utils.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) 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}.")