Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JIT] Add test for ignored class type property #45233

Closed

Conversation

SplitInfinity
Copy link

@SplitInfinity SplitInfinity commented Sep 23, 2020

Stack from ghstack:

Summary
This commit modifies TestClassType.test_properties to check that
properties on class types can be ignored with the same syntax as
ignoring properties on Modules.

Test Plan
python test/test_jit.py TestClassType.test_properties

Differential Revision: D23971885

**Summary**
This commit modifies `TestClassType.test_properties` to check that
properties on class types can be ignored with the same syntax as
ignoring properties on `Modules`.

**Test Plan**
`python test/test_jit.py TestClassType.test_properties`

[ghstack-poisoned]
@@ -1167,13 +1167,19 @@ def free_function(x: int) -> int:

@torch.jit.script
class Properties(object):
__ignored_properties__ = ["unsupported"]
Copy link
Contributor

Choose a reason for hiding this comment

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

OOC, is __ignored_properties__ the API we want users to use?

Copy link
Author

Choose a reason for hiding this comment

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

I think so. As @ppwwyyxx mentioned it should be easy to enable ignoring properties with a decorator, which is more intuitive because it's similar to how someone would ignore a function: D23797598.

Should we do it for this release or wait for the next?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it should be good to do for this release - i don't think it's particularly risky (although mabye unused is a better fit)

**Summary**
This commit modifies `TestClassType.test_properties` to check that
properties on class types can be ignored with the same syntax as
ignoring properties on `Modules`.

**Test Plan**
`python test/test_jit.py TestClassType.test_properties`

[ghstack-poisoned]
@dr-ci
Copy link

dr-ci bot commented Sep 23, 2020

💊 CI failures summary and remediations

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



❄️ 1 failure tentatively classified as flaky

but reruns have not yet been triggered to confirm:

See CircleCI build pytorch_ios_11_2_1_x86_64_build (1/1)

Step: "Update Homebrew" (full log | diagnosis details | 🔁 rerun) ❄️

fatal: Could not read from remote repository.
Receiving objects:  98% (175/178) Receiving objects:  99% (177/178) Receiving objects: 100% (178/178) Receiving objects: 100% (178/178), 63.90 KiB | 10.65 MiB/s, done. 
Resolving deltas:  96% (89/92) Resolving deltas:  97% (90/92) Resolving deltas: 100% (92/92) Resolving deltas: 100% (92/92), completed with 85 local objects. 
From ssh://github.com/Homebrew/homebrew-cask-versions 
 + 15f6b44...844ea12 master     -> origin/master  (forced update) 
+ git reset --hard origin/master 
HEAD is now at 844ea12 Update brave-browser-dev from 86.1.15.64,115.64 to 86.1.15.65,115.65 (#9680) 
+ for path in '$(find /usr/local/Homebrew -type d -name .git)' 
+ cd /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/.git/.. 
+ git fetch --depth=1 origin 
Connection to github.com closed by remote host.  
fatal: Could not read from remote repository. 
 
Please make sure you have the correct access rights 
and the repository exists. 

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

Copy link
Contributor

@eellison eellison left a comment

Choose a reason for hiding this comment

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

One question that was raised by a user internally on your previous PR - should we make the public api __jit_ignored_properties__ ? or _jit_ignored_attributes ? (if we extend this to also work for ignored class attributes which we should)

Or any other name suggestions?

@SplitInfinity
Copy link
Author

SplitInfinity commented Sep 23, 2020

If we go through with D23797598, the public API will be decorator-based. Will we still need this class attribute API for ignoring properties?

I think something like __jit_ignored_attributes__ makes sense for ignoring attributes of modules in general, I can stack that diff on top.

@eellison
Copy link
Contributor

SGTM

Meghan Lele added 2 commits September 24, 2020 11:50
**Summary**
This commit modifies `TestClassType.test_properties` to check that
properties on class types can be ignored with the same syntax as
ignoring properties on `Modules`.

**Test Plan**
`python test/test_jit.py TestClassType.test_properties`

[ghstack-poisoned]
**Summary**
This commit modifies `TestClassType.test_properties` to check that
properties on class types can be ignored with the same syntax as
ignoring properties on `Modules`.

**Test Plan**
`python test/test_jit.py TestClassType.test_properties`

[ghstack-poisoned]
@ydcjeff
Copy link
Contributor

ydcjeff commented Sep 25, 2020

Will we still need this class attribute API for ignoring properties?

Just a little opinion here, for other libraries based on PyTorch, instead of writing decorators everywhere, it is good to have class attribute API for ignoring properties to be able to ignore them in the respective files in one place.

Meghan Lele added 4 commits September 25, 2020 13:26
**Summary**
This commit modifies `TestClassType.test_properties` to check that
properties on class types can be ignored with the same syntax as
ignoring properties on `Modules`.

**Test Plan**
`python test/test_jit.py TestClassType.test_properties`

[ghstack-poisoned]
**Summary**
This commit modifies `TestClassType.test_properties` to check that
properties on class types can be ignored with the same syntax as
ignoring properties on `Modules`.

**Test Plan**
`python test/test_jit.py TestClassType.test_properties`

[ghstack-poisoned]
**Summary**
This commit modifies `TestClassType.test_properties` to check that
properties on class types can be ignored with the same syntax as
ignoring properties on `Modules`.

**Test Plan**
`python test/test_jit.py TestClassType.test_properties`

[ghstack-poisoned]
**Summary**
This commit modifies `TestClassType.test_properties` to check that
properties on class types can be ignored with the same syntax as
ignoring properties on `Modules`.

**Test Plan**
`python test/test_jit.py TestClassType.test_properties`

[ghstack-poisoned]
@eellison
Copy link
Contributor

Is this PR still necessary with __jit_ignored_attributes__ pr above ?

@SplitInfinity
Copy link
Author

Is this PR still necessary with __jit_ignored_attributes__ pr above ?

This PR adds the test (which didn't exist at all before and is necessary IMO), and the PR above renames the class property from __ignored_attributes__ to __jit_unused_attributes__. I made this PR before I realized I was going to rename __ignored_attributes__. I think they could be merged into one but I don't think it's a big deal.

@facebook-github-bot
Copy link
Contributor

@SplitInfinity merged this pull request in a0f0cb1.

@facebook-github-bot facebook-github-bot deleted the gh/splitinfinity/50/head branch October 2, 2020 14:17
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.

None yet

6 participants