Skip to content

Commit f1d4743

Browse files
authored
fixed typo in example train_text_to_image.py (huggingface#3608)
fixed typo
1 parent a6c7b5b commit f1d4743

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

examples/text_to_image/train_text_to_image.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ def log_validation(vae, text_encoder, tokenizer, unet, args, accelerator, weight
115115
def parse_args():
116116
parser = argparse.ArgumentParser(description="Simple example of a training script.")
117117
parser.add_argument(
118-
"--input_pertubation", type=float, default=0, help="The scale of input pretubation. Recommended 0.1."
118+
"--input_perturbation", type=float, default=0, help="The scale of input perturbation. Recommended 0.1."
119119
)
120120
parser.add_argument(
121121
"--pretrained_model_name_or_path",
@@ -830,16 +830,16 @@ def collate_fn(examples):
830830
noise += args.noise_offset * torch.randn(
831831
(latents.shape[0], latents.shape[1], 1, 1), device=latents.device
832832
)
833-
if args.input_pertubation:
834-
new_noise = noise + args.input_pertubation * torch.randn_like(noise)
833+
if args.input_perturbation:
834+
new_noise = noise + args.input_perturbation * torch.randn_like(noise)
835835
bsz = latents.shape[0]
836836
# Sample a random timestep for each image
837837
timesteps = torch.randint(0, noise_scheduler.config.num_train_timesteps, (bsz,), device=latents.device)
838838
timesteps = timesteps.long()
839839

840840
# Add noise to the latents according to the noise magnitude at each timestep
841841
# (this is the forward diffusion process)
842-
if args.input_pertubation:
842+
if args.input_perturbation:
843843
noisy_latents = noise_scheduler.add_noise(latents, new_noise, timesteps)
844844
else:
845845
noisy_latents = noise_scheduler.add_noise(latents, noise, timesteps)

0 commit comments

Comments
 (0)