[Bugfix] LoRA for DeepSeek V3.2 (#35077)

Signed-off-by: Hollow Man <hollowman@opensuse.org>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: Jee Jee Li <pandaleefree@gmail.com>
This commit is contained in:
ℍ𝕠𝕝𝕝𝕠𝕨 𝕄𝕒𝕟
2026-04-22 19:33:50 +08:00
committed by GitHub
co-authored by mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Jee Jee Li
parent 04eac6ba24
commit a250f1bd5f
13 changed files with 614 additions and 37 deletions
+7 -1
View File
@@ -46,6 +46,12 @@ class ReplicatedLinearWithLoRA(BaseLinearLayerWithLoRA):
return output, output_bias
def apply(self, x: torch.Tensor, bias: torch.Tensor | None = None) -> torch.Tensor:
# ReplicatedLinear subclasses such as GateLinear override forward() to
# dispatch custom kernels and/or adjust the output dtype. Apply LoRA on
# top of the actual base-layer output instead of bypassing that path.
return self._apply_base_forward(x)
# ReplicatedLinear should always be replaced, regardless of the fully
# sharded LoRAs setting, because it is, by definition, copied per GPU.
@classmethod
@@ -56,7 +62,7 @@ class ReplicatedLinearWithLoRA(BaseLinearLayerWithLoRA):
packed_modules_list: list,
model_config: PretrainedConfig | None = None,
) -> bool:
return type(source_layer) is maybe_get_oot_by_class(ReplicatedLinear)
return isinstance(source_layer, maybe_get_oot_by_class(ReplicatedLinear))
def slice_lora_a(
self, lora_a: torch.Tensor | list[torch.Tensor | None]