Skip to content

Conversation

@jcaip
Copy link
Contributor

@jcaip jcaip commented Dec 5, 2025

This PR adds in a new static quant workflow based off of Int8Tensor (#3407).

It introduces a new config, Int8StaticActivationInt8WeightConfig which requires a scale tensor and granularity

static_config = Int8StaticActivationInt8WeightConfig(
    scale=int8_input.scale.detach(), granularity=PerRow
)
quantize_(model_static_quant, static_config)

Currently PerRow and PerTensor symmetric quant is support only.

This scale tensor is stored on the weight Int8Tensor under activation_scale, and is used to create a new activation Int8Tensor for static quantization.

It would be nice to store this scale tensor in QuantizeTensorToInt8Kwargs but unfortunately this breaks dynamo tracing, as we store the quant kwargs as an object for the weight tensor and we are unable to fakeify them properly.

As a result, we need to keep track and pass scale outside of this Kwargs object.

@pytorch-bot
Copy link

pytorch-bot bot commented Dec 5, 2025

🔗 Helpful Links

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

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

✅ No Failures

As of commit 8ae921d with merge base c4273fe (image):
💚 Looks good so far! There are no failures yet. 💚

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 Dec 5, 2025
@jcaip jcaip changed the base branch from main to jcaip/int8-tensor December 5, 2025 00:27
@jcaip jcaip added the topic: new feature Use this tag if this PR adds a new feature label Dec 7, 2025
@jcaip jcaip marked this pull request as ready for review December 7, 2025 00:05
@jcaip jcaip changed the title int8 static quant Add int8 static quantization workflow Dec 7, 2025
@jcaip jcaip changed the base branch from jcaip/int8-tensor to main December 7, 2025 00:07
@jcaip jcaip closed this Dec 7, 2025
@jcaip jcaip reopened this Dec 7, 2025
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. topic: new feature Use this tag if this PR adds a new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants