banner



How To Install Keras Gpu


Introduction

If you want to install the main deep learning libraries in 4 hours or less and start preparation your own models you accept come up to the right identify. I created this tutorial to help yous rapidly and hands install the most complete libraries for deep learning such equally Keras, Theano, and TensorFlow from scratch with GPU. In Linux the procedure is likely very similar only I have not tested it.

This step past step tutorial will install Keras, Theano and TensorFlow using CPU and GPU without any previous dependencies. When you finalize this tutorial you lot will exist able to work with these libraries in Windows 8.1 or Windows 10. In this tutorial nosotros will be not exist using the latest version of the programs but instead the near recent configuration that works for the concluding deep learning libraries. Visual Studio 13 (not visual studio xv), Python three.5 (not Python 3.vi), Anaconda 4.2 (non 4.3.i) , CUDA 8.0, and cuDNN v5.1 (not 6). If y'all install exactly these dependencies Keras, Theano and TensorFlow volition work perfectly.

I nstall Visual Studio xiii

  1. Download and install Visual Studio Community 2022 update 5.
  2. Add the route of VS2013 to your PATH C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin  using the environment variables (I use Rapid Environment Editor but y'all tin practise information technology manually)

Install CUDA 8.0

  1. Download and installCUDA 8.0
    1. If you lot have issues compiling CUDA. It could exist because y'all need to install the DirectX SDK
  2. Test Cuda 8.0 has been correctly installed. Run whatsoever  of the examples from CUDA in C:\ProgramData\NVIDIA Corporation\CUDA Samples\v8.0  you can run them using Samples_vs2013.sln

Install Anaconda3 four.2 with Python iii.5

  1. Download and install Anaconda3 4.2 with Python 3.5
  2. Check that Python and Anaconda are correctly installed. Open a command terminal (cmd) and execute python, the version has to be Python 3.5.2, y'all tin test if it works correctly (iii+v=viii)

Install Theano

  1. Open a command concluding (cmd) and execute: C:\>conda install theano , say yes to all the dependences.
  2. Install the compiler for Theano: C:\>conda install mingw libpython
    1. I had already installed MinGW x86_64-5.iv.0-release-posix-seh-rt_v5-rev0.7z, if at the finish Theano doesn't piece of work try to install it, and add together the path where you unzip the MinGW to the PATH (environment variables)
  3. Execute in command terminal C:\>conda list theano  to know the version, it should be 0.nine.0
  4. Exam Theano.
    1. Create a file named testTheano.py with the following code:
                                                                        
                                                                                                import                                                                    theano                                                                
                                        a = theano.tensor.vector()      # declare variable out = a + a ** 10               # build symbolic expression f = theano.office([a], out)   # compile function print(f([0, 1, 2]))                                
    2. Execute in a command terminal (cmd) C:\pathfile\>python testTheano.py

Install TensorFlow cpu version

  1. Open a command terminal (cmd) and execute: C:\>pip install tensorflow

Install Keras

  1. Open a command terminal (cmd) and execute: C:\>pip install keras

Examination Keras, Theano and TensorFlow-cpu

  1. Download deep learning script case cifar10_cnn.py from Keras, it will use a CNN to classify the database Cifar10. Change " epochs = 200" to " epochs = two" in order to do a fast exam
  2. Test Keras with TensorFlow-cpu. In a command line execute: C:\pathfile\>python cifar10_cnn.py . Keras is by default using TensorFlow backend
  3. Examination Keras with Theano
    1. Salve Keras configuration file using TensorFlow equally backend, we volition use it again later on for testing the TensorFlow-gpu version
      1. Relieve file keras.json in C:\Users\nameUser\.keras\ as kerasTensorFlow.json , where "nameuser" is the proper noun of the user
    2. Change the backend to Theano. In keras.json file write:
       {

          "floatx": "float32",

          "epsilon": 1e-07,

          "image_dim_ordering": "thursday",

          "backend": "theano"

      }

    3. Create configuration file for Theano .theanorc in C:\Users\nameUser\

      [global] floatX = float32 device = gpu [nvcc] compiler_bindir=C:\Plan Files (x86)\Microsoft Visual Studio 12.0\VC\bin

    4. In a command line execute: C:\pathfile\>python cifar10_cnn.py . Keras is by default using Theano backend now. In the first line after the Keras python script it volition tell you the backend information technology is using.
  4. If you compare both yous volition meet as Theano is faster considering information technology's using gpu, you can change it if you lot want in device ( device = cpu ) to meet the difference in the speed.

Install cuDNN v5.1

  1. Download and install cuDNN v5.1
    1. The gpu version of the TensorFlow needs CUDA 8 and cuDNN v5.ane. You will need to register in nvidia to download it
    2. Download cudnn-8.0-windows7-x64-v5.1.zip for windows viii.one users and cudnn-viii.0-windows10-x64-v5.1.zip version for windows 10 users.
  2. Unzip the downloaded file and copy the bin, lib, and include files in their respective folders in C:\Plan Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\

Install TensorFlow gpu version

  1. Open a command terminal (cmd) and execute: C:\>pip install tensorflow-gpu

Test Keras with TensorFlow-gpu

  1. Rename the configuration file for Keras using TensorFlow equally backend kerasTensorFlow.json as keras.json in C:\Users\nameUser\.keras\
  2. Execute once again inorthward a command line: C:\pathfile\>python cifar10_cnn.py Keras is now by default using TensorFlow-gpu

If you take followed all the steps, your machine is now able to work with Keras and Theano, Tensorflow in CPU and GPU mode. Now you can start training and testing your own models. Let me know if you were able to practise it in nether 4 hours !!

Source: https://www.sites.google.com/site/ivanhuertacasado/installing-keras-theano-tensorflow-with-gpu-windows

Posted by: hagamanchimplas.blogspot.com

0 Response to "How To Install Keras Gpu"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel