# Downloads Model Every Time

**URL:** <https://discuss.huggingface.co/t/downloads-model-every-time/51988>\
**Category:** Spaces\
**Created:** [August 24, 2023, 3:17pm UTC](https://discuss.huggingface.co/t/downloads-model-every-time/51988 "2023-08-24T15:17:30Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mattsputnikdigital](https://avatars.discourse-cdn.com/v4/letter/m/a4c791/32.png) [@mattsputnikdigital](https://discuss.huggingface.co/u/mattsputnikdigital)\
**Post date:** [August 24, 2023, 3:17pm UTC](https://discuss.huggingface.co/t/downloads-model-every-time/51988/1 "2023-08-24T15:17:30Z")

</div>

The model is “meta-llama/Llama-2-7b-chat-hf”

Im using the sample code, that queries the model with “I liked “Breaking Bad” and “Band of Brothers”…”

When the space runs it downloads the 9GB+ model, taking a while and then outputs a response.

But if I refresh the page or use the embed code the whole process of downloading the model starts again.

I am at a loss to understand why this happens, I have even upgraded to persistent storage.

---

<div class="post-metadata">

**Author:** ![freddyaboulton](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/freddyaboulton/32/32732_2.png) [@freddyaboulton](https://discuss.huggingface.co/u/freddyaboulton)\
**Post date:** [August 24, 2023, 3:48pm UTC](https://discuss.huggingface.co/t/downloads-model-every-time/51988/2 "2023-08-24T15:48:07Z")

</div>

What space sdk are you using?

---

<div class="post-metadata">

**Author:** ![mattsputnikdigital](https://avatars.discourse-cdn.com/v4/letter/m/a4c791/32.png) [@mattsputnikdigital](https://discuss.huggingface.co/u/mattsputnikdigital)\
**Post date:** [August 24, 2023, 3:59pm UTC](https://discuss.huggingface.co/t/downloads-model-every-time/51988/3 "2023-08-24T15:59:58Z")

</div>

Streamlit.

I just read the section about setting the HF\_HOME variable so restarting and trying that.

---

<div class="post-metadata">

**Author:** ![mattsputnikdigital](https://avatars.discourse-cdn.com/v4/letter/m/a4c791/32.png) [@mattsputnikdigital](https://discuss.huggingface.co/u/mattsputnikdigital)\
**Post date:** [August 25, 2023, 8:27am UTC](https://discuss.huggingface.co/t/downloads-model-every-time/51988/4 "2023-08-25T08:27:04Z")

</div>

OK I now have the model persist on disk stopping it from having to be downloaded everytime.

Im running on an A10G and it seems that every time I refresh the page the model needs to be loaded into the GPU memory, which takes a few minutes.

Is there a way to persist the model in memory, I have set the gpu to sleep after an hour.

---

<div class="post-metadata">

**Author:** ![dwipper](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/dwipper/32/21750_2.png) [@dwipper](https://discuss.huggingface.co/u/dwipper)\
**Post date:** [November 2, 2023, 10:52pm UTC](https://discuss.huggingface.co/t/downloads-model-every-time/51988/5 "2023-11-02T22:52:44Z")

</div>

> [@mattsputnikdigital](#):
>
> HF\_HOME

What was the specific setting you made? I’m having the same issue with the model downloading every time I restart.
