# How to save RoBERTA sequence classifier model

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-save-roberta-sequence-classifier-model%2F6610%3E%5C
**Category:** 🤗Transformers\
**Created:** [June 7, 2021, 12:24am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-save-roberta-sequence-classifier-model%2F6610 "2021-06-07T00:24:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![srbnghosh99](https://avatars.discourse-cdn.com/v4/letter/s/fbc32d/32.png) [@srbnghosh99](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fsrbnghosh99)%5C
**Post date:** [June 7, 2021, 12:24am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-save-roberta-sequence-classifier-model%2F6610%2F1 "2021-06-07T00:24:53Z")

</div>

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’

---

<div class="post-metadata">

**Author:** ![sgugger](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/sgugger/32/2291_2.png) [@sgugger](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fsgugger)%5C
**Post date:** [June 7, 2021, 11:52am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-save-roberta-sequence-classifier-model%2F6610%2F2 "2021-06-07T11:52:32Z")

</div>

I’m not sure where you have gotten that `save_model` method but Transformers model don’t have it. They use `save_pretrained`.

---

<div class="post-metadata">

**Author:** ![srbnghosh99](https://avatars.discourse-cdn.com/v4/letter/s/fbc32d/32.png) [@srbnghosh99](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fsrbnghosh99)%5C
**Post date:** [June 19, 2021, 10:22am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-save-roberta-sequence-classifier-model%2F6610%2F3 "2021-06-19T10:22:21Z")

</div>

how can load the saved model?

---

<div class="post-metadata">

**Author:** ![osanseviero](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/osanseviero/32/38738_2.png) [@osanseviero](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fosanseviero)%5C
**Post date:** [June 19, 2021, 1:40pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-save-roberta-sequence-classifier-model%2F6610%2F4 "2021-06-19T13:40:40Z")

</div>

You can use the `from_pretrained` method.

You can find more about model sharing in [Model sharing and uploading — transformers 4.7.0 documentation](https://huggingface.co/transformers/model_sharing.html).
