Skip to content

Commit 3f3610b

Browse files
authored
chore: optimize lora log (leejet#1047)
1 parent 118683d commit 3f3610b

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

stable-diffusion.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -998,6 +998,12 @@ class StableDiffusionGGML {
998998
lora_state_diff[lora_name] -= curr_multiplier;
999999
}
10001000

1001+
if (lora_state_diff.empty()) {
1002+
return;
1003+
}
1004+
1005+
LOG_INFO("apply lora immediately");
1006+
10011007
size_t rm = lora_state_diff.size() - lora_state.size();
10021008
if (rm != 0) {
10031009
LOG_INFO("attempting to apply %lu LoRAs (removing %lu applied LoRAs)", lora_state.size(), rm);
@@ -1027,6 +1033,10 @@ class StableDiffusionGGML {
10271033
cond_stage_lora_models.clear();
10281034
diffusion_lora_models.clear();
10291035
first_stage_lora_models.clear();
1036+
if (lora_state.empty()) {
1037+
return;
1038+
}
1039+
LOG_INFO("apply lora at runtime");
10301040
if (cond_stage_model) {
10311041
std::vector<std::shared_ptr<LoraModel>> lora_models;
10321042
auto lora_state_diff = lora_state;
@@ -1161,10 +1171,8 @@ class StableDiffusionGGML {
11611171
}
11621172
int64_t t0 = ggml_time_ms();
11631173
if (apply_lora_immediately) {
1164-
LOG_INFO("apply lora immediately");
11651174
apply_loras_immediately(lora_f2m);
11661175
} else {
1167-
LOG_INFO("apply at runtime");
11681176
apply_loras_at_runtime(lora_f2m);
11691177
}
11701178
int64_t t1 = ggml_time_ms();

0 commit comments

Comments
 (0)