Theano CNN on CPU: AbstractConv2d Theano optimizat

2020-07-02 12:05发布

I'm trying to train a CNN for object detection on images with the CIFAR10 dataset for a seminar at my university but I get the following Error:

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 am running Anaconda 2.7 within a Jupyter notebook (CNN training on CPU) from a Windows 10 machine. As I already have updated to the newest theano version using git clone I tried the following things:

  • exclude dnn and gemm directly from within the code THEANO_FLAGS='optimizer_excluding=conv_dnn, optimizer_excluding=conv_gemm'
  • exclude dnn and gemm directly from cmd typing THEANO_FLAGS='...' python <myscript>.py which not suprisingly gives an "unknown command" error.
  • exclude dnn and gemm from a .theanorc.txt which I put into C:/user/myusername

Unfortunately, I still get the same error and when I call print(teano.config) the terms "conv_dnn" and "conv_gemm" do not appear.

  • Furthermore I tried to find out what BLAS my numpy package is using (which generally works well for) and if that package is static using a tool from dependencywalker.com but I failed miserably

So here's my question: How on earth can I set the theano flags properly and how can I check if I suceeded in doing so? If that doesn't help, how can I check what BLAS I am building? Which one should I use and how can I change the dependency for theano?

As you might have guessed I am not an expert when it comes to all this package, dependency, built and other fancy computer science stuff and the documentation I find only is just not noob proof so I would be most grateful I you guys could help me out!

Best

Jonas

3条回答
贪生不怕死
2楼-- · 2020-07-02 12:34

Add one line to .theanorc file

optimizer = None

as a global configuration.

查看更多
叼着烟拽天下
3楼-- · 2020-07-02 12:37

I had the same problem but under Linux. It turned out that BLAS was not installed at all, and I had to install it separately, including setting some new environment variables:

export LD_LIBRARY_PATH="/home/username/anaconda2/lib"
export LD_PRELOAD="/home/username/anaconda2/lib/libmkl_core.so:/home/MEDIANET/aharjunm/anaconda2/lib/libmkl_sequential.so"

I also had to make sure that there were no conflicting python paths between anaconda and any previous python installation.

I know that it's going to be vastly different under Windows, but because the error message is exactly the same, the basic premise for a cure should be the same as well: install BLAS. You can find plenty of sources for that, for example here.

查看更多
别忘想泡老子
4楼-- · 2020-07-02 12:51

I had same error message on Windows. My ".theanorc.txt" file located in "C:\Users\USERNAME\.theanorc.txt" was wrongly formatted and Blas library wasn't found by Theano. This can be seen in Python console by writing "import theano; theano.config.blas.ldflags" which gave blank string (''). The blas-keyword has to be as section header.

[global]
floatX = float32
device = cpu

[blas]
ldflags = -LC:\\openblas -lopenblas

In C:\openblass path I have files: libgcc_s_seh-1.dll, libgfortran-3.dll, libopenblas.dll and libquadmath-0.dll. Refer to http://deeplearning.net/software/theano/library/config.html

查看更多
登录 后发表回答