ling
This commit is contained in:
lllyasviel 2023-10-18 23:54:40 -07:00
parent 9660daff94
commit 906dfa1331
5 changed files with 28 additions and 22 deletions

View File

@ -1 +1 @@
version = '2.1.703'
version = '2.1.704'

View File

@ -400,8 +400,9 @@ def worker():
pipeline.final_unet.model.diffusion_model.in_inpaint = True
# outputs.append(['results', inpaint_worker.current_task.visualize_mask_processing()])
# return
if advanced_parameters.debugging_cn_preprocessor:
outputs.append(['results', inpaint_worker.current_task.visualize_mask_processing()])
return
progressbar(13, 'VAE Inpaint encoding ...')

View File

@ -335,8 +335,6 @@ def process_diffusion(positive_cond, negative_cond, steps, switch, width, height
# Disable refiner to avoid SD15 in joint swap
final_refiner_unet = None
print(f'[Sampler] refiner_swap_method = {refiner_swap_method}')
if latent is None:
empty_latent = core.generate_empty_latent(width=width, height=height, batch_size=1)
else:
@ -353,6 +351,12 @@ def process_diffusion(positive_cond, negative_cond, steps, switch, width, height
sigma_min, sigma_max, seed=image_seed, cpu=False)
decoded_latent = None
refiner_use_different_vae = final_refiner_vae is not None and final_refiner_unet is not None
if refiner_swap_method == 'upscale' and not refiner_use_different_vae:
refiner_swap_method = 'joint'
print(f'[Sampler] refiner_swap_method = {refiner_swap_method}')
if refiner_swap_method == 'joint':
sampled_latent = core.ksampler(
@ -375,14 +379,10 @@ def process_diffusion(positive_cond, negative_cond, steps, switch, width, height
decoded_latent = core.decode_vae(vae=final_vae, latent_image=sampled_latent, tiled=tiled)
if refiner_swap_method == 'upscale':
target_model = final_refiner_unet
if target_model is None:
target_model = final_unet
sampled_latent = core.ksampler(
model=target_model,
positive=clip_separate(positive_cond, target_model=target_model.model, target_clip=final_clip),
negative=clip_separate(negative_cond, target_model=target_model.model, target_clip=final_clip),
model=final_refiner_unet,
positive=clip_separate(positive_cond, target_model=final_refiner_unet.model, target_clip=final_clip),
negative=clip_separate(negative_cond, target_model=final_refiner_unet.model, target_clip=final_clip),
latent=empty_latent,
steps=steps, start_step=0, last_step=steps, disable_noise=False, force_full_denoise=True,
seed=image_seed,
@ -394,11 +394,7 @@ def process_diffusion(positive_cond, negative_cond, steps, switch, width, height
previewer_start=0,
previewer_end=steps,
)
target_model = final_refiner_vae
if target_model is None:
target_model = final_vae
decoded_latent = core.decode_vae(vae=target_model, latent_image=sampled_latent, tiled=tiled)
decoded_latent = core.decode_vae(vae=final_refiner_vae, latent_image=sampled_latent, tiled=tiled)
if refiner_swap_method == 'separate':
sampled_latent = core.ksampler(

View File

@ -189,6 +189,15 @@ def downloading_inpaint_models(v):
model_dir=inpaint_models_path,
file_name='fooocus_inpaint_head.pth'
)
head_file = os.path.join(inpaint_models_path, 'fooocus_inpaint_head.pth')
patch_file = None
# load_file_from_url(
# url='https://huggingface.co/lllyasviel/Annotators/resolve/main/ControlNetLama.pth',
# model_dir=inpaint_models_path,
# file_name='ControlNetLama.pth'
# )
# lama_file = os.path.join(inpaint_models_path, 'ControlNetLama.pth')
if v == 'v1':
load_file_from_url(
@ -196,8 +205,7 @@ def downloading_inpaint_models(v):
model_dir=inpaint_models_path,
file_name='inpaint.fooocus.patch'
)
return os.path.join(inpaint_models_path, 'fooocus_inpaint_head.pth'), os.path.join(inpaint_models_path,
'inpaint.fooocus.patch')
patch_file = os.path.join(inpaint_models_path, 'inpaint.fooocus.patch')
if v == 'v2.5':
load_file_from_url(
@ -205,8 +213,9 @@ def downloading_inpaint_models(v):
model_dir=inpaint_models_path,
file_name='inpaint_v25.fooocus.patch'
)
return os.path.join(inpaint_models_path, 'fooocus_inpaint_head.pth'), os.path.join(inpaint_models_path,
'inpaint_v25.fooocus.patch')
patch_file = os.path.join(inpaint_models_path, 'inpaint_v25.fooocus.patch')
return head_file, patch_file
def downloading_controlnet_canny():

View File

@ -279,7 +279,7 @@ with shared.gradio_root:
info='Version of Fooocus inpaint model')
with gr.Tab(label='Control Debug'):
debugging_cn_preprocessor = gr.Checkbox(label='Debug Preprocessor of ControlNets', value=False)
debugging_cn_preprocessor = gr.Checkbox(label='Debug Preprocessors', value=False)
mixing_image_prompt_and_vary_upscale = gr.Checkbox(label='Mixing Image Prompt and Vary/Upscale',
value=False)