Unverified Commit 09779cbb authored by Patrick von Platen's avatar Patrick von Platen Committed by GitHub
Browse files

[Bump version] 0.13.0dev0 & Deprecate `predict_epsilon` (#2109)

* [Bump version] 0.13

* Bump model up

* up
parent b0cc7c20
...@@ -185,7 +185,7 @@ class ImagicStableDiffusionPipeline(DiffusionPipeline): ...@@ -185,7 +185,7 @@ class ImagicStableDiffusionPipeline(DiffusionPipeline):
(nsfw) content, according to the `safety_checker`. (nsfw) content, according to the `safety_checker`.
""" """
message = "Please use `image` instead of `init_image`." message = "Please use `image` instead of `init_image`."
init_image = deprecate("init_image", "0.13.0", message, take_from=kwargs) init_image = deprecate("init_image", "0.14.0", message, take_from=kwargs)
image = init_image or image image = init_image or image
accelerator = Accelerator( accelerator = Accelerator(
......
...@@ -759,7 +759,7 @@ class StableDiffusionLongPromptWeightingPipeline(StableDiffusionPipeline): ...@@ -759,7 +759,7 @@ class StableDiffusionLongPromptWeightingPipeline(StableDiffusionPipeline):
(nsfw) content, according to the `safety_checker`. (nsfw) content, according to the `safety_checker`.
""" """
message = "Please use `image` instead of `init_image`." message = "Please use `image` instead of `init_image`."
init_image = deprecate("init_image", "0.13.0", message, take_from=kwargs) init_image = deprecate("init_image", "0.14.0", message, take_from=kwargs)
image = init_image or image image = init_image or image
# 0. Default height and width to unet # 0. Default height and width to unet
......
...@@ -745,7 +745,7 @@ class OnnxStableDiffusionLongPromptWeightingPipeline(OnnxStableDiffusionPipeline ...@@ -745,7 +745,7 @@ class OnnxStableDiffusionLongPromptWeightingPipeline(OnnxStableDiffusionPipeline
(nsfw) content, according to the `safety_checker`. (nsfw) content, according to the `safety_checker`.
""" """
message = "Please use `image` instead of `init_image`." message = "Please use `image` instead of `init_image`."
init_image = deprecate("init_image", "0.13.0", message, take_from=kwargs) init_image = deprecate("init_image", "0.14.0", message, take_from=kwargs)
image = init_image or image image = init_image or image
# 0. Default height and width to unet # 0. Default height and width to unet
......
...@@ -46,7 +46,7 @@ from transformers import AutoTokenizer, PretrainedConfig ...@@ -46,7 +46,7 @@ from transformers import AutoTokenizer, PretrainedConfig
# Will error if the minimal version of diffusers is not installed. Remove at your own risks. # Will error if the minimal version of diffusers is not installed. Remove at your own risks.
check_min_version("0.12.0") check_min_version("0.13.0.dev0")
logger = get_logger(__name__) logger = get_logger(__name__)
......
...@@ -36,7 +36,7 @@ from transformers import CLIPFeatureExtractor, CLIPTokenizer, FlaxCLIPTextModel, ...@@ -36,7 +36,7 @@ from transformers import CLIPFeatureExtractor, CLIPTokenizer, FlaxCLIPTextModel,
# Will error if the minimal version of diffusers is not installed. Remove at your own risks. # Will error if the minimal version of diffusers is not installed. Remove at your own risks.
check_min_version("0.12.0") check_min_version("0.13.0.dev0")
# Cache compiled models across invocations of this script. # Cache compiled models across invocations of this script.
cc.initialize_cache(os.path.expanduser("~/.cache/jax/compilation_cache")) cc.initialize_cache(os.path.expanduser("~/.cache/jax/compilation_cache"))
......
...@@ -54,7 +54,7 @@ from transformers import AutoTokenizer, PretrainedConfig ...@@ -54,7 +54,7 @@ from transformers import AutoTokenizer, PretrainedConfig
# Will error if the minimal version of diffusers is not installed. Remove at your own risks. # Will error if the minimal version of diffusers is not installed. Remove at your own risks.
check_min_version("0.12.0") check_min_version("0.13.0.dev0")
logger = get_logger(__name__) logger = get_logger(__name__)
......
...@@ -45,7 +45,7 @@ from transformers import CLIPTextModel, CLIPTokenizer ...@@ -45,7 +45,7 @@ from transformers import CLIPTextModel, CLIPTokenizer
# Will error if the minimal version of diffusers is not installed. Remove at your own risks. # Will error if the minimal version of diffusers is not installed. Remove at your own risks.
check_min_version("0.12.0") check_min_version("0.13.0.dev0")
logger = get_logger(__name__, log_level="INFO") logger = get_logger(__name__, log_level="INFO")
......
...@@ -34,7 +34,7 @@ from transformers import CLIPFeatureExtractor, CLIPTokenizer, FlaxCLIPTextModel, ...@@ -34,7 +34,7 @@ from transformers import CLIPFeatureExtractor, CLIPTokenizer, FlaxCLIPTextModel,
# Will error if the minimal version of diffusers is not installed. Remove at your own risks. # Will error if the minimal version of diffusers is not installed. Remove at your own risks.
check_min_version("0.12.0") check_min_version("0.13.0.dev0")
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
......
...@@ -47,7 +47,7 @@ from transformers import CLIPTextModel, CLIPTokenizer ...@@ -47,7 +47,7 @@ from transformers import CLIPTextModel, CLIPTokenizer
# Will error if the minimal version of diffusers is not installed. Remove at your own risks. # Will error if the minimal version of diffusers is not installed. Remove at your own risks.
check_min_version("0.12.0") check_min_version("0.13.0.dev0")
logger = get_logger(__name__, log_level="INFO") logger = get_logger(__name__, log_level="INFO")
......
...@@ -68,7 +68,7 @@ else: ...@@ -68,7 +68,7 @@ else:
# Will error if the minimal version of diffusers is not installed. Remove at your own risks. # Will error if the minimal version of diffusers is not installed. Remove at your own risks.
check_min_version("0.12.0") check_min_version("0.13.0.dev0")
logger = get_logger(__name__) logger = get_logger(__name__)
......
...@@ -57,7 +57,7 @@ else: ...@@ -57,7 +57,7 @@ else:
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# Will error if the minimal version of diffusers is not installed. Remove at your own risks. # Will error if the minimal version of diffusers is not installed. Remove at your own risks.
check_min_version("0.12.0") check_min_version("0.13.0.dev0")
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
......
...@@ -33,7 +33,7 @@ from tqdm.auto import tqdm ...@@ -33,7 +33,7 @@ from tqdm.auto import tqdm
# Will error if the minimal version of diffusers is not installed. Remove at your own risks. # Will error if the minimal version of diffusers is not installed. Remove at your own risks.
check_min_version("0.12.0") check_min_version("0.13.0.dev0")
logger = get_logger(__name__, log_level="INFO") logger = get_logger(__name__, log_level="INFO")
......
...@@ -30,7 +30,7 @@ from tqdm.auto import tqdm ...@@ -30,7 +30,7 @@ from tqdm.auto import tqdm
# Will error if the minimal version of diffusers is not installed. Remove at your own risks. # Will error if the minimal version of diffusers is not installed. Remove at your own risks.
check_min_version("0.12.0") check_min_version("0.13.0.dev0")
logger = get_logger(__name__) logger = get_logger(__name__)
......
...@@ -219,7 +219,7 @@ install_requires = [ ...@@ -219,7 +219,7 @@ install_requires = [
setup( setup(
name="diffusers", name="diffusers",
version="0.12.0", # expected format is one of x.y.z.dev0, or x.y.z.rc1 or x.y.z (no to dashes, yes to dots) version="0.13.0.dev0", # expected format is one of x.y.z.dev0, or x.y.z.rc1 or x.y.z (no to dashes, yes to dots)
description="Diffusers", description="Diffusers",
long_description=open("README.md", "r", encoding="utf-8").read(), long_description=open("README.md", "r", encoding="utf-8").read(),
long_description_content_type="text/markdown", long_description_content_type="text/markdown",
......
__version__ = "0.12.0" __version__ = "0.13.0.dev0"
from .configuration_utils import ConfigMixin from .configuration_utils import ConfigMixin
from .utils import ( from .utils import (
......
...@@ -606,7 +606,7 @@ class AltDiffusionImg2ImgPipeline(DiffusionPipeline): ...@@ -606,7 +606,7 @@ class AltDiffusionImg2ImgPipeline(DiffusionPipeline):
(nsfw) content, according to the `safety_checker`. (nsfw) content, according to the `safety_checker`.
""" """
message = "Please use `image` instead of `init_image`." message = "Please use `image` instead of `init_image`."
init_image = deprecate("init_image", "0.13.0", message, take_from=kwargs) init_image = deprecate("init_image", "0.14.0", message, take_from=kwargs)
image = init_image or image image = init_image or image
# 1. Check inputs. Raise error if not correct # 1. Check inputs. Raise error if not correct
......
...@@ -17,8 +17,7 @@ from typing import List, Optional, Tuple, Union ...@@ -17,8 +17,7 @@ from typing import List, Optional, Tuple, Union
import torch import torch
from ...configuration_utils import FrozenDict from ...utils import randn_tensor
from ...utils import deprecate, randn_tensor
from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput
...@@ -46,7 +45,6 @@ class DDPMPipeline(DiffusionPipeline): ...@@ -46,7 +45,6 @@ class DDPMPipeline(DiffusionPipeline):
num_inference_steps: int = 1000, num_inference_steps: int = 1000,
output_type: Optional[str] = "pil", output_type: Optional[str] = "pil",
return_dict: bool = True, return_dict: bool = True,
**kwargs,
) -> Union[ImagePipelineOutput, Tuple]: ) -> Union[ImagePipelineOutput, Tuple]:
r""" r"""
Args: Args:
...@@ -68,30 +66,6 @@ class DDPMPipeline(DiffusionPipeline): ...@@ -68,30 +66,6 @@ class DDPMPipeline(DiffusionPipeline):
[`~pipelines.ImagePipelineOutput`] or `tuple`: [`~pipelines.utils.ImagePipelineOutput`] if `return_dict` is [`~pipelines.ImagePipelineOutput`] or `tuple`: [`~pipelines.utils.ImagePipelineOutput`] if `return_dict` is
True, otherwise a `tuple. When returning a tuple, the first element is a list with the generated images. True, otherwise a `tuple. When returning a tuple, the first element is a list with the generated images.
""" """
message = (
"Please make sure to instantiate your scheduler with `prediction_type` instead. E.g. `scheduler ="
" DDPMScheduler.from_pretrained(<model_id>, prediction_type='epsilon')`."
)
predict_epsilon = deprecate("predict_epsilon", "0.13.0", message, take_from=kwargs)
if predict_epsilon is not None:
new_config = dict(self.scheduler.config)
new_config["prediction_type"] = "epsilon" if predict_epsilon else "sample"
self.scheduler._internal_dict = FrozenDict(new_config)
if generator is not None and generator.device.type != self.device.type and self.device.type != "mps":
message = (
f"The `generator` device is `{generator.device}` and does not match the pipeline "
f"device `{self.device}`, so the `generator` will be ignored. "
f'Please use `torch.Generator(device="{self.device}")` instead.'
)
deprecate(
"generator.device == 'cpu'",
"0.13.0",
message,
)
generator = None
# Sample gaussian noise to begin loop # Sample gaussian noise to begin loop
if isinstance(self.unet.sample_size, int): if isinstance(self.unet.sample_size, int):
image_shape = (batch_size, self.unet.in_channels, self.unet.sample_size, self.unet.sample_size) image_shape = (batch_size, self.unet.in_channels, self.unet.sample_size, self.unet.sample_size)
......
...@@ -102,7 +102,7 @@ class LDMSuperResolutionPipeline(DiffusionPipeline): ...@@ -102,7 +102,7 @@ class LDMSuperResolutionPipeline(DiffusionPipeline):
True, otherwise a `tuple. When returning a tuple, the first element is a list with the generated images. True, otherwise a `tuple. When returning a tuple, the first element is a list with the generated images.
""" """
message = "Please use `image` instead of `init_image`." message = "Please use `image` instead of `init_image`."
init_image = deprecate("init_image", "0.13.0", message, take_from=kwargs) init_image = deprecate("init_image", "0.14.0", message, take_from=kwargs)
image = init_image or image image = init_image or image
if isinstance(image, PIL.Image.Image): if isinstance(image, PIL.Image.Image):
......
...@@ -623,7 +623,7 @@ class CycleDiffusionPipeline(DiffusionPipeline): ...@@ -623,7 +623,7 @@ class CycleDiffusionPipeline(DiffusionPipeline):
(nsfw) content, according to the `safety_checker`. (nsfw) content, according to the `safety_checker`.
""" """
message = "Please use `image` instead of `init_image`." message = "Please use `image` instead of `init_image`."
init_image = deprecate("init_image", "0.13.0", message, take_from=kwargs) init_image = deprecate("init_image", "0.14.0", message, take_from=kwargs)
image = init_image or image image = init_image or image
# 1. Check inputs # 1. Check inputs
......
...@@ -311,7 +311,7 @@ class OnnxStableDiffusionImg2ImgPipeline(DiffusionPipeline): ...@@ -311,7 +311,7 @@ class OnnxStableDiffusionImg2ImgPipeline(DiffusionPipeline):
(nsfw) content, according to the `safety_checker`. (nsfw) content, according to the `safety_checker`.
""" """
message = "Please use `image` instead of `init_image`." message = "Please use `image` instead of `init_image`."
init_image = deprecate("init_image", "0.13.0", message, take_from=kwargs) init_image = deprecate("init_image", "0.14.0", message, take_from=kwargs)
image = init_image or image image = init_image or image
if isinstance(prompt, str): if isinstance(prompt, str):
......
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