Lab 1: Warmup

Objectives

Step 1: Create your portfolio repo

Go to this GitHub Classroom link and follow the instructions.

We’re only using GitHub Classroom to get you set up with a repo quickly. You don’t need to save the classroom link, just your repo.

Step 2: Setup your Environment

You have a choice between several different ways to run your code

  1. Use the lab computers. Pro: all the software is installed; you can use nice tools like VS Code. Con: you need to be physically in the lab. (Guacamole remote access is limited and doesn’t have good GPUs.)
  2. Use a cloud provider, like Kaggle or Google Colab. Pro: can run things anywhere, with decent GPUs. Con: availability may be limited if servers are busy; Git integration is not as refined.
  3. Set things up on your laptop. Some things might be quite slow if you don’t have a GPU configured. But you’ll be able to use your own filesystem, and you’ll have everything with you when you come to class.

Setup on Lab Computers

  1. Boot the computer to Linux and log in.
  2. Open a Terminal (main menu in top-left, start typing “term” and it should show up)
  3. Practice using tab-complete: type /home/cs/344/set and press the Tab key. You should get /home/cs/344/setup-cs344.sh. Run that script.
  4. Log off and log back in.

Setup on Kaggle or Colab

See https://course.fast.ai/Lessons/lesson1.html#how-to-complete-lesson-1.

You’ll need to “Link to GitHub” (on the File menu). When you do so, make sure that you allow the Colab or Kaggle app to access the Calvin-CS344 organization:

(If you don’t see this option, check for an email from GitHub inviting you to join the organization.)

If you don’t get a prompt for this as part of the linking process, go to https://github.com/settings/applications and Grant the access there.

If you get an ImportError, add a code chunk at the top of your notebook containing:

try:
    import fastai
except ImportError:
    !pip install -Uqq fastai

Step 2: Jupyter Notebooks

In this section, we’ll practice working with Jupyter notebooks. You may find these references helpful:

On a lab computer, clone your Portfolio repo. The easiest way is to start VS Code, launch the command palette (Ctrl-Shift-P), and type Clone.

You can run your notebook code within VS Code, or if you prefer a simpler interface, you can use Jupyter. You can start the Jupyter Notebook server either by finding it on the main menu (start typing “jup” and it should come right up) or running jupyter notebook in a Terminal window.

Run the Environment Check cells by selecting the first one and pressing Shift-Enter once for each cell. Stop when you get to “Jupyter Notebooks”. A number will appear next to each of the code cells when they have run successfully.

Note carefully the difference between Command mode and Edit mode. (see Help->Keyboard shortcuts).

I highly encourage you to get comfortable with keyboard shortcuts for the following operations:

When you’re done:

Image Classifier

In the next section, you’ll work with the image classifier code from Chapter 1 of the textbook.

Although the original was famously short, it was inhospitably jam-packed. So I’ve taken the liberty to space things out a bit and split it into multiple cells.

In this section (and most future Labs), the tasks to do are inside the notebook itself. You’ll find cells labeled Task and blank code chunks usually labeled # your code here. Follow the instructions top-to-bottom, then Save-Commit-Push when you’re done.

Note: If you experience an “out of memory error”:

  1. Check that you don’t have another notebook already running (if you’re not sure, log off and log back in).
  2. “Restart and Run All” on the Kernel menu.

You may find the following to be helpful references:

Discussion 1: What's AI useful for?