README.md in torch-rb-0.2.4 vs README.md in torch-rb-0.2.5
- old
+ new
@@ -1,9 +1,11 @@
# Torch.rb
:fire: Deep learning for Ruby, powered by [LibTorch](https://pytorch.org)
+For computer vision tasks, also check out [TorchVision](https://github.com/ankane/torchvision)
+
[![Build Status](https://travis-ci.org/ankane/torch.rb.svg?branch=master)](https://travis-ci.org/ankane/torch.rb)
## Installation
First, [install LibTorch](#libtorch-installation). For Homebrew, use:
@@ -20,10 +22,22 @@
It can take a few minutes to compile the extension.
## Getting Started
+Deep learning is significantly faster with a GPU. If you don’t have an NVIDIA GPU, we recommend using a cloud service. [Paperspace](https://www.paperspace.com/) has a great free plan.
+
+We’ve put together a [Docker image](https://github.com/ankane/ml-stack) to make it easy to get started. On Paperspace, create a notebook with a custom container. Set the container name to:
+
+```text
+ankane/ml-stack:torch-gpu
+```
+
+And leave the other fields in that section blank. Once the notebook is running, you can run the [MNIST example](https://github.com/ankane/ml-stack/blob/master/torch-gpu/MNIST.ipynb).
+
+## API
+
This library follows the [PyTorch API](https://pytorch.org/docs/stable/torch.html). There are a few changes to make it more Ruby-like:
- Methods that perform in-place modifications end with `!` instead of `_` (`add!` instead of `add_`)
- Methods that return booleans use `?` instead of `is_` (`tensor?` instead of `is_tensor`)
- Numo is used instead of NumPy (`x.numo` instead of `x.numpy()`)
@@ -190,11 +204,11 @@
### Neural Networks
Define a neural network
```ruby
-class Net < Torch::NN::Module
+class MyNet < Torch::NN::Module
def initialize
super
@conv1 = Torch::NN::Conv2d.new(1, 6, 3)
@conv2 = Torch::NN::Conv2d.new(6, 16, 3)
@fc1 = Torch::NN::Linear.new(16 * 6 * 6, 120)
@@ -224,11 +238,11 @@
```
Create an instance of it
```ruby
-net = Net.new
+net = MyNet.new
input = Torch.randn(1, 1, 32, 32)
net.call(input)
```
Get trainable parameters
@@ -292,11 +306,11 @@
```
Load a model
```ruby
-net = Net.new
+net = MyNet.new
net.load_state_dict(Torch.load("net.pth"))
net.eval
```
### Tensor Creation
@@ -411,12 +425,10 @@
## Performance
### Linux
-Deep learning is significantly faster on GPUs.
-
-Install [CUDA](https://developer.nvidia.com/cuda-downloads) and [cuDNN](https://developer.nvidia.com/cudnn) and reinstall the gem.
+Deep learning is significantly faster on a GPU. Install [CUDA](https://developer.nvidia.com/cuda-downloads) and [cuDNN](https://developer.nvidia.com/cudnn) and reinstall the gem.
Check if CUDA is available
```ruby
Torch::CUDA.available?