37

I'm new to Theano. Trying to set up a config file.

First of all, I notice that I have no .theanorc file:

  1. locate .theanorc - returns nothing
  2. echo $THEANORC - returns nothing
  3. theano.test() - passes ok

I'm guessing some default configuration was created wen i installed theano. Where is it?

4

5 回答 5

46

Theano 本身不会创建任何配置文件,但它的所有配置标志都有默认值。如果你想修改默认值,你只需要这样一个文件。

这可以通过在您的主目录中创建一个 .theanorc 文件来完成。例如,如果您希望 floatX 始终为 float32,您可以这样做:

echo -e "\n[global]\nfloatX=float32\n" >> ~/.theanorc

在 Linux 和 Mac 下。在windows下,也可以这样做。有关详细信息,请参阅此页面:

http://deeplearning.net/software/theano/library/config.html

于 2014-02-11T13:32:15.160 回答
9

在 Linux 的终端主目录中写入:

nano .theanorc

在文件中复制以下行

[global]
floatX = float32
device = gpu0

[lib]
cnmem = 1   

保存。

当我在 python 中导入 theano 时,我遇到了 cnmem 内存问题。似乎是因为显示器连接到了gpu。要解决它,请将 cnmem 更改为 0.8。这个低于 1 的数字是为 theano 保留的 gpu 的百分比

于 2016-10-13T08:19:01.857 回答
3

我有一个类似的问题,这对我有帮助:

import theano
//...
theano.config.floatX = 'float32' //or 'float64' whatever you want
于 2016-09-14T07:02:45.287 回答
1

我一直有类似的问题。我在带有华硕 Z270E 主板的台式机上安装了 NVIDIA 1070 GPU,并且在设置 .theanorc 文件后能够导入 theano,如下所示。(然后重新启动)

[global]
floatX = float32
device = gpu

[cuda]
root = /usr/local/cuda
[lib]
cnmem = 1   
于 2017-12-03T13:47:55.660 回答
1

这对我有用:

nano ~/.theanorc

然后我输入:

[global]
floatX = float32
device = cuda

检查 Theano 是否使用 GPU 的代码位于Theano 文档页面

(我使用的是 Ubuntu 14.04、Theano 0.9.0(conda)、NVIDIA 1080 Ti GPU)。

于 2017-06-08T22:36:05.993 回答