theanoバージョン依存ピット

Ubuntuの+ theanoインストールガイド

https://blog.csdn.net/hczhcz0905/article/details/80424023
https://blog.csdn.net/Xujian0000abcd/article/details/51352707
次のようにpygpuコマンドをインストールします。

        git clone https://github.com/Theano/libgpuarray.git
        cd libgpuarray
        mkdir Build
        cd Build
        cmake .. -DCMAKE_BUILD_TYPE=Release
        make 
        make install
        cd ..
        python setup.py build 
        python setup.py install    
        sudo ldconfig

theanoバックエンドを変更

theano 0.9以降では、デバイス= GPUやCPUやCUDA(新しいバックエンド)、あなたは、それを修正し、Ctrlキーを押したままする必要があります+ ALT + Tコマンドラインを入力し、入力して、GPUの新しいバックエンドを使用します

sudo gedit ~/.theanorc #修改device

あなたは、環境を構成した後、あなたは、GPUやCPUを使用して、テストするには、次のコードを使用することができます。

# -*- coding: utf-8 -*-
from theano import function, config, shared, sandbox  
import theano.tensor as T  
import numpy  
import time  
  
vlen = 10 * 30 * 768  # 10 x #cores x # threads per core  
iters = 1000  
  
rng = numpy.random.RandomState(22)  
x = shared(numpy.asarray(rng.rand(vlen), config.floatX))  
f = function([], T.exp(x))  
print f.maker.fgraph.toposort()  
t0 = time.time()  
for i in xrange(iters):  
    r = f()  
t1 = time.time()  
print 'Looping %d times took' % iters, t1 - t0, 'seconds'  
print 'Result is', r  
if numpy.any([isinstance(x.op, T.Elemwise) for x in f.maker.fgraph.toposort()]):  
    print 'Used the cpu'  
else:  
    print 'Used the gpu'  

注意:そこテストされていますpygpu = 0.6.5theano = 0.9.0 若しくはpygpu = 0.7.5theano = 1.0.0。OK
注:私はGPUをテストしたり、CPUが、私はインストール時に問題が発生しましたTheanoの== 1.0.4をデバイス= CUDAが、私は、私は、検索の様々なを通じて、CPUを使用することが示唆されているテストしたとき、答えを見つけるために:
https://github.com/Theano/Theano/issues/6065

The script you are using to test does not seem to detect GPU usage correctly.
In fact, since it prints GpuElemwise{exp,no_inplace}(<GpuArrayType<None>(float32, vector)>), you can be sure that it actually is using the GPU.
Are you using the latest version of the script at http://deeplearning.net/software/theano/tutorial/using_gpu.html#testing-theano-with-gpu ?

私は少しを再実行し、最終的に成功http://deeplearning.net/software/theano/tutorial/using_gpu.html#testing-theano-with-gpu対応するコードからURLをコピーした後...
ここに画像を挿入説明

theanoのバージョンアップ

あなたはtheano 0.9以降のランタイムを求めるメッセージが表示されます。

C:\Program Files\Anaconda2\lib\site-packages\keras\backend\theano_backend.py:1500: UserWarning: DEPRECATION: the 'ds' parameter is not going to exist anymore as it is going to be replaced by the parameter 'ws'.
  mode='max')
C:\Program Files\Anaconda2\lib\site-packages\keras\backend\theano_backend.py:1500: UserWarning: DEPRECATION: the 'st' parameter is not going to exist anymore as it is going to be replaced by the parameter 'stride'.
  mode='max')
C:\Program Files\Anaconda2\lib\site-packages\keras\backend\theano_backend.py:1500: UserWarning: DEPRECATION: the 'padding' parameter is not going to exist anymore as it is going to be replaced by the parameter 'pad'.
  mode='max')

この問題で次のように答えて、検索したが、練習していません。

strongly suggest that you update cudnn to v7 (or at least v6). They fixed some of those type of errors.

Updating Theano to 0.10.beta1 could also fix that, as we have some work around in some cases for that.

The ideal would be to update both.

If you update Theano to 0.10.beta2 or the dev version, you will need to update libgpuarray version to 0.7.1

また、ときnumpyのより大きい1.16、エラーメッセージが要求されます:

AttributeError: module 'numpy.core.multiarray' has no attribute '_get_ndarray_c_version'

これに基づき、2つの解決策があります

  1. ≥1.0.4のtheanoバージョンのアップグレード
  2. 1.15にnumpyのダウングレード。*

参考サイト

http://www.zhongruitech.com/249400924.html
https://github.com/Theano/Theano/issues/6065
https://groups.google.com/forum/#!topic/theano-users/j8- 6eLwxQUk
https://blog.csdn.net/hczhcz0905/article/details/80424023
https://blog.csdn.net/Xujian0000abcd/article/details/51352707

おすすめ

転載: blog.csdn.net/sdkjkfk/article/details/92605434
おすすめ