File tree Expand file tree Collapse file tree 1 file changed +13
-12
lines changed
Expand file tree Collapse file tree 1 file changed +13
-12
lines changed Original file line number Diff line number Diff line change @@ -689,19 +689,20 @@ class StableDiffusionGGML {
689689 for (auto & kv : lora_state) {
690690 const std::string& lora_name = kv.first ;
691691 float multiplier = kv.second ;
692-
693- if (curr_lora_state.find (lora_name) != curr_lora_state.end ()) {
694- float curr_multiplier = curr_lora_state[lora_name];
695- float multiplier_diff = multiplier - curr_multiplier;
696- if (multiplier_diff != 0 .f ) {
697- lora_state_diff[lora_name] = multiplier_diff;
698- }
699- } else {
700- lora_state_diff[lora_name] = multiplier;
701- }
692+ lora_state_diff[lora_name] += multiplier;
693+ }
694+ for (auto & kv : curr_lora_state) {
695+ const std::string& lora_name = kv.first ;
696+ float curr_multiplier = kv.second ;
697+ lora_state_diff[lora_name] -= curr_multiplier;
698+ }
699+
700+ size_t rm = lora_state_diff.size () - lora_state.size ();
701+ if (rm != 0 ) {
702+ LOG_INFO (" Attempting to apply %lu LoRAs (removing %lu applied LoRAs)" , lora_state.size (), rm);
703+ } else {
704+ LOG_INFO (" Attempting to apply %lu LoRAs" , lora_state.size ());
702705 }
703-
704- LOG_INFO (" Attempting to apply %lu LoRAs" , lora_state.size ());
705706
706707 for (auto & kv : lora_state_diff) {
707708 apply_lora (kv.first , kv.second );
You can’t perform that action at this time.
0 commit comments