From 014986f2e3491341aff5202c6a5eda56c6da6001 Mon Sep 17 00:00:00 2001 From: magic-akari Date: Thu, 6 Jul 2023 23:06:01 +0800 Subject: [PATCH 1/3] fix: E722 issues --- train.py | 2 +- utils.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/train.py b/train.py index 248dd8b..b9132a2 100644 --- a/train.py +++ b/train.py @@ -99,7 +99,7 @@ def run(rank, n_gpus, hps): name=utils.latest_checkpoint_path(hps.model_dir, "D_*.pth") global_step=int(name[name.rfind("_")+1:name.rfind(".")])+1 #global_step = (epoch_str - 1) * len(train_loader) - except: # noqa: E722 I have no idea about this CC: @ylzz1997 + except AssertionError: print("load old checkpoint failed...") epoch_str = 1 global_step = 0 diff --git a/utils.py b/utils.py index 3f286cc..27cee07 100644 --- a/utils.py +++ b/utils.py @@ -164,7 +164,7 @@ def load_checkpoint(checkpoint_path, model, optimizer=None, skip_optimizer=False # print("load", k) new_state_dict[k] = saved_state_dict[k] assert saved_state_dict[k].shape == v.shape, (saved_state_dict[k].shape, v.shape) - except: # noqa: E722 I have no idea about this CC: @ylzz1997 + except AssertionError: print("error, %s is not in the checkpoint" % k) logger.info("%s is not in the checkpoint" % k) new_state_dict[k] = v @@ -483,7 +483,7 @@ def train_index(spk_name,root_dir = "dataset/44k/"): #from: RVC https://github. .fit(big_npy) .cluster_centers_ ) - except: # noqa: E722 + except ValueError: info = traceback.format_exc() print(info) n_ivf = min(int(16 * np.sqrt(big_npy.shape[0])), big_npy.shape[0] // 39) From 136b2308503a61a16050d4b1cf4d862594ce4e4d Mon Sep 17 00:00:00 2001 From: magic-akari Date: Thu, 6 Jul 2023 23:38:02 +0800 Subject: [PATCH 2/3] fix: E722 --- train.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/train.py b/train.py index b9132a2..7aec545 100644 --- a/train.py +++ b/train.py @@ -99,7 +99,7 @@ def run(rank, n_gpus, hps): name=utils.latest_checkpoint_path(hps.model_dir, "D_*.pth") global_step=int(name[name.rfind("_")+1:name.rfind(".")])+1 #global_step = (epoch_str - 1) * len(train_loader) - except AssertionError: + except Exception: print("load old checkpoint failed...") epoch_str = 1 global_step = 0 From d2ae02c24e739c940b1a12e7ec728238176247fb Mon Sep 17 00:00:00 2001 From: YuriHead Date: Thu, 6 Jul 2023 23:42:08 +0800 Subject: [PATCH 3/3] Update utils.py --- utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils.py b/utils.py index 27cee07..5b2bea9 100644 --- a/utils.py +++ b/utils.py @@ -164,7 +164,7 @@ def load_checkpoint(checkpoint_path, model, optimizer=None, skip_optimizer=False # print("load", k) new_state_dict[k] = saved_state_dict[k] assert saved_state_dict[k].shape == v.shape, (saved_state_dict[k].shape, v.shape) - except AssertionError: + except Exception: print("error, %s is not in the checkpoint" % k) logger.info("%s is not in the checkpoint" % k) new_state_dict[k] = v @@ -483,7 +483,7 @@ def train_index(spk_name,root_dir = "dataset/44k/"): #from: RVC https://github. .fit(big_npy) .cluster_centers_ ) - except ValueError: + except Exception: info = traceback.format_exc() print(info) n_ivf = min(int(16 * np.sqrt(big_npy.shape[0])), big_npy.shape[0] // 39)