Theano with Anaconda on Windows: how to setup BLAS?

爱⌒轻易说出口 提交于 2019-12-23 03:01:13

问题


I've used Anaconda to install Theano (and Keras) on Windows 7 64bit. Here are my steps.

  1. Install the latest Anaconda for Python 3.5
  2. conda install mingw libpython
  3. pip install Theano
  4. conda install pydot-ng
  5. pip install keras
  6. Edit .keras/keras.json to use "theano" instead of "tensorflow".

Open Jupyter, copy and paste this code: https://github.com/fchollet/keras/blob/master/examples/cifar10_cnn.py It executes fine until the call to model.fit : imports, data download, model compilation all work.

Please note that I set data_augmentation to False.

The call to model.fit fails with the following error message:http://pastebin.com/Rq7HTc4H

This seems to be the problem:

AssertionError: AbstractConv2d Theano optimization failed: there is no implementation available supporting the requested options. Did you exclude both "conv_dnn" and "conv_gemm" from the optimizer? If on GPU, is cuDNN available and does the GPU support it? If on CPU, do you have a BLAS library installed Theano can link against?

I didn't install BLAS myself, I thought that would be a part of Anaconda. Browsing the internet reveals similar problems. Apparently you can prevent Theano from looking for a BLAS library by editing a .theanorc.txt file and adding "optimizer = None": How configure theano on Windows?

I executed os.path.expanduser('~/.theanorc.txt'), verified that my .theanorc.txt is in the right place, added the optimier=None line and tried the code again. No effect.

How can I configure Theano to work without BLAS ? Or, even better, how can I install a BLAS library (preferably via Anaconda) ?

UPDATE: Apparently you can edit the config during runtime:

import theano
theano.config.optimizer="None"

removes the problem.

This means that Theano doesn't find my config file. I thought I had put it at the correct location, what might prevent Theano from finding it ?


回答1:


it should be os.path.expanduser('~/.theanorc') without the txt.

use enviroment variable to change theano parameters:
beginning on your code use this to config theano:

import os
os.environ['THEANO_FLAGS'] = 'optimizer=None'

also you can try this: http://deeplearning.net/software/theano/troubleshooting.html#test-blas



来源:https://stackoverflow.com/questions/40178119/theano-with-anaconda-on-windows-how-to-setup-blas

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!