Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
diffusers
Commits
da95a28f
Unverified
Commit
da95a28f
authored
Jan 22, 2024
by
Sayak Paul
Committed by
GitHub
Jan 22, 2024
Browse files
[Diffusion DPO] apply fixes from #6547 (#6668)
apply fixes from #6547
parent
d66d554d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
5 deletions
+4
-5
examples/research_projects/diffusion_dpo/train_diffusion_dpo_sdxl.py
...search_projects/diffusion_dpo/train_diffusion_dpo_sdxl.py
+4
-5
No files found.
examples/research_projects/diffusion_dpo/train_diffusion_dpo_sdxl.py
View file @
da95a28f
...
@@ -740,6 +740,10 @@ def main(args):
...
@@ -740,6 +740,10 @@ def main(args):
# Resize.
# Resize.
combined_im
=
train_resize
(
combined_im
)
combined_im
=
train_resize
(
combined_im
)
# Flipping.
if
not
args
.
no_flip
and
random
.
random
()
<
0.5
:
combined_im
=
train_flip
(
combined_im
)
# Cropping.
# Cropping.
if
not
args
.
random_crop
:
if
not
args
.
random_crop
:
y1
=
max
(
0
,
int
(
round
((
combined_im
.
shape
[
1
]
-
args
.
resolution
)
/
2.0
)))
y1
=
max
(
0
,
int
(
round
((
combined_im
.
shape
[
1
]
-
args
.
resolution
)
/
2.0
)))
...
@@ -749,11 +753,6 @@ def main(args):
...
@@ -749,11 +753,6 @@ def main(args):
y1
,
x1
,
h
,
w
=
train_crop
.
get_params
(
combined_im
,
(
args
.
resolution
,
args
.
resolution
))
y1
,
x1
,
h
,
w
=
train_crop
.
get_params
(
combined_im
,
(
args
.
resolution
,
args
.
resolution
))
combined_im
=
crop
(
combined_im
,
y1
,
x1
,
h
,
w
)
combined_im
=
crop
(
combined_im
,
y1
,
x1
,
h
,
w
)
# Flipping.
if
random
.
random
()
<
0.5
:
x1
=
combined_im
.
shape
[
2
]
-
x1
combined_im
=
train_flip
(
combined_im
)
crop_top_left
=
(
y1
,
x1
)
crop_top_left
=
(
y1
,
x1
)
crop_top_lefts
.
append
(
crop_top_left
)
crop_top_lefts
.
append
(
crop_top_left
)
combined_im
=
normalize
(
combined_im
)
combined_im
=
normalize
(
combined_im
)
...
...
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