From 2a0fa74b0bfd5b3e667fcf67a8f595d23919f060 Mon Sep 17 00:00:00 2001 From: Jasper Blues Date: Thu, 26 Nov 2026 14:35:43 +1000 Subject: [PATCH] fix(lora): apply LoRAs at runtime for fp8 weights in auto mode --- src/dgl/models/lora.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/dgl/models/lora.cpp b/src/dgl/models/lora.cpp index 039244e3..29d94260 100644 --- a/src/dgl/models/lora.cpp +++ b/src/dgl/models/lora.cpp @@ -19,7 +19,9 @@ namespace sd::dgl::models { const auto& tensors = loader.get_tensor_storage_map(); const bool quantized = std::any_of(tensors.begin(), tensors.end(), [](const auto& entry) { const auto& tensor = entry.second; - return tensor.w4_convrot_kind || + // Merging into fp8 weights needs a CPY to fp8, which Vulkan cannot run. + const ggml_type type = tensor.expected_type < GGML_TYPE_COUNT ? tensor.expected_type : tensor.type; + return tensor.w4_convrot_kind || type == GGML_TYPE_F8_E4M3 || type == GGML_TYPE_F8_E5M2 || (!tensor.is_int8_tensorwise && (ggml_is_quantized(tensor.type) || (tensor.expected_type < GGML_TYPE_COUNT && ggml_is_quantized(tensor.expected_type))));