How to save RoBERTA sequence classifier model
After finishing the training phase, I want to save the RoBERTa classifier model for later evaluation purpose.I am getting this error.AttributeError                            Traceback (most recent call last)in1 out_model = “src_classifier_final_ICWSM_10e”----> 2 src_classifier.save_model(f’models/{out_model}_final’)~/.local/lib/python3.8/site-packages/torch/nn/modules/module.py ingetattr(self, name)945             if name in modules:946                 return modules[name]→ 947         raise AttributeError("’{}’ object has no attribute ‘{}’".format(948             type(self).name, name))949AttributeError: ‘RobertaForSequenceClassification’ object has no attribute ‘save_model’
2021-06-07T11:52:32Z
I’m not sure where you have gotten thatsave_modelmethod but Transformers model don’t have it. They usesave_pretrained.
2021-06-19T10:22:21Z
how can load the saved model?
2021-06-19T13:40:40Z
You can use thefrom_pretrainedmethod.You can find more about model sharing inModel sharing and uploading — transformers 4.7.0 documentation.