Unverified Commit 08839682 authored by Anton Lozhkov's avatar Anton Lozhkov Committed by GitHub
Browse files

Better steps deprecation for LMS (#753)

* Better steps deprecation for LMS

* upd
parent 6c647419
...@@ -215,9 +215,13 @@ class LMSDiscreteScheduler(SchedulerMixin, ConfigMixin): ...@@ -215,9 +215,13 @@ class LMSDiscreteScheduler(SchedulerMixin, ConfigMixin):
or isinstance(timestep, torch.IntTensor) or isinstance(timestep, torch.IntTensor)
or isinstance(timestep, torch.LongTensor) or isinstance(timestep, torch.LongTensor)
): ):
warnings.warn( deprecate(
"Integer timesteps in `LMSDiscreteScheduler.step()` are deprecated and will be removed in version" "timestep as an index",
" 0.5.0. Make sure to pass one of the `scheduler.timesteps`." "0.5.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 step_index = timestep
else: else:
...@@ -257,9 +261,13 @@ class LMSDiscreteScheduler(SchedulerMixin, ConfigMixin): ...@@ -257,9 +261,13 @@ class LMSDiscreteScheduler(SchedulerMixin, ConfigMixin):
schedule_timesteps = self.timesteps.to(original_samples.device) schedule_timesteps = self.timesteps.to(original_samples.device)
timesteps = timesteps.to(original_samples.device) timesteps = timesteps.to(original_samples.device)
if isinstance(timesteps, torch.IntTensor) or isinstance(timesteps, torch.LongTensor): if isinstance(timesteps, torch.IntTensor) or isinstance(timesteps, torch.LongTensor):
warnings.warn( deprecate(
"Integer timesteps in `LMSDiscreteScheduler.add_noise()` are deprecated and will be removed in" "timesteps as indices",
" version 0.5.0. Make sure to pass values from `scheduler.timesteps`." "0.5.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 step_indices = timesteps
else: else:
......
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