MCPcopy
hub / github.com/openai/guided-diffusion / save_model

Function save_model

scripts/classifier_train.py:176–182  ·  view source on GitHub ↗
(mp_trainer, opt, step)

Source from the content-addressed store, hash-verified

174
175
176def save_model(mp_trainer, opt, step):
177 if dist.get_rank() == 0:
178 th.save(
179 mp_trainer.master_params_to_state_dict(mp_trainer.master_params),
180 os.path.join(logger.get_dir(), f"model{step:06d}.pt"),
181 )
182 th.save(opt.state_dict(), os.path.join(logger.get_dir(), f"opt{step:06d}.pt"))
183
184
185def compute_top_k(logits, labels, k, reduction="mean"):

Callers 1

mainFunction · 0.85

Calls 3

saveMethod · 0.80
get_dirMethod · 0.80

Tested by

no test coverage detected