From d5696615a84a768307e82d13e50b4aef64f69dbd Mon Sep 17 00:00:00 2001 From: Volpeon Date: Mon, 16 Jan 2023 10:03:05 +0100 Subject: Extended Dreambooth: Train TI tokens separately --- data/csv.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'data') 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 from models.clip.util import unify_input_ids +cache = {} + + interpolations = { "linear": transforms.InterpolationMode.NEAREST, "bilinear": transforms.InterpolationMode.BILINEAR, @@ -24,9 +27,13 @@ interpolations = { def get_image(path): + if path in cache: + return cache[path] + image = Image.open(path) if not image.mode == "RGB": image = image.convert("RGB") + cache[path] = image return image -- cgit v1.2.3-70-g09d2