first step

This commit is contained in:
Haoming
2026-02-23 18:12:50 +08:00
parent c24ede025c
commit 46cb69c27b
2 changed files with 11 additions and 10 deletions
+2 -4
View File
@@ -155,10 +155,6 @@ def images_tensor_to_samples(image, approximation=None, model=None):
def store_latent(decoded):
state.current_latent = decoded
if opts.live_previews_enable and opts.show_progress_every_n_steps > 0 and shared.state.sampling_step % opts.show_progress_every_n_steps == 0:
if not shared.parallel_processing_allowed:
shared.state.assign_current_image(sample_to_image(decoded))
def is_sampler_using_eta_noise_seed_delta(p):
"""returns whether sampler from config will use eta noise seed delta for image creation"""
@@ -356,6 +352,7 @@ class Sampler:
raise InterruptedException
state.sampling_step = step
state.preview_step = step + 1
shared.total_tqdm.update()
def launch_sampling(self, steps, func):
@@ -363,6 +360,7 @@ class Sampler:
self.model_wrap_cfg.total_steps = self.config.total_steps(steps)
state.sampling_steps = steps
state.sampling_step = 0
state.preview_step = 0
try:
return func()
+9 -6
View File
@@ -23,8 +23,9 @@ class State:
job_count = 0
processing_has_refined_job_count = False
job_timestamp = "0"
sampling_step = 0
sampling_steps = 0
preview_step: int = 0
sampling_step: int = 0
sampling_steps: int = 0
current_latent = None
current_image = None
current_image_sampling_step = 0
@@ -98,6 +99,7 @@ class State:
self.job_no += 1
self.sampling_step = 0
self.preview_step = 0
self.current_image_sampling_step = 0
def dict(self):
@@ -117,6 +119,7 @@ class State:
def begin(self, job: str = "(unknown)"):
self.sampling_step = 0
self.preview_step = 0
self.time_start = time.time()
self.job_count = -1
self.processing_has_refined_job_count = False
@@ -144,11 +147,11 @@ class State:
@torch.inference_mode()
def set_current_image(self):
"""if enough sampling steps have been made after the last call to this, sets self.current_image from self.current_latent, and modifies self.id_live_preview accordingly"""
if not shared.parallel_processing_allowed:
if not shared.opts.live_previews_enable or shared.opts.show_progress_every_n_steps == -1:
return
if self.sampling_step - self.current_image_sampling_step >= shared.opts.show_progress_every_n_steps and shared.opts.live_previews_enable and shared.opts.show_progress_every_n_steps != -1:
if self.preview_step >= self.sampling_steps:
return
if self.preview_step - self.current_image_sampling_step >= shared.opts.show_progress_every_n_steps:
self.do_set_current_image()
@torch.inference_mode()