Skip to content
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

[NF4][FSDP] return contiguous quantization_factor #298

Merged
merged 2 commits into from
May 31, 2024

Conversation

weifengpy
Copy link
Contributor

@weifengpy weifengpy commented May 30, 2024

before, NF4.quantization_factor is non-contiguous, meaning NF4.stride() is (16, 0)
after, NF4.quantization_factor contiguous with NF4.stride() is (1, 0). it's easy to work with FSDP since we do .view(unit8) and it requries contiguous tensor

import torch
from torchao.dtypes.nf4tensor import to_nf4
inpt_tensor = torch.rand(4096, device='cuda')
inpt_tensor_nf4 = to_nf4(inpt_tensor, 32, 16)
print(inpt_tensor_nf4.quantization_factor.stride())

Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:
Copy link

pytorch-bot bot commented May 30, 2024

🔗 Helpful Links

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

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:

✅ No Failures

As of commit ce26526 with merge base 68ce5b8 (image):
💚 Looks good so far! There are no failures yet. 💚

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

@facebook-github-bot facebook-github-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 May 30, 2024
@weifengpy weifengpy requested a review from drisspg May 30, 2024 23:45
Copy link
Contributor

@drisspg drisspg left a comment

Choose a reason for hiding this comment

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

🚢

@msaroufim msaroufim merged commit 9dbc554 into pytorch:main May 31, 2024
13 checks passed
dbyoung18 pushed a commit to dbyoung18/ao that referenced this pull request Jul 31, 2024
Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants