From 80122e4f4cd4d882309d876e6cefde0232ced8a4 Mon Sep 17 00:00:00 2001 From: WenhaoZhang <42087078+niehen6174@users.noreply.github.com> Date: Sat, 6 Dec 2025 22:14:44 +0800 Subject: [PATCH] [diffusion] lora: fix LoRA dtype handling and weight attribute access for z-image model (#14543) Co-authored-by: niehen6174 --- .../multimodal_gen/runtime/layers/lora/linear.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/python/sglang/multimodal_gen/runtime/layers/lora/linear.py b/python/sglang/multimodal_gen/runtime/layers/lora/linear.py index 63092612f..898b90d4f 100644 --- a/python/sglang/multimodal_gen/runtime/layers/lora/linear.py +++ b/python/sglang/multimodal_gen/runtime/layers/lora/linear.py @@ -59,6 +59,14 @@ class BaseLayerWithLoRA(nn.Module): self.lora_A = None self.lora_B = None + @property + def weight(self): + return self.base_layer.weight + + @property + def bias(self): + return getattr(self.base_layer, "bias", None) + @torch.compile() def forward(self, x: torch.Tensor) -> torch.Tensor: lora_A = self.lora_A @@ -79,7 +87,7 @@ class BaseLayerWithLoRA(nn.Module): return out + delta, output_bias else: out, output_bias = self.base_layer(x) - return out.to(x), output_bias + return out, output_bias def slice_lora_a_weights(self, A: torch.Tensor) -> torch.Tensor: return A