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

Function swap_scale_shift

diffusers/scripts/convert_flux_to_diffusers.py:63–66  ·  view source on GitHub ↗
(weight)

Source from the content-addressed store, hash-verified

61# in SD3 original implementation of AdaLayerNormContinuous, it split linear projection output into shift, scale;
62# while in diffusers it split into scale, shift. Here we swap the linear projection weights in order to be able to use diffusers implementation
63def swap_scale_shift(weight):
64 shift, scale = weight.chunk(2, dim=0)
65 new_weight = torch.cat([scale, shift], dim=0)
66 return new_weight
67
68
69def convert_flux_transformer_checkpoint_to_diffusers(

Calls

no outgoing calls

Tested by

no test coverage detected