MCPcopy Create free account
hub / github.com/OpenGVLab/HumanBench / state_dict

Method state_dict

PATH/core/fp16/opt.py:292–311  ·  view source on GitHub ↗

Returns a dict containing the current state of this :class:`FP16_Optimizer` instance. This dict contains attributes of :class:`FP16_Optimizer`, as well as the state_dict of the contained Pytorch optimizer. Example:: checkpoint = {} checkpoi

(self)

Source from the content-addressed store, hash-verified

290 return -1
291
292 def state_dict(self):
293 """
294 Returns a dict containing the current state of this :class:`FP16_Optimizer`
295 instance. This dict contains attributes of :class:`FP16_Optimizer`, as
296 well as the state_dict of the contained Pytorch optimizer.
297 Example::
298
299 checkpoint = {}
300 checkpoint['model'] = model.state_dict()
301 checkpoint['optimizer'] = optimizer.state_dict()
302 torch.save(checkpoint, "saved.pth")
303 """
304 state_dict = {}
305 state_dict['loss_scaler'] = self.loss_scaler
306 state_dict['dynamic_loss_scale'] = self.dynamic_loss_scale
307 state_dict['overflow'] = self.overflow
308 state_dict['first_closure_call_this_step'] = self.first_closure_call_this_step
309 state_dict['optimizer_state_dict'] = self.optimizer.state_dict()
310 state_dict['fp32_from_fp16'] = self.fp32_from_fp16_groups
311 return state_dict
312
313 def load_state_dict(self, state_dict):
314 """

Callers 10

load_state_modelFunction · 0.80
load_checkpointFunction · 0.80
load_checkpointFunction · 0.80
load_checkpointFunction · 0.80
load_checkpointFunction · 0.80
load_modelMethod · 0.80
__init__Method · 0.80
auto_denan_saveMethod · 0.80
saveMethod · 0.80
saveMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected