From 96f113b8ec3809e339b772d874712b3ace5129f9 Mon Sep 17 00:00:00 2001 From: bmaltais Date: Mon, 18 Dec 2023 19:41:53 -0500 Subject: [PATCH 1/2] Update lr_scheduler_args placeholder --- library/class_basic_training.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/class_basic_training.py b/library/class_basic_training.py index e0bb2f1ef..5aaa52d81 100644 --- a/library/class_basic_training.py +++ b/library/class_basic_training.py @@ -123,7 +123,7 @@ def __init__( ) self.lr_scheduler_args = gr.Textbox( label="LR scheduler extra arguments", - placeholder='(Optional) eg: "lr_end=5e-5"', + placeholder='(Optional) eg: "milestones=[1,10,30,50]" "gamma=0.1"', ) self.optimizer_args = gr.Textbox( label="Optimizer extra arguments", From 6dc1928994fa73f0770518806a52b036bbf98035 Mon Sep 17 00:00:00 2001 From: Lucas Freire Sangoi <125471877+DevArqSangoi@users.noreply.github.com> Date: Tue, 19 Dec 2023 11:53:06 -0300 Subject: [PATCH 2/2] Update lpw_stable_diffusion.py Workaround for this: https://github.com/bmaltais/kohya_ss/issues/1780 --- library/lpw_stable_diffusion.py | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/library/lpw_stable_diffusion.py b/library/lpw_stable_diffusion.py index 9dce91a76..4f9408352 100644 --- a/library/lpw_stable_diffusion.py +++ b/library/lpw_stable_diffusion.py @@ -9,7 +9,7 @@ import PIL.Image import torch from packaging import version -from transformers import CLIPFeatureExtractor, CLIPTextModel, CLIPTokenizer +from transformers import CLIPFeatureExtractor, CLIPTextModel, CLIPTokenizer, CLIPVisionModelWithProjection import diffusers from diffusers import SchedulerMixin, StableDiffusionPipeline @@ -516,12 +516,13 @@ def __init__( tokenizer: CLIPTokenizer, unet: UNet2DConditionModel, scheduler: SchedulerMixin, - # clip_skip: int, safety_checker: StableDiffusionSafetyChecker, feature_extractor: CLIPFeatureExtractor, + image_encoder: CLIPVisionModelWithProjection = None, # Incluindo o image_encoder requires_safety_checker: bool = True, clip_skip: int = 1, ): + self._clip_skip_internal = clip_skip super().__init__( vae=vae, text_encoder=text_encoder, @@ -530,11 +531,25 @@ def __init__( scheduler=scheduler, safety_checker=safety_checker, feature_extractor=feature_extractor, + image_encoder=image_encoder, requires_safety_checker=requires_safety_checker, ) - self.clip_skip = clip_skip self.__init__additional__() + @property + def clip_skip(self): + return self._clip_skip_internal + + @clip_skip.setter + def clip_skip(self, value): + self._clip_skip_internal = value + + def __setattr__(self, name: str, value): + if name == "clip_skip": + object.__setattr__(self, "_clip_skip_internal", value) + else: + super().__setattr__(name, value) + # else: # def __init__( # self,