kohya-ss / kohya-ss/sd-scripts

High Committed Memory Usage During Model Training with SDXL

Open
#1,264 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
7.2k
Forks
1.2k
Avg merge
11m
Merged PRs (30d)
2

Description

I am currently training a large model(Checkpoint) using SDXL with a dataset of 13,820 images. I've observed a phenomenon where the program requests a significant amount of memory, but the actual usage is relatively low.

After enabling caching for latent variables and other parameters, the Committed Memory in Windows Task Manager shows up to 60GB, whereas the actual memory usage is around 10GB. This does not cause any issues during normal training, but problems arise when the training completes an epoch and attempts to output a model.

At that time, the upper limit of my Committed Memory was 63.8GB. Since the memory usage was close to this limit (60GB), the system failed to export the model and displayed an error indicating insufficient memory. The issue persisted until I reduced the dataset to 300 images and disabled latent variable caching, which then allowed the model to be output successfully.

To resolve this, I increased the virtual memory to 91.5GB. I am wondering if this behavior is expected, or if there might be a more efficient way to manage memory allocation to prevent such high Committed Memory usage.

![image](https://github.com/kohya-ss/sd-scripts/assets/39492464/cbfe1a41-410f-4b64-9c23-54a3f13d6788)
![image](https://github.com/kohya-ss/sd-scripts/assets/39492464/ba202aa8-5948-4ea5-982f-e9577be39951)

Contributor guide

No contributing guide indexed for this repository

Research direction

No files, tests, or entry points are named in the report. Start by reproducing SDXL training with 13,820 images and latent caching on Windows while monitoring committed versus actual memory. Done means determining whether the allocation is expected and whether model export can avoid failing near the commit limit.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.