Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
/aoPublic

Fix NVFP4 QAT mixed precision#3501

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
andrewor14 wants to merge1 commit intomain
base:main
Choose a base branch
Loading
fromfix-nvfp4-mixed-precision

Conversation

@andrewor14
Copy link
Contributor

Summary: This commit adds support for bf16 activations + fp32 weights mixed precision for NVFP4 QAT, which previously threw a dtype assertion error:

File "ao/torchao/prototype/qat/nvfp4.py", line 159, in forward  assert fq.dtype == x.dtype

Test Plan:

python test/quantization/test_qat.py -k test_nvfp4_fake_quanitzed_linear_mixed_precision

@pytorch-bot
Copy link

pytorch-botbot commentedDec 17, 2025
edited
Loading

🔗 Helpful Links

🧪 See artifacts and rendered test results athud.pytorch.org/pr/pytorch/ao/3501

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

✅ You can merge normally! (1 Unrelated Failure)

As of commit4a5913b with merge basef3342a0 (image):

BROKEN TRUNK - The following job failed but were present on the merge base:

👉Rebase onto the `viable/strict` branch to avoid these failures

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

@meta-clameta-clabot added the CLA SignedThis label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. labelDec 17, 2025
@andrewor14andrewor14 added the topic: bug fixUse this tag for PRs that fix bugs labelDec 17, 2025
@andrewor14andrewor14force-pushed thefix-nvfp4-mixed-precision branch from38c977e to7826b54CompareDecember 17, 2025 16:38
x=x.view(-1,x.shape[-1])
else:
batch_size=None
fq=_NVFP4QuantizedForwardFakeQuantizedBackward.apply(
Copy link
Contributor

Choose a reason for hiding this comment

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

should the cast be inside_NVFP4QuantizedForwardFakeQuantizedBackward?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

moved it in

**Summary:** This commit adds support for bf16 activations +fp32 weights mixed precision for NVFP4 QAT, which previouslythrew a dtype assertion error:```File "ao/torchao/prototype/qat/nvfp4.py", line 159, in forward  assert fq.dtype == x.dtype```**Test Plan:**```python test/quantization/test_qat.py -k test_nvfp4_fake_quanitzed_linear_mixed_precision```

ctx.save_for_backward(_input,weight)

return_addmm_nvfp4_dispatch(
Copy link
Contributor

Choose a reason for hiding this comment

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

why is this returning the wrong dtype?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Seems to be caused by adding the bias:

Before this line result was bf16, after this line it's fp32. Do you think we should cast the bias here instead?

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@vkuzovkuzovkuzo left review comments

@jerryzh168jerryzh168Awaiting requested review from jerryzh168

Assignees

No one assigned

Labels

CLA SignedThis label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.topic: bug fixUse this tag for PRs that fix bugs

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@andrewor14@vkuzo

[8]ページ先頭

©2009-2025 Movatter.jp