TypeError: 'int' object is not callable on fine_tune of text_classifier_learner

Hi guys, I’ve searched in the forums and online, with no solution.

I’m training a text classifier, it seems to randomly error with this message. I cannot figure out what is going wrong. The dataset is over 2,500 records.

Here’s the error:

    TypeError                                 Traceback (most recent call last)
<ipython-input-28-70ad27f71db1> in <module>()
      1 learn = text_classifier_learner(dls, AWD_LSTM, drop_mult=0.5, metrics=accuracy)
      2 
----> 3 learn.fine_tune(12, 1e-2)

19 frames
/usr/local/lib/python3.7/dist-packages/fastai/learner.py in accumulate(self, learn)
    415     def accumulate(self, learn):
    416         bs = find_bs(learn.yb)
--> 417         self.total += learn.to_detach(self.func(learn.pred, *learn.yb))*bs
    418         self.count += bs
    419     @property

TypeError: 'int' object is not callable

Here’s the code:

dls = TextDataLoaders.from_df(df_train, text_col='CONTENT', label_col='CLASS', valid_pct=0.15)
learn = text_classifier_learner(dls, AWD_LSTM, drop_mult=0.5, metrics=accuracy)
learn.fine_tune(12, 1e-2)

Any help would be much appreciate, blocked :frowning:

This may not be much help: have you tried to run learn.summary()?

You can run it on Datablocks, too. But I have no idea if there is someting similar for Dataloards… But you could try to run dls.show_batch(), and see if that looks reasonable.