mirror of
https://github.com/ml-explore/mlx-examples.git
synced 2025-06-24 01:17:28 +08:00
Allow loading from diffusers ckpt (#1117)
This commit is contained in:
parent
2a9294a5f0
commit
eb9277f574
@ -85,6 +85,8 @@ class Flux(nn.Module):
|
|||||||
def sanitize(self, weights):
|
def sanitize(self, weights):
|
||||||
new_weights = {}
|
new_weights = {}
|
||||||
for k, w in weights.items():
|
for k, w in weights.items():
|
||||||
|
if k.startswith("model.diffusion_model."):
|
||||||
|
k = k[22:]
|
||||||
if k.endswith(".scale"):
|
if k.endswith(".scale"):
|
||||||
k = k[:-6] + ".weight"
|
k = k[:-6] + ".weight"
|
||||||
for seq in ["img_mlp", "txt_mlp", "adaLN_modulation"]:
|
for seq in ["img_mlp", "txt_mlp", "adaLN_modulation"]:
|
||||||
|
Loading…
Reference in New Issue
Block a user