tmux + EC2 + deep learning

If you are training deep neural nets on AWS EC2 instances tmux can make you more efficient. It takes a long time to train these models and since you are connecting to your EC2 instance using ssh your interface is a single shell instance. The naive approach would leave you in a situation where you can’t do anything while your model is training. tmux helps solve this problem.

You may want to:

  1. Continue training your model after you disconnect from the EC2 instance.
  2. Launch TensorBoard and visualize your model while it is training.
  3. Look at some files your model creates while it is training such as images. (Since I don’t know of any way to view images on an EC2 instance I transfer them to my local computer with $ scp -i aws_key.pem ubuntu@EC2_IP_ADDRESS:~/PATH_TO_FILE_ON_EC2 ~/PATH_TO_FILE_ON_LOCAL).
  4. Do other stuff on the EC2 instance while your model is training.

tmux is already installed if your instance is running Ubuntu. If running Amazon Linux installing tmux is simple: $ sudo yum install tmux.

Then before you start training your model run:

$ tmux and you will enter a tmux session. Once in this session train your model as you normally would, for example: $ python train_model.py. Now you can leave the session with Ctrl + b and then d and you can re-enter the session with tmux attach. To end the session when you are done or want to stop training your model run: $ tmux kill-session.

This is a minimal guide to getting started w/ tmux & EC2. If you have any input/tips please comment and share w/ us!

About Waya.ai

Waya.ai is a company whose vision is a world where medical conditions are addressed early on, in their infancy. This approach will shift the health-care industry from a constant fire-fight against symptoms to a preventative approach where root causes are addressed and fixed. Our first step to realize this vision is easy, accurate and available diagnosis. Please get in contact with me if this resonates with you!