summaryrefslogtreecommitdiffstats
path: root/data
diff options
context:
space:
mode:
authorVolpeon <git@volpeon.ink>2023-01-16 10:03:05 +0100
committerVolpeon <git@volpeon.ink>2023-01-16 10:03:05 +0100
commitd5696615a84a768307e82d13e50b4aef64f69dbd (patch)
tree47cfaa5b8922edbfd567739ecd770977e339f8d7 /data
parentImplemented extended Dreambooth training (diff)
downloadtextual-inversion-diff-d5696615a84a768307e82d13e50b4aef64f69dbd.tar.gz
textual-inversion-diff-d5696615a84a768307e82d13e50b4aef64f69dbd.tar.bz2
textual-inversion-diff-d5696615a84a768307e82d13e50b4aef64f69dbd.zip
Extended Dreambooth: Train TI tokens separately
Diffstat (limited to 'data')
-rw-r--r--data/csv.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/data/csv.py b/data/csv.py
index 2b1e202..002fdd2 100644
--- a/data/csv.py
+++ b/data/csv.py
@@ -15,6 +15,9 @@ from data.keywords import prompt_to_keywords, keywords_to_prompt
15from models.clip.util import unify_input_ids 15from models.clip.util import unify_input_ids
16 16
17 17
18cache = {}
19
20
18interpolations = { 21interpolations = {
19 "linear": transforms.InterpolationMode.NEAREST, 22 "linear": transforms.InterpolationMode.NEAREST,
20 "bilinear": transforms.InterpolationMode.BILINEAR, 23 "bilinear": transforms.InterpolationMode.BILINEAR,
@@ -24,9 +27,13 @@ interpolations = {
24 27
25 28
26def get_image(path): 29def get_image(path):
30 if path in cache:
31 return cache[path]
32
27 image = Image.open(path) 33 image = Image.open(path)
28 if not image.mode == "RGB": 34 if not image.mode == "RGB":
29 image = image.convert("RGB") 35 image = image.convert("RGB")
36 cache[path] = image
30 return image 37 return image
31 38
32 39