MCPcopy Index your code
hub / github.com/huggingface/diffusers / swap_scale_shift

Function swap_scale_shift

scripts/convert_hunyuandit_to_diffusers.py:187–190  ·  view source on GitHub ↗
(weight)

Source from the content-addressed store, hash-verified

185
186 # model.final_adaLN_modulation.1 -> norm_out.linear
187 def swap_scale_shift(weight):
188 shift, scale = weight.chunk(2, dim=0)
189 new_weight = torch.cat([scale, shift], dim=0)
190 return new_weight
191
192 state_dict["norm_out.linear.weight"] = swap_scale_shift(state_dict["final_layer.adaLN_modulation.1.weight"])
193 state_dict["norm_out.linear.bias"] = swap_scale_shift(state_dict["final_layer.adaLN_modulation.1.bias"])

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…