Commit Graph

45 Commits

Author SHA1 Message Date
Aarni Koskela f8fb74b93a Bump Spandrel to 0.3.4; add spandrel-extra-arches for CodeFormer 2024-07-04 09:14:04 +03:00
w-e-w 246c269af8 add option to check file hash after download
if the sha256 hash does not match it will be automatically deleted
2024-04-23 03:09:45 +09:00
Aarni Koskela e3fa46f26f Fix various typos with crate-ci/typos 2024-03-04 08:42:07 +02:00
Aarni Koskela 2cacbc124c load_spandrel_model: make `half` `prefer_half`
As discussed with the Spandrel folks, it's good to heed Spandrel's
"supports half precision" flag to avoid e.g. black blotches and what-not.
2024-01-02 10:44:38 +02:00
Aarni Koskela 777af661a2 Be more clear about Spandrel model nomenclature 2023-12-31 00:22:58 +02:00
Aarni Koskela c0ca6348e8 load_spandrel_model: always return a model descriptor 2023-12-31 00:04:47 +02:00
AUTOMATIC1111 7c13ffdbb1
Merge pull request #14472 from akx/drop-move-code
Remove `cleanup_models` code
2023-12-30 22:15:30 +03:00
Aarni Koskela af050dcaa7 Soften Spandrel model-architecture check to just a warning 2023-12-30 21:05:59 +02:00
Aarni Koskela 5fbb13e0da Remove `cleanup_models` code 2023-12-30 20:47:12 +02:00
Aarni Koskela 4ad0c0c0a8 Verify architecture for loaded Spandrel models 2023-12-30 16:37:03 +02:00
Aarni Koskela b0f5934234 Use Spandrel for upscaling and face restoration architectures (aside from GFPGAN and LDSR) 2023-12-30 16:24:01 +02:00
AUTOMATIC1111 3cd4fd51ef
Merge pull request #10823 from akx/model-loady
Upscaler model loading cleanup
2023-06-27 09:20:49 +03:00
Aarni Koskela 0afbc0c235 Fix up `if "http" in ...:` to be more sensible startswiths 2023-06-13 12:38:29 +03:00
Aarni Koskela 89352a2f52 Move `load_file_from_url` to modelloader 2023-06-13 12:38:28 +03:00
Aarni Koskela 165ab44f03 Use os.makedirs(..., exist_ok=True) 2023-06-13 12:35:43 +03:00
AUTOMATIC df6fffb054 change upscalers to download models into user-specified directory (from commandline args) rather than the default models/<...> 2023-05-19 09:09:18 +03:00
AUTOMATIC 8aa87c564a add UI to edit defaults
allow setting defaults for elements in extensions' tabs
fix a problem with ESRGAN upscalers disappearing after UI reload
implicit change: HTML element id for train tab from tab_ti to tab_train (will this break things?)
2023-05-10 23:41:08 +03:00
AUTOMATIC 028d3f6425 ruff auto fixes 2023-05-10 11:05:02 +03:00
AUTOMATIC f741a98bac imports cleanup for ruff 2023-05-10 08:43:42 +03:00
AUTOMATIC 96d6ca4199 manual fixes for ruff 2023-05-10 08:25:25 +03:00
AUTOMATIC1111 b3a44385b1
Merge pull request #10025 from acncagua/Upscaler_initialization
Initialize the upscalers
2023-05-08 15:03:59 +03:00
AUTOMATIC 083dc3c76a directory hiding for extra networks: dirs starting with . will hide their cards on extra network tabs unless specifically searched for
create HTML for extra network pages only on demand
allow directories starting with . to still list their models for lora, checkpoints, etc
keep "search" filter for extra networks when user refreshes the page
2023-05-08 11:33:45 +03:00
Acncagua Slt 1bebb50da9
No double calls will be made
Do not call load_upscalers in list_builtin_upscalers
2023-05-04 11:59:22 +09:00
ArrowM 00bd271faf Move `load_file_from_url`
Why?
one of the internal calls of `load_file_from_url` import cv2, which locks the cv2 site-package, which extensions may (and in our case, is) breaking the installation of some libraries. The base project should be limiting its import of unnecessary libraries when possible during the installation phase.
2023-03-21 21:13:30 -05:00
Brad Smith d118cb6ea3
use lowercase name for sorting; keep `UpscalerLanczos` and `UpscalerNearest` at the start of the list with `UpscalerNone`
Co-authored-by: catboxanon <122327233+catboxanon@users.noreply.github.com>
2023-03-06 13:21:42 -05:00
Brad Smith b15bc73c99
sort upscalers by name 2023-02-24 14:45:08 -05:00
spezialspezial 6524478850
Update modelloader.py
os.path.getmtime(filename) throws exception later in codepath when meeting broken symlink. For now catch it here early but more checks could be added for robustness.
2023-02-04 16:52:15 +01:00
AUTOMATIC ce3f639ec8 add more stuff to ignore when creating model from config
prevent .vae.safetensors files from being listed as stable diffusion models
2023-01-10 16:51:04 +03:00
AUTOMATIC 2d5a5076bb Make it so that upscalers are not repeated when restarting UI. 2023-01-03 18:38:21 +03:00
AUTOMATIC b6e5edd746 add built-in extension system
add support for adding upscalers in extensions
move LDSR, ScuNET and SwinIR to built-in extensions
2022-12-03 18:06:33 +03:00
Tim Patton ac7ecd2d84 Label and load SD .safetensors model files 2022-11-19 14:49:22 -05:00
victorca25 c9bb33dd43 add resrgan 8x, allow use 1x and up to 8x extra models, move BSRGAN model, add nearest 2022-10-30 12:54:06 +01:00
d8ahazard 5d26ba2b4b
Merge branch 'master' into ScuNET 2022-10-02 07:56:22 -05:00
AUTOMATIC 0114057ad6 fix incorrect use of glob in modelloader for #1410 2022-10-02 15:49:42 +03:00
d8ahazard e82ea20299 Optimize model loader
Child classes only get populated to __subclassess__ when they are imported. We don't actually need to import any of them to webui any more, so clean up webUI imports and make sure loader imports children.

Also, fix command line paths not actually being passed to the scalers.
2022-09-30 15:26:18 -05:00
d8ahazard 5d52231bcb Logging....
Cleanup. Sorry.
2022-09-30 09:28:48 -05:00
d8ahazard ca87c09c0e Fix recursive model loading
Ensure we find checkpoints within subdirectories.
2022-09-30 09:28:28 -05:00
AUTOMATIC d1f098540a remove unwanted formatting/functionality from the PR 2022-09-30 11:42:40 +03:00
AUTOMATIC aec811c5e6 undo upscaler model filename tampering 2022-09-30 10:52:45 +03:00
d8ahazard 435fd2112a Fixes, cleanup. 2022-09-29 19:59:53 -05:00
d8ahazard 0dce0df1ee Holy $hit.
Yep.

Fix gfpgan_model_arch requirement(s).
Add Upscaler base class, move from images.
Add a lot of methods to Upscaler.
Re-work all the child upscalers to be proper classes.
Add BSRGAN scaler.
Add ldsr_model_arch class, removing the dependency for another repo that just uses regular latent-diffusion stuff.
Add one universal method that will always find and load new upscaler models without having to add new "setup_model" calls. Still need to add command line params, but that could probably be automated.
Add a "self.scale" property to all Upscalers so the scalers themselves can do "things" in response to the requested upscaling size.
Ensure LDSR doesn't get stuck in a longer loop of "upscale/downscale/upscale" as we try to reach the target upscale size.
Add typehints for IDE sanity.
PEP-8 improvements.
Moar.
2022-09-29 17:46:23 -05:00
d8ahazard 31ad536c33 Remove debugging message 2022-09-27 11:05:25 -05:00
d8ahazard 11875f5863 Use model loader with stable-diffusion too.
Hook the model loader into the SD_models file.
Add default url/download if checkpoint is not found.
Add matching stablediffusion-models-path argument.
Add message that --ckpt-dir will be removed in the future, but have it pipe to stablediffusion-models-path for now.
Update help strings for models-path args so they're more or less uniform.
Move sd_model "setup" call to webUI with the others.
Ensure "cleanup_models" method moves existing models to the new locations, including SD, and that we aren't deleting folders that still have stuff in them.
2022-09-27 11:01:13 -05:00
d8ahazard 7d5c29b674 Cleanup existing directories, fixes 2022-09-26 10:27:18 -05:00
d8ahazard 740070ea9c Re-implement universal model loading 2022-09-26 09:29:50 -05:00