Are you sure you want to delete this access key?
title | keywords | sidebar |
---|---|---|
SageMaker | <nil> | home_sidebar |
This is a quick guide to starting v3 of the fast.ai course Practical Deep Learning for Coders using AWS SageMaker.
If you are returning to work and have previously completed the steps below, please go to the returning to work section.
NB: There is a temporary issue where data downloaded for training models, and saved models, are not saved after you shut down your instance. This will be resolved in a couple of weeks.
The instance we suggest, ml.p2.xlarge, is $1.26 an hour. The hourly rate is dependent on the instance type selected, see all available types here. You will need to explicitely request a limit request to use this instance, here Instances must be stopped to end billing.
Visit the AWS webpage and click on 'Sign In to the Console'. Next, enter your credentials if you are signing in or e-mail, account name and password if you need to sign up.
If you do not have an account, the button to press will say 'Sign up' instead of 'Sign in to the Console'. If you are signing up you will also need to set your credit card details. This will be the credit card to which all the charges of the instance usage will be applied (if you have free credits you will not be charged until they are over). Note that you will also need to provide a phone number that will be called to verify your identity.
Once you have an account and are logged in, click Services in the top bar, and type 'sagemaker'. You can then click Amazon SageMaker.
On the left navigation bar, choose Lifecycle Configurations. This is where we set up the script that will create your notebook instance for you, with all software and lessons preinstalled.
Click Create configuration.
Enter fastai as the name.
In the Scripts section, click Start notebook.
Paste the following to replace the script shown:
#!/bin/bash
set -e
echo "Creating fast.ai conda enviornment"
cat > /home/ec2-user/fastai-setup.sh << EOF
#!/bin/bash
cd /home/ec2-user/SageMaker
source activate envs/fastai
echo "Finished creating fast.ai conda environment"
ipython kernel install --name 'fastai' --display-name 'Python 3' --user
EOF
chown ec2-user:ec2-user /home/ec2-user/fastai-setup.sh
chmod 755 /home/ec2-user/fastai-setup.sh
sudo -i -u ec2-user bash << EOF
echo "Creating fast.ai conda env in background process."
nohup /home/ec2-user/fastai-setup.sh &
EOF
In the Scripts section, click Create notebook. NB: ensure you are in the Create notebook section, otherwise your instance will be reconfigured from scratch every time you start it!
Paste the following to replace the script shown:
#!/bin/bash
wget http://course-v3.fast.ai/setup/sagemaker;
chown ec2-user sagemaker;
chmod u+x sagemaker;
sudo -H -u ec2-user -i bash -c 'nohup ./sagemaker &';
Click Create configuration..
On the left navigation bar, choose Notebook instances. This is where we create, manage, and access our notebook instances.
Click Create notebook instance.
Enter fastai in the name, and in the instance type field choose ml.p2.xlarge.
In the IAM Role section, choose to create a new role, then select None for S3 buckets, and choose Create role.
In the Lifecycle configuration section, choose the fastai configuration you created earlier.
In the Volume Size in GB - optional section, enter a volume size between 15 and 25 GB (we recommend 25 GB).
Check that your selections now look like this:
Once it's entered correctly, click Create notebook instance at the bottom of the screen.
You will receive a message that the instance is being created.
For around 5 minutes it will show as Pending and you will not be able to access it.
After about 5 minutes it will show InService and you can click Open.
Your server is now downloading and installing software in the background. You won't be able to see the course notebooks yet. Go get a cup of tea, and come back in 15 minutes.
After 15 minutes you should see a new course-v3 folder has appeared, amongst others.
Click on the course-v3 folder, and your screen should look like this:
On the upper right corner of your screen click on 'New' and 'Terminal'. A new window will open up.
You will need to type the following commands to update the fastai library:
source activate SageMaker/envs/fastai
conda install -c fastai fastai
Once you have run these two commands close the terminal window.
When you start the notebook, if prompted (not expected if all is well) to select a kernel choose Python 3. If you aren't prompted, you can verify the kernel name on the top right hand side, you can change the attahed kernel through the menu Kernel > Change Kernel
Go back to the first page to see how to use this jupyter notebook and run the jupyter notebook tutorial. Come back here once you're finished and don't forget to stop your instance with the next step.
When you're done, close the notebook tab, and remember to click stop! If you don't, you'll keep getting charged until you click the stop button.
To see how to open it again, update the course or the fastai library, go to the Returning to work page.
For questions or issues related to course content, we recommend posting in the fast.ai forum.
Press p or to see the previous file or, n or to see the next file
Are you sure you want to delete this access key?
Are you sure you want to delete this access key?
Are you sure you want to delete this access key?
Are you sure you want to delete this access key?