mirror of https://github.com/coqui-ai/TTS.git
use native amp for tacotron training
This commit is contained in:
parent
6cc464ead6
commit
d8511efa8f
|
@ -539,12 +539,16 @@ def main(args): # pylint: disable=redefined-outer-name
|
||||||
if args.restore_path:
|
if args.restore_path:
|
||||||
checkpoint = torch.load(args.restore_path, map_location='cpu')
|
checkpoint = torch.load(args.restore_path, map_location='cpu')
|
||||||
try:
|
try:
|
||||||
# TODO: fix optimizer init, model.cuda() needs to be called before
|
print(" > Restoring Model.")
|
||||||
|
model.load_state_dict(checkpoint['model'])
|
||||||
# optimizer restore
|
# optimizer restore
|
||||||
# optimizer.load_state_dict(checkpoint['optimizer'])
|
print(" > Restoring Optimizer.")
|
||||||
|
optimizer.load_state_dict(checkpoint['optimizer'])
|
||||||
|
if "scaler" in checkpoint and c.mixed_precision:
|
||||||
|
print(" > Restoring AMP Scaler...")
|
||||||
|
scaler.load_state_dict(checkpoint["scaler"])
|
||||||
if c.reinit_layers:
|
if c.reinit_layers:
|
||||||
raise RuntimeError
|
raise RuntimeError
|
||||||
model.load_state_dict(checkpoint['model'])
|
|
||||||
except KeyError:
|
except KeyError:
|
||||||
print(" > Partial model initialization.")
|
print(" > Partial model initialization.")
|
||||||
model_dict = model.state_dict()
|
model_dict = model.state_dict()
|
||||||
|
|
Loading…
Reference in New Issue