Skip to content

Commit

Permalink
Fix compatibility with diffusers < 0.25.0 (#2063)
Browse files Browse the repository at this point in the history
* Fix compatibility with diffusers < 0.25.0

* fix import
  • Loading branch information
echarlaix authored Oct 18, 2024
1 parent 1e5014e commit 8e54205
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion optimum/onnxruntime/modeling_diffusion.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import numpy as np
import torch
from diffusers.configuration_utils import ConfigMixin
from diffusers.models.autoencoders.vae import DiagonalGaussianDistribution
from diffusers.pipelines import (
AutoPipelineForImage2Image,
AutoPipelineForInpainting,
Expand All @@ -52,6 +51,7 @@
from transformers.modeling_outputs import ModelOutput

import onnxruntime as ort
from optimum.utils import check_if_diffusers_greater

from ..exporters.onnx import main_export
from ..onnx.utils import _get_model_external_data_paths
Expand All @@ -73,6 +73,12 @@
)


if check_if_diffusers_greater("0.25.0"):
from diffusers.models.autoencoders.vae import DiagonalGaussianDistribution
else:
from diffusers.models.vae import DiagonalGaussianDistribution


logger = logging.getLogger(__name__)


Expand Down

0 comments on commit 8e54205

Please sign in to comment.