Running fastai & jupyter on a Jetson Nano

I’m starting the fastai course and I thought it would be nice to be in control of the hardware needed to run the notebooks. I tried using Google’s colab and it’s quite cumbersome and slow and I have some experience with the nano platform so I thought I might give it a try.

I know @Interogativ posted here some instructions for setting it up
However the instructions are quite old and accordingly the version of pytorch and fastai are old.

I opted instead to base my setup on the more recent jetcard setup - an SD card image which includes jupyter and pytorch,

I installed fastai on top of it (just pip3 install fastai) and I can import fastai.
However, the first notebook from the course does not run.
In particular, the first cats example gives me an error:

from fastai.vision.all import *
path = untar_data(URLs.PETS)/'images'

def is_cat(x): return x[0].isupper()

dls = ImageDataLoaders.from_name_func(
    path, get_image_files(path), valid_pct=0.2, seed=42,
    label_func=is_cat, item_tfms=Resize(224))

learn = cnn_learner(dls, resnet34, metrics=error_rate)

learn.fine_tune(1)

I tried running it in a standalone file and I’m getting a similar result to what I’m getting in the notebook:

Could not do one pass in your dataloader, there is something wrong in it

Then the standalone version core-dumps:

Illegal instruction (core dumped)

No additional information is available, either in the standalone script or in the jupyter notebook.
I assume such a cheap standalone setup would be useful to others. If I could only get this to work…

My installed packages are:

% pip3 freeze | grep -E 'torch|fastai'
efficientnet-pytorch==0.6.3
fastai==2.4
segmentation-models-pytorch==0.1.3
torch==1.9.0
torch2trt==0.2.0
torchvision==0.10.0

Ideas for how to proceed would be welcome

Never used Jetson nano before, but maybe you have a hardware issue? What happens when you run this:

import torch
torch.has_cuda

torch.has_cuda is False :frowning:

Have you tried installing the pytorch wheel from:
PyTorch for Jetson - version 1.9.0 now available - Jetson Nano - NVIDIA Developer Forums ?

trying now…

Just to close the loop here. I spend hours on trying to install fastai & fastbook on a jetson nano, without success :frowning:
This is sad as running in colab is really slow and frustrating.

Took a bit of wrestling on a TX2, but it seems to run without errors so far. Tried initially using a venv and a container with both Python3.6 & 3.8 ==> error: illegal instruction core dump.

Went back to installing as user on the host. Much prefer a venv or container, but at least its working. Need to build a number of the packages/whl from source. Here is the gist of the steps I performed to get it working. Install and access FastAI course locally on a Nvidia Jetson natively as user · GitHub

Hope that helps