mirror of
https://github.com/huggingface/diffusers.git
synced 2025-12-07 21:14:44 +08:00
Compare commits
2 Commits
test-runne
...
fix-addnoi
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9c112aaaca | ||
|
|
0f348e5405 |
@@ -734,7 +734,16 @@ class DEISMultistepScheduler(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)
|
||||||
|
|
||||||
step_indices = [(schedule_timesteps == t).nonzero().item() for t in timesteps]
|
step_indices = []
|
||||||
|
for timestep in timesteps:
|
||||||
|
index_candidates = (schedule_timesteps == timestep).nonzero()
|
||||||
|
if len(index_candidates) == 0:
|
||||||
|
step_index = len(schedule_timesteps) - 1
|
||||||
|
elif len(index_candidates) > 1:
|
||||||
|
step_index = index_candidates[1].item()
|
||||||
|
else:
|
||||||
|
step_index = index_candidates[0].item()
|
||||||
|
step_indices.append(step_index)
|
||||||
|
|
||||||
sigma = sigmas[step_indices].flatten()
|
sigma = sigmas[step_indices].flatten()
|
||||||
while len(sigma.shape) < len(original_samples.shape):
|
while len(sigma.shape) < len(original_samples.shape):
|
||||||
|
|||||||
@@ -896,7 +896,16 @@ class DPMSolverMultistepScheduler(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)
|
||||||
|
|
||||||
step_indices = [(schedule_timesteps == t).nonzero().item() for t in timesteps]
|
step_indices = []
|
||||||
|
for timestep in timesteps:
|
||||||
|
index_candidates = (schedule_timesteps == timestep).nonzero()
|
||||||
|
if len(index_candidates) == 0:
|
||||||
|
step_index = len(schedule_timesteps) - 1
|
||||||
|
elif len(index_candidates) > 1:
|
||||||
|
step_index = index_candidates[1].item()
|
||||||
|
else:
|
||||||
|
step_index = index_candidates[0].item()
|
||||||
|
step_indices.append(step_index)
|
||||||
|
|
||||||
sigma = sigmas[step_indices].flatten()
|
sigma = sigmas[step_indices].flatten()
|
||||||
while len(sigma.shape) < len(original_samples.shape):
|
while len(sigma.shape) < len(original_samples.shape):
|
||||||
|
|||||||
@@ -891,7 +891,16 @@ class DPMSolverMultistepInverseScheduler(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)
|
||||||
|
|
||||||
step_indices = [(schedule_timesteps == t).nonzero().item() for t in timesteps]
|
step_indices = []
|
||||||
|
for timestep in timesteps:
|
||||||
|
index_candidates = (schedule_timesteps == timestep).nonzero()
|
||||||
|
if len(index_candidates) == 0:
|
||||||
|
step_index = len(schedule_timesteps) - 1
|
||||||
|
elif len(index_candidates) > 1:
|
||||||
|
step_index = index_candidates[1].item()
|
||||||
|
else:
|
||||||
|
step_index = index_candidates[0].item()
|
||||||
|
step_indices.append(step_index)
|
||||||
|
|
||||||
sigma = sigmas[step_indices].flatten()
|
sigma = sigmas[step_indices].flatten()
|
||||||
while len(sigma.shape) < len(original_samples.shape):
|
while len(sigma.shape) < len(original_samples.shape):
|
||||||
|
|||||||
@@ -897,7 +897,16 @@ class DPMSolverSinglestepScheduler(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)
|
||||||
|
|
||||||
step_indices = [(schedule_timesteps == t).nonzero().item() for t in timesteps]
|
step_indices = []
|
||||||
|
for timestep in timesteps:
|
||||||
|
index_candidates = (schedule_timesteps == timestep).nonzero()
|
||||||
|
if len(index_candidates) == 0:
|
||||||
|
step_index = len(schedule_timesteps) - 1
|
||||||
|
elif len(index_candidates) > 1:
|
||||||
|
step_index = index_candidates[1].item()
|
||||||
|
else:
|
||||||
|
step_index = index_candidates[0].item()
|
||||||
|
step_indices.append(step_index)
|
||||||
|
|
||||||
sigma = sigmas[step_indices].flatten()
|
sigma = sigmas[step_indices].flatten()
|
||||||
while len(sigma.shape) < len(original_samples.shape):
|
while len(sigma.shape) < len(original_samples.shape):
|
||||||
|
|||||||
@@ -828,7 +828,16 @@ class UniPCMultistepScheduler(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)
|
||||||
|
|
||||||
step_indices = [(schedule_timesteps == t).nonzero().item() for t in timesteps]
|
step_indices = []
|
||||||
|
for timestep in timesteps:
|
||||||
|
index_candidates = (schedule_timesteps == timestep).nonzero()
|
||||||
|
if len(index_candidates) == 0:
|
||||||
|
step_index = len(schedule_timesteps) - 1
|
||||||
|
elif len(index_candidates) > 1:
|
||||||
|
step_index = index_candidates[1].item()
|
||||||
|
else:
|
||||||
|
step_index = index_candidates[0].item()
|
||||||
|
step_indices.append(step_index)
|
||||||
|
|
||||||
sigma = sigmas[step_indices].flatten()
|
sigma = sigmas[step_indices].flatten()
|
||||||
while len(sigma.shape) < len(original_samples.shape):
|
while len(sigma.shape) < len(original_samples.shape):
|
||||||
|
|||||||
Reference in New Issue
Block a user