Commit
·
7095c8c
1
Parent(s):
2d98a52
- modules/core.py +3 -2
- modules/default_pipeline.py +1 -1
modules/core.py
CHANGED
|
@@ -58,13 +58,14 @@ def get_previewer(device, latent_format):
|
|
| 58 |
|
| 59 |
taesd = TAESD(None, taesd_decoder_path).to(device)
|
| 60 |
|
| 61 |
-
def preview_function(x0):
|
| 62 |
with torch.no_grad():
|
| 63 |
x_sample = taesd.decoder(x0).detach() * 255.0
|
| 64 |
x_sample = einops.rearrange(x_sample, 'b c h w -> b h w c')
|
| 65 |
x_sample = x_sample.cpu().numpy()[..., ::-1].copy().clip(0, 255).astype(np.uint8)
|
| 66 |
for i, s in enumerate(x_sample):
|
| 67 |
cv2.imshow(f'Preview {i}', s)
|
|
|
|
| 68 |
cv2.waitKey(1)
|
| 69 |
|
| 70 |
taesd.preview = preview_function
|
|
@@ -99,7 +100,7 @@ def ksampler(model, positive, negative, latent, seed=None, steps=30, cfg=9.0, sa
|
|
| 99 |
|
| 100 |
def callback(step, x0, x, total_steps):
|
| 101 |
if previewer and step % 3 == 0:
|
| 102 |
-
previewer.preview(x0)
|
| 103 |
pbar.update_absolute(step + 1, total_steps, None)
|
| 104 |
|
| 105 |
samples = comfy.sample.sample(model, noise, steps, cfg, sampler_name, scheduler, positive, negative, latent_image,
|
|
|
|
| 58 |
|
| 59 |
taesd = TAESD(None, taesd_decoder_path).to(device)
|
| 60 |
|
| 61 |
+
def preview_function(x0, step, total_steps):
|
| 62 |
with torch.no_grad():
|
| 63 |
x_sample = taesd.decoder(x0).detach() * 255.0
|
| 64 |
x_sample = einops.rearrange(x_sample, 'b c h w -> b h w c')
|
| 65 |
x_sample = x_sample.cpu().numpy()[..., ::-1].copy().clip(0, 255).astype(np.uint8)
|
| 66 |
for i, s in enumerate(x_sample):
|
| 67 |
cv2.imshow(f'Preview {i}', s)
|
| 68 |
+
cv2.setWindowTitle(f'Preview {i}', f'Preview {i}, [{step}/{total_steps}]')
|
| 69 |
cv2.waitKey(1)
|
| 70 |
|
| 71 |
taesd.preview = preview_function
|
|
|
|
| 100 |
|
| 101 |
def callback(step, x0, x, total_steps):
|
| 102 |
if previewer and step % 3 == 0:
|
| 103 |
+
previewer.preview(x0, step, total_steps)
|
| 104 |
pbar.update_absolute(step + 1, total_steps, None)
|
| 105 |
|
| 106 |
samples = comfy.sample.sample(model, noise, steps, cfg, sampler_name, scheduler, positive, negative, latent_image,
|
modules/default_pipeline.py
CHANGED
|
@@ -44,5 +44,5 @@ def process(positive_prompt, negative_prompt, width=1024, height=1024, batch_siz
|
|
| 44 |
images = core.image_to_numpy(decoded_latent)
|
| 45 |
|
| 46 |
core.close_all_preview()
|
| 47 |
-
|
| 48 |
return images
|
|
|
|
| 44 |
images = core.image_to_numpy(decoded_latent)
|
| 45 |
|
| 46 |
core.close_all_preview()
|
| 47 |
+
|
| 48 |
return images
|