Skip to content

Commit

Permalink
support testing without diffusers
Browse files Browse the repository at this point in the history
  • Loading branch information
IlyasMoutawwakil committed Sep 11, 2024
1 parent 56d06d4 commit 475efdf
Show file tree
Hide file tree
Showing 3 changed files with 113 additions and 38 deletions.
16 changes: 16 additions & 0 deletions optimum/onnxruntime/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@
"ORTPipelineForInpainting",
"ORTPipelineForText2Image",
"ORTDiffusionPipeline",
"ORTModelTextEncoder",
"ORTModelUnet",
"ORTModelVaeDecoder",
"ORTModelVaeEncoder",
]
else:
_import_structure["modeling_diffusion"] = [
Expand All @@ -96,6 +100,10 @@
"ORTPipelineForInpainting",
"ORTPipelineForText2Image",
"ORTDiffusionPipeline",
"ORTModelTextEncoder",
"ORTModelUnet",
"ORTModelVaeDecoder",
"ORTModelVaeEncoder",
]


Expand Down Expand Up @@ -147,6 +155,10 @@
from ..utils.dummy_diffusers_objects import (
ORTDiffusionPipeline,
ORTLatentConsistencyModelPipeline,
ORTModelTextEncoder,
ORTModelUnet,
ORTModelVaeDecoder,
ORTModelVaeEncoder,
ORTPipelineForImage2Image,
ORTPipelineForInpainting,
ORTPipelineForText2Image,
Expand All @@ -160,6 +172,10 @@
from .modeling_diffusion import (
ORTDiffusionPipeline,
ORTLatentConsistencyModelPipeline,
ORTModelTextEncoder,
ORTModelUnet,
ORTModelVaeDecoder,
ORTModelVaeEncoder,
ORTPipelineForImage2Image,
ORTPipelineForInpainting,
ORTPipelineForText2Image,
Expand Down
44 changes: 44 additions & 0 deletions optimum/utils/dummy_diffusers_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,3 +123,47 @@ def __init__(self, *args, **kwargs):
@classmethod
def from_pretrained(cls, *args, **kwargs):
requires_backends(cls, ["diffusers"])


class ORTModelTextEncoder(metaclass=DummyObject):
_backends = ["diffusers"]

def __init__(self, *args, **kwargs):
requires_backends(self, ["diffusers"])

@classmethod
def from_pretrained(cls, *args, **kwargs):
requires_backends(cls, ["diffusers"])


class ORTModelVaeDecoder(metaclass=DummyObject):
_backends = ["diffusers"]

def __init__(self, *args, **kwargs):
requires_backends(self, ["diffusers"])

@classmethod
def from_pretrained(cls, *args, **kwargs):
requires_backends(cls, ["diffusers"])


class ORTModelVaeEncoder(metaclass=DummyObject):
_backends = ["diffusers"]

def __init__(self, *args, **kwargs):
requires_backends(self, ["diffusers"])

@classmethod
def from_pretrained(cls, *args, **kwargs):
requires_backends(cls, ["diffusers"])


class ORTModelUnet(metaclass=DummyObject):
_backends = ["diffusers"]

def __init__(self, *args, **kwargs):
requires_backends(self, ["diffusers"])

@classmethod
def from_pretrained(cls, *args, **kwargs):
requires_backends(cls, ["diffusers"])
Loading

0 comments on commit 475efdf

Please sign in to comment.