Keras with TensorFlow backend not using GPU

拜拜、爱过 提交于 2019-11-27 05:06:42

It is never a good idea to have both tensorflow and tensorflow-gpu packages installed side by side (the one single time it happened to me accidentally, Keras was using the CPU version).

I guess now I need to figure out how to have keras use the gpu version of tensorflow.

You should simply remove both packages from your system, and then re-install tensorflow-gpu [UPDATED after comment]:

pip uninstall tensorflow tensorflow-gpu
pip install tensorflow-gpu

Moreover, it is puzzling why you seem to use the floydhub/dl-docker:cpu container, while according to the instructions you should be using the floydhub/dl-docker:gpu one...

juicygranpa

In the future, you can try using virtual environments to separate tensorflow CPU and GPU, for example:

conda create --name tensorflow python=3.5
activate tensorflow
pip install tensorflow

AND

conda create --name tensorflow-gpu python=3.5
activate tensorflow-gpu
pip install tensorflow-gpu

I had similar kind of issue - keras didn't use my GPU. I had tensorflow-gpu installed according to instruction into conda, but after installation of keras it simply not listed GPU as available device. I've realized that installation of keras adds tensorflow package! So I had both tensorflow and tensorflow-gpu packages. I've found that there is keras-gpu package available. After complete uninstallation of keras, tensorflow, tensorflow-gpu and installation of tensorflow-gpu, keras-gpu the problem was solved.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!