Skip to content

Conversation

@supriyar
Copy link
Contributor

@supriyar supriyar commented Sep 2, 2020

Stack from ghstack:

Summary:
embedding_bag requires only quantization of weights (no dynamic quantization of inputs)
So the type of quantization is essentially static (without calibration)
This will enable pyper to do fc and embedding_bag quantization using the same API call

Test Plan:
python test/test_quantization.py test_embedding_bag

Reviewers:

Subscribers:

Tasks:

Tags:

Differential Revision: D23467019

Summary:
embedding_bag requires only quantization of weights (no dynamic quantization of inputs)
So the type of quantization is essentially static (without calibration)
This will enable pyper to do fc and embedding_bag quantization using the same API call

Test Plan:
python test/test_quantization.py test_embedding_bag

Reviewers:

Subscribers:

Tasks:

Tags:

[ghstack-poisoned]
@supriyar supriyar requested a review from apaszke as a code owner September 2, 2020 01:23
supriyar added a commit that referenced this pull request Sep 2, 2020
Summary:
embedding_bag requires only quantization of weights (no dynamic quantization of inputs)
So the type of quantization is essentially static (without calibration)
This will enable pyper to do fc and embedding_bag quantization using the same API call

Test Plan:
python test/test_quantization.py test_embedding_bag

Reviewers:

Subscribers:

Tasks:

Tags:

ghstack-source-id: 8d24934
Pull Request resolved: #44008
@facebook-github-bot facebook-github-bot added the oncall: jit Add this issue/PR to JIT oncall triage queue label Sep 2, 2020
@dr-ci
Copy link

dr-ci bot commented Sep 2, 2020

💊 CI failures summary and remediations

As of commit 24789a1 (more details on the Dr. CI page):


  • 1/2 failures possibly* introduced in this PR
    • 1/1 non-CircleCI failure(s)
  • 1/2 broken upstream at merge base 6474057 on Sep 04 from 3:37am to 11:28am PDT (13 commits; f8f35fd - 0c2bc4f)

🚧 1 fixed upstream failure:

These were probably caused by upstream breakages that were already fixed.

Please rebase on the viable/strict branch (expand for instructions)

If your commit is newer than viable/strict, you can try basing on an older, stable commit:

git fetch https://github.com/pytorch/pytorch viable/strict
git rebase --onto FETCH_HEAD $(git merge-base origin/master HEAD)

If your commit is older than viable/strict:

git fetch https://github.com/pytorch/pytorch viable/strict
git rebase FETCH_HEAD

Check out the recency history of this "viable master" tracking branch.


ci.pytorch.org: 1 failed


This comment was automatically generated by Dr. CI (expand for details).Follow this link to opt-out of these comments for your Pull Requests.

Please report bugs/suggestions on the GitHub issue tracker or post in the (internal) Dr. CI Users group.

See how this bot performed.

This comment has been revised 16 times.

Summary:
embedding_bag requires only quantization of weights (no dynamic quantization of inputs)
So the type of quantization is essentially static (without calibration)
This will enable pyper to do fc and embedding_bag quantization using the same API call

Test Plan:
python test/test_quantization.py test_embedding_bag

Reviewers:

Subscribers:

Tasks:

Tags:

Differential Revision: [D23467019](https://our.internmc.facebook.com/intern/diff/D23467019)

[ghstack-poisoned]
Summary:
embedding_bag requires only quantization of weights (no dynamic quantization of inputs)
So the type of quantization is essentially static (without calibration)
This will enable pyper to do fc and embedding_bag quantization using the same API call

Test Plan:
python test/test_quantization.py test_embedding_bag

Reviewers:

Subscribers:

Tasks:

Tags:

Differential Revision: [D23467019](https://our.internmc.facebook.com/intern/diff/D23467019)

[ghstack-poisoned]
@codecov
Copy link

codecov bot commented Sep 2, 2020

Codecov Report

Merging #44008 into gh/supriyar/171/base will decrease coverage by 0.08%.
The diff coverage is n/a.

Impacted file tree graph

@@                   Coverage Diff                    @@
##           gh/supriyar/171/base   #44008      +/-   ##
========================================================
- Coverage                 69.35%   69.26%   -0.09%     
========================================================
  Files                       381      381              
  Lines                     47313    47239      -74     
========================================================
- Hits                      32812    32722      -90     
- Misses                    14501    14517      +16     
Impacted Files Coverage Δ
torch/testing/_internal/common_nn.py 79.20% <0.00%> (-3.88%) ⬇️
torch/testing/_internal/common_utils.py 76.61% <0.00%> (-0.62%) ⬇️
...ch/testing/_internal/common_methods_invocations.py 91.12% <0.00%> (-0.59%) ⬇️
torch/jit/quantized.py 56.44% <0.00%> (-0.17%) ⬇️
torch/quantization/fx/quantize.py 96.51% <0.00%> (-0.15%) ⬇️
torch/jit/annotations.py 92.27% <0.00%> (-0.14%) ⬇️
torch/jit/_recursive.py 93.96% <0.00%> (-0.06%) ⬇️
torch/jit/frontend.py 90.82% <0.00%> (-0.04%) ⬇️
torch/jit/_script.py 91.00% <0.00%> (-0.03%) ⬇️
torch/nn/modules/activation.py 96.62% <0.00%> (-0.02%) ⬇️
... and 27 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 119b273...24789a1. Read the comment docs.

int8_qconfig = QConfig(activation=PlaceholderObserver.with_args(dtype=torch.float,
custom_op_name="embedding_bag_byte"),
weight=PlaceholderObserver.with_args(custom_op_name="embedding_bag_byte"))
m = prepare_jit(m, {'embedding1' : int4_qconfig, 'embedding2' : int8_qconfig})
Copy link
Contributor

Choose a reason for hiding this comment

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

What about eager mode? Currently we expose embedding bag as a module in torch/nn/quantized/dynamic. Should we change that too?. Strictly speaking this case straddles the boundary of static vs dynamic: Output activations are in fp32 (like dynamic). Inputs are addresses and require no quantization. Weights alone are quantized.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure about eager mode. Currently for static quant we expect the users to provide calibration fn when they call quantize. Weight only quantization shouldn't require that step. So in that sense it fits better into dynamic.

Summary:
embedding_bag requires only quantization of weights (no dynamic quantization of inputs)
So the type of quantization is essentially static (without calibration)
This will enable pyper to do fc and embedding_bag quantization using the same API call

Test Plan:
python test/test_quantization.py test_embedding_bag

Reviewers:

Subscribers:

Tasks:

Tags:

Differential Revision: [D23467019](https://our.internmc.facebook.com/intern/diff/D23467019)

[ghstack-poisoned]
@facebook-github-bot
Copy link
Contributor

This pull request has been merged in 164b96c.

@facebook-github-bot facebook-github-bot deleted the gh/supriyar/171/head branch September 9, 2020 14:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Merged oncall: jit Add this issue/PR to JIT oncall triage queue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants