Rework DOP so it works with caching text embeddings

This commit is contained in:
Jaret Burkett committed 2026-08-09 22:13:49 -06:00
1 parent 5ff8a0435a
commit 257da9b586
5 files changed
+138 -30

No files matched your search

+4 -5
View File
@@ -924,6 +924,10 @@ class DatasetConfig:
self.default_caption: str = kwargs.get('default_caption', None)
# trigger word for just this dataset
self.trigger_word: str = kwargs.get('trigger_word', None)
# set automatically from the train config when diff output preservation is enabled.
# the dataset trigger word is replaced with the class in the caption for DOP embeddings
self.diff_output_preservation: bool = kwargs.get('diff_output_preservation', False)
self.diff_output_preservation_class: str = kwargs.get('diff_output_preservation_class', '')
random_triggers = kwargs.get('random_triggers', [])
# if they are a string, load them from a file
if isinstance(random_triggers, str) and os.path.exists(random_triggers):
@@ -1489,11 +1493,6 @@ def validate_configs(
# see if any datasets are caching text embeddings
is_caching_text_embeddings = any(dataset.cache_text_embeddings for dataset in dataset_configs)
if is_caching_text_embeddings:
# check if they are doing differential output preservation
if train_config.diff_output_preservation:
raise ValueError("Cannot use differential output preservation with caching text embeddings. Please set diff_output_preservation to False.")
# make sure they are all cached
for dataset in dataset_configs:
if not dataset.cache_text_embeddings: