mirror of
https://github.com/vladmandic/automatic
synced 2026-09-19 17:24:32 +02:00
ruff linting fixes
This commit is contained in:
@@ -195,7 +195,7 @@ class DDPM(pl.LightningModule):
|
||||
print(f"{context}: Restored training weights")
|
||||
|
||||
def init_from_ckpt(self, path, ignore_keys=None, only_model=False):
|
||||
ignore_keys = ignore_keys or []
|
||||
ignore_keys = ignore_keys or []
|
||||
sd = torch.load(path, map_location="cpu")
|
||||
if "state_dict" in list(sd.keys()):
|
||||
sd = sd["state_dict"]
|
||||
@@ -1212,8 +1212,10 @@ class LatentDiffusion(DDPM):
|
||||
|
||||
if i % log_every_t == 0 or i == timesteps - 1:
|
||||
intermediates.append(img)
|
||||
if callback: callback(i)
|
||||
if img_callback: img_callback(img, i)
|
||||
if callback:
|
||||
callback(i)
|
||||
if img_callback:
|
||||
img_callback(img, i)
|
||||
|
||||
if return_intermediates:
|
||||
return img, intermediates
|
||||
|
||||
@@ -29,10 +29,10 @@ class UniPCSampler(object):
|
||||
# first time we have all the info to get the real parameters from the ui
|
||||
# value from the hires steps slider:
|
||||
num_inference_steps = t[0] + 1
|
||||
approx_denoise_strength = num_inference_steps / self.inflated_steps
|
||||
num_inference_steps / self.inflated_steps
|
||||
self.denoise_steps = max(num_inference_steps, shared.opts.uni_pc_order)
|
||||
|
||||
init_timestep = max(self.inflated_steps - self.denoise_steps, 0)
|
||||
max(self.inflated_steps - self.denoise_steps, 0)
|
||||
|
||||
# actual number of steps we'll run
|
||||
|
||||
|
||||
@@ -752,7 +752,7 @@ class UniPC:
|
||||
t_T = self.noise_schedule.T if t_start is None else t_start
|
||||
device = x.device
|
||||
if method == 'multistep':
|
||||
if timesteps == None:
|
||||
if timesteps is None:
|
||||
timesteps = get_time_steps(self.noise_schedule, skip_type=skip_type, t_T=t_T, t_0=t_0, N=steps, device=device)
|
||||
#print(f"Running UniPC Sampling with {timesteps.shape[0]} timesteps, order {order}")
|
||||
assert steps >= order, "UniPC order must be < sampling steps"
|
||||
@@ -773,7 +773,7 @@ class UniPC:
|
||||
if self.after_update is not None:
|
||||
self.after_update(x, model_x)
|
||||
model_prev_list.append(model_x)
|
||||
t_prev_list.append(vec_t)
|
||||
t_prev_list.append(vec_t)
|
||||
progress.update(task, advance=1, description=f"Progress {round(len(vec_t) * init_order / (time.time() - t), 2)}it/s")
|
||||
# for step in trange(order, steps + 1):
|
||||
for step in range(order, steps + 1):
|
||||
|
||||
Reference in New Issue
Block a user