Skip to content

Commit

Permalink
Add defaults to refiner function
Browse files Browse the repository at this point in the history
  • Loading branch information
palp committed Aug 3, 2023
1 parent 45feb6c commit 853adb4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 5 additions & 3 deletions sgm/inference/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class Thresholder(str, Enum):
class SamplingParams:
width: int = 1024
height: int = 1024
steps: int = 50
steps: int = 40
sampler: Sampler = Sampler.DPMPP2M
discretization: Discretization = Discretization.LEGACY_DDPM
guider: Guider = Guider.VANILLA
Expand Down Expand Up @@ -247,10 +247,12 @@ def image_to_image(

def refiner(
self,
params: SamplingParams,
image,
prompt: str,
negative_prompt: Optional[str] = None,
negative_prompt: str = "",
params: SamplingParams = SamplingParams(
sampler=Sampler.EULER_EDM, steps=40, img2img_strength=0.2
),
samples: int = 1,
return_latents: bool = False,
):
Expand Down
4 changes: 2 additions & 2 deletions tests/inference/test_inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,10 @@ def test_sdxl_with_refiner(
samples, samples_z = output
assert samples is not None
assert samples_z is not None
refiner_pipeline.refiner(
params=SamplingParams(sampler=sampler_enum.value, steps=10),
refiner_pipeline.refiner(
image=samples_z,
prompt="A professional photograph of an astronaut riding a pig",
params=SamplingParams(sampler=sampler_enum.value, steps=40, img2img_strength=0.20),
negative_prompt="",
samples=1,
)

0 comments on commit 853adb4

Please sign in to comment.