From d2f38871fd23db0de11cd62adf246d0156be7b5d Mon Sep 17 00:00:00 2001 From: Pierre Chapuis Date: Tue, 16 Jan 2024 15:16:33 +0100 Subject: [PATCH] add a way to specify the subfolder of the unet (no subfolder -> pass an empty string) --- scripts/conversion/convert_diffusers_unet.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/conversion/convert_diffusers_unet.py b/scripts/conversion/convert_diffusers_unet.py index 7fbeeda..516c1e5 100644 --- a/scripts/conversion/convert_diffusers_unet.py +++ b/scripts/conversion/convert_diffusers_unet.py @@ -12,6 +12,7 @@ from refiners.foundationals.latent_diffusion import SD1UNet, SDXLUNet class Args(argparse.Namespace): source_path: str output_path: str | None + subfolder: str half: bool verbose: bool @@ -20,7 +21,7 @@ def setup_converter(args: Args) -> ModelConverter: # low_cpu_mem_usage=False stops some annoying console messages us to `pip install accelerate` source: nn.Module = UNet2DConditionModel.from_pretrained( # type: ignore pretrained_model_name_or_path=args.source_path, - subfolder="unet", + subfolder=args.subfolder, low_cpu_mem_usage=False, ) source_in_channels: int = source.config.in_channels # type: ignore @@ -81,6 +82,7 @@ def main() -> None: " source path." ), ) + parser.add_argument("--subfolder", type=str, default="unet", help="Subfolder. Default: unet.") parser.add_argument("--half", action="store_true", help="Convert to half precision.") parser.add_argument( "--verbose",