Prepare a remote server
On top of local hardware, TorchStudio can use any remote server that meets the following conditions:
- SSH Support
- Python 3.7 or higher installed
- PyTorch 1.9 or higher installed
Cloud services such as Amazon AWS, Microsoft Azure and Google Cloud offer such images.
To connect to a remote server TorchStudio needs the following infos:
- Address (public IP or domain)
- Port (usually 22 for SSH)
- Password and/or a key file
- Command/Path to the Python interpreter
EC2 > Instances > Launch instances > Amazon Machine Image
Image name: Deep Learning AMI (Ubuntu 18.04) Version 55.0
Address: public IP displayed after the virtual machine is created Username: ubuntu Key File: .pem file generated by AWS Command: /home/ubuntu/anaconda3/envs/pytorch_p38/bin/python
Image name: Deep Learning AMI GPU PyTorch 1.10.0 (Amazon Linux 2) 20211115
Address: public IP displayed after the virtual machine is created Username: ec2-user Key File: .pem file generated by AWS Command: /opt/conda/envs/pytorch/bin/python
Virtual Machines > Create > Virtual Machine > Image
Image name: Data Science Virtual Machine - Ubuntu 18.04
Address: public IP displayed after the virtual machine is created Username: azureuser (default username) Key File: .pem file generated by Azure Command: /anaconda/envs/py38_pytorch/bin/python
Compute Engine > VM Instances > Create Instance > Boot disk
Image name: Deep Learning on Linux > Debian 10 based Deep Learning VM for PyTorch CPU/GPU with CUDA 11.0 M88
Address: public IP displayed after the virtual machine is created Username: (depends on your Google account) Key File: file generated locally by the user and added to the server configuration Command: /opt/conda/bin/python
Add a remote server
Click > Settings…
Then click Add… and fill the informations corresponding to your server:
Then click OK. TorchStudio will connect to the server and check it meets the requirements. If everything goes well you’ll see something like this:
You can add as many different servers as you want, and their hardware and devices will be immediately available to TorchStudio. Click OK when you’re done adding servers.
Load a dataset on a remote server
If your dataset is stored remotely, or if the dataset can download its data (such as in the example below), you can specify to TorchStudio to load the dataset remotely. All you have to do is change the server next to the Load button before clicking it.
For example in the Dataset tab you can choose the torchvision.datasets category and the MNIST dataset, select your newly added server, and click Load.
All the samples will then be managed remotely.
Train a model on a remote server
Training a model remotely is as simple: simple choose the remote device you want to use next to the Train button before clicking it.
For example in a Model tab you can choose the torchvision.models category and the MNISTClassifier model, click Build, then select one of your newly added remote devices, and click Train.
NB: If both a remote dataset and remote training device are set, the remote dataset server will directly send the data to the remote training server without going through your computer. Just make sure the training server can accept connections from the dataset server ip.
Infer a model on a remote server
Finally, you can also use a remote server to infer a model, meaning getting output predictions for the displayed samples.
To use a remote server for inference, click > Settings… and change the Inference Device, then click OK to save the settings.
NB: It’s usually preferable to use local hardware for inference (specially if you have a local GPU), as this will cause less latency when previewing predictions.