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
83da817f
Unverified
Commit
83da817f
authored
Dec 27, 2024
by
SahilCarterr
Committed by
GitHub
Dec 27, 2024
Browse files
[Add] torch_xla support to pipeline_sana.py (#10364)
[Add] torch_xla support in pipeline_sana.py
parent
f430a0cf
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
0 deletions
+11
-0
src/diffusers/pipelines/sana/pipeline_sana.py
src/diffusers/pipelines/sana/pipeline_sana.py
+11
-0
No files found.
src/diffusers/pipelines/sana/pipeline_sana.py
View file @
83da817f
...
@@ -31,6 +31,7 @@ from ...utils import (
...
@@ -31,6 +31,7 @@ from ...utils import (
USE_PEFT_BACKEND
,
USE_PEFT_BACKEND
,
is_bs4_available
,
is_bs4_available
,
is_ftfy_available
,
is_ftfy_available
,
is_torch_xla_available
,
logging
,
logging
,
replace_example_docstring
,
replace_example_docstring
,
scale_lora_layers
,
scale_lora_layers
,
...
@@ -46,6 +47,13 @@ from ..pixart_alpha.pipeline_pixart_sigma import ASPECT_RATIO_2048_BIN
...
@@ -46,6 +47,13 @@ from ..pixart_alpha.pipeline_pixart_sigma import ASPECT_RATIO_2048_BIN
from
.pipeline_output
import
SanaPipelineOutput
from
.pipeline_output
import
SanaPipelineOutput
if
is_torch_xla_available
():
import
torch_xla.core.xla_model
as
xm
XLA_AVAILABLE
=
True
else
:
XLA_AVAILABLE
=
False
logger
=
logging
.
get_logger
(
__name__
)
# pylint: disable=invalid-name
logger
=
logging
.
get_logger
(
__name__
)
# pylint: disable=invalid-name
if
is_bs4_available
():
if
is_bs4_available
():
...
@@ -864,6 +872,9 @@ class SanaPipeline(DiffusionPipeline, SanaLoraLoaderMixin):
...
@@ -864,6 +872,9 @@ class SanaPipeline(DiffusionPipeline, SanaLoraLoaderMixin):
if
i
==
len
(
timesteps
)
-
1
or
((
i
+
1
)
>
num_warmup_steps
and
(
i
+
1
)
%
self
.
scheduler
.
order
==
0
):
if
i
==
len
(
timesteps
)
-
1
or
((
i
+
1
)
>
num_warmup_steps
and
(
i
+
1
)
%
self
.
scheduler
.
order
==
0
):
progress_bar
.
update
()
progress_bar
.
update
()
if
XLA_AVAILABLE
:
xm
.
mark_step
()
if
output_type
==
"latent"
:
if
output_type
==
"latent"
:
image
=
latents
image
=
latents
else
:
else
:
...
...
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