From d80ac2fd2df4e7fb8a28acfa512bb11472b5cc99 Mon Sep 17 00:00:00 2001
From: liugz18 <57401541+liugz18@users.noreply.github.com>
Date: 星期四, 18 七月 2024 21:34:55 +0800
Subject: [PATCH] Rename 'res' in line 514 to avoid with naming conflict with line 365
---
funasr/train_utils/load_pretrained_model.py | 19 +++++++++++--------
1 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/funasr/train_utils/load_pretrained_model.py b/funasr/train_utils/load_pretrained_model.py
index df0790d..8ed613c 100644
--- a/funasr/train_utils/load_pretrained_model.py
+++ b/funasr/train_utils/load_pretrained_model.py
@@ -52,16 +52,19 @@
if excludes is not None:
if isinstance(excludes, str):
excludes = excludes.split(",")
- if not isinstance(excludes, (tuple, list)):
- excludes = [excludes]
+
logging.info(f"excludes: {excludes}")
for k in dst_state.keys():
-
- for k_ex in excludes:
- if k.startswith(k_ex):
- logging.info(f"key: {{k}} matching: {k_ex}, excluded")
- continue
+ excludes_flag = False
+ if excludes is not None:
+ for k_ex in excludes:
+ if k.startswith(k_ex):
+ logging.info(f"key: {k} matching: {k_ex}, excluded")
+ excludes_flag = True
+ break
+ if excludes_flag:
+ continue
k_src = k
@@ -93,7 +96,7 @@
dst_state[k] = src_state[k_src]
else:
- logging.info(f"Warning, miss key in ckpt: {k}, mapped: {k_src}")
+ print(f"Warning, miss key in ckpt: {k}, {path}")
flag = obj.load_state_dict(dst_state, strict=True)
logging.info(f"Loading ckpt: {path}, status: {flag}")
--
Gitblit v1.9.1