MCPcopy Index your code
hub / github.com/THUDM/GLM / save_zero_checkpoint

Function save_zero_checkpoint

utils.py:215–221  ·  view source on GitHub ↗
(args, iteration, optimizer)

Source from the content-addressed store, hash-verified

213
214
215def save_zero_checkpoint(args, iteration, optimizer):
216 zero_sd = {'iteration': iteration,
217 'optimizer_state_dict': optimizer.state_dict()}
218 zero_checkpoint_name = get_checkpoint_name(args.save, iteration, zero=True)
219 ensure_directory_exists(zero_checkpoint_name)
220 torch.save(zero_sd, zero_checkpoint_name)
221 print(' successfully saved {}'.format(zero_checkpoint_name))
222
223
224def save_checkpoint(iteration, model, optimizer, lr_scheduler, args, tag=None, barrier=True,

Callers

nothing calls this directly

Calls 3

get_checkpoint_nameFunction · 0.85
ensure_directory_existsFunction · 0.85
state_dictMethod · 0.45

Tested by

no test coverage detected