@@ -1017,22 +1017,25 @@ def get_diffusion_models_for_export_ext(
1017
1017
is_sd3 = pipeline .__class__ .__name__ .startswith ("StableDiffusion3" )
1018
1018
is_flux = pipeline .__class__ .__name__ .startswith ("Flux" )
1019
1019
is_sd = pipeline .__class__ .__name__ .startswith ("StableDiffusion" ) and not is_sd3
1020
+ is_lcm = pipeline .__class__ .__name__ .startswith ("LatentConsistencyModel" )
1020
1021
1021
- if not is_sd3 and not is_flux :
1022
+ if is_sd or is_sdxl or is_lcm :
1022
1023
models_for_export = get_diffusion_models_for_export (pipeline , int_dtype , float_dtype , exporter )
1023
1024
if is_sdxl and pipeline .vae .config .force_upcast :
1024
1025
models_for_export ["vae_encoder" ][1 ].runtime_options = {"ACTIVATIONS_SCALE_FACTOR" : "128.0" }
1025
1026
models_for_export ["vae_decoder" ][1 ].runtime_options = {"ACTIVATIONS_SCALE_FACTOR" : "128.0" }
1026
1027
1028
+ # only SD 2.1 has overflow issue, it uses different prediction_type than other models
1027
1029
if is_sd and pipeline .scheduler .config .prediction_type == "v_prediction" :
1028
1030
models_for_export ["vae_encoder" ][1 ].runtime_options = {"ACTIVATIONS_SCALE_FACTOR" : "8.0" }
1029
1031
models_for_export ["vae_decoder" ][1 ].runtime_options = {"ACTIVATIONS_SCALE_FACTOR" : "8.0" }
1030
1032
1031
1033
elif is_sd3 :
1032
1034
models_for_export = get_sd3_models_for_export (pipeline , exporter , int_dtype , float_dtype )
1033
- else :
1035
+ elif is_flux :
1034
1036
models_for_export = get_flux_models_for_export (pipeline , exporter , int_dtype , float_dtype )
1035
-
1037
+ else :
1038
+ raise ValueError (f"Unsupported pipeline type `{ pipeline .__class__ .__name__ } ` provided" )
1036
1039
return None , models_for_export
1037
1040
1038
1041
0 commit comments