Note: This is a repost from my other blog.
Having started Fast.ai’s Practical Deep Learning for Coders course, the first thing I noticed is how much less structured it is than Andrew Ng’s Coursera Deep Learning Specialization (non affiliate link).
Fast.ai supplies you with the Jupyter notebooks needed for the assignments, but here a lot of the setup is down to you. At first I was a little frustrated by the extra work that Fast.ai was making me do. Then I came to the conclusion that it’s actually a good thing. In the first instance, the less controlled environment is better preparation for actual problems.
In the second, it means I can try doing the whole course via iPad. I’ve already noted that Jupyter in the browser is a pretty miserable experience on iPad. Happily there’s an excellent native Jupyter app called Juno, which solves that problem nicely. But a bit of extra work is needed to get it working well.
I decided to use Paperspace (Fast.ai’s recommended option) as my GPU cloud for this course. There are instructions for setting up Paperspace for fast.ai here. Once you’ve done that, your workflow will look something like this:
- Start your instance via the Paperspace console;
- Log in via ssh and start Jupytor;
- Copy the URL with the magic token;
- Paste it into your browser, replacing
localhostwith your instance’s public IP;
- Hack hack hack;
- Shut down your instance via the Paperspace console.
Step 3 and 4 don’t work so well for Juno, and step 2 is also pretty superfluous. We can eliminate these by turning on password authentication and automatically starting Jupyter on boot.
Password authentication comes first, which will make connecting via Juno a lot easier. I’m assuming you’ve followed the setup I linked to above. Start your instance and log in via the terminal. Now run this on the commend line:
jupyter notebook password
Then give it your chosen password. Next: run Jupyter on startup. Type this on the command line:
Now add this to the bottom of the file which opens:
@reboot cd /fastai; source /.bashrc; /anaconda3/envs/fastai/bin/jupyter notebook >>/cronrun.log 2>&1
Even though Jupyter will now start automatically, there are still reasons to log in. You’re going to need to download additional datasets, for one thing.
ssh would be the usual means of doing so, but from the iPad
mosh (short for “Mobile Shell”) is a more robust option. I’m using an app called Blink for that.
Paperspace machines are not set up to allow the ports mosh uses by default. So you’ll need to open one, like so:
sudo ufw allow 60001
After that mosh should work just fine.