Skip to content

QA: Check for a leaked class fixture at the class boundary - #48976

Open
tarekziade wants to merge 4 commits into
mainfrom
tarek/class-scope-memory-leak-check
Open

tarekziade wants to merge 4 commits into
mainfrom
tarek/class-scope-memory-leak-check

Conversation

@tarekziade

@tarekziade tarekziade commented Sep 21, 2026

Copy link
Copy Markdown
Collaborator

CPU CI GPU run-slow

What does this PR do?

MemoryCleanupMixin leak check is per-test, so a model setUpClass parks on the class is already inside every test's baseline and every test reports zero.

This patch also fixes Mamba2 which had that issue (in mamba2_chunk_scan)

MemoryCleanupMixin's leak check is per-test, so a model setUpClass parks on
the class is already inside every test's baseline and every test reports zero.
@tarekziade tarekziade self-assigned this Sep 21, 2026
The fallback `mamba2_chunk_scan` built each contraction as a broadcast product
followed by a sum, materialising the un-summed tensor first. G's is
(batch, chunks, chunk, chunk, heads, state) in float32 — 4 GiB per sequence at
bamba-9B's shapes, so BambaModelIntegrationTest OOMs asking for 8 GiB on a
22.3 GiB runner for a 10-token generate, with 18.2 GiB of that card holding the
model setUpClass loaded. Largest intermediate drops 4.000 GiB -> 0.031 GiB.
@tarekziade
tarekziade force-pushed the tarek/class-scope-memory-leak-check branch from 2a5126e to c47ddcb Compare September 21, 2026 06:42
@HuggingFaceDocBuilderDev

Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@github-actions

Copy link
Copy Markdown
Contributor

[For maintainers] Suggested jobs to run (before merge)

run-slow: bamba, falcon_h1, granitemoehybrid, mamba2, nemotron_h, zamba2

@github-actions

Copy link
Copy Markdown
Contributor

CI recap

Dashboard: View test results in Grafana
Latest run: 35569640889:1
Result: failure | Jobs: 16 | Tests: 190,608 | Failures: 76 | Duration: 15h 18m

Code quality check failed: test jobs were skipped. Fix the code quality issues and push again to run tests.

@tarekziade

Copy link
Copy Markdown
Collaborator Author

run-slow: bamba, falcon_h1, granitemoehybrid, mamba2, nemotron_h, zamba2

@github-actions

Copy link
Copy Markdown
Contributor

AMD CI

Workflow Run ⚙️

This comment contains run-slow, running the specified jobs on AMD:

models: ["models/bamba", "models/falcon_h1", "models/granitemoehybrid", "models/mamba2", "models/nemotron_h", "models/zamba2"]

@github-actions

Copy link
Copy Markdown
Contributor

Nvidia CI

Workflow Run ⚙️

This comment contains run-slow, running the specified jobs on Nvidia:

models: ["models/bamba", "models/falcon_h1", "models/granitemoehybrid", "models/mamba2", "models/nemotron_h", "models/zamba2"]
quantizations: []

@github-actions

Copy link
Copy Markdown
Contributor

CI Results (AMD)

Workflow Run ⚙️

Commit Info

Context Commit Description
RUN cce9de14 workflow commit (merge commit)
PR 636463c0 branch commit (from PR)
main d67c7293 base commit (on main)

Model CI Report

9 new failed tests from this PR 😭

  • bamba:
    tests/models/bamba/test_modeling_bamba.py::BambaModelIntegrationTest::test_simple_batched_generate_with_padding (❌ ⟹ ❌)

  • falcon_h1:
    tests/models/falcon_h1/test_modeling_falcon_h1.py::FalconH1ModelTest::test_eager_matches_fa2_generate (✅ ⟹ ❌)
    tests/models/falcon_h1/test_modeling_falcon_h1.py::FalconH1ModelTest::test_eager_matches_sdpa_generate (✅ ⟹ ❌)
    tests/models/falcon_h1/test_modeling_falcon_h1.py::FalconH1ModelTest::test_flash_attn_2_from_config (✅ ⟹ ❌)
    tests/models/falcon_h1/test_modeling_falcon_h1.py::FalconH1ModelTest::test_flash_attn_2_inference_equivalence (✅ ⟹ ❌)
    tests/models/falcon_h1/test_modeling_falcon_h1.py::FalconH1ModelTest::test_flash_attn_2_inference_equivalence_right_padding (✅ ⟹ ❌)
    tests/models/falcon_h1/test_modeling_falcon_h1.py::FalconH1ModelTest::test_sdpa_can_compile_dynamic (✅ ⟹ ❌)
    tests/models/falcon_h1/test_modeling_falcon_h1.py::FalconH1ModelTest::test_sdpa_can_dispatch_on_flash (✅ ⟹ ❌)
    tests/models/falcon_h1/test_modeling_falcon_h1.py::FalconH1ModelIntegrationTest::test_falcon_h1_hard (❌ ⟹ ❌)

@github-actions

Copy link
Copy Markdown
Contributor

CI Results (Nvidia)

Workflow Run ⚙️

Commit Info

Context Commit Description
RUN cce9de14 workflow commit (merge commit)
PR 636463c0 branch commit (from PR)
main d67c7293 base commit (on main)

Model CI Report

14 new failed tests from this PR 😭

  • bamba:
    tests/models/bamba/test_modeling_bamba.py::BambaModelIntegrationTest::test_simple_batched_generate_with_padding (❌ ⟹ ❌)
    tests/models/bamba/test_modeling_bamba.py::BambaModelIntegrationTest::test_simple_generate (❌ ⟹ ❌)

  • falcon_h1:
    tests/models/falcon_h1/test_modeling_falcon_h1.py::FalconH1ModelTest::test_eager_matches_sdpa_generate (✅ ⟹ ❌)
    tests/models/falcon_h1/test_modeling_falcon_h1.py::FalconH1ModelTest::test_onnx_export_dynamic (✅ ⟹ ❌)
    tests/models/falcon_h1/test_modeling_falcon_h1.py::FalconH1ModelTest::test_onnx_export_generate_dynamic (✅ ⟹ ❌)
    tests/models/falcon_h1/test_modeling_falcon_h1.py::FalconH1ModelTest::test_onnx_export_generate_static (✅ ⟹ ❌)
    tests/models/falcon_h1/test_modeling_falcon_h1.py::FalconH1ModelTest::test_onnx_export_static (✅ ⟹ ❌)
    tests/models/falcon_h1/test_modeling_falcon_h1.py::FalconH1ModelTest::test_sdpa_can_compile_dynamic (✅ ⟹ ❌)
    tests/models/falcon_h1/test_modeling_falcon_h1.py::FalconH1ModelTest::test_sdpa_can_dispatch_on_flash (✅ ⟹ ❌)
    tests/models/falcon_h1/test_modeling_falcon_h1.py::FalconH1ModelTest::test_torch_export_dynamic (✅ ⟹ ❌)
    tests/models/falcon_h1/test_modeling_falcon_h1.py::FalconH1ModelTest::test_torch_export_generate_dynamic (✅ ⟹ ❌)
    tests/models/falcon_h1/test_modeling_falcon_h1.py::FalconH1ModelTest::test_torch_export_generate_static (✅ ⟹ ❌)
    tests/models/falcon_h1/test_modeling_falcon_h1.py::FalconH1ModelTest::test_torch_export_static (✅ ⟹ ❌)
    tests/models/falcon_h1/test_modeling_falcon_h1.py::FalconH1ModelIntegrationTest::test_falcon_h1_hard (✅ ⟹ ❌)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants