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
b693aff7
Unverified
Commit
b693aff7
authored
Dec 27, 2022
by
Christopher Friesen
Committed by
GitHub
Dec 27, 2022
Browse files
fix: resize transform now preserves aspect ratio (#1804)
parent
8a4c3e50
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
2 deletions
+2
-2
examples/text_to_image/train_text_to_image.py
examples/text_to_image/train_text_to_image.py
+1
-1
examples/text_to_image/train_text_to_image_flax.py
examples/text_to_image/train_text_to_image_flax.py
+1
-1
No files found.
examples/text_to_image/train_text_to_image.py
View file @
b693aff7
...
@@ -493,7 +493,7 @@ def main():
...
@@ -493,7 +493,7 @@ def main():
train_transforms
=
transforms
.
Compose
(
train_transforms
=
transforms
.
Compose
(
[
[
transforms
.
Resize
(
(
args
.
resolution
,
args
.
resolution
),
interpolation
=
transforms
.
InterpolationMode
.
BILINEAR
),
transforms
.
Resize
(
args
.
resolution
,
interpolation
=
transforms
.
InterpolationMode
.
BILINEAR
),
transforms
.
CenterCrop
(
args
.
resolution
)
if
args
.
center_crop
else
transforms
.
RandomCrop
(
args
.
resolution
),
transforms
.
CenterCrop
(
args
.
resolution
)
if
args
.
center_crop
else
transforms
.
RandomCrop
(
args
.
resolution
),
transforms
.
RandomHorizontalFlip
()
if
args
.
random_flip
else
transforms
.
Lambda
(
lambda
x
:
x
),
transforms
.
RandomHorizontalFlip
()
if
args
.
random_flip
else
transforms
.
Lambda
(
lambda
x
:
x
),
transforms
.
ToTensor
(),
transforms
.
ToTensor
(),
...
...
examples/text_to_image/train_text_to_image_flax.py
View file @
b693aff7
...
@@ -333,7 +333,7 @@ def main():
...
@@ -333,7 +333,7 @@ def main():
train_transforms
=
transforms
.
Compose
(
train_transforms
=
transforms
.
Compose
(
[
[
transforms
.
Resize
(
(
args
.
resolution
,
args
.
resolution
),
interpolation
=
transforms
.
InterpolationMode
.
BILINEAR
),
transforms
.
Resize
(
args
.
resolution
,
interpolation
=
transforms
.
InterpolationMode
.
BILINEAR
),
transforms
.
CenterCrop
(
args
.
resolution
)
if
args
.
center_crop
else
transforms
.
RandomCrop
(
args
.
resolution
),
transforms
.
CenterCrop
(
args
.
resolution
)
if
args
.
center_crop
else
transforms
.
RandomCrop
(
args
.
resolution
),
transforms
.
RandomHorizontalFlip
()
if
args
.
random_flip
else
transforms
.
Lambda
(
lambda
x
:
x
),
transforms
.
RandomHorizontalFlip
()
if
args
.
random_flip
else
transforms
.
Lambda
(
lambda
x
:
x
),
transforms
.
ToTensor
(),
transforms
.
ToTensor
(),
...
...
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