-
Notifications
You must be signed in to change notification settings - Fork 310
[android] Custom build tutorial section #320
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
[android] Custom build tutorial section #320
Conversation
_mobile/android.md
Outdated
``` | ||
|
||
After successful build you can integrate the result aar files to your android gradle project, following the steps from previous section of this tutorial (Building PyTorch Android from Source). | ||
|
||
## More Details |
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.
Rather than "More Details", should we change this header to something more descriptive? Suggestion - "API Docs" to match the header in iOS
_mobile/android.md
Outdated
|
||
## Custom Build | ||
|
||
To reduce the size of binaries you can do custom build of pytorch android with only set of operators required by your model. |
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.
Capitalize "PyTorch Android" to stay consistent with rest of the document
_mobile/android.md
Outdated
To reduce the size of binaries you can do custom build of pytorch android with only set of operators required by your model. | ||
This includes two steps: preparing the list of operators from your model, rebuilding pytorch android with specified list. | ||
|
||
1\. Preparation of the list of operators. |
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.
Remove period at the end to stay consistent with the numbering in the rest of document
_mobile/android.md
Outdated
f = open('test.yaml', 'w') | ||
yaml.dump(ops, f) | ||
``` | ||
2\. Building pytorch android with prepared operators list. |
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.
Capitalize "PyTorch Android" and remove period for consistency
_mobile/android.md
Outdated
``` | ||
2\. Building pytorch android with prepared operators list. | ||
|
||
To build pytorch android with prepared yaml list of operators you specify it in environment variable `SELECTED_OP_LIST` and specify as arguments of android ABIs for which you want to build it, by default it builds all 4 android ABIs. |
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.
Capitalize "PyTorch Android" for consistency
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.
Capitalize "Android ABIs"
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.
Suggested rewording to be more succinct -
To build PyTorch Android with the prepared yaml list of operators, specify it in the environment variable SELECTED_OP_LIST
. Also in the arguments, specify which Android ABIs it should build; by default it builds all 4 Android ABIs.
Also consider adding link to docs for this environment variable and its arguments
360f03b
to
5a79af4
Compare
Changes for just android.md added into this PR to avoid pulling in the other file changes |
import torch, yaml | ||
m = torch.jit.load("example.pt") | ||
ops = torch.jit.export_opnames(m) | ||
f = open('test.yaml', 'w') |
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: shall we use 'with' statement?
with open('MobileNetV2.yaml', 'w') as file:
yaml.dump(ops, file)
And I saw Android/iOS examples are slightly different in terms of file naming, shall we change both to 'MobileNetV2'?
Also contains small sync for previous section about adding transitive dependencies when aar files are used directly.