From 712f57c915910f6582bffa223f0d0acf40966fd1 Mon Sep 17 00:00:00 2001 From: gchapman Date: Wed, 19 Jun 2024 09:45:33 +0100 Subject: [PATCH] Use different keys for detection between original model and converted model --- PixArt/diffusers_convert.py | 2 +- PixArt/loader.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/PixArt/diffusers_convert.py b/PixArt/diffusers_convert.py index 19852a4..45c4672 100644 --- a/PixArt/diffusers_convert.py +++ b/PixArt/diffusers_convert.py @@ -17,7 +17,7 @@ conversion_map_ms = [ # for multi_scale_train (MS) ] def get_depth(state_dict): - return sum(key.endswith('.scale_shift_table') for key in state_dict.keys()) + return sum(key.endswith('.attn1.to_k.bias') for key in state_dict.keys()) def get_conversion_map(state_dict): conversion_map = [ # main SD conversion map (PixArt reference, HF Diffusers) diff --git a/PixArt/loader.py b/PixArt/loader.py index e085d63..63294a5 100644 --- a/PixArt/loader.py +++ b/PixArt/loader.py @@ -76,7 +76,7 @@ def load_pixart(model_path, model_conf): device=model_management.get_torch_device() ) - model_conf.unet_config['depth'] = sum(key.endswith('.scale_shift_table') for key in state_dict.keys()) + model_conf.unet_config['depth'] = sum(key.endswith('mlp.fc1.weight') for key in state_dict.keys()) if model_conf.model_target == "PixArtMS": from .models.PixArtMS import PixArtMS