MCPcopy Create free account
hub / github.com/CausalLearning/robust-unlearnable-examples / get_model_state

Function get_model_state

utils/generic.py:322–328  ·  view source on GitHub ↗
(model)

Source from the content-addressed store, hash-verified

320
321
322def get_model_state(model):
323 # if isinstance(model, torch.nn.parallel.DistributedDataParallel):
324 if isinstance(model, torch.nn.DataParallel):
325 model_state = model_state_to_cpu(model.module.state_dict())
326 else:
327 model_state = model.state_dict()
328 return model_state

Callers

nothing calls this directly

Calls 1

model_state_to_cpuFunction · 0.85

Tested by

no test coverage detected