torch.cuda.empty_cache() Finally, the training loop takes care of the rest. If you chose to apply a timestep bias strategy, you’ll see the timestep weights are calculated and added as noise:   Copied weights = generate_timestep_weights(args, noise_scheduler.config.num_train_timesteps).to(