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
e9636216
Unverified
Commit
e9636216
authored
Apr 25, 2024
by
Sayak Paul
Committed by
GitHub
Apr 25, 2024
Browse files
[PixArt] fix small nits in pixart sigma (#7767)
fix small nits in pixart sigma
parent
39215aa3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
21 deletions
+3
-21
src/diffusers/pipelines/pixart_alpha/pipeline_pixart_alpha.py
...diffusers/pipelines/pixart_alpha/pipeline_pixart_alpha.py
+0
-9
src/diffusers/pipelines/pixart_alpha/pipeline_pixart_sigma.py
...diffusers/pipelines/pixart_alpha/pipeline_pixart_sigma.py
+3
-12
No files found.
src/diffusers/pipelines/pixart_alpha/pipeline_pixart_alpha.py
View file @
e9636216
...
@@ -273,15 +273,6 @@ class PixArtAlphaPipeline(DiffusionPipeline):
...
@@ -273,15 +273,6 @@ class PixArtAlphaPipeline(DiffusionPipeline):
self
.
vae_scale_factor
=
2
**
(
len
(
self
.
vae
.
config
.
block_out_channels
)
-
1
)
self
.
vae_scale_factor
=
2
**
(
len
(
self
.
vae
.
config
.
block_out_channels
)
-
1
)
self
.
image_processor
=
PixArtImageProcessor
(
vae_scale_factor
=
self
.
vae_scale_factor
)
self
.
image_processor
=
PixArtImageProcessor
(
vae_scale_factor
=
self
.
vae_scale_factor
)
# Adapted from https://github.com/PixArt-alpha/PixArt-alpha/blob/master/diffusion/model/utils.py
def
mask_text_embeddings
(
self
,
emb
,
mask
):
if
emb
.
shape
[
0
]
==
1
:
keep_index
=
mask
.
sum
().
item
()
return
emb
[:,
:,
:
keep_index
,
:],
keep_index
else
:
masked_feature
=
emb
*
mask
[:,
None
,
:,
None
]
return
masked_feature
,
emb
.
shape
[
2
]
# Adapted from diffusers.pipelines.deepfloyd_if.pipeline_if.encode_prompt
# Adapted from diffusers.pipelines.deepfloyd_if.pipeline_if.encode_prompt
def
encode_prompt
(
def
encode_prompt
(
self
,
self
,
...
...
src/diffusers/pipelines/pixart_alpha/pipeline_pixart_sigma.py
View file @
e9636216
...
@@ -199,16 +199,7 @@ class PixArtSigmaPipeline(DiffusionPipeline):
...
@@ -199,16 +199,7 @@ class PixArtSigmaPipeline(DiffusionPipeline):
self
.
vae_scale_factor
=
2
**
(
len
(
self
.
vae
.
config
.
block_out_channels
)
-
1
)
self
.
vae_scale_factor
=
2
**
(
len
(
self
.
vae
.
config
.
block_out_channels
)
-
1
)
self
.
image_processor
=
PixArtImageProcessor
(
vae_scale_factor
=
self
.
vae_scale_factor
)
self
.
image_processor
=
PixArtImageProcessor
(
vae_scale_factor
=
self
.
vae_scale_factor
)
# copied from diffusers.pipelines.pixart_alpha.pipeline_pixart_alpha.py
# Copied from diffusers.pipelines.pixart_alpha.pipeline_pixart_alpha.PixArtAlphaPipeline.encode_prompt
def
mask_text_embeddings
(
self
,
emb
,
mask
):
if
emb
.
shape
[
0
]
==
1
:
keep_index
=
mask
.
sum
().
item
()
return
emb
[:,
:,
:
keep_index
,
:],
keep_index
else
:
masked_feature
=
emb
*
mask
[:,
None
,
:,
None
]
return
masked_feature
,
emb
.
shape
[
2
]
# Adapted from diffusers.pipelines.deepfloyd_if.pipeline_if.encode_prompt
def
encode_prompt
(
def
encode_prompt
(
self
,
self
,
prompt
:
Union
[
str
,
List
[
str
]],
prompt
:
Union
[
str
,
List
[
str
]],
...
@@ -369,7 +360,7 @@ class PixArtSigmaPipeline(DiffusionPipeline):
...
@@ -369,7 +360,7 @@ class PixArtSigmaPipeline(DiffusionPipeline):
extra_step_kwargs
[
"generator"
]
=
generator
extra_step_kwargs
[
"generator"
]
=
generator
return
extra_step_kwargs
return
extra_step_kwargs
#
c
opied from diffusers.pipelines.pixart_alpha.pipeline_pixart_alpha.
py
#
C
opied from diffusers.pipelines.pixart_alpha.pipeline_pixart_alpha.
PixArtAlphaPipeline.check_inputs
def
check_inputs
(
def
check_inputs
(
self
,
self
,
prompt
,
prompt
,
...
@@ -462,7 +453,7 @@ class PixArtSigmaPipeline(DiffusionPipeline):
...
@@ -462,7 +453,7 @@ class PixArtSigmaPipeline(DiffusionPipeline):
return
[
process
(
t
)
for
t
in
text
]
return
[
process
(
t
)
for
t
in
text
]
# Copied from diffusers.pipelines.
pixart_alpha.pipeline_pixart_alpha.PixArtAlpha
Pipeline._clean_caption
# Copied from diffusers.pipelines.
deepfloyd_if.pipeline_if.IF
Pipeline._clean_caption
def
_clean_caption
(
self
,
caption
):
def
_clean_caption
(
self
,
caption
):
caption
=
str
(
caption
)
caption
=
str
(
caption
)
caption
=
ul
.
unquote_plus
(
caption
)
caption
=
ul
.
unquote_plus
(
caption
)
...
...
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