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

Conversation

@jeffxtang
Copy link
Contributor

No description provided.

If you don't have the PyTorch environment set up to run the script below to generate the model file, you can download it to the `ios-demo-app/ImageSegmentation` folder using the link [here](https://drive.google.com/file/d/1FHV9tN6-e3EWUgM_K3YvDoRLPBj7NHXO/view?usp=sharing).
If you don't have the PyTorch environment set up to run the script below to generate the model file, you can download it to the `ios-demo-app/ImageSegmentation` folder using the link [here](https://drive.google.com/file/d/1_guNVutt8eTvO_YhGxkAe1uReBhNaC4f/view?usp=sharing).

Be aware that the downloadable model file was 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.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to update all the recipes as well or add new set for lite interpreter specific recipes?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think so, as all PT Mobile recipes have this:

Pre-requisites
PyTorch 1.6.0 or 1.7.0
torchvision 0.6.0 or 0.7.0

So do the tutorials https://pytorch.org/tutorials/beginner/deeplabv3_on_ios.html and https://pytorch.org/tutorials/beginner/deeplabv3_on_android.html

torch::autograd::AutoGradMode guard(false);
at::AutoNonVariableTypeMode non_var_type_mode(true);

c10::InferenceMode guard;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is the guard getting used?

@xta0
Copy link
Contributor

xta0 commented Sep 6, 2021

Thanks @jeffxtang ! This looks great. Have you updated all objective-c wrappers to use c10::InferenceMode guard;?

@jeffxtang
Copy link
Contributor Author

Thanks @jeffxtang ! This looks great. Have you updated all objective-c wrappers to use c10::InferenceMode guard;?

Just double checked and found I updated 7 of 8, except D2Go - let me do it now.

@msaroufim
Copy link
Member

As far as I know downloads.pytorch.org doesn't host model weights but @seemethere can correct me if I'm wrong

The way I've seen models hosted if they come from Facebook is via Torch Hub. You can follow instructions from their README here https://github.com/pytorch/hub

After doing this users can use your model weights with something like

model = torch.hub.load('pytorch/vision:v0.10.0', 'resnet18', pretrained=True)

Another alternative is you host all your trained models on an S3 bucket and you can give it a nice name like pytorch-lite-models and people would just wget the S3 url. This is what we do with Torchserve.

If you'd like to feature the model on the pytorch.org website you can look at uploading it here https://github.com/pytorch/pytorch.github.io

@xta0 xta0 merged commit cedae91 into pytorch:master Sep 10, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants