fix potential numerical problems
This commit is contained in:
parent
22fc28958f
commit
4cf0c778da
@ -1 +1 @@
|
|||||||
version = '2.1.727'
|
version = '2.1.728'
|
||||||
|
|||||||
@ -3,6 +3,7 @@ import os
|
|||||||
import torch
|
import torch
|
||||||
import modules.patch
|
import modules.patch
|
||||||
import modules.path
|
import modules.path
|
||||||
|
import fcbh.sample
|
||||||
import fcbh.model_management
|
import fcbh.model_management
|
||||||
import fcbh.latent_formats
|
import fcbh.latent_formats
|
||||||
import modules.inpaint_worker
|
import modules.inpaint_worker
|
||||||
@ -278,6 +279,14 @@ def vae_parse(latent):
|
|||||||
return {'samples': result}
|
return {'samples': result}
|
||||||
|
|
||||||
|
|
||||||
|
@torch.no_grad()
|
||||||
|
@torch.inference_mode()
|
||||||
|
def noise_parse(latent: torch.Tensor, seed: int, noise_inds=None):
|
||||||
|
noise = fcbh.sample.prepare_noise(latent, seed=seed, noise_inds=noise_inds)
|
||||||
|
s, m = torch.std_mean(latent, dim=1, keepdim=True)
|
||||||
|
return m + s * noise
|
||||||
|
|
||||||
|
|
||||||
@torch.no_grad()
|
@torch.no_grad()
|
||||||
@torch.inference_mode()
|
@torch.inference_mode()
|
||||||
def calculate_sigmas_all(sampler, model, scheduler, steps):
|
def calculate_sigmas_all(sampler, model, scheduler, steps):
|
||||||
@ -468,8 +477,10 @@ def process_diffusion(positive_cond, negative_cond, steps, switch, width, height
|
|||||||
denoise=denoise)[switch:] * k_sigmas
|
denoise=denoise)[switch:] * k_sigmas
|
||||||
len_sigmas = len(sigmas) - 1
|
len_sigmas = len(sigmas) - 1
|
||||||
|
|
||||||
residual_noise = modules.patch.eps_record
|
residual_noise = noise_parse(
|
||||||
assert isinstance(residual_noise, torch.Tensor)
|
modules.patch.eps_record,
|
||||||
|
seed=image_seed+1,
|
||||||
|
noise_inds=sampled_latent["batch_index"] if "batch_index" in sampled_latent else None)
|
||||||
|
|
||||||
if modules.inpaint_worker.current_task is not None:
|
if modules.inpaint_worker.current_task is not None:
|
||||||
modules.inpaint_worker.current_task.swap()
|
modules.inpaint_worker.current_task.swap()
|
||||||
@ -480,7 +491,7 @@ def process_diffusion(positive_cond, negative_cond, steps, switch, width, height
|
|||||||
negative=clip_separate(negative_cond, target_model=target_model.model, target_clip=final_clip),
|
negative=clip_separate(negative_cond, target_model=target_model.model, target_clip=final_clip),
|
||||||
latent=sampled_latent,
|
latent=sampled_latent,
|
||||||
steps=len_sigmas, start_step=0, last_step=len_sigmas, disable_noise=False, force_full_denoise=True,
|
steps=len_sigmas, start_step=0, last_step=len_sigmas, disable_noise=False, force_full_denoise=True,
|
||||||
seed=image_seed,
|
seed=image_seed+1,
|
||||||
denoise=denoise,
|
denoise=denoise,
|
||||||
callback_function=callback,
|
callback_function=callback,
|
||||||
cfg=cfg_scale,
|
cfg=cfg_scale,
|
||||||
|
|||||||
@ -1,3 +1,7 @@
|
|||||||
|
# 2.1.728
|
||||||
|
|
||||||
|
* Fixed some potential numerical problems since 2.1.723
|
||||||
|
|
||||||
# 2.1.723
|
# 2.1.723
|
||||||
|
|
||||||
* Improve Fooocus Anime a bit by using better SD1.5 refining formulation.
|
* Improve Fooocus Anime a bit by using better SD1.5 refining formulation.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user