Skip to content

Commit

Permalink
fix: VAEEncodeTiled - overlap compatibility patch
Browse files Browse the repository at this point in the history
  • Loading branch information
ltdrdata committed Dec 21, 2024
1 parent 8f04714 commit c21b361
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion modules/impact/config.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import configparser
import os

version_code = [8, 1, 2]
version_code = [8, 1, 3]
version = f"V{version_code[0]}.{version_code[1]}" + (f'.{version_code[2]}' if len(version_code) > 2 else '')

dependency_version = 24
Expand Down
17 changes: 11 additions & 6 deletions modules/impact/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1384,9 +1384,14 @@ def vae_decode(vae, samples, use_tile, hook, tile_size=512, overlap=64):
return pixels


def vae_encode(vae, pixels, use_tile, hook, tile_size=512):
def vae_encode(vae, pixels, use_tile, hook, tile_size=512, overlap=64):
if use_tile:
samples = nodes.VAEEncodeTiled().encode(vae, pixels, tile_size)[0]
encoder = nodes.VAEEncodeTiled()
if 'overlap' in inspect.signature(encoder.encode).parameters:
samples = encoder.encode(vae, pixels, tile_size, overlap=overlap)[0]
else:
print(f"[Impact Pack] Your ComfyUI is outdated.")
samples = encoder.encode(vae, pixels, tile_size)[0]
else:
samples = nodes.VAEEncode().encode(vae, pixels)[0]

Expand All @@ -1412,7 +1417,7 @@ def latent_upscale_on_pixel_space_shape2(samples, scale_method, w, h, vae, use_t
if hook is not None:
pixels = hook.post_upscale(pixels)

return (vae_encode(vae, pixels, use_tile, hook, tile_size=tile_size), old_pixels)
return vae_encode(vae, pixels, use_tile, hook, tile_size=tile_size, overlap=overlap), old_pixels


def latent_upscale_on_pixel_space(samples, scale_method, scale_factor, vae, use_tile=False, tile_size=512, save_temp_prefix=None, hook=None, overlap=64):
Expand All @@ -1433,7 +1438,7 @@ def latent_upscale_on_pixel_space2(samples, scale_method, scale_factor, vae, use
if hook is not None:
pixels = hook.post_upscale(pixels)

return (vae_encode(vae, pixels, use_tile, hook, tile_size=tile_size), old_pixels)
return vae_encode(vae, pixels, use_tile, hook, tile_size=tile_size, overlap=overlap), old_pixels


def latent_upscale_on_pixel_space_with_model_shape(samples, scale_method, upscale_model, new_w, new_h, vae, use_tile=False, tile_size=512, save_temp_prefix=None, hook=None, overlap=64):
Expand Down Expand Up @@ -1464,7 +1469,7 @@ def latent_upscale_on_pixel_space_with_model_shape2(samples, scale_method, upsca
if hook is not None:
pixels = hook.post_upscale(pixels)

return (vae_encode(vae, pixels, use_tile, hook, tile_size=tile_size), old_pixels)
return vae_encode(vae, pixels, use_tile, hook, tile_size=tile_size, overlap=overlap), old_pixels


def latent_upscale_on_pixel_space_with_model(samples, scale_method, upscale_model, scale_factor, vae, use_tile=False,
Expand Down Expand Up @@ -1500,7 +1505,7 @@ def latent_upscale_on_pixel_space_with_model2(samples, scale_method, upscale_mod
if hook is not None:
pixels = hook.post_upscale(pixels)

return (vae_encode(vae, pixels, use_tile, hook, tile_size=tile_size), old_pixels)
return vae_encode(vae, pixels, use_tile, hook, tile_size=tile_size, overlap=overlap), old_pixels


class TwoSamplersForMaskUpscaler:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[project]
name = "comfyui-impact-pack"
description = "This node pack offers various detector nodes and detailer nodes that allow you to configure a workflow that automatically enhances facial details. And provide iterative upscaler."
version = "8.1.2"
version = "8.1.3"
license = { file = "LICENSE.txt" }
dependencies = ["segment-anything", "scikit-image", "piexif", "transformers", "opencv-python-headless", "GitPython", "scipy>=1.11.4"]

Expand Down

0 comments on commit c21b361

Please sign in to comment.