Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support min/max timesteps in train_controlnet.py #1664

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion train_controlnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,8 +444,11 @@ def remove_model(old_ckpt_name):
)

# Sample a random timestep for each image
min_timestep = args.min_timestep if args.min_timestep is not None else 0
sched_max_timestep = noise_scheduler.config.num_train_timesteps
max_timestep = args.max_timestep if args.max_timestep is not None else sched_max_timestep
timesteps, huber_c = train_util.get_timesteps_and_huber_c(
args, 0, noise_scheduler.config.num_train_timesteps, noise_scheduler, b_size, latents.device
args, min_timestep, max_timestep, noise_scheduler, b_size, latents.device
)

# Add noise to the latents according to the noise magnitude at each timestep
Expand Down