diff options
author | Volpeon <git@volpeon.ink> | 2023-01-16 07:27:45 +0100 |
---|---|---|
committer | Volpeon <git@volpeon.ink> | 2023-01-16 07:27:45 +0100 |
commit | 3c6ccadd3c12c54a1fa2280bce505a2dd511958a (patch) | |
tree | 019b9ac09acc85196ef1d09e2d968ba917ac8993 /data | |
parent | Added Dreambooth strategy (diff) | |
download | textual-inversion-diff-3c6ccadd3c12c54a1fa2280bce505a2dd511958a.tar.gz textual-inversion-diff-3c6ccadd3c12c54a1fa2280bce505a2dd511958a.tar.bz2 textual-inversion-diff-3c6ccadd3c12c54a1fa2280bce505a2dd511958a.zip |
Implemented extended Dreambooth training
Diffstat (limited to 'data')
-rw-r--r-- | data/csv.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/data/csv.py b/data/csv.py index 2a8115b..2b1e202 100644 --- a/data/csv.py +++ b/data/csv.py | |||
@@ -130,6 +130,25 @@ class VlpnDataItem(NamedTuple): | |||
130 | collection: list[str] | 130 | collection: list[str] |
131 | 131 | ||
132 | 132 | ||
133 | def keyword_filter( | ||
134 | placeholder_tokens: Optional[list[str]], | ||
135 | collection: Optional[list[str]], | ||
136 | exclude_collections: Optional[list[str]], | ||
137 | item: VlpnDataItem | ||
138 | ): | ||
139 | cond1 = placeholder_tokens is None or any( | ||
140 | keyword in part | ||
141 | for keyword in placeholder_tokens | ||
142 | for part in item.prompt | ||
143 | ) | ||
144 | cond2 = collection is None or collection in item.collection | ||
145 | cond3 = exclude_collections is None or not any( | ||
146 | collection in item.collection | ||
147 | for collection in exclude_collections | ||
148 | ) | ||
149 | return cond1 and cond2 and cond3 | ||
150 | |||
151 | |||
133 | class VlpnDataModule(): | 152 | class VlpnDataModule(): |
134 | def __init__( | 153 | def __init__( |
135 | self, | 154 | self, |