README.md 1.6 KB
Newer Older
Joslin Guillaume's avatar
Joslin Guillaume committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
# Cifar10/Pytorch on **ruche**

## Cifar source code

Pytorch code for cifar10 from the Pytorch sample : [https://pytorch.org/tutorials/beginner/blitz/cifar10_tutorial.html]

## Setting Conda environment

Launch an interactive session on a GPU server.

```shell
srun --nodes=1 --time=01:00:00 -p gpu --pty /bin/bash
```

OR

```shell
./interactive_gpu.sh
```

In this session :

```shell
module load anaconda3/2020.02/gcc-9.2.0
module load cuda/10.2.89/intel-19.0.3.199
conda create --name cifar10
source activate cifar10
conda install pytorch torchvision matplotlib -c pytorch
conda env export > config/environment.yml # save conda environment description
```

OR

```shell
./config/config_env.sh
```


## Cifar Data

Cifar data is automatically downloaded in current directory (342MB).


## Script detail

Scripts :
* `show_images.py` : display 4 images. Use this script for data exploration
* `train_network.py` : train the network and save state into `output/network.save`
* `train_network_gpu.py` : train the network with GPU acceleration
* `test_network.py` : test the `output/network.save` network predictions on 4 images from the validation dataset. Display the images, the tags and the predicted values.


## Launch configuration and run the sample network

### Configure environment

```shell
# configure environment
sbatch pbs_configure.sh
```

### Train the network

Train the network on CPU.

```shell
# once configuration is over, run code
sbatch pbs_train.sh
```

Train the network on GPU.

```shell
# once configuration is over, run code
sbatch pbs_train_gpu.sh
```

Output network is saved on the `output/network.save`