# Failed to save model and tokenizer with .save\_pretrained()

**URL:** <https://discuss.huggingface.co/t/failed-to-save-model-and-tokenizer-with-save-pretrained/91968>\
**Category:** Azure ML Studio Model Catalog\
**Created:** [June 13, 2024, 11:50am UTC](https://discuss.huggingface.co/t/failed-to-save-model-and-tokenizer-with-save-pretrained/91968 "2024-06-13T11:50:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![IngoTB303](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/ingotb303/32/28183_2.png) [@IngoTB303](https://discuss.huggingface.co/u/IngoTB303)\
**Post date:** [June 13, 2024, 11:50am UTC](https://discuss.huggingface.co/t/failed-to-save-model-and-tokenizer-with-save-pretrained/91968/1 "2024-06-13T11:50:28Z")

</div>

Hi there,

I’m a kind of beginner with Azure Databricks. I have a Standard\_NC4as\_T4\_v3 singlenode compute engine with Databricks. I successfully loaded a model from the hub with .from\_pretrained() and did some inference.  
While using the .save\_pretrained() method to store the model, e.g. “model.save\_pretrained(”/Workspace/…/model\_folder/“)” I get the error message “SafetensorError: Error while serializing: IoError(Os { code: 27, kind: FileTooLarge, message: “File too large” })”.  
When I additionally use the parameter “max\_shard\_size=xxxMB” it saves only the last chunk of the tensors.

Any ideas?

Thanks and cheers,  
Ingo

---

<div class="post-metadata">

**Author:** ![Rasputin312](https://avatars.discourse-cdn.com/v4/letter/r/258eb7/32.png) [@Rasputin312](https://discuss.huggingface.co/u/Rasputin312)\
**Post date:** [February 7, 2025, 10:30pm UTC](https://discuss.huggingface.co/t/failed-to-save-model-and-tokenizer-with-save-pretrained/91968/2 "2025-02-07T22:30:29Z")

</div>

Did you happen to get an answer to this? I am trying to save to an ML Flow run in databricks and I am getting this message.

---

<div class="post-metadata">

**Author:** ![Vinc01](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/vinc01/32/46530_2.png) [@Vinc01](https://discuss.huggingface.co/u/Vinc01)\
**Post date:** [April 28, 2025, 9:17pm UTC](https://discuss.huggingface.co/t/failed-to-save-model-and-tokenizer-with-save-pretrained/91968/3 "2025-04-28T21:17:23Z")

</div>

Hi Ingo, avoid saving models in the Workspace since they have a 500 MB limit and it will eventually result in issues when using Git Folders.. Instead, save them to DBFS or mounted storage, by running model.save\_model(“/dbfs/…”). Hope this helps:)

---

<div class="post-metadata">

**Author:** ![IngoTB303](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/ingotb303/32/28183_2.png) [@IngoTB303](https://discuss.huggingface.co/u/IngoTB303)\
**Post date:** [April 29, 2025, 4:34am UTC](https://discuss.huggingface.co/t/failed-to-save-model-and-tokenizer-with-save-pretrained/91968/4 "2025-04-29T04:34:29Z")

</div>

Hi, thanks. I got it running by saving it to a volume mount in my unity catalog. Best regards, Ingo
