Skip to content

Commit 1f6b933

Browse files
committed
hack to fix lora loading for qwen image
1 parent a5f8410 commit 1f6b933

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

otherarch/sdcpp/name_conversion.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1037,6 +1037,16 @@ std::string convert_tensor_name(std::string name, SDVersion version) {
10371037
if (sd_version_is_unet(version) || sd_version_is_flux(version) || is_lycoris_underline) {
10381038
name = convert_sep_to_dot(name);
10391039
}
1040+
1041+
//kcpp hack: name surgery for qwen image, https://github.com/leejet/stable-diffusion.cpp/issues/1131
1042+
const std::string badprefix = "unet_transformer_blocks_";
1043+
const std::string goodprefix = "lora.model.diffusion_model.transformer_blocks.";
1044+
if(is_lora && sd_version_is_qwen_image(version) && starts_with(name,badprefix))
1045+
{
1046+
name = goodprefix + name.substr(badprefix.size());
1047+
name = convert_sep_to_dot(name);
1048+
}
1049+
return name;
10401050
}
10411051

10421052
std::unordered_map<std::string, std::string> prefix_map = {

0 commit comments

Comments
 (0)