dockerで機械学習(42) Programming PyTorch for Deep Learning By Ian Pointer

Programming PyTorch for Deep Learning By Ian Pointer
![lrg-4.jpg](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/51423/7b77acef-7ab4-06be-988f-9d430a3e9e66.jpeg)

https://www.oreilly.com/library/view/programming-pytorch-for/9781492045342/

非公式？
https://github.com/falloutdurham/pytorchupandrunning

```shell-session:OS
$ docker run -p 8888:8888 -it kaizenjapan/pytorch /bin/bash
```

```shell-session:docker/anaconda
 # jupyter notebook --ip=0.0.0.0 --allow-root
```

ブラウザで
localhost:8888
で開き、
idを入れる。

![torch1.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/51423/cfd019d9-3c32-05dd-be29-4e5cfc934965.png)
![torch2.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/51423/d23ebeb5-0587-fb2b-d486-3a9938207cf4.png)
![torch3.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/51423/0a2897bf-8845-947f-f056-fb7496dba281.png)
![torch4.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/51423/147009db-05b1-d655-3a85-fa28c20b8234.png)
![torch5.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/51423/e20e514a-c0a9-6322-0e61-f583ba647364.png)


# 構築までの手順

```shell-session:OS
$ docker run -p 8888:8888 -it continuumio/anaconda3 /bin/bash
```

```shell-session:ubuntu/anaconda
# apt update; apt -y upgrade
# apt install vim git sudo apt-utils
# pip install --upgrade pip
# git clone https://github.com/falloutdurham/pytorchupandrunning.git
# conda install pytorch torchvision -c pytorch
Collecting package metadata (current_repodata.json): done
Solving environment: done

## Package Plan ##

  environment location: /opt/conda

  added / updated specs:
    - pytorch
    - torchvision


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    conda-4.7.12               |           py37_0         3.0 MB
    cudatoolkit-10.1.243       |       h6bb024c_0       347.4 MB
    ninja-1.9.0                |   py37hfd86e86_0         1.2 MB
    pytorch-1.3.0              |py3.7_cuda10.1.243_cudnn7.6.3_0       463.7 MB  pytorch
    torchvision-0.4.1          |       py37_cu101        10.9 MB  pytorch
    ------------------------------------------------------------
                                           Total:       826.3 MB

The following NEW packages will be INSTALLED:

  cudatoolkit        pkgs/main/linux-64::cudatoolkit-10.1.243-h6bb024c_0
  ninja              pkgs/main/linux-64::ninja-1.9.0-py37hfd86e86_0
  pytorch            pytorch/linux-64::pytorch-1.3.0-py3.7_cuda10.1.243_cudnn7.6.3_0
  torchvision        pytorch/linux-64::torchvision-0.4.1-py37_cu101

The following packages will be UPDATED:

  conda                                       4.7.10-py37_0 --> 4.7.12-py37_0


Proceed ([y]/n)? y


Downloading and Extracting Packages
torchvision-0.4.1    | 10.9 MB   | ############################################################### | 100% 
pytorch-1.3.0        | 463.7 MB  | ############################################################### | 100% 
conda-4.7.12         | 3.0 MB    | ########################################################################### | 100% 
ninja-1.9.0          | 1.2 MB    | ########################################################################### | 100% 
cudatoolkit-10.1.243 | 347.4 MB  | ########################################################################### | 100% 
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
```

hubに保存




# 参考文献(reference)

GET STARTED pytorch
https://pytorch.org/get-started/locally/

仮想環境でPytorchを使いたい
https://qiita.com/nozomi254/items/b536883b1b46ae20aeae


# 文書履歴(document history)
ver. 0.01 初稿 20191105
ver. 0.02 画像等追記 20191106