Keras: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 7: | Line 7: | ||
<!--T:3--> | <!--T:3--> | ||
#Install either [[Tensorflow]], [[CTNK]] or [[Theano]]. | #Install either [[Tensorflow]], [[CTNK]] or [[Theano]] in a Python virtual environment. | ||
#Activate the Python virtual environment | #Activate the Python virtual environment (named <tt>$HOME/tensorflow</tt> in our example). | ||
#:{{Command2|source $HOME/tensorflow/bin/activate}} | #:{{Command2|source $HOME/tensorflow/bin/activate}} | ||
#Install | #Install Keras in your virtual environment. | ||
#:{{Command2 | #:{{Command2 | ||
|prompt=(tensorflow)_[name@server ~]$ | |prompt=(tensorflow)_[name@server ~]$ |
Revision as of 20:51, 28 January 2019
"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
- Install either Tensorflow, CTNK or Theano in a Python virtual environment.
- Activate the Python virtual environment (named $HOME/tensorflow in our example).
[name@server ~]$ source $HOME/tensorflow/bin/activate
- Install Keras in your virtual environment.
(tensorflow)_[name@server ~]$ pip install keras
R package
This section details how to install Keras for R and use TensorFlow as the backend.
- Install TensorFlow for R by following the instructions provided here.
- Follow the instructions from the parent section.
- Load the required modules.
[name@server ~]$ module load gcc r/3.5.0
- Launch R.
[name@server ~]$ R
- 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'))