MCPcopy
hub / github.com/zai-org/CogView / save_zero_checkpoint

Function save_zero_checkpoint

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

Source from the content-addressed store, hash-verified

177
178
179def save_zero_checkpoint(args, iteration, optimizer):
180 zero_sd = {'iteration': iteration,
181 'optimizer_state_dict': optimizer.state_dict()}
182 zero_checkpoint_name = get_checkpoint_name(args.save, iteration, zero=True)
183 ensure_directory_exists(zero_checkpoint_name)
184 torch.save(zero_sd, zero_checkpoint_name)
185 print(' successfully saved {}'.format(zero_checkpoint_name))
186
187
188def save_checkpoint(iteration, model, optimizer,

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