Disable mypy arg-type and assignment checks in tests (#59428)

Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Harry Mellor
2026-09-30 15:18:50 +00:00
committed by GitHub
co-authored by Claude Opus 5.5
parent 17e9295dd5
commit fc2c801ad9
131 changed files with 402 additions and 409 deletions
+2 -2
View File
@@ -123,8 +123,8 @@ def test_auto_gptq_moe_creates_zero_initialized_expert_biases():
method = object.__new__(AutoGPTQMoEMethod)
method.quant_config = AutoGPTQConfig(4, 128, False, True, False, {}, {})
method.input_dtype = None
method.experts_cls = None # type: ignore[assignment] # Weight creation does not select experts.
method.moe = SimpleNamespace(w13_num_shards=2) # type: ignore[assignment]
method.experts_cls = None
method.moe = SimpleNamespace(w13_num_shards=2)
layer = torch.nn.Module()
method.create_weights(
+6 -6
View File
@@ -423,7 +423,7 @@ def test_inc_get_quant_method_unquantized_routed_experts_with_model_prefix(
config = make_config(extra_config={"model.moe_layer": {"bits": 16}})
layer = object.__new__(RoutedExperts)
layer.moe_config = None # type: ignore[assignment] # No MoE config used by this stub.
layer.moe_config = None
method = config.get_quant_method(layer, "moe_layer")
@@ -730,7 +730,7 @@ def test_wna16_cuda_low_bit_moe_routes_to_humming(monkeypatch, bits) -> None:
)
layer = object.__new__(RoutedExperts)
layer.moe_config = DummyMoeConfig() # type: ignore[assignment]
layer.moe_config = DummyMoeConfig()
layer_config = make_layer_config(bits=bits)
method = INCWna16Scheme().get_moe_method(
make_config(), layer, "model.layers.0.mlp", layer_config
@@ -861,7 +861,7 @@ def test_qwen3_30b_a3b_w4a16_autoround_routes_to_gptq_moe(
config = make_qwen3_autoround_config("qwen3_30b_a3b_w4a16")
layer = object.__new__(RoutedExperts)
layer.moe_config = DummyMoeConfig() # type: ignore[assignment]
layer.moe_config = DummyMoeConfig()
method = config.get_quant_method(layer, "model.layers.0.mlp")
@@ -890,7 +890,7 @@ def test_qwen3_30b_a3b_mxfp4_autoround_routes_to_mxfp4_moe(
config = make_qwen3_autoround_config("qwen3_30b_a3b_mxfp4")
layer = object.__new__(RoutedExperts)
layer.moe_config = DummyMoeConfig() # type: ignore[assignment]
layer.moe_config = DummyMoeConfig()
ignored_method = config.get_quant_method(
object.__new__(LinearBase), "model.layers.0.self_attn.q_proj"
@@ -1186,7 +1186,7 @@ def test_wna16_xpu_moe_routes_to_gptq_moe(monkeypatch) -> None:
)
layer = object.__new__(RoutedExperts)
layer.moe_config = DummyMoeConfig() # type: ignore[assignment]
layer.moe_config = DummyMoeConfig()
method = INCWna16Scheme().get_moe_method(
make_config(),
layer,
@@ -1669,7 +1669,7 @@ def test_inc_get_quant_method_unquantized_moe_returns_unquantized(
when extra_config has bits >= 16."""
config = make_config(extra_config={"layer": {"bits": 16}})
layer = object.__new__(RoutedExperts)
layer.moe_config = None # type: ignore[assignment] # No MoE config used by this stub.
layer.moe_config = None
class DummyUnquantizedFusedMoEMethod:
def __init__(self, moe_config) -> None:
+2 -2
View File
@@ -220,7 +220,7 @@ def test_deepseek_v41_vl_mapper_routes_linear_scales(
quant_config=SimpleNamespace(weight_block_size=weight_block_size)
)
resolved = model_module._linear_scale_param_name(
vllm_config, # type: ignore[arg-type]
vllm_config,
expert_dtype,
)
assert resolved == scale_name
@@ -798,7 +798,7 @@ def test_kv_cache_scale_sync_to_host_copies():
set_default_quant_scales(layer, register_buffer=True)
layer.kv_cache_dtype = "fp8"
method = BaseKVCacheMethod(quant_config=None) # type: ignore[arg-type] # Scale synchronization does not use quant_config.
method = BaseKVCacheMethod(quant_config=None)
method.create_weights(layer)
# 0.3 stays != 1.0 even after the fp8_fnuz x2 rescale.
checkpoint_scale = torch.tensor(0.3, dtype=torch.float32)
+4 -4
View File
@@ -218,9 +218,9 @@ def test_gptq_nfirst_weights_pass_through_for_triton():
def test_moe_wna16_setup_forwards_selected_backend(monkeypatch):
method = object.__new__(MoeWNA16Method)
method.experts_cls = object # type: ignore[assignment] # Opaque mocked-expert sentinel.
method.experts_cls = object
method.wna16_backend = WNA16MoEBackend.HUMMING
method.moe = object() # type: ignore[assignment] # Opaque mocked-config sentinel.
method.moe = object()
quant_config = object()
monkeypatch.setattr(
method, "get_fused_moe_quant_config", lambda layer: quant_config
@@ -235,7 +235,7 @@ def test_moe_wna16_setup_forwards_selected_backend(monkeypatch):
monkeypatch.setattr(moe_wna16, "make_wna16_moe_kernel", fake_make_wna16_moe_kernel)
method._setup_kernel(layer) # type: ignore[arg-type] # Routing-table stub.
method._setup_kernel(layer)
assert method.moe_kernel is kernel
assert captured["backend"] == WNA16MoEBackend.HUMMING
@@ -280,7 +280,7 @@ def test_moe_wna16_uses_humming_quant_config(monkeypatch):
),
)
assert method.get_fused_moe_quant_config(layer) is quant_config # type: ignore[arg-type] # Identity sentinel.
assert method.get_fused_moe_quant_config(layer) is quant_config
@pytest.mark.skipif(
+4 -4
View File
@@ -210,9 +210,9 @@ def test_online_nvfp4_reuses_kernel_when_weights_are_reprocessed(
monkeypatch,
) -> None:
method = object.__new__(Nvfp4OnlineMoEMethod)
method.moe = SimpleNamespace(is_act_and_mul=True) # type: ignore[assignment]
method.nvfp4_backend = object() # type: ignore[assignment] # Opaque mocked-backend sentinel.
method.experts_cls = object # type: ignore[assignment] # Opaque mocked-expert sentinel.
method.moe = SimpleNamespace(is_act_and_mul=True)
method.nvfp4_backend = object()
method.experts_cls = object
method.moe_quant_config = None
method.moe_kernel = None
@@ -1432,7 +1432,7 @@ def test_online_int8_moe_w2_scale_matches_unsharded(monkeypatch) -> None:
layer.w2_weight = torch.nn.Parameter(w2_in, requires_grad=False)
layer.num_experts = layer.local_num_experts = w13.shape[0]
method = SimpleNamespace(moe=SimpleNamespace(tp_size=moe_tp_size))
Int8OnlineMoEMethod._quantize_weights(method, layer) # type: ignore[arg-type]
Int8OnlineMoEMethod._quantize_weights(method, layer)
return layer.w2_weight, layer.w2_scale
full_weight, full_scale = quantize(w2, 1)
+2 -2
View File
@@ -2314,7 +2314,7 @@ class TestQuarkInt4Format:
None,
quant_config.quant_config["global_quant_config"]["weight"],
quant_config.pack_method,
moe_config, # type: ignore[arg-type]
moe_config,
)
layer = _FakeLayer(moe_config)
@@ -2326,7 +2326,7 @@ class TestQuarkInt4Format:
requires_grad=False,
)
loader = method.get_weight_loader(
layer, # type: ignore[arg-type]
layer,
weight_loader=None,
)
loader(
@@ -34,7 +34,7 @@ def test_shared_nvfp4_input_scales_have_writable_storage(monkeypatch):
outputs = prepare_nvfp4_moe_layer_for_fi_or_cutlass(
backend=NvFp4MoeBackend.FLASHINFER_CUTLASS,
layer=layer, # type: ignore[arg-type]
layer=layer,
w13=w13,
w13_scale=w13_scale,
w13_scale_2=weight_scale,
+1 -1
View File
@@ -300,7 +300,7 @@ class TestTurboQuantKVCacheSpec:
# The layer builds an unpacked spec; the worker's spec-collection
# loop applies TQ slot packing via the backend's customize_spec hook.
spec = Attention.get_kv_cache_spec(layer, vllm_config) # type: ignore[arg-type]
spec = Attention.get_kv_cache_spec(layer, vllm_config)
assert isinstance(spec, FullAttentionSpec)
assert spec.kv_quant_mode.is_turboquant
assert spec.state_content_bytes is None