From d1b1ca49dd448e580a32ac02bab83163bafca791 Mon Sep 17 00:00:00 2001 From: dxqbYD Date: Sun, 12 Jan 2025 15:26:36 +0100 Subject: [PATCH] Fix loading Flux Dev transformers from_single_file since this commit https://github.com/huggingface/diffusers/commit/862a7d5038c1c53641ffcab146a7eeb5ab683656 loading flux transformers (not: entire pipeline) from_single_file() fails --- src/diffusers/loaders/single_file_utils.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/diffusers/loaders/single_file_utils.py b/src/diffusers/loaders/single_file_utils.py index b2b21675054c..dfd54d19785f 100644 --- a/src/diffusers/loaders/single_file_utils.py +++ b/src/diffusers/loaders/single_file_utils.py @@ -605,7 +605,10 @@ def infer_diffusers_model_type(checkpoint): if any( g in checkpoint for g in ["guidance_in.in_layer.bias", "model.diffusion_model.guidance_in.in_layer.bias"] ): - if checkpoint["img_in.weight"].shape[1] == 384: + if "img_in.weight" not in checkpoint: + model_type = "flux-dev" + + elif checkpoint["img_in.weight"].shape[1] == 384: model_type = "flux-fill" elif checkpoint["img_in.weight"].shape[1] == 128: