Skip to content

Conversation

@supriyar
Copy link
Contributor

@supriyar supriyar commented Jul 29, 2020

Stack from ghstack:

Summary:
This change adds the necessary passes to perform FP16 dynamic quantization.
We skip inserting observers for activations based on the dtype (torch.float16) and only insert the Fp16Observer for weights

Test Plan:
python test/test_quantization.py TestQuantizeJitOps

Reviewers:

Subscribers:

Tasks:

Tags:

Differential Revision: D22849220

Summary:
This change adds the necessary passes to perform FP16 dynamic quantization.
We skip inserting observers for activations based on the dtype (torch.float16) and only insert the Fp16Observer for weights

Test Plan:
python test/test_quantization.py TestQuantizeJitOps

Reviewers:

Subscribers:

Tasks:

Tags:

[ghstack-poisoned]
@supriyar supriyar requested a review from apaszke as a code owner July 29, 2020 04:43
supriyar added a commit that referenced this pull request Jul 29, 2020
Summary:
This change adds the necessary passes to perform FP16 dynamic quantization.
We skip inserting observers for activations based on the dtype (torch.float16) and only insert the Fp16Observer for weights

Test Plan:
python test/test_quantization.py TestQuantizeJitOps

Reviewers:

Subscribers:

Tasks:

Tags:

ghstack-source-id: 99716c4
Pull Request resolved: #42222
@facebook-github-bot facebook-github-bot added the oncall: jit Add this issue/PR to JIT oncall triage queue label Jul 29, 2020
@dr-ci
Copy link

dr-ci bot commented Jul 29, 2020

💊 CI failures summary and remediations

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


  • 1/1 failures possibly* introduced in this PR
    • 1/1 non-CircleCI failure(s)

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 17 times.

Summary:
This change adds the necessary passes to perform FP16 dynamic quantization.
We skip inserting observers for activations based on the dtype (torch.float16) and only insert the Fp16Observer for weights

Test Plan:
python test/test_quantization.py TestQuantizeJitOps

Reviewers:

Subscribers:

Tasks:

Tags:

[ghstack-poisoned]
@supriyar supriyar requested review from jerryzh168 and vkuzo July 29, 2020 16:46
Summary:
This change adds the necessary passes to perform FP16 dynamic quantization.
We skip inserting observers for activations based on the dtype (torch.float16) and only insert the Fp16Observer for weights

Test Plan:
python test/test_quantization.py TestQuantizeJitOps

Reviewers:

Subscribers:

Tasks:

Tags:

[ghstack-poisoned]
supriyar added a commit that referenced this pull request Jul 29, 2020
Summary:
This change adds the necessary passes to perform FP16 dynamic quantization.
We skip inserting observers for activations based on the dtype (torch.float16) and only insert the Fp16Observer for weights

Test Plan:
python test/test_quantization.py TestQuantizeJitOps

Reviewers:

Subscribers:

Tasks:

Tags:

ghstack-source-id: fdd1e38
Pull Request resolved: #42222
}
if (quant_type == QuantType::DYNAMIC) {
if (isFP16NoopObserver(module, observer)) {
if (isFp16Observer(observer->input(0))) {
Copy link
Contributor

Choose a reason for hiding this comment

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

can we just check dtype here?

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 think so, was just being more explicit by checking for the observer type as well.

auto observer_module = module.attr(findObserverName(v).value()).toModule();
return (observer_module.attr("dtype") == at::ScalarType::Half) &&
isNoopObserver(observer);
bool isFp16Observer(Value* observer) {
Copy link
Contributor

Choose a reason for hiding this comment

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

do we need this check? I think checking dtype is enough for our purposes?

Summary:
This change adds the necessary passes to perform FP16 dynamic quantization.
We skip inserting observers for activations based on the dtype (torch.float16) and only insert the Fp16Observer for weights

Test Plan:
python test/test_quantization.py TestQuantizeJitOps

Reviewers:

Subscribers:

Tasks:

Tags:

[ghstack-poisoned]
supriyar added a commit that referenced this pull request Jul 30, 2020
Summary:
This change adds the necessary passes to perform FP16 dynamic quantization.
We skip inserting observers for activations based on the dtype (torch.float16) and only insert the Fp16Observer for weights

Test Plan:
python test/test_quantization.py TestQuantizeJitOps

Reviewers:

Subscribers:

Tasks:

Tags:

ghstack-source-id: 0d270ed
Pull Request resolved: #42222
@supriyar supriyar requested a review from jerryzh168 July 30, 2020 00:59
Comment on lines +2513 to +2515
observer_name = 'Fp16Observer = prim::GetAttr[name="_observer_'
FileCheck().check(observer_name) \
.run(m.fc.graph)
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like this check is not very useful, what do we want to check here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just additional check for observer name match

Copy link
Contributor

@jerryzh168 jerryzh168 left a comment

Choose a reason for hiding this comment

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

LG, had a few inline comments

Summary:
This change adds the necessary passes to perform FP16 dynamic quantization.
We skip inserting observers for activations based on the dtype (torch.float16) and only insert the Fp16Observer for weights

Test Plan:
python test/test_quantization.py TestQuantizeJitOps

Reviewers:

Subscribers:

Tasks:

Tags:

[ghstack-poisoned]
Summary:
This change adds the necessary passes to perform FP16 dynamic quantization.
We skip inserting observers for activations based on the dtype (torch.float16) and only insert the Fp16Observer for weights

Test Plan:
python test/test_quantization.py TestQuantizeJitOps

Reviewers:

Subscribers:

Tasks:

Tags:

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

[ghstack-poisoned]
supriyar added a commit that referenced this pull request Jul 30, 2020
Summary:
This change adds the necessary passes to perform FP16 dynamic quantization.
We skip inserting observers for activations based on the dtype (torch.float16) and only insert the Fp16Observer for weights

Test Plan:
python test/test_quantization.py TestQuantizeJitOps

Reviewers:

Subscribers:

Tasks:

Tags:

ghstack-source-id: ce6e7dd
Pull Request resolved: #42222
@facebook-github-bot
Copy link
Contributor

This pull request has been merged in 6bd46b5.

@facebook-github-bot facebook-github-bot deleted the gh/supriyar/153/head branch August 4, 2020 14:15
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.

5 participants