Skip to content

Conversation

@vkuzo
Copy link
Contributor

@vkuzo vkuzo commented Apr 15, 2020

Stack from ghstack:

Summary:

Adds the static quantization hook for LayerNorm

Test Plan:

python test/quantization/test_quantized_nn_mods.py ModuleAPITest.test_layer_norm
python test/quantization/test_quantization.py EagerModePostTrainingQuantTest.test_normalization

Reviewers:

Subscribers:

Tasks:

Tags:

Differential Revision: D21055401

Summary:

Adds the static quantization hook for LayerNorm

Test Plan:

```
python test/quantization/test_quantized_nn_mods.py ModuleAPITest.test_layer_norm
python test/quantization/test_quantization.py EagerModePostTrainingQuantTest.test_normalization
```

Reviewers:

Subscribers:

Tasks:

Tags:

[ghstack-poisoned]
@vkuzo vkuzo requested a review from apaszke as a code owner April 15, 2020 23:41
@vkuzo vkuzo self-assigned this Apr 15, 2020
@vkuzo vkuzo added the oncall: quantization Quantization support in PyTorch label Apr 15, 2020
@dr-ci
Copy link

dr-ci bot commented Apr 15, 2020

💊 Build failures summary and remediations

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


  • 1/1 failures introduced in this PR

XLA failure

Job pytorch_xla_linux_bionic_py3_6_clang9_build is failing. Please create an issue with title prefixed by [PT_BREAK] in pytorch/xla and link to to this PR. If you have questions, please reach out to @ailzhang / @dlibenzi / @JackCaoG.


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.

See how this bot performed.

This comment has been revised 7 times.

Summary:

Adds the static quantization hook for LayerNorm

Test Plan:

```
python test/quantization/test_quantized_nn_mods.py ModuleAPITest.test_layer_norm
python test/quantization/test_quantization.py EagerModePostTrainingQuantTest.test_normalization
```

Reviewers:

Subscribers:

Tasks:

Tags:

[ghstack-poisoned]
vkuzo added a commit that referenced this pull request Apr 15, 2020
Summary:

Adds the static quantization hook for LayerNorm

Test Plan:

```
python test/quantization/test_quantized_nn_mods.py ModuleAPITest.test_layer_norm
python test/quantization/test_quantization.py EagerModePostTrainingQuantTest.test_normalization
```

Reviewers:

Subscribers:

Tasks:

Tags:

ghstack-source-id: 5370ccb
Pull Request resolved: #36690
Copy link
Contributor

@supriyar supriyar left a comment

Choose a reason for hiding this comment

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

LGTM!

Summary:

Adds the static quantization hook for LayerNorm

Test Plan:

```
python test/quantization/test_quantized_nn_mods.py ModuleAPITest.test_layer_norm
python test/quantization/test_quantization.py EagerModePostTrainingQuantTest.test_normalization
```

Reviewers:

Subscribers:

Tasks:

Tags:

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

[ghstack-poisoned]
vkuzo added a commit that referenced this pull request Apr 16, 2020
Summary:

Adds the static quantization hook for LayerNorm

Test Plan:

```
python test/quantization/test_quantized_nn_mods.py ModuleAPITest.test_layer_norm
python test/quantization/test_quantization.py EagerModePostTrainingQuantTest.test_normalization
```

Reviewers:

Subscribers:

Tasks:

Tags:

ghstack-source-id: 4a7194e
Pull Request resolved: #36690

checkQuantized(model)

def test_normalization(self):
Copy link
Contributor

Choose a reason for hiding this comment

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

This test (and other tests here) only test for FBGEMM, needs to be fixed in a later PR.

self.assertEqual(quant_ref.int_repr().numpy(), qy.int_repr().numpy(),
message="BatchNorm3d module API failed")

def test_layer_norm(self):
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 test this over qnnpack and FBGEMM? Qnnpack only tests the x86 path.

    @given(qengine=st.sampled_from(("qnnpack", "fbgemm")))

and using qengine as an argument to the test should do it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we don't have a mobile implementation for LayerNorm. It might run correctly on mobile but it would be too slow to be useful. Should we still test for it? I'm flexible, more just curios on how we've done it in the past.

Copy link
Contributor

@raghuramank100 raghuramank100 left a comment

Choose a reason for hiding this comment

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

Requesting extending test to qnnpack, looks good otherwise!

@facebook-github-bot
Copy link
Contributor

This pull request has been merged in 2c558db.

@facebook-github-bot facebook-github-bot deleted the gh/vkuzo/35/head branch April 20, 2020 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Merged oncall: quantization Quantization support in PyTorch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants