Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/community/lpw_stable_diffusion_xl.py
Original file line number Diff line number Diff line change
Expand Up @@ -1766,15 +1766,15 @@ def __call__(

# 4. Prepare timesteps
def denoising_value_valid(dnv):
return isinstance(self.denoising_end, float) and 0 < dnv < 1
return isinstance(dnv, float) and 0 < dnv < 1

timesteps, num_inference_steps = retrieve_timesteps(self.scheduler, num_inference_steps, device, timesteps)
if image is not None:
timesteps, num_inference_steps = self.get_timesteps(
num_inference_steps,
strength,
device,
denoising_start=self.denoising_start if denoising_value_valid else None,
denoising_start=self.denoising_start if denoising_value_valid(self.denoising_start) else None,
)

# check that number of inference steps is not < 1 - as this doesn't make sense
Expand Down
4 changes: 2 additions & 2 deletions examples/community/pipeline_sdxl_style_aligned.py
Original file line number Diff line number Diff line change
Expand Up @@ -1769,7 +1769,7 @@ def __call__(

# 4. Prepare timesteps
def denoising_value_valid(dnv):
return isinstance(self.denoising_end, float) and 0 < dnv < 1
return isinstance(dnv, float) and 0 < dnv < 1

timesteps, num_inference_steps = retrieve_timesteps(self.scheduler, num_inference_steps, device, timesteps)

Expand All @@ -1778,7 +1778,7 @@ def denoising_value_valid(dnv):
num_inference_steps,
strength,
device,
denoising_start=self.denoising_start if denoising_value_valid else None,
denoising_start=self.denoising_start if denoising_value_valid(self.denoising_start) else None,
)

# check that number of inference steps is not < 1 - as this doesn't make sense
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1563,14 +1563,14 @@ def __call__(

# 4. set timesteps
def denoising_value_valid(dnv):
return isinstance(denoising_end, float) and 0 < dnv < 1
return isinstance(dnv, float) and 0 < dnv < 1

self.scheduler.set_timesteps(num_inference_steps, device=device)
timesteps, num_inference_steps = self.get_timesteps(
num_inference_steps,
strength,
device,
denoising_start=denoising_start if denoising_value_valid else None,
denoising_start=denoising_start if denoising_value_valid(denoising_start) else None,
)
# check that number of inference steps is not < 1 - as this doesn't make sense
if num_inference_steps < 1:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1477,11 +1477,14 @@ def __call__(

# 4. set timesteps
def denoising_value_valid(dnv):
return isinstance(denoising_end, float) and 0 < dnv < 1
return isinstance(dnv, float) and 0 < dnv < 1

self.scheduler.set_timesteps(num_inference_steps, device=device)
timesteps, num_inference_steps = self.get_timesteps(
num_inference_steps, strength, device, denoising_start=denoising_start if denoising_value_valid else None
num_inference_steps,
strength,
device,
denoising_start=denoising_start if denoising_value_valid(denoising_start) else None,
)
# check that number of inference steps is not < 1 - as this doesn't make sense
if num_inference_steps < 1:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1315,14 +1315,14 @@ def __call__(

# 5. Prepare timesteps
def denoising_value_valid(dnv):
return isinstance(self.denoising_end, float) and 0 < dnv < 1
return isinstance(dnv, float) and 0 < dnv < 1
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yiyixuxu Could you review please? The tests are now passing locally. I think the initial condition of checking isinstance(self.denoising_end, float) every time was incorrect because you can have denoising_end=None but denoising_start as not None.


timesteps, num_inference_steps = retrieve_timesteps(self.scheduler, num_inference_steps, device, timesteps)
timesteps, num_inference_steps = self.get_timesteps(
num_inference_steps,
strength,
device,
denoising_start=self.denoising_start if denoising_value_valid else None,
denoising_start=self.denoising_start if denoising_value_valid(self.denoising_start) else None,
)
latent_timestep = timesteps[:1].repeat(batch_size * num_images_per_prompt)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1581,14 +1581,14 @@ def __call__(

# 4. set timesteps
def denoising_value_valid(dnv):
return isinstance(self.denoising_end, float) and 0 < dnv < 1
return isinstance(dnv, float) and 0 < dnv < 1

timesteps, num_inference_steps = retrieve_timesteps(self.scheduler, num_inference_steps, device, timesteps)
timesteps, num_inference_steps = self.get_timesteps(
num_inference_steps,
strength,
device,
denoising_start=self.denoising_start if denoising_value_valid else None,
denoising_start=self.denoising_start if denoising_value_valid(self.denoising_start) else None,
)
# check that number of inference steps is not < 1 - as this doesn't make sense
if num_inference_steps < 1:
Expand Down