From 68ca0ea995434a331209fbc34938e1bbe7ccb083 Mon Sep 17 00:00:00 2001 From: Kohya S Date: Mon, 10 Jul 2023 22:28:26 +0900 Subject: [PATCH] Fix to show template type --- train_textual_inversion.py | 4 ++-- train_textual_inversion_XTI.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/train_textual_inversion.py b/train_textual_inversion.py index 09294048..1f085643 100644 --- a/train_textual_inversion.py +++ b/train_textual_inversion.py @@ -94,7 +94,7 @@ class TextualInversionTrainer: def assert_token_string(self, token_string, tokenizers): pass - + def get_text_cond(self, args, accelerator, batch, tokenizers, text_encoders, weight_dtype): with torch.enable_grad(): input_ids = batch["input_ids"].to(accelerator.device) @@ -311,7 +311,7 @@ class TextualInversionTrainer: # make captions: tokenstring tokenstring1 tokenstring2 ...tokenstringn という文字列に書き換える超乱暴な実装 if use_template: - accelerator.print("use template for training captions. is object: {args.use_object_template}") + accelerator.print(f"use template for training captions. is object: {args.use_object_template}") templates = imagenet_templates_small if args.use_object_template else imagenet_style_templates_small replace_to = " ".join(token_strings) captions = [] diff --git a/train_textual_inversion_XTI.py b/train_textual_inversion_XTI.py index a08c3a82..0e91c71c 100644 --- a/train_textual_inversion_XTI.py +++ b/train_textual_inversion_XTI.py @@ -234,7 +234,7 @@ def train(args): # make captions: tokenstring tokenstring1 tokenstring2 ...tokenstringn という文字列に書き換える超乱暴な実装 if use_template: - print("use template for training captions. is object: {args.use_object_template}") + print(f"use template for training captions. is object: {args.use_object_template}") templates = imagenet_templates_small if args.use_object_template else imagenet_style_templates_small replace_to = " ".join(token_strings) captions = []