TypeError: ufunc 'add' for lesson3-imdb

When I try to run:

data_lm = (TextFilesList.from_folder(path)                           
           #Inputs: all the text files in path
            .filter_by_folder(include=['train', 'test']) 
           #We may have other temp folders that contain text files so we only keep what's in train and test
            .random_split_by_pct(0.1)
           #We randomly split and keep 10% (10,000 reviews) for validation
            .label_for_lm()           
           #We want to do a language model so we label accordingly
            .databunch())

I get:

TypeError: ufunc β€˜add’ did not contain a loop with signature matching types dtype(’<U32’) dtype(’<U32’) dtype(’<U32’)```

image

Any suggestions?

1 Like

NVM!! just a nb code glitch - working now…

I think that was a particular version of numpy. Try conda install numpy

1 Like

I’m still getting this error whenever I try to load from unstructured .txt files.

from fastai.text import TextList
data = (TextList.from_folder('.')
 .random_split_by_pct()
 .label_for_lm()
 .databunch())
  • Python 3.7.0
  • fastai-1.0.38
  • numpy-1.15.4

EDIT I created a new virtual environment and now it’s working :man_shrugging: