From 17dfcc97eb55965ccf31d0abbb169d28e7010326 Mon Sep 17 00:00:00 2001 From: Disty0 Date: Fri, 17 Nov 2023 12:24:38 +0300 Subject: [PATCH 1/6] Update OpenVINO --- installer.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/installer.py b/installer.py index 78b530bc0..04a160b5c 100644 --- a/installer.py +++ b/installer.py @@ -442,7 +442,6 @@ def check_torch(): torchvision_pip = 'https://github.com/Nuullll/intel-extension-for-pytorch/releases/download/v2.0.110%2Bxpu-master%2Bdll-bundle/torchvision-0.15.2a0+fa99a53-cp310-cp310-win_amd64.whl' ipex_pip = 'https://github.com/Nuullll/intel-extension-for-pytorch/releases/download/v2.0.110%2Bxpu-master%2Bdll-bundle/intel_extension_for_pytorch-2.0.110+gitc6ea20b-cp310-cp310-win_amd64.whl' torch_command = os.environ.get('TORCH_COMMAND', f'{pytorch_pip} {torchvision_pip} {ipex_pip}') - uninstall('openvino-nightly') install('openvino', 'openvino', ignore=True) install('onnxruntime-openvino', 'onnxruntime-openvino', ignore=True) # TODO numpy version conflicts with tensorflow and doesn't support Python 3.11 elif allow_openvino and args.use_openvino: @@ -544,8 +543,8 @@ def check_torch(): if opts.get('cuda_compile_backend', '') == 'hidet': install('hidet', 'hidet') if args.use_openvino or opts.get('cuda_compile_backend', '') == 'openvino_fx': - uninstall('openvino') - install('openvino-nightly==2023.3.0.dev20231114', 'openvino-nightly') + uninstall('openvino-nightly') # TODO remove after people had enough time upgrading + install('openvino==2023.2.0', 'openvino') install('onnxruntime-openvino', 'onnxruntime-openvino', ignore=True) # TODO numpy version conflicts with tensorflow and doesn't support Python 3.11 os.environ.setdefault('PYTORCH_TRACING_MODE', 'TORCHFX') os.environ.setdefault('NEOReadDebugKeys', '1') From 378c16782038c7d279d356e316350a7b092d8966 Mon Sep 17 00:00:00 2001 From: Vladimir Mandic Date: Fri, 17 Nov 2023 08:38:13 -0500 Subject: [PATCH 2/6] update pillow --- javascript/loader.js | 5 ++++- javascript/logMonitor.js | 2 +- javascript/sdnext.css | 1 + launch.py | 2 +- modules/images.py | 12 +++++------- modules/sd_models.py | 23 ++++++++++++----------- requirements.txt | 6 +++--- 7 files changed, 27 insertions(+), 24 deletions(-) diff --git a/javascript/loader.js b/javascript/loader.js index 9b8ef4b3e..4fb85462f 100644 --- a/javascript/loader.js +++ b/javascript/loader.js @@ -39,7 +39,10 @@ async function createSplash() { document.getElementById('splash').insertAdjacentHTML('afterbegin', imgEl); fetch('/sdapi/v1/motd') .then((res) => res.text()) - .then((text) => document.getElementById('motd').innerHTML = text.replace(/["]+/g, '')) + .then((text) => { + const motdEl = document.getElementById('motd'); + if (motdEl) motdEl.innerHTML = text.replace(/["]+/g, ''); + }) .catch((err) => console.error('getMOTD:', err)); } diff --git a/javascript/logMonitor.js b/javascript/logMonitor.js index bca665672..7677cfced 100644 --- a/javascript/logMonitor.js +++ b/javascript/logMonitor.js @@ -39,7 +39,7 @@ async function initLogMonitor() { - + diff --git a/javascript/sdnext.css b/javascript/sdnext.css index 94652f34f..31b8a8f5c 100644 --- a/javascript/sdnext.css +++ b/javascript/sdnext.css @@ -234,6 +234,7 @@ table.settings-value-table td { padding: 0.4em; border: 1px solid #ccc; max-widt .extras { gap: 0.2em 1em !important } #extras_generate, #extras_interrupt, #extras_skip { display: block !important; position: relative; height: 36px; } #extras_upscale { margin-top: 10px } +#pnginfo_html_info { line-height: 1.5em; } /* log monitor */ .log-monitor { display: none; justify-content: unset !important; overflow: hidden; padding: 0; margin-top: auto; font-family: monospace; font-size: 0.85em; } diff --git a/launch.py b/launch.py index aeb3a1475..f47876240 100755 --- a/launch.py +++ b/launch.py @@ -233,7 +233,7 @@ if __name__ == "__main__": if round(time.time()) % 120 == 0: state = f'job="{instance.state.job}" {instance.state.job_no}/{instance.state.job_count}' if instance.state.job != '' or instance.state.job_no != 0 or instance.state.job_count != 0 else 'idle' uptime = round(time.time() - instance.state.server_start) - installer.log.debug(f'Server: alive={alive} jobs={instance.state.total_jobs} requests={requests} uptime={uptime} memory={get_memory_stats()} backend={instance.backend} {state}') + installer.log.debug(f'Server: alive={alive} jobs={instance.state.total_jobs} requests={requests} uptime={uptime} memory={get_memory_stats()} backend={instance.backend} state={state}') if not alive: if uv is not None and uv.wants_restart: installer.log.info('Server restarting...') diff --git a/modules/images.py b/modules/images.py index 652551b08..9c8def630 100644 --- a/modules/images.py +++ b/modules/images.py @@ -18,10 +18,8 @@ import piexif.helper from PIL import Image, ImageFont, ImageDraw, PngImagePlugin, ExifTags from modules import sd_samplers, shared, script_callbacks, errors, paths -LANCZOS = (Image.Resampling.LANCZOS if hasattr(Image, 'Resampling') else Image.LANCZOS) + debug = errors.log.info if os.environ.get('SD_PATH_DEBUG', None) is not None else lambda *args, **kwargs: None - - try: from pi_heif import register_heif_opener register_heif_opener() @@ -143,8 +141,8 @@ def draw_grid_annotations(im, width, height, hor_texts, ver_texts, margin=0, tit for line in lines: font = initial_fnt fontsize = initial_fontsize - while drawing.multiline_textsize(line.text, font=font)[0] > line.allowed_width and fontsize > 0: - fontsize -= 2 + while drawing.multiline_textbbox((0,0), text=line.text, font=font)[0] > line.allowed_width and fontsize > 0: + fontsize -= 1 font = get_font(fontsize) drawing.multiline_text((draw_x, draw_y + line.size[1] / 2), line.text, font=font, fill=shared.opts.font_color if line.is_active else color_inactive, anchor="mm", align="center") if not line.is_active: @@ -230,7 +228,7 @@ def resize_image(resize_mode, im, width, height, upscaler_name=None, output_type def resize(im, w, h): if upscaler_name is None or upscaler_name == "None" or im.mode == 'L': - return im.resize((w, h), resample=LANCZOS) + return im.resize((w, h), resample=Image.Resampling.LANCZOS) scale = max(w / im.width, h / im.height) if scale > 1.0: upscalers = [x for x in shared.sd_upscalers if x.name == upscaler_name] @@ -241,7 +239,7 @@ def resize_image(resize_mode, im, width, height, upscaler_name=None, output_type upscaler = upscalers[0] im = upscaler.scaler.upscale(im, scale, upscaler.data_path) if im.width != w or im.height != h: - im = im.resize((w, h), resample=LANCZOS) + im = im.resize((w, h), resample=Image.Resampling.LANCZOS) return im if resize_mode == 0: diff --git a/modules/sd_models.py b/modules/sd_models.py index fc96b00c5..e0a9d359b 100644 --- a/modules/sd_models.py +++ b/modules/sd_models.py @@ -595,51 +595,52 @@ def change_backend(): refresh_vae_list() -def detect_pipeline(f: str, op: str = 'model'): +def detect_pipeline(f: str, op: str = 'model', warning=True): if not f.endswith('.safetensors'): return None, None guess = shared.opts.diffusers_pipeline + warn = shared.log.warning if warning else lambda *args, **kwargs: None if guess == 'Autodetect': try: size = round(os.path.getsize(f) / 1024 / 1024) if size < 128: - shared.log.warning(f'Model size smaller than expected: {f} size={size} MB') + warn(f'Model size smaller than expected: {f} size={size} MB') elif (size >= 316 and size <= 324) or (size >= 156 and size <= 164): # 320 or 160 - shared.log.warning(f'Model detected as VAE model, but attempting to load as model: {op}={f} size={size} MB') + warn(f'Model detected as VAE model, but attempting to load as model: {op}={f} size={size} MB') guess = 'VAE' elif size >= 5351 and size <= 5359: # 5353 guess = 'Stable Diffusion' # SD v2 elif size >= 5791 and size <= 5799: # 5795 if shared.backend == shared.Backend.ORIGINAL: - shared.log.warning(f'Model detected as SD-XL refiner model, but attempting to load using backend=original: {op}={f} size={size} MB') + warn(f'Model detected as SD-XL refiner model, but attempting to load using backend=original: {op}={f} size={size} MB') if op == 'model': - shared.log.warning(f'Model detected as SD-XL refiner model, but attempting to load a base model: {op}={f} size={size} MB') + warn(f'Model detected as SD-XL refiner model, but attempting to load a base model: {op}={f} size={size} MB') guess = 'Stable Diffusion XL' elif (size >= 6611 and size <= 6619) or (size >= 6771 and size <= 6779): # 6617, HassakuXL is 6776 if shared.backend == shared.Backend.ORIGINAL: - shared.log.warning(f'Model detected as SD-XL base model, but attempting to load using backend=original: {op}={f} size={size} MB') + warn(f'Model detected as SD-XL base model, but attempting to load using backend=original: {op}={f} size={size} MB') guess = 'Stable Diffusion XL' elif size >= 3361 and size <= 3369: # 3368 if shared.backend == shared.Backend.ORIGINAL: - shared.log.warning(f'Model detected as SD upscale model, but attempting to load using backend=original: {op}={f} size={size} MB') + warn(f'Model detected as SD upscale model, but attempting to load using backend=original: {op}={f} size={size} MB') guess = 'Stable Diffusion Upscale' elif size >= 4891 and size <= 4899: # 4897 if shared.backend == shared.Backend.ORIGINAL: - shared.log.warning(f'Model detected as SD XL inpaint model, but attempting to load using backend=original: {op}={f} size={size} MB') + warn(f'Model detected as SD XL inpaint model, but attempting to load using backend=original: {op}={f} size={size} MB') guess = 'Stable Diffusion XL Inpaint' elif size >= 9791 and size <= 9799: # 9794 if shared.backend == shared.Backend.ORIGINAL: - shared.log.warning(f'Model detected as SD XL instruct pix2pix model, but attempting to load using backend=original: {op}={f} size={size} MB') + warn(f'Model detected as SD XL instruct pix2pix model, but attempting to load using backend=original: {op}={f} size={size} MB') guess = 'Stable Diffusion XL Instruct' else: guess = 'Stable Diffusion' if 'LCM_' in f or 'LCM-' in f: if shared.backend == shared.Backend.ORIGINAL: - shared.log.warning(f'Model detected as LCM model, but attempting to load using backend=original: {op}={f} size={size} MB') + warn(f'Model detected as LCM model, but attempting to load using backend=original: {op}={f} size={size} MB') guess = 'Latent Consistency Model' if 'PixArt' in f: if shared.backend == shared.Backend.ORIGINAL: - shared.log.warning(f'Model detected as PixArt Alpha model, but attempting to load using backend=original: {op}={f} size={size} MB') + warn(f'Model detected as PixArt Alpha model, but attempting to load using backend=original: {op}={f} size={size} MB') guess = 'PixArt Alpha' pipeline = shared_items.get_pipelines().get(guess, None) shared.log.info(f'Autodetect: {op}="{guess}" class={pipeline.__name__} file="{f}" size={size}MB') diff --git a/requirements.txt b/requirements.txt index 4207bf910..04dd5360f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -50,10 +50,10 @@ requests==2.31.0 tqdm==4.66.1 accelerate==0.20.3 opencv-python-headless==4.7.0.72 -diffusers==0.23.0 +diffusers==0.23.1 einops==0.4.1 gradio==3.43.2 -huggingface_hub==0.19.2 +huggingface_hub==0.19.4 numexpr==2.8.4 numpy==1.24.4 numba==0.57.1 @@ -63,7 +63,7 @@ pytorch_lightning==1.9.4 transformers==4.35.1 tomesd==0.1.3 urllib3==1.26.15 -Pillow==9.5.0 +Pillow==10.1.0 timm==0.9.7 pydantic==1.10.13 typing-extensions==4.8.0 From 75af4087e81009627c392f7f4d5beec9e8973414 Mon Sep 17 00:00:00 2001 From: Vladimir Mandic Date: Fri, 17 Nov 2023 10:53:21 -0500 Subject: [PATCH 3/6] formatting --- javascript/sdnext.css | 4 ++-- modules/processing_diffusers.py | 1 - modules/ui_common.py | 21 ++++++++++++++------- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/javascript/sdnext.css b/javascript/sdnext.css index 31b8a8f5c..f07228cf0 100644 --- a/javascript/sdnext.css +++ b/javascript/sdnext.css @@ -94,7 +94,8 @@ div#extras_scale_to_tab div.form{ flex-direction: row; } #mode_img2img .gradio-image > div.fixed-height, #mode_img2img .gradio-image > div.fixed-height img{ height: 480px !important; max-height: 480px !important; min-height: 480px !important; } #img2img_sketch, #img2maskimg, #inpaint_sketch { overflow: overlay !important; resize: auto; background: var(--panel-background-fill); z-index: 5; } .image-buttons button{ min-width: auto; } -.infotext { overflow-wrap: break-word; } +.infotext { overflow-wrap: break-word; line-height: 1.5em; } +.infotext > p { padding-left: 1em; text-indent: -1em; } .tooltip { display: block; position: fixed; top: 1em; right: 1em; padding: 0.5em; background: var(--input-background-fill); color: var(--body-text-color); border: 1pt solid var(--button-primary-border-color); width: 22em; min-height: 1.3em; font-size: 0.8em; transition: opacity 0.2s ease-in; pointer-events: none; opacity: 0; z-index: 999; } .tooltip-show { opacity: 0.9; } @@ -234,7 +235,6 @@ table.settings-value-table td { padding: 0.4em; border: 1px solid #ccc; max-widt .extras { gap: 0.2em 1em !important } #extras_generate, #extras_interrupt, #extras_skip { display: block !important; position: relative; height: 36px; } #extras_upscale { margin-top: 10px } -#pnginfo_html_info { line-height: 1.5em; } /* log monitor */ .log-monitor { display: none; justify-content: unset !important; overflow: hidden; padding: 0; margin-top: auto; font-family: monospace; font-size: 0.85em; } diff --git a/modules/processing_diffusers.py b/modules/processing_diffusers.py index 59ec22a41..00b22055d 100644 --- a/modules/processing_diffusers.py +++ b/modules/processing_diffusers.py @@ -470,7 +470,6 @@ def process_diffusers(p: StableDiffusionProcessing, seeds, prompts, negative_pro desc='Base', ) shared.state.sampling_steps = base_args['num_inference_steps'] - p.extra_generation_params['CFG rescale'] = p.diffusers_guidance_rescale p.extra_generation_params["Sampler Eta"] = shared.opts.scheduler_eta if shared.opts.scheduler_eta is not None and shared.opts.scheduler_eta > 0 and shared.opts.scheduler_eta < 1 else None try: output = shared.sd_model(**base_args) # pylint: disable=not-callable diff --git a/modules/ui_common.py b/modules/ui_common.py index 9206c6c59..a2b8aa1ee 100644 --- a/modules/ui_common.py +++ b/modules/ui_common.py @@ -6,7 +6,7 @@ import platform import subprocess import gradio as gr from modules import call_queue, shared -from modules.generation_parameters_copypaste import image_from_url_text +from modules.generation_parameters_copypaste import image_from_url_text, parse_generation_parameters import modules.ui_symbols as symbols import modules.images import modules.script_callbacks @@ -34,12 +34,19 @@ def plaintext_to_html(text): def infotext_to_html(text): - res = '

Prompt: ' + html.escape(text or '').replace('\n', '
') + '

' - sections = res.split('Steps:') # before and after prompt+negprompt' - if len(sections) > 1: - res = sections[0] + '
Steps: ' + sections[1].strip().replace(', ', ' | ') - res = res.replace('

', '
') - return res + res = parse_generation_parameters(text) + prompt = res.get('Prompt', None) + negative = res.get('Negative prompt', None) + res.pop('Prompt', None) + res.pop('Negative prompt', None) + params = [f'{k}: {v}' for k, v in res.items() if v is not None] + params = '| '.join(params) + code = f''' +

Prompt: {prompt}

+

Negative: {negative}

+

Parameters: {params}

+ ''' + return code def delete_files(js_data, images, _html_info, index): From 7ef41af090276de5b226474b62c2c238e89ab124 Mon Sep 17 00:00:00 2001 From: Disty0 Date: Fri, 17 Nov 2023 23:32:12 +0300 Subject: [PATCH 4/6] Fix AnimateDiff is_sdxl error --- modules/sd_models.py | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/sd_models.py b/modules/sd_models.py index e0a9d359b..6a5a40fef 100644 --- a/modules/sd_models.py +++ b/modules/sd_models.py @@ -1088,6 +1088,7 @@ def load_model(checkpoint_info=None, already_loaded_state_dict=None, timer=None, shared.log.debug(f"Model created from config: {checkpoint_config}") sd_model.used_config = checkpoint_config sd_model.has_accelerate = False + sd_model.is_sdxl = False # a1111 compatibility item timer.record("create") ok = load_model_weights(sd_model, checkpoint_info, state_dict, timer) if not ok: From d46dddd02467ef5632dbd9619839d0849eac16a8 Mon Sep 17 00:00:00 2001 From: Vladimir Mandic Date: Fri, 17 Nov 2023 16:59:30 -0500 Subject: [PATCH 5/6] fix upscale and add some compile options --- CHANGELOG.md | 3 ++- installer.py | 24 ++++++++++++------------ modules/processing_diffusers.py | 18 ++++++++---------- modules/sd_models_compile.py | 3 +++ modules/shared.py | 2 +- modules/upscaler.py | 2 +- 6 files changed, 27 insertions(+), 25 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3ce6e547a..0807b2c2c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -43,13 +43,14 @@ - Support `--ckpt none` to skip loading a model - **XYZ grid** - Add refiner options to XYZ Grid - - Add option to create only subimages in XYZ grid, thanks @midcoastal + - Add option to create only subgrids in XYZ grid, thanks @midcoastal - Allow custom font, background and text color in settings - **Fixes** - Fix `params.txt` saved before actual image - Fix inpaint - Fix manual grid image save - Fix img2img init image save + - Fix upscale in txt2img for batch counts when no hires is used - More uniform models paths - Safe scripts callback execution - Improved extension compatibility diff --git a/installer.py b/installer.py index 04a160b5c..5e7f4bc7c 100644 --- a/installer.py +++ b/installer.py @@ -775,26 +775,26 @@ def install_requirements(): # set environment variables controling the behavior of various libraries def set_environment(): log.debug('Setting environment tuning') - os.environ.setdefault('USE_TORCH', '1') - os.environ.setdefault('TF_CPP_MIN_LOG_LEVEL', '2') os.environ.setdefault('ACCELERATE', 'True') - os.environ.setdefault('FORCE_CUDA', '1') os.environ.setdefault('ATTN_PRECISION', 'fp16') - os.environ.setdefault('PYTORCH_CUDA_ALLOC_CONF', 'garbage_collection_threshold:0.8,max_split_size_mb:512') - os.environ.setdefault('CUDA_LAUNCH_BLOCKING', '0') - os.environ.setdefault('CUDA_CACHE_DISABLE', '0') os.environ.setdefault('CUDA_AUTO_BOOST', '1') - os.environ.setdefault('CUDA_MODULE_LOADING', 'LAZY') + os.environ.setdefault('CUDA_CACHE_DISABLE', '0') os.environ.setdefault('CUDA_DEVICE_DEFAULT_PERSISTING_L2_CACHE_PERCENTAGE_LIMIT', '0') + os.environ.setdefault('CUDA_LAUNCH_BLOCKING', '0') + os.environ.setdefault('CUDA_MODULE_LOADING', 'LAZY') + os.environ.setdefault('FORCE_CUDA', '1') os.environ.setdefault('GRADIO_ANALYTICS_ENABLED', 'False') - os.environ.setdefault('SAFETENSORS_FAST_GPU', '1') + os.environ.setdefault('HF_HUB_DISABLE_EXPERIMENTAL_WARNING', '1') + os.environ.setdefault('HF_HUB_DISABLE_TELEMETRY', '1') + os.environ.setdefault('K_DIFFUSION_USE_COMPILE', '0') os.environ.setdefault('NUMEXPR_MAX_THREADS', '16') os.environ.setdefault('PYTHONHTTPSVERIFY', '0') - os.environ.setdefault('HF_HUB_DISABLE_TELEMETRY', '1') - os.environ.setdefault('HF_HUB_DISABLE_EXPERIMENTAL_WARNING', '1') - os.environ.setdefault('UVICORN_TIMEOUT_KEEP_ALIVE', '60') - os.environ.setdefault('K_DIFFUSION_USE_COMPILE', '0') + os.environ.setdefault('PYTORCH_CUDA_ALLOC_CONF', 'garbage_collection_threshold:0.8,max_split_size_mb:512') + os.environ.setdefault('SAFETENSORS_FAST_GPU', '1') + os.environ.setdefault('TF_CPP_MIN_LOG_LEVEL', '2') os.environ.setdefault('TF_ENABLE_ONEDNN_OPTS', '0') + os.environ.setdefault('USE_TORCH', '1') + os.environ.setdefault('UVICORN_TIMEOUT_KEEP_ALIVE', '60') if sys.platform == 'darwin': os.environ.setdefault('PYTORCH_ENABLE_MPS_FALLBACK', '1') diff --git a/modules/processing_diffusers.py b/modules/processing_diffusers.py index 00b22055d..f491fa58b 100644 --- a/modules/processing_diffusers.py +++ b/modules/processing_diffusers.py @@ -42,16 +42,14 @@ def process_diffusers(p: StableDiffusionProcessing, seeds, prompts, negative_pro if latent_upscaler is not None: latents = torch.nn.functional.interpolate(latents, size=(p.hr_upscale_to_y // 8, p.hr_upscale_to_x // 8), mode=latent_upscaler["mode"], antialias=latent_upscaler["antialias"]) first_pass_images = vae_decode(latents=latents, model=shared.sd_model, full_quality=p.full_quality, output_type='pil') - p.init_images = [] + resized_images = [] for img in first_pass_images: if latent_upscaler is None: - init_image = images.resize_image(1, img, p.hr_upscale_to_x, p.hr_upscale_to_y, upscaler_name=p.hr_upscaler) + resized_image = images.resize_image(1, img, p.hr_upscale_to_x, p.hr_upscale_to_y, upscaler_name=p.hr_upscaler) else: - init_image = img - # if is_refiner_enabled: - # init_image = vae_encode(init_image, model=shared.sd_model, full_quality=p.full_quality) - p.init_images.append(init_image) - return p.init_images + resized_image = img + resized_images.append(resized_image) + return resized_images def save_intermediate(latents, suffix): for i in range(len(latents)): @@ -489,7 +487,7 @@ def process_diffusers(p: StableDiffusionProcessing, seeds, prompts, negative_pro return results # optional hires pass - if p.enable_hr and p.hr_upscaler != 'None' and p.denoising_strength > 0 and len(getattr(p, 'init_images', [])) == 0: + if p.enable_hr and getattr(p, 'hr_upscaler', 'None') != 'None' and len(getattr(p, 'init_images', [])) == 0: p.is_hr_pass = True latent_scale_mode = shared.latent_upscale_modes.get(p.hr_upscaler, None) if (hasattr(p, "hr_upscaler") and p.hr_upscaler is not None) else shared.latent_upscale_modes.get(shared.latent_upscale_default_mode, "None") if p.is_hr_pass: @@ -501,7 +499,7 @@ def process_diffusers(p: StableDiffusionProcessing, seeds, prompts, negative_pro save_intermediate(latents=output.images, suffix="-before-hires") shared.state.job = 'upscale' output.images = hires_resize(latents=output.images) - if latent_scale_mode is not None or p.hr_force: + if (latent_scale_mode is not None or p.hr_force) and p.denoising_strength > 0: p.ops.append('hires') shared.sd_model = sd_models.set_diffuser_pipe(shared.sd_model, sd_models.DiffusersTaskType.IMAGE_2_IMAGE) recompile_model(hires=True) @@ -518,7 +516,7 @@ def process_diffusers(p: StableDiffusionProcessing, seeds, prompts, negative_pro guidance_rescale=p.diffusers_guidance_rescale, output_type='latent' if hasattr(shared.sd_model, 'vae') else 'np', clip_skip=p.clip_skip, - image=p.init_images, + image=output.images, strength=p.denoising_strength, desc='Hires', ) diff --git a/modules/sd_models_compile.py b/modules/sd_models_compile.py index fe9f355d1..353171435 100644 --- a/modules/sd_models_compile.py +++ b/modules/sd_models_compile.py @@ -76,6 +76,9 @@ def compile_stablefast(sd_model): warnings.filterwarnings("ignore", category=torch.jit.TracerWarning) config.enable_cuda_graph = shared.opts.cuda_compile_fullgraph config.enable_jit_freeze = shared.opts.diffusers_eval + config.memory_format = torch.channels_last if shared.opts.opt_channelslast else torch.contiguous_format + # config.enable_cnn_optimization + # config.prefer_lowp_gemm try: t0 = time.time() sd_model = sf.compile(sd_model, config) diff --git a/modules/shared.py b/modules/shared.py index 2b28f5eb5..0cb16deb8 100644 --- a/modules/shared.py +++ b/modules/shared.py @@ -307,7 +307,7 @@ options_templates.update(options_section(('cuda', "Compute Settings"), { "cuda_compile_vae": OptionInfo(True if cmd_opts.use_openvino else False, "Compile VAE"), "cuda_compile_upscaler": OptionInfo(True if cmd_opts.use_openvino else False, "Compile upscaler"), "cuda_compile_backend": OptionInfo("openvino_fx" if cmd_opts.use_openvino else "none", "Model compile backend", gr.Radio, {"choices": ['none', 'inductor', 'cudagraphs', 'aot_ts_nvfuser', 'hidet', 'ipex', 'openvino_fx', 'stable-fast']}), - "cuda_compile_mode": OptionInfo("default", "Model compile mode", gr.Radio, {"choices": ['default', 'reduce-overhead', 'max-autotune']}), + "cuda_compile_mode": OptionInfo("default", "Model compile mode", gr.Radio, {"choices": ['default', 'reduce-overhead', 'max-autotune', 'max-autotune-no-cudagraphs']}), "cuda_compile_fullgraph": OptionInfo(False, "Model compile fullgraph"), "cuda_compile_precompile": OptionInfo(False if cmd_opts.use_openvino else True, "Model compile precompile"), "cuda_compile_verbose": OptionInfo(False, "Model compile verbose mode"), diff --git a/modules/upscaler.py b/modules/upscaler.py index 9228bc658..d15f44ad3 100644 --- a/modules/upscaler.py +++ b/modules/upscaler.py @@ -228,7 +228,7 @@ def compile_upscaler(model, name=""): if modules.shared.opts.cuda_compile_backend == "openvino_fx": from modules.intel.openvino import openvino_fx # pylint: disable=unused-import - from modules.sd_models_compile import CompiledModelState + from modules.sd_models_compile import CompiledModelState # pylint: disable=unused-import torch._dynamo.eval_frame.check_if_dynamo_supported = lambda: True # pylint: disable=protected-access log_level = logging.WARNING if modules.shared.opts.cuda_compile_verbose else logging.CRITICAL # pylint: disable=protected-access From 19257bbfe232b9dce4494825905f5b78533846bb Mon Sep 17 00:00:00 2001 From: Vladimir Mandic Date: Fri, 17 Nov 2023 18:20:45 -0500 Subject: [PATCH 6/6] fix auth logging --- webui.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webui.py b/webui.py index 103d78ec7..46e3d7156 100644 --- a/webui.py +++ b/webui.py @@ -248,7 +248,7 @@ def start_ui(): for line in file.readlines(): gradio_auth_creds += [x.strip() for x in line.split(',') if x.strip()] if len(gradio_auth_creds) > 0: - log.info(f'Authentication enabled: {gradio_auth_creds}') + log.info(f'Authentication enabled: users={len(list(gradio_auth_creds))}') global local_url # pylint: disable=global-statement stdout = io.StringIO()
TimeTime Level Facility Module