Unable to make the QuickStart exercise work


I have started the course and when trying to run the QuickStart exercise, I get a loss value of “nan”: This is the code:

(I previously run the untar command so the files are already in the specified path)
The output is this:

Can anyone see what I am missing?

Thank you in advance!

Forcing CPU fixes the issue. Unfortunately, it runs quite slow, but at least I am unblocked now.

1 Like

I see your platform is Windows. If its Windows 10 or 11, you’ll probably have more success with WSL. Check out Live-coding (aka walk-thrus) ✅.

Or actually, in the course Jeremy suggests using a cloud service to focus on machine learning rather than becoming an expert sysadmin. I’ve enjoyed Paperspace using this setup.


Hi bencoman, sorry for the late reply, and thank you for your tip. I have been busy with other projects and could not get back to this until now. I have actually installed WSL2 in Windows 11 and now I am being able to run the notebooks in VSCode. I was interested in having this setup since I am also practicing with Tensorflow so I now have the two virtual environments working. In case someone is trying to achieve the same result, here is what I did:

  1. Installed WSL2 and Ubuntu distro
  2. Enabled WSL in VS Code: Work in Windows Subsystem for Linux with Visual Studio Code
  3. Followed these instructions to enable GPU support on WSL2.
  4. bash setup-conda.sh (file downloaded from GitHub - fastai/fastsetup: Setup all the things)

  5. Close and reopen terminal
  6. mamba init

  7. Close and reopen terminal
    For creating the Fastai environment:
  8. mamba create -n fastai

mamba activate fastai
mamba install python=“3.9”

  1. Installed pytorch. I chose a combination of python, torch and cuda compatible with torchvision 0.12 which seems the version used in the notebooks (higher versions will throw errors in many course notebooks):

mamba install pytorch==1.11.0 torchvision==0.12.0 torchaudio==0.11.0 cudatoolkit=10.2 -c pytorch

  1. mamba install jupyterlab

  2. mamba install -c fastchan fastbook sentencepiece

  3. mamba install ipywidgets

Daily use: Open VSCode, “Open folder” containing the fastai jupyter notebooks. Open a notebook and set the kernel to “fastai”. The Kernel used will be remembered for that file the next time you open it

Still some of the cells will give errors because apparently the fastbook jupyter notebooks seem to have been created for an even older version than the one I am using, but I could fix all errors I found so far and looks like everything else is working fine.

For the record I have a Geforce 1060 with 6Gb

1 Like