-
Notifications
You must be signed in to change notification settings - Fork 25.6k
[pytorch][PR] Add ability for a mobile::Module to save as flatbuffer #70201
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
Conversation
CI Flow Status⚛️ CI FlowRuleset - Version:
You can add a comment to the PR and tag @pytorchbot with the following commands: # ciflow rerun, "ciflow/default" will always be added automatically
@pytorchbot ciflow rerun
# ciflow rerun with additional labels "-l <ciflow/label_name>", which is equivalent to adding these labels manually and trigger the rerun
@pytorchbot ciflow rerun -l ciflow/scheduled -l ciflow/slow For more information, please take a look at the CI Flow Wiki. |
🔗 Helpful links
💊 CI failures summary and remediationsAs of commit d4af813 (more details on the Dr. CI page): 💚 💚 Looks good so far! There are no failures yet. 💚 💚 This comment was automatically generated by Dr. CI (expand for details).Please report bugs/suggestions to the (internal) Dr. CI Users group. |
This pull request was exported from Phabricator. Differential Revision: D33239362 |
1 similar comment
This pull request was exported from Phabricator. Differential Revision: D33239362 |
a628492
to
f4ffa78
Compare
f4ffa78
to
68e517b
Compare
This pull request was exported from Phabricator. Differential Revision: D33239362 |
@pytorchbot ciflow rerun -l ciflow/all |
This pull request was exported from Phabricator. Differential Revision: D33239362 |
68e517b
to
e68eb94
Compare
This pull request was exported from Phabricator. Differential Revision: D33239362 |
e68eb94
to
c39430f
Compare
This pull request was exported from Phabricator. Differential Revision: D33239362 |
c39430f
to
089ada5
Compare
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.
Nit:
Create a constant for index of None, something like kNoneIndex
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.
done
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.
What are causes of exceptions? Unable to hash an IValue?
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.
Added more comments. IValue::hash explicitly throws runtime_error for some IValues. And for Tensor operator== doesn't return bool so you get c10::Error.
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.
Incomplete comment?
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.
removed.
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.
What is this version supposed to be?
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.
1 + whatever the latest (and last) pickle version should be. It is not explicitly used now.
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.
LOL, I think we are done with "pickling"
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.
rephased
This pull request was exported from Phabricator. Differential Revision: D33239362 |
This pull request was exported from Phabricator. Differential Revision: D33239362 |
6e0d98c
to
61305a0
Compare
Sync'd offline with @malfet and agreed to check-in the generated header file instead of messing with build scripts to generate it on the fly. PTAL. |
LGTM |
.jenkins/pytorch/win-build.sh
Outdated
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.
As headers are checked in, this should not longer be necessary, should it?
torch/CMakeLists.txt
Outdated
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.
LGTM, but in followup PR can we limit it to just 2 files in question? (So that we don't leak flatbuffers dependency to module extensions)
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.
Do you mean we can use different include paths when compiling flatbuffer_loader.cpp
and flatbuffer_serializer.cpp
but not when compiling other .cpp files? How do I do that? Also it's not just those 2 files also ones that happens to include flatbuffer_loader.h
or flatbuffer_serializer.h
.
torch/CMakeLists.txt
Outdated
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.
Hmm, I though flatbuffers is header only ones its generated, isn't it?
Looks good to me, but please remove changes to windows-builds (they should no longer be necessary) |
This pull request was exported from Phabricator. Differential Revision: D33239362 |
61305a0
to
6367571
Compare
This pull request was exported from Phabricator. Differential Revision: D33239362 |
6367571
to
b23c8ce
Compare
This pull request was exported from Phabricator. Differential Revision: D33239362 |
b23c8ce
to
f911133
Compare
This pull request was exported from Phabricator. Differential Revision: D33239362 |
f911133
to
3536506
Compare
…ytorch#70201) Summary: Pull Request resolved: pytorch#70201 Included functions: save_mobile_module -> saves a mobile::Module to flatbuffer load_mobile_module_from_file -> loads a flatbuffer into mobile::Module parse_mobile_module -> parses from bytes or deserialized flatbuffer module object Compared to previous attempts, this diff only adds flatbuffer to cmake target and leaves fbcode/xplat ones unchanged. Test Plan: unittest Reviewed By: malfet, gmagogsfm Differential Revision: D33239362 fbshipit-source-id: c89d5f8b96fee6906a2df9f034c081865b34548f
This pull request was exported from Phabricator. Differential Revision: D33239362 |
3536506
to
d4af813
Compare
Update: removed change to win-build.sh and it seems to work. Binary size increase is ~15kb. We didn't propose as optional feature because this will replace Module._save_for_lite_interpreter(). |
1 similar comment
Update: removed change to win-build.sh and it seems to work. Binary size increase is ~15kb. We didn't propose as optional feature because this will replace Module._save_for_lite_interpreter(). |
Summary:
Included functions:
save_mobile_module -> saves a mobile::Module to flatbuffer
load_mobile_module_from_file -> loads a flatbuffer into mobile::Module
parse_mobile_module -> parses from bytes or deserialized flatbuffer module object
Compared to previous attempts, this diff only adds flatbuffer to cmake target and leaves fbcode/xplat ones unchanged.
Test Plan: unittest
Differential Revision: D33239362