Skip to content

Conversation

@HDCharles
Copy link
Contributor

@HDCharles HDCharles commented Mar 28, 2022

Stack from ghstack (oldest at bottom):

Summary: This PR primarily allows the PTQ convert function to work with
parametrized modules. Given that the parametrized weight is what is used
by default in convert, as long as sparsifier.step() has already been
called, the converted model will use the sparisified weights. There is
currently no way to handle things if sparsifier.step() has not been
called. Lastly, added the has_no_children_ignoring_parametrizations function because
parametrized modules no longer look like leaves due to the
parametrizations module attached to them

Test Plan: python test/test_ao_sparsity.py TestComposability

Reviewers:

Subscribers:

Tasks:

Tags:

Differential Revision: D35240275

Summary: making sure it works for PTQ even if squash_mask isn't applied

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:

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

facebook-github-bot commented Mar 28, 2022

🔗 Helpful links

💊 CI failures summary and remediations

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


  • 1/1 failures introduced in this PR

🕵️‍♀️ 1 failure not recognized by patterns:

The following CI failures may be due to changes from the PR
Job Step Action
GitHub Actions pull / linux-bionic-rocm5.0-py3.7 / test (default, 2, 2, linux.rocm.gpu) Set up job 🔁 rerun

This comment was automatically generated by Dr. CI (expand for details).

Please report bugs/suggestions to the (internal) Dr. CI Users group.

Click here to manually regenerate this comment.

Summary: making sure it works for PTQ even if squash_mask isn't applied

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:

[ghstack-poisoned]
Summary: This PR primarily allows the PTQ convert function to work with
parametrized modules. Given that the parametrized weight is what is used
by default in convert, as long as sparsifier.step() has already been
called, the converted model will use the sparisified weights. There is
currently no way to handle things if sparsifier.step() has not been
called.

Test Plan: python test/test_ao_sparsity.py TestComposability

Reviewers:

Subscribers:

Tasks:

Tags:

[ghstack-poisoned]
@HDCharles HDCharles changed the title Fixing sparsity and composability convert [ao][sparsity] make sparsity compose with PTQ convert Mar 28, 2022
Summary: This PR primarily allows the PTQ convert function to work with
parametrized modules. Given that the parametrized weight is what is used
by default in convert, as long as sparsifier.step() has already been
called, the converted model will use the sparisified weights. There is
currently no way to handle things if sparsifier.step() has not been
called.

Test Plan: python test/test_ao_sparsity.py TestComposability

Reviewers:

Subscribers:

Tasks:

Tags:

[ghstack-poisoned]
Summary: This PR primarily allows the PTQ convert function to work with
parametrized modules. Given that the parametrized weight is what is used
by default in convert, as long as sparsifier.step() has already been
called, the converted model will use the sparisified weights. There is
currently no way to handle things if sparsifier.step() has not been
called.

Test Plan: python test/test_ao_sparsity.py TestComposability

Reviewers:

Subscribers:

Tasks:

Tags:

[ghstack-poisoned]
Summary: This PR primarily allows the PTQ convert function to work with
parametrized modules. Given that the parametrized weight is what is used
by default in convert, as long as sparsifier.step() has already been
called, the converted model will use the sparisified weights. There is
currently no way to handle things if sparsifier.step() has not been
called.

Test Plan: python test/test_ao_sparsity.py TestComposability

Reviewers:

Subscribers:

Tasks:

Tags:

[ghstack-poisoned]
Summary: This PR primarily allows the PTQ convert function to work with
parametrized modules. Given that the parametrized weight is what is used
by default in convert, as long as sparsifier.step() has already been
called, the converted model will use the sparisified weights. There is
currently no way to handle things if sparsifier.step() has not been
called.

Test Plan: python test/test_ao_sparsity.py TestComposability

Reviewers:

Subscribers:

Tasks:

Tags:

[ghstack-poisoned]
Summary: This PR primarily allows the PTQ convert function to work with
parametrized modules. Given that the parametrized weight is what is used
by default in convert, as long as sparsifier.step() has already been
called, the converted model will use the sparisified weights. There is
currently no way to handle things if sparsifier.step() has not been
called.

Test Plan: python test/test_ao_sparsity.py TestComposability

Reviewers:

Subscribers:

Tasks:

Tags:

[ghstack-poisoned]
Summary: This PR primarily allows the PTQ convert function to work with
parametrized modules. Given that the parametrized weight is what is used
by default in convert, as long as sparsifier.step() has already been
called, the converted model will use the sparisified weights. There is
currently no way to handle things if sparsifier.step() has not been
called. Lastly, added the is_leaf_or_only_parametrized function because
parametrized modules no longer look like leaves due to the
parametrizations module attached to them

Test Plan: python test/test_ao_sparsity.py TestComposability

Reviewers:

Subscribers:

Tasks:

Tags:

[ghstack-poisoned]
@albanD albanD removed their request for review March 29, 2022 18:09
Summary: This PR primarily allows the PTQ convert function to work with
parametrized modules. Given that the parametrized weight is what is used
by default in convert, as long as sparsifier.step() has already been
called, the converted model will use the sparisified weights. There is
currently no way to handle things if sparsifier.step() has not been
called. Lastly, added the is_leaf_or_only_parametrized function because
parametrized modules no longer look like leaves due to the
parametrizations module attached to them

Test Plan: python test/test_ao_sparsity.py TestComposability

Reviewers:

Subscribers:

Tasks:

Tags:

[ghstack-poisoned]
@HDCharles
Copy link
Contributor Author

@HDCharles has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

from torch.nn.utils.fusion import fuse_linear_bn_weights
from typing import Optional

from torch.nn.utils.parametrize import is_parametrized
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: fix lint

Summary: This PR primarily allows the PTQ convert function to work with
parametrized modules. Given that the parametrized weight is what is used
by default in convert, as long as sparsifier.step() has already been
called, the converted model will use the sparisified weights. There is
currently no way to handle things if sparsifier.step() has not been
called. Lastly, added the has_no_children_ignoring_parametrizations function because
parametrized modules no longer look like leaves due to the
parametrizations module attached to them

Test Plan: python test/test_ao_sparsity.py TestComposability

Reviewers:

Subscribers:

Tasks:

Tags:

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

[ghstack-poisoned]
@HDCharles
Copy link
Contributor Author

@HDCharles has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

Summary: This PR primarily allows the PTQ convert function to work with
parametrized modules. Given that the parametrized weight is what is used
by default in convert, as long as sparsifier.step() has already been
called, the converted model will use the sparisified weights. There is
currently no way to handle things if sparsifier.step() has not been
called. Lastly, added the has_no_children_ignoring_parametrizations function because
parametrized modules no longer look like leaves due to the
parametrizations module attached to them

Test Plan: python test/test_ao_sparsity.py TestComposability

Reviewers:

Subscribers:

Tasks:

Tags:

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

[ghstack-poisoned]
@HDCharles
Copy link
Contributor Author

@HDCharles has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

Summary: This PR primarily allows the PTQ convert function to work with
parametrized modules. Given that the parametrized weight is what is used
by default in convert, as long as sparsifier.step() has already been
called, the converted model will use the sparisified weights. There is
currently no way to handle things if sparsifier.step() has not been
called. Lastly, added the has_no_children_ignoring_parametrizations function because
parametrized modules no longer look like leaves due to the
parametrizations module attached to them

Test Plan: python test/test_ao_sparsity.py TestComposability

Reviewers:

Subscribers:

Tasks:

Tags:

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

[ghstack-poisoned]
@HDCharles
Copy link
Contributor Author

@HDCharles has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

self.assertTrue(isinstance(mod[5], torch.nn.quantized.Linear))
self.assertEqual(mod(torch.randn(1, 4, 4, 4)).shape, torch.Size([1, 4, 4, 4]))

def test_convert_without_squash_mask(self):
Copy link
Contributor

@jerryzh168 jerryzh168 Apr 1, 2022

Choose a reason for hiding this comment

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

nit: same more this, I feel these tests are a bit complicated so we should have more comments on the context, also for future tests in this file as well

Summary: This PR primarily allows the PTQ convert function to work with
parametrized modules. Given that the parametrized weight is what is used
by default in convert, as long as sparsifier.step() has already been
called, the converted model will use the sparisified weights. There is
currently no way to handle things if sparsifier.step() has not been
called. Lastly, added the has_no_children_ignoring_parametrizations function because
parametrized modules no longer look like leaves due to the
parametrizations module attached to them

Test Plan: python test/test_ao_sparsity.py TestComposability

Reviewers:

Subscribers:

Tasks:

Tags:

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

[ghstack-poisoned]
@HDCharles
Copy link
Contributor Author

@HDCharles has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

Summary: This PR primarily allows the PTQ convert function to work with
parametrized modules. Given that the parametrized weight is what is used
by default in convert, as long as sparsifier.step() has already been
called, the converted model will use the sparisified weights. There is
currently no way to handle things if sparsifier.step() has not been
called. Lastly, added the has_no_children_ignoring_parametrizations function because
parametrized modules no longer look like leaves due to the
parametrizations module attached to them

Test Plan: python test/test_ao_sparsity.py TestComposability

Reviewers:

Subscribers:

Tasks:

Tags:

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

[ghstack-poisoned]
@HDCharles
Copy link
Contributor Author

@HDCharles has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

1 similar comment
@HDCharles
Copy link
Contributor Author

@HDCharles has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

Summary: This PR primarily allows the PTQ convert function to work with
parametrized modules. Given that the parametrized weight is what is used
by default in convert, as long as sparsifier.step() has already been
called, the converted model will use the sparisified weights. There is
currently no way to handle things if sparsifier.step() has not been
called. Lastly, added the has_no_children_ignoring_parametrizations function because
parametrized modules no longer look like leaves due to the
parametrizations module attached to them

Test Plan: python test/test_ao_sparsity.py TestComposability

Reviewers:

Subscribers:

Tasks:

Tags:

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

[ghstack-poisoned]
@HDCharles
Copy link
Contributor Author

@HDCharles has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

Summary: This PR primarily allows the PTQ convert function to work with
parametrized modules. Given that the parametrized weight is what is used
by default in convert, as long as sparsifier.step() has already been
called, the converted model will use the sparisified weights. There is
currently no way to handle things if sparsifier.step() has not been
called. Lastly, added the has_no_children_ignoring_parametrizations function because
parametrized modules no longer look like leaves due to the
parametrizations module attached to them

Test Plan: python test/test_ao_sparsity.py TestComposability

Reviewers:

Subscribers:

Tasks:

Tags:

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

[ghstack-poisoned]
@HDCharles
Copy link
Contributor Author

@HDCharles has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

facebook-github-bot pushed a commit that referenced this pull request Apr 6, 2022
Summary:
Pull Request resolved: #74846

This PR primarily allows the PTQ convert function to work with
parametrized modules. Given that the parametrized weight is what is used
by default in convert, as long as sparsifier.step() has already been
called, the converted model will use the sparisified weights. There is
currently no way to handle things if sparsifier.step() has not been
called. Lastly, added the is_leaf_or_only_parametrized function because
parametrized modules no longer look like leaves due to the
parametrizations module attached to them

Test Plan:
python test/test_ao_sparsity.py TestComposability

Imported from OSS

Reviewed By: vkuzo

Differential Revision: D35240275

fbshipit-source-id: 48529f2a83edfe6d8a2d2dff8ca3d08a3fb0d553
@github-actions
Copy link
Contributor

github-actions bot commented Apr 6, 2022

Hey @HDCharles.
You've committed this PR, but it does not have both a 'release notes: ...' and 'topics: ...' label. Please add one of each to the PR. The 'release notes: ...' label should represent the part of PyTorch that this PR changes (fx, autograd, distributed, etc) and the 'topics: ...' label should represent the kind of PR it is (not user facing, new feature, bug fix, perf improvement, etc). The list of valid labels can be found here for the 'release notes: ...' and here for the 'topics: ...'.
For changes that are 'topic: not user facing' there is no need for a release notes label.

NesrineMHB pushed a commit to NesrineMHB/pytorch that referenced this pull request Apr 7, 2022
Summary: This PR primarily allows the PTQ convert function to work with
parametrized modules. Given that the parametrized weight is what is used
by default in convert, as long as sparsifier.step() has already been
called, the converted model will use the sparisified weights. There is
currently no way to handle things if sparsifier.step() has not been
called. Lastly, added the has_no_children_ignoring_parametrizations function because
parametrized modules no longer look like leaves due to the
parametrizations module attached to them

Test Plan: python test/test_ao_sparsity.py TestComposability

Reviewers:

Subscribers:

Tasks:

Tags:

ghstack-source-id: ce30add
Pull Request resolved: pytorch/pytorch#74846
@facebook-github-bot facebook-github-bot deleted the gh/HDCharles/63/head branch April 9, 2022 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants