# The CPU memory usage becomes very small during model inference

**URL:** <https://discuss.huggingface.co/t/the-cpu-memory-usage-becomes-very-small-during-model-inference/128567>\
**Category:** 🤗Transformers\
**Created:** [November 30, 2024, 12:26pm UTC](https://discuss.huggingface.co/t/the-cpu-memory-usage-becomes-very-small-during-model-inference/128567 "2024-11-30T12:26:09Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sumuyou](https://avatars.discourse-cdn.com/v4/letter/s/858c86/32.png) [@sumuyou](https://discuss.huggingface.co/u/sumuyou)\
**Post date:** [November 30, 2024, 12:26pm UTC](https://discuss.huggingface.co/t/the-cpu-memory-usage-becomes-very-small-during-model-inference/128567/1 "2024-11-30T12:26:09Z")

</div>

I downloaded a GPT2-3.5B model from huggingface, when I used `model = GPT2LMHeadModel.from_pretrained` load the model from disk to inference on cpu,the memory usage is approximately 14GB，but after I used `model.save_pretrained` to save the model and tokenizer to a new folder,I load it for inference, the CPU memory usage is only about 1GB, and the generated content is correct.  
It is worth noting that the original model parameters are bin file, and after saving they are safetensors.
