Skip to content

Fix 6115282#1419

Open
sugunav14 wants to merge 1 commit intomainfrom
svelury/fix-6115282
Open

Fix 6115282#1419
sugunav14 wants to merge 1 commit intomainfrom
svelury/fix-6115282

Conversation

@sugunav14
Copy link
Copy Markdown
Contributor

@sugunav14 sugunav14 commented May 8, 2026

What does this PR do?

Type of change: ?

Usage

# Add a code snippet demonstrating how to use this

Testing

Before your PR is "Ready for review"

Make sure you read and follow Contributor guidelines and your commits are signed (git commit -s -S).

Make sure you read and follow the Security Best Practices (e.g. avoiding hardcoded trust_remote_code=True, torch.load(..., weights_only=False), pickle, etc.).

  • Is this change backward compatible?: ✅ / ❌ / N/A
  • If you copied code from any other sources or added a new PIP dependency, did you follow guidance in CONTRIBUTING.md: ✅ / ❌ / N/A
  • Did you write any new necessary tests?: ✅ / ❌ / N/A
  • Did you update Changelog?: ✅ / ❌ / N/A
  • Did you get Claude approval on this PR?: ✅ / ❌ / N/A

Additional Information

Summary by CodeRabbit

  • Bug Fixes
    • Updated compatibility handling to support Transformers 5.0 while maintaining backward compatibility with earlier versions.

Signed-off-by: Suguna Velury <178320438+sugunav14@users.noreply.github.com>
@sugunav14 sugunav14 requested a review from a team as a code owner May 8, 2026 19:37
@sugunav14 sugunav14 requested a review from shengliangxu May 8, 2026 19:37
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 8, 2026

Review Change Stack
No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 8e4f59ec-2f7f-40f5-90a1-4f3939699d37

📥 Commits

Reviewing files that changed from the base of the PR and between e2d29c8 and 37b2706.

📒 Files selected for processing (1)
  • modelopt/torch/opt/plugins/transformers.py

📝 Walkthrough

Walkthrough

The pull request adds Transformers 5.0 API compatibility by introducing explicit version detection and conditionally adjusting the signature of a cached Transformers private loader function. The module checks Transformers version at import time and branches the loader call based on whether the installed version is >= 5.0.

Changes

Transformers 5.0 Compatibility

Layer / File(s) Summary
Version Detection
modelopt/torch/opt/plugins/transformers.py
Adds explicit imports of transformers and Version from packaging.version; defines _TRANSFORMERS_GE_5_0 flag at module level to enable runtime version checks.
Version-Conditional Loader
modelopt/torch/opt/plugins/transformers.py
Updates _load_params_and_buffers_into_zero3_model to branch on _TRANSFORMERS_GE_5_0 when calling the cached private _load_state_dict_into_zero3_model loader, passing load_config=True only for Transformers >= 5.0.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'Fix 6115282' is vague and does not clearly describe the actual changes made to the codebase, which involve handling a Transformers 5.0 API change. Update the title to be more specific about the change, such as 'Support Transformers 5.0 API changes in zero3 model loading' to better convey the purpose of the fix.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch svelury/fix-6115282

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


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

@sugunav14 sugunav14 requested a review from kevalmorabia97 May 8, 2026 19:38
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 8, 2026

PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://NVIDIA.github.io/Model-Optimizer/pr-preview/pr-1419/

Built to branch gh-pages at 2026-05-08 19:41 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 8, 2026

Codecov Report

❌ Patch coverage is 85.71429% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 65.79%. Comparing base (e2d29c8) to head (37b2706).

Files with missing lines Patch % Lines
modelopt/torch/opt/plugins/transformers.py 85.71% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #1419       +/-   ##
===========================================
- Coverage   77.40%   65.79%   -11.61%     
===========================================
  Files         476      476               
  Lines       51319    51325        +6     
===========================================
- Hits        39721    33768     -5953     
- Misses      11598    17557     +5959     
Flag Coverage Δ
examples 32.34% <85.71%> (-9.63%) ⬇️
gpu 27.41% <42.85%> (-33.03%) ⬇️
regression 15.20% <42.85%> (+0.07%) ⬆️
unit 52.56% <42.85%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

1 participant