Skip to content

Commit 6521d55

Browse files
committed
apply comments
1 parent 3be14d2 commit 6521d55

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

optimum/exporters/openvino/convert.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -1017,22 +1017,25 @@ def get_diffusion_models_for_export_ext(
10171017
is_sd3 = pipeline.__class__.__name__.startswith("StableDiffusion3")
10181018
is_flux = pipeline.__class__.__name__.startswith("Flux")
10191019
is_sd = pipeline.__class__.__name__.startswith("StableDiffusion") and not is_sd3
1020+
is_lcm = pipeline.__class__.__name__.startswith("LatentConsistencyModel")
10201021

1021-
if not is_sd3 and not is_flux:
1022+
if is_sd or is_sdxl or is_lcm:
10221023
models_for_export = get_diffusion_models_for_export(pipeline, int_dtype, float_dtype, exporter)
10231024
if is_sdxl and pipeline.vae.config.force_upcast:
10241025
models_for_export["vae_encoder"][1].runtime_options = {"ACTIVATIONS_SCALE_FACTOR": "128.0"}
10251026
models_for_export["vae_decoder"][1].runtime_options = {"ACTIVATIONS_SCALE_FACTOR": "128.0"}
10261027

1028+
# only SD 2.1 has overflow issue, it uses different prediction_type than other models
10271029
if is_sd and pipeline.scheduler.config.prediction_type == "v_prediction":
10281030
models_for_export["vae_encoder"][1].runtime_options = {"ACTIVATIONS_SCALE_FACTOR": "8.0"}
10291031
models_for_export["vae_decoder"][1].runtime_options = {"ACTIVATIONS_SCALE_FACTOR": "8.0"}
10301032

10311033
elif is_sd3:
10321034
models_for_export = get_sd3_models_for_export(pipeline, exporter, int_dtype, float_dtype)
1033-
else:
1035+
elif is_flux:
10341036
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")
10361039
return None, models_for_export
10371040

10381041

0 commit comments

Comments
 (0)