1010 coreml-diffusion convert --ckpt model.safetensors --model-version SD15 \\
1111 --out unet.mlpackage --height 512 --width 512 --attn-impl SPLIT_EINSUM
1212"""
13+
1314import argparse
1415
1516import coreml_diffusion
@@ -52,7 +53,9 @@ def build_parser():
5253 sub = parser .add_subparsers (dest = "command" , required = True )
5354
5455 conv = sub .add_parser ("convert" , help = "Convert a checkpoint's UNet to a .mlpackage" )
55- conv .add_argument ("--ckpt" , required = True , help = "Path to the source .safetensors checkpoint" )
56+ conv .add_argument (
57+ "--ckpt" , required = True , help = "Path to the source .safetensors checkpoint"
58+ )
5659 conv .add_argument (
5760 "--model-version" ,
5861 required = True ,
@@ -62,9 +65,15 @@ def build_parser():
6265 help = "Model architecture (verified: SD15, SDXL; experimental otherwise)" ,
6366 )
6467 conv .add_argument ("--out" , required = True , help = "Output .mlpackage path to write" )
65- conv .add_argument ("--height" , type = int , default = 512 , help = "Target image height (default 512)" )
66- conv .add_argument ("--width" , type = int , default = 512 , help = "Target image width (default 512)" )
67- conv .add_argument ("--batch-size" , type = int , default = 1 , help = "Batch size (default 1)" )
68+ conv .add_argument (
69+ "--height" , type = int , default = 512 , help = "Target image height (default 512)"
70+ )
71+ conv .add_argument (
72+ "--width" , type = int , default = 512 , help = "Target image width (default 512)"
73+ )
74+ conv .add_argument (
75+ "--batch-size" , type = int , default = 1 , help = "Batch size (default 1)"
76+ )
6877 conv .add_argument (
6978 "--attn-impl" ,
7079 choices = coreml_diffusion .list_attention_impls (),
@@ -82,7 +91,9 @@ def build_parser():
8291 metavar = "PATH[:STRENGTH]" ,
8392 help = "LoRA to fuse before conversion; repeatable. STRENGTH defaults to 1.0" ,
8493 )
85- conv .add_argument ("--config" , default = None , help = "Optional original-config YAML path" )
94+ conv .add_argument (
95+ "--config" , default = None , help = "Optional original-config YAML path"
96+ )
8697 conv .add_argument (
8798 "--quantize" ,
8899 choices = coreml_diffusion .list_quant_modes (),
0 commit comments