Unverified Commit 3d2f24b0 authored by Damian Stewart's avatar Damian Stewart Committed by GitHub
Browse files

Module-ise "original stable diffusion to diffusers" conversion script (#2019)



* convert __main__ to a function call and call it

* add missing type hint

* make style check pass

* move loading to src/diffusers
Co-authored-by: default avatarPatrick von Platen <patrick.v.platen@gmail.com>
parent bcb47679
This diff is collapsed.
......@@ -48,6 +48,7 @@ from .import_utils import (
is_k_diffusion_available,
is_k_diffusion_version,
is_librosa_available,
is_omegaconf_available,
is_onnx_available,
is_safetensors_available,
is_scipy_available,
......
......@@ -213,10 +213,17 @@ except importlib_metadata.PackageNotFoundError:
_wandb_available = importlib.util.find_spec("wandb") is not None
try:
_wandb_version = importlib_metadata.version("wandb")
logger.debug(f"Successfully imported k-diffusion version {_wandb_version }")
logger.debug(f"Successfully imported wandb version {_wandb_version }")
except importlib_metadata.PackageNotFoundError:
_wandb_available = False
_omegaconf_available = importlib.util.find_spec("omegaconf") is not None
try:
_omegaconf_version = importlib_metadata.version("omegaconf")
logger.debug(f"Successfully imported omegaconf version {_omegaconf_version}")
except importlib_metadata.PackageNotFoundError:
_omegaconf_available = False
def is_torch_available():
return _torch_available
......@@ -274,6 +281,10 @@ def is_wandb_available():
return _wandb_available
def is_omegaconf_available():
return _omegaconf_available
# docstyle-ignore
FLAX_IMPORT_ERROR = """
{0} requires the FLAX library but it was not found in your environment. Checkout the instructions on the
......@@ -334,6 +345,11 @@ WANDB_IMPORT_ERROR = """
install wandb`
"""
# docstyle-ignore
OMEGACONF_IMPORT_ERROR = """
{0} requires the omegaconf library but it was not found in your environment. You can install it with pip: `pip
install omegaconf`
"""
BACKENDS_MAPPING = OrderedDict(
[
......@@ -347,6 +363,7 @@ BACKENDS_MAPPING = OrderedDict(
("librosa", (is_librosa_available, LIBROSA_IMPORT_ERROR)),
("k_diffusion", (is_k_diffusion_available, K_DIFFUSION_IMPORT_ERROR)),
("wandb", (is_wandb_available, WANDB_IMPORT_ERROR)),
("omageconf", (is_omegaconf_available, OMEGACONF_IMPORT_ERROR)),
]
)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment