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

Function swap_scale_shift

diffusers/scripts/convert_hunyuandit_to_diffusers.py:188–191  ·  view source on GitHub ↗
(weight)

Source from the content-addressed store, hash-verified

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