Unverified Commit 511bd3aa authored by Suraj Patil's avatar Suraj Patil Committed by GitHub
Browse files

[example/image2image] raise error if strength is not in desired range (#238)

raise error if strength is not in desired range
parent 4674fdf8
...@@ -64,6 +64,9 @@ class StableDiffusionImg2ImgPipeline(DiffusionPipeline): ...@@ -64,6 +64,9 @@ class StableDiffusionImg2ImgPipeline(DiffusionPipeline):
else: else:
raise ValueError(f"`prompt` has to be of type `str` or `list` but is {type(prompt)}") raise ValueError(f"`prompt` has to be of type `str` or `list` but is {type(prompt)}")
if strength < 0 or strength > 1:
raise ValueError(f"The value of strength should in [0.0, 1.0] but is {strength}")
# set timesteps # set timesteps
accepts_offset = "offset" in set(inspect.signature(self.scheduler.set_timesteps).parameters.keys()) accepts_offset = "offset" in set(inspect.signature(self.scheduler.set_timesteps).parameters.keys())
extra_set_kwargs = {} extra_set_kwargs = {}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment