From 942371b25a4f6927d50b4d303889671b5801a9ec Mon Sep 17 00:00:00 2001 From: AI-Casanova <54461896+AI-Casanova@users.noreply.github.com> Date: Fri, 28 Jul 2023 18:00:44 -0500 Subject: [PATCH 01/17] Update lora_diffusers.py --- modules/lora_diffusers.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/lora_diffusers.py b/modules/lora_diffusers.py index e5779b3c6..537416180 100644 --- a/modules/lora_diffusers.py +++ b/modules/lora_diffusers.py @@ -10,6 +10,7 @@ lora_state = { # TODO Lora state for Diffusers def unload_diffusers_lora(): try: pipe = shared.sd_model + pipe.unload_lora_weights() lora_state['active'] = False lora_state['loaded'] = 0 pipe._remove_text_encoder_monkey_patch() # pylint: disable=W0212 @@ -24,7 +25,7 @@ def unload_diffusers_lora(): def load_diffusers_lora(name, lora, strength = 1.0): try: pipe = shared.sd_model - pipe.load_lora_weights(lora.filename, cache_dir=shared.opts.diffusers_dir, local_files_only=True) + pipe.load_lora_weights(lora.filename, cache_dir=shared.opts.diffusers_dir, local_files_only=True, lora_scale=strength) lora_state['active'] = True lora_state['loaded'] += 1 lora_state['multiplier'] = strength From fd7f51302ef62d2922e7b6e07a323d4b7376547a Mon Sep 17 00:00:00 2001 From: AI-Casanova <54461896+AI-Casanova@users.noreply.github.com> Date: Fri, 28 Jul 2023 18:01:38 -0500 Subject: [PATCH 02/17] Update processing_diffusers.py --- modules/processing_diffusers.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/processing_diffusers.py b/modules/processing_diffusers.py index 52175889c..e7c427523 100644 --- a/modules/processing_diffusers.py +++ b/modules/processing_diffusers.py @@ -152,6 +152,9 @@ def process_diffusers(p: StableDiffusionProcessing, seeds, prompts, negative_pro if shared.sd_refiner is None or not p.enable_hr: output.images = vae_decode(output.images, shared.sd_model) + if lora_state['active']: + unload_diffusers_lora() + if refiner_enabled: for i in range(len(output.images)): if shared.opts.save and not p.do_not_save_samples and shared.opts.save_images_before_refiner and hasattr(shared.sd_model, 'vae'): @@ -207,7 +210,6 @@ def process_diffusers(p: StableDiffusionProcessing, seeds, prompts, negative_pro if p.is_hr_pass: shared.log.warning('Diffusers not implemented: hires fix') - if lora_state['active']: - unload_diffusers_lora() + return results From 6e428ff0a2299d16efc4197751d7102fb065b2f3 Mon Sep 17 00:00:00 2001 From: Vladimir Mandic Date: Sun, 30 Jul 2023 17:14:34 +0200 Subject: [PATCH 03/17] update diffusers --- extensions-builtin/sd-dynamic-thresholding | 2 +- modules/lycoris | 2 +- requirements.txt | 2 +- wiki | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/extensions-builtin/sd-dynamic-thresholding b/extensions-builtin/sd-dynamic-thresholding index 27700fddf..639e40970 160000 --- a/extensions-builtin/sd-dynamic-thresholding +++ b/extensions-builtin/sd-dynamic-thresholding @@ -1 +1 @@ -Subproject commit 27700fddf866e0f0e1f13e9fb4a1dead326d43d3 +Subproject commit 639e40970f9b88c019866a6babb34f3294465d39 diff --git a/modules/lycoris b/modules/lycoris index 6dc0dbf47..3549fdef8 160000 --- a/modules/lycoris +++ b/modules/lycoris @@ -1 +1 @@ -Subproject commit 6dc0dbf477d5c71a44da25014a7b3d7146b08b52 +Subproject commit 3549fdef8f564761d68b695a08ef88b1122fdedc diff --git a/requirements.txt b/requirements.txt index daedd02c3..79d52cb80 100644 --- a/requirements.txt +++ b/requirements.txt @@ -49,7 +49,7 @@ requests==2.31.0 tqdm==4.65.0 accelerate==0.20.3 opencv-python==4.7.0.72 -diffusers==0.19.0 +diffusers==0.19.3 einops==0.4.1 gradio==3.32.0 numexpr==2.8.4 diff --git a/wiki b/wiki index fd99f38e1..457ec3ad4 160000 --- a/wiki +++ b/wiki @@ -1 +1 @@ -Subproject commit fd99f38e1b847cc651f3289cd07fae62dfbb902f +Subproject commit 457ec3ad437af300f4fb6e5a6e58d43bd465e7cf From f749a9532930bc30ed946484126e021133148e14 Mon Sep 17 00:00:00 2001 From: JetVarimax <140423365+JetVarimax@users.noreply.github.com> Date: Sun, 30 Jul 2023 16:17:42 +0100 Subject: [PATCH 04/17] Change to use ISO 8601 date format Reduces confusion when looking at dates --- CHANGELOG.md | 76 ++++++++++++++++++++++++++-------------------------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dec98b47e..a65993060 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Change Log for SD.Next -## Update for 07/26/2023 +## Update for 2023-07-26 This is a big one, new models, new diffusers, new features and updated UI... @@ -60,7 +60,7 @@ Actual changelog is: this now fully obsoletes `fallback_sampler` and `force_latent_sampler` -## Update for 07/18/2023 +## Update for 2023-07-18 While we're waiting for official SD-XL release, here's another update with some fixes and enhancements... @@ -90,7 +90,7 @@ While we're waiting for official SD-XL release, here's another update with some download using model downloader: `thu-ml/unidiffuser-v1` and set resolution to 512x512 -## Update for 07/14/2023 +## Update for 2023-07-14 Trying to unify settings for both original and diffusers backend without introducing duplicates... @@ -107,7 +107,7 @@ Trying to unify settings for both original and diffusers backend without introdu - reorganized settings -> samplers to show which section refers to which backend - added diffusers **lmsd** sampler -## Update for 07/13/2023 +## Update for 2023-07-13 Another big one, but now improvements to both **diffusers** and **original** backends as well plus ability to dynamically switch between them! @@ -136,7 +136,7 @@ Another big one, but now improvements to both **diffusers** and **original** bac big thanks to @huggingface team for great communication, support and fixing all the reported issues asap! -## Update for 07/10/2023 +## Update for 2023-07-10 Service release with some fixes and enhancements: @@ -158,7 +158,7 @@ Service release with some fixes and enhancements: - fix startup issue with incorrect config - installer should always check requirements on upgrades -## Update for 07/08/2023 +## Update for 2023-07-08 This is a massive update which has been baking in a `dev` branch for a while now @@ -179,7 +179,7 @@ Release also contains number of smaller updates: speeds up app start if you have a lot of extra networks and you want to build them manually when needed - extra network ui tweaks -## Update for 07/01/2023 +## Update for 2023-07-01 Small quality-of-life updates and bugfixes: @@ -191,7 +191,7 @@ Small quality-of-life updates and bugfixes: - folder `Show` button is present only when working on localhost, otherwise its replaced with `Copy` that places image URLs on clipboard so they can be used in other apps -## Update for 06/30/2023 +## Update for 2023-06-30 A bit bigger update this time, but contained to specific areas... @@ -213,7 +213,7 @@ A bit bigger update this time, but contained to specific areas... - **extensions sort** by trending - add requirements check for training -## Update for 06/26/2023 +## Update for 2023-06-26 - new training tab interface - redesigned preprocess, train embedding, train hypernetwork @@ -222,7 +222,7 @@ A bit bigger update this time, but contained to specific areas... - new model verify functionality - lot of ipex specific fixes/optimizations, thanks @disty0 -## Update for 06/20/2023 +## Update for 2023-06-20 This one is less relevant for standard users, but pretty major if you're running an actual server But even if not, it still includes bunch of cumulative fixes since last release - and going by number of new issues, this is probably the most stable release so far... @@ -237,7 +237,7 @@ But even if not, it still includes bunch of cumulative fixes since last release - ring buffer with api endpoint `/sdapi/v1/log` - real-time status and load endpoint `/sdapi/v1/system-info/status` -## Update for 06/14/2023 +## Update for 2023-06-14 Second stage of a jumbo merge from upstream plus few minor changes... @@ -252,7 +252,7 @@ Second stage of a jumbo merge from upstream plus few minor changes... - broken/reverted: sub-quadratic optimization changes -## Update for 06/13/2023 +## Update for 2023-06-14 Just a day later and one *bigger update*... Both some **new functionality** as well as **massive merges** from upstream @@ -270,7 +270,7 @@ Both some **new functionality** as well as **massive merges** from upstream this was a massive merge, hopefully this does not cause any regressions and still a bit more pending... -## Update for 06/12/2023 +## Update for 2023-06-12 - updated ui labels and hints to improve clarity and provide some extra info this is 1st stage of the process, more to come... @@ -291,7 +291,7 @@ Both some **new functionality** as well as **massive merges** from upstream results? who am i to judge :) -## Update for 06/05/2023 +## Update for 2023-06-05 Few new features and extra handling for broken extensions that caused my phone to go crazy with notifications over the weekend... @@ -311,7 +311,7 @@ that caused my phone to go crazy with notifications over the weekend... - some work on bfloat16 which nobody really should be using, but why not ๐Ÿ™‚ -## Update for 06/02/2023 +## Update for 2023-06-02 Some quality-of-life improvements while working on larger stuff in the background... @@ -328,7 +328,7 @@ Some quality-of-life improvements while working on larger stuff in the backgroun if you do have `xformers` selected as your desired cross-optimization method, then they will be used reason is that a lot of libaries try to blindly import xformers even if they are not selected or not functional -## Update for 05/30/2023 +## Update for 2023-05-30 Another bigger one...And more to come in the next few days... @@ -344,7 +344,7 @@ Another bigger one...And more to come in the next few days... - updated lora, swinir, scunet and ldsr code from upstream - start of merge from a1111 v1.3 -## Update for 05/26/2023 +## Update for 2023-05-26 Some quality-of-life improvements... @@ -372,7 +372,7 @@ other than that - first stage of [Diffusers](https://github.com/huggingface/diff i don't recommend anyone to try it (and dont even think reporting issues for it) but if anyone wants to contribute, take a look at [project page](https://github.com/users/vladmandic/projects/1/views/1) -## Update for 05/23/2023 +## Update for 2023-05-23 Major internal work with perhaps not that much user-facing to show for it ;) @@ -398,7 +398,7 @@ Major internal work with perhaps not that much user-facing to show for it ;) - fixes...amazing how many issues were introduced by porting a1111 v1.20 code without adding almost no new functionality next one is v1.30 (still in dev) which does bring a lot of new features -## Update for 05/17/2023 +## Update for 2023-05-17 This is a massive one due to huge number of changes, but hopefully it will go ok... @@ -419,7 +419,7 @@ but hopefully it will go ok... - port *all* upstream changes from [A1111](https://github.com/AUTOMATIC1111/stable-diffusion-webui) up to today - commit hash `89f9faa` -## Update for 05/15/2023 +## Update for 2023-05-15 - major work on **prompt parsing** this can cause some differences in results compared to what you're used to, but its all about fixes & improvements @@ -431,7 +431,7 @@ but hopefully it will go ok... - add option in settings to force different **latent sampler** instead of using primary only - add **interrupt/skip** capabilities to process images -## Update for 05/13/2023 +## Update for 2023-05-13 This is mostly about optimizations... @@ -448,7 +448,7 @@ This is mostly about optimizations... - allow per-extension updates in extension manager - option to reset configuration in settings -## Update for 05/11/2023 +## Update for 2023-05-11 - brand new **extension manager** this is pretty much a complete rewrite, so new issues are possible @@ -459,7 +459,7 @@ This is mostly about optimizations... - auto-recover & re-attempt when `--upgrade` is requested but fails - check for duplicate extensions -## Update for 05/08/2023 +## Update for 2023-05-08 Back online with few updates: @@ -470,7 +470,7 @@ Back online with few updates: - configurable order of scripts in txt2img and img2img for both, see sections in ui-> settings -> user interface -## Update for 05/04/2023 +## Update for 2023-05-04 Again, few days later... @@ -487,7 +487,7 @@ Again, few days later... - better logging this includes new `--debug` flag for more verbose logging when troubleshooting -## Update for 05/01/2023 +## Update for 2023-05-01 Been a bit quieter for last few days as changes were quite significant, but finally here we are... @@ -506,7 +506,7 @@ Been a bit quieter for last few days as changes were quite significant, but fina To take advantage of new out-of-the-box tunings, its recommended to delete your `config.json` so new defaults are applied. Its not necessary, but otherwise you may need to play with UI Settings to get the best of Intel ARC, TorchML, ROCm or Apple M1/M2. -## Update for 04/27/2023 +## Update for 2023-04-27 a bit shorter list as: @@ -527,7 +527,7 @@ what's new: - set defaults for Apple M1/M2 if you have issues, you may want to start with a fresh install so configuration can be created from scratch -## Update for 04/25/2023 +## Update for 2023-04-25 - update process image -> info - add VAE info to metadata @@ -540,7 +540,7 @@ what's new: - validate script args for always-on scripts fixes: deforum with controlnet -## Update for 04/24/2023 +## Update for 2023-04-24 - identify race condition where generate locks up while fetching preview - add pulldowns to x/y/z script @@ -552,7 +552,7 @@ what's new: - fix setup not installing `tensorflow` dependencies - update default git flags to reduce number of warnings -## Update for 04/23/2023 +## Update for 2023-04-23 - fix VAE dtype should fix most issues with NaN or black images @@ -567,7 +567,7 @@ what's new: - mark tensorflow as optional - add additional image name templates -## Update for 04/22/2023 +## Update for 2023-04-22 - autodetect which system libs should be installed this is a first pass of autoconfig for **nVidia** vs **AMD** environments @@ -579,7 +579,7 @@ what's new: *expect shorter updates for the next few days as i'll be partially ooo* -## Update for 04/20/2023 +## Update for 2023-04-20 - full CUDA tuning section in UI Settings - improve exif/pnginfo metadata parsing @@ -593,7 +593,7 @@ what's new: note: if you previously had command line optimizations such as --no-half, those are now ignored and moved to ui settings -## Update for 04/19/2023 +## Update for 2023-04-19 - fix live preview - fix model merge @@ -605,7 +605,7 @@ note: if you previously had command line optimizations such as --no-half, those - created initial merge backlog from pending prs on a1111 repo see #258 for details -## Update for 04/18/2023 +## Update for 2023-04-18 - reconnect ui to active session on browser restart this is one of most frequently asked for items, finally figured it out @@ -625,7 +625,7 @@ note: if you previously had command line optimizations such as --no-half, those - update README.md - update TODO.md -## Update for 04/17/2023 +## Update for 2023-04-17 - **themes** are now dynamic and discovered from list of available gradio themes on huggingface its quite a list of 30+ supported themes so far @@ -636,7 +636,7 @@ note: if you previously had command line optimizations such as --no-half, those - updated github integration - make model download as optional if no models found -## Update for 04/16/2023 +## Update for 2023-04-16 - support for ui themes! to to *settings* -> *user interface* -> "ui theme* includes 12 predefined themes @@ -648,7 +648,7 @@ note: if you previously had command line optimizations such as --no-half, those - install bugfixes, hopefully new installer is now ok \ i really want to focus on features and not troubleshooting installer -## Update for 04/15/2023 +## Update for 2023-04-15 - update default values - remove `ui-config.json` from repo, its not fully under user control @@ -663,7 +663,7 @@ note: if you previously had command line optimizations such as --no-half, those - fix git update issues - update github templates -## Update for 04/14/2023 +## Update for 2023-04-14 - handle duplicate extensions - redo exception handler @@ -675,7 +675,7 @@ note: if you previously had command line optimizations such as --no-half, those - pin transformers version to last known good version - fix extension loader -## Update for 04/12/2023 +## Update for 2023-04-12 This has been pending for a while, but finally uploaded some massive changes From 2300329893d6aede6d593d1235bd549a03ad5e4b Mon Sep 17 00:00:00 2001 From: Vladimir Mandic Date: Sun, 30 Jul 2023 17:17:56 +0200 Subject: [PATCH 05/17] fix lint --- modules/processing_diffusers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/processing_diffusers.py b/modules/processing_diffusers.py index 3f99a6b7a..3a3e4c939 100644 --- a/modules/processing_diffusers.py +++ b/modules/processing_diffusers.py @@ -161,7 +161,7 @@ def process_diffusers(p: StableDiffusionProcessing, seeds, prompts, negative_pro if lora_state['active']: unload_diffusers_lora() - + if refiner_enabled: for i in range(len(output.images)): #shared.cmd_opts.medvram or shared.opts.diffusers_model_cpu_offload: @@ -219,6 +219,6 @@ def process_diffusers(p: StableDiffusionProcessing, seeds, prompts, negative_pro if p.is_hr_pass: shared.log.warning('Diffusers not implemented: hires fix') - + return results From 884e4646936844df9519c04831ff91c7e246cd14 Mon Sep 17 00:00:00 2001 From: Disty0 Date: Sun, 30 Jul 2023 18:39:23 +0300 Subject: [PATCH 06/17] Move base to cpu when using refiner with offload --- modules/processing_diffusers.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/modules/processing_diffusers.py b/modules/processing_diffusers.py index 3a3e4c939..7c80909de 100644 --- a/modules/processing_diffusers.py +++ b/modules/processing_diffusers.py @@ -164,16 +164,14 @@ def process_diffusers(p: StableDiffusionProcessing, seeds, prompts, negative_pro if refiner_enabled: for i in range(len(output.images)): - #shared.cmd_opts.medvram or shared.opts.diffusers_model_cpu_offload: - #Model CPU Offload doesn't unload the base model without this. - if ((shared.opts.save and not p.do_not_save_samples and shared.opts.save_images_before_refiner) or shared.cmd_opts.medvram or shared.opts.diffusers_model_cpu_offload) and hasattr(shared.sd_model, 'vae'): + if shared.opts.save and not p.do_not_save_samples and shared.opts.save_images_before_refiner and hasattr(shared.sd_model, 'vae'): from modules.processing import create_infotext info=create_infotext(p, p.all_prompts, p.all_seeds, p.all_subseeds, [], iteration=p.iteration, position_in_batch=i) decoded = vae_decode(output.images, shared.sd_model, output_type='pil') for i in range(len(decoded)): images.save_image(decoded[i], path=p.outpath_samples, basename="", seed=seeds[i], prompt=prompts[i], extension=shared.opts.samples_format, info=info, p=p, suffix="-before-refiner") - if shared.opts.diffusers_move_base and not shared.sd_model.has_accelerate: + if (shared.opts.diffusers_move_base or shared.cmd_opts.medvram or shared.opts.diffusers_model_cpu_offload) and not (shared.cmd_opts.lowvram or shared.opts.diffusers_seq_cpu_offload): shared.log.debug('Diffusers: Moving base model to CPU') shared.sd_model.to(devices.cpu) devices.torch_gc() From 45955f4c12b9bcd82c859ae5c606acf27f28e546 Mon Sep 17 00:00:00 2001 From: Vladimir Mandic Date: Sun, 30 Jul 2023 17:40:06 +0200 Subject: [PATCH 07/17] update changelog --- CHANGELOG.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a65993060..e4749bfe9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Change Log for SD.Next +## Update for 2023-07-30 + +- Update `diffusers` +- Minor bugfixes + ## Update for 2023-07-26 This is a big one, new models, new diffusers, new features and updated UI... @@ -252,7 +257,7 @@ Second stage of a jumbo merge from upstream plus few minor changes... - broken/reverted: sub-quadratic optimization changes -## Update for 2023-06-14 +## Update for 2023-06-13 Just a day later and one *bigger update*... Both some **new functionality** as well as **massive merges** from upstream From 84456740b06490ffab39e0773ea6d1683b6f9784 Mon Sep 17 00:00:00 2001 From: Vladimir Mandic Date: Sun, 30 Jul 2023 17:48:45 +0200 Subject: [PATCH 08/17] update changelog --- CHANGELOG.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e4749bfe9..ace430af9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,8 +2,11 @@ ## Update for 2023-07-30 -- Update `diffusers` -- Minor bugfixes +- diffusers: + - update packages + - memory optimizations: Enhanced sequential CPU offloading, model CPU offload, FP16 VAE + - significant impact if running SD-XL (for example, but applies to any model) with only 8GB VRAM +- minor bugfixes ## Update for 2023-07-26 From ce1e978a25bc1b316384547392bfba592e0fba87 Mon Sep 17 00:00:00 2001 From: Paul Farnell <48354391+dotgrid@users.noreply.github.com> Date: Sun, 30 Jul 2023 23:53:13 +0100 Subject: [PATCH 09/17] Fix Kandinsky model URI --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ace430af9..afcbac43e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,7 +20,7 @@ First, **SD-XL 1.0** is released and yes, SD.Next supports it out of the box! Also fresh is new **Kandinsky 2.2** model that does look quite nice: - [Kandinsky Decoder](https://huggingface.co/kandinsky-community/kandinsky-2-2-decoder) -- [Kandinsky Prior](kandinsky-community/kandinsky-2-2-prior) +- [Kandinsky Prior](https://huggingface.co/kandinsky-community/kandinsky-2-2-prior) Actual changelog is: From 20d94af063d498ebfaeaf0501c36e61b7f34ac91 Mon Sep 17 00:00:00 2001 From: Vladimir Mandic Date: Mon, 31 Jul 2023 06:49:09 +0200 Subject: [PATCH 10/17] update lint rules --- .markdownlint.json | 2 ++ CHANGELOG.md | 5 ++++- wiki | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.markdownlint.json b/.markdownlint.json index c9179cd2f..e07c835be 100644 --- a/.markdownlint.json +++ b/.markdownlint.json @@ -1,6 +1,8 @@ { + "MD004": false, "MD012": false, "MD013": false, + "MD032": false, "MD033": false, "MD036": false, "MD041": false diff --git a/CHANGELOG.md b/CHANGELOG.md index afcbac43e..34c5aa5c5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,10 +2,13 @@ ## Update for 2023-07-30 +Smaller release, but IMO worth a post... + - diffusers: - - update packages + - sd-xl lora's are now supported! - memory optimizations: Enhanced sequential CPU offloading, model CPU offload, FP16 VAE - significant impact if running SD-XL (for example, but applies to any model) with only 8GB VRAM + - update packages - minor bugfixes ## Update for 2023-07-26 diff --git a/wiki b/wiki index 457ec3ad4..ec18e358a 160000 --- a/wiki +++ b/wiki @@ -1 +1 @@ -Subproject commit 457ec3ad437af300f4fb6e5a6e58d43bd465e7cf +Subproject commit ec18e358a4523567164170e38a90c74eb4deba0f From 8ffaea76ba2cceb4947f6b44095da7342e857ce8 Mon Sep 17 00:00:00 2001 From: Disty0 Date: Mon, 31 Jul 2023 14:39:32 +0300 Subject: [PATCH 11/17] Add Diffusers model and VAE variant loading option --- html/locale_en.json | 5 ++++- html/locale_ko.json | 4 +++- modules/sd_models.py | 9 +++++++-- modules/sd_vae.py | 9 +++++++-- modules/shared.py | 2 ++ 5 files changed, 23 insertions(+), 6 deletions(-) diff --git a/html/locale_en.json b/html/locale_en.json index 6a13e9cd4..0d2a6cc20 100644 --- a/html/locale_en.json +++ b/html/locale_en.json @@ -572,7 +572,10 @@ {"id":"","label":"Enable model CPU offload","localized":"","hint":"Transferring of entire models to the GPU, negligible impact on inference time while still providing some memory savings. Use with Enable Attention slicing for additional memory savings"}, {"id":"","label":"Enable VAE slicing","localized":"","hint":"Decodes batch latents one image at a time with limited VRAM. Small performance boost in VAE decode on multi-image batches. Use with Enable Attention slicing"}, {"id":"","label":"Enable VAE tiling","localized":"","hint":"Divide large images into overlapping tiles with limited VRAM. Might result in a minor increase in processing time. Use with Enable Attention Slicing"}, - {"id":"","label":"Enable attention slicing","localized":"","hint":"Performs attention computation in steps instead of all at once. 10% slower inference times. Greatly reduces memory usage. Best used, period"} + {"id":"","label":"Enable attention slicing","localized":"","hint":"Performs attention computation in steps instead of all at once. 10% slower inference times. Greatly reduces memory usage. Best used, period"}, + {"id":"","label":"Diffusers model loading variant","localized":"","hint":""}, + {"id":"","label":"Diffusers VAE loading variant","localized":"","hint":""} + ], "scripts": [ {"id":"","label":"Script","localized":"","hint":""}, diff --git a/html/locale_ko.json b/html/locale_ko.json index b2a2807d0..f91f7759c 100644 --- a/html/locale_ko.json +++ b/html/locale_ko.json @@ -572,7 +572,9 @@ {"id":"","label":"Enable model CPU offload","localized":"๋ชจ๋ธ CPU ์˜คํ”„๋กœ๋“œ ํ™œ์„ฑํ™”","hint":"์ „์ฒด ๋ชจ๋ธ์„ GPU๋กœ ์˜ฎ๊ธด๋‹ค. ์—ฌ์ „ํžˆ GPU ๋ฉ”๋ชจ๋ฆฌ ์‚ฌ์šฉ๋ฅ ์„ ์•ฝ๊ฐ„ ๋‚ฎ์ถฐ์ฃผ์ง€๋งŒ ์ƒ์„ฑ ์†๋„์—๋Š” ๋ฌด์‹œํ•  ์ˆ˜ ์žˆ๋Š” ์ •๋„์˜ ์˜ํ–ฅ์„ ์ค€๋‹ค. ์ถ”๊ฐ€์ ์ธ ๋ฉ”๋ชจ๋ฆฌ ์ ˆ์•ฝ์„ ์œ„ํ•ด์„œ๋Š” ์–ดํ…์…˜ ์Šฌ๋ผ์ด์‹ฑ๊ณผ ํ•จ๊ป˜ ์‚ฌ์šฉํ•œ๋‹ค."}, {"id":"","label":"Enable VAE slicing","localized":"VAE ์Šฌ๋ผ์ด์‹ฑ ํ™œ์„ฑํ™”","hint":"Decodes batch latents one image at a time with limited VRAM. ์—ฌ๋Ÿฌ ์ด๋ฏธ์ง€๋ฅผ ๋‹ค๋ฃฐ ๋•Œ VAE ํ•ด๋… ์‹œ ์ž‘์€ ์„ฑ๋Šฅ ํ–ฅ์ƒ์ด ์žˆ๋‹ค. ์–ดํ…์…˜ ์Šฌ๋ผ์ด์‹ฑ๊ณผ ํ•จ๊ป˜ ์‚ฌ์šฉํ•œ๋‹ค."}, {"id":"","label":"Enable VAE tiling","localized":"VAE ํƒ€์ผ๋ง ํ™œ์„ฑํ™”","hint":"Divide large images into overlapping tiles with limited VRAM. ์ƒ์„ฑ ์‹œ๊ฐ„์ด ์•ฝ๊ฐ„ ๋Š˜์–ด๋‚  ์ˆ˜ ์žˆ๋‹ค. ์–ดํ…์…˜ ์Šฌ๋ผ์ด์‹ฑ๊ณผ ํ•จ๊ป˜ ์‚ฌ์šฉํ•œ๋‹ค."}, - {"id":"","label":"Enable attention slicing","localized":"์–ดํ…์…˜ ์Šฌ๋ผ์ด์‹ฑ ํ™œ์„ฑํ™”","hint":"Performs attention computation in steps instead of all at once. ์ƒ์„ฑ์ด 10% ๋А๋ ค์ง€์ง€๋งŒ ๋ฉ”๋ชจ๋ฆฌ ์‚ฌ์šฉ๋ฅ ์„ ๋งค์šฐ ํฌ๊ฒŒ ์ค„์—ฌ์ค€๋‹ค."} + {"id":"","label":"Enable attention slicing","localized":"์–ดํ…์…˜ ์Šฌ๋ผ์ด์‹ฑ ํ™œ์„ฑํ™”","hint":"Performs attention computation in steps instead of all at once. ์ƒ์„ฑ์ด 10% ๋А๋ ค์ง€์ง€๋งŒ ๋ฉ”๋ชจ๋ฆฌ ์‚ฌ์šฉ๋ฅ ์„ ๋งค์šฐ ํฌ๊ฒŒ ์ค„์—ฌ์ค€๋‹ค."}, + {"id":"","label":"Diffusers model loading variant","localized":"","hint":""}, + {"id":"","label":"Diffusers VAE loading variant","localized":"","hint":""} ], "scripts": [ {"id":"","label":"Script","localized":"์Šคํฌ๋ฆฝํŠธ","hint":""}, diff --git a/modules/sd_models.py b/modules/sd_models.py index cc1f92cb4..72dacf3bf 100644 --- a/modules/sd_models.py +++ b/modules/sd_models.py @@ -548,8 +548,13 @@ def load_diffuser(checkpoint_info=None, already_loaded_state_dict=None, timer=No "load_connected_pipeline": True # always load end-to-end / connected pipelines # "use_safetensors": True, # TODO(PVP) - we can't enable this for all checkpoints just yet } - if devices.dtype == torch.float16: - diffusers_load_config['variant'] = 'fp16' + if shared.opts.diffusers_model_load_variant == 'default': + if devices.dtype == torch.float16: + diffusers_load_config['variant'] = 'fp16' + elif shared.opts.diffusers_model_load_variant == 'fp32': + pass + else: + diffusers_load_config['variant'] = shared.opts.diffusers_model_load_variant if shared.opts.data.get('sd_model_checkpoint', '') == 'model.ckpt' or shared.opts.data.get('sd_model_checkpoint', '') == '': shared.opts.data['sd_model_checkpoint'] = "runwayml/stable-diffusion-v1-5" diff --git a/modules/sd_vae.py b/modules/sd_vae.py index acab7cfda..e87af749f 100644 --- a/modules/sd_vae.py +++ b/modules/sd_vae.py @@ -181,8 +181,13 @@ def load_vae_diffusers(_model, vae_file=None, vae_source="from unknown source"): "torch_dtype": devices.dtype_vae, "use_safetensors": True, } - if devices.dtype_vae == torch.float16: - diffusers_load_config['variant'] = 'fp16' + if shared.opts.diffusers_vae_load_variant == 'default': + if devices.dtype_vae == torch.float16: + diffusers_load_config['variant'] = 'fp16' + elif shared.opts.diffusers_vae_load_variant == 'fp32': + pass + else: + diffusers_load_config['variant'] = shared.opts.diffusers_vae_load_variant if shared.opts.diffusers_vae_upcast != 'default': diffusers_load_config['force_upcast'] = True if shared.opts.diffusers_vae_upcast == 'true' else False diff --git a/modules/shared.py b/modules/shared.py index 711a77802..596058796 100644 --- a/modules/shared.py +++ b/modules/shared.py @@ -407,6 +407,8 @@ options_templates.update(options_section(('diffusers', "Diffusers Settings"), { "diffusers_vae_slicing": OptionInfo(True, "Enable VAE slicing"), "diffusers_vae_tiling": OptionInfo(False, "Enable VAE tiling"), "diffusers_attention_slicing": OptionInfo(False, "Enable attention slicing"), + "diffusers_model_load_variant": OptionInfo("default", "Diffusers model loading variant", gr.Radio, lambda: {"choices": ['default', 'fp32', 'fp16']}), + "diffusers_vae_load_variant": OptionInfo("default", "Diffusers VAE loading variant", gr.Radio, lambda: {"choices": ['default', 'fp32', 'fp16']}), # "diffusers_force_zeros": OptionInfo(False, "Force zeros for prompts when empty"), # "diffusers_aesthetics_score": OptionInfo(6.0, "Require aesthetic score", gr.Slider, {"minimum": 0, "maximum": 10, "step": 0.1}), })) From d711880aa93c2f331d9224ca10b427534a4adad3 Mon Sep 17 00:00:00 2001 From: Seunghoon Lee Date: Tue, 1 Aug 2023 01:58:04 +0900 Subject: [PATCH 12/17] New option for DirectML: memory stats provider. 1. Performance Counter. Get vram size allocated to & used by python.exe from pdh.dll. Generation can be slower than atiadlxx. Use memory less greedy then atiadlxx. Windows only. 2. atiadlxx. Get max vram size and available vram size from AMD GPU driver (atiadlxx.dll). Use memory more greedy than Performance Counter. Windows & WSL are supported. 3. None. Assume available vram size is 8GB. Use memory regardless of current vram usage. --- modules/dml/__init__.py | 41 +++++++-- modules/dml/backend.py | 46 ++++------ modules/dml/memctl/amd/__init__.py | 8 -- modules/dml/memctl/intel/__init__.py | 6 -- modules/dml/memctl/memctl.py | 8 -- modules/dml/memctl/nvidia/__init__.py | 6 -- modules/dml/memctl/unknown/__init__.py | 5 -- modules/dml/memory.py | 31 +++++++ modules/dml/memory_amd/__init__.py | 7 ++ .../amd => memory_amd}/driver/atiadlxx.py | 0 .../driver/atiadlxx_apis.py | 0 .../driver/atiadlxx_defines.py | 0 .../driver/atiadlxx_structures.py | 0 modules/dml/pdh/__init__.py | 85 +++++++++++++++++++ modules/dml/pdh/apis.py | 36 ++++++++ modules/dml/pdh/defines.py | 22 +++++ modules/dml/pdh/errors.py | 3 + modules/dml/pdh/msvcrt.py | 11 +++ modules/dml/pdh/structures.py | 41 +++++++++ modules/shared.py | 3 +- 20 files changed, 288 insertions(+), 71 deletions(-) delete mode 100644 modules/dml/memctl/amd/__init__.py delete mode 100644 modules/dml/memctl/intel/__init__.py delete mode 100644 modules/dml/memctl/memctl.py delete mode 100644 modules/dml/memctl/nvidia/__init__.py delete mode 100644 modules/dml/memctl/unknown/__init__.py create mode 100644 modules/dml/memory.py create mode 100644 modules/dml/memory_amd/__init__.py rename modules/dml/{memctl/amd => memory_amd}/driver/atiadlxx.py (100%) rename modules/dml/{memctl/amd => memory_amd}/driver/atiadlxx_apis.py (100%) rename modules/dml/{memctl/amd => memory_amd}/driver/atiadlxx_defines.py (100%) rename modules/dml/{memctl/amd => memory_amd}/driver/atiadlxx_structures.py (100%) create mode 100644 modules/dml/pdh/__init__.py create mode 100644 modules/dml/pdh/apis.py create mode 100644 modules/dml/pdh/defines.py create mode 100644 modules/dml/pdh/errors.py create mode 100644 modules/dml/pdh/msvcrt.py create mode 100644 modules/dml/pdh/structures.py diff --git a/modules/dml/__init__.py b/modules/dml/__init__.py index 3c8d8f0e1..a36af5da3 100644 --- a/modules/dml/__init__.py +++ b/modules/dml/__init__.py @@ -1,11 +1,40 @@ -import os +from platform import system import torch from typing import NamedTuple, Callable, Optional from modules.sd_hijack_utils import CondFunc +memory_providers = ["None", "atiadlxx (AMD only)"] +default_memory_provider = "None" +if system() == "Windows": + memory_providers.append("Performance Counter") + default_memory_provider = "Performance Counter" do_nothing = lambda: None +def _set_memory_provider(): + from modules.shared import opts, cmd_opts, log + + if opts.directml_memory_provider == "Performance Counter": + from .backend import pdh_mem_get_info + from .memory import MemoryProvider + torch.dml.mem_get_info = pdh_mem_get_info + if torch.dml.memory_provider is not None: + del torch.dml.memory_provider + torch.dml.memory_provider = MemoryProvider() + elif opts.directml_memory_provider == "atiadlxx (AMD only)": + device_name = torch.dml.get_device_name(cmd_opts.device_id) + if "AMD" not in device_name and "Radeon" not in device_name: + log.warning(f"Memory stats provider is changed to None because the current device is not AMDGPU. Current Device: {device_name}") + opts.directml_memory_provider = "None" + _set_memory_provider() + return + from .backend import amd_mem_get_info + torch.dml.mem_get_info = amd_mem_get_info + else: + from .backend import mem_get_info + torch.dml.mem_get_info = mem_get_info + torch.cuda.mem_get_info = torch.dml.mem_get_info + def directml_init(): from modules.dml.backend import DirectML # pylint: disable=ungrouped-imports # Alternative of torch.cuda for DirectML. @@ -29,10 +58,6 @@ def directml_init(): torch.Tensor.directml = lambda self: self.to(torch.dml.current_device()) - mem_bound = os.environ.get("DML_GPU_MEMORY_BOUND", None) - if mem_bound is not None: - torch.dml.set_gpu_memory_bound(int(mem_bound)) - def directml_do_hijack(): import modules.dml.hijack from modules.devices import device @@ -42,6 +67,8 @@ def directml_do_hijack(): lambda orig_func, *args, **kwargs: orig_func(args[0].astype('float32')), lambda *args, **kwargs: args[1].dtype == float) + _set_memory_provider() + class OverrideItem(NamedTuple): value: str condition: Optional[Callable] @@ -61,9 +88,9 @@ def directml_override_opts(): count = 0 for key in opts_override_table: - count += 1 item = opts_override_table[key] if getattr(shared.opts, key) != item.value and (item.condition is None or item.condition(shared.opts)): + count += 1 setattr(shared.opts, key, item.value) if item.message is not None: shared.log.warning(item.message) @@ -71,3 +98,5 @@ def directml_override_opts(): if count > 0: shared.log.info(f'{count} options are automatically overriden. If you want to keep them from overriding, run with --experimental argument.') + + _set_memory_provider() diff --git a/modules/dml/backend.py b/modules/dml/backend.py index feb0a07bd..ef46f288a 100644 --- a/modules/dml/backend.py +++ b/modules/dml/backend.py @@ -1,13 +1,24 @@ # pylint: disable=no-member,no-self-argument,no-method-argument -from typing import Optional +from typing import Optional, Callable import torch import torch_directml # pylint: disable=import-error import modules.dml.amp as amp -from .memctl.unknown import UnknownMemoryControl from .utils import rDevice, get_device from .device import device from .device_properties import DeviceProperties +from .memory_amd import AMDMemoryProvider +from .memory import MemoryProvider + +def amd_mem_get_info(device: Optional[rDevice]=None) -> tuple[int, int]: + return AMDMemoryProvider.mem_get_info(get_device(device).index) + +def pdh_mem_get_info(device: Optional[rDevice]=None) -> tuple[int, int]: + mem_info = DirectML.memory_provider.get_memory(get_device(device).index) + return (mem_info["total_committed"] - mem_info["dedicated_usage"], mem_info["total_committed"]) + +def mem_get_info(device: Optional[rDevice]=None) -> tuple[int, int]: + return (8589934592, 8589934592) class DirectML: amp = amp @@ -15,29 +26,10 @@ class DirectML: context_device: Optional[torch.device] = None - __gpu_memory_bound: Optional[int] = None - is_autocast_enabled = False autocast_gpu_dtype = torch.float16 - def __get_memory_control(device: torch.device): - assert device.type == 'privateuseone' - try: - device_name = torch_directml.device_name(device.index) - if 'NVIDIA' in device_name or 'GeForce' in device_name: - from .memctl.nvidia import nVidiaMemoryControl as memory_control - elif 'AMD' in device_name or 'Radeon' in device_name: - from .memctl.amd import AMDMemoryControl as memory_control - elif 'Intel' in device_name: - from .memctl.intel import IntelMemoryControl as memory_control - else: - return UnknownMemoryControl - return memory_control - except Exception: - return UnknownMemoryControl - - def set_gpu_memory_bound(bound: Optional[int]): - DirectML.__gpu_memory_bound = bound + memory_provider: Optional[MemoryProvider] = None def is_available() -> bool: return torch_directml.is_available() @@ -73,15 +65,7 @@ class DirectML: "num_alloc_retries": mem_stat_fill, } - def mem_get_info(device: Optional[rDevice]=None) -> tuple[int, int]: - device = get_device(device) - memory_control = DirectML.__get_memory_control(device) - mem_info = memory_control.mem_get_info(device.index) - if DirectML.__gpu_memory_bound is None: - return mem_info - used = mem_info[1] - mem_info[0] - available = DirectML.__gpu_memory_bound - used - return (0 if available < 0 else available, DirectML.__gpu_memory_bound) + mem_get_info: Callable = mem_get_info def memory_allocated(device: Optional[rDevice]=None) -> int: return sum(torch_directml.gpu_memory(get_device(device).index)) * (1 << 20) diff --git a/modules/dml/memctl/amd/__init__.py b/modules/dml/memctl/amd/__init__.py deleted file mode 100644 index b2de1c1bf..000000000 --- a/modules/dml/memctl/amd/__init__.py +++ /dev/null @@ -1,8 +0,0 @@ -from modules.dml.memctl.memctl import MemoryControl -from .driver.atiadlxx import ATIADLxx - -class AMDMemoryControl(MemoryControl): - driver: ATIADLxx = ATIADLxx() - def mem_get_info(index): - usage = AMDMemoryControl.driver.get_dedicated_vram_usage(index) * (1 << 20) - return (AMDMemoryControl.driver.iHyperMemorySize - usage, AMDMemoryControl.driver.iHyperMemorySize) diff --git a/modules/dml/memctl/intel/__init__.py b/modules/dml/memctl/intel/__init__.py deleted file mode 100644 index 24909c5bf..000000000 --- a/modules/dml/memctl/intel/__init__.py +++ /dev/null @@ -1,6 +0,0 @@ -from modules.dml.memctl.memctl import MemoryControl - -class IntelMemoryControl(MemoryControl): - def mem_get_info(index: int): - # DML TODO: Implement or find a general (and also lightweight) way. - return (1073741824, 1073741824) diff --git a/modules/dml/memctl/memctl.py b/modules/dml/memctl/memctl.py deleted file mode 100644 index bda31dd20..000000000 --- a/modules/dml/memctl/memctl.py +++ /dev/null @@ -1,8 +0,0 @@ -from abc import * -from typing import * - -class MemoryControl(metaclass=ABCMeta): - driver: Any = None - @abstractmethod - def mem_get_info(index: int) -> Tuple[int, int]: - pass diff --git a/modules/dml/memctl/nvidia/__init__.py b/modules/dml/memctl/nvidia/__init__.py deleted file mode 100644 index 3334b3518..000000000 --- a/modules/dml/memctl/nvidia/__init__.py +++ /dev/null @@ -1,6 +0,0 @@ -from modules.dml.memctl.memctl import MemoryControl - -class nVidiaMemoryControl(MemoryControl): - def mem_get_info(index: int): - # DML TODO: Implement or find a general (and also lightweight) way. - return (1073741824, 1073741824) diff --git a/modules/dml/memctl/unknown/__init__.py b/modules/dml/memctl/unknown/__init__.py deleted file mode 100644 index 31fda2bcd..000000000 --- a/modules/dml/memctl/unknown/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -from modules.dml.memctl.memctl import MemoryControl - -class UnknownMemoryControl(MemoryControl): - def mem_get_info(index: int): - return (1073741824, 1073741824) diff --git a/modules/dml/memory.py b/modules/dml/memory.py new file mode 100644 index 000000000..af2d8060f --- /dev/null +++ b/modules/dml/memory.py @@ -0,0 +1,31 @@ +from os import getpid +from collections import defaultdict + +from modules.dml.pdh import HQuery, HCounter, expand_wildcard_path + +class MemoryProvider: + hQuery: HQuery + hCounters: defaultdict[str, list[HCounter]] + + def __init__(self): + self.hQuery = HQuery() + self.hCounters = defaultdict(list) + + def get_memory(self, device_id: int) -> dict[str, int]: + if len(self.hCounters) == 0: + pid = getpid() + paths_dedicated = expand_wildcard_path(f"\\GPU Process Memory(pid_{pid}_*_phys_{device_id})\\Dedicated Usage") + paths_committed = expand_wildcard_path(f"\\GPU Process Memory(pid_{pid}_*_phys_{device_id})\\Total Committed") + for path in paths_dedicated: + self.hCounters["dedicated_usage"].append(self.hQuery.add_counter(path)) + for path in paths_committed: + self.hCounters["total_committed"].append(self.hQuery.add_counter(path)) + self.hQuery.collect_data() + result = defaultdict(int) + for key in self.hCounters: + for hCounter in self.hCounters[key]: + result[key] += hCounter.get_formatted_value(int) + return dict(result) + + def __del__(self): + self.hQuery.close() diff --git a/modules/dml/memory_amd/__init__.py b/modules/dml/memory_amd/__init__.py new file mode 100644 index 000000000..9928d5bc5 --- /dev/null +++ b/modules/dml/memory_amd/__init__.py @@ -0,0 +1,7 @@ +from .driver.atiadlxx import ATIADLxx + +class AMDMemoryProvider: + driver: ATIADLxx = ATIADLxx() + def mem_get_info(index): + usage = AMDMemoryProvider.driver.get_dedicated_vram_usage(index) * (1 << 20) + return (AMDMemoryProvider.driver.iHyperMemorySize - usage, AMDMemoryProvider.driver.iHyperMemorySize) diff --git a/modules/dml/memctl/amd/driver/atiadlxx.py b/modules/dml/memory_amd/driver/atiadlxx.py similarity index 100% rename from modules/dml/memctl/amd/driver/atiadlxx.py rename to modules/dml/memory_amd/driver/atiadlxx.py diff --git a/modules/dml/memctl/amd/driver/atiadlxx_apis.py b/modules/dml/memory_amd/driver/atiadlxx_apis.py similarity index 100% rename from modules/dml/memctl/amd/driver/atiadlxx_apis.py rename to modules/dml/memory_amd/driver/atiadlxx_apis.py diff --git a/modules/dml/memctl/amd/driver/atiadlxx_defines.py b/modules/dml/memory_amd/driver/atiadlxx_defines.py similarity index 100% rename from modules/dml/memctl/amd/driver/atiadlxx_defines.py rename to modules/dml/memory_amd/driver/atiadlxx_defines.py diff --git a/modules/dml/memctl/amd/driver/atiadlxx_structures.py b/modules/dml/memory_amd/driver/atiadlxx_structures.py similarity index 100% rename from modules/dml/memctl/amd/driver/atiadlxx_structures.py rename to modules/dml/memory_amd/driver/atiadlxx_structures.py diff --git a/modules/dml/pdh/__init__.py b/modules/dml/pdh/__init__.py new file mode 100644 index 000000000..0dcd466cb --- /dev/null +++ b/modules/dml/pdh/__init__.py @@ -0,0 +1,85 @@ +from ctypes import * +from ctypes.wintypes import * +from typing import NamedTuple, TypeVar + +from .apis import PdhExpandWildCardPathW, PdhOpenQueryW, PdhAddEnglishCounterW, PdhCollectQueryData, PdhGetFormattedCounterValue, PdhGetFormattedCounterArrayW, PdhCloseQuery +from .structures import PDH_HQUERY, PDH_HCOUNTER, PDH_FMT_COUNTERVALUE, PPDH_FMT_COUNTERVALUE_ITEM_W +from .defines import * +from .msvcrt import malloc +from .errors import PDHError + +class __InternalAbstraction(NamedTuple): + flag: int + attr_name: str + +_type_map = { + int: __InternalAbstraction(PDH_FMT_LARGE, "largeValue"), + float: __InternalAbstraction(PDH_FMT_DOUBLE, "doubleValue"), +} + +def expand_wildcard_path(path: str) -> list[str]: + listLength = DWORD(0) + if PdhExpandWildCardPathW(None, LPCWSTR(path), None, byref(listLength), PDH_NOEXPANDCOUNTERS) != PDH_MORE_DATA: + raise PDHError("Something went wrong.") + expanded = (WCHAR * listLength.value)() + if PdhExpandWildCardPathW(None, LPCWSTR(path), expanded, byref(listLength), PDH_NOEXPANDCOUNTERS) != PDH_OK: + raise PDHError(f"Couldn't expand wildcard path '{path}'") + result = list() + cur = str() + for chr in expanded: + if chr == '\0': + result.append(cur) + cur = str() + else: + cur += chr + result.pop() + return result + +T = TypeVar("T", *_type_map.keys()) + +class HCounter(PDH_HCOUNTER): + def get_formatted_value(self, type: T) -> T: + if type not in _type_map: + raise PDHError(f"Invalid value type: {type}") + flag, attr_name = _type_map[type] + value = PDH_FMT_COUNTERVALUE() + if PdhGetFormattedCounterValue(self, DWORD(flag | PDH_FMT_NOSCALE), None, byref(value)) != PDH_OK: + raise PDHError("Couldn't get formatted counter value.") + return getattr(value.u, attr_name) + + def get_formatted_dict(self, type: T) -> dict[str, T]: + if type not in _type_map: + raise PDHError(f"Invalid value type: {type}") + flag, attr_name = _type_map[type] + bufferSize = DWORD(0) + itemCount = DWORD(0) + if PdhGetFormattedCounterArrayW(self, DWORD(flag | PDH_FMT_NOSCALE), byref(bufferSize), byref(itemCount), None) != PDH_MORE_DATA: + raise PDHError("Something went wrong.") + itemBuffer = cast(malloc(c_size_t(bufferSize.value)), PPDH_FMT_COUNTERVALUE_ITEM_W) + if PdhGetFormattedCounterArrayW(self, DWORD(flag | PDH_FMT_NOSCALE), byref(bufferSize), byref(itemCount), itemBuffer) != PDH_OK: + raise PDHError("Couldn't get formatted counter array.") + result: dict[str, T] = dict() + for i in range(0, itemCount.value): + item = itemBuffer[i] + result[item.szName] = getattr(item.FmtValue.u, attr_name) + return result + +class HQuery(PDH_HQUERY): + def __init__(self): + super(HQuery, self).__init__() + if PdhOpenQueryW(None, None, byref(self)) != PDH_OK: + raise PDHError("Couldn't open PDH query.") + + def add_counter(self, path: str) -> HCounter: + hCounter = HCounter() + if PdhAddEnglishCounterW(self, LPCWSTR(path), None, byref(hCounter)) != PDH_OK: + raise PDHError("Couldn't add counter query.") + return hCounter + + def collect_data(self): + if PdhCollectQueryData(self) != PDH_OK: + raise PDHError("Couldn't collect query data.") + + def close(self): + if PdhCloseQuery(self) != PDH_OK: + raise PDHError("Couldn't close PDH query.") diff --git a/modules/dml/pdh/apis.py b/modules/dml/pdh/apis.py new file mode 100644 index 000000000..87c1d1204 --- /dev/null +++ b/modules/dml/pdh/apis.py @@ -0,0 +1,36 @@ +from ctypes import * +from ctypes.wintypes import * +from typing import Callable + +from .structures import * +from .defines import * + +pdh = CDLL("pdh.dll") + +PdhExpandWildCardPathW: Callable = pdh.PdhExpandWildCardPathW +PdhExpandWildCardPathW.restype = PDH_FUNCTION +PdhExpandWildCardPathW.argtypes = [LPCWSTR, LPCWSTR, PZZWSTR, LPDWORD, DWORD] + +PdhOpenQueryW: Callable = pdh.PdhOpenQueryW +PdhOpenQueryW.restype = PDH_FUNCTION +PdhOpenQueryW.argtypes = [LPCWSTR, DWORD_PTR, POINTER(PDH_HQUERY)] + +PdhAddEnglishCounterW: Callable = pdh.PdhAddEnglishCounterW +PdhAddEnglishCounterW.restype = PDH_FUNCTION +PdhAddEnglishCounterW.argtypes = [PDH_HQUERY, LPCWSTR, DWORD_PTR, POINTER(PDH_HCOUNTER)] + +PdhCollectQueryData: Callable = pdh.PdhCollectQueryData +PdhCollectQueryData.restype = PDH_FUNCTION +PdhCollectQueryData.argtypes = [PDH_HQUERY] + +PdhGetFormattedCounterValue: Callable = pdh.PdhGetFormattedCounterValue +PdhGetFormattedCounterValue.restype = PDH_FUNCTION +PdhGetFormattedCounterValue.argtypes = [PDH_HCOUNTER, DWORD, LPDWORD, PPDH_FMT_COUNTERVALUE] + +PdhGetFormattedCounterArrayW: Callable = pdh.PdhGetFormattedCounterArrayW +PdhGetFormattedCounterArrayW.restype = PDH_FUNCTION +PdhGetFormattedCounterArrayW.argtypes = [PDH_HCOUNTER, DWORD, LPDWORD, LPDWORD, PPDH_FMT_COUNTERVALUE_ITEM_W] + +PdhCloseQuery: Callable = pdh.PdhCloseQuery +PdhCloseQuery.restype = PDH_FUNCTION +PdhCloseQuery.argtypes = [PDH_HQUERY] diff --git a/modules/dml/pdh/defines.py b/modules/dml/pdh/defines.py new file mode 100644 index 000000000..a5ea1d479 --- /dev/null +++ b/modules/dml/pdh/defines.py @@ -0,0 +1,22 @@ +from ctypes import * +from ctypes.wintypes import * + +PDH_FUNCTION = c_int +PDH_OK = 0x00000000 +PDH_MORE_DATA = -2147481646#0x800007D2 + +DWORD_PTR = POINTER(DWORD) +PWSTR = POINTER(WCHAR) +PZZWSTR = POINTER(WCHAR) + +PDH_NOEXPANDCOUNTERS = 1 +PDH_NOEXPANDINSTANCES = 2 +PDH_REFRESHCOUNTERS = 4 + +PDH_FMT_LONG = 0x00000100 +PDH_FMT_DOUBLE = 0x00000200 +PDH_FMT_LARGE = 0x00000400 + +PDH_FMT_NOSCALE = 0x00001000 +PDH_FMT_1000 = 0x00002000 +PDH_FMT_NOCAP100 = 0x00008000 diff --git a/modules/dml/pdh/errors.py b/modules/dml/pdh/errors.py new file mode 100644 index 000000000..60d9ab8f7 --- /dev/null +++ b/modules/dml/pdh/errors.py @@ -0,0 +1,3 @@ +class PDHError(Exception): + def __init__(self, message: str): + super(PDHError, self).__init__(message) diff --git a/modules/dml/pdh/msvcrt.py b/modules/dml/pdh/msvcrt.py new file mode 100644 index 000000000..bc5d93031 --- /dev/null +++ b/modules/dml/pdh/msvcrt.py @@ -0,0 +1,11 @@ +from ctypes import * + +msvcrt = CDLL("msvcrt") + +malloc = msvcrt.malloc +malloc.restype = c_void_p +malloc.argtypes = [c_size_t] + +free = msvcrt.free +free.restype = None +free.argtypes = [c_void_p] diff --git a/modules/dml/pdh/structures.py b/modules/dml/pdh/structures.py new file mode 100644 index 000000000..8fb09e6cb --- /dev/null +++ b/modules/dml/pdh/structures.py @@ -0,0 +1,41 @@ +from ctypes import * +from ctypes.wintypes import * + +PDH_HQUERY = HANDLE +PDH_HCOUNTER = HANDLE + +class PDH_FMT_COUNTERVALUE_U(Union): + _fields_ = [ + ("longValue", LONG), + ("doubleValue", c_double), + ("largeValue", c_longlong), + ("AnsiStringValue", LPCSTR), + ("WideStringValue", LPCWSTR), + ] + + longValue: int + doubleValue: float + largeValue: int + AnsiStringValue: LPCSTR + WideStringValue: LPCWSTR + +class PDH_FMT_COUNTERVALUE(Structure): + _anonymous_ = ("u",) + _fields_ = [ + ("CStatus", DWORD), + ("u", PDH_FMT_COUNTERVALUE_U), + ] + + CStatus: DWORD + u: PDH_FMT_COUNTERVALUE_U +PPDH_FMT_COUNTERVALUE = POINTER(PDH_FMT_COUNTERVALUE) + +class PDH_FMT_COUNTERVALUE_ITEM_W(Structure): + _fields_ = [ + ("szName", LPWSTR), + ("FmtValue", PDH_FMT_COUNTERVALUE), + ] + + szName: str + FmtValue: PDH_FMT_COUNTERVALUE +PPDH_FMT_COUNTERVALUE_ITEM_W = POINTER(PDH_FMT_COUNTERVALUE_ITEM_W) diff --git a/modules/shared.py b/modules/shared.py index 711a77802..e7e585223 100644 --- a/modules/shared.py +++ b/modules/shared.py @@ -12,7 +12,7 @@ import requests import fasteners from modules import errors, ui_components, shared_items, cmd_args from modules.paths_internal import models_path, script_path, data_path, sd_configs_path, sd_default_config, sd_model_file, default_sd_model_file, extensions_dir, extensions_builtin_dir # pylint: disable=W0611 -from modules.dml import directml_do_hijack +from modules.dml import memory_providers, default_memory_provider, directml_do_hijack import modules.interrogate import modules.memmon import modules.styles @@ -390,6 +390,7 @@ options_templates.update(options_section(('cuda', "Compute Settings"), { "cuda_compile_verbose": OptionInfo(False, "Model compile verbose mode"), "cuda_compile_errors": OptionInfo(True, "Model compile suppress errors"), "disable_gc": OptionInfo(True, "Disable Torch memory garbage collection"), + "directml_memory_provider": OptionInfo(default_memory_provider, '[DirectML] Memory stats provider', gr.Dropdown, lambda: {"choices": memory_providers}), })) options_templates.update(options_section(('diffusers', "Diffusers Settings"), { From 80b834054b7628df81fd5a16351fd9f5e8df4a01 Mon Sep 17 00:00:00 2001 From: Disty0 Date: Tue, 1 Aug 2023 02:51:50 +0300 Subject: [PATCH 13/17] CPU offload mode check & Enable compile for IPEX --- modules/processing_diffusers.py | 1 + modules/sd_models.py | 6 ++++++ modules/shared.py | 4 ++-- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/modules/processing_diffusers.py b/modules/processing_diffusers.py index 7c80909de..8ee247f9c 100644 --- a/modules/processing_diffusers.py +++ b/modules/processing_diffusers.py @@ -211,6 +211,7 @@ def process_diffusers(p: StableDiffusionProcessing, seeds, prompts, negative_pro if shared.opts.diffusers_move_refiner and not shared.sd_refiner.has_accelerate: shared.log.debug('Diffusers: Moving refiner model to CPU') shared.sd_refiner.to(devices.cpu) + devices.torch_gc() else: results = output.images diff --git a/modules/sd_models.py b/modules/sd_models.py index 72dacf3bf..fa7002ec0 100644 --- a/modules/sd_models.py +++ b/modules/sd_models.py @@ -655,6 +655,12 @@ def load_diffuser(checkpoint_info=None, already_loaded_state_dict=None, timer=No elif "Kandinsky" in sd_model.__class__.__name__: sd_model.scheduler.name = 'DDIM' + if (shared.opts.diffusers_model_cpu_offload or shared.cmd_opts.medvram) and (shared.opts.diffusers_seq_cpu_offload or shared.cmd_opts.lowvram): + shared.log.warning(f'Diffusers {op}: Model CPU offload (--medvram) and Sequential CPU offload (--lowvram) are not compatible') + shared.log.debug(f'Diffusers {op}: disable model CPU offload and --medvram') + shared.opts.diffusers_model_cpu_offload=False + shared.cmd_opts.medvram=False + if hasattr(sd_model, "watermark"): sd_model.watermark = NoWatermark() sd_model.has_accelerate = False diff --git a/modules/shared.py b/modules/shared.py index 6c888819c..63f5549b4 100644 --- a/modules/shared.py +++ b/modules/shared.py @@ -384,8 +384,8 @@ options_templates.update(options_section(('cuda', "Compute Settings"), { "cudnn_benchmark": OptionInfo(False, "Enable full-depth cuDNN benchmark feature"), "cuda_allow_tf32": OptionInfo(True, "Allow TF32 math ops"), "cuda_allow_tf16_reduced": OptionInfo(True, "Allow TF16 reduced precision math ops"), - "cuda_compile": OptionInfo(False, "Enable model compile (experimental)"), - "cuda_compile_mode": OptionInfo("none", "Model compile mode (experimental)", gr.Radio, lambda: {"choices": ['none', 'inductor', 'reduce-overhead', 'cudagraphs', 'aot_ts_nvfuser', 'hidet', 'ipex']}), + "cuda_compile": OptionInfo(True if devices.backend == "ipex" else False, "Enable model compile (experimental)"), + "cuda_compile_mode": OptionInfo("ipex" if devices.backend == "ipex" else "none", "Model compile mode (experimental)", gr.Radio, lambda: {"choices": ['none', 'inductor', 'reduce-overhead', 'cudagraphs', 'aot_ts_nvfuser', 'hidet', 'ipex']}), "cuda_compile_fullgraph": OptionInfo(False, "Model compile fullgraph"), "cuda_compile_verbose": OptionInfo(False, "Model compile verbose mode"), "cuda_compile_errors": OptionInfo(True, "Model compile suppress errors"), From 1524365284f225e58831d15365992ae40029b85c Mon Sep 17 00:00:00 2001 From: Seunghoon Lee Date: Wed, 2 Aug 2023 02:32:11 +0900 Subject: [PATCH 14/17] Update Korean localization & DirectML bug fix. --- html/locale_ko.json | 120 ++++++++++++++++++++--------------------- modules/dml/backend.py | 2 +- 2 files changed, 61 insertions(+), 61 deletions(-) diff --git a/html/locale_ko.json b/html/locale_ko.json index f91f7759c..b49ddbf84 100644 --- a/html/locale_ko.json +++ b/html/locale_ko.json @@ -16,9 +16,9 @@ {"id":"","label":"Negative prompt","localized":"๋„ค๊ฑฐํ‹ฐ๋ธŒ ํ”„๋กฌํ”„ํŠธ","hint":"์ƒ์„ฑ๋˜์ง€ ์•Š์•˜์œผ๋ฉด ํ•˜๋Š” ์ด๋ฏธ์ง€์˜ ์„ค๋ช…"} ], "common keywords": [ - {"id":"","label":"fp16","localized":"๋ฐ˜์ •๋ฐ€๋„(16๋น„ํŠธ)","hint":"์ˆ˜๋ฅผ 16๋น„ํŠธ ๋ถ€๋™์†Œ์ˆ˜์ ์œผ๋กœ ํ‘œํ˜„"}, - {"id":"","label":"fp32","localized":"๋‹จ์ •๋ฐ€๋„(32๋น„ํŠธ)","hint":"์ˆ˜๋ฅผ 32๋น„ํŠธ ๋ถ€๋™์†Œ์ˆ˜์ ์œผ๋กœ ํ‘œํ˜„"}, - {"id":"","label":"bf16","localized":"ํ˜ผํ•ฉ ์ •๋ฐ€๋„(16๋น„ํŠธ bfloat)","hint":"์ˆ˜๋ฅผ 16๋น„ํŠธ ํ˜ผํ•ฉ ์ •๋ฐ€๋„๋กœ ํ‘œํ˜„"}, + {"id":"","label":"fp16","localized":"๋ฐ˜์ •๋ฐ€๋„(16๋น„ํŠธ)","hint":"์ˆ˜๋ฅผ 16๋น„ํŠธ ๋ถ€๋™์†Œ์ˆ˜์ ์œผ๋กœ ํ‘œํ˜„ํ•œ๋‹ค."}, + {"id":"","label":"fp32","localized":"๋‹จ์ •๋ฐ€๋„(32๋น„ํŠธ)","hint":"์ˆ˜๋ฅผ 32๋น„ํŠธ ๋ถ€๋™์†Œ์ˆ˜์ ์œผ๋กœ ํ‘œํ˜„ํ•œ๋‹ค."}, + {"id":"","label":"bf16","localized":"ํ˜ผํ•ฉ ์ •๋ฐ€๋„(16๋น„ํŠธ bfloat)","hint":"์ˆ˜๋ฅผ 16๋น„ํŠธ ํ˜ผํ•ฉ ์ •๋ฐ€๋„๋กœ ํ‘œํ˜„ํ•œ๋‹ค."}, {"id":"","label":"Run","localized":"์‹คํ–‰","hint":""}, {"id":"","label":"all","localized":"์ „์ฒด","hint":""}, {"id":"","label":"none","localized":"์—†์Œ","hint":""}, @@ -55,18 +55,18 @@ {"id":"","label":"UI card preview lazy loading","localized":"UI ์นด๋“œ ํ”„๋ฆฌ๋ทฐ๋ฅผ ๋Šฆ๊ฒŒ ๋กœ๋“œ","hint":""}, {"id":"","label":"UI card size (px)","localized":"UI ์นด๋“œ ํฌ๊ธฐ (px, ํ”ฝ์…€)","hint":""}, {"id":"","label":"UI disable variable aspect ratio","localized":"","hint":""}, - {"id":"","label":"UI image contain method","localized":"","hint":""}, + {"id":"","label":"UI image contain method","localized":"UI ์ด๋ฏธ์ง€ ํ‘œ์‹œ ๋ฐฉ์‹","hint":""}, {"id":"","label":"Do not automatically build extra network pages","localized":"์ž๋™์œผ๋กœ ์—‘์ŠคํŠธ๋ผ ๋„คํŠธ์›Œํฌ ํŽ˜์ด์ง€๋ฅผ ๋งŒ๋“ค์ง€ ์•Š์Œ","hint":""}, {"id":"","label":"Use LyCoris handler for all Lora types","localized":"๋ชจ๋“  Lora ์ข…๋ฅ˜์— LyCoris ํ•ธ๋“ค๋Ÿฌ ์‚ฌ์šฉ","hint":""}, {"id":"","label":"Disable built-in Lora handler","localized":"๋‚ด์žฅ Lora ํ•ธ๋“ค๋Ÿฌ ๋น„ํ™œ์„ฑํ™”","hint":""}, - {"id":"","label":"Use Kohya method for handling multiple Loras","localized":"","hint":""}, - {"id":"","label":"Multiplier for extra networks","localized":"์—‘์ŠคํŠธ๋ผ ๋„คํŠธ์›Œํฌ ๋ฐฐ์œจ","hint":"ํ•˜์ดํผ ๋„คํŠธ์›Œํฌ ๋˜๋Š” Lora๋ฅผ ํ”„๋กฌํ”„ํŠธ์— ์ถ”๊ฐ€ํ•  ๋•Œ ์‚ฌ์šฉํ•  ๋ฐฐ์œจ."}, + {"id":"","label":"Use Kohya method for handling multiple Loras","localized":"์—ฌ๋Ÿฌ Lora๋ฅผ ๋‹ค๋ฃฐ ๋•Œ Kohya์˜ ๋ฐฉ๋ฒ• ์‚ฌ์šฉ","hint":""}, + {"id":"","label":"Multiplier for extra networks","localized":"์—‘์ŠคํŠธ๋ผ ๋„คํŠธ์›Œํฌ ๋ฐฐ์œจ","hint":"ํ•˜์ดํผ ๋„คํŠธ์›Œํฌ ๋˜๋Š” Lora๋ฅผ ํ”„๋กฌํ”„ํŠธ์— ์ถ”๊ฐ€ํ•  ๋•Œ ์‚ฌ์šฉํ•  ๋ฐฐ์œจ์ด๋‹ค."}, {"id":"","label":"Add hypernetwork to prompt","localized":"ํ”„๋กฌํ”„ํŠธ์— ํ•˜์ดํผ ๋„คํŠธ์›Œํฌ ์ถ”๊ฐ€","hint":""}, {"id":"","label":"Add Lora to prompt","localized":"ํ”„๋กฌํ”„ํŠธ์— Lora ์ถ”๊ฐ€","hint":""}, {"id":"","label":"shuffle tags by ',' when creating prompts.","localized":"ํ”„๋กฌํ”„ํŠธ๋ฅผ ์ƒ์„ฑํ•  ๋•Œ ','์— ๋”ฐ๋ผ ํƒœ๊ทธ ์„ž๊ธฐ","hint":""}, - {"id":"","label":"extra text to add before <...> when adding extra network to prompt","localized":"","hint":""}, + {"id":"","label":"extra text to add before <...> when adding extra network to prompt","localized":"์—‘์ŠคํŠธ๋ผ ๋„คํŠธ์›Œํฌ๋ฅผ ํ”„๋กฌํ”„ํŠธ์— ์ถ”๊ฐ€ํ•  ๋•Œ <...> ์ด์ „์— ์ถ”๊ฐ€ํ•  ํ…์ŠคํŠธ","hint":""}, {"id":"","label":"When adding to prompt, refer to Lora by","localized":"","hint":""}, - {"id":"","label":"add lora hashes to infotext","localized":"","hint":""}, + {"id":"","label":"add lora hashes to infotext","localized":"infotext์— Lora ํ•ด์‹œ ์ •๋ณด ํฌํ•จ","hint":""}, {"id":"","label":"Checkpoints","localized":"์ฒดํฌํฌ์ธํŠธ","hint":""}, {"id":"","label":"Lora","localized":"","hint":""}, {"id":"","label":"LyCORIS","localized":"","hint":""}, @@ -83,9 +83,9 @@ {"id":"","label":"delete","localized":"์‚ญ์ œ","hint":"์ด๋ฏธ์ง€๋ฅผ ์‚ญ์ œํ•œ๋‹ค."}, {"id":"","label":"โž  text","localized":"โž  ํ…์ŠคํŠธ","hint":"์ด๋ฏธ์ง€๋ฅผ ์ด๋ฏธ์ง€โž ํ…์ŠคํŠธ ํƒญ์œผ๋กœ ์˜ฎ๊ธด๋‹ค."}, {"id":"","label":"โž  image","localized":"โž  ์ด๋ฏธ์ง€","hint":"์ด๋ฏธ์ง€๋ฅผ ์ด๋ฏธ์ง€โž ์ด๋ฏธ์ง€ ํƒญ์œผ๋กœ ์˜ฎ๊ธด๋‹ค."}, - {"id":"","label":"โž  inpaint","localized":"","hint":"Transfer image to inpaint interface"}, - {"id":"","label":"โž  sketch","localized":"","hint":"Transfer image to sketch interface"}, - {"id":"","label":"โž  inpaint sketch","localized":"","hint":"Transfer image to inpaint sketch interface"}, + {"id":"","label":"โž  inpaint","localized":"โž  ์ธํŽ˜์ธํŠธ","hint":"์ด๋ฏธ์ง€๋ฅผ ์ธํŽ˜์ธํŠธ ํ™”๋ฉด์œผ๋กœ ์˜ฎ๊ธด๋‹ค."}, + {"id":"","label":"โž  sketch","localized":"โž  ์Šค์ผ€์น˜","hint":"์ด๋ฏธ์ง€๋ฅผ ์Šค์ผ€์น˜ ํ™”๋ฉด์œผ๋กœ ์˜ฎ๊ธด๋‹ค."}, + {"id":"","label":"โž  inpaint sketch","localized":"โž  ์ธํŽ˜์ธํŠธ ์Šค์ผ€์น˜","hint":"์ด๋ฏธ์ง€๋ฅผ ์ธํŽ˜์ธํŠธ ์Šค์ผ€์น˜ ํƒญ์œผ๋กœ ์˜ฎ๊ธด๋‹ค."}, {"id":"","label":"โž  process","localized":"โž  ์ด๋ฏธ์ง€ ์ •๋ณด","hint":"์ด๋ฏธ์ง€๋ฅผ ์ด๋ฏธ์ง€ ์ •๋ณด ํƒญ์œผ๋กœ ์˜ฎ๊ธด๋‹ค."} ], "extensions": [ @@ -102,24 +102,24 @@ {"id":"","label":"Apply changes & restart server","localized":"๋ณ€๊ฒฝ ์‚ฌํ•ญ์„ ์ €์žฅํ•˜๊ณ  ์„œ๋ฒ„๋ฅผ ์žฌ์‹œ์ž‘","hint":"๋ชจ๋“  ๋ณ€๊ฒฝ ์‚ฌํ•ญ์„ ์ ์šฉํ•˜๊ณ  ์„œ๋ฒ„๋ฅผ ์žฌ์‹œ์ž‘ํ•œ๋‹ค."}, {"id":"","label":"install","localized":"์„ค์น˜","hint":"์ด ํ™•์žฅ์„ ์„ค์น˜ํ•œ๋‹ค."}, {"id":"","label":"uninstall","localized":"์ œ๊ฑฐ","hint":"์ด ํ™•์žฅ์„ ์ œ๊ฑฐํ•œ๋‹ค."}, - {"id":"","label":"User interface defaults","localized":"์‚ฌ์šฉ์ž ์ธํ„ฐํŽ˜์ด์Šค ๊ธฐ๋ณธ๊ฐ’","hint":"Review and set current values as default values for the user interface"}, - {"id":"","label":"View changes","localized":"๋ณ€๊ฒฝ ์‚ฌํ•ญ ํ™•์ธ","hint":"Review changes between default user interface values and and current values"}, - {"id":"","label":"Set new defaults","localized":"์ƒˆ ๊ธฐ๋ณธ๊ฐ’ ์„ค์ •","hint":"Set current values as default values for the user interface"}, + {"id":"","label":"User interface defaults","localized":"์œ ์ € ์ธํ„ฐํŽ˜์ด์Šค ๊ธฐ๋ณธ๊ฐ’","hint":"Review and set current values as default values for the user interface"}, + {"id":"","label":"View changes","localized":"๋ณ€๊ฒฝ ์‚ฌํ•ญ ํ™•์ธ","hint":"๊ธฐ๋ณธ๊ฐ’๊ณผ ํ˜„์žฌ ๊ฐ’ ๊ฐ„์˜ ๋ณ€๊ฒฝ ์‚ฌํ•ญ์„ ํ™•์ธํ•œ๋‹ค."}, + {"id":"","label":"Set new defaults","localized":"์ƒˆ ๊ธฐ๋ณธ๊ฐ’ ์„ค์ •","hint":"ํ˜„์žฌ UI ์„ค์ •์„ ๊ธฐ๋ณธ๊ฐ’์œผ๋กœ ์ €์žฅํ•œ๋‹ค."}, {"id":"","label":"Restore system defaults","localized":"์‹œ์Šคํ…œ ๊ธฐ๋ณธ๊ฐ’ ๋ณต์›","hint":"์œ ์ € ์ธํ„ฐํŽ˜์ด์Šค ๊ธฐ๋ณธ๊ฐ’์„ ๋ณต์›ํ•œ๋‹ค."} ], "txt2img tab": [ {"id":"","label":"Sampling method","localized":"์ƒ˜ํ”Œ๋ง ๋ฐฉ๋ฒ•(์ƒ˜ํ”Œ๋Ÿฌ)","hint":"์ด๋ฏธ์ง€ ์ƒ์„ฑ ์‹œ ์‚ฌ์šฉํ•  ์•Œ๊ณ ๋ฆฌ์ฆ˜์„ ์ง€์ •ํ•œ๋‹ค."}, {"id":"","label":"Sampling steps","localized":"์ƒ˜ํ”Œ๋ง ์Šคํƒญ ์ˆ˜","hint":"์ด๋ฏธ์ง€๋ฅผ ์ƒ์„ฑ ๊ณผ์ •์„ ์–ผ๋งˆ๋‚˜ ๋งŽ์ด ๋ฐ˜๋ณตํ• ์ง€ ์ง€์ •ํ•œ๋‹ค. ๋†’์„ ์ˆ˜๋ก ์ƒ์„ฑ์ด ๊ธธ์–ด์ง€๊ณ  ๋‚ฎ์„ ์ˆ˜๋ก ๊ฒฐ๊ณผ๋ฌผ ํ€„๋ฆฌํ‹ฐ๊ฐ€ ๋‚ฎ์•„์ง„๋‹ค."}, - {"id":"","label":"Restore faces","localized":"์–ผ๊ตด ๋ณต์›","hint":"Use a pre-trained model to correct the generated faces. See GFPGAN or Codeformer."}, + {"id":"","label":"Restore faces","localized":"์–ผ๊ตด ๋ณต์›","hint":"์ƒ์„ฑ๋œ ์ด๋ฏธ์ง€์˜ ์–ผ๊ตด์„ GFPGAN ๋˜๋Š” CodeFormer๋กœ ๊ณ ์นœ๋‹ค."}, {"id":"","label":"Tiling","localized":"ํƒ€์ผ๋ง","hint":"Produce an image that can be tiled"}, {"id":"","label":"Hires fix","localized":"์ƒ์„ฑ ํ›„ ์—…์Šค์ผ€์ผ(Hires fix)","hint":"์ตœ์ข… ์ด๋ฏธ์ง€๋ฅผ ์ƒ์„ฑํ•˜๊ธฐ ์ „์— ์—…์Šค์ผ€์ผํ•œ๋‹ค."}, - {"id":"","label":"Denoising strength","localized":"๋””๋…ธ์ด์ฆˆ ๊ฐ•๋„","hint":"Determines how little respect the algorithm should have for image's content. At 0, nothing will change, and at 1 you'll get an unrelated image. With values below 1.0, processing will take less steps than the Sampling Steps slider specifies"}, + {"id":"","label":"Denoising strength","localized":"๋””๋…ธ์ด์ฆˆ ๊ฐ•๋„","hint":"๊ธฐ์กด ์ด๋ฏธ์ง€์˜ ํŠน์ง•์„ ์–ผ๋งˆ๋‚˜ ๋‚จ๊ธธ์ง€ ์ •ํ•œ๋‹ค. ๋งŒ์•ฝ 0์ด๋ผ๋ฉด ์ด์ „ ์ด๋ฏธ์ง€๊ฐ€ ๊ทธ๋Œ€๋กœ ์ƒ์„ฑ๋˜๊ณ  1์ด๋ผ๋ฉด ์ด์ „ ์ด๋ฏธ์ง€์™€ ์ „ํ˜€ ๋ฌด๊ด€ํ•œ ์ด๋ฏธ์ง€๊ฐ€ ์ƒ์„ฑ๋œ๋‹ค. With values below 1.0, processing will take less steps than the Sampling Steps slider specifies"}, {"id":"","label":"Denoise start","localized":"","hint":"Override denoise strength by stating how early base model should finish and when refiner should start. Only applicable to refiner usage. If set to 0 or 1, denoising strength will be used"}, - {"id":"","label":"Hires steps","localized":"์—…์Šค์ผ€์ผ ์Šคํƒญ ์ˆ˜","hint":"Number of sampling steps for upscaled picture. If 0, uses same as for original"}, - {"id":"","label":"Upscaler","localized":"์—…์Šค์ผ€์ผ๋Ÿฌ","hint":"Which pre-tarined model to use for the upscaling process."}, - {"id":"","label":"Upscale by","localized":"์—…์Šค์ผ€์ผ ๋ฐฐ์œจ","hint":"Adjusts the size of the image by multiplying the original width and height by the selected value. Ignored if either Resize width to or Resize height to are non-zero"}, - {"id":"","label":"Resize width to","localized":"๋„ˆ๋น„","hint":"์ด ๋„ˆ๋น„๋กœ ์ด๋ฏธ์ง€๋ฅผ ๋ฆฌ์‚ฌ์ด์ฆˆํ•œ๋‹ค. If 0, width is inferred from either of two nearby sliders"}, - {"id":"","label":"Resize height to","localized":"๋†’์ด","hint":"์ด ๋†’์ด๋กœ ์ด๋ฏธ์ง€๋ฅผ ๋ฆฌ์‚ฌ์ด์ฆˆํ•œ๋‹ค. If 0, height is inferred from either of two nearby sliders"}, + {"id":"","label":"Hires steps","localized":"์—…์Šค์ผ€์ผ ์Šคํƒญ ์ˆ˜","hint":"์—…์Šค์ผ€์ผ ์‹œ ์ƒ˜ํ”Œ๋ง ์Šคํƒญ ์ˆ˜์ด๋‹ค. If 0, uses same as for original"}, + {"id":"","label":"Upscaler","localized":"์—…์Šค์ผ€์ผ๋Ÿฌ","hint":"์—…์Šค์ผ€์ผ ์‹œ ์‚ฌ์šฉํ•  ๋ชจ๋ธ์ด๋‹ค."}, + {"id":"","label":"Upscale by","localized":"์—…์Šค์ผ€์ผ ๋ฐฐ์œจ","hint":"๊ธฐ์กด ์ด๋ฏธ์ง€์˜ ๋„ˆ๋น„์™€ ๋†’์ด์— ์ด ๊ฐ’์„ ๊ณฑํ•œ๋‹ค. ๋„ˆ๋น„์™€ ๋†’์ด๊ฐ€ 0์ด ์•„๋‹ˆ๋ผ๋ฉด ๋ฌด์‹œ๋œ๋‹ค."}, + {"id":"","label":"Resize width to","localized":"๋„ˆ๋น„","hint":"์ด ๋„ˆ๋น„๋กœ ์ด๋ฏธ์ง€๋ฅผ ๋ฆฌ์‚ฌ์ด์ฆˆํ•œ๋‹ค. 0์ด๋ผ๋ฉด ๋†’์ด์—์„œ ์ถ”๋ก ํ•œ๋‹ค."}, + {"id":"","label":"Resize height to","localized":"๋†’์ด","hint":"์ด ๋†’์ด๋กœ ์ด๋ฏธ์ง€๋ฅผ ๋ฆฌ์‚ฌ์ด์ฆˆํ•œ๋‹ค. 0์ด๋ผ๋ฉด ๋„ˆ๋น„์—์„œ ์ถ”๋ก ํ•œ๋‹ค."}, {"id":"","label":"Secondary sampler","localized":"2๋‹จ๊ณ„ ์ƒ˜ํ”Œ๋Ÿฌ","hint":"Use specific sampler as fallback sampler if primary is not supported for specific operation"}, {"id":"","label":"Secondary steps","localized":"2๋‹จ๊ณ„ ์Šคํƒญ ์ˆ˜","hint":"Number of steps to use for second pass"}, {"id":"","label":"Secondary CFG Scale","localized":"2๋‹จ๊ณ„ CFG ์Šค์ผ€์ผ","hint":"CFG scale used for refiner pass"}, @@ -132,24 +132,24 @@ {"id":"","label":"Batch size","localized":"๋ฐฐ์น˜ ์‚ฌ์ด์ฆˆ","hint":"How many image to create in a single batch (์ƒ์„ฑ ์‹œ ์„ฑ๋Šฅ์— ์˜ํ–ฅ์„ ์ฃผ๊ณ  VRAM์„ ๋” ์‚ฌ์šฉํ•จ)"}, {"id":"","label":"CFG Scale","localized":"CFG ์Šค์ผ€์ผ","hint":"Classifier Free Guidance scale: how strongly the image should conform to prompt. Lower values produce more creative results, higher values make it follow the prompt more strictly; recommended values between 5-10"}, {"id":"","label":"CLIP skip","localized":"ํด๋ฆฝ(CLIP) ์Šคํ‚ต","hint":"Clip skip is a feature that allows users to control the level of specificity of the prompt, the higher the CLIP skip value, the less deep the prompt will be interpreted. CLIP Skip 1 is typical while some anime models produce better results at CLIP skip 2"}, - {"id":"","label":"Seed","localized":"์‹œ๋“œ","hint":"Random Number Generator์˜ ๊ฒฐ๊ณผ๋ฅผ ๊ฒฐ์ •ํ•˜๋Š” ๊ฐ’. ๊ฐ™์€ ์„ค์ • ๊ฐ’๊ณผ ์‹œ๋“œ๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ๊ฐ™์€ ๊ฒฐ๊ณผ๋ฅผ ์–ป๋Š”๋‹ค."}, + {"id":"","label":"Seed","localized":"์‹œ๋“œ","hint":"๋‚œ์ˆ˜ ์ƒ์„ฑ๊ธฐ์˜ ๊ฒฐ๊ณผ๋ฅผ ๊ฒฐ์ •ํ•˜๋Š” ๊ฐ’. ๊ฐ™์€ ์„ค์ • ๊ฐ’๊ณผ ์‹œ๋“œ๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ๊ฐ™์€ ๊ฒฐ๊ณผ๋ฅผ ์–ป๋Š”๋‹ค."}, {"id":"","label":"Extra","localized":"๊ธฐํƒ€","hint":"์ถ”๊ฐ€ ์„ค์ •์„ ๋ณธ๋‹ค."}, - {"id":"","label":"Variation seed","localized":"","hint":"Seed of a different picture to be mixed into the generation"}, - {"id":"","label":"Variation strength","localized":"","hint":"How strong of a variation to produce. At 0, there will be no effect. At 1, you will get the complete picture with variation seed (except for ancestral samplers, where you will just get something)"}, + {"id":"","label":"Variation seed","localized":"๋‹ค์–‘์„ฑ ์‹œ๋“œ","hint":"Seed of a different picture to be mixed into the generation"}, + {"id":"","label":"Variation strength","localized":"๋‹ค์–‘์„ฑ ๊ฐ•๋„","hint":"How strong of a variation to produce. At 0, there will be no effect. At 1, you will get the complete picture with variation seed (except for ancestral samplers, where you will just get something)"}, {"id":"","label":"Resize seed from width","localized":"","hint":"Make an attempt to produce a picture similar to what would have been produced with same seed at specified resolution"}, {"id":"","label":"Resize seed from height","localized":"","hint":"Make an attempt to produce a picture similar to what would have been produced with same seed at specified resolution"}, {"id":"","label":"Override settings","localized":"์„ค์ • ๋ฎ์–ด์“ฐ๊ธฐ","hint":"If you read in generation parameters through 'Process Image tab' and individual generation parameters should deviate from your system settings, this box will be populated with those settings to override your system configuration for this workflow"} ], "process tab": [ - {"id":"","label":"Single Image","localized":"๋‹จ์ผ ์ด๋ฏธ์ง€","hint":"Process single image"}, - {"id":"","label":"Process Batch","localized":"๋ฐฐ์น˜ ์ƒ์„ฑ","hint":"Process batch of images"}, - {"id":"","label":"Process Folder","localized":"ํด๋” ์ƒ์„ฑ","hint":"Process all images in a folder"}, - {"id":"","label":"Scale by","localized":"๋ฆฌ์‚ฌ์ด์ฆˆ(๋ฐฐ์œจ)","hint":"Use this tab to resize the source image(s) by a chosen factor"}, - {"id":"","label":"Scale to","localized":"๋ฆฌ์‚ฌ์ด์ฆˆ","hint":"Use this tab to resize the source image(s) to a chosen target size"}, + {"id":"","label":"Single Image","localized":"๋‹จ์ผ ์ด๋ฏธ์ง€","hint":"๋‹จ์ผ ์ด๋ฏธ์ง€์— ๋Œ€ํ•ด ์ž‘์—…์„ ์ˆ˜ํ–‰ํ•œ๋‹ค."}, + {"id":"","label":"Process Batch","localized":"๋ฐฐ์น˜ ์ƒ์„ฑ","hint":"์ด๋ฏธ์ง€ ๋ฐฐ์น˜๋ฅผ ์ƒ์„ฑํ•œ๋‹ค."}, + {"id":"","label":"Process Folder","localized":"ํด๋”","hint":"ํด๋” ๋‚ด ๋ชจ๋“  ์ด๋ฏธ์ง€๋ฅผ ๋Œ€์ƒ์œผ๋กœ ์ž‘์—…์„ ์ˆ˜ํ–‰ํ•œ๋‹ค."}, + {"id":"","label":"Scale by","localized":"์ด๋ฏธ์ง€ ํฌ๊ธฐ ๋ณ€๊ฒฝ(๋ฐฐ์œจ)","hint":"์ด ๋ฐฐ์œจ๋งŒํผ ์ด๋ฏธ์ง€ ํฌ๊ธฐ๋ฅผ ๋ฐ”๊พผ๋‹ค."}, + {"id":"","label":"Scale to","localized":"์ด๋ฏธ์ง€ ํฌ๊ธฐ ๋ณ€๊ฒฝ","hint":"ํŠน์ • ํฌ๊ธฐ๋กœ ์ด๋ฏธ์ง€ ํฌ๊ธฐ๋ฅผ ๋ฐ”๊พผ๋‹ค."}, {"id":"","label":"Input directory","localized":"์ž…๋ ฅ ์œ„์น˜","hint":"Folder where the images are that you want to process"}, {"id":"","label":"Output directory","localized":"์ถœ๋ ฅ ์œ„์น˜","hint":"Folder where the processed images should be saved to"}, {"id":"","label":"Show result images","localized":"๊ฒฐ๊ณผ ์ด๋ฏธ์ง€ ๋ณด๊ธฐ","hint":"Enable to show the processed images in the image pane"}, - {"id":"","label":"Resize","localized":"๋ฆฌ์‚ฌ์ด์ฆˆ ๋ฐฐ์œจ","hint":"Factor for resizing 1x mean no upscale, 4x means 4 times upscale, high values might lead to memory issues on small graphics cards"}, + {"id":"","label":"Resize","localized":"์ด๋ฏธ์ง€ ํฌ๊ธฐ ๋ณ€๊ฒฝ ๋ฐฐ์œจ","hint":"Factor for resizing 1x mean no upscale, 4x means 4 times upscale, high values might lead to memory issues on small graphics cards"}, {"id":"","label":"Crop to fit","localized":"","hint":"If the dimensions of your source image (e.g. 512x510) deviate from your target dimensions (e.g. 1024x768) this function will fit your upscaled image into your target size image. Excess will be cropped"}, {"id":"","label":"Secondary Upscaler","localized":"2๋‹จ๊ณ„ ์—…์Šค์ผ€์ผ๋Ÿฌ","hint":"Select secondary upscaler to run after initial upscaler"}, {"id":"","label":"Upscaler 2 visibility","localized":"","hint":"Strength of the secondary upscaler"}, @@ -163,8 +163,8 @@ {"id":"shutdown_submit","label":"Shutdown server","localized":"์„œ๋ฒ„ ์ข…๋ฃŒ","hint":"์„œ๋ฒ„๋ฅผ ์ข…๋ฃŒํ•œ๋‹ค."}, {"id":"settings_preview_theme","label":"Preview theme","localized":"ํ…Œ๋งˆ ๋ฏธ๋ฆฌ๋ณด๊ธฐ","hint":"ํ…Œ๋งˆ ๋ฏธ๋ฆฌ๋ณด๊ธฐ ํƒญ์„ ์—ฐ๋‹ค."}, {"id":"defaults_submit","label":"Restore defaults","localized":"๊ธฐ๋ณธ๊ฐ’ ๋ณต์›","hint":"๊ธฐ๋ณธ ์„ค์ •์„ ๋ถˆ๋Ÿฌ์˜จ๋‹ค."}, - {"id":"sett_unload_sd_model","label":"Unload checkpoint","localized":"์ฒดํฌํฌ์ธํŠธ ์–ธ๋กœ๋“œ","hint":"ํ˜„์žฌ ๋กœ๋“œ๋œ ๋ชจ๋ธ์„ ์–ธ๋กœ๋“œํ•œ๋‹ค."}, - {"id":"sett_reload_sd_model","label":"Reload checkpoint","localized":"์ฒดํฌํฌ์ธํŠธ ๋‹ค์‹œ ๋ถˆ๋Ÿฌ์˜ค๊ธฐ","hint":"ํ˜„์žฌ ๋กœ๋“œ๋œ ๋ชจ๋ธ์„ ๋‹ค์‹œ ๋ถˆ๋Ÿฌ์˜จ๋‹ค."} + {"id":"sett_unload_sd_model","label":"Unload checkpoint","localized":"์ฒดํฌํฌ์ธํŠธ ์–ธ๋กœ๋“œ","hint":"ํ˜„์žฌ ๋ชจ๋ธ์„ ๋ฉ”๋ชจ๋ฆฌ์—์„œ ํ•ด์ œํ•œ๋‹ค."}, + {"id":"sett_reload_sd_model","label":"Reload checkpoint","localized":"์ฒดํฌํฌ์ธํŠธ ๋‹ค์‹œ ๋ถˆ๋Ÿฌ์˜ค๊ธฐ","hint":"ํ˜„์žฌ ๋ชจ๋ธ์„ ๋‹ค์‹œ ๋ถˆ๋Ÿฌ์˜จ๋‹ค."} ], "settings sections": [ {"id":"","label":"Stable Diffusion","localized":"","hint":""}, @@ -189,11 +189,11 @@ ], "img2img tabs": [ {"id":"","label":"Image","localized":"์ด๋ฏธ์ง€","hint":""}, - {"id":"","label":"Sketch","localized":"","hint":""}, - {"id":"","label":"Inpaint","localized":"","hint":""}, - {"id":"","label":"Inpaint sketch","localized":"","hint":""}, - {"id":"","label":"Inpaint upload","localized":"","hint":""}, - {"id":"","label":"Batch","localized":"","hint":""} + {"id":"","label":"Sketch","localized":"์Šค์ผ€์น˜","hint":""}, + {"id":"","label":"Inpaint","localized":"์ธํŽ˜์ธํŠธ","hint":""}, + {"id":"","label":"Inpaint sketch","localized":"์ธํŽ˜์ธํŠธ ์Šค์ผ€์น˜","hint":""}, + {"id":"","label":"Inpaint upload","localized":"์ธํŽ˜์ธํŠธ ์—…๋กœ๋“œ","hint":""}, + {"id":"","label":"Batch","localized":"๋ฐฐ์น˜","hint":""} ], "img2img tab": [ {"id":"","label":"Inpaint batch input directory","localized":"","hint":""}, @@ -259,7 +259,7 @@ {"id":"","label":"Name","localized":"์ด๋ฆ„","hint":""}, {"id":"","label":"Initialization text","localized":"","hint":"If the number of tokens is more than the number of vectors, some may be skipped.\nLeave the textbox empty to start with zeroed out vectors"}, {"id":"","label":"Number of vectors per token","localized":"","hint":""}, - {"id":"","label":"Overwrite Old Embedding","localized":"","hint":""}, + {"id":"","label":"Overwrite Old Embedding","localized":"๊ธฐ์กด ์ž„๋ฒ ๋”ฉ ๋ฎ์–ด์“ฐ๊ธฐ","hint":""}, {"id":"","label":"Enter hypernetwork layer structure","localized":"","hint":""}, {"id":"","label":"Select activation function of hypernetwork","localized":"","hint":"Recommended : Swish / Linear(none)"}, {"id":"","label":"Select Layer weights initialization","localized":"","hint":"Recommended: Kaiming for relu-like, Xavier for sigmoid-like, Normal otherwise"}, @@ -342,8 +342,8 @@ {"id":"","label":"InvokeAI's","localized":"","hint":""}, {"id":"","label":"Sub-quadratic","localized":"","hint":""}, {"id":"","label":"Split attention","localized":"","hint":""}, - {"id":"","label":"xFormers enable flash Attention","localized":"","hint":""}, - {"id":"","label":"SDP disable memory attention","localized":"","hint":""}, + {"id":"","label":"xFormers enable flash Attention","localized":"xFormers Flash Attention ํ™œ์„ฑํ™”","hint":""}, + {"id":"","label":"SDP disable memory attention","localized":"SDP Memory Attention ๋น„ํ™œ์„ฑํ™”","hint":""}, {"id":"","label":"Sub-quadratic cross-attention query chunk size","localized":"Sub-quadratic ํฌ๋กœ์Šค ์–ดํ…์…˜ ์ฟผ๋ฆฌ ์ฒญํฌ ํฌ๊ธฐ","hint":""}, {"id":"","label":"Sub-quadratic cross-attention kv chunk size","localized":"Sub-quadratic ํฌ๋กœ์Šค ์–ดํ…์…˜ kv ์ฒญํฌ ํฌ๊ธฐ","hint":""}, {"id":"","label":"Sub-quadratic cross-attention chunking threshold","localized":"Sub-quadratic ํฌ๋กœ์Šค ์–ดํ…์…˜ ์ฒญํฌ ๋ถ„ํ•  ์ž„๊ณ„๊ฐ’","hint":""}, @@ -363,16 +363,16 @@ {"id":"","label":"FP32","localized":"","hint":""}, {"id":"","label":"FP16","localized":"","hint":""}, {"id":"","label":"BF16","localized":"","hint":""}, - {"id":"","label":"Use full precision for model (--no-half)","localized":"๋ชจ๋ธ์— ๋‹จ์ •๋ฐ€๋„ ์‚ฌ์šฉ (--no-half)","hint":"Uses FP32 for the model. May produce better results while using more VRAM and slower generation"}, - {"id":"","label":"Use full precision for VAE (--no-half-vae)","localized":"VAE์— ๋‹จ์ •๋ฐ€๋„ ์‚ฌ์šฉ (--no-half-vae)","hint":"Uses FP32 for the VAE. May produce better results while using more VRAM and slower generation"}, - {"id":"","label":"Enable upcast sampling","localized":"","hint":"Usually produces similar results to --no-half with better performance while using less memory"}, - {"id":"","label":"Enable upcast cross attention layer","localized":"","hint":""}, - {"id":"","label":"Disable NaN check in produced images/latent spaces","localized":"","hint":""}, - {"id":"","label":"Attempt VAE roll back when produced NaN values (experimental)","localized":"","hint":"Requires Torch 2.1 and NaN check enabled"}, - {"id":"","label":"Use channels last as torch memory format","localized":"","hint":""}, - {"id":"","label":"Enable full-depth cuDNN benchmark feature","localized":"","hint":""}, - {"id":"","label":"Allow TF32 math ops","localized":"TF32 ๋‹จ์ •๋ฐ€๋„ ์—ฐ์‚ฐ ํ—ˆ์šฉ","hint":""}, - {"id":"","label":"Allow TF16 reduced precision math ops","localized":"TF16 ๋ฐ˜์ •๋ฐ€๋„ ์—ฐ์‚ฐ ํ—ˆ์šฉ","hint":""}, + {"id":"","label":"Use full precision for model (--no-half)","localized":"๋ชจ๋ธ์— ๋‹จ์ •๋ฐ€๋„ ์‚ฌ์šฉ (--no-half)","hint":"๋ชจ๋ธ์„ ๋‹จ์ •๋ฐ€๋„ ๋ถ€๋™์†Œ์ˆ˜์ (FP32)์œผ๋กœ ๋ถˆ๋Ÿฌ์˜จ๋‹ค. VRAM์„ ๋งŽ์ด ์‚ฌ์šฉํ•˜๊ณ  ์ƒ์„ฑ ์†๋„๊ฐ€ ๋А๋ ค์ง€์ง€๋งŒ ๋” ์ข‹์€ ๊ฒฐ๊ณผ๋ฌผ์„ ์–ป์„ ์ˆ˜๋„ ์žˆ๋‹ค."}, + {"id":"","label":"Use full precision for VAE (--no-half-vae)","localized":"VAE์— ๋‹จ์ •๋ฐ€๋„ ์‚ฌ์šฉ (--no-half-vae)","hint":"VAE๋ฅผ ๋‹จ์ •๋ฐ€๋„ ๋ถ€๋™์†Œ์ˆ˜์ (FP32)์œผ๋กœ ๋ถˆ๋Ÿฌ์˜จ๋‹ค. VRAM์„ ๋งŽ์ด ์‚ฌ์šฉํ•˜๊ณ  ์ƒ์„ฑ ์†๋„๊ฐ€ ๋А๋ ค์ง€์ง€๋งŒ ๋” ์ข‹์€ ๊ฒฐ๊ณผ๋ฌผ์„ ์–ป์„ ์ˆ˜๋„ ์žˆ๋‹ค."}, + {"id":"","label":"Enable upcast sampling","localized":"Upcast sampling ํ™œ์„ฑํ™”","hint":"๋ฉ”๋ชจ๋ฆฌ๋ฅผ ๋œ ์‚ฌ์šฉํ•˜๊ณ  ์ข‹์€ ์„ฑ๋Šฅ์„ ๋‚ด๋ฉด์„œ๋„ --no-half๋ฅผ ์‚ฌ์šฉํ•  ๋•Œ์™€ ๋น„์Šทํ•œ ๊ฒฐ๊ณผ๋ฌผ์„ ์–ป์„ ์ˆ˜ ์žˆ๋‹ค."}, + {"id":"","label":"Enable upcast cross attention layer","localized":"Upcast cross attention layer ํ™œ์„ฑํ™”","hint":""}, + {"id":"","label":"Disable NaN check in produced images/latent spaces","localized":"์ƒ์„ฑ๋œ ์ด๋ฏธ์ง€์™€ ์ž ์žฌ ๊ณต๊ฐ„(latent space)์— ๋Œ€ํ•ด NaN ๊ฒ€์‚ฌ๋ฅผ ํ•˜์ง€ ์•Š์Œ","hint":""}, + {"id":"","label":"Attempt VAE roll back when produced NaN values (experimental)","localized":"NaN ๊ฐ’์ด ๋ฐœ๊ฒฌ๋˜์—ˆ์„ ๋•Œ VAE ๋กค๋ฐฑ ์‹œ๋„ (์‹คํ—˜์ )","hint":"Torch 2.1์„ ์‚ฌ์šฉ ์ค‘์ด๊ณ  NaN ๊ฒ€์‚ฌ๊ฐ€ ํ™œ์„ฑํ™”๋˜์–ด ์žˆ์–ด์•ผ ํ•œ๋‹ค."}, + {"id":"","label":"Use channels last as torch memory format","localized":"Channels last ๋ฉ”๋ชจ๋ฆฌ ํ˜•์‹ ์‚ฌ์šฉ","hint":""}, + {"id":"","label":"Enable full-depth cuDNN benchmark feature","localized":"Full-depth cuDNN benchmark ๊ธฐ๋Šฅ ํ™œ์„ฑํ™”","hint":""}, + {"id":"","label":"Allow TF32 math ops","localized":"TF32 ์—ฐ์‚ฐ ํ—ˆ์šฉ","hint":""}, + {"id":"","label":"Allow TF16 reduced precision math ops","localized":"TF16 ์—ฐ์‚ฐ ํ—ˆ์šฉ","hint":""}, {"id":"","label":"Enable model compile (experimental)","localized":"๋ชจ๋ธ ์ปดํŒŒ์ผ ํ™œ์„ฑํ™” (์‹คํ—˜์ )","hint":""}, {"id":"","label":"inductor","localized":"","hint":""}, {"id":"","label":"cudagraphs","localized":"","hint":""}, @@ -381,7 +381,7 @@ {"id":"","label":"ipex","localized":"","hint":""}, {"id":"","label":"Model compile verbose mode","localized":"","hint":""}, {"id":"","label":"Model compile suppress errors","localized":"๋ชจ๋ธ ์ปดํŒŒ์ผ ์‹œ ์˜ค๋ฅ˜ ์–ต์ œ","hint":""}, - {"id":"","label":"Disable Torch memory garbage collection","localized":"Torch ๋ฉ”๋ชจ๋ฆฌ ์ •๋ฆฌ ๋น„ํ™œ์„ฑํ™”","hint":"Disable Torch memory garbage collection on each generation. CG will still run before & after model load as well when low GPU memory threshold is reached."}, + {"id":"","label":"Disable Torch memory garbage collection","localized":"Torch ๋ฉ”๋ชจ๋ฆฌ ์ •๋ฆฌ ๋น„ํ™œ์„ฑํ™”","hint":"์ด๋ฏธ์ง€ ์ƒ์„ฑ ์‹œ ๋ฉ”๋ชจ๋ฆฌ ์ •๋ฆฌ๋ฅผ ํ•˜์ง€ ์•Š๋Š”๋‹ค. CG will still run before & after model load as well when low GPU memory threshold is reached."}, {"id":"","label":"Directory for temporary images; leave empty for default","localized":"์ž„์‹œ ์ด๋ฏธ์ง€ ์ €์žฅ ์œ„์น˜ (๋น„์›Œ ๋†“์œผ๋ฉด ๊ธฐ๋ณธ๊ฐ’)","hint":""}, {"id":"","label":"Cleanup non-default temporary directory when starting webui","localized":"์ž„์‹œ ์œ„์น˜๊ฐ€ ๊ธฐ๋ณธ๊ฐ’์ด ์•„๋‹Œ ๊ฒฝ์šฐ WebUI ์‹œ์ž‘ ์‹œ ๋น„์šฐ๊ธฐ","hint":""}, {"id":"","label":"Path to directory with stable diffusion checkpoints","localized":"์ฒดํฌํฌ์ธํŠธ ์œ„์น˜","hint":""}, @@ -402,8 +402,8 @@ {"id":"","label":"Path to directory with LyCORIS network(s)","localized":"LyCORIS ์œ„์น˜","hint":""}, {"id":"","label":"Path to user-defined styles file","localized":"ํ”„๋กฌํ”„ํŠธ ์Šคํƒ€์ผ ์œ„์น˜","hint":""}, {"id":"","label":"Always save all generated images","localized":"ํ•ญ์ƒ ์ƒ์„ฑ๋œ ๋ชจ๋“  ์ด๋ฏธ์ง€ ์ €์žฅ","hint":""}, - {"id":"","label":"File format for generated images","localized":"์ƒ์„ฑ๋œ ์ด๋ฏธ์ง€์˜ ํŒŒ์ผ ํฌ๋งท","hint":"Select file format for images"}, - {"id":"","label":"Include metadata in saved images","localized":"์ €์žฅ๋œ ์ด๋ฏธ์ง€์— ๋ฉ”ํƒ€๋ฐ์ดํ„ฐ ํฌํ•จ","hint":"Save image create parameters as metadata tags inside image file"}, + {"id":"","label":"File format for generated images","localized":"์ƒ์„ฑ๋œ ์ด๋ฏธ์ง€์˜ ํŒŒ์ผ ํ˜•์‹","hint":"์ด๋ฏธ์ง€ ํŒŒ์ผ ํ˜•์‹์„ ์„ ํƒํ•œ๋‹ค."}, + {"id":"","label":"Include metadata in saved images","localized":"์ €์žฅ๋œ ์ด๋ฏธ์ง€์— ๋ฉ”ํƒ€๋ฐ์ดํ„ฐ ํฌํ•จ","hint":"์ด๋ฏธ์ง€ ํŒŒ์ผ์— ์ด๋ฏธ์ง€ ์ƒ์„ฑ ํŒŒ๋ผ๋ฏธํ„ฐ๋ฅผ ๋ฉ”ํƒ€๋ฐ์ดํ„ฐ๋กœ ์ €์žฅํ•œ๋‹ค."}, {"id":"","label":"Images filename pattern","localized":"์ด๋ฏธ์ง€ ํŒŒ์ผ๋ช… ํŒจํ„ด","hint":"Use following tags to define how filenames for images are chosen:
seq, uuid
date, datetime, job_timestamp
generation_number, batch_number
model, model_shortname
model_hash, model_name
sampler, seed, steps, cfg
clip_skip, denoising
hasprompt, prompt, styles
prompt_hash, prompt_no_styles
prompt_spaces, prompt_words
height, width, image_hash
"}, {"id":"","label":"Add number to filename when saving","localized":"์ €์žฅ ์‹œ ํŒŒ์ผ๋ช…์— ์ˆซ์ž ์ถ”๊ฐ€","hint":""}, {"id":"","label":"Always save all generated image grids","localized":"ํ•ญ์ƒ ์ƒ์„ฑ๋œ ๋ชจ๋“  ๊ทธ๋ฆฌ๋“œ ์ด๋ฏธ์ง€ ์ €์žฅ","hint":""}, @@ -457,8 +457,8 @@ {"id":"","label":"Send seed when sending prompt or image to other interface","localized":"","hint":""}, {"id":"","label":"Send size when sending prompt or image to another interface","localized":"","hint":""}, {"id":"","label":"Font for image grids that have text","localized":"","hint":""}, - {"id":"","label":"Ctrl+up/down precision when editing (attention:1.1)","localized":"","hint":""}, - {"id":"","label":"Ctrl+up/down precision when editing ","localized":"","hint":""}, + {"id":"","label":"Ctrl+up/down precision when editing (attention:1.1)","localized":"(attention:1.1) ์ˆ˜์ • ์‹œ ์ปจํŠธ๋กค+์ƒ/ํ•˜ ์กฐ์ ˆ ์ •๋ฐ€๋„","hint":""}, + {"id":"","label":"Ctrl+up/down precision when editing ","localized":" ์ˆ˜์ • ์‹œ ์ปจํŠธ๋กค+์ƒ/ํ•˜ ์กฐ์ ˆ ์ •๋ฐ€๋„","hint":""}, {"id":"","label":"Ctrl+up/down word delimiters","localized":"","hint":""}, {"id":"","label":"Quicksettings list","localized":"๋น ๋ฅธ ์„ค์ • ๋ชฉ๋ก","hint":"List of setting names, separated by commas, for settings that should go to the quick access bar at the top instead the setting tab"}, {"id":"","label":"Hidden UI tabs","localized":"์ˆจ๊ธด UI ํƒญ","hint":""}, @@ -517,10 +517,10 @@ {"id":"","label":"logSNR","localized":"","hint":""}, {"id":"","label":"UniPC order (must be < sampling steps)","localized":"","hint":""}, {"id":"","label":"UniPC lower order final","localized":"","hint":""}, - {"id":"","label":"Enable addtional postprocessing operations","localized":"","hint":""}, - {"id":"","label":"Postprocessing operation order","localized":"","hint":""}, + {"id":"","label":"Enable addtional postprocessing operations","localized":"์ถ”๊ฐ€ ํ›„์ฒ˜๋ฆฌ ์ž‘์—…","hint":""}, + {"id":"","label":"Postprocessing operation order","localized":"ํ›„์ฒ˜๋ฆฌ ์ž‘์—… ์ˆœ์„œ","hint":""}, {"id":"","label":"Maximum number of images in upscaling cache","localized":"","hint":""}, - {"id":"","label":"Move VAE and CLIP to RAM when training if possible","localized":"","hint":""}, + {"id":"","label":"Move VAE and CLIP to RAM when training if possible","localized":"๊ฐ€๋Šฅํ•˜๋‹ค๋ฉด ํ•™์Šต ์‹œ VAE์™€ CLIP ๋ชจ๋ธ์„ ๋žจ์œผ๋กœ ์ด๋™","hint":""}, {"id":"","label":"Pin training dataset to memory","localized":"","hint":""}, {"id":"","label":"Save resumable optimizer state when training","localized":"","hint":""}, {"id":"","label":"Save training settings to a text file on training start","localized":"","hint":""}, @@ -565,9 +565,9 @@ {"id":"","label":"Select diffuser pipeline when loading from safetensors","localized":"safetensors ํŒŒ์ผ์—์„œ ๋กœ๋“œํ•  ๋•Œ ์‚ฌ์šฉํ•  ํŒŒ์ดํ”„๋ผ์ธ ์„ ํƒ","hint":""}, {"id":"","label":"Move base model to CPU when using refiner","localized":"๋ฆฌํŒŒ์ด๋„ˆ๋ฅผ ์‚ฌ์šฉ ์ค‘์ผ ๋•Œ base ๋ชจ๋ธ์„ CPU๋กœ ์ด๋™","hint":""}, {"id":"","label":"Move refiner model to CPU when not in use","localized":"์‚ฌ์šฉ ์ค‘์ด์ง€ ์•Š์„ ๋•Œ ๋ฆฌํŒŒ์ด๋„ˆ ๋ชจ๋ธ์„ CPU๋กœ ์ด๋™","hint":""}, - {"id":"","label":"Move UNet to CPU while VAE decoding","localized":"","hint":""}, + {"id":"","label":"Move UNet to CPU while VAE decoding","localized":"VAE ๋””์ฝ”๋”ฉ ์‹œ UNet์„ CPU๋กœ ์ด๋™","hint":""}, {"id":"","label":"Use model EMA weights when possible","localized":"๊ฐ€๋Šฅํ•˜๋‹ค๋ฉด ๋ชจ๋ธ์˜ EMA ๊ฐ€์ค‘์น˜ ์‚ฌ์šฉ","hint":""}, - {"id":"","label":"Generator device","localized":"Generator ๋””๋ฐ”์ด์Šค","hint":""}, + {"id":"","label":"Generator device","localized":"๋‚œ์ˆ˜ ์ƒ์„ฑ ์žฅ์น˜","hint":""}, {"id":"","label":"Enable sequential CPU offload","localized":"์ˆœ์ฐจ CPU ์˜คํ”„๋กœ๋“œ ํ™œ์„ฑํ™”","hint":"๊ฐ€์ค‘์น˜๋ฅผ CPU๋กœ ์˜ฎ๊ฒจ GPU ๋ฉ”๋ชจ๋ฆฌ ์‚ฌ์šฉ๋ฅ ์„ ๋‚ฎ์ถ˜๋‹ค. ์†๋„๊ฐ€ ์•ฝ 10% ๋А๋ ค์ง„๋‹ค. Use with ์–ดํ…์…˜ ์Šฌ๋ผ์ด์‹ฑ ํ™œ์„ฑํ™” for minimal memory consumption"}, {"id":"","label":"Enable model CPU offload","localized":"๋ชจ๋ธ CPU ์˜คํ”„๋กœ๋“œ ํ™œ์„ฑํ™”","hint":"์ „์ฒด ๋ชจ๋ธ์„ GPU๋กœ ์˜ฎ๊ธด๋‹ค. ์—ฌ์ „ํžˆ GPU ๋ฉ”๋ชจ๋ฆฌ ์‚ฌ์šฉ๋ฅ ์„ ์•ฝ๊ฐ„ ๋‚ฎ์ถฐ์ฃผ์ง€๋งŒ ์ƒ์„ฑ ์†๋„์—๋Š” ๋ฌด์‹œํ•  ์ˆ˜ ์žˆ๋Š” ์ •๋„์˜ ์˜ํ–ฅ์„ ์ค€๋‹ค. ์ถ”๊ฐ€์ ์ธ ๋ฉ”๋ชจ๋ฆฌ ์ ˆ์•ฝ์„ ์œ„ํ•ด์„œ๋Š” ์–ดํ…์…˜ ์Šฌ๋ผ์ด์‹ฑ๊ณผ ํ•จ๊ป˜ ์‚ฌ์šฉํ•œ๋‹ค."}, {"id":"","label":"Enable VAE slicing","localized":"VAE ์Šฌ๋ผ์ด์‹ฑ ํ™œ์„ฑํ™”","hint":"Decodes batch latents one image at a time with limited VRAM. ์—ฌ๋Ÿฌ ์ด๋ฏธ์ง€๋ฅผ ๋‹ค๋ฃฐ ๋•Œ VAE ํ•ด๋… ์‹œ ์ž‘์€ ์„ฑ๋Šฅ ํ–ฅ์ƒ์ด ์žˆ๋‹ค. ์–ดํ…์…˜ ์Šฌ๋ผ์ด์‹ฑ๊ณผ ํ•จ๊ป˜ ์‚ฌ์šฉํ•œ๋‹ค."}, diff --git a/modules/dml/backend.py b/modules/dml/backend.py index ef46f288a..90b2d0528 100644 --- a/modules/dml/backend.py +++ b/modules/dml/backend.py @@ -7,10 +7,10 @@ import modules.dml.amp as amp from .utils import rDevice, get_device from .device import device from .device_properties import DeviceProperties -from .memory_amd import AMDMemoryProvider from .memory import MemoryProvider def amd_mem_get_info(device: Optional[rDevice]=None) -> tuple[int, int]: + from .memory_amd import AMDMemoryProvider return AMDMemoryProvider.mem_get_info(get_device(device).index) def pdh_mem_get_info(device: Optional[rDevice]=None) -> tuple[int, int]: From 2cf40140400ff7ccf751a79b33aa60b6e1b37f1d Mon Sep 17 00:00:00 2001 From: Vladimir Mandic Date: Mon, 31 Jul 2023 11:36:51 +0200 Subject: [PATCH 15/17] refresh --- extensions-builtin/sd-webui-agent-scheduler | 2 +- .../stable-diffusion-webui-images-browser | 2 +- modules/ui_models.py | 14 ++++++++++++-- wiki | 2 +- 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/extensions-builtin/sd-webui-agent-scheduler b/extensions-builtin/sd-webui-agent-scheduler index 1bb04d1fb..1a5be3bf3 160000 --- a/extensions-builtin/sd-webui-agent-scheduler +++ b/extensions-builtin/sd-webui-agent-scheduler @@ -1 +1 @@ -Subproject commit 1bb04d1fbe00201cc28638fef09c25bea002b1e2 +Subproject commit 1a5be3bf3ae9b829681fcbe4614a1dc43a06d57e diff --git a/extensions-builtin/stable-diffusion-webui-images-browser b/extensions-builtin/stable-diffusion-webui-images-browser index b984cdd16..a3aeb93fd 160000 --- a/extensions-builtin/stable-diffusion-webui-images-browser +++ b/extensions-builtin/stable-diffusion-webui-images-browser @@ -1 +1 @@ -Subproject commit b984cdd1692f46006333ab92ef463cc35879f455 +Subproject commit a3aeb93fd7387cfe58aabf431b2dbbd1796bffed diff --git a/modules/ui_models.py b/modules/ui_models.py index d1afb8183..607dd069c 100644 --- a/modules/ui_models.py +++ b/modules/ui_models.py @@ -141,12 +141,22 @@ def create_ui(): model_checkhash_btn = gr.Button(value="Calculate hash for all models (may take a long time)", variant='primary') model_checkhash_btn.click(fn=sd_models.update_model_hashes, inputs=[], outputs=[models_outcome]) with gr.Row(): - model_table = gr.DataFrame(model_data, label = 'Model data', show_label = True, interactive = False, wrap = True, overflow_row_behaviour = 'paginate', max_rows = 10, headers = model_headers) + model_table = gr.DataFrame( + data = model_data, + headers = model_headers, + label = 'Model data', + show_label = True, + interactive = False, + wrap = True, + overflow_row_behaviour = 'paginate', + max_rows = 50, + ) def list_models(): total_size = 0 + model_data.clear() + txt = '' for m in sd_models.checkpoints_list.values(): - txt = '' try: stat = os.stat(m.filename) m_name = m.name.replace('.ckpt', '').replace('.safetensors', '') diff --git a/wiki b/wiki index ec18e358a..f76cc3a9a 160000 --- a/wiki +++ b/wiki @@ -1 +1 @@ -Subproject commit ec18e358a4523567164170e38a90c74eb4deba0f +Subproject commit f76cc3a9ac124882f58f35ba3dfe930744109456 From 246989129f9583396dd9fe5e357ba6f46734a6d1 Mon Sep 17 00:00:00 2001 From: Vladimir Mandic Date: Wed, 2 Aug 2023 08:27:16 +0200 Subject: [PATCH 16/17] ui settings logging --- modules/ui.py | 20 ++++++++++++-------- modules/ui_models.py | 2 +- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/modules/ui.py b/modules/ui.py index 179c68a26..7ca1261ca 100644 --- a/modules/ui.py +++ b/modules/ui.py @@ -32,6 +32,7 @@ import modules.sd_samplers modules.errors.install() mimetypes.init() mimetypes.add_type('application/javascript', '.js') +log = modules.shared.log if not cmd_opts.share and not cmd_opts.listen: # fix gradio phoning home @@ -126,7 +127,7 @@ def process_interrogate(interrogation_function, mode, ii_input_files, ii_input_d images = [f.name for f in ii_input_files] else: if not os.path.isdir(ii_input_dir): - modules.shared.log.error(f"Input directory not found: {ii_input_dir}") + log.error(f"Input directory not found: {ii_input_dir}") return images = modules.shared.listfiles(ii_input_dir) if ii_output_dir != "": @@ -195,7 +196,7 @@ def connect_reuse_seed(seed: gr.Number, reuse_seed: gr.Button, generation_info: res = all_seeds[index if 0 <= index < len(all_seeds) else 0] except json.decoder.JSONDecodeError: if gen_info_string != '': - modules.shared.log.error(f"Error parsing JSON generation info: {gen_info_string}") + log.error(f"Error parsing JSON generation info: {gen_info_string}") return [res, gr_show(False)] reuse_seed.click(fn=copy_seed, _js="(x, y) => [x, selected_gallery_index()]", show_progress=False, inputs=[generation_info, dummy_component], outputs=[seed, dummy_component]) @@ -503,6 +504,7 @@ def create_ui(startup_timer = None): negative_token_button.click(fn=wrap_queued_call(update_token_counter), inputs=[txt2img_negative_prompt, steps], outputs=[negative_token_counter]) ui_extra_networks.setup_ui(extra_networks_ui, txt2img_gallery) + log.debug(f'UI interface: tab=txt2img batch={show_batch.value} seed={show_seed.value} advanced={show_advanced.value} second_pass={show_second_pass.value}') startup_timer.record("ui-txt2img") @@ -854,6 +856,8 @@ def create_ui(startup_timer = None): paste_button=img2img_paste, tabname="img2img", source_text_component=img2img_prompt, source_image_component=None, )) + log.debug(f'UI interface: tab=img2img seed={show_seed.value} resize={show_resize.value} batch={show_batch.value} denoise={show_denoise.value} advanced={show_advanced.value}') + startup_timer.record("ui-img2img") modules.scripts.scripts_current = None @@ -910,7 +914,7 @@ def create_ui(startup_timer = None): try: res = comp(label=info.label, value=fun(), elem_id=elem_id, **(args or {})) except Exception as e: - modules.shared.log.error(f'Error creating setting: {key} {e}') + log.error(f'Error creating setting: {key} {e}') res = None if res is not None and not is_quicksettings: @@ -955,9 +959,9 @@ def create_ui(startup_timer = None): directml_override_opts() try: opts.save(modules.shared.config_filename) - modules.shared.log.info(f'Settings changed: {len(changed)} {changed}') + log.info(f'Settings changed: {len(changed)} {changed}') except RuntimeError: - modules.shared.log.error(f'Settings change failed: {len(changed)} {changed}') + log.error(f'Settings change failed: {len(changed)} {changed}') return opts.dumpjson(), f'{len(changed)} Settings changed without save: {", ".join(changed)}' return opts.dumpjson(), f'{len(changed)} Settings changed{": " if len(changed) > 0 else ""}{", ".join(changed)}' @@ -969,7 +973,7 @@ def create_ui(startup_timer = None): if cmd_opts.use_directml: directml_override_opts() opts.save(modules.shared.config_filename) - modules.shared.log.debug(f'Setting changed: key={key}, value={value}') + log.debug(f'Setting changed: key={key}, value={value}') return get_value_for_setting(key), opts.dumpjson() with gr.Blocks(analytics_enabled=False) as settings_interface: @@ -1179,7 +1183,7 @@ def html_head(): head += f'\n' added.append(script.path) added = [a.replace(script_path, '').replace('\\', '/') for a in added] - # modules.shared.log.debug(f'Adding JS scripts: {added}') + # log.debug(f'Adding JS scripts: {added}') return head @@ -1209,7 +1213,7 @@ def html_css(): if os.path.exists(os.path.join(data_path, "user.css")): head += stylesheet(os.path.join(data_path, "user.css")) added = [a.replace(script_path, '').replace('\\', '/') for a in added] - # modules.shared.log.debug(f'Adding CSS stylesheets: {added}') + # log.debug(f'Adding CSS stylesheets: {added}') return head diff --git a/modules/ui_models.py b/modules/ui_models.py index 607dd069c..54b24bfea 100644 --- a/modules/ui_models.py +++ b/modules/ui_models.py @@ -142,7 +142,7 @@ def create_ui(): model_checkhash_btn.click(fn=sd_models.update_model_hashes, inputs=[], outputs=[models_outcome]) with gr.Row(): model_table = gr.DataFrame( - data = model_data, + value = model_data, headers = model_headers, label = 'Model data', show_label = True, From a293e3cdcb44bd446847b06dc9fb5a6713d89b5e Mon Sep 17 00:00:00 2001 From: Disty0 Date: Thu, 3 Aug 2023 16:29:56 +0300 Subject: [PATCH 17/17] Torch 2.0 for IPEX --- installer.py | 2 +- modules/ipex_specific/__init__.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/installer.py b/installer.py index cbb60c7fd..62510d303 100644 --- a/installer.py +++ b/installer.py @@ -323,7 +323,7 @@ def check_torch(): os.environ.setdefault('NEOReadDebugKeys', '1') os.environ.setdefault('ClDeviceGlobalMemSizeAvailablePercent', '100') os.environ.setdefault('TENSORFLOW_PACKAGE', 'tensorflow==2.12.0 intel-extension-for-tensorflow[gpu]') - torch_command = os.environ.get('TORCH_COMMAND', 'torch==1.13.0a0+git6c9b55e torchvision==0.14.1a0 intel_extension_for_pytorch==1.13.120+xpu -f https://developer.intel.com/ipex-whl-stable-xpu') + torch_command = os.environ.get('TORCH_COMMAND', 'torch==2.0.1a0 torchvision==0.15.2a0 intel_extension_for_pytorch==2.0.110+xpu -f https://developer.intel.com/ipex-whl-stable-xpu') else: machine = platform.machine() if sys.platform == 'darwin': diff --git a/modules/ipex_specific/__init__.py b/modules/ipex_specific/__init__.py index 042777928..4bba9052c 100644 --- a/modules/ipex_specific/__init__.py +++ b/modules/ipex_specific/__init__.py @@ -1,4 +1,5 @@ import os +import contextlib import torch import intel_extension_for_pytorch as ipex from modules import shared @@ -16,6 +17,9 @@ def ipex_no_cuda(orig_func, *args, **kwargs): # pylint: disable=redefined-outer- orig_func(*args, **kwargs) torch.cuda.is_available = torch.xpu.is_available +def return_null_context(*args, **kwargs): + return contextlib.nullcontext() + def ipex_init(): #Fix functions with ipex torch.cuda.is_available = torch.xpu.is_available @@ -27,6 +31,7 @@ def ipex_init(): torch._utils._get_available_device_type = lambda: "xpu" # pylint: disable=protected-access torch.cuda.set_device = torch.xpu.set_device torch.cuda.synchronize = torch.xpu.synchronize + torch.backends.cuda.sdp_kernel = return_null_context torch.Tensor.cuda = torch.Tensor.xpu torch.nn.DataParallel = DummyDataParallel