I've put these instructions down for installing keras to work with tensorflow in case they are helpful for others.
I'm going to assume that you are already on top of how to install python packages, or else have the excellent Anaconda (from continuum analytics) installed, which makes it easy via it's conda package manager (You can get it at https://www.continuum.io/).
If you have Anaconda installed, you should use its built-in package manager to install additional packages needed by keras:
conda install pyyaml
conda install h5py
You probably also want to make sure you are up to date with scipy, numpy, six:
conda upgrade six
conda upgrade scipy
conda upgrade numpy
Now, keras needs a back-end of either Theano or Tensorflow. I started using Tensorflow (for no particularly good reason, that's just what I picked). I just followed the Tensorflow setup instructions for Mac, which essentially consisted of typing the following at the command prompt:pip install --upgrade https://storage.googleapis.com/tensorflow/mac/tensorflow-0.6.0-py2-none-any.whl
Now, finally, you want to install keras, which is the python library that sits atop Tensorflow/Theano and makes it easier to specify and train a neural network. You can clone the git repository which lives here. I just downloaded the zip file (from the same location), and unzipped it.
The keras website says to
cd
to the keras directory and run sudo python setup.py install
However, this did not work for me, because keras attempts to install Theano, and I had problems with that part of the install. Theano is listed as a dependency I suspect for historical reasons, even if you intend to use keras with a tensorflow backend. So, I just edited setup.py and removed theano as a dependency. By the time you read this, this issue will probably be fixed, and you wont need to edit
setup.py
.Lastly, before you run keras, you need to create a
.keras
directory in your home folder, and in that directory, create a file called keras.json
, and put the following in it: {"epsilon": 1e-07, "floatx": "float32", "backend": "tensorflow"}
Now, you should be able to run keras. At least this seems to have worked for me.
2 comments:
I wanted to thank for sharing this article and I have bookmarked this page to check out new stuff.
ccna Training in Chennai
ccna course in Chennai
Python Classes in Chennai
Python Training Institute in Chennai
R Training in Chennai
R Programming Training in Chennai
CCNA Training in T Nagar
CCNA Training in OMR
Nice article.Thanks for posting article like this.Keep up the good work
DevOps Training in Chennai
Splunk Training in Chennai
Post a Comment