How to save RoBERTA sequence classifier model

srbnghosh99
Mon, 07 Jun 2021 00:24:53 +0000

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)
in
1 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 in getattr(self, name)
945 if name in modules:
946 return modules[name]
→ 947 raise AttributeError(“‘{}’ object has no attribute ‘{}’”.format(
948 type(self).name, name))
949

AttributeError: ‘RobertaForSequenceClassification’ object has no attribute ‘save_model’