[Diffusion] Fix lora default lora_scale bug (#17982)

This commit is contained in:
Xiaoyu Zhang
2026-01-30 22:04:54 +08:00
committed by GitHub
parent 0c5a81acb8
commit abf13ccc11
2 changed files with 8 additions and 1 deletions

View File

@@ -98,7 +98,7 @@ class LoRAPipeline(ComposedPipelineBase):
if self.lora_path is not None:
self.convert_to_lora_layers()
self.set_lora(
self.lora_nickname, self.lora_path # type: ignore
self.lora_nickname, self.lora_path, strength=self.server_args.lora_scale # type: ignore
) # type: ignore
def is_target_layer(self, module_name: str) -> bool:

View File

@@ -276,6 +276,7 @@ class ServerArgs:
# (Wenxuan) prefer to keep it here instead of in pipeline config to not make it complicated.
lora_path: str | None = None
lora_nickname: str = "default" # for swapping adapters in the pipeline
lora_scale: float = 1.0 # LoRA scale for merging (e.g., 0.125 for Hyper-SD)
# VAE parameters
vae_path: str | None = None # Custom VAE path (e.g., for distilled autoencoder)
@@ -728,6 +729,12 @@ class ServerArgs:
default=ServerArgs.lora_nickname,
help="The nickname for the LoRA adapter to launch with",
)
parser.add_argument(
"--lora-scale",
type=float,
default=ServerArgs.lora_scale,
help="LoRA scale for merging (e.g., 0.125 for Hyper-SD). Same as lora_scale in Diffusers",
)
# Add pipeline configuration arguments
PipelineConfig.add_cli_args(parser)