Add pydocstyle to the ruff rules (#52136)
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com> Signed-off-by: Harry Mellor <hej.mellor@gmail.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
804e5377aa
commit
8c1557a79c
@@ -703,7 +703,7 @@ def mhc_pre_ref(
|
||||
hc_post_mult_value: float,
|
||||
sinkhorn_repeat: int,
|
||||
) -> tuple[torch.Tensor, torch.Tensor, torch.Tensor]:
|
||||
"""mHC pre reference kernel from tilelang repo: https://github.com/tile-ai/tilelang/blob/d135bd1cd2d2eee74fbb41dd0a0831a427194c86/examples/deepseek_mhc/example_mhc_pre.py#L303"""
|
||||
"""MHC pre reference kernel from tilelang repo: https://github.com/tile-ai/tilelang/blob/d135bd1cd2d2eee74fbb41dd0a0831a427194c86/examples/deepseek_mhc/example_mhc_pre.py#L303."""
|
||||
hc_mult = residual.shape[-2]
|
||||
|
||||
residual_flat = residual.flatten(-2, -1).float()
|
||||
@@ -742,7 +742,7 @@ def mhc_post_ref(
|
||||
post_layer_mix: torch.Tensor,
|
||||
comb_res_mix: torch.Tensor,
|
||||
) -> torch.Tensor:
|
||||
"""mHC post reference kernel from tilelang repo: https://github.com/tile-ai/tilelang/blob/d135bd1cd2d2eee74fbb41dd0a0831a427194c86/examples/deepseek_mhc/example_mhc_post.py#L68"""
|
||||
"""MHC post reference kernel from tilelang repo: https://github.com/tile-ai/tilelang/blob/d135bd1cd2d2eee74fbb41dd0a0831a427194c86/examples/deepseek_mhc/example_mhc_post.py#L68."""
|
||||
term2 = torch.bmm(comb_res_mix.mT, residual.float())
|
||||
return (x.float().unsqueeze(-2) * post_layer_mix + term2).bfloat16()
|
||||
|
||||
@@ -1372,7 +1372,8 @@ def _patch_first_rank_pp_group(monkeypatch):
|
||||
|
||||
def test_deepseek_v4_mhc_broadcast_finalize_sums_hc_streams(monkeypatch):
|
||||
"""First finalize (at the end of load_weights) allocates
|
||||
hc_attn_fn_broadcast as hc_attn_fn summed over hc streams."""
|
||||
hc_attn_fn_broadcast as hc_attn_fn summed over hc streams.
|
||||
"""
|
||||
_patch_first_rank_pp_group(monkeypatch)
|
||||
layer = _make_mhc_decoder_layer(hc_mult=2, hidden_size=8)
|
||||
model = SimpleNamespace(start_layer=0, end_layer=1, layers=[layer])
|
||||
@@ -1387,7 +1388,8 @@ def test_deepseek_v4_mhc_broadcast_finalize_sums_hc_streams(monkeypatch):
|
||||
def test_deepseek_v4_mhc_broadcast_refit_refreshes_in_place(monkeypatch):
|
||||
"""Re-finalizing after a weight refit must copy into the existing
|
||||
broadcast tensor so its address stays stable for captured CUDA graphs,
|
||||
while picking up the new hc_attn_fn values."""
|
||||
while picking up the new hc_attn_fn values.
|
||||
"""
|
||||
_patch_first_rank_pp_group(monkeypatch)
|
||||
layer = _make_mhc_decoder_layer(hc_mult=2, hidden_size=8)
|
||||
model = SimpleNamespace(start_layer=0, end_layer=1, layers=[layer])
|
||||
|
||||
Reference in New Issue
Block a user