fix:: unapply current loras properly (#590)
This commit is contained in:
parent
1be2491dcf
commit
f23b803a6b
@ -673,19 +673,20 @@ public:
|
|||||||
for (auto& kv : lora_state) {
|
for (auto& kv : lora_state) {
|
||||||
const std::string& lora_name = kv.first;
|
const std::string& lora_name = kv.first;
|
||||||
float multiplier = kv.second;
|
float multiplier = kv.second;
|
||||||
|
lora_state_diff[lora_name] += multiplier;
|
||||||
if (curr_lora_state.find(lora_name) != curr_lora_state.end()) {
|
}
|
||||||
float curr_multiplier = curr_lora_state[lora_name];
|
for (auto& kv : curr_lora_state) {
|
||||||
float multiplier_diff = multiplier - curr_multiplier;
|
const std::string& lora_name = kv.first;
|
||||||
if (multiplier_diff != 0.f) {
|
float curr_multiplier = kv.second;
|
||||||
lora_state_diff[lora_name] = multiplier_diff;
|
lora_state_diff[lora_name] -= curr_multiplier;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
lora_state_diff[lora_name] = multiplier;
|
size_t rm = lora_state_diff.size() - lora_state.size();
|
||||||
}
|
if (rm != 0) {
|
||||||
|
LOG_INFO("Attempting to apply %lu LoRAs (removing %lu applied LoRAs)", lora_state.size(), rm);
|
||||||
|
} else {
|
||||||
|
LOG_INFO("Attempting to apply %lu LoRAs", lora_state.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_INFO("Attempting to apply %lu LoRAs", lora_state.size());
|
|
||||||
|
|
||||||
for (auto& kv : lora_state_diff) {
|
for (auto& kv : lora_state_diff) {
|
||||||
apply_lora(kv.first, kv.second);
|
apply_lora(kv.first, kv.second);
|
||||||
|
Loading…
Reference in New Issue
Block a user