utterworks / fast-bert

Super easy library for BERT based NLP models
Apache License 2.0
1.86k stars 341 forks source link

Exception has occurred: TypeError object of type 'NoneType' has no len() in learner_cls.py when do Model inference #321

Open ruianlc opened 5 months ago

ruianlc commented 5 months ago

when load the local trained model, and do the model inference based on the given example, error occurs, below is the full information. anyone can helps, thanks.

Exception has occurred: TypeError object of type 'NoneType' has no len() File "E:\workspace\baseProject\code_repo\competitions\FastBERT-MutliLabel Text Classification\fast-bert\fast_bert\learner_cls.py", line 344, in init t_total = len(train_dataloader) // self.grad_accumulation_steps * epochs File "E:\workspace\baseProject\code_repo\competitions\FastBERT-MutliLabel Text Classification\fast-bert\fast_bert\learner_cls.py", line 245, in from_pretrained_model return BertLearner( File "E:\workspace\baseProject\code_repo\competitions\FastBERT-MutliLabel Text Classification\fast-bert\fast_bert\prediction.py", line 66, in get_learner learner = BertLearner.from_pretrained_model( File "E:\workspace\baseProject\code_repo\competitions\FastBERT-MutliLabel Text Classification\fast-bert\fast_bert\prediction.py", line 46, in init self.learner = self.get_learner() File "E:\workspace\baseProject\code_repo\competitions\FastBERT-MutliLabel Text Classification\fastbert-multilable.py", line 141, in predict predictor = BertClassificationPredictor( File "E:\workspace\baseProject\code_repo\competitions\FastBERT-MutliLabel Text Classification\fastbert-multilable.py", line 164, in predict() TypeError: object of type 'NoneType' has no len()