mirror of
https://github.com/lllyasviel/Fooocus.git
synced 2026-08-16 13:13:16 +02:00
ling
This commit is contained in:
@@ -3,7 +3,6 @@ import os
|
||||
import torch
|
||||
import modules.patch
|
||||
import modules.path
|
||||
import fcbh.sample
|
||||
import fcbh.model_management
|
||||
import fcbh.latent_formats
|
||||
import modules.inpaint_worker
|
||||
@@ -279,14 +278,6 @@ def vae_parse(latent):
|
||||
return {'samples': result}
|
||||
|
||||
|
||||
@torch.no_grad()
|
||||
@torch.inference_mode()
|
||||
def noise_parse(latent: torch.Tensor, seed: int, noise_inds=None, k=0.9):
|
||||
noise = fcbh.sample.prepare_noise(latent, seed=seed, noise_inds=noise_inds)
|
||||
offset = torch.mean(latent, dim=1, keepdim=True)
|
||||
return offset * k + noise
|
||||
|
||||
|
||||
@torch.no_grad()
|
||||
@torch.inference_mode()
|
||||
def calculate_sigmas_all(sampler, model, scheduler, steps):
|
||||
@@ -477,10 +468,7 @@ def process_diffusion(positive_cond, negative_cond, steps, switch, width, height
|
||||
denoise=denoise)[switch:] * k_sigmas
|
||||
len_sigmas = len(sigmas) - 1
|
||||
|
||||
residual_noise = noise_parse(
|
||||
modules.patch.eps_record,
|
||||
seed=image_seed+1,
|
||||
noise_inds=sampled_latent["batch_index"] if "batch_index" in sampled_latent else None)
|
||||
noise_offset = torch.mean(modules.patch.eps_record, dim=1, keepdim=True) * 0.9
|
||||
|
||||
if modules.inpaint_worker.current_task is not None:
|
||||
modules.inpaint_worker.current_task.swap()
|
||||
@@ -500,7 +488,7 @@ def process_diffusion(positive_cond, negative_cond, steps, switch, width, height
|
||||
previewer_start=switch,
|
||||
previewer_end=steps,
|
||||
sigmas=sigmas,
|
||||
noise=residual_noise
|
||||
noise_offset=noise_offset
|
||||
)
|
||||
|
||||
target_model = final_refiner_vae
|
||||
|
||||
Reference in New Issue
Block a user