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

[BAD VERSION2] Make module swap the main QAT flow again #1019

Merged
merged 1 commit into from
Oct 8, 2024

Conversation

andrewor14
Copy link
Contributor

@andrewor14 andrewor14 commented Oct 4, 2024

Stack from ghstack (oldest at bottom):

Summary: Following #987, this
commit makes module swap the main QAT flow today. We remove all
tensor subclass fake quantize injection logic since this is not
needed in both the long term and the short term plans for QAT.
In the short term, we will continue to use a full module swap
flow, and only migrate to the long term flow once there is
general distributed support for tensor subclasses and when
tensor subclass composability provides meaningful benefits.

Test Plan:
python test/quantization/test_qat.py

Summary: Following #987, this
commit makes module swap the main QAT flow today. We remove all
tensor subclass fake quantize injection logic since this is not
needed in both the long term and the short term plans for QAT.
In the short term, we will continue to use a full module swap
flow, and only migrate to the long term flow once there is
general distributed support for tensor subclasses and when
tensor subclass composability provides meaningful benefits.

Test Plan:
python test/quantization/test_qat.py

[ghstack-poisoned]
Copy link

pytorch-bot bot commented Oct 4, 2024

🔗 Helpful Links

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

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

✅ You can merge normally! (1 Unrelated Failure)

As of commit 0756f39 with merge base 5a4857e (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.

@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 Oct 4, 2024
# | 8da4w QAT |
# =================

def int8_dynamic_activation_int4_weight_fake_quantize(group_size=32):
Copy link
Contributor

@jerryzh168 jerryzh168 Oct 7, 2024

Choose a reason for hiding this comment

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

so we are not planning to use fake quant tensor subclass? I remember there was some benefits, can you write down the plan for this? maybe either in summary or code comments

Copy link
Contributor

Choose a reason for hiding this comment

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

I thought we decided on using fake quantize tensor subclass for the long term: #987?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This path is doing tensor subclass injection. I think we don't want to do that in the long term. E.g. what fp8 training does is use module swaps to insert the subclasses, like:

weight_fp8 = hp_tensor_and_scale_to_float8(
.

Copy link
Contributor

@jerryzh168 jerryzh168 Oct 7, 2024

Choose a reason for hiding this comment

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

oh OK I thought AffineFakeQuantizedTensor was removed. then sounds good

@andrewor14 andrewor14 merged commit 47131e9 into gh/andrewor14/3/base Oct 8, 2024
40 of 43 checks passed
@andrewor14
Copy link
Contributor Author

oh no, this was merged into the wrong branch, need to reopen again

@andrewor14 andrewor14 changed the title Make module swap the main QAT flow again [BAD VERSION2] Make module swap the main QAT flow again Oct 8, 2024
@andrewor14
Copy link
Contributor Author

Reopened here: #1037

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.

3 participants