@@ -1022,65 +1022,63 @@ SDVersion ModelLoader::get_sd_version() {
10221022 bool has_attn_1024 = false ;
10231023
10241024 for (auto & [name, tensor_storage] : tensor_storage_map) {
1025- if (!(is_xl)) {
1026- if (tensor_storage.name .find (" model.diffusion_model.double_blocks." ) != std::string::npos) {
1027- is_flux = true ;
1028- }
1029- if (tensor_storage.name .find (" model.diffusion_model.nerf_final_layer_conv." ) != std::string::npos) {
1030- return VERSION_CHROMA_RADIANCE;
1031- }
1032- if (tensor_storage.name .find (" model.diffusion_model.joint_blocks." ) != std::string::npos) {
1033- return VERSION_SD3;
1034- }
1035- if (tensor_storage.name .find (" model.diffusion_model.transformer_blocks.0.img_mod.1.weight" ) != std::string::npos) {
1036- return VERSION_QWEN_IMAGE;
1037- }
1038- if (tensor_storage.name .find (" llm_adapter.blocks.0.cross_attn.q_proj.weight" ) != std::string::npos) {
1039- return VERSION_ANIMA;
1040- }
1041- if (tensor_storage.name .find (" model.diffusion_model.double_stream_modulation_img.lin.weight" ) != std::string::npos) {
1042- is_flux2 = true ;
1043- }
1044- if (tensor_storage.name .find (" single_blocks.47.linear1.weight" ) != std::string::npos) {
1045- has_single_block_47 = true ;
1046- }
1047- if (tensor_storage.name .find (" model.diffusion_model.double_blocks.0.img_mlp.gate_proj.weight" ) != std::string::npos) {
1048- return VERSION_OVIS_IMAGE;
1049- }
1050- if (tensor_storage.name .find (" model.diffusion_model.cap_embedder.0.weight" ) != std::string::npos) {
1051- return VERSION_Z_IMAGE;
1052- }
1053- if (tensor_storage.name .find (" model.diffusion_model.layers.0.adaLN_sa_ln.weight" ) != std::string::npos) {
1054- return VERSION_ERNIE_IMAGE;
1055- }
1056- if (tensor_storage.name .find (" model.diffusion_model.blocks.0.cross_attn.norm_k.weight" ) != std::string::npos) {
1057- is_wan = true ;
1058- }
1059- if (tensor_storage.name .find (" model.diffusion_model.patch_embedding.weight" ) != std::string::npos) {
1060- patch_embedding_channels = tensor_storage.ne [3 ];
1061- }
1062- if (tensor_storage.name .find (" model.diffusion_model.img_emb" ) != std::string::npos) {
1063- has_img_emb = true ;
1064- }
1065- if (tensor_storage.name .find (" model.diffusion_model.input_blocks." ) != std::string::npos ||
1066- tensor_storage.name .find (" unet.down_blocks." ) != std::string::npos) {
1067- is_unet = true ;
1068- if (has_multiple_encoders) {
1069- is_xl = true ;
1070- }
1071- }
1072- if (tensor_storage.name .find (" conditioner.embedders.1" ) != std::string::npos ||
1073- tensor_storage.name .find (" cond_stage_model.1" ) != std::string::npos ||
1074- tensor_storage.name .find (" te.1" ) != std::string::npos) {
1075- has_multiple_encoders = true ;
1076- if (is_unet) {
1077- is_xl = true ;
1078- }
1025+ if (tensor_storage.name .find (" model.diffusion_model.double_blocks." ) != std::string::npos) {
1026+ is_flux = true ;
1027+ }
1028+ if (tensor_storage.name .find (" model.diffusion_model.nerf_final_layer_conv." ) != std::string::npos) {
1029+ return VERSION_CHROMA_RADIANCE;
1030+ }
1031+ if (tensor_storage.name .find (" model.diffusion_model.joint_blocks." ) != std::string::npos) {
1032+ return VERSION_SD3;
1033+ }
1034+ if (tensor_storage.name .find (" model.diffusion_model.transformer_blocks.0.img_mod.1.weight" ) != std::string::npos) {
1035+ return VERSION_QWEN_IMAGE;
1036+ }
1037+ if (tensor_storage.name .find (" llm_adapter.blocks.0.cross_attn.q_proj.weight" ) != std::string::npos) {
1038+ return VERSION_ANIMA;
1039+ }
1040+ if (tensor_storage.name .find (" model.diffusion_model.double_stream_modulation_img.lin.weight" ) != std::string::npos) {
1041+ is_flux2 = true ;
1042+ }
1043+ if (tensor_storage.name .find (" single_blocks.47.linear1.weight" ) != std::string::npos) {
1044+ has_single_block_47 = true ;
1045+ }
1046+ if (tensor_storage.name .find (" model.diffusion_model.double_blocks.0.img_mlp.gate_proj.weight" ) != std::string::npos) {
1047+ return VERSION_OVIS_IMAGE;
1048+ }
1049+ if (tensor_storage.name .find (" model.diffusion_model.cap_embedder.0.weight" ) != std::string::npos) {
1050+ return VERSION_Z_IMAGE;
1051+ }
1052+ if (tensor_storage.name .find (" model.diffusion_model.layers.0.adaLN_sa_ln.weight" ) != std::string::npos) {
1053+ return VERSION_ERNIE_IMAGE;
1054+ }
1055+ if (tensor_storage.name .find (" model.diffusion_model.blocks.0.cross_attn.norm_k.weight" ) != std::string::npos) {
1056+ is_wan = true ;
1057+ }
1058+ if (tensor_storage.name .find (" model.diffusion_model.patch_embedding.weight" ) != std::string::npos) {
1059+ patch_embedding_channels = tensor_storage.ne [3 ];
1060+ }
1061+ if (tensor_storage.name .find (" model.diffusion_model.img_emb" ) != std::string::npos) {
1062+ has_img_emb = true ;
1063+ }
1064+ if (tensor_storage.name .find (" model.diffusion_model.input_blocks." ) != std::string::npos ||
1065+ tensor_storage.name .find (" unet.down_blocks." ) != std::string::npos) {
1066+ is_unet = true ;
1067+ if (has_multiple_encoders) {
1068+ is_xl = true ;
10791069 }
1080- if (tensor_storage.name .find (" model.diffusion_model.input_blocks.8.0.time_mixer.mix_factor" ) != std::string::npos) {
1081- return VERSION_SVD;
1070+ }
1071+ if (tensor_storage.name .find (" conditioner.embedders.1" ) != std::string::npos ||
1072+ tensor_storage.name .find (" cond_stage_model.1" ) != std::string::npos ||
1073+ tensor_storage.name .find (" te.1" ) != std::string::npos) {
1074+ has_multiple_encoders = true ;
1075+ if (is_unet) {
1076+ is_xl = true ;
10821077 }
10831078 }
1079+ if (tensor_storage.name .find (" model.diffusion_model.input_blocks.8.0.time_mixer.mix_factor" ) != std::string::npos) {
1080+ return VERSION_SVD;
1081+ }
10841082 if (tensor_storage.name .find (" model.diffusion_model.middle_block.1." ) != std::string::npos ||
10851083 tensor_storage.name .find (" unet.mid_block.resnets.1." ) != std::string::npos) {
10861084 has_middle_block_1 = true ;
0 commit comments