# How can I restrict the GPU usage in this case?

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-can-i-restrict-the-gpu-usage-in-this-case%2F69704%3E%5C
**Category:** 🤗Transformers\
**Created:** [January 19, 2024, 1:56am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-can-i-restrict-the-gpu-usage-in-this-case%2F69704 "2024-01-19T01:56:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![lihongjunhj](https://avatars.discourse-cdn.com/v4/letter/l/5e9695/32.png) [@lihongjunhj](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Flihongjunhj)%5C
**Post date:** [January 19, 2024, 1:56am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-can-i-restrict-the-gpu-usage-in-this-case%2F69704%2F1 "2024-01-19T01:56:14Z")

</div>

In the example `run_clm_no_trainer.py` , may I ask how to limit the usage of GPU? Currently, I have a 24GB GPU, but I keep getting the `torch.cuda.OutOfMemoryError` error. The command I am using is:  
python run\_clm\_no\_trainer.py   
–dataset\_name lmsys/lmsys-chat-1m   
–train\_file /root/autodl-tmp/transformers-4.26.0/examples/pytorch/language-modeling/aa.txt   
–model\_name\_or\_path lmsys/vicuna-7b-v1.5-16k   
–output\_dir /root/autodl-tmp/aa
