Add optional optimizer/scheduler loading
This commit is contained in:
parent
b215c0fa7b
commit
55f61b9a70
@ -159,7 +159,9 @@ def gpu_worker(local_rank, node, args):
|
|||||||
load_model_state_dict(model.module, state['model'],
|
load_model_state_dict(model.module, state['model'],
|
||||||
strict=args.load_state_strict)
|
strict=args.load_state_strict)
|
||||||
|
|
||||||
|
if 'optimizer' in state:
|
||||||
optimizer.load_state_dict(state['optimizer'])
|
optimizer.load_state_dict(state['optimizer'])
|
||||||
|
if 'scheduler' in state:
|
||||||
scheduler.load_state_dict(state['scheduler'])
|
scheduler.load_state_dict(state['scheduler'])
|
||||||
|
|
||||||
torch.set_rng_state(state['rng'].cpu()) # move rng state back
|
torch.set_rng_state(state['rng'].cpu()) # move rng state back
|
||||||
|
Loading…
Reference in New Issue
Block a user