diff options
-rw-r--r-- | .eslintrc.js | 1 | ||||
-rw-r--r-- | CHANGELOG.md | 100 | ||||
-rw-r--r-- | extensions-builtin/LDSR/scripts/ldsr_model.py | 4 | ||||
-rw-r--r-- | extensions-builtin/ScuNET/scripts/scunet_model.py | 3 | ||||
-rw-r--r-- | extensions-builtin/SwinIR/scripts/swinir_model.py | 2 | ||||
-rw-r--r-- | javascript/dragdrop.js | 5 | ||||
-rw-r--r-- | modules/esrgan_model.py | 2 | ||||
-rw-r--r-- | modules/modelloader.py | 7 | ||||
-rw-r--r-- | modules/realesrgan_model.py | 2 | ||||
-rw-r--r-- | modules/ui_extensions.py | 4 | ||||
-rw-r--r-- | modules/upscaler.py | 1 | ||||
-rw-r--r-- | script.js | 28 |
12 files changed, 85 insertions, 74 deletions
diff --git a/.eslintrc.js b/.eslintrc.js index 78275554..9e7ab34d 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -56,6 +56,7 @@ module.exports = { onOptionsChanged: "writable", uiCurrentTab: "writable", uiElementIsVisible: "writable", + uiElementInSight: "writable", executeCallbacks: "writable", //ui.js opts: "writable", diff --git a/CHANGELOG.md b/CHANGELOG.md index 4badc113..8a4da1d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,17 +4,17 @@ * add UI to edit defaults
* token merging (via dbolya/tomesd)
* settings tab rework: add a lot of additional explanations and links
- * load extensions' git metadata in parallel to loading the main program to save a ton of time during startup
+ * load extensions' Git metadata in parallel to loading the main program to save a ton of time during startup
* update extensions table: show branch, show date in separate column, and show version from tags if available
* TAESD - another option for cheap live previews
* allow choosing sampler and prompts for second pass of hires fix - hidden by default, enabled in settings
### Minor:
- * gradio bumped to 3.31.0
- * Bump pytorch to 2.0.1 for OSX and Linux AMD
+ * bump Gradio to 3.31.0
+ * bump PyTorch to 2.0.1 for macOS and Linux AMD
* allow setting defaults for elements in extensions' tabs
* allow selecting file type for live previews
- * Show "Loading..." for extra networks when displaying for the first time
+ * show "Loading..." for extra networks when displaying for the first time
* suppress ENSD infotext for samplers that don't use it
* clientside optimizations
* add options to show/hide hidden files and dirs in extra networks, and to not list models/files in hidden directories
@@ -29,78 +29,78 @@ ### Extensions:
* add /sdapi/v1/script-info api
- * use ruff to lint python code
- * use eslit to link javascript code
- * Add/modify CFG callbacks for Self-Attention Guidance extension
- * command and endpoint for graceful server stopping
+ * use Ruff to lint Python code
+ * use ESlint to lint Javascript code
+ * add/modify CFG callbacks for Self-Attention Guidance extension
+ * add command and endpoint for graceful server stopping
* add some locals (prompts/seeds/etc) from processing function into the Processing class as fields
- * rework quoting for infotext items that have commas in them to use json (should be backwards compatible except for cases where it didn't work previously)
+ * rework quoting for infotext items that have commas in them to use JSON (should be backwards compatible except for cases where it didn't work previously)
### Bug Fixes:
- * fix an issue preventing the program from starting if the user specifies a bad gradio theme
+ * fix an issue preventing the program from starting if the user specifies a bad Gradio theme
* fix broken prompts from file script
* fix symlink scanning for extra networks
* fix --data-dir ignored when launching via webui-user.bat COMMANDLINE_ARGS
* allow web UI to be ran fully offline
* fix inability to run with --freeze-settings
* fix inability to merge checkpoint without adding metadata
- * fix extra networks save preview image not adding infotext for jpeg/webm
+ * fix extra networks' save preview image not adding infotext for jpeg/webm
* remove blinking effect from text in hires fix and scale resolution preview
## 1.2.1
### Features:
- * add an option to always refer to lora by filenames
+ * add an option to always refer to LoRA by filenames
### Bug Fixes:
- * never refer to lora by an alias if multiple loras have same alias or the alias is called none
+ * never refer to LoRA by an alias if multiple LoRAs have same alias or the alias is called none
* fix upscalers disappearing after the user reloads UI
- * allow bf16 in safe unpickler (resolves problems with loading some loras)
+ * allow bf16 in safe unpickler (resolves problems with loading some LoRAs)
* allow web UI to be ran fully offline
* fix localizations not working
- * fix error for loras: 'LatentDiffusion' object has no attribute 'lora_layer_mapping'
+ * fix error for LoRAs: `'LatentDiffusion' object has no attribute 'lora_layer_mapping'`
## 1.2.0
### Features:
- * do not wait for stable diffusion model to load at startup
- * add filename patterns: [denoising]
- * directory hiding for extra networks: dirs starting with . will hide their cards on extra network tabs unless specifically searched for
- * Lora: for the `<...>` text in prompt, use name of Lora that is in the metdata of the file, if present, instead of filename (both can be used to activate lora)
- * Lora: read infotext params from kohya-ss's extension parameters if they are present and if his extension is not active
- * Lora: Fix some Loras not working (ones that have 3x3 convolution layer)
- * Lora: add an option to use old method of applying loras (producing same results as with kohya-ss)
+ * do not wait for Stable Diffusion model to load at startup
+ * add filename patterns: `[denoising]`
+ * directory hiding for extra networks: dirs starting with `.` will hide their cards on extra network tabs unless specifically searched for
+ * LoRA: for the `<...>` text in prompt, use name of LoRA that is in the metdata of the file, if present, instead of filename (both can be used to activate LoRA)
+ * LoRA: read infotext params from kohya-ss's extension parameters if they are present and if his extension is not active
+ * LoRA: fix some LoRAs not working (ones that have 3x3 convolution layer)
+ * LoRA: add an option to use old method of applying LoRAs (producing same results as with kohya-ss)
* add version to infotext, footer and console output when starting
* add links to wiki for filename pattern settings
* add extended info for quicksettings setting and use multiselect input instead of a text field
### Minor:
- * gradio bumped to 3.29.0
- * torch bumped to 2.0.1
- * --subpath option for gradio for use with reverse proxy
- * linux/OSX: use existing virtualenv if already active (the VIRTUAL_ENV environment variable)
- * possible frontend optimization: do not apply localizations if there are none
- * Add extra `None` option for VAE in XYZ plot
+ * bump Gradio to 3.29.0
+ * bump PyTorch to 2.0.1
+ * `--subpath` option for gradio for use with reverse proxy
+ * Linux/macOS: use existing virtualenv if already active (the VIRTUAL_ENV environment variable)
+ * do not apply localizations if there are none (possible frontend optimization)
+ * add extra `None` option for VAE in XYZ plot
* print error to console when batch processing in img2img fails
* create HTML for extra network pages only on demand
- * allow directories starting with . to still list their models for lora, checkpoints, etc
+ * allow directories starting with `.` to still list their models for LoRA, checkpoints, etc
* put infotext options into their own category in settings tab
* do not show licenses page when user selects Show all pages in settings
### Extensions:
- * Tooltip localization support
- * Add api method to get LoRA models with prompt
+ * tooltip localization support
+ * add API method to get LoRA models with prompt
### Bug Fixes:
- * re-add /docs endpoint
+ * re-add `/docs` endpoint
* fix gamepad navigation
* make the lightbox fullscreen image function properly
* fix squished thumbnails in extras tab
* keep "search" filter for extra networks when user refreshes the tab (previously it showed everthing after you refreshed)
* fix webui showing the same image if you configure the generation to always save results into same file
* fix bug with upscalers not working properly
- * Fix MPS on PyTorch 2.0.1, Intel Macs
+ * fix MPS on PyTorch 2.0.1, Intel Macs
* make it so that custom context menu from contextMenu.js only disappears after user's click, ignoring non-user click events
* prevent Reload UI button/link from reloading the page when it's not yet ready
* fix prompts from file script failing to read contents from a drag/drop file
@@ -108,20 +108,20 @@ ## 1.1.1
### Bug Fixes:
- * fix an error that prevents running webui on torch<2.0 without --disable-safe-unpickle
+ * fix an error that prevents running webui on PyTorch<2.0 without --disable-safe-unpickle
## 1.1.0
### Features:
- * switch to torch 2.0.0 (except for AMD GPUs)
+ * switch to PyTorch 2.0.0 (except for AMD GPUs)
* visual improvements to custom code scripts
- * add filename patterns: [clip_skip], [hasprompt<>], [batch_number], [generation_number]
+ * add filename patterns: `[clip_skip]`, `[hasprompt<>]`, `[batch_number]`, `[generation_number]`
* add support for saving init images in img2img, and record their hashes in infotext for reproducability
* automatically select current word when adjusting weight with ctrl+up/down
* add dropdowns for X/Y/Z plot
- * setting: Stable Diffusion/Random number generator source: makes it possible to make images generated from a given manual seed consistent across different GPUs
+ * add setting: Stable Diffusion/Random number generator source: makes it possible to make images generated from a given manual seed consistent across different GPUs
* support Gradio's theme API
* use TCMalloc on Linux by default; possible fix for memory leaks
- * (optimization) option to remove negative conditioning at low sigma values #9177
+ * add optimization option to remove negative conditioning at low sigma values #9177
* embed model merge metadata in .safetensors file
* extension settings backup/restore feature #9169
* add "resize by" and "resize to" tabs to img2img
@@ -130,22 +130,22 @@ * button to restore the progress from session lost / tab reload
### Minor:
- * gradio bumped to 3.28.1
- * in extra tab, change extras "scale to" to sliders
+ * bump Gradio to 3.28.1
+ * change "scale to" to sliders in Extras tab
* add labels to tool buttons to make it possible to hide them
* add tiled inference support for ScuNET
* add branch support for extension installation
- * change linux installation script to insall into current directory rather than /home/username
- * sort textual inversion embeddings by name (case insensitive)
+ * change Linux installation script to install into current directory rather than `/home/username`
+ * sort textual inversion embeddings by name (case-insensitive)
* allow styles.csv to be symlinked or mounted in docker
* remove the "do not add watermark to images" option
* make selected tab configurable with UI config
- * extra networks UI in now fixed height and scrollable
- * add disable_tls_verify arg for use with self-signed certs
+ * make the extra networks UI fixed height and scrollable
+ * add `disable_tls_verify` arg for use with self-signed certs
### Extensions:
- * Add reload callback
- * add is_hr_pass field for processing
+ * add reload callback
+ * add `is_hr_pass` field for processing
### Bug Fixes:
* fix broken batch image processing on 'Extras/Batch Process' tab
@@ -161,10 +161,10 @@ * one broken image in img2img batch won't stop all processing
* fix image orientation bug in train/preprocess
* fix Ngrok recreating tunnels every reload
- * fix --realesrgan-models-path and --ldsr-models-path not working
- * fix --skip-install not working
- * outpainting Mk2 & Poorman should use the SAMPLE file format to save images, not GRID file format
- * do not fail all Loras if some have failed to load when making a picture
+ * fix `--realesrgan-models-path` and `--ldsr-models-path` not working
+ * fix `--skip-install` not working
+ * use SAMPLE file format in Outpainting Mk2 & Poorman
+ * do not fail all LoRAs if some have failed to load when making a picture
## 1.0.0
* everything
diff --git a/extensions-builtin/LDSR/scripts/ldsr_model.py b/extensions-builtin/LDSR/scripts/ldsr_model.py index fbbe9005..c4da79f3 100644 --- a/extensions-builtin/LDSR/scripts/ldsr_model.py +++ b/extensions-builtin/LDSR/scripts/ldsr_model.py @@ -45,9 +45,9 @@ class UpscalerLDSR(Upscaler): if local_safetensors_path is not None and os.path.exists(local_safetensors_path): model = local_safetensors_path else: - model = local_ckpt_path if local_ckpt_path is not None else load_file_from_url(url=self.model_url, model_dir=self.model_path, file_name="model.ckpt", progress=True) + model = local_ckpt_path if local_ckpt_path is not None else load_file_from_url(url=self.model_url, model_dir=self.model_download_path, file_name="model.ckpt", progress=True) - yaml = local_yaml_path if local_yaml_path is not None else load_file_from_url(url=self.yaml_url, model_dir=self.model_path, file_name="project.yaml", progress=True) + yaml = local_yaml_path if local_yaml_path is not None else load_file_from_url(url=self.yaml_url, model_dir=self.model_download_path, file_name="project.yaml", progress=True) try: return LDSR(model, yaml) diff --git a/extensions-builtin/ScuNET/scripts/scunet_model.py b/extensions-builtin/ScuNET/scripts/scunet_model.py index cc2cbc6a..45d9297b 100644 --- a/extensions-builtin/ScuNET/scripts/scunet_model.py +++ b/extensions-builtin/ScuNET/scripts/scunet_model.py @@ -121,8 +121,7 @@ class UpscalerScuNET(modules.upscaler.Upscaler): def load_model(self, path: str): device = devices.get_device_for('scunet') if "http" in path: - filename = load_file_from_url(url=self.model_url, model_dir=self.model_path, file_name="%s.pth" % self.name, - progress=True) + filename = load_file_from_url(url=self.model_url, model_dir=self.model_download_path, file_name="%s.pth" % self.name, progress=True) else: filename = path if not os.path.exists(os.path.join(self.model_path, filename)) or filename is None: diff --git a/extensions-builtin/SwinIR/scripts/swinir_model.py b/extensions-builtin/SwinIR/scripts/swinir_model.py index 0ba50487..1c7bf325 100644 --- a/extensions-builtin/SwinIR/scripts/swinir_model.py +++ b/extensions-builtin/SwinIR/scripts/swinir_model.py @@ -51,7 +51,7 @@ class UpscalerSwinIR(Upscaler): def load_model(self, path, scale=4): if "http" in path: dl_name = "%s%s" % (self.model_name.replace(" ", "_"), ".pth") - filename = load_file_from_url(url=path, model_dir=self.model_path, file_name=dl_name, progress=True) + filename = load_file_from_url(url=path, model_dir=self.model_download_path, file_name=dl_name, progress=True) else: filename = path if filename is None or not os.path.exists(filename): diff --git a/javascript/dragdrop.js b/javascript/dragdrop.js index e316a365..77a24a07 100644 --- a/javascript/dragdrop.js +++ b/javascript/dragdrop.js @@ -81,7 +81,10 @@ window.addEventListener('paste', e => { } const visibleImageFields = [...gradioApp().querySelectorAll('[data-testid="image"]')] - .filter(el => uiElementIsVisible(el)); + .filter(el => uiElementIsVisible(el)) + .sort((a, b) => uiElementInSight(b) - uiElementInSight(a)); + + if (!visibleImageFields.length) { return; } diff --git a/modules/esrgan_model.py b/modules/esrgan_model.py index a009eb42..2fced999 100644 --- a/modules/esrgan_model.py +++ b/modules/esrgan_model.py @@ -154,7 +154,7 @@ class UpscalerESRGAN(Upscaler): if "http" in path:
filename = load_file_from_url(
url=self.model_url,
- model_dir=self.model_path,
+ model_dir=self.model_download_path,
file_name=f"{self.model_name}.pth",
progress=True,
)
diff --git a/modules/modelloader.py b/modules/modelloader.py index 2a479bcb..be23071a 100644 --- a/modules/modelloader.py +++ b/modules/modelloader.py @@ -47,7 +47,7 @@ def load_models(model_path: str, model_url: str = None, command_path: str = None if model_url is not None and len(output) == 0: if download_name is not None: from basicsr.utils.download_util import load_file_from_url - dl = load_file_from_url(model_url, model_path, True, download_name) + dl = load_file_from_url(model_url, places[0], True, download_name) output.append(dl) else: output.append(model_url) @@ -144,7 +144,10 @@ def load_upscalers(): for cls in reversed(used_classes.values()): name = cls.__name__ cmd_name = f"{name.lower().replace('upscaler', '')}_models_path" - scaler = cls(commandline_options.get(cmd_name, None)) + commandline_model_path = commandline_options.get(cmd_name, None) + scaler = cls(commandline_model_path) + scaler.user_path = commandline_model_path + scaler.model_download_path = commandline_model_path or scaler.model_path datas += scaler.scalers shared.sd_upscalers = sorted( diff --git a/modules/realesrgan_model.py b/modules/realesrgan_model.py index c24d8dbb..99983678 100644 --- a/modules/realesrgan_model.py +++ b/modules/realesrgan_model.py @@ -73,7 +73,7 @@ class UpscalerRealESRGAN(Upscaler): return None
if info.local_data_path.startswith("http"):
- info.local_data_path = load_file_from_url(url=info.data_path, model_dir=self.model_path, progress=True)
+ info.local_data_path = load_file_from_url(url=info.data_path, model_dir=self.model_download_path, progress=True)
return info
except Exception as e:
diff --git a/modules/ui_extensions.py b/modules/ui_extensions.py index 4ba3bdd7..ef18f438 100644 --- a/modules/ui_extensions.py +++ b/modules/ui_extensions.py @@ -125,7 +125,9 @@ def make_commit_link(commit_hash, remote, text=None): if text is None:
text = commit_hash[:8]
if remote.startswith("https://github.com/"):
- href = os.path.join(remote, "commit", commit_hash)
+ if remote.endswith(".git"):
+ remote = remote[:-4]
+ href = remote + "/commit/" + commit_hash
return f'<a href="{href}" target="_blank">{text}</a>'
else:
return text
diff --git a/modules/upscaler.py b/modules/upscaler.py index 8acb6e96..7b1046d6 100644 --- a/modules/upscaler.py +++ b/modules/upscaler.py @@ -34,6 +34,7 @@ class Upscaler: self.half = not modules.shared.cmd_opts.no_half self.pre_pad = 0 self.mod_scale = None + self.model_download_path = None if self.model_path is None and self.name: self.model_path = os.path.join(shared.models_path, self.name) @@ -92,19 +92,21 @@ document.addEventListener('keydown', function(e) { * checks that a UI element is not in another hidden element or tab content */ function uiElementIsVisible(el) { - let isVisible = !el.closest('.\\!hidden'); - if (!isVisible) { - return false; + if (el === document) { + return true; } - while ((isVisible = el.closest('.tabitem')?.style.display) !== 'none') { - if (!isVisible) { - return false; - } else if (el.parentElement) { - el = el.parentElement; - } else { - break; - } - } - return isVisible; + const computedStyle = getComputedStyle(el); + const isVisible = computedStyle.display !== 'none'; + + if (!isVisible) return false; + return uiElementIsVisible(el.parentNode); +} + +function uiElementInSight(el) { + const clRect = el.getBoundingClientRect(); + const windowHeight = window.innerHeight; + const isOnScreen = clRect.bottom > 0 && clRect.top < windowHeight; + + return isOnScreen; } |