MCPcopy
hub / github.com/deepspeedai/DeepSpeedExamples / save_zero_checkpoint

Function save_zero_checkpoint

Megatron-LM/utils.py:171–177  ·  view source on GitHub ↗
(args, iteration, optimizer)

Source from the content-addressed store, hash-verified

169
170
171def save_zero_checkpoint(args, iteration, optimizer):
172 zero_sd = {'iteration': iteration,
173 'optimizer_state_dict': optimizer.state_dict()}
174 zero_checkpoint_name = get_checkpoint_name(args.save, iteration, zero=True)
175 ensure_directory_exists(zero_checkpoint_name)
176 torch.save(zero_sd, zero_checkpoint_name)
177 print(' successfully saved {}'.format(zero_checkpoint_name))
178
179def save_checkpoint(iteration, model, optimizer,
180 lr_scheduler, args):

Callers

nothing calls this directly

Calls 4

get_checkpoint_nameFunction · 0.85
ensure_directory_existsFunction · 0.85
state_dictMethod · 0.45
saveMethod · 0.45

Tested by

no test coverage detected