Skip to content
This repository was archived by the owner on Aug 28, 2024. It is now read-only.

Commit 85d17ae

Browse files
committed
updated README and Podfile to PT 1.9 for PyTorchDemo and MachineTranslation
1 parent 5f74f6b commit 85d17ae

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

PyTorchDemo/Podfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
platform :ios, '14.3'
22
target 'PyTorchDemo' do
3-
pod 'LibTorch', '~>1.7.0'
3+
pod 'LibTorch', '~>1.9.0'
44
end

Seq2SeqNMT/Podfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
platform :ios, '12.0'
22
target 'Seq2SeqNMT' do
3-
pod 'LibTorch', '~>1.7.0'
3+
pod 'LibTorch', '~>1.9.0'
44
end

Seq2SeqNMT/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ This iOS demo app shows:
1212

1313
## Prerequisites
1414

15-
* PyTorch 1.7 or later (Optional)
15+
* PyTorch 1.9.0 or later (Optional)
1616
* Python 3.8 (Optional)
17-
* iOS Pytorch pod library 1.7
17+
* iOS Cocoapods library LibTorch 1.9.0
1818
* Xcode 12 or later
1919

2020
## Quick Start
@@ -25,11 +25,11 @@ To Test Run the Object Detection iOS App, follow the steps below:
2525

2626
If you don't have the PyTorch environment set up to run the script, you can download the PyTorch trained and optimized NMT encoder and decoder models compressed in a zip [here](https://drive.google.com/file/d/1Ju9ceHi5e87UW1P09-XIvPVdMjOs5kiE/view?usp=sharing), unzip it, copy to the iOS app project folder, and continue to Step 2.
2727

28-
Be aware that the downloadable model files were created with PyTorch 1.7.0, matching the iOS LibTorch library 1.7.0 specified in the `Podfile`. If you use a different version of PyTorch to create your model by following the instructions below, make sure you specify the same iOS LibTorch version in the `Podfile` to avoid possible errors caused by the version mismatch. Furthermore, if you want to use the latest prototype features in the PyTorch master branch to create the model, follow the steps at [Building PyTorch iOS Libraries from Source](https://pytorch.org/mobile/ios/#build-pytorch-ios-libraries-from-source) on how to use the model in iOS.
28+
Be aware that the downloadable model files were created with PyTorch 1.9.0, matching the iOS LibTorch library 1.9.0 specified in the `Podfile`. If you use a different version of PyTorch to create your model by following the instructions below, make sure you specify the same iOS LibTorch version in the `Podfile` to avoid possible errors caused by the version mismatch. Furthermore, if you want to use the latest prototype features in the PyTorch master branch to create the model, follow the steps at [Building PyTorch iOS Libraries from Source](https://pytorch.org/mobile/ios/#build-pytorch-ios-libraries-from-source) on how to use the model in iOS.
2929

3030
If you have a good GPU and want to train your model from scratch, uncomment the line `trainIters(encoder, decoder, 450100, print_every=5000)` in `seq2seq_nmt.py` before running `python seq2seq2_nmt.py` to go through the whole process of training, saving, loading, optimizing and saving the final mobile-ready models.
3131

32-
To just convert a pre-trained model `seq2seq_mt_150000.pt` to the TorchScript model used on mobile, download [seq2seq_mt_150000.pt](https://drive.google.com/file/d/1f91PvlkxS8JS0xGpMRZ3fmr0Ev80Guxk/view?usp=sharing) first to the same directory as `seq2seq2_nmt.py`, then run `python seq2seq2_nmt.py`. After `optimized_encoder_150k.pth` and `optimized_decoder_150k.pth` are generated, copy them to the iOS app. Note that dynamic quantization is applied to the decoder in `seq2seq2_nmt.py` for its `nn.Linear` parameters to reduce the decoder model size from 29MB to 18MB.
32+
To just convert a pre-trained model `seq2seq_mt_150000.pt` to the TorchScript model used on mobile, download [seq2seq_mt_150000.pt](https://drive.google.com/file/d/1f91PvlkxS8JS0xGpMRZ3fmr0Ev80Guxk/view?usp=sharing) first to the same directory as `seq2seq2_nmt.py`, then run `python seq2seq_nmt.py`. After `optimized_encoder_150k.pth` and `optimized_decoder_150k.pth` are generated, copy them to the iOS app. Note that dynamic quantization is applied to the decoder in `seq2seq2_nmt.py` for its `nn.Linear` parameters to reduce the decoder model size from 29MB to 18MB.
3333

3434
### 2. Use LibTorch
3535

0 commit comments

Comments
 (0)