Support GLIGEN.
This commit is contained in:
@@ -22,8 +22,6 @@ This extension enables **large image drawing & upscaling with limited VRAM** via
|
||||
- [x] Img2img upscale
|
||||
- [x] Ultra-Large image generation
|
||||
|
||||
Some conditioning nodes like SetArea or GLIGEN aren't working at the moment.
|
||||
|
||||
## Tiled Diffusion
|
||||
|
||||
<div align="center">
|
||||
@@ -35,7 +33,7 @@ Some conditioning nodes like SetArea or GLIGEN aren't working at the moment.
|
||||
|
||||
| Name | Description |
|
||||
|-------------------|--------------------------------------------------------------|
|
||||
| `method` | Tiling strategy. `MultiDiffusion` or `Mixture of Diffusers`. |
|
||||
| `method` | Tiling [strategy](https://github.com/pkuliyi2015/multidiffusion-upscaler-for-automatic1111/blob/fbb24736c9bc374c7f098f82b575fcd14a73936a/scripts/tilediffusion.py#L39-L46). `MultiDiffusion` or `Mixture of Diffusers`. |
|
||||
| `tile_width` | Tile's width |
|
||||
| `tile_height` | Tile's height |
|
||||
| `tile_overlap` | Tile's overlap |
|
||||
|
||||
@@ -98,6 +98,18 @@ def hook_samplers_pre_run_control():
|
||||
fn = inject_code(pre_run_control, payload)
|
||||
return create_hook(fn, 'comfy.samplers')
|
||||
|
||||
def hook_gligen__set_position():
|
||||
from comfy.gligen import Gligen
|
||||
payload = [{
|
||||
"target_line": "module = self.module_list[key]",
|
||||
"code_to_insert": """
|
||||
nonlocal objs
|
||||
if x.shape[0] > objs.shape[0]:
|
||||
objs = objs.repeat(-(x.shape[0] // -objs.shape[0]),1,1)
|
||||
"""}]
|
||||
fn = inject_code(Gligen._set_position, payload, 'a')
|
||||
return create_hook(fn, 'comfy.gligen', 'Gligen._set_position', 'Gligen._set_position')
|
||||
|
||||
def create_hook(fn, module_name:str, target = None, orig_key = None):
|
||||
if target is None: target = fn.__name__
|
||||
if orig_key is None: orig_key = f'{target}_original'
|
||||
@@ -131,6 +143,7 @@ def hook_all(restore=False, hooks=None):
|
||||
hook_calc_cond_uncond_batch(),
|
||||
hook_sag_create_blur_map(),
|
||||
hook_samplers_pre_run_control(),
|
||||
hook_gligen__set_position(),
|
||||
]
|
||||
for m in sys.modules:
|
||||
for hook in hooks:
|
||||
|
||||
Reference in New Issue
Block a user