Update pipeline.py
Browse files- pipeline.py +3 -2
pipeline.py
CHANGED
@@ -505,6 +505,7 @@ class WebUIStableDiffusionPipeline(DiffusionPipeline):
|
|
505 |
callback_steps: Optional[int] = 1,
|
506 |
cross_attention_kwargs: Optional[Dict[str, Any]] = None,
|
507 |
clip_skip: int = 1,
|
|
|
508 |
):
|
509 |
r"""
|
510 |
Function invoked when calling the pipeline for generation.
|
@@ -591,7 +592,7 @@ class WebUIStableDiffusionPipeline(DiffusionPipeline):
|
|
591 |
|
592 |
prompts, extra_network_data = parse_prompts([prompt])
|
593 |
|
594 |
-
if self.LORA_DIR is not None:
|
595 |
if os.path.exists(self.LORA_DIR):
|
596 |
lora_mapping = {p.stem: p.absolute() for p in Path(self.LORA_DIR).glob("*.safetensors")}
|
597 |
for params in extra_network_data["lora"]:
|
@@ -719,7 +720,7 @@ class WebUIStableDiffusionPipeline(DiffusionPipeline):
|
|
719 |
except Exception as e:
|
720 |
raise ValueError(e)
|
721 |
finally:
|
722 |
-
if self.weights_has_changed:
|
723 |
for sub_layer in self.text_encoder.sublayers(include_self=True):
|
724 |
if hasattr(sub_layer, "backup_weights"):
|
725 |
sub_layer.weight.copy_(sub_layer.backup_weights, True)
|
|
|
505 |
callback_steps: Optional[int] = 1,
|
506 |
cross_attention_kwargs: Optional[Dict[str, Any]] = None,
|
507 |
clip_skip: int = 1,
|
508 |
+
enable_lora: bool = True,
|
509 |
):
|
510 |
r"""
|
511 |
Function invoked when calling the pipeline for generation.
|
|
|
592 |
|
593 |
prompts, extra_network_data = parse_prompts([prompt])
|
594 |
|
595 |
+
if enable_lora and self.LORA_DIR is not None:
|
596 |
if os.path.exists(self.LORA_DIR):
|
597 |
lora_mapping = {p.stem: p.absolute() for p in Path(self.LORA_DIR).glob("*.safetensors")}
|
598 |
for params in extra_network_data["lora"]:
|
|
|
720 |
except Exception as e:
|
721 |
raise ValueError(e)
|
722 |
finally:
|
723 |
+
if enable_lora and self.weights_has_changed:
|
724 |
for sub_layer in self.text_encoder.sublayers(include_self=True):
|
725 |
if hasattr(sub_layer, "backup_weights"):
|
726 |
sub_layer.weight.copy_(sub_layer.backup_weights, True)
|