Git Product home page Git Product logo

keras's Introduction

Keras

Keras for beginners

To get started we need to install CUDA and CUDNN if you want to use your internal GPU for running tensorflow.

Installing Nvidia Drivers and Cuda

Firstly we need to install nvidia driver I personally recomend nvidia 390. To install that open up terminal and type:

 sudo apt-get install nvidia-390

I recommended installing cuda 9.0 or 9.1 as 9.2 is not fully supported and you might run into mulitple errors when playing around with tensorflow

  1. Go to Cuda tool kit and scroll down to legacy releases
  2. Download the local runfile. Make sure you select the correct operating system in this tutorial i will be using linix
  3. Navigate to the runfile using the cd commond for instance if its on the desktop type:
cd Desktop/
  1. To run the .run file type in:
sudo sh cuda_9.1.85_387.26_linux.run 
  1. Make sure you press N when it asks to install the nvidia drivers as we have previosuly installed them.
  2. Once cuda is installed we need to open the .bashrc for that type in:
nano ~/.bashrc

and then add these lines at the end of the file (this is done so that libs such as tensorflow can locate cuda) :

export PATH=/usr/local/cuda-9.1/bin${PATH:+:${PATH}}

Press Ctrl+X to exit out make sure you press save when exiting out

  1. Run the following command so that the changes are applied:
source ~/.bashrc
  1. Reboot you pc and verify nvidia and cuda drivers are install properly this will be done by:
cat /proc/driver/nvidia/version

and for cuda

nvcc -V
  1. Now you need to install cuDNN to do that firstly you need register for an nvidia develper account
  2. Now download cuDNN 7.1 for linix
  3. Once downloaded navigate to that folder and unpack the file
 tar -xzvf cudnn-8.0-linux-x64-v5.1.tgz

Copy cuDNN files to cuda folder

sudo cp cuda/lib64/* /usr/local/cuda/lib64/
sudo cp cuda/include/cudnn.h /usr/local/cuda/include/

Setting up a virtaul enviornment

  1. To install a virtual enviornment firstly type:
sudo apt-get install python3-venv
  1. Name your virtual enviornment
virtualenv --system-site-packages ~/keras
  1. To activate the virtual enviornment type:
source ~/keras/bin/activate
  1. Now install tensorflow by using this command:
pip3 install --upgrade tensorflow-gpu
  1. Now install Keras Library:
pip3 install keras
  1. Finally to test everthing create a text file with
import tensorflow as tf
import keras
import numpy as np
import scipy

sess = tf.Session(config=tf.ConfigProto(log_device_placement=True))
  1. Save it as test.py and run it using:
python3 test.py

keras's People

Contributors

hammadsaeed avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.