MCPcopy Create free account
hub / github.com/TencentARC/BrushNet / cast_training_params

Function cast_training_params

src/diffusers/training_utils.py:139–146  ·  view source on GitHub ↗
(model: Union[torch.nn.Module, List[torch.nn.Module]], dtype=torch.float32)

Source from the content-addressed store, hash-verified

137
138
139def cast_training_params(model: Union[torch.nn.Module, List[torch.nn.Module]], dtype=torch.float32):
140 if not isinstance(model, list):
141 model = [model]
142 for m in model:
143 for param in m.parameters():
144 # only upcast trainable parameters into fp32
145 if param.requires_grad:
146 param.data = param.to(dtype)
147
148
149def _set_state_dict_into_text_encoder(

Callers 11

load_model_hookFunction · 0.90
mainFunction · 0.90
load_model_hookFunction · 0.90
mainFunction · 0.90
mainFunction · 0.90
load_model_hookFunction · 0.90
mainFunction · 0.90
load_model_hookFunction · 0.90
mainFunction · 0.90
load_model_hookFunction · 0.90
mainFunction · 0.90

Calls 1

toMethod · 0.45

Tested by

no test coverage detected