問題タブ [theano-cuda]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
python - keras と theano を使用した Python での MemoryError
このkeras チュートリアルを試しました。私は他のプロジェクトで theano を使用しているので、keras を変更して、tenorflow ではなく theano を使用するようにしました。しかし、このチュートリアルを実行すると、最初に次のエラーが発生します。
nvcc 致命的: PATH にコンパイラ 'cl.exe' が見つかりません
そしてしばらくすると、最初のエポック (3 つのうち) で、サンプル番号 13056 (25000 のうち) で次のエラーが発生します。
ファイル "test_keras.py"、28 行目、model.fit(X_train, y_train, validation_data=(X_test, y_test), epochs=3, batch_size=64) 内
ファイル "C:\Users\domi1_000\Anaconda3\envs\Pyhon27\lib\site-packages\keras\models.py"、845 行目、initial_epoch=initial_epoch に適合)
ファイル "C:\Users\domi1_000\Anaconda3\envs\Pyhon27\lib\site-packages\keras\engine\training.py"、1485 行目、initial_epoch=initial_epoch に適合)
ファイル "C:\Users\domi1_000\Anaconda3\envs\Pyhon27\lib\site-packages\keras\engine\training.py"、1140 行目、_fit_loop outs = f(ins_batch) 内
ファイル「C:\Users\domi1_000\Anaconda3\envs\Pyhon27\lib\site-packages\keras\backend\theano_backend.py」、1094 行目、呼び出しで return self.function(*inputs)
ファイル "C:\Users\domi1_000\Anaconda3\envs\Pyhon27\lib\site-packages\theano\compile\function_module.py"、898 行目、呼び出し storage_map=getattr(self.fn, 'storage_map', None))
ファイル「C:\Users\domi1_000\Anaconda3\envs\Pyhon27\lib\site-packages\theano\gof\link.py」、325行目、raise_with_op reraise(exc_type, exc_value, exc_trace)
ファイル "C:\Users\domi1_000\Anaconda3\envs\Pyhon27\lib\site-packages\theano\compile\function_module.py"、884 行 目、output_subset が None else\ の場合、self.fn()の呼び出し
ファイル "C:\Users\domi1_000\Anaconda3\envs\Pyhon27\lib\site-packages\theano\scan_module\scan_op.py"、989 行目、rval r = p(n, [x[0] for x in i) ]、o)
ファイル「C:\Users\domi1_000\Anaconda3\envs\Pyhon27\lib\site-packages\theano\scan_module\scan_op.py」、978行目、p self、node)
ファイル「theano/scan_module/scan_perform.pyx」、行 445、theano.scan_module.scan_perform.perform (C:\Users\domi1_000\AppData\Local\Theano\compiledir_Windows-8.1-6.3.9600-Intel64_Family_6_Model_58_St epping_9_GenuineIntel-2.7.12 内-64\scan_perform\mod.cpp:5259)
メモリエラー:
エラーの原因となった適用ノード: forall_inplace,cpu,grad_of_scan_fn}(TensorConstant{500}, Subtensor{int64:int64:int64}.0, Elemwise{tanh}.0, Alloc.0, InplaceDimShuffle{0,2,1}. 0, Elemwise{Composite{(i0 - sqr(i1))}}.0, Subtensor{int64:int64:int64}.0, Subtensor{int64:int64:int64}.0, Subtensor{int64:int64:int64}. 0、Alloc.0、Alloc.0、Alloc.0、TensorConstant{500}、Subtensor{::、int64:int64:}.0、Subtensor {::、:int64:}.0、Subtensor{::、 int64::}.0、Subtensor{::、int64:int64:}.0、InplaceDimShuffle{1,0}.0、InplaceDimShuffle{1,0}.0、InplaceDimShuffle{1,0}.0、Alloc.0 , InplaceDimShuffle{1,0}.0)
Toposort インデックス: 148 入力タイプ: [TensorType(int64, scalar), TensorType(float32, 3D), TensorType(float32, 3D), TensorType(float32, 3D), TensorType(float32, 3D), TensorType(float32, 3D), TensorType(float32, 3D), TensorType(float32, 3D), TensorType(float32, 3D), TensorType(float32, 3D), TensorType(float32, 3D), TensorType(float32, 3D), TensorType(int64, スカラー), TensorType(float32, マトリックス), TensorType(float32, マトリックス) , TensorType(float32, マトリックス), TensorType(float32, マトリックス), TensorType(float32, マトリックス), TensorType(float32, マトリックス), TensorType(float32, マトリックス), TensorType (float32, 行列), TensorType(float32, 行列 ix)]
入力形状: [(), (500L, 64L, 100L), (500L, 64L, 100L), (500L, 64L, 400L), (500L, 100L, 64L), (500L, 64L, 100L), (500L, 64L、400L)、(500L、64L、100L)、(500L、64L、100L)、(501L、64L、100L)、(501L、64L、100L)、(2L、100L、400L)、()、( 100L、100L)、(100L、100L)、(100L、100L)、(100L、100L)、(100L、100L)、(100L、100L)、(100L、100L)、(100L、400L)、(100L、 100L)] 入力ストライド: [(), (-25600L, 400L, 4L), (25600L, 400L, 4L), (102400L, 1600L, 4L), (-25600L, 4L, 400L), (25600L, 400L, 4L )、(-1600L、800000L、4L)、(-25600L、400L、4L)、(-25600L、400L、4L)、(25600L、4 00L、4L)、(25600L、400L、4L)、(160000L、1600L 、4L)、()、(1600L、4L)、(1600L、4L)、(1600L、4L)、(1600L、4L)、(4L、1600L)、(4L、1600L)、(4L、1600L)、( 1600L, 4L), (4L, 1600L)] 入力値: [array(500L, dtype=int64), 'not shown', 'not shown', 'not shown', '非表示'、非表示、非表示、非表示、非表示、非表示、非表示、非表示、配列(500L, dty pe=int64)、'出力クライアント: [[] , [], [Subtensor{int64}(forall_inplace,cpu,grad_of_scan_fn}.2, Constant{1})], [Subtensor{::int64}(forall_inplace,cpu,grad_of_scan_fn}.3, Constant{-1})] ]クライアントを出力します: [[], [], [Subtensor{int64}(forall_inplace,cpu,grad_of_scan_fn}.2, Constant{1})] , [サブテンソル{::int64}(forall_inplace,cpu,grad_of_scan_fn}.3, 定数{-1})]]クライアントを出力します: [[], [], [Subtensor{int64}(forall_inplace,cpu,grad_of_scan_fn}.2, Constant{1})] , [サブテンソル{::int64}(forall_inplace,cpu,grad_of_scan_fn}.3, 定数{-1})]]
ヒント: ほとんどの Theano 最適化を無効にして再実行すると、このノードがいつ作成されたかのバックトレースが得られる可能性があります。これは、Theano フラグ 'optimizer=fast_compile' を設定することで実行できます。それでもうまくいかない場合は、Theano の最適化を「optimizer=None」で無効にすることができます。
これは私の他のプロジェクトでも起こりましたが、寸法の不一致が問題でした。サイズが 300x200 のノードとサイズが 100x100 のノードを一致させることができませんでした。
どんな助けでも本当に感謝しています。