Skip to content

Commit

Permalink
add a docstring for set_inference_steps
Browse files Browse the repository at this point in the history
This explains the relation between first_step and strength,
as shown by @holwech here: #374
  • Loading branch information
catwell committed May 29, 2024
1 parent ddcd84c commit 1886e64
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/refiners/foundationals/latent_diffusion/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@ def __init__(
self.classifier_free_guidance = classifier_free_guidance

def set_inference_steps(self, num_steps: int, first_step: int = 0) -> None:
"""Set the steps of the diffusion process.
Args:
num_steps: The number of inference steps.
first_step: The first inference step, used for image-to-image diffusion.
You may be used to setting a float in `[0, 1]` called `strength` instead,
which is an abstraction for this. The first step is
`round((1 - strength) * (num_steps - 1))`.
"""
self.solver = self.solver.rebuild(num_inference_steps=num_steps, first_inference_step=first_step)

@staticmethod
Expand Down

0 comments on commit 1886e64

Please sign in to comment.