LoginSignup
3
0

More than 5 years have passed since last update.

DeepLearning環境構築=CUDA9.0+python3.6.4(Anaconda)+GTX750Ti

Last updated at Posted at 2018-03-25

要約

  • DeepLearning環境を作るためChainer Advent Calendar 2015 10日目の内容をいまのバージョンで追いかけたときに簡単で済んだ部分と罠だった部分があった
  • CPUで10分の処理がGPUで1分で終わって感動した
    • GPUを2016年に買ってから環境構築が上手くいかなくて放置してたのが活きてホッとした
    • 当時GTX750Tiが1万2千円でしたが、いまならGTX1030が1万円切ってますね

資材

ハード

ソフト

インストールの順番

  1. Visual Studioインストール
    • 2013とか2015とか共存とか気にしたけど最終的に要らなかったぽい
  2. CUDAインストール、cuDNNインストール
    • GTX-750Tiタグの記事はChainer1.8の頃でCUDA7.5が多く、7.5の方が相性よいのだろうと期待したけどVisual Studioの準備が面倒なだけで止めとけばよかった
    • すなおにVisual StudioもCUDAもChainerも新しいのを使ってよい
  3. Anaconda3インストール
    • minicondaの方がいまの流行ぽいけど環境構築を今度こそやり切りたかったのでAnacondaで簡単に済ませられました
  4. conda update conda
  5. python -m pip install --upgrade pip
  6. pip install cupy
  7. pip install chainer
h5py_2.7.1がワーニングだす
>>> import chainer
D:\home\bin\Anaconda3\lib\site-packages\h5py\__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
  from ._conv import register_converters as _register_converters

動作確認

CPU

mnist_CPUでトレーニング
>python train_mnist.py
GPU: -1
# unit: 1000
# Minibatch-size: 100
# epoch: 20

epoch       main/loss   validation/main/loss  main/accuracy  validation/main/accuracy  elapsed_time
1           0.189173    0.0963605             0.942567       0.9685                    27.3366
2           0.071832    0.0726725             0.977733       0.9777                    56.5767
3           0.0470005   0.0634714             0.984867       0.9809                    87.2547
4           0.0366731   0.0790446             0.987967       0.9774                    117.328
5           0.0296025   0.0831928             0.99035        0.9781                    147.328
6           0.0230024   0.0712753             0.99245        0.982                     177.886
7           0.0209149   0.0884882             0.993033       0.9773                    208.995
8           0.0190647   0.0840848             0.99415        0.9798                    238.948
9           0.0148285   0.0773293             0.99495        0.9814                    269.679
10          0.0155097   0.0924865             0.995183       0.9809                    300.837
11          0.0156042   0.0855404             0.9945         0.9812                    331.837
12          0.0122421   0.0908882             0.996167       0.9818                    363.44
13          0.0110155   0.114288              0.996683       0.9788                    395.034
14          0.0112867   0.0832217             0.99645        0.9838                    426.827
15          0.0052481   0.106357              0.99845        0.9813                    459.479
16          0.0141688   0.102184              0.995983       0.9792                    492.254
17          0.0122581   0.0892446             0.996433       0.981                     525.907
18          0.00950019  0.0987923             0.99735        0.9828                    560.172
19          0.00654957  0.0942901             0.99815        0.985                     594.848
20          0.00566024  0.125176              0.9982         0.9808                    630.605

GPU

mnist_GPUでトレーニング
>python train_mnist.py --gpu 0
GPU: 0
# unit: 1000
# Minibatch-size: 100
# epoch: 20

epoch       main/loss   validation/main/loss  main/accuracy  validation/main/accuracy  elapsed_time
1           0.189426    0.0986673             0.942434       0.9714                    12.1036
2           0.0770398   0.0885144             0.975533       0.9713                    15.4033
3           0.0493435   0.076026              0.984266       0.9757                    18.6904
4           0.0352887   0.0684401             0.987782       0.979                     21.9806
5           0.0268      0.0811076             0.990998       0.9795                    25.2938
6           0.0229493   0.0807123             0.992349       0.9808                    28.586
7           0.0196452   0.073097              0.993331       0.9785                    31.8601
8           0.0184286   0.0847715             0.993916       0.9811                    35.1581
9           0.0156427   0.100943              0.994915       0.976                     38.4409
10          0.0168551   0.0894318             0.994965       0.9814                    41.7316
11          0.0113114   0.120982              0.996182       0.9766                    44.9846
12          0.0152375   0.0916953             0.995532       0.9811                    48.2706
13          0.00836241  0.089633              0.997499       0.9815                    51.5273
14          0.0143102   0.0976422             0.995682       0.9809                    54.8322
15          0.0137209   0.088502              0.995732       0.9824                    58.1949
16          0.00605376  0.111912              0.998083       0.9832                    61.5142
17          0.00990389  0.104521              0.997249       0.9811                    64.8512
18          0.00773674  0.111974              0.997849       0.9808                    68.1799
19          0.0121542   0.0951731             0.996399       0.9851                    71.4791
20          0.00937598  0.0928568             0.997599       0.9837                    74.792
3
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
0