Allow loading from diffusers ckpt (#1117)

This commit is contained in:
Angelos Katharopoulos 2024-12-02 13:15:50 -08:00 committed by GitHub
parent 2a9294a5f0
commit eb9277f574
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -85,6 +85,8 @@ class Flux(nn.Module):
def sanitize(self, weights):
new_weights = {}
for k, w in weights.items():
if k.startswith("model.diffusion_model."):
k = k[22:]
if k.endswith(".scale"):
k = k[:-6] + ".weight"
for seq in ["img_mlp", "txt_mlp", "adaLN_modulation"]: