fix transformers + torchao nvfp4 serialization#45573
Merged
SunMarc merged 2 commits intohuggingface:mainfrom Apr 23, 2026
Merged
fix transformers + torchao nvfp4 serialization#45573SunMarc merged 2 commits intohuggingface:mainfrom
SunMarc merged 2 commits intohuggingface:mainfrom
Conversation
Contributor
Author
|
test failure looks unrelated |
vkuzo
added a commit
to pytorch/ao
that referenced
this pull request
Apr 22, 2026
Summary: remove the hacky transformers version check, and replace it with proper workarounds: 1. ensure the user has transformers with huggingface/transformers#45573 for nvfp4 serialization to work 2. manually attach an HF quantizer to ensure deserialization works (this is required with transformers 5.0.0+). Test Plan: ``` ``` ghstack-source-id: 8376570 ghstack-comment-id: 4295746737 Pull-Request: #4313
vkuzo
added a commit
to pytorch/ao
that referenced
this pull request
Apr 22, 2026
Summary: remove the hacky transformers version check, and replace it with proper workarounds: 1. ensure the user has transformers with huggingface/transformers#45573 for nvfp4 serialization to work 2. manually attach an HF quantizer to ensure deserialization works (this is required with transformers 5.0.0+). Test Plan: ``` ``` ghstack-source-id: 8376570 ghstack-comment-id: 4295746737 Pull-Request: #4313
SunMarc
approved these changes
Apr 22, 2026
c0892f0 to
4b69954
Compare
Summary: 1. fix torchao NVFP4 serialization with transformers 2. add a test to cover the fix While i'm here, also did the following bundled into this PR: 3. make the torchao serialization test have human readable names (easier to debug) 4. fix the float8 test (update the expected output) after this PR the test command for all torchao configs passes on an NVIDIA B200 Test Plan: ``` RUN_SLOW=1 pytest tests/quantization/torchao_integration/test_torchao.py -k "Serialization" -s ```
4b69954 to
4b8ceaa
Compare
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
Contributor
|
so torchao tests are actually running in transformers repo's CI and only nvfp4 is broken right? |
Contributor
|
[For maintainers] Suggested jobs to run (before merge) run-slow: torchao_integration |
Member
The tests are working fine, we are just adding coverage for nvfp4 here @jerryzh168. I've reworked the testing suite + the integration a few weeks again to clean a bit. |
tarekziade
pushed a commit
that referenced
this pull request
Apr 23, 2026
Summary: 1. fix torchao NVFP4 serialization with transformers 2. add a test to cover the fix While i'm here, also did the following bundled into this PR: 3. make the torchao serialization test have human readable names (easier to debug) 4. fix the float8 test (update the expected output) after this PR the test command for all torchao configs passes on an NVIDIA B200 Test Plan: ``` RUN_SLOW=1 pytest tests/quantization/torchao_integration/test_torchao.py -k "Serialization" -s ``` Co-authored-by: Marc Sun <57196510+SunMarc@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
While i'm here, also did the following bundled into this PR:
3. make the torchao serialization test have human readable names (easier to debug)
4. fix the float8 test (update the expected output)
after this PR the test command for all torchao configs passes on an NVIDIA B200
Co-developed with Claude.
Test Plan:
What does this PR do?
Fixes # (issue)
Code Agent Policy
The Transformers repo is currently being overwhelmed by a large number of PRs and issue comments written by
code agents. We are currently bottlenecked by our ability to review and respond to them. As a result,
we ask that new users do not submit pure code agent PRs at this time.
You may use code agents in drafting or to help you diagnose issues. We'd also ask autonomous "OpenClaw"-like agents
not to open any PRs or issues for the moment.
PRs that appear to be fully agent-written will probably be closed without review, and we may block users who do this
repeatedly or maliciously.
This is a rapidly-evolving situation that's causing significant shockwaves in the open-source community. As a result,
this policy is likely to be updated regularly in the near future. For more information, please read
CONTRIBUTING.md.Before submitting
Pull Request section?
to it if that's the case.
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.