Skip to content

Commit 87dcf54

Browse files
committed
skip scheduler
1 parent 56ac8b4 commit 87dcf54

File tree

7 files changed

+10
-48
lines changed

7 files changed

+10
-48
lines changed

src/diffusers/pipelines/kandinsky2_2/pipeline_kandinsky2_2.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import torch
1818

1919
from ...models import UNet2DConditionModel, VQModel
20-
from ...schedulers import DDPMScheduler, UnCLIPScheduler
20+
from ...schedulers import DDPMScheduler
2121
from ...utils import deprecate, logging, replace_example_docstring
2222
from ...utils.torch_utils import randn_tensor
2323
from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput
@@ -83,7 +83,7 @@ class KandinskyV22Pipeline(DiffusionPipeline):
8383
def __init__(
8484
self,
8585
unet: UNet2DConditionModel,
86-
scheduler: Union[DDPMScheduler, UnCLIPScheduler],
86+
scheduler: DDPMScheduler,
8787
movq: VQModel,
8888
):
8989
super().__init__()

src/diffusers/pipelines/kandinsky2_2/pipeline_kandinsky2_2_combined.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,13 +140,13 @@ class KandinskyV22CombinedPipeline(DiffusionPipeline):
140140
def __init__(
141141
self,
142142
unet: UNet2DConditionModel,
143-
scheduler: Union[DDPMScheduler, UnCLIPScheduler],
143+
scheduler: DDPMScheduler,
144144
movq: VQModel,
145145
prior_prior: PriorTransformer,
146146
prior_image_encoder: CLIPVisionModelWithProjection,
147147
prior_text_encoder: CLIPTextModelWithProjection,
148148
prior_tokenizer: CLIPTokenizer,
149-
prior_scheduler: Union[DDPMScheduler, UnCLIPScheduler],
149+
prior_scheduler: UnCLIPScheduler,
150150
prior_image_processor: CLIPImageProcessor,
151151
):
152152
super().__init__()

src/diffusers/pipelines/kandinsky2_2/pipeline_kandinsky2_2_prior.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from transformers import CLIPImageProcessor, CLIPTextModelWithProjection, CLIPTokenizer, CLIPVisionModelWithProjection
66

77
from ...models import PriorTransformer
8-
from ...schedulers import DDPMScheduler, UnCLIPScheduler
8+
from ...schedulers import UnCLIPScheduler
99
from ...utils import (
1010
logging,
1111
replace_example_docstring,
@@ -114,7 +114,7 @@ def __init__(
114114
image_encoder: CLIPVisionModelWithProjection,
115115
text_encoder: CLIPTextModelWithProjection,
116116
tokenizer: CLIPTokenizer,
117-
scheduler: Union[DDPMScheduler, UnCLIPScheduler],
117+
scheduler: UnCLIPScheduler,
118118
image_processor: CLIPImageProcessor,
119119
):
120120
super().__init__()

src/diffusers/pipelines/pipeline_utils.py

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@
4646
from ..models.attention_processor import FusedAttnProcessor2_0
4747
from ..models.modeling_utils import _LOW_CPU_MEM_USAGE_DEFAULT, ModelMixin
4848
from ..quantizers.bitsandbytes.utils import _check_bnb_status
49-
from ..schedulers.scheduling_utils import SCHEDULER_CONFIG_NAME, SchedulerMixin
50-
from ..schedulers.scheduling_utils_flax import FlaxSchedulerMixin
49+
from ..schedulers.scheduling_utils import SCHEDULER_CONFIG_NAME
5150
from ..utils import (
5251
CONFIG_NAME,
5352
DEPRECATED_REVISION_ARGS,
@@ -839,6 +838,8 @@ def load_module(name, value):
839838
for key in init_dict.keys():
840839
if key not in passed_class_obj:
841840
continue
841+
if "scheduler" in key:
842+
continue
842843

843844
class_obj = passed_class_obj[key]
844845
_expected_class_types = []
@@ -849,16 +850,7 @@ def load_module(name, value):
849850
_expected_class_types.append(expected_type.__name__)
850851

851852
_is_valid_type = class_obj.__class__.__name__ in _expected_class_types
852-
if (
853-
isinstance(class_obj, SchedulerMixin) or isinstance(class_obj, FlaxSchedulerMixin)
854-
) and not _is_valid_type:
855-
_requires_flow_match = any("FlowMatch" in class_type for class_type in _expected_class_types)
856-
_is_flow_match = "FlowMatch" in class_obj.__class__.__name__
857-
if _requires_flow_match and not _is_flow_match:
858-
logger.warning(f"Expected FlowMatch scheduler, got {class_obj.__class__.__name__}.")
859-
elif not _requires_flow_match and _is_flow_match:
860-
logger.warning(f"Expected non-FlowMatch scheduler, got {class_obj.__class__.__name__}.")
861-
elif not _is_valid_type:
853+
if not _is_valid_type:
862854
logger.warning(
863855
f"Expected types for {key}: {_expected_class_types}, got {class_obj.__class__.__name__}."
864856
)

src/diffusers/schedulers/scheduling_utils.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ class KarrasDiffusionSchedulers(Enum):
4646
UniPCMultistepScheduler = 13
4747
DPMSolverSDEScheduler = 14
4848
EDMEulerScheduler = 15
49-
LCMScheduler = 16
5049

5150

5251
AysSchedules = {

tests/pipelines/stable_diffusion_2/test_stable_diffusion_latent_upscale.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,6 @@ def test_karras_schedulers_shape(self):
250250
"KDPM2AncestralDiscreteScheduler",
251251
"DPMSolverSDEScheduler",
252252
"EDMEulerScheduler",
253-
"LCMScheduler",
254253
]
255254
components = self.get_dummy_components()
256255
pipe = self.pipeline_class(**components)

tests/pipelines/test_pipelines.py

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@
4747
DPMSolverMultistepScheduler,
4848
EulerAncestralDiscreteScheduler,
4949
EulerDiscreteScheduler,
50-
FlowMatchEulerDiscreteScheduler,
51-
FluxPipeline,
5250
LMSDiscreteScheduler,
5351
ModelMixin,
5452
PNDMScheduler,
@@ -1814,32 +1812,6 @@ def test_wrong_model(self):
18141812
assert "is of type" in str(error_context.exception)
18151813
assert "but should be" in str(error_context.exception)
18161814

1817-
def test_wrong_model_scheduler_type(self):
1818-
scheduler = EulerDiscreteScheduler.from_pretrained("hf-internal-testing/tiny-flux-pipe", subfolder="scheduler")
1819-
with self.assertLogs(
1820-
logging.get_logger("diffusers.pipelines.pipeline_utils"), level="WARNING"
1821-
) as warning_context:
1822-
_ = FluxPipeline.from_pretrained("hf-internal-testing/tiny-flux-pipe", scheduler=scheduler)
1823-
1824-
assert any("Expected" in message for message in warning_context.output)
1825-
assert any("scheduler" in message for message in warning_context.output)
1826-
assert any("EulerDiscreteScheduler" in message for message in warning_context.output)
1827-
1828-
def test_wrong_model_scheduler_enum(self):
1829-
scheduler = FlowMatchEulerDiscreteScheduler.from_pretrained(
1830-
"hf-internal-testing/diffusers-stable-diffusion-tiny-all", subfolder="scheduler"
1831-
)
1832-
with self.assertLogs(
1833-
logging.get_logger("diffusers.pipelines.pipeline_utils"), level="WARNING"
1834-
) as warning_context:
1835-
_ = StableDiffusionPipeline.from_pretrained(
1836-
"hf-internal-testing/diffusers-stable-diffusion-tiny-all", scheduler=scheduler
1837-
)
1838-
1839-
assert any("Expected" in message for message in warning_context.output)
1840-
assert any("scheduler" in message for message in warning_context.output)
1841-
assert any("FlowMatchEulerDiscreteScheduler" in message for message in warning_context.output)
1842-
18431815

18441816
@slow
18451817
@require_torch_gpu

0 commit comments

Comments
 (0)