Support KTransformers for Qwen3-VL moe (#13983)

This commit is contained in:
mrhaoxx
2025-11-27 06:59:15 +08:00
committed by GitHub
parent 9adef42c60
commit 15ff6982b9

View File

@@ -22,6 +22,7 @@ import torch
import torch.nn as nn
from sglang.srt.configs.qwen3_vl import Qwen3VLMoeConfig, Qwen3VLMoeTextConfig
from sglang.srt.eplb.expert_location import ModelConfigForExpertLocation
from sglang.srt.layers.moe.fused_moe_triton.layer import FusedMoE
from sglang.srt.layers.quantization.base_config import QuantizationConfig
from sglang.srt.model_executor.forward_batch_info import ForwardBatch, PPProxyTensors
@@ -326,5 +327,13 @@ class Qwen3VLMoeForConditionalGeneration(Qwen3VLForConditionalGeneration):
# if isinstance(self.model.layers[layer_id].mlp, Qwen3MoeSparseMoeBlock)
# }
@classmethod
def get_model_config_for_expert_location(cls, config):
return ModelConfigForExpertLocation(
num_layers=config.text_config.num_hidden_layers,
num_logical_experts=config.text_config.num_experts,
num_groups=None,
)
EntryClass = Qwen3VLMoeForConditionalGeneration