ruff linting fixes

This commit is contained in:
Vladimir Mandic
2023-06-13 12:22:39 -04:00
parent cb307399dd
commit 1d9e490ef9
33 changed files with 86 additions and 86 deletions
+5 -3
View File
@@ -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
+2 -2
View File
@@ -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
+2 -2
View File
@@ -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):