-
Notifications
You must be signed in to change notification settings - Fork 22.4k
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] Fix dict type serialization #32569
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
If the dict's contained types cannot be inferred from its contents (for example, `Dict[str, Tensor]` vs. `Dict[str, Optional[Tensor]]`), we must explicitly annotate the type. Also this removes some special handling that omits annotations on empty containers that have the default type. It makes the code more complex for not too much value, and was wrong for dicts anyway. [ghstack-poisoned]
facebook-github-bot
added
the
oncall: jit
Add this issue/PR to JIT oncall triage queue
label
Jan 24, 2020
If the dict's contained types cannot be inferred from its contents (for example, `Dict[str, Tensor]` vs. `Dict[str, Optional[Tensor]]`), we must explicitly annotate the type. Also this removes some special handling that omits annotations on empty containers that have the default type. It makes the code more complex for not too much value, and was wrong for dicts anyway. [ghstack-poisoned]
If the dict's contained types cannot be inferred from its contents (for example, `Dict[str, Tensor]` vs. `Dict[str, Optional[Tensor]]`), we must explicitly annotate the type. Also this removes some special handling that omits annotations on empty containers that have the default type. It makes the code more complex for not too much value, and was wrong for dicts anyway. [ghstack-poisoned]
If the dict's contained types cannot be inferred from its contents (for example, `Dict[str, Tensor]` vs. `Dict[str, Optional[Tensor]]`), we must explicitly annotate the type. Also this removes some special handling that omits annotations on empty containers that have the default type. It makes the code more complex for not too much value, and was wrong for dicts anyway. Differential Revision: [D19551016](https://our.internmc.facebook.com/intern/diff/D19551016) [ghstack-poisoned]
zdevito
approved these changes
Jan 24, 2020
if (node->inputs().size() == 0 && !is_default_type) { | ||
// Empty dicts must be annotated with their type so the compiler knows | ||
// what type is supposed to be inside them | ||
if (node->inputs().size() == 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This branch can be folded into the one below as another or clause. printDict knows know to print an empty Dict.
If the dict's contained types cannot be inferred from its contents (for example, `Dict[str, Tensor]` vs. `Dict[str, Optional[Tensor]]`), we must explicitly annotate the type. Also this removes some special handling that omits annotations on empty containers that have the default type. It makes the code more complex for not too much value, and was wrong for dicts anyway. Differential Revision: [D19551016](https://our.internmc.facebook.com/intern/diff/D19551016) [ghstack-poisoned]
suo
added a commit
that referenced
this pull request
Jan 24, 2020
If the dict's contained types cannot be inferred from its contents (for example, `Dict[str, Tensor]` vs. `Dict[str, Optional[Tensor]]`), we must explicitly annotate the type. Also this removes some special handling that omits annotations on empty containers that have the default type. It makes the code more complex for not too much value, and was wrong for dicts anyway. ghstack-source-id: eb4745c6d69abe97e0fade9df20ac3f6c9783079 Pull Request resolved: #32569
If the dict's contained types cannot be inferred from its contents (for example, `Dict[str, Tensor]` vs. `Dict[str, Optional[Tensor]]`), we must explicitly annotate the type. Also this removes some special handling that omits annotations on empty containers that have the default type. It makes the code more complex for not too much value, and was wrong for dicts anyway. Differential Revision: [D19551016](https://our.internmc.facebook.com/intern/diff/D19551016) [ghstack-poisoned]
If the dict's contained types cannot be inferred from its contents (for example, `Dict[str, Tensor]` vs. `Dict[str, Optional[Tensor]]`), we must explicitly annotate the type. Also this removes some special handling that omits annotations on empty containers that have the default type. It makes the code more complex for not too much value, and was wrong for dicts anyway. Differential Revision: [D19551016](https://our.internmc.facebook.com/intern/diff/D19551016) [ghstack-poisoned]
suo
added a commit
that referenced
this pull request
Jan 24, 2020
If the dict's contained types cannot be inferred from its contents (for example, `Dict[str, Tensor]` vs. `Dict[str, Optional[Tensor]]`), we must explicitly annotate the type. Also this removes some special handling that omits annotations on empty containers that have the default type. It makes the code more complex for not too much value, and was wrong for dicts anyway. ghstack-source-id: fa0f869ebd5d51b9ab401d45a165bf540767d9bb Pull Request resolved: #32569
wuhuikx
pushed a commit
to wuhuikx/pytorch
that referenced
this pull request
Jan 30, 2020
Summary: Pull Request resolved: pytorch#32569 If the dict's contained types cannot be inferred from its contents (for example, `Dict[str, Tensor]` vs. `Dict[str, Optional[Tensor]]`), we must explicitly annotate the type. Also this removes some special handling that omits annotations on empty containers that have the default type. It makes the code more complex for not too much value, and was wrong for dicts anyway. Test Plan: Imported from OSS Differential Revision: D19551016 Pulled By: suo fbshipit-source-id: c529b112e72c10f509a6bc0f5876644caa1be967
cndn
added a commit
to cndn/fairseq
that referenced
this pull request
Jan 30, 2020
Summary: Pull Request resolved: facebookresearch#1653 Earlier we had some issues at pickling. Type information gets lost. Fixed in pytorch/pytorch#32569. These save_and_load tests are added for protection in the future. Reviewed By: myleott Differential Revision: D19435988 fbshipit-source-id: 76f31c78fd732c0e6e3a87bf1e16f5a9a0553d80
facebook-github-bot
pushed a commit
to facebookresearch/fairseq
that referenced
this pull request
Jan 31, 2020
Summary: Pull Request resolved: #1653 Earlier we had some issues at pickling. Type information gets lost. Fixed in pytorch/pytorch#32569. These save_and_load tests are added for protection in the future. Reviewed By: myleott Differential Revision: D19435988 fbshipit-source-id: 560ea65ed3493bebcf394327818364b3fcd6fc92
ttumiel
pushed a commit
to ttumiel/pytorch
that referenced
this pull request
Mar 4, 2020
Summary: Pull Request resolved: pytorch#32569 If the dict's contained types cannot be inferred from its contents (for example, `Dict[str, Tensor]` vs. `Dict[str, Optional[Tensor]]`), we must explicitly annotate the type. Also this removes some special handling that omits annotations on empty containers that have the default type. It makes the code more complex for not too much value, and was wrong for dicts anyway. Test Plan: Imported from OSS Differential Revision: D19551016 Pulled By: suo fbshipit-source-id: c529b112e72c10f509a6bc0f5876644caa1be967
moussaKam
pushed a commit
to moussaKam/language-adaptive-pretraining
that referenced
this pull request
Sep 29, 2020
Summary: Pull Request resolved: facebookresearch#1653 Earlier we had some issues at pickling. Type information gets lost. Fixed in pytorch/pytorch#32569. These save_and_load tests are added for protection in the future. Reviewed By: myleott Differential Revision: D19435988 fbshipit-source-id: 560ea65ed3493bebcf394327818364b3fcd6fc92
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Stack from ghstack:
If the dict's contained types cannot be inferred from its contents (for
example,
Dict[str, Tensor]
vs.Dict[str, Optional[Tensor]]
), we mustexplicitly annotate the type.
Also this removes some special handling that omits annotations on empty
containers that have the default type. It makes the code more complex
for not too much value, and was wrong for dicts anyway.
Differential Revision: D19551016