[CI] Revert flaky test_quark_int8_w8a8_moe (#54991)
Signed-off-by: Felix Marty <Felix.Marty@amd.com>
This commit is contained in:
@@ -1020,32 +1020,32 @@ def test_quark_int8_w_per_tensor_a_per_tensor(monkeypatch, dist_init, workspace_
|
|||||||
assert torch.isfinite(logits).all()
|
assert torch.isfinite(logits).all()
|
||||||
|
|
||||||
|
|
||||||
def test_quark_int8_w8a8_moe(monkeypatch, dist_init, workspace_init):
|
@pytest.mark.parametrize("tp", [1])
|
||||||
|
def test_quark_int8_w8a8_moe(vllm_runner, tp):
|
||||||
"""Test W8A8 INT8 MoE quantization with a tiny Qwen3 MoE model."""
|
"""Test W8A8 INT8 MoE quantization with a tiny Qwen3 MoE model."""
|
||||||
model_path = "amd/tiny-qwen3-moe-w8a8-int8"
|
model_path = "amd/tiny-qwen3-moe-w8a8-int8"
|
||||||
model, vllm_config = load_model_without_vllm_runner(
|
with vllm_runner(
|
||||||
model_path,
|
model_path,
|
||||||
model_config_kwargs={"hf_overrides": {"num_hidden_layers": 3}},
|
enforce_eager=True,
|
||||||
)
|
tensor_parallel_size=tp,
|
||||||
|
gpu_memory_utilization=0.1,
|
||||||
|
) as llm:
|
||||||
|
|
||||||
layer = model.model.layers[0]
|
def check_model(model):
|
||||||
moe = layer.mlp.experts
|
layer = model.model.layers[0]
|
||||||
assert isinstance(moe._quant_method, QuarkW8A8Int8MoEMethod), (
|
# MoE experts should use QuarkW8A8Int8MoEMethod
|
||||||
f"Expected QuarkW8A8Int8MoEMethod, got {type(moe._quant_method)}"
|
moe = layer.mlp.experts
|
||||||
)
|
assert isinstance(moe._quant_method, QuarkW8A8Int8MoEMethod), (
|
||||||
qkv_proj = layer.self_attn.qkv_proj
|
f"Expected QuarkW8A8Int8MoEMethod, got {type(moe._quant_method)}"
|
||||||
assert isinstance(qkv_proj.scheme, QuarkW8A8Int8)
|
)
|
||||||
|
# Non-MoE linear layers should use QuarkW8A8Int8
|
||||||
|
qkv_proj = layer.self_attn.qkv_proj
|
||||||
|
assert isinstance(qkv_proj.scheme, QuarkW8A8Int8)
|
||||||
|
|
||||||
monkeypatch.setattr(Attention, "forward", lambda _, q, k, v: q.contiguous())
|
llm.apply_model(check_model)
|
||||||
input_ids = torch.tensor([1, 2, 3, 4], device=DEVICE_TYPE)
|
|
||||||
positions = torch.arange(input_ids.numel(), device=DEVICE_TYPE)
|
output = llm.generate_greedy("Hello", max_tokens=4)
|
||||||
with (
|
assert output
|
||||||
set_current_vllm_config(vllm_config),
|
|
||||||
set_forward_context(None, vllm_config, num_tokens=input_ids.numel()),
|
|
||||||
):
|
|
||||||
hidden_states = model(input_ids, positions, None)
|
|
||||||
logits = model.compute_logits(hidden_states)
|
|
||||||
assert torch.isfinite(logits).all()
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.skipif(
|
@pytest.mark.skipif(
|
||||||
|
|||||||
Reference in New Issue
Block a user