# SDXL lora training taking too much memory

**URL:** <https://discuss.huggingface.co/t/sdxl-lora-training-taking-too-much-memory/48676>\
**Category:** 🧨 Diffusers\
**Created:** [July 30, 2023, 4:04am UTC](https://discuss.huggingface.co/t/sdxl-lora-training-taking-too-much-memory/48676 "2023-07-30T04:04:40Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sausax](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/sausax/32/12200_2.png) [@sausax](https://discuss.huggingface.co/u/sausax)\
**Post date:** [July 30, 2023, 4:04am UTC](https://discuss.huggingface.co/t/sdxl-lora-training-taking-too-much-memory/48676/1 "2023-07-30T04:04:40Z")

</div>

Hi,

I am trying to train dreambooth sdxl but keep running out of memory when trying it for 1024px resolution. I am using the following command with the latest repo on github. Any way to run it in less memory.

accelerate launch train\_dreambooth\_lora\_sdxl.py   
–pretrained\_model\_name\_or\_path=$MODEL\_NAME   
–instance\_data\_dir=$INSTANCE\_DIR   
–output\_dir=$OUTPUT\_DIR   
–mixed\_precision=“fp16”   
–instance\_prompt=“a photo of sks dog”   
–resolution=1024   
–train\_batch\_size=1   
–gradient\_accumulation\_steps=8   
–learning\_rate=1e-4   
–gradient\_checkpointing   
–lr\_scheduler=“constant”   
–lr\_warmup\_steps=0   
–max\_train\_steps=500   
–validation\_prompt=“A photo of sks dog in a bucket”   
–validation\_epochs=25   
–seed=“0”   
–enable\_xformers\_memory\_efficient\_attention
