[Intel XPU] Enable fused_moe_triton tuning on XPU and add tuned DeepSeek-OCR-2 configs (#28723)
This commit is contained in:
@@ -29,6 +29,8 @@ def test_get_model_config_supports_kimi_vl():
|
||||
n_routed_experts=64,
|
||||
num_experts_per_tok=6,
|
||||
moe_intermediate_size=1408,
|
||||
num_hidden_layers=27,
|
||||
first_k_dense_replace=1,
|
||||
torch_dtype=torch.bfloat16,
|
||||
)
|
||||
model_config = SimpleNamespace(
|
||||
@@ -42,6 +44,8 @@ def test_get_model_config_supports_kimi_vl():
|
||||
"moonshotai/Kimi-VL-A3B-Instruct", tp_size=4, ep_size=4
|
||||
)
|
||||
|
||||
# The layer counts come from the text config, not the outer one, which has
|
||||
# neither field.
|
||||
assert tuned_config == {
|
||||
"num_experts": 16,
|
||||
"topk": 6,
|
||||
@@ -50,6 +54,48 @@ def test_get_model_config_supports_kimi_vl():
|
||||
"dtype": torch.bfloat16,
|
||||
"block_shape": None,
|
||||
"architecture": "KimiVLForConditionalGeneration",
|
||||
"num_layers": 27,
|
||||
"dense_layers": 1,
|
||||
}
|
||||
|
||||
|
||||
def test_get_model_config_reports_deepseek_ocr_layer_layout():
|
||||
"""``load_topk_ids`` indexes recorded topk_ids per MoE layer.
|
||||
|
||||
It derives the MoE layer count as ``num_layers - dense_layers``, so a config
|
||||
that reports either as 0 makes the tuner read the wrong (or no) recording.
|
||||
"""
|
||||
common_utils = _load_common_utils()
|
||||
text_config = SimpleNamespace(
|
||||
hidden_size=1280,
|
||||
n_routed_experts=64,
|
||||
num_experts_per_tok=6,
|
||||
moe_intermediate_size=896,
|
||||
num_hidden_layers=12,
|
||||
first_k_dense_replace=1,
|
||||
torch_dtype=torch.bfloat16,
|
||||
)
|
||||
model_config = SimpleNamespace(
|
||||
architectures=["DeepseekOCRForCausalLM"],
|
||||
text_config=text_config,
|
||||
get_text_config=lambda: text_config,
|
||||
)
|
||||
|
||||
with patch.object(common_utils, "get_config", return_value=model_config):
|
||||
tuned_config = common_utils.get_model_config(
|
||||
"deepseek-ai/DeepSeek-OCR-2", tp_size=1, ep_size=1
|
||||
)
|
||||
|
||||
assert tuned_config == {
|
||||
"num_experts": 64,
|
||||
"topk": 6,
|
||||
"hidden_size": 1280,
|
||||
"shard_intermediate_size": 1792,
|
||||
"dtype": torch.bfloat16,
|
||||
"block_shape": None,
|
||||
"architecture": "DeepseekOCRForCausalLM",
|
||||
"num_layers": 12,
|
||||
"dense_layers": 1,
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user