Use R and Torch on a GPU

Saturn Cloud now has an image for using R and torch for neural network model training.

PyTorch, one of the most popular deep learning frameworks in Python, is also available in R! The R package torch, maintained by Daniel Falbel at RStudio, lets you from use Torch from R in a way that has similar functionality to PyTorch in Python while still maintaining the feel of R. On the backend it’s using C++ Torch libraries that get installed when you first use the package. This is distinct from the R version of TensorFlow which requires an entire installation of Python which adds a substantial amount of overhead and maintenance. Best of all, the R torch package can easily support GPUs.

At Saturn Cloud we’ve released a template resource that is pre-configured to work with R Torch on a GPU. This uses a modified version of the rocker/ml image which supports GPUs and works with the Saturn Cloud platform. The template includes a RMarkdown file to train an example neural network that generates novel pet names.

You can try it for yourself using the button below. It will create the example for you on our free Saturn Cloud Hosted platform so you can get started in just a few clicks!

The Torch logo is copyright of Daniel Falbel.

Try the code from this blog post in seconds on Saturn Cloud