Skip to content

Default observer and fake-quant for backends#26627

Closed
raghuramank100 wants to merge 11 commits intogh/raghuramank100/38/basefrom
gh/raghuramank100/38/head
Closed

Default observer and fake-quant for backends#26627
raghuramank100 wants to merge 11 commits intogh/raghuramank100/38/basefrom
gh/raghuramank100/38/head

Conversation

@raghuramank100
Copy link
Contributor

@raghuramank100 raghuramank100 commented Sep 22, 2019

Stack from ghstack:

Differential Revision: D17518194

raghuramank100 pushed a commit that referenced this pull request Sep 23, 2019
Pull Request resolved: #26627


ghstack-source-id: 90556162

Differential Revision: [D17518194](https://our.internmc.facebook.com/intern/diff/D17518194/)
raghuramank100 pushed a commit that referenced this pull request Sep 23, 2019
Pull Request resolved: #26627


ghstack-source-id: 90623342

Differential Revision: [D17518194](https://our.internmc.facebook.com/intern/diff/D17518194/)
raghuramank100 pushed a commit that referenced this pull request Sep 24, 2019
Pull Request resolved: #26627


ghstack-source-id: 90623342

Differential Revision: [D17518194](https://our.internmc.facebook.com/intern/diff/D17518194/)
default_qat_qconfig = QConfig(activation=default_fake_quant,
weight=default_weight_fake_quant)

def get_default_qconfig(backend='fbgemm'):
Copy link
Collaborator

Choose a reason for hiding this comment

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

technically - it's not even fbgemm, but rather fbgemm on per-CooperLake x86 :-\ . But I don't know how to make it nicer.

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 agree, perhaps just call it server and have a comment stating that you need to know about the hardware platform to ensure you are picking a good default?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually with mkl-dnn not sure how to improve on this, so leaving this as is for now

def get_default_qconfig(backend='fbgemm'):
if backend == 'fbgemm':
qconfig = QConfig(activation=HistogramObserver.with_args(reduce_range=True),
weight=default_per_channel_weight_observer)
Copy link
Collaborator

Choose a reason for hiding this comment

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

so we do per-channel only for fbgemm, not for mobile?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Mobile does not support per-channel kernels currently. If and when QNNPACK supports it, we can change that.


def get_default_qat_qconfig(backend='fbgemm'):
if backend == 'fbgemm':
qconfig = QConfig(activation=FakeQuantize.with_args(observer=default_l2_observer(reduce_range = True),
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this will create the same instance of observer for each FakeQuant - you probably need double with_args, but it gets ugly...

@raghuramank100 raghuramank100 added this to the 1.3 milestone Sep 24, 2019
raghuramank100 pushed a commit that referenced this pull request Sep 24, 2019
Pull Request resolved: #26627


ghstack-source-id: 90704697

Differential Revision: [D17518194](https://our.internmc.facebook.com/intern/diff/D17518194/)
raghuramank100 pushed a commit that referenced this pull request Sep 28, 2019
Pull Request resolved: #26627


ghstack-source-id: 90979560

Differential Revision: [D17518194](https://our.internmc.facebook.com/intern/diff/D17518194/)
Copy link
Collaborator

@dzhulgakov dzhulgakov left a comment

Choose a reason for hiding this comment

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

Feel free to land this PR before the others (reorder the stack) as it's useful

raghuramank100 pushed a commit that referenced this pull request Sep 29, 2019
Pull Request resolved: #26627


ghstack-source-id: 90997604

Differential Revision: [D17518194](https://our.internmc.facebook.com/intern/diff/D17518194/)
raghuramank100 pushed a commit that referenced this pull request Sep 30, 2019
Pull Request resolved: #26627


ghstack-source-id: 91008337

Differential Revision: [D17518194](https://our.internmc.facebook.com/intern/diff/D17518194/)
@facebook-github-bot
Copy link
Contributor

This pull request has been merged in d5298b6.

jamesr66a pushed a commit that referenced this pull request Oct 3, 2019
Summary:
Pull Request resolved: #26627

ghstack-source-id: 91008337

Test Plan: buck test caffe2/test:quantization -- --print-passing-details

Differential Revision: D17518194

fbshipit-source-id: 1eb8a7a85dc811c4ee5228d68563abb157613ceb
jamesr66a pushed a commit that referenced this pull request Oct 3, 2019
Summary:
Pull Request resolved: #26627

ghstack-source-id: 91008337

Test Plan: buck test caffe2/test:quantization -- --print-passing-details

Differential Revision: D17518194

fbshipit-source-id: 1eb8a7a85dc811c4ee5228d68563abb157613ceb
jamesr66a pushed a commit that referenced this pull request Oct 4, 2019
Summary:
Pull Request resolved: #26627

ghstack-source-id: 91008337

Test Plan: buck test caffe2/test:quantization -- --print-passing-details

Differential Revision: D17518194

fbshipit-source-id: 1eb8a7a85dc811c4ee5228d68563abb157613ceb
jamesr66a pushed a commit that referenced this pull request Oct 4, 2019
Summary:
Pull Request resolved: #26627

ghstack-source-id: 91008337

Test Plan: buck test caffe2/test:quantization -- --print-passing-details

Differential Revision: D17518194

fbshipit-source-id: 1eb8a7a85dc811c4ee5228d68563abb157613ceb
soumith pushed a commit that referenced this pull request Oct 7, 2019
Summary:
Pull Request resolved: #26627

ghstack-source-id: 91008337

Test Plan: buck test caffe2/test:quantization -- --print-passing-details

Differential Revision: D17518194

fbshipit-source-id: 1eb8a7a85dc811c4ee5228d68563abb157613ceb
@facebook-github-bot facebook-github-bot deleted the gh/raghuramank100/38/head branch October 28, 2019 22:19
pdlive215 pushed a commit to pdlive215/pytorch that referenced this pull request Nov 27, 2019
Summary:
Pull Request resolved: pytorch#26627

ghstack-source-id: 91008337

Test Plan: buck test caffe2/test:quantization -- --print-passing-details

Differential Revision: D17518194

fbshipit-source-id: 1eb8a7a85dc811c4ee5228d68563abb157613ceb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants