File tree 1 file changed +13
-12
lines changed 1 file changed +13
-12
lines changed Original file line number Diff line number Diff line change @@ -673,19 +673,20 @@ class StableDiffusionGGML {
673
673
for (auto & kv : lora_state) {
674
674
const std::string& lora_name = kv.first ;
675
675
float multiplier = kv.second ;
676
-
677
- if (curr_lora_state.find (lora_name) != curr_lora_state.end ()) {
678
- float curr_multiplier = curr_lora_state[lora_name];
679
- float multiplier_diff = multiplier - curr_multiplier;
680
- if (multiplier_diff != 0 .f ) {
681
- lora_state_diff[lora_name] = multiplier_diff;
682
- }
683
- } else {
684
- lora_state_diff[lora_name] = multiplier;
685
- }
676
+ lora_state_diff[lora_name] += multiplier;
677
+ }
678
+ for (auto & kv : curr_lora_state) {
679
+ const std::string& lora_name = kv.first ;
680
+ float curr_multiplier = kv.second ;
681
+ lora_state_diff[lora_name] -= curr_multiplier;
682
+ }
683
+
684
+ size_t rm = lora_state_diff.size () - lora_state.size ();
685
+ if (rm != 0 ) {
686
+ LOG_INFO (" Attempting to apply %lu LoRAs (removing %lu applied LoRAs)" , lora_state.size (), rm);
687
+ } else {
688
+ LOG_INFO (" Attempting to apply %lu LoRAs" , lora_state.size ());
686
689
}
687
-
688
- LOG_INFO (" Attempting to apply %lu LoRAs" , lora_state.size ());
689
690
690
691
for (auto & kv : lora_state_diff) {
691
692
apply_lora (kv.first , kv.second );
You can’t perform that action at this time.
0 commit comments