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
b0c89738
Unverified
Commit
b0c89738
authored
Jan 15, 2025
by
Leo Jiang
Committed by
GitHub
Jan 16, 2025
Browse files
[Sana 4K] Add vae tiling option to avoid OOM (#10583)
Co-authored-by:
J石页
<
jiangshuo9@h-partners.com
>
parent
c944f065
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
0 deletions
+4
-0
examples/dreambooth/train_dreambooth_lora_sana.py
examples/dreambooth/train_dreambooth_lora_sana.py
+4
-0
No files found.
examples/dreambooth/train_dreambooth_lora_sana.py
View file @
b0c89738
...
@@ -158,6 +158,9 @@ def log_validation(
...
@@ -158,6 +158,9 @@ def log_validation(
f
"Running validation...
\n
Generating
{
args
.
num_validation_images
}
images with prompt:"
f
"Running validation...
\n
Generating
{
args
.
num_validation_images
}
images with prompt:"
f
"
{
args
.
validation_prompt
}
."
f
"
{
args
.
validation_prompt
}
."
)
)
if
args
.
enable_vae_tiling
:
pipeline
.
vae
.
enable_tiling
(
tile_sample_min_height
=
1024
,
tile_sample_stride_width
=
1024
)
pipeline
.
text_encoder
=
pipeline
.
text_encoder
.
to
(
torch
.
bfloat16
)
pipeline
.
text_encoder
=
pipeline
.
text_encoder
.
to
(
torch
.
bfloat16
)
pipeline
=
pipeline
.
to
(
accelerator
.
device
)
pipeline
=
pipeline
.
to
(
accelerator
.
device
)
pipeline
.
set_progress_bar_config
(
disable
=
True
)
pipeline
.
set_progress_bar_config
(
disable
=
True
)
...
@@ -597,6 +600,7 @@ def parse_args(input_args=None):
...
@@ -597,6 +600,7 @@ def parse_args(input_args=None):
help
=
"Whether to offload the VAE and the text encoder to CPU when they are not used."
,
help
=
"Whether to offload the VAE and the text encoder to CPU when they are not used."
,
)
)
parser
.
add_argument
(
"--local_rank"
,
type
=
int
,
default
=-
1
,
help
=
"For distributed training: local_rank"
)
parser
.
add_argument
(
"--local_rank"
,
type
=
int
,
default
=-
1
,
help
=
"For distributed training: local_rank"
)
parser
.
add_argument
(
"--enable_vae_tiling"
,
action
=
"store_true"
,
help
=
"Enabla vae tiling in log validation"
)
if
input_args
is
not
None
:
if
input_args
is
not
None
:
args
=
parser
.
parse_args
(
input_args
)
args
=
parser
.
parse_args
(
input_args
)
...
...
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