Hello there!
I used this code for installation:
git clone https://github.com/fastai/fastai.git
cd fastai
conda env create -f environment.yml
Now I run imdb notebook and when I came to this line:
Tokenizer().process_all(texts)
I got this error:
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-21-51e26f4b98a3> in <module>
----> 1 tok_trn, trn_labels = get_all(df_trn, 1)
2 tok_val, val_labels = get_all(df_val, 1)
<ipython-input-19-2580616f3669> in get_all(df, n_lbls)
3 for i, r in enumerate(df):
4 print(i)
----> 5 tok_, labels_ = get_texts(r, n_lbls)
6 tok += tok_;
7 labels += labels_
<ipython-input-18-8adcf082b5c5> in get_texts(df, n_lbls)
6
7 # tok = Tokenizer().proc_all_mp(partition_by_cores(texts))
----> 8 tok = Tokenizer().process_all(texts)
9 return tok, list(labels)
NameError: name 'Tokenizer' is not defined
I found that I need to import fastai.text to resolve this error but I don’t know how to install it!(It is not mentioned as dependencies on conda installation)
In the first line of notebook there is a description:
[quote=“amsali, post:72, topic:24652, full:true”]
Hello there!
I used this code for installation:
git clone https://github.com/fastai/fastai.git
cd fastai
conda env create -f environment.yml
Now I run imdb notebook and when I came to this line:
Tokenizer().process_all(texts)
I got this error:
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-21-51e26f4b98a3> in <module>
----> 1 tok_trn, trn_labels = get_all(df_trn, 1)
2 tok_val, val_labels = get_all(df_val, 1)
<ipython-input-19-2580616f3669> in get_all(df, n_lbls)
3 for i, r in enumerate(df):
4 print(i)
----> 5 tok_, labels_ = get_texts(r, n_lbls)
6 tok += tok_;
7 labels += labels_
<ipython-input-18-8adcf082b5c5> in get_texts(df, n_lbls)
6
7 # tok = Tokenizer().proc_all_mp(partition_by_cores(texts))
----> 8 tok = Tokenizer().process_all(texts)
9 return tok, list(labels)
NameError: name 'Tokenizer' is not defined
I found that I need to import fastai.text to resolve this error but I don’t know how to install it!(It is not mentioned as dependencies on conda installation)
Can anybody help?
Thanks.
At Fast.ai we have introduced a new module called fastai.text which replaces the torchtext library that was used in our 2018 dl1 course. The fastai.text module also supersedes the fastai.nlp library but retains many of the key functions.
So fastai.text is introduced in version 1 but the imdb script is meant to be run on v0.7.
the notebooks under courses/*/*.ipynb
currently still work with the v0.7 code base
Can anybody help?
Thanks.