...
 
Commits (57)
    https://gitcode.net/overbill1683/stable-diffusion-webui/-/commit/6efdfe3234d0510a6fd522c31dc62366d363ae73 if use use_main_prompt index = 0 2024-04-07T22:58:12+09:00 w-e-w 40751091+w-e-w@users.noreply.github.com https://gitcode.net/overbill1683/stable-diffusion-webui/-/commit/47ed9b2d398287f14a6dcab6fa4fe8b78bccf1c8 allow list or callables in generation_params 2024-04-08T01:39:31+09:00 w-e-w 40751091+w-e-w@users.noreply.github.com https://gitcode.net/overbill1683/stable-diffusion-webui/-/commit/219e64489c9c2a712dc31fe254d1a32ce3caf7c2 re-work extra_generation_params for Hires prompt 2024-04-08T18:18:13+09:00 w-e-w 40751091+w-e-w@users.noreply.github.com https://gitcode.net/overbill1683/stable-diffusion-webui/-/commit/1e1176b6eb4b0054ad44b29787cb8e9217da5daf non-serializable as None 2024-04-08T18:18:33+09:00 w-e-w 40751091+w-e-w@users.noreply.github.com https://gitcode.net/overbill1683/stable-diffusion-webui/-/commit/e3aabe6959c2088f6b6e917b4f84185ae95a3af6 add documentation for create_infotext 2024-04-08T20:14:02+09:00 w-e-w 40751091+w-e-w@users.noreply.github.com https://gitcode.net/overbill1683/stable-diffusion-webui/-/commit/d9708c92b444894bce8070e4dcfaa093f8eb8d43 fix limited file write (thanks, Sylwia) 2024-04-08T16:15:25+03:00 AUTOMATIC1111 16777216c@gmail.com https://gitcode.net/overbill1683/stable-diffusion-webui/-/commit/2580235c72b0cde49519678756c26417248348f5 Fix extra-single-image API not doing upscale failed 2024-04-09T11:13:47+08:00 Jorden Tse jordenyt@gmail.com https://gitcode.net/overbill1683/stable-diffusion-webui/-/commit/c48b6bf6bde677716dc0ace3acc4f012d4a6cb05 Merge pull request #15465 from jordenyt/fix-extras-api-upscale-enabled 2024-04-09T11:00:30+03:00 AUTOMATIC1111 16777216c@gmail.com Fix extra-single-image API not doing upscale failed https://gitcode.net/overbill1683/stable-diffusion-webui/-/commit/a976f4dff94f501bf2813b394407d3edff37cbe8 Merge pull request #15460 from AUTOMATIC1111/create_infotext-index-and-callable 2024-04-09T12:05:02+03:00 AUTOMATIC1111 16777216c@gmail.com create_infotext allow index and callable, re-work Hires prompt infotext https://gitcode.net/overbill1683/stable-diffusion-webui/-/commit/600f339c4cf1829c4a52bf83a71544ba7fe7bb5b Warning when Script is not found 2024-04-09T21:32:41+09:00 w-e-w 40751091+w-e-w@users.noreply.github.com https://gitcode.net/overbill1683/stable-diffusion-webui/-/commit/ef83f6831fd747fea4d0fa638fe5ffb71aaa5b0f catch exception for all paste_fields callable 2024-04-09T21:32:58+09:00 w-e-w 40751091+w-e-w@users.noreply.github.com https://gitcode.net/overbill1683/stable-diffusion-webui/-/commit/ac8ffb34e3d1196319c8dcfcf0f5d3eded713176 Merge pull request #15470 from AUTOMATIC1111/read-infotext-Script-not-found 2024-04-09T16:00:56+03:00 AUTOMATIC1111 16777216c@gmail.com error handling paste_field callables https://gitcode.net/overbill1683/stable-diffusion-webui/-/commit/4068429ac72cd83e03abe779148bbe1d6a141a09 fix: Coordinate 'right' is less than 'left' 2024-04-10T10:53:25+00:00 storyicon storyicon@foxmail.com Signed-off-by: <span data-trailer="Signed-off-by:"><a href="mailto:storyicon@foxmail.com" title="storyicon@foxmail.com"></a><a href="javascript:void(0)" class="avatar s16 avatar-inline identicon bg5" style="text-decoration: none">N</a><a href="mailto:storyicon@foxmail.com" title="storyicon@foxmail.com">storyicon</a> &lt;<a href="mailto:storyicon@foxmail.com" title="storyicon@foxmail.com">storyicon@foxmail.com</a>&gt;</span> https://gitcode.net/overbill1683/stable-diffusion-webui/-/commit/592e40ebe937cea6325412fe3650f4b693e0ab95 update restricted_opts 2024-04-11T23:10:25+09:00 w-e-w 40751091+w-e-w@users.noreply.github.com https://gitcode.net/overbill1683/stable-diffusion-webui/-/commit/3fadb4fc85818547b576eeb0891f3f1c755345fe Merge pull request #15492 from w-e-w/update-restricted_opts 2024-04-11T19:33:55+03:00 AUTOMATIC1111 16777216c@gmail.com update restricted_opts https://gitcode.net/overbill1683/stable-diffusion-webui/-/commit/ff6f4680c40cd033697af1f87e704f74af0977c7 Merge branch 'master' into dev 2024-04-13T06:38:58+03:00 AUTOMATIC1111 16777216c@gmail.com https://gitcode.net/overbill1683/stable-diffusion-webui/-/commit/8e1c3561beb33fa58e39c6fb2594ece02aca188a fix typo in function call (eror -> error) 2024-04-15T21:17:24+02:00 thatfuckingbird 67429906+thatfuckingbird@users.noreply.github.com https://gitcode.net/overbill1683/stable-diffusion-webui/-/commit/0f82948e4f46ca27acbf3ffb817cabec402c6438 Fix cls.__module__ 2024-04-15T22:14:19-04:00 huchenlei chenlei.hu@mail.utoronto.ca https://gitcode.net/overbill1683/stable-diffusion-webui/-/commit/a95326bec434da5d0a2aeb943d35cfded75e3afa nit 2024-04-15T22:34:01-04:00 huchenlei chenlei.hu@mail.utoronto.ca https://gitcode.net/overbill1683/stable-diffusion-webui/-/commit/bba306d414f1e81c979ae53271c022df08ef7388 fix: remove callbacks properly in remove_callbacks_for_function() 2024-04-15T21:10:11-07:00 Travis Geiselbrecht geist@foobox.com Like remove_current_script_callback just before, also remove from the ordered_callbacks_map to keep the callback map and ordered callback map in sync. https://gitcode.net/overbill1683/stable-diffusion-webui/-/commit/0980fdfe8c85bb4ff915bab100a383674a6a0171 fix: images do not match 2024-04-16T07:35:33+00:00 storyicon storyicon@foxmail.com Signed-off-by: <span data-trailer="Signed-off-by:"><a href="mailto:storyicon@foxmail.com" title="storyicon@foxmail.com"></a><a href="javascript:void(0)" class="avatar s16 avatar-inline identicon bg3" style="text-decoration: none">N</a><a href="mailto:storyicon@foxmail.com" title="storyicon@foxmail.com">storyicon</a> &lt;<a href="mailto:storyicon@foxmail.com" title="storyicon@foxmail.com">storyicon@foxmail.com</a>&gt;</span> https://gitcode.net/overbill1683/stable-diffusion-webui/-/commit/50190ca669fde082cd45a5030127813617a7f777 Compatibility with Debian 11, Fedora 34+ and openSUSE 15.4+ 2024-04-17T00:01:56-03:00 Alessandro de Oliveira Faria (A.K.A. CABELO) cabelo@opensuse.org https://gitcode.net/overbill1683/stable-diffusion-webui/-/commit/63fd38a04f91ed97bf0f51c9b63f134a2ed81d59 numpy DeprecationWarning product -> prod 2024-04-17T15:54:45+09:00 w-e-w 40751091+w-e-w@users.noreply.github.com https://gitcode.net/overbill1683/stable-diffusion-webui/-/commit/9d4fdc45d3c4b9431551fd53de64a67726dcbd64 fix x1 upscalers 2024-04-18T01:53:23+04:00 Andray light.and.ray@gmail.com https://gitcode.net/overbill1683/stable-diffusion-webui/-/commit/909c3dfe83ac8c55edebb8c23e265dbfe5532081 Remove API upscaling factor limits 2024-04-17T21:20:03-06:00 missionfloyd missionfloyd@users.noreply.github.com https://gitcode.net/overbill1683/stable-diffusion-webui/-/commit/ba2a737cceced2355f10e2f645e6794762858d12 Allow webui.sh to be runnable from directories containing a .git file 2024-04-18T04:25:32+00:00 Speculative Moonstone 167392122+speculativemoonstone@users.noreply.github.com https://gitcode.net/overbill1683/stable-diffusion-webui/-/commit/71314e47b1e505744f5ec8336fea0f7e45e0b4fb feat:compatible with inconsistent/empty mask 2024-04-18T11:59:25+00:00 storyicon storyicon@foxmail.com Signed-off-by: <span data-trailer="Signed-off-by:"><a href="mailto:storyicon@foxmail.com" title="storyicon@foxmail.com"></a><a href="javascript:void(0)" class="avatar s16 avatar-inline identicon bg1" style="text-decoration: none">N</a><a href="mailto:storyicon@foxmail.com" title="storyicon@foxmail.com">storyicon</a> &lt;<a href="mailto:storyicon@foxmail.com" title="storyicon@foxmail.com">storyicon@foxmail.com</a>&gt;</span> https://gitcode.net/overbill1683/stable-diffusion-webui/-/commit/d212fb59fe897327142c9b5049460689148be7a7 Hide 'No Image data blocks found.' message 2024-04-18T20:56:51-06:00 missionfloyd missionfloyd@users.noreply.github.com https://gitcode.net/overbill1683/stable-diffusion-webui/-/commit/5cb567c1384a019e5ba534b023b0f5d2dfff931f Add schedulers API endpoint 2024-04-19T20:32:09-06:00 missionfloyd missionfloyd@users.noreply.github.com https://gitcode.net/overbill1683/stable-diffusion-webui/-/commit/b5b1487f6a7ccc9c80251f100a92b004f727bee7 FilenameGenerator Sampler Scheduler 2024-04-21T04:52:03+09:00 w-e-w 40751091+w-e-w@users.noreply.github.com https://gitcode.net/overbill1683/stable-diffusion-webui/-/commit/49fee7c8dbb7f17e3903c2a238c53ddd53bc503f Add avif support 2024-04-20T23:26:04+03:00 kaanyalova 76952012+kaanyalova@users.noreply.github.com https://gitcode.net/overbill1683/stable-diffusion-webui/-/commit/cde35bebe90f05d2fa481663775ce5bd32d7cdd7 Merge pull request #15582 from kaanyalova/avif-support 2024-04-21T06:59:38+03:00 AUTOMATIC1111 16777216c@gmail.com Add avif support https://gitcode.net/overbill1683/stable-diffusion-webui/-/commit/f8f5d6cea2ecfcaaedf4f547745abaff5c7b4362 Merge pull request #15577 from AUTOMATIC1111/api-get-schedulers 2024-04-21T06:59:56+03:00 AUTOMATIC1111 16777216c@gmail.com Add schedulers API endpoint https://gitcode.net/overbill1683/stable-diffusion-webui/-/commit/3810413c00f350222651b30897ed16ecb6e1206c Merge pull request #15581 from AUTOMATIC1111/FilenameGenerator-sampler-scheduler 2024-04-21T07:00:28+03:00 AUTOMATIC1111 16777216c@gmail.com FilenameGenerator Sampler Scheduler https://gitcode.net/overbill1683/stable-diffusion-webui/-/commit/449bc7bcf35fc292e7d655500ba98bbcb707fb22 Merge pull request #15534 from storyicon/fix-masking 2024-04-21T07:06:45+03:00 AUTOMATIC1111 16777216c@gmail.com Fix images do not match / Coordinate 'right' is less than 'left' https://gitcode.net/overbill1683/stable-diffusion-webui/-/commit/c8ac42aad1c3214f9934689effa8675751108729 Merge pull request #15533 from travisg/callback-fix 2024-04-21T07:07:58+03:00 AUTOMATIC1111 16777216c@gmail.com fix: remove_callbacks_for_function should also remove from the ordered map https://gitcode.net/overbill1683/stable-diffusion-webui/-/commit/367b823466717129942735dbe48f6da9bdcd4eaf Merge pull request #15567 from AUTOMATIC1111/no-image-data-blocks-debug 2024-04-21T07:09:27+03:00 AUTOMATIC1111 16777216c@gmail.com Hide 'No Image data blocks found.' message https://gitcode.net/overbill1683/stable-diffusion-webui/-/commit/6f4f6bff6b4af4e65264618a7aebe8a6435d1350 add more info to the error message for #15567 2024-04-21T07:18:58+03:00 AUTOMATIC1111 16777216c@gmail.com https://gitcode.net/overbill1683/stable-diffusion-webui/-/commit/8d6e72dbfabc03ca17d8056df35475018d655ed9 Merge pull request #15561 from speculativemoonstone/fix-launch-git-directories 2024-04-21T07:21:21+03:00 AUTOMATIC1111 16777216c@gmail.com Allow webui.sh to be runnable from arbitrary directories containing a .git file https://gitcode.net/overbill1683/stable-diffusion-webui/-/commit/ce19a7baef9d4004b0eba3b5e605eb7198a420b7 Merge pull request #15544 from cabelo/master 2024-04-21T07:22:04+03:00 AUTOMATIC1111 16777216c@gmail.com Compatibility with Debian 11, Fedora 34+ and openSUSE 15.4+ https://gitcode.net/overbill1683/stable-diffusion-webui/-/commit/daae17851a9dc4a72aa6748fcd17fe3360df040b Merge pull request #15560 from AUTOMATIC1111/api-downscale 2024-04-21T07:22:30+03:00 AUTOMATIC1111 16777216c@gmail.com Remove API upscaling factor limits https://gitcode.net/overbill1683/stable-diffusion-webui/-/commit/a44ed231c2c7d36fc31a1163e245f17a44aa9edf Merge pull request #15555 from light-and-ray/fix_x1_upscalers 2024-04-21T07:22:58+03:00 AUTOMATIC1111 16777216c@gmail.com fix x1 upscalers https://gitcode.net/overbill1683/stable-diffusion-webui/-/commit/d74fc56fa578b224515f8ecb26ce200d5811ae1f Merge pull request #15547 from AUTOMATIC1111/numpy-DeprecationWarning-product... 2024-04-21T07:23:38+03:00 AUTOMATIC1111 16777216c@gmail.com numpy DeprecationWarning product -&gt; prod https://gitcode.net/overbill1683/stable-diffusion-webui/-/commit/9bcfb92a00df2ff217359be68ea2b21b3260f341 rename logging from textual inversion to not confuse it with global logging m... 2024-04-21T07:41:28+03:00 AUTOMATIC1111 16777216c@gmail.com https://gitcode.net/overbill1683/stable-diffusion-webui/-/commit/c0eaeb15af10c0aa2367930bc7fd256c46ce8d37 Merge pull request #15532 from huchenlei/fix_module 2024-04-21T07:42:57+03:00 AUTOMATIC1111 16777216c@gmail.com Fix cls.__module__ value in extension script https://gitcode.net/overbill1683/stable-diffusion-webui/-/commit/d1998d747db550afe7e65608ffcce3015c22b9d4 Merge pull request #15531 from thatfuckingbird/fix-mistyped-function-name 2024-04-21T07:43:19+03:00 AUTOMATIC1111 16777216c@gmail.com fix typo in function call (eror -&gt; error) https://gitcode.net/overbill1683/stable-diffusion-webui/-/commit/db263df5d5c1ba6d56b277a155186b80d24ac5bd get_crop_region_v2 2024-04-21T19:34:11+09:00 w-e-w 40751091+w-e-w@users.noreply.github.com https://gitcode.net/overbill1683/stable-diffusion-webui/-/commit/e6a8d0b4e65b365a684bd7539cf5b2cd16f9c44c Merge pull request #15583 from AUTOMATIC1111/get_crop_region_v2 2024-04-21T18:06:40+03:00 AUTOMATIC1111 16777216c@gmail.com get_crop_region_v2 https://gitcode.net/overbill1683/stable-diffusion-webui/-/commit/6c7c176dc9b2808fa897a8f52f445b48312b61bd fix mistake in #15583 2024-04-22T00:10:49+09:00 w-e-w 40751091+w-e-w@users.noreply.github.com https://gitcode.net/overbill1683/stable-diffusion-webui/-/commit/a183ea4ba773da5144e9f6b99fa48bff13078d2a undo adding scripts to sys.modules 2024-04-22T11:49:55+03:00 AUTOMATIC1111 16777216c@gmail.com https://gitcode.net/overbill1683/stable-diffusion-webui/-/commit/e4aa0c362e440cef6a6f728b2d4d695086f8cd3a Merge pull request #15587 from AUTOMATIC1111/fix-mistake-in-#15583 2024-04-22T11:50:34+03:00 AUTOMATIC1111 16777216c@gmail.com fix mistake in #15583 https://gitcode.net/overbill1683/stable-diffusion-webui/-/commit/e84703b2539c21d68881852f7e9738d76e7de26f update changelog 2024-04-22T11:59:54+03:00 AUTOMATIC1111 16777216c@gmail.com https://gitcode.net/overbill1683/stable-diffusion-webui/-/commit/61f6479ea9a85fd12b830be2dfe71a51db34b121 restore 1.8.0-style naming of scripts 2024-04-22T12:19:30+03:00 AUTOMATIC1111 16777216c@gmail.com https://gitcode.net/overbill1683/stable-diffusion-webui/-/commit/e9809de6512160501e34c54e9c8c5e5e493e306f restore 1.8.0-style naming of scripts 2024-04-22T18:23:58+09:00 w-e-w 40751091+w-e-w@users.noreply.github.com https://gitcode.net/overbill1683/stable-diffusion-webui/-/commit/3fdc3cfbbf50814d9609fb03e9730d16d6d20bb6 Merge pull request #15591 from AUTOMATIC1111/restore-1.8.0-style-naming-of-sc... 2024-04-22T12:24:06+03:00 AUTOMATIC1111 16777216c@gmail.com Restore 1.8.0 style naming of scripts https://gitcode.net/overbill1683/stable-diffusion-webui/-/commit/e837124f4b1b9dcf3caccd8d2fa5730cf3df099a changelog 2024-04-22T12:26:05+03:00 AUTOMATIC1111 16777216c@gmail.com https://gitcode.net/overbill1683/stable-diffusion-webui/-/commit/e2b177c508447cd3068993c67e165880348ff0d8 Merge branch 'dev' 2024-04-22T12:26:24+03:00 AUTOMATIC1111 16777216c@gmail.com
## 1.9.2
### Extensions and API:
* restore 1.8.0-style naming of scripts
## 1.9.1
### Minor:
* Add avif support ([#15582](https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/15582))
* Add filename patterns: `[sampler_scheduler]` and `[scheduler]` ([#15581](https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/15581))
### Extensions and API:
* undo adding scripts to sys.modules
* Add schedulers API endpoint ([#15577](https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/15577))
* Remove API upscaling factor limits ([#15560](https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/15560))
### Bug Fixes:
* Fix images do not match / Coordinate 'right' is less than 'left' ([#15534](https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/15534))
* fix: remove_callbacks_for_function should also remove from the ordered map ([#15533](https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/15533))
* fix x1 upscalers ([#15555](https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/15555))
* Fix cls.__module__ value in extension script ([#15532](https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/15532))
* fix typo in function call (eror -> error) ([#15531](https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/15531))
### Other:
* Hide 'No Image data blocks found.' message ([#15567](https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/15567))
* Allow webui.sh to be runnable from arbitrary directories containing a .git file ([#15561](https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/15561))
* Compatibility with Debian 11, Fedora 34+ and openSUSE 15.4+ ([#15544](https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/15544))
* numpy DeprecationWarning product -> prod ([#15547](https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/15547))
* get_crop_region_v2 ([#15583](https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/15583), [#15587](https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/15587))
## 1.9.0
### Features:
......@@ -85,7 +116,6 @@
* Fix extra-single-image API not doing upscale failed ([#15465](https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/15465))
* error handling paste_field callables ([#15470](https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/15470))
### Hardware:
* Add training support and change lspci for Ascend NPU ([#14981](https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/14981))
* Update to ROCm5.7 and PyTorch ([#14820](https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/14820))
......
......@@ -568,7 +568,7 @@ function extraNetworksShowMetadata(text) {
return;
}
} catch (error) {
console.eror(error);
console.error(error);
}
var elem = document.createElement('pre');
......
......@@ -17,7 +17,7 @@ from fastapi.encoders import jsonable_encoder
from secrets import compare_digest
import modules.shared as shared
from modules import sd_samplers, deepbooru, sd_hijack, images, scripts, ui, postprocessing, errors, restart, shared_items, script_callbacks, infotext_utils, sd_models
from modules import sd_samplers, deepbooru, sd_hijack, images, scripts, ui, postprocessing, errors, restart, shared_items, script_callbacks, infotext_utils, sd_models, sd_schedulers
from modules.api import models
from modules.shared import opts
from modules.processing import StableDiffusionProcessingTxt2Img, StableDiffusionProcessingImg2Img, process_images
......@@ -221,6 +221,7 @@ class Api:
self.add_api_route("/sdapi/v1/options", self.set_config, methods=["POST"])
self.add_api_route("/sdapi/v1/cmd-flags", self.get_cmd_flags, methods=["GET"], response_model=models.FlagsModel)
self.add_api_route("/sdapi/v1/samplers", self.get_samplers, methods=["GET"], response_model=list[models.SamplerItem])
self.add_api_route("/sdapi/v1/schedulers", self.get_schedulers, methods=["GET"], response_model=list[models.SchedulerItem])
self.add_api_route("/sdapi/v1/upscalers", self.get_upscalers, methods=["GET"], response_model=list[models.UpscalerItem])
self.add_api_route("/sdapi/v1/latent-upscale-modes", self.get_latent_upscale_modes, methods=["GET"], response_model=list[models.LatentUpscalerModeItem])
self.add_api_route("/sdapi/v1/sd-models", self.get_sd_models, methods=["GET"], response_model=list[models.SDModelItem])
......@@ -683,6 +684,17 @@ class Api:
def get_samplers(self):
return [{"name": sampler[0], "aliases":sampler[2], "options":sampler[3]} for sampler in sd_samplers.all_samplers]
def get_schedulers(self):
return [
{
"name": scheduler.name,
"label": scheduler.label,
"aliases": scheduler.aliases,
"default_rho": scheduler.default_rho,
"need_inner_model": scheduler.need_inner_model,
}
for scheduler in sd_schedulers.schedulers]
def get_upscalers(self):
return [
{
......
......@@ -147,7 +147,7 @@ class ExtrasBaseRequest(BaseModel):
gfpgan_visibility: float = Field(default=0, title="GFPGAN Visibility", ge=0, le=1, allow_inf_nan=False, description="Sets the visibility of GFPGAN, values should be between 0 and 1.")
codeformer_visibility: float = Field(default=0, title="CodeFormer Visibility", ge=0, le=1, allow_inf_nan=False, description="Sets the visibility of CodeFormer, values should be between 0 and 1.")
codeformer_weight: float = Field(default=0, title="CodeFormer Weight", ge=0, le=1, allow_inf_nan=False, description="Sets the weight of CodeFormer, values should be between 0 and 1.")
upscaling_resize: float = Field(default=2, title="Upscaling Factor", ge=1, le=8, description="By how much to upscale the image, only used when resize_mode=0.")
upscaling_resize: float = Field(default=2, title="Upscaling Factor", gt=0, description="By how much to upscale the image, only used when resize_mode=0.")
upscaling_resize_w: int = Field(default=512, title="Target Width", ge=1, description="Target width for the upscaler to hit. Only used when resize_mode=1.")
upscaling_resize_h: int = Field(default=512, title="Target Height", ge=1, description="Target height for the upscaler to hit. Only used when resize_mode=1.")
upscaling_crop: bool = Field(default=True, title="Crop to fit", description="Should the upscaler crop the image to fit in the chosen size?")
......@@ -235,6 +235,13 @@ class SamplerItem(BaseModel):
aliases: list[str] = Field(title="Aliases")
options: dict[str, str] = Field(title="Options")
class SchedulerItem(BaseModel):
name: str = Field(title="Name")
label: str = Field(title="Label")
aliases: Optional[list[str]] = Field(title="Aliases")
default_rho: Optional[float] = Field(title="Default Rho")
need_inner_model: Optional[bool] = Field(title="Needs Inner Model")
class UpscalerItem(BaseModel):
name: str = Field(title="Name")
model_name: Optional[str] = Field(title="Model Name")
......
......@@ -11,7 +11,7 @@ import tqdm
from einops import rearrange, repeat
from ldm.util import default
from modules import devices, sd_models, shared, sd_samplers, hashes, sd_hijack_checkpoint, errors
from modules.textual_inversion import textual_inversion, logging
from modules.textual_inversion import textual_inversion, saving_settings
from modules.textual_inversion.learn_schedule import LearnRateScheduler
from torch import einsum
from torch.nn.init import normal_, xavier_normal_, xavier_uniform_, kaiming_normal_, kaiming_uniform_, zeros_
......@@ -533,7 +533,7 @@ def train_hypernetwork(id_task, hypernetwork_name: str, learn_rate: float, batch
model_name=checkpoint.model_name, model_hash=checkpoint.shorthash, num_of_dataset_images=len(ds),
**{field: getattr(hypernetwork, field) for field in ['layer_structure', 'activation_func', 'weight_init', 'add_layer_norm', 'use_dropout', ]}
)
logging.save_settings_to_file(log_directory, {**saved_params, **locals()})
saving_settings.save_settings_to_file(log_directory, {**saved_params, **locals()})
latent_sampling_method = ds.latent_sampling_method
......
from __future__ import annotations
import datetime
import functools
import pytz
import io
import math
......@@ -13,6 +13,8 @@ import numpy as np
import piexif
import piexif.helper
from PIL import Image, ImageFont, ImageDraw, ImageColor, PngImagePlugin, ImageOps
# pillow_avif needs to be imported somewhere in code for it to work
import pillow_avif # noqa: F401
import string
import json
import hashlib
......@@ -347,6 +349,32 @@ def sanitize_filename_part(text, replace_spaces=True):
return text
@functools.cache
def get_scheduler_str(sampler_name, scheduler_name):
"""Returns {Scheduler} if the scheduler is applicable to the sampler"""
if scheduler_name == 'Automatic':
config = sd_samplers.find_sampler_config(sampler_name)
scheduler_name = config.options.get('scheduler', 'Automatic')
return scheduler_name.capitalize()
@functools.cache
def get_sampler_scheduler_str(sampler_name, scheduler_name):
"""Returns the '{Sampler} {Scheduler}' if the scheduler is applicable to the sampler"""
return f'{sampler_name} {get_scheduler_str(sampler_name, scheduler_name)}'
def get_sampler_scheduler(p, sampler):
"""Returns '{Sampler} {Scheduler}' / '{Scheduler}' / 'NOTHING_AND_SKIP_PREVIOUS_TEXT'"""
if hasattr(p, 'scheduler') and hasattr(p, 'sampler_name'):
if sampler:
sampler_scheduler = get_sampler_scheduler_str(p.sampler_name, p.scheduler)
else:
sampler_scheduler = get_scheduler_str(p.sampler_name, p.scheduler)
return sanitize_filename_part(sampler_scheduler, replace_spaces=False)
return NOTHING_AND_SKIP_PREVIOUS_TEXT
class FilenameGenerator:
replacements = {
'seed': lambda self: self.seed if self.seed is not None else '',
......@@ -358,6 +386,8 @@ class FilenameGenerator:
'height': lambda self: self.image.height,
'styles': lambda self: self.p and sanitize_filename_part(", ".join([style for style in self.p.styles if not style == "None"]) or "None", replace_spaces=False),
'sampler': lambda self: self.p and sanitize_filename_part(self.p.sampler_name, replace_spaces=False),
'sampler_scheduler': lambda self: self.p and get_sampler_scheduler(self.p, True),
'scheduler': lambda self: self.p and get_sampler_scheduler(self.p, False),
'model_hash': lambda self: getattr(self.p, "sd_model_hash", shared.sd_model.sd_model_hash),
'model_name': lambda self: sanitize_filename_part(shared.sd_model.sd_checkpoint_info.name_for_extra, replace_spaces=False),
'date': lambda self: datetime.datetime.now().strftime('%Y-%m-%d'),
......@@ -569,6 +599,16 @@ def save_image_with_geninfo(image, geninfo, filename, extension=None, existing_p
})
piexif.insert(exif_bytes, filename)
elif extension.lower() == '.avif':
if opts.enable_pnginfo and geninfo is not None:
exif_bytes = piexif.dump({
"Exif": {
piexif.ExifIFD.UserComment: piexif.helper.UserComment.dump(geninfo or "", encoding="unicode")
},
})
image.save(filename,format=image_format, exif=exif_bytes)
elif extension.lower() == ".gif":
image.save(filename, format=image_format, comment=geninfo)
else:
......@@ -747,7 +787,6 @@ def read_info_from_image(image: Image.Image) -> tuple[str | None, dict]:
exif_comment = exif_comment.decode('utf8', errors="ignore")
if exif_comment:
items['exif comment'] = exif_comment
geninfo = exif_comment
elif "comment" in items: # for gif
geninfo = items["comment"].decode('utf8', errors="ignore")
......
from PIL import Image, ImageFilter, ImageOps
def get_crop_region(mask, pad=0):
"""finds a rectangular region that contains all masked ares in an image. Returns (x1, y1, x2, y2) coordinates of the rectangle.
For example, if a user has painted the top-right part of a 512x512 image, the result may be (256, 0, 512, 256)"""
mask_img = mask if isinstance(mask, Image.Image) else Image.fromarray(mask)
box = mask_img.getbbox()
if box:
def get_crop_region_v2(mask, pad=0):
"""
Finds a rectangular region that contains all masked ares in a mask.
Returns None if mask is completely black mask (all 0)
Parameters:
mask: PIL.Image.Image L mode or numpy 1d array
pad: int number of pixels that the region will be extended on all sides
Returns: (x1, y1, x2, y2) | None
Introduced post 1.9.0
"""
mask = mask if isinstance(mask, Image.Image) else Image.fromarray(mask)
if box := mask.getbbox():
x1, y1, x2, y2 = box
else: # when no box is found
x1, y1 = mask_img.size
x2 = y2 = 0
return max(x1 - pad, 0), max(y1 - pad, 0), min(x2 + pad, mask_img.size[0]), min(y2 + pad, mask_img.size[1])
return max(x1 - pad, 0), max(y1 - pad, 0), min(x2 + pad, mask.size[0]), min(y2 + pad, mask.size[1]) if pad else box
def get_crop_region(mask, pad=0):
"""
Same function as get_crop_region_v2 but handles completely black mask (all 0) differently
when mask all black still return coordinates but the coordinates may be invalid ie x2>x1 or y2>y1
Notes: it is possible for the coordinates to be "valid" again if pad size is sufficiently large
(mask_size.x-pad, mask_size.y-pad, pad, pad)
Extension developer should use get_crop_region_v2 instead unless for compatibility considerations.
"""
mask = mask if isinstance(mask, Image.Image) else Image.fromarray(mask)
if box := get_crop_region_v2(mask, pad):
return box
x1, y1 = mask.size
x2 = y2 = 0
return max(x1 - pad, 0), max(y1 - pad, 0), min(x2 + pad, mask.size[0]), min(y2 + pad, mask.size[1])
def expand_crop_region(crop_region, processing_width, processing_height, image_width, image_height):
......
......@@ -1611,16 +1611,23 @@ class StableDiffusionProcessingImg2Img(StableDiffusionProcessing):
if self.inpaint_full_res:
self.mask_for_overlay = image_mask
mask = image_mask.convert('L')
crop_region = masking.get_crop_region(mask, self.inpaint_full_res_padding)
crop_region = masking.expand_crop_region(crop_region, self.width, self.height, mask.width, mask.height)
x1, y1, x2, y2 = crop_region
mask = mask.crop(crop_region)
image_mask = images.resize_image(2, mask, self.width, self.height)
self.paste_to = (x1, y1, x2-x1, y2-y1)
self.extra_generation_params["Inpaint area"] = "Only masked"
self.extra_generation_params["Masked area padding"] = self.inpaint_full_res_padding
crop_region = masking.get_crop_region_v2(mask, self.inpaint_full_res_padding)
if crop_region:
crop_region = masking.expand_crop_region(crop_region, self.width, self.height, mask.width, mask.height)
x1, y1, x2, y2 = crop_region
mask = mask.crop(crop_region)
image_mask = images.resize_image(2, mask, self.width, self.height)
self.paste_to = (x1, y1, x2-x1, y2-y1)
self.extra_generation_params["Inpaint area"] = "Only masked"
self.extra_generation_params["Masked area padding"] = self.inpaint_full_res_padding
else:
crop_region = None
image_mask = None
self.mask_for_overlay = None
self.inpaint_full_res = False
massage = 'Unable to perform "Inpaint Only mask" because mask is blank, switch to img2img mode.'
model_hijack.comments.append(massage)
logging.info(massage)
else:
image_mask = images.resize_image(self.resize_mode, image_mask, self.width, self.height)
np_mask = np.array(image_mask)
......@@ -1648,6 +1655,8 @@ class StableDiffusionProcessingImg2Img(StableDiffusionProcessing):
image = images.resize_image(self.resize_mode, image, self.width, self.height)
if image_mask is not None:
if self.mask_for_overlay.size != (image.width, image.height):
self.mask_for_overlay = images.resize_image(self.resize_mode, self.mask_for_overlay, image.width, image.height)
image_masked = Image.new('RGBa', (image.width, image.height))
image_masked.paste(image.convert("RGBA").convert("RGBa"), mask=ImageOps.invert(self.mask_for_overlay.convert('L')))
......
......@@ -448,6 +448,9 @@ def remove_callbacks_for_function(callback_func):
for callback_list in callback_map.values():
for callback_to_remove in [cb for cb in callback_list if cb.callback == callback_func]:
callback_list.remove(callback_to_remove)
for ordered_callback_list in ordered_callbacks_map.values():
for callback_to_remove in [cb for cb in ordered_callback_list if cb.callback == callback_func]:
ordered_callback_list.remove(callback_to_remove)
def on_app_started(callback, *, name=None):
......
......@@ -2,7 +2,6 @@ import os
import importlib.util
from modules import errors
import sys
loaded_scripts = {}
......@@ -14,10 +13,6 @@ def load_module(path):
module_spec.loader.exec_module(module)
loaded_scripts[path] = module
module_name, _ = os.path.splitext(os.path.basename(path))
sys.modules["scripts." + module_name] = module
return module
......
import base64
import json
import os.path
import warnings
import logging
import numpy as np
import zlib
from PIL import Image, ImageDraw
import torch
logger = logging.getLogger(__name__)
class EmbeddingEncoder(json.JSONEncoder):
def default(self, obj):
......@@ -43,7 +47,7 @@ def lcg(m=2**32, a=1664525, c=1013904223, seed=0):
def xor_block(block):
g = lcg()
randblock = np.array([next(g) for _ in range(np.product(block.shape))]).astype(np.uint8).reshape(block.shape)
randblock = np.array([next(g) for _ in range(np.prod(block.shape))]).astype(np.uint8).reshape(block.shape)
return np.bitwise_xor(block.astype(np.uint8), randblock & 0x0F)
......@@ -114,7 +118,7 @@ def extract_image_data_embed(image):
outarr = crop_black(np.array(image.convert('RGB').getdata()).reshape(image.size[1], image.size[0], d).astype(np.uint8)) & 0x0F
black_cols = np.where(np.sum(outarr, axis=(0, 2)) == 0)
if black_cols[0].shape[0] < 2:
print('No Image data blocks found.')
logger.debug(f'{os.path.basename(getattr(image, "filename", "unknown image file"))}: no embedded information found.')
return None
data_block_lower = outarr[:, :black_cols[0].min(), :].astype(np.uint8)
......
......@@ -17,7 +17,7 @@ import modules.textual_inversion.dataset
from modules.textual_inversion.learn_schedule import LearnRateScheduler
from modules.textual_inversion.image_embedding import embedding_to_b64, embedding_from_b64, insert_image_data_embed, extract_image_data_embed, caption_image_overlay
from modules.textual_inversion.logging import save_settings_to_file
from modules.textual_inversion.saving_settings import save_settings_to_file
TextualInversionTemplate = namedtuple("TextualInversionTemplate", ["name", "path"])
......
......@@ -57,7 +57,7 @@ class Upscaler:
dest_h = int((img.height * scale) // 8 * 8)
for _ in range(3):
if img.width >= dest_w and img.height >= dest_h:
if img.width >= dest_w and img.height >= dest_h and scale != 1:
break
if shared.state.interrupted:
......
......@@ -30,3 +30,4 @@ torch
torchdiffeq
torchsde
transformers==4.30.2
pillow-avif-plugin==1.4.3
\ No newline at end of file
......@@ -29,3 +29,4 @@ torchdiffeq==0.2.3
torchsde==0.2.6
transformers==4.30.2
httpx==0.24.1
pillow-avif-plugin==1.4.3
......@@ -113,13 +113,13 @@ then
exit 1
fi
if [[ -d .git ]]
if [[ -d "$SCRIPT_DIR/.git" ]]
then
printf "\n%s\n" "${delimiter}"
printf "Repo already cloned, using it as install directory"
printf "\n%s\n" "${delimiter}"
install_dir="${PWD}/../"
clone_dir="${PWD##*/}"
install_dir="${SCRIPT_DIR}/../"
clone_dir="${SCRIPT_DIR##*/}"
fi
# Check prerequisites
......@@ -243,7 +243,7 @@ prepare_tcmalloc() {
for lib in "${TCMALLOC_LIBS[@]}"
do
# Determine which type of tcmalloc library the library supports
TCMALLOC="$(PATH=/usr/sbin:$PATH ldconfig -p | grep -P $lib | head -n 1)"
TCMALLOC="$(PATH=/sbin:/usr/sbin:$PATH ldconfig -p | grep -P $lib | head -n 1)"
TC_INFO=(${TCMALLOC//=>/})
if [[ ! -z "${TC_INFO}" ]]; then
echo "Check TCMalloc: ${TC_INFO}"
......