MCPcopy Create free account
hub / github.com/modelscope/modelscope / save_zero_checkpoint

Function save_zero_checkpoint

modelscope/models/nlp/mglm/utils.py:206–214  ·  view source on GitHub ↗
(args, iteration, optimizer)

Source from the content-addressed store, hash-verified

204
205
206def save_zero_checkpoint(args, iteration, optimizer):
207 zero_sd = {
208 'iteration': iteration,
209 'optimizer_state_dict': optimizer.state_dict()
210 }
211 zero_checkpoint_name = get_checkpoint_name(args.save, iteration, zero=True)
212 ensure_directory_exists(zero_checkpoint_name)
213 torch.save(zero_sd, zero_checkpoint_name)
214 print(' successfully saved {}'.format(zero_checkpoint_name))
215
216
217def save_checkpoint(iteration,

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…