mirror of
https://github.com/leejet/stable-diffusion.cpp.git
synced 2026-10-27 07:14:04 +08:00
fix: enhance decision in --lora-apply-mode auto for quantized parameters (#2162)
This commit is contained in:
@@ -1058,9 +1058,15 @@ void StableDiffusionGGML::configure_weight_loading() {
|
||||
const auto& model_loader = model_manager->loader();
|
||||
const auto wtype_stat = model_loader.get_wtype_stat();
|
||||
bool have_int8_tensorwise = false;
|
||||
bool have_quant_type_rule = false;
|
||||
for (const auto& [_, tensor_storage] : model_loader.get_tensor_storage_map()) {
|
||||
if (tensor_storage.is_int8_tensorwise) {
|
||||
have_int8_tensorwise = true;
|
||||
}
|
||||
if (tensor_storage.expected_type < GGML_TYPE_COUNT && ggml_is_quantized(tensor_storage.expected_type)) {
|
||||
have_quant_type_rule = true;
|
||||
}
|
||||
if (have_int8_tensorwise && have_quant_type_rule) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1077,7 +1083,8 @@ void StableDiffusionGGML::configure_weight_loading() {
|
||||
const bool params_offloaded = params_backend_for(SDBackendModule::DIFFUSION) != backend_for(SDBackendModule::DIFFUSION);
|
||||
const bool streaming_constrained = params_offloaded ||
|
||||
backend_manager.params_backend_is_disk(SDBackendModule::DIFFUSION);
|
||||
if (have_quantized_weight || streaming_constrained || row_split_active()) {
|
||||
|
||||
if (have_quant_type_rule || have_quantized_weight || streaming_constrained || row_split_active()) {
|
||||
apply_lora_immediately = false;
|
||||
} else {
|
||||
apply_lora_immediately = true;
|
||||
|
||||
Reference in New Issue
Block a user