Unsupport operand types(s) for +=: TensorCategory and TensorText

Hello -

I’ve run the following code below on a Mac and in Google Colab without issue, but on a different machine I’m running into a weird TypeError. I’m running anaconda 3.7 python, 2.1.6 fastai and 1.7.0 pytorch on a Mac, using a Jupyter Notebook. I run the following code, but the last line gives me an error:

dls_clas = TextDataLoaders.from_df(messages, path=data_path, text_col='message', label_col='is_happy', valid_pct=0.2, text_vocab=dls.vocab)
classify = text_classifier_learner(dls_clas, AWD_LSTM, drop_mult=0.5, metrics=accuracy)
classify.load_encoder('messages-awd.pkl')
classify.fit_one_cycle(1, 1e-2)
/anaconda3/lib/python3.7/site-packages/fastai/callback/rnn.py in after_loss(self)
     31 def after_loss(self):
     32    if not self.training: return
---> 33    if self.alpha != 0.: self.learn.loss += self.alpha * self.out.float().pow(2).mean()
     34    if self.beta != 0.:
     35        h = self.raw_out
TypeError: unsupported operand type(s) for +=: 'TensoryCategory' and 'TensorText'

Any hints what might be causing this and/or how to fix it?

I would recommend a quick forum search before asking if possible :slight_smile: This has been asked:

Also this has now been fixed, please update your fastai version :slight_smile:

1 Like

Ah, looks like it might have been resolved 13 minutes ago!