(weight, dim)
| 35 | # in SD3 original implementation of AdaLayerNormContinuous, it split linear projection output into shift, scale; |
| 36 | # while in diffusers it split into scale, shift. Here we swap the linear projection weights in order to be able to use diffusers implementation |
| 37 | def swap_scale_shift(weight, dim): |
| 38 | shift, scale = weight.chunk(2, dim=0) |
| 39 | new_weight = torch.cat([scale, shift], dim=0) |
| 40 | return new_weight |
| 41 | |
| 42 | |
| 43 | def convert_sd3_transformer_checkpoint_to_diffusers(original_state_dict, num_layers, caption_projection_dim): |
no outgoing calls
no test coverage detected