Skip to content

Commit cd8e242

Browse files
authored
Merge pull request #336 from bghira/feature/on-demand-vae-cache
by default, we now use the on demand vae cache | selective cache clear by using "image" or "text" as value to preserve the cache | aws: fix mps file loading | fix log level issue with metadata backend
2 parents d05d585 + a2d7219 commit cd8e242

File tree

19 files changed

+296
-96
lines changed

19 files changed

+296
-96
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
*.code-workspace
2+
multidatabackend*json
13
# Python and virtual environment files
24
temp/
35
env.sh

OPTIONS.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ This guide provides a user-friendly breakdown of the command-line options availa
4141
- **What**: When provided, will allow SimpleTuner to ignore differences between the cached config inside the dataset and the current values.
4242
- **Why**: When SimplerTuner is run for the first time on a dataset, it will create a cache document containing information about everything in that dataset. This includes the dataset config, including its "crop" and "resolution" related configuration values. Changing these arbitrarily or by accident could result in your training jobs crashing randomly, so it's highly recommended to not use this parameter, and instead resolve the differences you'd like to apply in your dataset some other way.
4343

44-
### `--vae_cache_behaviour`
44+
### `--vae_cache_scan_behaviour`
4545

4646
- **What**: Configure the behaviour of the integrity scan check.
47-
- **Why**: A dataset could have incorrect settings applied at multiple points of training, eg. if you accidentally delete the `.json` cache files from your dataset and switch the data backend config to use square images rather than aspect-crops. This will result in an inconsistent data cache, which can be corrected by setting `scan_for_errors` to `true` in your `multidatabackend.json` configuration file. When this scan runs, it relies on the setting of `--vae_cache_behaviour` to determine how to resolve the inconsistency: `recreate` (the default) will remove the offending cache entry so that it can be recreated, and `sync` will update the bucket metadata to reflect the reality of the real training sample. Recommended value: `recreate`.
47+
- **Why**: A dataset could have incorrect settings applied at multiple points of training, eg. if you accidentally delete the `.json` cache files from your dataset and switch the data backend config to use square images rather than aspect-crops. This will result in an inconsistent data cache, which can be corrected by setting `scan_for_errors` to `true` in your `multidatabackend.json` configuration file. When this scan runs, it relies on the setting of `--vae_cache_scan_behaviour` to determine how to resolve the inconsistency: `recreate` (the default) will remove the offending cache entry so that it can be recreated, and `sync` will update the bucket metadata to reflect the reality of the real training sample. Recommended value: `recreate`.
4848

4949
---
5050

@@ -179,7 +179,7 @@ usage: train_sdxl.py [-h] [--snr_gamma SNR_GAMMA] [--model_type {full,lora}]
179179
[--timestep_bias_portion TIMESTEP_BIAS_PORTION]
180180
[--rescale_betas_zero_snr] [--vae_dtype VAE_DTYPE]
181181
[--vae_batch_size VAE_BATCH_SIZE]
182-
[--vae_cache_behaviour {recreate,sync}]
182+
[--vae_cache_scan_behaviour {recreate,sync}]
183183
[--keep_vae_loaded]
184184
[--skip_file_discovery SKIP_FILE_DISCOVERY]
185185
[--revision REVISION] [--preserve_data_backend_cache]
@@ -374,7 +374,7 @@ options:
374374
issues, but if you are at that point of contention,
375375
it's possible that your GPU has too little RAM.
376376
Default: 4.
377-
--vae_cache_behaviour {recreate,sync}
377+
--vae_cache_scan_behaviour {recreate,sync}
378378
When a mismatched latent vector is detected, a scan
379379
will be initiated to locate inconsistencies and
380380
resolve them. The default setting 'recreate' will

helpers/arguments.py

+10-1
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ def parse_args(input_args=None):
190190
),
191191
)
192192
parser.add_argument(
193-
"--vae_cache_behaviour",
193+
"--vae_cache_scan_behaviour",
194194
type=str,
195195
choices=["recreate", "sync"],
196196
default="recreate",
@@ -201,6 +201,15 @@ def parse_args(input_args=None):
201201
" The recommended behaviour is to use the default value and allow the cache to be recreated."
202202
),
203203
)
204+
parser.add_argument(
205+
"--encode_during_training",
206+
type=bool,
207+
default=True,
208+
help=(
209+
"By default, will encode images during training. For some situations, pre-processing may be desired."
210+
" To revert to the old behaviour, supply --encode_during_training=false."
211+
),
212+
)
204213
parser.add_argument(
205214
"--keep_vae_loaded",
206215
action="store_true",

0 commit comments

Comments
 (0)