From b1a9bfad1048acefc77dbac3eb2f0c5bb1fe42dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A0=20Arrufat?= <1671644+arrufat@users.noreply.github.com> Date: Mon, 24 Apr 2023 11:38:19 +0900 Subject: [PATCH 1/2] Set --only_save_embeds to False by default Due to how the option is named, it makes more sense to behave like this. --- examples/textual_inversion/textual_inversion.py | 1 - 1 file changed, 1 deletion(-) diff --git a/examples/textual_inversion/textual_inversion.py b/examples/textual_inversion/textual_inversion.py index d7be58bdb9ba..4f4de4401442 100644 --- a/examples/textual_inversion/textual_inversion.py +++ b/examples/textual_inversion/textual_inversion.py @@ -178,7 +178,6 @@ def parse_args(): parser.add_argument( "--only_save_embeds", action="store_true", - default=True, help="Save only the embeddings for the new concept.", ) parser.add_argument( From a25304f2e93541420a8f5f525a517e3ecca780db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A0=20Arrufat?= Date: Tue, 2 May 2023 11:06:24 +0900 Subject: [PATCH 2/2] Refactor only_save_embeds to save_as_full_pipeline --- examples/textual_inversion/textual_inversion.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/textual_inversion/textual_inversion.py b/examples/textual_inversion/textual_inversion.py index 4f4de4401442..5e10fb07ae7a 100644 --- a/examples/textual_inversion/textual_inversion.py +++ b/examples/textual_inversion/textual_inversion.py @@ -176,9 +176,9 @@ def parse_args(): help="Save learned_embeds.bin every X updates steps.", ) parser.add_argument( - "--only_save_embeds", + "--save_as_full_pipeline", action="store_true", - help="Save only the embeddings for the new concept.", + help="Save the complete stable diffusion pipeline.", ) parser.add_argument( "--num_vectors", @@ -899,11 +899,11 @@ def main(): # Create the pipeline using the trained modules and save it. accelerator.wait_for_everyone() if accelerator.is_main_process: - if args.push_to_hub and args.only_save_embeds: + if args.push_to_hub and not args.save_as_full_pipeline: logger.warn("Enabling full model saving because --push_to_hub=True was specified.") save_full_model = True else: - save_full_model = not args.only_save_embeds + save_full_model = args.save_as_full_pipeline if save_full_model: pipeline = StableDiffusionPipeline.from_pretrained( args.pretrained_model_name_or_path,