vllm.lora.layers.fused_moe
¶
Classes:
FusedMoE3DWithLoRA
¶
Bases: FusedMoEWithLoRA
Methods:
-
can_replace_layer–Returns True if the layer can be replaced by this LoRA layer.
-
create_lora_weights–Initializes lora matrices.
-
set_lora–Overwrites lora tensors at index.
Attributes:
-
w13_input_size–Full size.
-
w13_output_size–Full size.
-
w2_input_size–Full size.
-
w2_output_size–Full size.
w13_input_size
property
¶
Full size.
w13_output_size
property
¶
Full size.
w2_input_size
property
¶
Full size.
w2_output_size
property
¶
Full size.
can_replace_layer(source_layer, lora_config, packed_modules_list, model_config=None)
classmethod
¶
Returns True if the layer can be replaced by this LoRA layer.
create_lora_weights(max_loras, lora_config, model_config=None)
¶
Initializes lora matrices.
set_lora(index, lora_a, lora_b)
¶
Overwrites lora tensors at index.
FusedMoEWithLoRA
¶
Bases: BaseLayerWithLoRA
Methods:
-
can_replace_layer–Returns True if the layer can be replaced by this LoRA layer.
-
create_lora_weights–Initializes lora matrices.
-
reset_lora–Resets the lora weights at index back to 0.
-
set_lora–Overwrites lora tensors at index.
_tp_shard_size
property
¶
Match the base loader's shard stride before backend padding.
_w13_a_num_experts
property
¶
Expert-dim of the w13 lora_A buffer: 1 when shared.
_w2_b_num_experts
property
¶
Expert-dim of the w2 lora_B buffer: 1 when shared.
_match_expert_dim(src, buffer)
¶
Align a LoRA factor's expert-dim (dim 0) to its stacked buffer.
Equal dims pass through. When the buffer is collapsed to expert-dim 1 (a shared factor) but the source carries per-expert copies, keep the first — every expert shares the same factor, so the copies are identical for a real adapter and irrelevant (zeros) for the dummy.
_slice_w13_a(w13_lora_a)
¶
Applies to FusedMoEWithLoRA and FusedMoE3DWithLoRA.
_slice_w2_a(w2_lora_a)
¶
Applies to FusedMoEWithLoRA and FusedMoE3DWithLoRA.
_slice_w2_b(w2_lora_b)
¶
Applies to FusedMoEWithLoRA and FusedMoE3DWithLoRA.
can_replace_layer(source_layer, lora_config, packed_modules_list, model_config=None)
classmethod
¶
Returns True if the layer can be replaced by this LoRA layer.
create_lora_weights(max_loras, lora_config, model_config=None)
¶
Initializes lora matrices.
reset_lora(index)
¶
Resets the lora weights at index back to 0.
set_lora(index, lora_a, lora_b)
¶
Overwrites lora tensors at index.