mirror of
https://github.com/lllyasviel/stable-diffusion-webui-forge.git
synced 2026-07-21 21:01:24 +08:00
detection
This commit is contained in:
parent
cb601f0e26
commit
7479a61e8b
@ -118,6 +118,14 @@ def detect_unet_config(state_dict: dict, key_prefix: str):
|
||||
dit_config["guidance_embed"] = "{}guidance_in.in_layer.weight".format(key_prefix) in state_dict_keys
|
||||
return dit_config
|
||||
|
||||
if "{}txt_norm.weight".format(key_prefix) in state_dict_keys: # Qwen Image
|
||||
_qweight: bool = "{}transformer_blocks.0.attn.to_qkv.qweight".format(key_prefix) in state_dict_keys
|
||||
dit_config = {"nunchaku": _qweight}
|
||||
dit_config["image_model"] = "qwen_image"
|
||||
dit_config["in_channels"] = state_dict["{}img_in.weight".format(key_prefix)].shape[1]
|
||||
dit_config["num_layers"] = count_blocks(state_dict_keys, "{}transformer_blocks.".format(key_prefix) + "{}.")
|
||||
return dit_config
|
||||
|
||||
if "{}input_blocks.0.0.weight".format(key_prefix) not in state_dict_keys:
|
||||
return None
|
||||
|
||||
|
||||
@ -375,6 +375,38 @@ class WAN21_I2V(WAN21_T2V):
|
||||
}
|
||||
|
||||
|
||||
class QwenImage(BASE):
|
||||
huggingface_repo = "Qwen/Qwen-Image"
|
||||
|
||||
unet_config = {
|
||||
"image_model": "qwen_image",
|
||||
}
|
||||
|
||||
sampling_settings = {
|
||||
"multiplier": 1.0,
|
||||
"shift": 1.15,
|
||||
}
|
||||
|
||||
memory_usage_factor = 1.8
|
||||
|
||||
unet_extra_config = {}
|
||||
latent_format = latent.Wan21
|
||||
|
||||
supported_inference_dtypes = [torch.bfloat16, torch.float32]
|
||||
|
||||
vae_key_prefix = ["vae."]
|
||||
text_encoder_key_prefix = ["text_encoders."]
|
||||
|
||||
unet_target = "transformer"
|
||||
|
||||
def __init__(self, unet_config):
|
||||
super().__init__(unet_config)
|
||||
self.nunchaku: bool = self.unet_config.pop("nunchaku", False)
|
||||
|
||||
def clip_target(self, state_dict={}):
|
||||
return {"qwen25": "text_encoder"}
|
||||
|
||||
|
||||
models = [
|
||||
SD15,
|
||||
SDXL,
|
||||
@ -384,4 +416,5 @@ models = [
|
||||
Chroma,
|
||||
WAN21_T2V,
|
||||
WAN21_I2V,
|
||||
QwenImage,
|
||||
]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user