Skip to content

Add nvfp4_mse and nvfp4_local_hessian options to the ptq script.#1113

Open
bkartal-dev wants to merge 2 commits intoNVIDIA:mainfrom
bkartal-dev:fix-example-script
Open

Add nvfp4_mse and nvfp4_local_hessian options to the ptq script.#1113
bkartal-dev wants to merge 2 commits intoNVIDIA:mainfrom
bkartal-dev:fix-example-script

Conversation

@bkartal-dev
Copy link

@bkartal-dev bkartal-dev commented Mar 24, 2026

What does this PR do?

Type of change: Bugfix

Add newly added quant configs to the example PTQ script.

Testing

I have locally run auto_quantize with these two quant_configs, and obtained successfully exported HF artifacts.

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

Additional Information

Summary by CodeRabbit

  • New Features

    • Added support for three new quantization formats: nvfp4_mse, nvfp4_local_hessian, and nvfp4_experts_only, expanding available export options when using auto-quantize.
  • Bug Fixes / UX

    • Updated the invalid-quantization error message to include the newly accepted format identifiers.

@bkartal-dev bkartal-dev requested a review from a team as a code owner March 24, 2026 18:42
@bkartal-dev bkartal-dev requested a review from Edwardf0t1 March 24, 2026 18:42
@copy-pr-bot
Copy link

copy-pr-bot bot commented Mar 24, 2026

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 24, 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

Run ID: e636ad69-6bd3-46d0-b537-37cee9c55dc3

📥 Commits

Reviewing files that changed from the base of the PR and between 8278385 and f8ee452.

📒 Files selected for processing (2)
  • examples/llm_ptq/hf_ptq.py
  • examples/llm_ptq/scripts/huggingface_example.sh
🚧 Files skipped from review as they are similar to previous changes (2)
  • examples/llm_ptq/scripts/huggingface_example.sh
  • examples/llm_ptq/hf_ptq.py

📝 Walkthrough

Walkthrough

Updated allowed quantization format lists: the Python auto-quantize whitelist now accepts nvfp4_mse and nvfp4_local_hessian, and the shell example expands its case whitelist to include nvfp4_mse, nvfp4_local_hessian, and nvfp4_experts_only.

Changes

Cohort / File(s) Summary
Python quantization whitelist
examples/llm_ptq/hf_ptq.py
Added nvfp4_mse and nvfp4_local_hessian to the qformat/qformat_list accepted by auto_quantize() so they pass the existing assertion and can be mapped into quantization_formats.
Shell example whitelist & message
examples/llm_ptq/scripts/huggingface_example.sh
Extended the case $qformat in whitelist to include nvfp4_mse, nvfp4_local_hessian, and nvfp4_experts_only; updated the "Unknown quant argument" message to list the expanded set of valid options.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 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 clearly and accurately summarizes the main changes: adding nvfp4_mse and nvfp4_local_hessian options to the ptq script, which matches the core modifications in both files.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Security Anti-Patterns ✅ Passed The changes only add new quantization format keys and extend the script's qformat whitelist; no security issues introduced.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
⚔️ Resolve merge conflicts
  • Resolve merge conflict in branch fix-example-script

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

Signed-off-by: Bilal Kartal <bkartal@nvidia.com>
@realAsma realAsma requested a review from cjluo-nv March 24, 2026 19:14
Copy link
Contributor

@Edwardf0t1 Edwardf0t1 left a comment

Choose a reason for hiding this comment

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

Please fix the conflict.

Signed-off-by: bkartal-dev <bkartal@nvidia.com>
@codecov
Copy link

codecov bot commented Mar 24, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.18%. Comparing base (714dbd2) to head (c50a346).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1113      +/-   ##
==========================================
+ Coverage   70.16%   70.18%   +0.02%     
==========================================
  Files         228      228              
  Lines       25952    25952              
==========================================
+ Hits        18208    18214       +6     
+ Misses       7744     7738       -6     

☔ 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.

@bkartal-dev
Copy link
Author

merge conflict is resolved.

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