Keras: Difference between revisions

From Alliance Doc
Jump to navigation Jump to search
No edit summary
Line 21: Line 21:
#Load the required modules :  
#Load the required modules :  
#:{{Command2|module load gcc r/3.5.0}}
#:{{Command2|module load gcc r/3.5.0}}
#In R, install package keras:  
# Launch R
#:{{Command2|R}}
#In R, install package keras with devtools:  
#:<syntaxhighlight lang='r'>
#:<syntaxhighlight lang='r'>
devtools::install_github('rstudio/keras')
devtools::install_github('rstudio/keras')

Revision as of 19:54, 1 June 2018


This article is a draft

This is not a complete article: This is a draft, a work in progress that is intended to be published into an article, which may or may not be ready for inclusion in the main wiki. It should not necessarily be considered factual or authoritative.




"Keras is a high-level neural networks API, written in Python and capable of running on top of TensorFlow, CNTK, or Theano. It was developed with a focus on enabling fast experimentation."[1]

Installing

  1. Install either Tensorflow, CTNK or Theano.
  2. Activate the Python virtual environment in which you installed one of the preceding package.
    [name@server ~]$ source $HOME/deeplearning/bin/activate
    
  1. Install keras in your virtual environment.
    (deeplearning)_[name@server ~]$ pip install keras
    


R package

This section details how to install Keras for R and use TensorFlow as the backend.

  1. Install TensorFlow for R by following the instructions provided here.
  2. Follow the instructions from the parent section.
  3. Load the required modules :
    [name@server ~]$ module load gcc r/3.5.0
    
  1. Launch R
    [name@server ~]$ R
    
  1. In R, install package keras with devtools:
    devtools::install_github('rstudio/keras')
    


You are then good to go. Do not call install_keras() in R, as Keras and TensorFlow have already been installed in your virtual environment with pip. To use the Keras installed in your virtual environment, enter the following commands in R after the activation of the environment.

library(keras)
use_virtualenv(Sys.getenv('VIRTUAL_ENV'))

References