Training fails for language model and text classfier with numpy v1.16

I am using fastai v0.7 with numpy v1.15+ and noticed that my tests started to fail when numpy recently bumped to v1.16. The relevant part of the error look like this:

../../../virtualenv/python3.6.3/lib/python3.6/site-packages/fastai/ in fit
    return self.fit_gen(self.model,, layer_opt, n_cycle, **kwargs)
../../../virtualenv/python3.6.3/lib/python3.6/site-packages/fastai/ in fit_gen
    swa_eval_freq=swa_eval_freq, **kwargs)
../../../virtualenv/python3.6.3/lib/python3.6/site-packages/fastai/ in fit
    print_stats(epoch, [debias_loss] + vals)
../../../virtualenv/python3.6.3/lib/python3.6/site-packages/fastai/ in print_stats
    values = [epoch] + list(np.round(values, decimals))
../../../virtualenv/python3.6.3/lib/python3.6/site-packages/numpy/core/ in round_
    return around(a, decimals=decimals, out=out)
../../../virtualenv/python3.6.3/lib/python3.6/site-packages/numpy/core/ in around
    return _wrapfunc(a, 'round', decimals=decimals, out=out)
../../../virtualenv/python3.6.3/lib/python3.6/site-packages/numpy/core/ in _wrapfunc
    return _wrapit(obj, method, *args, **kwds)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
obj = [4.57860245691305, array([4.04758]), 0.24526315789473685]
method = 'round', args = (), kwds = {'decimals': 6, 'out': None}, wrap = None
    def _wrapit(obj, method, *args, **kwds):
            wrap = obj.__array_wrap__
        except AttributeError:
            wrap = None
>       result = getattr(asarray(obj), method)(*args, **kwds)
E       AttributeError: 'float' object has no attribute 'rint'
../../../virtualenv/python3.6.3/lib/python3.6/site-packages/numpy/core/ AttributeError

I can make do fine with pinning numpy to v1.15, but just wanted to put this out here for others.


I am facing the same. How did you resolve the error:

name ‘os_fspath’ is not defined

when entering the command

spacy_tok = spacy.load(‘en’)

Hi. I never really faced this problem. The tokenizer works fine for me.

@salmanmaq: I’ve run into a similar kind of issue. Could you kindly explain how you downgraded numpy to v.1.15+.
Thanks :slight_smile:

I use pip and virtualenv, so I just uninstalled numpy, and then did pip install numpy==1.15

1 Like

@salmanmaq Wish had read this earlier. Training failed after 4 hours. Any other version issues I can prevent ?

Thanks @salmanmaq :+1:

You can check out the version we use here:

Some of them are auxillary libraries for our application and don’t have much to do with fastai. I would mostly be concerned about numpy, torchtext, and spacy from the list.