Monday, August 6, 2018

Setting up TensorFlow backed Keras with GPU in Anaconda - Windows

I wanted to use my GPU instead of CPU in Keras, after knowing that it supports CUDA, for a simple deep learning example training, so I had to do some search on how to set it up and ended with this summary:
 
Pre requisites :
1- Anaconda installed
2- setup Nividia CUDA 9.0 https://developer.nvidia.com/cuda-90-download-archive
3- setup Nividia cuDNN 7 (for CUDA 9.0) https://developer.nvidia.com/rdp/cudnn-download
https://docs.nvidia.com/deeplearning/sdk/cudnn-install/index.html#install-windows

Steps:

0) run Anaconda Prompt

1) install conda packages
conda create --name tf-gpu-keras-p35 python=3.5 pip
activate tf-gpu-keras-p35
conda install jupyter
conda install scipy
conda install scikit-learn
conda install pandas
pip install tensorflow-gpu
pip install keras

The following didn't work for me:
(didn't work with keras, keras installed tensorflow 1.1.0) keras keeps overriding the tensorflow-gpu
you get empty tensorflow module
conda install -c conda-forge keras
conda install -c conda-forge keras-gpu
conda install -c conda-forge tensorflow
conda install -c anaconda tensorflow-gpu

2) Set keras to use tensorflow backend, in case it uses theano (default)

go to Anaconda3/envs/<env name>/etc/activate.d/keras_activate.bat
go to <User home directory>\.keras\keras.json and change to tensorflow

3) run jupyter:
jupyter notebook

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Istio —simple fast way to start

istio archeticture (source istio.io) I would like to share with you a sample repo to start and help you continue your jou...