将GPU上构建的anano模型转换为CPU? [英] Converting a theano model built on GPU to CPU?

查看:634
本文介绍了将GPU上构建的anano模型转换为CPU?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些建立在gpu上的深度学习模型的pickle文件。我想在生产中使用它们。但是当我尝试在服务器上取消它们,我得到以下错误。

I have some pickle files of deep learning models built on gpu. I'm trying to use them in production. But when i try to unpickle them on the server, i'm getting the following error.


回溯(最近最后一次呼叫):

文件score.py,第30行,位于

model =(cPickle.load(file))

文件/usr/local/python2.7/lib/python2.7/site-packages/Theano-0.6.0-py2 .b.eb / baob / usr / cbin / cuda / type.py,第485行,在CudaNdarray_unpickler中

return cuda.CudaNdarray(npa)

AttributeError:('NoneType'object没有属性'CudaNdarray',,(array([[0.011515,0.01171047,0.10408644,...,-0.0343636,

0.04944979,-0.06583775],

[-0.03771918 ,0.080524,-0.10609912,...,0.11019105,

-0.0570752,0.02100536],

[-0.03628891,-0.07109226,-0.00932018,...,0.04316209,

0.02817888,0.05785328],

...,

[0.0703947,-0.00172865,-0.05942701,...,-0.00999349,

0.01624184,0.09832744],

[-0.09029484,-0.11509365,-0.07193922,...,0.10658887,

0.17730837,0.01104965],

[0.06659461 ,-0.02492988,0.02271739,...,-0.0646857,

0.03879852,0.08779807],dtype = float32),))

Traceback (most recent call last):
File "score.py", line 30, in
model = (cPickle.load(file))
File "/usr/local/python2.7/lib/python2.7/site-packages/Theano-0.6.0-py2.7.egg/theano/sandbox/cuda/type.py", line 485, in CudaNdarray_unpickler
return cuda.CudaNdarray(npa)
AttributeError: ("'NoneType' object has no attribute 'CudaNdarray'", , (array([[ 0.011515 , 0.01171047, 0.10408644, ..., -0.0343636 ,
0.04944979, -0.06583775],
[-0.03771918, 0.080524 , -0.10609912, ..., 0.11019105,
-0.0570752 , 0.02100536],
[-0.03628891, -0.07109226, -0.00932018, ..., 0.04316209,
0.02817888, 0.05785328],
...,
[ 0.0703947 , -0.00172865, -0.05942701, ..., -0.00999349,
0.01624184, 0.09832744],
[-0.09029484, -0.11509365, -0.07193922, ..., 0.10658887,
0.17730837, 0.01104965],
[ 0.06659461, -0.02492988, 0.02271739, ..., -0.0646857 ,
0.03879852, 0.08779807]], dtype=float32),))

我在我的本地机器上检查了cudaNdarray软件包,它没有安装,但我仍然可以取消它们。但在服务器,我无法。如何让它们在没有GPU的服务器上运行?

I checked for that cudaNdarray package in my local machine and it is not installed, but still i am able to unpickle them. But in the server, i am unable to. How do i make them to run on a server which doesnt have a GPU?

推荐答案

pylearn2中有一个脚本您需要:

There is a script in pylearn2 which may do what you need:

pylearn2 / scripts / gpu_pkl_to_cpu_pkl.py

这篇关于将GPU上构建的anano模型转换为CPU?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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