model: prune comments and redundant tests in dsv41 vision CP

This commit is contained in:
Xinyuan Tong
2026-09-23 14:36:01 +08:00
committed by minke.yu
parent b48e2cb1eb
commit 6833498646
4 changed files with 1 additions and 32 deletions
-2
View File
@@ -4922,8 +4922,6 @@ class DeepseekV4ForCausalLM(nn.Module):
self.image_start = nn.Parameter(torch.empty(config.hidden_size))
self.image_end = nn.Parameter(torch.empty(config.hidden_size))
self.image_newline = nn.Parameter(torch.empty(config.hidden_size))
# Ranks of this group run identical image chunks; one owner encodes each
# span and broadcasts it. None keeps the replicated encoder.
self.mm_owner_group = (
select_owner_group(get_parallel())
if self.vision is not None and _is_cuda
@@ -229,8 +229,6 @@ class _VisionStub(DeepseekV4ForCausalLM):
class _TracedGroup:
"""Records every collective (op, source, shape, group size) around a real coordinator."""
def __init__(self, inner):
self.inner = inner
self.trace = []
@@ -441,7 +439,6 @@ def _topology_program(rank, world_size):
singles = _coordinator([[r] for r in range(8)], rank)
out = {}
# TP8, DP1, CP off.
tp_group, attn_tp, attn_cp = (
_TracedGroup(tp8),
_TracedGroup(tp8),
@@ -469,7 +466,6 @@ def _topology_program(rank, world_size):
assert torch.equal(embeds, _expected_embeds(embed, requests, {x: 0, y: 5, z: 2}))
out["cp1"] = {"encoded": list(model.encoded), "trace": list(attn_tp.trace)}
# TP8, DP1, CP8 through the CP runner.
tp_group, attn_tp, attn_cp = (
_TracedGroup(tp8),
_TracedGroup(singles),
@@ -516,7 +512,7 @@ def _topology_program(rank, world_size):
finally:
init_cp_strategy(enable_prefill_cp=False, cp_size=1, cp_strategy="interleave")
# TP8, attention-DP2, CP off: one replica is text-only first.
# One attention-DP replica is text-only first.
tp_group, attn_tp, attn_cp = (
_TracedGroup(tp8),
_TracedGroup(replicas),
@@ -804,7 +800,6 @@ def test_owner_actions_and_cache_lifetime_across_asymmetric_ranks():
def test_tp8_cp1_and_cp8_dedupe_and_attention_dp_replicas_stay_isolated():
"""One encode per key on TP8 with CP off and CP8; attention-DP replicas never share a collective."""
results = _run_ranks(8, _topology_program)
cp1 = [r["cp1"] for r in results]
@@ -839,7 +834,6 @@ def test_tp8_cp1_and_cp8_dedupe_and_attention_dp_replicas_stay_isolated():
def test_failures_agree_before_payload_text_embedding_or_body():
"""Every rank raises the same error and none enters a later collective."""
results = _run_ranks(4, _failure_program)
cases = (
"prepare",
@@ -200,21 +200,6 @@ class TestDeepseekV41VisionPrefillCPInputs(CustomTestCase):
input_embeds=input_embeds,
)
def test_prepare_model_inputs_merges_on_full_layout(self):
forward_batch, item = _build_batch()
scheduler_ids = forward_batch.input_ids.clone()
model_ids, embeds = self._prepare(forward_batch)
self.assertTrue(torch.equal(forward_batch.input_ids, scheduler_ids))
self.assertIs(forward_batch.mm_input_embeds, embeds)
self.assertTrue(torch.equal(model_ids, _canonical(scheduler_ids)))
self.assertTrue(torch.equal(embeds[IMAGE_ROWS], _image_span(item)[1:7]))
text_rows = model_ids != IMAGE_TOKEN_ID
with torch.no_grad():
text_embeds = self.embed(scheduler_ids[text_rows])
self.assertTrue(torch.equal(embeds[text_rows], text_embeds))
def test_cp_runner_merges_before_shard(self):
runner = EagerRunner.__new__(EagerRunner)
runner.model_runner = SimpleNamespace(model=self.model)
@@ -4123,14 +4123,6 @@ class TestDeepseekV41VisionPrefillCPArgs(CustomTestCase):
):
handle_model_specific_adjustments(args)
def test_interleave_eager_prefill_is_accepted(self):
args = self._args()
validate_deepseek_v41_features(args)
self.assertEqual(
resolution_result(args, "cuda_graph_config").prefill.backend,
Backend.DISABLED,
)
def test_zigzag_is_rejected_only_with_vision(self):
with self.assertRaisesRegex(ValueError, "requires --cp-strategy interleave"):
validate_deepseek_v41_features(self._args(cp_strategy="zigzag"))