diff --git a/dreambooth/dataclasses/db_config.py b/dreambooth/dataclasses/db_config.py index fa143f87..3b8bc207 100644 --- a/dreambooth/dataclasses/db_config.py +++ b/dreambooth/dataclasses/db_config.py @@ -72,6 +72,7 @@ class DreamboothConfig(BaseModel): max_token_length: int = 75 min_snr_gamma: float = 0.0 use_dream: bool = False + dream_detail: float = 0.5 mixed_precision: str = "fp16" model_dir: str = "" model_name: str = "" diff --git a/dreambooth/train_dreambooth.py b/dreambooth/train_dreambooth.py index 6188dd65..2b076fe5 100644 --- a/dreambooth/train_dreambooth.py +++ b/dreambooth/train_dreambooth.py @@ -1621,9 +1621,8 @@ def lora_save_function(weights, filename): sqrt_alpha_prod = alpha_prod ** 0.5 sqrt_one_minus_alpha_prod = (1 - alpha_prod) ** 0.5 - # The paper uses lambda = sqrt(1 - alpha) ** p, with p = 1 in their experiments, but - # lambda = 1 seems to give better results for fine-tuning. - dream_lambda = 1 + # The paper uses lambda = sqrt(1 - alpha) ** p, with p = 1 in their experiments. + dream_lambda = (1 - alpha_prod) ** args.dream_detail if args.model_type == "SDXL": with accelerator.autocast(): @@ -1649,7 +1648,7 @@ def lora_save_function(weights, filename): else: raise ValueError(f"Unknown prediction type {noise_scheduler.config.prediction_type}") - del alpha_prod, sqrt_alpha_prod, sqrt_one_minus_alpha_prod, dream_lambda, predicted_noise, delta_noise + del alpha_prod, sqrt_alpha_prod, sqrt_one_minus_alpha_prod, dream_lambda, model_pred, predicted_noise, delta_noise if args.model_type == "SDXL": with accelerator.autocast(): diff --git a/index.html b/index.html index babdecf8..8d68ce1d 100644 --- a/index.html +++ b/index.html @@ -302,6 +302,11 @@ id="use_dream" name="use_dream"> + +
+