1005 B
1005 B
Pytorch
Run a docker container
This container runs in background
docker run -d -it --gpus all -name pytorch-container pytorch/pytorch:latest
Jupyter container with pytorch for GPU
docker run -e JUPYTER_ENABLE_LAB=yes -v /home/john/Work/pytorch/:/workspace/dev --gpus all --ipc=host --ulimit memlock=-1 --ulimit stack=67108864 --rm -p 8888:8888 jw/pytorch:0.1
Test GPU
import torch
print(torch.cuda.is_available())
Connect to running container
docker exec -it <container-name> bash
docker exec -it <container-name> bash -c "cat aap"
Stop and start an execistion container
docker stop <container-name>
docker start <container-name>
Example code
# Load libraries
import torch
import torch.nn as nn
from res.plot_lib import set_default, show_scatterplot, plot_bases
from matplotlib.pyplot import plot, title, axis
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")