mirror of
https://github.com/vladmandic/automatic
synced 2026-09-18 16:54:33 +02:00
add additional ip-adapters
This commit is contained in:
+7
-1
@@ -2,8 +2,14 @@
|
||||
|
||||
## Update for 2023-12-05
|
||||
|
||||
*Note*: based on `diffusers==0.25.0.dev0`
|
||||
|
||||
- **Diffusers**
|
||||
- **IP Adapter** add support for `ip-adapter-plus_sd15` and `ip-adapter-plus-face_sd15`
|
||||
- **General**
|
||||
- **Extra networks** new settting -> extra networks -> build info on first access
|
||||
- **LoRA** add support for block weights, thanks @AI-Casanova
|
||||
example `<lora:SDXL_LCM_LoRA:1.0:in=0:mid=1:out=0>`
|
||||
- **Extra networks** new *settting -> extra networks -> build info on first access*
|
||||
indexes all networks on first access instead of server startup
|
||||
- disable google fonts check on server startup
|
||||
- fix torchvision/basicsr compatibility
|
||||
|
||||
@@ -705,13 +705,15 @@ def process_images(p: StableDiffusionProcessing) -> Processed:
|
||||
modules.sd_vae.reload_vae_weights()
|
||||
|
||||
shared.prompt_styles.apply_styles_to_extra(p)
|
||||
|
||||
print('HERE1')
|
||||
if not shared.opts.cuda_compile:
|
||||
modules.sd_models.apply_token_merging(p.sd_model, p.get_token_merging_ratio())
|
||||
modules.sd_hijack_freeu.apply_freeu(p, shared.backend == shared.Backend.ORIGINAL)
|
||||
|
||||
print('HERE2')
|
||||
modules.script_callbacks.before_process_callback(p)
|
||||
|
||||
print('HERE3')
|
||||
if shared.cmd_opts.profile:
|
||||
import cProfile
|
||||
profile_python = cProfile.Profile()
|
||||
@@ -732,6 +734,7 @@ def process_images(p: StableDiffusionProcessing) -> Processed:
|
||||
else:
|
||||
with context_hypertile_vae(p), context_hypertile_unet(p):
|
||||
res = process_images_inner(p)
|
||||
print('HERE4')
|
||||
|
||||
finally:
|
||||
if not shared.opts.cuda_compile:
|
||||
|
||||
@@ -8,6 +8,7 @@ TODO:
|
||||
- SD/SDXL autodetect
|
||||
"""
|
||||
|
||||
import time
|
||||
import gradio as gr
|
||||
from modules import scripts, processing, shared, devices
|
||||
|
||||
@@ -18,11 +19,11 @@ ADAPTERS = [
|
||||
'none',
|
||||
'models/ip-adapter_sd15',
|
||||
'models/ip-adapter_sd15_light',
|
||||
# 'models/ip-adapter_sd15_vit-G', # RuntimeError: mat1 and mat2 shapes cannot be multiplied (2x1024 and 1280x3072)
|
||||
# 'models/ip-adapter-plus_sd15', # KeyError: 'proj.weight'
|
||||
# 'models/ip-adapter-plus-face_sd15', # KeyError: 'proj.weight'
|
||||
'models/ip-adapter-plus_sd15',
|
||||
'models/ip-adapter-plus-face_sd15',
|
||||
# 'models/ip-adapter-full-face_sd15', # KeyError: 'proj.weight'
|
||||
'sdxl_models/ip-adapter_sdxl',
|
||||
# 'models/ip-adapter_sd15_vit-G', # RuntimeError: mat1 and mat2 shapes cannot be multiplied (2x1024 and 1280x3072)
|
||||
# 'sdxl_models/ip-adapter_sdxl_vit-h',
|
||||
# 'sdxl_models/ip-adapter-plus_sdxl_vit-h',
|
||||
# 'sdxl_models/ip-adapter-plus-face_sdxl_vit-h',
|
||||
@@ -89,13 +90,17 @@ class Script(scripts.Script):
|
||||
# main code
|
||||
subfolder, model = adapter.split('/')
|
||||
if model != loaded or getattr(shared.sd_model.unet.config, 'encoder_hid_dim_type', None) is None:
|
||||
t0 = time.time()
|
||||
if loaded is not None:
|
||||
shared.log.debug('IP adapter: reset attention processor')
|
||||
shared.sd_model.unet.set_default_attn_processor()
|
||||
loaded = None
|
||||
shared.log.info(f'IP adapter load: adapter="{model}" scale={scale} image={image}')
|
||||
else:
|
||||
shared.log.debug('IP adapter: load attention processor')
|
||||
shared.sd_model.image_encoder = image_encoder
|
||||
shared.sd_model.load_ip_adapter("h94/IP-Adapter", subfolder=subfolder, weight_name=f'{model}.safetensors')
|
||||
t1 = time.time()
|
||||
shared.log.info(f'IP adapter load: adapter="{model}" scale={scale} image={image} time={t1-t0:.2f}')
|
||||
loaded = model
|
||||
else:
|
||||
shared.log.debug(f'IP adapter cache: adapter="{model}" scale={scale} image={image}')
|
||||
|
||||
Reference in New Issue
Block a user