Lesson2-sgd notebook error: Can't call numpy() on Variable that requires grad

lesson2-sgd notebook gets an error for the following cell:

plt.scatter(x[:,0],y)
plt.scatter(x[:,0],x@a);

The last line of the long traceback says:

RuntimeError: Can't call numpy() on Variable that requires grad. Use var.detach().numpy() instead.

I am using the Paperspace + Fast.AI 1.0 (V3) container and followed the setup instructions and the instructions for returning to work.

Installation details:

== Software ===
python        : 3.6.7
fastai        : 1.0.60
fastprogress  : 0.2.2
torch         : 1.4.0
nvidia driver : 418.67
torch cuda    : 10.1 / is available
torch cudnn   : 7603 / is enabled

=== Hardware ===
nvidia gpus   : 1
torch devices : 1
  - gpu0      : 8126MB | Quadro M4000

=== Environment ===
platform      : Linux-4.15.0-72-generic-x86_64-with-debian-stretch-sid
distro        : #81~16.04.1-Ubuntu SMP Tue Nov 26 16:34:21 UTC 2019
conda env     : fastai
python        : /opt/conda/envs/fastai/bin/python
sys.path      :
/opt/conda/envs/fastai/lib/python36.zip
/opt/conda/envs/fastai/lib/python3.6
/opt/conda/envs/fastai/lib/python3.6/lib-dynload
/opt/conda/envs/fastai/lib/python3.6/site-packages
/opt/conda/envs/fastai/lib/python3.6/site-packages/IPython/extensions

Try making these changes:

https://github.com/fastai/course-v3/issues/455

1 Like

Thanks. That worked. I also created a PR to permanently fix the notebook here https://github.com/fastai/course-v3/pull/489

1 Like