Show_batch() and language_model_learner() errors


I am trying to replicate the code in course-v3 lesson3-imdb.ipynb
For the moment, with no changes. However, I come across two problems. First, data.show_batch() raises

RuntimeError: Could not infer dtype of numpy.int64

The data itself seems fine, so I tried moving on, but trying to create a learner also raises an error:

RuntimeError: you can only change requires_grad flags of leaf variables. If you want to use a computed variable in a subgraph that doesn’t require differentiation use var_no_grad = var.detach().

This error has prevented me from moving further. Could this be a conflict between fastai versions? Right now my machine has


Thanks for your help!


You don’t have pytorch 1.0, which is required for fastai v1, that’s why you get those issues.

1 Like

Fantastic! I’ll update right away. Is there a file with all the requirements that I need for Fastai v1? In case some other dependency has the wrong version!

You should follow the instructions here.


Again, thanks for the help.

I think fastai requirements may need updating: If I pip install fastai I get an older version of PyTorch! Of course, it is very easy to manually make sure to get the updated version, but to avoid trouble in the future. I also had to install IPython to get things going, so maybe this should also go into the requirements?

Related to my question: Show_batch is intended for Jupyter, if I am not mistaken, so from console it only produces <IPython.core.display.HTML object>. Is there an easy way to get to the data, similarly to what they do here?