From abf13ccc11cb084afce113f5e9bf35c54de61d65 Mon Sep 17 00:00:00 2001 From: Xiaoyu Zhang <35585791+BBuf@users.noreply.github.com> Date: Fri, 30 Jan 2026 22:04:54 +0800 Subject: [PATCH] [Diffusion] Fix lora default lora_scale bug (#17982) --- .../multimodal_gen/runtime/pipelines_core/lora_pipeline.py | 2 +- python/sglang/multimodal_gen/runtime/server_args.py | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/python/sglang/multimodal_gen/runtime/pipelines_core/lora_pipeline.py b/python/sglang/multimodal_gen/runtime/pipelines_core/lora_pipeline.py index f4e0565a7..035ec489b 100644 --- a/python/sglang/multimodal_gen/runtime/pipelines_core/lora_pipeline.py +++ b/python/sglang/multimodal_gen/runtime/pipelines_core/lora_pipeline.py @@ -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: diff --git a/python/sglang/multimodal_gen/runtime/server_args.py b/python/sglang/multimodal_gen/runtime/server_args.py index f53ee67f5..122e5d274 100644 --- a/python/sglang/multimodal_gen/runtime/server_args.py +++ b/python/sglang/multimodal_gen/runtime/server_args.py @@ -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)