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

Function master_params_to_model_params

guided_diffusion/fp16_util.py:65–75  ·  view source on GitHub ↗

Copy the master parameter data back into the model parameters.

(param_groups_and_shapes, master_params)

Source from the content-addressed store, hash-verified

63
64
65def master_params_to_model_params(param_groups_and_shapes, master_params):
66 """
67 Copy the master parameter data back into the model parameters.
68 """
69 # Without copying to a list, if a generator is passed, this will
70 # silently not copy any parameters.
71 for master_param, (param_group, _) in zip(master_params, param_groups_and_shapes):
72 for (_, param), unflat_master_param in zip(
73 param_group, unflatten_master_params(param_group, master_param.view(-1))
74 ):
75 param.detach().copy_(unflat_master_param)
76
77
78def unflatten_master_params(param_group, master_param):

Callers 1

_optimize_fp16Method · 0.85

Calls 1

unflatten_master_paramsFunction · 0.85

Tested by

no test coverage detected