# How to minimize memory consume when loading from pretrained models?

**URL:** <https://discuss.huggingface.co/t/how-to-minimize-memory-consume-when-loading-from-pretrained-models/57920>\
**Category:** 🤗Transformers\
**Created:** [October 9, 2023, 2:24pm UTC](https://discuss.huggingface.co/t/how-to-minimize-memory-consume-when-loading-from-pretrained-models/57920 "2023-10-09T14:24:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ShiLuohe](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/shiluohe/32/20185_2.png) [@ShiLuohe](https://discuss.huggingface.co/u/ShiLuohe)\
**Post date:** [October 9, 2023, 2:24pm UTC](https://discuss.huggingface.co/t/how-to-minimize-memory-consume-when-loading-from-pretrained-models/57920/1 "2023-10-09T14:24:45Z")

</div>

I’ve recently working on multiple 7B scale LLMs. When I load LLaMA2-7B from AutoModelForCasualLM, the memory usage is well controlled, around 28GB. However when I load MPT, which has a slightly smaller amount of parameters, it cost 31GB and I can’t load other LLMs like Falcon-7B, since I only have a 32GB system. I’m curious why loading LLaMA2 only take 27GB memory and how can I load Falcon with 32GB memory cap.
