6
votes

I'm running Keras in R and using Tensorflow-GPU backend. Is it possible to force Keras to run on CPU without re-installing the backend?

1

1 Answers

2
votes

Let me give you 2 answers.

Answer #1 (normal answer)

No, unfortunately not. For keras CPU and GPU are 2 different versions, from which you select at install time.

It seems you remember that you selected GPU at install time. I guess you're hoping that you were only setting a minor option, not selecting a version of the program. Unfortunately, you were selecting the version of keras to install.

Answer #2 (ok, maybe you can "trick" keras)

It seems you can use environment variable values to trick keras into thinking that your CPU is your GPU.

This seems like it may have unexpected results, but it seemed to work for these Python users.

I wouldn't worry about the fact that they are using Python. They are just using their language to set environment variables. So you can do the same in R or directly within your OS.