问题
I've used Anaconda to install Theano (and Keras) on Windows 7 64bit. Here are my steps.
- Install the latest Anaconda for Python 3.5
- conda install mingw libpython
- pip install Theano
- conda install pydot-ng
- pip install keras
- 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