i was thinking about language model and how it was able to predict next word.Now idea that struck me was will it be possible to get a score for sentence out of model for use in sentence comparison.
DataParallel is one of the first things I add to the notebook. I have had great success with it for images/camvid, but I am afraid it does not work for NLP. I noted this before, perhaps in a different thread.
Here it the error it throws on 1.0.27 which was the same for previous versions:
~/anaconda3/envs/course1018/lib/python3.6/site-packages/torch/nn/modules/module.py in __getattr__(self, name)
516 return modules[name]
517 raise AttributeError("'{}' object has no attribute '{}'".format(
--> 518 type(self).__name__, name))
519
520 def __setattr__(self, name, value):
AttributeError: 'DataParallel' object has no attribute 'reset'
I think fastai has nothing to do with this: it is pytorch stuff.
However, it could be worth to ask the developers (Jeremy, Sgugger, etc…) about such issues. AWD-lstm is truly a beast of RNN, it would be a shame not to use parallelization, it could completely hinder its usage on non-enterprise hardware.
data_clas = (TextList.from_folder(path, vocab=data_lm.vocab) # vocab is passed in from our pretrained model so that the numerialization is exactly the same of the same words
#grab all the text files in path
.split_by_folder(valid='test')
#split by train and valid folder (that only keeps 'train' and 'test' so no need to filter)
.label_from_folder(classes=['neg', 'pos'])
#remove docs with labels not in above list (i.e. 'unsup')
.filter_missing_y()
#label them all with their folders
.databunch(bs=bs))
data_clas.save(‘tmp_clas’)
I get
TypeError Traceback (most recent call last)
<ipython-input-25-ef1d6c6e4867> in <module>
3 .split_by_folder(valid='test')
4 #split by train and valid folder (that only keeps 'train' and 'test' so no need to filter)
----> 5 .label_from_folder(classes=['neg', 'pos'])
6 #remove docs with labels not in above list (i.e. 'unsup')
7 .filter_missing_y()
TypeError: 'bool' object is not callable
It loads for a bit then throws this. Any fix? I am using the latest version.
The collab notebook returns an error on te learner of the “use_nn” part . Replacing (min_sore=0., max_score=5.0.) with (y_range=(0.,5.)) repairs this error. (see also doc on collab_learner).
You can use both of them, it’s ok. But sometimes, since the code source of library changes quickly, the version of pypi (using pip) is not updated that fast. So when you use pip, maybe nothing happens.
you can follow all updated versions of pip in the site pypi/fastai. And with conda, here: conda/fastai
For an advice, I think conda way is preferred!