Skip to content

Removed version fixes for torch transformers in windows ptq example requirements#1275

Open
hthadicherla wants to merge 2 commits intomainfrom
hthadicherla/remove-torch-transformers-version-fix
Open

Removed version fixes for torch transformers in windows ptq example requirements#1275
hthadicherla wants to merge 2 commits intomainfrom
hthadicherla/remove-torch-transformers-version-fix

Conversation

@hthadicherla
Copy link
Copy Markdown
Contributor

@hthadicherla hthadicherla commented Apr 16, 2026

What does this PR do?

Type of change: Bug fix

Removed version fixes for torch and transformers

Testing

Tested quantization with a couple of models . Working as expected.

Summary by CodeRabbit

  • Chores
    • Relaxed dependency specs: removed strict pin for torch to allow latest compatible installs, and constrained transformers to <5.0.0 for broader compatibility and easier updates.

Signed-off-by: Hrishith Thadicherla <hthadicherla@nvidia.com>
@hthadicherla hthadicherla requested a review from a team as a code owner April 16, 2026 11:32
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 16, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: b57a4e4b-f682-478e-80e1-8e45066b8175

📥 Commits

Reviewing files that changed from the base of the PR and between ebe1ce0 and 3bcd51e.

📒 Files selected for processing (1)
  • examples/windows/onnx_ptq/genai_llm/requirements.txt
✅ Files skipped from review due to trivial changes (1)
  • examples/windows/onnx_ptq/genai_llm/requirements.txt

📝 Walkthrough

Walkthrough

Updated the example requirements file to relax version constraints: torch==2.9.0 was replaced with torch (unpinned) and transformers==4.57.3 was changed to transformers<5.0.0.

Changes

Cohort / File(s) Summary
Dependency Version Constraints
examples/windows/onnx_ptq/genai_llm/requirements.txt
Replaced torch==2.9.0 with torch (remove pin). Replaced transformers==4.57.3 with transformers<5.0.0 (loosened to a version range).

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: removing strict version pinning for torch and transformers in the windows PTQ example requirements file.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Security Anti-Patterns ✅ Passed All torch.load() calls use weights_only=True, trust_remote_code properly defaults to False, no eval/exec patterns found, no nosec comments present, and no problematic new dependencies added.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch hthadicherla/remove-torch-transformers-version-fix

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

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
examples/windows/onnx_ptq/genai_llm/requirements.txt (1)

2-3: Consider bounded ranges instead of fully unpinned dependencies

Lines 2–3 being fully unpinned can make the example non-reproducible and vulnerable to future major-version breakage. Other examples in the repo use tested versions with upper bounds (e.g., torch>=2.6.0, transformers<5.0). If flexibility is desired, prefer tested lower bounds with a major version upper cap.

Suggested change
- torch
- transformers
+ torch>=2.7,<3
+ transformers>=4.57,<5
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@examples/windows/onnx_ptq/genai_llm/requirements.txt` around lines 2 - 3, The
requirements file lists unpinned dependencies (torch, transformers); replace
these with tested bounded ranges to avoid breakage and ensure
reproducibility—e.g., set a tested minimum and a major-version upper bound for
torch and transformers (for example torch>=2.6.0,<3.0 and
transformers>=4.0,<5.0) or use your project’s chosen lower bounds/upper caps,
updating the entries for "torch" and "transformers" in requirements.txt
accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@examples/windows/onnx_ptq/genai_llm/requirements.txt`:
- Around line 2-3: The requirements file lists unpinned dependencies (torch,
transformers); replace these with tested bounded ranges to avoid breakage and
ensure reproducibility—e.g., set a tested minimum and a major-version upper
bound for torch and transformers (for example torch>=2.6.0,<3.0 and
transformers>=4.0,<5.0) or use your project’s chosen lower bounds/upper caps,
updating the entries for "torch" and "transformers" in requirements.txt
accordingly.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 67c6a315-53a9-4e12-a24b-68cc510586b1

📥 Commits

Reviewing files that changed from the base of the PR and between 9f8188d and ebe1ce0.

📒 Files selected for processing (1)
  • examples/windows/onnx_ptq/genai_llm/requirements.txt

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 16, 2026

PR Preview Action v1.8.1

QR code for preview link

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

Built to branch gh-pages at 2026-04-16 18:13 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 16, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.73%. Comparing base (07ae8e7) to head (3bcd51e).
⚠️ Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1275      +/-   ##
==========================================
- Coverage   75.61%   74.73%   -0.88%     
==========================================
  Files         459      459              
  Lines       48597    48621      +24     
==========================================
- Hits        36747    36338     -409     
- Misses      11850    12283     +433     
Flag Coverage Δ
examples 25.15% <ø> (-4.69%) ⬇️
unit 52.20% <ø> (-0.03%) ⬇️

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.

torch==2.9.0
transformers==4.57.3
torch
transformers
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

does this work for transformers v5 also?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

agreed, do we want to specify a range instead?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Atleast for the quantization example, I saw that it worked with transformers v5 for the models I tested(llama, qwen, gemma). I could however lock it install highest version below 5 if you think it could cause an issue.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Do you support MoE models? Thats the main one which is affected by transformers v5. If you only care about dense llms, then you are fine using latest transformers

Copy link
Copy Markdown
Contributor Author

@hthadicherla hthadicherla Apr 16, 2026

Choose a reason for hiding this comment

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

I don't know whether it is used for MOE models. Atleast in our internal automation , we only test for dense models.

@vishalpandya1990 do you know if our quantization example supports MOE models ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Adding upper bound to < 5 anyway.
If there is a need in future for transformers v5 for this particular example, I can add it then.

Signed-off-by: Hrishith Thadicherla <99313418+hthadicherla@users.noreply.github.com>
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.

3 participants