MCPcopy Index your code
hub / github.com/openai/guided-diffusion / state_dict_to_master_params

Function state_dict_to_master_params

guided_diffusion/fp16_util.py:116–125  ·  view source on GitHub ↗
(model, state_dict, use_fp16)

Source from the content-addressed store, hash-verified

114
115
116def state_dict_to_master_params(model, state_dict, use_fp16):
117 if use_fp16:
118 named_model_params = [
119 (name, state_dict[name]) for name, _ in model.named_parameters()
120 ]
121 param_groups_and_shapes = get_param_groups_and_shapes(named_model_params)
122 master_params = make_master_params(param_groups_and_shapes)
123 else:
124 master_params = [state_dict[name] for name, _ in model.named_parameters()]
125 return master_params
126
127
128def zero_master_grads(master_params):

Callers 1

Calls 2

make_master_paramsFunction · 0.85

Tested by

no test coverage detected