Skip to content

Use modules list for sequential epoch end#2682

Merged
brian-dellabetta merged 6 commits intovllm-project:mainfrom
zeel2104:fix/sequential-epoch-end-modules
May 4, 2026
Merged

Use modules list for sequential epoch end#2682
brian-dellabetta merged 6 commits intovllm-project:mainfrom
zeel2104:fix/sequential-epoch-end-modules

Conversation

@zeel2104
Copy link
Copy Markdown
Contributor

@zeel2104 zeel2104 commented May 2, 2026

Fixes #2666

SUMMARY:
Changed LifecycleCallbacks.sequential_epoch_end to pass a list of modules instead of the full subgraph. The sequential pipeline now derives the module list from each subgraph, and AutoRound consumes that list directly.

TEST PLAN:
Ran focused lifecycle and sequential pipeline tests locally with Python 3.12:

python -m pytest tests\llmcompressor\core\test_session_functions.py
python -m pytest tests\llmcompressor\pipelines\sequential\test_helpers.py tests\llmcompressor\core\test_session_functions.py

Result: 10 passed.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 2, 2026

👋 Hi! Thank you for contributing to llm-compressor. Please add the ready label when the PR is ready for review.

Note: This is required to complete the testing suite, please only add the label once the PR is code complete and local testing has been performed.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 2, 2026

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: c6e2e4a9-a027-407c-b51b-0f363380516c

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Walkthrough

The PR updates LifecycleCallbacks.sequential_epoch_end to accept a concrete list of Module objects instead of a Subgraph object. The change propagates through AutoRound's apply_autoround method and the sequential pipeline caller, which now extracts and passes module lists directly to the callback.

Changes

Sequential Epoch End API Refactor

Layer / File(s) Summary
Type Imports
src/llmcompressor/core/session_functions.py
Import changed from llmcompressor.pipelines.sequential.Subgraph to torch.nn.Module under TYPE_CHECKING to support the updated callback signature.
Core API Definition
src/llmcompressor/core/session_functions.py
LifecycleCallbacks.sequential_epoch_end signature updated from subgraph: "Subgraph" to modules: list["Module"]; event payload now passes modules=modules instead of subgraph=subgraph.
AutoRound Consumer
src/llmcompressor/modifiers/autoround/base.py
on_event handler extracts modules from kwargs and passes to apply_autoround; apply_autoround filters the modules list directly via _is_decoding_layer instead of deriving from subgraph.submodules().
Pipeline Wiring
src/llmcompressor/pipelines/sequential/pipeline.py
Call to LifecycleCallbacks.sequential_epoch_end now passes list(subgraph.submodules(model)) instead of the subgraph object itself.
Tests / Verification
tests/llmcompressor/core/test_session_functions.py
New test test_sequential_epoch_end_passes_modules validates that the callback correctly propagates the modules list and additional kwargs to the emitted event.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related issues

Suggested labels

refactor, autoround, two-reviews

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 62.50% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Use modules list for sequential epoch end' clearly and concisely describes the main change: replacing subgraph parameter with a modules list in the sequential epoch end callback.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The pull request description clearly relates to the changeset, explaining the API change from subgraph to modules list across multiple files.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@mergify mergify Bot added the two-reviews When a PR requires two reviews label May 2, 2026
@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented May 2, 2026

Merge Protections

Your pull request matches the following merge protections and will not be merged until they are valid.

🟢 Require two reviews

Wonderful, this rule succeeded.

PRs labelled "two-reviews" must have at least two approving reviews before merging.

  • #approved-reviews-by >= 2
  • #changes-requested-reviews-by = 0

@coderabbitai coderabbitai Bot added autoround For any PR / issue related to autoround support Refactor Code cleanup and/or improvements to existing features labels May 2, 2026
@zeel2104
Copy link
Copy Markdown
Contributor Author

zeel2104 commented May 2, 2026

/ready

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the sequential_epoch_end lifecycle event to pass a list of modules instead of a Subgraph object, updating LifecycleCallbacks, the AutoRound modifier, and the sequential pipeline accordingly. A new test verifies the updated event signature. Feedback was provided to replace a runtime assert with an explicit ValueError in the AutoRound modifier to prevent validation from being bypassed in optimized Python environments.

Comment thread src/llmcompressor/modifiers/autoround/base.py Outdated
@zeel2104
Copy link
Copy Markdown
Contributor Author

zeel2104 commented May 2, 2026

/ready

@zeel2104
Copy link
Copy Markdown
Contributor Author

zeel2104 commented May 2, 2026

Local testing passed. Could a maintainer please add the ready label as I do not have permissions?

Copy link
Copy Markdown
Collaborator

@brian-dellabetta brian-dellabetta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the contribution, these changes look good to me.

edit: can you run make style / make quality?

@brian-dellabetta brian-dellabetta added the ready When a PR is ready for review label May 4, 2026
@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented May 4, 2026

The quality checks have failed. Please run make style and make quality under
the root directory to adddress the lint failures. You will need to install the
dev optional install to get the required linting packages:
https://github.com/vllm-project/llm-compressor/blob/main/CONTRIBUTING.md

@HDCharles
Copy link
Copy Markdown
Collaborator

fix quality

@HDCharles
Copy link
Copy Markdown
Collaborator

looks good but needs to pass CI, fix quality issue and then this is ready to land, great work!

@mergify mergify Bot removed the quality-failed label May 4, 2026
@zeel2104
Copy link
Copy Markdown
Contributor Author

zeel2104 commented May 4, 2026

Updated the branch with latest upstream main and reran local checks:

..venv312\Scripts\ruff.exe check --no-cache src tests examples setup.py
..venv312\Scripts\ruff.exe format --check --no-cache src tests examples setup.py
..venv312\Scripts\python.exe -m pytest tests\llmcompressor\pipelines\sequential\test_helpers.py tests\llmcompressor\core\test_session_functions.py

Ruff checks passed.

@brian-dellabetta brian-dellabetta enabled auto-merge (squash) May 4, 2026 20:20
@brian-dellabetta brian-dellabetta merged commit 284401a into vllm-project:main May 4, 2026
12 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autoround For any PR / issue related to autoround support ready When a PR is ready for review Refactor Code cleanup and/or improvements to existing features two-reviews When a PR requires two reviews

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update Lifecycle.sequential_epoch_end to use a list of modules instead of a subgraph

3 participants