Skip to content

Commit 3d5fdd7

Browse files
authored
feat: add support for more underline loras (#1135)
1 parent 3e6c428 commit 3d5fdd7

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

name_conversion.cpp

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -960,19 +960,35 @@ bool is_first_stage_model_name(const std::string& name) {
960960
std::string convert_tensor_name(std::string name, SDVersion version) {
961961
bool is_lora = false;
962962
bool is_lycoris_underline = false;
963+
bool is_underline = false;
963964
std::vector<std::string> lora_prefix_vec = {
964965
"lora.lora.",
965966
"lora.lora_",
966967
"lora.lycoris_",
967968
"lora.lycoris.",
968969
"lora.",
969970
};
971+
std::vector<std::string> underline_lora_prefix_vec = {
972+
"unet_",
973+
"te_",
974+
"te1_",
975+
"te2_",
976+
"te3_",
977+
"vae_",
978+
};
970979
for (const auto& prefix : lora_prefix_vec) {
971980
if (starts_with(name, prefix)) {
972981
is_lora = true;
973982
name = name.substr(prefix.size());
974983
if (contains(prefix, "lycoris_")) {
975984
is_lycoris_underline = true;
985+
} else {
986+
for (const auto& underline_lora_prefix : underline_lora_prefix_vec) {
987+
if (starts_with(name, underline_lora_prefix)) {
988+
is_underline = true;
989+
break;
990+
}
991+
}
976992
}
977993
break;
978994
}
@@ -1034,7 +1050,7 @@ std::string convert_tensor_name(std::string name, SDVersion version) {
10341050

10351051
// LOG_DEBUG("name %s %d", name.c_str(), version);
10361052

1037-
if (sd_version_is_unet(version) || sd_version_is_flux(version) || is_lycoris_underline) {
1053+
if (sd_version_is_unet(version) || is_underline || is_lycoris_underline) {
10381054
name = convert_sep_to_dot(name);
10391055
}
10401056
}

0 commit comments

Comments
 (0)