Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

start_sagemaker.md 7.6 KB

You have to be logged in to leave a comment. Sign In
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.

Pricing

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.

Getting Set Up

Accessing SageMaker

  1. 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.

    stop

    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.

  2. Once you have an account and are logged in, click Services in the top bar, and type 'sagemaker'. You can then click Amazon SageMaker.

    sage

Configuring your notebook instance

  1. 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.

    lifecycle config
  2. Click Create configuration.

    create config
  3. Enter fastai as the name.

    fastai
  4. In the Scripts section, click Start notebook.

    create
  5. 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
    
  6. 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!

    create
  7. 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 &';
    
    script
  8. Click Create configuration..

    create
  9. On the left navigation bar, choose Notebook instances. This is where we create, manage, and access our notebook instances.

    notebook instance
  10. Click Create notebook instance.

    create nb instance
  11. Enter fastai in the name, and in the instance type field choose ml.p2.xlarge.

    choose ml.p2
  12. In the IAM Role section, choose to create a new role, then select None for S3 buckets, and choose Create role.

    role
  13. In the Lifecycle configuration section, choose the fastai configuration you created earlier.

    config
  14. In the Volume Size in GB - optional section, enter a volume size between 15 and 25 GB (we recommend 25 GB).

    config
  15. Check that your selections now look like this:

    summary
  16. Once it's entered correctly, click Create notebook instance at the bottom of the screen.

    click
  17. You will receive a message that the instance is being created.

    message
  18. For around 5 minutes it will show as Pending and you will not be able to access it.

    pending

Accessing the notebooks

  1. After about 5 minutes it will show InService and you can click Open.

    in service
  2. 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.

    server
  3. After 15 minutes you should see a new course-v3 folder has appeared, amongst others.

    course
  4. Click on the course-v3 folder, and your screen should look like this:

    nb tuto
  5. On the upper right corner of your screen click on 'New' and 'Terminal'. A new window will open up.

    terminal

    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.

  6. 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

  7. 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.

Shutting down your instance

  • 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.

    stop

    To see how to open it again, update the course or the fastai library, go to the Returning to work page.

More help

For questions or issues related to course content, we recommend posting in the fast.ai forum.

Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...