# About model storage in spaces

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fabout-model-storage-in-spaces%2F146654%3E%5C
**Category:** Spaces\
**Created:** [March 20, 2025, 2:43pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fabout-model-storage-in-spaces%2F146654 "2025-03-20T14:43:38Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Senzen](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/senzen/32/35934_2.png) [@Senzen](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FSenzen)%5C
**Post date:** [March 20, 2025, 2:43pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fabout-model-storage-in-spaces%2F146654%2F1 "2025-03-20T14:43:38Z")

</div>

Hey I am building a sentiment classifier app which uses hugging faces Finbert model and few other transformer models. Would the model download the weights from hugging face every time I run the app in **spaces**. If yes then how do i upload the models to spaces?

---

<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:** [March 20, 2025, 3:29pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fabout-model-storage-in-spaces%2F146654%2F2 "2025-03-20T15:29:41Z")

</div>

If you are using a model you created yourself or a very old model, you will need to [use HfApi to download it](https://huggingface.co/docs/huggingface_hub/v0.29.3/guides/download), but in that case, you can download it when you need it by simply writing it as shown below.

```py
from transformers import AutoTokenizer, AutoModelForSequenceClassification

model = AutoModelForSequenceClassification.from_pretrained("ProsusAI/finbert") # this line downloads model weight
tokenizer = AutoTokenizer.from_pretrained("ProsusAI/finbert") # this line downloads tokenizer configuration

```

or

```py
from transformers import pipeline
pipe = pipeline("text-classification", model="ProsusAI/finbert") # this line downloads whole model weights and settings

```

> **[ProsusAI/finbert · Hugging Face](https://huggingface.co/ProsusAI/finbert)**
>
> We’re on a journey to advance and democratize artificial intelligence through open source and open science.

---

<div class="post-metadata">

**Author:** ![Senzen](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/senzen/32/35934_2.png) [@Senzen](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FSenzen)%5C
**Post date:** [March 20, 2025, 3:42pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fabout-model-storage-in-spaces%2F146654%2F3 "2025-03-20T15:42:32Z")

</div>

I get how to download these models. I have a query about if I launch my gradio app in spaces. It would download the models every time it loads. How should I upload my model to spaces ?

---

<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:** [March 20, 2025, 4:26pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fabout-model-storage-in-spaces%2F146654%2F4 "2025-03-20T16:26:33Z")

</div>

If you do from\_pretrained once, it should be cached, so there should be no problem even if you don’t think about it. If you really want to put the file on the Spaces disk, you can use snapshot\_download.

It used to be possible for us to put the model in the Spaces repository itself, but now you can only put up to a total of 1GB in the repository, so I don’t recommend uploading to the repository.

> **[Download files from the Hub](https://huggingface.co/docs/huggingface_hub/v0.29.3/guides/download#download-an-entire-repository)**
>
> We’re on a journey to advance and democratize artificial intelligence through open source and open science.

> **[Storage limits](https://huggingface.co/docs/hub/storage-limits)**
>
> We’re on a journey to advance and democratize artificial intelligence through open source and open science.

---

<div class="post-metadata">

**Author:** ![Senzen](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/senzen/32/35934_2.png) [@Senzen](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FSenzen)%5C
**Post date:** [March 20, 2025, 4:34pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fabout-model-storage-in-spaces%2F146654%2F5 "2025-03-20T16:34:28Z")

</div>

They say the disk space is ephemeral here. Meaning it would restart everytime I refresh the app ?

> **[Disk usage on Spaces](https://huggingface.co/docs/hub/en/spaces-storage#disk-usage-on-spaces)**
>
> We’re on a journey to advance and democratize artificial intelligence through open source and open science.

---

<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:** [March 20, 2025, 4:36pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fabout-model-storage-in-spaces%2F146654%2F6 "2025-03-20T16:36:43Z")

</div>

> Meaning it would restart everytime I refresh the app ?

Yes.
