-
Notifications
You must be signed in to change notification settings - Fork 307
update iOS.md #268
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
update iOS.md #268
Conversation
update iOS.md
|
||
## Quickstart with a HelloWorld example | ||
## Quickstart with a Hello World example |
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 "Example"
_mobile/ios.md
Outdated
|
||
```shell | ||
python trace_model.py | ||
``` | ||
|
||
If everything works well, we should have our model - `model.pt` generated in the same folder. Now copy the model file to our application folder `HelloWorld/model`. | ||
|
||
More details about TorchScript you can find in [tutorials on pytorch.org](https://pytorch.org/docs/stable/jit.html) |
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.
The sentence refers to tutorials but the link is to the documentation. Suggestion to change wording to say "More details about TorchScript you can find in [the TorchScript documentation on pytorch.org]."
### Install PyTorch C++ libraries via Cocoapods | ||
|
||
The PyTorch C++ library is available in [Cocoapods](https://cocoapods.org/), to integrate it to our project, we can run | ||
|
||
```ruby | ||
pod install | ||
``` | ||
Now it's time to open the `HelloWorld.xcworkspace` in XCode, select an iOS simulator and hit the build and run button (cmd + R). If everything works well, we should see a wolf picture on the simulator screen along with the prediction result. | ||
Now it's time to open the `HelloWorld.xcworkspace` in XCode, select an iOS simulator and launch it (cmd + R). If everything works well, we should see a wolf picture on the simulator screen along with the prediction result. |
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.
Suggestion to add link to wolf picture.
|
||
#### Init JIT interpreter | ||
The code might look weird at first glance, but it’ll make sense once we understand our model. The input data of our model is a 3-channel RGB image of shape (3 x H x W), where H and W are expected to be at least 224. The image have to be loaded in to a range of [0, 1] and then normalized using mean = [0.485, 0.456, 0.406] and std = [0.229, 0.224, 0.225]. |
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.
Change have to has.
"The image have..." --> "The image ..."
#### Init JIT interpreter | ||
The code might look weird at first glance, but it’ll make sense once we understand our model. The input data of our model is a 3-channel RGB image of shape (3 x H x W), where H and W are expected to be at least 224. The image have to be loaded in to a range of [0, 1] and then normalized using mean = [0.485, 0.456, 0.406] and std = [0.229, 0.224, 0.225]. | ||
|
||
#### TorchScript module |
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 "Module"
Finally, we can call this `forward` function to get the output tensor as the results. | ||
|
||
```cpp | ||
auto outputTensor = _impl.forward({tensor}).toTensor(); | ||
``` | ||
|
||
### Collect results |
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 "Results"
@@ -120,9 +141,7 @@ let sortedResults = zippedResults.sorted { $0.1.floatValue > $1.1.floatValue }.p | |||
|
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 Demo App"
_mobile/ios.md
Outdated
For more complex use cases, we recommend to check out the PyTorch demo application. | ||
|
||
The demo app contains two showcases. A camera app that runs a quantized model to predict the images coming from device’s rear-facing camera in real time. And a text-based app that uses a self-trained NLP model to predict the topic from the input string. | ||
For more complex use cases, we recommend to check out the PyTorch demo application. The demo app contains two showcases. A camera app that runs a quantized model to predict the images coming from device’s rear-facing camera in real time. And a text-based app that uses a self-trained NLP model to predict the topic from the input string. |
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.
Add link to PyTorch demo application
I can't leave comments for the lines below so consolidating them here:
- Capitalization "Build PyTorch iOS Libraries from Source"
- Capitalization "Setup Local Python Development Environment"
- Capitalization "Build LibTorch.a for iOS Simulator"
- Lines 161 and 170: Add an "s" ---> "After the build succeed(s)..."
- Capitalization "Build LibTorch.a for arm64 Devices"
- Capitalization "XCode Setup"
|
||
Before we jump into details, we highly recommend following the Pytorch Github page to set up the Python development environment on your local machine. | ||
Before we jump into details, we highly recommend following the [Pytorch Github page](https://github.com/pytorch/pytorch) to set up the Python development environment on your local machine. | ||
|
||
### Model preparation |
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 "'Model Preparation"
|
||
### Code Walkthrough | ||
|
||
In this part, we are going to walk through the code step by step. The `ViewController.swift` contains most of the code. | ||
In this part, we are going to walk through the code step by step. All logic happens in `ViewController.swift`. | ||
|
||
#### Image loading |
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 "Image Loading"
Add some detail to the C++ code