# Out of memory error

**URL:** <https://discuss.huggingface.co/t/out-of-memory-error/30481>\
**Category:** Beginners\
**Created:** [January 26, 2023, 12:47pm UTC](https://discuss.huggingface.co/t/out-of-memory-error/30481 "2023-01-26T12:47:13Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Billyjoker](https://avatars.discourse-cdn.com/v4/letter/b/8491ac/32.png) [@Billyjoker](https://discuss.huggingface.co/u/Billyjoker)\
**Post date:** [January 26, 2023, 12:47pm UTC](https://discuss.huggingface.co/t/out-of-memory-error/30481/1 "2023-01-26T12:47:13Z")

</div>

Hi with my trainer I get an error and I am not able to fix it. Log as follows, just when 100% is reached:

torch.cuda.OutOfMemoryError: CUDA out of memory. Tried to allocate 1024.00 MiB (GPU 0; 14.76 GiB total capacity; 11.39 GiB already allocated; 253.88 MiB free; 13.22 GiB reserved in total by PyTorch) If reserved memory is \>\> allocated memory try setting max\_split\_size\_mb to avoid fragmentation. See documentation for Memory Management and PYTORCH\_CUDA\_ALLOC\_CONF  
Progress:| |: 0% 1/1600 [00:08\<3:59:07, 8.97s/it, loss=0.686, lr=1e-6]  
Traceback (most recent call last):  
File “/usr/local/bin/accelerate”, line 8, in   
sys.exit(main())  
File “/usr/local/lib/python3.8/dist-packages/accelerate/commands/accelerate\_cli.py”, line 43, in main  
args.func(args)  
File “/usr/local/lib/python3.8/dist-packages/accelerate/commands/launch.py”, line 837, in launch\_command  
simple\_launcher(args)  
File “/usr/local/lib/python3.8/dist-packages/accelerate/commands/launch.py”, line 354, in simple\_launcher  
raise subprocess.CalledProcessError(returncode=process.returncode, cmd=cmd)

The problem gets when Generating class images: 100%

How could I fix it? Thanks in advance
