Fastai v1 namespace changes?

Which if any of the following lines of python are now wrong in fastai v1, due to library changes, and what is the exact correct new version of the line of code? Thank you so much. Please no generic responses like “read the manual.” If you don’t know answers that’s OK just stay quiet if possible. THank you so much.

from fastai.learner import *
import torchtext
from torchtext import vocab, data
from torchtext.datasets import language_modeling
from fastai.rnn_reg import *
from fastai.rnn_train import *
from fastai.nlp import *
from fastai.lm_rnn import *

The show_install(1) script reports everything is OK (see below). HOwever, it’s not really OK at all, because the imports above all throw exception regarding fail to load module. Is there in existence yet, a version-matched-to-fastai.v1 python script which runs all the imports in Jeremy’s notebooks, which can serve as a slightly more detailed diagnostic of installation status of the fastai stack of software? Or for starters I would just like confirmatin that the above code is still currently compatible with my versions shown below, if anyone knows. THanks for helping me get this train on the tracks.

My version information:

$ python -c ‘import fastai; fastai.show_install(1)’

=== Software === 
python version  : 3.6.6
fastai version  : 1.0.30
torch version   : 1.0.0.dev20181128
nvidia driver   : 384.145
torch cuda ver  : 8.0.61
torch cuda is   : available
torch cudnn ver : 7102
torch cudnn is  : enabled

=== Hardware === 
nvidia gpus     : 1
torch available : 1
  - gpu0        : 8112MB | GeForce GTX 1080

=== Environment === 
platform        : Linux-4.4.0-139-generic-x86_64-with-debian-stretch-sid
distro          : #165-Ubuntu SMP Wed Oct 24 10:58:50 UTC 2018
conda env       : py36
python          : /home/ga/anaconda3/envs/py36/bin/python
sys.path        : 
/usr/local/spark/python/lib/py4j-0.10.6-src.zip
/usr/local/spark/python
/mnt/fastssd/bot_subreddit_recom
/home/ga/anaconda3/envs/py36/lib/python36.zip
/home/ga/anaconda3/envs/py36/lib/python3.6
/home/ga/anaconda3/envs/py36/lib/python3.6/lib-dynload
/home/ga/anaconda3/envs/py36/lib/python3.6/site-packages
/home/ga/anaconda3/envs/py36/lib/python3.6/site-packages/urllib3-1.12-py3.6.egg
/home/ga/anaconda3/envs/py36/lib/python3.6/site-packages/IPython/extensions

Wed Nov 28 12:39:20 2018       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 384.145                Driver Version: 384.145                   |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce GTX 1080    Off  | 00000000:41:00.0 Off |                  N/A |
|  0%   42C    P0    46W / 240W |     10MiB /  8112MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|  No running processes found                                                 |
+-----------------------------------------------------------------------------+

fastai v1 is basically fully incompatible with the old fastai (0.7) almost all apis have changed. You are simply trying to use it as a drop in replacement, doing all imports as before, which cannot work. You seem to be trying to do nlp, IIRC fastai does not even use torchtext anymore. Check out this simple textbased example with new api:

Also if you want to know what libraries the new fastai v1 uses look at the setup.py file in the repo, it lists all requirements (other than pytorch and torchvision, which have to be installed separately).
And even if you don’t want to hear it, the new docs are very good:

https://docs.fast.ai/text.html

Are you sure that’s how Jeremy Horton was trying to use it? JH gave us this code in his 2018 lecture for Deep Learning 1.

As for me, no, I’m not trying that.

Trying to do NLP? Yes, I am doing that. I need to train a new LM from a totally different corpus, but following very similar steps to model presented in DL1-module4.

What’s a better match to the current fastai code: jeremy’s 2018 course notebooks, or that docs page? How would I know? Maybe the links you gave have more current information than Jeremy’s 2018 notebooks, not sure. None of the links or notebooks or course videos or docs web pages bother to print the library versions they were written to be compatible with unfortunately, e.g., np.version(). Doing so could go a long way to clearing up what version of the library the example code is using. You might happen to be the authoritative source for all the information, but I can’t tell if you are. I don’t know you. So maybe you can provide citations when you make claims, and you did provide some links, which I’ll look at.

I don’ really know why I am still even “talking” to you really. And I am definitely not an authority on anything here. But I can read :wink:

Note for course.fast.ai students

If you are using fastai for any course.fast.ai course, you need to use fastai 0.7 . Please ignore the rest of this document, which is written for fastai v1 , and instead follow the installation instructions here.

This is at the top of the fastai repo (https://github.com/fastai/fastai)

And by the way, Jeremy’s Lastname is not Horton.

I’m not a student.

OK you left some good clues. But to the point, v1 is what I shall prefer over v 0.7.

Thanks for sharing

@mrcoder if you are not ready to contribute to these forums in a respectful manner please do not come back. You are the first and only person of the >10,000 people that have signed up to these forums that I have made this suggestion to. That is not an achievement to be proud of.

2 Likes