Saving and reloading sentiment model on local drive?
Hi there,I’ve been going through this tutorial :Getting Started with Sentiment Analysis using Pythondata = [“I love you”, “I hate you”]// trained the modeltrainer.train()trainer.evaluate()// saved the model on local drivemodel_dir = ‘E:/ken/huggingFaceModels/’trainer.save_model(model_dir + ‘fine_tune_sentiment/model’)// tried to reload the modelfrom transformers import DistilBertForTokenClassification, DistilBertConfig, AutoModelForTokenClassificationmdl = DistilBertForTokenClassification.from_pretrained(model_dir + ‘fine_tune_sentiment/model’, local_files_only=True)// apply reloaded model to datamdl(data)I get the following error message. I’m thinking that it is a different function that is required to reload a sentiment model?// Error messageTraceback (most recent call last):Input In [50] in <cell line: 1>mdl(data)File ~\anaconda3\lib\site-packages\torch\nn\modules\module.py:1194 in _call_implreturn forward_call(*input, **kwargs)File ~\anaconda3\lib\site-packages\transformers\models\distilbert\modeling_distilbert.py:990 in forwardoutputs = self.distilbert(File ~\anaconda3\lib\site-packages\torch\nn\modules\module.py:1194 in _call_implreturn forward_call(*input, **kwargs)File ~\anaconda3\lib\site-packages\transformers\models\distilbert\modeling_distilbert.py:563 in forwardinput_shape = input_ids.size()AttributeError: ‘list’ object has no attribute ‘size’