From cc36f2e7ff9414a27e6f4f1ff3c70f4baf38afe2 Mon Sep 17 00:00:00 2001 From: Anton Lozhkov Date: Thu, 20 Oct 2022 20:25:20 +0200 Subject: [PATCH] Bump the version to 0.7.0.dev0 (#912) * Bump the version to 0.7.0.dev0 * deprecate offsets * deprecate LMS timesteps * LMS 0.7.0->0.8.0 --- setup.py | 2 +- src/diffusers/__init__.py | 2 +- src/diffusers/schedulers/scheduling_ddim.py | 11 +++-------- src/diffusers/schedulers/scheduling_lms_discrete.py | 4 ++-- src/diffusers/schedulers/scheduling_pndm.py | 9 ++------- 5 files changed, 9 insertions(+), 19 deletions(-) diff --git a/setup.py b/setup.py index 7532feb5a3..b4c1613ba1 100644 --- a/setup.py +++ b/setup.py @@ -211,7 +211,7 @@ install_requires = [ setup( name="diffusers", - version="0.6.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.7.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", long_description=open("README.md", "r", encoding="utf-8").read(), long_description_content_type="text/markdown", diff --git a/src/diffusers/__init__.py b/src/diffusers/__init__.py index 02d98fb71c..8a0dbc9de1 100644 --- a/src/diffusers/__init__.py +++ b/src/diffusers/__init__.py @@ -9,7 +9,7 @@ from .utils import ( ) -__version__ = "0.6.0" +__version__ = "0.7.0.dev0" from .configuration_utils import ConfigMixin from .onnx_utils import OnnxRuntimeModel diff --git a/src/diffusers/schedulers/scheduling_ddim.py b/src/diffusers/schedulers/scheduling_ddim.py index 612c24f807..b94cada4ce 100644 --- a/src/diffusers/schedulers/scheduling_ddim.py +++ b/src/diffusers/schedulers/scheduling_ddim.py @@ -23,7 +23,7 @@ import numpy as np import torch from ..configuration_utils import ConfigMixin, register_to_config -from ..utils import BaseOutput, deprecate +from ..utils import BaseOutput from .scheduling_utils import SchedulerMixin @@ -175,7 +175,7 @@ class DDIMScheduler(SchedulerMixin, ConfigMixin): return variance - def set_timesteps(self, num_inference_steps: int, device: Union[str, torch.device] = None, **kwargs): + def set_timesteps(self, num_inference_steps: int, device: Union[str, torch.device] = None): """ Sets the discrete timesteps used for the diffusion chain. Supporting function to be run before inference. @@ -183,18 +183,13 @@ class DDIMScheduler(SchedulerMixin, ConfigMixin): num_inference_steps (`int`): the number of diffusion steps used when generating samples with a pre-trained model. """ - deprecated_offset = deprecate( - "offset", "0.7.0", "Please pass `steps_offset` to `__init__` instead.", take_from=kwargs - ) - offset = deprecated_offset or self.config.steps_offset - self.num_inference_steps = num_inference_steps step_ratio = self.config.num_train_timesteps // self.num_inference_steps # creates integer timesteps by multiplying by ratio # casting to int to avoid issues when num_inference_step is power of 3 timesteps = (np.arange(0, num_inference_steps) * step_ratio).round()[::-1].copy().astype(np.int64) self.timesteps = torch.from_numpy(timesteps).to(device) - self.timesteps += offset + self.timesteps += self.config.steps_offset def step( self, diff --git a/src/diffusers/schedulers/scheduling_lms_discrete.py b/src/diffusers/schedulers/scheduling_lms_discrete.py index 1b8ca7c5df..2a5c1c3954 100644 --- a/src/diffusers/schedulers/scheduling_lms_discrete.py +++ b/src/diffusers/schedulers/scheduling_lms_discrete.py @@ -209,7 +209,7 @@ class LMSDiscreteScheduler(SchedulerMixin, ConfigMixin): ): deprecate( "timestep as an index", - "0.7.0", + "0.8.0", "Passing integer indices (e.g. from `enumerate(timesteps)`) as timesteps to" " `LMSDiscreteScheduler.step()` will not be supported in future versions. Make sure to pass" " one of the `scheduler.timesteps` as a timestep.", @@ -259,7 +259,7 @@ class LMSDiscreteScheduler(SchedulerMixin, ConfigMixin): if isinstance(timesteps, torch.IntTensor) or isinstance(timesteps, torch.LongTensor): deprecate( "timesteps as indices", - "0.7.0", + "0.8.0", "Passing integer indices (e.g. from `enumerate(timesteps)`) as timesteps to" " `LMSDiscreteScheduler.add_noise()` will not be supported in future versions. Make sure to" " pass values from `scheduler.timesteps` as timesteps.", diff --git a/src/diffusers/schedulers/scheduling_pndm.py b/src/diffusers/schedulers/scheduling_pndm.py index 829329d2e1..03ea5c15d1 100644 --- a/src/diffusers/schedulers/scheduling_pndm.py +++ b/src/diffusers/schedulers/scheduling_pndm.py @@ -21,7 +21,6 @@ import numpy as np import torch from ..configuration_utils import ConfigMixin, register_to_config -from ..utils import deprecate from .scheduling_utils import SchedulerMixin, SchedulerOutput @@ -142,7 +141,7 @@ class PNDMScheduler(SchedulerMixin, ConfigMixin): self.plms_timesteps = None self.timesteps = None - def set_timesteps(self, num_inference_steps: int, device: Union[str, torch.device] = None, **kwargs): + def set_timesteps(self, num_inference_steps: int, device: Union[str, torch.device] = None): """ Sets the discrete timesteps used for the diffusion chain. Supporting function to be run before inference. @@ -150,17 +149,13 @@ class PNDMScheduler(SchedulerMixin, ConfigMixin): num_inference_steps (`int`): the number of diffusion steps used when generating samples with a pre-trained model. """ - deprecated_offset = deprecate( - "offset", "0.7.0", "Please pass `steps_offset` to `__init__` instead.", take_from=kwargs - ) - offset = deprecated_offset or self.config.steps_offset self.num_inference_steps = num_inference_steps step_ratio = self.config.num_train_timesteps // self.num_inference_steps # creates integer timesteps by multiplying by ratio # casting to int to avoid issues when num_inference_step is power of 3 self._timesteps = (np.arange(0, num_inference_steps) * step_ratio).round() - self._timesteps += offset + self._timesteps += self.config.steps_offset if self.config.skip_prk_steps: # for some models like stable diffusion the prk steps can/should be skipped to