mirror of
https://github.com/kohya-ss/sd-scripts.git
synced 2026-04-08 22:35:09 +00:00
Remove double noise
This commit is contained in:
@@ -415,8 +415,6 @@ def get_noisy_model_input_and_timesteps(
|
|||||||
bsz, _, h, w = latents.shape
|
bsz, _, h, w = latents.shape
|
||||||
sigmas = None
|
sigmas = None
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if args.timestep_sampling == "uniform" or args.timestep_sampling == "sigmoid":
|
if args.timestep_sampling == "uniform" or args.timestep_sampling == "sigmoid":
|
||||||
# Simple random t-based noise sampling
|
# Simple random t-based noise sampling
|
||||||
if args.timestep_sampling == "sigmoid":
|
if args.timestep_sampling == "sigmoid":
|
||||||
@@ -469,10 +467,10 @@ def get_noisy_model_input_and_timesteps(
|
|||||||
# (this is the forward diffusion process)
|
# (this is the forward diffusion process)
|
||||||
if args.ip_noise_gamma:
|
if args.ip_noise_gamma:
|
||||||
if args.ip_noise_gamma_random_strength:
|
if args.ip_noise_gamma_random_strength:
|
||||||
xi = noise.detach().clone() + (torch.rand(1, device=latents.device) * args.ip_noise_gamma) * torch.randn_like(latents)
|
noise_perturbation = (torch.rand(1, device=latents.device) * args.ip_noise_gamma) * torch.randn_like(noise)
|
||||||
else:
|
else:
|
||||||
xi = noise.detach().clone() + args.ip_noise_gamma * torch.randn_like(latents)
|
noise_perturbation = args.ip_noise_gamma * torch.randn_like(noise)
|
||||||
noisy_model_input += xi
|
noisy_model_input += noise_perturbation
|
||||||
|
|
||||||
return noisy_model_input.to(dtype), timesteps.to(dtype), sigmas
|
return noisy_model_input.to(dtype), timesteps.to(dtype), sigmas
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user