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
4b60f4b6
Unverified
Commit
4b60f4b6
authored
Apr 23, 2025
by
Ishan Dutta
Committed by
GitHub
Apr 23, 2025
Browse files
[train_dreambooth_flux] Add LANCZOS as the default interpolation mode for image resizing (#11395)
parent
6cef71de
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
1 deletion
+13
-1
examples/dreambooth/train_dreambooth_flux.py
examples/dreambooth/train_dreambooth_flux.py
+13
-1
No files found.
examples/dreambooth/train_dreambooth_flux.py
View file @
4b60f4b6
...
@@ -618,6 +618,15 @@ def parse_args(input_args=None):
...
@@ -618,6 +618,15 @@ def parse_args(input_args=None):
),
),
)
)
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
(
"--image_interpolation_mode"
,
type
=
str
,
default
=
"lanczos"
,
choices
=
[
f
.
lower
()
for
f
in
dir
(
transforms
.
InterpolationMode
)
if
not
f
.
startswith
(
"__"
)
and
not
f
.
endswith
(
"__"
)
],
help
=
"The image interpolation method to use for resizing images."
,
)
if
input_args
is
not
None
:
if
input_args
is
not
None
:
args
=
parser
.
parse_args
(
input_args
)
args
=
parser
.
parse_args
(
input_args
)
...
@@ -737,7 +746,10 @@ class DreamBoothDataset(Dataset):
...
@@ -737,7 +746,10 @@ class DreamBoothDataset(Dataset):
self
.
instance_images
.
extend
(
itertools
.
repeat
(
img
,
repeats
))
self
.
instance_images
.
extend
(
itertools
.
repeat
(
img
,
repeats
))
self
.
pixel_values
=
[]
self
.
pixel_values
=
[]
train_resize
=
transforms
.
Resize
(
size
,
interpolation
=
transforms
.
InterpolationMode
.
BILINEAR
)
interpolation
=
getattr
(
transforms
.
InterpolationMode
,
args
.
image_interpolation_mode
.
upper
(),
None
)
if
interpolation
is
None
:
raise
ValueError
(
f
"Unsupported interpolation mode
{
interpolation
=
}
."
)
train_resize
=
transforms
.
Resize
(
size
,
interpolation
=
interpolation
)
train_crop
=
transforms
.
CenterCrop
(
size
)
if
center_crop
else
transforms
.
RandomCrop
(
size
)
train_crop
=
transforms
.
CenterCrop
(
size
)
if
center_crop
else
transforms
.
RandomCrop
(
size
)
train_flip
=
transforms
.
RandomHorizontalFlip
(
p
=
1.0
)
train_flip
=
transforms
.
RandomHorizontalFlip
(
p
=
1.0
)
train_transforms
=
transforms
.
Compose
(
train_transforms
=
transforms
.
Compose
(
...
...
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