Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for diffusers 0.29.0 #89

Merged
merged 1 commit into from
Jun 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions lib_layerdiffusion/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,23 @@
from typing import Optional, Tuple
from diffusers.configuration_utils import ConfigMixin, register_to_config
from diffusers.models.modeling_utils import ModelMixin
from diffusers.models.unet_2d_blocks import UNetMidBlock2D, get_down_block, get_up_block
import importlib.metadata
from packaging.version import parse

diffusers_version = importlib.metadata.version('diffusers')

def check_diffusers_version():
import diffusers
from packaging.version import parse

assert parse(diffusers.__version__) >= parse(
"0.25.0"
), "diffusers>=0.25.0 requirement not satisfied. Please install correct diffusers version."

def check_diffusers_version(min_version="0.25.0"):
assert parse(diffusers_version) >= parse(
min_version
), f"diffusers>={min_version} requirement not satisfied. Please install correct diffusers version."

check_diffusers_version()

if parse(diffusers_version) >= parse("0.29.0"):
from diffusers.models.unets.unet_2d_blocks import UNetMidBlock2D, get_down_block, get_up_block
else:
from diffusers.models.unet_2d_blocks import UNetMidBlock2D, get_down_block, get_up_block


def zero_module(module):
"""
Expand Down
Loading