Skip to content

Update QAT README.md #2162

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

Merged
merged 1 commit into from
May 2, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion torchao/quantization/qat/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,11 @@ To fake quantize embedding in addition to linear, you can additionally call
the following with a filter function during the prepare step:

```
from torchao.quantization.quant_api import _is_linear
quantize_(
m,
IntXQuantizationAwareTrainingConfig(weight_config=weight_config),
filter_fn=lambda m, _: isinstance(m, torch.nn.Embedding),
filter_fn=lambda m, _: isinstance(m, torch.nn.Embedding) or _is_linear(m),
Copy link
Contributor

Choose a reason for hiding this comment

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

Actually this is only if you want to use the same configuration for embedding and linear. I kept them as two separate calls because in the above example linear additionally has activation quantization.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah you're right and this example won't work if you try and apply a config with activation quantization to both linear and embedding layers at the same time.
You can stack calls to quantize right? Would the right way to go about this two quantize calls, one which iflters for linear, then another which filters for embeddings?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah if you have slightly different quantization configurations for embedding and linear the right way would be two separate quantize_ calls. This is by design because we don't want to complicate quantize_ to accept a dictionary of configs

)
```

Expand Down
Loading