Skip to content

gptq example: remove transformers version check#4313

Merged
vkuzo merged 19 commits intomainfrom
gh/vkuzo/251/head
Apr 23, 2026
Merged

gptq example: remove transformers version check#4313
vkuzo merged 19 commits intomainfrom
gh/vkuzo/251/head

Conversation

@vkuzo
Copy link
Copy Markdown
Contributor

@vkuzo vkuzo commented Apr 22, 2026

Summary:

remove the hacky transformers version check, and replace it with proper
workarounds:

  1. ensure the user has transformers with
    fix transformers + torchao nvfp4 serialization 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:

torchao/prototype/gptq/gptq_nvfp4_llama3_2_1b_nonsequential_wikitext.sh
// results unchanged

vkuzo added 13 commits April 20, 2026 20:52
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
@vkuzo
Copy link
Copy Markdown
Contributor Author

vkuzo commented Apr 22, 2026

@vkuzo vkuzo requested a review from jerryzh168 as a code owner April 22, 2026 11:21
@pytorch-bot
Copy link
Copy Markdown

pytorch-bot Bot commented Apr 22, 2026

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/ao/4313

Note: Links to docs will display an error until the docs builds have been completed.

❗ 1 Active SEVs

There are 1 currently active SEVs. If your PR is affected, please view them below:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Apr 22, 2026
@vkuzo vkuzo added the module: not user facing Use this tag if you don't want this PR to show up in release notes label Apr 22, 2026
vkuzo added 3 commits April 22, 2026 11:24
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
vkuzo added a commit 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 2 commits April 22, 2026 11:25
[ghstack-poisoned]
[ghstack-poisoned]
vkuzo added a commit 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
)

if args.quantization != "none":
# Attach hf_quantizer so save_pretrained uses the flatten path for tensor
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

is there a more official api for this?

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.

this is a non user facing hacky prototype script - works for now, we can improve later if there is a need

[ghstack-poisoned]
@vkuzo vkuzo requested a review from danielvegamyhre as a code owner April 23, 2026 09:23
@vkuzo vkuzo changed the base branch from gh/vkuzo/250/head to main April 23, 2026 09:23
@vkuzo vkuzo merged commit fa5aed0 into main Apr 23, 2026
36 of 48 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. module: not user facing Use this tag if you don't want this PR to show up in release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants