If you find deep learning and the competencies that this technology will provide you with is exciting, you may have already heard that even the basic models you create will have a high calculation cost. Many researchers, who have recently started to work in this field, leave the advantages of deep learning to the big players because of the high hardware requirements. There are, however, a large number of free or low-cost resources that you can model and educate, and then easily grow and distribute. In this article, you’ll be stepping into an Amazon deep learning machine with pre-loaded deep learning libraries and GPU acceleration capabilities, by training your deep learning idea that you want to develop.
GPU vs CPU
CPU (Central Processing Unit) is the name given to the central processor unit on the motherboards. GPU (Graphics Processing Unit) is the name given to the processor of the video cards.
During the training phase of deep learning, your model will try to calculate a large number of matrix products with many other operations. Therefore, instead of specialized CPUs that are specialized in sequential computing and performance optimized; GPU units can accelerate this process with parallel / distributed architectures. The thousands of cores dedicated to simple math operations make GPUs the best choice for millions of operations required by your deep learning education.
Amazon Deep Learning AMIs (Amazon Machine Images)
Amazon deep learning machines are available in both Ubuntu and Amazon Linux versions. Your machine has the following advantages that you will create deep learning, without straining in a way that is already installed with the manual process offers:
- Popular Python packages and Anaconda platform
- Open source deep learning libraries (TensorFlow, Apache MXNet, Microsoft Cognitive Toolkit (CNTK), Caffe, Caffe2, Theano, Torch and Keras)
- GPU acceleration with CUDA, cuDNN drivers and Intel Math Kernel Library (MKL)
If you don’t have an AWS account, open the new account and enter the admin console. After searching “Deep Learning”, you can see the deep learning AMIs listed below. Continue selecting Deep Learning AMI (Amazon Linux) Version 5.0 “.
Machine Type Selection
Although the deep learning machines are free, it is useful to remind you that before you make your choice, the calculation units you will use will be charged. Take a look at the guidelines recommended by Amazon Web Services according to the needs of your deep learning model:
- If you are new in the field of deep learning, the machines with a GPU unit will probably be enough for you.
- If you have a budget concern, it is best to start by experimenting with machines that only contain CPUs.
- Using a model that is already trained may be more appropriate for your needs if you take the foresight by using a high-memory CPU machine, or even those clusters with high-volume machines can be more appropriate.
- However, if you have a deep learning model that you want to train by processing a large amount of data, the machine clusters with high GPU units will get you to your destination faster.
In this article, you can continue by selecting a t2.micro type, offered free of charge, because you will be able to stand up to a Jupyter server.
Before you start to operate your machine, you can download the digital key pair with pem extension to use when connecting later, and click “Launch Instance” button to lift your machine.
In a few minutes, you can view the status of your machine as “running” in the “Instances” tab with the details below.
Machine Security Settings
In the advanced stages, you need to change the security settings of your machine due to the Juypter server and the SSH connection you will contact via port 8888. Click the Security Group alan tab under the left-hand navigation of the Amazon console. Then to create a new group option under the “Inbound” portion will be enough to replace it with the following values.
Type : Custom
After changes, your security group should look like this:
Go to the location where your previous pem file is downloaded from your terminal and make sure that the key with the special pem extension is not clearly visible.
$ cd /Users/$your_user_name/Desktop/pem $ chmod 400 deep-learning.pem
Now connect the machine to your machine by replacing the $public_DNS part in the following block of code with the in public DNS values from the “Instances“ tab where you can see the machine details.
ssh -i "deep-learning.pem" ec2-user@$public_DNS
Launching the Jupyter server
First you need to activate the python3 components to run the Jupyter platform. Don’t worry if you have a commitment to python2 libraries in your project. Jupyter can meet these requirements in newly created files after starting.
$source activate python3
What you need to pay attention to here is that you should not allow the “token” value which is given to you, to be lost between the log lines.
Copy/paste this URL into your browser when you connect for the first time, to login with a token: http://localhost:8888/?token=$token
Because you will need this token values in the next steps to connect to the Jupyter server that you started on your machine.
Local Environment And Jupyter Server Connection
Open a new terminal window and run the following command line. (This command line works in MacOS environment, please visit AWS for different environments).
$ ssh -i "deep-learning.pem" -L 8157:127.0.0.1:8888 ec2-user@$public_DNS
After this step, you have created a tunnel between your environment and your AWS machine. Now go to http://127.0.0.1:8157 in your browser.
You can log in to your Jupyter server with this password after you have registered a new password with token.
Now you have a machine running on Amazon Web Services to use in your fun deep learning projects.