Skip to content

Commit

Permalink
Update docker_images/diffusers/app/pipelines/image_to_image.py
Browse files Browse the repository at this point in the history
Co-authored-by: apolinário <[email protected]>
  • Loading branch information
oOraph and apolinario authored Oct 25, 2024
1 parent 6c3f28f commit 103b858
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions docker_images/diffusers/app/pipelines/image_to_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,12 @@ def _process_req(self, image, prompt, **kwargs):
"negative_prompt": kwargs.get("negative_prompt", None),
"guidance_scale": kwargs.get("guidance_scale", 7),
}
if int(kwargs["num_inference_steps"]) <= 4 and 'guidance_scale' not in kwargs.keys():
kwargs["guidance_scale"] = 0
prior_args["guidance_scale"] = 0
if "guidance_scale" not in kwargs:
default_guidance_scale = os.getenv("DEFAULT_GUIDANCE_SCALE")
if default_guidance_scale:
kwargs["guidance_scale"] = float(default_guidance_scale)
prior_args["guidance_scale"] = float(default_guidance_scale)
# Else, don't specify anything, leave the default behaviour
image_emb, zero_image_emb = self.prior(prompt, **prior_args).to_tuple()
images = self.ldm(
prompt,
Expand Down

0 comments on commit 103b858

Please sign in to comment.