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

Follow up on freezing #34786

Closed
wants to merge 7 commits into from
Closed

Follow up on freezing #34786

wants to merge 7 commits into from

Conversation

bzinodev
Copy link
Contributor

@bzinodev bzinodev commented Mar 15, 2020

Stack from ghstack:

  1. Rename 'HashIValue' to 'HashAliasedIValue'
  2. Added Object case in getSubValues function
  3. Hashes tensors to their storage
  4. Added Dict case in orverrideGradient
  5. nit clean up

Differential Revision: D20585270

1) Rename 'HashIValue' to 'HashAliasedIValue'
2) Added Object case in getSubValues function
3) Hashes tensors to their storage
4) Added Dict case in orverrideGradient
5) nit clean up

[ghstack-poisoned]
@bzinodev bzinodev requested a review from apaszke as a code owner March 15, 2020 18:55
@facebook-github-bot facebook-github-bot added the oncall: jit Add this issue/PR to JIT oncall triage queue label Mar 15, 2020
@bzinodev bzinodev requested review from eellison, suo and zdevito March 15, 2020 18:57
@dr-ci
Copy link

dr-ci bot commented Mar 15, 2020

💊 CircleCI build failures summary and remediations

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


💚 💚 Looks good so far! There are no CircleCI failures yet. 💚 💚


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.

This comment has been revised 34 times.

Zino Benaissa added 2 commits March 16, 2020 12:35
1) Rename 'HashIValue' to 'HashAliasedIValue'
2) Added Object case in getSubValues function
3) Hashes tensors to their storage
4) Added Dict case in orverrideGradient
5) nit clean up

[ghstack-poisoned]
1) Rename 'HashIValue' to 'HashAliasedIValue'
2) Added Object case in getSubValues function
3) Hashes tensors to their storage
4) Added Dict case in orverrideGradient
5) nit clean up

[ghstack-poisoned]
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.

Changes here look good, could you address a few of the other comments from PR? I added each as a comment to make it easier to track.

@@ -227,6 +227,13 @@ class AttributePropagator {
elems.set(i, overrideGradient(elems.extract(i)));
}
attr = std::move(elems);
} else if (attr.isGenericDict()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

For the override gradient implementation here, can you call getSubValues and then remove the gradient for all tensor subvalues ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the gradient is not overridden inplace because it is detached so that the original module has no side effects so I can really use getSubValues

Copy link
Contributor

Choose a reason for hiding this comment

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

Okay, that makes sense. If that's the case don't you need to return the recursively constructed new attribute and reset it as the attribute ?

here for example we're not returning a new tuple with the detatched gradients. so it's either inplace, which we're not trying to do, or we're not changing anything.

elem = overrideGradient(elem);

Copy link
Contributor

Choose a reason for hiding this comment

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

cc @Krovatkin @smessmer @zdevito how to do correct detaching of gradients in these cases

case Tag::Object: {
subValues.insert(*this);
auto obj_type = type()->expect<ClassType>();
auto obj_value = toObject();
Copy link
Contributor

Choose a reason for hiding this comment

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

https://github.com/pytorch/pytorch/pull/32178/files#r385953414 for this comment, could you address or clarify in the code ?

@bzinodev bzinodev requested a review from jerryzh168 March 19, 2020 06:46
1) Rename 'HashIValue' to 'HashAliasedIValue'
2) Added Object case in getSubValues function
3) Hashes tensors to their storage
4) Added Dict case in orverrideGradient
5) nit clean up

[ghstack-poisoned]
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.

LGTM, one comment about the recursive gradient detaching and it should be good to go

@@ -227,6 +227,13 @@ class AttributePropagator {
elems.set(i, overrideGradient(elems.extract(i)));
}
attr = std::move(elems);
} else if (attr.isGenericDict()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Okay, that makes sense. If that's the case don't you need to return the recursively constructed new attribute and reset it as the attribute ?

here for example we're not returning a new tuple with the detatched gradients. so it's either inplace, which we're not trying to do, or we're not changing anything.

elem = overrideGradient(elem);

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.

meant to accept

Zino Benaissa added 3 commits March 21, 2020 11:08
1) Rename 'HashIValue' to 'HashAliasedIValue'
2) Added Object case in getSubValues function
3) Hashes tensors to their storage
4) Added Dict case in orverrideGradient
5) nit clean up

[ghstack-poisoned]
1) Rename 'HashIValue' to 'HashAliasedIValue'
2) Added Object case in getSubValues function
3) Hashes tensors to their storage
4) Added Dict case in orverrideGradient
5) nit clean up

[ghstack-poisoned]
1) Rename 'HashIValue' to 'HashAliasedIValue'
2) Added Object case in getSubValues function
3) Hashes tensors to their storage
4) Added Dict case in orverrideGradient
5) nit clean up

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

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

@bzinodev merged this pull request in c321f02.

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.

4 participants