[Diffusion] Fix lora default lora_scale bug (#17982)
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user