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
60d915fb
Commit
60d915fb
authored
Jan 31, 2023
by
Patrick von Platen
Browse files
make style
parent
d1efefe1
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_inpaint_legacy.py
...ble_diffusion/pipeline_stable_diffusion_inpaint_legacy.py
+3
-3
No files found.
src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_inpaint_legacy.py
View file @
60d915fb
...
@@ -45,7 +45,6 @@ def preprocess_image(image):
...
@@ -45,7 +45,6 @@ def preprocess_image(image):
def
preprocess_mask
(
mask
,
scale_factor
=
8
):
def
preprocess_mask
(
mask
,
scale_factor
=
8
):
if
not
isinstance
(
mask
,
torch
.
FloatTensor
):
if
not
isinstance
(
mask
,
torch
.
FloatTensor
):
mask
=
mask
.
convert
(
"L"
)
mask
=
mask
.
convert
(
"L"
)
w
,
h
=
mask
.
size
w
,
h
=
mask
.
size
...
@@ -65,7 +64,8 @@ def preprocess_mask(mask, scale_factor=8):
...
@@ -65,7 +64,8 @@ def preprocess_mask(mask, scale_factor=8):
mask
=
mask
.
permute
(
0
,
3
,
1
,
2
)
mask
=
mask
.
permute
(
0
,
3
,
1
,
2
)
elif
mask
.
shape
[
1
]
not
in
valid_mask_channel_sizes
:
elif
mask
.
shape
[
1
]
not
in
valid_mask_channel_sizes
:
raise
ValueError
(
raise
ValueError
(
f
"Mask channel dimension of size in
{
valid_mask_channel_sizes
}
should be second or fourth dimension, but received mask of shape
{
tuple
(
mask
.
shape
)
}
"
f
"Mask channel dimension of size in
{
valid_mask_channel_sizes
}
should be second or fourth dimension,"
f
" but received mask of shape
{
tuple
(
mask
.
shape
)
}
"
)
)
# (potentially) reduce mask channel dimension from 3 to 1 for broadcasting to latent shape
# (potentially) reduce mask channel dimension from 3 to 1 for broadcasting to latent shape
mask
=
mask
.
mean
(
dim
=
1
,
keepdim
=
True
)
mask
=
mask
.
mean
(
dim
=
1
,
keepdim
=
True
)
...
...
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