If you’ve been working on deep learning models on your laptop, then this is for YOU.
So, if you’ve seen my other projects, you’ll know that when I finish setting up my neural networks, I usually optimize them using a genetic algorithm. Now, up to this point, I’ve only used the genetic algorithm to work on Sklearn models; with usually 200 neural nets at a time.
However, work has required me to adapt this algorithm to a recurrent neural network, an LSTM (long short-term memory) to be exact. This being a deep learning model, it was a given that training will span from anywhere between 20 mins (for one neural net) to a couple of days. And that is exactly what started to happen when I ran the genetic algorithm.
Imagine training 20 LSTM models over 10 generations! 12 to 14 hours after I started running it, I found out that I was barely 10% into the 1st generation. This pushed me to look for an alternative. I didn’t want to go through the usual Google, AWS, etc. options, since I just really needed something for rapid prototyping.
After around 20 minutes of googling, I stumbled upon Floydhub.com. According to the website,
Honestly, I think it’s a mix of Heroku and Github. I was drawn to this because you could run this using Terminal (I use a Mac, remember?). It was also very simple to use. It can run normal python scripts and Jupyter notebooks.
At the time of signing up, I got 2 hours worth of GPU run time. I knew this wasn’t going to be enough, but I needed a little bit more convincing before I sign up for a pay-as-you-go account.
Lo and behold, after setting up my directory (kinda like how you set up Github repos) and running a Jupyter notebook (it looks and feels exactly like a normal Jupyter notebook, minus the LOUD FAN NOISE), the genetic algorithm started eating over hundreds of epochs and several neural nets. So much so, that in about 20 mins, I had already overtaken the progress that I had achieved using my local CPU, which had been running for more than 14 hours.
Because I am very satisfied with the whole experience (from setting up to the actual training), I decided to share more details about this neat little GPU platform on the cloud.
Installing Floydhub using Terminal:
Logging into Floydhub:
Initializing the project:
Before initializing the directory, I had to create a project on the dashboard in my Floydhub account. Afterwards, all I had to do was run this command on my Terminal.
Make sure to have your dataset in the directory.
Creating the floyd-requirements.txt (list of required dependencies):
Take note of the environment code that I used: tensorflow-1.2:py2. I had to append the “:py2” because Floydhub runs on Python 3 by default. This environment already has Keras (which is what I’m using for this model). If you’re using other environments, you can check this page out.
Plans and Rates:
These are as of August 28, 2017. Check here for more updated rates.