Add optional optimizer/scheduler loading
This commit is contained in:
parent
b215c0fa7b
commit
55f61b9a70
@ -159,8 +159,10 @@ 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)
|
||||||
|
|
||||||
optimizer.load_state_dict(state['optimizer'])
|
if 'optimizer' in state:
|
||||||
scheduler.load_state_dict(state['scheduler'])
|
optimizer.load_state_dict(state['optimizer'])
|
||||||
|
if 'scheduler' in state:
|
||||||
|
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