-
Notifications
You must be signed in to change notification settings - Fork 3.8k
[Quantization]feat: Add Nvidia ModelOpt HF FP8 support for fp8_pc_pt and fp8_pb_wo #15468
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Summary of ChangesHello @CedricHwong, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances SGLang's ModelOpt integration by introducing explicit support for two prevalent HuggingFace FP8 quantization variants: Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this 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 adds support for two new Nvidia ModelOpt FP8 quantization variants, fp8_pc_pt and fp8_pb_wo. The changes are well-implemented, making the quantization logic more robust and explicit by strictly checking for supported algorithms. The introduction of new LinearMethod classes for each variant is a clean design choice. The PR also includes corresponding unit tests and documentation updates, which is excellent. I have one minor suggestion to improve the clarity of the documentation.
Signed-off-by: CedricHuang <cedrichgw@gmail.com>
Signed-off-by: CedricHuang <cedrichgw@gmail.com>
Signed-off-by: CedricHuang <cedrichgw@gmail.com>
Fixes #15467
Motivation
ModelOpt-exported HuggingFace checkpoints encode the FP8 flavor via
hf_quant_config.json(
quantization.quant_algo). We’ve seen two ModelOpt FP8 variants show up in real PTQ workflows and servingdeployments on Hopper (H200):
FP8_PER_CHANNEL_PER_TOKEN(fp8_pc_pt)FP8_PB_WO(fp8_pb_wo)SGLang’s existing ModelOpt path did not consistently recognize/route these variants, which could cause load-time failures or wrong quant method selection. This PR makes those variants first-class and keeps the matching strict
to avoid accidentally treating other FP8 formats as ModelOpt.
Modifications
FP8_PER_CHANNEL_PER_TOKEN(per-channel weight scale, per-token activation scaling)FP8_PB_WO(blockwise FP8 weight-only)quant_algoparsing (case-insensitive) and error out on unknown FP8 algos instead of “accept any FP8*”.Accuracy Tests
Unit tests:
PYTHONPATH=python pytest -q test/srt/test_modelopt_loader.py -k "TestModelOptFp8ConfigVariants or test_engine_with_modelopt_quant_cli_argument"Benchmarking and Profiling
Not included. This change is primarily enabling/dispatching support for additional checkpoint formats; performance evaluation can be done follow-up once merged (I can provide H200 numbers if desired).
Checklist