Added capability of continue training from previous checkpoints
This commit is contained in:
+16
-13
@@ -98,19 +98,22 @@ def run(rank, n_gpus, hps):
|
|||||||
net_d = MultiPeriodDiscriminator(hps.model.use_spectral_norm).cuda(rank)
|
net_d = MultiPeriodDiscriminator(hps.model.use_spectral_norm).cuda(rank)
|
||||||
|
|
||||||
# load existing model
|
# load existing model
|
||||||
G_ckpt = "./pretrained_models/G_latest.pth" if hps.cont else "./pretrained_models/G_0.pth"
|
if hps.cont:
|
||||||
D_ckpt = "./pretrained_models/D_latest.pth" if hps.cont else "./pretrained_models/D_0.pth"
|
try:
|
||||||
try:
|
_, _, _, epoch_str = utils.load_checkpoint(utils.latest_checkpoint_path(hps.model_dir, "G_*.pth"), net_g, None)
|
||||||
_, _, _, _ = utils.load_checkpoint(G_ckpt, net_g, None,
|
_, _, _, epoch_str = utils.load_checkpoint(utils.latest_checkpoint_path(hps.model_dir, "D_*.pth"), net_d, None)
|
||||||
drop_speaker_emb=hps.drop_speaker_embed)
|
epoch_str = 1
|
||||||
except Exception:
|
global_step = 0
|
||||||
_, _, _, _ = utils.load_checkpoint("./pretrained_models/G_0.pth", net_g, None, drop_speaker_emb=hps.drop_speaker_embed)
|
except:
|
||||||
try:
|
_, _, _, epoch_str = utils.load_checkpoint("./pretrained_models/G_0.pth", net_g, None)
|
||||||
_, _, _, _ = utils.load_checkpoint(D_ckpt, net_d, None)
|
_, _, _, epoch_str = utils.load_checkpoint("./pretrained_models/D_0.pth", net_d, None)
|
||||||
except Exception:
|
epoch_str = 1
|
||||||
_, _, _, _ = utils.load_checkpoint("./pretrained_models/D_0.pth", net_d, None)
|
global_step = 0
|
||||||
epoch_str = 1
|
else:
|
||||||
global_step = 0
|
_, _, _, epoch_str = utils.load_checkpoint("./pretrained_models/G_0.pth", net_g, None)
|
||||||
|
_, _, _, epoch_str = utils.load_checkpoint("./pretrained_models/D_0.pth", net_d, None)
|
||||||
|
epoch_str = 1
|
||||||
|
global_step = 0
|
||||||
# freeze all other layers except speaker embedding
|
# freeze all other layers except speaker embedding
|
||||||
for p in net_g.parameters():
|
for p in net_g.parameters():
|
||||||
p.requires_grad = True
|
p.requires_grad = True
|
||||||
|
|||||||
Reference in New Issue
Block a user