From 3da8aa257b043939bce71fbf3764e2a9d71a7d11 Mon Sep 17 00:00:00 2001 From: Artiprocher Date: Sat, 14 Sep 2024 17:16:59 +0800 Subject: [PATCH] staticmethod --- diffsynth/models/lora.py | 3 ++- examples/train/flux/train_flux_lora.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/diffsynth/models/lora.py b/diffsynth/models/lora.py index bae08f5..f8e7599 100644 --- a/diffsynth/models/lora.py +++ b/diffsynth/models/lora.py @@ -252,7 +252,8 @@ class FluxLoRAConverter: def __init__(self): pass - def align_to_opensource_format(self, state_dict, alpha=1.0): + @staticmethod + def align_to_opensource_format(state_dict, alpha=1.0): prefix_rename_dict = { "single_blocks": "lora_unet_single_blocks", "blocks": "lora_unet_double_blocks", diff --git a/examples/train/flux/train_flux_lora.py b/examples/train/flux/train_flux_lora.py index 65496ec..9024f9e 100644 --- a/examples/train/flux/train_flux_lora.py +++ b/examples/train/flux/train_flux_lora.py @@ -81,6 +81,6 @@ if __name__ == '__main__': lora_rank=args.lora_rank, lora_alpha=args.lora_alpha, lora_target_modules=args.lora_target_modules, - state_dict_converter=FluxLoRAConverter().align_to_opensource_format if args.align_to_opensource_format else None, + state_dict_converter=FluxLoRAConverter.align_to_opensource_format if args.align_to_opensource_format else None, ) launch_training_task(model, args)