"vscode:/vscode.git/clone" did not exist on "ed8e9c4440c204d19a138bcc552ee476c3a7cbc1"
Unverified Commit cc36f2e7 authored by Anton Lozhkov's avatar Anton Lozhkov Committed by GitHub
Browse files

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
parent ba74a8be
...@@ -211,7 +211,7 @@ install_requires = [ ...@@ -211,7 +211,7 @@ install_requires = [
setup( setup(
name="diffusers", 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", 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",
......
...@@ -9,7 +9,7 @@ from .utils import ( ...@@ -9,7 +9,7 @@ from .utils import (
) )
__version__ = "0.6.0" __version__ = "0.7.0.dev0"
from .configuration_utils import ConfigMixin from .configuration_utils import ConfigMixin
from .onnx_utils import OnnxRuntimeModel from .onnx_utils import OnnxRuntimeModel
......
...@@ -23,7 +23,7 @@ import numpy as np ...@@ -23,7 +23,7 @@ import numpy as np
import torch import torch
from ..configuration_utils import ConfigMixin, register_to_config from ..configuration_utils import ConfigMixin, register_to_config
from ..utils import BaseOutput, deprecate from ..utils import BaseOutput
from .scheduling_utils import SchedulerMixin from .scheduling_utils import SchedulerMixin
...@@ -175,7 +175,7 @@ class DDIMScheduler(SchedulerMixin, ConfigMixin): ...@@ -175,7 +175,7 @@ class DDIMScheduler(SchedulerMixin, ConfigMixin):
return variance 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. Sets the discrete timesteps used for the diffusion chain. Supporting function to be run before inference.
...@@ -183,18 +183,13 @@ class DDIMScheduler(SchedulerMixin, ConfigMixin): ...@@ -183,18 +183,13 @@ class DDIMScheduler(SchedulerMixin, ConfigMixin):
num_inference_steps (`int`): num_inference_steps (`int`):
the number of diffusion steps used when generating samples with a pre-trained model. 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 self.num_inference_steps = num_inference_steps
step_ratio = self.config.num_train_timesteps // self.num_inference_steps step_ratio = self.config.num_train_timesteps // self.num_inference_steps
# creates integer timesteps by multiplying by ratio # creates integer timesteps by multiplying by ratio
# casting to int to avoid issues when num_inference_step is power of 3 # 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) 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 = torch.from_numpy(timesteps).to(device)
self.timesteps += offset self.timesteps += self.config.steps_offset
def step( def step(
self, self,
......
...@@ -209,7 +209,7 @@ class LMSDiscreteScheduler(SchedulerMixin, ConfigMixin): ...@@ -209,7 +209,7 @@ class LMSDiscreteScheduler(SchedulerMixin, ConfigMixin):
): ):
deprecate( deprecate(
"timestep as an index", "timestep as an index",
"0.7.0", "0.8.0",
"Passing integer indices (e.g. from `enumerate(timesteps)`) as timesteps to" "Passing integer indices (e.g. from `enumerate(timesteps)`) as timesteps to"
" `LMSDiscreteScheduler.step()` will not be supported in future versions. Make sure to pass" " `LMSDiscreteScheduler.step()` will not be supported in future versions. Make sure to pass"
" one of the `scheduler.timesteps` as a timestep.", " one of the `scheduler.timesteps` as a timestep.",
...@@ -259,7 +259,7 @@ class LMSDiscreteScheduler(SchedulerMixin, ConfigMixin): ...@@ -259,7 +259,7 @@ class LMSDiscreteScheduler(SchedulerMixin, ConfigMixin):
if isinstance(timesteps, torch.IntTensor) or isinstance(timesteps, torch.LongTensor): if isinstance(timesteps, torch.IntTensor) or isinstance(timesteps, torch.LongTensor):
deprecate( deprecate(
"timesteps as indices", "timesteps as indices",
"0.7.0", "0.8.0",
"Passing integer indices (e.g. from `enumerate(timesteps)`) as timesteps to" "Passing integer indices (e.g. from `enumerate(timesteps)`) as timesteps to"
" `LMSDiscreteScheduler.add_noise()` will not be supported in future versions. Make sure to" " `LMSDiscreteScheduler.add_noise()` will not be supported in future versions. Make sure to"
" pass values from `scheduler.timesteps` as timesteps.", " pass values from `scheduler.timesteps` as timesteps.",
......
...@@ -21,7 +21,6 @@ import numpy as np ...@@ -21,7 +21,6 @@ import numpy as np
import torch import torch
from ..configuration_utils import ConfigMixin, register_to_config from ..configuration_utils import ConfigMixin, register_to_config
from ..utils import deprecate
from .scheduling_utils import SchedulerMixin, SchedulerOutput from .scheduling_utils import SchedulerMixin, SchedulerOutput
...@@ -142,7 +141,7 @@ class PNDMScheduler(SchedulerMixin, ConfigMixin): ...@@ -142,7 +141,7 @@ class PNDMScheduler(SchedulerMixin, ConfigMixin):
self.plms_timesteps = None self.plms_timesteps = None
self.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. Sets the discrete timesteps used for the diffusion chain. Supporting function to be run before inference.
...@@ -150,17 +149,13 @@ class PNDMScheduler(SchedulerMixin, ConfigMixin): ...@@ -150,17 +149,13 @@ class PNDMScheduler(SchedulerMixin, ConfigMixin):
num_inference_steps (`int`): num_inference_steps (`int`):
the number of diffusion steps used when generating samples with a pre-trained model. 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 self.num_inference_steps = num_inference_steps
step_ratio = self.config.num_train_timesteps // self.num_inference_steps step_ratio = self.config.num_train_timesteps // self.num_inference_steps
# creates integer timesteps by multiplying by ratio # creates integer timesteps by multiplying by ratio
# casting to int to avoid issues when num_inference_step is power of 3 # 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 = (np.arange(0, num_inference_steps) * step_ratio).round()
self._timesteps += offset self._timesteps += self.config.steps_offset
if self.config.skip_prk_steps: if self.config.skip_prk_steps:
# for some models like stable diffusion the prk steps can/should be skipped to # for some models like stable diffusion the prk steps can/should be skipped to
......
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