Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

696
Visualizações
How to force keras to use tensorflow GPU backend

I know this is one of the popular questions, but none of the solutions worked for me, so far.

I'm running a legacy code that is written in tensorflow v1.13.1 and keras v2.2.4. I cannot modify the code to run latest tensorflow version. Since keras has now been merged into tensorflow, I'm facing problems installing the specific versions of tensorflow and keras via pip. I found that anaconda has option to install keras and tensorflow with the above version. So, I installed it with

conda install -c conda-forge keras-gpu=2.2.4 tensorflow-gpu=1.13.1

It installed the version and all works too. But it doesn't use GPU, and instead runs on CPU. I noticed that anaconda installed both CPU and GPU versions of tensorflow and I guess this is why it is defaulting to CPU version. So, my question is, how can I force it to use GPU version?

PS: There are many answers out there that suggest to remove CPU version of tensorflow. But when I try to remove CPU version, conda uninstalls everything including keras. So, I assume there should be a way to use tensorflow-gpu when both of them are installed. Any help in this regard is appreciated!

over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

Let me start off with the assumption you're using an NVIDIA GPU. It's most likely due to you either not having CUDA installed or having the wrong version. Although, do double check to make sure you also have the latest NVIDIA drivers. If you look at this list you can see that tensorflow_gpu-1.13.1 uses CUDA version 10.0 and CudNN 7.4. To install those through anaconda use the following command.

conda install cudatoolkit==10.0.130

As for cudnn 7.4 check out the archive

over 4 years ago · Santiago Trujillo Relatório

0

Installing tensorflow first and then keras worked!

conda install tensorflow-gpu=1.13.1
conda install keras-gpu=2.2.4
over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda