I’m trying to go through the collision avoidance notebook, which I acces through the jupyterlab server running on the Nano (just like stated in the setup tutorial).
Everything worked just fine until I got to the live_demo_resnet18.ipynb notebook. I can run the first two cells in the notebook and load in my trained model with torch, but when I get to the thord cell, which is:
device = torch.device(‘cuda’)
model = model.to(device)
model = model.eval().half()
I get the following error message:
NameErrorTraceback (most recent call last)
----> 1 device = torch.device(‘cuda’)
2 model = model.to(device)
3 model = model.eval().half()
NameError: name ‘torch’ is not defined
Which I can’t understand, because I get that it means that either torch is not installed or it isn’t imported into the script, but since torch is installed on the Nano (I can import it from the command line on the device) and it is imported into the script in the very first cell of this notebook…I truly feel myself a bit lost.
I noticed something, which can be important in solving my problem, after I execute the second cell of the notebook, which is:
the kernel says Busy -> Restarting -> Idle which is quite strange I don’t understand why does it need to restart. Perhaps that’s the point where it forgets that torch was already imported into the script? If this is the case how can I prevent it from restarting?
The link to this notebook: https://github.com/NVIDIA-AI-IOT/jetbot/blob/master/notebooks/collision_avoidance/live_demo_resnet18.ipynb
I’m using the JP 4.4.1 SDK
Thanks in advance!