[CI] Bump mypy version (#34950)

Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
This commit is contained in:
Harry Mellor
2026-03-04 20:55:11 +00:00
committed by GitHub
parent 7eca859110
commit 17dc9c7fc9
13 changed files with 90 additions and 61 deletions
+2 -5
View File
@@ -94,12 +94,9 @@ def test_rotary_embedding(
positions = torch.randint(0, max_position, (batch_size, seq_len))
query_shape = tensor_shape_fn(batch_size, seq_len, num_heads, head_size)
query = torch.randn(query_shape, dtype=dtype)
key = torch.randn_like(query) if use_key else None
# slice tensor if required, noop otherwise
query = query[..., :head_size]
key = key[..., :head_size] if use_key else None
query = torch.randn(query_shape, dtype=dtype)[..., :head_size]
key = torch.randn_like(query)[..., :head_size] if use_key else None
# NOTE(woosuk): The reference implementation should be executed first
# because the custom kernel is in-place.
+2 -2
View File
@@ -62,7 +62,7 @@ def test_rotary_embedding_opcheck(
)
key = torch.randn_like(query) if use_key else None
query = query[..., :head_size]
key = key[..., :head_size] if use_key else None
key = key[..., :head_size] if key is not None else None
rotary_embedding_opcheck(rot, positions, query, key)
@@ -73,5 +73,5 @@ def test_rotary_embedding_opcheck(
rot,
positions,
query.flatten(start_dim=-2),
key.flatten(start_dim=-2) if use_key else None,
key.flatten(start_dim=-2) if key is not None else None,
)
+7 -7
View File
@@ -298,13 +298,13 @@ def test_selective_scan(
C = torch.randn(C_shape, device=device, dtype=wtype if not is_variable_C else itype)
C_ref = C.clone()
D = torch.randn(dim, device=device, dtype=torch.float32) if has_D else None
D_ref = D.clone()
D_ref = D.clone() if D is not None else None
z = (
torch.randn(batch_size, dim, seqlen, device=device, dtype=itype)
if has_z
else None
)
z_ref = z.clone() if has_z else None
z_ref = z.clone() if z is not None else None
delta_bias = (
(0.5 * torch.rand(dim, device=device, dtype=torch.float32))
if has_delta_bias
@@ -493,7 +493,7 @@ def test_selective_state_update_varlen(dim, dstate, has_z, itype, max_seq_len):
B[idx : idx + 1],
C[idx : idx + 1],
D=D,
z=z[idx : idx + 1] if has_z else None,
z=z[idx : idx + 1] if z is not None else None,
dt_bias=dt_bias,
dt_softplus=True,
)
@@ -578,7 +578,7 @@ def test_selective_scan_varlen(
C = torch.randn(C_shape, device=device, dtype=wtype if not is_variable_C else itype)
C_ref = C.clone()
D = torch.randn(dim, device=device, dtype=torch.float32) if has_D else None
D_ref = D.clone()
D_ref = D.clone() if D is not None else None
z = torch.randn(dim, seqlen, device=device, dtype=itype)
z_ref = z.clone()
delta_bias = (
@@ -750,7 +750,7 @@ def test_selective_state_update_with_batch_indices(
B[:batch_size],
C[:batch_size],
D=D,
z=z[:batch_size],
z=z[:batch_size] if z is not None else None,
dt_bias=dt_bias,
dt_softplus=True,
)
@@ -934,7 +934,7 @@ def test_selective_state_update_with_num_accepted_tokens(
B[global_idx : global_idx + 1],
C[global_idx : global_idx + 1],
D=D,
z=z[global_idx : global_idx + 1] if has_z else None,
z=z[global_idx : global_idx + 1] if z is not None else None,
dt_bias=dt_bias,
dt_softplus=True,
)
@@ -1061,7 +1061,7 @@ def test_selective_state_update_varlen_with_num_accepted(
B[global_idx : global_idx + 1],
C[global_idx : global_idx + 1],
D=D,
z=z[global_idx : global_idx + 1] if has_z else None,
z=z[global_idx : global_idx + 1] if z is not None else None,
dt_bias=dt_bias,
dt_softplus=True,
)
+3 -3
View File
@@ -57,11 +57,11 @@ def opcheck_fp8_quant(
@pytest.mark.parametrize("num_tokens", NUM_TOKENS)
@pytest.mark.parametrize("hidden_size", HIDDEN_SIZES)
@pytest.mark.parametrize("dtype", DTYPES)
@pytest.mark.parametrize("scale_ub", SCALE_UBS)
@pytest.mark.parametrize("do_scale_ub", SCALE_UBS)
@pytest.mark.parametrize("seed", SEEDS)
@torch.inference_mode()
def test_dynamic_per_token_fp8_quant(
num_tokens: int, hidden_size: int, dtype: torch.dtype, scale_ub: bool, seed: int
num_tokens: int, hidden_size: int, dtype: torch.dtype, do_scale_ub: bool, seed: int
) -> None:
set_random_seed(seed)
@@ -70,7 +70,7 @@ def test_dynamic_per_token_fp8_quant(
) # avoid nans
scale_ub = (
torch.mean(x).to(dtype=torch.float32, device="cuda") if scale_ub else None
torch.mean(x).to(dtype=torch.float32, device="cuda") if do_scale_ub else None
)
ref_out, ref_scales = ref_dynamic_per_token_quant(x, FP8_DTYPE, scale_ub)
ops_out, ops_scales = ops.scaled_fp8_quant(