# How to save custom model to get config.json file

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-save-custom-model-to-get-config-json-file%2F63665%3E%5C
**Category:** Beginners\
**Created:** [November 27, 2023, 8:15am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-save-custom-model-to-get-config-json-file%2F63665 "2023-11-27T08:15:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![nnhwin](https://avatars.discourse-cdn.com/v4/letter/n/c0e974/32.png) [@nnhwin](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fnnhwin)%5C
**Post date:** [November 27, 2023, 8:15am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-save-custom-model-to-get-config-json-file%2F63665%2F1 "2023-11-27T08:15:33Z")

</div>

Hello experts,

I am trying to write BERT model with my own custom model (adding layer end of BERT).It goes well and I would like to save model to avoid future training. I am using trainer API and so, there are two ways to save model, right?

1. training\_arugments and trainer (save the model under a folder)  
trainging\_arguements + trainer  
training\_args = TrainingArguments(  
output\_dir=“./sentiment\_transformer/”,  
logging\_dir=‘./sentiment\_transformer/logs’,  
logging\_strategy=‘epoch’,  
logging\_steps=10,  
num\_train\_epochs=1,  
per\_device\_train\_batch\_size=4,  
per\_device\_eval\_batch\_size=4,  
learning\_rate=5e-6,  
seed=42,  
save\_strategy=‘epoch’,  
save\_steps=100,  
evaluation\_strategy=‘epoch’,  
eval\_steps=100,  
load\_best\_model\_at\_end=True  
)

This type of saving cannot save config.json although other files can be saved. If I am saving model with only BERT model without adding any layers, it can save all files including json.config.

1. trainer.save\_model("/folder)

This also cannot save json.config file.

So, the question is how can we get all completed saved information for custom model ?? because without config.json file we cannot load and reuse the model again. Is there any way to save all included files for custom model saving.

Your suggestions will be highly appreciated how to save the custom model.

---

<div class="post-metadata">

**Author:** ![saeed899](https://avatars.discourse-cdn.com/v4/letter/s/3da27b/32.png) [@saeed899](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fsaeed899)%5C
**Post date:** [October 20, 2024, 8:57am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-save-custom-model-to-get-config-json-file%2F63665%2F2 "2024-10-20T08:57:09Z")

</div>

same question

---

<div class="post-metadata">

**Author:** ![John6666](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/john6666/32/27664_2.png) [@John6666](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FJohn6666)%5C
**Post date:** [October 20, 2024, 1:04pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-save-custom-model-to-get-config-json-file%2F63665%2F3 "2024-10-20T13:04:54Z")

</div>

It is most reliable if `save_pretrained()` can be used.

> <https://stackoverflow.com/questions/72108945/saving-finetuned-model-locally>
