deepspeedai / deepspeedai/DeepSpeed

2 tests fail: assert isinstance(model.llm[0], DistributedAttention)

Open
#8,554 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
43.1k
Forks
5k
Avg merge
4d 15h
Merged PRs (30d)
112

Description

============================================================ FAILURES =============================================================
___________________________ TestAutoWrapModelForSP.test_llm_layers_replaced_with_distributed_attention ____________________________

self = <deepspeed.sequence.test_autosp.TestAutoWrapModelForSP object at 0x1e9a5777e00>

    def test_llm_layers_replaced_with_distributed_attention(self):
        """LLM attention layers must be wrapped with DistributedAttention."""
        pg = _make_mock_process_group(world_size=2, rank=0)
        model = _FakeLLMOnlyModel(num_layers=3)
        auto_wrap_model_for_sp(model, pg)
        for layer in model.layers:
>           assert isinstance(layer, DistributedAttention)
E           assert False
E            +  where False = isinstance(_FakeLLMAttn(), DistributedAttention)

deepspeed/sequence/test_autosp.py:253: AssertionError
-------------------------------------------------------- Captured log call --------------------------------------------------------
WARNING  deepspeed.sequence.auto_sp:auto_sp.py:105 AutoSP: LLM attention 'layers.0' (class _FakeLLMAttn) uses a HuggingFace hidden_states interface that is incompatible with DistributedAttention's Q/K/V interface. Skipping auto-wrap. Configure sequence parallelism for this layer manually.
WARNING  deepspeed.sequence.auto_sp:auto_sp.py:105 AutoSP: LLM attention 'layers.1' (class _FakeLLMAttn) uses a HuggingFace hidden_states interface that is incompatible with DistributedAttention's Q/K/V interface. Skipping auto-wrap. Configure sequence parallelism for this layer manually.
WARNING  deepspeed.sequence.auto_sp:auto_sp.py:105 AutoSP: LLM attention 'layers.2' (class _FakeLLMAttn) uses a HuggingFace hidden_states interface that is incompatible with DistributedAttention's Q/K/V interface. Skipping auto-wrap. Configure sequence parallelism for this layer manually.
________________________________ TestAutoWrapModelForSP.test_multimodal_model_wraps_both_branches _________________________________

self = <deepspeed.sequence.test_autosp.TestAutoWrapModelForSP object at 0x1e9a57755e0>

    def test_multimodal_model_wraps_both_branches(self):
        """Both ViT and LLM attention layers must be replaced in a combined model."""
        pg = _make_mock_process_group(world_size=2, rank=0)
        model = _FakeMultimodalModel()
        returned = auto_wrap_model_for_sp(model, pg)
        # auto_wrap_model_for_sp must return the same object (in-place)
        assert returned is model
        assert isinstance(model.vision_encoder[0], UlyssesSPViTAttention)
>       assert isinstance(model.llm[0], DistributedAttention)
E       assert False
E        +  where False = isinstance(_FakeLLMAttn(), DistributedAttention)

deepspeed/sequence/test_autosp.py:263: AssertionError
-------------------------------------------------------- Captured log call --------------------------------------------------------

Version: 0.19.6
Python-3.12
FreeBSD 15.1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with deepspeed/sequence/auto_sp.py and the failing tests in deepspeed/sequence/test_autosp.py, then run the two reported TestAutoWrapModelForSP cases. Trace why _FakeLLMAttn is skipped despite the expected DistributedAttention replacement, and make the intended wrapping behavior consistent with the tests. Done means both tests pass while the multimodal case still wraps the vision branch and returns the model in place.

Written by the indexing model from the issue text.

Assessment

Tech stack
huggingface, python
Domain
distributed-systems, machine-learning, testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.