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
OpenDAS
diffusers
Commits
f1d47433
Unverified
Commit
f1d47433
authored
Jun 02, 2023
by
Kashif Rasul
Committed by
GitHub
Jun 02, 2023
Browse files
fixed typo in example train_text_to_image.py (#3608)
fixed typo
parent
a6c7b5b6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
examples/text_to_image/train_text_to_image.py
examples/text_to_image/train_text_to_image.py
+4
-4
No files found.
examples/text_to_image/train_text_to_image.py
View file @
f1d47433
...
@@ -115,7 +115,7 @@ def log_validation(vae, text_encoder, tokenizer, unet, args, accelerator, weight
...
@@ -115,7 +115,7 @@ def log_validation(vae, text_encoder, tokenizer, unet, args, accelerator, weight
def
parse_args
():
def
parse_args
():
parser
=
argparse
.
ArgumentParser
(
description
=
"Simple example of a training script."
)
parser
=
argparse
.
ArgumentParser
(
description
=
"Simple example of a training script."
)
parser
.
add_argument
(
parser
.
add_argument
(
"--input_pertubation"
,
type
=
float
,
default
=
0
,
help
=
"The scale of input p
r
etubation. Recommended 0.1."
"--input_pertu
r
bation"
,
type
=
float
,
default
=
0
,
help
=
"The scale of input pe
r
tu
r
bation. Recommended 0.1."
)
)
parser
.
add_argument
(
parser
.
add_argument
(
"--pretrained_model_name_or_path"
,
"--pretrained_model_name_or_path"
,
...
@@ -830,8 +830,8 @@ def main():
...
@@ -830,8 +830,8 @@ def main():
noise
+=
args
.
noise_offset
*
torch
.
randn
(
noise
+=
args
.
noise_offset
*
torch
.
randn
(
(
latents
.
shape
[
0
],
latents
.
shape
[
1
],
1
,
1
),
device
=
latents
.
device
(
latents
.
shape
[
0
],
latents
.
shape
[
1
],
1
,
1
),
device
=
latents
.
device
)
)
if
args
.
input_pertubation
:
if
args
.
input_pertu
r
bation
:
new_noise
=
noise
+
args
.
input_pertubation
*
torch
.
randn_like
(
noise
)
new_noise
=
noise
+
args
.
input_pertu
r
bation
*
torch
.
randn_like
(
noise
)
bsz
=
latents
.
shape
[
0
]
bsz
=
latents
.
shape
[
0
]
# Sample a random timestep for each image
# Sample a random timestep for each image
timesteps
=
torch
.
randint
(
0
,
noise_scheduler
.
config
.
num_train_timesteps
,
(
bsz
,),
device
=
latents
.
device
)
timesteps
=
torch
.
randint
(
0
,
noise_scheduler
.
config
.
num_train_timesteps
,
(
bsz
,),
device
=
latents
.
device
)
...
@@ -839,7 +839,7 @@ def main():
...
@@ -839,7 +839,7 @@ def main():
# Add noise to the latents according to the noise magnitude at each timestep
# Add noise to the latents according to the noise magnitude at each timestep
# (this is the forward diffusion process)
# (this is the forward diffusion process)
if
args
.
input_pertubation
:
if
args
.
input_pertu
r
bation
:
noisy_latents
=
noise_scheduler
.
add_noise
(
latents
,
new_noise
,
timesteps
)
noisy_latents
=
noise_scheduler
.
add_noise
(
latents
,
new_noise
,
timesteps
)
else
:
else
:
noisy_latents
=
noise_scheduler
.
add_noise
(
latents
,
noise
,
timesteps
)
noisy_latents
=
noise_scheduler
.
add_noise
(
latents
,
noise
,
timesteps
)
...
...
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