Windows上带有Anaconda的Theano:如何设置BLAS? [英] Theano with Anaconda on Windows: how to setup BLAS?

查看:268
本文介绍了Windows上带有Anaconda的Theano:如何设置BLAS?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用Anaconda在Windows 7 64bit上安装Theano(和Keras). 这是我的步骤.

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

  1. 为Python 3.5安装最新的Anaconda
  2. conda安装mingw libpython
  3. pip安装Theano
  4. conda安装pydot-ng
  5. pip install keras
  6. 编辑.keras/keras.json以使用"theano"代替"tensorflow".

打开Jupyter,复制并粘贴以下代码: https://github.com/fchollet/keras/blob/master/examples/cifar10_cnn.py 它可以正常执行,直到对model.fit的调用:导入,数据下载,模型编译全部工作为止.

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.

请注意,我将data_augmentation设置为False.

Please note that I set data_augmentation to False.

对model.fit的调用失败,并显示以下错误消息: http://pastebin.com/Rq7HTc4H

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

这似乎是问题所在:

AssertionError:AbstractConv2d Theano优化失败:没有 可用的实现支持所请求的选项.你是否 从优化程序中同时排除"conv_dnn"和"conv_gemm"?如果在GPU上, cuDNN是否可用,GPU是否支持它?如果在CPU上,您有 安装了Theano的BLAS库是否可以链接?

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?

我自己没有安装BLAS,我以为那是Anaconda的一部分. 浏览互联网会发现类似的问题. 显然,您可以通过编辑.theanorc.txt文件并添加"optimizer = None"来阻止Theano寻找BLAS库:

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?

我执行了os.path.expanduser('~/.theanorc.txt'),验证了我的.theanorc.txt在正确的位置,添加了optimier = None行并再次尝试了该代码. 没有效果.

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.

如何配置Theano在不使用BLAS的情况下工作? 或者,甚至更好的是,如何安装BLAS库(最好通过Anaconda)?

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"

消除了问题.

这意味着Theano找不到我的配置文件. 我以为我把它放到了正确的位置,是什么导致Theano找不到它?

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 ?

推荐答案

应为os.path.expanduser('~/.theanorc'),不带txt.

使用环境变量更改theano参数:
从您的代码开始,使用它来配置theano:

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

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

您也可以尝试以下操作: http://deeplearning.net/software/theano/troubleshooting.html#test- blas

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

这篇关于Windows上带有Anaconda的Theano:如何设置BLAS?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆