MCPcopy Create free account
hub / github.com/YesianRohn/TextSSR / cast_training_params

Function cast_training_params

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

Source from the content-addressed store, hash-verified

194
195
196def cast_training_params(model: Union[torch.nn.Module, List[torch.nn.Module]], dtype=torch.float32):
197 if not isinstance(model, list):
198 model = [model]
199 for m in model:
200 for param in m.parameters():
201 # only upcast trainable parameters into fp32
202 if param.requires_grad:
203 param.data = param.to(dtype)
204
205
206def _set_state_dict_into_text_encoder(

Callers 15

load_model_hookFunction · 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
mainFunction · 0.90
load_model_hookFunction · 0.90
mainFunction · 0.90
load_model_hookFunction · 0.90

Calls 1

toMethod · 0.45

Tested by

no test coverage detected