Skip to content

Commit

Permalink
Bump to 0.8.0.dev0 (open-mmlab#1131)
Browse files Browse the repository at this point in the history
* Bump to 0.8.0.dev0

* deprecate int timesteps

* style
  • Loading branch information
anton-l authored Nov 4, 2022
1 parent a480229 commit 2fcae69
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 60 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ def run(self):

setup(
name="diffusers",
version="0.7.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.8.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",
Expand Down
2 changes: 1 addition & 1 deletion src/diffusers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
)


__version__ = "0.7.0"
__version__ = "0.8.0.dev0"

from .configuration_utils import ConfigMixin
from .onnx_utils import OnnxRuntimeModel
Expand Down
16 changes: 2 additions & 14 deletions src/diffusers/schedulers/scheduling_euler_ancestral_discrete.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import torch

from ..configuration_utils import ConfigMixin, register_to_config
from ..utils import BaseOutput, deprecate, logging
from ..utils import BaseOutput, logging
from .scheduling_utils import SchedulerMixin


Expand Down Expand Up @@ -253,19 +253,7 @@ def add_noise(
timesteps = timesteps.to(original_samples.device)

schedule_timesteps = self.timesteps

if isinstance(timesteps, torch.IntTensor) or isinstance(timesteps, torch.LongTensor):
deprecate(
"timesteps as indices",
"0.8.0",
"Passing integer indices (e.g. from `enumerate(timesteps)`) as timesteps to"
" `EulerAncestralDiscreteScheduler.add_noise()` will not be supported in future versions. Make sure to"
" pass values from `scheduler.timesteps` as timesteps.",
standard_warn=False,
)
step_indices = timesteps
else:
step_indices = [(schedule_timesteps == t).nonzero().item() for t in timesteps]
step_indices = [(schedule_timesteps == t).nonzero().item() for t in timesteps]

sigma = self.sigmas[step_indices].flatten()
while len(sigma.shape) < len(original_samples.shape):
Expand Down
16 changes: 2 additions & 14 deletions src/diffusers/schedulers/scheduling_euler_discrete.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import torch

from ..configuration_utils import ConfigMixin, register_to_config
from ..utils import BaseOutput, deprecate, logging
from ..utils import BaseOutput, logging
from .scheduling_utils import SchedulerMixin


Expand Down Expand Up @@ -262,19 +262,7 @@ def add_noise(
timesteps = timesteps.to(original_samples.device)

schedule_timesteps = self.timesteps

if isinstance(timesteps, torch.IntTensor) or isinstance(timesteps, torch.LongTensor):
deprecate(
"timesteps as indices",
"0.8.0",
"Passing integer indices (e.g. from `enumerate(timesteps)`) as timesteps to"
" `EulerDiscreteScheduler.add_noise()` will not be supported in future versions. Make sure to"
" pass values from `scheduler.timesteps` as timesteps.",
standard_warn=False,
)
step_indices = timesteps
else:
step_indices = [(schedule_timesteps == t).nonzero().item() for t in timesteps]
step_indices = [(schedule_timesteps == t).nonzero().item() for t in timesteps]

sigma = self.sigmas[step_indices].flatten()
while len(sigma.shape) < len(original_samples.shape):
Expand Down
33 changes: 3 additions & 30 deletions src/diffusers/schedulers/scheduling_lms_discrete.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from scipy import integrate

from ..configuration_utils import ConfigMixin, register_to_config
from ..utils import BaseOutput, deprecate
from ..utils import BaseOutput
from .scheduling_utils import SchedulerMixin


Expand Down Expand Up @@ -211,22 +211,7 @@ def step(

if isinstance(timestep, torch.Tensor):
timestep = timestep.to(self.timesteps.device)
if (
isinstance(timestep, int)
or isinstance(timestep, torch.IntTensor)
or isinstance(timestep, torch.LongTensor)
):
deprecate(
"timestep as an index",
"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.",
standard_warn=False,
)
step_index = timestep
else:
step_index = (self.timesteps == timestep).nonzero().item()
step_index = (self.timesteps == timestep).nonzero().item()
sigma = self.sigmas[step_index]

# 1. compute predicted original sample (x_0) from sigma-scaled predicted noise
Expand Down Expand Up @@ -269,19 +254,7 @@ def add_noise(
timesteps = timesteps.to(original_samples.device)

schedule_timesteps = self.timesteps

if isinstance(timesteps, torch.IntTensor) or isinstance(timesteps, torch.LongTensor):
deprecate(
"timesteps as indices",
"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.",
standard_warn=False,
)
step_indices = timesteps
else:
step_indices = [(schedule_timesteps == t).nonzero().item() for t in timesteps]
step_indices = [(schedule_timesteps == t).nonzero().item() for t in timesteps]

sigma = self.sigmas[step_indices].flatten()
while len(sigma.shape) < len(original_samples.shape):
Expand Down

0 comments on commit 2fcae69

Please sign in to comment.