Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
renzhc
diffusers_dcu
Commits
511bd3aa
Unverified
Commit
511bd3aa
authored
Aug 23, 2022
by
Suraj Patil
Committed by
GitHub
Aug 23, 2022
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
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
0 deletions
+3
-0
examples/inference/image_to_image.py
examples/inference/image_to_image.py
+3
-0
No files found.
examples/inference/image_to_image.py
View file @
511bd3aa
...
@@ -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
=
{}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment