InvokeAI/ldm/generate.py

1206 lines
50 KiB
Python
Raw Normal View History

Refactoring simplet2i (#387) * start refactoring -not yet functional * first phase of refactor done - not sure weighted prompts working * Second phase of refactoring. Everything mostly working. * The refactoring has moved all the hard-core inference work into ldm.dream.generator.*, where there are submodules for txt2img and img2img. inpaint will go in there as well. * Some additional refactoring will be done soon, but relatively minor work. * fix -save_orig flag to actually work * add @neonsecret attention.py memory optimization * remove unneeded imports * move token logging into conditioning.py * add placeholder version of inpaint; porting in progress * fix crash in img2img * inpainting working; not tested on variations * fix crashes in img2img * ported attention.py memory optimization #117 from basujindal branch * added @torch_no_grad() decorators to img2img, txt2img, inpaint closures * Final commit prior to PR against development * fixup crash when generating intermediate images in web UI * rename ldm.simplet2i to ldm.generate * add backward-compatibility simplet2i shell with deprecation warning * add back in mps exception, addresses @vargol comment in #354 * replaced Conditioning class with exported functions * fix wrong type of with_variations attribute during intialization * changed "image_iterator()" to "get_make_image()" * raise NotImplementedError for calling get_make_image() in parent class * Update ldm/generate.py better error message Co-authored-by: Kevin Gibbons <bakkot@gmail.com> * minor stylistic fixes and assertion checks from code review * moved get_noise() method into img2img class * break get_noise() into two methods, one for txt2img and the other for img2img * inpainting works on non-square images now * make get_noise() an abstract method in base class * much improved inpainting Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
2022-09-06 00:40:10 +00:00
# Copyright (c) 2022 Lincoln D. Stein (https://github.com/lstein)
# Derived from source code carrying the following copyrights
# Copyright (c) 2022 Machine Vision and Learning Group, LMU Munich
# Copyright (c) 2022 Robin Rombach and Patrick Esser and contributors
use 🧨diffusers model (#1583) * initial commit of DiffusionPipeline class * spike: proof of concept using diffusers for txt2img * doc: type hints for Generator * refactor(model_cache): factor out load_ckpt * model_cache: add ability to load a diffusers model pipeline and update associated things in Generate & Generator to not instantly fail when that happens * model_cache: fix model default image dimensions * txt2img: support switching diffusers schedulers * diffusers: let the scheduler do its scaling of the initial latents Remove IPNDM scheduler; it is not behaving. * web server: update image_progress callback for diffusers data * diffusers: restore prompt weighting feature * diffusers: fix set-sampler error following model switch * diffusers: use InvokeAIDiffuserComponent for conditioning * cross_attention_control: stub (no-op) implementations for diffusers * model_cache: let offload_model work with DiffusionPipeline, sorta. * models.yaml.example: add diffusers-format model, set as default * test-invoke-conda: use diffusers-format model test-invoke-conda: put huggingface-token where the library can use it * environment-mac: upgrade to diffusers 0.7 (from 0.6) this was already done for linux; mac must have been lost in the merge. * preload_models: explicitly load diffusers models In non-interactive mode too, as long as you're logged in. * fix(model_cache): don't check `model.config` in diffusers format clean-up from recent merge. * diffusers integration: support img2img * dev: upgrade to diffusers 0.8 (from 0.7.1) We get to remove some code by using methods that were factored out in the base class. * refactor: remove backported img2img.get_timesteps now that we can use it directly from diffusers 0.8.1 * ci: use diffusers model * dev: upgrade to diffusers 0.9 (from 0.8.1) * lint: correct annotations for Python 3.9. * lint: correct AttributeError.name reference for Python 3.9. * CI: prefer diffusers-1.4 because it no longer requires a token The RunwayML models still do. * build: there's yet another place to update requirements? * configure: try to download models even without token Models in the CompVis and stabilityai repos no longer require them. (But runwayml still does.) * configure: add troubleshooting info for config-not-found * fix(configure): prepend root to config path * fix(configure): remove second `default: true` from models example * CI: simplify test-on-push logic now that we don't need secrets The "test on push but only in forks" logic was only necessary when tests didn't work for PRs-from-forks. * create an embedding_manager for diffusers * internal: avoid importing diffusers DummyObject see https://github.com/huggingface/diffusers/issues/1479 * fix "config attributes…not expected" diffusers warnings. * fix deprecated scheduler construction * work around an apparent MPS torch bug that causes conditioning to have no effect * 🚧 post-rebase repair * preliminary support for outpainting (no masking yet) * monkey-patch diffusers.attention and use Invoke lowvram code * add always_use_cpu arg to bypass MPS * add cross-attention control support to diffusers (fails on MPS) For unknown reasons MPS produces garbage output with .swap(). Use --always_use_cpu arg to invoke.py for now to test this code on MPS. * diffusers support for the inpainting model * fix debug_image to not crash with non-RGB images. * inpainting for the normal model [WIP] This seems to be performing well until the LAST STEP, at which point it dissolves to confetti. * fix off-by-one bug in cross-attention-control (#1774) prompt token sequences begin with a "beginning-of-sequence" marker <bos> and end with a repeated "end-of-sequence" marker <eos> - to make a default prompt length of <bos> + 75 prompt tokens + <eos>. the .swap() code was failing to take the column for <bos> at index 0 into account. the changes here do that, and also add extra handling for a single <eos> (which may be redundant but which is included for completeness). based on my understanding and some assumptions about how this all works, the reason .swap() nevertheless seemed to do the right thing, to some extent, is because over multiple steps the conditioning process in Stable Diffusion operates as a feedback loop. a change to token n-1 has flow-on effects to how the [1x4x64x64] latent tensor is modified by all the tokens after it, - and as the next step is processed, all the tokens before it as well. intuitively, a token's conditioning effects "echo" throughout the whole length of the prompt. so even though the token at n-1 was being edited when what the user actually wanted was to edit the token at n, it nevertheless still had some non-negligible effect, in roughly the right direction, often enough that it seemed like it was working properly. * refactor common CrossAttention stuff into a mixin so that the old ldm code can still work if necessary * inpainting for the normal model. I think it works this time. * diffusers: reset num_vectors_per_token sync with 44a00555718f1df173c60da0ed646cf700e29537 * diffusers: txt2img2img (hires_fix) with so much slicing and dicing of pipeline methods to stitch them together * refactor(diffusers): reduce some code duplication amongst the different tasks * fixup! refactor(diffusers): reduce some code duplication amongst the different tasks * diffusers: enable DPMSolver++ scheduler * diffusers: upgrade to diffusers 0.10, add Heun scheduler * diffusers(ModelCache): stopgap to make from_cpu compatible with diffusers * CI: default to diffusers-1.5 now that runwayml token requirement is gone * diffusers: update to 0.10 (and transformers to 4.25) * diffusers: use xformers when available diffusers no longer auto-enables this as of 0.10.2. * diffusers: make masked img2img behave better with multi-step schedulers re-randomizing the noise each step was confusing them. * diffusers: work more better with more models. fixed relative path problem with local models. fixed models on hub not always having a `fp16` branch. * diffusers: stopgap fix for attention_maps_callback crash after recent merge * fixup import merge conflicts correction for 061c5369a2247c6c92cd69606bcf54c4f1962a0b * test: add tests/inpainting inputs for masked img2img * diffusers(AddsMaskedGuidance): partial fix for k-schedulers Prevents them from crashing, but results are still hot garbage. * fix --safety_checker arg parsing and add note to diffusers loader about where safety checker gets called * generate: fix import error * CI: don't try to read the old init location * diffusers: support loading an alternate VAE * CI: remove sh-syntax if-statement so it doesn't crash powershell * CI: fold strings in yaml because backslash is not line-continuation in powershell * attention maps callback stuff for diffusers * build: fix syntax error in environment-mac * diffusers: add INITIAL_MODELS with diffusers-compatible repos * re-enable the embedding manager; closes #1778 * Squashed commit of the following: commit e4a956abc37fcb5cf188388b76b617bc5c8fda7d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:43:07 2022 +0100 import new load handling from EmbeddingManager and cleanup commit c4abe91a5ba0d415b45bf734068385668b7a66e6 Merge: 032e856e 1efc6397 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:09:53 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers_with_textual_inversion_manager commit 032e856eefb3bbc39534f5daafd25764bcfcef8b Merge: 8b4f0fe9 bc515e24 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:08:01 2022 +0100 Merge remote-tracking branch 'upstream/dev/diffusers' into dev/diffusers_with_textual_inversion_manager commit 1efc6397fc6e61c1aff4b0258b93089d61de5955 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:04:28 2022 +0100 cleanup and add performance notes commit e400f804ac471a0ca2ba432fd658778b20c7bdab Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:45:07 2022 +0100 fix bug and update unit tests commit deb9ae0ae1016750e93ce8275734061f7285a231 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:28:29 2022 +0100 textual inversion manager seems to work commit 162e02505dec777e91a983c4d0fb52e950d25ff0 Merge: cbad4583 12769b3d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:58:03 2022 +0100 Merge branch 'main' into feature_textual_inversion_mgr commit cbad45836c6aace6871a90f2621a953f49433131 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:54:10 2022 +0100 use position embeddings commit 070344c69b0e0db340a183857d0a787b348681d3 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:53:47 2022 +0100 Don't crash CLI on exceptions commit b035ac8c6772dfd9ba41b8eeb9103181cda028f8 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:11:55 2022 +0100 add missing position_embeddings commit 12769b3d3562ef71e0f54946b532ad077e10043c Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:33:25 2022 +0100 debugging why it don't work commit bafb7215eabe1515ca5e8388fd3bb2f3ac5362cf Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:21:33 2022 +0100 debugging why it don't work commit 664a6e9e146b42d96703f0cc8baf8f5efec04ee1 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit 8b4f0fe9d6e4e2643b36dfa27864294785d7ba4e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit ffbe1ab11163ba712e353d89404e301d0e0c6cdf Merge: 6e4dad60 023df37e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:37:31 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers commit 023df37efffa67434f77def7fc3c9dfb29f699fd Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:36:54 2022 +0100 cleanup commit 05fac594eaf79d0058e3c48deee93df603f136c2 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:07:49 2022 +0100 tweak error checking commit 009f32ed39a7280997c3ffab112adadee0b44279 Author: damian <null@damianstewart.com> Date: Thu Dec 15 21:29:47 2022 +0100 unit tests passing for embeddings with vector length >1 commit beb1b08d9a98112ed2fe073580568e1a18698da3 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:39:09 2022 +0100 more explicit equality tests when overwriting commit 44d8a5a7c85cdabc9ce3a54fd0769a10597b3ca9 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:30:13 2022 +0100 wip textual inversion manager (unit tests passing for 1v embedding overwriting) commit 417c2b57d90924a839616bfb66804faab8039e4c Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 12:30:55 2022 +0100 wip textual inversion manager (unit tests passing for base stuff + padding) commit 2e80872e3b6f7fd7d8eb8928822bd824b63cb2ff Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 10:57:57 2022 +0100 wip new TextualInversionManager * stop using WeightedFrozenCLIPEmbedder * store diffusion models locally - configure_invokeai.py reconfigured to store diffusion models rather than CompVis models - hugging face caching model is used, but cache is set to ~/invokeai/models/repo_id - models.yaml does **NOT** use path, just repo_id - "repo_name" changed to "repo_id" to following hugging face conventions - Models are loaded with full precision pending further work. * allow non-local files during development * path takes priority over repo_id * MVP for model_cache and configure_invokeai - Feature complete (almost) - configure_invokeai.py downloads both .ckpt and diffuser models, along with their VAEs. Both types of download are controlled by a unified INITIAL_MODELS.yaml file. - model_cache can load both type of model and switches back and forth in CPU. No memory leaks detected TO DO: 1. I have not yet turned on the LocalOnly flag for diffuser models, so the code will check the Hugging Face repo for updates before using the locally cached models. This will break firewalled systems. I am thinking of putting in a global check for internet connectivity at startup time and setting the LocalOnly flag based on this. It would be good to check updates if there is connectivity. 2. I have not gone completely through INITIAL_MODELS.yaml to check which models are available as diffusers and which are not. So models like PaperCut and VoxelArt may not load properly. The runway and stability models are checked, as well as the Trinart models. 3. Add stanzas for SD 2.0 and 2.1 in INITIAL_MODELS.yaml REMAINING PROBLEMS NOT DIRECTLY RELATED TO MODEL_CACHE: 1. When loading a .ckpt file there are lots of messages like this: Warning! ldm.modules.attention.CrossAttention is no longer being maintained. Please use InvokeAICrossAttention instead. I'm not sure how to address this. 2. The ckpt models ***don't actually run*** due to the lack of special-case support for them in the generator objects. For example, here's the hard crash you get when you run txt2img against the legacy waifu-diffusion-1.3 model: ``` >> An error occurred: Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 140, in main main_loop(gen, opt) File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 371, in main_loop gen.prompt2image( File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1265, in __getattr__ raise AttributeError("'{}' object has no attribute '{}'".format( AttributeError: 'LatentDiffusion' object has no attribute 'image_from_embeddings' ``` 3. The inpainting diffusion model isn't working. Here's the output of "banana sushi" when inpainting-1.5 is loaded: ``` Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 301, in image_from_embeddings result_latents, result_attention_map_saver = self.latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 330, in latents_from_embeddings result: PipelineIntermediateState = infer_latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 185, in __call__ for result in self.generator_method(*args, **kwargs): File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 367, in generate_latents_from_embeddings step_output = self.step(batched_t, latents, guidance_scale, File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context return func(*args, **kwargs) File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 409, in step step_output = self.scheduler.step(noise_pred, timestep, latents, **extra_step_kwargs) File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/diffusers/schedulers/scheduling_lms_discrete.py", line 223, in step pred_original_sample = sample - sigma * model_output RuntimeError: The size of tensor a (9) must match the size of tensor b (4) at non-singleton dimension 1 ``` * proper support for float32/float16 - configure script now correctly detects user's preference for fp16/32 and downloads the correct diffuser version. If fp16 version not available, falls back to fp32 version. - misc code cleanup and simplification in model_cache * add on-the-fly conversion of .ckpt to diffusers models 1. On-the-fly conversion code can be found in the file ldm/invoke/ckpt_to_diffusers.py. 2. A new !optimize command has been added to the CLI. Should be ported to Web GUI. User experience on the CLI is this: ``` invoke> !optimize /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt INFO: Converting legacy weights file /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt to optimized diffuser model. This operation will take 30-60s to complete. Success. Optimized model is now located at /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 Writing new config file entry for sd-v1-4... >> New configuration: sd-v1-4: description: Optimized version of sd-v1-4 format: diffusers path: /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 OK to import [n]? y >> Verifying that new model loads... >> Current VRAM usage: 2.60G >> Offloading stable-diffusion-2.1 to CPU >> Loading diffusers model from /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 | Using faster float16 precision You have disabled the safety checker for <class 'ldm.invoke.generator.diffusers_pipeline.StableDiffusionGeneratorPipeline'> by passing `safety_checker=None`. Ensure that you abide to the conditions of the Stable Diffusion \ license and do not expose unfiltered results in services or applications open to the public. Both the diffusers team and Hugging Face strongly recommend to keep the safety filter enabled in all public facing circumstances,\ disabling it only for use-cases that involve analyzing network behavior or auditing its results. For more information, please have a look at https://github.com/huggingface/diffusers/pull/254 . | training width x height = (512 x 512) >> Model loaded in 3.48s >> Max VRAM used to load the model: 2.17G >> Current VRAM usage:2.17G >> Textual inversions available: >> Setting Sampler to k_lms (LMSDiscreteScheduler) Keep model loaded? [y] ``` * add parallel set of generator files for ckpt legacy generation * generation using legacy ckpt models now working * diffusers: fix missing attention_maps_callback fix for 23eb80b40421b2bb8f4b6d3dd30490d11c447b36 * associate legacy CrossAttention with .ckpt models * enable autoconvert New --autoconvert CLI option will scan a designated directory for new .ckpt files, convert them into diffuser models, and import them into models.yaml. Works like this: invoke.py --autoconvert /path/to/weights/directory In ModelCache added two new methods: autoconvert_weights(config_path, weights_directory_path, models_directory_path) convert_and_import(ckpt_path, diffuser_path) * diffusers: update to diffusers 0.11 (from 0.10.2) * fix vae loading & width/height calculation * refactor: encapsulate these conditioning data into one container * diffusers: fix some noise-scaling issues by pushing the noise-mixing down to the common function * add support for safetensors and accelerate * set local_files_only when internet unreachable * diffusers: fix error-handling path when model repo has no fp16 branch * fix generatorinpaint error Fixes : "ModuleNotFoundError: No module named 'ldm.invoke.generatorinpaint' https://github.com/invoke-ai/InvokeAI/pull/1583#issuecomment-1363634318 * quench diffuser safety-checker warning * diffusers: support stochastic DDIM eta parameter * fix conda env creation on macos * fix cross-attention with diffusers 0.11 * diffusers: the VAE needs to be tiling as well as the U-Net * diffusers: comment on subfolders * diffusers: embiggen! * diffusers: make model_cache.list_models serializable * diffusers(inpaint): restore scaling functionality * fix requirements clash between numba and numpy 1.24 * diffusers: allow inpainting model to do non-inpainting tasks * start expanding model_cache functionality * add import_ckpt_model() and import_diffuser_model() methods to model_manager - in addition, model_cache.py is now renamed to model_manager.py * allow "recommended" flag to be optional in INITIAL_MODELS.yaml * configure_invokeai now downloads VAE diffusers in advance * rename ModelCache to ModelManager * remove support for `repo_name` in models.yaml * check for and refuse to load embeddings trained on incompatible models * models.yaml.example: s/repo_name/repo_id and remove extra INITIAL_MODELS now that the main one has diffusers models in it. * add MVP textual inversion script * refactor(InvokeAIDiffuserComponent): factor out _combine() * InvokeAIDiffuserComponent: implement threshold * InvokeAIDiffuserComponent: diagnostic logs for threshold ...this does not look right * add a curses-based frontend to textual inversion - not quite working yet - requires npyscreen installed - on windows will also have the windows-curses requirement, but not added to requirements yet * add curses-based interface for textual inversion * fix crash in convert_and_import() - This corrects a "local variable referenced before assignment" error in model_manager.convert_and_import() * potential workaround for no 'state_dict' key error - As reported in https://github.com/huggingface/diffusers/issues/1876 * create TI output dir if needed * Update environment-lin-cuda.yml (#2159) Fixing line 42 to be the proper order to define the transformers requirement: ~= instead of =~ * diffusers: update sampler-to-scheduler mapping based on https://github.com/huggingface/diffusers/issues/277#issuecomment-1371428672 * improve user exp for ckt to diffusers conversion - !optimize_models command now operates on an existing ckpt file entry in models.yaml - replaces existing entry, rather than adding a new one - offers to delete the ckpt file after conversion * web: adapt progress callback to deal with old generator or new diffusers pipeline * clean-up model_manager code - add_model() verified to work for .ckpt local paths, .ckpt remote URLs, diffusers local paths, and diffusers repo_ids - convert_and_import() verified to work for local and remove .ckpt files * handle edge cases for import_model() and convert_model() * add support for safetensor .ckpt files * fix name error * code cleanup with pyflake * improve model setting behavior - If the user enters an invalid model name at startup time, will not try to load it, warn, and use default model - CLI UI enhancement: include currently active model in the command line prompt. * update test-invoke-pip.yml - fix model cache path to point to runwayml/stable-diffusion-v1-5 - remove `skip-sd-weights` from configure_invokeai.py args * exclude dev/diffusers from "fail for draft PRs" * disable "fail on PR jobs" * re-add `--skip-sd-weights` since no space * update workflow environments - include `INVOKE_MODEL_RECONFIGURE: '--yes'` * clean up model load failure handling - Allow CLI to run even when no model is defined or loadable. - Inhibit stack trace when model load fails - only show last error - Give user *option* to run configure_invokeai.py when no models successfully load. - Restart invokeai after reconfiguration. * further edge-case handling 1) only one model in models.yaml file, and that model is broken 2) no models in models.yaml 3) models.yaml doesn't exist at all * fix incorrect model status listing - "cached" was not being returned from list_models() - normalize handling of exceptions during model loading: - Passing an invalid model name to generate.set_model() will return a KeyError - All other exceptions are returned as the appropriate Exception * CI: do download weights (if not already cached) * diffusers: fix scheduler loading in offline mode * CI: fix model name (no longer has `diffusers-` prefix) * Update txt2img2img.py (#2256) * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * feat - make model storage compatible with hugging face caching system This commit alters the InvokeAI model directory to be compatible with hugging face, making it easier to share diffusers (and other models) across different programs. - If the HF_HOME environment variable is not set, then models are cached in ~/invokeai/models in a format that is identical to the HuggingFace cache. - If HF_HOME is set, then models are cached wherever HF_HOME points. - To enable sharing with other HuggingFace library clients, set HF_HOME to ~/.cache/huggingface to set the default cache location or to ~/invokeai/models to have huggingface cache inside InvokeAI. * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * fix error "no attribute CkptInpaint" * model_manager.list_models() returns entire model config stanza+status * Initial Draft - Model Manager Diffusers * added hash function to diffusers * implement sha256 hashes on diffusers models * Add Model Manager Support for Diffusers * fix various problems with model manager - in cli import functions, fix not enough values to unpack from _get_name_and_desc() - fix crash when using old-style vae: value with new-style diffuser * rebuild frontend * fix dictconfig-not-serializable issue * fix NoneType' object is not subscriptable crash in model_manager * fix "str has no attribute get" error in model_manager list_models() * Add path and repo_id support for Diffusers Model Manager Also fixes bugs * Fix tooltip IT localization not working * Add Version Number To WebUI * Optimize Model Search * Fix incorrect font on the Model Manager UI * Fix image degradation on merge fixes - [Experimental] This change should effectively fix a couple of things. - Fix image degradation on subsequent merges of the canvas layers. - Fix the slight transparent border that is left behind when filling the bounding box with a color. - Fix the left over line of color when filling a bounding box with color. So far there are no side effects for this. If any, please report. * Add local model filtering for Diffusers / Checkpoints * Go to home on modal close for the Add Modal UI * Styling Fixes * Model Manager Diffusers Localization Update * Add Safe Tensor scanning to Model Manager * Fix model edit form dispatching string values instead of numbers. * Resolve VAE handling / edge cases for supplied repos * defer injecting tokens for textual inversions until they're used for the first time * squash a console warning * implement model migration check * add_model() overwrites previous config rather than merges * fix model config file attribute merging * fix precision handling in textual inversion script * allow ckpt conversion script to work with safetensors .ckpts Applied patch here: https://github.com/huggingface/diffusers/commit/beb932c5d111872c5e45387e7b1b2b3dd0524a47 * fix name "args" is not defined crash in textual_inversion_training * fix a second NameError: name 'args' is not defined crash * fix loading of the safety checker from the global cache dir * add installation step to textual inversion frontend - After a successful training run, the script will copy learned_embeds.bin to a subfolder of the embeddings directory. - User given the option to delete the logs and intermediate checkpoints (which together use 7-8G of space) - If textual inversion training fails, reports the error gracefully. * don't crash out on incompatible embeddings - put try: blocks around places where the system tries to load an embedding which is incompatible with the currently loaded model * add support for checkpoint resuming * textual inversion preferences are saved and restored between sessions - Preferences are stored in a file named text-inversion-training/preferences.conf - Currently the resume-from-checkpoint option is not working correctly. Possible bug in textual_inversion_training.py? * copy learned_embeddings.bin into right location * add front end for diffusers model merging - Front end doesn't do anything yet!!!! - Made change to model name parsing in CLI to support ability to have merged models with the "+" character in their names. * improve inpainting experience - recommend ckpt version of inpainting-1.5 to user - fix get_noise() bug in ckpt version of omnibus.py * update environment*yml * tweak instructions to install HuggingFace token * bump version number * enhance update scripts - update scripts will now fetch new INITIAL_MODELS.yaml so that configure_invokeai.py will know about the diffusers versions. * enhance invoke.sh/invoke.bat launchers - added configure_invokeai.py to menu - menu defaults to browser-based invoke * remove conda workflow (#2321) * fix `token_ids has shape torch.Size([79]) - expected [77]` * update CHANGELOG.md with 2.3.* info - Add information on how formats have changed and the upgrade process. - Add short bug list. Co-authored-by: Damian Stewart <d@damianstewart.com> Co-authored-by: Damian Stewart <null@damianstewart.com> Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> Co-authored-by: Wybartel-luxmc <37852506+Wybartel-luxmc@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> Co-authored-by: mickr777 <115216705+mickr777@users.noreply.github.com> Co-authored-by: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Co-authored-by: Eugene Brodsky <ebr@users.noreply.github.com> Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com>
2023-01-15 14:22:46 +00:00
import gc
import importlib
Refactoring simplet2i (#387) * start refactoring -not yet functional * first phase of refactor done - not sure weighted prompts working * Second phase of refactoring. Everything mostly working. * The refactoring has moved all the hard-core inference work into ldm.dream.generator.*, where there are submodules for txt2img and img2img. inpaint will go in there as well. * Some additional refactoring will be done soon, but relatively minor work. * fix -save_orig flag to actually work * add @neonsecret attention.py memory optimization * remove unneeded imports * move token logging into conditioning.py * add placeholder version of inpaint; porting in progress * fix crash in img2img * inpainting working; not tested on variations * fix crashes in img2img * ported attention.py memory optimization #117 from basujindal branch * added @torch_no_grad() decorators to img2img, txt2img, inpaint closures * Final commit prior to PR against development * fixup crash when generating intermediate images in web UI * rename ldm.simplet2i to ldm.generate * add backward-compatibility simplet2i shell with deprecation warning * add back in mps exception, addresses @vargol comment in #354 * replaced Conditioning class with exported functions * fix wrong type of with_variations attribute during intialization * changed "image_iterator()" to "get_make_image()" * raise NotImplementedError for calling get_make_image() in parent class * Update ldm/generate.py better error message Co-authored-by: Kevin Gibbons <bakkot@gmail.com> * minor stylistic fixes and assertion checks from code review * moved get_noise() method into img2img class * break get_noise() into two methods, one for txt2img and the other for img2img * inpainting works on non-square images now * make get_noise() an abstract method in base class * much improved inpainting Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
2022-09-06 00:40:10 +00:00
import os
use 🧨diffusers model (#1583) * initial commit of DiffusionPipeline class * spike: proof of concept using diffusers for txt2img * doc: type hints for Generator * refactor(model_cache): factor out load_ckpt * model_cache: add ability to load a diffusers model pipeline and update associated things in Generate & Generator to not instantly fail when that happens * model_cache: fix model default image dimensions * txt2img: support switching diffusers schedulers * diffusers: let the scheduler do its scaling of the initial latents Remove IPNDM scheduler; it is not behaving. * web server: update image_progress callback for diffusers data * diffusers: restore prompt weighting feature * diffusers: fix set-sampler error following model switch * diffusers: use InvokeAIDiffuserComponent for conditioning * cross_attention_control: stub (no-op) implementations for diffusers * model_cache: let offload_model work with DiffusionPipeline, sorta. * models.yaml.example: add diffusers-format model, set as default * test-invoke-conda: use diffusers-format model test-invoke-conda: put huggingface-token where the library can use it * environment-mac: upgrade to diffusers 0.7 (from 0.6) this was already done for linux; mac must have been lost in the merge. * preload_models: explicitly load diffusers models In non-interactive mode too, as long as you're logged in. * fix(model_cache): don't check `model.config` in diffusers format clean-up from recent merge. * diffusers integration: support img2img * dev: upgrade to diffusers 0.8 (from 0.7.1) We get to remove some code by using methods that were factored out in the base class. * refactor: remove backported img2img.get_timesteps now that we can use it directly from diffusers 0.8.1 * ci: use diffusers model * dev: upgrade to diffusers 0.9 (from 0.8.1) * lint: correct annotations for Python 3.9. * lint: correct AttributeError.name reference for Python 3.9. * CI: prefer diffusers-1.4 because it no longer requires a token The RunwayML models still do. * build: there's yet another place to update requirements? * configure: try to download models even without token Models in the CompVis and stabilityai repos no longer require them. (But runwayml still does.) * configure: add troubleshooting info for config-not-found * fix(configure): prepend root to config path * fix(configure): remove second `default: true` from models example * CI: simplify test-on-push logic now that we don't need secrets The "test on push but only in forks" logic was only necessary when tests didn't work for PRs-from-forks. * create an embedding_manager for diffusers * internal: avoid importing diffusers DummyObject see https://github.com/huggingface/diffusers/issues/1479 * fix "config attributes…not expected" diffusers warnings. * fix deprecated scheduler construction * work around an apparent MPS torch bug that causes conditioning to have no effect * 🚧 post-rebase repair * preliminary support for outpainting (no masking yet) * monkey-patch diffusers.attention and use Invoke lowvram code * add always_use_cpu arg to bypass MPS * add cross-attention control support to diffusers (fails on MPS) For unknown reasons MPS produces garbage output with .swap(). Use --always_use_cpu arg to invoke.py for now to test this code on MPS. * diffusers support for the inpainting model * fix debug_image to not crash with non-RGB images. * inpainting for the normal model [WIP] This seems to be performing well until the LAST STEP, at which point it dissolves to confetti. * fix off-by-one bug in cross-attention-control (#1774) prompt token sequences begin with a "beginning-of-sequence" marker <bos> and end with a repeated "end-of-sequence" marker <eos> - to make a default prompt length of <bos> + 75 prompt tokens + <eos>. the .swap() code was failing to take the column for <bos> at index 0 into account. the changes here do that, and also add extra handling for a single <eos> (which may be redundant but which is included for completeness). based on my understanding and some assumptions about how this all works, the reason .swap() nevertheless seemed to do the right thing, to some extent, is because over multiple steps the conditioning process in Stable Diffusion operates as a feedback loop. a change to token n-1 has flow-on effects to how the [1x4x64x64] latent tensor is modified by all the tokens after it, - and as the next step is processed, all the tokens before it as well. intuitively, a token's conditioning effects "echo" throughout the whole length of the prompt. so even though the token at n-1 was being edited when what the user actually wanted was to edit the token at n, it nevertheless still had some non-negligible effect, in roughly the right direction, often enough that it seemed like it was working properly. * refactor common CrossAttention stuff into a mixin so that the old ldm code can still work if necessary * inpainting for the normal model. I think it works this time. * diffusers: reset num_vectors_per_token sync with 44a00555718f1df173c60da0ed646cf700e29537 * diffusers: txt2img2img (hires_fix) with so much slicing and dicing of pipeline methods to stitch them together * refactor(diffusers): reduce some code duplication amongst the different tasks * fixup! refactor(diffusers): reduce some code duplication amongst the different tasks * diffusers: enable DPMSolver++ scheduler * diffusers: upgrade to diffusers 0.10, add Heun scheduler * diffusers(ModelCache): stopgap to make from_cpu compatible with diffusers * CI: default to diffusers-1.5 now that runwayml token requirement is gone * diffusers: update to 0.10 (and transformers to 4.25) * diffusers: use xformers when available diffusers no longer auto-enables this as of 0.10.2. * diffusers: make masked img2img behave better with multi-step schedulers re-randomizing the noise each step was confusing them. * diffusers: work more better with more models. fixed relative path problem with local models. fixed models on hub not always having a `fp16` branch. * diffusers: stopgap fix for attention_maps_callback crash after recent merge * fixup import merge conflicts correction for 061c5369a2247c6c92cd69606bcf54c4f1962a0b * test: add tests/inpainting inputs for masked img2img * diffusers(AddsMaskedGuidance): partial fix for k-schedulers Prevents them from crashing, but results are still hot garbage. * fix --safety_checker arg parsing and add note to diffusers loader about where safety checker gets called * generate: fix import error * CI: don't try to read the old init location * diffusers: support loading an alternate VAE * CI: remove sh-syntax if-statement so it doesn't crash powershell * CI: fold strings in yaml because backslash is not line-continuation in powershell * attention maps callback stuff for diffusers * build: fix syntax error in environment-mac * diffusers: add INITIAL_MODELS with diffusers-compatible repos * re-enable the embedding manager; closes #1778 * Squashed commit of the following: commit e4a956abc37fcb5cf188388b76b617bc5c8fda7d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:43:07 2022 +0100 import new load handling from EmbeddingManager and cleanup commit c4abe91a5ba0d415b45bf734068385668b7a66e6 Merge: 032e856e 1efc6397 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:09:53 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers_with_textual_inversion_manager commit 032e856eefb3bbc39534f5daafd25764bcfcef8b Merge: 8b4f0fe9 bc515e24 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:08:01 2022 +0100 Merge remote-tracking branch 'upstream/dev/diffusers' into dev/diffusers_with_textual_inversion_manager commit 1efc6397fc6e61c1aff4b0258b93089d61de5955 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:04:28 2022 +0100 cleanup and add performance notes commit e400f804ac471a0ca2ba432fd658778b20c7bdab Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:45:07 2022 +0100 fix bug and update unit tests commit deb9ae0ae1016750e93ce8275734061f7285a231 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:28:29 2022 +0100 textual inversion manager seems to work commit 162e02505dec777e91a983c4d0fb52e950d25ff0 Merge: cbad4583 12769b3d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:58:03 2022 +0100 Merge branch 'main' into feature_textual_inversion_mgr commit cbad45836c6aace6871a90f2621a953f49433131 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:54:10 2022 +0100 use position embeddings commit 070344c69b0e0db340a183857d0a787b348681d3 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:53:47 2022 +0100 Don't crash CLI on exceptions commit b035ac8c6772dfd9ba41b8eeb9103181cda028f8 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:11:55 2022 +0100 add missing position_embeddings commit 12769b3d3562ef71e0f54946b532ad077e10043c Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:33:25 2022 +0100 debugging why it don't work commit bafb7215eabe1515ca5e8388fd3bb2f3ac5362cf Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:21:33 2022 +0100 debugging why it don't work commit 664a6e9e146b42d96703f0cc8baf8f5efec04ee1 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit 8b4f0fe9d6e4e2643b36dfa27864294785d7ba4e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit ffbe1ab11163ba712e353d89404e301d0e0c6cdf Merge: 6e4dad60 023df37e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:37:31 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers commit 023df37efffa67434f77def7fc3c9dfb29f699fd Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:36:54 2022 +0100 cleanup commit 05fac594eaf79d0058e3c48deee93df603f136c2 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:07:49 2022 +0100 tweak error checking commit 009f32ed39a7280997c3ffab112adadee0b44279 Author: damian <null@damianstewart.com> Date: Thu Dec 15 21:29:47 2022 +0100 unit tests passing for embeddings with vector length >1 commit beb1b08d9a98112ed2fe073580568e1a18698da3 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:39:09 2022 +0100 more explicit equality tests when overwriting commit 44d8a5a7c85cdabc9ce3a54fd0769a10597b3ca9 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:30:13 2022 +0100 wip textual inversion manager (unit tests passing for 1v embedding overwriting) commit 417c2b57d90924a839616bfb66804faab8039e4c Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 12:30:55 2022 +0100 wip textual inversion manager (unit tests passing for base stuff + padding) commit 2e80872e3b6f7fd7d8eb8928822bd824b63cb2ff Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 10:57:57 2022 +0100 wip new TextualInversionManager * stop using WeightedFrozenCLIPEmbedder * store diffusion models locally - configure_invokeai.py reconfigured to store diffusion models rather than CompVis models - hugging face caching model is used, but cache is set to ~/invokeai/models/repo_id - models.yaml does **NOT** use path, just repo_id - "repo_name" changed to "repo_id" to following hugging face conventions - Models are loaded with full precision pending further work. * allow non-local files during development * path takes priority over repo_id * MVP for model_cache and configure_invokeai - Feature complete (almost) - configure_invokeai.py downloads both .ckpt and diffuser models, along with their VAEs. Both types of download are controlled by a unified INITIAL_MODELS.yaml file. - model_cache can load both type of model and switches back and forth in CPU. No memory leaks detected TO DO: 1. I have not yet turned on the LocalOnly flag for diffuser models, so the code will check the Hugging Face repo for updates before using the locally cached models. This will break firewalled systems. I am thinking of putting in a global check for internet connectivity at startup time and setting the LocalOnly flag based on this. It would be good to check updates if there is connectivity. 2. I have not gone completely through INITIAL_MODELS.yaml to check which models are available as diffusers and which are not. So models like PaperCut and VoxelArt may not load properly. The runway and stability models are checked, as well as the Trinart models. 3. Add stanzas for SD 2.0 and 2.1 in INITIAL_MODELS.yaml REMAINING PROBLEMS NOT DIRECTLY RELATED TO MODEL_CACHE: 1. When loading a .ckpt file there are lots of messages like this: Warning! ldm.modules.attention.CrossAttention is no longer being maintained. Please use InvokeAICrossAttention instead. I'm not sure how to address this. 2. The ckpt models ***don't actually run*** due to the lack of special-case support for them in the generator objects. For example, here's the hard crash you get when you run txt2img against the legacy waifu-diffusion-1.3 model: ``` >> An error occurred: Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 140, in main main_loop(gen, opt) File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 371, in main_loop gen.prompt2image( File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1265, in __getattr__ raise AttributeError("'{}' object has no attribute '{}'".format( AttributeError: 'LatentDiffusion' object has no attribute 'image_from_embeddings' ``` 3. The inpainting diffusion model isn't working. Here's the output of "banana sushi" when inpainting-1.5 is loaded: ``` Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 301, in image_from_embeddings result_latents, result_attention_map_saver = self.latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 330, in latents_from_embeddings result: PipelineIntermediateState = infer_latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 185, in __call__ for result in self.generator_method(*args, **kwargs): File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 367, in generate_latents_from_embeddings step_output = self.step(batched_t, latents, guidance_scale, File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context return func(*args, **kwargs) File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 409, in step step_output = self.scheduler.step(noise_pred, timestep, latents, **extra_step_kwargs) File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/diffusers/schedulers/scheduling_lms_discrete.py", line 223, in step pred_original_sample = sample - sigma * model_output RuntimeError: The size of tensor a (9) must match the size of tensor b (4) at non-singleton dimension 1 ``` * proper support for float32/float16 - configure script now correctly detects user's preference for fp16/32 and downloads the correct diffuser version. If fp16 version not available, falls back to fp32 version. - misc code cleanup and simplification in model_cache * add on-the-fly conversion of .ckpt to diffusers models 1. On-the-fly conversion code can be found in the file ldm/invoke/ckpt_to_diffusers.py. 2. A new !optimize command has been added to the CLI. Should be ported to Web GUI. User experience on the CLI is this: ``` invoke> !optimize /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt INFO: Converting legacy weights file /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt to optimized diffuser model. This operation will take 30-60s to complete. Success. Optimized model is now located at /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 Writing new config file entry for sd-v1-4... >> New configuration: sd-v1-4: description: Optimized version of sd-v1-4 format: diffusers path: /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 OK to import [n]? y >> Verifying that new model loads... >> Current VRAM usage: 2.60G >> Offloading stable-diffusion-2.1 to CPU >> Loading diffusers model from /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 | Using faster float16 precision You have disabled the safety checker for <class 'ldm.invoke.generator.diffusers_pipeline.StableDiffusionGeneratorPipeline'> by passing `safety_checker=None`. Ensure that you abide to the conditions of the Stable Diffusion \ license and do not expose unfiltered results in services or applications open to the public. Both the diffusers team and Hugging Face strongly recommend to keep the safety filter enabled in all public facing circumstances,\ disabling it only for use-cases that involve analyzing network behavior or auditing its results. For more information, please have a look at https://github.com/huggingface/diffusers/pull/254 . | training width x height = (512 x 512) >> Model loaded in 3.48s >> Max VRAM used to load the model: 2.17G >> Current VRAM usage:2.17G >> Textual inversions available: >> Setting Sampler to k_lms (LMSDiscreteScheduler) Keep model loaded? [y] ``` * add parallel set of generator files for ckpt legacy generation * generation using legacy ckpt models now working * diffusers: fix missing attention_maps_callback fix for 23eb80b40421b2bb8f4b6d3dd30490d11c447b36 * associate legacy CrossAttention with .ckpt models * enable autoconvert New --autoconvert CLI option will scan a designated directory for new .ckpt files, convert them into diffuser models, and import them into models.yaml. Works like this: invoke.py --autoconvert /path/to/weights/directory In ModelCache added two new methods: autoconvert_weights(config_path, weights_directory_path, models_directory_path) convert_and_import(ckpt_path, diffuser_path) * diffusers: update to diffusers 0.11 (from 0.10.2) * fix vae loading & width/height calculation * refactor: encapsulate these conditioning data into one container * diffusers: fix some noise-scaling issues by pushing the noise-mixing down to the common function * add support for safetensors and accelerate * set local_files_only when internet unreachable * diffusers: fix error-handling path when model repo has no fp16 branch * fix generatorinpaint error Fixes : "ModuleNotFoundError: No module named 'ldm.invoke.generatorinpaint' https://github.com/invoke-ai/InvokeAI/pull/1583#issuecomment-1363634318 * quench diffuser safety-checker warning * diffusers: support stochastic DDIM eta parameter * fix conda env creation on macos * fix cross-attention with diffusers 0.11 * diffusers: the VAE needs to be tiling as well as the U-Net * diffusers: comment on subfolders * diffusers: embiggen! * diffusers: make model_cache.list_models serializable * diffusers(inpaint): restore scaling functionality * fix requirements clash between numba and numpy 1.24 * diffusers: allow inpainting model to do non-inpainting tasks * start expanding model_cache functionality * add import_ckpt_model() and import_diffuser_model() methods to model_manager - in addition, model_cache.py is now renamed to model_manager.py * allow "recommended" flag to be optional in INITIAL_MODELS.yaml * configure_invokeai now downloads VAE diffusers in advance * rename ModelCache to ModelManager * remove support for `repo_name` in models.yaml * check for and refuse to load embeddings trained on incompatible models * models.yaml.example: s/repo_name/repo_id and remove extra INITIAL_MODELS now that the main one has diffusers models in it. * add MVP textual inversion script * refactor(InvokeAIDiffuserComponent): factor out _combine() * InvokeAIDiffuserComponent: implement threshold * InvokeAIDiffuserComponent: diagnostic logs for threshold ...this does not look right * add a curses-based frontend to textual inversion - not quite working yet - requires npyscreen installed - on windows will also have the windows-curses requirement, but not added to requirements yet * add curses-based interface for textual inversion * fix crash in convert_and_import() - This corrects a "local variable referenced before assignment" error in model_manager.convert_and_import() * potential workaround for no 'state_dict' key error - As reported in https://github.com/huggingface/diffusers/issues/1876 * create TI output dir if needed * Update environment-lin-cuda.yml (#2159) Fixing line 42 to be the proper order to define the transformers requirement: ~= instead of =~ * diffusers: update sampler-to-scheduler mapping based on https://github.com/huggingface/diffusers/issues/277#issuecomment-1371428672 * improve user exp for ckt to diffusers conversion - !optimize_models command now operates on an existing ckpt file entry in models.yaml - replaces existing entry, rather than adding a new one - offers to delete the ckpt file after conversion * web: adapt progress callback to deal with old generator or new diffusers pipeline * clean-up model_manager code - add_model() verified to work for .ckpt local paths, .ckpt remote URLs, diffusers local paths, and diffusers repo_ids - convert_and_import() verified to work for local and remove .ckpt files * handle edge cases for import_model() and convert_model() * add support for safetensor .ckpt files * fix name error * code cleanup with pyflake * improve model setting behavior - If the user enters an invalid model name at startup time, will not try to load it, warn, and use default model - CLI UI enhancement: include currently active model in the command line prompt. * update test-invoke-pip.yml - fix model cache path to point to runwayml/stable-diffusion-v1-5 - remove `skip-sd-weights` from configure_invokeai.py args * exclude dev/diffusers from "fail for draft PRs" * disable "fail on PR jobs" * re-add `--skip-sd-weights` since no space * update workflow environments - include `INVOKE_MODEL_RECONFIGURE: '--yes'` * clean up model load failure handling - Allow CLI to run even when no model is defined or loadable. - Inhibit stack trace when model load fails - only show last error - Give user *option* to run configure_invokeai.py when no models successfully load. - Restart invokeai after reconfiguration. * further edge-case handling 1) only one model in models.yaml file, and that model is broken 2) no models in models.yaml 3) models.yaml doesn't exist at all * fix incorrect model status listing - "cached" was not being returned from list_models() - normalize handling of exceptions during model loading: - Passing an invalid model name to generate.set_model() will return a KeyError - All other exceptions are returned as the appropriate Exception * CI: do download weights (if not already cached) * diffusers: fix scheduler loading in offline mode * CI: fix model name (no longer has `diffusers-` prefix) * Update txt2img2img.py (#2256) * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * feat - make model storage compatible with hugging face caching system This commit alters the InvokeAI model directory to be compatible with hugging face, making it easier to share diffusers (and other models) across different programs. - If the HF_HOME environment variable is not set, then models are cached in ~/invokeai/models in a format that is identical to the HuggingFace cache. - If HF_HOME is set, then models are cached wherever HF_HOME points. - To enable sharing with other HuggingFace library clients, set HF_HOME to ~/.cache/huggingface to set the default cache location or to ~/invokeai/models to have huggingface cache inside InvokeAI. * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * fix error "no attribute CkptInpaint" * model_manager.list_models() returns entire model config stanza+status * Initial Draft - Model Manager Diffusers * added hash function to diffusers * implement sha256 hashes on diffusers models * Add Model Manager Support for Diffusers * fix various problems with model manager - in cli import functions, fix not enough values to unpack from _get_name_and_desc() - fix crash when using old-style vae: value with new-style diffuser * rebuild frontend * fix dictconfig-not-serializable issue * fix NoneType' object is not subscriptable crash in model_manager * fix "str has no attribute get" error in model_manager list_models() * Add path and repo_id support for Diffusers Model Manager Also fixes bugs * Fix tooltip IT localization not working * Add Version Number To WebUI * Optimize Model Search * Fix incorrect font on the Model Manager UI * Fix image degradation on merge fixes - [Experimental] This change should effectively fix a couple of things. - Fix image degradation on subsequent merges of the canvas layers. - Fix the slight transparent border that is left behind when filling the bounding box with a color. - Fix the left over line of color when filling a bounding box with color. So far there are no side effects for this. If any, please report. * Add local model filtering for Diffusers / Checkpoints * Go to home on modal close for the Add Modal UI * Styling Fixes * Model Manager Diffusers Localization Update * Add Safe Tensor scanning to Model Manager * Fix model edit form dispatching string values instead of numbers. * Resolve VAE handling / edge cases for supplied repos * defer injecting tokens for textual inversions until they're used for the first time * squash a console warning * implement model migration check * add_model() overwrites previous config rather than merges * fix model config file attribute merging * fix precision handling in textual inversion script * allow ckpt conversion script to work with safetensors .ckpts Applied patch here: https://github.com/huggingface/diffusers/commit/beb932c5d111872c5e45387e7b1b2b3dd0524a47 * fix name "args" is not defined crash in textual_inversion_training * fix a second NameError: name 'args' is not defined crash * fix loading of the safety checker from the global cache dir * add installation step to textual inversion frontend - After a successful training run, the script will copy learned_embeds.bin to a subfolder of the embeddings directory. - User given the option to delete the logs and intermediate checkpoints (which together use 7-8G of space) - If textual inversion training fails, reports the error gracefully. * don't crash out on incompatible embeddings - put try: blocks around places where the system tries to load an embedding which is incompatible with the currently loaded model * add support for checkpoint resuming * textual inversion preferences are saved and restored between sessions - Preferences are stored in a file named text-inversion-training/preferences.conf - Currently the resume-from-checkpoint option is not working correctly. Possible bug in textual_inversion_training.py? * copy learned_embeddings.bin into right location * add front end for diffusers model merging - Front end doesn't do anything yet!!!! - Made change to model name parsing in CLI to support ability to have merged models with the "+" character in their names. * improve inpainting experience - recommend ckpt version of inpainting-1.5 to user - fix get_noise() bug in ckpt version of omnibus.py * update environment*yml * tweak instructions to install HuggingFace token * bump version number * enhance update scripts - update scripts will now fetch new INITIAL_MODELS.yaml so that configure_invokeai.py will know about the diffusers versions. * enhance invoke.sh/invoke.bat launchers - added configure_invokeai.py to menu - menu defaults to browser-based invoke * remove conda workflow (#2321) * fix `token_ids has shape torch.Size([79]) - expected [77]` * update CHANGELOG.md with 2.3.* info - Add information on how formats have changed and the upgrade process. - Add short bug list. Co-authored-by: Damian Stewart <d@damianstewart.com> Co-authored-by: Damian Stewart <null@damianstewart.com> Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> Co-authored-by: Wybartel-luxmc <37852506+Wybartel-luxmc@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> Co-authored-by: mickr777 <115216705+mickr777@users.noreply.github.com> Co-authored-by: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Co-authored-by: Eugene Brodsky <ebr@users.noreply.github.com> Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com>
2023-01-15 14:22:46 +00:00
import random
Refactoring simplet2i (#387) * start refactoring -not yet functional * first phase of refactor done - not sure weighted prompts working * Second phase of refactoring. Everything mostly working. * The refactoring has moved all the hard-core inference work into ldm.dream.generator.*, where there are submodules for txt2img and img2img. inpaint will go in there as well. * Some additional refactoring will be done soon, but relatively minor work. * fix -save_orig flag to actually work * add @neonsecret attention.py memory optimization * remove unneeded imports * move token logging into conditioning.py * add placeholder version of inpaint; porting in progress * fix crash in img2img * inpainting working; not tested on variations * fix crashes in img2img * ported attention.py memory optimization #117 from basujindal branch * added @torch_no_grad() decorators to img2img, txt2img, inpaint closures * Final commit prior to PR against development * fixup crash when generating intermediate images in web UI * rename ldm.simplet2i to ldm.generate * add backward-compatibility simplet2i shell with deprecation warning * add back in mps exception, addresses @vargol comment in #354 * replaced Conditioning class with exported functions * fix wrong type of with_variations attribute during intialization * changed "image_iterator()" to "get_make_image()" * raise NotImplementedError for calling get_make_image() in parent class * Update ldm/generate.py better error message Co-authored-by: Kevin Gibbons <bakkot@gmail.com> * minor stylistic fixes and assertion checks from code review * moved get_noise() method into img2img class * break get_noise() into two methods, one for txt2img and the other for img2img * inpainting works on non-square images now * make get_noise() an abstract method in base class * much improved inpainting Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
2022-09-06 00:40:10 +00:00
import re
import sys
use 🧨diffusers model (#1583) * initial commit of DiffusionPipeline class * spike: proof of concept using diffusers for txt2img * doc: type hints for Generator * refactor(model_cache): factor out load_ckpt * model_cache: add ability to load a diffusers model pipeline and update associated things in Generate & Generator to not instantly fail when that happens * model_cache: fix model default image dimensions * txt2img: support switching diffusers schedulers * diffusers: let the scheduler do its scaling of the initial latents Remove IPNDM scheduler; it is not behaving. * web server: update image_progress callback for diffusers data * diffusers: restore prompt weighting feature * diffusers: fix set-sampler error following model switch * diffusers: use InvokeAIDiffuserComponent for conditioning * cross_attention_control: stub (no-op) implementations for diffusers * model_cache: let offload_model work with DiffusionPipeline, sorta. * models.yaml.example: add diffusers-format model, set as default * test-invoke-conda: use diffusers-format model test-invoke-conda: put huggingface-token where the library can use it * environment-mac: upgrade to diffusers 0.7 (from 0.6) this was already done for linux; mac must have been lost in the merge. * preload_models: explicitly load diffusers models In non-interactive mode too, as long as you're logged in. * fix(model_cache): don't check `model.config` in diffusers format clean-up from recent merge. * diffusers integration: support img2img * dev: upgrade to diffusers 0.8 (from 0.7.1) We get to remove some code by using methods that were factored out in the base class. * refactor: remove backported img2img.get_timesteps now that we can use it directly from diffusers 0.8.1 * ci: use diffusers model * dev: upgrade to diffusers 0.9 (from 0.8.1) * lint: correct annotations for Python 3.9. * lint: correct AttributeError.name reference for Python 3.9. * CI: prefer diffusers-1.4 because it no longer requires a token The RunwayML models still do. * build: there's yet another place to update requirements? * configure: try to download models even without token Models in the CompVis and stabilityai repos no longer require them. (But runwayml still does.) * configure: add troubleshooting info for config-not-found * fix(configure): prepend root to config path * fix(configure): remove second `default: true` from models example * CI: simplify test-on-push logic now that we don't need secrets The "test on push but only in forks" logic was only necessary when tests didn't work for PRs-from-forks. * create an embedding_manager for diffusers * internal: avoid importing diffusers DummyObject see https://github.com/huggingface/diffusers/issues/1479 * fix "config attributes…not expected" diffusers warnings. * fix deprecated scheduler construction * work around an apparent MPS torch bug that causes conditioning to have no effect * 🚧 post-rebase repair * preliminary support for outpainting (no masking yet) * monkey-patch diffusers.attention and use Invoke lowvram code * add always_use_cpu arg to bypass MPS * add cross-attention control support to diffusers (fails on MPS) For unknown reasons MPS produces garbage output with .swap(). Use --always_use_cpu arg to invoke.py for now to test this code on MPS. * diffusers support for the inpainting model * fix debug_image to not crash with non-RGB images. * inpainting for the normal model [WIP] This seems to be performing well until the LAST STEP, at which point it dissolves to confetti. * fix off-by-one bug in cross-attention-control (#1774) prompt token sequences begin with a "beginning-of-sequence" marker <bos> and end with a repeated "end-of-sequence" marker <eos> - to make a default prompt length of <bos> + 75 prompt tokens + <eos>. the .swap() code was failing to take the column for <bos> at index 0 into account. the changes here do that, and also add extra handling for a single <eos> (which may be redundant but which is included for completeness). based on my understanding and some assumptions about how this all works, the reason .swap() nevertheless seemed to do the right thing, to some extent, is because over multiple steps the conditioning process in Stable Diffusion operates as a feedback loop. a change to token n-1 has flow-on effects to how the [1x4x64x64] latent tensor is modified by all the tokens after it, - and as the next step is processed, all the tokens before it as well. intuitively, a token's conditioning effects "echo" throughout the whole length of the prompt. so even though the token at n-1 was being edited when what the user actually wanted was to edit the token at n, it nevertheless still had some non-negligible effect, in roughly the right direction, often enough that it seemed like it was working properly. * refactor common CrossAttention stuff into a mixin so that the old ldm code can still work if necessary * inpainting for the normal model. I think it works this time. * diffusers: reset num_vectors_per_token sync with 44a00555718f1df173c60da0ed646cf700e29537 * diffusers: txt2img2img (hires_fix) with so much slicing and dicing of pipeline methods to stitch them together * refactor(diffusers): reduce some code duplication amongst the different tasks * fixup! refactor(diffusers): reduce some code duplication amongst the different tasks * diffusers: enable DPMSolver++ scheduler * diffusers: upgrade to diffusers 0.10, add Heun scheduler * diffusers(ModelCache): stopgap to make from_cpu compatible with diffusers * CI: default to diffusers-1.5 now that runwayml token requirement is gone * diffusers: update to 0.10 (and transformers to 4.25) * diffusers: use xformers when available diffusers no longer auto-enables this as of 0.10.2. * diffusers: make masked img2img behave better with multi-step schedulers re-randomizing the noise each step was confusing them. * diffusers: work more better with more models. fixed relative path problem with local models. fixed models on hub not always having a `fp16` branch. * diffusers: stopgap fix for attention_maps_callback crash after recent merge * fixup import merge conflicts correction for 061c5369a2247c6c92cd69606bcf54c4f1962a0b * test: add tests/inpainting inputs for masked img2img * diffusers(AddsMaskedGuidance): partial fix for k-schedulers Prevents them from crashing, but results are still hot garbage. * fix --safety_checker arg parsing and add note to diffusers loader about where safety checker gets called * generate: fix import error * CI: don't try to read the old init location * diffusers: support loading an alternate VAE * CI: remove sh-syntax if-statement so it doesn't crash powershell * CI: fold strings in yaml because backslash is not line-continuation in powershell * attention maps callback stuff for diffusers * build: fix syntax error in environment-mac * diffusers: add INITIAL_MODELS with diffusers-compatible repos * re-enable the embedding manager; closes #1778 * Squashed commit of the following: commit e4a956abc37fcb5cf188388b76b617bc5c8fda7d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:43:07 2022 +0100 import new load handling from EmbeddingManager and cleanup commit c4abe91a5ba0d415b45bf734068385668b7a66e6 Merge: 032e856e 1efc6397 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:09:53 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers_with_textual_inversion_manager commit 032e856eefb3bbc39534f5daafd25764bcfcef8b Merge: 8b4f0fe9 bc515e24 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:08:01 2022 +0100 Merge remote-tracking branch 'upstream/dev/diffusers' into dev/diffusers_with_textual_inversion_manager commit 1efc6397fc6e61c1aff4b0258b93089d61de5955 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:04:28 2022 +0100 cleanup and add performance notes commit e400f804ac471a0ca2ba432fd658778b20c7bdab Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:45:07 2022 +0100 fix bug and update unit tests commit deb9ae0ae1016750e93ce8275734061f7285a231 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:28:29 2022 +0100 textual inversion manager seems to work commit 162e02505dec777e91a983c4d0fb52e950d25ff0 Merge: cbad4583 12769b3d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:58:03 2022 +0100 Merge branch 'main' into feature_textual_inversion_mgr commit cbad45836c6aace6871a90f2621a953f49433131 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:54:10 2022 +0100 use position embeddings commit 070344c69b0e0db340a183857d0a787b348681d3 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:53:47 2022 +0100 Don't crash CLI on exceptions commit b035ac8c6772dfd9ba41b8eeb9103181cda028f8 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:11:55 2022 +0100 add missing position_embeddings commit 12769b3d3562ef71e0f54946b532ad077e10043c Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:33:25 2022 +0100 debugging why it don't work commit bafb7215eabe1515ca5e8388fd3bb2f3ac5362cf Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:21:33 2022 +0100 debugging why it don't work commit 664a6e9e146b42d96703f0cc8baf8f5efec04ee1 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit 8b4f0fe9d6e4e2643b36dfa27864294785d7ba4e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit ffbe1ab11163ba712e353d89404e301d0e0c6cdf Merge: 6e4dad60 023df37e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:37:31 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers commit 023df37efffa67434f77def7fc3c9dfb29f699fd Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:36:54 2022 +0100 cleanup commit 05fac594eaf79d0058e3c48deee93df603f136c2 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:07:49 2022 +0100 tweak error checking commit 009f32ed39a7280997c3ffab112adadee0b44279 Author: damian <null@damianstewart.com> Date: Thu Dec 15 21:29:47 2022 +0100 unit tests passing for embeddings with vector length >1 commit beb1b08d9a98112ed2fe073580568e1a18698da3 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:39:09 2022 +0100 more explicit equality tests when overwriting commit 44d8a5a7c85cdabc9ce3a54fd0769a10597b3ca9 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:30:13 2022 +0100 wip textual inversion manager (unit tests passing for 1v embedding overwriting) commit 417c2b57d90924a839616bfb66804faab8039e4c Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 12:30:55 2022 +0100 wip textual inversion manager (unit tests passing for base stuff + padding) commit 2e80872e3b6f7fd7d8eb8928822bd824b63cb2ff Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 10:57:57 2022 +0100 wip new TextualInversionManager * stop using WeightedFrozenCLIPEmbedder * store diffusion models locally - configure_invokeai.py reconfigured to store diffusion models rather than CompVis models - hugging face caching model is used, but cache is set to ~/invokeai/models/repo_id - models.yaml does **NOT** use path, just repo_id - "repo_name" changed to "repo_id" to following hugging face conventions - Models are loaded with full precision pending further work. * allow non-local files during development * path takes priority over repo_id * MVP for model_cache and configure_invokeai - Feature complete (almost) - configure_invokeai.py downloads both .ckpt and diffuser models, along with their VAEs. Both types of download are controlled by a unified INITIAL_MODELS.yaml file. - model_cache can load both type of model and switches back and forth in CPU. No memory leaks detected TO DO: 1. I have not yet turned on the LocalOnly flag for diffuser models, so the code will check the Hugging Face repo for updates before using the locally cached models. This will break firewalled systems. I am thinking of putting in a global check for internet connectivity at startup time and setting the LocalOnly flag based on this. It would be good to check updates if there is connectivity. 2. I have not gone completely through INITIAL_MODELS.yaml to check which models are available as diffusers and which are not. So models like PaperCut and VoxelArt may not load properly. The runway and stability models are checked, as well as the Trinart models. 3. Add stanzas for SD 2.0 and 2.1 in INITIAL_MODELS.yaml REMAINING PROBLEMS NOT DIRECTLY RELATED TO MODEL_CACHE: 1. When loading a .ckpt file there are lots of messages like this: Warning! ldm.modules.attention.CrossAttention is no longer being maintained. Please use InvokeAICrossAttention instead. I'm not sure how to address this. 2. The ckpt models ***don't actually run*** due to the lack of special-case support for them in the generator objects. For example, here's the hard crash you get when you run txt2img against the legacy waifu-diffusion-1.3 model: ``` >> An error occurred: Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 140, in main main_loop(gen, opt) File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 371, in main_loop gen.prompt2image( File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1265, in __getattr__ raise AttributeError("'{}' object has no attribute '{}'".format( AttributeError: 'LatentDiffusion' object has no attribute 'image_from_embeddings' ``` 3. The inpainting diffusion model isn't working. Here's the output of "banana sushi" when inpainting-1.5 is loaded: ``` Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 301, in image_from_embeddings result_latents, result_attention_map_saver = self.latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 330, in latents_from_embeddings result: PipelineIntermediateState = infer_latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 185, in __call__ for result in self.generator_method(*args, **kwargs): File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 367, in generate_latents_from_embeddings step_output = self.step(batched_t, latents, guidance_scale, File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context return func(*args, **kwargs) File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 409, in step step_output = self.scheduler.step(noise_pred, timestep, latents, **extra_step_kwargs) File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/diffusers/schedulers/scheduling_lms_discrete.py", line 223, in step pred_original_sample = sample - sigma * model_output RuntimeError: The size of tensor a (9) must match the size of tensor b (4) at non-singleton dimension 1 ``` * proper support for float32/float16 - configure script now correctly detects user's preference for fp16/32 and downloads the correct diffuser version. If fp16 version not available, falls back to fp32 version. - misc code cleanup and simplification in model_cache * add on-the-fly conversion of .ckpt to diffusers models 1. On-the-fly conversion code can be found in the file ldm/invoke/ckpt_to_diffusers.py. 2. A new !optimize command has been added to the CLI. Should be ported to Web GUI. User experience on the CLI is this: ``` invoke> !optimize /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt INFO: Converting legacy weights file /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt to optimized diffuser model. This operation will take 30-60s to complete. Success. Optimized model is now located at /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 Writing new config file entry for sd-v1-4... >> New configuration: sd-v1-4: description: Optimized version of sd-v1-4 format: diffusers path: /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 OK to import [n]? y >> Verifying that new model loads... >> Current VRAM usage: 2.60G >> Offloading stable-diffusion-2.1 to CPU >> Loading diffusers model from /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 | Using faster float16 precision You have disabled the safety checker for <class 'ldm.invoke.generator.diffusers_pipeline.StableDiffusionGeneratorPipeline'> by passing `safety_checker=None`. Ensure that you abide to the conditions of the Stable Diffusion \ license and do not expose unfiltered results in services or applications open to the public. Both the diffusers team and Hugging Face strongly recommend to keep the safety filter enabled in all public facing circumstances,\ disabling it only for use-cases that involve analyzing network behavior or auditing its results. For more information, please have a look at https://github.com/huggingface/diffusers/pull/254 . | training width x height = (512 x 512) >> Model loaded in 3.48s >> Max VRAM used to load the model: 2.17G >> Current VRAM usage:2.17G >> Textual inversions available: >> Setting Sampler to k_lms (LMSDiscreteScheduler) Keep model loaded? [y] ``` * add parallel set of generator files for ckpt legacy generation * generation using legacy ckpt models now working * diffusers: fix missing attention_maps_callback fix for 23eb80b40421b2bb8f4b6d3dd30490d11c447b36 * associate legacy CrossAttention with .ckpt models * enable autoconvert New --autoconvert CLI option will scan a designated directory for new .ckpt files, convert them into diffuser models, and import them into models.yaml. Works like this: invoke.py --autoconvert /path/to/weights/directory In ModelCache added two new methods: autoconvert_weights(config_path, weights_directory_path, models_directory_path) convert_and_import(ckpt_path, diffuser_path) * diffusers: update to diffusers 0.11 (from 0.10.2) * fix vae loading & width/height calculation * refactor: encapsulate these conditioning data into one container * diffusers: fix some noise-scaling issues by pushing the noise-mixing down to the common function * add support for safetensors and accelerate * set local_files_only when internet unreachable * diffusers: fix error-handling path when model repo has no fp16 branch * fix generatorinpaint error Fixes : "ModuleNotFoundError: No module named 'ldm.invoke.generatorinpaint' https://github.com/invoke-ai/InvokeAI/pull/1583#issuecomment-1363634318 * quench diffuser safety-checker warning * diffusers: support stochastic DDIM eta parameter * fix conda env creation on macos * fix cross-attention with diffusers 0.11 * diffusers: the VAE needs to be tiling as well as the U-Net * diffusers: comment on subfolders * diffusers: embiggen! * diffusers: make model_cache.list_models serializable * diffusers(inpaint): restore scaling functionality * fix requirements clash between numba and numpy 1.24 * diffusers: allow inpainting model to do non-inpainting tasks * start expanding model_cache functionality * add import_ckpt_model() and import_diffuser_model() methods to model_manager - in addition, model_cache.py is now renamed to model_manager.py * allow "recommended" flag to be optional in INITIAL_MODELS.yaml * configure_invokeai now downloads VAE diffusers in advance * rename ModelCache to ModelManager * remove support for `repo_name` in models.yaml * check for and refuse to load embeddings trained on incompatible models * models.yaml.example: s/repo_name/repo_id and remove extra INITIAL_MODELS now that the main one has diffusers models in it. * add MVP textual inversion script * refactor(InvokeAIDiffuserComponent): factor out _combine() * InvokeAIDiffuserComponent: implement threshold * InvokeAIDiffuserComponent: diagnostic logs for threshold ...this does not look right * add a curses-based frontend to textual inversion - not quite working yet - requires npyscreen installed - on windows will also have the windows-curses requirement, but not added to requirements yet * add curses-based interface for textual inversion * fix crash in convert_and_import() - This corrects a "local variable referenced before assignment" error in model_manager.convert_and_import() * potential workaround for no 'state_dict' key error - As reported in https://github.com/huggingface/diffusers/issues/1876 * create TI output dir if needed * Update environment-lin-cuda.yml (#2159) Fixing line 42 to be the proper order to define the transformers requirement: ~= instead of =~ * diffusers: update sampler-to-scheduler mapping based on https://github.com/huggingface/diffusers/issues/277#issuecomment-1371428672 * improve user exp for ckt to diffusers conversion - !optimize_models command now operates on an existing ckpt file entry in models.yaml - replaces existing entry, rather than adding a new one - offers to delete the ckpt file after conversion * web: adapt progress callback to deal with old generator or new diffusers pipeline * clean-up model_manager code - add_model() verified to work for .ckpt local paths, .ckpt remote URLs, diffusers local paths, and diffusers repo_ids - convert_and_import() verified to work for local and remove .ckpt files * handle edge cases for import_model() and convert_model() * add support for safetensor .ckpt files * fix name error * code cleanup with pyflake * improve model setting behavior - If the user enters an invalid model name at startup time, will not try to load it, warn, and use default model - CLI UI enhancement: include currently active model in the command line prompt. * update test-invoke-pip.yml - fix model cache path to point to runwayml/stable-diffusion-v1-5 - remove `skip-sd-weights` from configure_invokeai.py args * exclude dev/diffusers from "fail for draft PRs" * disable "fail on PR jobs" * re-add `--skip-sd-weights` since no space * update workflow environments - include `INVOKE_MODEL_RECONFIGURE: '--yes'` * clean up model load failure handling - Allow CLI to run even when no model is defined or loadable. - Inhibit stack trace when model load fails - only show last error - Give user *option* to run configure_invokeai.py when no models successfully load. - Restart invokeai after reconfiguration. * further edge-case handling 1) only one model in models.yaml file, and that model is broken 2) no models in models.yaml 3) models.yaml doesn't exist at all * fix incorrect model status listing - "cached" was not being returned from list_models() - normalize handling of exceptions during model loading: - Passing an invalid model name to generate.set_model() will return a KeyError - All other exceptions are returned as the appropriate Exception * CI: do download weights (if not already cached) * diffusers: fix scheduler loading in offline mode * CI: fix model name (no longer has `diffusers-` prefix) * Update txt2img2img.py (#2256) * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * feat - make model storage compatible with hugging face caching system This commit alters the InvokeAI model directory to be compatible with hugging face, making it easier to share diffusers (and other models) across different programs. - If the HF_HOME environment variable is not set, then models are cached in ~/invokeai/models in a format that is identical to the HuggingFace cache. - If HF_HOME is set, then models are cached wherever HF_HOME points. - To enable sharing with other HuggingFace library clients, set HF_HOME to ~/.cache/huggingface to set the default cache location or to ~/invokeai/models to have huggingface cache inside InvokeAI. * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * fix error "no attribute CkptInpaint" * model_manager.list_models() returns entire model config stanza+status * Initial Draft - Model Manager Diffusers * added hash function to diffusers * implement sha256 hashes on diffusers models * Add Model Manager Support for Diffusers * fix various problems with model manager - in cli import functions, fix not enough values to unpack from _get_name_and_desc() - fix crash when using old-style vae: value with new-style diffuser * rebuild frontend * fix dictconfig-not-serializable issue * fix NoneType' object is not subscriptable crash in model_manager * fix "str has no attribute get" error in model_manager list_models() * Add path and repo_id support for Diffusers Model Manager Also fixes bugs * Fix tooltip IT localization not working * Add Version Number To WebUI * Optimize Model Search * Fix incorrect font on the Model Manager UI * Fix image degradation on merge fixes - [Experimental] This change should effectively fix a couple of things. - Fix image degradation on subsequent merges of the canvas layers. - Fix the slight transparent border that is left behind when filling the bounding box with a color. - Fix the left over line of color when filling a bounding box with color. So far there are no side effects for this. If any, please report. * Add local model filtering for Diffusers / Checkpoints * Go to home on modal close for the Add Modal UI * Styling Fixes * Model Manager Diffusers Localization Update * Add Safe Tensor scanning to Model Manager * Fix model edit form dispatching string values instead of numbers. * Resolve VAE handling / edge cases for supplied repos * defer injecting tokens for textual inversions until they're used for the first time * squash a console warning * implement model migration check * add_model() overwrites previous config rather than merges * fix model config file attribute merging * fix precision handling in textual inversion script * allow ckpt conversion script to work with safetensors .ckpts Applied patch here: https://github.com/huggingface/diffusers/commit/beb932c5d111872c5e45387e7b1b2b3dd0524a47 * fix name "args" is not defined crash in textual_inversion_training * fix a second NameError: name 'args' is not defined crash * fix loading of the safety checker from the global cache dir * add installation step to textual inversion frontend - After a successful training run, the script will copy learned_embeds.bin to a subfolder of the embeddings directory. - User given the option to delete the logs and intermediate checkpoints (which together use 7-8G of space) - If textual inversion training fails, reports the error gracefully. * don't crash out on incompatible embeddings - put try: blocks around places where the system tries to load an embedding which is incompatible with the currently loaded model * add support for checkpoint resuming * textual inversion preferences are saved and restored between sessions - Preferences are stored in a file named text-inversion-training/preferences.conf - Currently the resume-from-checkpoint option is not working correctly. Possible bug in textual_inversion_training.py? * copy learned_embeddings.bin into right location * add front end for diffusers model merging - Front end doesn't do anything yet!!!! - Made change to model name parsing in CLI to support ability to have merged models with the "+" character in their names. * improve inpainting experience - recommend ckpt version of inpainting-1.5 to user - fix get_noise() bug in ckpt version of omnibus.py * update environment*yml * tweak instructions to install HuggingFace token * bump version number * enhance update scripts - update scripts will now fetch new INITIAL_MODELS.yaml so that configure_invokeai.py will know about the diffusers versions. * enhance invoke.sh/invoke.bat launchers - added configure_invokeai.py to menu - menu defaults to browser-based invoke * remove conda workflow (#2321) * fix `token_ids has shape torch.Size([79]) - expected [77]` * update CHANGELOG.md with 2.3.* info - Add information on how formats have changed and the upgrade process. - Add short bug list. Co-authored-by: Damian Stewart <d@damianstewart.com> Co-authored-by: Damian Stewart <null@damianstewart.com> Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> Co-authored-by: Wybartel-luxmc <37852506+Wybartel-luxmc@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> Co-authored-by: mickr777 <115216705+mickr777@users.noreply.github.com> Co-authored-by: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Co-authored-by: Eugene Brodsky <ebr@users.noreply.github.com> Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com>
2023-01-15 14:22:46 +00:00
import time
Refactoring simplet2i (#387) * start refactoring -not yet functional * first phase of refactor done - not sure weighted prompts working * Second phase of refactoring. Everything mostly working. * The refactoring has moved all the hard-core inference work into ldm.dream.generator.*, where there are submodules for txt2img and img2img. inpaint will go in there as well. * Some additional refactoring will be done soon, but relatively minor work. * fix -save_orig flag to actually work * add @neonsecret attention.py memory optimization * remove unneeded imports * move token logging into conditioning.py * add placeholder version of inpaint; porting in progress * fix crash in img2img * inpainting working; not tested on variations * fix crashes in img2img * ported attention.py memory optimization #117 from basujindal branch * added @torch_no_grad() decorators to img2img, txt2img, inpaint closures * Final commit prior to PR against development * fixup crash when generating intermediate images in web UI * rename ldm.simplet2i to ldm.generate * add backward-compatibility simplet2i shell with deprecation warning * add back in mps exception, addresses @vargol comment in #354 * replaced Conditioning class with exported functions * fix wrong type of with_variations attribute during intialization * changed "image_iterator()" to "get_make_image()" * raise NotImplementedError for calling get_make_image() in parent class * Update ldm/generate.py better error message Co-authored-by: Kevin Gibbons <bakkot@gmail.com> * minor stylistic fixes and assertion checks from code review * moved get_noise() method into img2img class * break get_noise() into two methods, one for txt2img and the other for img2img * inpainting works on non-square images now * make get_noise() an abstract method in base class * much improved inpainting Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
2022-09-06 00:40:10 +00:00
import traceback
use 🧨diffusers model (#1583) * initial commit of DiffusionPipeline class * spike: proof of concept using diffusers for txt2img * doc: type hints for Generator * refactor(model_cache): factor out load_ckpt * model_cache: add ability to load a diffusers model pipeline and update associated things in Generate & Generator to not instantly fail when that happens * model_cache: fix model default image dimensions * txt2img: support switching diffusers schedulers * diffusers: let the scheduler do its scaling of the initial latents Remove IPNDM scheduler; it is not behaving. * web server: update image_progress callback for diffusers data * diffusers: restore prompt weighting feature * diffusers: fix set-sampler error following model switch * diffusers: use InvokeAIDiffuserComponent for conditioning * cross_attention_control: stub (no-op) implementations for diffusers * model_cache: let offload_model work with DiffusionPipeline, sorta. * models.yaml.example: add diffusers-format model, set as default * test-invoke-conda: use diffusers-format model test-invoke-conda: put huggingface-token where the library can use it * environment-mac: upgrade to diffusers 0.7 (from 0.6) this was already done for linux; mac must have been lost in the merge. * preload_models: explicitly load diffusers models In non-interactive mode too, as long as you're logged in. * fix(model_cache): don't check `model.config` in diffusers format clean-up from recent merge. * diffusers integration: support img2img * dev: upgrade to diffusers 0.8 (from 0.7.1) We get to remove some code by using methods that were factored out in the base class. * refactor: remove backported img2img.get_timesteps now that we can use it directly from diffusers 0.8.1 * ci: use diffusers model * dev: upgrade to diffusers 0.9 (from 0.8.1) * lint: correct annotations for Python 3.9. * lint: correct AttributeError.name reference for Python 3.9. * CI: prefer diffusers-1.4 because it no longer requires a token The RunwayML models still do. * build: there's yet another place to update requirements? * configure: try to download models even without token Models in the CompVis and stabilityai repos no longer require them. (But runwayml still does.) * configure: add troubleshooting info for config-not-found * fix(configure): prepend root to config path * fix(configure): remove second `default: true` from models example * CI: simplify test-on-push logic now that we don't need secrets The "test on push but only in forks" logic was only necessary when tests didn't work for PRs-from-forks. * create an embedding_manager for diffusers * internal: avoid importing diffusers DummyObject see https://github.com/huggingface/diffusers/issues/1479 * fix "config attributes…not expected" diffusers warnings. * fix deprecated scheduler construction * work around an apparent MPS torch bug that causes conditioning to have no effect * 🚧 post-rebase repair * preliminary support for outpainting (no masking yet) * monkey-patch diffusers.attention and use Invoke lowvram code * add always_use_cpu arg to bypass MPS * add cross-attention control support to diffusers (fails on MPS) For unknown reasons MPS produces garbage output with .swap(). Use --always_use_cpu arg to invoke.py for now to test this code on MPS. * diffusers support for the inpainting model * fix debug_image to not crash with non-RGB images. * inpainting for the normal model [WIP] This seems to be performing well until the LAST STEP, at which point it dissolves to confetti. * fix off-by-one bug in cross-attention-control (#1774) prompt token sequences begin with a "beginning-of-sequence" marker <bos> and end with a repeated "end-of-sequence" marker <eos> - to make a default prompt length of <bos> + 75 prompt tokens + <eos>. the .swap() code was failing to take the column for <bos> at index 0 into account. the changes here do that, and also add extra handling for a single <eos> (which may be redundant but which is included for completeness). based on my understanding and some assumptions about how this all works, the reason .swap() nevertheless seemed to do the right thing, to some extent, is because over multiple steps the conditioning process in Stable Diffusion operates as a feedback loop. a change to token n-1 has flow-on effects to how the [1x4x64x64] latent tensor is modified by all the tokens after it, - and as the next step is processed, all the tokens before it as well. intuitively, a token's conditioning effects "echo" throughout the whole length of the prompt. so even though the token at n-1 was being edited when what the user actually wanted was to edit the token at n, it nevertheless still had some non-negligible effect, in roughly the right direction, often enough that it seemed like it was working properly. * refactor common CrossAttention stuff into a mixin so that the old ldm code can still work if necessary * inpainting for the normal model. I think it works this time. * diffusers: reset num_vectors_per_token sync with 44a00555718f1df173c60da0ed646cf700e29537 * diffusers: txt2img2img (hires_fix) with so much slicing and dicing of pipeline methods to stitch them together * refactor(diffusers): reduce some code duplication amongst the different tasks * fixup! refactor(diffusers): reduce some code duplication amongst the different tasks * diffusers: enable DPMSolver++ scheduler * diffusers: upgrade to diffusers 0.10, add Heun scheduler * diffusers(ModelCache): stopgap to make from_cpu compatible with diffusers * CI: default to diffusers-1.5 now that runwayml token requirement is gone * diffusers: update to 0.10 (and transformers to 4.25) * diffusers: use xformers when available diffusers no longer auto-enables this as of 0.10.2. * diffusers: make masked img2img behave better with multi-step schedulers re-randomizing the noise each step was confusing them. * diffusers: work more better with more models. fixed relative path problem with local models. fixed models on hub not always having a `fp16` branch. * diffusers: stopgap fix for attention_maps_callback crash after recent merge * fixup import merge conflicts correction for 061c5369a2247c6c92cd69606bcf54c4f1962a0b * test: add tests/inpainting inputs for masked img2img * diffusers(AddsMaskedGuidance): partial fix for k-schedulers Prevents them from crashing, but results are still hot garbage. * fix --safety_checker arg parsing and add note to diffusers loader about where safety checker gets called * generate: fix import error * CI: don't try to read the old init location * diffusers: support loading an alternate VAE * CI: remove sh-syntax if-statement so it doesn't crash powershell * CI: fold strings in yaml because backslash is not line-continuation in powershell * attention maps callback stuff for diffusers * build: fix syntax error in environment-mac * diffusers: add INITIAL_MODELS with diffusers-compatible repos * re-enable the embedding manager; closes #1778 * Squashed commit of the following: commit e4a956abc37fcb5cf188388b76b617bc5c8fda7d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:43:07 2022 +0100 import new load handling from EmbeddingManager and cleanup commit c4abe91a5ba0d415b45bf734068385668b7a66e6 Merge: 032e856e 1efc6397 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:09:53 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers_with_textual_inversion_manager commit 032e856eefb3bbc39534f5daafd25764bcfcef8b Merge: 8b4f0fe9 bc515e24 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:08:01 2022 +0100 Merge remote-tracking branch 'upstream/dev/diffusers' into dev/diffusers_with_textual_inversion_manager commit 1efc6397fc6e61c1aff4b0258b93089d61de5955 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:04:28 2022 +0100 cleanup and add performance notes commit e400f804ac471a0ca2ba432fd658778b20c7bdab Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:45:07 2022 +0100 fix bug and update unit tests commit deb9ae0ae1016750e93ce8275734061f7285a231 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:28:29 2022 +0100 textual inversion manager seems to work commit 162e02505dec777e91a983c4d0fb52e950d25ff0 Merge: cbad4583 12769b3d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:58:03 2022 +0100 Merge branch 'main' into feature_textual_inversion_mgr commit cbad45836c6aace6871a90f2621a953f49433131 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:54:10 2022 +0100 use position embeddings commit 070344c69b0e0db340a183857d0a787b348681d3 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:53:47 2022 +0100 Don't crash CLI on exceptions commit b035ac8c6772dfd9ba41b8eeb9103181cda028f8 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:11:55 2022 +0100 add missing position_embeddings commit 12769b3d3562ef71e0f54946b532ad077e10043c Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:33:25 2022 +0100 debugging why it don't work commit bafb7215eabe1515ca5e8388fd3bb2f3ac5362cf Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:21:33 2022 +0100 debugging why it don't work commit 664a6e9e146b42d96703f0cc8baf8f5efec04ee1 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit 8b4f0fe9d6e4e2643b36dfa27864294785d7ba4e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit ffbe1ab11163ba712e353d89404e301d0e0c6cdf Merge: 6e4dad60 023df37e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:37:31 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers commit 023df37efffa67434f77def7fc3c9dfb29f699fd Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:36:54 2022 +0100 cleanup commit 05fac594eaf79d0058e3c48deee93df603f136c2 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:07:49 2022 +0100 tweak error checking commit 009f32ed39a7280997c3ffab112adadee0b44279 Author: damian <null@damianstewart.com> Date: Thu Dec 15 21:29:47 2022 +0100 unit tests passing for embeddings with vector length >1 commit beb1b08d9a98112ed2fe073580568e1a18698da3 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:39:09 2022 +0100 more explicit equality tests when overwriting commit 44d8a5a7c85cdabc9ce3a54fd0769a10597b3ca9 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:30:13 2022 +0100 wip textual inversion manager (unit tests passing for 1v embedding overwriting) commit 417c2b57d90924a839616bfb66804faab8039e4c Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 12:30:55 2022 +0100 wip textual inversion manager (unit tests passing for base stuff + padding) commit 2e80872e3b6f7fd7d8eb8928822bd824b63cb2ff Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 10:57:57 2022 +0100 wip new TextualInversionManager * stop using WeightedFrozenCLIPEmbedder * store diffusion models locally - configure_invokeai.py reconfigured to store diffusion models rather than CompVis models - hugging face caching model is used, but cache is set to ~/invokeai/models/repo_id - models.yaml does **NOT** use path, just repo_id - "repo_name" changed to "repo_id" to following hugging face conventions - Models are loaded with full precision pending further work. * allow non-local files during development * path takes priority over repo_id * MVP for model_cache and configure_invokeai - Feature complete (almost) - configure_invokeai.py downloads both .ckpt and diffuser models, along with their VAEs. Both types of download are controlled by a unified INITIAL_MODELS.yaml file. - model_cache can load both type of model and switches back and forth in CPU. No memory leaks detected TO DO: 1. I have not yet turned on the LocalOnly flag for diffuser models, so the code will check the Hugging Face repo for updates before using the locally cached models. This will break firewalled systems. I am thinking of putting in a global check for internet connectivity at startup time and setting the LocalOnly flag based on this. It would be good to check updates if there is connectivity. 2. I have not gone completely through INITIAL_MODELS.yaml to check which models are available as diffusers and which are not. So models like PaperCut and VoxelArt may not load properly. The runway and stability models are checked, as well as the Trinart models. 3. Add stanzas for SD 2.0 and 2.1 in INITIAL_MODELS.yaml REMAINING PROBLEMS NOT DIRECTLY RELATED TO MODEL_CACHE: 1. When loading a .ckpt file there are lots of messages like this: Warning! ldm.modules.attention.CrossAttention is no longer being maintained. Please use InvokeAICrossAttention instead. I'm not sure how to address this. 2. The ckpt models ***don't actually run*** due to the lack of special-case support for them in the generator objects. For example, here's the hard crash you get when you run txt2img against the legacy waifu-diffusion-1.3 model: ``` >> An error occurred: Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 140, in main main_loop(gen, opt) File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 371, in main_loop gen.prompt2image( File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1265, in __getattr__ raise AttributeError("'{}' object has no attribute '{}'".format( AttributeError: 'LatentDiffusion' object has no attribute 'image_from_embeddings' ``` 3. The inpainting diffusion model isn't working. Here's the output of "banana sushi" when inpainting-1.5 is loaded: ``` Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 301, in image_from_embeddings result_latents, result_attention_map_saver = self.latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 330, in latents_from_embeddings result: PipelineIntermediateState = infer_latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 185, in __call__ for result in self.generator_method(*args, **kwargs): File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 367, in generate_latents_from_embeddings step_output = self.step(batched_t, latents, guidance_scale, File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context return func(*args, **kwargs) File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 409, in step step_output = self.scheduler.step(noise_pred, timestep, latents, **extra_step_kwargs) File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/diffusers/schedulers/scheduling_lms_discrete.py", line 223, in step pred_original_sample = sample - sigma * model_output RuntimeError: The size of tensor a (9) must match the size of tensor b (4) at non-singleton dimension 1 ``` * proper support for float32/float16 - configure script now correctly detects user's preference for fp16/32 and downloads the correct diffuser version. If fp16 version not available, falls back to fp32 version. - misc code cleanup and simplification in model_cache * add on-the-fly conversion of .ckpt to diffusers models 1. On-the-fly conversion code can be found in the file ldm/invoke/ckpt_to_diffusers.py. 2. A new !optimize command has been added to the CLI. Should be ported to Web GUI. User experience on the CLI is this: ``` invoke> !optimize /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt INFO: Converting legacy weights file /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt to optimized diffuser model. This operation will take 30-60s to complete. Success. Optimized model is now located at /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 Writing new config file entry for sd-v1-4... >> New configuration: sd-v1-4: description: Optimized version of sd-v1-4 format: diffusers path: /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 OK to import [n]? y >> Verifying that new model loads... >> Current VRAM usage: 2.60G >> Offloading stable-diffusion-2.1 to CPU >> Loading diffusers model from /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 | Using faster float16 precision You have disabled the safety checker for <class 'ldm.invoke.generator.diffusers_pipeline.StableDiffusionGeneratorPipeline'> by passing `safety_checker=None`. Ensure that you abide to the conditions of the Stable Diffusion \ license and do not expose unfiltered results in services or applications open to the public. Both the diffusers team and Hugging Face strongly recommend to keep the safety filter enabled in all public facing circumstances,\ disabling it only for use-cases that involve analyzing network behavior or auditing its results. For more information, please have a look at https://github.com/huggingface/diffusers/pull/254 . | training width x height = (512 x 512) >> Model loaded in 3.48s >> Max VRAM used to load the model: 2.17G >> Current VRAM usage:2.17G >> Textual inversions available: >> Setting Sampler to k_lms (LMSDiscreteScheduler) Keep model loaded? [y] ``` * add parallel set of generator files for ckpt legacy generation * generation using legacy ckpt models now working * diffusers: fix missing attention_maps_callback fix for 23eb80b40421b2bb8f4b6d3dd30490d11c447b36 * associate legacy CrossAttention with .ckpt models * enable autoconvert New --autoconvert CLI option will scan a designated directory for new .ckpt files, convert them into diffuser models, and import them into models.yaml. Works like this: invoke.py --autoconvert /path/to/weights/directory In ModelCache added two new methods: autoconvert_weights(config_path, weights_directory_path, models_directory_path) convert_and_import(ckpt_path, diffuser_path) * diffusers: update to diffusers 0.11 (from 0.10.2) * fix vae loading & width/height calculation * refactor: encapsulate these conditioning data into one container * diffusers: fix some noise-scaling issues by pushing the noise-mixing down to the common function * add support for safetensors and accelerate * set local_files_only when internet unreachable * diffusers: fix error-handling path when model repo has no fp16 branch * fix generatorinpaint error Fixes : "ModuleNotFoundError: No module named 'ldm.invoke.generatorinpaint' https://github.com/invoke-ai/InvokeAI/pull/1583#issuecomment-1363634318 * quench diffuser safety-checker warning * diffusers: support stochastic DDIM eta parameter * fix conda env creation on macos * fix cross-attention with diffusers 0.11 * diffusers: the VAE needs to be tiling as well as the U-Net * diffusers: comment on subfolders * diffusers: embiggen! * diffusers: make model_cache.list_models serializable * diffusers(inpaint): restore scaling functionality * fix requirements clash between numba and numpy 1.24 * diffusers: allow inpainting model to do non-inpainting tasks * start expanding model_cache functionality * add import_ckpt_model() and import_diffuser_model() methods to model_manager - in addition, model_cache.py is now renamed to model_manager.py * allow "recommended" flag to be optional in INITIAL_MODELS.yaml * configure_invokeai now downloads VAE diffusers in advance * rename ModelCache to ModelManager * remove support for `repo_name` in models.yaml * check for and refuse to load embeddings trained on incompatible models * models.yaml.example: s/repo_name/repo_id and remove extra INITIAL_MODELS now that the main one has diffusers models in it. * add MVP textual inversion script * refactor(InvokeAIDiffuserComponent): factor out _combine() * InvokeAIDiffuserComponent: implement threshold * InvokeAIDiffuserComponent: diagnostic logs for threshold ...this does not look right * add a curses-based frontend to textual inversion - not quite working yet - requires npyscreen installed - on windows will also have the windows-curses requirement, but not added to requirements yet * add curses-based interface for textual inversion * fix crash in convert_and_import() - This corrects a "local variable referenced before assignment" error in model_manager.convert_and_import() * potential workaround for no 'state_dict' key error - As reported in https://github.com/huggingface/diffusers/issues/1876 * create TI output dir if needed * Update environment-lin-cuda.yml (#2159) Fixing line 42 to be the proper order to define the transformers requirement: ~= instead of =~ * diffusers: update sampler-to-scheduler mapping based on https://github.com/huggingface/diffusers/issues/277#issuecomment-1371428672 * improve user exp for ckt to diffusers conversion - !optimize_models command now operates on an existing ckpt file entry in models.yaml - replaces existing entry, rather than adding a new one - offers to delete the ckpt file after conversion * web: adapt progress callback to deal with old generator or new diffusers pipeline * clean-up model_manager code - add_model() verified to work for .ckpt local paths, .ckpt remote URLs, diffusers local paths, and diffusers repo_ids - convert_and_import() verified to work for local and remove .ckpt files * handle edge cases for import_model() and convert_model() * add support for safetensor .ckpt files * fix name error * code cleanup with pyflake * improve model setting behavior - If the user enters an invalid model name at startup time, will not try to load it, warn, and use default model - CLI UI enhancement: include currently active model in the command line prompt. * update test-invoke-pip.yml - fix model cache path to point to runwayml/stable-diffusion-v1-5 - remove `skip-sd-weights` from configure_invokeai.py args * exclude dev/diffusers from "fail for draft PRs" * disable "fail on PR jobs" * re-add `--skip-sd-weights` since no space * update workflow environments - include `INVOKE_MODEL_RECONFIGURE: '--yes'` * clean up model load failure handling - Allow CLI to run even when no model is defined or loadable. - Inhibit stack trace when model load fails - only show last error - Give user *option* to run configure_invokeai.py when no models successfully load. - Restart invokeai after reconfiguration. * further edge-case handling 1) only one model in models.yaml file, and that model is broken 2) no models in models.yaml 3) models.yaml doesn't exist at all * fix incorrect model status listing - "cached" was not being returned from list_models() - normalize handling of exceptions during model loading: - Passing an invalid model name to generate.set_model() will return a KeyError - All other exceptions are returned as the appropriate Exception * CI: do download weights (if not already cached) * diffusers: fix scheduler loading in offline mode * CI: fix model name (no longer has `diffusers-` prefix) * Update txt2img2img.py (#2256) * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * feat - make model storage compatible with hugging face caching system This commit alters the InvokeAI model directory to be compatible with hugging face, making it easier to share diffusers (and other models) across different programs. - If the HF_HOME environment variable is not set, then models are cached in ~/invokeai/models in a format that is identical to the HuggingFace cache. - If HF_HOME is set, then models are cached wherever HF_HOME points. - To enable sharing with other HuggingFace library clients, set HF_HOME to ~/.cache/huggingface to set the default cache location or to ~/invokeai/models to have huggingface cache inside InvokeAI. * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * fix error "no attribute CkptInpaint" * model_manager.list_models() returns entire model config stanza+status * Initial Draft - Model Manager Diffusers * added hash function to diffusers * implement sha256 hashes on diffusers models * Add Model Manager Support for Diffusers * fix various problems with model manager - in cli import functions, fix not enough values to unpack from _get_name_and_desc() - fix crash when using old-style vae: value with new-style diffuser * rebuild frontend * fix dictconfig-not-serializable issue * fix NoneType' object is not subscriptable crash in model_manager * fix "str has no attribute get" error in model_manager list_models() * Add path and repo_id support for Diffusers Model Manager Also fixes bugs * Fix tooltip IT localization not working * Add Version Number To WebUI * Optimize Model Search * Fix incorrect font on the Model Manager UI * Fix image degradation on merge fixes - [Experimental] This change should effectively fix a couple of things. - Fix image degradation on subsequent merges of the canvas layers. - Fix the slight transparent border that is left behind when filling the bounding box with a color. - Fix the left over line of color when filling a bounding box with color. So far there are no side effects for this. If any, please report. * Add local model filtering for Diffusers / Checkpoints * Go to home on modal close for the Add Modal UI * Styling Fixes * Model Manager Diffusers Localization Update * Add Safe Tensor scanning to Model Manager * Fix model edit form dispatching string values instead of numbers. * Resolve VAE handling / edge cases for supplied repos * defer injecting tokens for textual inversions until they're used for the first time * squash a console warning * implement model migration check * add_model() overwrites previous config rather than merges * fix model config file attribute merging * fix precision handling in textual inversion script * allow ckpt conversion script to work with safetensors .ckpts Applied patch here: https://github.com/huggingface/diffusers/commit/beb932c5d111872c5e45387e7b1b2b3dd0524a47 * fix name "args" is not defined crash in textual_inversion_training * fix a second NameError: name 'args' is not defined crash * fix loading of the safety checker from the global cache dir * add installation step to textual inversion frontend - After a successful training run, the script will copy learned_embeds.bin to a subfolder of the embeddings directory. - User given the option to delete the logs and intermediate checkpoints (which together use 7-8G of space) - If textual inversion training fails, reports the error gracefully. * don't crash out on incompatible embeddings - put try: blocks around places where the system tries to load an embedding which is incompatible with the currently loaded model * add support for checkpoint resuming * textual inversion preferences are saved and restored between sessions - Preferences are stored in a file named text-inversion-training/preferences.conf - Currently the resume-from-checkpoint option is not working correctly. Possible bug in textual_inversion_training.py? * copy learned_embeddings.bin into right location * add front end for diffusers model merging - Front end doesn't do anything yet!!!! - Made change to model name parsing in CLI to support ability to have merged models with the "+" character in their names. * improve inpainting experience - recommend ckpt version of inpainting-1.5 to user - fix get_noise() bug in ckpt version of omnibus.py * update environment*yml * tweak instructions to install HuggingFace token * bump version number * enhance update scripts - update scripts will now fetch new INITIAL_MODELS.yaml so that configure_invokeai.py will know about the diffusers versions. * enhance invoke.sh/invoke.bat launchers - added configure_invokeai.py to menu - menu defaults to browser-based invoke * remove conda workflow (#2321) * fix `token_ids has shape torch.Size([79]) - expected [77]` * update CHANGELOG.md with 2.3.* info - Add information on how formats have changed and the upgrade process. - Add short bug list. Co-authored-by: Damian Stewart <d@damianstewart.com> Co-authored-by: Damian Stewart <null@damianstewart.com> Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> Co-authored-by: Wybartel-luxmc <37852506+Wybartel-luxmc@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> Co-authored-by: mickr777 <115216705+mickr777@users.noreply.github.com> Co-authored-by: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Co-authored-by: Eugene Brodsky <ebr@users.noreply.github.com> Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com>
2023-01-15 14:22:46 +00:00
import cv2
use 🧨diffusers model (#1583) * initial commit of DiffusionPipeline class * spike: proof of concept using diffusers for txt2img * doc: type hints for Generator * refactor(model_cache): factor out load_ckpt * model_cache: add ability to load a diffusers model pipeline and update associated things in Generate & Generator to not instantly fail when that happens * model_cache: fix model default image dimensions * txt2img: support switching diffusers schedulers * diffusers: let the scheduler do its scaling of the initial latents Remove IPNDM scheduler; it is not behaving. * web server: update image_progress callback for diffusers data * diffusers: restore prompt weighting feature * diffusers: fix set-sampler error following model switch * diffusers: use InvokeAIDiffuserComponent for conditioning * cross_attention_control: stub (no-op) implementations for diffusers * model_cache: let offload_model work with DiffusionPipeline, sorta. * models.yaml.example: add diffusers-format model, set as default * test-invoke-conda: use diffusers-format model test-invoke-conda: put huggingface-token where the library can use it * environment-mac: upgrade to diffusers 0.7 (from 0.6) this was already done for linux; mac must have been lost in the merge. * preload_models: explicitly load diffusers models In non-interactive mode too, as long as you're logged in. * fix(model_cache): don't check `model.config` in diffusers format clean-up from recent merge. * diffusers integration: support img2img * dev: upgrade to diffusers 0.8 (from 0.7.1) We get to remove some code by using methods that were factored out in the base class. * refactor: remove backported img2img.get_timesteps now that we can use it directly from diffusers 0.8.1 * ci: use diffusers model * dev: upgrade to diffusers 0.9 (from 0.8.1) * lint: correct annotations for Python 3.9. * lint: correct AttributeError.name reference for Python 3.9. * CI: prefer diffusers-1.4 because it no longer requires a token The RunwayML models still do. * build: there's yet another place to update requirements? * configure: try to download models even without token Models in the CompVis and stabilityai repos no longer require them. (But runwayml still does.) * configure: add troubleshooting info for config-not-found * fix(configure): prepend root to config path * fix(configure): remove second `default: true` from models example * CI: simplify test-on-push logic now that we don't need secrets The "test on push but only in forks" logic was only necessary when tests didn't work for PRs-from-forks. * create an embedding_manager for diffusers * internal: avoid importing diffusers DummyObject see https://github.com/huggingface/diffusers/issues/1479 * fix "config attributes…not expected" diffusers warnings. * fix deprecated scheduler construction * work around an apparent MPS torch bug that causes conditioning to have no effect * 🚧 post-rebase repair * preliminary support for outpainting (no masking yet) * monkey-patch diffusers.attention and use Invoke lowvram code * add always_use_cpu arg to bypass MPS * add cross-attention control support to diffusers (fails on MPS) For unknown reasons MPS produces garbage output with .swap(). Use --always_use_cpu arg to invoke.py for now to test this code on MPS. * diffusers support for the inpainting model * fix debug_image to not crash with non-RGB images. * inpainting for the normal model [WIP] This seems to be performing well until the LAST STEP, at which point it dissolves to confetti. * fix off-by-one bug in cross-attention-control (#1774) prompt token sequences begin with a "beginning-of-sequence" marker <bos> and end with a repeated "end-of-sequence" marker <eos> - to make a default prompt length of <bos> + 75 prompt tokens + <eos>. the .swap() code was failing to take the column for <bos> at index 0 into account. the changes here do that, and also add extra handling for a single <eos> (which may be redundant but which is included for completeness). based on my understanding and some assumptions about how this all works, the reason .swap() nevertheless seemed to do the right thing, to some extent, is because over multiple steps the conditioning process in Stable Diffusion operates as a feedback loop. a change to token n-1 has flow-on effects to how the [1x4x64x64] latent tensor is modified by all the tokens after it, - and as the next step is processed, all the tokens before it as well. intuitively, a token's conditioning effects "echo" throughout the whole length of the prompt. so even though the token at n-1 was being edited when what the user actually wanted was to edit the token at n, it nevertheless still had some non-negligible effect, in roughly the right direction, often enough that it seemed like it was working properly. * refactor common CrossAttention stuff into a mixin so that the old ldm code can still work if necessary * inpainting for the normal model. I think it works this time. * diffusers: reset num_vectors_per_token sync with 44a00555718f1df173c60da0ed646cf700e29537 * diffusers: txt2img2img (hires_fix) with so much slicing and dicing of pipeline methods to stitch them together * refactor(diffusers): reduce some code duplication amongst the different tasks * fixup! refactor(diffusers): reduce some code duplication amongst the different tasks * diffusers: enable DPMSolver++ scheduler * diffusers: upgrade to diffusers 0.10, add Heun scheduler * diffusers(ModelCache): stopgap to make from_cpu compatible with diffusers * CI: default to diffusers-1.5 now that runwayml token requirement is gone * diffusers: update to 0.10 (and transformers to 4.25) * diffusers: use xformers when available diffusers no longer auto-enables this as of 0.10.2. * diffusers: make masked img2img behave better with multi-step schedulers re-randomizing the noise each step was confusing them. * diffusers: work more better with more models. fixed relative path problem with local models. fixed models on hub not always having a `fp16` branch. * diffusers: stopgap fix for attention_maps_callback crash after recent merge * fixup import merge conflicts correction for 061c5369a2247c6c92cd69606bcf54c4f1962a0b * test: add tests/inpainting inputs for masked img2img * diffusers(AddsMaskedGuidance): partial fix for k-schedulers Prevents them from crashing, but results are still hot garbage. * fix --safety_checker arg parsing and add note to diffusers loader about where safety checker gets called * generate: fix import error * CI: don't try to read the old init location * diffusers: support loading an alternate VAE * CI: remove sh-syntax if-statement so it doesn't crash powershell * CI: fold strings in yaml because backslash is not line-continuation in powershell * attention maps callback stuff for diffusers * build: fix syntax error in environment-mac * diffusers: add INITIAL_MODELS with diffusers-compatible repos * re-enable the embedding manager; closes #1778 * Squashed commit of the following: commit e4a956abc37fcb5cf188388b76b617bc5c8fda7d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:43:07 2022 +0100 import new load handling from EmbeddingManager and cleanup commit c4abe91a5ba0d415b45bf734068385668b7a66e6 Merge: 032e856e 1efc6397 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:09:53 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers_with_textual_inversion_manager commit 032e856eefb3bbc39534f5daafd25764bcfcef8b Merge: 8b4f0fe9 bc515e24 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:08:01 2022 +0100 Merge remote-tracking branch 'upstream/dev/diffusers' into dev/diffusers_with_textual_inversion_manager commit 1efc6397fc6e61c1aff4b0258b93089d61de5955 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:04:28 2022 +0100 cleanup and add performance notes commit e400f804ac471a0ca2ba432fd658778b20c7bdab Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:45:07 2022 +0100 fix bug and update unit tests commit deb9ae0ae1016750e93ce8275734061f7285a231 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:28:29 2022 +0100 textual inversion manager seems to work commit 162e02505dec777e91a983c4d0fb52e950d25ff0 Merge: cbad4583 12769b3d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:58:03 2022 +0100 Merge branch 'main' into feature_textual_inversion_mgr commit cbad45836c6aace6871a90f2621a953f49433131 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:54:10 2022 +0100 use position embeddings commit 070344c69b0e0db340a183857d0a787b348681d3 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:53:47 2022 +0100 Don't crash CLI on exceptions commit b035ac8c6772dfd9ba41b8eeb9103181cda028f8 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:11:55 2022 +0100 add missing position_embeddings commit 12769b3d3562ef71e0f54946b532ad077e10043c Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:33:25 2022 +0100 debugging why it don't work commit bafb7215eabe1515ca5e8388fd3bb2f3ac5362cf Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:21:33 2022 +0100 debugging why it don't work commit 664a6e9e146b42d96703f0cc8baf8f5efec04ee1 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit 8b4f0fe9d6e4e2643b36dfa27864294785d7ba4e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit ffbe1ab11163ba712e353d89404e301d0e0c6cdf Merge: 6e4dad60 023df37e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:37:31 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers commit 023df37efffa67434f77def7fc3c9dfb29f699fd Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:36:54 2022 +0100 cleanup commit 05fac594eaf79d0058e3c48deee93df603f136c2 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:07:49 2022 +0100 tweak error checking commit 009f32ed39a7280997c3ffab112adadee0b44279 Author: damian <null@damianstewart.com> Date: Thu Dec 15 21:29:47 2022 +0100 unit tests passing for embeddings with vector length >1 commit beb1b08d9a98112ed2fe073580568e1a18698da3 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:39:09 2022 +0100 more explicit equality tests when overwriting commit 44d8a5a7c85cdabc9ce3a54fd0769a10597b3ca9 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:30:13 2022 +0100 wip textual inversion manager (unit tests passing for 1v embedding overwriting) commit 417c2b57d90924a839616bfb66804faab8039e4c Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 12:30:55 2022 +0100 wip textual inversion manager (unit tests passing for base stuff + padding) commit 2e80872e3b6f7fd7d8eb8928822bd824b63cb2ff Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 10:57:57 2022 +0100 wip new TextualInversionManager * stop using WeightedFrozenCLIPEmbedder * store diffusion models locally - configure_invokeai.py reconfigured to store diffusion models rather than CompVis models - hugging face caching model is used, but cache is set to ~/invokeai/models/repo_id - models.yaml does **NOT** use path, just repo_id - "repo_name" changed to "repo_id" to following hugging face conventions - Models are loaded with full precision pending further work. * allow non-local files during development * path takes priority over repo_id * MVP for model_cache and configure_invokeai - Feature complete (almost) - configure_invokeai.py downloads both .ckpt and diffuser models, along with their VAEs. Both types of download are controlled by a unified INITIAL_MODELS.yaml file. - model_cache can load both type of model and switches back and forth in CPU. No memory leaks detected TO DO: 1. I have not yet turned on the LocalOnly flag for diffuser models, so the code will check the Hugging Face repo for updates before using the locally cached models. This will break firewalled systems. I am thinking of putting in a global check for internet connectivity at startup time and setting the LocalOnly flag based on this. It would be good to check updates if there is connectivity. 2. I have not gone completely through INITIAL_MODELS.yaml to check which models are available as diffusers and which are not. So models like PaperCut and VoxelArt may not load properly. The runway and stability models are checked, as well as the Trinart models. 3. Add stanzas for SD 2.0 and 2.1 in INITIAL_MODELS.yaml REMAINING PROBLEMS NOT DIRECTLY RELATED TO MODEL_CACHE: 1. When loading a .ckpt file there are lots of messages like this: Warning! ldm.modules.attention.CrossAttention is no longer being maintained. Please use InvokeAICrossAttention instead. I'm not sure how to address this. 2. The ckpt models ***don't actually run*** due to the lack of special-case support for them in the generator objects. For example, here's the hard crash you get when you run txt2img against the legacy waifu-diffusion-1.3 model: ``` >> An error occurred: Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 140, in main main_loop(gen, opt) File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 371, in main_loop gen.prompt2image( File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1265, in __getattr__ raise AttributeError("'{}' object has no attribute '{}'".format( AttributeError: 'LatentDiffusion' object has no attribute 'image_from_embeddings' ``` 3. The inpainting diffusion model isn't working. Here's the output of "banana sushi" when inpainting-1.5 is loaded: ``` Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 301, in image_from_embeddings result_latents, result_attention_map_saver = self.latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 330, in latents_from_embeddings result: PipelineIntermediateState = infer_latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 185, in __call__ for result in self.generator_method(*args, **kwargs): File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 367, in generate_latents_from_embeddings step_output = self.step(batched_t, latents, guidance_scale, File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context return func(*args, **kwargs) File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 409, in step step_output = self.scheduler.step(noise_pred, timestep, latents, **extra_step_kwargs) File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/diffusers/schedulers/scheduling_lms_discrete.py", line 223, in step pred_original_sample = sample - sigma * model_output RuntimeError: The size of tensor a (9) must match the size of tensor b (4) at non-singleton dimension 1 ``` * proper support for float32/float16 - configure script now correctly detects user's preference for fp16/32 and downloads the correct diffuser version. If fp16 version not available, falls back to fp32 version. - misc code cleanup and simplification in model_cache * add on-the-fly conversion of .ckpt to diffusers models 1. On-the-fly conversion code can be found in the file ldm/invoke/ckpt_to_diffusers.py. 2. A new !optimize command has been added to the CLI. Should be ported to Web GUI. User experience on the CLI is this: ``` invoke> !optimize /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt INFO: Converting legacy weights file /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt to optimized diffuser model. This operation will take 30-60s to complete. Success. Optimized model is now located at /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 Writing new config file entry for sd-v1-4... >> New configuration: sd-v1-4: description: Optimized version of sd-v1-4 format: diffusers path: /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 OK to import [n]? y >> Verifying that new model loads... >> Current VRAM usage: 2.60G >> Offloading stable-diffusion-2.1 to CPU >> Loading diffusers model from /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 | Using faster float16 precision You have disabled the safety checker for <class 'ldm.invoke.generator.diffusers_pipeline.StableDiffusionGeneratorPipeline'> by passing `safety_checker=None`. Ensure that you abide to the conditions of the Stable Diffusion \ license and do not expose unfiltered results in services or applications open to the public. Both the diffusers team and Hugging Face strongly recommend to keep the safety filter enabled in all public facing circumstances,\ disabling it only for use-cases that involve analyzing network behavior or auditing its results. For more information, please have a look at https://github.com/huggingface/diffusers/pull/254 . | training width x height = (512 x 512) >> Model loaded in 3.48s >> Max VRAM used to load the model: 2.17G >> Current VRAM usage:2.17G >> Textual inversions available: >> Setting Sampler to k_lms (LMSDiscreteScheduler) Keep model loaded? [y] ``` * add parallel set of generator files for ckpt legacy generation * generation using legacy ckpt models now working * diffusers: fix missing attention_maps_callback fix for 23eb80b40421b2bb8f4b6d3dd30490d11c447b36 * associate legacy CrossAttention with .ckpt models * enable autoconvert New --autoconvert CLI option will scan a designated directory for new .ckpt files, convert them into diffuser models, and import them into models.yaml. Works like this: invoke.py --autoconvert /path/to/weights/directory In ModelCache added two new methods: autoconvert_weights(config_path, weights_directory_path, models_directory_path) convert_and_import(ckpt_path, diffuser_path) * diffusers: update to diffusers 0.11 (from 0.10.2) * fix vae loading & width/height calculation * refactor: encapsulate these conditioning data into one container * diffusers: fix some noise-scaling issues by pushing the noise-mixing down to the common function * add support for safetensors and accelerate * set local_files_only when internet unreachable * diffusers: fix error-handling path when model repo has no fp16 branch * fix generatorinpaint error Fixes : "ModuleNotFoundError: No module named 'ldm.invoke.generatorinpaint' https://github.com/invoke-ai/InvokeAI/pull/1583#issuecomment-1363634318 * quench diffuser safety-checker warning * diffusers: support stochastic DDIM eta parameter * fix conda env creation on macos * fix cross-attention with diffusers 0.11 * diffusers: the VAE needs to be tiling as well as the U-Net * diffusers: comment on subfolders * diffusers: embiggen! * diffusers: make model_cache.list_models serializable * diffusers(inpaint): restore scaling functionality * fix requirements clash between numba and numpy 1.24 * diffusers: allow inpainting model to do non-inpainting tasks * start expanding model_cache functionality * add import_ckpt_model() and import_diffuser_model() methods to model_manager - in addition, model_cache.py is now renamed to model_manager.py * allow "recommended" flag to be optional in INITIAL_MODELS.yaml * configure_invokeai now downloads VAE diffusers in advance * rename ModelCache to ModelManager * remove support for `repo_name` in models.yaml * check for and refuse to load embeddings trained on incompatible models * models.yaml.example: s/repo_name/repo_id and remove extra INITIAL_MODELS now that the main one has diffusers models in it. * add MVP textual inversion script * refactor(InvokeAIDiffuserComponent): factor out _combine() * InvokeAIDiffuserComponent: implement threshold * InvokeAIDiffuserComponent: diagnostic logs for threshold ...this does not look right * add a curses-based frontend to textual inversion - not quite working yet - requires npyscreen installed - on windows will also have the windows-curses requirement, but not added to requirements yet * add curses-based interface for textual inversion * fix crash in convert_and_import() - This corrects a "local variable referenced before assignment" error in model_manager.convert_and_import() * potential workaround for no 'state_dict' key error - As reported in https://github.com/huggingface/diffusers/issues/1876 * create TI output dir if needed * Update environment-lin-cuda.yml (#2159) Fixing line 42 to be the proper order to define the transformers requirement: ~= instead of =~ * diffusers: update sampler-to-scheduler mapping based on https://github.com/huggingface/diffusers/issues/277#issuecomment-1371428672 * improve user exp for ckt to diffusers conversion - !optimize_models command now operates on an existing ckpt file entry in models.yaml - replaces existing entry, rather than adding a new one - offers to delete the ckpt file after conversion * web: adapt progress callback to deal with old generator or new diffusers pipeline * clean-up model_manager code - add_model() verified to work for .ckpt local paths, .ckpt remote URLs, diffusers local paths, and diffusers repo_ids - convert_and_import() verified to work for local and remove .ckpt files * handle edge cases for import_model() and convert_model() * add support for safetensor .ckpt files * fix name error * code cleanup with pyflake * improve model setting behavior - If the user enters an invalid model name at startup time, will not try to load it, warn, and use default model - CLI UI enhancement: include currently active model in the command line prompt. * update test-invoke-pip.yml - fix model cache path to point to runwayml/stable-diffusion-v1-5 - remove `skip-sd-weights` from configure_invokeai.py args * exclude dev/diffusers from "fail for draft PRs" * disable "fail on PR jobs" * re-add `--skip-sd-weights` since no space * update workflow environments - include `INVOKE_MODEL_RECONFIGURE: '--yes'` * clean up model load failure handling - Allow CLI to run even when no model is defined or loadable. - Inhibit stack trace when model load fails - only show last error - Give user *option* to run configure_invokeai.py when no models successfully load. - Restart invokeai after reconfiguration. * further edge-case handling 1) only one model in models.yaml file, and that model is broken 2) no models in models.yaml 3) models.yaml doesn't exist at all * fix incorrect model status listing - "cached" was not being returned from list_models() - normalize handling of exceptions during model loading: - Passing an invalid model name to generate.set_model() will return a KeyError - All other exceptions are returned as the appropriate Exception * CI: do download weights (if not already cached) * diffusers: fix scheduler loading in offline mode * CI: fix model name (no longer has `diffusers-` prefix) * Update txt2img2img.py (#2256) * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * feat - make model storage compatible with hugging face caching system This commit alters the InvokeAI model directory to be compatible with hugging face, making it easier to share diffusers (and other models) across different programs. - If the HF_HOME environment variable is not set, then models are cached in ~/invokeai/models in a format that is identical to the HuggingFace cache. - If HF_HOME is set, then models are cached wherever HF_HOME points. - To enable sharing with other HuggingFace library clients, set HF_HOME to ~/.cache/huggingface to set the default cache location or to ~/invokeai/models to have huggingface cache inside InvokeAI. * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * fix error "no attribute CkptInpaint" * model_manager.list_models() returns entire model config stanza+status * Initial Draft - Model Manager Diffusers * added hash function to diffusers * implement sha256 hashes on diffusers models * Add Model Manager Support for Diffusers * fix various problems with model manager - in cli import functions, fix not enough values to unpack from _get_name_and_desc() - fix crash when using old-style vae: value with new-style diffuser * rebuild frontend * fix dictconfig-not-serializable issue * fix NoneType' object is not subscriptable crash in model_manager * fix "str has no attribute get" error in model_manager list_models() * Add path and repo_id support for Diffusers Model Manager Also fixes bugs * Fix tooltip IT localization not working * Add Version Number To WebUI * Optimize Model Search * Fix incorrect font on the Model Manager UI * Fix image degradation on merge fixes - [Experimental] This change should effectively fix a couple of things. - Fix image degradation on subsequent merges of the canvas layers. - Fix the slight transparent border that is left behind when filling the bounding box with a color. - Fix the left over line of color when filling a bounding box with color. So far there are no side effects for this. If any, please report. * Add local model filtering for Diffusers / Checkpoints * Go to home on modal close for the Add Modal UI * Styling Fixes * Model Manager Diffusers Localization Update * Add Safe Tensor scanning to Model Manager * Fix model edit form dispatching string values instead of numbers. * Resolve VAE handling / edge cases for supplied repos * defer injecting tokens for textual inversions until they're used for the first time * squash a console warning * implement model migration check * add_model() overwrites previous config rather than merges * fix model config file attribute merging * fix precision handling in textual inversion script * allow ckpt conversion script to work with safetensors .ckpts Applied patch here: https://github.com/huggingface/diffusers/commit/beb932c5d111872c5e45387e7b1b2b3dd0524a47 * fix name "args" is not defined crash in textual_inversion_training * fix a second NameError: name 'args' is not defined crash * fix loading of the safety checker from the global cache dir * add installation step to textual inversion frontend - After a successful training run, the script will copy learned_embeds.bin to a subfolder of the embeddings directory. - User given the option to delete the logs and intermediate checkpoints (which together use 7-8G of space) - If textual inversion training fails, reports the error gracefully. * don't crash out on incompatible embeddings - put try: blocks around places where the system tries to load an embedding which is incompatible with the currently loaded model * add support for checkpoint resuming * textual inversion preferences are saved and restored between sessions - Preferences are stored in a file named text-inversion-training/preferences.conf - Currently the resume-from-checkpoint option is not working correctly. Possible bug in textual_inversion_training.py? * copy learned_embeddings.bin into right location * add front end for diffusers model merging - Front end doesn't do anything yet!!!! - Made change to model name parsing in CLI to support ability to have merged models with the "+" character in their names. * improve inpainting experience - recommend ckpt version of inpainting-1.5 to user - fix get_noise() bug in ckpt version of omnibus.py * update environment*yml * tweak instructions to install HuggingFace token * bump version number * enhance update scripts - update scripts will now fetch new INITIAL_MODELS.yaml so that configure_invokeai.py will know about the diffusers versions. * enhance invoke.sh/invoke.bat launchers - added configure_invokeai.py to menu - menu defaults to browser-based invoke * remove conda workflow (#2321) * fix `token_ids has shape torch.Size([79]) - expected [77]` * update CHANGELOG.md with 2.3.* info - Add information on how formats have changed and the upgrade process. - Add short bug list. Co-authored-by: Damian Stewart <d@damianstewart.com> Co-authored-by: Damian Stewart <null@damianstewart.com> Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> Co-authored-by: Wybartel-luxmc <37852506+Wybartel-luxmc@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> Co-authored-by: mickr777 <115216705+mickr777@users.noreply.github.com> Co-authored-by: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Co-authored-by: Eugene Brodsky <ebr@users.noreply.github.com> Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com>
2023-01-15 14:22:46 +00:00
import diffusers
import numpy as np
import skimage
use 🧨diffusers model (#1583) * initial commit of DiffusionPipeline class * spike: proof of concept using diffusers for txt2img * doc: type hints for Generator * refactor(model_cache): factor out load_ckpt * model_cache: add ability to load a diffusers model pipeline and update associated things in Generate & Generator to not instantly fail when that happens * model_cache: fix model default image dimensions * txt2img: support switching diffusers schedulers * diffusers: let the scheduler do its scaling of the initial latents Remove IPNDM scheduler; it is not behaving. * web server: update image_progress callback for diffusers data * diffusers: restore prompt weighting feature * diffusers: fix set-sampler error following model switch * diffusers: use InvokeAIDiffuserComponent for conditioning * cross_attention_control: stub (no-op) implementations for diffusers * model_cache: let offload_model work with DiffusionPipeline, sorta. * models.yaml.example: add diffusers-format model, set as default * test-invoke-conda: use diffusers-format model test-invoke-conda: put huggingface-token where the library can use it * environment-mac: upgrade to diffusers 0.7 (from 0.6) this was already done for linux; mac must have been lost in the merge. * preload_models: explicitly load diffusers models In non-interactive mode too, as long as you're logged in. * fix(model_cache): don't check `model.config` in diffusers format clean-up from recent merge. * diffusers integration: support img2img * dev: upgrade to diffusers 0.8 (from 0.7.1) We get to remove some code by using methods that were factored out in the base class. * refactor: remove backported img2img.get_timesteps now that we can use it directly from diffusers 0.8.1 * ci: use diffusers model * dev: upgrade to diffusers 0.9 (from 0.8.1) * lint: correct annotations for Python 3.9. * lint: correct AttributeError.name reference for Python 3.9. * CI: prefer diffusers-1.4 because it no longer requires a token The RunwayML models still do. * build: there's yet another place to update requirements? * configure: try to download models even without token Models in the CompVis and stabilityai repos no longer require them. (But runwayml still does.) * configure: add troubleshooting info for config-not-found * fix(configure): prepend root to config path * fix(configure): remove second `default: true` from models example * CI: simplify test-on-push logic now that we don't need secrets The "test on push but only in forks" logic was only necessary when tests didn't work for PRs-from-forks. * create an embedding_manager for diffusers * internal: avoid importing diffusers DummyObject see https://github.com/huggingface/diffusers/issues/1479 * fix "config attributes…not expected" diffusers warnings. * fix deprecated scheduler construction * work around an apparent MPS torch bug that causes conditioning to have no effect * 🚧 post-rebase repair * preliminary support for outpainting (no masking yet) * monkey-patch diffusers.attention and use Invoke lowvram code * add always_use_cpu arg to bypass MPS * add cross-attention control support to diffusers (fails on MPS) For unknown reasons MPS produces garbage output with .swap(). Use --always_use_cpu arg to invoke.py for now to test this code on MPS. * diffusers support for the inpainting model * fix debug_image to not crash with non-RGB images. * inpainting for the normal model [WIP] This seems to be performing well until the LAST STEP, at which point it dissolves to confetti. * fix off-by-one bug in cross-attention-control (#1774) prompt token sequences begin with a "beginning-of-sequence" marker <bos> and end with a repeated "end-of-sequence" marker <eos> - to make a default prompt length of <bos> + 75 prompt tokens + <eos>. the .swap() code was failing to take the column for <bos> at index 0 into account. the changes here do that, and also add extra handling for a single <eos> (which may be redundant but which is included for completeness). based on my understanding and some assumptions about how this all works, the reason .swap() nevertheless seemed to do the right thing, to some extent, is because over multiple steps the conditioning process in Stable Diffusion operates as a feedback loop. a change to token n-1 has flow-on effects to how the [1x4x64x64] latent tensor is modified by all the tokens after it, - and as the next step is processed, all the tokens before it as well. intuitively, a token's conditioning effects "echo" throughout the whole length of the prompt. so even though the token at n-1 was being edited when what the user actually wanted was to edit the token at n, it nevertheless still had some non-negligible effect, in roughly the right direction, often enough that it seemed like it was working properly. * refactor common CrossAttention stuff into a mixin so that the old ldm code can still work if necessary * inpainting for the normal model. I think it works this time. * diffusers: reset num_vectors_per_token sync with 44a00555718f1df173c60da0ed646cf700e29537 * diffusers: txt2img2img (hires_fix) with so much slicing and dicing of pipeline methods to stitch them together * refactor(diffusers): reduce some code duplication amongst the different tasks * fixup! refactor(diffusers): reduce some code duplication amongst the different tasks * diffusers: enable DPMSolver++ scheduler * diffusers: upgrade to diffusers 0.10, add Heun scheduler * diffusers(ModelCache): stopgap to make from_cpu compatible with diffusers * CI: default to diffusers-1.5 now that runwayml token requirement is gone * diffusers: update to 0.10 (and transformers to 4.25) * diffusers: use xformers when available diffusers no longer auto-enables this as of 0.10.2. * diffusers: make masked img2img behave better with multi-step schedulers re-randomizing the noise each step was confusing them. * diffusers: work more better with more models. fixed relative path problem with local models. fixed models on hub not always having a `fp16` branch. * diffusers: stopgap fix for attention_maps_callback crash after recent merge * fixup import merge conflicts correction for 061c5369a2247c6c92cd69606bcf54c4f1962a0b * test: add tests/inpainting inputs for masked img2img * diffusers(AddsMaskedGuidance): partial fix for k-schedulers Prevents them from crashing, but results are still hot garbage. * fix --safety_checker arg parsing and add note to diffusers loader about where safety checker gets called * generate: fix import error * CI: don't try to read the old init location * diffusers: support loading an alternate VAE * CI: remove sh-syntax if-statement so it doesn't crash powershell * CI: fold strings in yaml because backslash is not line-continuation in powershell * attention maps callback stuff for diffusers * build: fix syntax error in environment-mac * diffusers: add INITIAL_MODELS with diffusers-compatible repos * re-enable the embedding manager; closes #1778 * Squashed commit of the following: commit e4a956abc37fcb5cf188388b76b617bc5c8fda7d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:43:07 2022 +0100 import new load handling from EmbeddingManager and cleanup commit c4abe91a5ba0d415b45bf734068385668b7a66e6 Merge: 032e856e 1efc6397 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:09:53 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers_with_textual_inversion_manager commit 032e856eefb3bbc39534f5daafd25764bcfcef8b Merge: 8b4f0fe9 bc515e24 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:08:01 2022 +0100 Merge remote-tracking branch 'upstream/dev/diffusers' into dev/diffusers_with_textual_inversion_manager commit 1efc6397fc6e61c1aff4b0258b93089d61de5955 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:04:28 2022 +0100 cleanup and add performance notes commit e400f804ac471a0ca2ba432fd658778b20c7bdab Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:45:07 2022 +0100 fix bug and update unit tests commit deb9ae0ae1016750e93ce8275734061f7285a231 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:28:29 2022 +0100 textual inversion manager seems to work commit 162e02505dec777e91a983c4d0fb52e950d25ff0 Merge: cbad4583 12769b3d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:58:03 2022 +0100 Merge branch 'main' into feature_textual_inversion_mgr commit cbad45836c6aace6871a90f2621a953f49433131 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:54:10 2022 +0100 use position embeddings commit 070344c69b0e0db340a183857d0a787b348681d3 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:53:47 2022 +0100 Don't crash CLI on exceptions commit b035ac8c6772dfd9ba41b8eeb9103181cda028f8 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:11:55 2022 +0100 add missing position_embeddings commit 12769b3d3562ef71e0f54946b532ad077e10043c Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:33:25 2022 +0100 debugging why it don't work commit bafb7215eabe1515ca5e8388fd3bb2f3ac5362cf Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:21:33 2022 +0100 debugging why it don't work commit 664a6e9e146b42d96703f0cc8baf8f5efec04ee1 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit 8b4f0fe9d6e4e2643b36dfa27864294785d7ba4e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit ffbe1ab11163ba712e353d89404e301d0e0c6cdf Merge: 6e4dad60 023df37e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:37:31 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers commit 023df37efffa67434f77def7fc3c9dfb29f699fd Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:36:54 2022 +0100 cleanup commit 05fac594eaf79d0058e3c48deee93df603f136c2 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:07:49 2022 +0100 tweak error checking commit 009f32ed39a7280997c3ffab112adadee0b44279 Author: damian <null@damianstewart.com> Date: Thu Dec 15 21:29:47 2022 +0100 unit tests passing for embeddings with vector length >1 commit beb1b08d9a98112ed2fe073580568e1a18698da3 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:39:09 2022 +0100 more explicit equality tests when overwriting commit 44d8a5a7c85cdabc9ce3a54fd0769a10597b3ca9 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:30:13 2022 +0100 wip textual inversion manager (unit tests passing for 1v embedding overwriting) commit 417c2b57d90924a839616bfb66804faab8039e4c Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 12:30:55 2022 +0100 wip textual inversion manager (unit tests passing for base stuff + padding) commit 2e80872e3b6f7fd7d8eb8928822bd824b63cb2ff Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 10:57:57 2022 +0100 wip new TextualInversionManager * stop using WeightedFrozenCLIPEmbedder * store diffusion models locally - configure_invokeai.py reconfigured to store diffusion models rather than CompVis models - hugging face caching model is used, but cache is set to ~/invokeai/models/repo_id - models.yaml does **NOT** use path, just repo_id - "repo_name" changed to "repo_id" to following hugging face conventions - Models are loaded with full precision pending further work. * allow non-local files during development * path takes priority over repo_id * MVP for model_cache and configure_invokeai - Feature complete (almost) - configure_invokeai.py downloads both .ckpt and diffuser models, along with their VAEs. Both types of download are controlled by a unified INITIAL_MODELS.yaml file. - model_cache can load both type of model and switches back and forth in CPU. No memory leaks detected TO DO: 1. I have not yet turned on the LocalOnly flag for diffuser models, so the code will check the Hugging Face repo for updates before using the locally cached models. This will break firewalled systems. I am thinking of putting in a global check for internet connectivity at startup time and setting the LocalOnly flag based on this. It would be good to check updates if there is connectivity. 2. I have not gone completely through INITIAL_MODELS.yaml to check which models are available as diffusers and which are not. So models like PaperCut and VoxelArt may not load properly. The runway and stability models are checked, as well as the Trinart models. 3. Add stanzas for SD 2.0 and 2.1 in INITIAL_MODELS.yaml REMAINING PROBLEMS NOT DIRECTLY RELATED TO MODEL_CACHE: 1. When loading a .ckpt file there are lots of messages like this: Warning! ldm.modules.attention.CrossAttention is no longer being maintained. Please use InvokeAICrossAttention instead. I'm not sure how to address this. 2. The ckpt models ***don't actually run*** due to the lack of special-case support for them in the generator objects. For example, here's the hard crash you get when you run txt2img against the legacy waifu-diffusion-1.3 model: ``` >> An error occurred: Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 140, in main main_loop(gen, opt) File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 371, in main_loop gen.prompt2image( File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1265, in __getattr__ raise AttributeError("'{}' object has no attribute '{}'".format( AttributeError: 'LatentDiffusion' object has no attribute 'image_from_embeddings' ``` 3. The inpainting diffusion model isn't working. Here's the output of "banana sushi" when inpainting-1.5 is loaded: ``` Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 301, in image_from_embeddings result_latents, result_attention_map_saver = self.latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 330, in latents_from_embeddings result: PipelineIntermediateState = infer_latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 185, in __call__ for result in self.generator_method(*args, **kwargs): File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 367, in generate_latents_from_embeddings step_output = self.step(batched_t, latents, guidance_scale, File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context return func(*args, **kwargs) File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 409, in step step_output = self.scheduler.step(noise_pred, timestep, latents, **extra_step_kwargs) File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/diffusers/schedulers/scheduling_lms_discrete.py", line 223, in step pred_original_sample = sample - sigma * model_output RuntimeError: The size of tensor a (9) must match the size of tensor b (4) at non-singleton dimension 1 ``` * proper support for float32/float16 - configure script now correctly detects user's preference for fp16/32 and downloads the correct diffuser version. If fp16 version not available, falls back to fp32 version. - misc code cleanup and simplification in model_cache * add on-the-fly conversion of .ckpt to diffusers models 1. On-the-fly conversion code can be found in the file ldm/invoke/ckpt_to_diffusers.py. 2. A new !optimize command has been added to the CLI. Should be ported to Web GUI. User experience on the CLI is this: ``` invoke> !optimize /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt INFO: Converting legacy weights file /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt to optimized diffuser model. This operation will take 30-60s to complete. Success. Optimized model is now located at /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 Writing new config file entry for sd-v1-4... >> New configuration: sd-v1-4: description: Optimized version of sd-v1-4 format: diffusers path: /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 OK to import [n]? y >> Verifying that new model loads... >> Current VRAM usage: 2.60G >> Offloading stable-diffusion-2.1 to CPU >> Loading diffusers model from /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 | Using faster float16 precision You have disabled the safety checker for <class 'ldm.invoke.generator.diffusers_pipeline.StableDiffusionGeneratorPipeline'> by passing `safety_checker=None`. Ensure that you abide to the conditions of the Stable Diffusion \ license and do not expose unfiltered results in services or applications open to the public. Both the diffusers team and Hugging Face strongly recommend to keep the safety filter enabled in all public facing circumstances,\ disabling it only for use-cases that involve analyzing network behavior or auditing its results. For more information, please have a look at https://github.com/huggingface/diffusers/pull/254 . | training width x height = (512 x 512) >> Model loaded in 3.48s >> Max VRAM used to load the model: 2.17G >> Current VRAM usage:2.17G >> Textual inversions available: >> Setting Sampler to k_lms (LMSDiscreteScheduler) Keep model loaded? [y] ``` * add parallel set of generator files for ckpt legacy generation * generation using legacy ckpt models now working * diffusers: fix missing attention_maps_callback fix for 23eb80b40421b2bb8f4b6d3dd30490d11c447b36 * associate legacy CrossAttention with .ckpt models * enable autoconvert New --autoconvert CLI option will scan a designated directory for new .ckpt files, convert them into diffuser models, and import them into models.yaml. Works like this: invoke.py --autoconvert /path/to/weights/directory In ModelCache added two new methods: autoconvert_weights(config_path, weights_directory_path, models_directory_path) convert_and_import(ckpt_path, diffuser_path) * diffusers: update to diffusers 0.11 (from 0.10.2) * fix vae loading & width/height calculation * refactor: encapsulate these conditioning data into one container * diffusers: fix some noise-scaling issues by pushing the noise-mixing down to the common function * add support for safetensors and accelerate * set local_files_only when internet unreachable * diffusers: fix error-handling path when model repo has no fp16 branch * fix generatorinpaint error Fixes : "ModuleNotFoundError: No module named 'ldm.invoke.generatorinpaint' https://github.com/invoke-ai/InvokeAI/pull/1583#issuecomment-1363634318 * quench diffuser safety-checker warning * diffusers: support stochastic DDIM eta parameter * fix conda env creation on macos * fix cross-attention with diffusers 0.11 * diffusers: the VAE needs to be tiling as well as the U-Net * diffusers: comment on subfolders * diffusers: embiggen! * diffusers: make model_cache.list_models serializable * diffusers(inpaint): restore scaling functionality * fix requirements clash between numba and numpy 1.24 * diffusers: allow inpainting model to do non-inpainting tasks * start expanding model_cache functionality * add import_ckpt_model() and import_diffuser_model() methods to model_manager - in addition, model_cache.py is now renamed to model_manager.py * allow "recommended" flag to be optional in INITIAL_MODELS.yaml * configure_invokeai now downloads VAE diffusers in advance * rename ModelCache to ModelManager * remove support for `repo_name` in models.yaml * check for and refuse to load embeddings trained on incompatible models * models.yaml.example: s/repo_name/repo_id and remove extra INITIAL_MODELS now that the main one has diffusers models in it. * add MVP textual inversion script * refactor(InvokeAIDiffuserComponent): factor out _combine() * InvokeAIDiffuserComponent: implement threshold * InvokeAIDiffuserComponent: diagnostic logs for threshold ...this does not look right * add a curses-based frontend to textual inversion - not quite working yet - requires npyscreen installed - on windows will also have the windows-curses requirement, but not added to requirements yet * add curses-based interface for textual inversion * fix crash in convert_and_import() - This corrects a "local variable referenced before assignment" error in model_manager.convert_and_import() * potential workaround for no 'state_dict' key error - As reported in https://github.com/huggingface/diffusers/issues/1876 * create TI output dir if needed * Update environment-lin-cuda.yml (#2159) Fixing line 42 to be the proper order to define the transformers requirement: ~= instead of =~ * diffusers: update sampler-to-scheduler mapping based on https://github.com/huggingface/diffusers/issues/277#issuecomment-1371428672 * improve user exp for ckt to diffusers conversion - !optimize_models command now operates on an existing ckpt file entry in models.yaml - replaces existing entry, rather than adding a new one - offers to delete the ckpt file after conversion * web: adapt progress callback to deal with old generator or new diffusers pipeline * clean-up model_manager code - add_model() verified to work for .ckpt local paths, .ckpt remote URLs, diffusers local paths, and diffusers repo_ids - convert_and_import() verified to work for local and remove .ckpt files * handle edge cases for import_model() and convert_model() * add support for safetensor .ckpt files * fix name error * code cleanup with pyflake * improve model setting behavior - If the user enters an invalid model name at startup time, will not try to load it, warn, and use default model - CLI UI enhancement: include currently active model in the command line prompt. * update test-invoke-pip.yml - fix model cache path to point to runwayml/stable-diffusion-v1-5 - remove `skip-sd-weights` from configure_invokeai.py args * exclude dev/diffusers from "fail for draft PRs" * disable "fail on PR jobs" * re-add `--skip-sd-weights` since no space * update workflow environments - include `INVOKE_MODEL_RECONFIGURE: '--yes'` * clean up model load failure handling - Allow CLI to run even when no model is defined or loadable. - Inhibit stack trace when model load fails - only show last error - Give user *option* to run configure_invokeai.py when no models successfully load. - Restart invokeai after reconfiguration. * further edge-case handling 1) only one model in models.yaml file, and that model is broken 2) no models in models.yaml 3) models.yaml doesn't exist at all * fix incorrect model status listing - "cached" was not being returned from list_models() - normalize handling of exceptions during model loading: - Passing an invalid model name to generate.set_model() will return a KeyError - All other exceptions are returned as the appropriate Exception * CI: do download weights (if not already cached) * diffusers: fix scheduler loading in offline mode * CI: fix model name (no longer has `diffusers-` prefix) * Update txt2img2img.py (#2256) * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * feat - make model storage compatible with hugging face caching system This commit alters the InvokeAI model directory to be compatible with hugging face, making it easier to share diffusers (and other models) across different programs. - If the HF_HOME environment variable is not set, then models are cached in ~/invokeai/models in a format that is identical to the HuggingFace cache. - If HF_HOME is set, then models are cached wherever HF_HOME points. - To enable sharing with other HuggingFace library clients, set HF_HOME to ~/.cache/huggingface to set the default cache location or to ~/invokeai/models to have huggingface cache inside InvokeAI. * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * fix error "no attribute CkptInpaint" * model_manager.list_models() returns entire model config stanza+status * Initial Draft - Model Manager Diffusers * added hash function to diffusers * implement sha256 hashes on diffusers models * Add Model Manager Support for Diffusers * fix various problems with model manager - in cli import functions, fix not enough values to unpack from _get_name_and_desc() - fix crash when using old-style vae: value with new-style diffuser * rebuild frontend * fix dictconfig-not-serializable issue * fix NoneType' object is not subscriptable crash in model_manager * fix "str has no attribute get" error in model_manager list_models() * Add path and repo_id support for Diffusers Model Manager Also fixes bugs * Fix tooltip IT localization not working * Add Version Number To WebUI * Optimize Model Search * Fix incorrect font on the Model Manager UI * Fix image degradation on merge fixes - [Experimental] This change should effectively fix a couple of things. - Fix image degradation on subsequent merges of the canvas layers. - Fix the slight transparent border that is left behind when filling the bounding box with a color. - Fix the left over line of color when filling a bounding box with color. So far there are no side effects for this. If any, please report. * Add local model filtering for Diffusers / Checkpoints * Go to home on modal close for the Add Modal UI * Styling Fixes * Model Manager Diffusers Localization Update * Add Safe Tensor scanning to Model Manager * Fix model edit form dispatching string values instead of numbers. * Resolve VAE handling / edge cases for supplied repos * defer injecting tokens for textual inversions until they're used for the first time * squash a console warning * implement model migration check * add_model() overwrites previous config rather than merges * fix model config file attribute merging * fix precision handling in textual inversion script * allow ckpt conversion script to work with safetensors .ckpts Applied patch here: https://github.com/huggingface/diffusers/commit/beb932c5d111872c5e45387e7b1b2b3dd0524a47 * fix name "args" is not defined crash in textual_inversion_training * fix a second NameError: name 'args' is not defined crash * fix loading of the safety checker from the global cache dir * add installation step to textual inversion frontend - After a successful training run, the script will copy learned_embeds.bin to a subfolder of the embeddings directory. - User given the option to delete the logs and intermediate checkpoints (which together use 7-8G of space) - If textual inversion training fails, reports the error gracefully. * don't crash out on incompatible embeddings - put try: blocks around places where the system tries to load an embedding which is incompatible with the currently loaded model * add support for checkpoint resuming * textual inversion preferences are saved and restored between sessions - Preferences are stored in a file named text-inversion-training/preferences.conf - Currently the resume-from-checkpoint option is not working correctly. Possible bug in textual_inversion_training.py? * copy learned_embeddings.bin into right location * add front end for diffusers model merging - Front end doesn't do anything yet!!!! - Made change to model name parsing in CLI to support ability to have merged models with the "+" character in their names. * improve inpainting experience - recommend ckpt version of inpainting-1.5 to user - fix get_noise() bug in ckpt version of omnibus.py * update environment*yml * tweak instructions to install HuggingFace token * bump version number * enhance update scripts - update scripts will now fetch new INITIAL_MODELS.yaml so that configure_invokeai.py will know about the diffusers versions. * enhance invoke.sh/invoke.bat launchers - added configure_invokeai.py to menu - menu defaults to browser-based invoke * remove conda workflow (#2321) * fix `token_ids has shape torch.Size([79]) - expected [77]` * update CHANGELOG.md with 2.3.* info - Add information on how formats have changed and the upgrade process. - Add short bug list. Co-authored-by: Damian Stewart <d@damianstewart.com> Co-authored-by: Damian Stewart <null@damianstewart.com> Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> Co-authored-by: Wybartel-luxmc <37852506+Wybartel-luxmc@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> Co-authored-by: mickr777 <115216705+mickr777@users.noreply.github.com> Co-authored-by: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Co-authored-by: Eugene Brodsky <ebr@users.noreply.github.com> Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com>
2023-01-15 14:22:46 +00:00
import torch
import transformers
Refactoring simplet2i (#387) * start refactoring -not yet functional * first phase of refactor done - not sure weighted prompts working * Second phase of refactoring. Everything mostly working. * The refactoring has moved all the hard-core inference work into ldm.dream.generator.*, where there are submodules for txt2img and img2img. inpaint will go in there as well. * Some additional refactoring will be done soon, but relatively minor work. * fix -save_orig flag to actually work * add @neonsecret attention.py memory optimization * remove unneeded imports * move token logging into conditioning.py * add placeholder version of inpaint; porting in progress * fix crash in img2img * inpainting working; not tested on variations * fix crashes in img2img * ported attention.py memory optimization #117 from basujindal branch * added @torch_no_grad() decorators to img2img, txt2img, inpaint closures * Final commit prior to PR against development * fixup crash when generating intermediate images in web UI * rename ldm.simplet2i to ldm.generate * add backward-compatibility simplet2i shell with deprecation warning * add back in mps exception, addresses @vargol comment in #354 * replaced Conditioning class with exported functions * fix wrong type of with_variations attribute during intialization * changed "image_iterator()" to "get_make_image()" * raise NotImplementedError for calling get_make_image() in parent class * Update ldm/generate.py better error message Co-authored-by: Kevin Gibbons <bakkot@gmail.com> * minor stylistic fixes and assertion checks from code review * moved get_noise() method into img2img class * break get_noise() into two methods, one for txt2img and the other for img2img * inpainting works on non-square images now * make get_noise() an abstract method in base class * much improved inpainting Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
2022-09-06 00:40:10 +00:00
from PIL import Image, ImageOps
use 🧨diffusers model (#1583) * initial commit of DiffusionPipeline class * spike: proof of concept using diffusers for txt2img * doc: type hints for Generator * refactor(model_cache): factor out load_ckpt * model_cache: add ability to load a diffusers model pipeline and update associated things in Generate & Generator to not instantly fail when that happens * model_cache: fix model default image dimensions * txt2img: support switching diffusers schedulers * diffusers: let the scheduler do its scaling of the initial latents Remove IPNDM scheduler; it is not behaving. * web server: update image_progress callback for diffusers data * diffusers: restore prompt weighting feature * diffusers: fix set-sampler error following model switch * diffusers: use InvokeAIDiffuserComponent for conditioning * cross_attention_control: stub (no-op) implementations for diffusers * model_cache: let offload_model work with DiffusionPipeline, sorta. * models.yaml.example: add diffusers-format model, set as default * test-invoke-conda: use diffusers-format model test-invoke-conda: put huggingface-token where the library can use it * environment-mac: upgrade to diffusers 0.7 (from 0.6) this was already done for linux; mac must have been lost in the merge. * preload_models: explicitly load diffusers models In non-interactive mode too, as long as you're logged in. * fix(model_cache): don't check `model.config` in diffusers format clean-up from recent merge. * diffusers integration: support img2img * dev: upgrade to diffusers 0.8 (from 0.7.1) We get to remove some code by using methods that were factored out in the base class. * refactor: remove backported img2img.get_timesteps now that we can use it directly from diffusers 0.8.1 * ci: use diffusers model * dev: upgrade to diffusers 0.9 (from 0.8.1) * lint: correct annotations for Python 3.9. * lint: correct AttributeError.name reference for Python 3.9. * CI: prefer diffusers-1.4 because it no longer requires a token The RunwayML models still do. * build: there's yet another place to update requirements? * configure: try to download models even without token Models in the CompVis and stabilityai repos no longer require them. (But runwayml still does.) * configure: add troubleshooting info for config-not-found * fix(configure): prepend root to config path * fix(configure): remove second `default: true` from models example * CI: simplify test-on-push logic now that we don't need secrets The "test on push but only in forks" logic was only necessary when tests didn't work for PRs-from-forks. * create an embedding_manager for diffusers * internal: avoid importing diffusers DummyObject see https://github.com/huggingface/diffusers/issues/1479 * fix "config attributes…not expected" diffusers warnings. * fix deprecated scheduler construction * work around an apparent MPS torch bug that causes conditioning to have no effect * 🚧 post-rebase repair * preliminary support for outpainting (no masking yet) * monkey-patch diffusers.attention and use Invoke lowvram code * add always_use_cpu arg to bypass MPS * add cross-attention control support to diffusers (fails on MPS) For unknown reasons MPS produces garbage output with .swap(). Use --always_use_cpu arg to invoke.py for now to test this code on MPS. * diffusers support for the inpainting model * fix debug_image to not crash with non-RGB images. * inpainting for the normal model [WIP] This seems to be performing well until the LAST STEP, at which point it dissolves to confetti. * fix off-by-one bug in cross-attention-control (#1774) prompt token sequences begin with a "beginning-of-sequence" marker <bos> and end with a repeated "end-of-sequence" marker <eos> - to make a default prompt length of <bos> + 75 prompt tokens + <eos>. the .swap() code was failing to take the column for <bos> at index 0 into account. the changes here do that, and also add extra handling for a single <eos> (which may be redundant but which is included for completeness). based on my understanding and some assumptions about how this all works, the reason .swap() nevertheless seemed to do the right thing, to some extent, is because over multiple steps the conditioning process in Stable Diffusion operates as a feedback loop. a change to token n-1 has flow-on effects to how the [1x4x64x64] latent tensor is modified by all the tokens after it, - and as the next step is processed, all the tokens before it as well. intuitively, a token's conditioning effects "echo" throughout the whole length of the prompt. so even though the token at n-1 was being edited when what the user actually wanted was to edit the token at n, it nevertheless still had some non-negligible effect, in roughly the right direction, often enough that it seemed like it was working properly. * refactor common CrossAttention stuff into a mixin so that the old ldm code can still work if necessary * inpainting for the normal model. I think it works this time. * diffusers: reset num_vectors_per_token sync with 44a00555718f1df173c60da0ed646cf700e29537 * diffusers: txt2img2img (hires_fix) with so much slicing and dicing of pipeline methods to stitch them together * refactor(diffusers): reduce some code duplication amongst the different tasks * fixup! refactor(diffusers): reduce some code duplication amongst the different tasks * diffusers: enable DPMSolver++ scheduler * diffusers: upgrade to diffusers 0.10, add Heun scheduler * diffusers(ModelCache): stopgap to make from_cpu compatible with diffusers * CI: default to diffusers-1.5 now that runwayml token requirement is gone * diffusers: update to 0.10 (and transformers to 4.25) * diffusers: use xformers when available diffusers no longer auto-enables this as of 0.10.2. * diffusers: make masked img2img behave better with multi-step schedulers re-randomizing the noise each step was confusing them. * diffusers: work more better with more models. fixed relative path problem with local models. fixed models on hub not always having a `fp16` branch. * diffusers: stopgap fix for attention_maps_callback crash after recent merge * fixup import merge conflicts correction for 061c5369a2247c6c92cd69606bcf54c4f1962a0b * test: add tests/inpainting inputs for masked img2img * diffusers(AddsMaskedGuidance): partial fix for k-schedulers Prevents them from crashing, but results are still hot garbage. * fix --safety_checker arg parsing and add note to diffusers loader about where safety checker gets called * generate: fix import error * CI: don't try to read the old init location * diffusers: support loading an alternate VAE * CI: remove sh-syntax if-statement so it doesn't crash powershell * CI: fold strings in yaml because backslash is not line-continuation in powershell * attention maps callback stuff for diffusers * build: fix syntax error in environment-mac * diffusers: add INITIAL_MODELS with diffusers-compatible repos * re-enable the embedding manager; closes #1778 * Squashed commit of the following: commit e4a956abc37fcb5cf188388b76b617bc5c8fda7d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:43:07 2022 +0100 import new load handling from EmbeddingManager and cleanup commit c4abe91a5ba0d415b45bf734068385668b7a66e6 Merge: 032e856e 1efc6397 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:09:53 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers_with_textual_inversion_manager commit 032e856eefb3bbc39534f5daafd25764bcfcef8b Merge: 8b4f0fe9 bc515e24 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:08:01 2022 +0100 Merge remote-tracking branch 'upstream/dev/diffusers' into dev/diffusers_with_textual_inversion_manager commit 1efc6397fc6e61c1aff4b0258b93089d61de5955 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:04:28 2022 +0100 cleanup and add performance notes commit e400f804ac471a0ca2ba432fd658778b20c7bdab Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:45:07 2022 +0100 fix bug and update unit tests commit deb9ae0ae1016750e93ce8275734061f7285a231 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:28:29 2022 +0100 textual inversion manager seems to work commit 162e02505dec777e91a983c4d0fb52e950d25ff0 Merge: cbad4583 12769b3d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:58:03 2022 +0100 Merge branch 'main' into feature_textual_inversion_mgr commit cbad45836c6aace6871a90f2621a953f49433131 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:54:10 2022 +0100 use position embeddings commit 070344c69b0e0db340a183857d0a787b348681d3 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:53:47 2022 +0100 Don't crash CLI on exceptions commit b035ac8c6772dfd9ba41b8eeb9103181cda028f8 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:11:55 2022 +0100 add missing position_embeddings commit 12769b3d3562ef71e0f54946b532ad077e10043c Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:33:25 2022 +0100 debugging why it don't work commit bafb7215eabe1515ca5e8388fd3bb2f3ac5362cf Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:21:33 2022 +0100 debugging why it don't work commit 664a6e9e146b42d96703f0cc8baf8f5efec04ee1 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit 8b4f0fe9d6e4e2643b36dfa27864294785d7ba4e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit ffbe1ab11163ba712e353d89404e301d0e0c6cdf Merge: 6e4dad60 023df37e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:37:31 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers commit 023df37efffa67434f77def7fc3c9dfb29f699fd Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:36:54 2022 +0100 cleanup commit 05fac594eaf79d0058e3c48deee93df603f136c2 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:07:49 2022 +0100 tweak error checking commit 009f32ed39a7280997c3ffab112adadee0b44279 Author: damian <null@damianstewart.com> Date: Thu Dec 15 21:29:47 2022 +0100 unit tests passing for embeddings with vector length >1 commit beb1b08d9a98112ed2fe073580568e1a18698da3 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:39:09 2022 +0100 more explicit equality tests when overwriting commit 44d8a5a7c85cdabc9ce3a54fd0769a10597b3ca9 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:30:13 2022 +0100 wip textual inversion manager (unit tests passing for 1v embedding overwriting) commit 417c2b57d90924a839616bfb66804faab8039e4c Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 12:30:55 2022 +0100 wip textual inversion manager (unit tests passing for base stuff + padding) commit 2e80872e3b6f7fd7d8eb8928822bd824b63cb2ff Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 10:57:57 2022 +0100 wip new TextualInversionManager * stop using WeightedFrozenCLIPEmbedder * store diffusion models locally - configure_invokeai.py reconfigured to store diffusion models rather than CompVis models - hugging face caching model is used, but cache is set to ~/invokeai/models/repo_id - models.yaml does **NOT** use path, just repo_id - "repo_name" changed to "repo_id" to following hugging face conventions - Models are loaded with full precision pending further work. * allow non-local files during development * path takes priority over repo_id * MVP for model_cache and configure_invokeai - Feature complete (almost) - configure_invokeai.py downloads both .ckpt and diffuser models, along with their VAEs. Both types of download are controlled by a unified INITIAL_MODELS.yaml file. - model_cache can load both type of model and switches back and forth in CPU. No memory leaks detected TO DO: 1. I have not yet turned on the LocalOnly flag for diffuser models, so the code will check the Hugging Face repo for updates before using the locally cached models. This will break firewalled systems. I am thinking of putting in a global check for internet connectivity at startup time and setting the LocalOnly flag based on this. It would be good to check updates if there is connectivity. 2. I have not gone completely through INITIAL_MODELS.yaml to check which models are available as diffusers and which are not. So models like PaperCut and VoxelArt may not load properly. The runway and stability models are checked, as well as the Trinart models. 3. Add stanzas for SD 2.0 and 2.1 in INITIAL_MODELS.yaml REMAINING PROBLEMS NOT DIRECTLY RELATED TO MODEL_CACHE: 1. When loading a .ckpt file there are lots of messages like this: Warning! ldm.modules.attention.CrossAttention is no longer being maintained. Please use InvokeAICrossAttention instead. I'm not sure how to address this. 2. The ckpt models ***don't actually run*** due to the lack of special-case support for them in the generator objects. For example, here's the hard crash you get when you run txt2img against the legacy waifu-diffusion-1.3 model: ``` >> An error occurred: Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 140, in main main_loop(gen, opt) File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 371, in main_loop gen.prompt2image( File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1265, in __getattr__ raise AttributeError("'{}' object has no attribute '{}'".format( AttributeError: 'LatentDiffusion' object has no attribute 'image_from_embeddings' ``` 3. The inpainting diffusion model isn't working. Here's the output of "banana sushi" when inpainting-1.5 is loaded: ``` Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 301, in image_from_embeddings result_latents, result_attention_map_saver = self.latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 330, in latents_from_embeddings result: PipelineIntermediateState = infer_latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 185, in __call__ for result in self.generator_method(*args, **kwargs): File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 367, in generate_latents_from_embeddings step_output = self.step(batched_t, latents, guidance_scale, File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context return func(*args, **kwargs) File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 409, in step step_output = self.scheduler.step(noise_pred, timestep, latents, **extra_step_kwargs) File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/diffusers/schedulers/scheduling_lms_discrete.py", line 223, in step pred_original_sample = sample - sigma * model_output RuntimeError: The size of tensor a (9) must match the size of tensor b (4) at non-singleton dimension 1 ``` * proper support for float32/float16 - configure script now correctly detects user's preference for fp16/32 and downloads the correct diffuser version. If fp16 version not available, falls back to fp32 version. - misc code cleanup and simplification in model_cache * add on-the-fly conversion of .ckpt to diffusers models 1. On-the-fly conversion code can be found in the file ldm/invoke/ckpt_to_diffusers.py. 2. A new !optimize command has been added to the CLI. Should be ported to Web GUI. User experience on the CLI is this: ``` invoke> !optimize /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt INFO: Converting legacy weights file /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt to optimized diffuser model. This operation will take 30-60s to complete. Success. Optimized model is now located at /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 Writing new config file entry for sd-v1-4... >> New configuration: sd-v1-4: description: Optimized version of sd-v1-4 format: diffusers path: /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 OK to import [n]? y >> Verifying that new model loads... >> Current VRAM usage: 2.60G >> Offloading stable-diffusion-2.1 to CPU >> Loading diffusers model from /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 | Using faster float16 precision You have disabled the safety checker for <class 'ldm.invoke.generator.diffusers_pipeline.StableDiffusionGeneratorPipeline'> by passing `safety_checker=None`. Ensure that you abide to the conditions of the Stable Diffusion \ license and do not expose unfiltered results in services or applications open to the public. Both the diffusers team and Hugging Face strongly recommend to keep the safety filter enabled in all public facing circumstances,\ disabling it only for use-cases that involve analyzing network behavior or auditing its results. For more information, please have a look at https://github.com/huggingface/diffusers/pull/254 . | training width x height = (512 x 512) >> Model loaded in 3.48s >> Max VRAM used to load the model: 2.17G >> Current VRAM usage:2.17G >> Textual inversions available: >> Setting Sampler to k_lms (LMSDiscreteScheduler) Keep model loaded? [y] ``` * add parallel set of generator files for ckpt legacy generation * generation using legacy ckpt models now working * diffusers: fix missing attention_maps_callback fix for 23eb80b40421b2bb8f4b6d3dd30490d11c447b36 * associate legacy CrossAttention with .ckpt models * enable autoconvert New --autoconvert CLI option will scan a designated directory for new .ckpt files, convert them into diffuser models, and import them into models.yaml. Works like this: invoke.py --autoconvert /path/to/weights/directory In ModelCache added two new methods: autoconvert_weights(config_path, weights_directory_path, models_directory_path) convert_and_import(ckpt_path, diffuser_path) * diffusers: update to diffusers 0.11 (from 0.10.2) * fix vae loading & width/height calculation * refactor: encapsulate these conditioning data into one container * diffusers: fix some noise-scaling issues by pushing the noise-mixing down to the common function * add support for safetensors and accelerate * set local_files_only when internet unreachable * diffusers: fix error-handling path when model repo has no fp16 branch * fix generatorinpaint error Fixes : "ModuleNotFoundError: No module named 'ldm.invoke.generatorinpaint' https://github.com/invoke-ai/InvokeAI/pull/1583#issuecomment-1363634318 * quench diffuser safety-checker warning * diffusers: support stochastic DDIM eta parameter * fix conda env creation on macos * fix cross-attention with diffusers 0.11 * diffusers: the VAE needs to be tiling as well as the U-Net * diffusers: comment on subfolders * diffusers: embiggen! * diffusers: make model_cache.list_models serializable * diffusers(inpaint): restore scaling functionality * fix requirements clash between numba and numpy 1.24 * diffusers: allow inpainting model to do non-inpainting tasks * start expanding model_cache functionality * add import_ckpt_model() and import_diffuser_model() methods to model_manager - in addition, model_cache.py is now renamed to model_manager.py * allow "recommended" flag to be optional in INITIAL_MODELS.yaml * configure_invokeai now downloads VAE diffusers in advance * rename ModelCache to ModelManager * remove support for `repo_name` in models.yaml * check for and refuse to load embeddings trained on incompatible models * models.yaml.example: s/repo_name/repo_id and remove extra INITIAL_MODELS now that the main one has diffusers models in it. * add MVP textual inversion script * refactor(InvokeAIDiffuserComponent): factor out _combine() * InvokeAIDiffuserComponent: implement threshold * InvokeAIDiffuserComponent: diagnostic logs for threshold ...this does not look right * add a curses-based frontend to textual inversion - not quite working yet - requires npyscreen installed - on windows will also have the windows-curses requirement, but not added to requirements yet * add curses-based interface for textual inversion * fix crash in convert_and_import() - This corrects a "local variable referenced before assignment" error in model_manager.convert_and_import() * potential workaround for no 'state_dict' key error - As reported in https://github.com/huggingface/diffusers/issues/1876 * create TI output dir if needed * Update environment-lin-cuda.yml (#2159) Fixing line 42 to be the proper order to define the transformers requirement: ~= instead of =~ * diffusers: update sampler-to-scheduler mapping based on https://github.com/huggingface/diffusers/issues/277#issuecomment-1371428672 * improve user exp for ckt to diffusers conversion - !optimize_models command now operates on an existing ckpt file entry in models.yaml - replaces existing entry, rather than adding a new one - offers to delete the ckpt file after conversion * web: adapt progress callback to deal with old generator or new diffusers pipeline * clean-up model_manager code - add_model() verified to work for .ckpt local paths, .ckpt remote URLs, diffusers local paths, and diffusers repo_ids - convert_and_import() verified to work for local and remove .ckpt files * handle edge cases for import_model() and convert_model() * add support for safetensor .ckpt files * fix name error * code cleanup with pyflake * improve model setting behavior - If the user enters an invalid model name at startup time, will not try to load it, warn, and use default model - CLI UI enhancement: include currently active model in the command line prompt. * update test-invoke-pip.yml - fix model cache path to point to runwayml/stable-diffusion-v1-5 - remove `skip-sd-weights` from configure_invokeai.py args * exclude dev/diffusers from "fail for draft PRs" * disable "fail on PR jobs" * re-add `--skip-sd-weights` since no space * update workflow environments - include `INVOKE_MODEL_RECONFIGURE: '--yes'` * clean up model load failure handling - Allow CLI to run even when no model is defined or loadable. - Inhibit stack trace when model load fails - only show last error - Give user *option* to run configure_invokeai.py when no models successfully load. - Restart invokeai after reconfiguration. * further edge-case handling 1) only one model in models.yaml file, and that model is broken 2) no models in models.yaml 3) models.yaml doesn't exist at all * fix incorrect model status listing - "cached" was not being returned from list_models() - normalize handling of exceptions during model loading: - Passing an invalid model name to generate.set_model() will return a KeyError - All other exceptions are returned as the appropriate Exception * CI: do download weights (if not already cached) * diffusers: fix scheduler loading in offline mode * CI: fix model name (no longer has `diffusers-` prefix) * Update txt2img2img.py (#2256) * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * feat - make model storage compatible with hugging face caching system This commit alters the InvokeAI model directory to be compatible with hugging face, making it easier to share diffusers (and other models) across different programs. - If the HF_HOME environment variable is not set, then models are cached in ~/invokeai/models in a format that is identical to the HuggingFace cache. - If HF_HOME is set, then models are cached wherever HF_HOME points. - To enable sharing with other HuggingFace library clients, set HF_HOME to ~/.cache/huggingface to set the default cache location or to ~/invokeai/models to have huggingface cache inside InvokeAI. * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * fix error "no attribute CkptInpaint" * model_manager.list_models() returns entire model config stanza+status * Initial Draft - Model Manager Diffusers * added hash function to diffusers * implement sha256 hashes on diffusers models * Add Model Manager Support for Diffusers * fix various problems with model manager - in cli import functions, fix not enough values to unpack from _get_name_and_desc() - fix crash when using old-style vae: value with new-style diffuser * rebuild frontend * fix dictconfig-not-serializable issue * fix NoneType' object is not subscriptable crash in model_manager * fix "str has no attribute get" error in model_manager list_models() * Add path and repo_id support for Diffusers Model Manager Also fixes bugs * Fix tooltip IT localization not working * Add Version Number To WebUI * Optimize Model Search * Fix incorrect font on the Model Manager UI * Fix image degradation on merge fixes - [Experimental] This change should effectively fix a couple of things. - Fix image degradation on subsequent merges of the canvas layers. - Fix the slight transparent border that is left behind when filling the bounding box with a color. - Fix the left over line of color when filling a bounding box with color. So far there are no side effects for this. If any, please report. * Add local model filtering for Diffusers / Checkpoints * Go to home on modal close for the Add Modal UI * Styling Fixes * Model Manager Diffusers Localization Update * Add Safe Tensor scanning to Model Manager * Fix model edit form dispatching string values instead of numbers. * Resolve VAE handling / edge cases for supplied repos * defer injecting tokens for textual inversions until they're used for the first time * squash a console warning * implement model migration check * add_model() overwrites previous config rather than merges * fix model config file attribute merging * fix precision handling in textual inversion script * allow ckpt conversion script to work with safetensors .ckpts Applied patch here: https://github.com/huggingface/diffusers/commit/beb932c5d111872c5e45387e7b1b2b3dd0524a47 * fix name "args" is not defined crash in textual_inversion_training * fix a second NameError: name 'args' is not defined crash * fix loading of the safety checker from the global cache dir * add installation step to textual inversion frontend - After a successful training run, the script will copy learned_embeds.bin to a subfolder of the embeddings directory. - User given the option to delete the logs and intermediate checkpoints (which together use 7-8G of space) - If textual inversion training fails, reports the error gracefully. * don't crash out on incompatible embeddings - put try: blocks around places where the system tries to load an embedding which is incompatible with the currently loaded model * add support for checkpoint resuming * textual inversion preferences are saved and restored between sessions - Preferences are stored in a file named text-inversion-training/preferences.conf - Currently the resume-from-checkpoint option is not working correctly. Possible bug in textual_inversion_training.py? * copy learned_embeddings.bin into right location * add front end for diffusers model merging - Front end doesn't do anything yet!!!! - Made change to model name parsing in CLI to support ability to have merged models with the "+" character in their names. * improve inpainting experience - recommend ckpt version of inpainting-1.5 to user - fix get_noise() bug in ckpt version of omnibus.py * update environment*yml * tweak instructions to install HuggingFace token * bump version number * enhance update scripts - update scripts will now fetch new INITIAL_MODELS.yaml so that configure_invokeai.py will know about the diffusers versions. * enhance invoke.sh/invoke.bat launchers - added configure_invokeai.py to menu - menu defaults to browser-based invoke * remove conda workflow (#2321) * fix `token_ids has shape torch.Size([79]) - expected [77]` * update CHANGELOG.md with 2.3.* info - Add information on how formats have changed and the upgrade process. - Add short bug list. Co-authored-by: Damian Stewart <d@damianstewart.com> Co-authored-by: Damian Stewart <null@damianstewart.com> Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> Co-authored-by: Wybartel-luxmc <37852506+Wybartel-luxmc@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> Co-authored-by: mickr777 <115216705+mickr777@users.noreply.github.com> Co-authored-by: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Co-authored-by: Eugene Brodsky <ebr@users.noreply.github.com> Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com>
2023-01-15 14:22:46 +00:00
from diffusers.pipeline_utils import DiffusionPipeline
from omegaconf import OmegaConf
from pytorch_lightning import seed_everything, logging
Refactoring simplet2i (#387) * start refactoring -not yet functional * first phase of refactor done - not sure weighted prompts working * Second phase of refactoring. Everything mostly working. * The refactoring has moved all the hard-core inference work into ldm.dream.generator.*, where there are submodules for txt2img and img2img. inpaint will go in there as well. * Some additional refactoring will be done soon, but relatively minor work. * fix -save_orig flag to actually work * add @neonsecret attention.py memory optimization * remove unneeded imports * move token logging into conditioning.py * add placeholder version of inpaint; porting in progress * fix crash in img2img * inpainting working; not tested on variations * fix crashes in img2img * ported attention.py memory optimization #117 from basujindal branch * added @torch_no_grad() decorators to img2img, txt2img, inpaint closures * Final commit prior to PR against development * fixup crash when generating intermediate images in web UI * rename ldm.simplet2i to ldm.generate * add backward-compatibility simplet2i shell with deprecation warning * add back in mps exception, addresses @vargol comment in #354 * replaced Conditioning class with exported functions * fix wrong type of with_variations attribute during intialization * changed "image_iterator()" to "get_make_image()" * raise NotImplementedError for calling get_make_image() in parent class * Update ldm/generate.py better error message Co-authored-by: Kevin Gibbons <bakkot@gmail.com> * minor stylistic fixes and assertion checks from code review * moved get_noise() method into img2img class * break get_noise() into two methods, one for txt2img and the other for img2img * inpainting works on non-square images now * make get_noise() an abstract method in base class * much improved inpainting Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
2022-09-06 00:40:10 +00:00
use 🧨diffusers model (#1583) * initial commit of DiffusionPipeline class * spike: proof of concept using diffusers for txt2img * doc: type hints for Generator * refactor(model_cache): factor out load_ckpt * model_cache: add ability to load a diffusers model pipeline and update associated things in Generate & Generator to not instantly fail when that happens * model_cache: fix model default image dimensions * txt2img: support switching diffusers schedulers * diffusers: let the scheduler do its scaling of the initial latents Remove IPNDM scheduler; it is not behaving. * web server: update image_progress callback for diffusers data * diffusers: restore prompt weighting feature * diffusers: fix set-sampler error following model switch * diffusers: use InvokeAIDiffuserComponent for conditioning * cross_attention_control: stub (no-op) implementations for diffusers * model_cache: let offload_model work with DiffusionPipeline, sorta. * models.yaml.example: add diffusers-format model, set as default * test-invoke-conda: use diffusers-format model test-invoke-conda: put huggingface-token where the library can use it * environment-mac: upgrade to diffusers 0.7 (from 0.6) this was already done for linux; mac must have been lost in the merge. * preload_models: explicitly load diffusers models In non-interactive mode too, as long as you're logged in. * fix(model_cache): don't check `model.config` in diffusers format clean-up from recent merge. * diffusers integration: support img2img * dev: upgrade to diffusers 0.8 (from 0.7.1) We get to remove some code by using methods that were factored out in the base class. * refactor: remove backported img2img.get_timesteps now that we can use it directly from diffusers 0.8.1 * ci: use diffusers model * dev: upgrade to diffusers 0.9 (from 0.8.1) * lint: correct annotations for Python 3.9. * lint: correct AttributeError.name reference for Python 3.9. * CI: prefer diffusers-1.4 because it no longer requires a token The RunwayML models still do. * build: there's yet another place to update requirements? * configure: try to download models even without token Models in the CompVis and stabilityai repos no longer require them. (But runwayml still does.) * configure: add troubleshooting info for config-not-found * fix(configure): prepend root to config path * fix(configure): remove second `default: true` from models example * CI: simplify test-on-push logic now that we don't need secrets The "test on push but only in forks" logic was only necessary when tests didn't work for PRs-from-forks. * create an embedding_manager for diffusers * internal: avoid importing diffusers DummyObject see https://github.com/huggingface/diffusers/issues/1479 * fix "config attributes…not expected" diffusers warnings. * fix deprecated scheduler construction * work around an apparent MPS torch bug that causes conditioning to have no effect * 🚧 post-rebase repair * preliminary support for outpainting (no masking yet) * monkey-patch diffusers.attention and use Invoke lowvram code * add always_use_cpu arg to bypass MPS * add cross-attention control support to diffusers (fails on MPS) For unknown reasons MPS produces garbage output with .swap(). Use --always_use_cpu arg to invoke.py for now to test this code on MPS. * diffusers support for the inpainting model * fix debug_image to not crash with non-RGB images. * inpainting for the normal model [WIP] This seems to be performing well until the LAST STEP, at which point it dissolves to confetti. * fix off-by-one bug in cross-attention-control (#1774) prompt token sequences begin with a "beginning-of-sequence" marker <bos> and end with a repeated "end-of-sequence" marker <eos> - to make a default prompt length of <bos> + 75 prompt tokens + <eos>. the .swap() code was failing to take the column for <bos> at index 0 into account. the changes here do that, and also add extra handling for a single <eos> (which may be redundant but which is included for completeness). based on my understanding and some assumptions about how this all works, the reason .swap() nevertheless seemed to do the right thing, to some extent, is because over multiple steps the conditioning process in Stable Diffusion operates as a feedback loop. a change to token n-1 has flow-on effects to how the [1x4x64x64] latent tensor is modified by all the tokens after it, - and as the next step is processed, all the tokens before it as well. intuitively, a token's conditioning effects "echo" throughout the whole length of the prompt. so even though the token at n-1 was being edited when what the user actually wanted was to edit the token at n, it nevertheless still had some non-negligible effect, in roughly the right direction, often enough that it seemed like it was working properly. * refactor common CrossAttention stuff into a mixin so that the old ldm code can still work if necessary * inpainting for the normal model. I think it works this time. * diffusers: reset num_vectors_per_token sync with 44a00555718f1df173c60da0ed646cf700e29537 * diffusers: txt2img2img (hires_fix) with so much slicing and dicing of pipeline methods to stitch them together * refactor(diffusers): reduce some code duplication amongst the different tasks * fixup! refactor(diffusers): reduce some code duplication amongst the different tasks * diffusers: enable DPMSolver++ scheduler * diffusers: upgrade to diffusers 0.10, add Heun scheduler * diffusers(ModelCache): stopgap to make from_cpu compatible with diffusers * CI: default to diffusers-1.5 now that runwayml token requirement is gone * diffusers: update to 0.10 (and transformers to 4.25) * diffusers: use xformers when available diffusers no longer auto-enables this as of 0.10.2. * diffusers: make masked img2img behave better with multi-step schedulers re-randomizing the noise each step was confusing them. * diffusers: work more better with more models. fixed relative path problem with local models. fixed models on hub not always having a `fp16` branch. * diffusers: stopgap fix for attention_maps_callback crash after recent merge * fixup import merge conflicts correction for 061c5369a2247c6c92cd69606bcf54c4f1962a0b * test: add tests/inpainting inputs for masked img2img * diffusers(AddsMaskedGuidance): partial fix for k-schedulers Prevents them from crashing, but results are still hot garbage. * fix --safety_checker arg parsing and add note to diffusers loader about where safety checker gets called * generate: fix import error * CI: don't try to read the old init location * diffusers: support loading an alternate VAE * CI: remove sh-syntax if-statement so it doesn't crash powershell * CI: fold strings in yaml because backslash is not line-continuation in powershell * attention maps callback stuff for diffusers * build: fix syntax error in environment-mac * diffusers: add INITIAL_MODELS with diffusers-compatible repos * re-enable the embedding manager; closes #1778 * Squashed commit of the following: commit e4a956abc37fcb5cf188388b76b617bc5c8fda7d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:43:07 2022 +0100 import new load handling from EmbeddingManager and cleanup commit c4abe91a5ba0d415b45bf734068385668b7a66e6 Merge: 032e856e 1efc6397 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:09:53 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers_with_textual_inversion_manager commit 032e856eefb3bbc39534f5daafd25764bcfcef8b Merge: 8b4f0fe9 bc515e24 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:08:01 2022 +0100 Merge remote-tracking branch 'upstream/dev/diffusers' into dev/diffusers_with_textual_inversion_manager commit 1efc6397fc6e61c1aff4b0258b93089d61de5955 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:04:28 2022 +0100 cleanup and add performance notes commit e400f804ac471a0ca2ba432fd658778b20c7bdab Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:45:07 2022 +0100 fix bug and update unit tests commit deb9ae0ae1016750e93ce8275734061f7285a231 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:28:29 2022 +0100 textual inversion manager seems to work commit 162e02505dec777e91a983c4d0fb52e950d25ff0 Merge: cbad4583 12769b3d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:58:03 2022 +0100 Merge branch 'main' into feature_textual_inversion_mgr commit cbad45836c6aace6871a90f2621a953f49433131 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:54:10 2022 +0100 use position embeddings commit 070344c69b0e0db340a183857d0a787b348681d3 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:53:47 2022 +0100 Don't crash CLI on exceptions commit b035ac8c6772dfd9ba41b8eeb9103181cda028f8 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:11:55 2022 +0100 add missing position_embeddings commit 12769b3d3562ef71e0f54946b532ad077e10043c Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:33:25 2022 +0100 debugging why it don't work commit bafb7215eabe1515ca5e8388fd3bb2f3ac5362cf Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:21:33 2022 +0100 debugging why it don't work commit 664a6e9e146b42d96703f0cc8baf8f5efec04ee1 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit 8b4f0fe9d6e4e2643b36dfa27864294785d7ba4e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit ffbe1ab11163ba712e353d89404e301d0e0c6cdf Merge: 6e4dad60 023df37e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:37:31 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers commit 023df37efffa67434f77def7fc3c9dfb29f699fd Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:36:54 2022 +0100 cleanup commit 05fac594eaf79d0058e3c48deee93df603f136c2 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:07:49 2022 +0100 tweak error checking commit 009f32ed39a7280997c3ffab112adadee0b44279 Author: damian <null@damianstewart.com> Date: Thu Dec 15 21:29:47 2022 +0100 unit tests passing for embeddings with vector length >1 commit beb1b08d9a98112ed2fe073580568e1a18698da3 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:39:09 2022 +0100 more explicit equality tests when overwriting commit 44d8a5a7c85cdabc9ce3a54fd0769a10597b3ca9 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:30:13 2022 +0100 wip textual inversion manager (unit tests passing for 1v embedding overwriting) commit 417c2b57d90924a839616bfb66804faab8039e4c Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 12:30:55 2022 +0100 wip textual inversion manager (unit tests passing for base stuff + padding) commit 2e80872e3b6f7fd7d8eb8928822bd824b63cb2ff Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 10:57:57 2022 +0100 wip new TextualInversionManager * stop using WeightedFrozenCLIPEmbedder * store diffusion models locally - configure_invokeai.py reconfigured to store diffusion models rather than CompVis models - hugging face caching model is used, but cache is set to ~/invokeai/models/repo_id - models.yaml does **NOT** use path, just repo_id - "repo_name" changed to "repo_id" to following hugging face conventions - Models are loaded with full precision pending further work. * allow non-local files during development * path takes priority over repo_id * MVP for model_cache and configure_invokeai - Feature complete (almost) - configure_invokeai.py downloads both .ckpt and diffuser models, along with their VAEs. Both types of download are controlled by a unified INITIAL_MODELS.yaml file. - model_cache can load both type of model and switches back and forth in CPU. No memory leaks detected TO DO: 1. I have not yet turned on the LocalOnly flag for diffuser models, so the code will check the Hugging Face repo for updates before using the locally cached models. This will break firewalled systems. I am thinking of putting in a global check for internet connectivity at startup time and setting the LocalOnly flag based on this. It would be good to check updates if there is connectivity. 2. I have not gone completely through INITIAL_MODELS.yaml to check which models are available as diffusers and which are not. So models like PaperCut and VoxelArt may not load properly. The runway and stability models are checked, as well as the Trinart models. 3. Add stanzas for SD 2.0 and 2.1 in INITIAL_MODELS.yaml REMAINING PROBLEMS NOT DIRECTLY RELATED TO MODEL_CACHE: 1. When loading a .ckpt file there are lots of messages like this: Warning! ldm.modules.attention.CrossAttention is no longer being maintained. Please use InvokeAICrossAttention instead. I'm not sure how to address this. 2. The ckpt models ***don't actually run*** due to the lack of special-case support for them in the generator objects. For example, here's the hard crash you get when you run txt2img against the legacy waifu-diffusion-1.3 model: ``` >> An error occurred: Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 140, in main main_loop(gen, opt) File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 371, in main_loop gen.prompt2image( File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1265, in __getattr__ raise AttributeError("'{}' object has no attribute '{}'".format( AttributeError: 'LatentDiffusion' object has no attribute 'image_from_embeddings' ``` 3. The inpainting diffusion model isn't working. Here's the output of "banana sushi" when inpainting-1.5 is loaded: ``` Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 301, in image_from_embeddings result_latents, result_attention_map_saver = self.latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 330, in latents_from_embeddings result: PipelineIntermediateState = infer_latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 185, in __call__ for result in self.generator_method(*args, **kwargs): File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 367, in generate_latents_from_embeddings step_output = self.step(batched_t, latents, guidance_scale, File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context return func(*args, **kwargs) File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 409, in step step_output = self.scheduler.step(noise_pred, timestep, latents, **extra_step_kwargs) File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/diffusers/schedulers/scheduling_lms_discrete.py", line 223, in step pred_original_sample = sample - sigma * model_output RuntimeError: The size of tensor a (9) must match the size of tensor b (4) at non-singleton dimension 1 ``` * proper support for float32/float16 - configure script now correctly detects user's preference for fp16/32 and downloads the correct diffuser version. If fp16 version not available, falls back to fp32 version. - misc code cleanup and simplification in model_cache * add on-the-fly conversion of .ckpt to diffusers models 1. On-the-fly conversion code can be found in the file ldm/invoke/ckpt_to_diffusers.py. 2. A new !optimize command has been added to the CLI. Should be ported to Web GUI. User experience on the CLI is this: ``` invoke> !optimize /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt INFO: Converting legacy weights file /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt to optimized diffuser model. This operation will take 30-60s to complete. Success. Optimized model is now located at /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 Writing new config file entry for sd-v1-4... >> New configuration: sd-v1-4: description: Optimized version of sd-v1-4 format: diffusers path: /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 OK to import [n]? y >> Verifying that new model loads... >> Current VRAM usage: 2.60G >> Offloading stable-diffusion-2.1 to CPU >> Loading diffusers model from /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 | Using faster float16 precision You have disabled the safety checker for <class 'ldm.invoke.generator.diffusers_pipeline.StableDiffusionGeneratorPipeline'> by passing `safety_checker=None`. Ensure that you abide to the conditions of the Stable Diffusion \ license and do not expose unfiltered results in services or applications open to the public. Both the diffusers team and Hugging Face strongly recommend to keep the safety filter enabled in all public facing circumstances,\ disabling it only for use-cases that involve analyzing network behavior or auditing its results. For more information, please have a look at https://github.com/huggingface/diffusers/pull/254 . | training width x height = (512 x 512) >> Model loaded in 3.48s >> Max VRAM used to load the model: 2.17G >> Current VRAM usage:2.17G >> Textual inversions available: >> Setting Sampler to k_lms (LMSDiscreteScheduler) Keep model loaded? [y] ``` * add parallel set of generator files for ckpt legacy generation * generation using legacy ckpt models now working * diffusers: fix missing attention_maps_callback fix for 23eb80b40421b2bb8f4b6d3dd30490d11c447b36 * associate legacy CrossAttention with .ckpt models * enable autoconvert New --autoconvert CLI option will scan a designated directory for new .ckpt files, convert them into diffuser models, and import them into models.yaml. Works like this: invoke.py --autoconvert /path/to/weights/directory In ModelCache added two new methods: autoconvert_weights(config_path, weights_directory_path, models_directory_path) convert_and_import(ckpt_path, diffuser_path) * diffusers: update to diffusers 0.11 (from 0.10.2) * fix vae loading & width/height calculation * refactor: encapsulate these conditioning data into one container * diffusers: fix some noise-scaling issues by pushing the noise-mixing down to the common function * add support for safetensors and accelerate * set local_files_only when internet unreachable * diffusers: fix error-handling path when model repo has no fp16 branch * fix generatorinpaint error Fixes : "ModuleNotFoundError: No module named 'ldm.invoke.generatorinpaint' https://github.com/invoke-ai/InvokeAI/pull/1583#issuecomment-1363634318 * quench diffuser safety-checker warning * diffusers: support stochastic DDIM eta parameter * fix conda env creation on macos * fix cross-attention with diffusers 0.11 * diffusers: the VAE needs to be tiling as well as the U-Net * diffusers: comment on subfolders * diffusers: embiggen! * diffusers: make model_cache.list_models serializable * diffusers(inpaint): restore scaling functionality * fix requirements clash between numba and numpy 1.24 * diffusers: allow inpainting model to do non-inpainting tasks * start expanding model_cache functionality * add import_ckpt_model() and import_diffuser_model() methods to model_manager - in addition, model_cache.py is now renamed to model_manager.py * allow "recommended" flag to be optional in INITIAL_MODELS.yaml * configure_invokeai now downloads VAE diffusers in advance * rename ModelCache to ModelManager * remove support for `repo_name` in models.yaml * check for and refuse to load embeddings trained on incompatible models * models.yaml.example: s/repo_name/repo_id and remove extra INITIAL_MODELS now that the main one has diffusers models in it. * add MVP textual inversion script * refactor(InvokeAIDiffuserComponent): factor out _combine() * InvokeAIDiffuserComponent: implement threshold * InvokeAIDiffuserComponent: diagnostic logs for threshold ...this does not look right * add a curses-based frontend to textual inversion - not quite working yet - requires npyscreen installed - on windows will also have the windows-curses requirement, but not added to requirements yet * add curses-based interface for textual inversion * fix crash in convert_and_import() - This corrects a "local variable referenced before assignment" error in model_manager.convert_and_import() * potential workaround for no 'state_dict' key error - As reported in https://github.com/huggingface/diffusers/issues/1876 * create TI output dir if needed * Update environment-lin-cuda.yml (#2159) Fixing line 42 to be the proper order to define the transformers requirement: ~= instead of =~ * diffusers: update sampler-to-scheduler mapping based on https://github.com/huggingface/diffusers/issues/277#issuecomment-1371428672 * improve user exp for ckt to diffusers conversion - !optimize_models command now operates on an existing ckpt file entry in models.yaml - replaces existing entry, rather than adding a new one - offers to delete the ckpt file after conversion * web: adapt progress callback to deal with old generator or new diffusers pipeline * clean-up model_manager code - add_model() verified to work for .ckpt local paths, .ckpt remote URLs, diffusers local paths, and diffusers repo_ids - convert_and_import() verified to work for local and remove .ckpt files * handle edge cases for import_model() and convert_model() * add support for safetensor .ckpt files * fix name error * code cleanup with pyflake * improve model setting behavior - If the user enters an invalid model name at startup time, will not try to load it, warn, and use default model - CLI UI enhancement: include currently active model in the command line prompt. * update test-invoke-pip.yml - fix model cache path to point to runwayml/stable-diffusion-v1-5 - remove `skip-sd-weights` from configure_invokeai.py args * exclude dev/diffusers from "fail for draft PRs" * disable "fail on PR jobs" * re-add `--skip-sd-weights` since no space * update workflow environments - include `INVOKE_MODEL_RECONFIGURE: '--yes'` * clean up model load failure handling - Allow CLI to run even when no model is defined or loadable. - Inhibit stack trace when model load fails - only show last error - Give user *option* to run configure_invokeai.py when no models successfully load. - Restart invokeai after reconfiguration. * further edge-case handling 1) only one model in models.yaml file, and that model is broken 2) no models in models.yaml 3) models.yaml doesn't exist at all * fix incorrect model status listing - "cached" was not being returned from list_models() - normalize handling of exceptions during model loading: - Passing an invalid model name to generate.set_model() will return a KeyError - All other exceptions are returned as the appropriate Exception * CI: do download weights (if not already cached) * diffusers: fix scheduler loading in offline mode * CI: fix model name (no longer has `diffusers-` prefix) * Update txt2img2img.py (#2256) * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * feat - make model storage compatible with hugging face caching system This commit alters the InvokeAI model directory to be compatible with hugging face, making it easier to share diffusers (and other models) across different programs. - If the HF_HOME environment variable is not set, then models are cached in ~/invokeai/models in a format that is identical to the HuggingFace cache. - If HF_HOME is set, then models are cached wherever HF_HOME points. - To enable sharing with other HuggingFace library clients, set HF_HOME to ~/.cache/huggingface to set the default cache location or to ~/invokeai/models to have huggingface cache inside InvokeAI. * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * fix error "no attribute CkptInpaint" * model_manager.list_models() returns entire model config stanza+status * Initial Draft - Model Manager Diffusers * added hash function to diffusers * implement sha256 hashes on diffusers models * Add Model Manager Support for Diffusers * fix various problems with model manager - in cli import functions, fix not enough values to unpack from _get_name_and_desc() - fix crash when using old-style vae: value with new-style diffuser * rebuild frontend * fix dictconfig-not-serializable issue * fix NoneType' object is not subscriptable crash in model_manager * fix "str has no attribute get" error in model_manager list_models() * Add path and repo_id support for Diffusers Model Manager Also fixes bugs * Fix tooltip IT localization not working * Add Version Number To WebUI * Optimize Model Search * Fix incorrect font on the Model Manager UI * Fix image degradation on merge fixes - [Experimental] This change should effectively fix a couple of things. - Fix image degradation on subsequent merges of the canvas layers. - Fix the slight transparent border that is left behind when filling the bounding box with a color. - Fix the left over line of color when filling a bounding box with color. So far there are no side effects for this. If any, please report. * Add local model filtering for Diffusers / Checkpoints * Go to home on modal close for the Add Modal UI * Styling Fixes * Model Manager Diffusers Localization Update * Add Safe Tensor scanning to Model Manager * Fix model edit form dispatching string values instead of numbers. * Resolve VAE handling / edge cases for supplied repos * defer injecting tokens for textual inversions until they're used for the first time * squash a console warning * implement model migration check * add_model() overwrites previous config rather than merges * fix model config file attribute merging * fix precision handling in textual inversion script * allow ckpt conversion script to work with safetensors .ckpts Applied patch here: https://github.com/huggingface/diffusers/commit/beb932c5d111872c5e45387e7b1b2b3dd0524a47 * fix name "args" is not defined crash in textual_inversion_training * fix a second NameError: name 'args' is not defined crash * fix loading of the safety checker from the global cache dir * add installation step to textual inversion frontend - After a successful training run, the script will copy learned_embeds.bin to a subfolder of the embeddings directory. - User given the option to delete the logs and intermediate checkpoints (which together use 7-8G of space) - If textual inversion training fails, reports the error gracefully. * don't crash out on incompatible embeddings - put try: blocks around places where the system tries to load an embedding which is incompatible with the currently loaded model * add support for checkpoint resuming * textual inversion preferences are saved and restored between sessions - Preferences are stored in a file named text-inversion-training/preferences.conf - Currently the resume-from-checkpoint option is not working correctly. Possible bug in textual_inversion_training.py? * copy learned_embeddings.bin into right location * add front end for diffusers model merging - Front end doesn't do anything yet!!!! - Made change to model name parsing in CLI to support ability to have merged models with the "+" character in their names. * improve inpainting experience - recommend ckpt version of inpainting-1.5 to user - fix get_noise() bug in ckpt version of omnibus.py * update environment*yml * tweak instructions to install HuggingFace token * bump version number * enhance update scripts - update scripts will now fetch new INITIAL_MODELS.yaml so that configure_invokeai.py will know about the diffusers versions. * enhance invoke.sh/invoke.bat launchers - added configure_invokeai.py to menu - menu defaults to browser-based invoke * remove conda workflow (#2321) * fix `token_ids has shape torch.Size([79]) - expected [77]` * update CHANGELOG.md with 2.3.* info - Add information on how formats have changed and the upgrade process. - Add short bug list. Co-authored-by: Damian Stewart <d@damianstewart.com> Co-authored-by: Damian Stewart <null@damianstewart.com> Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> Co-authored-by: Wybartel-luxmc <37852506+Wybartel-luxmc@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> Co-authored-by: mickr777 <115216705+mickr777@users.noreply.github.com> Co-authored-by: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Co-authored-by: Eugene Brodsky <ebr@users.noreply.github.com> Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com>
2023-01-15 14:22:46 +00:00
import ldm.invoke.conditioning
from ldm.invoke.args import metadata_from_png
use 🧨diffusers model (#1583) * initial commit of DiffusionPipeline class * spike: proof of concept using diffusers for txt2img * doc: type hints for Generator * refactor(model_cache): factor out load_ckpt * model_cache: add ability to load a diffusers model pipeline and update associated things in Generate & Generator to not instantly fail when that happens * model_cache: fix model default image dimensions * txt2img: support switching diffusers schedulers * diffusers: let the scheduler do its scaling of the initial latents Remove IPNDM scheduler; it is not behaving. * web server: update image_progress callback for diffusers data * diffusers: restore prompt weighting feature * diffusers: fix set-sampler error following model switch * diffusers: use InvokeAIDiffuserComponent for conditioning * cross_attention_control: stub (no-op) implementations for diffusers * model_cache: let offload_model work with DiffusionPipeline, sorta. * models.yaml.example: add diffusers-format model, set as default * test-invoke-conda: use diffusers-format model test-invoke-conda: put huggingface-token where the library can use it * environment-mac: upgrade to diffusers 0.7 (from 0.6) this was already done for linux; mac must have been lost in the merge. * preload_models: explicitly load diffusers models In non-interactive mode too, as long as you're logged in. * fix(model_cache): don't check `model.config` in diffusers format clean-up from recent merge. * diffusers integration: support img2img * dev: upgrade to diffusers 0.8 (from 0.7.1) We get to remove some code by using methods that were factored out in the base class. * refactor: remove backported img2img.get_timesteps now that we can use it directly from diffusers 0.8.1 * ci: use diffusers model * dev: upgrade to diffusers 0.9 (from 0.8.1) * lint: correct annotations for Python 3.9. * lint: correct AttributeError.name reference for Python 3.9. * CI: prefer diffusers-1.4 because it no longer requires a token The RunwayML models still do. * build: there's yet another place to update requirements? * configure: try to download models even without token Models in the CompVis and stabilityai repos no longer require them. (But runwayml still does.) * configure: add troubleshooting info for config-not-found * fix(configure): prepend root to config path * fix(configure): remove second `default: true` from models example * CI: simplify test-on-push logic now that we don't need secrets The "test on push but only in forks" logic was only necessary when tests didn't work for PRs-from-forks. * create an embedding_manager for diffusers * internal: avoid importing diffusers DummyObject see https://github.com/huggingface/diffusers/issues/1479 * fix "config attributes…not expected" diffusers warnings. * fix deprecated scheduler construction * work around an apparent MPS torch bug that causes conditioning to have no effect * 🚧 post-rebase repair * preliminary support for outpainting (no masking yet) * monkey-patch diffusers.attention and use Invoke lowvram code * add always_use_cpu arg to bypass MPS * add cross-attention control support to diffusers (fails on MPS) For unknown reasons MPS produces garbage output with .swap(). Use --always_use_cpu arg to invoke.py for now to test this code on MPS. * diffusers support for the inpainting model * fix debug_image to not crash with non-RGB images. * inpainting for the normal model [WIP] This seems to be performing well until the LAST STEP, at which point it dissolves to confetti. * fix off-by-one bug in cross-attention-control (#1774) prompt token sequences begin with a "beginning-of-sequence" marker <bos> and end with a repeated "end-of-sequence" marker <eos> - to make a default prompt length of <bos> + 75 prompt tokens + <eos>. the .swap() code was failing to take the column for <bos> at index 0 into account. the changes here do that, and also add extra handling for a single <eos> (which may be redundant but which is included for completeness). based on my understanding and some assumptions about how this all works, the reason .swap() nevertheless seemed to do the right thing, to some extent, is because over multiple steps the conditioning process in Stable Diffusion operates as a feedback loop. a change to token n-1 has flow-on effects to how the [1x4x64x64] latent tensor is modified by all the tokens after it, - and as the next step is processed, all the tokens before it as well. intuitively, a token's conditioning effects "echo" throughout the whole length of the prompt. so even though the token at n-1 was being edited when what the user actually wanted was to edit the token at n, it nevertheless still had some non-negligible effect, in roughly the right direction, often enough that it seemed like it was working properly. * refactor common CrossAttention stuff into a mixin so that the old ldm code can still work if necessary * inpainting for the normal model. I think it works this time. * diffusers: reset num_vectors_per_token sync with 44a00555718f1df173c60da0ed646cf700e29537 * diffusers: txt2img2img (hires_fix) with so much slicing and dicing of pipeline methods to stitch them together * refactor(diffusers): reduce some code duplication amongst the different tasks * fixup! refactor(diffusers): reduce some code duplication amongst the different tasks * diffusers: enable DPMSolver++ scheduler * diffusers: upgrade to diffusers 0.10, add Heun scheduler * diffusers(ModelCache): stopgap to make from_cpu compatible with diffusers * CI: default to diffusers-1.5 now that runwayml token requirement is gone * diffusers: update to 0.10 (and transformers to 4.25) * diffusers: use xformers when available diffusers no longer auto-enables this as of 0.10.2. * diffusers: make masked img2img behave better with multi-step schedulers re-randomizing the noise each step was confusing them. * diffusers: work more better with more models. fixed relative path problem with local models. fixed models on hub not always having a `fp16` branch. * diffusers: stopgap fix for attention_maps_callback crash after recent merge * fixup import merge conflicts correction for 061c5369a2247c6c92cd69606bcf54c4f1962a0b * test: add tests/inpainting inputs for masked img2img * diffusers(AddsMaskedGuidance): partial fix for k-schedulers Prevents them from crashing, but results are still hot garbage. * fix --safety_checker arg parsing and add note to diffusers loader about where safety checker gets called * generate: fix import error * CI: don't try to read the old init location * diffusers: support loading an alternate VAE * CI: remove sh-syntax if-statement so it doesn't crash powershell * CI: fold strings in yaml because backslash is not line-continuation in powershell * attention maps callback stuff for diffusers * build: fix syntax error in environment-mac * diffusers: add INITIAL_MODELS with diffusers-compatible repos * re-enable the embedding manager; closes #1778 * Squashed commit of the following: commit e4a956abc37fcb5cf188388b76b617bc5c8fda7d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:43:07 2022 +0100 import new load handling from EmbeddingManager and cleanup commit c4abe91a5ba0d415b45bf734068385668b7a66e6 Merge: 032e856e 1efc6397 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:09:53 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers_with_textual_inversion_manager commit 032e856eefb3bbc39534f5daafd25764bcfcef8b Merge: 8b4f0fe9 bc515e24 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:08:01 2022 +0100 Merge remote-tracking branch 'upstream/dev/diffusers' into dev/diffusers_with_textual_inversion_manager commit 1efc6397fc6e61c1aff4b0258b93089d61de5955 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:04:28 2022 +0100 cleanup and add performance notes commit e400f804ac471a0ca2ba432fd658778b20c7bdab Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:45:07 2022 +0100 fix bug and update unit tests commit deb9ae0ae1016750e93ce8275734061f7285a231 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:28:29 2022 +0100 textual inversion manager seems to work commit 162e02505dec777e91a983c4d0fb52e950d25ff0 Merge: cbad4583 12769b3d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:58:03 2022 +0100 Merge branch 'main' into feature_textual_inversion_mgr commit cbad45836c6aace6871a90f2621a953f49433131 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:54:10 2022 +0100 use position embeddings commit 070344c69b0e0db340a183857d0a787b348681d3 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:53:47 2022 +0100 Don't crash CLI on exceptions commit b035ac8c6772dfd9ba41b8eeb9103181cda028f8 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:11:55 2022 +0100 add missing position_embeddings commit 12769b3d3562ef71e0f54946b532ad077e10043c Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:33:25 2022 +0100 debugging why it don't work commit bafb7215eabe1515ca5e8388fd3bb2f3ac5362cf Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:21:33 2022 +0100 debugging why it don't work commit 664a6e9e146b42d96703f0cc8baf8f5efec04ee1 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit 8b4f0fe9d6e4e2643b36dfa27864294785d7ba4e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit ffbe1ab11163ba712e353d89404e301d0e0c6cdf Merge: 6e4dad60 023df37e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:37:31 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers commit 023df37efffa67434f77def7fc3c9dfb29f699fd Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:36:54 2022 +0100 cleanup commit 05fac594eaf79d0058e3c48deee93df603f136c2 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:07:49 2022 +0100 tweak error checking commit 009f32ed39a7280997c3ffab112adadee0b44279 Author: damian <null@damianstewart.com> Date: Thu Dec 15 21:29:47 2022 +0100 unit tests passing for embeddings with vector length >1 commit beb1b08d9a98112ed2fe073580568e1a18698da3 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:39:09 2022 +0100 more explicit equality tests when overwriting commit 44d8a5a7c85cdabc9ce3a54fd0769a10597b3ca9 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:30:13 2022 +0100 wip textual inversion manager (unit tests passing for 1v embedding overwriting) commit 417c2b57d90924a839616bfb66804faab8039e4c Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 12:30:55 2022 +0100 wip textual inversion manager (unit tests passing for base stuff + padding) commit 2e80872e3b6f7fd7d8eb8928822bd824b63cb2ff Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 10:57:57 2022 +0100 wip new TextualInversionManager * stop using WeightedFrozenCLIPEmbedder * store diffusion models locally - configure_invokeai.py reconfigured to store diffusion models rather than CompVis models - hugging face caching model is used, but cache is set to ~/invokeai/models/repo_id - models.yaml does **NOT** use path, just repo_id - "repo_name" changed to "repo_id" to following hugging face conventions - Models are loaded with full precision pending further work. * allow non-local files during development * path takes priority over repo_id * MVP for model_cache and configure_invokeai - Feature complete (almost) - configure_invokeai.py downloads both .ckpt and diffuser models, along with their VAEs. Both types of download are controlled by a unified INITIAL_MODELS.yaml file. - model_cache can load both type of model and switches back and forth in CPU. No memory leaks detected TO DO: 1. I have not yet turned on the LocalOnly flag for diffuser models, so the code will check the Hugging Face repo for updates before using the locally cached models. This will break firewalled systems. I am thinking of putting in a global check for internet connectivity at startup time and setting the LocalOnly flag based on this. It would be good to check updates if there is connectivity. 2. I have not gone completely through INITIAL_MODELS.yaml to check which models are available as diffusers and which are not. So models like PaperCut and VoxelArt may not load properly. The runway and stability models are checked, as well as the Trinart models. 3. Add stanzas for SD 2.0 and 2.1 in INITIAL_MODELS.yaml REMAINING PROBLEMS NOT DIRECTLY RELATED TO MODEL_CACHE: 1. When loading a .ckpt file there are lots of messages like this: Warning! ldm.modules.attention.CrossAttention is no longer being maintained. Please use InvokeAICrossAttention instead. I'm not sure how to address this. 2. The ckpt models ***don't actually run*** due to the lack of special-case support for them in the generator objects. For example, here's the hard crash you get when you run txt2img against the legacy waifu-diffusion-1.3 model: ``` >> An error occurred: Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 140, in main main_loop(gen, opt) File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 371, in main_loop gen.prompt2image( File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1265, in __getattr__ raise AttributeError("'{}' object has no attribute '{}'".format( AttributeError: 'LatentDiffusion' object has no attribute 'image_from_embeddings' ``` 3. The inpainting diffusion model isn't working. Here's the output of "banana sushi" when inpainting-1.5 is loaded: ``` Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 301, in image_from_embeddings result_latents, result_attention_map_saver = self.latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 330, in latents_from_embeddings result: PipelineIntermediateState = infer_latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 185, in __call__ for result in self.generator_method(*args, **kwargs): File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 367, in generate_latents_from_embeddings step_output = self.step(batched_t, latents, guidance_scale, File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context return func(*args, **kwargs) File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 409, in step step_output = self.scheduler.step(noise_pred, timestep, latents, **extra_step_kwargs) File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/diffusers/schedulers/scheduling_lms_discrete.py", line 223, in step pred_original_sample = sample - sigma * model_output RuntimeError: The size of tensor a (9) must match the size of tensor b (4) at non-singleton dimension 1 ``` * proper support for float32/float16 - configure script now correctly detects user's preference for fp16/32 and downloads the correct diffuser version. If fp16 version not available, falls back to fp32 version. - misc code cleanup and simplification in model_cache * add on-the-fly conversion of .ckpt to diffusers models 1. On-the-fly conversion code can be found in the file ldm/invoke/ckpt_to_diffusers.py. 2. A new !optimize command has been added to the CLI. Should be ported to Web GUI. User experience on the CLI is this: ``` invoke> !optimize /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt INFO: Converting legacy weights file /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt to optimized diffuser model. This operation will take 30-60s to complete. Success. Optimized model is now located at /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 Writing new config file entry for sd-v1-4... >> New configuration: sd-v1-4: description: Optimized version of sd-v1-4 format: diffusers path: /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 OK to import [n]? y >> Verifying that new model loads... >> Current VRAM usage: 2.60G >> Offloading stable-diffusion-2.1 to CPU >> Loading diffusers model from /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 | Using faster float16 precision You have disabled the safety checker for <class 'ldm.invoke.generator.diffusers_pipeline.StableDiffusionGeneratorPipeline'> by passing `safety_checker=None`. Ensure that you abide to the conditions of the Stable Diffusion \ license and do not expose unfiltered results in services or applications open to the public. Both the diffusers team and Hugging Face strongly recommend to keep the safety filter enabled in all public facing circumstances,\ disabling it only for use-cases that involve analyzing network behavior or auditing its results. For more information, please have a look at https://github.com/huggingface/diffusers/pull/254 . | training width x height = (512 x 512) >> Model loaded in 3.48s >> Max VRAM used to load the model: 2.17G >> Current VRAM usage:2.17G >> Textual inversions available: >> Setting Sampler to k_lms (LMSDiscreteScheduler) Keep model loaded? [y] ``` * add parallel set of generator files for ckpt legacy generation * generation using legacy ckpt models now working * diffusers: fix missing attention_maps_callback fix for 23eb80b40421b2bb8f4b6d3dd30490d11c447b36 * associate legacy CrossAttention with .ckpt models * enable autoconvert New --autoconvert CLI option will scan a designated directory for new .ckpt files, convert them into diffuser models, and import them into models.yaml. Works like this: invoke.py --autoconvert /path/to/weights/directory In ModelCache added two new methods: autoconvert_weights(config_path, weights_directory_path, models_directory_path) convert_and_import(ckpt_path, diffuser_path) * diffusers: update to diffusers 0.11 (from 0.10.2) * fix vae loading & width/height calculation * refactor: encapsulate these conditioning data into one container * diffusers: fix some noise-scaling issues by pushing the noise-mixing down to the common function * add support for safetensors and accelerate * set local_files_only when internet unreachable * diffusers: fix error-handling path when model repo has no fp16 branch * fix generatorinpaint error Fixes : "ModuleNotFoundError: No module named 'ldm.invoke.generatorinpaint' https://github.com/invoke-ai/InvokeAI/pull/1583#issuecomment-1363634318 * quench diffuser safety-checker warning * diffusers: support stochastic DDIM eta parameter * fix conda env creation on macos * fix cross-attention with diffusers 0.11 * diffusers: the VAE needs to be tiling as well as the U-Net * diffusers: comment on subfolders * diffusers: embiggen! * diffusers: make model_cache.list_models serializable * diffusers(inpaint): restore scaling functionality * fix requirements clash between numba and numpy 1.24 * diffusers: allow inpainting model to do non-inpainting tasks * start expanding model_cache functionality * add import_ckpt_model() and import_diffuser_model() methods to model_manager - in addition, model_cache.py is now renamed to model_manager.py * allow "recommended" flag to be optional in INITIAL_MODELS.yaml * configure_invokeai now downloads VAE diffusers in advance * rename ModelCache to ModelManager * remove support for `repo_name` in models.yaml * check for and refuse to load embeddings trained on incompatible models * models.yaml.example: s/repo_name/repo_id and remove extra INITIAL_MODELS now that the main one has diffusers models in it. * add MVP textual inversion script * refactor(InvokeAIDiffuserComponent): factor out _combine() * InvokeAIDiffuserComponent: implement threshold * InvokeAIDiffuserComponent: diagnostic logs for threshold ...this does not look right * add a curses-based frontend to textual inversion - not quite working yet - requires npyscreen installed - on windows will also have the windows-curses requirement, but not added to requirements yet * add curses-based interface for textual inversion * fix crash in convert_and_import() - This corrects a "local variable referenced before assignment" error in model_manager.convert_and_import() * potential workaround for no 'state_dict' key error - As reported in https://github.com/huggingface/diffusers/issues/1876 * create TI output dir if needed * Update environment-lin-cuda.yml (#2159) Fixing line 42 to be the proper order to define the transformers requirement: ~= instead of =~ * diffusers: update sampler-to-scheduler mapping based on https://github.com/huggingface/diffusers/issues/277#issuecomment-1371428672 * improve user exp for ckt to diffusers conversion - !optimize_models command now operates on an existing ckpt file entry in models.yaml - replaces existing entry, rather than adding a new one - offers to delete the ckpt file after conversion * web: adapt progress callback to deal with old generator or new diffusers pipeline * clean-up model_manager code - add_model() verified to work for .ckpt local paths, .ckpt remote URLs, diffusers local paths, and diffusers repo_ids - convert_and_import() verified to work for local and remove .ckpt files * handle edge cases for import_model() and convert_model() * add support for safetensor .ckpt files * fix name error * code cleanup with pyflake * improve model setting behavior - If the user enters an invalid model name at startup time, will not try to load it, warn, and use default model - CLI UI enhancement: include currently active model in the command line prompt. * update test-invoke-pip.yml - fix model cache path to point to runwayml/stable-diffusion-v1-5 - remove `skip-sd-weights` from configure_invokeai.py args * exclude dev/diffusers from "fail for draft PRs" * disable "fail on PR jobs" * re-add `--skip-sd-weights` since no space * update workflow environments - include `INVOKE_MODEL_RECONFIGURE: '--yes'` * clean up model load failure handling - Allow CLI to run even when no model is defined or loadable. - Inhibit stack trace when model load fails - only show last error - Give user *option* to run configure_invokeai.py when no models successfully load. - Restart invokeai after reconfiguration. * further edge-case handling 1) only one model in models.yaml file, and that model is broken 2) no models in models.yaml 3) models.yaml doesn't exist at all * fix incorrect model status listing - "cached" was not being returned from list_models() - normalize handling of exceptions during model loading: - Passing an invalid model name to generate.set_model() will return a KeyError - All other exceptions are returned as the appropriate Exception * CI: do download weights (if not already cached) * diffusers: fix scheduler loading in offline mode * CI: fix model name (no longer has `diffusers-` prefix) * Update txt2img2img.py (#2256) * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * feat - make model storage compatible with hugging face caching system This commit alters the InvokeAI model directory to be compatible with hugging face, making it easier to share diffusers (and other models) across different programs. - If the HF_HOME environment variable is not set, then models are cached in ~/invokeai/models in a format that is identical to the HuggingFace cache. - If HF_HOME is set, then models are cached wherever HF_HOME points. - To enable sharing with other HuggingFace library clients, set HF_HOME to ~/.cache/huggingface to set the default cache location or to ~/invokeai/models to have huggingface cache inside InvokeAI. * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * fix error "no attribute CkptInpaint" * model_manager.list_models() returns entire model config stanza+status * Initial Draft - Model Manager Diffusers * added hash function to diffusers * implement sha256 hashes on diffusers models * Add Model Manager Support for Diffusers * fix various problems with model manager - in cli import functions, fix not enough values to unpack from _get_name_and_desc() - fix crash when using old-style vae: value with new-style diffuser * rebuild frontend * fix dictconfig-not-serializable issue * fix NoneType' object is not subscriptable crash in model_manager * fix "str has no attribute get" error in model_manager list_models() * Add path and repo_id support for Diffusers Model Manager Also fixes bugs * Fix tooltip IT localization not working * Add Version Number To WebUI * Optimize Model Search * Fix incorrect font on the Model Manager UI * Fix image degradation on merge fixes - [Experimental] This change should effectively fix a couple of things. - Fix image degradation on subsequent merges of the canvas layers. - Fix the slight transparent border that is left behind when filling the bounding box with a color. - Fix the left over line of color when filling a bounding box with color. So far there are no side effects for this. If any, please report. * Add local model filtering for Diffusers / Checkpoints * Go to home on modal close for the Add Modal UI * Styling Fixes * Model Manager Diffusers Localization Update * Add Safe Tensor scanning to Model Manager * Fix model edit form dispatching string values instead of numbers. * Resolve VAE handling / edge cases for supplied repos * defer injecting tokens for textual inversions until they're used for the first time * squash a console warning * implement model migration check * add_model() overwrites previous config rather than merges * fix model config file attribute merging * fix precision handling in textual inversion script * allow ckpt conversion script to work with safetensors .ckpts Applied patch here: https://github.com/huggingface/diffusers/commit/beb932c5d111872c5e45387e7b1b2b3dd0524a47 * fix name "args" is not defined crash in textual_inversion_training * fix a second NameError: name 'args' is not defined crash * fix loading of the safety checker from the global cache dir * add installation step to textual inversion frontend - After a successful training run, the script will copy learned_embeds.bin to a subfolder of the embeddings directory. - User given the option to delete the logs and intermediate checkpoints (which together use 7-8G of space) - If textual inversion training fails, reports the error gracefully. * don't crash out on incompatible embeddings - put try: blocks around places where the system tries to load an embedding which is incompatible with the currently loaded model * add support for checkpoint resuming * textual inversion preferences are saved and restored between sessions - Preferences are stored in a file named text-inversion-training/preferences.conf - Currently the resume-from-checkpoint option is not working correctly. Possible bug in textual_inversion_training.py? * copy learned_embeddings.bin into right location * add front end for diffusers model merging - Front end doesn't do anything yet!!!! - Made change to model name parsing in CLI to support ability to have merged models with the "+" character in their names. * improve inpainting experience - recommend ckpt version of inpainting-1.5 to user - fix get_noise() bug in ckpt version of omnibus.py * update environment*yml * tweak instructions to install HuggingFace token * bump version number * enhance update scripts - update scripts will now fetch new INITIAL_MODELS.yaml so that configure_invokeai.py will know about the diffusers versions. * enhance invoke.sh/invoke.bat launchers - added configure_invokeai.py to menu - menu defaults to browser-based invoke * remove conda workflow (#2321) * fix `token_ids has shape torch.Size([79]) - expected [77]` * update CHANGELOG.md with 2.3.* info - Add information on how formats have changed and the upgrade process. - Add short bug list. Co-authored-by: Damian Stewart <d@damianstewart.com> Co-authored-by: Damian Stewart <null@damianstewart.com> Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> Co-authored-by: Wybartel-luxmc <37852506+Wybartel-luxmc@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> Co-authored-by: mickr777 <115216705+mickr777@users.noreply.github.com> Co-authored-by: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Co-authored-by: Eugene Brodsky <ebr@users.noreply.github.com> Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com>
2023-01-15 14:22:46 +00:00
from ldm.invoke.concepts_lib import HuggingFaceConceptsLibrary
from ldm.invoke.conditioning import get_uc_and_c_and_ec
use 🧨diffusers model (#1583) * initial commit of DiffusionPipeline class * spike: proof of concept using diffusers for txt2img * doc: type hints for Generator * refactor(model_cache): factor out load_ckpt * model_cache: add ability to load a diffusers model pipeline and update associated things in Generate & Generator to not instantly fail when that happens * model_cache: fix model default image dimensions * txt2img: support switching diffusers schedulers * diffusers: let the scheduler do its scaling of the initial latents Remove IPNDM scheduler; it is not behaving. * web server: update image_progress callback for diffusers data * diffusers: restore prompt weighting feature * diffusers: fix set-sampler error following model switch * diffusers: use InvokeAIDiffuserComponent for conditioning * cross_attention_control: stub (no-op) implementations for diffusers * model_cache: let offload_model work with DiffusionPipeline, sorta. * models.yaml.example: add diffusers-format model, set as default * test-invoke-conda: use diffusers-format model test-invoke-conda: put huggingface-token where the library can use it * environment-mac: upgrade to diffusers 0.7 (from 0.6) this was already done for linux; mac must have been lost in the merge. * preload_models: explicitly load diffusers models In non-interactive mode too, as long as you're logged in. * fix(model_cache): don't check `model.config` in diffusers format clean-up from recent merge. * diffusers integration: support img2img * dev: upgrade to diffusers 0.8 (from 0.7.1) We get to remove some code by using methods that were factored out in the base class. * refactor: remove backported img2img.get_timesteps now that we can use it directly from diffusers 0.8.1 * ci: use diffusers model * dev: upgrade to diffusers 0.9 (from 0.8.1) * lint: correct annotations for Python 3.9. * lint: correct AttributeError.name reference for Python 3.9. * CI: prefer diffusers-1.4 because it no longer requires a token The RunwayML models still do. * build: there's yet another place to update requirements? * configure: try to download models even without token Models in the CompVis and stabilityai repos no longer require them. (But runwayml still does.) * configure: add troubleshooting info for config-not-found * fix(configure): prepend root to config path * fix(configure): remove second `default: true` from models example * CI: simplify test-on-push logic now that we don't need secrets The "test on push but only in forks" logic was only necessary when tests didn't work for PRs-from-forks. * create an embedding_manager for diffusers * internal: avoid importing diffusers DummyObject see https://github.com/huggingface/diffusers/issues/1479 * fix "config attributes…not expected" diffusers warnings. * fix deprecated scheduler construction * work around an apparent MPS torch bug that causes conditioning to have no effect * 🚧 post-rebase repair * preliminary support for outpainting (no masking yet) * monkey-patch diffusers.attention and use Invoke lowvram code * add always_use_cpu arg to bypass MPS * add cross-attention control support to diffusers (fails on MPS) For unknown reasons MPS produces garbage output with .swap(). Use --always_use_cpu arg to invoke.py for now to test this code on MPS. * diffusers support for the inpainting model * fix debug_image to not crash with non-RGB images. * inpainting for the normal model [WIP] This seems to be performing well until the LAST STEP, at which point it dissolves to confetti. * fix off-by-one bug in cross-attention-control (#1774) prompt token sequences begin with a "beginning-of-sequence" marker <bos> and end with a repeated "end-of-sequence" marker <eos> - to make a default prompt length of <bos> + 75 prompt tokens + <eos>. the .swap() code was failing to take the column for <bos> at index 0 into account. the changes here do that, and also add extra handling for a single <eos> (which may be redundant but which is included for completeness). based on my understanding and some assumptions about how this all works, the reason .swap() nevertheless seemed to do the right thing, to some extent, is because over multiple steps the conditioning process in Stable Diffusion operates as a feedback loop. a change to token n-1 has flow-on effects to how the [1x4x64x64] latent tensor is modified by all the tokens after it, - and as the next step is processed, all the tokens before it as well. intuitively, a token's conditioning effects "echo" throughout the whole length of the prompt. so even though the token at n-1 was being edited when what the user actually wanted was to edit the token at n, it nevertheless still had some non-negligible effect, in roughly the right direction, often enough that it seemed like it was working properly. * refactor common CrossAttention stuff into a mixin so that the old ldm code can still work if necessary * inpainting for the normal model. I think it works this time. * diffusers: reset num_vectors_per_token sync with 44a00555718f1df173c60da0ed646cf700e29537 * diffusers: txt2img2img (hires_fix) with so much slicing and dicing of pipeline methods to stitch them together * refactor(diffusers): reduce some code duplication amongst the different tasks * fixup! refactor(diffusers): reduce some code duplication amongst the different tasks * diffusers: enable DPMSolver++ scheduler * diffusers: upgrade to diffusers 0.10, add Heun scheduler * diffusers(ModelCache): stopgap to make from_cpu compatible with diffusers * CI: default to diffusers-1.5 now that runwayml token requirement is gone * diffusers: update to 0.10 (and transformers to 4.25) * diffusers: use xformers when available diffusers no longer auto-enables this as of 0.10.2. * diffusers: make masked img2img behave better with multi-step schedulers re-randomizing the noise each step was confusing them. * diffusers: work more better with more models. fixed relative path problem with local models. fixed models on hub not always having a `fp16` branch. * diffusers: stopgap fix for attention_maps_callback crash after recent merge * fixup import merge conflicts correction for 061c5369a2247c6c92cd69606bcf54c4f1962a0b * test: add tests/inpainting inputs for masked img2img * diffusers(AddsMaskedGuidance): partial fix for k-schedulers Prevents them from crashing, but results are still hot garbage. * fix --safety_checker arg parsing and add note to diffusers loader about where safety checker gets called * generate: fix import error * CI: don't try to read the old init location * diffusers: support loading an alternate VAE * CI: remove sh-syntax if-statement so it doesn't crash powershell * CI: fold strings in yaml because backslash is not line-continuation in powershell * attention maps callback stuff for diffusers * build: fix syntax error in environment-mac * diffusers: add INITIAL_MODELS with diffusers-compatible repos * re-enable the embedding manager; closes #1778 * Squashed commit of the following: commit e4a956abc37fcb5cf188388b76b617bc5c8fda7d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:43:07 2022 +0100 import new load handling from EmbeddingManager and cleanup commit c4abe91a5ba0d415b45bf734068385668b7a66e6 Merge: 032e856e 1efc6397 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:09:53 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers_with_textual_inversion_manager commit 032e856eefb3bbc39534f5daafd25764bcfcef8b Merge: 8b4f0fe9 bc515e24 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:08:01 2022 +0100 Merge remote-tracking branch 'upstream/dev/diffusers' into dev/diffusers_with_textual_inversion_manager commit 1efc6397fc6e61c1aff4b0258b93089d61de5955 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:04:28 2022 +0100 cleanup and add performance notes commit e400f804ac471a0ca2ba432fd658778b20c7bdab Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:45:07 2022 +0100 fix bug and update unit tests commit deb9ae0ae1016750e93ce8275734061f7285a231 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:28:29 2022 +0100 textual inversion manager seems to work commit 162e02505dec777e91a983c4d0fb52e950d25ff0 Merge: cbad4583 12769b3d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:58:03 2022 +0100 Merge branch 'main' into feature_textual_inversion_mgr commit cbad45836c6aace6871a90f2621a953f49433131 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:54:10 2022 +0100 use position embeddings commit 070344c69b0e0db340a183857d0a787b348681d3 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:53:47 2022 +0100 Don't crash CLI on exceptions commit b035ac8c6772dfd9ba41b8eeb9103181cda028f8 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:11:55 2022 +0100 add missing position_embeddings commit 12769b3d3562ef71e0f54946b532ad077e10043c Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:33:25 2022 +0100 debugging why it don't work commit bafb7215eabe1515ca5e8388fd3bb2f3ac5362cf Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:21:33 2022 +0100 debugging why it don't work commit 664a6e9e146b42d96703f0cc8baf8f5efec04ee1 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit 8b4f0fe9d6e4e2643b36dfa27864294785d7ba4e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit ffbe1ab11163ba712e353d89404e301d0e0c6cdf Merge: 6e4dad60 023df37e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:37:31 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers commit 023df37efffa67434f77def7fc3c9dfb29f699fd Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:36:54 2022 +0100 cleanup commit 05fac594eaf79d0058e3c48deee93df603f136c2 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:07:49 2022 +0100 tweak error checking commit 009f32ed39a7280997c3ffab112adadee0b44279 Author: damian <null@damianstewart.com> Date: Thu Dec 15 21:29:47 2022 +0100 unit tests passing for embeddings with vector length >1 commit beb1b08d9a98112ed2fe073580568e1a18698da3 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:39:09 2022 +0100 more explicit equality tests when overwriting commit 44d8a5a7c85cdabc9ce3a54fd0769a10597b3ca9 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:30:13 2022 +0100 wip textual inversion manager (unit tests passing for 1v embedding overwriting) commit 417c2b57d90924a839616bfb66804faab8039e4c Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 12:30:55 2022 +0100 wip textual inversion manager (unit tests passing for base stuff + padding) commit 2e80872e3b6f7fd7d8eb8928822bd824b63cb2ff Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 10:57:57 2022 +0100 wip new TextualInversionManager * stop using WeightedFrozenCLIPEmbedder * store diffusion models locally - configure_invokeai.py reconfigured to store diffusion models rather than CompVis models - hugging face caching model is used, but cache is set to ~/invokeai/models/repo_id - models.yaml does **NOT** use path, just repo_id - "repo_name" changed to "repo_id" to following hugging face conventions - Models are loaded with full precision pending further work. * allow non-local files during development * path takes priority over repo_id * MVP for model_cache and configure_invokeai - Feature complete (almost) - configure_invokeai.py downloads both .ckpt and diffuser models, along with their VAEs. Both types of download are controlled by a unified INITIAL_MODELS.yaml file. - model_cache can load both type of model and switches back and forth in CPU. No memory leaks detected TO DO: 1. I have not yet turned on the LocalOnly flag for diffuser models, so the code will check the Hugging Face repo for updates before using the locally cached models. This will break firewalled systems. I am thinking of putting in a global check for internet connectivity at startup time and setting the LocalOnly flag based on this. It would be good to check updates if there is connectivity. 2. I have not gone completely through INITIAL_MODELS.yaml to check which models are available as diffusers and which are not. So models like PaperCut and VoxelArt may not load properly. The runway and stability models are checked, as well as the Trinart models. 3. Add stanzas for SD 2.0 and 2.1 in INITIAL_MODELS.yaml REMAINING PROBLEMS NOT DIRECTLY RELATED TO MODEL_CACHE: 1. When loading a .ckpt file there are lots of messages like this: Warning! ldm.modules.attention.CrossAttention is no longer being maintained. Please use InvokeAICrossAttention instead. I'm not sure how to address this. 2. The ckpt models ***don't actually run*** due to the lack of special-case support for them in the generator objects. For example, here's the hard crash you get when you run txt2img against the legacy waifu-diffusion-1.3 model: ``` >> An error occurred: Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 140, in main main_loop(gen, opt) File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 371, in main_loop gen.prompt2image( File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1265, in __getattr__ raise AttributeError("'{}' object has no attribute '{}'".format( AttributeError: 'LatentDiffusion' object has no attribute 'image_from_embeddings' ``` 3. The inpainting diffusion model isn't working. Here's the output of "banana sushi" when inpainting-1.5 is loaded: ``` Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 301, in image_from_embeddings result_latents, result_attention_map_saver = self.latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 330, in latents_from_embeddings result: PipelineIntermediateState = infer_latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 185, in __call__ for result in self.generator_method(*args, **kwargs): File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 367, in generate_latents_from_embeddings step_output = self.step(batched_t, latents, guidance_scale, File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context return func(*args, **kwargs) File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 409, in step step_output = self.scheduler.step(noise_pred, timestep, latents, **extra_step_kwargs) File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/diffusers/schedulers/scheduling_lms_discrete.py", line 223, in step pred_original_sample = sample - sigma * model_output RuntimeError: The size of tensor a (9) must match the size of tensor b (4) at non-singleton dimension 1 ``` * proper support for float32/float16 - configure script now correctly detects user's preference for fp16/32 and downloads the correct diffuser version. If fp16 version not available, falls back to fp32 version. - misc code cleanup and simplification in model_cache * add on-the-fly conversion of .ckpt to diffusers models 1. On-the-fly conversion code can be found in the file ldm/invoke/ckpt_to_diffusers.py. 2. A new !optimize command has been added to the CLI. Should be ported to Web GUI. User experience on the CLI is this: ``` invoke> !optimize /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt INFO: Converting legacy weights file /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt to optimized diffuser model. This operation will take 30-60s to complete. Success. Optimized model is now located at /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 Writing new config file entry for sd-v1-4... >> New configuration: sd-v1-4: description: Optimized version of sd-v1-4 format: diffusers path: /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 OK to import [n]? y >> Verifying that new model loads... >> Current VRAM usage: 2.60G >> Offloading stable-diffusion-2.1 to CPU >> Loading diffusers model from /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 | Using faster float16 precision You have disabled the safety checker for <class 'ldm.invoke.generator.diffusers_pipeline.StableDiffusionGeneratorPipeline'> by passing `safety_checker=None`. Ensure that you abide to the conditions of the Stable Diffusion \ license and do not expose unfiltered results in services or applications open to the public. Both the diffusers team and Hugging Face strongly recommend to keep the safety filter enabled in all public facing circumstances,\ disabling it only for use-cases that involve analyzing network behavior or auditing its results. For more information, please have a look at https://github.com/huggingface/diffusers/pull/254 . | training width x height = (512 x 512) >> Model loaded in 3.48s >> Max VRAM used to load the model: 2.17G >> Current VRAM usage:2.17G >> Textual inversions available: >> Setting Sampler to k_lms (LMSDiscreteScheduler) Keep model loaded? [y] ``` * add parallel set of generator files for ckpt legacy generation * generation using legacy ckpt models now working * diffusers: fix missing attention_maps_callback fix for 23eb80b40421b2bb8f4b6d3dd30490d11c447b36 * associate legacy CrossAttention with .ckpt models * enable autoconvert New --autoconvert CLI option will scan a designated directory for new .ckpt files, convert them into diffuser models, and import them into models.yaml. Works like this: invoke.py --autoconvert /path/to/weights/directory In ModelCache added two new methods: autoconvert_weights(config_path, weights_directory_path, models_directory_path) convert_and_import(ckpt_path, diffuser_path) * diffusers: update to diffusers 0.11 (from 0.10.2) * fix vae loading & width/height calculation * refactor: encapsulate these conditioning data into one container * diffusers: fix some noise-scaling issues by pushing the noise-mixing down to the common function * add support for safetensors and accelerate * set local_files_only when internet unreachable * diffusers: fix error-handling path when model repo has no fp16 branch * fix generatorinpaint error Fixes : "ModuleNotFoundError: No module named 'ldm.invoke.generatorinpaint' https://github.com/invoke-ai/InvokeAI/pull/1583#issuecomment-1363634318 * quench diffuser safety-checker warning * diffusers: support stochastic DDIM eta parameter * fix conda env creation on macos * fix cross-attention with diffusers 0.11 * diffusers: the VAE needs to be tiling as well as the U-Net * diffusers: comment on subfolders * diffusers: embiggen! * diffusers: make model_cache.list_models serializable * diffusers(inpaint): restore scaling functionality * fix requirements clash between numba and numpy 1.24 * diffusers: allow inpainting model to do non-inpainting tasks * start expanding model_cache functionality * add import_ckpt_model() and import_diffuser_model() methods to model_manager - in addition, model_cache.py is now renamed to model_manager.py * allow "recommended" flag to be optional in INITIAL_MODELS.yaml * configure_invokeai now downloads VAE diffusers in advance * rename ModelCache to ModelManager * remove support for `repo_name` in models.yaml * check for and refuse to load embeddings trained on incompatible models * models.yaml.example: s/repo_name/repo_id and remove extra INITIAL_MODELS now that the main one has diffusers models in it. * add MVP textual inversion script * refactor(InvokeAIDiffuserComponent): factor out _combine() * InvokeAIDiffuserComponent: implement threshold * InvokeAIDiffuserComponent: diagnostic logs for threshold ...this does not look right * add a curses-based frontend to textual inversion - not quite working yet - requires npyscreen installed - on windows will also have the windows-curses requirement, but not added to requirements yet * add curses-based interface for textual inversion * fix crash in convert_and_import() - This corrects a "local variable referenced before assignment" error in model_manager.convert_and_import() * potential workaround for no 'state_dict' key error - As reported in https://github.com/huggingface/diffusers/issues/1876 * create TI output dir if needed * Update environment-lin-cuda.yml (#2159) Fixing line 42 to be the proper order to define the transformers requirement: ~= instead of =~ * diffusers: update sampler-to-scheduler mapping based on https://github.com/huggingface/diffusers/issues/277#issuecomment-1371428672 * improve user exp for ckt to diffusers conversion - !optimize_models command now operates on an existing ckpt file entry in models.yaml - replaces existing entry, rather than adding a new one - offers to delete the ckpt file after conversion * web: adapt progress callback to deal with old generator or new diffusers pipeline * clean-up model_manager code - add_model() verified to work for .ckpt local paths, .ckpt remote URLs, diffusers local paths, and diffusers repo_ids - convert_and_import() verified to work for local and remove .ckpt files * handle edge cases for import_model() and convert_model() * add support for safetensor .ckpt files * fix name error * code cleanup with pyflake * improve model setting behavior - If the user enters an invalid model name at startup time, will not try to load it, warn, and use default model - CLI UI enhancement: include currently active model in the command line prompt. * update test-invoke-pip.yml - fix model cache path to point to runwayml/stable-diffusion-v1-5 - remove `skip-sd-weights` from configure_invokeai.py args * exclude dev/diffusers from "fail for draft PRs" * disable "fail on PR jobs" * re-add `--skip-sd-weights` since no space * update workflow environments - include `INVOKE_MODEL_RECONFIGURE: '--yes'` * clean up model load failure handling - Allow CLI to run even when no model is defined or loadable. - Inhibit stack trace when model load fails - only show last error - Give user *option* to run configure_invokeai.py when no models successfully load. - Restart invokeai after reconfiguration. * further edge-case handling 1) only one model in models.yaml file, and that model is broken 2) no models in models.yaml 3) models.yaml doesn't exist at all * fix incorrect model status listing - "cached" was not being returned from list_models() - normalize handling of exceptions during model loading: - Passing an invalid model name to generate.set_model() will return a KeyError - All other exceptions are returned as the appropriate Exception * CI: do download weights (if not already cached) * diffusers: fix scheduler loading in offline mode * CI: fix model name (no longer has `diffusers-` prefix) * Update txt2img2img.py (#2256) * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * feat - make model storage compatible with hugging face caching system This commit alters the InvokeAI model directory to be compatible with hugging face, making it easier to share diffusers (and other models) across different programs. - If the HF_HOME environment variable is not set, then models are cached in ~/invokeai/models in a format that is identical to the HuggingFace cache. - If HF_HOME is set, then models are cached wherever HF_HOME points. - To enable sharing with other HuggingFace library clients, set HF_HOME to ~/.cache/huggingface to set the default cache location or to ~/invokeai/models to have huggingface cache inside InvokeAI. * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * fix error "no attribute CkptInpaint" * model_manager.list_models() returns entire model config stanza+status * Initial Draft - Model Manager Diffusers * added hash function to diffusers * implement sha256 hashes on diffusers models * Add Model Manager Support for Diffusers * fix various problems with model manager - in cli import functions, fix not enough values to unpack from _get_name_and_desc() - fix crash when using old-style vae: value with new-style diffuser * rebuild frontend * fix dictconfig-not-serializable issue * fix NoneType' object is not subscriptable crash in model_manager * fix "str has no attribute get" error in model_manager list_models() * Add path and repo_id support for Diffusers Model Manager Also fixes bugs * Fix tooltip IT localization not working * Add Version Number To WebUI * Optimize Model Search * Fix incorrect font on the Model Manager UI * Fix image degradation on merge fixes - [Experimental] This change should effectively fix a couple of things. - Fix image degradation on subsequent merges of the canvas layers. - Fix the slight transparent border that is left behind when filling the bounding box with a color. - Fix the left over line of color when filling a bounding box with color. So far there are no side effects for this. If any, please report. * Add local model filtering for Diffusers / Checkpoints * Go to home on modal close for the Add Modal UI * Styling Fixes * Model Manager Diffusers Localization Update * Add Safe Tensor scanning to Model Manager * Fix model edit form dispatching string values instead of numbers. * Resolve VAE handling / edge cases for supplied repos * defer injecting tokens for textual inversions until they're used for the first time * squash a console warning * implement model migration check * add_model() overwrites previous config rather than merges * fix model config file attribute merging * fix precision handling in textual inversion script * allow ckpt conversion script to work with safetensors .ckpts Applied patch here: https://github.com/huggingface/diffusers/commit/beb932c5d111872c5e45387e7b1b2b3dd0524a47 * fix name "args" is not defined crash in textual_inversion_training * fix a second NameError: name 'args' is not defined crash * fix loading of the safety checker from the global cache dir * add installation step to textual inversion frontend - After a successful training run, the script will copy learned_embeds.bin to a subfolder of the embeddings directory. - User given the option to delete the logs and intermediate checkpoints (which together use 7-8G of space) - If textual inversion training fails, reports the error gracefully. * don't crash out on incompatible embeddings - put try: blocks around places where the system tries to load an embedding which is incompatible with the currently loaded model * add support for checkpoint resuming * textual inversion preferences are saved and restored between sessions - Preferences are stored in a file named text-inversion-training/preferences.conf - Currently the resume-from-checkpoint option is not working correctly. Possible bug in textual_inversion_training.py? * copy learned_embeddings.bin into right location * add front end for diffusers model merging - Front end doesn't do anything yet!!!! - Made change to model name parsing in CLI to support ability to have merged models with the "+" character in their names. * improve inpainting experience - recommend ckpt version of inpainting-1.5 to user - fix get_noise() bug in ckpt version of omnibus.py * update environment*yml * tweak instructions to install HuggingFace token * bump version number * enhance update scripts - update scripts will now fetch new INITIAL_MODELS.yaml so that configure_invokeai.py will know about the diffusers versions. * enhance invoke.sh/invoke.bat launchers - added configure_invokeai.py to menu - menu defaults to browser-based invoke * remove conda workflow (#2321) * fix `token_ids has shape torch.Size([79]) - expected [77]` * update CHANGELOG.md with 2.3.* info - Add information on how formats have changed and the upgrade process. - Add short bug list. Co-authored-by: Damian Stewart <d@damianstewart.com> Co-authored-by: Damian Stewart <null@damianstewart.com> Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> Co-authored-by: Wybartel-luxmc <37852506+Wybartel-luxmc@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> Co-authored-by: mickr777 <115216705+mickr777@users.noreply.github.com> Co-authored-by: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Co-authored-by: Eugene Brodsky <ebr@users.noreply.github.com> Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com>
2023-01-15 14:22:46 +00:00
from ldm.invoke.devices import choose_torch_device, choose_precision
from ldm.invoke.generator.inpaint import infill_methods
use 🧨diffusers model (#1583) * initial commit of DiffusionPipeline class * spike: proof of concept using diffusers for txt2img * doc: type hints for Generator * refactor(model_cache): factor out load_ckpt * model_cache: add ability to load a diffusers model pipeline and update associated things in Generate & Generator to not instantly fail when that happens * model_cache: fix model default image dimensions * txt2img: support switching diffusers schedulers * diffusers: let the scheduler do its scaling of the initial latents Remove IPNDM scheduler; it is not behaving. * web server: update image_progress callback for diffusers data * diffusers: restore prompt weighting feature * diffusers: fix set-sampler error following model switch * diffusers: use InvokeAIDiffuserComponent for conditioning * cross_attention_control: stub (no-op) implementations for diffusers * model_cache: let offload_model work with DiffusionPipeline, sorta. * models.yaml.example: add diffusers-format model, set as default * test-invoke-conda: use diffusers-format model test-invoke-conda: put huggingface-token where the library can use it * environment-mac: upgrade to diffusers 0.7 (from 0.6) this was already done for linux; mac must have been lost in the merge. * preload_models: explicitly load diffusers models In non-interactive mode too, as long as you're logged in. * fix(model_cache): don't check `model.config` in diffusers format clean-up from recent merge. * diffusers integration: support img2img * dev: upgrade to diffusers 0.8 (from 0.7.1) We get to remove some code by using methods that were factored out in the base class. * refactor: remove backported img2img.get_timesteps now that we can use it directly from diffusers 0.8.1 * ci: use diffusers model * dev: upgrade to diffusers 0.9 (from 0.8.1) * lint: correct annotations for Python 3.9. * lint: correct AttributeError.name reference for Python 3.9. * CI: prefer diffusers-1.4 because it no longer requires a token The RunwayML models still do. * build: there's yet another place to update requirements? * configure: try to download models even without token Models in the CompVis and stabilityai repos no longer require them. (But runwayml still does.) * configure: add troubleshooting info for config-not-found * fix(configure): prepend root to config path * fix(configure): remove second `default: true` from models example * CI: simplify test-on-push logic now that we don't need secrets The "test on push but only in forks" logic was only necessary when tests didn't work for PRs-from-forks. * create an embedding_manager for diffusers * internal: avoid importing diffusers DummyObject see https://github.com/huggingface/diffusers/issues/1479 * fix "config attributes…not expected" diffusers warnings. * fix deprecated scheduler construction * work around an apparent MPS torch bug that causes conditioning to have no effect * 🚧 post-rebase repair * preliminary support for outpainting (no masking yet) * monkey-patch diffusers.attention and use Invoke lowvram code * add always_use_cpu arg to bypass MPS * add cross-attention control support to diffusers (fails on MPS) For unknown reasons MPS produces garbage output with .swap(). Use --always_use_cpu arg to invoke.py for now to test this code on MPS. * diffusers support for the inpainting model * fix debug_image to not crash with non-RGB images. * inpainting for the normal model [WIP] This seems to be performing well until the LAST STEP, at which point it dissolves to confetti. * fix off-by-one bug in cross-attention-control (#1774) prompt token sequences begin with a "beginning-of-sequence" marker <bos> and end with a repeated "end-of-sequence" marker <eos> - to make a default prompt length of <bos> + 75 prompt tokens + <eos>. the .swap() code was failing to take the column for <bos> at index 0 into account. the changes here do that, and also add extra handling for a single <eos> (which may be redundant but which is included for completeness). based on my understanding and some assumptions about how this all works, the reason .swap() nevertheless seemed to do the right thing, to some extent, is because over multiple steps the conditioning process in Stable Diffusion operates as a feedback loop. a change to token n-1 has flow-on effects to how the [1x4x64x64] latent tensor is modified by all the tokens after it, - and as the next step is processed, all the tokens before it as well. intuitively, a token's conditioning effects "echo" throughout the whole length of the prompt. so even though the token at n-1 was being edited when what the user actually wanted was to edit the token at n, it nevertheless still had some non-negligible effect, in roughly the right direction, often enough that it seemed like it was working properly. * refactor common CrossAttention stuff into a mixin so that the old ldm code can still work if necessary * inpainting for the normal model. I think it works this time. * diffusers: reset num_vectors_per_token sync with 44a00555718f1df173c60da0ed646cf700e29537 * diffusers: txt2img2img (hires_fix) with so much slicing and dicing of pipeline methods to stitch them together * refactor(diffusers): reduce some code duplication amongst the different tasks * fixup! refactor(diffusers): reduce some code duplication amongst the different tasks * diffusers: enable DPMSolver++ scheduler * diffusers: upgrade to diffusers 0.10, add Heun scheduler * diffusers(ModelCache): stopgap to make from_cpu compatible with diffusers * CI: default to diffusers-1.5 now that runwayml token requirement is gone * diffusers: update to 0.10 (and transformers to 4.25) * diffusers: use xformers when available diffusers no longer auto-enables this as of 0.10.2. * diffusers: make masked img2img behave better with multi-step schedulers re-randomizing the noise each step was confusing them. * diffusers: work more better with more models. fixed relative path problem with local models. fixed models on hub not always having a `fp16` branch. * diffusers: stopgap fix for attention_maps_callback crash after recent merge * fixup import merge conflicts correction for 061c5369a2247c6c92cd69606bcf54c4f1962a0b * test: add tests/inpainting inputs for masked img2img * diffusers(AddsMaskedGuidance): partial fix for k-schedulers Prevents them from crashing, but results are still hot garbage. * fix --safety_checker arg parsing and add note to diffusers loader about where safety checker gets called * generate: fix import error * CI: don't try to read the old init location * diffusers: support loading an alternate VAE * CI: remove sh-syntax if-statement so it doesn't crash powershell * CI: fold strings in yaml because backslash is not line-continuation in powershell * attention maps callback stuff for diffusers * build: fix syntax error in environment-mac * diffusers: add INITIAL_MODELS with diffusers-compatible repos * re-enable the embedding manager; closes #1778 * Squashed commit of the following: commit e4a956abc37fcb5cf188388b76b617bc5c8fda7d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:43:07 2022 +0100 import new load handling from EmbeddingManager and cleanup commit c4abe91a5ba0d415b45bf734068385668b7a66e6 Merge: 032e856e 1efc6397 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:09:53 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers_with_textual_inversion_manager commit 032e856eefb3bbc39534f5daafd25764bcfcef8b Merge: 8b4f0fe9 bc515e24 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:08:01 2022 +0100 Merge remote-tracking branch 'upstream/dev/diffusers' into dev/diffusers_with_textual_inversion_manager commit 1efc6397fc6e61c1aff4b0258b93089d61de5955 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:04:28 2022 +0100 cleanup and add performance notes commit e400f804ac471a0ca2ba432fd658778b20c7bdab Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:45:07 2022 +0100 fix bug and update unit tests commit deb9ae0ae1016750e93ce8275734061f7285a231 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:28:29 2022 +0100 textual inversion manager seems to work commit 162e02505dec777e91a983c4d0fb52e950d25ff0 Merge: cbad4583 12769b3d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:58:03 2022 +0100 Merge branch 'main' into feature_textual_inversion_mgr commit cbad45836c6aace6871a90f2621a953f49433131 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:54:10 2022 +0100 use position embeddings commit 070344c69b0e0db340a183857d0a787b348681d3 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:53:47 2022 +0100 Don't crash CLI on exceptions commit b035ac8c6772dfd9ba41b8eeb9103181cda028f8 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:11:55 2022 +0100 add missing position_embeddings commit 12769b3d3562ef71e0f54946b532ad077e10043c Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:33:25 2022 +0100 debugging why it don't work commit bafb7215eabe1515ca5e8388fd3bb2f3ac5362cf Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:21:33 2022 +0100 debugging why it don't work commit 664a6e9e146b42d96703f0cc8baf8f5efec04ee1 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit 8b4f0fe9d6e4e2643b36dfa27864294785d7ba4e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit ffbe1ab11163ba712e353d89404e301d0e0c6cdf Merge: 6e4dad60 023df37e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:37:31 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers commit 023df37efffa67434f77def7fc3c9dfb29f699fd Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:36:54 2022 +0100 cleanup commit 05fac594eaf79d0058e3c48deee93df603f136c2 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:07:49 2022 +0100 tweak error checking commit 009f32ed39a7280997c3ffab112adadee0b44279 Author: damian <null@damianstewart.com> Date: Thu Dec 15 21:29:47 2022 +0100 unit tests passing for embeddings with vector length >1 commit beb1b08d9a98112ed2fe073580568e1a18698da3 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:39:09 2022 +0100 more explicit equality tests when overwriting commit 44d8a5a7c85cdabc9ce3a54fd0769a10597b3ca9 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:30:13 2022 +0100 wip textual inversion manager (unit tests passing for 1v embedding overwriting) commit 417c2b57d90924a839616bfb66804faab8039e4c Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 12:30:55 2022 +0100 wip textual inversion manager (unit tests passing for base stuff + padding) commit 2e80872e3b6f7fd7d8eb8928822bd824b63cb2ff Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 10:57:57 2022 +0100 wip new TextualInversionManager * stop using WeightedFrozenCLIPEmbedder * store diffusion models locally - configure_invokeai.py reconfigured to store diffusion models rather than CompVis models - hugging face caching model is used, but cache is set to ~/invokeai/models/repo_id - models.yaml does **NOT** use path, just repo_id - "repo_name" changed to "repo_id" to following hugging face conventions - Models are loaded with full precision pending further work. * allow non-local files during development * path takes priority over repo_id * MVP for model_cache and configure_invokeai - Feature complete (almost) - configure_invokeai.py downloads both .ckpt and diffuser models, along with their VAEs. Both types of download are controlled by a unified INITIAL_MODELS.yaml file. - model_cache can load both type of model and switches back and forth in CPU. No memory leaks detected TO DO: 1. I have not yet turned on the LocalOnly flag for diffuser models, so the code will check the Hugging Face repo for updates before using the locally cached models. This will break firewalled systems. I am thinking of putting in a global check for internet connectivity at startup time and setting the LocalOnly flag based on this. It would be good to check updates if there is connectivity. 2. I have not gone completely through INITIAL_MODELS.yaml to check which models are available as diffusers and which are not. So models like PaperCut and VoxelArt may not load properly. The runway and stability models are checked, as well as the Trinart models. 3. Add stanzas for SD 2.0 and 2.1 in INITIAL_MODELS.yaml REMAINING PROBLEMS NOT DIRECTLY RELATED TO MODEL_CACHE: 1. When loading a .ckpt file there are lots of messages like this: Warning! ldm.modules.attention.CrossAttention is no longer being maintained. Please use InvokeAICrossAttention instead. I'm not sure how to address this. 2. The ckpt models ***don't actually run*** due to the lack of special-case support for them in the generator objects. For example, here's the hard crash you get when you run txt2img against the legacy waifu-diffusion-1.3 model: ``` >> An error occurred: Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 140, in main main_loop(gen, opt) File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 371, in main_loop gen.prompt2image( File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1265, in __getattr__ raise AttributeError("'{}' object has no attribute '{}'".format( AttributeError: 'LatentDiffusion' object has no attribute 'image_from_embeddings' ``` 3. The inpainting diffusion model isn't working. Here's the output of "banana sushi" when inpainting-1.5 is loaded: ``` Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 301, in image_from_embeddings result_latents, result_attention_map_saver = self.latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 330, in latents_from_embeddings result: PipelineIntermediateState = infer_latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 185, in __call__ for result in self.generator_method(*args, **kwargs): File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 367, in generate_latents_from_embeddings step_output = self.step(batched_t, latents, guidance_scale, File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context return func(*args, **kwargs) File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 409, in step step_output = self.scheduler.step(noise_pred, timestep, latents, **extra_step_kwargs) File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/diffusers/schedulers/scheduling_lms_discrete.py", line 223, in step pred_original_sample = sample - sigma * model_output RuntimeError: The size of tensor a (9) must match the size of tensor b (4) at non-singleton dimension 1 ``` * proper support for float32/float16 - configure script now correctly detects user's preference for fp16/32 and downloads the correct diffuser version. If fp16 version not available, falls back to fp32 version. - misc code cleanup and simplification in model_cache * add on-the-fly conversion of .ckpt to diffusers models 1. On-the-fly conversion code can be found in the file ldm/invoke/ckpt_to_diffusers.py. 2. A new !optimize command has been added to the CLI. Should be ported to Web GUI. User experience on the CLI is this: ``` invoke> !optimize /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt INFO: Converting legacy weights file /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt to optimized diffuser model. This operation will take 30-60s to complete. Success. Optimized model is now located at /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 Writing new config file entry for sd-v1-4... >> New configuration: sd-v1-4: description: Optimized version of sd-v1-4 format: diffusers path: /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 OK to import [n]? y >> Verifying that new model loads... >> Current VRAM usage: 2.60G >> Offloading stable-diffusion-2.1 to CPU >> Loading diffusers model from /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 | Using faster float16 precision You have disabled the safety checker for <class 'ldm.invoke.generator.diffusers_pipeline.StableDiffusionGeneratorPipeline'> by passing `safety_checker=None`. Ensure that you abide to the conditions of the Stable Diffusion \ license and do not expose unfiltered results in services or applications open to the public. Both the diffusers team and Hugging Face strongly recommend to keep the safety filter enabled in all public facing circumstances,\ disabling it only for use-cases that involve analyzing network behavior or auditing its results. For more information, please have a look at https://github.com/huggingface/diffusers/pull/254 . | training width x height = (512 x 512) >> Model loaded in 3.48s >> Max VRAM used to load the model: 2.17G >> Current VRAM usage:2.17G >> Textual inversions available: >> Setting Sampler to k_lms (LMSDiscreteScheduler) Keep model loaded? [y] ``` * add parallel set of generator files for ckpt legacy generation * generation using legacy ckpt models now working * diffusers: fix missing attention_maps_callback fix for 23eb80b40421b2bb8f4b6d3dd30490d11c447b36 * associate legacy CrossAttention with .ckpt models * enable autoconvert New --autoconvert CLI option will scan a designated directory for new .ckpt files, convert them into diffuser models, and import them into models.yaml. Works like this: invoke.py --autoconvert /path/to/weights/directory In ModelCache added two new methods: autoconvert_weights(config_path, weights_directory_path, models_directory_path) convert_and_import(ckpt_path, diffuser_path) * diffusers: update to diffusers 0.11 (from 0.10.2) * fix vae loading & width/height calculation * refactor: encapsulate these conditioning data into one container * diffusers: fix some noise-scaling issues by pushing the noise-mixing down to the common function * add support for safetensors and accelerate * set local_files_only when internet unreachable * diffusers: fix error-handling path when model repo has no fp16 branch * fix generatorinpaint error Fixes : "ModuleNotFoundError: No module named 'ldm.invoke.generatorinpaint' https://github.com/invoke-ai/InvokeAI/pull/1583#issuecomment-1363634318 * quench diffuser safety-checker warning * diffusers: support stochastic DDIM eta parameter * fix conda env creation on macos * fix cross-attention with diffusers 0.11 * diffusers: the VAE needs to be tiling as well as the U-Net * diffusers: comment on subfolders * diffusers: embiggen! * diffusers: make model_cache.list_models serializable * diffusers(inpaint): restore scaling functionality * fix requirements clash between numba and numpy 1.24 * diffusers: allow inpainting model to do non-inpainting tasks * start expanding model_cache functionality * add import_ckpt_model() and import_diffuser_model() methods to model_manager - in addition, model_cache.py is now renamed to model_manager.py * allow "recommended" flag to be optional in INITIAL_MODELS.yaml * configure_invokeai now downloads VAE diffusers in advance * rename ModelCache to ModelManager * remove support for `repo_name` in models.yaml * check for and refuse to load embeddings trained on incompatible models * models.yaml.example: s/repo_name/repo_id and remove extra INITIAL_MODELS now that the main one has diffusers models in it. * add MVP textual inversion script * refactor(InvokeAIDiffuserComponent): factor out _combine() * InvokeAIDiffuserComponent: implement threshold * InvokeAIDiffuserComponent: diagnostic logs for threshold ...this does not look right * add a curses-based frontend to textual inversion - not quite working yet - requires npyscreen installed - on windows will also have the windows-curses requirement, but not added to requirements yet * add curses-based interface for textual inversion * fix crash in convert_and_import() - This corrects a "local variable referenced before assignment" error in model_manager.convert_and_import() * potential workaround for no 'state_dict' key error - As reported in https://github.com/huggingface/diffusers/issues/1876 * create TI output dir if needed * Update environment-lin-cuda.yml (#2159) Fixing line 42 to be the proper order to define the transformers requirement: ~= instead of =~ * diffusers: update sampler-to-scheduler mapping based on https://github.com/huggingface/diffusers/issues/277#issuecomment-1371428672 * improve user exp for ckt to diffusers conversion - !optimize_models command now operates on an existing ckpt file entry in models.yaml - replaces existing entry, rather than adding a new one - offers to delete the ckpt file after conversion * web: adapt progress callback to deal with old generator or new diffusers pipeline * clean-up model_manager code - add_model() verified to work for .ckpt local paths, .ckpt remote URLs, diffusers local paths, and diffusers repo_ids - convert_and_import() verified to work for local and remove .ckpt files * handle edge cases for import_model() and convert_model() * add support for safetensor .ckpt files * fix name error * code cleanup with pyflake * improve model setting behavior - If the user enters an invalid model name at startup time, will not try to load it, warn, and use default model - CLI UI enhancement: include currently active model in the command line prompt. * update test-invoke-pip.yml - fix model cache path to point to runwayml/stable-diffusion-v1-5 - remove `skip-sd-weights` from configure_invokeai.py args * exclude dev/diffusers from "fail for draft PRs" * disable "fail on PR jobs" * re-add `--skip-sd-weights` since no space * update workflow environments - include `INVOKE_MODEL_RECONFIGURE: '--yes'` * clean up model load failure handling - Allow CLI to run even when no model is defined or loadable. - Inhibit stack trace when model load fails - only show last error - Give user *option* to run configure_invokeai.py when no models successfully load. - Restart invokeai after reconfiguration. * further edge-case handling 1) only one model in models.yaml file, and that model is broken 2) no models in models.yaml 3) models.yaml doesn't exist at all * fix incorrect model status listing - "cached" was not being returned from list_models() - normalize handling of exceptions during model loading: - Passing an invalid model name to generate.set_model() will return a KeyError - All other exceptions are returned as the appropriate Exception * CI: do download weights (if not already cached) * diffusers: fix scheduler loading in offline mode * CI: fix model name (no longer has `diffusers-` prefix) * Update txt2img2img.py (#2256) * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * feat - make model storage compatible with hugging face caching system This commit alters the InvokeAI model directory to be compatible with hugging face, making it easier to share diffusers (and other models) across different programs. - If the HF_HOME environment variable is not set, then models are cached in ~/invokeai/models in a format that is identical to the HuggingFace cache. - If HF_HOME is set, then models are cached wherever HF_HOME points. - To enable sharing with other HuggingFace library clients, set HF_HOME to ~/.cache/huggingface to set the default cache location or to ~/invokeai/models to have huggingface cache inside InvokeAI. * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * fix error "no attribute CkptInpaint" * model_manager.list_models() returns entire model config stanza+status * Initial Draft - Model Manager Diffusers * added hash function to diffusers * implement sha256 hashes on diffusers models * Add Model Manager Support for Diffusers * fix various problems with model manager - in cli import functions, fix not enough values to unpack from _get_name_and_desc() - fix crash when using old-style vae: value with new-style diffuser * rebuild frontend * fix dictconfig-not-serializable issue * fix NoneType' object is not subscriptable crash in model_manager * fix "str has no attribute get" error in model_manager list_models() * Add path and repo_id support for Diffusers Model Manager Also fixes bugs * Fix tooltip IT localization not working * Add Version Number To WebUI * Optimize Model Search * Fix incorrect font on the Model Manager UI * Fix image degradation on merge fixes - [Experimental] This change should effectively fix a couple of things. - Fix image degradation on subsequent merges of the canvas layers. - Fix the slight transparent border that is left behind when filling the bounding box with a color. - Fix the left over line of color when filling a bounding box with color. So far there are no side effects for this. If any, please report. * Add local model filtering for Diffusers / Checkpoints * Go to home on modal close for the Add Modal UI * Styling Fixes * Model Manager Diffusers Localization Update * Add Safe Tensor scanning to Model Manager * Fix model edit form dispatching string values instead of numbers. * Resolve VAE handling / edge cases for supplied repos * defer injecting tokens for textual inversions until they're used for the first time * squash a console warning * implement model migration check * add_model() overwrites previous config rather than merges * fix model config file attribute merging * fix precision handling in textual inversion script * allow ckpt conversion script to work with safetensors .ckpts Applied patch here: https://github.com/huggingface/diffusers/commit/beb932c5d111872c5e45387e7b1b2b3dd0524a47 * fix name "args" is not defined crash in textual_inversion_training * fix a second NameError: name 'args' is not defined crash * fix loading of the safety checker from the global cache dir * add installation step to textual inversion frontend - After a successful training run, the script will copy learned_embeds.bin to a subfolder of the embeddings directory. - User given the option to delete the logs and intermediate checkpoints (which together use 7-8G of space) - If textual inversion training fails, reports the error gracefully. * don't crash out on incompatible embeddings - put try: blocks around places where the system tries to load an embedding which is incompatible with the currently loaded model * add support for checkpoint resuming * textual inversion preferences are saved and restored between sessions - Preferences are stored in a file named text-inversion-training/preferences.conf - Currently the resume-from-checkpoint option is not working correctly. Possible bug in textual_inversion_training.py? * copy learned_embeddings.bin into right location * add front end for diffusers model merging - Front end doesn't do anything yet!!!! - Made change to model name parsing in CLI to support ability to have merged models with the "+" character in their names. * improve inpainting experience - recommend ckpt version of inpainting-1.5 to user - fix get_noise() bug in ckpt version of omnibus.py * update environment*yml * tweak instructions to install HuggingFace token * bump version number * enhance update scripts - update scripts will now fetch new INITIAL_MODELS.yaml so that configure_invokeai.py will know about the diffusers versions. * enhance invoke.sh/invoke.bat launchers - added configure_invokeai.py to menu - menu defaults to browser-based invoke * remove conda workflow (#2321) * fix `token_ids has shape torch.Size([79]) - expected [77]` * update CHANGELOG.md with 2.3.* info - Add information on how formats have changed and the upgrade process. - Add short bug list. Co-authored-by: Damian Stewart <d@damianstewart.com> Co-authored-by: Damian Stewart <null@damianstewart.com> Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> Co-authored-by: Wybartel-luxmc <37852506+Wybartel-luxmc@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> Co-authored-by: mickr777 <115216705+mickr777@users.noreply.github.com> Co-authored-by: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Co-authored-by: Eugene Brodsky <ebr@users.noreply.github.com> Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com>
2023-01-15 14:22:46 +00:00
from ldm.invoke.globals import global_cache_dir
from ldm.invoke.image_util import InitImageResizer
from ldm.invoke.model_manager import ModelManager
from ldm.invoke.pngwriter import PngWriter
from ldm.invoke.seamless import configure_model_padding
from ldm.invoke.txt2mask import Txt2Mask
from ldm.models.diffusion.ddim import DDIMSampler
from ldm.models.diffusion.ksampler import KSampler
from ldm.models.diffusion.plms import PLMSSampler
def fix_func(orig):
if hasattr(torch.backends, 'mps') and torch.backends.mps.is_available():
def new_func(*args, **kw):
device = kw.get("device", "mps")
kw["device"]="cpu"
return orig(*args, **kw).to(device)
return new_func
return orig
torch.rand = fix_func(torch.rand)
torch.rand_like = fix_func(torch.rand_like)
torch.randn = fix_func(torch.randn)
torch.randn_like = fix_func(torch.randn_like)
torch.randint = fix_func(torch.randint)
torch.randint_like = fix_func(torch.randint_like)
torch.bernoulli = fix_func(torch.bernoulli)
torch.multinomial = fix_func(torch.multinomial)
# this is fallback model in case no default is defined
FALLBACK_MODEL_NAME='stable-diffusion-1.5'
Refactoring simplet2i (#387) * start refactoring -not yet functional * first phase of refactor done - not sure weighted prompts working * Second phase of refactoring. Everything mostly working. * The refactoring has moved all the hard-core inference work into ldm.dream.generator.*, where there are submodules for txt2img and img2img. inpaint will go in there as well. * Some additional refactoring will be done soon, but relatively minor work. * fix -save_orig flag to actually work * add @neonsecret attention.py memory optimization * remove unneeded imports * move token logging into conditioning.py * add placeholder version of inpaint; porting in progress * fix crash in img2img * inpainting working; not tested on variations * fix crashes in img2img * ported attention.py memory optimization #117 from basujindal branch * added @torch_no_grad() decorators to img2img, txt2img, inpaint closures * Final commit prior to PR against development * fixup crash when generating intermediate images in web UI * rename ldm.simplet2i to ldm.generate * add backward-compatibility simplet2i shell with deprecation warning * add back in mps exception, addresses @vargol comment in #354 * replaced Conditioning class with exported functions * fix wrong type of with_variations attribute during intialization * changed "image_iterator()" to "get_make_image()" * raise NotImplementedError for calling get_make_image() in parent class * Update ldm/generate.py better error message Co-authored-by: Kevin Gibbons <bakkot@gmail.com> * minor stylistic fixes and assertion checks from code review * moved get_noise() method into img2img class * break get_noise() into two methods, one for txt2img and the other for img2img * inpainting works on non-square images now * make get_noise() an abstract method in base class * much improved inpainting Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
2022-09-06 00:40:10 +00:00
"""Simplified text to image API for stable diffusion/latent diffusion
Example Usage:
from ldm.generate import Generate
# Create an object with default values
gr = Generate('stable-diffusion-1.4')
Refactoring simplet2i (#387) * start refactoring -not yet functional * first phase of refactor done - not sure weighted prompts working * Second phase of refactoring. Everything mostly working. * The refactoring has moved all the hard-core inference work into ldm.dream.generator.*, where there are submodules for txt2img and img2img. inpaint will go in there as well. * Some additional refactoring will be done soon, but relatively minor work. * fix -save_orig flag to actually work * add @neonsecret attention.py memory optimization * remove unneeded imports * move token logging into conditioning.py * add placeholder version of inpaint; porting in progress * fix crash in img2img * inpainting working; not tested on variations * fix crashes in img2img * ported attention.py memory optimization #117 from basujindal branch * added @torch_no_grad() decorators to img2img, txt2img, inpaint closures * Final commit prior to PR against development * fixup crash when generating intermediate images in web UI * rename ldm.simplet2i to ldm.generate * add backward-compatibility simplet2i shell with deprecation warning * add back in mps exception, addresses @vargol comment in #354 * replaced Conditioning class with exported functions * fix wrong type of with_variations attribute during intialization * changed "image_iterator()" to "get_make_image()" * raise NotImplementedError for calling get_make_image() in parent class * Update ldm/generate.py better error message Co-authored-by: Kevin Gibbons <bakkot@gmail.com> * minor stylistic fixes and assertion checks from code review * moved get_noise() method into img2img class * break get_noise() into two methods, one for txt2img and the other for img2img * inpainting works on non-square images now * make get_noise() an abstract method in base class * much improved inpainting Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
2022-09-06 00:40:10 +00:00
# do the slow model initialization
gr.load_model()
# Do the fast inference & image generation. Any options passed here
# override the default values assigned during class initialization
# Will call load_model() if the model was not previously loaded and so
# may be slow at first.
# The method returns a list of images. Each row of the list is a sub-list of [filename,seed]
results = gr.prompt2png(prompt = "an astronaut riding a horse",
outdir = "./outputs/samples",
iterations = 3)
for row in results:
print(f'filename={row[0]}')
print(f'seed ={row[1]}')
# Same thing, but using an initial image.
results = gr.prompt2png(prompt = "an astronaut riding a horse",
outdir = "./outputs/,
iterations = 3,
init_img = "./sketches/horse+rider.png")
for row in results:
print(f'filename={row[0]}')
print(f'seed ={row[1]}')
# Same thing, but we return a series of Image objects, which lets you manipulate them,
# combine them, and save them under arbitrary names
results = gr.prompt2image(prompt = "an astronaut riding a horse"
outdir = "./outputs/")
for row in results:
im = row[0]
seed = row[1]
im.save(f'./outputs/samples/an_astronaut_riding_a_horse-{seed}.png')
im.thumbnail(100,100).save('./outputs/samples/astronaut_thumb.jpg')
Note that the old txt2img() and img2img() calls are deprecated but will
still work.
The full list of arguments to Generate() are:
gr = Generate(
# these values are set once and shouldn't be changed
2022-10-24 02:56:58 +00:00
conf:str = path to configuration file ('configs/models.yaml')
model:str = symbolic name of the model in the configuration file
precision:float = float precision to be used
safety_checker:bool = activate safety checker [False]
# this value is sticky and maintained between generation calls
Merge dev into main for 2.2.0 (#1642) * Fixes inpainting + code cleanup * Disable stage info in Inpainting Tab * Mask Brush Preview now always at 0.5 opacity The new mask is only visible properly at max opacity but at max opacity the brush preview becomes fully opaque blocking the view. So the mask brush preview no remains at 0.5 no matter what the Brush opacity is. * Remove save button from Canvas Controls (cleanup) * Implements invert mask * Changes "Invert Mask" to "Preserve Masked Areas" * Fixes (?) spacebar issues * Patches redux-persist and redux-deep-persist with debounced persists Our app changes redux state very, very often. As our undo/redo history grows, the calls to persist state start to take in the 100ms range, due to a the deep cloning of the history. This causes very noticeable performance lag. The deep cloning is required because we need to blacklist certain items in redux from being persisted (e.g. the app's connection status). Debouncing the whole process of persistence is a simple and effective solution. Unfortunately, `redux-persist` dropped `debounce` between v4 and v5, replacing it with `throttle`. `throttle`, instead of delaying the expensive action until a period of X ms of inactivity, simply ensures the action is executed at least every X ms. Of course, this does not fix our performance issue. The patch is very simple. It adds a `debounce` argument - a number of milliseconds - and debounces `redux-persist`'s `update()` method (provided by `createPersistoid`) by that many ms. Before this, I also tried writing a custom storage adapter for `redux-persist` to debounce the calls to `localStorage.setItem()`. While this worked and was far less invasive, it doesn't actually address the issue. It turns out `setItem()` is a very fast part of the process. We use `redux-deep-persist` to simplify the `redux-persist` configuration, which can get complicated when you need to blacklist or whitelist deeply nested state. There is also a patch here for that library because it uses the same types as `redux-persist`. Unfortunately, the last release of `redux-persist` used a package `flat-stream` which was malicious and has been removed from npm. The latest commits to `redux-persist` (about 1 year ago) do not build; we cannot use the master branch. And between the last release and last commit, the changes have all been breaking. Patching this last release (about 3 years old at this point) directly is far simpler than attempting to fix the upstream library's master branch or figuring out an alternative to the malicious and now non-existent dependency. * Adds debouncing * Fixes AttributeError: 'dict' object has no attribute 'invert_mask' * Updates package.json to use redux-persist patches * Attempts to fix redux-persist debounce patch * Fixes undo/redo * Fixes invert mask * Debounce > 300ms * Limits history to 256 for each of undo and redo * Canvas styling * Hotkeys improvement * Add Metadata To Viewer * Increases CFG Scale max to 200 * Fix gallery width size for Outpainting Also fixes the canvas resizing failing n fast pushes * Fixes disappearing canvas grid lines * Adds staging area * Fixes "use all" not setting variationAmount Now sets to 0 when the image had variations. * Builds fresh bundle * Outpainting tab loads to empty canvas instead of upload * Fixes wonky canvas layer ordering & compositing * Fixes error on inpainting paste back `TypeError: 'float' object cannot be interpreted as an integer` * Hides staging area outline on mouseover prev/next * Fixes inpainting not doing img2img when no mask * Fixes bbox not resizing in outpainting if partially off screen * Fixes crashes during iterative outpaint. Still doesn't work correctly though. * Fix iterative outpainting by restoring original images * Moves image uploading to HTTP - It all seems to work fine - A lot of cleanup is still needed - Logging needs to be added - May need types to be reviewed * Fixes: outpainting temp images show in gallery * WIP refactor to unified canvas * Removes console.log from redux-persist patch * Initial unification of canvas * Removes all references to split inpainting/outpainting canvas * Add patchmatch and infill_method parameter to prompt2image (options are 'patchmatch' or 'tile'). * Fixes app after removing in/out-painting refs * Rebases on dev, updates new env files w/ patchmatch * Organises features/canvas * Fixes bounding box ending up offscreen * Organises features/canvas * Stops unnecessary canvas rescales on gallery state change * Fixes 2px layout shift on toggle canvas lock * Clips lines drawn while canvas locked When drawing with the locked canvas, if a brush stroke gets too close to the edge of the canvas and its stroke would extend past the edge of the canvas, the edge of that stroke will be seen after unlocking the canvas. This could cause a problem if you unlock the canvas and now have a bunch of strokes just outside the init image area, which are far back in undo history and you cannot easily erase. With this change, lines drawn while the canvas is locked get clipped to the initial image bbox, fixing this issue. Additionally, the merge and save to gallery functions have been updated to respect the initial image bbox so they function how you'd expect. * Fixes reset canvas view when locked * Fixes send to buttons * Fixes bounding box not being rounded to 64 * Abandons "inpainting" canvas lock * Fixes save to gallery including empty area, adds download and copy image * Fix Current Image display background going over image bounds * Sets status immediately when clicking Invoke * Adds hotkeys and refactors sharing of konva instances Adds hotkeys to canvas. As part of this change, the access to konva instance objects was refactored: Previously closure'd refs were used to indirectly get access to the konva instances outside of react components. Now, a getter and setter function are used to provide access directly to the konva objects. * Updates hotkeys * Fixes canvas showing spinner on first load Also adds good default canvas scale and positioning when no image is on it * Fixes possible hang on MaskCompositer * Improves behaviour when setting init canvas image/reset view * Resets bounding box coords/dims when no image present * Disables canvas actions which cannot be done during processing * Adds useToastWatcher hook - Dispatch an `addToast` action with standard Chakra toast options object to add a toast to the toastQueue - The hook is called in App.tsx and just useEffect's w/ toastQueue as dependency to create the toasts - So now you can add toasts anywhere you have access to `dispatch`, which includes middleware and thunks - Adds first usage of this for the save image buttons in canvas * Update Hotkey Info Add missing tooltip hotkeys and update the hotkeys modal to reflect the new hotkeys for the Unified Canvas. * Fix theme changer not displaying current theme on page refresh * Fix tab count in hotkeys panel * Unify Brush and Eraser Sizes * Fix staging area display toggle not working * Staging Area delete button is now red So it doesnt feel blended into to the rest of them. * Revert "Fix theme changer not displaying current theme on page refresh" This reverts commit 903edfb803e743500242589ff093a8a8a0912726. * Add arguments to use SSL to webserver * Integrates #1487 - touch events Need to add: - Pinch zoom - Touch-specific handling (some things aren't quite right) * Refactors upload-related async thunks - Now standard thunks instead of RTK createAsyncThunk() - Adds toasts for all canvas upload-related actions * Reorganises app file structure * Fixes Canvas Auto Save to Gallery * Fixes staging area outline * Adds staging area hotkeys, disables gallery left/right when staging * Fixes Use All Parameters * Fix metadata viewer image url length when viewing intermediate * Fixes intermediate images being tiny in txt2img/img2img * Removes stale code * Improves canvas status text and adds option to toggle debug info * Fixes paste image to upload * Adds model drop-down to site header * Adds theme changer popover * Fix missing key on ThemeChanger map * Fixes stage position changing on zoom * Hotkey Cleanup - Viewer is now Z - Canvas Move tool is V - sync with PS - Removed some unused hotkeys * Fix canvas resizing when both options and gallery are unpinned * Implements thumbnails for gallery - Thumbnails are saved whenever an image is saved, and when gallery requests images from server - Thumbnails saved at original image aspect ratio with width of 128px as WEBP - If the thumbnail property of an image is unavailable for whatever reason, the image's full size URL is used instead * Saves thumbnails to separate thumbnails directory * Thumbnail size = 256px * Fix Lightbox Issues * Disables canvas image saving functions when processing * Fix index error on going past last image in Gallery * WIP - Lightbox Fixes Still need to fix the images not being centered on load when the image res changes * Fixes another similar index error, simplifies logic * Reworks canvas toolbar * Fixes canvas toolbar upload button * Cleans up IAICanvasStatusText * Improves metadata handling, fixes #1450 - Removes model list from metadata - Adds generation's specific model to metadata - Displays full metadata in JSON viewer * Gracefully handles corrupted images; fixes #1486 - App does not crash if corrupted image loaded - Error is displayed in the UI console and CLI output if an image cannot be loaded * Adds hotkey to reset canvas interaction state If the canvas' interaction state (e.g. isMovingBoundingBox, isDrawing, etc) get stuck somehow, user can press Escape to reset the state. * Removes stray console.log() * Fixes bug causing gallery to close on context menu open * Minor bugfixes - When doing long-running canvas image exporting actions, display indeterminate progress bar - Fix staging area image outline not displaying after committing/discarding results * Removes unused imports * Fixes repo root .gitignore ignoring frontend things * Builds fresh bundle * Styling updates * Removes reasonsWhyNotReady The popover doesn't play well with the button being disabled, and I don't think adds any value. * Image gallery resize/style tweaks * Styles buttons for clearing canvas history and mask * First pass on Canvas options panel * Fixes bug where discarding staged images results in loss of history * Adds Save to Gallery button to staging toolbar * Rearrange some canvas toolbar icons Put brush stuff together and canvas movement stuff together * Fix gallery maxwidth on unified canvas * Update Layer hotkey display to UI * Adds option to crop to bounding box on save * Masking option tweaks * Crop to Bounding Box > Save Box Region Only * Adds clear temp folder * Updates mask options popover behavior * Builds fresh bundle * Fix styling on alert modals * Fix input checkbox styling being incorrect on light theme * Styling fixes * Improves gallery resize behaviour * Cap gallery size on canvas tab so it doesnt overflow * Fixes bug when postprocessing image with no metadata * Adds IAIAlertDialog component * Moves Loopback to app settings * Fixes metadata viewer not showing metadata after refresh Also adds Dream-style prompt to metadata * Adds outpainting specific options * Linting * Fixes gallery width on lightbox, fixes gallery button expansion * Builds fresh bundle * Fix Lightbox images of different res not centering * Update feature tooltip text * Highlight mask icon when on mask layer * Fix gallery not resizing correctly on open and close * Add loopback to just img2img. Remove from settings. * Fix to gallery resizing * Removes Advanced checkbox, cleans up options panel for unified canvas * Minor styling fixes to new options panel layout * Styling Updates * Adds infill method * Tab Styling Fixes * memoize outpainting options * Fix unnecessary gallery re-renders * Isolate Cursor Pos debug text on canvas to prevent rerenders * Fixes missing postprocessed image metadata before refresh * Builds fresh bundle * Fix rerenders on model select * Floating panel re-render fix * Simplify fullscreen hotkey selector * Add Training WIP Tab * Adds Training icon * Move full screen hotkey to floating to prevent tab rerenders * Adds single-column gallery layout * Fixes crash on cancel with intermediates enabled, fixes #1416 * Updates npm dependencies * Fixes img2img attempting inpaint when init image has transparency * Fixes missing threshold and perlin parameters in metadata viewer * Renames "Threshold" > "Noise Threshold" * Fixes postprocessing not being disabled when clicking use all * Builds fresh bundle * Adds color picker * Lints & builds fresh bundle * Fixes iterations being disabled when seed random & variations are off * Un-floors cursor position * Changes color picker preview to circles * Fixes variation params not set correctly when recalled * Fixes invoke hotkey not working in input fields * Simplifies Accordion Prep for adding reset buttons for each section * Fixes mask brush preview color * Committing color picker color changes tool to brush * Color picker does not overwrite user-selected alpha * Adds brush color alpha hotkey * Lints * Removes force_outpaint param * Add inpaint size options to inpaint at a larger size than the actual inpaint image, then scale back down for recombination * Bug fix for inpaint size * Adds inpaint size (as scale bounding box) to UI * Adds auto-scaling for inpaint size * Improves scaled bbox display logic * Fixes bug with clear mask and history * Fixes shouldShowStagingImage not resetting to true on commit * Builds fresh bundle * Fixes canvas failing to scale on first run * Builds fresh bundle * Fixes unnecessary canvas scaling * Adds gallery drag and drop to img2img/canvas * Builds fresh bundle * Fix desktop mode being broken with new versions of flaskwebgui * Fixes canvas dimensions not setting on first load * Builds fresh bundle * stop crash on !import_models call on model inside rootdir - addresses bug report #1546 * prevent "!switch state gets confused if model switching fails" - If !switch were to fail on a particular model, then generate got confused and wouldn't try again until you switch to a different working model and back again. - This commit fixes and closes #1547 * Revert "make the docstring more readable and improve the list_models logic" This reverts commit 248068fe5d57b5639ea7a87ee6cbf023104d957d. * fix model cache path * also set fail-fast to it's default (true) in this way the whole action fails if one job fails this should unblock the runners!!! * fix output path for Archive results * disable checks for python 3.9 * Update-requirements and test-invoke-pip workflow (#1574) * update requirements files * update test-invoke-pip workflow * move requirements-mkdocs.txt to docs folder (#1575) * move requirements-mkdocs.txt to docs folder * update copyright * Fixes outpainting with resized inpaint size * Interactive configuration (#1517) * Update scripts/configure_invokeai.py prevent crash if output exists Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> * implement changes requested by reviews * default to correct root and output directory on Windows systems - Previously the script was relying on the readline buffer editing feature to set up the correct default. But this feature doesn't exist on windows. - This commit detects when user typed return with an empty directory value and replaces with the default directory. * improved readability of directory choices * Update scripts/configure_invokeai.py Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> * better error reporting at startup - If user tries to run the script outside of the repo or runtime directory, a more informative message will appear explaining the problem. Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> * Embedding merging (#1526) * add whole <style token> to vocab for concept library embeddings * add ability to load multiple concept .bin files * make --log_tokenization respect custom tokens * start working on concept downloading system * preliminary support for dynamic loading and merging of multiple embedded models - The embedding_manager is now enhanced with ldm.invoke.concepts_lib, which handles dynamic downloading and caching of embedded models from the Hugging Face concepts library (https://huggingface.co/sd-concepts-library) - Downloading of a embedded model is triggered by the presence of one or more <concept> tags in the prompt. - Once the embedded model is downloaded, its trigger phrase will be loaded into the embedding manager and the prompt's <concept> tag will be replaced with the <trigger_phrase> - The downloaded model stays on disk for fast loading later. - The CLI autocomplete will complete partial <concept> tags for you. Type a '<' and hit tab to get all ~700 concepts. BUGS AND LIMITATIONS: - MODEL NAME VS TRIGGER PHRASE You must use the name of the concept embed model from the SD library, and not the trigger phrase itself. Usually these are the same, but not always. For example, the model named "hoi4-leaders" corresponds to the trigger "<HOI4-Leader>" One reason for this design choice is that there is no apparent constraint on the uniqueness of the trigger phrases and one trigger phrase may map onto multiple models. So we use the model name instead. The second reason is that there is no way I know of to search Hugging Face for models with certain trigger phrases. So we'd have to download all 700 models to index the phrases. The problem this presents is that this may confuse users, who will want to reuse prompts from distributions that use the trigger phrase directly. Usually this will work, but not always. - WON'T WORK ON A FIREWALLED SYSTEM If the host running IAI has no internet connection, it can't download the concept libraries. I will add a script that allows users to preload a list of concept models. - BUG IN PROMPT REPLACEMENT WHEN MODEL NOT FOUND There's a small bug that occurs when the user provides an invalid model name. The <concept> gets replaced with <None> in the prompt. * fix loading .pt embeddings; allow multi-vector embeddings; warn on dupes * simplify replacement logic and remove cuda assumption * download list of concepts from hugging face * remove misleading customization of '*' placeholder the existing code as-is did not do anything; unclear what it was supposed to do. the obvious alternative -- setting using 'placeholder_strings' instead of 'placeholder_tokens' to match model.params.personalization_config.params.placeholder_strings -- caused a crash. i think this is because the passed string also needed to be handed over on init of the PersonalizedBase as the 'placeholder_token' argument. this is weird config dict magic and i don't want to touch it. put a breakpoint in personalzied.py line 116 (top of PersonalizedBase.__init__) if you want to have a crack at it yourself. * address all the issues raised by damian0815 in review of PR #1526 * actually resize the token_embeddings * multiple improvements to the concept loader based on code reviews 1. Activated the --embedding_directory option (alias --embedding_path) to load a single embedding or an entire directory of embeddings at startup time. 2. Can turn off automatic loading of embeddings using --no-embeddings. 3. Embedding checkpoints are scanned with the pickle scanner. 4. More informative error messages when a concept can't be loaded due either to a 404 not found error or a network error. * autocomplete terms end with ">" now * fix startup error and network unreachable 1. If the .invokeai file does not contain the --root and --outdir options, invoke.py will now fix it. 2. Catch and handle network problems when downloading hugging face textual inversion concepts. * fix misformatted error string Co-authored-by: Damian Stewart <d@damianstewart.com> * model_cache.py: fix list_models Signed-off-by: devops117 <55235206+devops117@users.noreply.github.com> * add statement of values (#1584) * this adds the Statement of Values Google doc source = https://docs.google.com/document/d/1-PrUKDJcxy8OyNGc8CyiHhv2VgLvjt7LRGlEpbg1nmQ/edit?usp=sharing * Fix heading * Update InvokeAI_Statement_of_Values.md * Update InvokeAI_Statement_of_Values.md * Update InvokeAI_Statement_of_Values.md * Update InvokeAI_Statement_of_Values.md * Update InvokeAI_Statement_of_Values.md * add keturn and mauwii to the team member list * Fix punctuation * this adds the Statement of Values Google doc source = https://docs.google.com/document/d/1-PrUKDJcxy8OyNGc8CyiHhv2VgLvjt7LRGlEpbg1nmQ/edit?usp=sharing * add keturn and mauwii to the team member list * fix formating - make sub bullets use * (decide to all use - or *) - indent sub bullets Sorry, first only looked at the code version and found this only after looking at the markdown rendered version * use multiparagraph numbered sections * Break up Statement Of Values as per comments on #1584 * remove duplicated word, reduce vagueness it's important not to overstate how many artists we are consulting. * fix typo (sorry blessedcoolant) Co-authored-by: mauwii <Mauwii@outlook.de> Co-authored-by: damian <git@damianstewart.com> * update dockerfile (#1551) * update dockerfile * remove not existing file from .dockerignore * remove bloat and unecesary step also use --no-cache-dir for pip install image is now close to 2GB * make Dockerfile a variable * set base image to `ubuntu:22.10` * add build-essential * link outputs folder for persistence * update tag variable * update docs * fix not customizeable build args, add reqs output * !model_import autocompletes in ROOTDIR * Adds psychedelicious to statement of values signature (#1602) * add a --no-patchmatch option to disable patchmatch loading (#1598) This feature was added to prevent the CI Macintosh tests from erroring out when patchmatch is unable to retrieve its shared library from github assets. * Fix #1599 by relaxing the `match_trigger` regex (#1601) * Fix #1599 by relaxing the `match_trigger` regex Also simplify logic and reduce duplication. * restrict trigger regex again (but not so far) * make concepts library work with Web UI This PR makes it possible to include a Hugging Face concepts library <style-or-subject-trigger> in the WebUI prompt. The metadata seems to be correctly handled. * documentation enhancements (#1603) - Add documentation for the Hugging Face concepts library and TI embedding. - Fixup index.md to point to each of the feature documentation files, including ones that are pending. * tweak setup and environment files for linux & pypatchmatch (#1580) * tweak setup and environment files for linux & pypatchmatch - Downgrade python requirements to 3.9 because 3.10 is not supported on Ubuntu 20.04 LTS (widely-used distro) - Use our github pypatchmatch 0.1.3 in order to install Makefile where it needs to be. - Restored "-e ." as the last install step on pip installs. Hopefully this will not trigger the high-CPU hang we've previously experienced. * keep windows on basicsr 1.4.1 * keep windows on basicsr 1.4.1 * bump pypatchmatch requirement to 0.1.4 - This brings in a version of pypatchmatch that will gracefully handle internet connection not available at startup time. - Also refactors and simplifies the handling of gfpgan's basicsr requirement across various platforms. * revert to older version of list_models() (#1611) This restores the correct behavior of list_models() and quenches the bug of list_models() returning a single model entry named "name". I have not investigated what was wrong with the new version, but I think it may have to do with changes to the behavior in dict.update() * Fixes for #1604 (#1605) * Converts ESRGAN image input to RGB - Also adds typing for image input. - Partially resolves #1604 * ensure there are unmasked pixels before color matching Co-authored-by: Kyle Schouviller <kyle0654@hotmail.com> * update index.md (#1609) - comment out non existing link - fix indention - add seperator between feature categories * Debloat-docker (#1612) * debloat Dockerfile - less options more but more userfriendly - better Entrypoint to simulate CLI usage - without command the container still starts the web-host * debloat build.sh * better syntax in run.sh * update Docker docs - fix description of VOLUMENAME - update run script example to reflect new entrypoint * Test installer (#1618) * test linux install * try removing http from parsed requirements * pip install confirmed working on linux * ready for linux testing - rebuilt py3.10-linux-x86_64-cuda-reqs.txt to include pypatchmatch dependency. - point install.sh and install.bat to test-installer branch. * Updates MPS reqs * detect broken readline history files * fix download.pytorch.org URL * Test installer (Win 11) (#1620) Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> * Test installer (MacOS 13.0.1 w/ torch==1.12.0) (#1621) * Test installer (Win 11) * Test installer (MacOS 13.0.1 w/ torch==1.12.0) Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> * change sourceball to development for testing * Test installer (MacOS 13.0.1 w/ torch==1.12.1 & torchvision==1.13.1) (#1622) * Test installer (Win 11) * Test installer (MacOS 13.0.1 w/ torch==1.12.0) * Test installer (MacOS 13.0.1 w/ torch==1.12.1 & torchvision==1.13.1) Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Co-authored-by: Cyrus Chan <82143712+cyruschan360@users.noreply.github.com> Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> * 2.2 Doc Updates (#1589) * Unified Canvas Docs & Assets Unified Canvas draft Advanced Tools Updates Doc Updates (lstein feedback) * copy edits to Unified Canvas docs - consistent capitalisation and feature naming - more intimate address (replace "the user" with "you") for improved User Engagement(tm) - grammatical massaging and *poesie* Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> Co-authored-by: damian <git@damianstewart.com> * include a step after config to `cat ~/.invokeai` (#1629) * disable patchmatch in CI actions (#1626) * disable patchmatch in CI actions * fix indention * replace tab with spaces Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> * Fix installer script for macOS. (#1630) * refer to the platform as 'osx' instead of 'mac', otherwise the composed URL to micromamba is wrong. * move the `-O` option to `tar` to be grouped with the other tar flags to avoid the `-O` being interpreted as something to unarchive. * Removes symlinked environment.yaml (#1631) Was unintentionally added in #1621 * Fix inpainting with iterations (#1635) * fix error when inpainting using runwayml inpainting model (#1634) - error was "Omnibus object has no attribute pil_image" - closes #1596 * add k_dpmpp_2_a and k_dpmpp_2 solvers options (#1389) * add k_dpmpp_2_a and k_dpmpp_2 solvers options * update frontend Co-authored-by: Victor <victorca25@users.noreply.github.com> Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> * add .editorconfig (#1636) * Web UI 2.2 bugfixes (#1572) * Fixes bug preventing multiple images from being generated * Fixes valid seam strength value range * Update Delete Alert Text Indicates to the user that images are not permanently deleted. * Fixes left/right arrows not working on gallery * Fixes initial image on load erroneously set to a user uploaded image Should be a result gallery image. * Lightbox Fixes - Lightbox is now a button in the current image buttons - Lightbox is also now available in the gallery context menu - Lightbox zoom issues fixed - Lightbox has a fade in animation. * Fix image display wrapper in current preview not overflow bounds * Revert "Fix image display wrapper in current preview not overflow bounds" This reverts commit 5511c82714dbf1d1999d64e8bc357bafa34ddf37. * Change Staging Area discard icon from Bin to X * Expose Snap Threshold and Move Snap Settings to BBox Panel * Changes img2img strength default to 0.75 * Fixes drawing triggering when mouse enters canvas w/ button down When we only supported inpainting and no zoom, this was useful. It allowed the cursor to leave the canvas (which was easy to do given the limited canvas dimensions) and without losing the "I am drawing" state. With a zoomable canvas this is no longer as useful. Additionally, we have more popovers and tools (like the color pickers) which result in unexpected brush strokes. This fixes that issue. * Revert "Expose Snap Threshold and Move Snap Settings to BBox Panel" We will handle this a bit differently - by allowing the grid origin to be moved. I will dig in at some point. This reverts commit 33c92ecf4da724c2f17d9d91c7ea31a43a2f6deb. * Adds Limit Strokes to Box * Adds fill bounding box button * Adds erase bounding box button * Changes Staging area discard icon to match others * Fixes right click breaking move tool * Fixes brush preview visibility issue with "darken outside box" * Fixes history bugs with addFillRect, addEraseRect, and other actions * Adds missing `key` * Fixes postprocessing being applied to canvas generations * Fixes bbox not getting scaled in various situations * Fixes staging area show image toggle not resetting on accept/discard * Locks down canvas while generating/staging * Fixes move tool breaking when canvas loses focus during move/transform * Hides cursor when restrict strokes is on and mouse outside bbox * Lints * Builds fresh bundle * Fix overlapping hotkey for Fill Bounding Box * Build Fresh Bundle * Fixes bug with mask and bbox overlay * Builds fresh bundle Co-authored-by: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> * disable NSFW checker loading during the CI tests (#1641) * disable NSFW checker loading during the CI tests The NSFW filter apparently causes invoke.py to crash during CI testing, possibly due to out of memory errors. This workaround disables NSFW model loading. * doc change * fix formatting errors in yml files * Configure the NSFW checker at install time with default on (#1624) * configure the NSFW checker at install time with default on 1. Changes the --safety_checker argument to --nsfw_checker and --no-nsfw_checker. The original argument is recognized for backward compatibility. 2. The configure script asks users whether to enable the checker (default yes). Also offers users ability to select default sampler and number of generation steps. 3.Enables the pasting of the caution icon on blurred images when InvokeAI is installed into the package directory. 4. Adds documentation for the NSFW checker, including caveats about accuracy, memory requirements, and intermediate image dispaly. * use better fitting icon * NSFW defaults false for testing * set default back to nsfw active Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> Signed-off-by: devops117 <55235206+devops117@users.noreply.github.com> Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Co-authored-by: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Co-authored-by: Kyle Schouviller <kyle0654@hotmail.com> Co-authored-by: javl <mail@jaspervanloenen.com> Co-authored-by: Kent Keirsey <31807370+hipsterusername@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com> Co-authored-by: Damian Stewart <d@damianstewart.com> Co-authored-by: DevOps117 <55235206+devops117@users.noreply.github.com> Co-authored-by: damian <git@damianstewart.com> Co-authored-by: Damian Stewart <null@damianstewart.com> Co-authored-by: Cyrus Chan <82143712+cyruschan360@users.noreply.github.com> Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> Co-authored-by: Andre LaBranche <dre@mac.com> Co-authored-by: victorca25 <41912303+victorca25@users.noreply.github.com> Co-authored-by: Victor <victorca25@users.noreply.github.com>
2022-11-30 21:12:23 +00:00
sampler_name:str = ['ddim', 'k_dpm_2_a', 'k_dpm_2', 'k_dpmpp_2', 'k_dpmpp_2_a', 'k_euler_a', 'k_euler', 'k_heun', 'k_lms', 'plms'] // k_lms
# these are deprecated - use conf and model instead
weights = path to model weights ('models/ldm/stable-diffusion-v1/model.ckpt')
config = path to model configuration ('configs/stable-diffusion/v1-inference.yaml')
)
Refactoring simplet2i (#387) * start refactoring -not yet functional * first phase of refactor done - not sure weighted prompts working * Second phase of refactoring. Everything mostly working. * The refactoring has moved all the hard-core inference work into ldm.dream.generator.*, where there are submodules for txt2img and img2img. inpaint will go in there as well. * Some additional refactoring will be done soon, but relatively minor work. * fix -save_orig flag to actually work * add @neonsecret attention.py memory optimization * remove unneeded imports * move token logging into conditioning.py * add placeholder version of inpaint; porting in progress * fix crash in img2img * inpainting working; not tested on variations * fix crashes in img2img * ported attention.py memory optimization #117 from basujindal branch * added @torch_no_grad() decorators to img2img, txt2img, inpaint closures * Final commit prior to PR against development * fixup crash when generating intermediate images in web UI * rename ldm.simplet2i to ldm.generate * add backward-compatibility simplet2i shell with deprecation warning * add back in mps exception, addresses @vargol comment in #354 * replaced Conditioning class with exported functions * fix wrong type of with_variations attribute during intialization * changed "image_iterator()" to "get_make_image()" * raise NotImplementedError for calling get_make_image() in parent class * Update ldm/generate.py better error message Co-authored-by: Kevin Gibbons <bakkot@gmail.com> * minor stylistic fixes and assertion checks from code review * moved get_noise() method into img2img class * break get_noise() into two methods, one for txt2img and the other for img2img * inpainting works on non-square images now * make get_noise() an abstract method in base class * much improved inpainting Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
2022-09-06 00:40:10 +00:00
"""
class Generate:
"""Generate class
Stores default values for multiple configuration items
"""
def __init__(
self,
model = None,
conf = 'configs/models.yaml',
embedding_path = None,
sampler_name = 'k_lms',
ddim_eta = 0.0, # deterministic
full_precision = False,
precision = 'auto',
merge release-candidate-1-3-2 into main. Squashed commit of the following: commit 9a1fe8e7fbbd81d9e9e47c4fda6bde6f66fba30c Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 12 17:07:40 2022 +0000 swap in release URLs for installers commit ff56f5251ba8502833cb561317e82b028cd2da5d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 12 17:03:21 2022 +0000 fix up bad unicode chars in invoke.py commit ed943bd6c785d968d1e31fbbb814fea8688fc8bb Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 12 16:05:45 2022 +0000 outcrop improvements, hand-added commit 7ad2355b1da53861bb75312edead8f9db0b0f44d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 12 15:14:33 2022 +0000 documentation fixes commit 66c920fc197d9206be9e0e2d1eb2a1cb86362887 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 16:49:25 2022 -0500 Revert "Resize hires as an image" This reverts commit d05b1b3544dfa7b3c071ac05b4f014a52e08fa50. commit 3fc5cb09f8bc03ea96e67a3e49fb087019d2f9d5 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 12 12:43:17 2022 +0000 fix incorrect link in install commit 1345ec77ab58f70e1bf5a0f587ca40aba4e906b7 Author: tildebyte <337875+tildebyte@users.noreply.github.com> Date: Sun Nov 6 19:07:31 2022 -0500 toil(repo): add tildebyte as owner of installer/ directory commit b116715490f390a59e5bee1022a6a758aee0918d Author: Kyle Schouviller <kyle0654@hotmail.com> Date: Thu Nov 10 21:43:56 2022 -0800 Fix performance issue introduced by torch cuda cache clear during generation commit fa3670270e7aae6bfd8d47fb7bdd32b707310c23 Author: mauwii <Mauwii@outlook.de> Date: Fri Nov 11 12:42:03 2022 +0100 small update to dockers huggingface section commit c304250ef663b3e202b4da8332365288589d94c7 Author: mauwii <Mauwii@outlook.de> Date: Fri Nov 11 12:19:27 2022 +0100 fix format and Link in INSTALL_INVOKE.md commit 802ce5dde5ca68f24aa4609cdba428044e0c7fa1 Author: mauwii <Mauwii@outlook.de> Date: Fri Nov 11 11:17:49 2022 +0100 small fixex to format and a link in INSTALL_MANUAL commit 311ee320ecac892cb4a1bcd012374fa051b1d011 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 07:23:35 2022 +0000 ignore installer intermediate files commit e9df17b374df58a44d3ae3ba33cbdc58794bcf5d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 07:19:25 2022 +0000 fix backslash-related syntax error commit 061fb4ef00482bdd4fba635aeaeff4ca7510190d Merge: 52be0d23 4095acd1 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 06:50:04 2022 +0000 Merge branch 'release-candidate-2-1-3' of github.com:/invoke-ai/InvokeAI into release-candidate-2-1-3 commit 52be0d2396de2de02030855c92e3367008b50377 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 06:49:45 2022 +0000 add WindowsLongFileName batfile to source installer commit 4095acd10ebae05a8cb14cc2faf7c79936d9e6a9 Author: mauwii <Mauwii@outlook.de> Date: Fri Nov 11 07:05:17 2022 +0100 Doc Updates A lot of re-formating of new Installation Docs also some content updates/corrections commit 201eb22d7650b00f55249c2646fa4f47ac3e0ec2 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 04:41:02 2022 +0000 prevent two models from being marked default in models.yaml commit 17ab98220034dfbb798a9a0460bc2837f0c1e2cb Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 03:56:54 2022 +0000 installers download branch HEAD not tag commit a04965b0e9e9d1170cf284af9acbd1186d681255 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 03:48:21 2022 +0000 improve messaging during installation process commit 0b529f0c574dd91fb9593e924ebc41c8c219b6ce Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 15:22:32 2022 +0000 enable outcropping of random JPG/PNG images - Works best with runwayML inpainting model - Numerous code changes required to propagate seed to final metadata. Original code predicated on the image being generated within InvokeAI. commit 6f9f84834557eb3c48562dc5d0ace51ca9e9cca2 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 17:27:42 2022 +0000 enhance outcropping with ability to direct contents of new regions - When outcropping an image you can now add a `--new_prompt` option, to specify a new prompt to be used instead of the original one used to generate the image. - Similarly you can provide a new seed using `--seed` (or `-S`). A seed of zero will pick one randomly. - This PR also fixes the crash that happened when trying to outcrop an image that does not contain InvokeAI metadata. commit 918c1589ef30595668899f4259ece6a4ad605c69 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 20:16:47 2022 +0000 fix #1402 commit 116415b3fcec8415f8e6de9b23c0bbd0dbc6845b Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 21:27:25 2022 +0000 fix invoke.py crash if no models.yaml file present - Script will now offer the user the ability to create a minimal models.yaml and then gracefully exit. - Closes #1420 commit b4b6eabaac94896e38123be331c44d1b63065b0d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 16:49:25 2022 -0500 Revert "Log strength with hires" This reverts commit 82d4904c07670d514e9a541de7c9ecd8489eeae2. commit 4ef1f4a854717c953f9192454d0adabef32af36c Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 20:01:49 2022 +0000 remove temporary directory from repo commit 510fc4ebaa5f9dc0e77b47cf04e0c265423e0a44 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 19:59:03 2022 +0000 remove -e from clipseg load in installer commit a20914434bb3609cf1d883cabf048d4cc25f881a Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 19:37:07 2022 +0000 change clipseg repo branch to avoid clipseg not found error commit 0d134195fda5c69fce5a95d6da90248eba8d226d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 18:39:29 2022 +0000 update repo URL to point to rc commit 649d8c8573896fdb5a73453b69ee4b54cf4d6241 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 18:13:28 2022 +0000 integrate tildebyte installer commit a358d370a05ea985a9e26fa9c1101d9c14fdb3ab Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 17:48:14 2022 +0000 add @tildebyte compiled pip installer commit 94a9033c4f6214e604be149a3de6d7c747af7f3a Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 14:52:00 2022 +0000 ignore source installer zip files commit 18a947c503c83c95cd83f27424696219ff3c4c95 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 14:46:36 2022 +0000 documentation and environment file fixes - Have clarified the relationship between the @tildebyte and @cmdr2 installers; However, @tildebyte installer merge is still a WIP due to conflicts over such things as `invoke.sh`. - Rechristened 1click installer as "source" installer. @tildebyte installer will be "the" installer. (We'll see which one generates the least support requests and maintenance work.) - Sync'd `environment-mac.yml` with `development`. The former was failing with a taming-transformers error as per https://discord.com/channels/@me/1037201214154231899/1040060947378749460 commit a23b03189526a49da8ddae90ce71b0e902784d29 Author: Mike DiGiovanni <vinblau@gmail.com> Date: Wed Nov 9 16:44:59 2022 -0500 Fixes typos in README.md commit 23af68c7d79d947f1bd3441c91bb44d655238f01 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 07:02:27 2022 -0500 downgrade win installs to basicsr==1.4.1 commit e258beeb51f3e645b9ea60e52d69d18722221cc5 Merge: 7460c069 e481bfac Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 06:37:45 2022 -0500 Merge branch 'release-candidate-2-1-3' of github.com:invoke-ai/InvokeAI into release-candidate-2-1-3 commit 7460c069b880b10c84b55f2e0c0998e350d6cf12 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 06:36:48 2022 -0500 remove --prefer-binary from requirements-base.txt It appears that some versions of pip do not recognize this option when it appears in the requirements file. Did not explore this further but recommend --prefer-binary in the manual install instructions on the command line. commit e481bfac615e0c798ceb5e59e8fbe3038f85b431 Merge: 5040747c d1ab65a4 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 11:21:56 2022 +0000 Merge branch 'release-candidate-2-1-3' of github.com:/invoke-ai/InvokeAI into release-candidate-2-1-3 commit 5040747c6700c9b949e3f3e1d2c3f21daffcec6c Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 11:21:43 2022 +0000 fix windows install instructions & bat file commit d1ab65a43122f73c20533d5815590ec10bc05eca Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 07:18:59 2022 +0100 update WEBUIHOTKEYS.md commit af4ee7feb8a7d2528bf4e2b3f7deee7a7c4c3dec Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 06:33:49 2022 +0100 update INSTALL_DOCKER.md commit 764fb29aded8114984d05932c4266ea24614b932 Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 06:30:15 2022 +0100 fix formatting in INSTALL.md commit 1014d3ba44aa4cd4cfdc6e3650c24a0dc9568a6e Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 06:29:14 2022 +0100 fix build.sh invokeai_conda_env_file default value commit 40a48aca88e337e9f4475f80a03b7d6d4751d09b Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 05:25:30 2022 +0100 fix environment-mac.yml moved taming-transformers-rom1504 to pip dependencies commit 92abc00f16a34a586dd16d3c64408f00e23fcb53 Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 05:19:52 2022 +0100 fix test-invoke-conda - copy required conda environment yaml - use environment.yml - I use cp instead of ln since would be compatible for windows runners commit a5719aabf89c8c5f29c6044e2882ccdcd0c6916b Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 04:14:35 2022 +0100 update Dockerfile - link environment.yml from new environemnts path - change default conda_env_file - quote all variables to avoid splitting - also remove paths from conda-env-files in build-container.yml commit 44a18511fa7accfec6a20345774583a1ce745b02 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 20:51:06 2022 +0000 update paths in container build workflow commit b850dbadafba052310327ca759d96f49a9d25d03 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 20:16:57 2022 +0000 finished reorganization of install docs commit 9ef8b944d53afb1fed94c418b2fd936d2d743797 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 18:50:58 2022 +0000 tweaks to manual install documentation --prefer-binary is an iffy option in the requirements file. It isn't supported by some versions of pip, so I removed it from requirements-base.txt and inserted it into the manual install instructions where it seems to do what it is supposed to. commit efc5a9848803b4250d726bc1913b9fd5a33fad75 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 18:20:03 2022 +0000 manual installation documentation tested on Linux commit 1417c87928e13b0ed21bf1c5604f8636d3b50a8d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 17:37:06 2022 +0000 change name of requirements.txt to avoid confusion commit 2dd6fc2b93ff7bbb4038568a3b28d36a8fafaeb8 Merge: 22213612 71ee44a8 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 17:26:24 2022 +0000 Merge branch 'release-candidate-2-1-3' of github.com:/invoke-ai/InvokeAI into release-candidate-2-1-3 commit 22213612a08bbece46eafd48994f985b097cb141 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 17:25:59 2022 +0000 directory cleanup; working on install docs commit 71ee44a827898759fd457f774c0b2ac7a1ef6519 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 02:07:13 2022 +0000 prevent crash when switching to an invalid model commit b17ca0a5e731c142101bbdbf34d121df949e86d7 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 14:28:38 2022 +0100 don't suppress exceptions when doing cross-attention control commit 71bbfe4a1a5b70f90e5f41c94df50fb104dbdd79 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 12:59:34 2022 +0100 Fix #1362 by improving VRAM usage patterns when doing .swap() commit ef3f7a26e242b73c2beb0195c7fd8f654ef47f55 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 12:18:37 2022 +0100 remove log spam commit 7189d649622d4668b120b0dd278388ad672142c4 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 12:10:28 2022 +0100 change the way saved slicing strategy is applied commit 01c40f751ab72955140165c16f95ae411732265b Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 12:04:43 2022 +0100 fix slicing_strategy_getter callsite commit f8cfe25150a346958903316bc710737d99839923 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 11:56:22 2022 +0100 cleanup, consistent dim=0 also tested commit 5bf9b1e890d48e962afd4a668a219b68271e5dc1 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 11:34:09 2022 +0100 refactored context, tested with non-sliced cross attention control commit d58a46e39bf562e7459290d2444256e8c08ad0b6 Author: damian0815 <null@damianstewart.com> Date: Sun Nov 6 00:41:52 2022 +0100 cleanup commit 7e2c658b4c06fe239311b65b9bb16fa3adec7fd7 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:57:31 2022 +0100 disable logs commit 20ee89d93841b070738b3d8a4385c93b097d92eb Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:36:58 2022 +0100 slice saved attention if necessary commit 0a7684a22c880ec0f48cc22bfed4526358f71546 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:32:38 2022 +0100 raise instead of asserting commit 7083104c7f3a0d8fd96e94a2f391de50a3c942e4 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:31:00 2022 +0100 store dim when saving slices commit f7c0808ed383ec1dc70645288a798ed2aa4fa85c Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:27:16 2022 +0100 don't retry on exception commit 749a721e939b3fe7c1741e7998dab6bd2c85a0cb Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:24:50 2022 +0100 stuff commit 032ab90e9533be8726301ec91b97137e2aadef9a Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:20:17 2022 +0100 more logging commit 3dc34b387f033482305360e605809d95a40bf6f8 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:16:47 2022 +0100 logs commit 901c4c1aa4b9bcef695a6551867ec8149e6e6a93 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:12:39 2022 +0100 actually set save_slicing_strategy to True commit f780e0a0a7c6b6a3db320891064da82589358c8a Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:10:35 2022 +0100 store slicing strategy commit 93bb6d566fd18c5c69ef7dacc8f74ba2cf671cb7 Author: damian <git@damianstewart.com> Date: Sat Nov 5 20:43:48 2022 +0100 still not it commit 5e3a9541f8ae00bde524046963910323e20c40b7 Author: damian <git@damianstewart.com> Date: Sat Nov 5 17:20:02 2022 +0100 wip offloading attention slices on-demand commit 4c2966aa856b6f3b446216da3619ae931552ef08 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 15:47:40 2022 +0100 pre-emptive offloading, idk if it works commit 572576755e9f0a878d38e8173e485126c0efbefb Author: root <you@example.com> Date: Sat Nov 5 11:25:32 2022 +0000 push attention slices to cpu. slow but saves memory. commit b57c83a68f2ac03976ebc89ce2ff03812d6d185f Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 12:04:22 2022 +0100 verbose logging commit 3a5dae116f110a96585d9eb71d713b5ed2bc3d2b Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 11:50:48 2022 +0100 wip fixing mem strategy crash (4 test on runpod) commit 3cf237db5fae0c7b0b4cc3c47c81830bdb2ae7de Author: damian0815 <null@damianstewart.com> Date: Fri Nov 4 09:02:40 2022 +0100 wip, only works on cuda commit 5702271991e126c026aa1ff41c44f8ad37b26e3a Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 14:09:36 2022 +0000 speculative reorganization of the requirements & environment files - This is only a test! - The various environment*.yml and requirements*.txt files have all been moved into a directory named "environments-and-requirements". - The idea is to clean up our root directory so that the github home page is tidy. - The manual install instructions will start with the instructions to create a symbolic link from environment.yml to the appropriate file for OS and GPU. - The 1-click installers have been updated to accommodate this change. commit 10781e7dc4f4551583a110d14f2a1f60393112b8 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 01:59:45 2022 +0000 refactoring requirements commit 099d1157c579c7b9fea20945e8504cc15745c598 Author: mauwii <Mauwii@outlook.de> Date: Wed Nov 9 00:16:18 2022 +0100 better way to make sure if conda is useable commit ab825bf7ee5f0b82d2273da1cda64fc9266a978e Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 22:05:33 2022 +0000 add back --prefer-binaries to requirements commit 10cfeb5ada7bcfc9f3aff3716ab8ea4961a8b528 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 8 22:27:19 2022 +0100 add quotes to set and use `$environment_file` commit e97515d0453583e013674b4dd1f3739c7de402cc Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 8 22:24:21 2022 +0100 set environment file for conda update commit 0f04bc5789c712bf7c7319b1d93064914993f4ec Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 8 22:21:25 2022 +0100 use conda env update commit 3f74aabecd08ed25fac158463ae12b775bd1fca2 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 8 22:20:44 2022 +0100 use command instead of hash commit b1a99a51b7ca23c4b895855bd7b4c82dbdc431e4 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 14:44:44 2022 -0500 remove --global git config from 1-click installers commit 8004f8a6d99f6ff75e00c170da40f1dec93a8914 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Mon Nov 7 09:07:20 2022 -0500 Revert "Use array slicing to calc ddim timesteps" This reverts commit 1f0c5b4cf196716c21f2db74f92c8750ad8f889d. commit ff8ff2212afb1e1c2dce4f6a61f29e2bc8302eb5 Merge: 8e5363cd 636620b1 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 14:01:40 2022 +0000 add initfile support from PR #1386 commit 8e5363cd83bff0e6be0f002c644283955f7fcbfd Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 13:26:18 2022 +0000 move 'installer/' to '1-click-installer' to make room for tildebyte installer commit 1450779146e89510d12b8c90eb316d9861c3375e Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 12:56:36 2022 +0000 update branch for installer to pull against commit 8cd5d95b8a1cb213cce2f949c394c841a09d9cab Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 05:30:20 2022 +0000 move all models into subdirectories of ./models - this required an update to the invoke-ai fork of gfpgan - simultaneously reverted consolidation of environment and requirements files, as their presence in a directory triggered setup.py to try to install a sub-package. commit abd6407394d55d4f6c064a05f3ac989dd3817c59 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 03:52:46 2022 +0000 leave a copy of environment-cuda.yml at top level - named it environment.yml - need to avoid a big change for users and breaking older support instructions. commit 734dacfbe9d8c86ca943c6541e7b5ff5ef787ff4 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 03:50:07 2022 +0000 consolidate environment files - starting to remove unneeded entries and pins - no longer require -e in front of github dependencies - update setup.py with release number - update manual installation instructions commit 636620b1d5e2466613d0dcc2a604522be12fa3a4 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 03:26:16 2022 +0000 change initfile to ~/.invokeai - adjust documentation - also fix 'clipseg_models' to 'clipseg', which seems to be working now commit 1fe41146f0975bbc9d552208473490a9ccb9fc56 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 5 14:28:01 2022 -0400 add support for an initialization file, invokeai.init - Place preferred startup command switches in a file named "invokeai.init". The file can consist of a single line of switches such as "--web --steps=28", a series of switches on each line, or any combination of the two. Example: ``` --web --host=0.0.0.0 --steps=28 --grid -f 0.6 -C 11.0 -A k_euler_a ``` - The following options, which were previously only available within the CLI, are now available on the command line as well: --steps --strength --cfg_scale --width --height --fit commit 2ad6ef355a9b9c4b17bae71edea2346c2e8708c5 Merge: 865502ee 8b47c829 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sun Nov 6 18:08:36 2022 +0000 update discord link commit 865502ee4f681de4516d231370ae603983354d8f Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 18:00:16 2022 +0100 update changelog commit c7984f3299c5c8f56a70d80907d527af458674af Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 17:07:27 2022 +0100 update TROUBLESHOOT.md commit 7f150ed83302ba875c3e0c0f39d8ac0f32c6e362 Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 16:56:58 2022 +0100 remove `:`from headlines in CONTRIBUTORS.md commit badf4e256ce6e3201df1a9a87a7072b36b18d699 Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 16:56:37 2022 +0100 enable navigation tabs Since the docs are growing, this way they look cleaner commit e64c60bbb38fc1620e08ce52bf28bd17003c7ef6 Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 16:18:59 2022 +0100 remove preflight checks from assets seems like somebody executed tests and commited them commit 178061854300632b024810e65922b54b64d95939 Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 16:15:06 2022 +0100 update INSTALLING_MODELS.md commit f91fd276242a0c92b301e99d02982d30f7b712c3 Author: Kyle Schouviller <kyle0654@hotmail.com> Date: Sat Nov 5 14:47:53 2022 -0700 Bug fix for inpaint size commit 09e41e8f769457b9ffd56901aae13991cdc6eeb8 Author: Kyle Schouviller <kyle0654@hotmail.com> Date: Sat Nov 5 14:34:52 2022 -0700 Add inpaint size options to inpaint at a larger size than the actual inpaint image, then scale back down for recombination commit 6eeb2107b300fc27cfe6134b43e5570c246b8e96 Author: mauwii <Mauwii@outlook.de> Date: Sat Nov 5 21:01:14 2022 +0100 remove create-caches.yml since not used anywhere commit 17053ad8b7efecb21a9b4eb32695089f683f72e3 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 5 16:01:55 2022 -0400 fix duplicated argument introduced by conflict resolution commit fefb4dc1f88bc6551a39602a2bc79b278cd83c59 Merge: 762ca60a d05b1b35 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 5 12:47:35 2022 -0700 Merge branch 'development' into fix_generate.py commit d05b1b3544dfa7b3c071ac05b4f014a52e08fa50 Author: Craig <cwallen@users.noreply.github.com> Date: Sat Oct 29 20:40:30 2022 -0400 Resize hires as an image commit 82d4904c07670d514e9a541de7c9ecd8489eeae2 Author: Craig <cwallen@users.noreply.github.com> Date: Sat Oct 29 20:37:40 2022 -0400 Log strength with hires commit 1cdcf33cfa39e90f9660fabf8f5936dcfb6c3aa5 Merge: 6616fa83 cbc029c6 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 5 09:57:38 2022 -0400 Merge branch 'main' into development - this synchronizes recent document fixes by mauwii commit 6616fa835ac4318bf53419f2b54b88c962559578 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 4 00:47:03 2022 -0400 fix Windows library dependency issues This commit addresses two bugs: 1) invokeai.py crashes immediately with a message about an undefined attritube sigKILL (closes #1288). The fix is to pin torch at 1.12.1. 2) Version 1.4.2 of basicsr fails to load properly on Windows, and is a requirement of realesrgan, however 1.4.1 works. Pinning basicsr in our requirements file resulted in a dependency conflict, so I ended up cloning realesrgan into the invoke-ai Git space and changing the requirements file there. If there is a more elegant solution, please advise. commit 7b9a4564b11f4181b9b3c06ecda2a4a25fd1849e Author: Matthias Wild <40327258+mauwii@users.noreply.github.com> Date: Sat Nov 5 14:36:45 2022 +0100 Update-docs (#1382) * update IMG2IMG.md * update INPAINTING.md * update WEBUIHOTKEYS.md * more doc updates (mostly fix formatting): - OUTPAINTING.md - POSTPROCESS.md - PROMPTS.md - VARIATIONS.md - WEB.md - WEBUIHOTKEYS.md commit fcdefa0620761472718afa14b2955a5d0603cfcc Author: Matthias Wild <40327258+mauwii@users.noreply.github.com> Date: Fri Nov 4 20:47:31 2022 +0100 Hotifx docs (#1376) (#1377) commit ef8b3ce639954259a95a38f44fa5329687bee781 Merge: b7042095 36870a8f Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 4 12:08:44 2022 -0400 Merge-main-into-development (#1373) To get the rid of the difference between main and development. Since otherwise it will be a pain to start fixing the documentatino (when the state between main and development is not the same ...) Also this should fix the problem of all tests failing since environment yamls get updated. commit 36870a8f53217d4b733e9bb8b119190b5e36da59 Merge: 6b89adfa b7042095 Author: Matthias Wild <40327258+mauwii@users.noreply.github.com> Date: Fri Nov 4 16:25:00 2022 +0100 Merge branch 'development' into merge-main-into-development commit b70420951d5b70937c0c07e4f8a552a01c3008bc Author: damian0815 <null@damianstewart.com> Date: Thu Nov 3 12:39:45 2022 +0100 fix parsing error doing eg `forest ().swap(in winter)` commit 1f0c5b4cf196716c21f2db74f92c8750ad8f889d Author: wfng92 <43742196+wfng92@users.noreply.github.com> Date: Thu Nov 3 17:13:52 2022 +0800 Use array slicing to calc ddim timesteps commit 8648da811190fc8bcf237d83aff38cf605851300 Author: mauwii <Mauwii@outlook.de> Date: Fri Nov 4 00:06:19 2022 +0100 update environment-linux-aarch64 to use python 3.9 commit 45b459356399f8cfb7e9af571c1643fab04218fe Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 3 22:31:46 2022 +0100 update environment-linux-aarch64.yml - move getpass_asterisk to pip commit 41b04316cf5118ea9518dc77934d135a489dd684 Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 3 20:40:08 2022 +0100 rename job, remove debug branch from triggers commit e97c6db2a3c0157a8a5ab74cd28ebee480a2d078 Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 3 20:34:01 2022 +0100 include build matrix to build x86_64 and aarch64 commit 896820a349292b0e14bbc32f0c557fe8a6b45395 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 05:01:15 2022 +0100 disable caching commit 06c8f468bff7e1dfecc1a1990164be1005b114a7 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 04:26:39 2022 +0100 disable PR-Validation since there are no files passed from context this is unecesarry commit 61920e2701c4a9cea94c03ab933c4482458215b7 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 04:09:39 2022 +0100 update action to use current branch also update build-args of dockerfile and build.sh commit f34ba7ca70f1c417ee97e8b0c57abff57614d78f Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 02:30:24 2022 +0100 remove unecesarry mkdir command again commit c30ef0895dbf0565345ac6ccb136d98a174470a6 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 01:51:12 2022 +0100 remove symlink to GFPGANv1.4 also re-add mkdir to prevent action from failing commit aa3a774f73d5004571ea42fea14cd2b525fffb1c Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 01:48:59 2022 +0100 update build-container.yml to use cachev3 commit 2c30555b844293764123baa4137fcf952d40a4e7 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 01:34:20 2022 +0100 update Dockerfile - create models.yaml from models.yaml.example - run preload_models.py with --no-interactive commit 743f60577364d43237eeb46aefd523371c36e56b Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 01:21:15 2022 +0100 update build.sh to download sd-v1.5 model commit 519c661abbae83aa62b3ee536635c39192890441 Author: mauwii <Mauwii@outlook.de> Date: Tue Oct 25 01:26:50 2022 +0200 replace old fashined markdown templates with forms this will help the readability of issues a lot 🤓 commit 22c956c75f4797ddc2dffa944e3ea84b4eb3477c Merge: 13696adc 0196571a Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 3 10:20:21 2022 -0400 Merge branch 'development' of github.com:invoke-ai/InvokeAI into development commit 13696adc3a3a2b169e68048a5b511660d0430fae Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 3 10:20:10 2022 -0400 speculative change to solve windows esrgan issues commit 0196571a12992eb8207d36e022721fe3ad2cfd19 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 2 22:39:35 2022 -0400 remove merge markers from preload_models.py commit 9666f466ab1c710dfda2e59be9e8a26fcd7e8718 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 2 18:29:34 2022 -0400 use refined model by default commit 240e5486c89552ef480c3443a63283fb86a493c3 Merge: 8164b6b9 aa247e68 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 2 18:35:00 2022 -0400 Merge branch 'spezialspezial-patch-9' into development commit 8164b6b9cff077e4131384195af65e30a40733a7 Merge: 4fc82d55 dd5a88dc Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 2 17:06:46 2022 -0400 Merge branch 'development' of github.com:invoke-ai/InvokeAI into development commit 4fc82d554ff573780c0af562a6bc9586aa56012d Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 04:17:28 2022 +1300 [WebUI] Final 2.1 Release Build commit 96b34c0f85f6ed52707fe43456d20b81822c7d1d Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 09:08:11 2022 +0100 Final WebUI build for Release 2.1 - squashed commit of 52 commits from PR #1327 don't log base64 progress images Fresh Build For WebUI [WebUI] Loopback Default False Fixes bugs/styling - Fixes missing web app state on new version: Adds stateReconciler to redux-persist. When we add more values to the state and then release the update app, they will be automatically merged in. Reseting web UI will be needed far less. 7159ec - Fixes console z-index - Moves reset web UI button to visible area Decreases gallery width on inpainting Increases workarea split padding to 1rem Adds missing tooltips to site header Changes inpainting controls settings to hover Fixes hotkeys and settings buttons not working Improves bounding box interactions - Bounding box can now be moved by dragging any of its edges - Bounding box does not affect drawing if already drawing a stroke - Can lock bounding box to draw directly on the bounding box edges - Removes spacebar-hold behaviour due to technical issues Fixes silent crash when init image too large To send the mask to the server, the UI rendered the mask onto the init image and sent the whole image. The mask was then cropped by the server. If the image was too large, the app silently failed. Maybe it exceeds the websocket size limit. Fixed by cropping the mask in the UI layer, sending only bounding-box-sized mask image data. Disabled bounding box settings when locked Styles image uploader Builds fresh bundle Improves bounding box interaction Added spacebar-hold-to-transform back. Address bounding box feedback - Adds back toggle to hide bounding box - Box quick toggle = q, normal toggle = shift + q - Styles canvas alert icons Adds hints when unable to invoke - Popover on Invoke button indicates why exactly it is disabled, e.g. prompt is empty, something else is processing, etc. - There may be more than one reason; all are displayed. Fix Inpainting Alerts Styling Preventing unnecessary re-renders across the app Code Split Inpaint Options Isolate features to their own components so they dont re-render the other stuff each time. [TESTING] Remove global isReady checking I dont believe this is need at all because the isready state is constantly updated when needed and tracked real time in the Redux store. This causes massive re-renders. @psychedelicious If this is absolutely essential for a reason that I do not see, please hit me up on Discord. Fresh Bundle Fix Bounding Box Settings re-rendering on brush stroke [Code Splitting] Bounding Box Options Isolated all bounding box components to trigger unnecessary re-renders. Still need to fix bounding box triggering re-renders on the control panel inside the canvas itself. But the options panel should be a good to go with this change. Inpainting Controls Code Spitting and Performance Codesplit the entirety of the inpainting controls. Created new selectors for each and every component to ensure there are no unnecessary re-renders. App feels a lot smoother. Fixes rerenders on ClearBrushHistory Fixes crash when requesting post-generation upscale/face restoration - Moves the inpainting paste to before the postprocessing. Removes unused isReady state Changes Report Bug icon to a bug Restores shift+q bounding box shortcut Adds alert for bounding box size to status icons Adds asCheckbox to IAIIconButton Rough draft of this. Not happy with the styling but it's clearer than having them look just like buttons. Fixes crash related to old value of progress_latents in state Styling changes and settings modal minor refactor Fixes: uploaded JPG images not loading Reworks CurrentImageButtons.tsx - Change all icons to FA iconset for consistency - Refactors IAIIconButton, IAIButton, IAIPopover to handle ref forwarding - Redesigns buttons into group Only generate 1 iteration when seed fixed & variations disabled Fixes progress images select Fixes edge case: upload over gets stuck while alt tabbing - Press esc to close it now Fixes display progress images select typing Fixes current image button rerenders Adds min width to ImageUploader Makes fast-latents in progress default Update Icon Button Checkbox Style Styling Fixes next/prev image buttons Refactor canvas buttons + more Add Save Intermediates Step Count For accurate mode only. Co-Authored-By: Richard Macarthy <richardmacarthy@protonmail.com> Restores "initial image" text Address feedback - moves mask clear button - fixes intermediates - shrinks inpainting icons by 10% Fix Loopback Styling Adds escape hotkey to close floating panels Readd Hotkey for Dual Display Updated Current Image Button Styling commit dd5a88dceeec53ceb1722a62e3689ae3dd871154 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 04:17:28 2022 +1300 [WebUI] Final 2.1 Release Build commit 95ed56bf82825a47cfe406fa34eaf4e32c129143 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 04:16:31 2022 +1300 Updated Current Image Button Styling commit 1ae80f5ab9d00a25e0c3a21e2eccd318c5343401 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 04:07:57 2022 +1300 Readd Hotkey for Dual Display commit 1f0bd3ca6cda4221d1a7a46325f235cd23bd0af9 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu Nov 3 02:07:00 2022 +1100 Adds escape hotkey to close floating panels commit a1971f6830306b3d748f7f36c2243f6dee682f97 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 03:38:15 2022 +1300 Fix Loopback Styling commit c6118e889895ba35a191124ce1beb5d2b719366d Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu Nov 3 01:29:51 2022 +1100 Address feedback - moves mask clear button - fixes intermediates - shrinks inpainting icons by 10% commit 7ba958cf7ff4e804a127b71c88666084f81e7340 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu Nov 3 01:10:38 2022 +1100 Restores "initial image" text commit 383905d5d24359aa1824de96ff124a8f8a87e015 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 02:59:11 2022 +1300 Add Save Intermediates Step Count For accurate mode only. Co-Authored-By: Richard Macarthy <richardmacarthy@protonmail.com> commit 6173e3e9cabd5e74fb466d55d7bb6a80a77b3fa8 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu Nov 3 00:53:53 2022 +1100 Refactor canvas buttons + more commit 3feb7d8922b0e4c9f944e96b95211003f40d9705 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu Nov 3 00:49:23 2022 +1100 Fixes next/prev image buttons commit 1d9edbd0ddd6e10cf120fe0de3db0b56ae374db4 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 00:50:44 2022 +1300 Update Icon Button Checkbox Style Styling commit d439abdb89db73e652add9df371234861189d90c Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 21:37:24 2022 +1100 Makes fast-latents in progress default commit ee47ea0c891a33049bdec12f1c254926f341eff2 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 21:37:09 2022 +1100 Adds min width to ImageUploader commit 300bb2e6279c1c477131b9e57425db348062f19c Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 21:28:22 2022 +1100 Fixes current image button rerenders commit ccf8593501d23e00979f7340f8991514e6ca3428 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 21:27:43 2022 +1100 Fixes display progress images select typing commit 0fda612f3ff8ad75932e158b9b29cf64c3f30eb6 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 21:02:01 2022 +1100 Fixes edge case: upload over gets stuck while alt tabbing - Press esc to close it now commit 5afff65b71bb60d067392c120efff1a17adc66af Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 20:33:19 2022 +1100 Fixes progress images select commit 7e55bdefce8920831cac7b9fa857bfbffe9e9d5d Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 20:27:47 2022 +1100 Only generate 1 iteration when seed fixed & variations disabled commit 620cf84d3dd54b8498e84574f33040a26d4d315f Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 19:51:38 2022 +1100 Reworks CurrentImageButtons.tsx - Change all icons to FA iconset for consistency - Refactors IAIIconButton, IAIButton, IAIPopover to handle ref forwarding - Redesigns buttons into group commit cfe567c62ad3fd0cff5e3e579a2250ca5dfa2d53 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 16:14:50 2022 +1100 Fixes: uploaded JPG images not loading commit cefe12f1df72e051f109ed77ce46f18093b3b8bb Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 15:31:18 2022 +1100 Styling changes and settings modal minor refactor commit 1e51c3992853ad4643d8eda2443a3bd0d65f5f90 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 15:27:46 2022 +1100 Fixes crash related to old value of progress_latents in state commit 42a02bbb8087cd46a1b5c795b1b41e38c08ba229 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 13:15:06 2022 +1100 Adds asCheckbox to IAIIconButton Rough draft of this. Not happy with the styling but it's clearer than having them look just like buttons. commit f1ae6dae4c36e74ca8dedf8b57eb8933c059dcf4 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 13:13:56 2022 +1100 Adds alert for bounding box size to status icons commit 6195579910a91fb2ab7e1186aa1c1145566c3122 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 11:52:19 2022 +1100 Restores shift+q bounding box shortcut commit 16c8b23b347792d7811cff66a27d350fe5d0d62c Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 11:32:07 2022 +1100 Changes Report Bug icon to a bug commit 07ae626b22554b5222a3b71d1ce3974e2c3fb284 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 11:17:16 2022 +1100 Removes unused isReady state commit 8d171bb044f578d4b9cc4911edfa05b20a01d373 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 11:13:26 2022 +1100 Fixes crash when requesting post-generation upscale/face restoration - Moves the inpainting paste to before the postprocessing. commit 6e33ca7e9e64fb355430511e28bb08c32c9c68b1 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 10:59:01 2022 +1100 Fixes rerenders on ClearBrushHistory commit db46e12f2b8c98dac8895ea4d04242d3754dbec4 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 11:36:28 2022 +1300 Inpainting Controls Code Spitting and Performance Codesplit the entirety of the inpainting controls. Created new selectors for each and every component to ensure there are no unnecessary re-renders. App feels a lot smoother. commit 868e4b2db82fa8556b423111f2f8d565a70ec129 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 07:40:31 2022 +1300 [Code Splitting] Bounding Box Options Isolated all bounding box components to trigger unnecessary re-renders. Still need to fix bounding box triggering re-renders on the control panel inside the canvas itself. But the options panel should be a good to go with this change. commit 2e562742c13988a1fc299c673a97ba4e4a645aaf Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 06:40:27 2022 +1300 Fix Bounding Box Settings re-rendering on brush stroke commit 68e69580091fc1dc1d8b6e03c9e7ef777c7ebf61 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 06:28:34 2022 +1300 Fresh Bundle commit ea6e3a7949f2743711516261cb7e450517d39702 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 06:26:56 2022 +1300 [TESTING] Remove global isReady checking I dont believe this is need at all because the isready state is constantly updated when needed and tracked real time in the Redux store. This causes massive re-renders. @psychedelicious If this is absolutely essential for a reason that I do not see, please hit me up on Discord. commit b2879ca99f88869277c474185ade049914b0bf26 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 06:08:59 2022 +1300 Code Split Inpaint Options Isolate features to their own components so they dont re-render the other stuff each time. commit 4e911566c33989392eb3279049b15331ca98594a Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 03:50:56 2022 +1300 Preventing unnecessary re-renders across the app commit 9bafda6a152778893df143776ae859a3b8b7f192 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 03:02:35 2022 +1300 Fix Inpainting Alerts Styling commit 871a8a5375cae891f22eb853ffd2d22298298b11 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 23:52:07 2022 +1100 Adds hints when unable to invoke - Popover on Invoke button indicates why exactly it is disabled, e.g. prompt is empty, something else is processing, etc. - There may be more than one reason; all are displayed. commit 0eef74bc00d3c0cedc5037c1deeef1d9a5b6d33d Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 23:40:11 2022 +1100 Address bounding box feedback - Adds back toggle to hide bounding box - Box quick toggle = q, normal toggle = shift + q - Styles canvas alert icons commit 423ae3209782f1d8d321b2ed9ed00712b726adf7 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 17:06:07 2022 +1100 Improves bounding box interaction Added spacebar-hold-to-transform back. commit 8282e5d0458ca1bba5565c069093b5389f2228d4 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 16:57:07 2022 +1100 Builds fresh bundle commit 19305cdbdf6ac74833bd6011bff0ced8e9d36f69 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 16:51:11 2022 +1100 Styles image uploader commit eb9028ab3069bca9d747aca664ca60ae13ba6df8 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 16:51:03 2022 +1100 Disabled bounding box settings when locked commit 21483f5d0731bce5aa97985e722a64bf0d7cd12c Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 16:50:24 2022 +1100 Fixes silent crash when init image too large To send the mask to the server, the UI rendered the mask onto the init image and sent the whole image. The mask was then cropped by the server. If the image was too large, the app silently failed. Maybe it exceeds the websocket size limit. Fixed by cropping the mask in the UI layer, sending only bounding-box-sized mask image data. commit 82dcbac28f140aa7bd89d967bcc7fa31cb03a267 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 16:28:30 2022 +1100 Improves bounding box interactions - Bounding box can now be moved by dragging any of its edges - Bounding box does not affect drawing if already drawing a stroke - Can lock bounding box to draw directly on the bounding box edges - Removes spacebar-hold behaviour due to technical issues commit d43bd4625d64a03d90de0458ad5fcacef211a8a6 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 15:10:49 2022 +1100 Fixes hotkeys and settings buttons not working commit ea891324a2086faf8eeeeac7eaf47ae2935322fb Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 11:04:02 2022 +1100 Changes inpainting controls settings to hover commit 8fd9ea219390493f392e690eadb23c4209a4ecfc Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 11:03:41 2022 +1100 Adds missing tooltips to site header commit fb026668563b3179805819a1630c654c9ce260d9 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 11:03:25 2022 +1100 Increases workarea split padding to 1rem commit f6f5c2731b0c37089c5d7382736f973e857df712 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 11:03:10 2022 +1100 Decreases gallery width on inpainting commit b4e3f771e0314e0a18ad5cedc80b28f246fced59 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 10:54:59 2022 +1100 Fixes bugs/styling - Fixes missing web app state on new version: Adds stateReconciler to redux-persist. When we add more values to the state and then release the update app, they will be automatically merged in. Reseting web UI will be needed far less. 7159ec - Fixes console z-index - Moves reset web UI button to visible area commit 99bb9491ac97f1f733accab839ea38cdf4870ba0 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Tue Nov 1 08:35:45 2022 +1300 [WebUI] Loopback Default False commit 0453f211278a533a49fb1aee54dd989b69179c10 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 23:23:51 2022 +1300 Fresh Build For WebUI commit 9fc09aa4bda3b3e6139b026f24733a37747d373f Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 09:08:11 2022 +0100 don't log base64 progress images commit 5e87062cf809a08242d3b006b66d3bbb834ddb16 Author: spezialspezial <75758219+spezialspezial@users.noreply.github.com> Date: Wed Nov 2 00:21:27 2022 +0100 Option to directly invert the grayscale heatmap - fix commit 3e7a459990407ad1679f38d4027c19d50a9d36e3 Author: spezialspezial <75758219+spezialspezial@users.noreply.github.com> Date: Tue Nov 1 21:37:33 2022 +0100 Update txt2mask.py commit bbf4c03e500bafc8627c2a70f8b3396efeddabb3 Author: spezialspezial <75758219+spezialspezial@users.noreply.github.com> Date: Tue Nov 1 21:11:19 2022 +0100 Option to directly invert the grayscale heatmap Theoretically less work inverting the image while it's small but I can't measure a significant difference. Though, handy option to have in some cases. commit 611a3a975328a7e276c2781214d5e14108708ed7 Author: mauwii <Mauwii@outlook.de> Date: Wed Nov 2 02:23:09 2022 +0100 fix name of caching step commit 1611f0d1815022fe90d33f41c21d670251a75f29 Author: mauwii <Mauwii@outlook.de> Date: Wed Nov 2 02:18:46 2022 +0100 readd caching of sd-models - this would remove the necesarrity of the secret availability in PRs commit 08835115e4c5c0ee3587ce07ab769a04d55cb3c5 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 22:10:12 2022 -0400 pin pytorch_lightning to 1.7.7, issue #1331 commit 2d84e28d329be282b51a4cbc22f7c200d80c8f0e Merge: 533fd04e ef17aae8 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 22:11:04 2022 -0400 Merge branch 'development' of github.com:invoke-ai/InvokeAI into development commit ef17aae8abe03fd87dc6f91b3c6d2fe03375f6c5 Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 00:39:48 2022 +0100 add damian0815 to contributors list commit 0cc39f01a3c67f32873b7888e1e032d33626e269 Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 01:18:50 2022 +0100 report full size for fast latents and update conversion matrix for v1.5 commit 688d7258f185035a5924bee23322b001574da931 Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 00:33:00 2022 +0100 fix a bug that broke cross attention control index mapping commit 4513320bf161d3efdd99e2aef4f7c37472131373 Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 00:31:58 2022 +0100 save VRAM by not recombining tensors that have been sliced to save VRAM commit 533fd04ef0d1ba9d2cb25d556991b999e7d44aba Merge: 6215592b dff5681c Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 17:40:36 2022 -0400 Merge branch 'development' of github.com:invoke-ai/InvokeAI into development commit dff5681cf0e24faf67d5eb5903203c4ea39f89bd Author: damian0815 <d@d.com> Date: Tue Nov 1 13:56:03 2022 +0100 shorter strings commit 5a2790a69b11e049d2507bc22eab7812915d867f Author: damian0815 <d@d.com> Date: Tue Nov 1 13:19:20 2022 +0100 convert progress display to a drop-down commit 7c5305ccbaf7926162536aa3a9e51dcdd8574d0d Author: damian0815 <d@d.com> Date: Tue Nov 1 12:54:46 2022 +0100 do not try to save base64 intermediates in gallery on cancellation commit 4013e8ad6fa5e5c2a710c607fe7e1d040f353299 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 21:54:35 2022 +1100 Fixes b64 image sending and displaying commit d1dfd257f9e1cafd352d9007a56194226b9d6b63 Author: damian <d@d.com> Date: Tue Nov 1 11:40:40 2022 +0100 wip base64 commit 5322d735ee4515d89293b7fb015b2ce048262f68 Author: damian <d@d.com> Date: Tue Nov 1 11:31:42 2022 +0100 update frontend commit cdb107dcda858a8bb64455cc60a196a42345f8f7 Author: damian <d@d.com> Date: Tue Nov 1 11:17:43 2022 +0100 add option to show intermediate latent space commit be1393a41ce7a75ed8de7f648a93c5e5974a50d2 Author: damian <d@d.com> Date: Tue Nov 1 10:16:55 2022 +0100 ensure existing exception handling code also handles new exception class commit e554c2607f00a5e51c03052acb9861ff21ec1c12 Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Tue Nov 1 10:08:42 2022 +0100 Rebuilt prompt parsing logic Complete re-write of the prompt parsing logic to be more readable and logical, and therefore also hopefully easier to debug, maintain, and augment. In the process it has also become more robust to badly-formed prompts. Squashed commit of the following: commit 8fcfa88a16e1390d41717e940d72aed64712171c Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Sun Oct 30 17:05:57 2022 +0100 further cleanup commit 1a1fd78bcfeb49d072e3e6d5808aa8df15441629 Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Sun Oct 30 16:07:57 2022 +0100 cleanup and document commit 099c9659fa8b8135876f9a5a50fe80b20bc0635c Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Sun Oct 30 15:54:58 2022 +0100 works fully commit 5e6887ea8c25a1e21438ff6defb381fd027d25fd Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Sun Oct 30 15:24:31 2022 +0100 further... commit 492fda120844d9bc1ad4ec7dd408a3374762d0ff Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Sun Oct 30 14:08:57 2022 +0100 getting there... commit c6aab05a8450cc3c95c8691daf38fdc64c74f52d Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Fri Oct 28 14:29:03 2022 +0200 wip doesn't compile commit 5e533f731cfd20cd435330eeb0012e5689e87e81 Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Fri Oct 28 13:21:43 2022 +0200 working with CrossAttentionCtonrol but no Attention support yet commit 9678348773431e500e110e8aede99086bb7b5955 Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Fri Oct 28 13:04:52 2022 +0200 wip rebuiling prompt parser commit 6215592b12dea3822c727913b771012789a52477 Merge: ef24d76a 349cc254 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 17:34:55 2022 -0400 Merge branch 'development' of github.com:invoke-ai/InvokeAI into development commit 349cc25433e1d358c6c61cca4a6c300ecc8ca3d7 Author: damian0815 <d@d.com> Date: Tue Nov 1 20:08:52 2022 +0100 fix crash (be a little less aggressive clearing out the attention slice) commit 214d276379387ae0fa2259602ab00884ec1ad03e Author: damian0815 <d@d.com> Date: Tue Nov 1 19:57:55 2022 +0100 be more aggressive at clearing out saved_attn_slice commit ef24d76adc5a192297714707cd6794d4f44bcf67 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 14:34:23 2022 -0400 fix library problems in preload_modules commit ab2b5a691dadb292f7cecf5db94a165db3e3e126 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 17:22:48 2022 -0400 fix model_cache memory management issues commit c7de2b2801ad5d6ce52a5f44e88c5705f1dbf524 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 02:02:14 2022 +0100 disable checks with sd-V1.4 model... ...to save some resources, since V1.5 is the default now commit e8075658acf675346d35435d0cfb7710becab42a Author: mauwii <Mauwii@outlook.de> Date: Mon Oct 31 22:20:51 2022 +0100 update test-invoke-conda.yml - fix model dl path for sd-v1-4.ckpt - copy configs/models.yaml.example to configs/models.yaml commit 4202dabee1143f597f4c3946420fbfa7b8eccddf Author: mauwii <Mauwii@outlook.de> Date: Mon Oct 31 22:17:21 2022 +0100 fix models example weights for sd-v1.4 commit d67db2bcf1ac26d8bb7c5f8bfd056f2172597780 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Tue Nov 1 08:35:45 2022 +1300 [WebUI] Loopback Default False commit 7159ec885faa1117a3506689d547618be1d91808 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Mon Oct 31 11:33:05 2022 -0400 further improvements to preload_models.py - Faster startup for command line switch processing - Specify configuration file to modify using --config option: ./scripts/preload_models.ply --config models/my-models-file.yaml commit b5cf734ba9f1aeaab14075b55cc13ed9a0ae31e2 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Mon Oct 31 11:08:19 2022 -0400 improve behavior of preload_models.py - NEVER overwrite user's existing models.yaml - Instead, merge its contents into new config file, and rename original to models.yaml.orig (with message) - models.yaml has been removed from repository and renamed models.yaml.example commit f7dc8eafeef991e135b5541c01d0ff740dda9591 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Mon Oct 31 10:47:35 2022 -0400 restore models.yaml to virgin state commit 762ca60a309f70daaf1b9e79b6273f76fd9474b6 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Oct 4 22:55:10 2022 -0400 Update INPAINTING.md commit e7fb9f342cb5ed0c09e6215026d60d45eef3ebcb Author: Hideyuki Katsushiro <h.katsushiro@qualia.tokyo.jp> Date: Wed Oct 5 10:08:53 2022 +0900 add argument --outdir
2022-11-12 17:17:07 +00:00
outdir = 'outputs/img-samples',
gfpgan=None,
codeformer=None,
esrgan=None,
free_gpu_mem=False,
safety_checker:bool=False,
max_loaded_models:int=2,
# these are deprecated; if present they override values in the conf file
weights = None,
config = None,
Refactoring simplet2i (#387) * start refactoring -not yet functional * first phase of refactor done - not sure weighted prompts working * Second phase of refactoring. Everything mostly working. * The refactoring has moved all the hard-core inference work into ldm.dream.generator.*, where there are submodules for txt2img and img2img. inpaint will go in there as well. * Some additional refactoring will be done soon, but relatively minor work. * fix -save_orig flag to actually work * add @neonsecret attention.py memory optimization * remove unneeded imports * move token logging into conditioning.py * add placeholder version of inpaint; porting in progress * fix crash in img2img * inpainting working; not tested on variations * fix crashes in img2img * ported attention.py memory optimization #117 from basujindal branch * added @torch_no_grad() decorators to img2img, txt2img, inpaint closures * Final commit prior to PR against development * fixup crash when generating intermediate images in web UI * rename ldm.simplet2i to ldm.generate * add backward-compatibility simplet2i shell with deprecation warning * add back in mps exception, addresses @vargol comment in #354 * replaced Conditioning class with exported functions * fix wrong type of with_variations attribute during intialization * changed "image_iterator()" to "get_make_image()" * raise NotImplementedError for calling get_make_image() in parent class * Update ldm/generate.py better error message Co-authored-by: Kevin Gibbons <bakkot@gmail.com> * minor stylistic fixes and assertion checks from code review * moved get_noise() method into img2img class * break get_noise() into two methods, one for txt2img and the other for img2img * inpainting works on non-square images now * make get_noise() an abstract method in base class * much improved inpainting Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
2022-09-06 00:40:10 +00:00
):
enable fast switching between models in invoke.py - This PR enables two new commands in the invoke.py script !models -- list the available models and their cache status !switch <model> -- switch to the indicated model Example: invoke> !models laion400m not loaded Latent Diffusion LAION400M model stable-diffusion-1.4 active Stable Diffusion inference model version 1.4 waifu-1.3 cached Waifu anime model version 1.3 invoke> !switch waifu-1.3 >> Caching model stable-diffusion-1.4 in system RAM >> Retrieving model waifu-1.3 from system RAM cache The name and descriptions of the models are taken from `config/models.yaml`. A future enhancement to `model_cache.py` will be to enable new model stanzas to be added to the file programmatically. This will be useful for the WebGUI. More details: - Use fast switching algorithm described in PR #948 - Models are selected using their configuration stanza name given in models.yaml. - To avoid filling up CPU RAM with cached models, this PR implements an LRU cache that monitors available CPU RAM. - The caching code allows the minimum value of available RAM to be adjusted, but invoke.py does not currently have a command-line argument that allows you to set it. The minimum free RAM is arbitrarily set to 2 GB. - Add optional description field to configs/models.yaml Unrelated fixes: - Added ">>" to CompViz model loading messages in order to make user experience more consistent. - When generating an image greater than defaults, will only warn about possible VRAM filling the first time. - Fixed bug that was causing help message to be printed twice. This involved moving the import line for the web backend into the section where it is called. Coauthored by: @ArDiouscuros
2022-10-12 06:14:59 +00:00
mconfig = OmegaConf.load(conf)
self.height = None
self.width = None
use 🧨diffusers model (#1583) * initial commit of DiffusionPipeline class * spike: proof of concept using diffusers for txt2img * doc: type hints for Generator * refactor(model_cache): factor out load_ckpt * model_cache: add ability to load a diffusers model pipeline and update associated things in Generate & Generator to not instantly fail when that happens * model_cache: fix model default image dimensions * txt2img: support switching diffusers schedulers * diffusers: let the scheduler do its scaling of the initial latents Remove IPNDM scheduler; it is not behaving. * web server: update image_progress callback for diffusers data * diffusers: restore prompt weighting feature * diffusers: fix set-sampler error following model switch * diffusers: use InvokeAIDiffuserComponent for conditioning * cross_attention_control: stub (no-op) implementations for diffusers * model_cache: let offload_model work with DiffusionPipeline, sorta. * models.yaml.example: add diffusers-format model, set as default * test-invoke-conda: use diffusers-format model test-invoke-conda: put huggingface-token where the library can use it * environment-mac: upgrade to diffusers 0.7 (from 0.6) this was already done for linux; mac must have been lost in the merge. * preload_models: explicitly load diffusers models In non-interactive mode too, as long as you're logged in. * fix(model_cache): don't check `model.config` in diffusers format clean-up from recent merge. * diffusers integration: support img2img * dev: upgrade to diffusers 0.8 (from 0.7.1) We get to remove some code by using methods that were factored out in the base class. * refactor: remove backported img2img.get_timesteps now that we can use it directly from diffusers 0.8.1 * ci: use diffusers model * dev: upgrade to diffusers 0.9 (from 0.8.1) * lint: correct annotations for Python 3.9. * lint: correct AttributeError.name reference for Python 3.9. * CI: prefer diffusers-1.4 because it no longer requires a token The RunwayML models still do. * build: there's yet another place to update requirements? * configure: try to download models even without token Models in the CompVis and stabilityai repos no longer require them. (But runwayml still does.) * configure: add troubleshooting info for config-not-found * fix(configure): prepend root to config path * fix(configure): remove second `default: true` from models example * CI: simplify test-on-push logic now that we don't need secrets The "test on push but only in forks" logic was only necessary when tests didn't work for PRs-from-forks. * create an embedding_manager for diffusers * internal: avoid importing diffusers DummyObject see https://github.com/huggingface/diffusers/issues/1479 * fix "config attributes…not expected" diffusers warnings. * fix deprecated scheduler construction * work around an apparent MPS torch bug that causes conditioning to have no effect * 🚧 post-rebase repair * preliminary support for outpainting (no masking yet) * monkey-patch diffusers.attention and use Invoke lowvram code * add always_use_cpu arg to bypass MPS * add cross-attention control support to diffusers (fails on MPS) For unknown reasons MPS produces garbage output with .swap(). Use --always_use_cpu arg to invoke.py for now to test this code on MPS. * diffusers support for the inpainting model * fix debug_image to not crash with non-RGB images. * inpainting for the normal model [WIP] This seems to be performing well until the LAST STEP, at which point it dissolves to confetti. * fix off-by-one bug in cross-attention-control (#1774) prompt token sequences begin with a "beginning-of-sequence" marker <bos> and end with a repeated "end-of-sequence" marker <eos> - to make a default prompt length of <bos> + 75 prompt tokens + <eos>. the .swap() code was failing to take the column for <bos> at index 0 into account. the changes here do that, and also add extra handling for a single <eos> (which may be redundant but which is included for completeness). based on my understanding and some assumptions about how this all works, the reason .swap() nevertheless seemed to do the right thing, to some extent, is because over multiple steps the conditioning process in Stable Diffusion operates as a feedback loop. a change to token n-1 has flow-on effects to how the [1x4x64x64] latent tensor is modified by all the tokens after it, - and as the next step is processed, all the tokens before it as well. intuitively, a token's conditioning effects "echo" throughout the whole length of the prompt. so even though the token at n-1 was being edited when what the user actually wanted was to edit the token at n, it nevertheless still had some non-negligible effect, in roughly the right direction, often enough that it seemed like it was working properly. * refactor common CrossAttention stuff into a mixin so that the old ldm code can still work if necessary * inpainting for the normal model. I think it works this time. * diffusers: reset num_vectors_per_token sync with 44a00555718f1df173c60da0ed646cf700e29537 * diffusers: txt2img2img (hires_fix) with so much slicing and dicing of pipeline methods to stitch them together * refactor(diffusers): reduce some code duplication amongst the different tasks * fixup! refactor(diffusers): reduce some code duplication amongst the different tasks * diffusers: enable DPMSolver++ scheduler * diffusers: upgrade to diffusers 0.10, add Heun scheduler * diffusers(ModelCache): stopgap to make from_cpu compatible with diffusers * CI: default to diffusers-1.5 now that runwayml token requirement is gone * diffusers: update to 0.10 (and transformers to 4.25) * diffusers: use xformers when available diffusers no longer auto-enables this as of 0.10.2. * diffusers: make masked img2img behave better with multi-step schedulers re-randomizing the noise each step was confusing them. * diffusers: work more better with more models. fixed relative path problem with local models. fixed models on hub not always having a `fp16` branch. * diffusers: stopgap fix for attention_maps_callback crash after recent merge * fixup import merge conflicts correction for 061c5369a2247c6c92cd69606bcf54c4f1962a0b * test: add tests/inpainting inputs for masked img2img * diffusers(AddsMaskedGuidance): partial fix for k-schedulers Prevents them from crashing, but results are still hot garbage. * fix --safety_checker arg parsing and add note to diffusers loader about where safety checker gets called * generate: fix import error * CI: don't try to read the old init location * diffusers: support loading an alternate VAE * CI: remove sh-syntax if-statement so it doesn't crash powershell * CI: fold strings in yaml because backslash is not line-continuation in powershell * attention maps callback stuff for diffusers * build: fix syntax error in environment-mac * diffusers: add INITIAL_MODELS with diffusers-compatible repos * re-enable the embedding manager; closes #1778 * Squashed commit of the following: commit e4a956abc37fcb5cf188388b76b617bc5c8fda7d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:43:07 2022 +0100 import new load handling from EmbeddingManager and cleanup commit c4abe91a5ba0d415b45bf734068385668b7a66e6 Merge: 032e856e 1efc6397 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:09:53 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers_with_textual_inversion_manager commit 032e856eefb3bbc39534f5daafd25764bcfcef8b Merge: 8b4f0fe9 bc515e24 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:08:01 2022 +0100 Merge remote-tracking branch 'upstream/dev/diffusers' into dev/diffusers_with_textual_inversion_manager commit 1efc6397fc6e61c1aff4b0258b93089d61de5955 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:04:28 2022 +0100 cleanup and add performance notes commit e400f804ac471a0ca2ba432fd658778b20c7bdab Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:45:07 2022 +0100 fix bug and update unit tests commit deb9ae0ae1016750e93ce8275734061f7285a231 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:28:29 2022 +0100 textual inversion manager seems to work commit 162e02505dec777e91a983c4d0fb52e950d25ff0 Merge: cbad4583 12769b3d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:58:03 2022 +0100 Merge branch 'main' into feature_textual_inversion_mgr commit cbad45836c6aace6871a90f2621a953f49433131 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:54:10 2022 +0100 use position embeddings commit 070344c69b0e0db340a183857d0a787b348681d3 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:53:47 2022 +0100 Don't crash CLI on exceptions commit b035ac8c6772dfd9ba41b8eeb9103181cda028f8 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:11:55 2022 +0100 add missing position_embeddings commit 12769b3d3562ef71e0f54946b532ad077e10043c Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:33:25 2022 +0100 debugging why it don't work commit bafb7215eabe1515ca5e8388fd3bb2f3ac5362cf Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:21:33 2022 +0100 debugging why it don't work commit 664a6e9e146b42d96703f0cc8baf8f5efec04ee1 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit 8b4f0fe9d6e4e2643b36dfa27864294785d7ba4e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit ffbe1ab11163ba712e353d89404e301d0e0c6cdf Merge: 6e4dad60 023df37e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:37:31 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers commit 023df37efffa67434f77def7fc3c9dfb29f699fd Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:36:54 2022 +0100 cleanup commit 05fac594eaf79d0058e3c48deee93df603f136c2 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:07:49 2022 +0100 tweak error checking commit 009f32ed39a7280997c3ffab112adadee0b44279 Author: damian <null@damianstewart.com> Date: Thu Dec 15 21:29:47 2022 +0100 unit tests passing for embeddings with vector length >1 commit beb1b08d9a98112ed2fe073580568e1a18698da3 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:39:09 2022 +0100 more explicit equality tests when overwriting commit 44d8a5a7c85cdabc9ce3a54fd0769a10597b3ca9 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:30:13 2022 +0100 wip textual inversion manager (unit tests passing for 1v embedding overwriting) commit 417c2b57d90924a839616bfb66804faab8039e4c Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 12:30:55 2022 +0100 wip textual inversion manager (unit tests passing for base stuff + padding) commit 2e80872e3b6f7fd7d8eb8928822bd824b63cb2ff Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 10:57:57 2022 +0100 wip new TextualInversionManager * stop using WeightedFrozenCLIPEmbedder * store diffusion models locally - configure_invokeai.py reconfigured to store diffusion models rather than CompVis models - hugging face caching model is used, but cache is set to ~/invokeai/models/repo_id - models.yaml does **NOT** use path, just repo_id - "repo_name" changed to "repo_id" to following hugging face conventions - Models are loaded with full precision pending further work. * allow non-local files during development * path takes priority over repo_id * MVP for model_cache and configure_invokeai - Feature complete (almost) - configure_invokeai.py downloads both .ckpt and diffuser models, along with their VAEs. Both types of download are controlled by a unified INITIAL_MODELS.yaml file. - model_cache can load both type of model and switches back and forth in CPU. No memory leaks detected TO DO: 1. I have not yet turned on the LocalOnly flag for diffuser models, so the code will check the Hugging Face repo for updates before using the locally cached models. This will break firewalled systems. I am thinking of putting in a global check for internet connectivity at startup time and setting the LocalOnly flag based on this. It would be good to check updates if there is connectivity. 2. I have not gone completely through INITIAL_MODELS.yaml to check which models are available as diffusers and which are not. So models like PaperCut and VoxelArt may not load properly. The runway and stability models are checked, as well as the Trinart models. 3. Add stanzas for SD 2.0 and 2.1 in INITIAL_MODELS.yaml REMAINING PROBLEMS NOT DIRECTLY RELATED TO MODEL_CACHE: 1. When loading a .ckpt file there are lots of messages like this: Warning! ldm.modules.attention.CrossAttention is no longer being maintained. Please use InvokeAICrossAttention instead. I'm not sure how to address this. 2. The ckpt models ***don't actually run*** due to the lack of special-case support for them in the generator objects. For example, here's the hard crash you get when you run txt2img against the legacy waifu-diffusion-1.3 model: ``` >> An error occurred: Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 140, in main main_loop(gen, opt) File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 371, in main_loop gen.prompt2image( File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1265, in __getattr__ raise AttributeError("'{}' object has no attribute '{}'".format( AttributeError: 'LatentDiffusion' object has no attribute 'image_from_embeddings' ``` 3. The inpainting diffusion model isn't working. Here's the output of "banana sushi" when inpainting-1.5 is loaded: ``` Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 301, in image_from_embeddings result_latents, result_attention_map_saver = self.latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 330, in latents_from_embeddings result: PipelineIntermediateState = infer_latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 185, in __call__ for result in self.generator_method(*args, **kwargs): File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 367, in generate_latents_from_embeddings step_output = self.step(batched_t, latents, guidance_scale, File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context return func(*args, **kwargs) File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 409, in step step_output = self.scheduler.step(noise_pred, timestep, latents, **extra_step_kwargs) File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/diffusers/schedulers/scheduling_lms_discrete.py", line 223, in step pred_original_sample = sample - sigma * model_output RuntimeError: The size of tensor a (9) must match the size of tensor b (4) at non-singleton dimension 1 ``` * proper support for float32/float16 - configure script now correctly detects user's preference for fp16/32 and downloads the correct diffuser version. If fp16 version not available, falls back to fp32 version. - misc code cleanup and simplification in model_cache * add on-the-fly conversion of .ckpt to diffusers models 1. On-the-fly conversion code can be found in the file ldm/invoke/ckpt_to_diffusers.py. 2. A new !optimize command has been added to the CLI. Should be ported to Web GUI. User experience on the CLI is this: ``` invoke> !optimize /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt INFO: Converting legacy weights file /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt to optimized diffuser model. This operation will take 30-60s to complete. Success. Optimized model is now located at /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 Writing new config file entry for sd-v1-4... >> New configuration: sd-v1-4: description: Optimized version of sd-v1-4 format: diffusers path: /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 OK to import [n]? y >> Verifying that new model loads... >> Current VRAM usage: 2.60G >> Offloading stable-diffusion-2.1 to CPU >> Loading diffusers model from /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 | Using faster float16 precision You have disabled the safety checker for <class 'ldm.invoke.generator.diffusers_pipeline.StableDiffusionGeneratorPipeline'> by passing `safety_checker=None`. Ensure that you abide to the conditions of the Stable Diffusion \ license and do not expose unfiltered results in services or applications open to the public. Both the diffusers team and Hugging Face strongly recommend to keep the safety filter enabled in all public facing circumstances,\ disabling it only for use-cases that involve analyzing network behavior or auditing its results. For more information, please have a look at https://github.com/huggingface/diffusers/pull/254 . | training width x height = (512 x 512) >> Model loaded in 3.48s >> Max VRAM used to load the model: 2.17G >> Current VRAM usage:2.17G >> Textual inversions available: >> Setting Sampler to k_lms (LMSDiscreteScheduler) Keep model loaded? [y] ``` * add parallel set of generator files for ckpt legacy generation * generation using legacy ckpt models now working * diffusers: fix missing attention_maps_callback fix for 23eb80b40421b2bb8f4b6d3dd30490d11c447b36 * associate legacy CrossAttention with .ckpt models * enable autoconvert New --autoconvert CLI option will scan a designated directory for new .ckpt files, convert them into diffuser models, and import them into models.yaml. Works like this: invoke.py --autoconvert /path/to/weights/directory In ModelCache added two new methods: autoconvert_weights(config_path, weights_directory_path, models_directory_path) convert_and_import(ckpt_path, diffuser_path) * diffusers: update to diffusers 0.11 (from 0.10.2) * fix vae loading & width/height calculation * refactor: encapsulate these conditioning data into one container * diffusers: fix some noise-scaling issues by pushing the noise-mixing down to the common function * add support for safetensors and accelerate * set local_files_only when internet unreachable * diffusers: fix error-handling path when model repo has no fp16 branch * fix generatorinpaint error Fixes : "ModuleNotFoundError: No module named 'ldm.invoke.generatorinpaint' https://github.com/invoke-ai/InvokeAI/pull/1583#issuecomment-1363634318 * quench diffuser safety-checker warning * diffusers: support stochastic DDIM eta parameter * fix conda env creation on macos * fix cross-attention with diffusers 0.11 * diffusers: the VAE needs to be tiling as well as the U-Net * diffusers: comment on subfolders * diffusers: embiggen! * diffusers: make model_cache.list_models serializable * diffusers(inpaint): restore scaling functionality * fix requirements clash between numba and numpy 1.24 * diffusers: allow inpainting model to do non-inpainting tasks * start expanding model_cache functionality * add import_ckpt_model() and import_diffuser_model() methods to model_manager - in addition, model_cache.py is now renamed to model_manager.py * allow "recommended" flag to be optional in INITIAL_MODELS.yaml * configure_invokeai now downloads VAE diffusers in advance * rename ModelCache to ModelManager * remove support for `repo_name` in models.yaml * check for and refuse to load embeddings trained on incompatible models * models.yaml.example: s/repo_name/repo_id and remove extra INITIAL_MODELS now that the main one has diffusers models in it. * add MVP textual inversion script * refactor(InvokeAIDiffuserComponent): factor out _combine() * InvokeAIDiffuserComponent: implement threshold * InvokeAIDiffuserComponent: diagnostic logs for threshold ...this does not look right * add a curses-based frontend to textual inversion - not quite working yet - requires npyscreen installed - on windows will also have the windows-curses requirement, but not added to requirements yet * add curses-based interface for textual inversion * fix crash in convert_and_import() - This corrects a "local variable referenced before assignment" error in model_manager.convert_and_import() * potential workaround for no 'state_dict' key error - As reported in https://github.com/huggingface/diffusers/issues/1876 * create TI output dir if needed * Update environment-lin-cuda.yml (#2159) Fixing line 42 to be the proper order to define the transformers requirement: ~= instead of =~ * diffusers: update sampler-to-scheduler mapping based on https://github.com/huggingface/diffusers/issues/277#issuecomment-1371428672 * improve user exp for ckt to diffusers conversion - !optimize_models command now operates on an existing ckpt file entry in models.yaml - replaces existing entry, rather than adding a new one - offers to delete the ckpt file after conversion * web: adapt progress callback to deal with old generator or new diffusers pipeline * clean-up model_manager code - add_model() verified to work for .ckpt local paths, .ckpt remote URLs, diffusers local paths, and diffusers repo_ids - convert_and_import() verified to work for local and remove .ckpt files * handle edge cases for import_model() and convert_model() * add support for safetensor .ckpt files * fix name error * code cleanup with pyflake * improve model setting behavior - If the user enters an invalid model name at startup time, will not try to load it, warn, and use default model - CLI UI enhancement: include currently active model in the command line prompt. * update test-invoke-pip.yml - fix model cache path to point to runwayml/stable-diffusion-v1-5 - remove `skip-sd-weights` from configure_invokeai.py args * exclude dev/diffusers from "fail for draft PRs" * disable "fail on PR jobs" * re-add `--skip-sd-weights` since no space * update workflow environments - include `INVOKE_MODEL_RECONFIGURE: '--yes'` * clean up model load failure handling - Allow CLI to run even when no model is defined or loadable. - Inhibit stack trace when model load fails - only show last error - Give user *option* to run configure_invokeai.py when no models successfully load. - Restart invokeai after reconfiguration. * further edge-case handling 1) only one model in models.yaml file, and that model is broken 2) no models in models.yaml 3) models.yaml doesn't exist at all * fix incorrect model status listing - "cached" was not being returned from list_models() - normalize handling of exceptions during model loading: - Passing an invalid model name to generate.set_model() will return a KeyError - All other exceptions are returned as the appropriate Exception * CI: do download weights (if not already cached) * diffusers: fix scheduler loading in offline mode * CI: fix model name (no longer has `diffusers-` prefix) * Update txt2img2img.py (#2256) * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * feat - make model storage compatible with hugging face caching system This commit alters the InvokeAI model directory to be compatible with hugging face, making it easier to share diffusers (and other models) across different programs. - If the HF_HOME environment variable is not set, then models are cached in ~/invokeai/models in a format that is identical to the HuggingFace cache. - If HF_HOME is set, then models are cached wherever HF_HOME points. - To enable sharing with other HuggingFace library clients, set HF_HOME to ~/.cache/huggingface to set the default cache location or to ~/invokeai/models to have huggingface cache inside InvokeAI. * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * fix error "no attribute CkptInpaint" * model_manager.list_models() returns entire model config stanza+status * Initial Draft - Model Manager Diffusers * added hash function to diffusers * implement sha256 hashes on diffusers models * Add Model Manager Support for Diffusers * fix various problems with model manager - in cli import functions, fix not enough values to unpack from _get_name_and_desc() - fix crash when using old-style vae: value with new-style diffuser * rebuild frontend * fix dictconfig-not-serializable issue * fix NoneType' object is not subscriptable crash in model_manager * fix "str has no attribute get" error in model_manager list_models() * Add path and repo_id support for Diffusers Model Manager Also fixes bugs * Fix tooltip IT localization not working * Add Version Number To WebUI * Optimize Model Search * Fix incorrect font on the Model Manager UI * Fix image degradation on merge fixes - [Experimental] This change should effectively fix a couple of things. - Fix image degradation on subsequent merges of the canvas layers. - Fix the slight transparent border that is left behind when filling the bounding box with a color. - Fix the left over line of color when filling a bounding box with color. So far there are no side effects for this. If any, please report. * Add local model filtering for Diffusers / Checkpoints * Go to home on modal close for the Add Modal UI * Styling Fixes * Model Manager Diffusers Localization Update * Add Safe Tensor scanning to Model Manager * Fix model edit form dispatching string values instead of numbers. * Resolve VAE handling / edge cases for supplied repos * defer injecting tokens for textual inversions until they're used for the first time * squash a console warning * implement model migration check * add_model() overwrites previous config rather than merges * fix model config file attribute merging * fix precision handling in textual inversion script * allow ckpt conversion script to work with safetensors .ckpts Applied patch here: https://github.com/huggingface/diffusers/commit/beb932c5d111872c5e45387e7b1b2b3dd0524a47 * fix name "args" is not defined crash in textual_inversion_training * fix a second NameError: name 'args' is not defined crash * fix loading of the safety checker from the global cache dir * add installation step to textual inversion frontend - After a successful training run, the script will copy learned_embeds.bin to a subfolder of the embeddings directory. - User given the option to delete the logs and intermediate checkpoints (which together use 7-8G of space) - If textual inversion training fails, reports the error gracefully. * don't crash out on incompatible embeddings - put try: blocks around places where the system tries to load an embedding which is incompatible with the currently loaded model * add support for checkpoint resuming * textual inversion preferences are saved and restored between sessions - Preferences are stored in a file named text-inversion-training/preferences.conf - Currently the resume-from-checkpoint option is not working correctly. Possible bug in textual_inversion_training.py? * copy learned_embeddings.bin into right location * add front end for diffusers model merging - Front end doesn't do anything yet!!!! - Made change to model name parsing in CLI to support ability to have merged models with the "+" character in their names. * improve inpainting experience - recommend ckpt version of inpainting-1.5 to user - fix get_noise() bug in ckpt version of omnibus.py * update environment*yml * tweak instructions to install HuggingFace token * bump version number * enhance update scripts - update scripts will now fetch new INITIAL_MODELS.yaml so that configure_invokeai.py will know about the diffusers versions. * enhance invoke.sh/invoke.bat launchers - added configure_invokeai.py to menu - menu defaults to browser-based invoke * remove conda workflow (#2321) * fix `token_ids has shape torch.Size([79]) - expected [77]` * update CHANGELOG.md with 2.3.* info - Add information on how formats have changed and the upgrade process. - Add short bug list. Co-authored-by: Damian Stewart <d@damianstewart.com> Co-authored-by: Damian Stewart <null@damianstewart.com> Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> Co-authored-by: Wybartel-luxmc <37852506+Wybartel-luxmc@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> Co-authored-by: mickr777 <115216705+mickr777@users.noreply.github.com> Co-authored-by: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Co-authored-by: Eugene Brodsky <ebr@users.noreply.github.com> Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com>
2023-01-15 14:22:46 +00:00
self.model_manager = None
self.iterations = 1
self.steps = 50
self.cfg_scale = 7.5
self.sampler_name = sampler_name
use 🧨diffusers model (#1583) * initial commit of DiffusionPipeline class * spike: proof of concept using diffusers for txt2img * doc: type hints for Generator * refactor(model_cache): factor out load_ckpt * model_cache: add ability to load a diffusers model pipeline and update associated things in Generate & Generator to not instantly fail when that happens * model_cache: fix model default image dimensions * txt2img: support switching diffusers schedulers * diffusers: let the scheduler do its scaling of the initial latents Remove IPNDM scheduler; it is not behaving. * web server: update image_progress callback for diffusers data * diffusers: restore prompt weighting feature * diffusers: fix set-sampler error following model switch * diffusers: use InvokeAIDiffuserComponent for conditioning * cross_attention_control: stub (no-op) implementations for diffusers * model_cache: let offload_model work with DiffusionPipeline, sorta. * models.yaml.example: add diffusers-format model, set as default * test-invoke-conda: use diffusers-format model test-invoke-conda: put huggingface-token where the library can use it * environment-mac: upgrade to diffusers 0.7 (from 0.6) this was already done for linux; mac must have been lost in the merge. * preload_models: explicitly load diffusers models In non-interactive mode too, as long as you're logged in. * fix(model_cache): don't check `model.config` in diffusers format clean-up from recent merge. * diffusers integration: support img2img * dev: upgrade to diffusers 0.8 (from 0.7.1) We get to remove some code by using methods that were factored out in the base class. * refactor: remove backported img2img.get_timesteps now that we can use it directly from diffusers 0.8.1 * ci: use diffusers model * dev: upgrade to diffusers 0.9 (from 0.8.1) * lint: correct annotations for Python 3.9. * lint: correct AttributeError.name reference for Python 3.9. * CI: prefer diffusers-1.4 because it no longer requires a token The RunwayML models still do. * build: there's yet another place to update requirements? * configure: try to download models even without token Models in the CompVis and stabilityai repos no longer require them. (But runwayml still does.) * configure: add troubleshooting info for config-not-found * fix(configure): prepend root to config path * fix(configure): remove second `default: true` from models example * CI: simplify test-on-push logic now that we don't need secrets The "test on push but only in forks" logic was only necessary when tests didn't work for PRs-from-forks. * create an embedding_manager for diffusers * internal: avoid importing diffusers DummyObject see https://github.com/huggingface/diffusers/issues/1479 * fix "config attributes…not expected" diffusers warnings. * fix deprecated scheduler construction * work around an apparent MPS torch bug that causes conditioning to have no effect * 🚧 post-rebase repair * preliminary support for outpainting (no masking yet) * monkey-patch diffusers.attention and use Invoke lowvram code * add always_use_cpu arg to bypass MPS * add cross-attention control support to diffusers (fails on MPS) For unknown reasons MPS produces garbage output with .swap(). Use --always_use_cpu arg to invoke.py for now to test this code on MPS. * diffusers support for the inpainting model * fix debug_image to not crash with non-RGB images. * inpainting for the normal model [WIP] This seems to be performing well until the LAST STEP, at which point it dissolves to confetti. * fix off-by-one bug in cross-attention-control (#1774) prompt token sequences begin with a "beginning-of-sequence" marker <bos> and end with a repeated "end-of-sequence" marker <eos> - to make a default prompt length of <bos> + 75 prompt tokens + <eos>. the .swap() code was failing to take the column for <bos> at index 0 into account. the changes here do that, and also add extra handling for a single <eos> (which may be redundant but which is included for completeness). based on my understanding and some assumptions about how this all works, the reason .swap() nevertheless seemed to do the right thing, to some extent, is because over multiple steps the conditioning process in Stable Diffusion operates as a feedback loop. a change to token n-1 has flow-on effects to how the [1x4x64x64] latent tensor is modified by all the tokens after it, - and as the next step is processed, all the tokens before it as well. intuitively, a token's conditioning effects "echo" throughout the whole length of the prompt. so even though the token at n-1 was being edited when what the user actually wanted was to edit the token at n, it nevertheless still had some non-negligible effect, in roughly the right direction, often enough that it seemed like it was working properly. * refactor common CrossAttention stuff into a mixin so that the old ldm code can still work if necessary * inpainting for the normal model. I think it works this time. * diffusers: reset num_vectors_per_token sync with 44a00555718f1df173c60da0ed646cf700e29537 * diffusers: txt2img2img (hires_fix) with so much slicing and dicing of pipeline methods to stitch them together * refactor(diffusers): reduce some code duplication amongst the different tasks * fixup! refactor(diffusers): reduce some code duplication amongst the different tasks * diffusers: enable DPMSolver++ scheduler * diffusers: upgrade to diffusers 0.10, add Heun scheduler * diffusers(ModelCache): stopgap to make from_cpu compatible with diffusers * CI: default to diffusers-1.5 now that runwayml token requirement is gone * diffusers: update to 0.10 (and transformers to 4.25) * diffusers: use xformers when available diffusers no longer auto-enables this as of 0.10.2. * diffusers: make masked img2img behave better with multi-step schedulers re-randomizing the noise each step was confusing them. * diffusers: work more better with more models. fixed relative path problem with local models. fixed models on hub not always having a `fp16` branch. * diffusers: stopgap fix for attention_maps_callback crash after recent merge * fixup import merge conflicts correction for 061c5369a2247c6c92cd69606bcf54c4f1962a0b * test: add tests/inpainting inputs for masked img2img * diffusers(AddsMaskedGuidance): partial fix for k-schedulers Prevents them from crashing, but results are still hot garbage. * fix --safety_checker arg parsing and add note to diffusers loader about where safety checker gets called * generate: fix import error * CI: don't try to read the old init location * diffusers: support loading an alternate VAE * CI: remove sh-syntax if-statement so it doesn't crash powershell * CI: fold strings in yaml because backslash is not line-continuation in powershell * attention maps callback stuff for diffusers * build: fix syntax error in environment-mac * diffusers: add INITIAL_MODELS with diffusers-compatible repos * re-enable the embedding manager; closes #1778 * Squashed commit of the following: commit e4a956abc37fcb5cf188388b76b617bc5c8fda7d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:43:07 2022 +0100 import new load handling from EmbeddingManager and cleanup commit c4abe91a5ba0d415b45bf734068385668b7a66e6 Merge: 032e856e 1efc6397 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:09:53 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers_with_textual_inversion_manager commit 032e856eefb3bbc39534f5daafd25764bcfcef8b Merge: 8b4f0fe9 bc515e24 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:08:01 2022 +0100 Merge remote-tracking branch 'upstream/dev/diffusers' into dev/diffusers_with_textual_inversion_manager commit 1efc6397fc6e61c1aff4b0258b93089d61de5955 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:04:28 2022 +0100 cleanup and add performance notes commit e400f804ac471a0ca2ba432fd658778b20c7bdab Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:45:07 2022 +0100 fix bug and update unit tests commit deb9ae0ae1016750e93ce8275734061f7285a231 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:28:29 2022 +0100 textual inversion manager seems to work commit 162e02505dec777e91a983c4d0fb52e950d25ff0 Merge: cbad4583 12769b3d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:58:03 2022 +0100 Merge branch 'main' into feature_textual_inversion_mgr commit cbad45836c6aace6871a90f2621a953f49433131 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:54:10 2022 +0100 use position embeddings commit 070344c69b0e0db340a183857d0a787b348681d3 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:53:47 2022 +0100 Don't crash CLI on exceptions commit b035ac8c6772dfd9ba41b8eeb9103181cda028f8 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:11:55 2022 +0100 add missing position_embeddings commit 12769b3d3562ef71e0f54946b532ad077e10043c Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:33:25 2022 +0100 debugging why it don't work commit bafb7215eabe1515ca5e8388fd3bb2f3ac5362cf Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:21:33 2022 +0100 debugging why it don't work commit 664a6e9e146b42d96703f0cc8baf8f5efec04ee1 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit 8b4f0fe9d6e4e2643b36dfa27864294785d7ba4e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit ffbe1ab11163ba712e353d89404e301d0e0c6cdf Merge: 6e4dad60 023df37e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:37:31 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers commit 023df37efffa67434f77def7fc3c9dfb29f699fd Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:36:54 2022 +0100 cleanup commit 05fac594eaf79d0058e3c48deee93df603f136c2 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:07:49 2022 +0100 tweak error checking commit 009f32ed39a7280997c3ffab112adadee0b44279 Author: damian <null@damianstewart.com> Date: Thu Dec 15 21:29:47 2022 +0100 unit tests passing for embeddings with vector length >1 commit beb1b08d9a98112ed2fe073580568e1a18698da3 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:39:09 2022 +0100 more explicit equality tests when overwriting commit 44d8a5a7c85cdabc9ce3a54fd0769a10597b3ca9 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:30:13 2022 +0100 wip textual inversion manager (unit tests passing for 1v embedding overwriting) commit 417c2b57d90924a839616bfb66804faab8039e4c Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 12:30:55 2022 +0100 wip textual inversion manager (unit tests passing for base stuff + padding) commit 2e80872e3b6f7fd7d8eb8928822bd824b63cb2ff Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 10:57:57 2022 +0100 wip new TextualInversionManager * stop using WeightedFrozenCLIPEmbedder * store diffusion models locally - configure_invokeai.py reconfigured to store diffusion models rather than CompVis models - hugging face caching model is used, but cache is set to ~/invokeai/models/repo_id - models.yaml does **NOT** use path, just repo_id - "repo_name" changed to "repo_id" to following hugging face conventions - Models are loaded with full precision pending further work. * allow non-local files during development * path takes priority over repo_id * MVP for model_cache and configure_invokeai - Feature complete (almost) - configure_invokeai.py downloads both .ckpt and diffuser models, along with their VAEs. Both types of download are controlled by a unified INITIAL_MODELS.yaml file. - model_cache can load both type of model and switches back and forth in CPU. No memory leaks detected TO DO: 1. I have not yet turned on the LocalOnly flag for diffuser models, so the code will check the Hugging Face repo for updates before using the locally cached models. This will break firewalled systems. I am thinking of putting in a global check for internet connectivity at startup time and setting the LocalOnly flag based on this. It would be good to check updates if there is connectivity. 2. I have not gone completely through INITIAL_MODELS.yaml to check which models are available as diffusers and which are not. So models like PaperCut and VoxelArt may not load properly. The runway and stability models are checked, as well as the Trinart models. 3. Add stanzas for SD 2.0 and 2.1 in INITIAL_MODELS.yaml REMAINING PROBLEMS NOT DIRECTLY RELATED TO MODEL_CACHE: 1. When loading a .ckpt file there are lots of messages like this: Warning! ldm.modules.attention.CrossAttention is no longer being maintained. Please use InvokeAICrossAttention instead. I'm not sure how to address this. 2. The ckpt models ***don't actually run*** due to the lack of special-case support for them in the generator objects. For example, here's the hard crash you get when you run txt2img against the legacy waifu-diffusion-1.3 model: ``` >> An error occurred: Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 140, in main main_loop(gen, opt) File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 371, in main_loop gen.prompt2image( File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1265, in __getattr__ raise AttributeError("'{}' object has no attribute '{}'".format( AttributeError: 'LatentDiffusion' object has no attribute 'image_from_embeddings' ``` 3. The inpainting diffusion model isn't working. Here's the output of "banana sushi" when inpainting-1.5 is loaded: ``` Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 301, in image_from_embeddings result_latents, result_attention_map_saver = self.latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 330, in latents_from_embeddings result: PipelineIntermediateState = infer_latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 185, in __call__ for result in self.generator_method(*args, **kwargs): File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 367, in generate_latents_from_embeddings step_output = self.step(batched_t, latents, guidance_scale, File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context return func(*args, **kwargs) File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 409, in step step_output = self.scheduler.step(noise_pred, timestep, latents, **extra_step_kwargs) File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/diffusers/schedulers/scheduling_lms_discrete.py", line 223, in step pred_original_sample = sample - sigma * model_output RuntimeError: The size of tensor a (9) must match the size of tensor b (4) at non-singleton dimension 1 ``` * proper support for float32/float16 - configure script now correctly detects user's preference for fp16/32 and downloads the correct diffuser version. If fp16 version not available, falls back to fp32 version. - misc code cleanup and simplification in model_cache * add on-the-fly conversion of .ckpt to diffusers models 1. On-the-fly conversion code can be found in the file ldm/invoke/ckpt_to_diffusers.py. 2. A new !optimize command has been added to the CLI. Should be ported to Web GUI. User experience on the CLI is this: ``` invoke> !optimize /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt INFO: Converting legacy weights file /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt to optimized diffuser model. This operation will take 30-60s to complete. Success. Optimized model is now located at /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 Writing new config file entry for sd-v1-4... >> New configuration: sd-v1-4: description: Optimized version of sd-v1-4 format: diffusers path: /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 OK to import [n]? y >> Verifying that new model loads... >> Current VRAM usage: 2.60G >> Offloading stable-diffusion-2.1 to CPU >> Loading diffusers model from /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 | Using faster float16 precision You have disabled the safety checker for <class 'ldm.invoke.generator.diffusers_pipeline.StableDiffusionGeneratorPipeline'> by passing `safety_checker=None`. Ensure that you abide to the conditions of the Stable Diffusion \ license and do not expose unfiltered results in services or applications open to the public. Both the diffusers team and Hugging Face strongly recommend to keep the safety filter enabled in all public facing circumstances,\ disabling it only for use-cases that involve analyzing network behavior or auditing its results. For more information, please have a look at https://github.com/huggingface/diffusers/pull/254 . | training width x height = (512 x 512) >> Model loaded in 3.48s >> Max VRAM used to load the model: 2.17G >> Current VRAM usage:2.17G >> Textual inversions available: >> Setting Sampler to k_lms (LMSDiscreteScheduler) Keep model loaded? [y] ``` * add parallel set of generator files for ckpt legacy generation * generation using legacy ckpt models now working * diffusers: fix missing attention_maps_callback fix for 23eb80b40421b2bb8f4b6d3dd30490d11c447b36 * associate legacy CrossAttention with .ckpt models * enable autoconvert New --autoconvert CLI option will scan a designated directory for new .ckpt files, convert them into diffuser models, and import them into models.yaml. Works like this: invoke.py --autoconvert /path/to/weights/directory In ModelCache added two new methods: autoconvert_weights(config_path, weights_directory_path, models_directory_path) convert_and_import(ckpt_path, diffuser_path) * diffusers: update to diffusers 0.11 (from 0.10.2) * fix vae loading & width/height calculation * refactor: encapsulate these conditioning data into one container * diffusers: fix some noise-scaling issues by pushing the noise-mixing down to the common function * add support for safetensors and accelerate * set local_files_only when internet unreachable * diffusers: fix error-handling path when model repo has no fp16 branch * fix generatorinpaint error Fixes : "ModuleNotFoundError: No module named 'ldm.invoke.generatorinpaint' https://github.com/invoke-ai/InvokeAI/pull/1583#issuecomment-1363634318 * quench diffuser safety-checker warning * diffusers: support stochastic DDIM eta parameter * fix conda env creation on macos * fix cross-attention with diffusers 0.11 * diffusers: the VAE needs to be tiling as well as the U-Net * diffusers: comment on subfolders * diffusers: embiggen! * diffusers: make model_cache.list_models serializable * diffusers(inpaint): restore scaling functionality * fix requirements clash between numba and numpy 1.24 * diffusers: allow inpainting model to do non-inpainting tasks * start expanding model_cache functionality * add import_ckpt_model() and import_diffuser_model() methods to model_manager - in addition, model_cache.py is now renamed to model_manager.py * allow "recommended" flag to be optional in INITIAL_MODELS.yaml * configure_invokeai now downloads VAE diffusers in advance * rename ModelCache to ModelManager * remove support for `repo_name` in models.yaml * check for and refuse to load embeddings trained on incompatible models * models.yaml.example: s/repo_name/repo_id and remove extra INITIAL_MODELS now that the main one has diffusers models in it. * add MVP textual inversion script * refactor(InvokeAIDiffuserComponent): factor out _combine() * InvokeAIDiffuserComponent: implement threshold * InvokeAIDiffuserComponent: diagnostic logs for threshold ...this does not look right * add a curses-based frontend to textual inversion - not quite working yet - requires npyscreen installed - on windows will also have the windows-curses requirement, but not added to requirements yet * add curses-based interface for textual inversion * fix crash in convert_and_import() - This corrects a "local variable referenced before assignment" error in model_manager.convert_and_import() * potential workaround for no 'state_dict' key error - As reported in https://github.com/huggingface/diffusers/issues/1876 * create TI output dir if needed * Update environment-lin-cuda.yml (#2159) Fixing line 42 to be the proper order to define the transformers requirement: ~= instead of =~ * diffusers: update sampler-to-scheduler mapping based on https://github.com/huggingface/diffusers/issues/277#issuecomment-1371428672 * improve user exp for ckt to diffusers conversion - !optimize_models command now operates on an existing ckpt file entry in models.yaml - replaces existing entry, rather than adding a new one - offers to delete the ckpt file after conversion * web: adapt progress callback to deal with old generator or new diffusers pipeline * clean-up model_manager code - add_model() verified to work for .ckpt local paths, .ckpt remote URLs, diffusers local paths, and diffusers repo_ids - convert_and_import() verified to work for local and remove .ckpt files * handle edge cases for import_model() and convert_model() * add support for safetensor .ckpt files * fix name error * code cleanup with pyflake * improve model setting behavior - If the user enters an invalid model name at startup time, will not try to load it, warn, and use default model - CLI UI enhancement: include currently active model in the command line prompt. * update test-invoke-pip.yml - fix model cache path to point to runwayml/stable-diffusion-v1-5 - remove `skip-sd-weights` from configure_invokeai.py args * exclude dev/diffusers from "fail for draft PRs" * disable "fail on PR jobs" * re-add `--skip-sd-weights` since no space * update workflow environments - include `INVOKE_MODEL_RECONFIGURE: '--yes'` * clean up model load failure handling - Allow CLI to run even when no model is defined or loadable. - Inhibit stack trace when model load fails - only show last error - Give user *option* to run configure_invokeai.py when no models successfully load. - Restart invokeai after reconfiguration. * further edge-case handling 1) only one model in models.yaml file, and that model is broken 2) no models in models.yaml 3) models.yaml doesn't exist at all * fix incorrect model status listing - "cached" was not being returned from list_models() - normalize handling of exceptions during model loading: - Passing an invalid model name to generate.set_model() will return a KeyError - All other exceptions are returned as the appropriate Exception * CI: do download weights (if not already cached) * diffusers: fix scheduler loading in offline mode * CI: fix model name (no longer has `diffusers-` prefix) * Update txt2img2img.py (#2256) * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * feat - make model storage compatible with hugging face caching system This commit alters the InvokeAI model directory to be compatible with hugging face, making it easier to share diffusers (and other models) across different programs. - If the HF_HOME environment variable is not set, then models are cached in ~/invokeai/models in a format that is identical to the HuggingFace cache. - If HF_HOME is set, then models are cached wherever HF_HOME points. - To enable sharing with other HuggingFace library clients, set HF_HOME to ~/.cache/huggingface to set the default cache location or to ~/invokeai/models to have huggingface cache inside InvokeAI. * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * fix error "no attribute CkptInpaint" * model_manager.list_models() returns entire model config stanza+status * Initial Draft - Model Manager Diffusers * added hash function to diffusers * implement sha256 hashes on diffusers models * Add Model Manager Support for Diffusers * fix various problems with model manager - in cli import functions, fix not enough values to unpack from _get_name_and_desc() - fix crash when using old-style vae: value with new-style diffuser * rebuild frontend * fix dictconfig-not-serializable issue * fix NoneType' object is not subscriptable crash in model_manager * fix "str has no attribute get" error in model_manager list_models() * Add path and repo_id support for Diffusers Model Manager Also fixes bugs * Fix tooltip IT localization not working * Add Version Number To WebUI * Optimize Model Search * Fix incorrect font on the Model Manager UI * Fix image degradation on merge fixes - [Experimental] This change should effectively fix a couple of things. - Fix image degradation on subsequent merges of the canvas layers. - Fix the slight transparent border that is left behind when filling the bounding box with a color. - Fix the left over line of color when filling a bounding box with color. So far there are no side effects for this. If any, please report. * Add local model filtering for Diffusers / Checkpoints * Go to home on modal close for the Add Modal UI * Styling Fixes * Model Manager Diffusers Localization Update * Add Safe Tensor scanning to Model Manager * Fix model edit form dispatching string values instead of numbers. * Resolve VAE handling / edge cases for supplied repos * defer injecting tokens for textual inversions until they're used for the first time * squash a console warning * implement model migration check * add_model() overwrites previous config rather than merges * fix model config file attribute merging * fix precision handling in textual inversion script * allow ckpt conversion script to work with safetensors .ckpts Applied patch here: https://github.com/huggingface/diffusers/commit/beb932c5d111872c5e45387e7b1b2b3dd0524a47 * fix name "args" is not defined crash in textual_inversion_training * fix a second NameError: name 'args' is not defined crash * fix loading of the safety checker from the global cache dir * add installation step to textual inversion frontend - After a successful training run, the script will copy learned_embeds.bin to a subfolder of the embeddings directory. - User given the option to delete the logs and intermediate checkpoints (which together use 7-8G of space) - If textual inversion training fails, reports the error gracefully. * don't crash out on incompatible embeddings - put try: blocks around places where the system tries to load an embedding which is incompatible with the currently loaded model * add support for checkpoint resuming * textual inversion preferences are saved and restored between sessions - Preferences are stored in a file named text-inversion-training/preferences.conf - Currently the resume-from-checkpoint option is not working correctly. Possible bug in textual_inversion_training.py? * copy learned_embeddings.bin into right location * add front end for diffusers model merging - Front end doesn't do anything yet!!!! - Made change to model name parsing in CLI to support ability to have merged models with the "+" character in their names. * improve inpainting experience - recommend ckpt version of inpainting-1.5 to user - fix get_noise() bug in ckpt version of omnibus.py * update environment*yml * tweak instructions to install HuggingFace token * bump version number * enhance update scripts - update scripts will now fetch new INITIAL_MODELS.yaml so that configure_invokeai.py will know about the diffusers versions. * enhance invoke.sh/invoke.bat launchers - added configure_invokeai.py to menu - menu defaults to browser-based invoke * remove conda workflow (#2321) * fix `token_ids has shape torch.Size([79]) - expected [77]` * update CHANGELOG.md with 2.3.* info - Add information on how formats have changed and the upgrade process. - Add short bug list. Co-authored-by: Damian Stewart <d@damianstewart.com> Co-authored-by: Damian Stewart <null@damianstewart.com> Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> Co-authored-by: Wybartel-luxmc <37852506+Wybartel-luxmc@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> Co-authored-by: mickr777 <115216705+mickr777@users.noreply.github.com> Co-authored-by: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Co-authored-by: Eugene Brodsky <ebr@users.noreply.github.com> Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com>
2023-01-15 14:22:46 +00:00
self.ddim_eta = ddim_eta # same seed always produces same image
self.precision = precision
self.strength = 0.75
self.seamless = False
2022-10-17 02:45:18 +00:00
self.seamless_axes = {'x','y'}
self.hires_fix = False
self.embedding_path = embedding_path
self.model = None # empty for now
enable fast switching between models in invoke.py - This PR enables two new commands in the invoke.py script !models -- list the available models and their cache status !switch <model> -- switch to the indicated model Example: invoke> !models laion400m not loaded Latent Diffusion LAION400M model stable-diffusion-1.4 active Stable Diffusion inference model version 1.4 waifu-1.3 cached Waifu anime model version 1.3 invoke> !switch waifu-1.3 >> Caching model stable-diffusion-1.4 in system RAM >> Retrieving model waifu-1.3 from system RAM cache The name and descriptions of the models are taken from `config/models.yaml`. A future enhancement to `model_cache.py` will be to enable new model stanzas to be added to the file programmatically. This will be useful for the WebGUI. More details: - Use fast switching algorithm described in PR #948 - Models are selected using their configuration stanza name given in models.yaml. - To avoid filling up CPU RAM with cached models, this PR implements an LRU cache that monitors available CPU RAM. - The caching code allows the minimum value of available RAM to be adjusted, but invoke.py does not currently have a command-line argument that allows you to set it. The minimum free RAM is arbitrarily set to 2 GB. - Add optional description field to configs/models.yaml Unrelated fixes: - Added ">>" to CompViz model loading messages in order to make user experience more consistent. - When generating an image greater than defaults, will only warn about possible VRAM filling the first time. - Fixed bug that was causing help message to be printed twice. This involved moving the import line for the web backend into the section where it is called. Coauthored by: @ArDiouscuros
2022-10-12 06:14:59 +00:00
self.model_hash = None
self.sampler = None
self.device = None
self.session_peakmem = None
self.base_generator = None
self.seed = None
merge release-candidate-1-3-2 into main. Squashed commit of the following: commit 9a1fe8e7fbbd81d9e9e47c4fda6bde6f66fba30c Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 12 17:07:40 2022 +0000 swap in release URLs for installers commit ff56f5251ba8502833cb561317e82b028cd2da5d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 12 17:03:21 2022 +0000 fix up bad unicode chars in invoke.py commit ed943bd6c785d968d1e31fbbb814fea8688fc8bb Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 12 16:05:45 2022 +0000 outcrop improvements, hand-added commit 7ad2355b1da53861bb75312edead8f9db0b0f44d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 12 15:14:33 2022 +0000 documentation fixes commit 66c920fc197d9206be9e0e2d1eb2a1cb86362887 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 16:49:25 2022 -0500 Revert "Resize hires as an image" This reverts commit d05b1b3544dfa7b3c071ac05b4f014a52e08fa50. commit 3fc5cb09f8bc03ea96e67a3e49fb087019d2f9d5 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 12 12:43:17 2022 +0000 fix incorrect link in install commit 1345ec77ab58f70e1bf5a0f587ca40aba4e906b7 Author: tildebyte <337875+tildebyte@users.noreply.github.com> Date: Sun Nov 6 19:07:31 2022 -0500 toil(repo): add tildebyte as owner of installer/ directory commit b116715490f390a59e5bee1022a6a758aee0918d Author: Kyle Schouviller <kyle0654@hotmail.com> Date: Thu Nov 10 21:43:56 2022 -0800 Fix performance issue introduced by torch cuda cache clear during generation commit fa3670270e7aae6bfd8d47fb7bdd32b707310c23 Author: mauwii <Mauwii@outlook.de> Date: Fri Nov 11 12:42:03 2022 +0100 small update to dockers huggingface section commit c304250ef663b3e202b4da8332365288589d94c7 Author: mauwii <Mauwii@outlook.de> Date: Fri Nov 11 12:19:27 2022 +0100 fix format and Link in INSTALL_INVOKE.md commit 802ce5dde5ca68f24aa4609cdba428044e0c7fa1 Author: mauwii <Mauwii@outlook.de> Date: Fri Nov 11 11:17:49 2022 +0100 small fixex to format and a link in INSTALL_MANUAL commit 311ee320ecac892cb4a1bcd012374fa051b1d011 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 07:23:35 2022 +0000 ignore installer intermediate files commit e9df17b374df58a44d3ae3ba33cbdc58794bcf5d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 07:19:25 2022 +0000 fix backslash-related syntax error commit 061fb4ef00482bdd4fba635aeaeff4ca7510190d Merge: 52be0d23 4095acd1 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 06:50:04 2022 +0000 Merge branch 'release-candidate-2-1-3' of github.com:/invoke-ai/InvokeAI into release-candidate-2-1-3 commit 52be0d2396de2de02030855c92e3367008b50377 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 06:49:45 2022 +0000 add WindowsLongFileName batfile to source installer commit 4095acd10ebae05a8cb14cc2faf7c79936d9e6a9 Author: mauwii <Mauwii@outlook.de> Date: Fri Nov 11 07:05:17 2022 +0100 Doc Updates A lot of re-formating of new Installation Docs also some content updates/corrections commit 201eb22d7650b00f55249c2646fa4f47ac3e0ec2 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 04:41:02 2022 +0000 prevent two models from being marked default in models.yaml commit 17ab98220034dfbb798a9a0460bc2837f0c1e2cb Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 03:56:54 2022 +0000 installers download branch HEAD not tag commit a04965b0e9e9d1170cf284af9acbd1186d681255 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 03:48:21 2022 +0000 improve messaging during installation process commit 0b529f0c574dd91fb9593e924ebc41c8c219b6ce Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 15:22:32 2022 +0000 enable outcropping of random JPG/PNG images - Works best with runwayML inpainting model - Numerous code changes required to propagate seed to final metadata. Original code predicated on the image being generated within InvokeAI. commit 6f9f84834557eb3c48562dc5d0ace51ca9e9cca2 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 17:27:42 2022 +0000 enhance outcropping with ability to direct contents of new regions - When outcropping an image you can now add a `--new_prompt` option, to specify a new prompt to be used instead of the original one used to generate the image. - Similarly you can provide a new seed using `--seed` (or `-S`). A seed of zero will pick one randomly. - This PR also fixes the crash that happened when trying to outcrop an image that does not contain InvokeAI metadata. commit 918c1589ef30595668899f4259ece6a4ad605c69 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 20:16:47 2022 +0000 fix #1402 commit 116415b3fcec8415f8e6de9b23c0bbd0dbc6845b Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 21:27:25 2022 +0000 fix invoke.py crash if no models.yaml file present - Script will now offer the user the ability to create a minimal models.yaml and then gracefully exit. - Closes #1420 commit b4b6eabaac94896e38123be331c44d1b63065b0d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 16:49:25 2022 -0500 Revert "Log strength with hires" This reverts commit 82d4904c07670d514e9a541de7c9ecd8489eeae2. commit 4ef1f4a854717c953f9192454d0adabef32af36c Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 20:01:49 2022 +0000 remove temporary directory from repo commit 510fc4ebaa5f9dc0e77b47cf04e0c265423e0a44 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 19:59:03 2022 +0000 remove -e from clipseg load in installer commit a20914434bb3609cf1d883cabf048d4cc25f881a Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 19:37:07 2022 +0000 change clipseg repo branch to avoid clipseg not found error commit 0d134195fda5c69fce5a95d6da90248eba8d226d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 18:39:29 2022 +0000 update repo URL to point to rc commit 649d8c8573896fdb5a73453b69ee4b54cf4d6241 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 18:13:28 2022 +0000 integrate tildebyte installer commit a358d370a05ea985a9e26fa9c1101d9c14fdb3ab Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 17:48:14 2022 +0000 add @tildebyte compiled pip installer commit 94a9033c4f6214e604be149a3de6d7c747af7f3a Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 14:52:00 2022 +0000 ignore source installer zip files commit 18a947c503c83c95cd83f27424696219ff3c4c95 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 14:46:36 2022 +0000 documentation and environment file fixes - Have clarified the relationship between the @tildebyte and @cmdr2 installers; However, @tildebyte installer merge is still a WIP due to conflicts over such things as `invoke.sh`. - Rechristened 1click installer as "source" installer. @tildebyte installer will be "the" installer. (We'll see which one generates the least support requests and maintenance work.) - Sync'd `environment-mac.yml` with `development`. The former was failing with a taming-transformers error as per https://discord.com/channels/@me/1037201214154231899/1040060947378749460 commit a23b03189526a49da8ddae90ce71b0e902784d29 Author: Mike DiGiovanni <vinblau@gmail.com> Date: Wed Nov 9 16:44:59 2022 -0500 Fixes typos in README.md commit 23af68c7d79d947f1bd3441c91bb44d655238f01 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 07:02:27 2022 -0500 downgrade win installs to basicsr==1.4.1 commit e258beeb51f3e645b9ea60e52d69d18722221cc5 Merge: 7460c069 e481bfac Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 06:37:45 2022 -0500 Merge branch 'release-candidate-2-1-3' of github.com:invoke-ai/InvokeAI into release-candidate-2-1-3 commit 7460c069b880b10c84b55f2e0c0998e350d6cf12 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 06:36:48 2022 -0500 remove --prefer-binary from requirements-base.txt It appears that some versions of pip do not recognize this option when it appears in the requirements file. Did not explore this further but recommend --prefer-binary in the manual install instructions on the command line. commit e481bfac615e0c798ceb5e59e8fbe3038f85b431 Merge: 5040747c d1ab65a4 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 11:21:56 2022 +0000 Merge branch 'release-candidate-2-1-3' of github.com:/invoke-ai/InvokeAI into release-candidate-2-1-3 commit 5040747c6700c9b949e3f3e1d2c3f21daffcec6c Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 11:21:43 2022 +0000 fix windows install instructions & bat file commit d1ab65a43122f73c20533d5815590ec10bc05eca Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 07:18:59 2022 +0100 update WEBUIHOTKEYS.md commit af4ee7feb8a7d2528bf4e2b3f7deee7a7c4c3dec Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 06:33:49 2022 +0100 update INSTALL_DOCKER.md commit 764fb29aded8114984d05932c4266ea24614b932 Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 06:30:15 2022 +0100 fix formatting in INSTALL.md commit 1014d3ba44aa4cd4cfdc6e3650c24a0dc9568a6e Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 06:29:14 2022 +0100 fix build.sh invokeai_conda_env_file default value commit 40a48aca88e337e9f4475f80a03b7d6d4751d09b Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 05:25:30 2022 +0100 fix environment-mac.yml moved taming-transformers-rom1504 to pip dependencies commit 92abc00f16a34a586dd16d3c64408f00e23fcb53 Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 05:19:52 2022 +0100 fix test-invoke-conda - copy required conda environment yaml - use environment.yml - I use cp instead of ln since would be compatible for windows runners commit a5719aabf89c8c5f29c6044e2882ccdcd0c6916b Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 04:14:35 2022 +0100 update Dockerfile - link environment.yml from new environemnts path - change default conda_env_file - quote all variables to avoid splitting - also remove paths from conda-env-files in build-container.yml commit 44a18511fa7accfec6a20345774583a1ce745b02 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 20:51:06 2022 +0000 update paths in container build workflow commit b850dbadafba052310327ca759d96f49a9d25d03 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 20:16:57 2022 +0000 finished reorganization of install docs commit 9ef8b944d53afb1fed94c418b2fd936d2d743797 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 18:50:58 2022 +0000 tweaks to manual install documentation --prefer-binary is an iffy option in the requirements file. It isn't supported by some versions of pip, so I removed it from requirements-base.txt and inserted it into the manual install instructions where it seems to do what it is supposed to. commit efc5a9848803b4250d726bc1913b9fd5a33fad75 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 18:20:03 2022 +0000 manual installation documentation tested on Linux commit 1417c87928e13b0ed21bf1c5604f8636d3b50a8d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 17:37:06 2022 +0000 change name of requirements.txt to avoid confusion commit 2dd6fc2b93ff7bbb4038568a3b28d36a8fafaeb8 Merge: 22213612 71ee44a8 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 17:26:24 2022 +0000 Merge branch 'release-candidate-2-1-3' of github.com:/invoke-ai/InvokeAI into release-candidate-2-1-3 commit 22213612a08bbece46eafd48994f985b097cb141 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 17:25:59 2022 +0000 directory cleanup; working on install docs commit 71ee44a827898759fd457f774c0b2ac7a1ef6519 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 02:07:13 2022 +0000 prevent crash when switching to an invalid model commit b17ca0a5e731c142101bbdbf34d121df949e86d7 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 14:28:38 2022 +0100 don't suppress exceptions when doing cross-attention control commit 71bbfe4a1a5b70f90e5f41c94df50fb104dbdd79 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 12:59:34 2022 +0100 Fix #1362 by improving VRAM usage patterns when doing .swap() commit ef3f7a26e242b73c2beb0195c7fd8f654ef47f55 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 12:18:37 2022 +0100 remove log spam commit 7189d649622d4668b120b0dd278388ad672142c4 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 12:10:28 2022 +0100 change the way saved slicing strategy is applied commit 01c40f751ab72955140165c16f95ae411732265b Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 12:04:43 2022 +0100 fix slicing_strategy_getter callsite commit f8cfe25150a346958903316bc710737d99839923 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 11:56:22 2022 +0100 cleanup, consistent dim=0 also tested commit 5bf9b1e890d48e962afd4a668a219b68271e5dc1 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 11:34:09 2022 +0100 refactored context, tested with non-sliced cross attention control commit d58a46e39bf562e7459290d2444256e8c08ad0b6 Author: damian0815 <null@damianstewart.com> Date: Sun Nov 6 00:41:52 2022 +0100 cleanup commit 7e2c658b4c06fe239311b65b9bb16fa3adec7fd7 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:57:31 2022 +0100 disable logs commit 20ee89d93841b070738b3d8a4385c93b097d92eb Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:36:58 2022 +0100 slice saved attention if necessary commit 0a7684a22c880ec0f48cc22bfed4526358f71546 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:32:38 2022 +0100 raise instead of asserting commit 7083104c7f3a0d8fd96e94a2f391de50a3c942e4 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:31:00 2022 +0100 store dim when saving slices commit f7c0808ed383ec1dc70645288a798ed2aa4fa85c Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:27:16 2022 +0100 don't retry on exception commit 749a721e939b3fe7c1741e7998dab6bd2c85a0cb Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:24:50 2022 +0100 stuff commit 032ab90e9533be8726301ec91b97137e2aadef9a Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:20:17 2022 +0100 more logging commit 3dc34b387f033482305360e605809d95a40bf6f8 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:16:47 2022 +0100 logs commit 901c4c1aa4b9bcef695a6551867ec8149e6e6a93 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:12:39 2022 +0100 actually set save_slicing_strategy to True commit f780e0a0a7c6b6a3db320891064da82589358c8a Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:10:35 2022 +0100 store slicing strategy commit 93bb6d566fd18c5c69ef7dacc8f74ba2cf671cb7 Author: damian <git@damianstewart.com> Date: Sat Nov 5 20:43:48 2022 +0100 still not it commit 5e3a9541f8ae00bde524046963910323e20c40b7 Author: damian <git@damianstewart.com> Date: Sat Nov 5 17:20:02 2022 +0100 wip offloading attention slices on-demand commit 4c2966aa856b6f3b446216da3619ae931552ef08 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 15:47:40 2022 +0100 pre-emptive offloading, idk if it works commit 572576755e9f0a878d38e8173e485126c0efbefb Author: root <you@example.com> Date: Sat Nov 5 11:25:32 2022 +0000 push attention slices to cpu. slow but saves memory. commit b57c83a68f2ac03976ebc89ce2ff03812d6d185f Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 12:04:22 2022 +0100 verbose logging commit 3a5dae116f110a96585d9eb71d713b5ed2bc3d2b Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 11:50:48 2022 +0100 wip fixing mem strategy crash (4 test on runpod) commit 3cf237db5fae0c7b0b4cc3c47c81830bdb2ae7de Author: damian0815 <null@damianstewart.com> Date: Fri Nov 4 09:02:40 2022 +0100 wip, only works on cuda commit 5702271991e126c026aa1ff41c44f8ad37b26e3a Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 14:09:36 2022 +0000 speculative reorganization of the requirements & environment files - This is only a test! - The various environment*.yml and requirements*.txt files have all been moved into a directory named "environments-and-requirements". - The idea is to clean up our root directory so that the github home page is tidy. - The manual install instructions will start with the instructions to create a symbolic link from environment.yml to the appropriate file for OS and GPU. - The 1-click installers have been updated to accommodate this change. commit 10781e7dc4f4551583a110d14f2a1f60393112b8 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 01:59:45 2022 +0000 refactoring requirements commit 099d1157c579c7b9fea20945e8504cc15745c598 Author: mauwii <Mauwii@outlook.de> Date: Wed Nov 9 00:16:18 2022 +0100 better way to make sure if conda is useable commit ab825bf7ee5f0b82d2273da1cda64fc9266a978e Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 22:05:33 2022 +0000 add back --prefer-binaries to requirements commit 10cfeb5ada7bcfc9f3aff3716ab8ea4961a8b528 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 8 22:27:19 2022 +0100 add quotes to set and use `$environment_file` commit e97515d0453583e013674b4dd1f3739c7de402cc Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 8 22:24:21 2022 +0100 set environment file for conda update commit 0f04bc5789c712bf7c7319b1d93064914993f4ec Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 8 22:21:25 2022 +0100 use conda env update commit 3f74aabecd08ed25fac158463ae12b775bd1fca2 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 8 22:20:44 2022 +0100 use command instead of hash commit b1a99a51b7ca23c4b895855bd7b4c82dbdc431e4 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 14:44:44 2022 -0500 remove --global git config from 1-click installers commit 8004f8a6d99f6ff75e00c170da40f1dec93a8914 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Mon Nov 7 09:07:20 2022 -0500 Revert "Use array slicing to calc ddim timesteps" This reverts commit 1f0c5b4cf196716c21f2db74f92c8750ad8f889d. commit ff8ff2212afb1e1c2dce4f6a61f29e2bc8302eb5 Merge: 8e5363cd 636620b1 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 14:01:40 2022 +0000 add initfile support from PR #1386 commit 8e5363cd83bff0e6be0f002c644283955f7fcbfd Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 13:26:18 2022 +0000 move 'installer/' to '1-click-installer' to make room for tildebyte installer commit 1450779146e89510d12b8c90eb316d9861c3375e Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 12:56:36 2022 +0000 update branch for installer to pull against commit 8cd5d95b8a1cb213cce2f949c394c841a09d9cab Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 05:30:20 2022 +0000 move all models into subdirectories of ./models - this required an update to the invoke-ai fork of gfpgan - simultaneously reverted consolidation of environment and requirements files, as their presence in a directory triggered setup.py to try to install a sub-package. commit abd6407394d55d4f6c064a05f3ac989dd3817c59 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 03:52:46 2022 +0000 leave a copy of environment-cuda.yml at top level - named it environment.yml - need to avoid a big change for users and breaking older support instructions. commit 734dacfbe9d8c86ca943c6541e7b5ff5ef787ff4 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 03:50:07 2022 +0000 consolidate environment files - starting to remove unneeded entries and pins - no longer require -e in front of github dependencies - update setup.py with release number - update manual installation instructions commit 636620b1d5e2466613d0dcc2a604522be12fa3a4 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 03:26:16 2022 +0000 change initfile to ~/.invokeai - adjust documentation - also fix 'clipseg_models' to 'clipseg', which seems to be working now commit 1fe41146f0975bbc9d552208473490a9ccb9fc56 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 5 14:28:01 2022 -0400 add support for an initialization file, invokeai.init - Place preferred startup command switches in a file named "invokeai.init". The file can consist of a single line of switches such as "--web --steps=28", a series of switches on each line, or any combination of the two. Example: ``` --web --host=0.0.0.0 --steps=28 --grid -f 0.6 -C 11.0 -A k_euler_a ``` - The following options, which were previously only available within the CLI, are now available on the command line as well: --steps --strength --cfg_scale --width --height --fit commit 2ad6ef355a9b9c4b17bae71edea2346c2e8708c5 Merge: 865502ee 8b47c829 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sun Nov 6 18:08:36 2022 +0000 update discord link commit 865502ee4f681de4516d231370ae603983354d8f Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 18:00:16 2022 +0100 update changelog commit c7984f3299c5c8f56a70d80907d527af458674af Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 17:07:27 2022 +0100 update TROUBLESHOOT.md commit 7f150ed83302ba875c3e0c0f39d8ac0f32c6e362 Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 16:56:58 2022 +0100 remove `:`from headlines in CONTRIBUTORS.md commit badf4e256ce6e3201df1a9a87a7072b36b18d699 Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 16:56:37 2022 +0100 enable navigation tabs Since the docs are growing, this way they look cleaner commit e64c60bbb38fc1620e08ce52bf28bd17003c7ef6 Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 16:18:59 2022 +0100 remove preflight checks from assets seems like somebody executed tests and commited them commit 178061854300632b024810e65922b54b64d95939 Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 16:15:06 2022 +0100 update INSTALLING_MODELS.md commit f91fd276242a0c92b301e99d02982d30f7b712c3 Author: Kyle Schouviller <kyle0654@hotmail.com> Date: Sat Nov 5 14:47:53 2022 -0700 Bug fix for inpaint size commit 09e41e8f769457b9ffd56901aae13991cdc6eeb8 Author: Kyle Schouviller <kyle0654@hotmail.com> Date: Sat Nov 5 14:34:52 2022 -0700 Add inpaint size options to inpaint at a larger size than the actual inpaint image, then scale back down for recombination commit 6eeb2107b300fc27cfe6134b43e5570c246b8e96 Author: mauwii <Mauwii@outlook.de> Date: Sat Nov 5 21:01:14 2022 +0100 remove create-caches.yml since not used anywhere commit 17053ad8b7efecb21a9b4eb32695089f683f72e3 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 5 16:01:55 2022 -0400 fix duplicated argument introduced by conflict resolution commit fefb4dc1f88bc6551a39602a2bc79b278cd83c59 Merge: 762ca60a d05b1b35 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 5 12:47:35 2022 -0700 Merge branch 'development' into fix_generate.py commit d05b1b3544dfa7b3c071ac05b4f014a52e08fa50 Author: Craig <cwallen@users.noreply.github.com> Date: Sat Oct 29 20:40:30 2022 -0400 Resize hires as an image commit 82d4904c07670d514e9a541de7c9ecd8489eeae2 Author: Craig <cwallen@users.noreply.github.com> Date: Sat Oct 29 20:37:40 2022 -0400 Log strength with hires commit 1cdcf33cfa39e90f9660fabf8f5936dcfb6c3aa5 Merge: 6616fa83 cbc029c6 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 5 09:57:38 2022 -0400 Merge branch 'main' into development - this synchronizes recent document fixes by mauwii commit 6616fa835ac4318bf53419f2b54b88c962559578 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 4 00:47:03 2022 -0400 fix Windows library dependency issues This commit addresses two bugs: 1) invokeai.py crashes immediately with a message about an undefined attritube sigKILL (closes #1288). The fix is to pin torch at 1.12.1. 2) Version 1.4.2 of basicsr fails to load properly on Windows, and is a requirement of realesrgan, however 1.4.1 works. Pinning basicsr in our requirements file resulted in a dependency conflict, so I ended up cloning realesrgan into the invoke-ai Git space and changing the requirements file there. If there is a more elegant solution, please advise. commit 7b9a4564b11f4181b9b3c06ecda2a4a25fd1849e Author: Matthias Wild <40327258+mauwii@users.noreply.github.com> Date: Sat Nov 5 14:36:45 2022 +0100 Update-docs (#1382) * update IMG2IMG.md * update INPAINTING.md * update WEBUIHOTKEYS.md * more doc updates (mostly fix formatting): - OUTPAINTING.md - POSTPROCESS.md - PROMPTS.md - VARIATIONS.md - WEB.md - WEBUIHOTKEYS.md commit fcdefa0620761472718afa14b2955a5d0603cfcc Author: Matthias Wild <40327258+mauwii@users.noreply.github.com> Date: Fri Nov 4 20:47:31 2022 +0100 Hotifx docs (#1376) (#1377) commit ef8b3ce639954259a95a38f44fa5329687bee781 Merge: b7042095 36870a8f Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 4 12:08:44 2022 -0400 Merge-main-into-development (#1373) To get the rid of the difference between main and development. Since otherwise it will be a pain to start fixing the documentatino (when the state between main and development is not the same ...) Also this should fix the problem of all tests failing since environment yamls get updated. commit 36870a8f53217d4b733e9bb8b119190b5e36da59 Merge: 6b89adfa b7042095 Author: Matthias Wild <40327258+mauwii@users.noreply.github.com> Date: Fri Nov 4 16:25:00 2022 +0100 Merge branch 'development' into merge-main-into-development commit b70420951d5b70937c0c07e4f8a552a01c3008bc Author: damian0815 <null@damianstewart.com> Date: Thu Nov 3 12:39:45 2022 +0100 fix parsing error doing eg `forest ().swap(in winter)` commit 1f0c5b4cf196716c21f2db74f92c8750ad8f889d Author: wfng92 <43742196+wfng92@users.noreply.github.com> Date: Thu Nov 3 17:13:52 2022 +0800 Use array slicing to calc ddim timesteps commit 8648da811190fc8bcf237d83aff38cf605851300 Author: mauwii <Mauwii@outlook.de> Date: Fri Nov 4 00:06:19 2022 +0100 update environment-linux-aarch64 to use python 3.9 commit 45b459356399f8cfb7e9af571c1643fab04218fe Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 3 22:31:46 2022 +0100 update environment-linux-aarch64.yml - move getpass_asterisk to pip commit 41b04316cf5118ea9518dc77934d135a489dd684 Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 3 20:40:08 2022 +0100 rename job, remove debug branch from triggers commit e97c6db2a3c0157a8a5ab74cd28ebee480a2d078 Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 3 20:34:01 2022 +0100 include build matrix to build x86_64 and aarch64 commit 896820a349292b0e14bbc32f0c557fe8a6b45395 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 05:01:15 2022 +0100 disable caching commit 06c8f468bff7e1dfecc1a1990164be1005b114a7 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 04:26:39 2022 +0100 disable PR-Validation since there are no files passed from context this is unecesarry commit 61920e2701c4a9cea94c03ab933c4482458215b7 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 04:09:39 2022 +0100 update action to use current branch also update build-args of dockerfile and build.sh commit f34ba7ca70f1c417ee97e8b0c57abff57614d78f Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 02:30:24 2022 +0100 remove unecesarry mkdir command again commit c30ef0895dbf0565345ac6ccb136d98a174470a6 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 01:51:12 2022 +0100 remove symlink to GFPGANv1.4 also re-add mkdir to prevent action from failing commit aa3a774f73d5004571ea42fea14cd2b525fffb1c Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 01:48:59 2022 +0100 update build-container.yml to use cachev3 commit 2c30555b844293764123baa4137fcf952d40a4e7 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 01:34:20 2022 +0100 update Dockerfile - create models.yaml from models.yaml.example - run preload_models.py with --no-interactive commit 743f60577364d43237eeb46aefd523371c36e56b Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 01:21:15 2022 +0100 update build.sh to download sd-v1.5 model commit 519c661abbae83aa62b3ee536635c39192890441 Author: mauwii <Mauwii@outlook.de> Date: Tue Oct 25 01:26:50 2022 +0200 replace old fashined markdown templates with forms this will help the readability of issues a lot 🤓 commit 22c956c75f4797ddc2dffa944e3ea84b4eb3477c Merge: 13696adc 0196571a Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 3 10:20:21 2022 -0400 Merge branch 'development' of github.com:invoke-ai/InvokeAI into development commit 13696adc3a3a2b169e68048a5b511660d0430fae Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 3 10:20:10 2022 -0400 speculative change to solve windows esrgan issues commit 0196571a12992eb8207d36e022721fe3ad2cfd19 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 2 22:39:35 2022 -0400 remove merge markers from preload_models.py commit 9666f466ab1c710dfda2e59be9e8a26fcd7e8718 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 2 18:29:34 2022 -0400 use refined model by default commit 240e5486c89552ef480c3443a63283fb86a493c3 Merge: 8164b6b9 aa247e68 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 2 18:35:00 2022 -0400 Merge branch 'spezialspezial-patch-9' into development commit 8164b6b9cff077e4131384195af65e30a40733a7 Merge: 4fc82d55 dd5a88dc Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 2 17:06:46 2022 -0400 Merge branch 'development' of github.com:invoke-ai/InvokeAI into development commit 4fc82d554ff573780c0af562a6bc9586aa56012d Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 04:17:28 2022 +1300 [WebUI] Final 2.1 Release Build commit 96b34c0f85f6ed52707fe43456d20b81822c7d1d Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 09:08:11 2022 +0100 Final WebUI build for Release 2.1 - squashed commit of 52 commits from PR #1327 don't log base64 progress images Fresh Build For WebUI [WebUI] Loopback Default False Fixes bugs/styling - Fixes missing web app state on new version: Adds stateReconciler to redux-persist. When we add more values to the state and then release the update app, they will be automatically merged in. Reseting web UI will be needed far less. 7159ec - Fixes console z-index - Moves reset web UI button to visible area Decreases gallery width on inpainting Increases workarea split padding to 1rem Adds missing tooltips to site header Changes inpainting controls settings to hover Fixes hotkeys and settings buttons not working Improves bounding box interactions - Bounding box can now be moved by dragging any of its edges - Bounding box does not affect drawing if already drawing a stroke - Can lock bounding box to draw directly on the bounding box edges - Removes spacebar-hold behaviour due to technical issues Fixes silent crash when init image too large To send the mask to the server, the UI rendered the mask onto the init image and sent the whole image. The mask was then cropped by the server. If the image was too large, the app silently failed. Maybe it exceeds the websocket size limit. Fixed by cropping the mask in the UI layer, sending only bounding-box-sized mask image data. Disabled bounding box settings when locked Styles image uploader Builds fresh bundle Improves bounding box interaction Added spacebar-hold-to-transform back. Address bounding box feedback - Adds back toggle to hide bounding box - Box quick toggle = q, normal toggle = shift + q - Styles canvas alert icons Adds hints when unable to invoke - Popover on Invoke button indicates why exactly it is disabled, e.g. prompt is empty, something else is processing, etc. - There may be more than one reason; all are displayed. Fix Inpainting Alerts Styling Preventing unnecessary re-renders across the app Code Split Inpaint Options Isolate features to their own components so they dont re-render the other stuff each time. [TESTING] Remove global isReady checking I dont believe this is need at all because the isready state is constantly updated when needed and tracked real time in the Redux store. This causes massive re-renders. @psychedelicious If this is absolutely essential for a reason that I do not see, please hit me up on Discord. Fresh Bundle Fix Bounding Box Settings re-rendering on brush stroke [Code Splitting] Bounding Box Options Isolated all bounding box components to trigger unnecessary re-renders. Still need to fix bounding box triggering re-renders on the control panel inside the canvas itself. But the options panel should be a good to go with this change. Inpainting Controls Code Spitting and Performance Codesplit the entirety of the inpainting controls. Created new selectors for each and every component to ensure there are no unnecessary re-renders. App feels a lot smoother. Fixes rerenders on ClearBrushHistory Fixes crash when requesting post-generation upscale/face restoration - Moves the inpainting paste to before the postprocessing. Removes unused isReady state Changes Report Bug icon to a bug Restores shift+q bounding box shortcut Adds alert for bounding box size to status icons Adds asCheckbox to IAIIconButton Rough draft of this. Not happy with the styling but it's clearer than having them look just like buttons. Fixes crash related to old value of progress_latents in state Styling changes and settings modal minor refactor Fixes: uploaded JPG images not loading Reworks CurrentImageButtons.tsx - Change all icons to FA iconset for consistency - Refactors IAIIconButton, IAIButton, IAIPopover to handle ref forwarding - Redesigns buttons into group Only generate 1 iteration when seed fixed & variations disabled Fixes progress images select Fixes edge case: upload over gets stuck while alt tabbing - Press esc to close it now Fixes display progress images select typing Fixes current image button rerenders Adds min width to ImageUploader Makes fast-latents in progress default Update Icon Button Checkbox Style Styling Fixes next/prev image buttons Refactor canvas buttons + more Add Save Intermediates Step Count For accurate mode only. Co-Authored-By: Richard Macarthy <richardmacarthy@protonmail.com> Restores "initial image" text Address feedback - moves mask clear button - fixes intermediates - shrinks inpainting icons by 10% Fix Loopback Styling Adds escape hotkey to close floating panels Readd Hotkey for Dual Display Updated Current Image Button Styling commit dd5a88dceeec53ceb1722a62e3689ae3dd871154 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 04:17:28 2022 +1300 [WebUI] Final 2.1 Release Build commit 95ed56bf82825a47cfe406fa34eaf4e32c129143 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 04:16:31 2022 +1300 Updated Current Image Button Styling commit 1ae80f5ab9d00a25e0c3a21e2eccd318c5343401 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 04:07:57 2022 +1300 Readd Hotkey for Dual Display commit 1f0bd3ca6cda4221d1a7a46325f235cd23bd0af9 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu Nov 3 02:07:00 2022 +1100 Adds escape hotkey to close floating panels commit a1971f6830306b3d748f7f36c2243f6dee682f97 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 03:38:15 2022 +1300 Fix Loopback Styling commit c6118e889895ba35a191124ce1beb5d2b719366d Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu Nov 3 01:29:51 2022 +1100 Address feedback - moves mask clear button - fixes intermediates - shrinks inpainting icons by 10% commit 7ba958cf7ff4e804a127b71c88666084f81e7340 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu Nov 3 01:10:38 2022 +1100 Restores "initial image" text commit 383905d5d24359aa1824de96ff124a8f8a87e015 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 02:59:11 2022 +1300 Add Save Intermediates Step Count For accurate mode only. Co-Authored-By: Richard Macarthy <richardmacarthy@protonmail.com> commit 6173e3e9cabd5e74fb466d55d7bb6a80a77b3fa8 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu Nov 3 00:53:53 2022 +1100 Refactor canvas buttons + more commit 3feb7d8922b0e4c9f944e96b95211003f40d9705 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu Nov 3 00:49:23 2022 +1100 Fixes next/prev image buttons commit 1d9edbd0ddd6e10cf120fe0de3db0b56ae374db4 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 00:50:44 2022 +1300 Update Icon Button Checkbox Style Styling commit d439abdb89db73e652add9df371234861189d90c Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 21:37:24 2022 +1100 Makes fast-latents in progress default commit ee47ea0c891a33049bdec12f1c254926f341eff2 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 21:37:09 2022 +1100 Adds min width to ImageUploader commit 300bb2e6279c1c477131b9e57425db348062f19c Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 21:28:22 2022 +1100 Fixes current image button rerenders commit ccf8593501d23e00979f7340f8991514e6ca3428 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 21:27:43 2022 +1100 Fixes display progress images select typing commit 0fda612f3ff8ad75932e158b9b29cf64c3f30eb6 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 21:02:01 2022 +1100 Fixes edge case: upload over gets stuck while alt tabbing - Press esc to close it now commit 5afff65b71bb60d067392c120efff1a17adc66af Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 20:33:19 2022 +1100 Fixes progress images select commit 7e55bdefce8920831cac7b9fa857bfbffe9e9d5d Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 20:27:47 2022 +1100 Only generate 1 iteration when seed fixed & variations disabled commit 620cf84d3dd54b8498e84574f33040a26d4d315f Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 19:51:38 2022 +1100 Reworks CurrentImageButtons.tsx - Change all icons to FA iconset for consistency - Refactors IAIIconButton, IAIButton, IAIPopover to handle ref forwarding - Redesigns buttons into group commit cfe567c62ad3fd0cff5e3e579a2250ca5dfa2d53 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 16:14:50 2022 +1100 Fixes: uploaded JPG images not loading commit cefe12f1df72e051f109ed77ce46f18093b3b8bb Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 15:31:18 2022 +1100 Styling changes and settings modal minor refactor commit 1e51c3992853ad4643d8eda2443a3bd0d65f5f90 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 15:27:46 2022 +1100 Fixes crash related to old value of progress_latents in state commit 42a02bbb8087cd46a1b5c795b1b41e38c08ba229 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 13:15:06 2022 +1100 Adds asCheckbox to IAIIconButton Rough draft of this. Not happy with the styling but it's clearer than having them look just like buttons. commit f1ae6dae4c36e74ca8dedf8b57eb8933c059dcf4 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 13:13:56 2022 +1100 Adds alert for bounding box size to status icons commit 6195579910a91fb2ab7e1186aa1c1145566c3122 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 11:52:19 2022 +1100 Restores shift+q bounding box shortcut commit 16c8b23b347792d7811cff66a27d350fe5d0d62c Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 11:32:07 2022 +1100 Changes Report Bug icon to a bug commit 07ae626b22554b5222a3b71d1ce3974e2c3fb284 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 11:17:16 2022 +1100 Removes unused isReady state commit 8d171bb044f578d4b9cc4911edfa05b20a01d373 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 11:13:26 2022 +1100 Fixes crash when requesting post-generation upscale/face restoration - Moves the inpainting paste to before the postprocessing. commit 6e33ca7e9e64fb355430511e28bb08c32c9c68b1 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 10:59:01 2022 +1100 Fixes rerenders on ClearBrushHistory commit db46e12f2b8c98dac8895ea4d04242d3754dbec4 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 11:36:28 2022 +1300 Inpainting Controls Code Spitting and Performance Codesplit the entirety of the inpainting controls. Created new selectors for each and every component to ensure there are no unnecessary re-renders. App feels a lot smoother. commit 868e4b2db82fa8556b423111f2f8d565a70ec129 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 07:40:31 2022 +1300 [Code Splitting] Bounding Box Options Isolated all bounding box components to trigger unnecessary re-renders. Still need to fix bounding box triggering re-renders on the control panel inside the canvas itself. But the options panel should be a good to go with this change. commit 2e562742c13988a1fc299c673a97ba4e4a645aaf Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 06:40:27 2022 +1300 Fix Bounding Box Settings re-rendering on brush stroke commit 68e69580091fc1dc1d8b6e03c9e7ef777c7ebf61 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 06:28:34 2022 +1300 Fresh Bundle commit ea6e3a7949f2743711516261cb7e450517d39702 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 06:26:56 2022 +1300 [TESTING] Remove global isReady checking I dont believe this is need at all because the isready state is constantly updated when needed and tracked real time in the Redux store. This causes massive re-renders. @psychedelicious If this is absolutely essential for a reason that I do not see, please hit me up on Discord. commit b2879ca99f88869277c474185ade049914b0bf26 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 06:08:59 2022 +1300 Code Split Inpaint Options Isolate features to their own components so they dont re-render the other stuff each time. commit 4e911566c33989392eb3279049b15331ca98594a Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 03:50:56 2022 +1300 Preventing unnecessary re-renders across the app commit 9bafda6a152778893df143776ae859a3b8b7f192 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 03:02:35 2022 +1300 Fix Inpainting Alerts Styling commit 871a8a5375cae891f22eb853ffd2d22298298b11 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 23:52:07 2022 +1100 Adds hints when unable to invoke - Popover on Invoke button indicates why exactly it is disabled, e.g. prompt is empty, something else is processing, etc. - There may be more than one reason; all are displayed. commit 0eef74bc00d3c0cedc5037c1deeef1d9a5b6d33d Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 23:40:11 2022 +1100 Address bounding box feedback - Adds back toggle to hide bounding box - Box quick toggle = q, normal toggle = shift + q - Styles canvas alert icons commit 423ae3209782f1d8d321b2ed9ed00712b726adf7 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 17:06:07 2022 +1100 Improves bounding box interaction Added spacebar-hold-to-transform back. commit 8282e5d0458ca1bba5565c069093b5389f2228d4 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 16:57:07 2022 +1100 Builds fresh bundle commit 19305cdbdf6ac74833bd6011bff0ced8e9d36f69 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 16:51:11 2022 +1100 Styles image uploader commit eb9028ab3069bca9d747aca664ca60ae13ba6df8 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 16:51:03 2022 +1100 Disabled bounding box settings when locked commit 21483f5d0731bce5aa97985e722a64bf0d7cd12c Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 16:50:24 2022 +1100 Fixes silent crash when init image too large To send the mask to the server, the UI rendered the mask onto the init image and sent the whole image. The mask was then cropped by the server. If the image was too large, the app silently failed. Maybe it exceeds the websocket size limit. Fixed by cropping the mask in the UI layer, sending only bounding-box-sized mask image data. commit 82dcbac28f140aa7bd89d967bcc7fa31cb03a267 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 16:28:30 2022 +1100 Improves bounding box interactions - Bounding box can now be moved by dragging any of its edges - Bounding box does not affect drawing if already drawing a stroke - Can lock bounding box to draw directly on the bounding box edges - Removes spacebar-hold behaviour due to technical issues commit d43bd4625d64a03d90de0458ad5fcacef211a8a6 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 15:10:49 2022 +1100 Fixes hotkeys and settings buttons not working commit ea891324a2086faf8eeeeac7eaf47ae2935322fb Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 11:04:02 2022 +1100 Changes inpainting controls settings to hover commit 8fd9ea219390493f392e690eadb23c4209a4ecfc Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 11:03:41 2022 +1100 Adds missing tooltips to site header commit fb026668563b3179805819a1630c654c9ce260d9 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 11:03:25 2022 +1100 Increases workarea split padding to 1rem commit f6f5c2731b0c37089c5d7382736f973e857df712 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 11:03:10 2022 +1100 Decreases gallery width on inpainting commit b4e3f771e0314e0a18ad5cedc80b28f246fced59 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 10:54:59 2022 +1100 Fixes bugs/styling - Fixes missing web app state on new version: Adds stateReconciler to redux-persist. When we add more values to the state and then release the update app, they will be automatically merged in. Reseting web UI will be needed far less. 7159ec - Fixes console z-index - Moves reset web UI button to visible area commit 99bb9491ac97f1f733accab839ea38cdf4870ba0 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Tue Nov 1 08:35:45 2022 +1300 [WebUI] Loopback Default False commit 0453f211278a533a49fb1aee54dd989b69179c10 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 23:23:51 2022 +1300 Fresh Build For WebUI commit 9fc09aa4bda3b3e6139b026f24733a37747d373f Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 09:08:11 2022 +0100 don't log base64 progress images commit 5e87062cf809a08242d3b006b66d3bbb834ddb16 Author: spezialspezial <75758219+spezialspezial@users.noreply.github.com> Date: Wed Nov 2 00:21:27 2022 +0100 Option to directly invert the grayscale heatmap - fix commit 3e7a459990407ad1679f38d4027c19d50a9d36e3 Author: spezialspezial <75758219+spezialspezial@users.noreply.github.com> Date: Tue Nov 1 21:37:33 2022 +0100 Update txt2mask.py commit bbf4c03e500bafc8627c2a70f8b3396efeddabb3 Author: spezialspezial <75758219+spezialspezial@users.noreply.github.com> Date: Tue Nov 1 21:11:19 2022 +0100 Option to directly invert the grayscale heatmap Theoretically less work inverting the image while it's small but I can't measure a significant difference. Though, handy option to have in some cases. commit 611a3a975328a7e276c2781214d5e14108708ed7 Author: mauwii <Mauwii@outlook.de> Date: Wed Nov 2 02:23:09 2022 +0100 fix name of caching step commit 1611f0d1815022fe90d33f41c21d670251a75f29 Author: mauwii <Mauwii@outlook.de> Date: Wed Nov 2 02:18:46 2022 +0100 readd caching of sd-models - this would remove the necesarrity of the secret availability in PRs commit 08835115e4c5c0ee3587ce07ab769a04d55cb3c5 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 22:10:12 2022 -0400 pin pytorch_lightning to 1.7.7, issue #1331 commit 2d84e28d329be282b51a4cbc22f7c200d80c8f0e Merge: 533fd04e ef17aae8 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 22:11:04 2022 -0400 Merge branch 'development' of github.com:invoke-ai/InvokeAI into development commit ef17aae8abe03fd87dc6f91b3c6d2fe03375f6c5 Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 00:39:48 2022 +0100 add damian0815 to contributors list commit 0cc39f01a3c67f32873b7888e1e032d33626e269 Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 01:18:50 2022 +0100 report full size for fast latents and update conversion matrix for v1.5 commit 688d7258f185035a5924bee23322b001574da931 Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 00:33:00 2022 +0100 fix a bug that broke cross attention control index mapping commit 4513320bf161d3efdd99e2aef4f7c37472131373 Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 00:31:58 2022 +0100 save VRAM by not recombining tensors that have been sliced to save VRAM commit 533fd04ef0d1ba9d2cb25d556991b999e7d44aba Merge: 6215592b dff5681c Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 17:40:36 2022 -0400 Merge branch 'development' of github.com:invoke-ai/InvokeAI into development commit dff5681cf0e24faf67d5eb5903203c4ea39f89bd Author: damian0815 <d@d.com> Date: Tue Nov 1 13:56:03 2022 +0100 shorter strings commit 5a2790a69b11e049d2507bc22eab7812915d867f Author: damian0815 <d@d.com> Date: Tue Nov 1 13:19:20 2022 +0100 convert progress display to a drop-down commit 7c5305ccbaf7926162536aa3a9e51dcdd8574d0d Author: damian0815 <d@d.com> Date: Tue Nov 1 12:54:46 2022 +0100 do not try to save base64 intermediates in gallery on cancellation commit 4013e8ad6fa5e5c2a710c607fe7e1d040f353299 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 21:54:35 2022 +1100 Fixes b64 image sending and displaying commit d1dfd257f9e1cafd352d9007a56194226b9d6b63 Author: damian <d@d.com> Date: Tue Nov 1 11:40:40 2022 +0100 wip base64 commit 5322d735ee4515d89293b7fb015b2ce048262f68 Author: damian <d@d.com> Date: Tue Nov 1 11:31:42 2022 +0100 update frontend commit cdb107dcda858a8bb64455cc60a196a42345f8f7 Author: damian <d@d.com> Date: Tue Nov 1 11:17:43 2022 +0100 add option to show intermediate latent space commit be1393a41ce7a75ed8de7f648a93c5e5974a50d2 Author: damian <d@d.com> Date: Tue Nov 1 10:16:55 2022 +0100 ensure existing exception handling code also handles new exception class commit e554c2607f00a5e51c03052acb9861ff21ec1c12 Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Tue Nov 1 10:08:42 2022 +0100 Rebuilt prompt parsing logic Complete re-write of the prompt parsing logic to be more readable and logical, and therefore also hopefully easier to debug, maintain, and augment. In the process it has also become more robust to badly-formed prompts. Squashed commit of the following: commit 8fcfa88a16e1390d41717e940d72aed64712171c Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Sun Oct 30 17:05:57 2022 +0100 further cleanup commit 1a1fd78bcfeb49d072e3e6d5808aa8df15441629 Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Sun Oct 30 16:07:57 2022 +0100 cleanup and document commit 099c9659fa8b8135876f9a5a50fe80b20bc0635c Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Sun Oct 30 15:54:58 2022 +0100 works fully commit 5e6887ea8c25a1e21438ff6defb381fd027d25fd Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Sun Oct 30 15:24:31 2022 +0100 further... commit 492fda120844d9bc1ad4ec7dd408a3374762d0ff Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Sun Oct 30 14:08:57 2022 +0100 getting there... commit c6aab05a8450cc3c95c8691daf38fdc64c74f52d Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Fri Oct 28 14:29:03 2022 +0200 wip doesn't compile commit 5e533f731cfd20cd435330eeb0012e5689e87e81 Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Fri Oct 28 13:21:43 2022 +0200 working with CrossAttentionCtonrol but no Attention support yet commit 9678348773431e500e110e8aede99086bb7b5955 Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Fri Oct 28 13:04:52 2022 +0200 wip rebuiling prompt parser commit 6215592b12dea3822c727913b771012789a52477 Merge: ef24d76a 349cc254 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 17:34:55 2022 -0400 Merge branch 'development' of github.com:invoke-ai/InvokeAI into development commit 349cc25433e1d358c6c61cca4a6c300ecc8ca3d7 Author: damian0815 <d@d.com> Date: Tue Nov 1 20:08:52 2022 +0100 fix crash (be a little less aggressive clearing out the attention slice) commit 214d276379387ae0fa2259602ab00884ec1ad03e Author: damian0815 <d@d.com> Date: Tue Nov 1 19:57:55 2022 +0100 be more aggressive at clearing out saved_attn_slice commit ef24d76adc5a192297714707cd6794d4f44bcf67 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 14:34:23 2022 -0400 fix library problems in preload_modules commit ab2b5a691dadb292f7cecf5db94a165db3e3e126 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 17:22:48 2022 -0400 fix model_cache memory management issues commit c7de2b2801ad5d6ce52a5f44e88c5705f1dbf524 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 02:02:14 2022 +0100 disable checks with sd-V1.4 model... ...to save some resources, since V1.5 is the default now commit e8075658acf675346d35435d0cfb7710becab42a Author: mauwii <Mauwii@outlook.de> Date: Mon Oct 31 22:20:51 2022 +0100 update test-invoke-conda.yml - fix model dl path for sd-v1-4.ckpt - copy configs/models.yaml.example to configs/models.yaml commit 4202dabee1143f597f4c3946420fbfa7b8eccddf Author: mauwii <Mauwii@outlook.de> Date: Mon Oct 31 22:17:21 2022 +0100 fix models example weights for sd-v1.4 commit d67db2bcf1ac26d8bb7c5f8bfd056f2172597780 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Tue Nov 1 08:35:45 2022 +1300 [WebUI] Loopback Default False commit 7159ec885faa1117a3506689d547618be1d91808 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Mon Oct 31 11:33:05 2022 -0400 further improvements to preload_models.py - Faster startup for command line switch processing - Specify configuration file to modify using --config option: ./scripts/preload_models.ply --config models/my-models-file.yaml commit b5cf734ba9f1aeaab14075b55cc13ed9a0ae31e2 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Mon Oct 31 11:08:19 2022 -0400 improve behavior of preload_models.py - NEVER overwrite user's existing models.yaml - Instead, merge its contents into new config file, and rename original to models.yaml.orig (with message) - models.yaml has been removed from repository and renamed models.yaml.example commit f7dc8eafeef991e135b5541c01d0ff740dda9591 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Mon Oct 31 10:47:35 2022 -0400 restore models.yaml to virgin state commit 762ca60a309f70daaf1b9e79b6273f76fd9474b6 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Oct 4 22:55:10 2022 -0400 Update INPAINTING.md commit e7fb9f342cb5ed0c09e6215026d60d45eef3ebcb Author: Hideyuki Katsushiro <h.katsushiro@qualia.tokyo.jp> Date: Wed Oct 5 10:08:53 2022 +0900 add argument --outdir
2022-11-12 17:17:07 +00:00
self.outdir = outdir
self.gfpgan = gfpgan
self.codeformer = codeformer
self.esrgan = esrgan
self.free_gpu_mem = free_gpu_mem
self.max_loaded_models = max_loaded_models,
enable fast switching between models in invoke.py - This PR enables two new commands in the invoke.py script !models -- list the available models and their cache status !switch <model> -- switch to the indicated model Example: invoke> !models laion400m not loaded Latent Diffusion LAION400M model stable-diffusion-1.4 active Stable Diffusion inference model version 1.4 waifu-1.3 cached Waifu anime model version 1.3 invoke> !switch waifu-1.3 >> Caching model stable-diffusion-1.4 in system RAM >> Retrieving model waifu-1.3 from system RAM cache The name and descriptions of the models are taken from `config/models.yaml`. A future enhancement to `model_cache.py` will be to enable new model stanzas to be added to the file programmatically. This will be useful for the WebGUI. More details: - Use fast switching algorithm described in PR #948 - Models are selected using their configuration stanza name given in models.yaml. - To avoid filling up CPU RAM with cached models, this PR implements an LRU cache that monitors available CPU RAM. - The caching code allows the minimum value of available RAM to be adjusted, but invoke.py does not currently have a command-line argument that allows you to set it. The minimum free RAM is arbitrarily set to 2 GB. - Add optional description field to configs/models.yaml Unrelated fixes: - Added ">>" to CompViz model loading messages in order to make user experience more consistent. - When generating an image greater than defaults, will only warn about possible VRAM filling the first time. - Fixed bug that was causing help message to be printed twice. This involved moving the import line for the web backend into the section where it is called. Coauthored by: @ArDiouscuros
2022-10-12 06:14:59 +00:00
self.size_matters = True # used to warn once about large image sizes and VRAM
self.txt2mask = None
self.safety_checker = None
self.karras_max = None
self.infill_method = None
# Note that in previous versions, there was an option to pass the
# device to Generate(). However the device was then ignored, so
# it wasn't actually doing anything. This logic could be reinstated.
device_type = choose_torch_device()
print(f'>> Using device_type {device_type}')
Refactoring simplet2i (#387) * start refactoring -not yet functional * first phase of refactor done - not sure weighted prompts working * Second phase of refactoring. Everything mostly working. * The refactoring has moved all the hard-core inference work into ldm.dream.generator.*, where there are submodules for txt2img and img2img. inpaint will go in there as well. * Some additional refactoring will be done soon, but relatively minor work. * fix -save_orig flag to actually work * add @neonsecret attention.py memory optimization * remove unneeded imports * move token logging into conditioning.py * add placeholder version of inpaint; porting in progress * fix crash in img2img * inpainting working; not tested on variations * fix crashes in img2img * ported attention.py memory optimization #117 from basujindal branch * added @torch_no_grad() decorators to img2img, txt2img, inpaint closures * Final commit prior to PR against development * fixup crash when generating intermediate images in web UI * rename ldm.simplet2i to ldm.generate * add backward-compatibility simplet2i shell with deprecation warning * add back in mps exception, addresses @vargol comment in #354 * replaced Conditioning class with exported functions * fix wrong type of with_variations attribute during intialization * changed "image_iterator()" to "get_make_image()" * raise NotImplementedError for calling get_make_image() in parent class * Update ldm/generate.py better error message Co-authored-by: Kevin Gibbons <bakkot@gmail.com> * minor stylistic fixes and assertion checks from code review * moved get_noise() method into img2img class * break get_noise() into two methods, one for txt2img and the other for img2img * inpainting works on non-square images now * make get_noise() an abstract method in base class * much improved inpainting Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
2022-09-06 00:40:10 +00:00
self.device = torch.device(device_type)
if full_precision:
if self.precision != 'auto':
raise ValueError('Remove --full_precision / -F if using --precision')
print('Please remove deprecated --full_precision / -F')
print('If auto config does not work you can use --precision=float32')
self.precision = 'float32'
if self.precision == 'auto':
self.precision = choose_precision(self.device)
Refactoring simplet2i (#387) * start refactoring -not yet functional * first phase of refactor done - not sure weighted prompts working * Second phase of refactoring. Everything mostly working. * The refactoring has moved all the hard-core inference work into ldm.dream.generator.*, where there are submodules for txt2img and img2img. inpaint will go in there as well. * Some additional refactoring will be done soon, but relatively minor work. * fix -save_orig flag to actually work * add @neonsecret attention.py memory optimization * remove unneeded imports * move token logging into conditioning.py * add placeholder version of inpaint; porting in progress * fix crash in img2img * inpainting working; not tested on variations * fix crashes in img2img * ported attention.py memory optimization #117 from basujindal branch * added @torch_no_grad() decorators to img2img, txt2img, inpaint closures * Final commit prior to PR against development * fixup crash when generating intermediate images in web UI * rename ldm.simplet2i to ldm.generate * add backward-compatibility simplet2i shell with deprecation warning * add back in mps exception, addresses @vargol comment in #354 * replaced Conditioning class with exported functions * fix wrong type of with_variations attribute during intialization * changed "image_iterator()" to "get_make_image()" * raise NotImplementedError for calling get_make_image() in parent class * Update ldm/generate.py better error message Co-authored-by: Kevin Gibbons <bakkot@gmail.com> * minor stylistic fixes and assertion checks from code review * moved get_noise() method into img2img class * break get_noise() into two methods, one for txt2img and the other for img2img * inpainting works on non-square images now * make get_noise() an abstract method in base class * much improved inpainting Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
2022-09-06 00:40:10 +00:00
enable fast switching between models in invoke.py - This PR enables two new commands in the invoke.py script !models -- list the available models and their cache status !switch <model> -- switch to the indicated model Example: invoke> !models laion400m not loaded Latent Diffusion LAION400M model stable-diffusion-1.4 active Stable Diffusion inference model version 1.4 waifu-1.3 cached Waifu anime model version 1.3 invoke> !switch waifu-1.3 >> Caching model stable-diffusion-1.4 in system RAM >> Retrieving model waifu-1.3 from system RAM cache The name and descriptions of the models are taken from `config/models.yaml`. A future enhancement to `model_cache.py` will be to enable new model stanzas to be added to the file programmatically. This will be useful for the WebGUI. More details: - Use fast switching algorithm described in PR #948 - Models are selected using their configuration stanza name given in models.yaml. - To avoid filling up CPU RAM with cached models, this PR implements an LRU cache that monitors available CPU RAM. - The caching code allows the minimum value of available RAM to be adjusted, but invoke.py does not currently have a command-line argument that allows you to set it. The minimum free RAM is arbitrarily set to 2 GB. - Add optional description field to configs/models.yaml Unrelated fixes: - Added ">>" to CompViz model loading messages in order to make user experience more consistent. - When generating an image greater than defaults, will only warn about possible VRAM filling the first time. - Fixed bug that was causing help message to be printed twice. This involved moving the import line for the web backend into the section where it is called. Coauthored by: @ArDiouscuros
2022-10-12 06:14:59 +00:00
# model caching system for fast switching
use 🧨diffusers model (#1583) * initial commit of DiffusionPipeline class * spike: proof of concept using diffusers for txt2img * doc: type hints for Generator * refactor(model_cache): factor out load_ckpt * model_cache: add ability to load a diffusers model pipeline and update associated things in Generate & Generator to not instantly fail when that happens * model_cache: fix model default image dimensions * txt2img: support switching diffusers schedulers * diffusers: let the scheduler do its scaling of the initial latents Remove IPNDM scheduler; it is not behaving. * web server: update image_progress callback for diffusers data * diffusers: restore prompt weighting feature * diffusers: fix set-sampler error following model switch * diffusers: use InvokeAIDiffuserComponent for conditioning * cross_attention_control: stub (no-op) implementations for diffusers * model_cache: let offload_model work with DiffusionPipeline, sorta. * models.yaml.example: add diffusers-format model, set as default * test-invoke-conda: use diffusers-format model test-invoke-conda: put huggingface-token where the library can use it * environment-mac: upgrade to diffusers 0.7 (from 0.6) this was already done for linux; mac must have been lost in the merge. * preload_models: explicitly load diffusers models In non-interactive mode too, as long as you're logged in. * fix(model_cache): don't check `model.config` in diffusers format clean-up from recent merge. * diffusers integration: support img2img * dev: upgrade to diffusers 0.8 (from 0.7.1) We get to remove some code by using methods that were factored out in the base class. * refactor: remove backported img2img.get_timesteps now that we can use it directly from diffusers 0.8.1 * ci: use diffusers model * dev: upgrade to diffusers 0.9 (from 0.8.1) * lint: correct annotations for Python 3.9. * lint: correct AttributeError.name reference for Python 3.9. * CI: prefer diffusers-1.4 because it no longer requires a token The RunwayML models still do. * build: there's yet another place to update requirements? * configure: try to download models even without token Models in the CompVis and stabilityai repos no longer require them. (But runwayml still does.) * configure: add troubleshooting info for config-not-found * fix(configure): prepend root to config path * fix(configure): remove second `default: true` from models example * CI: simplify test-on-push logic now that we don't need secrets The "test on push but only in forks" logic was only necessary when tests didn't work for PRs-from-forks. * create an embedding_manager for diffusers * internal: avoid importing diffusers DummyObject see https://github.com/huggingface/diffusers/issues/1479 * fix "config attributes…not expected" diffusers warnings. * fix deprecated scheduler construction * work around an apparent MPS torch bug that causes conditioning to have no effect * 🚧 post-rebase repair * preliminary support for outpainting (no masking yet) * monkey-patch diffusers.attention and use Invoke lowvram code * add always_use_cpu arg to bypass MPS * add cross-attention control support to diffusers (fails on MPS) For unknown reasons MPS produces garbage output with .swap(). Use --always_use_cpu arg to invoke.py for now to test this code on MPS. * diffusers support for the inpainting model * fix debug_image to not crash with non-RGB images. * inpainting for the normal model [WIP] This seems to be performing well until the LAST STEP, at which point it dissolves to confetti. * fix off-by-one bug in cross-attention-control (#1774) prompt token sequences begin with a "beginning-of-sequence" marker <bos> and end with a repeated "end-of-sequence" marker <eos> - to make a default prompt length of <bos> + 75 prompt tokens + <eos>. the .swap() code was failing to take the column for <bos> at index 0 into account. the changes here do that, and also add extra handling for a single <eos> (which may be redundant but which is included for completeness). based on my understanding and some assumptions about how this all works, the reason .swap() nevertheless seemed to do the right thing, to some extent, is because over multiple steps the conditioning process in Stable Diffusion operates as a feedback loop. a change to token n-1 has flow-on effects to how the [1x4x64x64] latent tensor is modified by all the tokens after it, - and as the next step is processed, all the tokens before it as well. intuitively, a token's conditioning effects "echo" throughout the whole length of the prompt. so even though the token at n-1 was being edited when what the user actually wanted was to edit the token at n, it nevertheless still had some non-negligible effect, in roughly the right direction, often enough that it seemed like it was working properly. * refactor common CrossAttention stuff into a mixin so that the old ldm code can still work if necessary * inpainting for the normal model. I think it works this time. * diffusers: reset num_vectors_per_token sync with 44a00555718f1df173c60da0ed646cf700e29537 * diffusers: txt2img2img (hires_fix) with so much slicing and dicing of pipeline methods to stitch them together * refactor(diffusers): reduce some code duplication amongst the different tasks * fixup! refactor(diffusers): reduce some code duplication amongst the different tasks * diffusers: enable DPMSolver++ scheduler * diffusers: upgrade to diffusers 0.10, add Heun scheduler * diffusers(ModelCache): stopgap to make from_cpu compatible with diffusers * CI: default to diffusers-1.5 now that runwayml token requirement is gone * diffusers: update to 0.10 (and transformers to 4.25) * diffusers: use xformers when available diffusers no longer auto-enables this as of 0.10.2. * diffusers: make masked img2img behave better with multi-step schedulers re-randomizing the noise each step was confusing them. * diffusers: work more better with more models. fixed relative path problem with local models. fixed models on hub not always having a `fp16` branch. * diffusers: stopgap fix for attention_maps_callback crash after recent merge * fixup import merge conflicts correction for 061c5369a2247c6c92cd69606bcf54c4f1962a0b * test: add tests/inpainting inputs for masked img2img * diffusers(AddsMaskedGuidance): partial fix for k-schedulers Prevents them from crashing, but results are still hot garbage. * fix --safety_checker arg parsing and add note to diffusers loader about where safety checker gets called * generate: fix import error * CI: don't try to read the old init location * diffusers: support loading an alternate VAE * CI: remove sh-syntax if-statement so it doesn't crash powershell * CI: fold strings in yaml because backslash is not line-continuation in powershell * attention maps callback stuff for diffusers * build: fix syntax error in environment-mac * diffusers: add INITIAL_MODELS with diffusers-compatible repos * re-enable the embedding manager; closes #1778 * Squashed commit of the following: commit e4a956abc37fcb5cf188388b76b617bc5c8fda7d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:43:07 2022 +0100 import new load handling from EmbeddingManager and cleanup commit c4abe91a5ba0d415b45bf734068385668b7a66e6 Merge: 032e856e 1efc6397 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:09:53 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers_with_textual_inversion_manager commit 032e856eefb3bbc39534f5daafd25764bcfcef8b Merge: 8b4f0fe9 bc515e24 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:08:01 2022 +0100 Merge remote-tracking branch 'upstream/dev/diffusers' into dev/diffusers_with_textual_inversion_manager commit 1efc6397fc6e61c1aff4b0258b93089d61de5955 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:04:28 2022 +0100 cleanup and add performance notes commit e400f804ac471a0ca2ba432fd658778b20c7bdab Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:45:07 2022 +0100 fix bug and update unit tests commit deb9ae0ae1016750e93ce8275734061f7285a231 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:28:29 2022 +0100 textual inversion manager seems to work commit 162e02505dec777e91a983c4d0fb52e950d25ff0 Merge: cbad4583 12769b3d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:58:03 2022 +0100 Merge branch 'main' into feature_textual_inversion_mgr commit cbad45836c6aace6871a90f2621a953f49433131 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:54:10 2022 +0100 use position embeddings commit 070344c69b0e0db340a183857d0a787b348681d3 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:53:47 2022 +0100 Don't crash CLI on exceptions commit b035ac8c6772dfd9ba41b8eeb9103181cda028f8 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:11:55 2022 +0100 add missing position_embeddings commit 12769b3d3562ef71e0f54946b532ad077e10043c Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:33:25 2022 +0100 debugging why it don't work commit bafb7215eabe1515ca5e8388fd3bb2f3ac5362cf Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:21:33 2022 +0100 debugging why it don't work commit 664a6e9e146b42d96703f0cc8baf8f5efec04ee1 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit 8b4f0fe9d6e4e2643b36dfa27864294785d7ba4e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit ffbe1ab11163ba712e353d89404e301d0e0c6cdf Merge: 6e4dad60 023df37e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:37:31 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers commit 023df37efffa67434f77def7fc3c9dfb29f699fd Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:36:54 2022 +0100 cleanup commit 05fac594eaf79d0058e3c48deee93df603f136c2 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:07:49 2022 +0100 tweak error checking commit 009f32ed39a7280997c3ffab112adadee0b44279 Author: damian <null@damianstewart.com> Date: Thu Dec 15 21:29:47 2022 +0100 unit tests passing for embeddings with vector length >1 commit beb1b08d9a98112ed2fe073580568e1a18698da3 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:39:09 2022 +0100 more explicit equality tests when overwriting commit 44d8a5a7c85cdabc9ce3a54fd0769a10597b3ca9 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:30:13 2022 +0100 wip textual inversion manager (unit tests passing for 1v embedding overwriting) commit 417c2b57d90924a839616bfb66804faab8039e4c Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 12:30:55 2022 +0100 wip textual inversion manager (unit tests passing for base stuff + padding) commit 2e80872e3b6f7fd7d8eb8928822bd824b63cb2ff Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 10:57:57 2022 +0100 wip new TextualInversionManager * stop using WeightedFrozenCLIPEmbedder * store diffusion models locally - configure_invokeai.py reconfigured to store diffusion models rather than CompVis models - hugging face caching model is used, but cache is set to ~/invokeai/models/repo_id - models.yaml does **NOT** use path, just repo_id - "repo_name" changed to "repo_id" to following hugging face conventions - Models are loaded with full precision pending further work. * allow non-local files during development * path takes priority over repo_id * MVP for model_cache and configure_invokeai - Feature complete (almost) - configure_invokeai.py downloads both .ckpt and diffuser models, along with their VAEs. Both types of download are controlled by a unified INITIAL_MODELS.yaml file. - model_cache can load both type of model and switches back and forth in CPU. No memory leaks detected TO DO: 1. I have not yet turned on the LocalOnly flag for diffuser models, so the code will check the Hugging Face repo for updates before using the locally cached models. This will break firewalled systems. I am thinking of putting in a global check for internet connectivity at startup time and setting the LocalOnly flag based on this. It would be good to check updates if there is connectivity. 2. I have not gone completely through INITIAL_MODELS.yaml to check which models are available as diffusers and which are not. So models like PaperCut and VoxelArt may not load properly. The runway and stability models are checked, as well as the Trinart models. 3. Add stanzas for SD 2.0 and 2.1 in INITIAL_MODELS.yaml REMAINING PROBLEMS NOT DIRECTLY RELATED TO MODEL_CACHE: 1. When loading a .ckpt file there are lots of messages like this: Warning! ldm.modules.attention.CrossAttention is no longer being maintained. Please use InvokeAICrossAttention instead. I'm not sure how to address this. 2. The ckpt models ***don't actually run*** due to the lack of special-case support for them in the generator objects. For example, here's the hard crash you get when you run txt2img against the legacy waifu-diffusion-1.3 model: ``` >> An error occurred: Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 140, in main main_loop(gen, opt) File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 371, in main_loop gen.prompt2image( File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1265, in __getattr__ raise AttributeError("'{}' object has no attribute '{}'".format( AttributeError: 'LatentDiffusion' object has no attribute 'image_from_embeddings' ``` 3. The inpainting diffusion model isn't working. Here's the output of "banana sushi" when inpainting-1.5 is loaded: ``` Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 301, in image_from_embeddings result_latents, result_attention_map_saver = self.latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 330, in latents_from_embeddings result: PipelineIntermediateState = infer_latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 185, in __call__ for result in self.generator_method(*args, **kwargs): File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 367, in generate_latents_from_embeddings step_output = self.step(batched_t, latents, guidance_scale, File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context return func(*args, **kwargs) File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 409, in step step_output = self.scheduler.step(noise_pred, timestep, latents, **extra_step_kwargs) File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/diffusers/schedulers/scheduling_lms_discrete.py", line 223, in step pred_original_sample = sample - sigma * model_output RuntimeError: The size of tensor a (9) must match the size of tensor b (4) at non-singleton dimension 1 ``` * proper support for float32/float16 - configure script now correctly detects user's preference for fp16/32 and downloads the correct diffuser version. If fp16 version not available, falls back to fp32 version. - misc code cleanup and simplification in model_cache * add on-the-fly conversion of .ckpt to diffusers models 1. On-the-fly conversion code can be found in the file ldm/invoke/ckpt_to_diffusers.py. 2. A new !optimize command has been added to the CLI. Should be ported to Web GUI. User experience on the CLI is this: ``` invoke> !optimize /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt INFO: Converting legacy weights file /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt to optimized diffuser model. This operation will take 30-60s to complete. Success. Optimized model is now located at /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 Writing new config file entry for sd-v1-4... >> New configuration: sd-v1-4: description: Optimized version of sd-v1-4 format: diffusers path: /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 OK to import [n]? y >> Verifying that new model loads... >> Current VRAM usage: 2.60G >> Offloading stable-diffusion-2.1 to CPU >> Loading diffusers model from /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 | Using faster float16 precision You have disabled the safety checker for <class 'ldm.invoke.generator.diffusers_pipeline.StableDiffusionGeneratorPipeline'> by passing `safety_checker=None`. Ensure that you abide to the conditions of the Stable Diffusion \ license and do not expose unfiltered results in services or applications open to the public. Both the diffusers team and Hugging Face strongly recommend to keep the safety filter enabled in all public facing circumstances,\ disabling it only for use-cases that involve analyzing network behavior or auditing its results. For more information, please have a look at https://github.com/huggingface/diffusers/pull/254 . | training width x height = (512 x 512) >> Model loaded in 3.48s >> Max VRAM used to load the model: 2.17G >> Current VRAM usage:2.17G >> Textual inversions available: >> Setting Sampler to k_lms (LMSDiscreteScheduler) Keep model loaded? [y] ``` * add parallel set of generator files for ckpt legacy generation * generation using legacy ckpt models now working * diffusers: fix missing attention_maps_callback fix for 23eb80b40421b2bb8f4b6d3dd30490d11c447b36 * associate legacy CrossAttention with .ckpt models * enable autoconvert New --autoconvert CLI option will scan a designated directory for new .ckpt files, convert them into diffuser models, and import them into models.yaml. Works like this: invoke.py --autoconvert /path/to/weights/directory In ModelCache added two new methods: autoconvert_weights(config_path, weights_directory_path, models_directory_path) convert_and_import(ckpt_path, diffuser_path) * diffusers: update to diffusers 0.11 (from 0.10.2) * fix vae loading & width/height calculation * refactor: encapsulate these conditioning data into one container * diffusers: fix some noise-scaling issues by pushing the noise-mixing down to the common function * add support for safetensors and accelerate * set local_files_only when internet unreachable * diffusers: fix error-handling path when model repo has no fp16 branch * fix generatorinpaint error Fixes : "ModuleNotFoundError: No module named 'ldm.invoke.generatorinpaint' https://github.com/invoke-ai/InvokeAI/pull/1583#issuecomment-1363634318 * quench diffuser safety-checker warning * diffusers: support stochastic DDIM eta parameter * fix conda env creation on macos * fix cross-attention with diffusers 0.11 * diffusers: the VAE needs to be tiling as well as the U-Net * diffusers: comment on subfolders * diffusers: embiggen! * diffusers: make model_cache.list_models serializable * diffusers(inpaint): restore scaling functionality * fix requirements clash between numba and numpy 1.24 * diffusers: allow inpainting model to do non-inpainting tasks * start expanding model_cache functionality * add import_ckpt_model() and import_diffuser_model() methods to model_manager - in addition, model_cache.py is now renamed to model_manager.py * allow "recommended" flag to be optional in INITIAL_MODELS.yaml * configure_invokeai now downloads VAE diffusers in advance * rename ModelCache to ModelManager * remove support for `repo_name` in models.yaml * check for and refuse to load embeddings trained on incompatible models * models.yaml.example: s/repo_name/repo_id and remove extra INITIAL_MODELS now that the main one has diffusers models in it. * add MVP textual inversion script * refactor(InvokeAIDiffuserComponent): factor out _combine() * InvokeAIDiffuserComponent: implement threshold * InvokeAIDiffuserComponent: diagnostic logs for threshold ...this does not look right * add a curses-based frontend to textual inversion - not quite working yet - requires npyscreen installed - on windows will also have the windows-curses requirement, but not added to requirements yet * add curses-based interface for textual inversion * fix crash in convert_and_import() - This corrects a "local variable referenced before assignment" error in model_manager.convert_and_import() * potential workaround for no 'state_dict' key error - As reported in https://github.com/huggingface/diffusers/issues/1876 * create TI output dir if needed * Update environment-lin-cuda.yml (#2159) Fixing line 42 to be the proper order to define the transformers requirement: ~= instead of =~ * diffusers: update sampler-to-scheduler mapping based on https://github.com/huggingface/diffusers/issues/277#issuecomment-1371428672 * improve user exp for ckt to diffusers conversion - !optimize_models command now operates on an existing ckpt file entry in models.yaml - replaces existing entry, rather than adding a new one - offers to delete the ckpt file after conversion * web: adapt progress callback to deal with old generator or new diffusers pipeline * clean-up model_manager code - add_model() verified to work for .ckpt local paths, .ckpt remote URLs, diffusers local paths, and diffusers repo_ids - convert_and_import() verified to work for local and remove .ckpt files * handle edge cases for import_model() and convert_model() * add support for safetensor .ckpt files * fix name error * code cleanup with pyflake * improve model setting behavior - If the user enters an invalid model name at startup time, will not try to load it, warn, and use default model - CLI UI enhancement: include currently active model in the command line prompt. * update test-invoke-pip.yml - fix model cache path to point to runwayml/stable-diffusion-v1-5 - remove `skip-sd-weights` from configure_invokeai.py args * exclude dev/diffusers from "fail for draft PRs" * disable "fail on PR jobs" * re-add `--skip-sd-weights` since no space * update workflow environments - include `INVOKE_MODEL_RECONFIGURE: '--yes'` * clean up model load failure handling - Allow CLI to run even when no model is defined or loadable. - Inhibit stack trace when model load fails - only show last error - Give user *option* to run configure_invokeai.py when no models successfully load. - Restart invokeai after reconfiguration. * further edge-case handling 1) only one model in models.yaml file, and that model is broken 2) no models in models.yaml 3) models.yaml doesn't exist at all * fix incorrect model status listing - "cached" was not being returned from list_models() - normalize handling of exceptions during model loading: - Passing an invalid model name to generate.set_model() will return a KeyError - All other exceptions are returned as the appropriate Exception * CI: do download weights (if not already cached) * diffusers: fix scheduler loading in offline mode * CI: fix model name (no longer has `diffusers-` prefix) * Update txt2img2img.py (#2256) * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * feat - make model storage compatible with hugging face caching system This commit alters the InvokeAI model directory to be compatible with hugging face, making it easier to share diffusers (and other models) across different programs. - If the HF_HOME environment variable is not set, then models are cached in ~/invokeai/models in a format that is identical to the HuggingFace cache. - If HF_HOME is set, then models are cached wherever HF_HOME points. - To enable sharing with other HuggingFace library clients, set HF_HOME to ~/.cache/huggingface to set the default cache location or to ~/invokeai/models to have huggingface cache inside InvokeAI. * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * fix error "no attribute CkptInpaint" * model_manager.list_models() returns entire model config stanza+status * Initial Draft - Model Manager Diffusers * added hash function to diffusers * implement sha256 hashes on diffusers models * Add Model Manager Support for Diffusers * fix various problems with model manager - in cli import functions, fix not enough values to unpack from _get_name_and_desc() - fix crash when using old-style vae: value with new-style diffuser * rebuild frontend * fix dictconfig-not-serializable issue * fix NoneType' object is not subscriptable crash in model_manager * fix "str has no attribute get" error in model_manager list_models() * Add path and repo_id support for Diffusers Model Manager Also fixes bugs * Fix tooltip IT localization not working * Add Version Number To WebUI * Optimize Model Search * Fix incorrect font on the Model Manager UI * Fix image degradation on merge fixes - [Experimental] This change should effectively fix a couple of things. - Fix image degradation on subsequent merges of the canvas layers. - Fix the slight transparent border that is left behind when filling the bounding box with a color. - Fix the left over line of color when filling a bounding box with color. So far there are no side effects for this. If any, please report. * Add local model filtering for Diffusers / Checkpoints * Go to home on modal close for the Add Modal UI * Styling Fixes * Model Manager Diffusers Localization Update * Add Safe Tensor scanning to Model Manager * Fix model edit form dispatching string values instead of numbers. * Resolve VAE handling / edge cases for supplied repos * defer injecting tokens for textual inversions until they're used for the first time * squash a console warning * implement model migration check * add_model() overwrites previous config rather than merges * fix model config file attribute merging * fix precision handling in textual inversion script * allow ckpt conversion script to work with safetensors .ckpts Applied patch here: https://github.com/huggingface/diffusers/commit/beb932c5d111872c5e45387e7b1b2b3dd0524a47 * fix name "args" is not defined crash in textual_inversion_training * fix a second NameError: name 'args' is not defined crash * fix loading of the safety checker from the global cache dir * add installation step to textual inversion frontend - After a successful training run, the script will copy learned_embeds.bin to a subfolder of the embeddings directory. - User given the option to delete the logs and intermediate checkpoints (which together use 7-8G of space) - If textual inversion training fails, reports the error gracefully. * don't crash out on incompatible embeddings - put try: blocks around places where the system tries to load an embedding which is incompatible with the currently loaded model * add support for checkpoint resuming * textual inversion preferences are saved and restored between sessions - Preferences are stored in a file named text-inversion-training/preferences.conf - Currently the resume-from-checkpoint option is not working correctly. Possible bug in textual_inversion_training.py? * copy learned_embeddings.bin into right location * add front end for diffusers model merging - Front end doesn't do anything yet!!!! - Made change to model name parsing in CLI to support ability to have merged models with the "+" character in their names. * improve inpainting experience - recommend ckpt version of inpainting-1.5 to user - fix get_noise() bug in ckpt version of omnibus.py * update environment*yml * tweak instructions to install HuggingFace token * bump version number * enhance update scripts - update scripts will now fetch new INITIAL_MODELS.yaml so that configure_invokeai.py will know about the diffusers versions. * enhance invoke.sh/invoke.bat launchers - added configure_invokeai.py to menu - menu defaults to browser-based invoke * remove conda workflow (#2321) * fix `token_ids has shape torch.Size([79]) - expected [77]` * update CHANGELOG.md with 2.3.* info - Add information on how formats have changed and the upgrade process. - Add short bug list. Co-authored-by: Damian Stewart <d@damianstewart.com> Co-authored-by: Damian Stewart <null@damianstewart.com> Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> Co-authored-by: Wybartel-luxmc <37852506+Wybartel-luxmc@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> Co-authored-by: mickr777 <115216705+mickr777@users.noreply.github.com> Co-authored-by: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Co-authored-by: Eugene Brodsky <ebr@users.noreply.github.com> Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com>
2023-01-15 14:22:46 +00:00
self.model_manager = ModelManager(mconfig,self.device,self.precision,max_loaded_models=max_loaded_models)
# don't accept invalid models
fallback = self.model_manager.default_model() or FALLBACK_MODEL_NAME
model = model or fallback
if not self.model_manager.valid_model(model):
print(f'** "{model}" is not a known model name; falling back to {fallback}.')
model = None
self.model_name = model or fallback
enable fast switching between models in invoke.py - This PR enables two new commands in the invoke.py script !models -- list the available models and their cache status !switch <model> -- switch to the indicated model Example: invoke> !models laion400m not loaded Latent Diffusion LAION400M model stable-diffusion-1.4 active Stable Diffusion inference model version 1.4 waifu-1.3 cached Waifu anime model version 1.3 invoke> !switch waifu-1.3 >> Caching model stable-diffusion-1.4 in system RAM >> Retrieving model waifu-1.3 from system RAM cache The name and descriptions of the models are taken from `config/models.yaml`. A future enhancement to `model_cache.py` will be to enable new model stanzas to be added to the file programmatically. This will be useful for the WebGUI. More details: - Use fast switching algorithm described in PR #948 - Models are selected using their configuration stanza name given in models.yaml. - To avoid filling up CPU RAM with cached models, this PR implements an LRU cache that monitors available CPU RAM. - The caching code allows the minimum value of available RAM to be adjusted, but invoke.py does not currently have a command-line argument that allows you to set it. The minimum free RAM is arbitrarily set to 2 GB. - Add optional description field to configs/models.yaml Unrelated fixes: - Added ">>" to CompViz model loading messages in order to make user experience more consistent. - When generating an image greater than defaults, will only warn about possible VRAM filling the first time. - Fixed bug that was causing help message to be printed twice. This involved moving the import line for the web backend into the section where it is called. Coauthored by: @ArDiouscuros
2022-10-12 06:14:59 +00:00
Refactoring simplet2i (#387) * start refactoring -not yet functional * first phase of refactor done - not sure weighted prompts working * Second phase of refactoring. Everything mostly working. * The refactoring has moved all the hard-core inference work into ldm.dream.generator.*, where there are submodules for txt2img and img2img. inpaint will go in there as well. * Some additional refactoring will be done soon, but relatively minor work. * fix -save_orig flag to actually work * add @neonsecret attention.py memory optimization * remove unneeded imports * move token logging into conditioning.py * add placeholder version of inpaint; porting in progress * fix crash in img2img * inpainting working; not tested on variations * fix crashes in img2img * ported attention.py memory optimization #117 from basujindal branch * added @torch_no_grad() decorators to img2img, txt2img, inpaint closures * Final commit prior to PR against development * fixup crash when generating intermediate images in web UI * rename ldm.simplet2i to ldm.generate * add backward-compatibility simplet2i shell with deprecation warning * add back in mps exception, addresses @vargol comment in #354 * replaced Conditioning class with exported functions * fix wrong type of with_variations attribute during intialization * changed "image_iterator()" to "get_make_image()" * raise NotImplementedError for calling get_make_image() in parent class * Update ldm/generate.py better error message Co-authored-by: Kevin Gibbons <bakkot@gmail.com> * minor stylistic fixes and assertion checks from code review * moved get_noise() method into img2img class * break get_noise() into two methods, one for txt2img and the other for img2img * inpainting works on non-square images now * make get_noise() an abstract method in base class * much improved inpainting Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
2022-09-06 00:40:10 +00:00
# for VRAM usage statistics
self.session_peakmem = torch.cuda.max_memory_allocated() if self._has_cuda else None
Refactoring simplet2i (#387) * start refactoring -not yet functional * first phase of refactor done - not sure weighted prompts working * Second phase of refactoring. Everything mostly working. * The refactoring has moved all the hard-core inference work into ldm.dream.generator.*, where there are submodules for txt2img and img2img. inpaint will go in there as well. * Some additional refactoring will be done soon, but relatively minor work. * fix -save_orig flag to actually work * add @neonsecret attention.py memory optimization * remove unneeded imports * move token logging into conditioning.py * add placeholder version of inpaint; porting in progress * fix crash in img2img * inpainting working; not tested on variations * fix crashes in img2img * ported attention.py memory optimization #117 from basujindal branch * added @torch_no_grad() decorators to img2img, txt2img, inpaint closures * Final commit prior to PR against development * fixup crash when generating intermediate images in web UI * rename ldm.simplet2i to ldm.generate * add backward-compatibility simplet2i shell with deprecation warning * add back in mps exception, addresses @vargol comment in #354 * replaced Conditioning class with exported functions * fix wrong type of with_variations attribute during intialization * changed "image_iterator()" to "get_make_image()" * raise NotImplementedError for calling get_make_image() in parent class * Update ldm/generate.py better error message Co-authored-by: Kevin Gibbons <bakkot@gmail.com> * minor stylistic fixes and assertion checks from code review * moved get_noise() method into img2img class * break get_noise() into two methods, one for txt2img and the other for img2img * inpainting works on non-square images now * make get_noise() an abstract method in base class * much improved inpainting Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
2022-09-06 00:40:10 +00:00
transformers.logging.set_verbosity_error()
# gets rid of annoying messages about random seed
logging.getLogger('pytorch_lightning').setLevel(logging.ERROR)
# load safety checker if requested
if safety_checker:
try:
print('>> Initializing safety checker')
from diffusers.pipelines.stable_diffusion.safety_checker import StableDiffusionSafetyChecker
from transformers import AutoFeatureExtractor
safety_model_id = "CompVis/stable-diffusion-safety-checker"
use 🧨diffusers model (#1583) * initial commit of DiffusionPipeline class * spike: proof of concept using diffusers for txt2img * doc: type hints for Generator * refactor(model_cache): factor out load_ckpt * model_cache: add ability to load a diffusers model pipeline and update associated things in Generate & Generator to not instantly fail when that happens * model_cache: fix model default image dimensions * txt2img: support switching diffusers schedulers * diffusers: let the scheduler do its scaling of the initial latents Remove IPNDM scheduler; it is not behaving. * web server: update image_progress callback for diffusers data * diffusers: restore prompt weighting feature * diffusers: fix set-sampler error following model switch * diffusers: use InvokeAIDiffuserComponent for conditioning * cross_attention_control: stub (no-op) implementations for diffusers * model_cache: let offload_model work with DiffusionPipeline, sorta. * models.yaml.example: add diffusers-format model, set as default * test-invoke-conda: use diffusers-format model test-invoke-conda: put huggingface-token where the library can use it * environment-mac: upgrade to diffusers 0.7 (from 0.6) this was already done for linux; mac must have been lost in the merge. * preload_models: explicitly load diffusers models In non-interactive mode too, as long as you're logged in. * fix(model_cache): don't check `model.config` in diffusers format clean-up from recent merge. * diffusers integration: support img2img * dev: upgrade to diffusers 0.8 (from 0.7.1) We get to remove some code by using methods that were factored out in the base class. * refactor: remove backported img2img.get_timesteps now that we can use it directly from diffusers 0.8.1 * ci: use diffusers model * dev: upgrade to diffusers 0.9 (from 0.8.1) * lint: correct annotations for Python 3.9. * lint: correct AttributeError.name reference for Python 3.9. * CI: prefer diffusers-1.4 because it no longer requires a token The RunwayML models still do. * build: there's yet another place to update requirements? * configure: try to download models even without token Models in the CompVis and stabilityai repos no longer require them. (But runwayml still does.) * configure: add troubleshooting info for config-not-found * fix(configure): prepend root to config path * fix(configure): remove second `default: true` from models example * CI: simplify test-on-push logic now that we don't need secrets The "test on push but only in forks" logic was only necessary when tests didn't work for PRs-from-forks. * create an embedding_manager for diffusers * internal: avoid importing diffusers DummyObject see https://github.com/huggingface/diffusers/issues/1479 * fix "config attributes…not expected" diffusers warnings. * fix deprecated scheduler construction * work around an apparent MPS torch bug that causes conditioning to have no effect * 🚧 post-rebase repair * preliminary support for outpainting (no masking yet) * monkey-patch diffusers.attention and use Invoke lowvram code * add always_use_cpu arg to bypass MPS * add cross-attention control support to diffusers (fails on MPS) For unknown reasons MPS produces garbage output with .swap(). Use --always_use_cpu arg to invoke.py for now to test this code on MPS. * diffusers support for the inpainting model * fix debug_image to not crash with non-RGB images. * inpainting for the normal model [WIP] This seems to be performing well until the LAST STEP, at which point it dissolves to confetti. * fix off-by-one bug in cross-attention-control (#1774) prompt token sequences begin with a "beginning-of-sequence" marker <bos> and end with a repeated "end-of-sequence" marker <eos> - to make a default prompt length of <bos> + 75 prompt tokens + <eos>. the .swap() code was failing to take the column for <bos> at index 0 into account. the changes here do that, and also add extra handling for a single <eos> (which may be redundant but which is included for completeness). based on my understanding and some assumptions about how this all works, the reason .swap() nevertheless seemed to do the right thing, to some extent, is because over multiple steps the conditioning process in Stable Diffusion operates as a feedback loop. a change to token n-1 has flow-on effects to how the [1x4x64x64] latent tensor is modified by all the tokens after it, - and as the next step is processed, all the tokens before it as well. intuitively, a token's conditioning effects "echo" throughout the whole length of the prompt. so even though the token at n-1 was being edited when what the user actually wanted was to edit the token at n, it nevertheless still had some non-negligible effect, in roughly the right direction, often enough that it seemed like it was working properly. * refactor common CrossAttention stuff into a mixin so that the old ldm code can still work if necessary * inpainting for the normal model. I think it works this time. * diffusers: reset num_vectors_per_token sync with 44a00555718f1df173c60da0ed646cf700e29537 * diffusers: txt2img2img (hires_fix) with so much slicing and dicing of pipeline methods to stitch them together * refactor(diffusers): reduce some code duplication amongst the different tasks * fixup! refactor(diffusers): reduce some code duplication amongst the different tasks * diffusers: enable DPMSolver++ scheduler * diffusers: upgrade to diffusers 0.10, add Heun scheduler * diffusers(ModelCache): stopgap to make from_cpu compatible with diffusers * CI: default to diffusers-1.5 now that runwayml token requirement is gone * diffusers: update to 0.10 (and transformers to 4.25) * diffusers: use xformers when available diffusers no longer auto-enables this as of 0.10.2. * diffusers: make masked img2img behave better with multi-step schedulers re-randomizing the noise each step was confusing them. * diffusers: work more better with more models. fixed relative path problem with local models. fixed models on hub not always having a `fp16` branch. * diffusers: stopgap fix for attention_maps_callback crash after recent merge * fixup import merge conflicts correction for 061c5369a2247c6c92cd69606bcf54c4f1962a0b * test: add tests/inpainting inputs for masked img2img * diffusers(AddsMaskedGuidance): partial fix for k-schedulers Prevents them from crashing, but results are still hot garbage. * fix --safety_checker arg parsing and add note to diffusers loader about where safety checker gets called * generate: fix import error * CI: don't try to read the old init location * diffusers: support loading an alternate VAE * CI: remove sh-syntax if-statement so it doesn't crash powershell * CI: fold strings in yaml because backslash is not line-continuation in powershell * attention maps callback stuff for diffusers * build: fix syntax error in environment-mac * diffusers: add INITIAL_MODELS with diffusers-compatible repos * re-enable the embedding manager; closes #1778 * Squashed commit of the following: commit e4a956abc37fcb5cf188388b76b617bc5c8fda7d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:43:07 2022 +0100 import new load handling from EmbeddingManager and cleanup commit c4abe91a5ba0d415b45bf734068385668b7a66e6 Merge: 032e856e 1efc6397 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:09:53 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers_with_textual_inversion_manager commit 032e856eefb3bbc39534f5daafd25764bcfcef8b Merge: 8b4f0fe9 bc515e24 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:08:01 2022 +0100 Merge remote-tracking branch 'upstream/dev/diffusers' into dev/diffusers_with_textual_inversion_manager commit 1efc6397fc6e61c1aff4b0258b93089d61de5955 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:04:28 2022 +0100 cleanup and add performance notes commit e400f804ac471a0ca2ba432fd658778b20c7bdab Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:45:07 2022 +0100 fix bug and update unit tests commit deb9ae0ae1016750e93ce8275734061f7285a231 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:28:29 2022 +0100 textual inversion manager seems to work commit 162e02505dec777e91a983c4d0fb52e950d25ff0 Merge: cbad4583 12769b3d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:58:03 2022 +0100 Merge branch 'main' into feature_textual_inversion_mgr commit cbad45836c6aace6871a90f2621a953f49433131 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:54:10 2022 +0100 use position embeddings commit 070344c69b0e0db340a183857d0a787b348681d3 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:53:47 2022 +0100 Don't crash CLI on exceptions commit b035ac8c6772dfd9ba41b8eeb9103181cda028f8 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:11:55 2022 +0100 add missing position_embeddings commit 12769b3d3562ef71e0f54946b532ad077e10043c Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:33:25 2022 +0100 debugging why it don't work commit bafb7215eabe1515ca5e8388fd3bb2f3ac5362cf Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:21:33 2022 +0100 debugging why it don't work commit 664a6e9e146b42d96703f0cc8baf8f5efec04ee1 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit 8b4f0fe9d6e4e2643b36dfa27864294785d7ba4e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit ffbe1ab11163ba712e353d89404e301d0e0c6cdf Merge: 6e4dad60 023df37e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:37:31 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers commit 023df37efffa67434f77def7fc3c9dfb29f699fd Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:36:54 2022 +0100 cleanup commit 05fac594eaf79d0058e3c48deee93df603f136c2 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:07:49 2022 +0100 tweak error checking commit 009f32ed39a7280997c3ffab112adadee0b44279 Author: damian <null@damianstewart.com> Date: Thu Dec 15 21:29:47 2022 +0100 unit tests passing for embeddings with vector length >1 commit beb1b08d9a98112ed2fe073580568e1a18698da3 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:39:09 2022 +0100 more explicit equality tests when overwriting commit 44d8a5a7c85cdabc9ce3a54fd0769a10597b3ca9 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:30:13 2022 +0100 wip textual inversion manager (unit tests passing for 1v embedding overwriting) commit 417c2b57d90924a839616bfb66804faab8039e4c Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 12:30:55 2022 +0100 wip textual inversion manager (unit tests passing for base stuff + padding) commit 2e80872e3b6f7fd7d8eb8928822bd824b63cb2ff Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 10:57:57 2022 +0100 wip new TextualInversionManager * stop using WeightedFrozenCLIPEmbedder * store diffusion models locally - configure_invokeai.py reconfigured to store diffusion models rather than CompVis models - hugging face caching model is used, but cache is set to ~/invokeai/models/repo_id - models.yaml does **NOT** use path, just repo_id - "repo_name" changed to "repo_id" to following hugging face conventions - Models are loaded with full precision pending further work. * allow non-local files during development * path takes priority over repo_id * MVP for model_cache and configure_invokeai - Feature complete (almost) - configure_invokeai.py downloads both .ckpt and diffuser models, along with their VAEs. Both types of download are controlled by a unified INITIAL_MODELS.yaml file. - model_cache can load both type of model and switches back and forth in CPU. No memory leaks detected TO DO: 1. I have not yet turned on the LocalOnly flag for diffuser models, so the code will check the Hugging Face repo for updates before using the locally cached models. This will break firewalled systems. I am thinking of putting in a global check for internet connectivity at startup time and setting the LocalOnly flag based on this. It would be good to check updates if there is connectivity. 2. I have not gone completely through INITIAL_MODELS.yaml to check which models are available as diffusers and which are not. So models like PaperCut and VoxelArt may not load properly. The runway and stability models are checked, as well as the Trinart models. 3. Add stanzas for SD 2.0 and 2.1 in INITIAL_MODELS.yaml REMAINING PROBLEMS NOT DIRECTLY RELATED TO MODEL_CACHE: 1. When loading a .ckpt file there are lots of messages like this: Warning! ldm.modules.attention.CrossAttention is no longer being maintained. Please use InvokeAICrossAttention instead. I'm not sure how to address this. 2. The ckpt models ***don't actually run*** due to the lack of special-case support for them in the generator objects. For example, here's the hard crash you get when you run txt2img against the legacy waifu-diffusion-1.3 model: ``` >> An error occurred: Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 140, in main main_loop(gen, opt) File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 371, in main_loop gen.prompt2image( File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1265, in __getattr__ raise AttributeError("'{}' object has no attribute '{}'".format( AttributeError: 'LatentDiffusion' object has no attribute 'image_from_embeddings' ``` 3. The inpainting diffusion model isn't working. Here's the output of "banana sushi" when inpainting-1.5 is loaded: ``` Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 301, in image_from_embeddings result_latents, result_attention_map_saver = self.latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 330, in latents_from_embeddings result: PipelineIntermediateState = infer_latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 185, in __call__ for result in self.generator_method(*args, **kwargs): File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 367, in generate_latents_from_embeddings step_output = self.step(batched_t, latents, guidance_scale, File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context return func(*args, **kwargs) File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 409, in step step_output = self.scheduler.step(noise_pred, timestep, latents, **extra_step_kwargs) File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/diffusers/schedulers/scheduling_lms_discrete.py", line 223, in step pred_original_sample = sample - sigma * model_output RuntimeError: The size of tensor a (9) must match the size of tensor b (4) at non-singleton dimension 1 ``` * proper support for float32/float16 - configure script now correctly detects user's preference for fp16/32 and downloads the correct diffuser version. If fp16 version not available, falls back to fp32 version. - misc code cleanup and simplification in model_cache * add on-the-fly conversion of .ckpt to diffusers models 1. On-the-fly conversion code can be found in the file ldm/invoke/ckpt_to_diffusers.py. 2. A new !optimize command has been added to the CLI. Should be ported to Web GUI. User experience on the CLI is this: ``` invoke> !optimize /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt INFO: Converting legacy weights file /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt to optimized diffuser model. This operation will take 30-60s to complete. Success. Optimized model is now located at /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 Writing new config file entry for sd-v1-4... >> New configuration: sd-v1-4: description: Optimized version of sd-v1-4 format: diffusers path: /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 OK to import [n]? y >> Verifying that new model loads... >> Current VRAM usage: 2.60G >> Offloading stable-diffusion-2.1 to CPU >> Loading diffusers model from /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 | Using faster float16 precision You have disabled the safety checker for <class 'ldm.invoke.generator.diffusers_pipeline.StableDiffusionGeneratorPipeline'> by passing `safety_checker=None`. Ensure that you abide to the conditions of the Stable Diffusion \ license and do not expose unfiltered results in services or applications open to the public. Both the diffusers team and Hugging Face strongly recommend to keep the safety filter enabled in all public facing circumstances,\ disabling it only for use-cases that involve analyzing network behavior or auditing its results. For more information, please have a look at https://github.com/huggingface/diffusers/pull/254 . | training width x height = (512 x 512) >> Model loaded in 3.48s >> Max VRAM used to load the model: 2.17G >> Current VRAM usage:2.17G >> Textual inversions available: >> Setting Sampler to k_lms (LMSDiscreteScheduler) Keep model loaded? [y] ``` * add parallel set of generator files for ckpt legacy generation * generation using legacy ckpt models now working * diffusers: fix missing attention_maps_callback fix for 23eb80b40421b2bb8f4b6d3dd30490d11c447b36 * associate legacy CrossAttention with .ckpt models * enable autoconvert New --autoconvert CLI option will scan a designated directory for new .ckpt files, convert them into diffuser models, and import them into models.yaml. Works like this: invoke.py --autoconvert /path/to/weights/directory In ModelCache added two new methods: autoconvert_weights(config_path, weights_directory_path, models_directory_path) convert_and_import(ckpt_path, diffuser_path) * diffusers: update to diffusers 0.11 (from 0.10.2) * fix vae loading & width/height calculation * refactor: encapsulate these conditioning data into one container * diffusers: fix some noise-scaling issues by pushing the noise-mixing down to the common function * add support for safetensors and accelerate * set local_files_only when internet unreachable * diffusers: fix error-handling path when model repo has no fp16 branch * fix generatorinpaint error Fixes : "ModuleNotFoundError: No module named 'ldm.invoke.generatorinpaint' https://github.com/invoke-ai/InvokeAI/pull/1583#issuecomment-1363634318 * quench diffuser safety-checker warning * diffusers: support stochastic DDIM eta parameter * fix conda env creation on macos * fix cross-attention with diffusers 0.11 * diffusers: the VAE needs to be tiling as well as the U-Net * diffusers: comment on subfolders * diffusers: embiggen! * diffusers: make model_cache.list_models serializable * diffusers(inpaint): restore scaling functionality * fix requirements clash between numba and numpy 1.24 * diffusers: allow inpainting model to do non-inpainting tasks * start expanding model_cache functionality * add import_ckpt_model() and import_diffuser_model() methods to model_manager - in addition, model_cache.py is now renamed to model_manager.py * allow "recommended" flag to be optional in INITIAL_MODELS.yaml * configure_invokeai now downloads VAE diffusers in advance * rename ModelCache to ModelManager * remove support for `repo_name` in models.yaml * check for and refuse to load embeddings trained on incompatible models * models.yaml.example: s/repo_name/repo_id and remove extra INITIAL_MODELS now that the main one has diffusers models in it. * add MVP textual inversion script * refactor(InvokeAIDiffuserComponent): factor out _combine() * InvokeAIDiffuserComponent: implement threshold * InvokeAIDiffuserComponent: diagnostic logs for threshold ...this does not look right * add a curses-based frontend to textual inversion - not quite working yet - requires npyscreen installed - on windows will also have the windows-curses requirement, but not added to requirements yet * add curses-based interface for textual inversion * fix crash in convert_and_import() - This corrects a "local variable referenced before assignment" error in model_manager.convert_and_import() * potential workaround for no 'state_dict' key error - As reported in https://github.com/huggingface/diffusers/issues/1876 * create TI output dir if needed * Update environment-lin-cuda.yml (#2159) Fixing line 42 to be the proper order to define the transformers requirement: ~= instead of =~ * diffusers: update sampler-to-scheduler mapping based on https://github.com/huggingface/diffusers/issues/277#issuecomment-1371428672 * improve user exp for ckt to diffusers conversion - !optimize_models command now operates on an existing ckpt file entry in models.yaml - replaces existing entry, rather than adding a new one - offers to delete the ckpt file after conversion * web: adapt progress callback to deal with old generator or new diffusers pipeline * clean-up model_manager code - add_model() verified to work for .ckpt local paths, .ckpt remote URLs, diffusers local paths, and diffusers repo_ids - convert_and_import() verified to work for local and remove .ckpt files * handle edge cases for import_model() and convert_model() * add support for safetensor .ckpt files * fix name error * code cleanup with pyflake * improve model setting behavior - If the user enters an invalid model name at startup time, will not try to load it, warn, and use default model - CLI UI enhancement: include currently active model in the command line prompt. * update test-invoke-pip.yml - fix model cache path to point to runwayml/stable-diffusion-v1-5 - remove `skip-sd-weights` from configure_invokeai.py args * exclude dev/diffusers from "fail for draft PRs" * disable "fail on PR jobs" * re-add `--skip-sd-weights` since no space * update workflow environments - include `INVOKE_MODEL_RECONFIGURE: '--yes'` * clean up model load failure handling - Allow CLI to run even when no model is defined or loadable. - Inhibit stack trace when model load fails - only show last error - Give user *option* to run configure_invokeai.py when no models successfully load. - Restart invokeai after reconfiguration. * further edge-case handling 1) only one model in models.yaml file, and that model is broken 2) no models in models.yaml 3) models.yaml doesn't exist at all * fix incorrect model status listing - "cached" was not being returned from list_models() - normalize handling of exceptions during model loading: - Passing an invalid model name to generate.set_model() will return a KeyError - All other exceptions are returned as the appropriate Exception * CI: do download weights (if not already cached) * diffusers: fix scheduler loading in offline mode * CI: fix model name (no longer has `diffusers-` prefix) * Update txt2img2img.py (#2256) * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * feat - make model storage compatible with hugging face caching system This commit alters the InvokeAI model directory to be compatible with hugging face, making it easier to share diffusers (and other models) across different programs. - If the HF_HOME environment variable is not set, then models are cached in ~/invokeai/models in a format that is identical to the HuggingFace cache. - If HF_HOME is set, then models are cached wherever HF_HOME points. - To enable sharing with other HuggingFace library clients, set HF_HOME to ~/.cache/huggingface to set the default cache location or to ~/invokeai/models to have huggingface cache inside InvokeAI. * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * fix error "no attribute CkptInpaint" * model_manager.list_models() returns entire model config stanza+status * Initial Draft - Model Manager Diffusers * added hash function to diffusers * implement sha256 hashes on diffusers models * Add Model Manager Support for Diffusers * fix various problems with model manager - in cli import functions, fix not enough values to unpack from _get_name_and_desc() - fix crash when using old-style vae: value with new-style diffuser * rebuild frontend * fix dictconfig-not-serializable issue * fix NoneType' object is not subscriptable crash in model_manager * fix "str has no attribute get" error in model_manager list_models() * Add path and repo_id support for Diffusers Model Manager Also fixes bugs * Fix tooltip IT localization not working * Add Version Number To WebUI * Optimize Model Search * Fix incorrect font on the Model Manager UI * Fix image degradation on merge fixes - [Experimental] This change should effectively fix a couple of things. - Fix image degradation on subsequent merges of the canvas layers. - Fix the slight transparent border that is left behind when filling the bounding box with a color. - Fix the left over line of color when filling a bounding box with color. So far there are no side effects for this. If any, please report. * Add local model filtering for Diffusers / Checkpoints * Go to home on modal close for the Add Modal UI * Styling Fixes * Model Manager Diffusers Localization Update * Add Safe Tensor scanning to Model Manager * Fix model edit form dispatching string values instead of numbers. * Resolve VAE handling / edge cases for supplied repos * defer injecting tokens for textual inversions until they're used for the first time * squash a console warning * implement model migration check * add_model() overwrites previous config rather than merges * fix model config file attribute merging * fix precision handling in textual inversion script * allow ckpt conversion script to work with safetensors .ckpts Applied patch here: https://github.com/huggingface/diffusers/commit/beb932c5d111872c5e45387e7b1b2b3dd0524a47 * fix name "args" is not defined crash in textual_inversion_training * fix a second NameError: name 'args' is not defined crash * fix loading of the safety checker from the global cache dir * add installation step to textual inversion frontend - After a successful training run, the script will copy learned_embeds.bin to a subfolder of the embeddings directory. - User given the option to delete the logs and intermediate checkpoints (which together use 7-8G of space) - If textual inversion training fails, reports the error gracefully. * don't crash out on incompatible embeddings - put try: blocks around places where the system tries to load an embedding which is incompatible with the currently loaded model * add support for checkpoint resuming * textual inversion preferences are saved and restored between sessions - Preferences are stored in a file named text-inversion-training/preferences.conf - Currently the resume-from-checkpoint option is not working correctly. Possible bug in textual_inversion_training.py? * copy learned_embeddings.bin into right location * add front end for diffusers model merging - Front end doesn't do anything yet!!!! - Made change to model name parsing in CLI to support ability to have merged models with the "+" character in their names. * improve inpainting experience - recommend ckpt version of inpainting-1.5 to user - fix get_noise() bug in ckpt version of omnibus.py * update environment*yml * tweak instructions to install HuggingFace token * bump version number * enhance update scripts - update scripts will now fetch new INITIAL_MODELS.yaml so that configure_invokeai.py will know about the diffusers versions. * enhance invoke.sh/invoke.bat launchers - added configure_invokeai.py to menu - menu defaults to browser-based invoke * remove conda workflow (#2321) * fix `token_ids has shape torch.Size([79]) - expected [77]` * update CHANGELOG.md with 2.3.* info - Add information on how formats have changed and the upgrade process. - Add short bug list. Co-authored-by: Damian Stewart <d@damianstewart.com> Co-authored-by: Damian Stewart <null@damianstewart.com> Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> Co-authored-by: Wybartel-luxmc <37852506+Wybartel-luxmc@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> Co-authored-by: mickr777 <115216705+mickr777@users.noreply.github.com> Co-authored-by: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Co-authored-by: Eugene Brodsky <ebr@users.noreply.github.com> Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com>
2023-01-15 14:22:46 +00:00
safety_model_path = global_cache_dir("hub")
Merge dev into main for 2.2.0 (#1642) * Fixes inpainting + code cleanup * Disable stage info in Inpainting Tab * Mask Brush Preview now always at 0.5 opacity The new mask is only visible properly at max opacity but at max opacity the brush preview becomes fully opaque blocking the view. So the mask brush preview no remains at 0.5 no matter what the Brush opacity is. * Remove save button from Canvas Controls (cleanup) * Implements invert mask * Changes "Invert Mask" to "Preserve Masked Areas" * Fixes (?) spacebar issues * Patches redux-persist and redux-deep-persist with debounced persists Our app changes redux state very, very often. As our undo/redo history grows, the calls to persist state start to take in the 100ms range, due to a the deep cloning of the history. This causes very noticeable performance lag. The deep cloning is required because we need to blacklist certain items in redux from being persisted (e.g. the app's connection status). Debouncing the whole process of persistence is a simple and effective solution. Unfortunately, `redux-persist` dropped `debounce` between v4 and v5, replacing it with `throttle`. `throttle`, instead of delaying the expensive action until a period of X ms of inactivity, simply ensures the action is executed at least every X ms. Of course, this does not fix our performance issue. The patch is very simple. It adds a `debounce` argument - a number of milliseconds - and debounces `redux-persist`'s `update()` method (provided by `createPersistoid`) by that many ms. Before this, I also tried writing a custom storage adapter for `redux-persist` to debounce the calls to `localStorage.setItem()`. While this worked and was far less invasive, it doesn't actually address the issue. It turns out `setItem()` is a very fast part of the process. We use `redux-deep-persist` to simplify the `redux-persist` configuration, which can get complicated when you need to blacklist or whitelist deeply nested state. There is also a patch here for that library because it uses the same types as `redux-persist`. Unfortunately, the last release of `redux-persist` used a package `flat-stream` which was malicious and has been removed from npm. The latest commits to `redux-persist` (about 1 year ago) do not build; we cannot use the master branch. And between the last release and last commit, the changes have all been breaking. Patching this last release (about 3 years old at this point) directly is far simpler than attempting to fix the upstream library's master branch or figuring out an alternative to the malicious and now non-existent dependency. * Adds debouncing * Fixes AttributeError: 'dict' object has no attribute 'invert_mask' * Updates package.json to use redux-persist patches * Attempts to fix redux-persist debounce patch * Fixes undo/redo * Fixes invert mask * Debounce > 300ms * Limits history to 256 for each of undo and redo * Canvas styling * Hotkeys improvement * Add Metadata To Viewer * Increases CFG Scale max to 200 * Fix gallery width size for Outpainting Also fixes the canvas resizing failing n fast pushes * Fixes disappearing canvas grid lines * Adds staging area * Fixes "use all" not setting variationAmount Now sets to 0 when the image had variations. * Builds fresh bundle * Outpainting tab loads to empty canvas instead of upload * Fixes wonky canvas layer ordering & compositing * Fixes error on inpainting paste back `TypeError: 'float' object cannot be interpreted as an integer` * Hides staging area outline on mouseover prev/next * Fixes inpainting not doing img2img when no mask * Fixes bbox not resizing in outpainting if partially off screen * Fixes crashes during iterative outpaint. Still doesn't work correctly though. * Fix iterative outpainting by restoring original images * Moves image uploading to HTTP - It all seems to work fine - A lot of cleanup is still needed - Logging needs to be added - May need types to be reviewed * Fixes: outpainting temp images show in gallery * WIP refactor to unified canvas * Removes console.log from redux-persist patch * Initial unification of canvas * Removes all references to split inpainting/outpainting canvas * Add patchmatch and infill_method parameter to prompt2image (options are 'patchmatch' or 'tile'). * Fixes app after removing in/out-painting refs * Rebases on dev, updates new env files w/ patchmatch * Organises features/canvas * Fixes bounding box ending up offscreen * Organises features/canvas * Stops unnecessary canvas rescales on gallery state change * Fixes 2px layout shift on toggle canvas lock * Clips lines drawn while canvas locked When drawing with the locked canvas, if a brush stroke gets too close to the edge of the canvas and its stroke would extend past the edge of the canvas, the edge of that stroke will be seen after unlocking the canvas. This could cause a problem if you unlock the canvas and now have a bunch of strokes just outside the init image area, which are far back in undo history and you cannot easily erase. With this change, lines drawn while the canvas is locked get clipped to the initial image bbox, fixing this issue. Additionally, the merge and save to gallery functions have been updated to respect the initial image bbox so they function how you'd expect. * Fixes reset canvas view when locked * Fixes send to buttons * Fixes bounding box not being rounded to 64 * Abandons "inpainting" canvas lock * Fixes save to gallery including empty area, adds download and copy image * Fix Current Image display background going over image bounds * Sets status immediately when clicking Invoke * Adds hotkeys and refactors sharing of konva instances Adds hotkeys to canvas. As part of this change, the access to konva instance objects was refactored: Previously closure'd refs were used to indirectly get access to the konva instances outside of react components. Now, a getter and setter function are used to provide access directly to the konva objects. * Updates hotkeys * Fixes canvas showing spinner on first load Also adds good default canvas scale and positioning when no image is on it * Fixes possible hang on MaskCompositer * Improves behaviour when setting init canvas image/reset view * Resets bounding box coords/dims when no image present * Disables canvas actions which cannot be done during processing * Adds useToastWatcher hook - Dispatch an `addToast` action with standard Chakra toast options object to add a toast to the toastQueue - The hook is called in App.tsx and just useEffect's w/ toastQueue as dependency to create the toasts - So now you can add toasts anywhere you have access to `dispatch`, which includes middleware and thunks - Adds first usage of this for the save image buttons in canvas * Update Hotkey Info Add missing tooltip hotkeys and update the hotkeys modal to reflect the new hotkeys for the Unified Canvas. * Fix theme changer not displaying current theme on page refresh * Fix tab count in hotkeys panel * Unify Brush and Eraser Sizes * Fix staging area display toggle not working * Staging Area delete button is now red So it doesnt feel blended into to the rest of them. * Revert "Fix theme changer not displaying current theme on page refresh" This reverts commit 903edfb803e743500242589ff093a8a8a0912726. * Add arguments to use SSL to webserver * Integrates #1487 - touch events Need to add: - Pinch zoom - Touch-specific handling (some things aren't quite right) * Refactors upload-related async thunks - Now standard thunks instead of RTK createAsyncThunk() - Adds toasts for all canvas upload-related actions * Reorganises app file structure * Fixes Canvas Auto Save to Gallery * Fixes staging area outline * Adds staging area hotkeys, disables gallery left/right when staging * Fixes Use All Parameters * Fix metadata viewer image url length when viewing intermediate * Fixes intermediate images being tiny in txt2img/img2img * Removes stale code * Improves canvas status text and adds option to toggle debug info * Fixes paste image to upload * Adds model drop-down to site header * Adds theme changer popover * Fix missing key on ThemeChanger map * Fixes stage position changing on zoom * Hotkey Cleanup - Viewer is now Z - Canvas Move tool is V - sync with PS - Removed some unused hotkeys * Fix canvas resizing when both options and gallery are unpinned * Implements thumbnails for gallery - Thumbnails are saved whenever an image is saved, and when gallery requests images from server - Thumbnails saved at original image aspect ratio with width of 128px as WEBP - If the thumbnail property of an image is unavailable for whatever reason, the image's full size URL is used instead * Saves thumbnails to separate thumbnails directory * Thumbnail size = 256px * Fix Lightbox Issues * Disables canvas image saving functions when processing * Fix index error on going past last image in Gallery * WIP - Lightbox Fixes Still need to fix the images not being centered on load when the image res changes * Fixes another similar index error, simplifies logic * Reworks canvas toolbar * Fixes canvas toolbar upload button * Cleans up IAICanvasStatusText * Improves metadata handling, fixes #1450 - Removes model list from metadata - Adds generation's specific model to metadata - Displays full metadata in JSON viewer * Gracefully handles corrupted images; fixes #1486 - App does not crash if corrupted image loaded - Error is displayed in the UI console and CLI output if an image cannot be loaded * Adds hotkey to reset canvas interaction state If the canvas' interaction state (e.g. isMovingBoundingBox, isDrawing, etc) get stuck somehow, user can press Escape to reset the state. * Removes stray console.log() * Fixes bug causing gallery to close on context menu open * Minor bugfixes - When doing long-running canvas image exporting actions, display indeterminate progress bar - Fix staging area image outline not displaying after committing/discarding results * Removes unused imports * Fixes repo root .gitignore ignoring frontend things * Builds fresh bundle * Styling updates * Removes reasonsWhyNotReady The popover doesn't play well with the button being disabled, and I don't think adds any value. * Image gallery resize/style tweaks * Styles buttons for clearing canvas history and mask * First pass on Canvas options panel * Fixes bug where discarding staged images results in loss of history * Adds Save to Gallery button to staging toolbar * Rearrange some canvas toolbar icons Put brush stuff together and canvas movement stuff together * Fix gallery maxwidth on unified canvas * Update Layer hotkey display to UI * Adds option to crop to bounding box on save * Masking option tweaks * Crop to Bounding Box > Save Box Region Only * Adds clear temp folder * Updates mask options popover behavior * Builds fresh bundle * Fix styling on alert modals * Fix input checkbox styling being incorrect on light theme * Styling fixes * Improves gallery resize behaviour * Cap gallery size on canvas tab so it doesnt overflow * Fixes bug when postprocessing image with no metadata * Adds IAIAlertDialog component * Moves Loopback to app settings * Fixes metadata viewer not showing metadata after refresh Also adds Dream-style prompt to metadata * Adds outpainting specific options * Linting * Fixes gallery width on lightbox, fixes gallery button expansion * Builds fresh bundle * Fix Lightbox images of different res not centering * Update feature tooltip text * Highlight mask icon when on mask layer * Fix gallery not resizing correctly on open and close * Add loopback to just img2img. Remove from settings. * Fix to gallery resizing * Removes Advanced checkbox, cleans up options panel for unified canvas * Minor styling fixes to new options panel layout * Styling Updates * Adds infill method * Tab Styling Fixes * memoize outpainting options * Fix unnecessary gallery re-renders * Isolate Cursor Pos debug text on canvas to prevent rerenders * Fixes missing postprocessed image metadata before refresh * Builds fresh bundle * Fix rerenders on model select * Floating panel re-render fix * Simplify fullscreen hotkey selector * Add Training WIP Tab * Adds Training icon * Move full screen hotkey to floating to prevent tab rerenders * Adds single-column gallery layout * Fixes crash on cancel with intermediates enabled, fixes #1416 * Updates npm dependencies * Fixes img2img attempting inpaint when init image has transparency * Fixes missing threshold and perlin parameters in metadata viewer * Renames "Threshold" > "Noise Threshold" * Fixes postprocessing not being disabled when clicking use all * Builds fresh bundle * Adds color picker * Lints & builds fresh bundle * Fixes iterations being disabled when seed random & variations are off * Un-floors cursor position * Changes color picker preview to circles * Fixes variation params not set correctly when recalled * Fixes invoke hotkey not working in input fields * Simplifies Accordion Prep for adding reset buttons for each section * Fixes mask brush preview color * Committing color picker color changes tool to brush * Color picker does not overwrite user-selected alpha * Adds brush color alpha hotkey * Lints * Removes force_outpaint param * Add inpaint size options to inpaint at a larger size than the actual inpaint image, then scale back down for recombination * Bug fix for inpaint size * Adds inpaint size (as scale bounding box) to UI * Adds auto-scaling for inpaint size * Improves scaled bbox display logic * Fixes bug with clear mask and history * Fixes shouldShowStagingImage not resetting to true on commit * Builds fresh bundle * Fixes canvas failing to scale on first run * Builds fresh bundle * Fixes unnecessary canvas scaling * Adds gallery drag and drop to img2img/canvas * Builds fresh bundle * Fix desktop mode being broken with new versions of flaskwebgui * Fixes canvas dimensions not setting on first load * Builds fresh bundle * stop crash on !import_models call on model inside rootdir - addresses bug report #1546 * prevent "!switch state gets confused if model switching fails" - If !switch were to fail on a particular model, then generate got confused and wouldn't try again until you switch to a different working model and back again. - This commit fixes and closes #1547 * Revert "make the docstring more readable and improve the list_models logic" This reverts commit 248068fe5d57b5639ea7a87ee6cbf023104d957d. * fix model cache path * also set fail-fast to it's default (true) in this way the whole action fails if one job fails this should unblock the runners!!! * fix output path for Archive results * disable checks for python 3.9 * Update-requirements and test-invoke-pip workflow (#1574) * update requirements files * update test-invoke-pip workflow * move requirements-mkdocs.txt to docs folder (#1575) * move requirements-mkdocs.txt to docs folder * update copyright * Fixes outpainting with resized inpaint size * Interactive configuration (#1517) * Update scripts/configure_invokeai.py prevent crash if output exists Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> * implement changes requested by reviews * default to correct root and output directory on Windows systems - Previously the script was relying on the readline buffer editing feature to set up the correct default. But this feature doesn't exist on windows. - This commit detects when user typed return with an empty directory value and replaces with the default directory. * improved readability of directory choices * Update scripts/configure_invokeai.py Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> * better error reporting at startup - If user tries to run the script outside of the repo or runtime directory, a more informative message will appear explaining the problem. Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> * Embedding merging (#1526) * add whole <style token> to vocab for concept library embeddings * add ability to load multiple concept .bin files * make --log_tokenization respect custom tokens * start working on concept downloading system * preliminary support for dynamic loading and merging of multiple embedded models - The embedding_manager is now enhanced with ldm.invoke.concepts_lib, which handles dynamic downloading and caching of embedded models from the Hugging Face concepts library (https://huggingface.co/sd-concepts-library) - Downloading of a embedded model is triggered by the presence of one or more <concept> tags in the prompt. - Once the embedded model is downloaded, its trigger phrase will be loaded into the embedding manager and the prompt's <concept> tag will be replaced with the <trigger_phrase> - The downloaded model stays on disk for fast loading later. - The CLI autocomplete will complete partial <concept> tags for you. Type a '<' and hit tab to get all ~700 concepts. BUGS AND LIMITATIONS: - MODEL NAME VS TRIGGER PHRASE You must use the name of the concept embed model from the SD library, and not the trigger phrase itself. Usually these are the same, but not always. For example, the model named "hoi4-leaders" corresponds to the trigger "<HOI4-Leader>" One reason for this design choice is that there is no apparent constraint on the uniqueness of the trigger phrases and one trigger phrase may map onto multiple models. So we use the model name instead. The second reason is that there is no way I know of to search Hugging Face for models with certain trigger phrases. So we'd have to download all 700 models to index the phrases. The problem this presents is that this may confuse users, who will want to reuse prompts from distributions that use the trigger phrase directly. Usually this will work, but not always. - WON'T WORK ON A FIREWALLED SYSTEM If the host running IAI has no internet connection, it can't download the concept libraries. I will add a script that allows users to preload a list of concept models. - BUG IN PROMPT REPLACEMENT WHEN MODEL NOT FOUND There's a small bug that occurs when the user provides an invalid model name. The <concept> gets replaced with <None> in the prompt. * fix loading .pt embeddings; allow multi-vector embeddings; warn on dupes * simplify replacement logic and remove cuda assumption * download list of concepts from hugging face * remove misleading customization of '*' placeholder the existing code as-is did not do anything; unclear what it was supposed to do. the obvious alternative -- setting using 'placeholder_strings' instead of 'placeholder_tokens' to match model.params.personalization_config.params.placeholder_strings -- caused a crash. i think this is because the passed string also needed to be handed over on init of the PersonalizedBase as the 'placeholder_token' argument. this is weird config dict magic and i don't want to touch it. put a breakpoint in personalzied.py line 116 (top of PersonalizedBase.__init__) if you want to have a crack at it yourself. * address all the issues raised by damian0815 in review of PR #1526 * actually resize the token_embeddings * multiple improvements to the concept loader based on code reviews 1. Activated the --embedding_directory option (alias --embedding_path) to load a single embedding or an entire directory of embeddings at startup time. 2. Can turn off automatic loading of embeddings using --no-embeddings. 3. Embedding checkpoints are scanned with the pickle scanner. 4. More informative error messages when a concept can't be loaded due either to a 404 not found error or a network error. * autocomplete terms end with ">" now * fix startup error and network unreachable 1. If the .invokeai file does not contain the --root and --outdir options, invoke.py will now fix it. 2. Catch and handle network problems when downloading hugging face textual inversion concepts. * fix misformatted error string Co-authored-by: Damian Stewart <d@damianstewart.com> * model_cache.py: fix list_models Signed-off-by: devops117 <55235206+devops117@users.noreply.github.com> * add statement of values (#1584) * this adds the Statement of Values Google doc source = https://docs.google.com/document/d/1-PrUKDJcxy8OyNGc8CyiHhv2VgLvjt7LRGlEpbg1nmQ/edit?usp=sharing * Fix heading * Update InvokeAI_Statement_of_Values.md * Update InvokeAI_Statement_of_Values.md * Update InvokeAI_Statement_of_Values.md * Update InvokeAI_Statement_of_Values.md * Update InvokeAI_Statement_of_Values.md * add keturn and mauwii to the team member list * Fix punctuation * this adds the Statement of Values Google doc source = https://docs.google.com/document/d/1-PrUKDJcxy8OyNGc8CyiHhv2VgLvjt7LRGlEpbg1nmQ/edit?usp=sharing * add keturn and mauwii to the team member list * fix formating - make sub bullets use * (decide to all use - or *) - indent sub bullets Sorry, first only looked at the code version and found this only after looking at the markdown rendered version * use multiparagraph numbered sections * Break up Statement Of Values as per comments on #1584 * remove duplicated word, reduce vagueness it's important not to overstate how many artists we are consulting. * fix typo (sorry blessedcoolant) Co-authored-by: mauwii <Mauwii@outlook.de> Co-authored-by: damian <git@damianstewart.com> * update dockerfile (#1551) * update dockerfile * remove not existing file from .dockerignore * remove bloat and unecesary step also use --no-cache-dir for pip install image is now close to 2GB * make Dockerfile a variable * set base image to `ubuntu:22.10` * add build-essential * link outputs folder for persistence * update tag variable * update docs * fix not customizeable build args, add reqs output * !model_import autocompletes in ROOTDIR * Adds psychedelicious to statement of values signature (#1602) * add a --no-patchmatch option to disable patchmatch loading (#1598) This feature was added to prevent the CI Macintosh tests from erroring out when patchmatch is unable to retrieve its shared library from github assets. * Fix #1599 by relaxing the `match_trigger` regex (#1601) * Fix #1599 by relaxing the `match_trigger` regex Also simplify logic and reduce duplication. * restrict trigger regex again (but not so far) * make concepts library work with Web UI This PR makes it possible to include a Hugging Face concepts library <style-or-subject-trigger> in the WebUI prompt. The metadata seems to be correctly handled. * documentation enhancements (#1603) - Add documentation for the Hugging Face concepts library and TI embedding. - Fixup index.md to point to each of the feature documentation files, including ones that are pending. * tweak setup and environment files for linux & pypatchmatch (#1580) * tweak setup and environment files for linux & pypatchmatch - Downgrade python requirements to 3.9 because 3.10 is not supported on Ubuntu 20.04 LTS (widely-used distro) - Use our github pypatchmatch 0.1.3 in order to install Makefile where it needs to be. - Restored "-e ." as the last install step on pip installs. Hopefully this will not trigger the high-CPU hang we've previously experienced. * keep windows on basicsr 1.4.1 * keep windows on basicsr 1.4.1 * bump pypatchmatch requirement to 0.1.4 - This brings in a version of pypatchmatch that will gracefully handle internet connection not available at startup time. - Also refactors and simplifies the handling of gfpgan's basicsr requirement across various platforms. * revert to older version of list_models() (#1611) This restores the correct behavior of list_models() and quenches the bug of list_models() returning a single model entry named "name". I have not investigated what was wrong with the new version, but I think it may have to do with changes to the behavior in dict.update() * Fixes for #1604 (#1605) * Converts ESRGAN image input to RGB - Also adds typing for image input. - Partially resolves #1604 * ensure there are unmasked pixels before color matching Co-authored-by: Kyle Schouviller <kyle0654@hotmail.com> * update index.md (#1609) - comment out non existing link - fix indention - add seperator between feature categories * Debloat-docker (#1612) * debloat Dockerfile - less options more but more userfriendly - better Entrypoint to simulate CLI usage - without command the container still starts the web-host * debloat build.sh * better syntax in run.sh * update Docker docs - fix description of VOLUMENAME - update run script example to reflect new entrypoint * Test installer (#1618) * test linux install * try removing http from parsed requirements * pip install confirmed working on linux * ready for linux testing - rebuilt py3.10-linux-x86_64-cuda-reqs.txt to include pypatchmatch dependency. - point install.sh and install.bat to test-installer branch. * Updates MPS reqs * detect broken readline history files * fix download.pytorch.org URL * Test installer (Win 11) (#1620) Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> * Test installer (MacOS 13.0.1 w/ torch==1.12.0) (#1621) * Test installer (Win 11) * Test installer (MacOS 13.0.1 w/ torch==1.12.0) Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> * change sourceball to development for testing * Test installer (MacOS 13.0.1 w/ torch==1.12.1 & torchvision==1.13.1) (#1622) * Test installer (Win 11) * Test installer (MacOS 13.0.1 w/ torch==1.12.0) * Test installer (MacOS 13.0.1 w/ torch==1.12.1 & torchvision==1.13.1) Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Co-authored-by: Cyrus Chan <82143712+cyruschan360@users.noreply.github.com> Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> * 2.2 Doc Updates (#1589) * Unified Canvas Docs & Assets Unified Canvas draft Advanced Tools Updates Doc Updates (lstein feedback) * copy edits to Unified Canvas docs - consistent capitalisation and feature naming - more intimate address (replace "the user" with "you") for improved User Engagement(tm) - grammatical massaging and *poesie* Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> Co-authored-by: damian <git@damianstewart.com> * include a step after config to `cat ~/.invokeai` (#1629) * disable patchmatch in CI actions (#1626) * disable patchmatch in CI actions * fix indention * replace tab with spaces Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> * Fix installer script for macOS. (#1630) * refer to the platform as 'osx' instead of 'mac', otherwise the composed URL to micromamba is wrong. * move the `-O` option to `tar` to be grouped with the other tar flags to avoid the `-O` being interpreted as something to unarchive. * Removes symlinked environment.yaml (#1631) Was unintentionally added in #1621 * Fix inpainting with iterations (#1635) * fix error when inpainting using runwayml inpainting model (#1634) - error was "Omnibus object has no attribute pil_image" - closes #1596 * add k_dpmpp_2_a and k_dpmpp_2 solvers options (#1389) * add k_dpmpp_2_a and k_dpmpp_2 solvers options * update frontend Co-authored-by: Victor <victorca25@users.noreply.github.com> Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> * add .editorconfig (#1636) * Web UI 2.2 bugfixes (#1572) * Fixes bug preventing multiple images from being generated * Fixes valid seam strength value range * Update Delete Alert Text Indicates to the user that images are not permanently deleted. * Fixes left/right arrows not working on gallery * Fixes initial image on load erroneously set to a user uploaded image Should be a result gallery image. * Lightbox Fixes - Lightbox is now a button in the current image buttons - Lightbox is also now available in the gallery context menu - Lightbox zoom issues fixed - Lightbox has a fade in animation. * Fix image display wrapper in current preview not overflow bounds * Revert "Fix image display wrapper in current preview not overflow bounds" This reverts commit 5511c82714dbf1d1999d64e8bc357bafa34ddf37. * Change Staging Area discard icon from Bin to X * Expose Snap Threshold and Move Snap Settings to BBox Panel * Changes img2img strength default to 0.75 * Fixes drawing triggering when mouse enters canvas w/ button down When we only supported inpainting and no zoom, this was useful. It allowed the cursor to leave the canvas (which was easy to do given the limited canvas dimensions) and without losing the "I am drawing" state. With a zoomable canvas this is no longer as useful. Additionally, we have more popovers and tools (like the color pickers) which result in unexpected brush strokes. This fixes that issue. * Revert "Expose Snap Threshold and Move Snap Settings to BBox Panel" We will handle this a bit differently - by allowing the grid origin to be moved. I will dig in at some point. This reverts commit 33c92ecf4da724c2f17d9d91c7ea31a43a2f6deb. * Adds Limit Strokes to Box * Adds fill bounding box button * Adds erase bounding box button * Changes Staging area discard icon to match others * Fixes right click breaking move tool * Fixes brush preview visibility issue with "darken outside box" * Fixes history bugs with addFillRect, addEraseRect, and other actions * Adds missing `key` * Fixes postprocessing being applied to canvas generations * Fixes bbox not getting scaled in various situations * Fixes staging area show image toggle not resetting on accept/discard * Locks down canvas while generating/staging * Fixes move tool breaking when canvas loses focus during move/transform * Hides cursor when restrict strokes is on and mouse outside bbox * Lints * Builds fresh bundle * Fix overlapping hotkey for Fill Bounding Box * Build Fresh Bundle * Fixes bug with mask and bbox overlay * Builds fresh bundle Co-authored-by: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> * disable NSFW checker loading during the CI tests (#1641) * disable NSFW checker loading during the CI tests The NSFW filter apparently causes invoke.py to crash during CI testing, possibly due to out of memory errors. This workaround disables NSFW model loading. * doc change * fix formatting errors in yml files * Configure the NSFW checker at install time with default on (#1624) * configure the NSFW checker at install time with default on 1. Changes the --safety_checker argument to --nsfw_checker and --no-nsfw_checker. The original argument is recognized for backward compatibility. 2. The configure script asks users whether to enable the checker (default yes). Also offers users ability to select default sampler and number of generation steps. 3.Enables the pasting of the caution icon on blurred images when InvokeAI is installed into the package directory. 4. Adds documentation for the NSFW checker, including caveats about accuracy, memory requirements, and intermediate image dispaly. * use better fitting icon * NSFW defaults false for testing * set default back to nsfw active Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> Signed-off-by: devops117 <55235206+devops117@users.noreply.github.com> Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Co-authored-by: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Co-authored-by: Kyle Schouviller <kyle0654@hotmail.com> Co-authored-by: javl <mail@jaspervanloenen.com> Co-authored-by: Kent Keirsey <31807370+hipsterusername@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com> Co-authored-by: Damian Stewart <d@damianstewart.com> Co-authored-by: DevOps117 <55235206+devops117@users.noreply.github.com> Co-authored-by: damian <git@damianstewart.com> Co-authored-by: Damian Stewart <null@damianstewart.com> Co-authored-by: Cyrus Chan <82143712+cyruschan360@users.noreply.github.com> Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> Co-authored-by: Andre LaBranche <dre@mac.com> Co-authored-by: victorca25 <41912303+victorca25@users.noreply.github.com> Co-authored-by: Victor <victorca25@users.noreply.github.com>
2022-11-30 21:12:23 +00:00
self.safety_checker = StableDiffusionSafetyChecker.from_pretrained(safety_model_id,
local_files_only=True,
cache_dir=safety_model_path,
)
self.safety_feature_extractor = AutoFeatureExtractor.from_pretrained(safety_model_id,
local_files_only=True,
cache_dir=safety_model_path,
)
2022-10-30 20:54:06 +00:00
self.safety_checker.to(self.device)
except Exception:
print('** An error was encountered while installing the safety checker:')
print(traceback.format_exc())
Refactoring simplet2i (#387) * start refactoring -not yet functional * first phase of refactor done - not sure weighted prompts working * Second phase of refactoring. Everything mostly working. * The refactoring has moved all the hard-core inference work into ldm.dream.generator.*, where there are submodules for txt2img and img2img. inpaint will go in there as well. * Some additional refactoring will be done soon, but relatively minor work. * fix -save_orig flag to actually work * add @neonsecret attention.py memory optimization * remove unneeded imports * move token logging into conditioning.py * add placeholder version of inpaint; porting in progress * fix crash in img2img * inpainting working; not tested on variations * fix crashes in img2img * ported attention.py memory optimization #117 from basujindal branch * added @torch_no_grad() decorators to img2img, txt2img, inpaint closures * Final commit prior to PR against development * fixup crash when generating intermediate images in web UI * rename ldm.simplet2i to ldm.generate * add backward-compatibility simplet2i shell with deprecation warning * add back in mps exception, addresses @vargol comment in #354 * replaced Conditioning class with exported functions * fix wrong type of with_variations attribute during intialization * changed "image_iterator()" to "get_make_image()" * raise NotImplementedError for calling get_make_image() in parent class * Update ldm/generate.py better error message Co-authored-by: Kevin Gibbons <bakkot@gmail.com> * minor stylistic fixes and assertion checks from code review * moved get_noise() method into img2img class * break get_noise() into two methods, one for txt2img and the other for img2img * inpainting works on non-square images now * make get_noise() an abstract method in base class * much improved inpainting Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
2022-09-06 00:40:10 +00:00
def prompt2png(self, prompt, outdir, **kwargs):
"""
Takes a prompt and an output directory, writes out the requested number
of PNG files, and returns an array of [[filename,seed],[filename,seed]...]
Optional named arguments are the same as those passed to Generate and prompt2image()
"""
results = self.prompt2image(prompt, **kwargs)
Refactoring simplet2i (#387) * start refactoring -not yet functional * first phase of refactor done - not sure weighted prompts working * Second phase of refactoring. Everything mostly working. * The refactoring has moved all the hard-core inference work into ldm.dream.generator.*, where there are submodules for txt2img and img2img. inpaint will go in there as well. * Some additional refactoring will be done soon, but relatively minor work. * fix -save_orig flag to actually work * add @neonsecret attention.py memory optimization * remove unneeded imports * move token logging into conditioning.py * add placeholder version of inpaint; porting in progress * fix crash in img2img * inpainting working; not tested on variations * fix crashes in img2img * ported attention.py memory optimization #117 from basujindal branch * added @torch_no_grad() decorators to img2img, txt2img, inpaint closures * Final commit prior to PR against development * fixup crash when generating intermediate images in web UI * rename ldm.simplet2i to ldm.generate * add backward-compatibility simplet2i shell with deprecation warning * add back in mps exception, addresses @vargol comment in #354 * replaced Conditioning class with exported functions * fix wrong type of with_variations attribute during intialization * changed "image_iterator()" to "get_make_image()" * raise NotImplementedError for calling get_make_image() in parent class * Update ldm/generate.py better error message Co-authored-by: Kevin Gibbons <bakkot@gmail.com> * minor stylistic fixes and assertion checks from code review * moved get_noise() method into img2img class * break get_noise() into two methods, one for txt2img and the other for img2img * inpainting works on non-square images now * make get_noise() an abstract method in base class * much improved inpainting Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
2022-09-06 00:40:10 +00:00
pngwriter = PngWriter(outdir)
prefix = pngwriter.unique_prefix()
outputs = []
Refactoring simplet2i (#387) * start refactoring -not yet functional * first phase of refactor done - not sure weighted prompts working * Second phase of refactoring. Everything mostly working. * The refactoring has moved all the hard-core inference work into ldm.dream.generator.*, where there are submodules for txt2img and img2img. inpaint will go in there as well. * Some additional refactoring will be done soon, but relatively minor work. * fix -save_orig flag to actually work * add @neonsecret attention.py memory optimization * remove unneeded imports * move token logging into conditioning.py * add placeholder version of inpaint; porting in progress * fix crash in img2img * inpainting working; not tested on variations * fix crashes in img2img * ported attention.py memory optimization #117 from basujindal branch * added @torch_no_grad() decorators to img2img, txt2img, inpaint closures * Final commit prior to PR against development * fixup crash when generating intermediate images in web UI * rename ldm.simplet2i to ldm.generate * add backward-compatibility simplet2i shell with deprecation warning * add back in mps exception, addresses @vargol comment in #354 * replaced Conditioning class with exported functions * fix wrong type of with_variations attribute during intialization * changed "image_iterator()" to "get_make_image()" * raise NotImplementedError for calling get_make_image() in parent class * Update ldm/generate.py better error message Co-authored-by: Kevin Gibbons <bakkot@gmail.com> * minor stylistic fixes and assertion checks from code review * moved get_noise() method into img2img class * break get_noise() into two methods, one for txt2img and the other for img2img * inpainting works on non-square images now * make get_noise() an abstract method in base class * much improved inpainting Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
2022-09-06 00:40:10 +00:00
for image, seed in results:
name = f'{prefix}.{seed}.png'
path = pngwriter.save_image_and_prompt_to_png(
image, dream_prompt=f'{prompt} -S{seed}', name=name)
Refactoring simplet2i (#387) * start refactoring -not yet functional * first phase of refactor done - not sure weighted prompts working * Second phase of refactoring. Everything mostly working. * The refactoring has moved all the hard-core inference work into ldm.dream.generator.*, where there are submodules for txt2img and img2img. inpaint will go in there as well. * Some additional refactoring will be done soon, but relatively minor work. * fix -save_orig flag to actually work * add @neonsecret attention.py memory optimization * remove unneeded imports * move token logging into conditioning.py * add placeholder version of inpaint; porting in progress * fix crash in img2img * inpainting working; not tested on variations * fix crashes in img2img * ported attention.py memory optimization #117 from basujindal branch * added @torch_no_grad() decorators to img2img, txt2img, inpaint closures * Final commit prior to PR against development * fixup crash when generating intermediate images in web UI * rename ldm.simplet2i to ldm.generate * add backward-compatibility simplet2i shell with deprecation warning * add back in mps exception, addresses @vargol comment in #354 * replaced Conditioning class with exported functions * fix wrong type of with_variations attribute during intialization * changed "image_iterator()" to "get_make_image()" * raise NotImplementedError for calling get_make_image() in parent class * Update ldm/generate.py better error message Co-authored-by: Kevin Gibbons <bakkot@gmail.com> * minor stylistic fixes and assertion checks from code review * moved get_noise() method into img2img class * break get_noise() into two methods, one for txt2img and the other for img2img * inpainting works on non-square images now * make get_noise() an abstract method in base class * much improved inpainting Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
2022-09-06 00:40:10 +00:00
outputs.append([path, seed])
return outputs
def txt2img(self, prompt, **kwargs):
merge release-candidate-1-3-2 into main. Squashed commit of the following: commit 9a1fe8e7fbbd81d9e9e47c4fda6bde6f66fba30c Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 12 17:07:40 2022 +0000 swap in release URLs for installers commit ff56f5251ba8502833cb561317e82b028cd2da5d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 12 17:03:21 2022 +0000 fix up bad unicode chars in invoke.py commit ed943bd6c785d968d1e31fbbb814fea8688fc8bb Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 12 16:05:45 2022 +0000 outcrop improvements, hand-added commit 7ad2355b1da53861bb75312edead8f9db0b0f44d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 12 15:14:33 2022 +0000 documentation fixes commit 66c920fc197d9206be9e0e2d1eb2a1cb86362887 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 16:49:25 2022 -0500 Revert "Resize hires as an image" This reverts commit d05b1b3544dfa7b3c071ac05b4f014a52e08fa50. commit 3fc5cb09f8bc03ea96e67a3e49fb087019d2f9d5 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 12 12:43:17 2022 +0000 fix incorrect link in install commit 1345ec77ab58f70e1bf5a0f587ca40aba4e906b7 Author: tildebyte <337875+tildebyte@users.noreply.github.com> Date: Sun Nov 6 19:07:31 2022 -0500 toil(repo): add tildebyte as owner of installer/ directory commit b116715490f390a59e5bee1022a6a758aee0918d Author: Kyle Schouviller <kyle0654@hotmail.com> Date: Thu Nov 10 21:43:56 2022 -0800 Fix performance issue introduced by torch cuda cache clear during generation commit fa3670270e7aae6bfd8d47fb7bdd32b707310c23 Author: mauwii <Mauwii@outlook.de> Date: Fri Nov 11 12:42:03 2022 +0100 small update to dockers huggingface section commit c304250ef663b3e202b4da8332365288589d94c7 Author: mauwii <Mauwii@outlook.de> Date: Fri Nov 11 12:19:27 2022 +0100 fix format and Link in INSTALL_INVOKE.md commit 802ce5dde5ca68f24aa4609cdba428044e0c7fa1 Author: mauwii <Mauwii@outlook.de> Date: Fri Nov 11 11:17:49 2022 +0100 small fixex to format and a link in INSTALL_MANUAL commit 311ee320ecac892cb4a1bcd012374fa051b1d011 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 07:23:35 2022 +0000 ignore installer intermediate files commit e9df17b374df58a44d3ae3ba33cbdc58794bcf5d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 07:19:25 2022 +0000 fix backslash-related syntax error commit 061fb4ef00482bdd4fba635aeaeff4ca7510190d Merge: 52be0d23 4095acd1 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 06:50:04 2022 +0000 Merge branch 'release-candidate-2-1-3' of github.com:/invoke-ai/InvokeAI into release-candidate-2-1-3 commit 52be0d2396de2de02030855c92e3367008b50377 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 06:49:45 2022 +0000 add WindowsLongFileName batfile to source installer commit 4095acd10ebae05a8cb14cc2faf7c79936d9e6a9 Author: mauwii <Mauwii@outlook.de> Date: Fri Nov 11 07:05:17 2022 +0100 Doc Updates A lot of re-formating of new Installation Docs also some content updates/corrections commit 201eb22d7650b00f55249c2646fa4f47ac3e0ec2 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 04:41:02 2022 +0000 prevent two models from being marked default in models.yaml commit 17ab98220034dfbb798a9a0460bc2837f0c1e2cb Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 03:56:54 2022 +0000 installers download branch HEAD not tag commit a04965b0e9e9d1170cf284af9acbd1186d681255 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 03:48:21 2022 +0000 improve messaging during installation process commit 0b529f0c574dd91fb9593e924ebc41c8c219b6ce Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 15:22:32 2022 +0000 enable outcropping of random JPG/PNG images - Works best with runwayML inpainting model - Numerous code changes required to propagate seed to final metadata. Original code predicated on the image being generated within InvokeAI. commit 6f9f84834557eb3c48562dc5d0ace51ca9e9cca2 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 17:27:42 2022 +0000 enhance outcropping with ability to direct contents of new regions - When outcropping an image you can now add a `--new_prompt` option, to specify a new prompt to be used instead of the original one used to generate the image. - Similarly you can provide a new seed using `--seed` (or `-S`). A seed of zero will pick one randomly. - This PR also fixes the crash that happened when trying to outcrop an image that does not contain InvokeAI metadata. commit 918c1589ef30595668899f4259ece6a4ad605c69 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 20:16:47 2022 +0000 fix #1402 commit 116415b3fcec8415f8e6de9b23c0bbd0dbc6845b Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 21:27:25 2022 +0000 fix invoke.py crash if no models.yaml file present - Script will now offer the user the ability to create a minimal models.yaml and then gracefully exit. - Closes #1420 commit b4b6eabaac94896e38123be331c44d1b63065b0d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 16:49:25 2022 -0500 Revert "Log strength with hires" This reverts commit 82d4904c07670d514e9a541de7c9ecd8489eeae2. commit 4ef1f4a854717c953f9192454d0adabef32af36c Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 20:01:49 2022 +0000 remove temporary directory from repo commit 510fc4ebaa5f9dc0e77b47cf04e0c265423e0a44 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 19:59:03 2022 +0000 remove -e from clipseg load in installer commit a20914434bb3609cf1d883cabf048d4cc25f881a Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 19:37:07 2022 +0000 change clipseg repo branch to avoid clipseg not found error commit 0d134195fda5c69fce5a95d6da90248eba8d226d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 18:39:29 2022 +0000 update repo URL to point to rc commit 649d8c8573896fdb5a73453b69ee4b54cf4d6241 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 18:13:28 2022 +0000 integrate tildebyte installer commit a358d370a05ea985a9e26fa9c1101d9c14fdb3ab Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 17:48:14 2022 +0000 add @tildebyte compiled pip installer commit 94a9033c4f6214e604be149a3de6d7c747af7f3a Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 14:52:00 2022 +0000 ignore source installer zip files commit 18a947c503c83c95cd83f27424696219ff3c4c95 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 14:46:36 2022 +0000 documentation and environment file fixes - Have clarified the relationship between the @tildebyte and @cmdr2 installers; However, @tildebyte installer merge is still a WIP due to conflicts over such things as `invoke.sh`. - Rechristened 1click installer as "source" installer. @tildebyte installer will be "the" installer. (We'll see which one generates the least support requests and maintenance work.) - Sync'd `environment-mac.yml` with `development`. The former was failing with a taming-transformers error as per https://discord.com/channels/@me/1037201214154231899/1040060947378749460 commit a23b03189526a49da8ddae90ce71b0e902784d29 Author: Mike DiGiovanni <vinblau@gmail.com> Date: Wed Nov 9 16:44:59 2022 -0500 Fixes typos in README.md commit 23af68c7d79d947f1bd3441c91bb44d655238f01 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 07:02:27 2022 -0500 downgrade win installs to basicsr==1.4.1 commit e258beeb51f3e645b9ea60e52d69d18722221cc5 Merge: 7460c069 e481bfac Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 06:37:45 2022 -0500 Merge branch 'release-candidate-2-1-3' of github.com:invoke-ai/InvokeAI into release-candidate-2-1-3 commit 7460c069b880b10c84b55f2e0c0998e350d6cf12 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 06:36:48 2022 -0500 remove --prefer-binary from requirements-base.txt It appears that some versions of pip do not recognize this option when it appears in the requirements file. Did not explore this further but recommend --prefer-binary in the manual install instructions on the command line. commit e481bfac615e0c798ceb5e59e8fbe3038f85b431 Merge: 5040747c d1ab65a4 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 11:21:56 2022 +0000 Merge branch 'release-candidate-2-1-3' of github.com:/invoke-ai/InvokeAI into release-candidate-2-1-3 commit 5040747c6700c9b949e3f3e1d2c3f21daffcec6c Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 11:21:43 2022 +0000 fix windows install instructions & bat file commit d1ab65a43122f73c20533d5815590ec10bc05eca Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 07:18:59 2022 +0100 update WEBUIHOTKEYS.md commit af4ee7feb8a7d2528bf4e2b3f7deee7a7c4c3dec Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 06:33:49 2022 +0100 update INSTALL_DOCKER.md commit 764fb29aded8114984d05932c4266ea24614b932 Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 06:30:15 2022 +0100 fix formatting in INSTALL.md commit 1014d3ba44aa4cd4cfdc6e3650c24a0dc9568a6e Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 06:29:14 2022 +0100 fix build.sh invokeai_conda_env_file default value commit 40a48aca88e337e9f4475f80a03b7d6d4751d09b Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 05:25:30 2022 +0100 fix environment-mac.yml moved taming-transformers-rom1504 to pip dependencies commit 92abc00f16a34a586dd16d3c64408f00e23fcb53 Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 05:19:52 2022 +0100 fix test-invoke-conda - copy required conda environment yaml - use environment.yml - I use cp instead of ln since would be compatible for windows runners commit a5719aabf89c8c5f29c6044e2882ccdcd0c6916b Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 04:14:35 2022 +0100 update Dockerfile - link environment.yml from new environemnts path - change default conda_env_file - quote all variables to avoid splitting - also remove paths from conda-env-files in build-container.yml commit 44a18511fa7accfec6a20345774583a1ce745b02 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 20:51:06 2022 +0000 update paths in container build workflow commit b850dbadafba052310327ca759d96f49a9d25d03 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 20:16:57 2022 +0000 finished reorganization of install docs commit 9ef8b944d53afb1fed94c418b2fd936d2d743797 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 18:50:58 2022 +0000 tweaks to manual install documentation --prefer-binary is an iffy option in the requirements file. It isn't supported by some versions of pip, so I removed it from requirements-base.txt and inserted it into the manual install instructions where it seems to do what it is supposed to. commit efc5a9848803b4250d726bc1913b9fd5a33fad75 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 18:20:03 2022 +0000 manual installation documentation tested on Linux commit 1417c87928e13b0ed21bf1c5604f8636d3b50a8d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 17:37:06 2022 +0000 change name of requirements.txt to avoid confusion commit 2dd6fc2b93ff7bbb4038568a3b28d36a8fafaeb8 Merge: 22213612 71ee44a8 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 17:26:24 2022 +0000 Merge branch 'release-candidate-2-1-3' of github.com:/invoke-ai/InvokeAI into release-candidate-2-1-3 commit 22213612a08bbece46eafd48994f985b097cb141 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 17:25:59 2022 +0000 directory cleanup; working on install docs commit 71ee44a827898759fd457f774c0b2ac7a1ef6519 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 02:07:13 2022 +0000 prevent crash when switching to an invalid model commit b17ca0a5e731c142101bbdbf34d121df949e86d7 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 14:28:38 2022 +0100 don't suppress exceptions when doing cross-attention control commit 71bbfe4a1a5b70f90e5f41c94df50fb104dbdd79 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 12:59:34 2022 +0100 Fix #1362 by improving VRAM usage patterns when doing .swap() commit ef3f7a26e242b73c2beb0195c7fd8f654ef47f55 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 12:18:37 2022 +0100 remove log spam commit 7189d649622d4668b120b0dd278388ad672142c4 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 12:10:28 2022 +0100 change the way saved slicing strategy is applied commit 01c40f751ab72955140165c16f95ae411732265b Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 12:04:43 2022 +0100 fix slicing_strategy_getter callsite commit f8cfe25150a346958903316bc710737d99839923 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 11:56:22 2022 +0100 cleanup, consistent dim=0 also tested commit 5bf9b1e890d48e962afd4a668a219b68271e5dc1 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 11:34:09 2022 +0100 refactored context, tested with non-sliced cross attention control commit d58a46e39bf562e7459290d2444256e8c08ad0b6 Author: damian0815 <null@damianstewart.com> Date: Sun Nov 6 00:41:52 2022 +0100 cleanup commit 7e2c658b4c06fe239311b65b9bb16fa3adec7fd7 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:57:31 2022 +0100 disable logs commit 20ee89d93841b070738b3d8a4385c93b097d92eb Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:36:58 2022 +0100 slice saved attention if necessary commit 0a7684a22c880ec0f48cc22bfed4526358f71546 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:32:38 2022 +0100 raise instead of asserting commit 7083104c7f3a0d8fd96e94a2f391de50a3c942e4 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:31:00 2022 +0100 store dim when saving slices commit f7c0808ed383ec1dc70645288a798ed2aa4fa85c Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:27:16 2022 +0100 don't retry on exception commit 749a721e939b3fe7c1741e7998dab6bd2c85a0cb Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:24:50 2022 +0100 stuff commit 032ab90e9533be8726301ec91b97137e2aadef9a Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:20:17 2022 +0100 more logging commit 3dc34b387f033482305360e605809d95a40bf6f8 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:16:47 2022 +0100 logs commit 901c4c1aa4b9bcef695a6551867ec8149e6e6a93 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:12:39 2022 +0100 actually set save_slicing_strategy to True commit f780e0a0a7c6b6a3db320891064da82589358c8a Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:10:35 2022 +0100 store slicing strategy commit 93bb6d566fd18c5c69ef7dacc8f74ba2cf671cb7 Author: damian <git@damianstewart.com> Date: Sat Nov 5 20:43:48 2022 +0100 still not it commit 5e3a9541f8ae00bde524046963910323e20c40b7 Author: damian <git@damianstewart.com> Date: Sat Nov 5 17:20:02 2022 +0100 wip offloading attention slices on-demand commit 4c2966aa856b6f3b446216da3619ae931552ef08 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 15:47:40 2022 +0100 pre-emptive offloading, idk if it works commit 572576755e9f0a878d38e8173e485126c0efbefb Author: root <you@example.com> Date: Sat Nov 5 11:25:32 2022 +0000 push attention slices to cpu. slow but saves memory. commit b57c83a68f2ac03976ebc89ce2ff03812d6d185f Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 12:04:22 2022 +0100 verbose logging commit 3a5dae116f110a96585d9eb71d713b5ed2bc3d2b Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 11:50:48 2022 +0100 wip fixing mem strategy crash (4 test on runpod) commit 3cf237db5fae0c7b0b4cc3c47c81830bdb2ae7de Author: damian0815 <null@damianstewart.com> Date: Fri Nov 4 09:02:40 2022 +0100 wip, only works on cuda commit 5702271991e126c026aa1ff41c44f8ad37b26e3a Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 14:09:36 2022 +0000 speculative reorganization of the requirements & environment files - This is only a test! - The various environment*.yml and requirements*.txt files have all been moved into a directory named "environments-and-requirements". - The idea is to clean up our root directory so that the github home page is tidy. - The manual install instructions will start with the instructions to create a symbolic link from environment.yml to the appropriate file for OS and GPU. - The 1-click installers have been updated to accommodate this change. commit 10781e7dc4f4551583a110d14f2a1f60393112b8 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 01:59:45 2022 +0000 refactoring requirements commit 099d1157c579c7b9fea20945e8504cc15745c598 Author: mauwii <Mauwii@outlook.de> Date: Wed Nov 9 00:16:18 2022 +0100 better way to make sure if conda is useable commit ab825bf7ee5f0b82d2273da1cda64fc9266a978e Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 22:05:33 2022 +0000 add back --prefer-binaries to requirements commit 10cfeb5ada7bcfc9f3aff3716ab8ea4961a8b528 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 8 22:27:19 2022 +0100 add quotes to set and use `$environment_file` commit e97515d0453583e013674b4dd1f3739c7de402cc Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 8 22:24:21 2022 +0100 set environment file for conda update commit 0f04bc5789c712bf7c7319b1d93064914993f4ec Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 8 22:21:25 2022 +0100 use conda env update commit 3f74aabecd08ed25fac158463ae12b775bd1fca2 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 8 22:20:44 2022 +0100 use command instead of hash commit b1a99a51b7ca23c4b895855bd7b4c82dbdc431e4 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 14:44:44 2022 -0500 remove --global git config from 1-click installers commit 8004f8a6d99f6ff75e00c170da40f1dec93a8914 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Mon Nov 7 09:07:20 2022 -0500 Revert "Use array slicing to calc ddim timesteps" This reverts commit 1f0c5b4cf196716c21f2db74f92c8750ad8f889d. commit ff8ff2212afb1e1c2dce4f6a61f29e2bc8302eb5 Merge: 8e5363cd 636620b1 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 14:01:40 2022 +0000 add initfile support from PR #1386 commit 8e5363cd83bff0e6be0f002c644283955f7fcbfd Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 13:26:18 2022 +0000 move 'installer/' to '1-click-installer' to make room for tildebyte installer commit 1450779146e89510d12b8c90eb316d9861c3375e Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 12:56:36 2022 +0000 update branch for installer to pull against commit 8cd5d95b8a1cb213cce2f949c394c841a09d9cab Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 05:30:20 2022 +0000 move all models into subdirectories of ./models - this required an update to the invoke-ai fork of gfpgan - simultaneously reverted consolidation of environment and requirements files, as their presence in a directory triggered setup.py to try to install a sub-package. commit abd6407394d55d4f6c064a05f3ac989dd3817c59 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 03:52:46 2022 +0000 leave a copy of environment-cuda.yml at top level - named it environment.yml - need to avoid a big change for users and breaking older support instructions. commit 734dacfbe9d8c86ca943c6541e7b5ff5ef787ff4 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 03:50:07 2022 +0000 consolidate environment files - starting to remove unneeded entries and pins - no longer require -e in front of github dependencies - update setup.py with release number - update manual installation instructions commit 636620b1d5e2466613d0dcc2a604522be12fa3a4 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 03:26:16 2022 +0000 change initfile to ~/.invokeai - adjust documentation - also fix 'clipseg_models' to 'clipseg', which seems to be working now commit 1fe41146f0975bbc9d552208473490a9ccb9fc56 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 5 14:28:01 2022 -0400 add support for an initialization file, invokeai.init - Place preferred startup command switches in a file named "invokeai.init". The file can consist of a single line of switches such as "--web --steps=28", a series of switches on each line, or any combination of the two. Example: ``` --web --host=0.0.0.0 --steps=28 --grid -f 0.6 -C 11.0 -A k_euler_a ``` - The following options, which were previously only available within the CLI, are now available on the command line as well: --steps --strength --cfg_scale --width --height --fit commit 2ad6ef355a9b9c4b17bae71edea2346c2e8708c5 Merge: 865502ee 8b47c829 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sun Nov 6 18:08:36 2022 +0000 update discord link commit 865502ee4f681de4516d231370ae603983354d8f Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 18:00:16 2022 +0100 update changelog commit c7984f3299c5c8f56a70d80907d527af458674af Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 17:07:27 2022 +0100 update TROUBLESHOOT.md commit 7f150ed83302ba875c3e0c0f39d8ac0f32c6e362 Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 16:56:58 2022 +0100 remove `:`from headlines in CONTRIBUTORS.md commit badf4e256ce6e3201df1a9a87a7072b36b18d699 Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 16:56:37 2022 +0100 enable navigation tabs Since the docs are growing, this way they look cleaner commit e64c60bbb38fc1620e08ce52bf28bd17003c7ef6 Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 16:18:59 2022 +0100 remove preflight checks from assets seems like somebody executed tests and commited them commit 178061854300632b024810e65922b54b64d95939 Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 16:15:06 2022 +0100 update INSTALLING_MODELS.md commit f91fd276242a0c92b301e99d02982d30f7b712c3 Author: Kyle Schouviller <kyle0654@hotmail.com> Date: Sat Nov 5 14:47:53 2022 -0700 Bug fix for inpaint size commit 09e41e8f769457b9ffd56901aae13991cdc6eeb8 Author: Kyle Schouviller <kyle0654@hotmail.com> Date: Sat Nov 5 14:34:52 2022 -0700 Add inpaint size options to inpaint at a larger size than the actual inpaint image, then scale back down for recombination commit 6eeb2107b300fc27cfe6134b43e5570c246b8e96 Author: mauwii <Mauwii@outlook.de> Date: Sat Nov 5 21:01:14 2022 +0100 remove create-caches.yml since not used anywhere commit 17053ad8b7efecb21a9b4eb32695089f683f72e3 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 5 16:01:55 2022 -0400 fix duplicated argument introduced by conflict resolution commit fefb4dc1f88bc6551a39602a2bc79b278cd83c59 Merge: 762ca60a d05b1b35 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 5 12:47:35 2022 -0700 Merge branch 'development' into fix_generate.py commit d05b1b3544dfa7b3c071ac05b4f014a52e08fa50 Author: Craig <cwallen@users.noreply.github.com> Date: Sat Oct 29 20:40:30 2022 -0400 Resize hires as an image commit 82d4904c07670d514e9a541de7c9ecd8489eeae2 Author: Craig <cwallen@users.noreply.github.com> Date: Sat Oct 29 20:37:40 2022 -0400 Log strength with hires commit 1cdcf33cfa39e90f9660fabf8f5936dcfb6c3aa5 Merge: 6616fa83 cbc029c6 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 5 09:57:38 2022 -0400 Merge branch 'main' into development - this synchronizes recent document fixes by mauwii commit 6616fa835ac4318bf53419f2b54b88c962559578 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 4 00:47:03 2022 -0400 fix Windows library dependency issues This commit addresses two bugs: 1) invokeai.py crashes immediately with a message about an undefined attritube sigKILL (closes #1288). The fix is to pin torch at 1.12.1. 2) Version 1.4.2 of basicsr fails to load properly on Windows, and is a requirement of realesrgan, however 1.4.1 works. Pinning basicsr in our requirements file resulted in a dependency conflict, so I ended up cloning realesrgan into the invoke-ai Git space and changing the requirements file there. If there is a more elegant solution, please advise. commit 7b9a4564b11f4181b9b3c06ecda2a4a25fd1849e Author: Matthias Wild <40327258+mauwii@users.noreply.github.com> Date: Sat Nov 5 14:36:45 2022 +0100 Update-docs (#1382) * update IMG2IMG.md * update INPAINTING.md * update WEBUIHOTKEYS.md * more doc updates (mostly fix formatting): - OUTPAINTING.md - POSTPROCESS.md - PROMPTS.md - VARIATIONS.md - WEB.md - WEBUIHOTKEYS.md commit fcdefa0620761472718afa14b2955a5d0603cfcc Author: Matthias Wild <40327258+mauwii@users.noreply.github.com> Date: Fri Nov 4 20:47:31 2022 +0100 Hotifx docs (#1376) (#1377) commit ef8b3ce639954259a95a38f44fa5329687bee781 Merge: b7042095 36870a8f Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 4 12:08:44 2022 -0400 Merge-main-into-development (#1373) To get the rid of the difference between main and development. Since otherwise it will be a pain to start fixing the documentatino (when the state between main and development is not the same ...) Also this should fix the problem of all tests failing since environment yamls get updated. commit 36870a8f53217d4b733e9bb8b119190b5e36da59 Merge: 6b89adfa b7042095 Author: Matthias Wild <40327258+mauwii@users.noreply.github.com> Date: Fri Nov 4 16:25:00 2022 +0100 Merge branch 'development' into merge-main-into-development commit b70420951d5b70937c0c07e4f8a552a01c3008bc Author: damian0815 <null@damianstewart.com> Date: Thu Nov 3 12:39:45 2022 +0100 fix parsing error doing eg `forest ().swap(in winter)` commit 1f0c5b4cf196716c21f2db74f92c8750ad8f889d Author: wfng92 <43742196+wfng92@users.noreply.github.com> Date: Thu Nov 3 17:13:52 2022 +0800 Use array slicing to calc ddim timesteps commit 8648da811190fc8bcf237d83aff38cf605851300 Author: mauwii <Mauwii@outlook.de> Date: Fri Nov 4 00:06:19 2022 +0100 update environment-linux-aarch64 to use python 3.9 commit 45b459356399f8cfb7e9af571c1643fab04218fe Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 3 22:31:46 2022 +0100 update environment-linux-aarch64.yml - move getpass_asterisk to pip commit 41b04316cf5118ea9518dc77934d135a489dd684 Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 3 20:40:08 2022 +0100 rename job, remove debug branch from triggers commit e97c6db2a3c0157a8a5ab74cd28ebee480a2d078 Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 3 20:34:01 2022 +0100 include build matrix to build x86_64 and aarch64 commit 896820a349292b0e14bbc32f0c557fe8a6b45395 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 05:01:15 2022 +0100 disable caching commit 06c8f468bff7e1dfecc1a1990164be1005b114a7 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 04:26:39 2022 +0100 disable PR-Validation since there are no files passed from context this is unecesarry commit 61920e2701c4a9cea94c03ab933c4482458215b7 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 04:09:39 2022 +0100 update action to use current branch also update build-args of dockerfile and build.sh commit f34ba7ca70f1c417ee97e8b0c57abff57614d78f Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 02:30:24 2022 +0100 remove unecesarry mkdir command again commit c30ef0895dbf0565345ac6ccb136d98a174470a6 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 01:51:12 2022 +0100 remove symlink to GFPGANv1.4 also re-add mkdir to prevent action from failing commit aa3a774f73d5004571ea42fea14cd2b525fffb1c Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 01:48:59 2022 +0100 update build-container.yml to use cachev3 commit 2c30555b844293764123baa4137fcf952d40a4e7 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 01:34:20 2022 +0100 update Dockerfile - create models.yaml from models.yaml.example - run preload_models.py with --no-interactive commit 743f60577364d43237eeb46aefd523371c36e56b Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 01:21:15 2022 +0100 update build.sh to download sd-v1.5 model commit 519c661abbae83aa62b3ee536635c39192890441 Author: mauwii <Mauwii@outlook.de> Date: Tue Oct 25 01:26:50 2022 +0200 replace old fashined markdown templates with forms this will help the readability of issues a lot 🤓 commit 22c956c75f4797ddc2dffa944e3ea84b4eb3477c Merge: 13696adc 0196571a Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 3 10:20:21 2022 -0400 Merge branch 'development' of github.com:invoke-ai/InvokeAI into development commit 13696adc3a3a2b169e68048a5b511660d0430fae Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 3 10:20:10 2022 -0400 speculative change to solve windows esrgan issues commit 0196571a12992eb8207d36e022721fe3ad2cfd19 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 2 22:39:35 2022 -0400 remove merge markers from preload_models.py commit 9666f466ab1c710dfda2e59be9e8a26fcd7e8718 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 2 18:29:34 2022 -0400 use refined model by default commit 240e5486c89552ef480c3443a63283fb86a493c3 Merge: 8164b6b9 aa247e68 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 2 18:35:00 2022 -0400 Merge branch 'spezialspezial-patch-9' into development commit 8164b6b9cff077e4131384195af65e30a40733a7 Merge: 4fc82d55 dd5a88dc Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 2 17:06:46 2022 -0400 Merge branch 'development' of github.com:invoke-ai/InvokeAI into development commit 4fc82d554ff573780c0af562a6bc9586aa56012d Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 04:17:28 2022 +1300 [WebUI] Final 2.1 Release Build commit 96b34c0f85f6ed52707fe43456d20b81822c7d1d Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 09:08:11 2022 +0100 Final WebUI build for Release 2.1 - squashed commit of 52 commits from PR #1327 don't log base64 progress images Fresh Build For WebUI [WebUI] Loopback Default False Fixes bugs/styling - Fixes missing web app state on new version: Adds stateReconciler to redux-persist. When we add more values to the state and then release the update app, they will be automatically merged in. Reseting web UI will be needed far less. 7159ec - Fixes console z-index - Moves reset web UI button to visible area Decreases gallery width on inpainting Increases workarea split padding to 1rem Adds missing tooltips to site header Changes inpainting controls settings to hover Fixes hotkeys and settings buttons not working Improves bounding box interactions - Bounding box can now be moved by dragging any of its edges - Bounding box does not affect drawing if already drawing a stroke - Can lock bounding box to draw directly on the bounding box edges - Removes spacebar-hold behaviour due to technical issues Fixes silent crash when init image too large To send the mask to the server, the UI rendered the mask onto the init image and sent the whole image. The mask was then cropped by the server. If the image was too large, the app silently failed. Maybe it exceeds the websocket size limit. Fixed by cropping the mask in the UI layer, sending only bounding-box-sized mask image data. Disabled bounding box settings when locked Styles image uploader Builds fresh bundle Improves bounding box interaction Added spacebar-hold-to-transform back. Address bounding box feedback - Adds back toggle to hide bounding box - Box quick toggle = q, normal toggle = shift + q - Styles canvas alert icons Adds hints when unable to invoke - Popover on Invoke button indicates why exactly it is disabled, e.g. prompt is empty, something else is processing, etc. - There may be more than one reason; all are displayed. Fix Inpainting Alerts Styling Preventing unnecessary re-renders across the app Code Split Inpaint Options Isolate features to their own components so they dont re-render the other stuff each time. [TESTING] Remove global isReady checking I dont believe this is need at all because the isready state is constantly updated when needed and tracked real time in the Redux store. This causes massive re-renders. @psychedelicious If this is absolutely essential for a reason that I do not see, please hit me up on Discord. Fresh Bundle Fix Bounding Box Settings re-rendering on brush stroke [Code Splitting] Bounding Box Options Isolated all bounding box components to trigger unnecessary re-renders. Still need to fix bounding box triggering re-renders on the control panel inside the canvas itself. But the options panel should be a good to go with this change. Inpainting Controls Code Spitting and Performance Codesplit the entirety of the inpainting controls. Created new selectors for each and every component to ensure there are no unnecessary re-renders. App feels a lot smoother. Fixes rerenders on ClearBrushHistory Fixes crash when requesting post-generation upscale/face restoration - Moves the inpainting paste to before the postprocessing. Removes unused isReady state Changes Report Bug icon to a bug Restores shift+q bounding box shortcut Adds alert for bounding box size to status icons Adds asCheckbox to IAIIconButton Rough draft of this. Not happy with the styling but it's clearer than having them look just like buttons. Fixes crash related to old value of progress_latents in state Styling changes and settings modal minor refactor Fixes: uploaded JPG images not loading Reworks CurrentImageButtons.tsx - Change all icons to FA iconset for consistency - Refactors IAIIconButton, IAIButton, IAIPopover to handle ref forwarding - Redesigns buttons into group Only generate 1 iteration when seed fixed & variations disabled Fixes progress images select Fixes edge case: upload over gets stuck while alt tabbing - Press esc to close it now Fixes display progress images select typing Fixes current image button rerenders Adds min width to ImageUploader Makes fast-latents in progress default Update Icon Button Checkbox Style Styling Fixes next/prev image buttons Refactor canvas buttons + more Add Save Intermediates Step Count For accurate mode only. Co-Authored-By: Richard Macarthy <richardmacarthy@protonmail.com> Restores "initial image" text Address feedback - moves mask clear button - fixes intermediates - shrinks inpainting icons by 10% Fix Loopback Styling Adds escape hotkey to close floating panels Readd Hotkey for Dual Display Updated Current Image Button Styling commit dd5a88dceeec53ceb1722a62e3689ae3dd871154 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 04:17:28 2022 +1300 [WebUI] Final 2.1 Release Build commit 95ed56bf82825a47cfe406fa34eaf4e32c129143 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 04:16:31 2022 +1300 Updated Current Image Button Styling commit 1ae80f5ab9d00a25e0c3a21e2eccd318c5343401 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 04:07:57 2022 +1300 Readd Hotkey for Dual Display commit 1f0bd3ca6cda4221d1a7a46325f235cd23bd0af9 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu Nov 3 02:07:00 2022 +1100 Adds escape hotkey to close floating panels commit a1971f6830306b3d748f7f36c2243f6dee682f97 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 03:38:15 2022 +1300 Fix Loopback Styling commit c6118e889895ba35a191124ce1beb5d2b719366d Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu Nov 3 01:29:51 2022 +1100 Address feedback - moves mask clear button - fixes intermediates - shrinks inpainting icons by 10% commit 7ba958cf7ff4e804a127b71c88666084f81e7340 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu Nov 3 01:10:38 2022 +1100 Restores "initial image" text commit 383905d5d24359aa1824de96ff124a8f8a87e015 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 02:59:11 2022 +1300 Add Save Intermediates Step Count For accurate mode only. Co-Authored-By: Richard Macarthy <richardmacarthy@protonmail.com> commit 6173e3e9cabd5e74fb466d55d7bb6a80a77b3fa8 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu Nov 3 00:53:53 2022 +1100 Refactor canvas buttons + more commit 3feb7d8922b0e4c9f944e96b95211003f40d9705 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu Nov 3 00:49:23 2022 +1100 Fixes next/prev image buttons commit 1d9edbd0ddd6e10cf120fe0de3db0b56ae374db4 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 00:50:44 2022 +1300 Update Icon Button Checkbox Style Styling commit d439abdb89db73e652add9df371234861189d90c Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 21:37:24 2022 +1100 Makes fast-latents in progress default commit ee47ea0c891a33049bdec12f1c254926f341eff2 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 21:37:09 2022 +1100 Adds min width to ImageUploader commit 300bb2e6279c1c477131b9e57425db348062f19c Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 21:28:22 2022 +1100 Fixes current image button rerenders commit ccf8593501d23e00979f7340f8991514e6ca3428 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 21:27:43 2022 +1100 Fixes display progress images select typing commit 0fda612f3ff8ad75932e158b9b29cf64c3f30eb6 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 21:02:01 2022 +1100 Fixes edge case: upload over gets stuck while alt tabbing - Press esc to close it now commit 5afff65b71bb60d067392c120efff1a17adc66af Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 20:33:19 2022 +1100 Fixes progress images select commit 7e55bdefce8920831cac7b9fa857bfbffe9e9d5d Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 20:27:47 2022 +1100 Only generate 1 iteration when seed fixed & variations disabled commit 620cf84d3dd54b8498e84574f33040a26d4d315f Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 19:51:38 2022 +1100 Reworks CurrentImageButtons.tsx - Change all icons to FA iconset for consistency - Refactors IAIIconButton, IAIButton, IAIPopover to handle ref forwarding - Redesigns buttons into group commit cfe567c62ad3fd0cff5e3e579a2250ca5dfa2d53 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 16:14:50 2022 +1100 Fixes: uploaded JPG images not loading commit cefe12f1df72e051f109ed77ce46f18093b3b8bb Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 15:31:18 2022 +1100 Styling changes and settings modal minor refactor commit 1e51c3992853ad4643d8eda2443a3bd0d65f5f90 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 15:27:46 2022 +1100 Fixes crash related to old value of progress_latents in state commit 42a02bbb8087cd46a1b5c795b1b41e38c08ba229 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 13:15:06 2022 +1100 Adds asCheckbox to IAIIconButton Rough draft of this. Not happy with the styling but it's clearer than having them look just like buttons. commit f1ae6dae4c36e74ca8dedf8b57eb8933c059dcf4 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 13:13:56 2022 +1100 Adds alert for bounding box size to status icons commit 6195579910a91fb2ab7e1186aa1c1145566c3122 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 11:52:19 2022 +1100 Restores shift+q bounding box shortcut commit 16c8b23b347792d7811cff66a27d350fe5d0d62c Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 11:32:07 2022 +1100 Changes Report Bug icon to a bug commit 07ae626b22554b5222a3b71d1ce3974e2c3fb284 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 11:17:16 2022 +1100 Removes unused isReady state commit 8d171bb044f578d4b9cc4911edfa05b20a01d373 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 11:13:26 2022 +1100 Fixes crash when requesting post-generation upscale/face restoration - Moves the inpainting paste to before the postprocessing. commit 6e33ca7e9e64fb355430511e28bb08c32c9c68b1 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 10:59:01 2022 +1100 Fixes rerenders on ClearBrushHistory commit db46e12f2b8c98dac8895ea4d04242d3754dbec4 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 11:36:28 2022 +1300 Inpainting Controls Code Spitting and Performance Codesplit the entirety of the inpainting controls. Created new selectors for each and every component to ensure there are no unnecessary re-renders. App feels a lot smoother. commit 868e4b2db82fa8556b423111f2f8d565a70ec129 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 07:40:31 2022 +1300 [Code Splitting] Bounding Box Options Isolated all bounding box components to trigger unnecessary re-renders. Still need to fix bounding box triggering re-renders on the control panel inside the canvas itself. But the options panel should be a good to go with this change. commit 2e562742c13988a1fc299c673a97ba4e4a645aaf Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 06:40:27 2022 +1300 Fix Bounding Box Settings re-rendering on brush stroke commit 68e69580091fc1dc1d8b6e03c9e7ef777c7ebf61 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 06:28:34 2022 +1300 Fresh Bundle commit ea6e3a7949f2743711516261cb7e450517d39702 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 06:26:56 2022 +1300 [TESTING] Remove global isReady checking I dont believe this is need at all because the isready state is constantly updated when needed and tracked real time in the Redux store. This causes massive re-renders. @psychedelicious If this is absolutely essential for a reason that I do not see, please hit me up on Discord. commit b2879ca99f88869277c474185ade049914b0bf26 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 06:08:59 2022 +1300 Code Split Inpaint Options Isolate features to their own components so they dont re-render the other stuff each time. commit 4e911566c33989392eb3279049b15331ca98594a Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 03:50:56 2022 +1300 Preventing unnecessary re-renders across the app commit 9bafda6a152778893df143776ae859a3b8b7f192 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 03:02:35 2022 +1300 Fix Inpainting Alerts Styling commit 871a8a5375cae891f22eb853ffd2d22298298b11 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 23:52:07 2022 +1100 Adds hints when unable to invoke - Popover on Invoke button indicates why exactly it is disabled, e.g. prompt is empty, something else is processing, etc. - There may be more than one reason; all are displayed. commit 0eef74bc00d3c0cedc5037c1deeef1d9a5b6d33d Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 23:40:11 2022 +1100 Address bounding box feedback - Adds back toggle to hide bounding box - Box quick toggle = q, normal toggle = shift + q - Styles canvas alert icons commit 423ae3209782f1d8d321b2ed9ed00712b726adf7 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 17:06:07 2022 +1100 Improves bounding box interaction Added spacebar-hold-to-transform back. commit 8282e5d0458ca1bba5565c069093b5389f2228d4 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 16:57:07 2022 +1100 Builds fresh bundle commit 19305cdbdf6ac74833bd6011bff0ced8e9d36f69 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 16:51:11 2022 +1100 Styles image uploader commit eb9028ab3069bca9d747aca664ca60ae13ba6df8 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 16:51:03 2022 +1100 Disabled bounding box settings when locked commit 21483f5d0731bce5aa97985e722a64bf0d7cd12c Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 16:50:24 2022 +1100 Fixes silent crash when init image too large To send the mask to the server, the UI rendered the mask onto the init image and sent the whole image. The mask was then cropped by the server. If the image was too large, the app silently failed. Maybe it exceeds the websocket size limit. Fixed by cropping the mask in the UI layer, sending only bounding-box-sized mask image data. commit 82dcbac28f140aa7bd89d967bcc7fa31cb03a267 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 16:28:30 2022 +1100 Improves bounding box interactions - Bounding box can now be moved by dragging any of its edges - Bounding box does not affect drawing if already drawing a stroke - Can lock bounding box to draw directly on the bounding box edges - Removes spacebar-hold behaviour due to technical issues commit d43bd4625d64a03d90de0458ad5fcacef211a8a6 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 15:10:49 2022 +1100 Fixes hotkeys and settings buttons not working commit ea891324a2086faf8eeeeac7eaf47ae2935322fb Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 11:04:02 2022 +1100 Changes inpainting controls settings to hover commit 8fd9ea219390493f392e690eadb23c4209a4ecfc Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 11:03:41 2022 +1100 Adds missing tooltips to site header commit fb026668563b3179805819a1630c654c9ce260d9 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 11:03:25 2022 +1100 Increases workarea split padding to 1rem commit f6f5c2731b0c37089c5d7382736f973e857df712 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 11:03:10 2022 +1100 Decreases gallery width on inpainting commit b4e3f771e0314e0a18ad5cedc80b28f246fced59 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 10:54:59 2022 +1100 Fixes bugs/styling - Fixes missing web app state on new version: Adds stateReconciler to redux-persist. When we add more values to the state and then release the update app, they will be automatically merged in. Reseting web UI will be needed far less. 7159ec - Fixes console z-index - Moves reset web UI button to visible area commit 99bb9491ac97f1f733accab839ea38cdf4870ba0 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Tue Nov 1 08:35:45 2022 +1300 [WebUI] Loopback Default False commit 0453f211278a533a49fb1aee54dd989b69179c10 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 23:23:51 2022 +1300 Fresh Build For WebUI commit 9fc09aa4bda3b3e6139b026f24733a37747d373f Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 09:08:11 2022 +0100 don't log base64 progress images commit 5e87062cf809a08242d3b006b66d3bbb834ddb16 Author: spezialspezial <75758219+spezialspezial@users.noreply.github.com> Date: Wed Nov 2 00:21:27 2022 +0100 Option to directly invert the grayscale heatmap - fix commit 3e7a459990407ad1679f38d4027c19d50a9d36e3 Author: spezialspezial <75758219+spezialspezial@users.noreply.github.com> Date: Tue Nov 1 21:37:33 2022 +0100 Update txt2mask.py commit bbf4c03e500bafc8627c2a70f8b3396efeddabb3 Author: spezialspezial <75758219+spezialspezial@users.noreply.github.com> Date: Tue Nov 1 21:11:19 2022 +0100 Option to directly invert the grayscale heatmap Theoretically less work inverting the image while it's small but I can't measure a significant difference. Though, handy option to have in some cases. commit 611a3a975328a7e276c2781214d5e14108708ed7 Author: mauwii <Mauwii@outlook.de> Date: Wed Nov 2 02:23:09 2022 +0100 fix name of caching step commit 1611f0d1815022fe90d33f41c21d670251a75f29 Author: mauwii <Mauwii@outlook.de> Date: Wed Nov 2 02:18:46 2022 +0100 readd caching of sd-models - this would remove the necesarrity of the secret availability in PRs commit 08835115e4c5c0ee3587ce07ab769a04d55cb3c5 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 22:10:12 2022 -0400 pin pytorch_lightning to 1.7.7, issue #1331 commit 2d84e28d329be282b51a4cbc22f7c200d80c8f0e Merge: 533fd04e ef17aae8 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 22:11:04 2022 -0400 Merge branch 'development' of github.com:invoke-ai/InvokeAI into development commit ef17aae8abe03fd87dc6f91b3c6d2fe03375f6c5 Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 00:39:48 2022 +0100 add damian0815 to contributors list commit 0cc39f01a3c67f32873b7888e1e032d33626e269 Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 01:18:50 2022 +0100 report full size for fast latents and update conversion matrix for v1.5 commit 688d7258f185035a5924bee23322b001574da931 Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 00:33:00 2022 +0100 fix a bug that broke cross attention control index mapping commit 4513320bf161d3efdd99e2aef4f7c37472131373 Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 00:31:58 2022 +0100 save VRAM by not recombining tensors that have been sliced to save VRAM commit 533fd04ef0d1ba9d2cb25d556991b999e7d44aba Merge: 6215592b dff5681c Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 17:40:36 2022 -0400 Merge branch 'development' of github.com:invoke-ai/InvokeAI into development commit dff5681cf0e24faf67d5eb5903203c4ea39f89bd Author: damian0815 <d@d.com> Date: Tue Nov 1 13:56:03 2022 +0100 shorter strings commit 5a2790a69b11e049d2507bc22eab7812915d867f Author: damian0815 <d@d.com> Date: Tue Nov 1 13:19:20 2022 +0100 convert progress display to a drop-down commit 7c5305ccbaf7926162536aa3a9e51dcdd8574d0d Author: damian0815 <d@d.com> Date: Tue Nov 1 12:54:46 2022 +0100 do not try to save base64 intermediates in gallery on cancellation commit 4013e8ad6fa5e5c2a710c607fe7e1d040f353299 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 21:54:35 2022 +1100 Fixes b64 image sending and displaying commit d1dfd257f9e1cafd352d9007a56194226b9d6b63 Author: damian <d@d.com> Date: Tue Nov 1 11:40:40 2022 +0100 wip base64 commit 5322d735ee4515d89293b7fb015b2ce048262f68 Author: damian <d@d.com> Date: Tue Nov 1 11:31:42 2022 +0100 update frontend commit cdb107dcda858a8bb64455cc60a196a42345f8f7 Author: damian <d@d.com> Date: Tue Nov 1 11:17:43 2022 +0100 add option to show intermediate latent space commit be1393a41ce7a75ed8de7f648a93c5e5974a50d2 Author: damian <d@d.com> Date: Tue Nov 1 10:16:55 2022 +0100 ensure existing exception handling code also handles new exception class commit e554c2607f00a5e51c03052acb9861ff21ec1c12 Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Tue Nov 1 10:08:42 2022 +0100 Rebuilt prompt parsing logic Complete re-write of the prompt parsing logic to be more readable and logical, and therefore also hopefully easier to debug, maintain, and augment. In the process it has also become more robust to badly-formed prompts. Squashed commit of the following: commit 8fcfa88a16e1390d41717e940d72aed64712171c Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Sun Oct 30 17:05:57 2022 +0100 further cleanup commit 1a1fd78bcfeb49d072e3e6d5808aa8df15441629 Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Sun Oct 30 16:07:57 2022 +0100 cleanup and document commit 099c9659fa8b8135876f9a5a50fe80b20bc0635c Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Sun Oct 30 15:54:58 2022 +0100 works fully commit 5e6887ea8c25a1e21438ff6defb381fd027d25fd Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Sun Oct 30 15:24:31 2022 +0100 further... commit 492fda120844d9bc1ad4ec7dd408a3374762d0ff Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Sun Oct 30 14:08:57 2022 +0100 getting there... commit c6aab05a8450cc3c95c8691daf38fdc64c74f52d Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Fri Oct 28 14:29:03 2022 +0200 wip doesn't compile commit 5e533f731cfd20cd435330eeb0012e5689e87e81 Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Fri Oct 28 13:21:43 2022 +0200 working with CrossAttentionCtonrol but no Attention support yet commit 9678348773431e500e110e8aede99086bb7b5955 Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Fri Oct 28 13:04:52 2022 +0200 wip rebuiling prompt parser commit 6215592b12dea3822c727913b771012789a52477 Merge: ef24d76a 349cc254 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 17:34:55 2022 -0400 Merge branch 'development' of github.com:invoke-ai/InvokeAI into development commit 349cc25433e1d358c6c61cca4a6c300ecc8ca3d7 Author: damian0815 <d@d.com> Date: Tue Nov 1 20:08:52 2022 +0100 fix crash (be a little less aggressive clearing out the attention slice) commit 214d276379387ae0fa2259602ab00884ec1ad03e Author: damian0815 <d@d.com> Date: Tue Nov 1 19:57:55 2022 +0100 be more aggressive at clearing out saved_attn_slice commit ef24d76adc5a192297714707cd6794d4f44bcf67 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 14:34:23 2022 -0400 fix library problems in preload_modules commit ab2b5a691dadb292f7cecf5db94a165db3e3e126 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 17:22:48 2022 -0400 fix model_cache memory management issues commit c7de2b2801ad5d6ce52a5f44e88c5705f1dbf524 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 02:02:14 2022 +0100 disable checks with sd-V1.4 model... ...to save some resources, since V1.5 is the default now commit e8075658acf675346d35435d0cfb7710becab42a Author: mauwii <Mauwii@outlook.de> Date: Mon Oct 31 22:20:51 2022 +0100 update test-invoke-conda.yml - fix model dl path for sd-v1-4.ckpt - copy configs/models.yaml.example to configs/models.yaml commit 4202dabee1143f597f4c3946420fbfa7b8eccddf Author: mauwii <Mauwii@outlook.de> Date: Mon Oct 31 22:17:21 2022 +0100 fix models example weights for sd-v1.4 commit d67db2bcf1ac26d8bb7c5f8bfd056f2172597780 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Tue Nov 1 08:35:45 2022 +1300 [WebUI] Loopback Default False commit 7159ec885faa1117a3506689d547618be1d91808 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Mon Oct 31 11:33:05 2022 -0400 further improvements to preload_models.py - Faster startup for command line switch processing - Specify configuration file to modify using --config option: ./scripts/preload_models.ply --config models/my-models-file.yaml commit b5cf734ba9f1aeaab14075b55cc13ed9a0ae31e2 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Mon Oct 31 11:08:19 2022 -0400 improve behavior of preload_models.py - NEVER overwrite user's existing models.yaml - Instead, merge its contents into new config file, and rename original to models.yaml.orig (with message) - models.yaml has been removed from repository and renamed models.yaml.example commit f7dc8eafeef991e135b5541c01d0ff740dda9591 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Mon Oct 31 10:47:35 2022 -0400 restore models.yaml to virgin state commit 762ca60a309f70daaf1b9e79b6273f76fd9474b6 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Oct 4 22:55:10 2022 -0400 Update INPAINTING.md commit e7fb9f342cb5ed0c09e6215026d60d45eef3ebcb Author: Hideyuki Katsushiro <h.katsushiro@qualia.tokyo.jp> Date: Wed Oct 5 10:08:53 2022 +0900 add argument --outdir
2022-11-12 17:17:07 +00:00
outdir = kwargs.pop('outdir', self.outdir)
Refactoring simplet2i (#387) * start refactoring -not yet functional * first phase of refactor done - not sure weighted prompts working * Second phase of refactoring. Everything mostly working. * The refactoring has moved all the hard-core inference work into ldm.dream.generator.*, where there are submodules for txt2img and img2img. inpaint will go in there as well. * Some additional refactoring will be done soon, but relatively minor work. * fix -save_orig flag to actually work * add @neonsecret attention.py memory optimization * remove unneeded imports * move token logging into conditioning.py * add placeholder version of inpaint; porting in progress * fix crash in img2img * inpainting working; not tested on variations * fix crashes in img2img * ported attention.py memory optimization #117 from basujindal branch * added @torch_no_grad() decorators to img2img, txt2img, inpaint closures * Final commit prior to PR against development * fixup crash when generating intermediate images in web UI * rename ldm.simplet2i to ldm.generate * add backward-compatibility simplet2i shell with deprecation warning * add back in mps exception, addresses @vargol comment in #354 * replaced Conditioning class with exported functions * fix wrong type of with_variations attribute during intialization * changed "image_iterator()" to "get_make_image()" * raise NotImplementedError for calling get_make_image() in parent class * Update ldm/generate.py better error message Co-authored-by: Kevin Gibbons <bakkot@gmail.com> * minor stylistic fixes and assertion checks from code review * moved get_noise() method into img2img class * break get_noise() into two methods, one for txt2img and the other for img2img * inpainting works on non-square images now * make get_noise() an abstract method in base class * much improved inpainting Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
2022-09-06 00:40:10 +00:00
return self.prompt2png(prompt, outdir, **kwargs)
def img2img(self, prompt, **kwargs):
merge release-candidate-1-3-2 into main. Squashed commit of the following: commit 9a1fe8e7fbbd81d9e9e47c4fda6bde6f66fba30c Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 12 17:07:40 2022 +0000 swap in release URLs for installers commit ff56f5251ba8502833cb561317e82b028cd2da5d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 12 17:03:21 2022 +0000 fix up bad unicode chars in invoke.py commit ed943bd6c785d968d1e31fbbb814fea8688fc8bb Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 12 16:05:45 2022 +0000 outcrop improvements, hand-added commit 7ad2355b1da53861bb75312edead8f9db0b0f44d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 12 15:14:33 2022 +0000 documentation fixes commit 66c920fc197d9206be9e0e2d1eb2a1cb86362887 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 16:49:25 2022 -0500 Revert "Resize hires as an image" This reverts commit d05b1b3544dfa7b3c071ac05b4f014a52e08fa50. commit 3fc5cb09f8bc03ea96e67a3e49fb087019d2f9d5 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 12 12:43:17 2022 +0000 fix incorrect link in install commit 1345ec77ab58f70e1bf5a0f587ca40aba4e906b7 Author: tildebyte <337875+tildebyte@users.noreply.github.com> Date: Sun Nov 6 19:07:31 2022 -0500 toil(repo): add tildebyte as owner of installer/ directory commit b116715490f390a59e5bee1022a6a758aee0918d Author: Kyle Schouviller <kyle0654@hotmail.com> Date: Thu Nov 10 21:43:56 2022 -0800 Fix performance issue introduced by torch cuda cache clear during generation commit fa3670270e7aae6bfd8d47fb7bdd32b707310c23 Author: mauwii <Mauwii@outlook.de> Date: Fri Nov 11 12:42:03 2022 +0100 small update to dockers huggingface section commit c304250ef663b3e202b4da8332365288589d94c7 Author: mauwii <Mauwii@outlook.de> Date: Fri Nov 11 12:19:27 2022 +0100 fix format and Link in INSTALL_INVOKE.md commit 802ce5dde5ca68f24aa4609cdba428044e0c7fa1 Author: mauwii <Mauwii@outlook.de> Date: Fri Nov 11 11:17:49 2022 +0100 small fixex to format and a link in INSTALL_MANUAL commit 311ee320ecac892cb4a1bcd012374fa051b1d011 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 07:23:35 2022 +0000 ignore installer intermediate files commit e9df17b374df58a44d3ae3ba33cbdc58794bcf5d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 07:19:25 2022 +0000 fix backslash-related syntax error commit 061fb4ef00482bdd4fba635aeaeff4ca7510190d Merge: 52be0d23 4095acd1 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 06:50:04 2022 +0000 Merge branch 'release-candidate-2-1-3' of github.com:/invoke-ai/InvokeAI into release-candidate-2-1-3 commit 52be0d2396de2de02030855c92e3367008b50377 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 06:49:45 2022 +0000 add WindowsLongFileName batfile to source installer commit 4095acd10ebae05a8cb14cc2faf7c79936d9e6a9 Author: mauwii <Mauwii@outlook.de> Date: Fri Nov 11 07:05:17 2022 +0100 Doc Updates A lot of re-formating of new Installation Docs also some content updates/corrections commit 201eb22d7650b00f55249c2646fa4f47ac3e0ec2 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 04:41:02 2022 +0000 prevent two models from being marked default in models.yaml commit 17ab98220034dfbb798a9a0460bc2837f0c1e2cb Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 03:56:54 2022 +0000 installers download branch HEAD not tag commit a04965b0e9e9d1170cf284af9acbd1186d681255 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 03:48:21 2022 +0000 improve messaging during installation process commit 0b529f0c574dd91fb9593e924ebc41c8c219b6ce Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 15:22:32 2022 +0000 enable outcropping of random JPG/PNG images - Works best with runwayML inpainting model - Numerous code changes required to propagate seed to final metadata. Original code predicated on the image being generated within InvokeAI. commit 6f9f84834557eb3c48562dc5d0ace51ca9e9cca2 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 17:27:42 2022 +0000 enhance outcropping with ability to direct contents of new regions - When outcropping an image you can now add a `--new_prompt` option, to specify a new prompt to be used instead of the original one used to generate the image. - Similarly you can provide a new seed using `--seed` (or `-S`). A seed of zero will pick one randomly. - This PR also fixes the crash that happened when trying to outcrop an image that does not contain InvokeAI metadata. commit 918c1589ef30595668899f4259ece6a4ad605c69 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 20:16:47 2022 +0000 fix #1402 commit 116415b3fcec8415f8e6de9b23c0bbd0dbc6845b Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 21:27:25 2022 +0000 fix invoke.py crash if no models.yaml file present - Script will now offer the user the ability to create a minimal models.yaml and then gracefully exit. - Closes #1420 commit b4b6eabaac94896e38123be331c44d1b63065b0d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 16:49:25 2022 -0500 Revert "Log strength with hires" This reverts commit 82d4904c07670d514e9a541de7c9ecd8489eeae2. commit 4ef1f4a854717c953f9192454d0adabef32af36c Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 20:01:49 2022 +0000 remove temporary directory from repo commit 510fc4ebaa5f9dc0e77b47cf04e0c265423e0a44 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 19:59:03 2022 +0000 remove -e from clipseg load in installer commit a20914434bb3609cf1d883cabf048d4cc25f881a Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 19:37:07 2022 +0000 change clipseg repo branch to avoid clipseg not found error commit 0d134195fda5c69fce5a95d6da90248eba8d226d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 18:39:29 2022 +0000 update repo URL to point to rc commit 649d8c8573896fdb5a73453b69ee4b54cf4d6241 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 18:13:28 2022 +0000 integrate tildebyte installer commit a358d370a05ea985a9e26fa9c1101d9c14fdb3ab Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 17:48:14 2022 +0000 add @tildebyte compiled pip installer commit 94a9033c4f6214e604be149a3de6d7c747af7f3a Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 14:52:00 2022 +0000 ignore source installer zip files commit 18a947c503c83c95cd83f27424696219ff3c4c95 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 14:46:36 2022 +0000 documentation and environment file fixes - Have clarified the relationship between the @tildebyte and @cmdr2 installers; However, @tildebyte installer merge is still a WIP due to conflicts over such things as `invoke.sh`. - Rechristened 1click installer as "source" installer. @tildebyte installer will be "the" installer. (We'll see which one generates the least support requests and maintenance work.) - Sync'd `environment-mac.yml` with `development`. The former was failing with a taming-transformers error as per https://discord.com/channels/@me/1037201214154231899/1040060947378749460 commit a23b03189526a49da8ddae90ce71b0e902784d29 Author: Mike DiGiovanni <vinblau@gmail.com> Date: Wed Nov 9 16:44:59 2022 -0500 Fixes typos in README.md commit 23af68c7d79d947f1bd3441c91bb44d655238f01 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 07:02:27 2022 -0500 downgrade win installs to basicsr==1.4.1 commit e258beeb51f3e645b9ea60e52d69d18722221cc5 Merge: 7460c069 e481bfac Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 06:37:45 2022 -0500 Merge branch 'release-candidate-2-1-3' of github.com:invoke-ai/InvokeAI into release-candidate-2-1-3 commit 7460c069b880b10c84b55f2e0c0998e350d6cf12 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 06:36:48 2022 -0500 remove --prefer-binary from requirements-base.txt It appears that some versions of pip do not recognize this option when it appears in the requirements file. Did not explore this further but recommend --prefer-binary in the manual install instructions on the command line. commit e481bfac615e0c798ceb5e59e8fbe3038f85b431 Merge: 5040747c d1ab65a4 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 11:21:56 2022 +0000 Merge branch 'release-candidate-2-1-3' of github.com:/invoke-ai/InvokeAI into release-candidate-2-1-3 commit 5040747c6700c9b949e3f3e1d2c3f21daffcec6c Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 11:21:43 2022 +0000 fix windows install instructions & bat file commit d1ab65a43122f73c20533d5815590ec10bc05eca Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 07:18:59 2022 +0100 update WEBUIHOTKEYS.md commit af4ee7feb8a7d2528bf4e2b3f7deee7a7c4c3dec Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 06:33:49 2022 +0100 update INSTALL_DOCKER.md commit 764fb29aded8114984d05932c4266ea24614b932 Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 06:30:15 2022 +0100 fix formatting in INSTALL.md commit 1014d3ba44aa4cd4cfdc6e3650c24a0dc9568a6e Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 06:29:14 2022 +0100 fix build.sh invokeai_conda_env_file default value commit 40a48aca88e337e9f4475f80a03b7d6d4751d09b Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 05:25:30 2022 +0100 fix environment-mac.yml moved taming-transformers-rom1504 to pip dependencies commit 92abc00f16a34a586dd16d3c64408f00e23fcb53 Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 05:19:52 2022 +0100 fix test-invoke-conda - copy required conda environment yaml - use environment.yml - I use cp instead of ln since would be compatible for windows runners commit a5719aabf89c8c5f29c6044e2882ccdcd0c6916b Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 04:14:35 2022 +0100 update Dockerfile - link environment.yml from new environemnts path - change default conda_env_file - quote all variables to avoid splitting - also remove paths from conda-env-files in build-container.yml commit 44a18511fa7accfec6a20345774583a1ce745b02 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 20:51:06 2022 +0000 update paths in container build workflow commit b850dbadafba052310327ca759d96f49a9d25d03 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 20:16:57 2022 +0000 finished reorganization of install docs commit 9ef8b944d53afb1fed94c418b2fd936d2d743797 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 18:50:58 2022 +0000 tweaks to manual install documentation --prefer-binary is an iffy option in the requirements file. It isn't supported by some versions of pip, so I removed it from requirements-base.txt and inserted it into the manual install instructions where it seems to do what it is supposed to. commit efc5a9848803b4250d726bc1913b9fd5a33fad75 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 18:20:03 2022 +0000 manual installation documentation tested on Linux commit 1417c87928e13b0ed21bf1c5604f8636d3b50a8d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 17:37:06 2022 +0000 change name of requirements.txt to avoid confusion commit 2dd6fc2b93ff7bbb4038568a3b28d36a8fafaeb8 Merge: 22213612 71ee44a8 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 17:26:24 2022 +0000 Merge branch 'release-candidate-2-1-3' of github.com:/invoke-ai/InvokeAI into release-candidate-2-1-3 commit 22213612a08bbece46eafd48994f985b097cb141 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 17:25:59 2022 +0000 directory cleanup; working on install docs commit 71ee44a827898759fd457f774c0b2ac7a1ef6519 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 02:07:13 2022 +0000 prevent crash when switching to an invalid model commit b17ca0a5e731c142101bbdbf34d121df949e86d7 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 14:28:38 2022 +0100 don't suppress exceptions when doing cross-attention control commit 71bbfe4a1a5b70f90e5f41c94df50fb104dbdd79 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 12:59:34 2022 +0100 Fix #1362 by improving VRAM usage patterns when doing .swap() commit ef3f7a26e242b73c2beb0195c7fd8f654ef47f55 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 12:18:37 2022 +0100 remove log spam commit 7189d649622d4668b120b0dd278388ad672142c4 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 12:10:28 2022 +0100 change the way saved slicing strategy is applied commit 01c40f751ab72955140165c16f95ae411732265b Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 12:04:43 2022 +0100 fix slicing_strategy_getter callsite commit f8cfe25150a346958903316bc710737d99839923 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 11:56:22 2022 +0100 cleanup, consistent dim=0 also tested commit 5bf9b1e890d48e962afd4a668a219b68271e5dc1 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 11:34:09 2022 +0100 refactored context, tested with non-sliced cross attention control commit d58a46e39bf562e7459290d2444256e8c08ad0b6 Author: damian0815 <null@damianstewart.com> Date: Sun Nov 6 00:41:52 2022 +0100 cleanup commit 7e2c658b4c06fe239311b65b9bb16fa3adec7fd7 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:57:31 2022 +0100 disable logs commit 20ee89d93841b070738b3d8a4385c93b097d92eb Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:36:58 2022 +0100 slice saved attention if necessary commit 0a7684a22c880ec0f48cc22bfed4526358f71546 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:32:38 2022 +0100 raise instead of asserting commit 7083104c7f3a0d8fd96e94a2f391de50a3c942e4 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:31:00 2022 +0100 store dim when saving slices commit f7c0808ed383ec1dc70645288a798ed2aa4fa85c Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:27:16 2022 +0100 don't retry on exception commit 749a721e939b3fe7c1741e7998dab6bd2c85a0cb Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:24:50 2022 +0100 stuff commit 032ab90e9533be8726301ec91b97137e2aadef9a Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:20:17 2022 +0100 more logging commit 3dc34b387f033482305360e605809d95a40bf6f8 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:16:47 2022 +0100 logs commit 901c4c1aa4b9bcef695a6551867ec8149e6e6a93 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:12:39 2022 +0100 actually set save_slicing_strategy to True commit f780e0a0a7c6b6a3db320891064da82589358c8a Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:10:35 2022 +0100 store slicing strategy commit 93bb6d566fd18c5c69ef7dacc8f74ba2cf671cb7 Author: damian <git@damianstewart.com> Date: Sat Nov 5 20:43:48 2022 +0100 still not it commit 5e3a9541f8ae00bde524046963910323e20c40b7 Author: damian <git@damianstewart.com> Date: Sat Nov 5 17:20:02 2022 +0100 wip offloading attention slices on-demand commit 4c2966aa856b6f3b446216da3619ae931552ef08 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 15:47:40 2022 +0100 pre-emptive offloading, idk if it works commit 572576755e9f0a878d38e8173e485126c0efbefb Author: root <you@example.com> Date: Sat Nov 5 11:25:32 2022 +0000 push attention slices to cpu. slow but saves memory. commit b57c83a68f2ac03976ebc89ce2ff03812d6d185f Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 12:04:22 2022 +0100 verbose logging commit 3a5dae116f110a96585d9eb71d713b5ed2bc3d2b Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 11:50:48 2022 +0100 wip fixing mem strategy crash (4 test on runpod) commit 3cf237db5fae0c7b0b4cc3c47c81830bdb2ae7de Author: damian0815 <null@damianstewart.com> Date: Fri Nov 4 09:02:40 2022 +0100 wip, only works on cuda commit 5702271991e126c026aa1ff41c44f8ad37b26e3a Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 14:09:36 2022 +0000 speculative reorganization of the requirements & environment files - This is only a test! - The various environment*.yml and requirements*.txt files have all been moved into a directory named "environments-and-requirements". - The idea is to clean up our root directory so that the github home page is tidy. - The manual install instructions will start with the instructions to create a symbolic link from environment.yml to the appropriate file for OS and GPU. - The 1-click installers have been updated to accommodate this change. commit 10781e7dc4f4551583a110d14f2a1f60393112b8 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 01:59:45 2022 +0000 refactoring requirements commit 099d1157c579c7b9fea20945e8504cc15745c598 Author: mauwii <Mauwii@outlook.de> Date: Wed Nov 9 00:16:18 2022 +0100 better way to make sure if conda is useable commit ab825bf7ee5f0b82d2273da1cda64fc9266a978e Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 22:05:33 2022 +0000 add back --prefer-binaries to requirements commit 10cfeb5ada7bcfc9f3aff3716ab8ea4961a8b528 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 8 22:27:19 2022 +0100 add quotes to set and use `$environment_file` commit e97515d0453583e013674b4dd1f3739c7de402cc Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 8 22:24:21 2022 +0100 set environment file for conda update commit 0f04bc5789c712bf7c7319b1d93064914993f4ec Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 8 22:21:25 2022 +0100 use conda env update commit 3f74aabecd08ed25fac158463ae12b775bd1fca2 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 8 22:20:44 2022 +0100 use command instead of hash commit b1a99a51b7ca23c4b895855bd7b4c82dbdc431e4 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 14:44:44 2022 -0500 remove --global git config from 1-click installers commit 8004f8a6d99f6ff75e00c170da40f1dec93a8914 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Mon Nov 7 09:07:20 2022 -0500 Revert "Use array slicing to calc ddim timesteps" This reverts commit 1f0c5b4cf196716c21f2db74f92c8750ad8f889d. commit ff8ff2212afb1e1c2dce4f6a61f29e2bc8302eb5 Merge: 8e5363cd 636620b1 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 14:01:40 2022 +0000 add initfile support from PR #1386 commit 8e5363cd83bff0e6be0f002c644283955f7fcbfd Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 13:26:18 2022 +0000 move 'installer/' to '1-click-installer' to make room for tildebyte installer commit 1450779146e89510d12b8c90eb316d9861c3375e Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 12:56:36 2022 +0000 update branch for installer to pull against commit 8cd5d95b8a1cb213cce2f949c394c841a09d9cab Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 05:30:20 2022 +0000 move all models into subdirectories of ./models - this required an update to the invoke-ai fork of gfpgan - simultaneously reverted consolidation of environment and requirements files, as their presence in a directory triggered setup.py to try to install a sub-package. commit abd6407394d55d4f6c064a05f3ac989dd3817c59 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 03:52:46 2022 +0000 leave a copy of environment-cuda.yml at top level - named it environment.yml - need to avoid a big change for users and breaking older support instructions. commit 734dacfbe9d8c86ca943c6541e7b5ff5ef787ff4 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 03:50:07 2022 +0000 consolidate environment files - starting to remove unneeded entries and pins - no longer require -e in front of github dependencies - update setup.py with release number - update manual installation instructions commit 636620b1d5e2466613d0dcc2a604522be12fa3a4 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 03:26:16 2022 +0000 change initfile to ~/.invokeai - adjust documentation - also fix 'clipseg_models' to 'clipseg', which seems to be working now commit 1fe41146f0975bbc9d552208473490a9ccb9fc56 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 5 14:28:01 2022 -0400 add support for an initialization file, invokeai.init - Place preferred startup command switches in a file named "invokeai.init". The file can consist of a single line of switches such as "--web --steps=28", a series of switches on each line, or any combination of the two. Example: ``` --web --host=0.0.0.0 --steps=28 --grid -f 0.6 -C 11.0 -A k_euler_a ``` - The following options, which were previously only available within the CLI, are now available on the command line as well: --steps --strength --cfg_scale --width --height --fit commit 2ad6ef355a9b9c4b17bae71edea2346c2e8708c5 Merge: 865502ee 8b47c829 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sun Nov 6 18:08:36 2022 +0000 update discord link commit 865502ee4f681de4516d231370ae603983354d8f Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 18:00:16 2022 +0100 update changelog commit c7984f3299c5c8f56a70d80907d527af458674af Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 17:07:27 2022 +0100 update TROUBLESHOOT.md commit 7f150ed83302ba875c3e0c0f39d8ac0f32c6e362 Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 16:56:58 2022 +0100 remove `:`from headlines in CONTRIBUTORS.md commit badf4e256ce6e3201df1a9a87a7072b36b18d699 Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 16:56:37 2022 +0100 enable navigation tabs Since the docs are growing, this way they look cleaner commit e64c60bbb38fc1620e08ce52bf28bd17003c7ef6 Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 16:18:59 2022 +0100 remove preflight checks from assets seems like somebody executed tests and commited them commit 178061854300632b024810e65922b54b64d95939 Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 16:15:06 2022 +0100 update INSTALLING_MODELS.md commit f91fd276242a0c92b301e99d02982d30f7b712c3 Author: Kyle Schouviller <kyle0654@hotmail.com> Date: Sat Nov 5 14:47:53 2022 -0700 Bug fix for inpaint size commit 09e41e8f769457b9ffd56901aae13991cdc6eeb8 Author: Kyle Schouviller <kyle0654@hotmail.com> Date: Sat Nov 5 14:34:52 2022 -0700 Add inpaint size options to inpaint at a larger size than the actual inpaint image, then scale back down for recombination commit 6eeb2107b300fc27cfe6134b43e5570c246b8e96 Author: mauwii <Mauwii@outlook.de> Date: Sat Nov 5 21:01:14 2022 +0100 remove create-caches.yml since not used anywhere commit 17053ad8b7efecb21a9b4eb32695089f683f72e3 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 5 16:01:55 2022 -0400 fix duplicated argument introduced by conflict resolution commit fefb4dc1f88bc6551a39602a2bc79b278cd83c59 Merge: 762ca60a d05b1b35 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 5 12:47:35 2022 -0700 Merge branch 'development' into fix_generate.py commit d05b1b3544dfa7b3c071ac05b4f014a52e08fa50 Author: Craig <cwallen@users.noreply.github.com> Date: Sat Oct 29 20:40:30 2022 -0400 Resize hires as an image commit 82d4904c07670d514e9a541de7c9ecd8489eeae2 Author: Craig <cwallen@users.noreply.github.com> Date: Sat Oct 29 20:37:40 2022 -0400 Log strength with hires commit 1cdcf33cfa39e90f9660fabf8f5936dcfb6c3aa5 Merge: 6616fa83 cbc029c6 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 5 09:57:38 2022 -0400 Merge branch 'main' into development - this synchronizes recent document fixes by mauwii commit 6616fa835ac4318bf53419f2b54b88c962559578 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 4 00:47:03 2022 -0400 fix Windows library dependency issues This commit addresses two bugs: 1) invokeai.py crashes immediately with a message about an undefined attritube sigKILL (closes #1288). The fix is to pin torch at 1.12.1. 2) Version 1.4.2 of basicsr fails to load properly on Windows, and is a requirement of realesrgan, however 1.4.1 works. Pinning basicsr in our requirements file resulted in a dependency conflict, so I ended up cloning realesrgan into the invoke-ai Git space and changing the requirements file there. If there is a more elegant solution, please advise. commit 7b9a4564b11f4181b9b3c06ecda2a4a25fd1849e Author: Matthias Wild <40327258+mauwii@users.noreply.github.com> Date: Sat Nov 5 14:36:45 2022 +0100 Update-docs (#1382) * update IMG2IMG.md * update INPAINTING.md * update WEBUIHOTKEYS.md * more doc updates (mostly fix formatting): - OUTPAINTING.md - POSTPROCESS.md - PROMPTS.md - VARIATIONS.md - WEB.md - WEBUIHOTKEYS.md commit fcdefa0620761472718afa14b2955a5d0603cfcc Author: Matthias Wild <40327258+mauwii@users.noreply.github.com> Date: Fri Nov 4 20:47:31 2022 +0100 Hotifx docs (#1376) (#1377) commit ef8b3ce639954259a95a38f44fa5329687bee781 Merge: b7042095 36870a8f Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 4 12:08:44 2022 -0400 Merge-main-into-development (#1373) To get the rid of the difference between main and development. Since otherwise it will be a pain to start fixing the documentatino (when the state between main and development is not the same ...) Also this should fix the problem of all tests failing since environment yamls get updated. commit 36870a8f53217d4b733e9bb8b119190b5e36da59 Merge: 6b89adfa b7042095 Author: Matthias Wild <40327258+mauwii@users.noreply.github.com> Date: Fri Nov 4 16:25:00 2022 +0100 Merge branch 'development' into merge-main-into-development commit b70420951d5b70937c0c07e4f8a552a01c3008bc Author: damian0815 <null@damianstewart.com> Date: Thu Nov 3 12:39:45 2022 +0100 fix parsing error doing eg `forest ().swap(in winter)` commit 1f0c5b4cf196716c21f2db74f92c8750ad8f889d Author: wfng92 <43742196+wfng92@users.noreply.github.com> Date: Thu Nov 3 17:13:52 2022 +0800 Use array slicing to calc ddim timesteps commit 8648da811190fc8bcf237d83aff38cf605851300 Author: mauwii <Mauwii@outlook.de> Date: Fri Nov 4 00:06:19 2022 +0100 update environment-linux-aarch64 to use python 3.9 commit 45b459356399f8cfb7e9af571c1643fab04218fe Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 3 22:31:46 2022 +0100 update environment-linux-aarch64.yml - move getpass_asterisk to pip commit 41b04316cf5118ea9518dc77934d135a489dd684 Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 3 20:40:08 2022 +0100 rename job, remove debug branch from triggers commit e97c6db2a3c0157a8a5ab74cd28ebee480a2d078 Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 3 20:34:01 2022 +0100 include build matrix to build x86_64 and aarch64 commit 896820a349292b0e14bbc32f0c557fe8a6b45395 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 05:01:15 2022 +0100 disable caching commit 06c8f468bff7e1dfecc1a1990164be1005b114a7 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 04:26:39 2022 +0100 disable PR-Validation since there are no files passed from context this is unecesarry commit 61920e2701c4a9cea94c03ab933c4482458215b7 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 04:09:39 2022 +0100 update action to use current branch also update build-args of dockerfile and build.sh commit f34ba7ca70f1c417ee97e8b0c57abff57614d78f Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 02:30:24 2022 +0100 remove unecesarry mkdir command again commit c30ef0895dbf0565345ac6ccb136d98a174470a6 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 01:51:12 2022 +0100 remove symlink to GFPGANv1.4 also re-add mkdir to prevent action from failing commit aa3a774f73d5004571ea42fea14cd2b525fffb1c Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 01:48:59 2022 +0100 update build-container.yml to use cachev3 commit 2c30555b844293764123baa4137fcf952d40a4e7 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 01:34:20 2022 +0100 update Dockerfile - create models.yaml from models.yaml.example - run preload_models.py with --no-interactive commit 743f60577364d43237eeb46aefd523371c36e56b Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 01:21:15 2022 +0100 update build.sh to download sd-v1.5 model commit 519c661abbae83aa62b3ee536635c39192890441 Author: mauwii <Mauwii@outlook.de> Date: Tue Oct 25 01:26:50 2022 +0200 replace old fashined markdown templates with forms this will help the readability of issues a lot 🤓 commit 22c956c75f4797ddc2dffa944e3ea84b4eb3477c Merge: 13696adc 0196571a Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 3 10:20:21 2022 -0400 Merge branch 'development' of github.com:invoke-ai/InvokeAI into development commit 13696adc3a3a2b169e68048a5b511660d0430fae Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 3 10:20:10 2022 -0400 speculative change to solve windows esrgan issues commit 0196571a12992eb8207d36e022721fe3ad2cfd19 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 2 22:39:35 2022 -0400 remove merge markers from preload_models.py commit 9666f466ab1c710dfda2e59be9e8a26fcd7e8718 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 2 18:29:34 2022 -0400 use refined model by default commit 240e5486c89552ef480c3443a63283fb86a493c3 Merge: 8164b6b9 aa247e68 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 2 18:35:00 2022 -0400 Merge branch 'spezialspezial-patch-9' into development commit 8164b6b9cff077e4131384195af65e30a40733a7 Merge: 4fc82d55 dd5a88dc Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 2 17:06:46 2022 -0400 Merge branch 'development' of github.com:invoke-ai/InvokeAI into development commit 4fc82d554ff573780c0af562a6bc9586aa56012d Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 04:17:28 2022 +1300 [WebUI] Final 2.1 Release Build commit 96b34c0f85f6ed52707fe43456d20b81822c7d1d Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 09:08:11 2022 +0100 Final WebUI build for Release 2.1 - squashed commit of 52 commits from PR #1327 don't log base64 progress images Fresh Build For WebUI [WebUI] Loopback Default False Fixes bugs/styling - Fixes missing web app state on new version: Adds stateReconciler to redux-persist. When we add more values to the state and then release the update app, they will be automatically merged in. Reseting web UI will be needed far less. 7159ec - Fixes console z-index - Moves reset web UI button to visible area Decreases gallery width on inpainting Increases workarea split padding to 1rem Adds missing tooltips to site header Changes inpainting controls settings to hover Fixes hotkeys and settings buttons not working Improves bounding box interactions - Bounding box can now be moved by dragging any of its edges - Bounding box does not affect drawing if already drawing a stroke - Can lock bounding box to draw directly on the bounding box edges - Removes spacebar-hold behaviour due to technical issues Fixes silent crash when init image too large To send the mask to the server, the UI rendered the mask onto the init image and sent the whole image. The mask was then cropped by the server. If the image was too large, the app silently failed. Maybe it exceeds the websocket size limit. Fixed by cropping the mask in the UI layer, sending only bounding-box-sized mask image data. Disabled bounding box settings when locked Styles image uploader Builds fresh bundle Improves bounding box interaction Added spacebar-hold-to-transform back. Address bounding box feedback - Adds back toggle to hide bounding box - Box quick toggle = q, normal toggle = shift + q - Styles canvas alert icons Adds hints when unable to invoke - Popover on Invoke button indicates why exactly it is disabled, e.g. prompt is empty, something else is processing, etc. - There may be more than one reason; all are displayed. Fix Inpainting Alerts Styling Preventing unnecessary re-renders across the app Code Split Inpaint Options Isolate features to their own components so they dont re-render the other stuff each time. [TESTING] Remove global isReady checking I dont believe this is need at all because the isready state is constantly updated when needed and tracked real time in the Redux store. This causes massive re-renders. @psychedelicious If this is absolutely essential for a reason that I do not see, please hit me up on Discord. Fresh Bundle Fix Bounding Box Settings re-rendering on brush stroke [Code Splitting] Bounding Box Options Isolated all bounding box components to trigger unnecessary re-renders. Still need to fix bounding box triggering re-renders on the control panel inside the canvas itself. But the options panel should be a good to go with this change. Inpainting Controls Code Spitting and Performance Codesplit the entirety of the inpainting controls. Created new selectors for each and every component to ensure there are no unnecessary re-renders. App feels a lot smoother. Fixes rerenders on ClearBrushHistory Fixes crash when requesting post-generation upscale/face restoration - Moves the inpainting paste to before the postprocessing. Removes unused isReady state Changes Report Bug icon to a bug Restores shift+q bounding box shortcut Adds alert for bounding box size to status icons Adds asCheckbox to IAIIconButton Rough draft of this. Not happy with the styling but it's clearer than having them look just like buttons. Fixes crash related to old value of progress_latents in state Styling changes and settings modal minor refactor Fixes: uploaded JPG images not loading Reworks CurrentImageButtons.tsx - Change all icons to FA iconset for consistency - Refactors IAIIconButton, IAIButton, IAIPopover to handle ref forwarding - Redesigns buttons into group Only generate 1 iteration when seed fixed & variations disabled Fixes progress images select Fixes edge case: upload over gets stuck while alt tabbing - Press esc to close it now Fixes display progress images select typing Fixes current image button rerenders Adds min width to ImageUploader Makes fast-latents in progress default Update Icon Button Checkbox Style Styling Fixes next/prev image buttons Refactor canvas buttons + more Add Save Intermediates Step Count For accurate mode only. Co-Authored-By: Richard Macarthy <richardmacarthy@protonmail.com> Restores "initial image" text Address feedback - moves mask clear button - fixes intermediates - shrinks inpainting icons by 10% Fix Loopback Styling Adds escape hotkey to close floating panels Readd Hotkey for Dual Display Updated Current Image Button Styling commit dd5a88dceeec53ceb1722a62e3689ae3dd871154 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 04:17:28 2022 +1300 [WebUI] Final 2.1 Release Build commit 95ed56bf82825a47cfe406fa34eaf4e32c129143 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 04:16:31 2022 +1300 Updated Current Image Button Styling commit 1ae80f5ab9d00a25e0c3a21e2eccd318c5343401 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 04:07:57 2022 +1300 Readd Hotkey for Dual Display commit 1f0bd3ca6cda4221d1a7a46325f235cd23bd0af9 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu Nov 3 02:07:00 2022 +1100 Adds escape hotkey to close floating panels commit a1971f6830306b3d748f7f36c2243f6dee682f97 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 03:38:15 2022 +1300 Fix Loopback Styling commit c6118e889895ba35a191124ce1beb5d2b719366d Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu Nov 3 01:29:51 2022 +1100 Address feedback - moves mask clear button - fixes intermediates - shrinks inpainting icons by 10% commit 7ba958cf7ff4e804a127b71c88666084f81e7340 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu Nov 3 01:10:38 2022 +1100 Restores "initial image" text commit 383905d5d24359aa1824de96ff124a8f8a87e015 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 02:59:11 2022 +1300 Add Save Intermediates Step Count For accurate mode only. Co-Authored-By: Richard Macarthy <richardmacarthy@protonmail.com> commit 6173e3e9cabd5e74fb466d55d7bb6a80a77b3fa8 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu Nov 3 00:53:53 2022 +1100 Refactor canvas buttons + more commit 3feb7d8922b0e4c9f944e96b95211003f40d9705 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu Nov 3 00:49:23 2022 +1100 Fixes next/prev image buttons commit 1d9edbd0ddd6e10cf120fe0de3db0b56ae374db4 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 00:50:44 2022 +1300 Update Icon Button Checkbox Style Styling commit d439abdb89db73e652add9df371234861189d90c Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 21:37:24 2022 +1100 Makes fast-latents in progress default commit ee47ea0c891a33049bdec12f1c254926f341eff2 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 21:37:09 2022 +1100 Adds min width to ImageUploader commit 300bb2e6279c1c477131b9e57425db348062f19c Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 21:28:22 2022 +1100 Fixes current image button rerenders commit ccf8593501d23e00979f7340f8991514e6ca3428 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 21:27:43 2022 +1100 Fixes display progress images select typing commit 0fda612f3ff8ad75932e158b9b29cf64c3f30eb6 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 21:02:01 2022 +1100 Fixes edge case: upload over gets stuck while alt tabbing - Press esc to close it now commit 5afff65b71bb60d067392c120efff1a17adc66af Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 20:33:19 2022 +1100 Fixes progress images select commit 7e55bdefce8920831cac7b9fa857bfbffe9e9d5d Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 20:27:47 2022 +1100 Only generate 1 iteration when seed fixed & variations disabled commit 620cf84d3dd54b8498e84574f33040a26d4d315f Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 19:51:38 2022 +1100 Reworks CurrentImageButtons.tsx - Change all icons to FA iconset for consistency - Refactors IAIIconButton, IAIButton, IAIPopover to handle ref forwarding - Redesigns buttons into group commit cfe567c62ad3fd0cff5e3e579a2250ca5dfa2d53 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 16:14:50 2022 +1100 Fixes: uploaded JPG images not loading commit cefe12f1df72e051f109ed77ce46f18093b3b8bb Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 15:31:18 2022 +1100 Styling changes and settings modal minor refactor commit 1e51c3992853ad4643d8eda2443a3bd0d65f5f90 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 15:27:46 2022 +1100 Fixes crash related to old value of progress_latents in state commit 42a02bbb8087cd46a1b5c795b1b41e38c08ba229 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 13:15:06 2022 +1100 Adds asCheckbox to IAIIconButton Rough draft of this. Not happy with the styling but it's clearer than having them look just like buttons. commit f1ae6dae4c36e74ca8dedf8b57eb8933c059dcf4 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 13:13:56 2022 +1100 Adds alert for bounding box size to status icons commit 6195579910a91fb2ab7e1186aa1c1145566c3122 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 11:52:19 2022 +1100 Restores shift+q bounding box shortcut commit 16c8b23b347792d7811cff66a27d350fe5d0d62c Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 11:32:07 2022 +1100 Changes Report Bug icon to a bug commit 07ae626b22554b5222a3b71d1ce3974e2c3fb284 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 11:17:16 2022 +1100 Removes unused isReady state commit 8d171bb044f578d4b9cc4911edfa05b20a01d373 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 11:13:26 2022 +1100 Fixes crash when requesting post-generation upscale/face restoration - Moves the inpainting paste to before the postprocessing. commit 6e33ca7e9e64fb355430511e28bb08c32c9c68b1 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 10:59:01 2022 +1100 Fixes rerenders on ClearBrushHistory commit db46e12f2b8c98dac8895ea4d04242d3754dbec4 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 11:36:28 2022 +1300 Inpainting Controls Code Spitting and Performance Codesplit the entirety of the inpainting controls. Created new selectors for each and every component to ensure there are no unnecessary re-renders. App feels a lot smoother. commit 868e4b2db82fa8556b423111f2f8d565a70ec129 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 07:40:31 2022 +1300 [Code Splitting] Bounding Box Options Isolated all bounding box components to trigger unnecessary re-renders. Still need to fix bounding box triggering re-renders on the control panel inside the canvas itself. But the options panel should be a good to go with this change. commit 2e562742c13988a1fc299c673a97ba4e4a645aaf Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 06:40:27 2022 +1300 Fix Bounding Box Settings re-rendering on brush stroke commit 68e69580091fc1dc1d8b6e03c9e7ef777c7ebf61 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 06:28:34 2022 +1300 Fresh Bundle commit ea6e3a7949f2743711516261cb7e450517d39702 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 06:26:56 2022 +1300 [TESTING] Remove global isReady checking I dont believe this is need at all because the isready state is constantly updated when needed and tracked real time in the Redux store. This causes massive re-renders. @psychedelicious If this is absolutely essential for a reason that I do not see, please hit me up on Discord. commit b2879ca99f88869277c474185ade049914b0bf26 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 06:08:59 2022 +1300 Code Split Inpaint Options Isolate features to their own components so they dont re-render the other stuff each time. commit 4e911566c33989392eb3279049b15331ca98594a Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 03:50:56 2022 +1300 Preventing unnecessary re-renders across the app commit 9bafda6a152778893df143776ae859a3b8b7f192 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 03:02:35 2022 +1300 Fix Inpainting Alerts Styling commit 871a8a5375cae891f22eb853ffd2d22298298b11 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 23:52:07 2022 +1100 Adds hints when unable to invoke - Popover on Invoke button indicates why exactly it is disabled, e.g. prompt is empty, something else is processing, etc. - There may be more than one reason; all are displayed. commit 0eef74bc00d3c0cedc5037c1deeef1d9a5b6d33d Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 23:40:11 2022 +1100 Address bounding box feedback - Adds back toggle to hide bounding box - Box quick toggle = q, normal toggle = shift + q - Styles canvas alert icons commit 423ae3209782f1d8d321b2ed9ed00712b726adf7 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 17:06:07 2022 +1100 Improves bounding box interaction Added spacebar-hold-to-transform back. commit 8282e5d0458ca1bba5565c069093b5389f2228d4 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 16:57:07 2022 +1100 Builds fresh bundle commit 19305cdbdf6ac74833bd6011bff0ced8e9d36f69 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 16:51:11 2022 +1100 Styles image uploader commit eb9028ab3069bca9d747aca664ca60ae13ba6df8 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 16:51:03 2022 +1100 Disabled bounding box settings when locked commit 21483f5d0731bce5aa97985e722a64bf0d7cd12c Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 16:50:24 2022 +1100 Fixes silent crash when init image too large To send the mask to the server, the UI rendered the mask onto the init image and sent the whole image. The mask was then cropped by the server. If the image was too large, the app silently failed. Maybe it exceeds the websocket size limit. Fixed by cropping the mask in the UI layer, sending only bounding-box-sized mask image data. commit 82dcbac28f140aa7bd89d967bcc7fa31cb03a267 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 16:28:30 2022 +1100 Improves bounding box interactions - Bounding box can now be moved by dragging any of its edges - Bounding box does not affect drawing if already drawing a stroke - Can lock bounding box to draw directly on the bounding box edges - Removes spacebar-hold behaviour due to technical issues commit d43bd4625d64a03d90de0458ad5fcacef211a8a6 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 15:10:49 2022 +1100 Fixes hotkeys and settings buttons not working commit ea891324a2086faf8eeeeac7eaf47ae2935322fb Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 11:04:02 2022 +1100 Changes inpainting controls settings to hover commit 8fd9ea219390493f392e690eadb23c4209a4ecfc Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 11:03:41 2022 +1100 Adds missing tooltips to site header commit fb026668563b3179805819a1630c654c9ce260d9 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 11:03:25 2022 +1100 Increases workarea split padding to 1rem commit f6f5c2731b0c37089c5d7382736f973e857df712 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 11:03:10 2022 +1100 Decreases gallery width on inpainting commit b4e3f771e0314e0a18ad5cedc80b28f246fced59 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 10:54:59 2022 +1100 Fixes bugs/styling - Fixes missing web app state on new version: Adds stateReconciler to redux-persist. When we add more values to the state and then release the update app, they will be automatically merged in. Reseting web UI will be needed far less. 7159ec - Fixes console z-index - Moves reset web UI button to visible area commit 99bb9491ac97f1f733accab839ea38cdf4870ba0 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Tue Nov 1 08:35:45 2022 +1300 [WebUI] Loopback Default False commit 0453f211278a533a49fb1aee54dd989b69179c10 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 23:23:51 2022 +1300 Fresh Build For WebUI commit 9fc09aa4bda3b3e6139b026f24733a37747d373f Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 09:08:11 2022 +0100 don't log base64 progress images commit 5e87062cf809a08242d3b006b66d3bbb834ddb16 Author: spezialspezial <75758219+spezialspezial@users.noreply.github.com> Date: Wed Nov 2 00:21:27 2022 +0100 Option to directly invert the grayscale heatmap - fix commit 3e7a459990407ad1679f38d4027c19d50a9d36e3 Author: spezialspezial <75758219+spezialspezial@users.noreply.github.com> Date: Tue Nov 1 21:37:33 2022 +0100 Update txt2mask.py commit bbf4c03e500bafc8627c2a70f8b3396efeddabb3 Author: spezialspezial <75758219+spezialspezial@users.noreply.github.com> Date: Tue Nov 1 21:11:19 2022 +0100 Option to directly invert the grayscale heatmap Theoretically less work inverting the image while it's small but I can't measure a significant difference. Though, handy option to have in some cases. commit 611a3a975328a7e276c2781214d5e14108708ed7 Author: mauwii <Mauwii@outlook.de> Date: Wed Nov 2 02:23:09 2022 +0100 fix name of caching step commit 1611f0d1815022fe90d33f41c21d670251a75f29 Author: mauwii <Mauwii@outlook.de> Date: Wed Nov 2 02:18:46 2022 +0100 readd caching of sd-models - this would remove the necesarrity of the secret availability in PRs commit 08835115e4c5c0ee3587ce07ab769a04d55cb3c5 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 22:10:12 2022 -0400 pin pytorch_lightning to 1.7.7, issue #1331 commit 2d84e28d329be282b51a4cbc22f7c200d80c8f0e Merge: 533fd04e ef17aae8 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 22:11:04 2022 -0400 Merge branch 'development' of github.com:invoke-ai/InvokeAI into development commit ef17aae8abe03fd87dc6f91b3c6d2fe03375f6c5 Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 00:39:48 2022 +0100 add damian0815 to contributors list commit 0cc39f01a3c67f32873b7888e1e032d33626e269 Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 01:18:50 2022 +0100 report full size for fast latents and update conversion matrix for v1.5 commit 688d7258f185035a5924bee23322b001574da931 Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 00:33:00 2022 +0100 fix a bug that broke cross attention control index mapping commit 4513320bf161d3efdd99e2aef4f7c37472131373 Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 00:31:58 2022 +0100 save VRAM by not recombining tensors that have been sliced to save VRAM commit 533fd04ef0d1ba9d2cb25d556991b999e7d44aba Merge: 6215592b dff5681c Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 17:40:36 2022 -0400 Merge branch 'development' of github.com:invoke-ai/InvokeAI into development commit dff5681cf0e24faf67d5eb5903203c4ea39f89bd Author: damian0815 <d@d.com> Date: Tue Nov 1 13:56:03 2022 +0100 shorter strings commit 5a2790a69b11e049d2507bc22eab7812915d867f Author: damian0815 <d@d.com> Date: Tue Nov 1 13:19:20 2022 +0100 convert progress display to a drop-down commit 7c5305ccbaf7926162536aa3a9e51dcdd8574d0d Author: damian0815 <d@d.com> Date: Tue Nov 1 12:54:46 2022 +0100 do not try to save base64 intermediates in gallery on cancellation commit 4013e8ad6fa5e5c2a710c607fe7e1d040f353299 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 21:54:35 2022 +1100 Fixes b64 image sending and displaying commit d1dfd257f9e1cafd352d9007a56194226b9d6b63 Author: damian <d@d.com> Date: Tue Nov 1 11:40:40 2022 +0100 wip base64 commit 5322d735ee4515d89293b7fb015b2ce048262f68 Author: damian <d@d.com> Date: Tue Nov 1 11:31:42 2022 +0100 update frontend commit cdb107dcda858a8bb64455cc60a196a42345f8f7 Author: damian <d@d.com> Date: Tue Nov 1 11:17:43 2022 +0100 add option to show intermediate latent space commit be1393a41ce7a75ed8de7f648a93c5e5974a50d2 Author: damian <d@d.com> Date: Tue Nov 1 10:16:55 2022 +0100 ensure existing exception handling code also handles new exception class commit e554c2607f00a5e51c03052acb9861ff21ec1c12 Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Tue Nov 1 10:08:42 2022 +0100 Rebuilt prompt parsing logic Complete re-write of the prompt parsing logic to be more readable and logical, and therefore also hopefully easier to debug, maintain, and augment. In the process it has also become more robust to badly-formed prompts. Squashed commit of the following: commit 8fcfa88a16e1390d41717e940d72aed64712171c Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Sun Oct 30 17:05:57 2022 +0100 further cleanup commit 1a1fd78bcfeb49d072e3e6d5808aa8df15441629 Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Sun Oct 30 16:07:57 2022 +0100 cleanup and document commit 099c9659fa8b8135876f9a5a50fe80b20bc0635c Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Sun Oct 30 15:54:58 2022 +0100 works fully commit 5e6887ea8c25a1e21438ff6defb381fd027d25fd Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Sun Oct 30 15:24:31 2022 +0100 further... commit 492fda120844d9bc1ad4ec7dd408a3374762d0ff Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Sun Oct 30 14:08:57 2022 +0100 getting there... commit c6aab05a8450cc3c95c8691daf38fdc64c74f52d Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Fri Oct 28 14:29:03 2022 +0200 wip doesn't compile commit 5e533f731cfd20cd435330eeb0012e5689e87e81 Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Fri Oct 28 13:21:43 2022 +0200 working with CrossAttentionCtonrol but no Attention support yet commit 9678348773431e500e110e8aede99086bb7b5955 Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Fri Oct 28 13:04:52 2022 +0200 wip rebuiling prompt parser commit 6215592b12dea3822c727913b771012789a52477 Merge: ef24d76a 349cc254 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 17:34:55 2022 -0400 Merge branch 'development' of github.com:invoke-ai/InvokeAI into development commit 349cc25433e1d358c6c61cca4a6c300ecc8ca3d7 Author: damian0815 <d@d.com> Date: Tue Nov 1 20:08:52 2022 +0100 fix crash (be a little less aggressive clearing out the attention slice) commit 214d276379387ae0fa2259602ab00884ec1ad03e Author: damian0815 <d@d.com> Date: Tue Nov 1 19:57:55 2022 +0100 be more aggressive at clearing out saved_attn_slice commit ef24d76adc5a192297714707cd6794d4f44bcf67 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 14:34:23 2022 -0400 fix library problems in preload_modules commit ab2b5a691dadb292f7cecf5db94a165db3e3e126 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 17:22:48 2022 -0400 fix model_cache memory management issues commit c7de2b2801ad5d6ce52a5f44e88c5705f1dbf524 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 02:02:14 2022 +0100 disable checks with sd-V1.4 model... ...to save some resources, since V1.5 is the default now commit e8075658acf675346d35435d0cfb7710becab42a Author: mauwii <Mauwii@outlook.de> Date: Mon Oct 31 22:20:51 2022 +0100 update test-invoke-conda.yml - fix model dl path for sd-v1-4.ckpt - copy configs/models.yaml.example to configs/models.yaml commit 4202dabee1143f597f4c3946420fbfa7b8eccddf Author: mauwii <Mauwii@outlook.de> Date: Mon Oct 31 22:17:21 2022 +0100 fix models example weights for sd-v1.4 commit d67db2bcf1ac26d8bb7c5f8bfd056f2172597780 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Tue Nov 1 08:35:45 2022 +1300 [WebUI] Loopback Default False commit 7159ec885faa1117a3506689d547618be1d91808 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Mon Oct 31 11:33:05 2022 -0400 further improvements to preload_models.py - Faster startup for command line switch processing - Specify configuration file to modify using --config option: ./scripts/preload_models.ply --config models/my-models-file.yaml commit b5cf734ba9f1aeaab14075b55cc13ed9a0ae31e2 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Mon Oct 31 11:08:19 2022 -0400 improve behavior of preload_models.py - NEVER overwrite user's existing models.yaml - Instead, merge its contents into new config file, and rename original to models.yaml.orig (with message) - models.yaml has been removed from repository and renamed models.yaml.example commit f7dc8eafeef991e135b5541c01d0ff740dda9591 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Mon Oct 31 10:47:35 2022 -0400 restore models.yaml to virgin state commit 762ca60a309f70daaf1b9e79b6273f76fd9474b6 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Oct 4 22:55:10 2022 -0400 Update INPAINTING.md commit e7fb9f342cb5ed0c09e6215026d60d45eef3ebcb Author: Hideyuki Katsushiro <h.katsushiro@qualia.tokyo.jp> Date: Wed Oct 5 10:08:53 2022 +0900 add argument --outdir
2022-11-12 17:17:07 +00:00
outdir = kwargs.pop('outdir', self.outdir)
Refactoring simplet2i (#387) * start refactoring -not yet functional * first phase of refactor done - not sure weighted prompts working * Second phase of refactoring. Everything mostly working. * The refactoring has moved all the hard-core inference work into ldm.dream.generator.*, where there are submodules for txt2img and img2img. inpaint will go in there as well. * Some additional refactoring will be done soon, but relatively minor work. * fix -save_orig flag to actually work * add @neonsecret attention.py memory optimization * remove unneeded imports * move token logging into conditioning.py * add placeholder version of inpaint; porting in progress * fix crash in img2img * inpainting working; not tested on variations * fix crashes in img2img * ported attention.py memory optimization #117 from basujindal branch * added @torch_no_grad() decorators to img2img, txt2img, inpaint closures * Final commit prior to PR against development * fixup crash when generating intermediate images in web UI * rename ldm.simplet2i to ldm.generate * add backward-compatibility simplet2i shell with deprecation warning * add back in mps exception, addresses @vargol comment in #354 * replaced Conditioning class with exported functions * fix wrong type of with_variations attribute during intialization * changed "image_iterator()" to "get_make_image()" * raise NotImplementedError for calling get_make_image() in parent class * Update ldm/generate.py better error message Co-authored-by: Kevin Gibbons <bakkot@gmail.com> * minor stylistic fixes and assertion checks from code review * moved get_noise() method into img2img class * break get_noise() into two methods, one for txt2img and the other for img2img * inpainting works on non-square images now * make get_noise() an abstract method in base class * much improved inpainting Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
2022-09-06 00:40:10 +00:00
assert (
'init_img' in kwargs
), 'call to img2img() must include the init_img argument'
return self.prompt2png(prompt, outdir, **kwargs)
def prompt2image(
self,
# these are common
prompt,
iterations = None,
steps = None,
seed = None,
cfg_scale = None,
ddim_eta = None,
skip_normalize = False,
image_callback = None,
step_callback = None,
width = None,
height = None,
sampler_name = None,
seamless = False,
2022-10-17 02:45:18 +00:00
seamless_axes = {'x','y'},
log_tokenization = False,
with_variations = None,
variation_amount = 0.0,
threshold = 0.0,
perlin = 0.0,
karras_max = None,
merge release-candidate-1-3-2 into main. Squashed commit of the following: commit 9a1fe8e7fbbd81d9e9e47c4fda6bde6f66fba30c Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 12 17:07:40 2022 +0000 swap in release URLs for installers commit ff56f5251ba8502833cb561317e82b028cd2da5d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 12 17:03:21 2022 +0000 fix up bad unicode chars in invoke.py commit ed943bd6c785d968d1e31fbbb814fea8688fc8bb Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 12 16:05:45 2022 +0000 outcrop improvements, hand-added commit 7ad2355b1da53861bb75312edead8f9db0b0f44d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 12 15:14:33 2022 +0000 documentation fixes commit 66c920fc197d9206be9e0e2d1eb2a1cb86362887 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 16:49:25 2022 -0500 Revert "Resize hires as an image" This reverts commit d05b1b3544dfa7b3c071ac05b4f014a52e08fa50. commit 3fc5cb09f8bc03ea96e67a3e49fb087019d2f9d5 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 12 12:43:17 2022 +0000 fix incorrect link in install commit 1345ec77ab58f70e1bf5a0f587ca40aba4e906b7 Author: tildebyte <337875+tildebyte@users.noreply.github.com> Date: Sun Nov 6 19:07:31 2022 -0500 toil(repo): add tildebyte as owner of installer/ directory commit b116715490f390a59e5bee1022a6a758aee0918d Author: Kyle Schouviller <kyle0654@hotmail.com> Date: Thu Nov 10 21:43:56 2022 -0800 Fix performance issue introduced by torch cuda cache clear during generation commit fa3670270e7aae6bfd8d47fb7bdd32b707310c23 Author: mauwii <Mauwii@outlook.de> Date: Fri Nov 11 12:42:03 2022 +0100 small update to dockers huggingface section commit c304250ef663b3e202b4da8332365288589d94c7 Author: mauwii <Mauwii@outlook.de> Date: Fri Nov 11 12:19:27 2022 +0100 fix format and Link in INSTALL_INVOKE.md commit 802ce5dde5ca68f24aa4609cdba428044e0c7fa1 Author: mauwii <Mauwii@outlook.de> Date: Fri Nov 11 11:17:49 2022 +0100 small fixex to format and a link in INSTALL_MANUAL commit 311ee320ecac892cb4a1bcd012374fa051b1d011 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 07:23:35 2022 +0000 ignore installer intermediate files commit e9df17b374df58a44d3ae3ba33cbdc58794bcf5d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 07:19:25 2022 +0000 fix backslash-related syntax error commit 061fb4ef00482bdd4fba635aeaeff4ca7510190d Merge: 52be0d23 4095acd1 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 06:50:04 2022 +0000 Merge branch 'release-candidate-2-1-3' of github.com:/invoke-ai/InvokeAI into release-candidate-2-1-3 commit 52be0d2396de2de02030855c92e3367008b50377 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 06:49:45 2022 +0000 add WindowsLongFileName batfile to source installer commit 4095acd10ebae05a8cb14cc2faf7c79936d9e6a9 Author: mauwii <Mauwii@outlook.de> Date: Fri Nov 11 07:05:17 2022 +0100 Doc Updates A lot of re-formating of new Installation Docs also some content updates/corrections commit 201eb22d7650b00f55249c2646fa4f47ac3e0ec2 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 04:41:02 2022 +0000 prevent two models from being marked default in models.yaml commit 17ab98220034dfbb798a9a0460bc2837f0c1e2cb Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 03:56:54 2022 +0000 installers download branch HEAD not tag commit a04965b0e9e9d1170cf284af9acbd1186d681255 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 03:48:21 2022 +0000 improve messaging during installation process commit 0b529f0c574dd91fb9593e924ebc41c8c219b6ce Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 15:22:32 2022 +0000 enable outcropping of random JPG/PNG images - Works best with runwayML inpainting model - Numerous code changes required to propagate seed to final metadata. Original code predicated on the image being generated within InvokeAI. commit 6f9f84834557eb3c48562dc5d0ace51ca9e9cca2 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 17:27:42 2022 +0000 enhance outcropping with ability to direct contents of new regions - When outcropping an image you can now add a `--new_prompt` option, to specify a new prompt to be used instead of the original one used to generate the image. - Similarly you can provide a new seed using `--seed` (or `-S`). A seed of zero will pick one randomly. - This PR also fixes the crash that happened when trying to outcrop an image that does not contain InvokeAI metadata. commit 918c1589ef30595668899f4259ece6a4ad605c69 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 20:16:47 2022 +0000 fix #1402 commit 116415b3fcec8415f8e6de9b23c0bbd0dbc6845b Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 21:27:25 2022 +0000 fix invoke.py crash if no models.yaml file present - Script will now offer the user the ability to create a minimal models.yaml and then gracefully exit. - Closes #1420 commit b4b6eabaac94896e38123be331c44d1b63065b0d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 16:49:25 2022 -0500 Revert "Log strength with hires" This reverts commit 82d4904c07670d514e9a541de7c9ecd8489eeae2. commit 4ef1f4a854717c953f9192454d0adabef32af36c Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 20:01:49 2022 +0000 remove temporary directory from repo commit 510fc4ebaa5f9dc0e77b47cf04e0c265423e0a44 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 19:59:03 2022 +0000 remove -e from clipseg load in installer commit a20914434bb3609cf1d883cabf048d4cc25f881a Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 19:37:07 2022 +0000 change clipseg repo branch to avoid clipseg not found error commit 0d134195fda5c69fce5a95d6da90248eba8d226d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 18:39:29 2022 +0000 update repo URL to point to rc commit 649d8c8573896fdb5a73453b69ee4b54cf4d6241 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 18:13:28 2022 +0000 integrate tildebyte installer commit a358d370a05ea985a9e26fa9c1101d9c14fdb3ab Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 17:48:14 2022 +0000 add @tildebyte compiled pip installer commit 94a9033c4f6214e604be149a3de6d7c747af7f3a Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 14:52:00 2022 +0000 ignore source installer zip files commit 18a947c503c83c95cd83f27424696219ff3c4c95 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 14:46:36 2022 +0000 documentation and environment file fixes - Have clarified the relationship between the @tildebyte and @cmdr2 installers; However, @tildebyte installer merge is still a WIP due to conflicts over such things as `invoke.sh`. - Rechristened 1click installer as "source" installer. @tildebyte installer will be "the" installer. (We'll see which one generates the least support requests and maintenance work.) - Sync'd `environment-mac.yml` with `development`. The former was failing with a taming-transformers error as per https://discord.com/channels/@me/1037201214154231899/1040060947378749460 commit a23b03189526a49da8ddae90ce71b0e902784d29 Author: Mike DiGiovanni <vinblau@gmail.com> Date: Wed Nov 9 16:44:59 2022 -0500 Fixes typos in README.md commit 23af68c7d79d947f1bd3441c91bb44d655238f01 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 07:02:27 2022 -0500 downgrade win installs to basicsr==1.4.1 commit e258beeb51f3e645b9ea60e52d69d18722221cc5 Merge: 7460c069 e481bfac Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 06:37:45 2022 -0500 Merge branch 'release-candidate-2-1-3' of github.com:invoke-ai/InvokeAI into release-candidate-2-1-3 commit 7460c069b880b10c84b55f2e0c0998e350d6cf12 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 06:36:48 2022 -0500 remove --prefer-binary from requirements-base.txt It appears that some versions of pip do not recognize this option when it appears in the requirements file. Did not explore this further but recommend --prefer-binary in the manual install instructions on the command line. commit e481bfac615e0c798ceb5e59e8fbe3038f85b431 Merge: 5040747c d1ab65a4 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 11:21:56 2022 +0000 Merge branch 'release-candidate-2-1-3' of github.com:/invoke-ai/InvokeAI into release-candidate-2-1-3 commit 5040747c6700c9b949e3f3e1d2c3f21daffcec6c Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 11:21:43 2022 +0000 fix windows install instructions & bat file commit d1ab65a43122f73c20533d5815590ec10bc05eca Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 07:18:59 2022 +0100 update WEBUIHOTKEYS.md commit af4ee7feb8a7d2528bf4e2b3f7deee7a7c4c3dec Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 06:33:49 2022 +0100 update INSTALL_DOCKER.md commit 764fb29aded8114984d05932c4266ea24614b932 Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 06:30:15 2022 +0100 fix formatting in INSTALL.md commit 1014d3ba44aa4cd4cfdc6e3650c24a0dc9568a6e Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 06:29:14 2022 +0100 fix build.sh invokeai_conda_env_file default value commit 40a48aca88e337e9f4475f80a03b7d6d4751d09b Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 05:25:30 2022 +0100 fix environment-mac.yml moved taming-transformers-rom1504 to pip dependencies commit 92abc00f16a34a586dd16d3c64408f00e23fcb53 Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 05:19:52 2022 +0100 fix test-invoke-conda - copy required conda environment yaml - use environment.yml - I use cp instead of ln since would be compatible for windows runners commit a5719aabf89c8c5f29c6044e2882ccdcd0c6916b Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 04:14:35 2022 +0100 update Dockerfile - link environment.yml from new environemnts path - change default conda_env_file - quote all variables to avoid splitting - also remove paths from conda-env-files in build-container.yml commit 44a18511fa7accfec6a20345774583a1ce745b02 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 20:51:06 2022 +0000 update paths in container build workflow commit b850dbadafba052310327ca759d96f49a9d25d03 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 20:16:57 2022 +0000 finished reorganization of install docs commit 9ef8b944d53afb1fed94c418b2fd936d2d743797 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 18:50:58 2022 +0000 tweaks to manual install documentation --prefer-binary is an iffy option in the requirements file. It isn't supported by some versions of pip, so I removed it from requirements-base.txt and inserted it into the manual install instructions where it seems to do what it is supposed to. commit efc5a9848803b4250d726bc1913b9fd5a33fad75 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 18:20:03 2022 +0000 manual installation documentation tested on Linux commit 1417c87928e13b0ed21bf1c5604f8636d3b50a8d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 17:37:06 2022 +0000 change name of requirements.txt to avoid confusion commit 2dd6fc2b93ff7bbb4038568a3b28d36a8fafaeb8 Merge: 22213612 71ee44a8 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 17:26:24 2022 +0000 Merge branch 'release-candidate-2-1-3' of github.com:/invoke-ai/InvokeAI into release-candidate-2-1-3 commit 22213612a08bbece46eafd48994f985b097cb141 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 17:25:59 2022 +0000 directory cleanup; working on install docs commit 71ee44a827898759fd457f774c0b2ac7a1ef6519 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 02:07:13 2022 +0000 prevent crash when switching to an invalid model commit b17ca0a5e731c142101bbdbf34d121df949e86d7 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 14:28:38 2022 +0100 don't suppress exceptions when doing cross-attention control commit 71bbfe4a1a5b70f90e5f41c94df50fb104dbdd79 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 12:59:34 2022 +0100 Fix #1362 by improving VRAM usage patterns when doing .swap() commit ef3f7a26e242b73c2beb0195c7fd8f654ef47f55 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 12:18:37 2022 +0100 remove log spam commit 7189d649622d4668b120b0dd278388ad672142c4 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 12:10:28 2022 +0100 change the way saved slicing strategy is applied commit 01c40f751ab72955140165c16f95ae411732265b Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 12:04:43 2022 +0100 fix slicing_strategy_getter callsite commit f8cfe25150a346958903316bc710737d99839923 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 11:56:22 2022 +0100 cleanup, consistent dim=0 also tested commit 5bf9b1e890d48e962afd4a668a219b68271e5dc1 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 11:34:09 2022 +0100 refactored context, tested with non-sliced cross attention control commit d58a46e39bf562e7459290d2444256e8c08ad0b6 Author: damian0815 <null@damianstewart.com> Date: Sun Nov 6 00:41:52 2022 +0100 cleanup commit 7e2c658b4c06fe239311b65b9bb16fa3adec7fd7 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:57:31 2022 +0100 disable logs commit 20ee89d93841b070738b3d8a4385c93b097d92eb Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:36:58 2022 +0100 slice saved attention if necessary commit 0a7684a22c880ec0f48cc22bfed4526358f71546 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:32:38 2022 +0100 raise instead of asserting commit 7083104c7f3a0d8fd96e94a2f391de50a3c942e4 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:31:00 2022 +0100 store dim when saving slices commit f7c0808ed383ec1dc70645288a798ed2aa4fa85c Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:27:16 2022 +0100 don't retry on exception commit 749a721e939b3fe7c1741e7998dab6bd2c85a0cb Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:24:50 2022 +0100 stuff commit 032ab90e9533be8726301ec91b97137e2aadef9a Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:20:17 2022 +0100 more logging commit 3dc34b387f033482305360e605809d95a40bf6f8 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:16:47 2022 +0100 logs commit 901c4c1aa4b9bcef695a6551867ec8149e6e6a93 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:12:39 2022 +0100 actually set save_slicing_strategy to True commit f780e0a0a7c6b6a3db320891064da82589358c8a Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:10:35 2022 +0100 store slicing strategy commit 93bb6d566fd18c5c69ef7dacc8f74ba2cf671cb7 Author: damian <git@damianstewart.com> Date: Sat Nov 5 20:43:48 2022 +0100 still not it commit 5e3a9541f8ae00bde524046963910323e20c40b7 Author: damian <git@damianstewart.com> Date: Sat Nov 5 17:20:02 2022 +0100 wip offloading attention slices on-demand commit 4c2966aa856b6f3b446216da3619ae931552ef08 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 15:47:40 2022 +0100 pre-emptive offloading, idk if it works commit 572576755e9f0a878d38e8173e485126c0efbefb Author: root <you@example.com> Date: Sat Nov 5 11:25:32 2022 +0000 push attention slices to cpu. slow but saves memory. commit b57c83a68f2ac03976ebc89ce2ff03812d6d185f Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 12:04:22 2022 +0100 verbose logging commit 3a5dae116f110a96585d9eb71d713b5ed2bc3d2b Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 11:50:48 2022 +0100 wip fixing mem strategy crash (4 test on runpod) commit 3cf237db5fae0c7b0b4cc3c47c81830bdb2ae7de Author: damian0815 <null@damianstewart.com> Date: Fri Nov 4 09:02:40 2022 +0100 wip, only works on cuda commit 5702271991e126c026aa1ff41c44f8ad37b26e3a Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 14:09:36 2022 +0000 speculative reorganization of the requirements & environment files - This is only a test! - The various environment*.yml and requirements*.txt files have all been moved into a directory named "environments-and-requirements". - The idea is to clean up our root directory so that the github home page is tidy. - The manual install instructions will start with the instructions to create a symbolic link from environment.yml to the appropriate file for OS and GPU. - The 1-click installers have been updated to accommodate this change. commit 10781e7dc4f4551583a110d14f2a1f60393112b8 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 01:59:45 2022 +0000 refactoring requirements commit 099d1157c579c7b9fea20945e8504cc15745c598 Author: mauwii <Mauwii@outlook.de> Date: Wed Nov 9 00:16:18 2022 +0100 better way to make sure if conda is useable commit ab825bf7ee5f0b82d2273da1cda64fc9266a978e Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 22:05:33 2022 +0000 add back --prefer-binaries to requirements commit 10cfeb5ada7bcfc9f3aff3716ab8ea4961a8b528 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 8 22:27:19 2022 +0100 add quotes to set and use `$environment_file` commit e97515d0453583e013674b4dd1f3739c7de402cc Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 8 22:24:21 2022 +0100 set environment file for conda update commit 0f04bc5789c712bf7c7319b1d93064914993f4ec Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 8 22:21:25 2022 +0100 use conda env update commit 3f74aabecd08ed25fac158463ae12b775bd1fca2 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 8 22:20:44 2022 +0100 use command instead of hash commit b1a99a51b7ca23c4b895855bd7b4c82dbdc431e4 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 14:44:44 2022 -0500 remove --global git config from 1-click installers commit 8004f8a6d99f6ff75e00c170da40f1dec93a8914 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Mon Nov 7 09:07:20 2022 -0500 Revert "Use array slicing to calc ddim timesteps" This reverts commit 1f0c5b4cf196716c21f2db74f92c8750ad8f889d. commit ff8ff2212afb1e1c2dce4f6a61f29e2bc8302eb5 Merge: 8e5363cd 636620b1 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 14:01:40 2022 +0000 add initfile support from PR #1386 commit 8e5363cd83bff0e6be0f002c644283955f7fcbfd Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 13:26:18 2022 +0000 move 'installer/' to '1-click-installer' to make room for tildebyte installer commit 1450779146e89510d12b8c90eb316d9861c3375e Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 12:56:36 2022 +0000 update branch for installer to pull against commit 8cd5d95b8a1cb213cce2f949c394c841a09d9cab Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 05:30:20 2022 +0000 move all models into subdirectories of ./models - this required an update to the invoke-ai fork of gfpgan - simultaneously reverted consolidation of environment and requirements files, as their presence in a directory triggered setup.py to try to install a sub-package. commit abd6407394d55d4f6c064a05f3ac989dd3817c59 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 03:52:46 2022 +0000 leave a copy of environment-cuda.yml at top level - named it environment.yml - need to avoid a big change for users and breaking older support instructions. commit 734dacfbe9d8c86ca943c6541e7b5ff5ef787ff4 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 03:50:07 2022 +0000 consolidate environment files - starting to remove unneeded entries and pins - no longer require -e in front of github dependencies - update setup.py with release number - update manual installation instructions commit 636620b1d5e2466613d0dcc2a604522be12fa3a4 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 03:26:16 2022 +0000 change initfile to ~/.invokeai - adjust documentation - also fix 'clipseg_models' to 'clipseg', which seems to be working now commit 1fe41146f0975bbc9d552208473490a9ccb9fc56 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 5 14:28:01 2022 -0400 add support for an initialization file, invokeai.init - Place preferred startup command switches in a file named "invokeai.init". The file can consist of a single line of switches such as "--web --steps=28", a series of switches on each line, or any combination of the two. Example: ``` --web --host=0.0.0.0 --steps=28 --grid -f 0.6 -C 11.0 -A k_euler_a ``` - The following options, which were previously only available within the CLI, are now available on the command line as well: --steps --strength --cfg_scale --width --height --fit commit 2ad6ef355a9b9c4b17bae71edea2346c2e8708c5 Merge: 865502ee 8b47c829 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sun Nov 6 18:08:36 2022 +0000 update discord link commit 865502ee4f681de4516d231370ae603983354d8f Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 18:00:16 2022 +0100 update changelog commit c7984f3299c5c8f56a70d80907d527af458674af Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 17:07:27 2022 +0100 update TROUBLESHOOT.md commit 7f150ed83302ba875c3e0c0f39d8ac0f32c6e362 Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 16:56:58 2022 +0100 remove `:`from headlines in CONTRIBUTORS.md commit badf4e256ce6e3201df1a9a87a7072b36b18d699 Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 16:56:37 2022 +0100 enable navigation tabs Since the docs are growing, this way they look cleaner commit e64c60bbb38fc1620e08ce52bf28bd17003c7ef6 Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 16:18:59 2022 +0100 remove preflight checks from assets seems like somebody executed tests and commited them commit 178061854300632b024810e65922b54b64d95939 Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 16:15:06 2022 +0100 update INSTALLING_MODELS.md commit f91fd276242a0c92b301e99d02982d30f7b712c3 Author: Kyle Schouviller <kyle0654@hotmail.com> Date: Sat Nov 5 14:47:53 2022 -0700 Bug fix for inpaint size commit 09e41e8f769457b9ffd56901aae13991cdc6eeb8 Author: Kyle Schouviller <kyle0654@hotmail.com> Date: Sat Nov 5 14:34:52 2022 -0700 Add inpaint size options to inpaint at a larger size than the actual inpaint image, then scale back down for recombination commit 6eeb2107b300fc27cfe6134b43e5570c246b8e96 Author: mauwii <Mauwii@outlook.de> Date: Sat Nov 5 21:01:14 2022 +0100 remove create-caches.yml since not used anywhere commit 17053ad8b7efecb21a9b4eb32695089f683f72e3 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 5 16:01:55 2022 -0400 fix duplicated argument introduced by conflict resolution commit fefb4dc1f88bc6551a39602a2bc79b278cd83c59 Merge: 762ca60a d05b1b35 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 5 12:47:35 2022 -0700 Merge branch 'development' into fix_generate.py commit d05b1b3544dfa7b3c071ac05b4f014a52e08fa50 Author: Craig <cwallen@users.noreply.github.com> Date: Sat Oct 29 20:40:30 2022 -0400 Resize hires as an image commit 82d4904c07670d514e9a541de7c9ecd8489eeae2 Author: Craig <cwallen@users.noreply.github.com> Date: Sat Oct 29 20:37:40 2022 -0400 Log strength with hires commit 1cdcf33cfa39e90f9660fabf8f5936dcfb6c3aa5 Merge: 6616fa83 cbc029c6 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 5 09:57:38 2022 -0400 Merge branch 'main' into development - this synchronizes recent document fixes by mauwii commit 6616fa835ac4318bf53419f2b54b88c962559578 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 4 00:47:03 2022 -0400 fix Windows library dependency issues This commit addresses two bugs: 1) invokeai.py crashes immediately with a message about an undefined attritube sigKILL (closes #1288). The fix is to pin torch at 1.12.1. 2) Version 1.4.2 of basicsr fails to load properly on Windows, and is a requirement of realesrgan, however 1.4.1 works. Pinning basicsr in our requirements file resulted in a dependency conflict, so I ended up cloning realesrgan into the invoke-ai Git space and changing the requirements file there. If there is a more elegant solution, please advise. commit 7b9a4564b11f4181b9b3c06ecda2a4a25fd1849e Author: Matthias Wild <40327258+mauwii@users.noreply.github.com> Date: Sat Nov 5 14:36:45 2022 +0100 Update-docs (#1382) * update IMG2IMG.md * update INPAINTING.md * update WEBUIHOTKEYS.md * more doc updates (mostly fix formatting): - OUTPAINTING.md - POSTPROCESS.md - PROMPTS.md - VARIATIONS.md - WEB.md - WEBUIHOTKEYS.md commit fcdefa0620761472718afa14b2955a5d0603cfcc Author: Matthias Wild <40327258+mauwii@users.noreply.github.com> Date: Fri Nov 4 20:47:31 2022 +0100 Hotifx docs (#1376) (#1377) commit ef8b3ce639954259a95a38f44fa5329687bee781 Merge: b7042095 36870a8f Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 4 12:08:44 2022 -0400 Merge-main-into-development (#1373) To get the rid of the difference between main and development. Since otherwise it will be a pain to start fixing the documentatino (when the state between main and development is not the same ...) Also this should fix the problem of all tests failing since environment yamls get updated. commit 36870a8f53217d4b733e9bb8b119190b5e36da59 Merge: 6b89adfa b7042095 Author: Matthias Wild <40327258+mauwii@users.noreply.github.com> Date: Fri Nov 4 16:25:00 2022 +0100 Merge branch 'development' into merge-main-into-development commit b70420951d5b70937c0c07e4f8a552a01c3008bc Author: damian0815 <null@damianstewart.com> Date: Thu Nov 3 12:39:45 2022 +0100 fix parsing error doing eg `forest ().swap(in winter)` commit 1f0c5b4cf196716c21f2db74f92c8750ad8f889d Author: wfng92 <43742196+wfng92@users.noreply.github.com> Date: Thu Nov 3 17:13:52 2022 +0800 Use array slicing to calc ddim timesteps commit 8648da811190fc8bcf237d83aff38cf605851300 Author: mauwii <Mauwii@outlook.de> Date: Fri Nov 4 00:06:19 2022 +0100 update environment-linux-aarch64 to use python 3.9 commit 45b459356399f8cfb7e9af571c1643fab04218fe Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 3 22:31:46 2022 +0100 update environment-linux-aarch64.yml - move getpass_asterisk to pip commit 41b04316cf5118ea9518dc77934d135a489dd684 Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 3 20:40:08 2022 +0100 rename job, remove debug branch from triggers commit e97c6db2a3c0157a8a5ab74cd28ebee480a2d078 Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 3 20:34:01 2022 +0100 include build matrix to build x86_64 and aarch64 commit 896820a349292b0e14bbc32f0c557fe8a6b45395 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 05:01:15 2022 +0100 disable caching commit 06c8f468bff7e1dfecc1a1990164be1005b114a7 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 04:26:39 2022 +0100 disable PR-Validation since there are no files passed from context this is unecesarry commit 61920e2701c4a9cea94c03ab933c4482458215b7 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 04:09:39 2022 +0100 update action to use current branch also update build-args of dockerfile and build.sh commit f34ba7ca70f1c417ee97e8b0c57abff57614d78f Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 02:30:24 2022 +0100 remove unecesarry mkdir command again commit c30ef0895dbf0565345ac6ccb136d98a174470a6 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 01:51:12 2022 +0100 remove symlink to GFPGANv1.4 also re-add mkdir to prevent action from failing commit aa3a774f73d5004571ea42fea14cd2b525fffb1c Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 01:48:59 2022 +0100 update build-container.yml to use cachev3 commit 2c30555b844293764123baa4137fcf952d40a4e7 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 01:34:20 2022 +0100 update Dockerfile - create models.yaml from models.yaml.example - run preload_models.py with --no-interactive commit 743f60577364d43237eeb46aefd523371c36e56b Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 01:21:15 2022 +0100 update build.sh to download sd-v1.5 model commit 519c661abbae83aa62b3ee536635c39192890441 Author: mauwii <Mauwii@outlook.de> Date: Tue Oct 25 01:26:50 2022 +0200 replace old fashined markdown templates with forms this will help the readability of issues a lot 🤓 commit 22c956c75f4797ddc2dffa944e3ea84b4eb3477c Merge: 13696adc 0196571a Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 3 10:20:21 2022 -0400 Merge branch 'development' of github.com:invoke-ai/InvokeAI into development commit 13696adc3a3a2b169e68048a5b511660d0430fae Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 3 10:20:10 2022 -0400 speculative change to solve windows esrgan issues commit 0196571a12992eb8207d36e022721fe3ad2cfd19 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 2 22:39:35 2022 -0400 remove merge markers from preload_models.py commit 9666f466ab1c710dfda2e59be9e8a26fcd7e8718 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 2 18:29:34 2022 -0400 use refined model by default commit 240e5486c89552ef480c3443a63283fb86a493c3 Merge: 8164b6b9 aa247e68 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 2 18:35:00 2022 -0400 Merge branch 'spezialspezial-patch-9' into development commit 8164b6b9cff077e4131384195af65e30a40733a7 Merge: 4fc82d55 dd5a88dc Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 2 17:06:46 2022 -0400 Merge branch 'development' of github.com:invoke-ai/InvokeAI into development commit 4fc82d554ff573780c0af562a6bc9586aa56012d Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 04:17:28 2022 +1300 [WebUI] Final 2.1 Release Build commit 96b34c0f85f6ed52707fe43456d20b81822c7d1d Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 09:08:11 2022 +0100 Final WebUI build for Release 2.1 - squashed commit of 52 commits from PR #1327 don't log base64 progress images Fresh Build For WebUI [WebUI] Loopback Default False Fixes bugs/styling - Fixes missing web app state on new version: Adds stateReconciler to redux-persist. When we add more values to the state and then release the update app, they will be automatically merged in. Reseting web UI will be needed far less. 7159ec - Fixes console z-index - Moves reset web UI button to visible area Decreases gallery width on inpainting Increases workarea split padding to 1rem Adds missing tooltips to site header Changes inpainting controls settings to hover Fixes hotkeys and settings buttons not working Improves bounding box interactions - Bounding box can now be moved by dragging any of its edges - Bounding box does not affect drawing if already drawing a stroke - Can lock bounding box to draw directly on the bounding box edges - Removes spacebar-hold behaviour due to technical issues Fixes silent crash when init image too large To send the mask to the server, the UI rendered the mask onto the init image and sent the whole image. The mask was then cropped by the server. If the image was too large, the app silently failed. Maybe it exceeds the websocket size limit. Fixed by cropping the mask in the UI layer, sending only bounding-box-sized mask image data. Disabled bounding box settings when locked Styles image uploader Builds fresh bundle Improves bounding box interaction Added spacebar-hold-to-transform back. Address bounding box feedback - Adds back toggle to hide bounding box - Box quick toggle = q, normal toggle = shift + q - Styles canvas alert icons Adds hints when unable to invoke - Popover on Invoke button indicates why exactly it is disabled, e.g. prompt is empty, something else is processing, etc. - There may be more than one reason; all are displayed. Fix Inpainting Alerts Styling Preventing unnecessary re-renders across the app Code Split Inpaint Options Isolate features to their own components so they dont re-render the other stuff each time. [TESTING] Remove global isReady checking I dont believe this is need at all because the isready state is constantly updated when needed and tracked real time in the Redux store. This causes massive re-renders. @psychedelicious If this is absolutely essential for a reason that I do not see, please hit me up on Discord. Fresh Bundle Fix Bounding Box Settings re-rendering on brush stroke [Code Splitting] Bounding Box Options Isolated all bounding box components to trigger unnecessary re-renders. Still need to fix bounding box triggering re-renders on the control panel inside the canvas itself. But the options panel should be a good to go with this change. Inpainting Controls Code Spitting and Performance Codesplit the entirety of the inpainting controls. Created new selectors for each and every component to ensure there are no unnecessary re-renders. App feels a lot smoother. Fixes rerenders on ClearBrushHistory Fixes crash when requesting post-generation upscale/face restoration - Moves the inpainting paste to before the postprocessing. Removes unused isReady state Changes Report Bug icon to a bug Restores shift+q bounding box shortcut Adds alert for bounding box size to status icons Adds asCheckbox to IAIIconButton Rough draft of this. Not happy with the styling but it's clearer than having them look just like buttons. Fixes crash related to old value of progress_latents in state Styling changes and settings modal minor refactor Fixes: uploaded JPG images not loading Reworks CurrentImageButtons.tsx - Change all icons to FA iconset for consistency - Refactors IAIIconButton, IAIButton, IAIPopover to handle ref forwarding - Redesigns buttons into group Only generate 1 iteration when seed fixed & variations disabled Fixes progress images select Fixes edge case: upload over gets stuck while alt tabbing - Press esc to close it now Fixes display progress images select typing Fixes current image button rerenders Adds min width to ImageUploader Makes fast-latents in progress default Update Icon Button Checkbox Style Styling Fixes next/prev image buttons Refactor canvas buttons + more Add Save Intermediates Step Count For accurate mode only. Co-Authored-By: Richard Macarthy <richardmacarthy@protonmail.com> Restores "initial image" text Address feedback - moves mask clear button - fixes intermediates - shrinks inpainting icons by 10% Fix Loopback Styling Adds escape hotkey to close floating panels Readd Hotkey for Dual Display Updated Current Image Button Styling commit dd5a88dceeec53ceb1722a62e3689ae3dd871154 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 04:17:28 2022 +1300 [WebUI] Final 2.1 Release Build commit 95ed56bf82825a47cfe406fa34eaf4e32c129143 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 04:16:31 2022 +1300 Updated Current Image Button Styling commit 1ae80f5ab9d00a25e0c3a21e2eccd318c5343401 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 04:07:57 2022 +1300 Readd Hotkey for Dual Display commit 1f0bd3ca6cda4221d1a7a46325f235cd23bd0af9 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu Nov 3 02:07:00 2022 +1100 Adds escape hotkey to close floating panels commit a1971f6830306b3d748f7f36c2243f6dee682f97 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 03:38:15 2022 +1300 Fix Loopback Styling commit c6118e889895ba35a191124ce1beb5d2b719366d Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu Nov 3 01:29:51 2022 +1100 Address feedback - moves mask clear button - fixes intermediates - shrinks inpainting icons by 10% commit 7ba958cf7ff4e804a127b71c88666084f81e7340 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu Nov 3 01:10:38 2022 +1100 Restores "initial image" text commit 383905d5d24359aa1824de96ff124a8f8a87e015 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 02:59:11 2022 +1300 Add Save Intermediates Step Count For accurate mode only. Co-Authored-By: Richard Macarthy <richardmacarthy@protonmail.com> commit 6173e3e9cabd5e74fb466d55d7bb6a80a77b3fa8 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu Nov 3 00:53:53 2022 +1100 Refactor canvas buttons + more commit 3feb7d8922b0e4c9f944e96b95211003f40d9705 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu Nov 3 00:49:23 2022 +1100 Fixes next/prev image buttons commit 1d9edbd0ddd6e10cf120fe0de3db0b56ae374db4 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 00:50:44 2022 +1300 Update Icon Button Checkbox Style Styling commit d439abdb89db73e652add9df371234861189d90c Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 21:37:24 2022 +1100 Makes fast-latents in progress default commit ee47ea0c891a33049bdec12f1c254926f341eff2 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 21:37:09 2022 +1100 Adds min width to ImageUploader commit 300bb2e6279c1c477131b9e57425db348062f19c Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 21:28:22 2022 +1100 Fixes current image button rerenders commit ccf8593501d23e00979f7340f8991514e6ca3428 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 21:27:43 2022 +1100 Fixes display progress images select typing commit 0fda612f3ff8ad75932e158b9b29cf64c3f30eb6 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 21:02:01 2022 +1100 Fixes edge case: upload over gets stuck while alt tabbing - Press esc to close it now commit 5afff65b71bb60d067392c120efff1a17adc66af Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 20:33:19 2022 +1100 Fixes progress images select commit 7e55bdefce8920831cac7b9fa857bfbffe9e9d5d Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 20:27:47 2022 +1100 Only generate 1 iteration when seed fixed & variations disabled commit 620cf84d3dd54b8498e84574f33040a26d4d315f Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 19:51:38 2022 +1100 Reworks CurrentImageButtons.tsx - Change all icons to FA iconset for consistency - Refactors IAIIconButton, IAIButton, IAIPopover to handle ref forwarding - Redesigns buttons into group commit cfe567c62ad3fd0cff5e3e579a2250ca5dfa2d53 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 16:14:50 2022 +1100 Fixes: uploaded JPG images not loading commit cefe12f1df72e051f109ed77ce46f18093b3b8bb Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 15:31:18 2022 +1100 Styling changes and settings modal minor refactor commit 1e51c3992853ad4643d8eda2443a3bd0d65f5f90 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 15:27:46 2022 +1100 Fixes crash related to old value of progress_latents in state commit 42a02bbb8087cd46a1b5c795b1b41e38c08ba229 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 13:15:06 2022 +1100 Adds asCheckbox to IAIIconButton Rough draft of this. Not happy with the styling but it's clearer than having them look just like buttons. commit f1ae6dae4c36e74ca8dedf8b57eb8933c059dcf4 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 13:13:56 2022 +1100 Adds alert for bounding box size to status icons commit 6195579910a91fb2ab7e1186aa1c1145566c3122 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 11:52:19 2022 +1100 Restores shift+q bounding box shortcut commit 16c8b23b347792d7811cff66a27d350fe5d0d62c Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 11:32:07 2022 +1100 Changes Report Bug icon to a bug commit 07ae626b22554b5222a3b71d1ce3974e2c3fb284 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 11:17:16 2022 +1100 Removes unused isReady state commit 8d171bb044f578d4b9cc4911edfa05b20a01d373 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 11:13:26 2022 +1100 Fixes crash when requesting post-generation upscale/face restoration - Moves the inpainting paste to before the postprocessing. commit 6e33ca7e9e64fb355430511e28bb08c32c9c68b1 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 10:59:01 2022 +1100 Fixes rerenders on ClearBrushHistory commit db46e12f2b8c98dac8895ea4d04242d3754dbec4 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 11:36:28 2022 +1300 Inpainting Controls Code Spitting and Performance Codesplit the entirety of the inpainting controls. Created new selectors for each and every component to ensure there are no unnecessary re-renders. App feels a lot smoother. commit 868e4b2db82fa8556b423111f2f8d565a70ec129 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 07:40:31 2022 +1300 [Code Splitting] Bounding Box Options Isolated all bounding box components to trigger unnecessary re-renders. Still need to fix bounding box triggering re-renders on the control panel inside the canvas itself. But the options panel should be a good to go with this change. commit 2e562742c13988a1fc299c673a97ba4e4a645aaf Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 06:40:27 2022 +1300 Fix Bounding Box Settings re-rendering on brush stroke commit 68e69580091fc1dc1d8b6e03c9e7ef777c7ebf61 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 06:28:34 2022 +1300 Fresh Bundle commit ea6e3a7949f2743711516261cb7e450517d39702 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 06:26:56 2022 +1300 [TESTING] Remove global isReady checking I dont believe this is need at all because the isready state is constantly updated when needed and tracked real time in the Redux store. This causes massive re-renders. @psychedelicious If this is absolutely essential for a reason that I do not see, please hit me up on Discord. commit b2879ca99f88869277c474185ade049914b0bf26 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 06:08:59 2022 +1300 Code Split Inpaint Options Isolate features to their own components so they dont re-render the other stuff each time. commit 4e911566c33989392eb3279049b15331ca98594a Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 03:50:56 2022 +1300 Preventing unnecessary re-renders across the app commit 9bafda6a152778893df143776ae859a3b8b7f192 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 03:02:35 2022 +1300 Fix Inpainting Alerts Styling commit 871a8a5375cae891f22eb853ffd2d22298298b11 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 23:52:07 2022 +1100 Adds hints when unable to invoke - Popover on Invoke button indicates why exactly it is disabled, e.g. prompt is empty, something else is processing, etc. - There may be more than one reason; all are displayed. commit 0eef74bc00d3c0cedc5037c1deeef1d9a5b6d33d Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 23:40:11 2022 +1100 Address bounding box feedback - Adds back toggle to hide bounding box - Box quick toggle = q, normal toggle = shift + q - Styles canvas alert icons commit 423ae3209782f1d8d321b2ed9ed00712b726adf7 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 17:06:07 2022 +1100 Improves bounding box interaction Added spacebar-hold-to-transform back. commit 8282e5d0458ca1bba5565c069093b5389f2228d4 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 16:57:07 2022 +1100 Builds fresh bundle commit 19305cdbdf6ac74833bd6011bff0ced8e9d36f69 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 16:51:11 2022 +1100 Styles image uploader commit eb9028ab3069bca9d747aca664ca60ae13ba6df8 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 16:51:03 2022 +1100 Disabled bounding box settings when locked commit 21483f5d0731bce5aa97985e722a64bf0d7cd12c Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 16:50:24 2022 +1100 Fixes silent crash when init image too large To send the mask to the server, the UI rendered the mask onto the init image and sent the whole image. The mask was then cropped by the server. If the image was too large, the app silently failed. Maybe it exceeds the websocket size limit. Fixed by cropping the mask in the UI layer, sending only bounding-box-sized mask image data. commit 82dcbac28f140aa7bd89d967bcc7fa31cb03a267 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 16:28:30 2022 +1100 Improves bounding box interactions - Bounding box can now be moved by dragging any of its edges - Bounding box does not affect drawing if already drawing a stroke - Can lock bounding box to draw directly on the bounding box edges - Removes spacebar-hold behaviour due to technical issues commit d43bd4625d64a03d90de0458ad5fcacef211a8a6 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 15:10:49 2022 +1100 Fixes hotkeys and settings buttons not working commit ea891324a2086faf8eeeeac7eaf47ae2935322fb Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 11:04:02 2022 +1100 Changes inpainting controls settings to hover commit 8fd9ea219390493f392e690eadb23c4209a4ecfc Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 11:03:41 2022 +1100 Adds missing tooltips to site header commit fb026668563b3179805819a1630c654c9ce260d9 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 11:03:25 2022 +1100 Increases workarea split padding to 1rem commit f6f5c2731b0c37089c5d7382736f973e857df712 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 11:03:10 2022 +1100 Decreases gallery width on inpainting commit b4e3f771e0314e0a18ad5cedc80b28f246fced59 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 10:54:59 2022 +1100 Fixes bugs/styling - Fixes missing web app state on new version: Adds stateReconciler to redux-persist. When we add more values to the state and then release the update app, they will be automatically merged in. Reseting web UI will be needed far less. 7159ec - Fixes console z-index - Moves reset web UI button to visible area commit 99bb9491ac97f1f733accab839ea38cdf4870ba0 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Tue Nov 1 08:35:45 2022 +1300 [WebUI] Loopback Default False commit 0453f211278a533a49fb1aee54dd989b69179c10 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 23:23:51 2022 +1300 Fresh Build For WebUI commit 9fc09aa4bda3b3e6139b026f24733a37747d373f Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 09:08:11 2022 +0100 don't log base64 progress images commit 5e87062cf809a08242d3b006b66d3bbb834ddb16 Author: spezialspezial <75758219+spezialspezial@users.noreply.github.com> Date: Wed Nov 2 00:21:27 2022 +0100 Option to directly invert the grayscale heatmap - fix commit 3e7a459990407ad1679f38d4027c19d50a9d36e3 Author: spezialspezial <75758219+spezialspezial@users.noreply.github.com> Date: Tue Nov 1 21:37:33 2022 +0100 Update txt2mask.py commit bbf4c03e500bafc8627c2a70f8b3396efeddabb3 Author: spezialspezial <75758219+spezialspezial@users.noreply.github.com> Date: Tue Nov 1 21:11:19 2022 +0100 Option to directly invert the grayscale heatmap Theoretically less work inverting the image while it's small but I can't measure a significant difference. Though, handy option to have in some cases. commit 611a3a975328a7e276c2781214d5e14108708ed7 Author: mauwii <Mauwii@outlook.de> Date: Wed Nov 2 02:23:09 2022 +0100 fix name of caching step commit 1611f0d1815022fe90d33f41c21d670251a75f29 Author: mauwii <Mauwii@outlook.de> Date: Wed Nov 2 02:18:46 2022 +0100 readd caching of sd-models - this would remove the necesarrity of the secret availability in PRs commit 08835115e4c5c0ee3587ce07ab769a04d55cb3c5 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 22:10:12 2022 -0400 pin pytorch_lightning to 1.7.7, issue #1331 commit 2d84e28d329be282b51a4cbc22f7c200d80c8f0e Merge: 533fd04e ef17aae8 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 22:11:04 2022 -0400 Merge branch 'development' of github.com:invoke-ai/InvokeAI into development commit ef17aae8abe03fd87dc6f91b3c6d2fe03375f6c5 Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 00:39:48 2022 +0100 add damian0815 to contributors list commit 0cc39f01a3c67f32873b7888e1e032d33626e269 Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 01:18:50 2022 +0100 report full size for fast latents and update conversion matrix for v1.5 commit 688d7258f185035a5924bee23322b001574da931 Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 00:33:00 2022 +0100 fix a bug that broke cross attention control index mapping commit 4513320bf161d3efdd99e2aef4f7c37472131373 Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 00:31:58 2022 +0100 save VRAM by not recombining tensors that have been sliced to save VRAM commit 533fd04ef0d1ba9d2cb25d556991b999e7d44aba Merge: 6215592b dff5681c Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 17:40:36 2022 -0400 Merge branch 'development' of github.com:invoke-ai/InvokeAI into development commit dff5681cf0e24faf67d5eb5903203c4ea39f89bd Author: damian0815 <d@d.com> Date: Tue Nov 1 13:56:03 2022 +0100 shorter strings commit 5a2790a69b11e049d2507bc22eab7812915d867f Author: damian0815 <d@d.com> Date: Tue Nov 1 13:19:20 2022 +0100 convert progress display to a drop-down commit 7c5305ccbaf7926162536aa3a9e51dcdd8574d0d Author: damian0815 <d@d.com> Date: Tue Nov 1 12:54:46 2022 +0100 do not try to save base64 intermediates in gallery on cancellation commit 4013e8ad6fa5e5c2a710c607fe7e1d040f353299 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 21:54:35 2022 +1100 Fixes b64 image sending and displaying commit d1dfd257f9e1cafd352d9007a56194226b9d6b63 Author: damian <d@d.com> Date: Tue Nov 1 11:40:40 2022 +0100 wip base64 commit 5322d735ee4515d89293b7fb015b2ce048262f68 Author: damian <d@d.com> Date: Tue Nov 1 11:31:42 2022 +0100 update frontend commit cdb107dcda858a8bb64455cc60a196a42345f8f7 Author: damian <d@d.com> Date: Tue Nov 1 11:17:43 2022 +0100 add option to show intermediate latent space commit be1393a41ce7a75ed8de7f648a93c5e5974a50d2 Author: damian <d@d.com> Date: Tue Nov 1 10:16:55 2022 +0100 ensure existing exception handling code also handles new exception class commit e554c2607f00a5e51c03052acb9861ff21ec1c12 Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Tue Nov 1 10:08:42 2022 +0100 Rebuilt prompt parsing logic Complete re-write of the prompt parsing logic to be more readable and logical, and therefore also hopefully easier to debug, maintain, and augment. In the process it has also become more robust to badly-formed prompts. Squashed commit of the following: commit 8fcfa88a16e1390d41717e940d72aed64712171c Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Sun Oct 30 17:05:57 2022 +0100 further cleanup commit 1a1fd78bcfeb49d072e3e6d5808aa8df15441629 Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Sun Oct 30 16:07:57 2022 +0100 cleanup and document commit 099c9659fa8b8135876f9a5a50fe80b20bc0635c Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Sun Oct 30 15:54:58 2022 +0100 works fully commit 5e6887ea8c25a1e21438ff6defb381fd027d25fd Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Sun Oct 30 15:24:31 2022 +0100 further... commit 492fda120844d9bc1ad4ec7dd408a3374762d0ff Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Sun Oct 30 14:08:57 2022 +0100 getting there... commit c6aab05a8450cc3c95c8691daf38fdc64c74f52d Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Fri Oct 28 14:29:03 2022 +0200 wip doesn't compile commit 5e533f731cfd20cd435330eeb0012e5689e87e81 Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Fri Oct 28 13:21:43 2022 +0200 working with CrossAttentionCtonrol but no Attention support yet commit 9678348773431e500e110e8aede99086bb7b5955 Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Fri Oct 28 13:04:52 2022 +0200 wip rebuiling prompt parser commit 6215592b12dea3822c727913b771012789a52477 Merge: ef24d76a 349cc254 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 17:34:55 2022 -0400 Merge branch 'development' of github.com:invoke-ai/InvokeAI into development commit 349cc25433e1d358c6c61cca4a6c300ecc8ca3d7 Author: damian0815 <d@d.com> Date: Tue Nov 1 20:08:52 2022 +0100 fix crash (be a little less aggressive clearing out the attention slice) commit 214d276379387ae0fa2259602ab00884ec1ad03e Author: damian0815 <d@d.com> Date: Tue Nov 1 19:57:55 2022 +0100 be more aggressive at clearing out saved_attn_slice commit ef24d76adc5a192297714707cd6794d4f44bcf67 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 14:34:23 2022 -0400 fix library problems in preload_modules commit ab2b5a691dadb292f7cecf5db94a165db3e3e126 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 17:22:48 2022 -0400 fix model_cache memory management issues commit c7de2b2801ad5d6ce52a5f44e88c5705f1dbf524 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 02:02:14 2022 +0100 disable checks with sd-V1.4 model... ...to save some resources, since V1.5 is the default now commit e8075658acf675346d35435d0cfb7710becab42a Author: mauwii <Mauwii@outlook.de> Date: Mon Oct 31 22:20:51 2022 +0100 update test-invoke-conda.yml - fix model dl path for sd-v1-4.ckpt - copy configs/models.yaml.example to configs/models.yaml commit 4202dabee1143f597f4c3946420fbfa7b8eccddf Author: mauwii <Mauwii@outlook.de> Date: Mon Oct 31 22:17:21 2022 +0100 fix models example weights for sd-v1.4 commit d67db2bcf1ac26d8bb7c5f8bfd056f2172597780 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Tue Nov 1 08:35:45 2022 +1300 [WebUI] Loopback Default False commit 7159ec885faa1117a3506689d547618be1d91808 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Mon Oct 31 11:33:05 2022 -0400 further improvements to preload_models.py - Faster startup for command line switch processing - Specify configuration file to modify using --config option: ./scripts/preload_models.ply --config models/my-models-file.yaml commit b5cf734ba9f1aeaab14075b55cc13ed9a0ae31e2 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Mon Oct 31 11:08:19 2022 -0400 improve behavior of preload_models.py - NEVER overwrite user's existing models.yaml - Instead, merge its contents into new config file, and rename original to models.yaml.orig (with message) - models.yaml has been removed from repository and renamed models.yaml.example commit f7dc8eafeef991e135b5541c01d0ff740dda9591 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Mon Oct 31 10:47:35 2022 -0400 restore models.yaml to virgin state commit 762ca60a309f70daaf1b9e79b6273f76fd9474b6 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Oct 4 22:55:10 2022 -0400 Update INPAINTING.md commit e7fb9f342cb5ed0c09e6215026d60d45eef3ebcb Author: Hideyuki Katsushiro <h.katsushiro@qualia.tokyo.jp> Date: Wed Oct 5 10:08:53 2022 +0900 add argument --outdir
2022-11-12 17:17:07 +00:00
outdir = None,
# these are specific to img2img and inpaint
init_img = None,
init_mask = None,
text_mask = None,
invert_mask = False,
fit = False,
strength = None,
init_color = None,
# these are specific to embiggen (which also relies on img2img args)
Merge dev into main for 2.2.0 (#1642) * Fixes inpainting + code cleanup * Disable stage info in Inpainting Tab * Mask Brush Preview now always at 0.5 opacity The new mask is only visible properly at max opacity but at max opacity the brush preview becomes fully opaque blocking the view. So the mask brush preview no remains at 0.5 no matter what the Brush opacity is. * Remove save button from Canvas Controls (cleanup) * Implements invert mask * Changes "Invert Mask" to "Preserve Masked Areas" * Fixes (?) spacebar issues * Patches redux-persist and redux-deep-persist with debounced persists Our app changes redux state very, very often. As our undo/redo history grows, the calls to persist state start to take in the 100ms range, due to a the deep cloning of the history. This causes very noticeable performance lag. The deep cloning is required because we need to blacklist certain items in redux from being persisted (e.g. the app's connection status). Debouncing the whole process of persistence is a simple and effective solution. Unfortunately, `redux-persist` dropped `debounce` between v4 and v5, replacing it with `throttle`. `throttle`, instead of delaying the expensive action until a period of X ms of inactivity, simply ensures the action is executed at least every X ms. Of course, this does not fix our performance issue. The patch is very simple. It adds a `debounce` argument - a number of milliseconds - and debounces `redux-persist`'s `update()` method (provided by `createPersistoid`) by that many ms. Before this, I also tried writing a custom storage adapter for `redux-persist` to debounce the calls to `localStorage.setItem()`. While this worked and was far less invasive, it doesn't actually address the issue. It turns out `setItem()` is a very fast part of the process. We use `redux-deep-persist` to simplify the `redux-persist` configuration, which can get complicated when you need to blacklist or whitelist deeply nested state. There is also a patch here for that library because it uses the same types as `redux-persist`. Unfortunately, the last release of `redux-persist` used a package `flat-stream` which was malicious and has been removed from npm. The latest commits to `redux-persist` (about 1 year ago) do not build; we cannot use the master branch. And between the last release and last commit, the changes have all been breaking. Patching this last release (about 3 years old at this point) directly is far simpler than attempting to fix the upstream library's master branch or figuring out an alternative to the malicious and now non-existent dependency. * Adds debouncing * Fixes AttributeError: 'dict' object has no attribute 'invert_mask' * Updates package.json to use redux-persist patches * Attempts to fix redux-persist debounce patch * Fixes undo/redo * Fixes invert mask * Debounce > 300ms * Limits history to 256 for each of undo and redo * Canvas styling * Hotkeys improvement * Add Metadata To Viewer * Increases CFG Scale max to 200 * Fix gallery width size for Outpainting Also fixes the canvas resizing failing n fast pushes * Fixes disappearing canvas grid lines * Adds staging area * Fixes "use all" not setting variationAmount Now sets to 0 when the image had variations. * Builds fresh bundle * Outpainting tab loads to empty canvas instead of upload * Fixes wonky canvas layer ordering & compositing * Fixes error on inpainting paste back `TypeError: 'float' object cannot be interpreted as an integer` * Hides staging area outline on mouseover prev/next * Fixes inpainting not doing img2img when no mask * Fixes bbox not resizing in outpainting if partially off screen * Fixes crashes during iterative outpaint. Still doesn't work correctly though. * Fix iterative outpainting by restoring original images * Moves image uploading to HTTP - It all seems to work fine - A lot of cleanup is still needed - Logging needs to be added - May need types to be reviewed * Fixes: outpainting temp images show in gallery * WIP refactor to unified canvas * Removes console.log from redux-persist patch * Initial unification of canvas * Removes all references to split inpainting/outpainting canvas * Add patchmatch and infill_method parameter to prompt2image (options are 'patchmatch' or 'tile'). * Fixes app after removing in/out-painting refs * Rebases on dev, updates new env files w/ patchmatch * Organises features/canvas * Fixes bounding box ending up offscreen * Organises features/canvas * Stops unnecessary canvas rescales on gallery state change * Fixes 2px layout shift on toggle canvas lock * Clips lines drawn while canvas locked When drawing with the locked canvas, if a brush stroke gets too close to the edge of the canvas and its stroke would extend past the edge of the canvas, the edge of that stroke will be seen after unlocking the canvas. This could cause a problem if you unlock the canvas and now have a bunch of strokes just outside the init image area, which are far back in undo history and you cannot easily erase. With this change, lines drawn while the canvas is locked get clipped to the initial image bbox, fixing this issue. Additionally, the merge and save to gallery functions have been updated to respect the initial image bbox so they function how you'd expect. * Fixes reset canvas view when locked * Fixes send to buttons * Fixes bounding box not being rounded to 64 * Abandons "inpainting" canvas lock * Fixes save to gallery including empty area, adds download and copy image * Fix Current Image display background going over image bounds * Sets status immediately when clicking Invoke * Adds hotkeys and refactors sharing of konva instances Adds hotkeys to canvas. As part of this change, the access to konva instance objects was refactored: Previously closure'd refs were used to indirectly get access to the konva instances outside of react components. Now, a getter and setter function are used to provide access directly to the konva objects. * Updates hotkeys * Fixes canvas showing spinner on first load Also adds good default canvas scale and positioning when no image is on it * Fixes possible hang on MaskCompositer * Improves behaviour when setting init canvas image/reset view * Resets bounding box coords/dims when no image present * Disables canvas actions which cannot be done during processing * Adds useToastWatcher hook - Dispatch an `addToast` action with standard Chakra toast options object to add a toast to the toastQueue - The hook is called in App.tsx and just useEffect's w/ toastQueue as dependency to create the toasts - So now you can add toasts anywhere you have access to `dispatch`, which includes middleware and thunks - Adds first usage of this for the save image buttons in canvas * Update Hotkey Info Add missing tooltip hotkeys and update the hotkeys modal to reflect the new hotkeys for the Unified Canvas. * Fix theme changer not displaying current theme on page refresh * Fix tab count in hotkeys panel * Unify Brush and Eraser Sizes * Fix staging area display toggle not working * Staging Area delete button is now red So it doesnt feel blended into to the rest of them. * Revert "Fix theme changer not displaying current theme on page refresh" This reverts commit 903edfb803e743500242589ff093a8a8a0912726. * Add arguments to use SSL to webserver * Integrates #1487 - touch events Need to add: - Pinch zoom - Touch-specific handling (some things aren't quite right) * Refactors upload-related async thunks - Now standard thunks instead of RTK createAsyncThunk() - Adds toasts for all canvas upload-related actions * Reorganises app file structure * Fixes Canvas Auto Save to Gallery * Fixes staging area outline * Adds staging area hotkeys, disables gallery left/right when staging * Fixes Use All Parameters * Fix metadata viewer image url length when viewing intermediate * Fixes intermediate images being tiny in txt2img/img2img * Removes stale code * Improves canvas status text and adds option to toggle debug info * Fixes paste image to upload * Adds model drop-down to site header * Adds theme changer popover * Fix missing key on ThemeChanger map * Fixes stage position changing on zoom * Hotkey Cleanup - Viewer is now Z - Canvas Move tool is V - sync with PS - Removed some unused hotkeys * Fix canvas resizing when both options and gallery are unpinned * Implements thumbnails for gallery - Thumbnails are saved whenever an image is saved, and when gallery requests images from server - Thumbnails saved at original image aspect ratio with width of 128px as WEBP - If the thumbnail property of an image is unavailable for whatever reason, the image's full size URL is used instead * Saves thumbnails to separate thumbnails directory * Thumbnail size = 256px * Fix Lightbox Issues * Disables canvas image saving functions when processing * Fix index error on going past last image in Gallery * WIP - Lightbox Fixes Still need to fix the images not being centered on load when the image res changes * Fixes another similar index error, simplifies logic * Reworks canvas toolbar * Fixes canvas toolbar upload button * Cleans up IAICanvasStatusText * Improves metadata handling, fixes #1450 - Removes model list from metadata - Adds generation's specific model to metadata - Displays full metadata in JSON viewer * Gracefully handles corrupted images; fixes #1486 - App does not crash if corrupted image loaded - Error is displayed in the UI console and CLI output if an image cannot be loaded * Adds hotkey to reset canvas interaction state If the canvas' interaction state (e.g. isMovingBoundingBox, isDrawing, etc) get stuck somehow, user can press Escape to reset the state. * Removes stray console.log() * Fixes bug causing gallery to close on context menu open * Minor bugfixes - When doing long-running canvas image exporting actions, display indeterminate progress bar - Fix staging area image outline not displaying after committing/discarding results * Removes unused imports * Fixes repo root .gitignore ignoring frontend things * Builds fresh bundle * Styling updates * Removes reasonsWhyNotReady The popover doesn't play well with the button being disabled, and I don't think adds any value. * Image gallery resize/style tweaks * Styles buttons for clearing canvas history and mask * First pass on Canvas options panel * Fixes bug where discarding staged images results in loss of history * Adds Save to Gallery button to staging toolbar * Rearrange some canvas toolbar icons Put brush stuff together and canvas movement stuff together * Fix gallery maxwidth on unified canvas * Update Layer hotkey display to UI * Adds option to crop to bounding box on save * Masking option tweaks * Crop to Bounding Box > Save Box Region Only * Adds clear temp folder * Updates mask options popover behavior * Builds fresh bundle * Fix styling on alert modals * Fix input checkbox styling being incorrect on light theme * Styling fixes * Improves gallery resize behaviour * Cap gallery size on canvas tab so it doesnt overflow * Fixes bug when postprocessing image with no metadata * Adds IAIAlertDialog component * Moves Loopback to app settings * Fixes metadata viewer not showing metadata after refresh Also adds Dream-style prompt to metadata * Adds outpainting specific options * Linting * Fixes gallery width on lightbox, fixes gallery button expansion * Builds fresh bundle * Fix Lightbox images of different res not centering * Update feature tooltip text * Highlight mask icon when on mask layer * Fix gallery not resizing correctly on open and close * Add loopback to just img2img. Remove from settings. * Fix to gallery resizing * Removes Advanced checkbox, cleans up options panel for unified canvas * Minor styling fixes to new options panel layout * Styling Updates * Adds infill method * Tab Styling Fixes * memoize outpainting options * Fix unnecessary gallery re-renders * Isolate Cursor Pos debug text on canvas to prevent rerenders * Fixes missing postprocessed image metadata before refresh * Builds fresh bundle * Fix rerenders on model select * Floating panel re-render fix * Simplify fullscreen hotkey selector * Add Training WIP Tab * Adds Training icon * Move full screen hotkey to floating to prevent tab rerenders * Adds single-column gallery layout * Fixes crash on cancel with intermediates enabled, fixes #1416 * Updates npm dependencies * Fixes img2img attempting inpaint when init image has transparency * Fixes missing threshold and perlin parameters in metadata viewer * Renames "Threshold" > "Noise Threshold" * Fixes postprocessing not being disabled when clicking use all * Builds fresh bundle * Adds color picker * Lints & builds fresh bundle * Fixes iterations being disabled when seed random & variations are off * Un-floors cursor position * Changes color picker preview to circles * Fixes variation params not set correctly when recalled * Fixes invoke hotkey not working in input fields * Simplifies Accordion Prep for adding reset buttons for each section * Fixes mask brush preview color * Committing color picker color changes tool to brush * Color picker does not overwrite user-selected alpha * Adds brush color alpha hotkey * Lints * Removes force_outpaint param * Add inpaint size options to inpaint at a larger size than the actual inpaint image, then scale back down for recombination * Bug fix for inpaint size * Adds inpaint size (as scale bounding box) to UI * Adds auto-scaling for inpaint size * Improves scaled bbox display logic * Fixes bug with clear mask and history * Fixes shouldShowStagingImage not resetting to true on commit * Builds fresh bundle * Fixes canvas failing to scale on first run * Builds fresh bundle * Fixes unnecessary canvas scaling * Adds gallery drag and drop to img2img/canvas * Builds fresh bundle * Fix desktop mode being broken with new versions of flaskwebgui * Fixes canvas dimensions not setting on first load * Builds fresh bundle * stop crash on !import_models call on model inside rootdir - addresses bug report #1546 * prevent "!switch state gets confused if model switching fails" - If !switch were to fail on a particular model, then generate got confused and wouldn't try again until you switch to a different working model and back again. - This commit fixes and closes #1547 * Revert "make the docstring more readable and improve the list_models logic" This reverts commit 248068fe5d57b5639ea7a87ee6cbf023104d957d. * fix model cache path * also set fail-fast to it's default (true) in this way the whole action fails if one job fails this should unblock the runners!!! * fix output path for Archive results * disable checks for python 3.9 * Update-requirements and test-invoke-pip workflow (#1574) * update requirements files * update test-invoke-pip workflow * move requirements-mkdocs.txt to docs folder (#1575) * move requirements-mkdocs.txt to docs folder * update copyright * Fixes outpainting with resized inpaint size * Interactive configuration (#1517) * Update scripts/configure_invokeai.py prevent crash if output exists Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> * implement changes requested by reviews * default to correct root and output directory on Windows systems - Previously the script was relying on the readline buffer editing feature to set up the correct default. But this feature doesn't exist on windows. - This commit detects when user typed return with an empty directory value and replaces with the default directory. * improved readability of directory choices * Update scripts/configure_invokeai.py Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> * better error reporting at startup - If user tries to run the script outside of the repo or runtime directory, a more informative message will appear explaining the problem. Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> * Embedding merging (#1526) * add whole <style token> to vocab for concept library embeddings * add ability to load multiple concept .bin files * make --log_tokenization respect custom tokens * start working on concept downloading system * preliminary support for dynamic loading and merging of multiple embedded models - The embedding_manager is now enhanced with ldm.invoke.concepts_lib, which handles dynamic downloading and caching of embedded models from the Hugging Face concepts library (https://huggingface.co/sd-concepts-library) - Downloading of a embedded model is triggered by the presence of one or more <concept> tags in the prompt. - Once the embedded model is downloaded, its trigger phrase will be loaded into the embedding manager and the prompt's <concept> tag will be replaced with the <trigger_phrase> - The downloaded model stays on disk for fast loading later. - The CLI autocomplete will complete partial <concept> tags for you. Type a '<' and hit tab to get all ~700 concepts. BUGS AND LIMITATIONS: - MODEL NAME VS TRIGGER PHRASE You must use the name of the concept embed model from the SD library, and not the trigger phrase itself. Usually these are the same, but not always. For example, the model named "hoi4-leaders" corresponds to the trigger "<HOI4-Leader>" One reason for this design choice is that there is no apparent constraint on the uniqueness of the trigger phrases and one trigger phrase may map onto multiple models. So we use the model name instead. The second reason is that there is no way I know of to search Hugging Face for models with certain trigger phrases. So we'd have to download all 700 models to index the phrases. The problem this presents is that this may confuse users, who will want to reuse prompts from distributions that use the trigger phrase directly. Usually this will work, but not always. - WON'T WORK ON A FIREWALLED SYSTEM If the host running IAI has no internet connection, it can't download the concept libraries. I will add a script that allows users to preload a list of concept models. - BUG IN PROMPT REPLACEMENT WHEN MODEL NOT FOUND There's a small bug that occurs when the user provides an invalid model name. The <concept> gets replaced with <None> in the prompt. * fix loading .pt embeddings; allow multi-vector embeddings; warn on dupes * simplify replacement logic and remove cuda assumption * download list of concepts from hugging face * remove misleading customization of '*' placeholder the existing code as-is did not do anything; unclear what it was supposed to do. the obvious alternative -- setting using 'placeholder_strings' instead of 'placeholder_tokens' to match model.params.personalization_config.params.placeholder_strings -- caused a crash. i think this is because the passed string also needed to be handed over on init of the PersonalizedBase as the 'placeholder_token' argument. this is weird config dict magic and i don't want to touch it. put a breakpoint in personalzied.py line 116 (top of PersonalizedBase.__init__) if you want to have a crack at it yourself. * address all the issues raised by damian0815 in review of PR #1526 * actually resize the token_embeddings * multiple improvements to the concept loader based on code reviews 1. Activated the --embedding_directory option (alias --embedding_path) to load a single embedding or an entire directory of embeddings at startup time. 2. Can turn off automatic loading of embeddings using --no-embeddings. 3. Embedding checkpoints are scanned with the pickle scanner. 4. More informative error messages when a concept can't be loaded due either to a 404 not found error or a network error. * autocomplete terms end with ">" now * fix startup error and network unreachable 1. If the .invokeai file does not contain the --root and --outdir options, invoke.py will now fix it. 2. Catch and handle network problems when downloading hugging face textual inversion concepts. * fix misformatted error string Co-authored-by: Damian Stewart <d@damianstewart.com> * model_cache.py: fix list_models Signed-off-by: devops117 <55235206+devops117@users.noreply.github.com> * add statement of values (#1584) * this adds the Statement of Values Google doc source = https://docs.google.com/document/d/1-PrUKDJcxy8OyNGc8CyiHhv2VgLvjt7LRGlEpbg1nmQ/edit?usp=sharing * Fix heading * Update InvokeAI_Statement_of_Values.md * Update InvokeAI_Statement_of_Values.md * Update InvokeAI_Statement_of_Values.md * Update InvokeAI_Statement_of_Values.md * Update InvokeAI_Statement_of_Values.md * add keturn and mauwii to the team member list * Fix punctuation * this adds the Statement of Values Google doc source = https://docs.google.com/document/d/1-PrUKDJcxy8OyNGc8CyiHhv2VgLvjt7LRGlEpbg1nmQ/edit?usp=sharing * add keturn and mauwii to the team member list * fix formating - make sub bullets use * (decide to all use - or *) - indent sub bullets Sorry, first only looked at the code version and found this only after looking at the markdown rendered version * use multiparagraph numbered sections * Break up Statement Of Values as per comments on #1584 * remove duplicated word, reduce vagueness it's important not to overstate how many artists we are consulting. * fix typo (sorry blessedcoolant) Co-authored-by: mauwii <Mauwii@outlook.de> Co-authored-by: damian <git@damianstewart.com> * update dockerfile (#1551) * update dockerfile * remove not existing file from .dockerignore * remove bloat and unecesary step also use --no-cache-dir for pip install image is now close to 2GB * make Dockerfile a variable * set base image to `ubuntu:22.10` * add build-essential * link outputs folder for persistence * update tag variable * update docs * fix not customizeable build args, add reqs output * !model_import autocompletes in ROOTDIR * Adds psychedelicious to statement of values signature (#1602) * add a --no-patchmatch option to disable patchmatch loading (#1598) This feature was added to prevent the CI Macintosh tests from erroring out when patchmatch is unable to retrieve its shared library from github assets. * Fix #1599 by relaxing the `match_trigger` regex (#1601) * Fix #1599 by relaxing the `match_trigger` regex Also simplify logic and reduce duplication. * restrict trigger regex again (but not so far) * make concepts library work with Web UI This PR makes it possible to include a Hugging Face concepts library <style-or-subject-trigger> in the WebUI prompt. The metadata seems to be correctly handled. * documentation enhancements (#1603) - Add documentation for the Hugging Face concepts library and TI embedding. - Fixup index.md to point to each of the feature documentation files, including ones that are pending. * tweak setup and environment files for linux & pypatchmatch (#1580) * tweak setup and environment files for linux & pypatchmatch - Downgrade python requirements to 3.9 because 3.10 is not supported on Ubuntu 20.04 LTS (widely-used distro) - Use our github pypatchmatch 0.1.3 in order to install Makefile where it needs to be. - Restored "-e ." as the last install step on pip installs. Hopefully this will not trigger the high-CPU hang we've previously experienced. * keep windows on basicsr 1.4.1 * keep windows on basicsr 1.4.1 * bump pypatchmatch requirement to 0.1.4 - This brings in a version of pypatchmatch that will gracefully handle internet connection not available at startup time. - Also refactors and simplifies the handling of gfpgan's basicsr requirement across various platforms. * revert to older version of list_models() (#1611) This restores the correct behavior of list_models() and quenches the bug of list_models() returning a single model entry named "name". I have not investigated what was wrong with the new version, but I think it may have to do with changes to the behavior in dict.update() * Fixes for #1604 (#1605) * Converts ESRGAN image input to RGB - Also adds typing for image input. - Partially resolves #1604 * ensure there are unmasked pixels before color matching Co-authored-by: Kyle Schouviller <kyle0654@hotmail.com> * update index.md (#1609) - comment out non existing link - fix indention - add seperator between feature categories * Debloat-docker (#1612) * debloat Dockerfile - less options more but more userfriendly - better Entrypoint to simulate CLI usage - without command the container still starts the web-host * debloat build.sh * better syntax in run.sh * update Docker docs - fix description of VOLUMENAME - update run script example to reflect new entrypoint * Test installer (#1618) * test linux install * try removing http from parsed requirements * pip install confirmed working on linux * ready for linux testing - rebuilt py3.10-linux-x86_64-cuda-reqs.txt to include pypatchmatch dependency. - point install.sh and install.bat to test-installer branch. * Updates MPS reqs * detect broken readline history files * fix download.pytorch.org URL * Test installer (Win 11) (#1620) Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> * Test installer (MacOS 13.0.1 w/ torch==1.12.0) (#1621) * Test installer (Win 11) * Test installer (MacOS 13.0.1 w/ torch==1.12.0) Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> * change sourceball to development for testing * Test installer (MacOS 13.0.1 w/ torch==1.12.1 & torchvision==1.13.1) (#1622) * Test installer (Win 11) * Test installer (MacOS 13.0.1 w/ torch==1.12.0) * Test installer (MacOS 13.0.1 w/ torch==1.12.1 & torchvision==1.13.1) Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Co-authored-by: Cyrus Chan <82143712+cyruschan360@users.noreply.github.com> Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> * 2.2 Doc Updates (#1589) * Unified Canvas Docs & Assets Unified Canvas draft Advanced Tools Updates Doc Updates (lstein feedback) * copy edits to Unified Canvas docs - consistent capitalisation and feature naming - more intimate address (replace "the user" with "you") for improved User Engagement(tm) - grammatical massaging and *poesie* Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> Co-authored-by: damian <git@damianstewart.com> * include a step after config to `cat ~/.invokeai` (#1629) * disable patchmatch in CI actions (#1626) * disable patchmatch in CI actions * fix indention * replace tab with spaces Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> * Fix installer script for macOS. (#1630) * refer to the platform as 'osx' instead of 'mac', otherwise the composed URL to micromamba is wrong. * move the `-O` option to `tar` to be grouped with the other tar flags to avoid the `-O` being interpreted as something to unarchive. * Removes symlinked environment.yaml (#1631) Was unintentionally added in #1621 * Fix inpainting with iterations (#1635) * fix error when inpainting using runwayml inpainting model (#1634) - error was "Omnibus object has no attribute pil_image" - closes #1596 * add k_dpmpp_2_a and k_dpmpp_2 solvers options (#1389) * add k_dpmpp_2_a and k_dpmpp_2 solvers options * update frontend Co-authored-by: Victor <victorca25@users.noreply.github.com> Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> * add .editorconfig (#1636) * Web UI 2.2 bugfixes (#1572) * Fixes bug preventing multiple images from being generated * Fixes valid seam strength value range * Update Delete Alert Text Indicates to the user that images are not permanently deleted. * Fixes left/right arrows not working on gallery * Fixes initial image on load erroneously set to a user uploaded image Should be a result gallery image. * Lightbox Fixes - Lightbox is now a button in the current image buttons - Lightbox is also now available in the gallery context menu - Lightbox zoom issues fixed - Lightbox has a fade in animation. * Fix image display wrapper in current preview not overflow bounds * Revert "Fix image display wrapper in current preview not overflow bounds" This reverts commit 5511c82714dbf1d1999d64e8bc357bafa34ddf37. * Change Staging Area discard icon from Bin to X * Expose Snap Threshold and Move Snap Settings to BBox Panel * Changes img2img strength default to 0.75 * Fixes drawing triggering when mouse enters canvas w/ button down When we only supported inpainting and no zoom, this was useful. It allowed the cursor to leave the canvas (which was easy to do given the limited canvas dimensions) and without losing the "I am drawing" state. With a zoomable canvas this is no longer as useful. Additionally, we have more popovers and tools (like the color pickers) which result in unexpected brush strokes. This fixes that issue. * Revert "Expose Snap Threshold and Move Snap Settings to BBox Panel" We will handle this a bit differently - by allowing the grid origin to be moved. I will dig in at some point. This reverts commit 33c92ecf4da724c2f17d9d91c7ea31a43a2f6deb. * Adds Limit Strokes to Box * Adds fill bounding box button * Adds erase bounding box button * Changes Staging area discard icon to match others * Fixes right click breaking move tool * Fixes brush preview visibility issue with "darken outside box" * Fixes history bugs with addFillRect, addEraseRect, and other actions * Adds missing `key` * Fixes postprocessing being applied to canvas generations * Fixes bbox not getting scaled in various situations * Fixes staging area show image toggle not resetting on accept/discard * Locks down canvas while generating/staging * Fixes move tool breaking when canvas loses focus during move/transform * Hides cursor when restrict strokes is on and mouse outside bbox * Lints * Builds fresh bundle * Fix overlapping hotkey for Fill Bounding Box * Build Fresh Bundle * Fixes bug with mask and bbox overlay * Builds fresh bundle Co-authored-by: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> * disable NSFW checker loading during the CI tests (#1641) * disable NSFW checker loading during the CI tests The NSFW filter apparently causes invoke.py to crash during CI testing, possibly due to out of memory errors. This workaround disables NSFW model loading. * doc change * fix formatting errors in yml files * Configure the NSFW checker at install time with default on (#1624) * configure the NSFW checker at install time with default on 1. Changes the --safety_checker argument to --nsfw_checker and --no-nsfw_checker. The original argument is recognized for backward compatibility. 2. The configure script asks users whether to enable the checker (default yes). Also offers users ability to select default sampler and number of generation steps. 3.Enables the pasting of the caution icon on blurred images when InvokeAI is installed into the package directory. 4. Adds documentation for the NSFW checker, including caveats about accuracy, memory requirements, and intermediate image dispaly. * use better fitting icon * NSFW defaults false for testing * set default back to nsfw active Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> Signed-off-by: devops117 <55235206+devops117@users.noreply.github.com> Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Co-authored-by: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Co-authored-by: Kyle Schouviller <kyle0654@hotmail.com> Co-authored-by: javl <mail@jaspervanloenen.com> Co-authored-by: Kent Keirsey <31807370+hipsterusername@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com> Co-authored-by: Damian Stewart <d@damianstewart.com> Co-authored-by: DevOps117 <55235206+devops117@users.noreply.github.com> Co-authored-by: damian <git@damianstewart.com> Co-authored-by: Damian Stewart <null@damianstewart.com> Co-authored-by: Cyrus Chan <82143712+cyruschan360@users.noreply.github.com> Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> Co-authored-by: Andre LaBranche <dre@mac.com> Co-authored-by: victorca25 <41912303+victorca25@users.noreply.github.com> Co-authored-by: Victor <victorca25@users.noreply.github.com>
2022-11-30 21:12:23 +00:00
embiggen = None,
embiggen_tiles = None,
embiggen_strength = None,
Refactoring simplet2i (#387) * start refactoring -not yet functional * first phase of refactor done - not sure weighted prompts working * Second phase of refactoring. Everything mostly working. * The refactoring has moved all the hard-core inference work into ldm.dream.generator.*, where there are submodules for txt2img and img2img. inpaint will go in there as well. * Some additional refactoring will be done soon, but relatively minor work. * fix -save_orig flag to actually work * add @neonsecret attention.py memory optimization * remove unneeded imports * move token logging into conditioning.py * add placeholder version of inpaint; porting in progress * fix crash in img2img * inpainting working; not tested on variations * fix crashes in img2img * ported attention.py memory optimization #117 from basujindal branch * added @torch_no_grad() decorators to img2img, txt2img, inpaint closures * Final commit prior to PR against development * fixup crash when generating intermediate images in web UI * rename ldm.simplet2i to ldm.generate * add backward-compatibility simplet2i shell with deprecation warning * add back in mps exception, addresses @vargol comment in #354 * replaced Conditioning class with exported functions * fix wrong type of with_variations attribute during intialization * changed "image_iterator()" to "get_make_image()" * raise NotImplementedError for calling get_make_image() in parent class * Update ldm/generate.py better error message Co-authored-by: Kevin Gibbons <bakkot@gmail.com> * minor stylistic fixes and assertion checks from code review * moved get_noise() method into img2img class * break get_noise() into two methods, one for txt2img and the other for img2img * inpainting works on non-square images now * make get_noise() an abstract method in base class * much improved inpainting Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
2022-09-06 00:40:10 +00:00
# these are specific to GFPGAN/ESRGAN
merge release-candidate-1-3-2 into main. Squashed commit of the following: commit 9a1fe8e7fbbd81d9e9e47c4fda6bde6f66fba30c Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 12 17:07:40 2022 +0000 swap in release URLs for installers commit ff56f5251ba8502833cb561317e82b028cd2da5d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 12 17:03:21 2022 +0000 fix up bad unicode chars in invoke.py commit ed943bd6c785d968d1e31fbbb814fea8688fc8bb Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 12 16:05:45 2022 +0000 outcrop improvements, hand-added commit 7ad2355b1da53861bb75312edead8f9db0b0f44d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 12 15:14:33 2022 +0000 documentation fixes commit 66c920fc197d9206be9e0e2d1eb2a1cb86362887 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 16:49:25 2022 -0500 Revert "Resize hires as an image" This reverts commit d05b1b3544dfa7b3c071ac05b4f014a52e08fa50. commit 3fc5cb09f8bc03ea96e67a3e49fb087019d2f9d5 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 12 12:43:17 2022 +0000 fix incorrect link in install commit 1345ec77ab58f70e1bf5a0f587ca40aba4e906b7 Author: tildebyte <337875+tildebyte@users.noreply.github.com> Date: Sun Nov 6 19:07:31 2022 -0500 toil(repo): add tildebyte as owner of installer/ directory commit b116715490f390a59e5bee1022a6a758aee0918d Author: Kyle Schouviller <kyle0654@hotmail.com> Date: Thu Nov 10 21:43:56 2022 -0800 Fix performance issue introduced by torch cuda cache clear during generation commit fa3670270e7aae6bfd8d47fb7bdd32b707310c23 Author: mauwii <Mauwii@outlook.de> Date: Fri Nov 11 12:42:03 2022 +0100 small update to dockers huggingface section commit c304250ef663b3e202b4da8332365288589d94c7 Author: mauwii <Mauwii@outlook.de> Date: Fri Nov 11 12:19:27 2022 +0100 fix format and Link in INSTALL_INVOKE.md commit 802ce5dde5ca68f24aa4609cdba428044e0c7fa1 Author: mauwii <Mauwii@outlook.de> Date: Fri Nov 11 11:17:49 2022 +0100 small fixex to format and a link in INSTALL_MANUAL commit 311ee320ecac892cb4a1bcd012374fa051b1d011 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 07:23:35 2022 +0000 ignore installer intermediate files commit e9df17b374df58a44d3ae3ba33cbdc58794bcf5d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 07:19:25 2022 +0000 fix backslash-related syntax error commit 061fb4ef00482bdd4fba635aeaeff4ca7510190d Merge: 52be0d23 4095acd1 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 06:50:04 2022 +0000 Merge branch 'release-candidate-2-1-3' of github.com:/invoke-ai/InvokeAI into release-candidate-2-1-3 commit 52be0d2396de2de02030855c92e3367008b50377 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 06:49:45 2022 +0000 add WindowsLongFileName batfile to source installer commit 4095acd10ebae05a8cb14cc2faf7c79936d9e6a9 Author: mauwii <Mauwii@outlook.de> Date: Fri Nov 11 07:05:17 2022 +0100 Doc Updates A lot of re-formating of new Installation Docs also some content updates/corrections commit 201eb22d7650b00f55249c2646fa4f47ac3e0ec2 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 04:41:02 2022 +0000 prevent two models from being marked default in models.yaml commit 17ab98220034dfbb798a9a0460bc2837f0c1e2cb Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 03:56:54 2022 +0000 installers download branch HEAD not tag commit a04965b0e9e9d1170cf284af9acbd1186d681255 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 03:48:21 2022 +0000 improve messaging during installation process commit 0b529f0c574dd91fb9593e924ebc41c8c219b6ce Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 15:22:32 2022 +0000 enable outcropping of random JPG/PNG images - Works best with runwayML inpainting model - Numerous code changes required to propagate seed to final metadata. Original code predicated on the image being generated within InvokeAI. commit 6f9f84834557eb3c48562dc5d0ace51ca9e9cca2 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 17:27:42 2022 +0000 enhance outcropping with ability to direct contents of new regions - When outcropping an image you can now add a `--new_prompt` option, to specify a new prompt to be used instead of the original one used to generate the image. - Similarly you can provide a new seed using `--seed` (or `-S`). A seed of zero will pick one randomly. - This PR also fixes the crash that happened when trying to outcrop an image that does not contain InvokeAI metadata. commit 918c1589ef30595668899f4259ece6a4ad605c69 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 20:16:47 2022 +0000 fix #1402 commit 116415b3fcec8415f8e6de9b23c0bbd0dbc6845b Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 21:27:25 2022 +0000 fix invoke.py crash if no models.yaml file present - Script will now offer the user the ability to create a minimal models.yaml and then gracefully exit. - Closes #1420 commit b4b6eabaac94896e38123be331c44d1b63065b0d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 16:49:25 2022 -0500 Revert "Log strength with hires" This reverts commit 82d4904c07670d514e9a541de7c9ecd8489eeae2. commit 4ef1f4a854717c953f9192454d0adabef32af36c Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 20:01:49 2022 +0000 remove temporary directory from repo commit 510fc4ebaa5f9dc0e77b47cf04e0c265423e0a44 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 19:59:03 2022 +0000 remove -e from clipseg load in installer commit a20914434bb3609cf1d883cabf048d4cc25f881a Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 19:37:07 2022 +0000 change clipseg repo branch to avoid clipseg not found error commit 0d134195fda5c69fce5a95d6da90248eba8d226d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 18:39:29 2022 +0000 update repo URL to point to rc commit 649d8c8573896fdb5a73453b69ee4b54cf4d6241 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 18:13:28 2022 +0000 integrate tildebyte installer commit a358d370a05ea985a9e26fa9c1101d9c14fdb3ab Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 17:48:14 2022 +0000 add @tildebyte compiled pip installer commit 94a9033c4f6214e604be149a3de6d7c747af7f3a Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 14:52:00 2022 +0000 ignore source installer zip files commit 18a947c503c83c95cd83f27424696219ff3c4c95 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 14:46:36 2022 +0000 documentation and environment file fixes - Have clarified the relationship between the @tildebyte and @cmdr2 installers; However, @tildebyte installer merge is still a WIP due to conflicts over such things as `invoke.sh`. - Rechristened 1click installer as "source" installer. @tildebyte installer will be "the" installer. (We'll see which one generates the least support requests and maintenance work.) - Sync'd `environment-mac.yml` with `development`. The former was failing with a taming-transformers error as per https://discord.com/channels/@me/1037201214154231899/1040060947378749460 commit a23b03189526a49da8ddae90ce71b0e902784d29 Author: Mike DiGiovanni <vinblau@gmail.com> Date: Wed Nov 9 16:44:59 2022 -0500 Fixes typos in README.md commit 23af68c7d79d947f1bd3441c91bb44d655238f01 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 07:02:27 2022 -0500 downgrade win installs to basicsr==1.4.1 commit e258beeb51f3e645b9ea60e52d69d18722221cc5 Merge: 7460c069 e481bfac Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 06:37:45 2022 -0500 Merge branch 'release-candidate-2-1-3' of github.com:invoke-ai/InvokeAI into release-candidate-2-1-3 commit 7460c069b880b10c84b55f2e0c0998e350d6cf12 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 06:36:48 2022 -0500 remove --prefer-binary from requirements-base.txt It appears that some versions of pip do not recognize this option when it appears in the requirements file. Did not explore this further but recommend --prefer-binary in the manual install instructions on the command line. commit e481bfac615e0c798ceb5e59e8fbe3038f85b431 Merge: 5040747c d1ab65a4 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 11:21:56 2022 +0000 Merge branch 'release-candidate-2-1-3' of github.com:/invoke-ai/InvokeAI into release-candidate-2-1-3 commit 5040747c6700c9b949e3f3e1d2c3f21daffcec6c Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 11:21:43 2022 +0000 fix windows install instructions & bat file commit d1ab65a43122f73c20533d5815590ec10bc05eca Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 07:18:59 2022 +0100 update WEBUIHOTKEYS.md commit af4ee7feb8a7d2528bf4e2b3f7deee7a7c4c3dec Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 06:33:49 2022 +0100 update INSTALL_DOCKER.md commit 764fb29aded8114984d05932c4266ea24614b932 Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 06:30:15 2022 +0100 fix formatting in INSTALL.md commit 1014d3ba44aa4cd4cfdc6e3650c24a0dc9568a6e Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 06:29:14 2022 +0100 fix build.sh invokeai_conda_env_file default value commit 40a48aca88e337e9f4475f80a03b7d6d4751d09b Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 05:25:30 2022 +0100 fix environment-mac.yml moved taming-transformers-rom1504 to pip dependencies commit 92abc00f16a34a586dd16d3c64408f00e23fcb53 Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 05:19:52 2022 +0100 fix test-invoke-conda - copy required conda environment yaml - use environment.yml - I use cp instead of ln since would be compatible for windows runners commit a5719aabf89c8c5f29c6044e2882ccdcd0c6916b Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 04:14:35 2022 +0100 update Dockerfile - link environment.yml from new environemnts path - change default conda_env_file - quote all variables to avoid splitting - also remove paths from conda-env-files in build-container.yml commit 44a18511fa7accfec6a20345774583a1ce745b02 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 20:51:06 2022 +0000 update paths in container build workflow commit b850dbadafba052310327ca759d96f49a9d25d03 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 20:16:57 2022 +0000 finished reorganization of install docs commit 9ef8b944d53afb1fed94c418b2fd936d2d743797 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 18:50:58 2022 +0000 tweaks to manual install documentation --prefer-binary is an iffy option in the requirements file. It isn't supported by some versions of pip, so I removed it from requirements-base.txt and inserted it into the manual install instructions where it seems to do what it is supposed to. commit efc5a9848803b4250d726bc1913b9fd5a33fad75 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 18:20:03 2022 +0000 manual installation documentation tested on Linux commit 1417c87928e13b0ed21bf1c5604f8636d3b50a8d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 17:37:06 2022 +0000 change name of requirements.txt to avoid confusion commit 2dd6fc2b93ff7bbb4038568a3b28d36a8fafaeb8 Merge: 22213612 71ee44a8 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 17:26:24 2022 +0000 Merge branch 'release-candidate-2-1-3' of github.com:/invoke-ai/InvokeAI into release-candidate-2-1-3 commit 22213612a08bbece46eafd48994f985b097cb141 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 17:25:59 2022 +0000 directory cleanup; working on install docs commit 71ee44a827898759fd457f774c0b2ac7a1ef6519 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 02:07:13 2022 +0000 prevent crash when switching to an invalid model commit b17ca0a5e731c142101bbdbf34d121df949e86d7 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 14:28:38 2022 +0100 don't suppress exceptions when doing cross-attention control commit 71bbfe4a1a5b70f90e5f41c94df50fb104dbdd79 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 12:59:34 2022 +0100 Fix #1362 by improving VRAM usage patterns when doing .swap() commit ef3f7a26e242b73c2beb0195c7fd8f654ef47f55 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 12:18:37 2022 +0100 remove log spam commit 7189d649622d4668b120b0dd278388ad672142c4 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 12:10:28 2022 +0100 change the way saved slicing strategy is applied commit 01c40f751ab72955140165c16f95ae411732265b Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 12:04:43 2022 +0100 fix slicing_strategy_getter callsite commit f8cfe25150a346958903316bc710737d99839923 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 11:56:22 2022 +0100 cleanup, consistent dim=0 also tested commit 5bf9b1e890d48e962afd4a668a219b68271e5dc1 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 11:34:09 2022 +0100 refactored context, tested with non-sliced cross attention control commit d58a46e39bf562e7459290d2444256e8c08ad0b6 Author: damian0815 <null@damianstewart.com> Date: Sun Nov 6 00:41:52 2022 +0100 cleanup commit 7e2c658b4c06fe239311b65b9bb16fa3adec7fd7 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:57:31 2022 +0100 disable logs commit 20ee89d93841b070738b3d8a4385c93b097d92eb Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:36:58 2022 +0100 slice saved attention if necessary commit 0a7684a22c880ec0f48cc22bfed4526358f71546 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:32:38 2022 +0100 raise instead of asserting commit 7083104c7f3a0d8fd96e94a2f391de50a3c942e4 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:31:00 2022 +0100 store dim when saving slices commit f7c0808ed383ec1dc70645288a798ed2aa4fa85c Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:27:16 2022 +0100 don't retry on exception commit 749a721e939b3fe7c1741e7998dab6bd2c85a0cb Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:24:50 2022 +0100 stuff commit 032ab90e9533be8726301ec91b97137e2aadef9a Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:20:17 2022 +0100 more logging commit 3dc34b387f033482305360e605809d95a40bf6f8 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:16:47 2022 +0100 logs commit 901c4c1aa4b9bcef695a6551867ec8149e6e6a93 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:12:39 2022 +0100 actually set save_slicing_strategy to True commit f780e0a0a7c6b6a3db320891064da82589358c8a Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:10:35 2022 +0100 store slicing strategy commit 93bb6d566fd18c5c69ef7dacc8f74ba2cf671cb7 Author: damian <git@damianstewart.com> Date: Sat Nov 5 20:43:48 2022 +0100 still not it commit 5e3a9541f8ae00bde524046963910323e20c40b7 Author: damian <git@damianstewart.com> Date: Sat Nov 5 17:20:02 2022 +0100 wip offloading attention slices on-demand commit 4c2966aa856b6f3b446216da3619ae931552ef08 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 15:47:40 2022 +0100 pre-emptive offloading, idk if it works commit 572576755e9f0a878d38e8173e485126c0efbefb Author: root <you@example.com> Date: Sat Nov 5 11:25:32 2022 +0000 push attention slices to cpu. slow but saves memory. commit b57c83a68f2ac03976ebc89ce2ff03812d6d185f Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 12:04:22 2022 +0100 verbose logging commit 3a5dae116f110a96585d9eb71d713b5ed2bc3d2b Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 11:50:48 2022 +0100 wip fixing mem strategy crash (4 test on runpod) commit 3cf237db5fae0c7b0b4cc3c47c81830bdb2ae7de Author: damian0815 <null@damianstewart.com> Date: Fri Nov 4 09:02:40 2022 +0100 wip, only works on cuda commit 5702271991e126c026aa1ff41c44f8ad37b26e3a Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 14:09:36 2022 +0000 speculative reorganization of the requirements & environment files - This is only a test! - The various environment*.yml and requirements*.txt files have all been moved into a directory named "environments-and-requirements". - The idea is to clean up our root directory so that the github home page is tidy. - The manual install instructions will start with the instructions to create a symbolic link from environment.yml to the appropriate file for OS and GPU. - The 1-click installers have been updated to accommodate this change. commit 10781e7dc4f4551583a110d14f2a1f60393112b8 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 01:59:45 2022 +0000 refactoring requirements commit 099d1157c579c7b9fea20945e8504cc15745c598 Author: mauwii <Mauwii@outlook.de> Date: Wed Nov 9 00:16:18 2022 +0100 better way to make sure if conda is useable commit ab825bf7ee5f0b82d2273da1cda64fc9266a978e Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 22:05:33 2022 +0000 add back --prefer-binaries to requirements commit 10cfeb5ada7bcfc9f3aff3716ab8ea4961a8b528 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 8 22:27:19 2022 +0100 add quotes to set and use `$environment_file` commit e97515d0453583e013674b4dd1f3739c7de402cc Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 8 22:24:21 2022 +0100 set environment file for conda update commit 0f04bc5789c712bf7c7319b1d93064914993f4ec Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 8 22:21:25 2022 +0100 use conda env update commit 3f74aabecd08ed25fac158463ae12b775bd1fca2 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 8 22:20:44 2022 +0100 use command instead of hash commit b1a99a51b7ca23c4b895855bd7b4c82dbdc431e4 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 14:44:44 2022 -0500 remove --global git config from 1-click installers commit 8004f8a6d99f6ff75e00c170da40f1dec93a8914 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Mon Nov 7 09:07:20 2022 -0500 Revert "Use array slicing to calc ddim timesteps" This reverts commit 1f0c5b4cf196716c21f2db74f92c8750ad8f889d. commit ff8ff2212afb1e1c2dce4f6a61f29e2bc8302eb5 Merge: 8e5363cd 636620b1 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 14:01:40 2022 +0000 add initfile support from PR #1386 commit 8e5363cd83bff0e6be0f002c644283955f7fcbfd Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 13:26:18 2022 +0000 move 'installer/' to '1-click-installer' to make room for tildebyte installer commit 1450779146e89510d12b8c90eb316d9861c3375e Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 12:56:36 2022 +0000 update branch for installer to pull against commit 8cd5d95b8a1cb213cce2f949c394c841a09d9cab Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 05:30:20 2022 +0000 move all models into subdirectories of ./models - this required an update to the invoke-ai fork of gfpgan - simultaneously reverted consolidation of environment and requirements files, as their presence in a directory triggered setup.py to try to install a sub-package. commit abd6407394d55d4f6c064a05f3ac989dd3817c59 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 03:52:46 2022 +0000 leave a copy of environment-cuda.yml at top level - named it environment.yml - need to avoid a big change for users and breaking older support instructions. commit 734dacfbe9d8c86ca943c6541e7b5ff5ef787ff4 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 03:50:07 2022 +0000 consolidate environment files - starting to remove unneeded entries and pins - no longer require -e in front of github dependencies - update setup.py with release number - update manual installation instructions commit 636620b1d5e2466613d0dcc2a604522be12fa3a4 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 03:26:16 2022 +0000 change initfile to ~/.invokeai - adjust documentation - also fix 'clipseg_models' to 'clipseg', which seems to be working now commit 1fe41146f0975bbc9d552208473490a9ccb9fc56 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 5 14:28:01 2022 -0400 add support for an initialization file, invokeai.init - Place preferred startup command switches in a file named "invokeai.init". The file can consist of a single line of switches such as "--web --steps=28", a series of switches on each line, or any combination of the two. Example: ``` --web --host=0.0.0.0 --steps=28 --grid -f 0.6 -C 11.0 -A k_euler_a ``` - The following options, which were previously only available within the CLI, are now available on the command line as well: --steps --strength --cfg_scale --width --height --fit commit 2ad6ef355a9b9c4b17bae71edea2346c2e8708c5 Merge: 865502ee 8b47c829 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sun Nov 6 18:08:36 2022 +0000 update discord link commit 865502ee4f681de4516d231370ae603983354d8f Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 18:00:16 2022 +0100 update changelog commit c7984f3299c5c8f56a70d80907d527af458674af Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 17:07:27 2022 +0100 update TROUBLESHOOT.md commit 7f150ed83302ba875c3e0c0f39d8ac0f32c6e362 Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 16:56:58 2022 +0100 remove `:`from headlines in CONTRIBUTORS.md commit badf4e256ce6e3201df1a9a87a7072b36b18d699 Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 16:56:37 2022 +0100 enable navigation tabs Since the docs are growing, this way they look cleaner commit e64c60bbb38fc1620e08ce52bf28bd17003c7ef6 Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 16:18:59 2022 +0100 remove preflight checks from assets seems like somebody executed tests and commited them commit 178061854300632b024810e65922b54b64d95939 Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 16:15:06 2022 +0100 update INSTALLING_MODELS.md commit f91fd276242a0c92b301e99d02982d30f7b712c3 Author: Kyle Schouviller <kyle0654@hotmail.com> Date: Sat Nov 5 14:47:53 2022 -0700 Bug fix for inpaint size commit 09e41e8f769457b9ffd56901aae13991cdc6eeb8 Author: Kyle Schouviller <kyle0654@hotmail.com> Date: Sat Nov 5 14:34:52 2022 -0700 Add inpaint size options to inpaint at a larger size than the actual inpaint image, then scale back down for recombination commit 6eeb2107b300fc27cfe6134b43e5570c246b8e96 Author: mauwii <Mauwii@outlook.de> Date: Sat Nov 5 21:01:14 2022 +0100 remove create-caches.yml since not used anywhere commit 17053ad8b7efecb21a9b4eb32695089f683f72e3 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 5 16:01:55 2022 -0400 fix duplicated argument introduced by conflict resolution commit fefb4dc1f88bc6551a39602a2bc79b278cd83c59 Merge: 762ca60a d05b1b35 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 5 12:47:35 2022 -0700 Merge branch 'development' into fix_generate.py commit d05b1b3544dfa7b3c071ac05b4f014a52e08fa50 Author: Craig <cwallen@users.noreply.github.com> Date: Sat Oct 29 20:40:30 2022 -0400 Resize hires as an image commit 82d4904c07670d514e9a541de7c9ecd8489eeae2 Author: Craig <cwallen@users.noreply.github.com> Date: Sat Oct 29 20:37:40 2022 -0400 Log strength with hires commit 1cdcf33cfa39e90f9660fabf8f5936dcfb6c3aa5 Merge: 6616fa83 cbc029c6 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 5 09:57:38 2022 -0400 Merge branch 'main' into development - this synchronizes recent document fixes by mauwii commit 6616fa835ac4318bf53419f2b54b88c962559578 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 4 00:47:03 2022 -0400 fix Windows library dependency issues This commit addresses two bugs: 1) invokeai.py crashes immediately with a message about an undefined attritube sigKILL (closes #1288). The fix is to pin torch at 1.12.1. 2) Version 1.4.2 of basicsr fails to load properly on Windows, and is a requirement of realesrgan, however 1.4.1 works. Pinning basicsr in our requirements file resulted in a dependency conflict, so I ended up cloning realesrgan into the invoke-ai Git space and changing the requirements file there. If there is a more elegant solution, please advise. commit 7b9a4564b11f4181b9b3c06ecda2a4a25fd1849e Author: Matthias Wild <40327258+mauwii@users.noreply.github.com> Date: Sat Nov 5 14:36:45 2022 +0100 Update-docs (#1382) * update IMG2IMG.md * update INPAINTING.md * update WEBUIHOTKEYS.md * more doc updates (mostly fix formatting): - OUTPAINTING.md - POSTPROCESS.md - PROMPTS.md - VARIATIONS.md - WEB.md - WEBUIHOTKEYS.md commit fcdefa0620761472718afa14b2955a5d0603cfcc Author: Matthias Wild <40327258+mauwii@users.noreply.github.com> Date: Fri Nov 4 20:47:31 2022 +0100 Hotifx docs (#1376) (#1377) commit ef8b3ce639954259a95a38f44fa5329687bee781 Merge: b7042095 36870a8f Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 4 12:08:44 2022 -0400 Merge-main-into-development (#1373) To get the rid of the difference between main and development. Since otherwise it will be a pain to start fixing the documentatino (when the state between main and development is not the same ...) Also this should fix the problem of all tests failing since environment yamls get updated. commit 36870a8f53217d4b733e9bb8b119190b5e36da59 Merge: 6b89adfa b7042095 Author: Matthias Wild <40327258+mauwii@users.noreply.github.com> Date: Fri Nov 4 16:25:00 2022 +0100 Merge branch 'development' into merge-main-into-development commit b70420951d5b70937c0c07e4f8a552a01c3008bc Author: damian0815 <null@damianstewart.com> Date: Thu Nov 3 12:39:45 2022 +0100 fix parsing error doing eg `forest ().swap(in winter)` commit 1f0c5b4cf196716c21f2db74f92c8750ad8f889d Author: wfng92 <43742196+wfng92@users.noreply.github.com> Date: Thu Nov 3 17:13:52 2022 +0800 Use array slicing to calc ddim timesteps commit 8648da811190fc8bcf237d83aff38cf605851300 Author: mauwii <Mauwii@outlook.de> Date: Fri Nov 4 00:06:19 2022 +0100 update environment-linux-aarch64 to use python 3.9 commit 45b459356399f8cfb7e9af571c1643fab04218fe Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 3 22:31:46 2022 +0100 update environment-linux-aarch64.yml - move getpass_asterisk to pip commit 41b04316cf5118ea9518dc77934d135a489dd684 Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 3 20:40:08 2022 +0100 rename job, remove debug branch from triggers commit e97c6db2a3c0157a8a5ab74cd28ebee480a2d078 Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 3 20:34:01 2022 +0100 include build matrix to build x86_64 and aarch64 commit 896820a349292b0e14bbc32f0c557fe8a6b45395 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 05:01:15 2022 +0100 disable caching commit 06c8f468bff7e1dfecc1a1990164be1005b114a7 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 04:26:39 2022 +0100 disable PR-Validation since there are no files passed from context this is unecesarry commit 61920e2701c4a9cea94c03ab933c4482458215b7 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 04:09:39 2022 +0100 update action to use current branch also update build-args of dockerfile and build.sh commit f34ba7ca70f1c417ee97e8b0c57abff57614d78f Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 02:30:24 2022 +0100 remove unecesarry mkdir command again commit c30ef0895dbf0565345ac6ccb136d98a174470a6 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 01:51:12 2022 +0100 remove symlink to GFPGANv1.4 also re-add mkdir to prevent action from failing commit aa3a774f73d5004571ea42fea14cd2b525fffb1c Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 01:48:59 2022 +0100 update build-container.yml to use cachev3 commit 2c30555b844293764123baa4137fcf952d40a4e7 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 01:34:20 2022 +0100 update Dockerfile - create models.yaml from models.yaml.example - run preload_models.py with --no-interactive commit 743f60577364d43237eeb46aefd523371c36e56b Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 01:21:15 2022 +0100 update build.sh to download sd-v1.5 model commit 519c661abbae83aa62b3ee536635c39192890441 Author: mauwii <Mauwii@outlook.de> Date: Tue Oct 25 01:26:50 2022 +0200 replace old fashined markdown templates with forms this will help the readability of issues a lot 🤓 commit 22c956c75f4797ddc2dffa944e3ea84b4eb3477c Merge: 13696adc 0196571a Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 3 10:20:21 2022 -0400 Merge branch 'development' of github.com:invoke-ai/InvokeAI into development commit 13696adc3a3a2b169e68048a5b511660d0430fae Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 3 10:20:10 2022 -0400 speculative change to solve windows esrgan issues commit 0196571a12992eb8207d36e022721fe3ad2cfd19 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 2 22:39:35 2022 -0400 remove merge markers from preload_models.py commit 9666f466ab1c710dfda2e59be9e8a26fcd7e8718 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 2 18:29:34 2022 -0400 use refined model by default commit 240e5486c89552ef480c3443a63283fb86a493c3 Merge: 8164b6b9 aa247e68 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 2 18:35:00 2022 -0400 Merge branch 'spezialspezial-patch-9' into development commit 8164b6b9cff077e4131384195af65e30a40733a7 Merge: 4fc82d55 dd5a88dc Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 2 17:06:46 2022 -0400 Merge branch 'development' of github.com:invoke-ai/InvokeAI into development commit 4fc82d554ff573780c0af562a6bc9586aa56012d Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 04:17:28 2022 +1300 [WebUI] Final 2.1 Release Build commit 96b34c0f85f6ed52707fe43456d20b81822c7d1d Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 09:08:11 2022 +0100 Final WebUI build for Release 2.1 - squashed commit of 52 commits from PR #1327 don't log base64 progress images Fresh Build For WebUI [WebUI] Loopback Default False Fixes bugs/styling - Fixes missing web app state on new version: Adds stateReconciler to redux-persist. When we add more values to the state and then release the update app, they will be automatically merged in. Reseting web UI will be needed far less. 7159ec - Fixes console z-index - Moves reset web UI button to visible area Decreases gallery width on inpainting Increases workarea split padding to 1rem Adds missing tooltips to site header Changes inpainting controls settings to hover Fixes hotkeys and settings buttons not working Improves bounding box interactions - Bounding box can now be moved by dragging any of its edges - Bounding box does not affect drawing if already drawing a stroke - Can lock bounding box to draw directly on the bounding box edges - Removes spacebar-hold behaviour due to technical issues Fixes silent crash when init image too large To send the mask to the server, the UI rendered the mask onto the init image and sent the whole image. The mask was then cropped by the server. If the image was too large, the app silently failed. Maybe it exceeds the websocket size limit. Fixed by cropping the mask in the UI layer, sending only bounding-box-sized mask image data. Disabled bounding box settings when locked Styles image uploader Builds fresh bundle Improves bounding box interaction Added spacebar-hold-to-transform back. Address bounding box feedback - Adds back toggle to hide bounding box - Box quick toggle = q, normal toggle = shift + q - Styles canvas alert icons Adds hints when unable to invoke - Popover on Invoke button indicates why exactly it is disabled, e.g. prompt is empty, something else is processing, etc. - There may be more than one reason; all are displayed. Fix Inpainting Alerts Styling Preventing unnecessary re-renders across the app Code Split Inpaint Options Isolate features to their own components so they dont re-render the other stuff each time. [TESTING] Remove global isReady checking I dont believe this is need at all because the isready state is constantly updated when needed and tracked real time in the Redux store. This causes massive re-renders. @psychedelicious If this is absolutely essential for a reason that I do not see, please hit me up on Discord. Fresh Bundle Fix Bounding Box Settings re-rendering on brush stroke [Code Splitting] Bounding Box Options Isolated all bounding box components to trigger unnecessary re-renders. Still need to fix bounding box triggering re-renders on the control panel inside the canvas itself. But the options panel should be a good to go with this change. Inpainting Controls Code Spitting and Performance Codesplit the entirety of the inpainting controls. Created new selectors for each and every component to ensure there are no unnecessary re-renders. App feels a lot smoother. Fixes rerenders on ClearBrushHistory Fixes crash when requesting post-generation upscale/face restoration - Moves the inpainting paste to before the postprocessing. Removes unused isReady state Changes Report Bug icon to a bug Restores shift+q bounding box shortcut Adds alert for bounding box size to status icons Adds asCheckbox to IAIIconButton Rough draft of this. Not happy with the styling but it's clearer than having them look just like buttons. Fixes crash related to old value of progress_latents in state Styling changes and settings modal minor refactor Fixes: uploaded JPG images not loading Reworks CurrentImageButtons.tsx - Change all icons to FA iconset for consistency - Refactors IAIIconButton, IAIButton, IAIPopover to handle ref forwarding - Redesigns buttons into group Only generate 1 iteration when seed fixed & variations disabled Fixes progress images select Fixes edge case: upload over gets stuck while alt tabbing - Press esc to close it now Fixes display progress images select typing Fixes current image button rerenders Adds min width to ImageUploader Makes fast-latents in progress default Update Icon Button Checkbox Style Styling Fixes next/prev image buttons Refactor canvas buttons + more Add Save Intermediates Step Count For accurate mode only. Co-Authored-By: Richard Macarthy <richardmacarthy@protonmail.com> Restores "initial image" text Address feedback - moves mask clear button - fixes intermediates - shrinks inpainting icons by 10% Fix Loopback Styling Adds escape hotkey to close floating panels Readd Hotkey for Dual Display Updated Current Image Button Styling commit dd5a88dceeec53ceb1722a62e3689ae3dd871154 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 04:17:28 2022 +1300 [WebUI] Final 2.1 Release Build commit 95ed56bf82825a47cfe406fa34eaf4e32c129143 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 04:16:31 2022 +1300 Updated Current Image Button Styling commit 1ae80f5ab9d00a25e0c3a21e2eccd318c5343401 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 04:07:57 2022 +1300 Readd Hotkey for Dual Display commit 1f0bd3ca6cda4221d1a7a46325f235cd23bd0af9 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu Nov 3 02:07:00 2022 +1100 Adds escape hotkey to close floating panels commit a1971f6830306b3d748f7f36c2243f6dee682f97 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 03:38:15 2022 +1300 Fix Loopback Styling commit c6118e889895ba35a191124ce1beb5d2b719366d Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu Nov 3 01:29:51 2022 +1100 Address feedback - moves mask clear button - fixes intermediates - shrinks inpainting icons by 10% commit 7ba958cf7ff4e804a127b71c88666084f81e7340 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu Nov 3 01:10:38 2022 +1100 Restores "initial image" text commit 383905d5d24359aa1824de96ff124a8f8a87e015 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 02:59:11 2022 +1300 Add Save Intermediates Step Count For accurate mode only. Co-Authored-By: Richard Macarthy <richardmacarthy@protonmail.com> commit 6173e3e9cabd5e74fb466d55d7bb6a80a77b3fa8 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu Nov 3 00:53:53 2022 +1100 Refactor canvas buttons + more commit 3feb7d8922b0e4c9f944e96b95211003f40d9705 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu Nov 3 00:49:23 2022 +1100 Fixes next/prev image buttons commit 1d9edbd0ddd6e10cf120fe0de3db0b56ae374db4 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 00:50:44 2022 +1300 Update Icon Button Checkbox Style Styling commit d439abdb89db73e652add9df371234861189d90c Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 21:37:24 2022 +1100 Makes fast-latents in progress default commit ee47ea0c891a33049bdec12f1c254926f341eff2 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 21:37:09 2022 +1100 Adds min width to ImageUploader commit 300bb2e6279c1c477131b9e57425db348062f19c Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 21:28:22 2022 +1100 Fixes current image button rerenders commit ccf8593501d23e00979f7340f8991514e6ca3428 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 21:27:43 2022 +1100 Fixes display progress images select typing commit 0fda612f3ff8ad75932e158b9b29cf64c3f30eb6 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 21:02:01 2022 +1100 Fixes edge case: upload over gets stuck while alt tabbing - Press esc to close it now commit 5afff65b71bb60d067392c120efff1a17adc66af Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 20:33:19 2022 +1100 Fixes progress images select commit 7e55bdefce8920831cac7b9fa857bfbffe9e9d5d Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 20:27:47 2022 +1100 Only generate 1 iteration when seed fixed & variations disabled commit 620cf84d3dd54b8498e84574f33040a26d4d315f Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 19:51:38 2022 +1100 Reworks CurrentImageButtons.tsx - Change all icons to FA iconset for consistency - Refactors IAIIconButton, IAIButton, IAIPopover to handle ref forwarding - Redesigns buttons into group commit cfe567c62ad3fd0cff5e3e579a2250ca5dfa2d53 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 16:14:50 2022 +1100 Fixes: uploaded JPG images not loading commit cefe12f1df72e051f109ed77ce46f18093b3b8bb Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 15:31:18 2022 +1100 Styling changes and settings modal minor refactor commit 1e51c3992853ad4643d8eda2443a3bd0d65f5f90 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 15:27:46 2022 +1100 Fixes crash related to old value of progress_latents in state commit 42a02bbb8087cd46a1b5c795b1b41e38c08ba229 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 13:15:06 2022 +1100 Adds asCheckbox to IAIIconButton Rough draft of this. Not happy with the styling but it's clearer than having them look just like buttons. commit f1ae6dae4c36e74ca8dedf8b57eb8933c059dcf4 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 13:13:56 2022 +1100 Adds alert for bounding box size to status icons commit 6195579910a91fb2ab7e1186aa1c1145566c3122 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 11:52:19 2022 +1100 Restores shift+q bounding box shortcut commit 16c8b23b347792d7811cff66a27d350fe5d0d62c Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 11:32:07 2022 +1100 Changes Report Bug icon to a bug commit 07ae626b22554b5222a3b71d1ce3974e2c3fb284 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 11:17:16 2022 +1100 Removes unused isReady state commit 8d171bb044f578d4b9cc4911edfa05b20a01d373 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 11:13:26 2022 +1100 Fixes crash when requesting post-generation upscale/face restoration - Moves the inpainting paste to before the postprocessing. commit 6e33ca7e9e64fb355430511e28bb08c32c9c68b1 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 10:59:01 2022 +1100 Fixes rerenders on ClearBrushHistory commit db46e12f2b8c98dac8895ea4d04242d3754dbec4 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 11:36:28 2022 +1300 Inpainting Controls Code Spitting and Performance Codesplit the entirety of the inpainting controls. Created new selectors for each and every component to ensure there are no unnecessary re-renders. App feels a lot smoother. commit 868e4b2db82fa8556b423111f2f8d565a70ec129 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 07:40:31 2022 +1300 [Code Splitting] Bounding Box Options Isolated all bounding box components to trigger unnecessary re-renders. Still need to fix bounding box triggering re-renders on the control panel inside the canvas itself. But the options panel should be a good to go with this change. commit 2e562742c13988a1fc299c673a97ba4e4a645aaf Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 06:40:27 2022 +1300 Fix Bounding Box Settings re-rendering on brush stroke commit 68e69580091fc1dc1d8b6e03c9e7ef777c7ebf61 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 06:28:34 2022 +1300 Fresh Bundle commit ea6e3a7949f2743711516261cb7e450517d39702 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 06:26:56 2022 +1300 [TESTING] Remove global isReady checking I dont believe this is need at all because the isready state is constantly updated when needed and tracked real time in the Redux store. This causes massive re-renders. @psychedelicious If this is absolutely essential for a reason that I do not see, please hit me up on Discord. commit b2879ca99f88869277c474185ade049914b0bf26 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 06:08:59 2022 +1300 Code Split Inpaint Options Isolate features to their own components so they dont re-render the other stuff each time. commit 4e911566c33989392eb3279049b15331ca98594a Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 03:50:56 2022 +1300 Preventing unnecessary re-renders across the app commit 9bafda6a152778893df143776ae859a3b8b7f192 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 03:02:35 2022 +1300 Fix Inpainting Alerts Styling commit 871a8a5375cae891f22eb853ffd2d22298298b11 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 23:52:07 2022 +1100 Adds hints when unable to invoke - Popover on Invoke button indicates why exactly it is disabled, e.g. prompt is empty, something else is processing, etc. - There may be more than one reason; all are displayed. commit 0eef74bc00d3c0cedc5037c1deeef1d9a5b6d33d Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 23:40:11 2022 +1100 Address bounding box feedback - Adds back toggle to hide bounding box - Box quick toggle = q, normal toggle = shift + q - Styles canvas alert icons commit 423ae3209782f1d8d321b2ed9ed00712b726adf7 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 17:06:07 2022 +1100 Improves bounding box interaction Added spacebar-hold-to-transform back. commit 8282e5d0458ca1bba5565c069093b5389f2228d4 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 16:57:07 2022 +1100 Builds fresh bundle commit 19305cdbdf6ac74833bd6011bff0ced8e9d36f69 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 16:51:11 2022 +1100 Styles image uploader commit eb9028ab3069bca9d747aca664ca60ae13ba6df8 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 16:51:03 2022 +1100 Disabled bounding box settings when locked commit 21483f5d0731bce5aa97985e722a64bf0d7cd12c Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 16:50:24 2022 +1100 Fixes silent crash when init image too large To send the mask to the server, the UI rendered the mask onto the init image and sent the whole image. The mask was then cropped by the server. If the image was too large, the app silently failed. Maybe it exceeds the websocket size limit. Fixed by cropping the mask in the UI layer, sending only bounding-box-sized mask image data. commit 82dcbac28f140aa7bd89d967bcc7fa31cb03a267 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 16:28:30 2022 +1100 Improves bounding box interactions - Bounding box can now be moved by dragging any of its edges - Bounding box does not affect drawing if already drawing a stroke - Can lock bounding box to draw directly on the bounding box edges - Removes spacebar-hold behaviour due to technical issues commit d43bd4625d64a03d90de0458ad5fcacef211a8a6 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 15:10:49 2022 +1100 Fixes hotkeys and settings buttons not working commit ea891324a2086faf8eeeeac7eaf47ae2935322fb Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 11:04:02 2022 +1100 Changes inpainting controls settings to hover commit 8fd9ea219390493f392e690eadb23c4209a4ecfc Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 11:03:41 2022 +1100 Adds missing tooltips to site header commit fb026668563b3179805819a1630c654c9ce260d9 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 11:03:25 2022 +1100 Increases workarea split padding to 1rem commit f6f5c2731b0c37089c5d7382736f973e857df712 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 11:03:10 2022 +1100 Decreases gallery width on inpainting commit b4e3f771e0314e0a18ad5cedc80b28f246fced59 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 10:54:59 2022 +1100 Fixes bugs/styling - Fixes missing web app state on new version: Adds stateReconciler to redux-persist. When we add more values to the state and then release the update app, they will be automatically merged in. Reseting web UI will be needed far less. 7159ec - Fixes console z-index - Moves reset web UI button to visible area commit 99bb9491ac97f1f733accab839ea38cdf4870ba0 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Tue Nov 1 08:35:45 2022 +1300 [WebUI] Loopback Default False commit 0453f211278a533a49fb1aee54dd989b69179c10 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 23:23:51 2022 +1300 Fresh Build For WebUI commit 9fc09aa4bda3b3e6139b026f24733a37747d373f Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 09:08:11 2022 +0100 don't log base64 progress images commit 5e87062cf809a08242d3b006b66d3bbb834ddb16 Author: spezialspezial <75758219+spezialspezial@users.noreply.github.com> Date: Wed Nov 2 00:21:27 2022 +0100 Option to directly invert the grayscale heatmap - fix commit 3e7a459990407ad1679f38d4027c19d50a9d36e3 Author: spezialspezial <75758219+spezialspezial@users.noreply.github.com> Date: Tue Nov 1 21:37:33 2022 +0100 Update txt2mask.py commit bbf4c03e500bafc8627c2a70f8b3396efeddabb3 Author: spezialspezial <75758219+spezialspezial@users.noreply.github.com> Date: Tue Nov 1 21:11:19 2022 +0100 Option to directly invert the grayscale heatmap Theoretically less work inverting the image while it's small but I can't measure a significant difference. Though, handy option to have in some cases. commit 611a3a975328a7e276c2781214d5e14108708ed7 Author: mauwii <Mauwii@outlook.de> Date: Wed Nov 2 02:23:09 2022 +0100 fix name of caching step commit 1611f0d1815022fe90d33f41c21d670251a75f29 Author: mauwii <Mauwii@outlook.de> Date: Wed Nov 2 02:18:46 2022 +0100 readd caching of sd-models - this would remove the necesarrity of the secret availability in PRs commit 08835115e4c5c0ee3587ce07ab769a04d55cb3c5 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 22:10:12 2022 -0400 pin pytorch_lightning to 1.7.7, issue #1331 commit 2d84e28d329be282b51a4cbc22f7c200d80c8f0e Merge: 533fd04e ef17aae8 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 22:11:04 2022 -0400 Merge branch 'development' of github.com:invoke-ai/InvokeAI into development commit ef17aae8abe03fd87dc6f91b3c6d2fe03375f6c5 Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 00:39:48 2022 +0100 add damian0815 to contributors list commit 0cc39f01a3c67f32873b7888e1e032d33626e269 Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 01:18:50 2022 +0100 report full size for fast latents and update conversion matrix for v1.5 commit 688d7258f185035a5924bee23322b001574da931 Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 00:33:00 2022 +0100 fix a bug that broke cross attention control index mapping commit 4513320bf161d3efdd99e2aef4f7c37472131373 Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 00:31:58 2022 +0100 save VRAM by not recombining tensors that have been sliced to save VRAM commit 533fd04ef0d1ba9d2cb25d556991b999e7d44aba Merge: 6215592b dff5681c Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 17:40:36 2022 -0400 Merge branch 'development' of github.com:invoke-ai/InvokeAI into development commit dff5681cf0e24faf67d5eb5903203c4ea39f89bd Author: damian0815 <d@d.com> Date: Tue Nov 1 13:56:03 2022 +0100 shorter strings commit 5a2790a69b11e049d2507bc22eab7812915d867f Author: damian0815 <d@d.com> Date: Tue Nov 1 13:19:20 2022 +0100 convert progress display to a drop-down commit 7c5305ccbaf7926162536aa3a9e51dcdd8574d0d Author: damian0815 <d@d.com> Date: Tue Nov 1 12:54:46 2022 +0100 do not try to save base64 intermediates in gallery on cancellation commit 4013e8ad6fa5e5c2a710c607fe7e1d040f353299 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 21:54:35 2022 +1100 Fixes b64 image sending and displaying commit d1dfd257f9e1cafd352d9007a56194226b9d6b63 Author: damian <d@d.com> Date: Tue Nov 1 11:40:40 2022 +0100 wip base64 commit 5322d735ee4515d89293b7fb015b2ce048262f68 Author: damian <d@d.com> Date: Tue Nov 1 11:31:42 2022 +0100 update frontend commit cdb107dcda858a8bb64455cc60a196a42345f8f7 Author: damian <d@d.com> Date: Tue Nov 1 11:17:43 2022 +0100 add option to show intermediate latent space commit be1393a41ce7a75ed8de7f648a93c5e5974a50d2 Author: damian <d@d.com> Date: Tue Nov 1 10:16:55 2022 +0100 ensure existing exception handling code also handles new exception class commit e554c2607f00a5e51c03052acb9861ff21ec1c12 Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Tue Nov 1 10:08:42 2022 +0100 Rebuilt prompt parsing logic Complete re-write of the prompt parsing logic to be more readable and logical, and therefore also hopefully easier to debug, maintain, and augment. In the process it has also become more robust to badly-formed prompts. Squashed commit of the following: commit 8fcfa88a16e1390d41717e940d72aed64712171c Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Sun Oct 30 17:05:57 2022 +0100 further cleanup commit 1a1fd78bcfeb49d072e3e6d5808aa8df15441629 Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Sun Oct 30 16:07:57 2022 +0100 cleanup and document commit 099c9659fa8b8135876f9a5a50fe80b20bc0635c Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Sun Oct 30 15:54:58 2022 +0100 works fully commit 5e6887ea8c25a1e21438ff6defb381fd027d25fd Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Sun Oct 30 15:24:31 2022 +0100 further... commit 492fda120844d9bc1ad4ec7dd408a3374762d0ff Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Sun Oct 30 14:08:57 2022 +0100 getting there... commit c6aab05a8450cc3c95c8691daf38fdc64c74f52d Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Fri Oct 28 14:29:03 2022 +0200 wip doesn't compile commit 5e533f731cfd20cd435330eeb0012e5689e87e81 Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Fri Oct 28 13:21:43 2022 +0200 working with CrossAttentionCtonrol but no Attention support yet commit 9678348773431e500e110e8aede99086bb7b5955 Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Fri Oct 28 13:04:52 2022 +0200 wip rebuiling prompt parser commit 6215592b12dea3822c727913b771012789a52477 Merge: ef24d76a 349cc254 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 17:34:55 2022 -0400 Merge branch 'development' of github.com:invoke-ai/InvokeAI into development commit 349cc25433e1d358c6c61cca4a6c300ecc8ca3d7 Author: damian0815 <d@d.com> Date: Tue Nov 1 20:08:52 2022 +0100 fix crash (be a little less aggressive clearing out the attention slice) commit 214d276379387ae0fa2259602ab00884ec1ad03e Author: damian0815 <d@d.com> Date: Tue Nov 1 19:57:55 2022 +0100 be more aggressive at clearing out saved_attn_slice commit ef24d76adc5a192297714707cd6794d4f44bcf67 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 14:34:23 2022 -0400 fix library problems in preload_modules commit ab2b5a691dadb292f7cecf5db94a165db3e3e126 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 17:22:48 2022 -0400 fix model_cache memory management issues commit c7de2b2801ad5d6ce52a5f44e88c5705f1dbf524 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 02:02:14 2022 +0100 disable checks with sd-V1.4 model... ...to save some resources, since V1.5 is the default now commit e8075658acf675346d35435d0cfb7710becab42a Author: mauwii <Mauwii@outlook.de> Date: Mon Oct 31 22:20:51 2022 +0100 update test-invoke-conda.yml - fix model dl path for sd-v1-4.ckpt - copy configs/models.yaml.example to configs/models.yaml commit 4202dabee1143f597f4c3946420fbfa7b8eccddf Author: mauwii <Mauwii@outlook.de> Date: Mon Oct 31 22:17:21 2022 +0100 fix models example weights for sd-v1.4 commit d67db2bcf1ac26d8bb7c5f8bfd056f2172597780 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Tue Nov 1 08:35:45 2022 +1300 [WebUI] Loopback Default False commit 7159ec885faa1117a3506689d547618be1d91808 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Mon Oct 31 11:33:05 2022 -0400 further improvements to preload_models.py - Faster startup for command line switch processing - Specify configuration file to modify using --config option: ./scripts/preload_models.ply --config models/my-models-file.yaml commit b5cf734ba9f1aeaab14075b55cc13ed9a0ae31e2 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Mon Oct 31 11:08:19 2022 -0400 improve behavior of preload_models.py - NEVER overwrite user's existing models.yaml - Instead, merge its contents into new config file, and rename original to models.yaml.orig (with message) - models.yaml has been removed from repository and renamed models.yaml.example commit f7dc8eafeef991e135b5541c01d0ff740dda9591 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Mon Oct 31 10:47:35 2022 -0400 restore models.yaml to virgin state commit 762ca60a309f70daaf1b9e79b6273f76fd9474b6 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Oct 4 22:55:10 2022 -0400 Update INPAINTING.md commit e7fb9f342cb5ed0c09e6215026d60d45eef3ebcb Author: Hideyuki Katsushiro <h.katsushiro@qualia.tokyo.jp> Date: Wed Oct 5 10:08:53 2022 +0900 add argument --outdir
2022-11-12 17:17:07 +00:00
gfpgan_strength= 0,
facetool = None,
2022-10-13 13:14:21 +00:00
facetool_strength = 0,
codeformer_fidelity = None,
save_original = False,
upscale = None,
# this is specific to inpainting and causes more extreme inpainting
inpaint_replace = 0.0,
merge release-candidate-1-3-2 into main. Squashed commit of the following: commit 9a1fe8e7fbbd81d9e9e47c4fda6bde6f66fba30c Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 12 17:07:40 2022 +0000 swap in release URLs for installers commit ff56f5251ba8502833cb561317e82b028cd2da5d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 12 17:03:21 2022 +0000 fix up bad unicode chars in invoke.py commit ed943bd6c785d968d1e31fbbb814fea8688fc8bb Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 12 16:05:45 2022 +0000 outcrop improvements, hand-added commit 7ad2355b1da53861bb75312edead8f9db0b0f44d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 12 15:14:33 2022 +0000 documentation fixes commit 66c920fc197d9206be9e0e2d1eb2a1cb86362887 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 16:49:25 2022 -0500 Revert "Resize hires as an image" This reverts commit d05b1b3544dfa7b3c071ac05b4f014a52e08fa50. commit 3fc5cb09f8bc03ea96e67a3e49fb087019d2f9d5 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 12 12:43:17 2022 +0000 fix incorrect link in install commit 1345ec77ab58f70e1bf5a0f587ca40aba4e906b7 Author: tildebyte <337875+tildebyte@users.noreply.github.com> Date: Sun Nov 6 19:07:31 2022 -0500 toil(repo): add tildebyte as owner of installer/ directory commit b116715490f390a59e5bee1022a6a758aee0918d Author: Kyle Schouviller <kyle0654@hotmail.com> Date: Thu Nov 10 21:43:56 2022 -0800 Fix performance issue introduced by torch cuda cache clear during generation commit fa3670270e7aae6bfd8d47fb7bdd32b707310c23 Author: mauwii <Mauwii@outlook.de> Date: Fri Nov 11 12:42:03 2022 +0100 small update to dockers huggingface section commit c304250ef663b3e202b4da8332365288589d94c7 Author: mauwii <Mauwii@outlook.de> Date: Fri Nov 11 12:19:27 2022 +0100 fix format and Link in INSTALL_INVOKE.md commit 802ce5dde5ca68f24aa4609cdba428044e0c7fa1 Author: mauwii <Mauwii@outlook.de> Date: Fri Nov 11 11:17:49 2022 +0100 small fixex to format and a link in INSTALL_MANUAL commit 311ee320ecac892cb4a1bcd012374fa051b1d011 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 07:23:35 2022 +0000 ignore installer intermediate files commit e9df17b374df58a44d3ae3ba33cbdc58794bcf5d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 07:19:25 2022 +0000 fix backslash-related syntax error commit 061fb4ef00482bdd4fba635aeaeff4ca7510190d Merge: 52be0d23 4095acd1 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 06:50:04 2022 +0000 Merge branch 'release-candidate-2-1-3' of github.com:/invoke-ai/InvokeAI into release-candidate-2-1-3 commit 52be0d2396de2de02030855c92e3367008b50377 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 06:49:45 2022 +0000 add WindowsLongFileName batfile to source installer commit 4095acd10ebae05a8cb14cc2faf7c79936d9e6a9 Author: mauwii <Mauwii@outlook.de> Date: Fri Nov 11 07:05:17 2022 +0100 Doc Updates A lot of re-formating of new Installation Docs also some content updates/corrections commit 201eb22d7650b00f55249c2646fa4f47ac3e0ec2 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 04:41:02 2022 +0000 prevent two models from being marked default in models.yaml commit 17ab98220034dfbb798a9a0460bc2837f0c1e2cb Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 03:56:54 2022 +0000 installers download branch HEAD not tag commit a04965b0e9e9d1170cf284af9acbd1186d681255 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 03:48:21 2022 +0000 improve messaging during installation process commit 0b529f0c574dd91fb9593e924ebc41c8c219b6ce Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 15:22:32 2022 +0000 enable outcropping of random JPG/PNG images - Works best with runwayML inpainting model - Numerous code changes required to propagate seed to final metadata. Original code predicated on the image being generated within InvokeAI. commit 6f9f84834557eb3c48562dc5d0ace51ca9e9cca2 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 17:27:42 2022 +0000 enhance outcropping with ability to direct contents of new regions - When outcropping an image you can now add a `--new_prompt` option, to specify a new prompt to be used instead of the original one used to generate the image. - Similarly you can provide a new seed using `--seed` (or `-S`). A seed of zero will pick one randomly. - This PR also fixes the crash that happened when trying to outcrop an image that does not contain InvokeAI metadata. commit 918c1589ef30595668899f4259ece6a4ad605c69 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 20:16:47 2022 +0000 fix #1402 commit 116415b3fcec8415f8e6de9b23c0bbd0dbc6845b Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 21:27:25 2022 +0000 fix invoke.py crash if no models.yaml file present - Script will now offer the user the ability to create a minimal models.yaml and then gracefully exit. - Closes #1420 commit b4b6eabaac94896e38123be331c44d1b63065b0d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 16:49:25 2022 -0500 Revert "Log strength with hires" This reverts commit 82d4904c07670d514e9a541de7c9ecd8489eeae2. commit 4ef1f4a854717c953f9192454d0adabef32af36c Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 20:01:49 2022 +0000 remove temporary directory from repo commit 510fc4ebaa5f9dc0e77b47cf04e0c265423e0a44 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 19:59:03 2022 +0000 remove -e from clipseg load in installer commit a20914434bb3609cf1d883cabf048d4cc25f881a Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 19:37:07 2022 +0000 change clipseg repo branch to avoid clipseg not found error commit 0d134195fda5c69fce5a95d6da90248eba8d226d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 18:39:29 2022 +0000 update repo URL to point to rc commit 649d8c8573896fdb5a73453b69ee4b54cf4d6241 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 18:13:28 2022 +0000 integrate tildebyte installer commit a358d370a05ea985a9e26fa9c1101d9c14fdb3ab Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 17:48:14 2022 +0000 add @tildebyte compiled pip installer commit 94a9033c4f6214e604be149a3de6d7c747af7f3a Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 14:52:00 2022 +0000 ignore source installer zip files commit 18a947c503c83c95cd83f27424696219ff3c4c95 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 14:46:36 2022 +0000 documentation and environment file fixes - Have clarified the relationship between the @tildebyte and @cmdr2 installers; However, @tildebyte installer merge is still a WIP due to conflicts over such things as `invoke.sh`. - Rechristened 1click installer as "source" installer. @tildebyte installer will be "the" installer. (We'll see which one generates the least support requests and maintenance work.) - Sync'd `environment-mac.yml` with `development`. The former was failing with a taming-transformers error as per https://discord.com/channels/@me/1037201214154231899/1040060947378749460 commit a23b03189526a49da8ddae90ce71b0e902784d29 Author: Mike DiGiovanni <vinblau@gmail.com> Date: Wed Nov 9 16:44:59 2022 -0500 Fixes typos in README.md commit 23af68c7d79d947f1bd3441c91bb44d655238f01 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 07:02:27 2022 -0500 downgrade win installs to basicsr==1.4.1 commit e258beeb51f3e645b9ea60e52d69d18722221cc5 Merge: 7460c069 e481bfac Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 06:37:45 2022 -0500 Merge branch 'release-candidate-2-1-3' of github.com:invoke-ai/InvokeAI into release-candidate-2-1-3 commit 7460c069b880b10c84b55f2e0c0998e350d6cf12 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 06:36:48 2022 -0500 remove --prefer-binary from requirements-base.txt It appears that some versions of pip do not recognize this option when it appears in the requirements file. Did not explore this further but recommend --prefer-binary in the manual install instructions on the command line. commit e481bfac615e0c798ceb5e59e8fbe3038f85b431 Merge: 5040747c d1ab65a4 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 11:21:56 2022 +0000 Merge branch 'release-candidate-2-1-3' of github.com:/invoke-ai/InvokeAI into release-candidate-2-1-3 commit 5040747c6700c9b949e3f3e1d2c3f21daffcec6c Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 11:21:43 2022 +0000 fix windows install instructions & bat file commit d1ab65a43122f73c20533d5815590ec10bc05eca Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 07:18:59 2022 +0100 update WEBUIHOTKEYS.md commit af4ee7feb8a7d2528bf4e2b3f7deee7a7c4c3dec Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 06:33:49 2022 +0100 update INSTALL_DOCKER.md commit 764fb29aded8114984d05932c4266ea24614b932 Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 06:30:15 2022 +0100 fix formatting in INSTALL.md commit 1014d3ba44aa4cd4cfdc6e3650c24a0dc9568a6e Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 06:29:14 2022 +0100 fix build.sh invokeai_conda_env_file default value commit 40a48aca88e337e9f4475f80a03b7d6d4751d09b Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 05:25:30 2022 +0100 fix environment-mac.yml moved taming-transformers-rom1504 to pip dependencies commit 92abc00f16a34a586dd16d3c64408f00e23fcb53 Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 05:19:52 2022 +0100 fix test-invoke-conda - copy required conda environment yaml - use environment.yml - I use cp instead of ln since would be compatible for windows runners commit a5719aabf89c8c5f29c6044e2882ccdcd0c6916b Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 04:14:35 2022 +0100 update Dockerfile - link environment.yml from new environemnts path - change default conda_env_file - quote all variables to avoid splitting - also remove paths from conda-env-files in build-container.yml commit 44a18511fa7accfec6a20345774583a1ce745b02 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 20:51:06 2022 +0000 update paths in container build workflow commit b850dbadafba052310327ca759d96f49a9d25d03 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 20:16:57 2022 +0000 finished reorganization of install docs commit 9ef8b944d53afb1fed94c418b2fd936d2d743797 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 18:50:58 2022 +0000 tweaks to manual install documentation --prefer-binary is an iffy option in the requirements file. It isn't supported by some versions of pip, so I removed it from requirements-base.txt and inserted it into the manual install instructions where it seems to do what it is supposed to. commit efc5a9848803b4250d726bc1913b9fd5a33fad75 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 18:20:03 2022 +0000 manual installation documentation tested on Linux commit 1417c87928e13b0ed21bf1c5604f8636d3b50a8d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 17:37:06 2022 +0000 change name of requirements.txt to avoid confusion commit 2dd6fc2b93ff7bbb4038568a3b28d36a8fafaeb8 Merge: 22213612 71ee44a8 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 17:26:24 2022 +0000 Merge branch 'release-candidate-2-1-3' of github.com:/invoke-ai/InvokeAI into release-candidate-2-1-3 commit 22213612a08bbece46eafd48994f985b097cb141 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 17:25:59 2022 +0000 directory cleanup; working on install docs commit 71ee44a827898759fd457f774c0b2ac7a1ef6519 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 02:07:13 2022 +0000 prevent crash when switching to an invalid model commit b17ca0a5e731c142101bbdbf34d121df949e86d7 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 14:28:38 2022 +0100 don't suppress exceptions when doing cross-attention control commit 71bbfe4a1a5b70f90e5f41c94df50fb104dbdd79 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 12:59:34 2022 +0100 Fix #1362 by improving VRAM usage patterns when doing .swap() commit ef3f7a26e242b73c2beb0195c7fd8f654ef47f55 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 12:18:37 2022 +0100 remove log spam commit 7189d649622d4668b120b0dd278388ad672142c4 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 12:10:28 2022 +0100 change the way saved slicing strategy is applied commit 01c40f751ab72955140165c16f95ae411732265b Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 12:04:43 2022 +0100 fix slicing_strategy_getter callsite commit f8cfe25150a346958903316bc710737d99839923 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 11:56:22 2022 +0100 cleanup, consistent dim=0 also tested commit 5bf9b1e890d48e962afd4a668a219b68271e5dc1 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 11:34:09 2022 +0100 refactored context, tested with non-sliced cross attention control commit d58a46e39bf562e7459290d2444256e8c08ad0b6 Author: damian0815 <null@damianstewart.com> Date: Sun Nov 6 00:41:52 2022 +0100 cleanup commit 7e2c658b4c06fe239311b65b9bb16fa3adec7fd7 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:57:31 2022 +0100 disable logs commit 20ee89d93841b070738b3d8a4385c93b097d92eb Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:36:58 2022 +0100 slice saved attention if necessary commit 0a7684a22c880ec0f48cc22bfed4526358f71546 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:32:38 2022 +0100 raise instead of asserting commit 7083104c7f3a0d8fd96e94a2f391de50a3c942e4 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:31:00 2022 +0100 store dim when saving slices commit f7c0808ed383ec1dc70645288a798ed2aa4fa85c Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:27:16 2022 +0100 don't retry on exception commit 749a721e939b3fe7c1741e7998dab6bd2c85a0cb Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:24:50 2022 +0100 stuff commit 032ab90e9533be8726301ec91b97137e2aadef9a Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:20:17 2022 +0100 more logging commit 3dc34b387f033482305360e605809d95a40bf6f8 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:16:47 2022 +0100 logs commit 901c4c1aa4b9bcef695a6551867ec8149e6e6a93 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:12:39 2022 +0100 actually set save_slicing_strategy to True commit f780e0a0a7c6b6a3db320891064da82589358c8a Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:10:35 2022 +0100 store slicing strategy commit 93bb6d566fd18c5c69ef7dacc8f74ba2cf671cb7 Author: damian <git@damianstewart.com> Date: Sat Nov 5 20:43:48 2022 +0100 still not it commit 5e3a9541f8ae00bde524046963910323e20c40b7 Author: damian <git@damianstewart.com> Date: Sat Nov 5 17:20:02 2022 +0100 wip offloading attention slices on-demand commit 4c2966aa856b6f3b446216da3619ae931552ef08 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 15:47:40 2022 +0100 pre-emptive offloading, idk if it works commit 572576755e9f0a878d38e8173e485126c0efbefb Author: root <you@example.com> Date: Sat Nov 5 11:25:32 2022 +0000 push attention slices to cpu. slow but saves memory. commit b57c83a68f2ac03976ebc89ce2ff03812d6d185f Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 12:04:22 2022 +0100 verbose logging commit 3a5dae116f110a96585d9eb71d713b5ed2bc3d2b Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 11:50:48 2022 +0100 wip fixing mem strategy crash (4 test on runpod) commit 3cf237db5fae0c7b0b4cc3c47c81830bdb2ae7de Author: damian0815 <null@damianstewart.com> Date: Fri Nov 4 09:02:40 2022 +0100 wip, only works on cuda commit 5702271991e126c026aa1ff41c44f8ad37b26e3a Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 14:09:36 2022 +0000 speculative reorganization of the requirements & environment files - This is only a test! - The various environment*.yml and requirements*.txt files have all been moved into a directory named "environments-and-requirements". - The idea is to clean up our root directory so that the github home page is tidy. - The manual install instructions will start with the instructions to create a symbolic link from environment.yml to the appropriate file for OS and GPU. - The 1-click installers have been updated to accommodate this change. commit 10781e7dc4f4551583a110d14f2a1f60393112b8 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 01:59:45 2022 +0000 refactoring requirements commit 099d1157c579c7b9fea20945e8504cc15745c598 Author: mauwii <Mauwii@outlook.de> Date: Wed Nov 9 00:16:18 2022 +0100 better way to make sure if conda is useable commit ab825bf7ee5f0b82d2273da1cda64fc9266a978e Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 22:05:33 2022 +0000 add back --prefer-binaries to requirements commit 10cfeb5ada7bcfc9f3aff3716ab8ea4961a8b528 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 8 22:27:19 2022 +0100 add quotes to set and use `$environment_file` commit e97515d0453583e013674b4dd1f3739c7de402cc Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 8 22:24:21 2022 +0100 set environment file for conda update commit 0f04bc5789c712bf7c7319b1d93064914993f4ec Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 8 22:21:25 2022 +0100 use conda env update commit 3f74aabecd08ed25fac158463ae12b775bd1fca2 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 8 22:20:44 2022 +0100 use command instead of hash commit b1a99a51b7ca23c4b895855bd7b4c82dbdc431e4 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 14:44:44 2022 -0500 remove --global git config from 1-click installers commit 8004f8a6d99f6ff75e00c170da40f1dec93a8914 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Mon Nov 7 09:07:20 2022 -0500 Revert "Use array slicing to calc ddim timesteps" This reverts commit 1f0c5b4cf196716c21f2db74f92c8750ad8f889d. commit ff8ff2212afb1e1c2dce4f6a61f29e2bc8302eb5 Merge: 8e5363cd 636620b1 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 14:01:40 2022 +0000 add initfile support from PR #1386 commit 8e5363cd83bff0e6be0f002c644283955f7fcbfd Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 13:26:18 2022 +0000 move 'installer/' to '1-click-installer' to make room for tildebyte installer commit 1450779146e89510d12b8c90eb316d9861c3375e Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 12:56:36 2022 +0000 update branch for installer to pull against commit 8cd5d95b8a1cb213cce2f949c394c841a09d9cab Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 05:30:20 2022 +0000 move all models into subdirectories of ./models - this required an update to the invoke-ai fork of gfpgan - simultaneously reverted consolidation of environment and requirements files, as their presence in a directory triggered setup.py to try to install a sub-package. commit abd6407394d55d4f6c064a05f3ac989dd3817c59 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 03:52:46 2022 +0000 leave a copy of environment-cuda.yml at top level - named it environment.yml - need to avoid a big change for users and breaking older support instructions. commit 734dacfbe9d8c86ca943c6541e7b5ff5ef787ff4 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 03:50:07 2022 +0000 consolidate environment files - starting to remove unneeded entries and pins - no longer require -e in front of github dependencies - update setup.py with release number - update manual installation instructions commit 636620b1d5e2466613d0dcc2a604522be12fa3a4 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 03:26:16 2022 +0000 change initfile to ~/.invokeai - adjust documentation - also fix 'clipseg_models' to 'clipseg', which seems to be working now commit 1fe41146f0975bbc9d552208473490a9ccb9fc56 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 5 14:28:01 2022 -0400 add support for an initialization file, invokeai.init - Place preferred startup command switches in a file named "invokeai.init". The file can consist of a single line of switches such as "--web --steps=28", a series of switches on each line, or any combination of the two. Example: ``` --web --host=0.0.0.0 --steps=28 --grid -f 0.6 -C 11.0 -A k_euler_a ``` - The following options, which were previously only available within the CLI, are now available on the command line as well: --steps --strength --cfg_scale --width --height --fit commit 2ad6ef355a9b9c4b17bae71edea2346c2e8708c5 Merge: 865502ee 8b47c829 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sun Nov 6 18:08:36 2022 +0000 update discord link commit 865502ee4f681de4516d231370ae603983354d8f Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 18:00:16 2022 +0100 update changelog commit c7984f3299c5c8f56a70d80907d527af458674af Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 17:07:27 2022 +0100 update TROUBLESHOOT.md commit 7f150ed83302ba875c3e0c0f39d8ac0f32c6e362 Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 16:56:58 2022 +0100 remove `:`from headlines in CONTRIBUTORS.md commit badf4e256ce6e3201df1a9a87a7072b36b18d699 Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 16:56:37 2022 +0100 enable navigation tabs Since the docs are growing, this way they look cleaner commit e64c60bbb38fc1620e08ce52bf28bd17003c7ef6 Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 16:18:59 2022 +0100 remove preflight checks from assets seems like somebody executed tests and commited them commit 178061854300632b024810e65922b54b64d95939 Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 16:15:06 2022 +0100 update INSTALLING_MODELS.md commit f91fd276242a0c92b301e99d02982d30f7b712c3 Author: Kyle Schouviller <kyle0654@hotmail.com> Date: Sat Nov 5 14:47:53 2022 -0700 Bug fix for inpaint size commit 09e41e8f769457b9ffd56901aae13991cdc6eeb8 Author: Kyle Schouviller <kyle0654@hotmail.com> Date: Sat Nov 5 14:34:52 2022 -0700 Add inpaint size options to inpaint at a larger size than the actual inpaint image, then scale back down for recombination commit 6eeb2107b300fc27cfe6134b43e5570c246b8e96 Author: mauwii <Mauwii@outlook.de> Date: Sat Nov 5 21:01:14 2022 +0100 remove create-caches.yml since not used anywhere commit 17053ad8b7efecb21a9b4eb32695089f683f72e3 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 5 16:01:55 2022 -0400 fix duplicated argument introduced by conflict resolution commit fefb4dc1f88bc6551a39602a2bc79b278cd83c59 Merge: 762ca60a d05b1b35 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 5 12:47:35 2022 -0700 Merge branch 'development' into fix_generate.py commit d05b1b3544dfa7b3c071ac05b4f014a52e08fa50 Author: Craig <cwallen@users.noreply.github.com> Date: Sat Oct 29 20:40:30 2022 -0400 Resize hires as an image commit 82d4904c07670d514e9a541de7c9ecd8489eeae2 Author: Craig <cwallen@users.noreply.github.com> Date: Sat Oct 29 20:37:40 2022 -0400 Log strength with hires commit 1cdcf33cfa39e90f9660fabf8f5936dcfb6c3aa5 Merge: 6616fa83 cbc029c6 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 5 09:57:38 2022 -0400 Merge branch 'main' into development - this synchronizes recent document fixes by mauwii commit 6616fa835ac4318bf53419f2b54b88c962559578 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 4 00:47:03 2022 -0400 fix Windows library dependency issues This commit addresses two bugs: 1) invokeai.py crashes immediately with a message about an undefined attritube sigKILL (closes #1288). The fix is to pin torch at 1.12.1. 2) Version 1.4.2 of basicsr fails to load properly on Windows, and is a requirement of realesrgan, however 1.4.1 works. Pinning basicsr in our requirements file resulted in a dependency conflict, so I ended up cloning realesrgan into the invoke-ai Git space and changing the requirements file there. If there is a more elegant solution, please advise. commit 7b9a4564b11f4181b9b3c06ecda2a4a25fd1849e Author: Matthias Wild <40327258+mauwii@users.noreply.github.com> Date: Sat Nov 5 14:36:45 2022 +0100 Update-docs (#1382) * update IMG2IMG.md * update INPAINTING.md * update WEBUIHOTKEYS.md * more doc updates (mostly fix formatting): - OUTPAINTING.md - POSTPROCESS.md - PROMPTS.md - VARIATIONS.md - WEB.md - WEBUIHOTKEYS.md commit fcdefa0620761472718afa14b2955a5d0603cfcc Author: Matthias Wild <40327258+mauwii@users.noreply.github.com> Date: Fri Nov 4 20:47:31 2022 +0100 Hotifx docs (#1376) (#1377) commit ef8b3ce639954259a95a38f44fa5329687bee781 Merge: b7042095 36870a8f Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 4 12:08:44 2022 -0400 Merge-main-into-development (#1373) To get the rid of the difference between main and development. Since otherwise it will be a pain to start fixing the documentatino (when the state between main and development is not the same ...) Also this should fix the problem of all tests failing since environment yamls get updated. commit 36870a8f53217d4b733e9bb8b119190b5e36da59 Merge: 6b89adfa b7042095 Author: Matthias Wild <40327258+mauwii@users.noreply.github.com> Date: Fri Nov 4 16:25:00 2022 +0100 Merge branch 'development' into merge-main-into-development commit b70420951d5b70937c0c07e4f8a552a01c3008bc Author: damian0815 <null@damianstewart.com> Date: Thu Nov 3 12:39:45 2022 +0100 fix parsing error doing eg `forest ().swap(in winter)` commit 1f0c5b4cf196716c21f2db74f92c8750ad8f889d Author: wfng92 <43742196+wfng92@users.noreply.github.com> Date: Thu Nov 3 17:13:52 2022 +0800 Use array slicing to calc ddim timesteps commit 8648da811190fc8bcf237d83aff38cf605851300 Author: mauwii <Mauwii@outlook.de> Date: Fri Nov 4 00:06:19 2022 +0100 update environment-linux-aarch64 to use python 3.9 commit 45b459356399f8cfb7e9af571c1643fab04218fe Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 3 22:31:46 2022 +0100 update environment-linux-aarch64.yml - move getpass_asterisk to pip commit 41b04316cf5118ea9518dc77934d135a489dd684 Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 3 20:40:08 2022 +0100 rename job, remove debug branch from triggers commit e97c6db2a3c0157a8a5ab74cd28ebee480a2d078 Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 3 20:34:01 2022 +0100 include build matrix to build x86_64 and aarch64 commit 896820a349292b0e14bbc32f0c557fe8a6b45395 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 05:01:15 2022 +0100 disable caching commit 06c8f468bff7e1dfecc1a1990164be1005b114a7 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 04:26:39 2022 +0100 disable PR-Validation since there are no files passed from context this is unecesarry commit 61920e2701c4a9cea94c03ab933c4482458215b7 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 04:09:39 2022 +0100 update action to use current branch also update build-args of dockerfile and build.sh commit f34ba7ca70f1c417ee97e8b0c57abff57614d78f Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 02:30:24 2022 +0100 remove unecesarry mkdir command again commit c30ef0895dbf0565345ac6ccb136d98a174470a6 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 01:51:12 2022 +0100 remove symlink to GFPGANv1.4 also re-add mkdir to prevent action from failing commit aa3a774f73d5004571ea42fea14cd2b525fffb1c Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 01:48:59 2022 +0100 update build-container.yml to use cachev3 commit 2c30555b844293764123baa4137fcf952d40a4e7 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 01:34:20 2022 +0100 update Dockerfile - create models.yaml from models.yaml.example - run preload_models.py with --no-interactive commit 743f60577364d43237eeb46aefd523371c36e56b Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 01:21:15 2022 +0100 update build.sh to download sd-v1.5 model commit 519c661abbae83aa62b3ee536635c39192890441 Author: mauwii <Mauwii@outlook.de> Date: Tue Oct 25 01:26:50 2022 +0200 replace old fashined markdown templates with forms this will help the readability of issues a lot 🤓 commit 22c956c75f4797ddc2dffa944e3ea84b4eb3477c Merge: 13696adc 0196571a Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 3 10:20:21 2022 -0400 Merge branch 'development' of github.com:invoke-ai/InvokeAI into development commit 13696adc3a3a2b169e68048a5b511660d0430fae Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 3 10:20:10 2022 -0400 speculative change to solve windows esrgan issues commit 0196571a12992eb8207d36e022721fe3ad2cfd19 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 2 22:39:35 2022 -0400 remove merge markers from preload_models.py commit 9666f466ab1c710dfda2e59be9e8a26fcd7e8718 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 2 18:29:34 2022 -0400 use refined model by default commit 240e5486c89552ef480c3443a63283fb86a493c3 Merge: 8164b6b9 aa247e68 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 2 18:35:00 2022 -0400 Merge branch 'spezialspezial-patch-9' into development commit 8164b6b9cff077e4131384195af65e30a40733a7 Merge: 4fc82d55 dd5a88dc Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 2 17:06:46 2022 -0400 Merge branch 'development' of github.com:invoke-ai/InvokeAI into development commit 4fc82d554ff573780c0af562a6bc9586aa56012d Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 04:17:28 2022 +1300 [WebUI] Final 2.1 Release Build commit 96b34c0f85f6ed52707fe43456d20b81822c7d1d Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 09:08:11 2022 +0100 Final WebUI build for Release 2.1 - squashed commit of 52 commits from PR #1327 don't log base64 progress images Fresh Build For WebUI [WebUI] Loopback Default False Fixes bugs/styling - Fixes missing web app state on new version: Adds stateReconciler to redux-persist. When we add more values to the state and then release the update app, they will be automatically merged in. Reseting web UI will be needed far less. 7159ec - Fixes console z-index - Moves reset web UI button to visible area Decreases gallery width on inpainting Increases workarea split padding to 1rem Adds missing tooltips to site header Changes inpainting controls settings to hover Fixes hotkeys and settings buttons not working Improves bounding box interactions - Bounding box can now be moved by dragging any of its edges - Bounding box does not affect drawing if already drawing a stroke - Can lock bounding box to draw directly on the bounding box edges - Removes spacebar-hold behaviour due to technical issues Fixes silent crash when init image too large To send the mask to the server, the UI rendered the mask onto the init image and sent the whole image. The mask was then cropped by the server. If the image was too large, the app silently failed. Maybe it exceeds the websocket size limit. Fixed by cropping the mask in the UI layer, sending only bounding-box-sized mask image data. Disabled bounding box settings when locked Styles image uploader Builds fresh bundle Improves bounding box interaction Added spacebar-hold-to-transform back. Address bounding box feedback - Adds back toggle to hide bounding box - Box quick toggle = q, normal toggle = shift + q - Styles canvas alert icons Adds hints when unable to invoke - Popover on Invoke button indicates why exactly it is disabled, e.g. prompt is empty, something else is processing, etc. - There may be more than one reason; all are displayed. Fix Inpainting Alerts Styling Preventing unnecessary re-renders across the app Code Split Inpaint Options Isolate features to their own components so they dont re-render the other stuff each time. [TESTING] Remove global isReady checking I dont believe this is need at all because the isready state is constantly updated when needed and tracked real time in the Redux store. This causes massive re-renders. @psychedelicious If this is absolutely essential for a reason that I do not see, please hit me up on Discord. Fresh Bundle Fix Bounding Box Settings re-rendering on brush stroke [Code Splitting] Bounding Box Options Isolated all bounding box components to trigger unnecessary re-renders. Still need to fix bounding box triggering re-renders on the control panel inside the canvas itself. But the options panel should be a good to go with this change. Inpainting Controls Code Spitting and Performance Codesplit the entirety of the inpainting controls. Created new selectors for each and every component to ensure there are no unnecessary re-renders. App feels a lot smoother. Fixes rerenders on ClearBrushHistory Fixes crash when requesting post-generation upscale/face restoration - Moves the inpainting paste to before the postprocessing. Removes unused isReady state Changes Report Bug icon to a bug Restores shift+q bounding box shortcut Adds alert for bounding box size to status icons Adds asCheckbox to IAIIconButton Rough draft of this. Not happy with the styling but it's clearer than having them look just like buttons. Fixes crash related to old value of progress_latents in state Styling changes and settings modal minor refactor Fixes: uploaded JPG images not loading Reworks CurrentImageButtons.tsx - Change all icons to FA iconset for consistency - Refactors IAIIconButton, IAIButton, IAIPopover to handle ref forwarding - Redesigns buttons into group Only generate 1 iteration when seed fixed & variations disabled Fixes progress images select Fixes edge case: upload over gets stuck while alt tabbing - Press esc to close it now Fixes display progress images select typing Fixes current image button rerenders Adds min width to ImageUploader Makes fast-latents in progress default Update Icon Button Checkbox Style Styling Fixes next/prev image buttons Refactor canvas buttons + more Add Save Intermediates Step Count For accurate mode only. Co-Authored-By: Richard Macarthy <richardmacarthy@protonmail.com> Restores "initial image" text Address feedback - moves mask clear button - fixes intermediates - shrinks inpainting icons by 10% Fix Loopback Styling Adds escape hotkey to close floating panels Readd Hotkey for Dual Display Updated Current Image Button Styling commit dd5a88dceeec53ceb1722a62e3689ae3dd871154 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 04:17:28 2022 +1300 [WebUI] Final 2.1 Release Build commit 95ed56bf82825a47cfe406fa34eaf4e32c129143 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 04:16:31 2022 +1300 Updated Current Image Button Styling commit 1ae80f5ab9d00a25e0c3a21e2eccd318c5343401 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 04:07:57 2022 +1300 Readd Hotkey for Dual Display commit 1f0bd3ca6cda4221d1a7a46325f235cd23bd0af9 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu Nov 3 02:07:00 2022 +1100 Adds escape hotkey to close floating panels commit a1971f6830306b3d748f7f36c2243f6dee682f97 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 03:38:15 2022 +1300 Fix Loopback Styling commit c6118e889895ba35a191124ce1beb5d2b719366d Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu Nov 3 01:29:51 2022 +1100 Address feedback - moves mask clear button - fixes intermediates - shrinks inpainting icons by 10% commit 7ba958cf7ff4e804a127b71c88666084f81e7340 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu Nov 3 01:10:38 2022 +1100 Restores "initial image" text commit 383905d5d24359aa1824de96ff124a8f8a87e015 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 02:59:11 2022 +1300 Add Save Intermediates Step Count For accurate mode only. Co-Authored-By: Richard Macarthy <richardmacarthy@protonmail.com> commit 6173e3e9cabd5e74fb466d55d7bb6a80a77b3fa8 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu Nov 3 00:53:53 2022 +1100 Refactor canvas buttons + more commit 3feb7d8922b0e4c9f944e96b95211003f40d9705 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu Nov 3 00:49:23 2022 +1100 Fixes next/prev image buttons commit 1d9edbd0ddd6e10cf120fe0de3db0b56ae374db4 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 00:50:44 2022 +1300 Update Icon Button Checkbox Style Styling commit d439abdb89db73e652add9df371234861189d90c Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 21:37:24 2022 +1100 Makes fast-latents in progress default commit ee47ea0c891a33049bdec12f1c254926f341eff2 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 21:37:09 2022 +1100 Adds min width to ImageUploader commit 300bb2e6279c1c477131b9e57425db348062f19c Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 21:28:22 2022 +1100 Fixes current image button rerenders commit ccf8593501d23e00979f7340f8991514e6ca3428 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 21:27:43 2022 +1100 Fixes display progress images select typing commit 0fda612f3ff8ad75932e158b9b29cf64c3f30eb6 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 21:02:01 2022 +1100 Fixes edge case: upload over gets stuck while alt tabbing - Press esc to close it now commit 5afff65b71bb60d067392c120efff1a17adc66af Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 20:33:19 2022 +1100 Fixes progress images select commit 7e55bdefce8920831cac7b9fa857bfbffe9e9d5d Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 20:27:47 2022 +1100 Only generate 1 iteration when seed fixed & variations disabled commit 620cf84d3dd54b8498e84574f33040a26d4d315f Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 19:51:38 2022 +1100 Reworks CurrentImageButtons.tsx - Change all icons to FA iconset for consistency - Refactors IAIIconButton, IAIButton, IAIPopover to handle ref forwarding - Redesigns buttons into group commit cfe567c62ad3fd0cff5e3e579a2250ca5dfa2d53 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 16:14:50 2022 +1100 Fixes: uploaded JPG images not loading commit cefe12f1df72e051f109ed77ce46f18093b3b8bb Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 15:31:18 2022 +1100 Styling changes and settings modal minor refactor commit 1e51c3992853ad4643d8eda2443a3bd0d65f5f90 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 15:27:46 2022 +1100 Fixes crash related to old value of progress_latents in state commit 42a02bbb8087cd46a1b5c795b1b41e38c08ba229 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 13:15:06 2022 +1100 Adds asCheckbox to IAIIconButton Rough draft of this. Not happy with the styling but it's clearer than having them look just like buttons. commit f1ae6dae4c36e74ca8dedf8b57eb8933c059dcf4 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 13:13:56 2022 +1100 Adds alert for bounding box size to status icons commit 6195579910a91fb2ab7e1186aa1c1145566c3122 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 11:52:19 2022 +1100 Restores shift+q bounding box shortcut commit 16c8b23b347792d7811cff66a27d350fe5d0d62c Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 11:32:07 2022 +1100 Changes Report Bug icon to a bug commit 07ae626b22554b5222a3b71d1ce3974e2c3fb284 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 11:17:16 2022 +1100 Removes unused isReady state commit 8d171bb044f578d4b9cc4911edfa05b20a01d373 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 11:13:26 2022 +1100 Fixes crash when requesting post-generation upscale/face restoration - Moves the inpainting paste to before the postprocessing. commit 6e33ca7e9e64fb355430511e28bb08c32c9c68b1 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 10:59:01 2022 +1100 Fixes rerenders on ClearBrushHistory commit db46e12f2b8c98dac8895ea4d04242d3754dbec4 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 11:36:28 2022 +1300 Inpainting Controls Code Spitting and Performance Codesplit the entirety of the inpainting controls. Created new selectors for each and every component to ensure there are no unnecessary re-renders. App feels a lot smoother. commit 868e4b2db82fa8556b423111f2f8d565a70ec129 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 07:40:31 2022 +1300 [Code Splitting] Bounding Box Options Isolated all bounding box components to trigger unnecessary re-renders. Still need to fix bounding box triggering re-renders on the control panel inside the canvas itself. But the options panel should be a good to go with this change. commit 2e562742c13988a1fc299c673a97ba4e4a645aaf Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 06:40:27 2022 +1300 Fix Bounding Box Settings re-rendering on brush stroke commit 68e69580091fc1dc1d8b6e03c9e7ef777c7ebf61 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 06:28:34 2022 +1300 Fresh Bundle commit ea6e3a7949f2743711516261cb7e450517d39702 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 06:26:56 2022 +1300 [TESTING] Remove global isReady checking I dont believe this is need at all because the isready state is constantly updated when needed and tracked real time in the Redux store. This causes massive re-renders. @psychedelicious If this is absolutely essential for a reason that I do not see, please hit me up on Discord. commit b2879ca99f88869277c474185ade049914b0bf26 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 06:08:59 2022 +1300 Code Split Inpaint Options Isolate features to their own components so they dont re-render the other stuff each time. commit 4e911566c33989392eb3279049b15331ca98594a Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 03:50:56 2022 +1300 Preventing unnecessary re-renders across the app commit 9bafda6a152778893df143776ae859a3b8b7f192 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 03:02:35 2022 +1300 Fix Inpainting Alerts Styling commit 871a8a5375cae891f22eb853ffd2d22298298b11 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 23:52:07 2022 +1100 Adds hints when unable to invoke - Popover on Invoke button indicates why exactly it is disabled, e.g. prompt is empty, something else is processing, etc. - There may be more than one reason; all are displayed. commit 0eef74bc00d3c0cedc5037c1deeef1d9a5b6d33d Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 23:40:11 2022 +1100 Address bounding box feedback - Adds back toggle to hide bounding box - Box quick toggle = q, normal toggle = shift + q - Styles canvas alert icons commit 423ae3209782f1d8d321b2ed9ed00712b726adf7 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 17:06:07 2022 +1100 Improves bounding box interaction Added spacebar-hold-to-transform back. commit 8282e5d0458ca1bba5565c069093b5389f2228d4 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 16:57:07 2022 +1100 Builds fresh bundle commit 19305cdbdf6ac74833bd6011bff0ced8e9d36f69 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 16:51:11 2022 +1100 Styles image uploader commit eb9028ab3069bca9d747aca664ca60ae13ba6df8 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 16:51:03 2022 +1100 Disabled bounding box settings when locked commit 21483f5d0731bce5aa97985e722a64bf0d7cd12c Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 16:50:24 2022 +1100 Fixes silent crash when init image too large To send the mask to the server, the UI rendered the mask onto the init image and sent the whole image. The mask was then cropped by the server. If the image was too large, the app silently failed. Maybe it exceeds the websocket size limit. Fixed by cropping the mask in the UI layer, sending only bounding-box-sized mask image data. commit 82dcbac28f140aa7bd89d967bcc7fa31cb03a267 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 16:28:30 2022 +1100 Improves bounding box interactions - Bounding box can now be moved by dragging any of its edges - Bounding box does not affect drawing if already drawing a stroke - Can lock bounding box to draw directly on the bounding box edges - Removes spacebar-hold behaviour due to technical issues commit d43bd4625d64a03d90de0458ad5fcacef211a8a6 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 15:10:49 2022 +1100 Fixes hotkeys and settings buttons not working commit ea891324a2086faf8eeeeac7eaf47ae2935322fb Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 11:04:02 2022 +1100 Changes inpainting controls settings to hover commit 8fd9ea219390493f392e690eadb23c4209a4ecfc Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 11:03:41 2022 +1100 Adds missing tooltips to site header commit fb026668563b3179805819a1630c654c9ce260d9 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 11:03:25 2022 +1100 Increases workarea split padding to 1rem commit f6f5c2731b0c37089c5d7382736f973e857df712 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 11:03:10 2022 +1100 Decreases gallery width on inpainting commit b4e3f771e0314e0a18ad5cedc80b28f246fced59 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 10:54:59 2022 +1100 Fixes bugs/styling - Fixes missing web app state on new version: Adds stateReconciler to redux-persist. When we add more values to the state and then release the update app, they will be automatically merged in. Reseting web UI will be needed far less. 7159ec - Fixes console z-index - Moves reset web UI button to visible area commit 99bb9491ac97f1f733accab839ea38cdf4870ba0 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Tue Nov 1 08:35:45 2022 +1300 [WebUI] Loopback Default False commit 0453f211278a533a49fb1aee54dd989b69179c10 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 23:23:51 2022 +1300 Fresh Build For WebUI commit 9fc09aa4bda3b3e6139b026f24733a37747d373f Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 09:08:11 2022 +0100 don't log base64 progress images commit 5e87062cf809a08242d3b006b66d3bbb834ddb16 Author: spezialspezial <75758219+spezialspezial@users.noreply.github.com> Date: Wed Nov 2 00:21:27 2022 +0100 Option to directly invert the grayscale heatmap - fix commit 3e7a459990407ad1679f38d4027c19d50a9d36e3 Author: spezialspezial <75758219+spezialspezial@users.noreply.github.com> Date: Tue Nov 1 21:37:33 2022 +0100 Update txt2mask.py commit bbf4c03e500bafc8627c2a70f8b3396efeddabb3 Author: spezialspezial <75758219+spezialspezial@users.noreply.github.com> Date: Tue Nov 1 21:11:19 2022 +0100 Option to directly invert the grayscale heatmap Theoretically less work inverting the image while it's small but I can't measure a significant difference. Though, handy option to have in some cases. commit 611a3a975328a7e276c2781214d5e14108708ed7 Author: mauwii <Mauwii@outlook.de> Date: Wed Nov 2 02:23:09 2022 +0100 fix name of caching step commit 1611f0d1815022fe90d33f41c21d670251a75f29 Author: mauwii <Mauwii@outlook.de> Date: Wed Nov 2 02:18:46 2022 +0100 readd caching of sd-models - this would remove the necesarrity of the secret availability in PRs commit 08835115e4c5c0ee3587ce07ab769a04d55cb3c5 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 22:10:12 2022 -0400 pin pytorch_lightning to 1.7.7, issue #1331 commit 2d84e28d329be282b51a4cbc22f7c200d80c8f0e Merge: 533fd04e ef17aae8 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 22:11:04 2022 -0400 Merge branch 'development' of github.com:invoke-ai/InvokeAI into development commit ef17aae8abe03fd87dc6f91b3c6d2fe03375f6c5 Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 00:39:48 2022 +0100 add damian0815 to contributors list commit 0cc39f01a3c67f32873b7888e1e032d33626e269 Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 01:18:50 2022 +0100 report full size for fast latents and update conversion matrix for v1.5 commit 688d7258f185035a5924bee23322b001574da931 Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 00:33:00 2022 +0100 fix a bug that broke cross attention control index mapping commit 4513320bf161d3efdd99e2aef4f7c37472131373 Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 00:31:58 2022 +0100 save VRAM by not recombining tensors that have been sliced to save VRAM commit 533fd04ef0d1ba9d2cb25d556991b999e7d44aba Merge: 6215592b dff5681c Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 17:40:36 2022 -0400 Merge branch 'development' of github.com:invoke-ai/InvokeAI into development commit dff5681cf0e24faf67d5eb5903203c4ea39f89bd Author: damian0815 <d@d.com> Date: Tue Nov 1 13:56:03 2022 +0100 shorter strings commit 5a2790a69b11e049d2507bc22eab7812915d867f Author: damian0815 <d@d.com> Date: Tue Nov 1 13:19:20 2022 +0100 convert progress display to a drop-down commit 7c5305ccbaf7926162536aa3a9e51dcdd8574d0d Author: damian0815 <d@d.com> Date: Tue Nov 1 12:54:46 2022 +0100 do not try to save base64 intermediates in gallery on cancellation commit 4013e8ad6fa5e5c2a710c607fe7e1d040f353299 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 21:54:35 2022 +1100 Fixes b64 image sending and displaying commit d1dfd257f9e1cafd352d9007a56194226b9d6b63 Author: damian <d@d.com> Date: Tue Nov 1 11:40:40 2022 +0100 wip base64 commit 5322d735ee4515d89293b7fb015b2ce048262f68 Author: damian <d@d.com> Date: Tue Nov 1 11:31:42 2022 +0100 update frontend commit cdb107dcda858a8bb64455cc60a196a42345f8f7 Author: damian <d@d.com> Date: Tue Nov 1 11:17:43 2022 +0100 add option to show intermediate latent space commit be1393a41ce7a75ed8de7f648a93c5e5974a50d2 Author: damian <d@d.com> Date: Tue Nov 1 10:16:55 2022 +0100 ensure existing exception handling code also handles new exception class commit e554c2607f00a5e51c03052acb9861ff21ec1c12 Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Tue Nov 1 10:08:42 2022 +0100 Rebuilt prompt parsing logic Complete re-write of the prompt parsing logic to be more readable and logical, and therefore also hopefully easier to debug, maintain, and augment. In the process it has also become more robust to badly-formed prompts. Squashed commit of the following: commit 8fcfa88a16e1390d41717e940d72aed64712171c Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Sun Oct 30 17:05:57 2022 +0100 further cleanup commit 1a1fd78bcfeb49d072e3e6d5808aa8df15441629 Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Sun Oct 30 16:07:57 2022 +0100 cleanup and document commit 099c9659fa8b8135876f9a5a50fe80b20bc0635c Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Sun Oct 30 15:54:58 2022 +0100 works fully commit 5e6887ea8c25a1e21438ff6defb381fd027d25fd Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Sun Oct 30 15:24:31 2022 +0100 further... commit 492fda120844d9bc1ad4ec7dd408a3374762d0ff Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Sun Oct 30 14:08:57 2022 +0100 getting there... commit c6aab05a8450cc3c95c8691daf38fdc64c74f52d Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Fri Oct 28 14:29:03 2022 +0200 wip doesn't compile commit 5e533f731cfd20cd435330eeb0012e5689e87e81 Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Fri Oct 28 13:21:43 2022 +0200 working with CrossAttentionCtonrol but no Attention support yet commit 9678348773431e500e110e8aede99086bb7b5955 Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Fri Oct 28 13:04:52 2022 +0200 wip rebuiling prompt parser commit 6215592b12dea3822c727913b771012789a52477 Merge: ef24d76a 349cc254 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 17:34:55 2022 -0400 Merge branch 'development' of github.com:invoke-ai/InvokeAI into development commit 349cc25433e1d358c6c61cca4a6c300ecc8ca3d7 Author: damian0815 <d@d.com> Date: Tue Nov 1 20:08:52 2022 +0100 fix crash (be a little less aggressive clearing out the attention slice) commit 214d276379387ae0fa2259602ab00884ec1ad03e Author: damian0815 <d@d.com> Date: Tue Nov 1 19:57:55 2022 +0100 be more aggressive at clearing out saved_attn_slice commit ef24d76adc5a192297714707cd6794d4f44bcf67 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 14:34:23 2022 -0400 fix library problems in preload_modules commit ab2b5a691dadb292f7cecf5db94a165db3e3e126 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 17:22:48 2022 -0400 fix model_cache memory management issues commit c7de2b2801ad5d6ce52a5f44e88c5705f1dbf524 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 02:02:14 2022 +0100 disable checks with sd-V1.4 model... ...to save some resources, since V1.5 is the default now commit e8075658acf675346d35435d0cfb7710becab42a Author: mauwii <Mauwii@outlook.de> Date: Mon Oct 31 22:20:51 2022 +0100 update test-invoke-conda.yml - fix model dl path for sd-v1-4.ckpt - copy configs/models.yaml.example to configs/models.yaml commit 4202dabee1143f597f4c3946420fbfa7b8eccddf Author: mauwii <Mauwii@outlook.de> Date: Mon Oct 31 22:17:21 2022 +0100 fix models example weights for sd-v1.4 commit d67db2bcf1ac26d8bb7c5f8bfd056f2172597780 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Tue Nov 1 08:35:45 2022 +1300 [WebUI] Loopback Default False commit 7159ec885faa1117a3506689d547618be1d91808 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Mon Oct 31 11:33:05 2022 -0400 further improvements to preload_models.py - Faster startup for command line switch processing - Specify configuration file to modify using --config option: ./scripts/preload_models.ply --config models/my-models-file.yaml commit b5cf734ba9f1aeaab14075b55cc13ed9a0ae31e2 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Mon Oct 31 11:08:19 2022 -0400 improve behavior of preload_models.py - NEVER overwrite user's existing models.yaml - Instead, merge its contents into new config file, and rename original to models.yaml.orig (with message) - models.yaml has been removed from repository and renamed models.yaml.example commit f7dc8eafeef991e135b5541c01d0ff740dda9591 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Mon Oct 31 10:47:35 2022 -0400 restore models.yaml to virgin state commit 762ca60a309f70daaf1b9e79b6273f76fd9474b6 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Oct 4 22:55:10 2022 -0400 Update INPAINTING.md commit e7fb9f342cb5ed0c09e6215026d60d45eef3ebcb Author: Hideyuki Katsushiro <h.katsushiro@qualia.tokyo.jp> Date: Wed Oct 5 10:08:53 2022 +0900 add argument --outdir
2022-11-12 17:17:07 +00:00
# This controls the size at which inpaint occurs (scaled up for inpaint, then back down for the result)
inpaint_width = None,
inpaint_height = None,
# This will help match inpainted areas to the original image more smoothly
mask_blur_radius: int = 8,
# Set this True to handle KeyboardInterrupt internally
catch_interrupts = False,
hires_fix = False,
use_mps_noise = False,
# Seam settings for outpainting
seam_size: int = 0,
seam_blur: int = 0,
seam_strength: float = 0.7,
seam_steps: int = 10,
tile_size: int = 32,
infill_method = None,
force_outpaint: bool = False,
Merge dev into main for 2.2.0 (#1642) * Fixes inpainting + code cleanup * Disable stage info in Inpainting Tab * Mask Brush Preview now always at 0.5 opacity The new mask is only visible properly at max opacity but at max opacity the brush preview becomes fully opaque blocking the view. So the mask brush preview no remains at 0.5 no matter what the Brush opacity is. * Remove save button from Canvas Controls (cleanup) * Implements invert mask * Changes "Invert Mask" to "Preserve Masked Areas" * Fixes (?) spacebar issues * Patches redux-persist and redux-deep-persist with debounced persists Our app changes redux state very, very often. As our undo/redo history grows, the calls to persist state start to take in the 100ms range, due to a the deep cloning of the history. This causes very noticeable performance lag. The deep cloning is required because we need to blacklist certain items in redux from being persisted (e.g. the app's connection status). Debouncing the whole process of persistence is a simple and effective solution. Unfortunately, `redux-persist` dropped `debounce` between v4 and v5, replacing it with `throttle`. `throttle`, instead of delaying the expensive action until a period of X ms of inactivity, simply ensures the action is executed at least every X ms. Of course, this does not fix our performance issue. The patch is very simple. It adds a `debounce` argument - a number of milliseconds - and debounces `redux-persist`'s `update()` method (provided by `createPersistoid`) by that many ms. Before this, I also tried writing a custom storage adapter for `redux-persist` to debounce the calls to `localStorage.setItem()`. While this worked and was far less invasive, it doesn't actually address the issue. It turns out `setItem()` is a very fast part of the process. We use `redux-deep-persist` to simplify the `redux-persist` configuration, which can get complicated when you need to blacklist or whitelist deeply nested state. There is also a patch here for that library because it uses the same types as `redux-persist`. Unfortunately, the last release of `redux-persist` used a package `flat-stream` which was malicious and has been removed from npm. The latest commits to `redux-persist` (about 1 year ago) do not build; we cannot use the master branch. And between the last release and last commit, the changes have all been breaking. Patching this last release (about 3 years old at this point) directly is far simpler than attempting to fix the upstream library's master branch or figuring out an alternative to the malicious and now non-existent dependency. * Adds debouncing * Fixes AttributeError: 'dict' object has no attribute 'invert_mask' * Updates package.json to use redux-persist patches * Attempts to fix redux-persist debounce patch * Fixes undo/redo * Fixes invert mask * Debounce > 300ms * Limits history to 256 for each of undo and redo * Canvas styling * Hotkeys improvement * Add Metadata To Viewer * Increases CFG Scale max to 200 * Fix gallery width size for Outpainting Also fixes the canvas resizing failing n fast pushes * Fixes disappearing canvas grid lines * Adds staging area * Fixes "use all" not setting variationAmount Now sets to 0 when the image had variations. * Builds fresh bundle * Outpainting tab loads to empty canvas instead of upload * Fixes wonky canvas layer ordering & compositing * Fixes error on inpainting paste back `TypeError: 'float' object cannot be interpreted as an integer` * Hides staging area outline on mouseover prev/next * Fixes inpainting not doing img2img when no mask * Fixes bbox not resizing in outpainting if partially off screen * Fixes crashes during iterative outpaint. Still doesn't work correctly though. * Fix iterative outpainting by restoring original images * Moves image uploading to HTTP - It all seems to work fine - A lot of cleanup is still needed - Logging needs to be added - May need types to be reviewed * Fixes: outpainting temp images show in gallery * WIP refactor to unified canvas * Removes console.log from redux-persist patch * Initial unification of canvas * Removes all references to split inpainting/outpainting canvas * Add patchmatch and infill_method parameter to prompt2image (options are 'patchmatch' or 'tile'). * Fixes app after removing in/out-painting refs * Rebases on dev, updates new env files w/ patchmatch * Organises features/canvas * Fixes bounding box ending up offscreen * Organises features/canvas * Stops unnecessary canvas rescales on gallery state change * Fixes 2px layout shift on toggle canvas lock * Clips lines drawn while canvas locked When drawing with the locked canvas, if a brush stroke gets too close to the edge of the canvas and its stroke would extend past the edge of the canvas, the edge of that stroke will be seen after unlocking the canvas. This could cause a problem if you unlock the canvas and now have a bunch of strokes just outside the init image area, which are far back in undo history and you cannot easily erase. With this change, lines drawn while the canvas is locked get clipped to the initial image bbox, fixing this issue. Additionally, the merge and save to gallery functions have been updated to respect the initial image bbox so they function how you'd expect. * Fixes reset canvas view when locked * Fixes send to buttons * Fixes bounding box not being rounded to 64 * Abandons "inpainting" canvas lock * Fixes save to gallery including empty area, adds download and copy image * Fix Current Image display background going over image bounds * Sets status immediately when clicking Invoke * Adds hotkeys and refactors sharing of konva instances Adds hotkeys to canvas. As part of this change, the access to konva instance objects was refactored: Previously closure'd refs were used to indirectly get access to the konva instances outside of react components. Now, a getter and setter function are used to provide access directly to the konva objects. * Updates hotkeys * Fixes canvas showing spinner on first load Also adds good default canvas scale and positioning when no image is on it * Fixes possible hang on MaskCompositer * Improves behaviour when setting init canvas image/reset view * Resets bounding box coords/dims when no image present * Disables canvas actions which cannot be done during processing * Adds useToastWatcher hook - Dispatch an `addToast` action with standard Chakra toast options object to add a toast to the toastQueue - The hook is called in App.tsx and just useEffect's w/ toastQueue as dependency to create the toasts - So now you can add toasts anywhere you have access to `dispatch`, which includes middleware and thunks - Adds first usage of this for the save image buttons in canvas * Update Hotkey Info Add missing tooltip hotkeys and update the hotkeys modal to reflect the new hotkeys for the Unified Canvas. * Fix theme changer not displaying current theme on page refresh * Fix tab count in hotkeys panel * Unify Brush and Eraser Sizes * Fix staging area display toggle not working * Staging Area delete button is now red So it doesnt feel blended into to the rest of them. * Revert "Fix theme changer not displaying current theme on page refresh" This reverts commit 903edfb803e743500242589ff093a8a8a0912726. * Add arguments to use SSL to webserver * Integrates #1487 - touch events Need to add: - Pinch zoom - Touch-specific handling (some things aren't quite right) * Refactors upload-related async thunks - Now standard thunks instead of RTK createAsyncThunk() - Adds toasts for all canvas upload-related actions * Reorganises app file structure * Fixes Canvas Auto Save to Gallery * Fixes staging area outline * Adds staging area hotkeys, disables gallery left/right when staging * Fixes Use All Parameters * Fix metadata viewer image url length when viewing intermediate * Fixes intermediate images being tiny in txt2img/img2img * Removes stale code * Improves canvas status text and adds option to toggle debug info * Fixes paste image to upload * Adds model drop-down to site header * Adds theme changer popover * Fix missing key on ThemeChanger map * Fixes stage position changing on zoom * Hotkey Cleanup - Viewer is now Z - Canvas Move tool is V - sync with PS - Removed some unused hotkeys * Fix canvas resizing when both options and gallery are unpinned * Implements thumbnails for gallery - Thumbnails are saved whenever an image is saved, and when gallery requests images from server - Thumbnails saved at original image aspect ratio with width of 128px as WEBP - If the thumbnail property of an image is unavailable for whatever reason, the image's full size URL is used instead * Saves thumbnails to separate thumbnails directory * Thumbnail size = 256px * Fix Lightbox Issues * Disables canvas image saving functions when processing * Fix index error on going past last image in Gallery * WIP - Lightbox Fixes Still need to fix the images not being centered on load when the image res changes * Fixes another similar index error, simplifies logic * Reworks canvas toolbar * Fixes canvas toolbar upload button * Cleans up IAICanvasStatusText * Improves metadata handling, fixes #1450 - Removes model list from metadata - Adds generation's specific model to metadata - Displays full metadata in JSON viewer * Gracefully handles corrupted images; fixes #1486 - App does not crash if corrupted image loaded - Error is displayed in the UI console and CLI output if an image cannot be loaded * Adds hotkey to reset canvas interaction state If the canvas' interaction state (e.g. isMovingBoundingBox, isDrawing, etc) get stuck somehow, user can press Escape to reset the state. * Removes stray console.log() * Fixes bug causing gallery to close on context menu open * Minor bugfixes - When doing long-running canvas image exporting actions, display indeterminate progress bar - Fix staging area image outline not displaying after committing/discarding results * Removes unused imports * Fixes repo root .gitignore ignoring frontend things * Builds fresh bundle * Styling updates * Removes reasonsWhyNotReady The popover doesn't play well with the button being disabled, and I don't think adds any value. * Image gallery resize/style tweaks * Styles buttons for clearing canvas history and mask * First pass on Canvas options panel * Fixes bug where discarding staged images results in loss of history * Adds Save to Gallery button to staging toolbar * Rearrange some canvas toolbar icons Put brush stuff together and canvas movement stuff together * Fix gallery maxwidth on unified canvas * Update Layer hotkey display to UI * Adds option to crop to bounding box on save * Masking option tweaks * Crop to Bounding Box > Save Box Region Only * Adds clear temp folder * Updates mask options popover behavior * Builds fresh bundle * Fix styling on alert modals * Fix input checkbox styling being incorrect on light theme * Styling fixes * Improves gallery resize behaviour * Cap gallery size on canvas tab so it doesnt overflow * Fixes bug when postprocessing image with no metadata * Adds IAIAlertDialog component * Moves Loopback to app settings * Fixes metadata viewer not showing metadata after refresh Also adds Dream-style prompt to metadata * Adds outpainting specific options * Linting * Fixes gallery width on lightbox, fixes gallery button expansion * Builds fresh bundle * Fix Lightbox images of different res not centering * Update feature tooltip text * Highlight mask icon when on mask layer * Fix gallery not resizing correctly on open and close * Add loopback to just img2img. Remove from settings. * Fix to gallery resizing * Removes Advanced checkbox, cleans up options panel for unified canvas * Minor styling fixes to new options panel layout * Styling Updates * Adds infill method * Tab Styling Fixes * memoize outpainting options * Fix unnecessary gallery re-renders * Isolate Cursor Pos debug text on canvas to prevent rerenders * Fixes missing postprocessed image metadata before refresh * Builds fresh bundle * Fix rerenders on model select * Floating panel re-render fix * Simplify fullscreen hotkey selector * Add Training WIP Tab * Adds Training icon * Move full screen hotkey to floating to prevent tab rerenders * Adds single-column gallery layout * Fixes crash on cancel with intermediates enabled, fixes #1416 * Updates npm dependencies * Fixes img2img attempting inpaint when init image has transparency * Fixes missing threshold and perlin parameters in metadata viewer * Renames "Threshold" > "Noise Threshold" * Fixes postprocessing not being disabled when clicking use all * Builds fresh bundle * Adds color picker * Lints & builds fresh bundle * Fixes iterations being disabled when seed random & variations are off * Un-floors cursor position * Changes color picker preview to circles * Fixes variation params not set correctly when recalled * Fixes invoke hotkey not working in input fields * Simplifies Accordion Prep for adding reset buttons for each section * Fixes mask brush preview color * Committing color picker color changes tool to brush * Color picker does not overwrite user-selected alpha * Adds brush color alpha hotkey * Lints * Removes force_outpaint param * Add inpaint size options to inpaint at a larger size than the actual inpaint image, then scale back down for recombination * Bug fix for inpaint size * Adds inpaint size (as scale bounding box) to UI * Adds auto-scaling for inpaint size * Improves scaled bbox display logic * Fixes bug with clear mask and history * Fixes shouldShowStagingImage not resetting to true on commit * Builds fresh bundle * Fixes canvas failing to scale on first run * Builds fresh bundle * Fixes unnecessary canvas scaling * Adds gallery drag and drop to img2img/canvas * Builds fresh bundle * Fix desktop mode being broken with new versions of flaskwebgui * Fixes canvas dimensions not setting on first load * Builds fresh bundle * stop crash on !import_models call on model inside rootdir - addresses bug report #1546 * prevent "!switch state gets confused if model switching fails" - If !switch were to fail on a particular model, then generate got confused and wouldn't try again until you switch to a different working model and back again. - This commit fixes and closes #1547 * Revert "make the docstring more readable and improve the list_models logic" This reverts commit 248068fe5d57b5639ea7a87ee6cbf023104d957d. * fix model cache path * also set fail-fast to it's default (true) in this way the whole action fails if one job fails this should unblock the runners!!! * fix output path for Archive results * disable checks for python 3.9 * Update-requirements and test-invoke-pip workflow (#1574) * update requirements files * update test-invoke-pip workflow * move requirements-mkdocs.txt to docs folder (#1575) * move requirements-mkdocs.txt to docs folder * update copyright * Fixes outpainting with resized inpaint size * Interactive configuration (#1517) * Update scripts/configure_invokeai.py prevent crash if output exists Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> * implement changes requested by reviews * default to correct root and output directory on Windows systems - Previously the script was relying on the readline buffer editing feature to set up the correct default. But this feature doesn't exist on windows. - This commit detects when user typed return with an empty directory value and replaces with the default directory. * improved readability of directory choices * Update scripts/configure_invokeai.py Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> * better error reporting at startup - If user tries to run the script outside of the repo or runtime directory, a more informative message will appear explaining the problem. Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> * Embedding merging (#1526) * add whole <style token> to vocab for concept library embeddings * add ability to load multiple concept .bin files * make --log_tokenization respect custom tokens * start working on concept downloading system * preliminary support for dynamic loading and merging of multiple embedded models - The embedding_manager is now enhanced with ldm.invoke.concepts_lib, which handles dynamic downloading and caching of embedded models from the Hugging Face concepts library (https://huggingface.co/sd-concepts-library) - Downloading of a embedded model is triggered by the presence of one or more <concept> tags in the prompt. - Once the embedded model is downloaded, its trigger phrase will be loaded into the embedding manager and the prompt's <concept> tag will be replaced with the <trigger_phrase> - The downloaded model stays on disk for fast loading later. - The CLI autocomplete will complete partial <concept> tags for you. Type a '<' and hit tab to get all ~700 concepts. BUGS AND LIMITATIONS: - MODEL NAME VS TRIGGER PHRASE You must use the name of the concept embed model from the SD library, and not the trigger phrase itself. Usually these are the same, but not always. For example, the model named "hoi4-leaders" corresponds to the trigger "<HOI4-Leader>" One reason for this design choice is that there is no apparent constraint on the uniqueness of the trigger phrases and one trigger phrase may map onto multiple models. So we use the model name instead. The second reason is that there is no way I know of to search Hugging Face for models with certain trigger phrases. So we'd have to download all 700 models to index the phrases. The problem this presents is that this may confuse users, who will want to reuse prompts from distributions that use the trigger phrase directly. Usually this will work, but not always. - WON'T WORK ON A FIREWALLED SYSTEM If the host running IAI has no internet connection, it can't download the concept libraries. I will add a script that allows users to preload a list of concept models. - BUG IN PROMPT REPLACEMENT WHEN MODEL NOT FOUND There's a small bug that occurs when the user provides an invalid model name. The <concept> gets replaced with <None> in the prompt. * fix loading .pt embeddings; allow multi-vector embeddings; warn on dupes * simplify replacement logic and remove cuda assumption * download list of concepts from hugging face * remove misleading customization of '*' placeholder the existing code as-is did not do anything; unclear what it was supposed to do. the obvious alternative -- setting using 'placeholder_strings' instead of 'placeholder_tokens' to match model.params.personalization_config.params.placeholder_strings -- caused a crash. i think this is because the passed string also needed to be handed over on init of the PersonalizedBase as the 'placeholder_token' argument. this is weird config dict magic and i don't want to touch it. put a breakpoint in personalzied.py line 116 (top of PersonalizedBase.__init__) if you want to have a crack at it yourself. * address all the issues raised by damian0815 in review of PR #1526 * actually resize the token_embeddings * multiple improvements to the concept loader based on code reviews 1. Activated the --embedding_directory option (alias --embedding_path) to load a single embedding or an entire directory of embeddings at startup time. 2. Can turn off automatic loading of embeddings using --no-embeddings. 3. Embedding checkpoints are scanned with the pickle scanner. 4. More informative error messages when a concept can't be loaded due either to a 404 not found error or a network error. * autocomplete terms end with ">" now * fix startup error and network unreachable 1. If the .invokeai file does not contain the --root and --outdir options, invoke.py will now fix it. 2. Catch and handle network problems when downloading hugging face textual inversion concepts. * fix misformatted error string Co-authored-by: Damian Stewart <d@damianstewart.com> * model_cache.py: fix list_models Signed-off-by: devops117 <55235206+devops117@users.noreply.github.com> * add statement of values (#1584) * this adds the Statement of Values Google doc source = https://docs.google.com/document/d/1-PrUKDJcxy8OyNGc8CyiHhv2VgLvjt7LRGlEpbg1nmQ/edit?usp=sharing * Fix heading * Update InvokeAI_Statement_of_Values.md * Update InvokeAI_Statement_of_Values.md * Update InvokeAI_Statement_of_Values.md * Update InvokeAI_Statement_of_Values.md * Update InvokeAI_Statement_of_Values.md * add keturn and mauwii to the team member list * Fix punctuation * this adds the Statement of Values Google doc source = https://docs.google.com/document/d/1-PrUKDJcxy8OyNGc8CyiHhv2VgLvjt7LRGlEpbg1nmQ/edit?usp=sharing * add keturn and mauwii to the team member list * fix formating - make sub bullets use * (decide to all use - or *) - indent sub bullets Sorry, first only looked at the code version and found this only after looking at the markdown rendered version * use multiparagraph numbered sections * Break up Statement Of Values as per comments on #1584 * remove duplicated word, reduce vagueness it's important not to overstate how many artists we are consulting. * fix typo (sorry blessedcoolant) Co-authored-by: mauwii <Mauwii@outlook.de> Co-authored-by: damian <git@damianstewart.com> * update dockerfile (#1551) * update dockerfile * remove not existing file from .dockerignore * remove bloat and unecesary step also use --no-cache-dir for pip install image is now close to 2GB * make Dockerfile a variable * set base image to `ubuntu:22.10` * add build-essential * link outputs folder for persistence * update tag variable * update docs * fix not customizeable build args, add reqs output * !model_import autocompletes in ROOTDIR * Adds psychedelicious to statement of values signature (#1602) * add a --no-patchmatch option to disable patchmatch loading (#1598) This feature was added to prevent the CI Macintosh tests from erroring out when patchmatch is unable to retrieve its shared library from github assets. * Fix #1599 by relaxing the `match_trigger` regex (#1601) * Fix #1599 by relaxing the `match_trigger` regex Also simplify logic and reduce duplication. * restrict trigger regex again (but not so far) * make concepts library work with Web UI This PR makes it possible to include a Hugging Face concepts library <style-or-subject-trigger> in the WebUI prompt. The metadata seems to be correctly handled. * documentation enhancements (#1603) - Add documentation for the Hugging Face concepts library and TI embedding. - Fixup index.md to point to each of the feature documentation files, including ones that are pending. * tweak setup and environment files for linux & pypatchmatch (#1580) * tweak setup and environment files for linux & pypatchmatch - Downgrade python requirements to 3.9 because 3.10 is not supported on Ubuntu 20.04 LTS (widely-used distro) - Use our github pypatchmatch 0.1.3 in order to install Makefile where it needs to be. - Restored "-e ." as the last install step on pip installs. Hopefully this will not trigger the high-CPU hang we've previously experienced. * keep windows on basicsr 1.4.1 * keep windows on basicsr 1.4.1 * bump pypatchmatch requirement to 0.1.4 - This brings in a version of pypatchmatch that will gracefully handle internet connection not available at startup time. - Also refactors and simplifies the handling of gfpgan's basicsr requirement across various platforms. * revert to older version of list_models() (#1611) This restores the correct behavior of list_models() and quenches the bug of list_models() returning a single model entry named "name". I have not investigated what was wrong with the new version, but I think it may have to do with changes to the behavior in dict.update() * Fixes for #1604 (#1605) * Converts ESRGAN image input to RGB - Also adds typing for image input. - Partially resolves #1604 * ensure there are unmasked pixels before color matching Co-authored-by: Kyle Schouviller <kyle0654@hotmail.com> * update index.md (#1609) - comment out non existing link - fix indention - add seperator between feature categories * Debloat-docker (#1612) * debloat Dockerfile - less options more but more userfriendly - better Entrypoint to simulate CLI usage - without command the container still starts the web-host * debloat build.sh * better syntax in run.sh * update Docker docs - fix description of VOLUMENAME - update run script example to reflect new entrypoint * Test installer (#1618) * test linux install * try removing http from parsed requirements * pip install confirmed working on linux * ready for linux testing - rebuilt py3.10-linux-x86_64-cuda-reqs.txt to include pypatchmatch dependency. - point install.sh and install.bat to test-installer branch. * Updates MPS reqs * detect broken readline history files * fix download.pytorch.org URL * Test installer (Win 11) (#1620) Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> * Test installer (MacOS 13.0.1 w/ torch==1.12.0) (#1621) * Test installer (Win 11) * Test installer (MacOS 13.0.1 w/ torch==1.12.0) Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> * change sourceball to development for testing * Test installer (MacOS 13.0.1 w/ torch==1.12.1 & torchvision==1.13.1) (#1622) * Test installer (Win 11) * Test installer (MacOS 13.0.1 w/ torch==1.12.0) * Test installer (MacOS 13.0.1 w/ torch==1.12.1 & torchvision==1.13.1) Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Co-authored-by: Cyrus Chan <82143712+cyruschan360@users.noreply.github.com> Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> * 2.2 Doc Updates (#1589) * Unified Canvas Docs & Assets Unified Canvas draft Advanced Tools Updates Doc Updates (lstein feedback) * copy edits to Unified Canvas docs - consistent capitalisation and feature naming - more intimate address (replace "the user" with "you") for improved User Engagement(tm) - grammatical massaging and *poesie* Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> Co-authored-by: damian <git@damianstewart.com> * include a step after config to `cat ~/.invokeai` (#1629) * disable patchmatch in CI actions (#1626) * disable patchmatch in CI actions * fix indention * replace tab with spaces Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> * Fix installer script for macOS. (#1630) * refer to the platform as 'osx' instead of 'mac', otherwise the composed URL to micromamba is wrong. * move the `-O` option to `tar` to be grouped with the other tar flags to avoid the `-O` being interpreted as something to unarchive. * Removes symlinked environment.yaml (#1631) Was unintentionally added in #1621 * Fix inpainting with iterations (#1635) * fix error when inpainting using runwayml inpainting model (#1634) - error was "Omnibus object has no attribute pil_image" - closes #1596 * add k_dpmpp_2_a and k_dpmpp_2 solvers options (#1389) * add k_dpmpp_2_a and k_dpmpp_2 solvers options * update frontend Co-authored-by: Victor <victorca25@users.noreply.github.com> Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> * add .editorconfig (#1636) * Web UI 2.2 bugfixes (#1572) * Fixes bug preventing multiple images from being generated * Fixes valid seam strength value range * Update Delete Alert Text Indicates to the user that images are not permanently deleted. * Fixes left/right arrows not working on gallery * Fixes initial image on load erroneously set to a user uploaded image Should be a result gallery image. * Lightbox Fixes - Lightbox is now a button in the current image buttons - Lightbox is also now available in the gallery context menu - Lightbox zoom issues fixed - Lightbox has a fade in animation. * Fix image display wrapper in current preview not overflow bounds * Revert "Fix image display wrapper in current preview not overflow bounds" This reverts commit 5511c82714dbf1d1999d64e8bc357bafa34ddf37. * Change Staging Area discard icon from Bin to X * Expose Snap Threshold and Move Snap Settings to BBox Panel * Changes img2img strength default to 0.75 * Fixes drawing triggering when mouse enters canvas w/ button down When we only supported inpainting and no zoom, this was useful. It allowed the cursor to leave the canvas (which was easy to do given the limited canvas dimensions) and without losing the "I am drawing" state. With a zoomable canvas this is no longer as useful. Additionally, we have more popovers and tools (like the color pickers) which result in unexpected brush strokes. This fixes that issue. * Revert "Expose Snap Threshold and Move Snap Settings to BBox Panel" We will handle this a bit differently - by allowing the grid origin to be moved. I will dig in at some point. This reverts commit 33c92ecf4da724c2f17d9d91c7ea31a43a2f6deb. * Adds Limit Strokes to Box * Adds fill bounding box button * Adds erase bounding box button * Changes Staging area discard icon to match others * Fixes right click breaking move tool * Fixes brush preview visibility issue with "darken outside box" * Fixes history bugs with addFillRect, addEraseRect, and other actions * Adds missing `key` * Fixes postprocessing being applied to canvas generations * Fixes bbox not getting scaled in various situations * Fixes staging area show image toggle not resetting on accept/discard * Locks down canvas while generating/staging * Fixes move tool breaking when canvas loses focus during move/transform * Hides cursor when restrict strokes is on and mouse outside bbox * Lints * Builds fresh bundle * Fix overlapping hotkey for Fill Bounding Box * Build Fresh Bundle * Fixes bug with mask and bbox overlay * Builds fresh bundle Co-authored-by: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> * disable NSFW checker loading during the CI tests (#1641) * disable NSFW checker loading during the CI tests The NSFW filter apparently causes invoke.py to crash during CI testing, possibly due to out of memory errors. This workaround disables NSFW model loading. * doc change * fix formatting errors in yml files * Configure the NSFW checker at install time with default on (#1624) * configure the NSFW checker at install time with default on 1. Changes the --safety_checker argument to --nsfw_checker and --no-nsfw_checker. The original argument is recognized for backward compatibility. 2. The configure script asks users whether to enable the checker (default yes). Also offers users ability to select default sampler and number of generation steps. 3.Enables the pasting of the caution icon on blurred images when InvokeAI is installed into the package directory. 4. Adds documentation for the NSFW checker, including caveats about accuracy, memory requirements, and intermediate image dispaly. * use better fitting icon * NSFW defaults false for testing * set default back to nsfw active Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> Signed-off-by: devops117 <55235206+devops117@users.noreply.github.com> Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Co-authored-by: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Co-authored-by: Kyle Schouviller <kyle0654@hotmail.com> Co-authored-by: javl <mail@jaspervanloenen.com> Co-authored-by: Kent Keirsey <31807370+hipsterusername@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com> Co-authored-by: Damian Stewart <d@damianstewart.com> Co-authored-by: DevOps117 <55235206+devops117@users.noreply.github.com> Co-authored-by: damian <git@damianstewart.com> Co-authored-by: Damian Stewart <null@damianstewart.com> Co-authored-by: Cyrus Chan <82143712+cyruschan360@users.noreply.github.com> Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> Co-authored-by: Andre LaBranche <dre@mac.com> Co-authored-by: victorca25 <41912303+victorca25@users.noreply.github.com> Co-authored-by: Victor <victorca25@users.noreply.github.com>
2022-11-30 21:12:23 +00:00
enable_image_debugging = False,
Refactoring simplet2i (#387) * start refactoring -not yet functional * first phase of refactor done - not sure weighted prompts working * Second phase of refactoring. Everything mostly working. * The refactoring has moved all the hard-core inference work into ldm.dream.generator.*, where there are submodules for txt2img and img2img. inpaint will go in there as well. * Some additional refactoring will be done soon, but relatively minor work. * fix -save_orig flag to actually work * add @neonsecret attention.py memory optimization * remove unneeded imports * move token logging into conditioning.py * add placeholder version of inpaint; porting in progress * fix crash in img2img * inpainting working; not tested on variations * fix crashes in img2img * ported attention.py memory optimization #117 from basujindal branch * added @torch_no_grad() decorators to img2img, txt2img, inpaint closures * Final commit prior to PR against development * fixup crash when generating intermediate images in web UI * rename ldm.simplet2i to ldm.generate * add backward-compatibility simplet2i shell with deprecation warning * add back in mps exception, addresses @vargol comment in #354 * replaced Conditioning class with exported functions * fix wrong type of with_variations attribute during intialization * changed "image_iterator()" to "get_make_image()" * raise NotImplementedError for calling get_make_image() in parent class * Update ldm/generate.py better error message Co-authored-by: Kevin Gibbons <bakkot@gmail.com> * minor stylistic fixes and assertion checks from code review * moved get_noise() method into img2img class * break get_noise() into two methods, one for txt2img and the other for img2img * inpainting works on non-square images now * make get_noise() an abstract method in base class * much improved inpainting Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
2022-09-06 00:40:10 +00:00
**args,
): # eat up additional cruft
"""
ldm.generate.prompt2image() is the common entry point for txt2img() and img2img()
Refactoring simplet2i (#387) * start refactoring -not yet functional * first phase of refactor done - not sure weighted prompts working * Second phase of refactoring. Everything mostly working. * The refactoring has moved all the hard-core inference work into ldm.dream.generator.*, where there are submodules for txt2img and img2img. inpaint will go in there as well. * Some additional refactoring will be done soon, but relatively minor work. * fix -save_orig flag to actually work * add @neonsecret attention.py memory optimization * remove unneeded imports * move token logging into conditioning.py * add placeholder version of inpaint; porting in progress * fix crash in img2img * inpainting working; not tested on variations * fix crashes in img2img * ported attention.py memory optimization #117 from basujindal branch * added @torch_no_grad() decorators to img2img, txt2img, inpaint closures * Final commit prior to PR against development * fixup crash when generating intermediate images in web UI * rename ldm.simplet2i to ldm.generate * add backward-compatibility simplet2i shell with deprecation warning * add back in mps exception, addresses @vargol comment in #354 * replaced Conditioning class with exported functions * fix wrong type of with_variations attribute during intialization * changed "image_iterator()" to "get_make_image()" * raise NotImplementedError for calling get_make_image() in parent class * Update ldm/generate.py better error message Co-authored-by: Kevin Gibbons <bakkot@gmail.com> * minor stylistic fixes and assertion checks from code review * moved get_noise() method into img2img class * break get_noise() into two methods, one for txt2img and the other for img2img * inpainting works on non-square images now * make get_noise() an abstract method in base class * much improved inpainting Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
2022-09-06 00:40:10 +00:00
It takes the following arguments:
prompt // prompt string (no default)
iterations // iterations (1); image count=iterations
steps // refinement steps per iteration
seed // seed for random number generator
width // width of image, in multiples of 64 (512)
height // height of image, in multiples of 64 (512)
cfg_scale // how strongly the prompt influences the image (7.5) (must be >1)
seamless // whether the generated image should tile
hires_fix // whether the Hires Fix should be applied during generation
Refactoring simplet2i (#387) * start refactoring -not yet functional * first phase of refactor done - not sure weighted prompts working * Second phase of refactoring. Everything mostly working. * The refactoring has moved all the hard-core inference work into ldm.dream.generator.*, where there are submodules for txt2img and img2img. inpaint will go in there as well. * Some additional refactoring will be done soon, but relatively minor work. * fix -save_orig flag to actually work * add @neonsecret attention.py memory optimization * remove unneeded imports * move token logging into conditioning.py * add placeholder version of inpaint; porting in progress * fix crash in img2img * inpainting working; not tested on variations * fix crashes in img2img * ported attention.py memory optimization #117 from basujindal branch * added @torch_no_grad() decorators to img2img, txt2img, inpaint closures * Final commit prior to PR against development * fixup crash when generating intermediate images in web UI * rename ldm.simplet2i to ldm.generate * add backward-compatibility simplet2i shell with deprecation warning * add back in mps exception, addresses @vargol comment in #354 * replaced Conditioning class with exported functions * fix wrong type of with_variations attribute during intialization * changed "image_iterator()" to "get_make_image()" * raise NotImplementedError for calling get_make_image() in parent class * Update ldm/generate.py better error message Co-authored-by: Kevin Gibbons <bakkot@gmail.com> * minor stylistic fixes and assertion checks from code review * moved get_noise() method into img2img class * break get_noise() into two methods, one for txt2img and the other for img2img * inpainting works on non-square images now * make get_noise() an abstract method in base class * much improved inpainting Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
2022-09-06 00:40:10 +00:00
init_img // path to an initial image
init_mask // path to a mask for the initial image
text_mask // a text string that will be used to guide clipseg generation of the init_mask
invert_mask // boolean, if true invert the mask
Refactoring simplet2i (#387) * start refactoring -not yet functional * first phase of refactor done - not sure weighted prompts working * Second phase of refactoring. Everything mostly working. * The refactoring has moved all the hard-core inference work into ldm.dream.generator.*, where there are submodules for txt2img and img2img. inpaint will go in there as well. * Some additional refactoring will be done soon, but relatively minor work. * fix -save_orig flag to actually work * add @neonsecret attention.py memory optimization * remove unneeded imports * move token logging into conditioning.py * add placeholder version of inpaint; porting in progress * fix crash in img2img * inpainting working; not tested on variations * fix crashes in img2img * ported attention.py memory optimization #117 from basujindal branch * added @torch_no_grad() decorators to img2img, txt2img, inpaint closures * Final commit prior to PR against development * fixup crash when generating intermediate images in web UI * rename ldm.simplet2i to ldm.generate * add backward-compatibility simplet2i shell with deprecation warning * add back in mps exception, addresses @vargol comment in #354 * replaced Conditioning class with exported functions * fix wrong type of with_variations attribute during intialization * changed "image_iterator()" to "get_make_image()" * raise NotImplementedError for calling get_make_image() in parent class * Update ldm/generate.py better error message Co-authored-by: Kevin Gibbons <bakkot@gmail.com> * minor stylistic fixes and assertion checks from code review * moved get_noise() method into img2img class * break get_noise() into two methods, one for txt2img and the other for img2img * inpainting works on non-square images now * make get_noise() an abstract method in base class * much improved inpainting Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
2022-09-06 00:40:10 +00:00
strength // strength for noising/unnoising init_img. 0.0 preserves image exactly, 1.0 replaces it completely
2022-10-13 13:14:21 +00:00
facetool_strength // strength for GFPGAN/CodeFormer. 0.0 preserves image exactly, 1.0 replaces it completely
Refactoring simplet2i (#387) * start refactoring -not yet functional * first phase of refactor done - not sure weighted prompts working * Second phase of refactoring. Everything mostly working. * The refactoring has moved all the hard-core inference work into ldm.dream.generator.*, where there are submodules for txt2img and img2img. inpaint will go in there as well. * Some additional refactoring will be done soon, but relatively minor work. * fix -save_orig flag to actually work * add @neonsecret attention.py memory optimization * remove unneeded imports * move token logging into conditioning.py * add placeholder version of inpaint; porting in progress * fix crash in img2img * inpainting working; not tested on variations * fix crashes in img2img * ported attention.py memory optimization #117 from basujindal branch * added @torch_no_grad() decorators to img2img, txt2img, inpaint closures * Final commit prior to PR against development * fixup crash when generating intermediate images in web UI * rename ldm.simplet2i to ldm.generate * add backward-compatibility simplet2i shell with deprecation warning * add back in mps exception, addresses @vargol comment in #354 * replaced Conditioning class with exported functions * fix wrong type of with_variations attribute during intialization * changed "image_iterator()" to "get_make_image()" * raise NotImplementedError for calling get_make_image() in parent class * Update ldm/generate.py better error message Co-authored-by: Kevin Gibbons <bakkot@gmail.com> * minor stylistic fixes and assertion checks from code review * moved get_noise() method into img2img class * break get_noise() into two methods, one for txt2img and the other for img2img * inpainting works on non-square images now * make get_noise() an abstract method in base class * much improved inpainting Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
2022-09-06 00:40:10 +00:00
ddim_eta // image randomness (eta=0.0 means the same seed always produces the same image)
step_callback // a function or method that will be called each step
image_callback // a function or method that will be called each time an image is generated
with_variations // a weighted list [(seed_1, weight_1), (seed_2, weight_2), ...] of variations which should be applied before doing any generation
variation_amount // optional 0-1 value to slerp from -S noise to random noise (allows variations on an image)
2022-09-14 01:56:17 +00:00
threshold // optional value >=0 to add thresholding to latent values for k-diffusion samplers (0 disables)
perlin // optional 0-1 value to add a percentage of perlin noise to the initial noise
embiggen // scale factor relative to the size of the --init_img (-I), followed by ESRGAN upscaling strength (0-1.0), followed by minimum amount of overlap between tiles as a decimal ratio (0 - 1.0) or number of pixels
embiggen_tiles // list of tiles by number in order to process and replace onto the image e.g. `0 2 4`
Merge dev into main for 2.2.0 (#1642) * Fixes inpainting + code cleanup * Disable stage info in Inpainting Tab * Mask Brush Preview now always at 0.5 opacity The new mask is only visible properly at max opacity but at max opacity the brush preview becomes fully opaque blocking the view. So the mask brush preview no remains at 0.5 no matter what the Brush opacity is. * Remove save button from Canvas Controls (cleanup) * Implements invert mask * Changes "Invert Mask" to "Preserve Masked Areas" * Fixes (?) spacebar issues * Patches redux-persist and redux-deep-persist with debounced persists Our app changes redux state very, very often. As our undo/redo history grows, the calls to persist state start to take in the 100ms range, due to a the deep cloning of the history. This causes very noticeable performance lag. The deep cloning is required because we need to blacklist certain items in redux from being persisted (e.g. the app's connection status). Debouncing the whole process of persistence is a simple and effective solution. Unfortunately, `redux-persist` dropped `debounce` between v4 and v5, replacing it with `throttle`. `throttle`, instead of delaying the expensive action until a period of X ms of inactivity, simply ensures the action is executed at least every X ms. Of course, this does not fix our performance issue. The patch is very simple. It adds a `debounce` argument - a number of milliseconds - and debounces `redux-persist`'s `update()` method (provided by `createPersistoid`) by that many ms. Before this, I also tried writing a custom storage adapter for `redux-persist` to debounce the calls to `localStorage.setItem()`. While this worked and was far less invasive, it doesn't actually address the issue. It turns out `setItem()` is a very fast part of the process. We use `redux-deep-persist` to simplify the `redux-persist` configuration, which can get complicated when you need to blacklist or whitelist deeply nested state. There is also a patch here for that library because it uses the same types as `redux-persist`. Unfortunately, the last release of `redux-persist` used a package `flat-stream` which was malicious and has been removed from npm. The latest commits to `redux-persist` (about 1 year ago) do not build; we cannot use the master branch. And between the last release and last commit, the changes have all been breaking. Patching this last release (about 3 years old at this point) directly is far simpler than attempting to fix the upstream library's master branch or figuring out an alternative to the malicious and now non-existent dependency. * Adds debouncing * Fixes AttributeError: 'dict' object has no attribute 'invert_mask' * Updates package.json to use redux-persist patches * Attempts to fix redux-persist debounce patch * Fixes undo/redo * Fixes invert mask * Debounce > 300ms * Limits history to 256 for each of undo and redo * Canvas styling * Hotkeys improvement * Add Metadata To Viewer * Increases CFG Scale max to 200 * Fix gallery width size for Outpainting Also fixes the canvas resizing failing n fast pushes * Fixes disappearing canvas grid lines * Adds staging area * Fixes "use all" not setting variationAmount Now sets to 0 when the image had variations. * Builds fresh bundle * Outpainting tab loads to empty canvas instead of upload * Fixes wonky canvas layer ordering & compositing * Fixes error on inpainting paste back `TypeError: 'float' object cannot be interpreted as an integer` * Hides staging area outline on mouseover prev/next * Fixes inpainting not doing img2img when no mask * Fixes bbox not resizing in outpainting if partially off screen * Fixes crashes during iterative outpaint. Still doesn't work correctly though. * Fix iterative outpainting by restoring original images * Moves image uploading to HTTP - It all seems to work fine - A lot of cleanup is still needed - Logging needs to be added - May need types to be reviewed * Fixes: outpainting temp images show in gallery * WIP refactor to unified canvas * Removes console.log from redux-persist patch * Initial unification of canvas * Removes all references to split inpainting/outpainting canvas * Add patchmatch and infill_method parameter to prompt2image (options are 'patchmatch' or 'tile'). * Fixes app after removing in/out-painting refs * Rebases on dev, updates new env files w/ patchmatch * Organises features/canvas * Fixes bounding box ending up offscreen * Organises features/canvas * Stops unnecessary canvas rescales on gallery state change * Fixes 2px layout shift on toggle canvas lock * Clips lines drawn while canvas locked When drawing with the locked canvas, if a brush stroke gets too close to the edge of the canvas and its stroke would extend past the edge of the canvas, the edge of that stroke will be seen after unlocking the canvas. This could cause a problem if you unlock the canvas and now have a bunch of strokes just outside the init image area, which are far back in undo history and you cannot easily erase. With this change, lines drawn while the canvas is locked get clipped to the initial image bbox, fixing this issue. Additionally, the merge and save to gallery functions have been updated to respect the initial image bbox so they function how you'd expect. * Fixes reset canvas view when locked * Fixes send to buttons * Fixes bounding box not being rounded to 64 * Abandons "inpainting" canvas lock * Fixes save to gallery including empty area, adds download and copy image * Fix Current Image display background going over image bounds * Sets status immediately when clicking Invoke * Adds hotkeys and refactors sharing of konva instances Adds hotkeys to canvas. As part of this change, the access to konva instance objects was refactored: Previously closure'd refs were used to indirectly get access to the konva instances outside of react components. Now, a getter and setter function are used to provide access directly to the konva objects. * Updates hotkeys * Fixes canvas showing spinner on first load Also adds good default canvas scale and positioning when no image is on it * Fixes possible hang on MaskCompositer * Improves behaviour when setting init canvas image/reset view * Resets bounding box coords/dims when no image present * Disables canvas actions which cannot be done during processing * Adds useToastWatcher hook - Dispatch an `addToast` action with standard Chakra toast options object to add a toast to the toastQueue - The hook is called in App.tsx and just useEffect's w/ toastQueue as dependency to create the toasts - So now you can add toasts anywhere you have access to `dispatch`, which includes middleware and thunks - Adds first usage of this for the save image buttons in canvas * Update Hotkey Info Add missing tooltip hotkeys and update the hotkeys modal to reflect the new hotkeys for the Unified Canvas. * Fix theme changer not displaying current theme on page refresh * Fix tab count in hotkeys panel * Unify Brush and Eraser Sizes * Fix staging area display toggle not working * Staging Area delete button is now red So it doesnt feel blended into to the rest of them. * Revert "Fix theme changer not displaying current theme on page refresh" This reverts commit 903edfb803e743500242589ff093a8a8a0912726. * Add arguments to use SSL to webserver * Integrates #1487 - touch events Need to add: - Pinch zoom - Touch-specific handling (some things aren't quite right) * Refactors upload-related async thunks - Now standard thunks instead of RTK createAsyncThunk() - Adds toasts for all canvas upload-related actions * Reorganises app file structure * Fixes Canvas Auto Save to Gallery * Fixes staging area outline * Adds staging area hotkeys, disables gallery left/right when staging * Fixes Use All Parameters * Fix metadata viewer image url length when viewing intermediate * Fixes intermediate images being tiny in txt2img/img2img * Removes stale code * Improves canvas status text and adds option to toggle debug info * Fixes paste image to upload * Adds model drop-down to site header * Adds theme changer popover * Fix missing key on ThemeChanger map * Fixes stage position changing on zoom * Hotkey Cleanup - Viewer is now Z - Canvas Move tool is V - sync with PS - Removed some unused hotkeys * Fix canvas resizing when both options and gallery are unpinned * Implements thumbnails for gallery - Thumbnails are saved whenever an image is saved, and when gallery requests images from server - Thumbnails saved at original image aspect ratio with width of 128px as WEBP - If the thumbnail property of an image is unavailable for whatever reason, the image's full size URL is used instead * Saves thumbnails to separate thumbnails directory * Thumbnail size = 256px * Fix Lightbox Issues * Disables canvas image saving functions when processing * Fix index error on going past last image in Gallery * WIP - Lightbox Fixes Still need to fix the images not being centered on load when the image res changes * Fixes another similar index error, simplifies logic * Reworks canvas toolbar * Fixes canvas toolbar upload button * Cleans up IAICanvasStatusText * Improves metadata handling, fixes #1450 - Removes model list from metadata - Adds generation's specific model to metadata - Displays full metadata in JSON viewer * Gracefully handles corrupted images; fixes #1486 - App does not crash if corrupted image loaded - Error is displayed in the UI console and CLI output if an image cannot be loaded * Adds hotkey to reset canvas interaction state If the canvas' interaction state (e.g. isMovingBoundingBox, isDrawing, etc) get stuck somehow, user can press Escape to reset the state. * Removes stray console.log() * Fixes bug causing gallery to close on context menu open * Minor bugfixes - When doing long-running canvas image exporting actions, display indeterminate progress bar - Fix staging area image outline not displaying after committing/discarding results * Removes unused imports * Fixes repo root .gitignore ignoring frontend things * Builds fresh bundle * Styling updates * Removes reasonsWhyNotReady The popover doesn't play well with the button being disabled, and I don't think adds any value. * Image gallery resize/style tweaks * Styles buttons for clearing canvas history and mask * First pass on Canvas options panel * Fixes bug where discarding staged images results in loss of history * Adds Save to Gallery button to staging toolbar * Rearrange some canvas toolbar icons Put brush stuff together and canvas movement stuff together * Fix gallery maxwidth on unified canvas * Update Layer hotkey display to UI * Adds option to crop to bounding box on save * Masking option tweaks * Crop to Bounding Box > Save Box Region Only * Adds clear temp folder * Updates mask options popover behavior * Builds fresh bundle * Fix styling on alert modals * Fix input checkbox styling being incorrect on light theme * Styling fixes * Improves gallery resize behaviour * Cap gallery size on canvas tab so it doesnt overflow * Fixes bug when postprocessing image with no metadata * Adds IAIAlertDialog component * Moves Loopback to app settings * Fixes metadata viewer not showing metadata after refresh Also adds Dream-style prompt to metadata * Adds outpainting specific options * Linting * Fixes gallery width on lightbox, fixes gallery button expansion * Builds fresh bundle * Fix Lightbox images of different res not centering * Update feature tooltip text * Highlight mask icon when on mask layer * Fix gallery not resizing correctly on open and close * Add loopback to just img2img. Remove from settings. * Fix to gallery resizing * Removes Advanced checkbox, cleans up options panel for unified canvas * Minor styling fixes to new options panel layout * Styling Updates * Adds infill method * Tab Styling Fixes * memoize outpainting options * Fix unnecessary gallery re-renders * Isolate Cursor Pos debug text on canvas to prevent rerenders * Fixes missing postprocessed image metadata before refresh * Builds fresh bundle * Fix rerenders on model select * Floating panel re-render fix * Simplify fullscreen hotkey selector * Add Training WIP Tab * Adds Training icon * Move full screen hotkey to floating to prevent tab rerenders * Adds single-column gallery layout * Fixes crash on cancel with intermediates enabled, fixes #1416 * Updates npm dependencies * Fixes img2img attempting inpaint when init image has transparency * Fixes missing threshold and perlin parameters in metadata viewer * Renames "Threshold" > "Noise Threshold" * Fixes postprocessing not being disabled when clicking use all * Builds fresh bundle * Adds color picker * Lints & builds fresh bundle * Fixes iterations being disabled when seed random & variations are off * Un-floors cursor position * Changes color picker preview to circles * Fixes variation params not set correctly when recalled * Fixes invoke hotkey not working in input fields * Simplifies Accordion Prep for adding reset buttons for each section * Fixes mask brush preview color * Committing color picker color changes tool to brush * Color picker does not overwrite user-selected alpha * Adds brush color alpha hotkey * Lints * Removes force_outpaint param * Add inpaint size options to inpaint at a larger size than the actual inpaint image, then scale back down for recombination * Bug fix for inpaint size * Adds inpaint size (as scale bounding box) to UI * Adds auto-scaling for inpaint size * Improves scaled bbox display logic * Fixes bug with clear mask and history * Fixes shouldShowStagingImage not resetting to true on commit * Builds fresh bundle * Fixes canvas failing to scale on first run * Builds fresh bundle * Fixes unnecessary canvas scaling * Adds gallery drag and drop to img2img/canvas * Builds fresh bundle * Fix desktop mode being broken with new versions of flaskwebgui * Fixes canvas dimensions not setting on first load * Builds fresh bundle * stop crash on !import_models call on model inside rootdir - addresses bug report #1546 * prevent "!switch state gets confused if model switching fails" - If !switch were to fail on a particular model, then generate got confused and wouldn't try again until you switch to a different working model and back again. - This commit fixes and closes #1547 * Revert "make the docstring more readable and improve the list_models logic" This reverts commit 248068fe5d57b5639ea7a87ee6cbf023104d957d. * fix model cache path * also set fail-fast to it's default (true) in this way the whole action fails if one job fails this should unblock the runners!!! * fix output path for Archive results * disable checks for python 3.9 * Update-requirements and test-invoke-pip workflow (#1574) * update requirements files * update test-invoke-pip workflow * move requirements-mkdocs.txt to docs folder (#1575) * move requirements-mkdocs.txt to docs folder * update copyright * Fixes outpainting with resized inpaint size * Interactive configuration (#1517) * Update scripts/configure_invokeai.py prevent crash if output exists Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> * implement changes requested by reviews * default to correct root and output directory on Windows systems - Previously the script was relying on the readline buffer editing feature to set up the correct default. But this feature doesn't exist on windows. - This commit detects when user typed return with an empty directory value and replaces with the default directory. * improved readability of directory choices * Update scripts/configure_invokeai.py Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> * better error reporting at startup - If user tries to run the script outside of the repo or runtime directory, a more informative message will appear explaining the problem. Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> * Embedding merging (#1526) * add whole <style token> to vocab for concept library embeddings * add ability to load multiple concept .bin files * make --log_tokenization respect custom tokens * start working on concept downloading system * preliminary support for dynamic loading and merging of multiple embedded models - The embedding_manager is now enhanced with ldm.invoke.concepts_lib, which handles dynamic downloading and caching of embedded models from the Hugging Face concepts library (https://huggingface.co/sd-concepts-library) - Downloading of a embedded model is triggered by the presence of one or more <concept> tags in the prompt. - Once the embedded model is downloaded, its trigger phrase will be loaded into the embedding manager and the prompt's <concept> tag will be replaced with the <trigger_phrase> - The downloaded model stays on disk for fast loading later. - The CLI autocomplete will complete partial <concept> tags for you. Type a '<' and hit tab to get all ~700 concepts. BUGS AND LIMITATIONS: - MODEL NAME VS TRIGGER PHRASE You must use the name of the concept embed model from the SD library, and not the trigger phrase itself. Usually these are the same, but not always. For example, the model named "hoi4-leaders" corresponds to the trigger "<HOI4-Leader>" One reason for this design choice is that there is no apparent constraint on the uniqueness of the trigger phrases and one trigger phrase may map onto multiple models. So we use the model name instead. The second reason is that there is no way I know of to search Hugging Face for models with certain trigger phrases. So we'd have to download all 700 models to index the phrases. The problem this presents is that this may confuse users, who will want to reuse prompts from distributions that use the trigger phrase directly. Usually this will work, but not always. - WON'T WORK ON A FIREWALLED SYSTEM If the host running IAI has no internet connection, it can't download the concept libraries. I will add a script that allows users to preload a list of concept models. - BUG IN PROMPT REPLACEMENT WHEN MODEL NOT FOUND There's a small bug that occurs when the user provides an invalid model name. The <concept> gets replaced with <None> in the prompt. * fix loading .pt embeddings; allow multi-vector embeddings; warn on dupes * simplify replacement logic and remove cuda assumption * download list of concepts from hugging face * remove misleading customization of '*' placeholder the existing code as-is did not do anything; unclear what it was supposed to do. the obvious alternative -- setting using 'placeholder_strings' instead of 'placeholder_tokens' to match model.params.personalization_config.params.placeholder_strings -- caused a crash. i think this is because the passed string also needed to be handed over on init of the PersonalizedBase as the 'placeholder_token' argument. this is weird config dict magic and i don't want to touch it. put a breakpoint in personalzied.py line 116 (top of PersonalizedBase.__init__) if you want to have a crack at it yourself. * address all the issues raised by damian0815 in review of PR #1526 * actually resize the token_embeddings * multiple improvements to the concept loader based on code reviews 1. Activated the --embedding_directory option (alias --embedding_path) to load a single embedding or an entire directory of embeddings at startup time. 2. Can turn off automatic loading of embeddings using --no-embeddings. 3. Embedding checkpoints are scanned with the pickle scanner. 4. More informative error messages when a concept can't be loaded due either to a 404 not found error or a network error. * autocomplete terms end with ">" now * fix startup error and network unreachable 1. If the .invokeai file does not contain the --root and --outdir options, invoke.py will now fix it. 2. Catch and handle network problems when downloading hugging face textual inversion concepts. * fix misformatted error string Co-authored-by: Damian Stewart <d@damianstewart.com> * model_cache.py: fix list_models Signed-off-by: devops117 <55235206+devops117@users.noreply.github.com> * add statement of values (#1584) * this adds the Statement of Values Google doc source = https://docs.google.com/document/d/1-PrUKDJcxy8OyNGc8CyiHhv2VgLvjt7LRGlEpbg1nmQ/edit?usp=sharing * Fix heading * Update InvokeAI_Statement_of_Values.md * Update InvokeAI_Statement_of_Values.md * Update InvokeAI_Statement_of_Values.md * Update InvokeAI_Statement_of_Values.md * Update InvokeAI_Statement_of_Values.md * add keturn and mauwii to the team member list * Fix punctuation * this adds the Statement of Values Google doc source = https://docs.google.com/document/d/1-PrUKDJcxy8OyNGc8CyiHhv2VgLvjt7LRGlEpbg1nmQ/edit?usp=sharing * add keturn and mauwii to the team member list * fix formating - make sub bullets use * (decide to all use - or *) - indent sub bullets Sorry, first only looked at the code version and found this only after looking at the markdown rendered version * use multiparagraph numbered sections * Break up Statement Of Values as per comments on #1584 * remove duplicated word, reduce vagueness it's important not to overstate how many artists we are consulting. * fix typo (sorry blessedcoolant) Co-authored-by: mauwii <Mauwii@outlook.de> Co-authored-by: damian <git@damianstewart.com> * update dockerfile (#1551) * update dockerfile * remove not existing file from .dockerignore * remove bloat and unecesary step also use --no-cache-dir for pip install image is now close to 2GB * make Dockerfile a variable * set base image to `ubuntu:22.10` * add build-essential * link outputs folder for persistence * update tag variable * update docs * fix not customizeable build args, add reqs output * !model_import autocompletes in ROOTDIR * Adds psychedelicious to statement of values signature (#1602) * add a --no-patchmatch option to disable patchmatch loading (#1598) This feature was added to prevent the CI Macintosh tests from erroring out when patchmatch is unable to retrieve its shared library from github assets. * Fix #1599 by relaxing the `match_trigger` regex (#1601) * Fix #1599 by relaxing the `match_trigger` regex Also simplify logic and reduce duplication. * restrict trigger regex again (but not so far) * make concepts library work with Web UI This PR makes it possible to include a Hugging Face concepts library <style-or-subject-trigger> in the WebUI prompt. The metadata seems to be correctly handled. * documentation enhancements (#1603) - Add documentation for the Hugging Face concepts library and TI embedding. - Fixup index.md to point to each of the feature documentation files, including ones that are pending. * tweak setup and environment files for linux & pypatchmatch (#1580) * tweak setup and environment files for linux & pypatchmatch - Downgrade python requirements to 3.9 because 3.10 is not supported on Ubuntu 20.04 LTS (widely-used distro) - Use our github pypatchmatch 0.1.3 in order to install Makefile where it needs to be. - Restored "-e ." as the last install step on pip installs. Hopefully this will not trigger the high-CPU hang we've previously experienced. * keep windows on basicsr 1.4.1 * keep windows on basicsr 1.4.1 * bump pypatchmatch requirement to 0.1.4 - This brings in a version of pypatchmatch that will gracefully handle internet connection not available at startup time. - Also refactors and simplifies the handling of gfpgan's basicsr requirement across various platforms. * revert to older version of list_models() (#1611) This restores the correct behavior of list_models() and quenches the bug of list_models() returning a single model entry named "name". I have not investigated what was wrong with the new version, but I think it may have to do with changes to the behavior in dict.update() * Fixes for #1604 (#1605) * Converts ESRGAN image input to RGB - Also adds typing for image input. - Partially resolves #1604 * ensure there are unmasked pixels before color matching Co-authored-by: Kyle Schouviller <kyle0654@hotmail.com> * update index.md (#1609) - comment out non existing link - fix indention - add seperator between feature categories * Debloat-docker (#1612) * debloat Dockerfile - less options more but more userfriendly - better Entrypoint to simulate CLI usage - without command the container still starts the web-host * debloat build.sh * better syntax in run.sh * update Docker docs - fix description of VOLUMENAME - update run script example to reflect new entrypoint * Test installer (#1618) * test linux install * try removing http from parsed requirements * pip install confirmed working on linux * ready for linux testing - rebuilt py3.10-linux-x86_64-cuda-reqs.txt to include pypatchmatch dependency. - point install.sh and install.bat to test-installer branch. * Updates MPS reqs * detect broken readline history files * fix download.pytorch.org URL * Test installer (Win 11) (#1620) Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> * Test installer (MacOS 13.0.1 w/ torch==1.12.0) (#1621) * Test installer (Win 11) * Test installer (MacOS 13.0.1 w/ torch==1.12.0) Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> * change sourceball to development for testing * Test installer (MacOS 13.0.1 w/ torch==1.12.1 & torchvision==1.13.1) (#1622) * Test installer (Win 11) * Test installer (MacOS 13.0.1 w/ torch==1.12.0) * Test installer (MacOS 13.0.1 w/ torch==1.12.1 & torchvision==1.13.1) Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Co-authored-by: Cyrus Chan <82143712+cyruschan360@users.noreply.github.com> Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> * 2.2 Doc Updates (#1589) * Unified Canvas Docs & Assets Unified Canvas draft Advanced Tools Updates Doc Updates (lstein feedback) * copy edits to Unified Canvas docs - consistent capitalisation and feature naming - more intimate address (replace "the user" with "you") for improved User Engagement(tm) - grammatical massaging and *poesie* Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> Co-authored-by: damian <git@damianstewart.com> * include a step after config to `cat ~/.invokeai` (#1629) * disable patchmatch in CI actions (#1626) * disable patchmatch in CI actions * fix indention * replace tab with spaces Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> * Fix installer script for macOS. (#1630) * refer to the platform as 'osx' instead of 'mac', otherwise the composed URL to micromamba is wrong. * move the `-O` option to `tar` to be grouped with the other tar flags to avoid the `-O` being interpreted as something to unarchive. * Removes symlinked environment.yaml (#1631) Was unintentionally added in #1621 * Fix inpainting with iterations (#1635) * fix error when inpainting using runwayml inpainting model (#1634) - error was "Omnibus object has no attribute pil_image" - closes #1596 * add k_dpmpp_2_a and k_dpmpp_2 solvers options (#1389) * add k_dpmpp_2_a and k_dpmpp_2 solvers options * update frontend Co-authored-by: Victor <victorca25@users.noreply.github.com> Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> * add .editorconfig (#1636) * Web UI 2.2 bugfixes (#1572) * Fixes bug preventing multiple images from being generated * Fixes valid seam strength value range * Update Delete Alert Text Indicates to the user that images are not permanently deleted. * Fixes left/right arrows not working on gallery * Fixes initial image on load erroneously set to a user uploaded image Should be a result gallery image. * Lightbox Fixes - Lightbox is now a button in the current image buttons - Lightbox is also now available in the gallery context menu - Lightbox zoom issues fixed - Lightbox has a fade in animation. * Fix image display wrapper in current preview not overflow bounds * Revert "Fix image display wrapper in current preview not overflow bounds" This reverts commit 5511c82714dbf1d1999d64e8bc357bafa34ddf37. * Change Staging Area discard icon from Bin to X * Expose Snap Threshold and Move Snap Settings to BBox Panel * Changes img2img strength default to 0.75 * Fixes drawing triggering when mouse enters canvas w/ button down When we only supported inpainting and no zoom, this was useful. It allowed the cursor to leave the canvas (which was easy to do given the limited canvas dimensions) and without losing the "I am drawing" state. With a zoomable canvas this is no longer as useful. Additionally, we have more popovers and tools (like the color pickers) which result in unexpected brush strokes. This fixes that issue. * Revert "Expose Snap Threshold and Move Snap Settings to BBox Panel" We will handle this a bit differently - by allowing the grid origin to be moved. I will dig in at some point. This reverts commit 33c92ecf4da724c2f17d9d91c7ea31a43a2f6deb. * Adds Limit Strokes to Box * Adds fill bounding box button * Adds erase bounding box button * Changes Staging area discard icon to match others * Fixes right click breaking move tool * Fixes brush preview visibility issue with "darken outside box" * Fixes history bugs with addFillRect, addEraseRect, and other actions * Adds missing `key` * Fixes postprocessing being applied to canvas generations * Fixes bbox not getting scaled in various situations * Fixes staging area show image toggle not resetting on accept/discard * Locks down canvas while generating/staging * Fixes move tool breaking when canvas loses focus during move/transform * Hides cursor when restrict strokes is on and mouse outside bbox * Lints * Builds fresh bundle * Fix overlapping hotkey for Fill Bounding Box * Build Fresh Bundle * Fixes bug with mask and bbox overlay * Builds fresh bundle Co-authored-by: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> * disable NSFW checker loading during the CI tests (#1641) * disable NSFW checker loading during the CI tests The NSFW filter apparently causes invoke.py to crash during CI testing, possibly due to out of memory errors. This workaround disables NSFW model loading. * doc change * fix formatting errors in yml files * Configure the NSFW checker at install time with default on (#1624) * configure the NSFW checker at install time with default on 1. Changes the --safety_checker argument to --nsfw_checker and --no-nsfw_checker. The original argument is recognized for backward compatibility. 2. The configure script asks users whether to enable the checker (default yes). Also offers users ability to select default sampler and number of generation steps. 3.Enables the pasting of the caution icon on blurred images when InvokeAI is installed into the package directory. 4. Adds documentation for the NSFW checker, including caveats about accuracy, memory requirements, and intermediate image dispaly. * use better fitting icon * NSFW defaults false for testing * set default back to nsfw active Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> Signed-off-by: devops117 <55235206+devops117@users.noreply.github.com> Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Co-authored-by: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Co-authored-by: Kyle Schouviller <kyle0654@hotmail.com> Co-authored-by: javl <mail@jaspervanloenen.com> Co-authored-by: Kent Keirsey <31807370+hipsterusername@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com> Co-authored-by: Damian Stewart <d@damianstewart.com> Co-authored-by: DevOps117 <55235206+devops117@users.noreply.github.com> Co-authored-by: damian <git@damianstewart.com> Co-authored-by: Damian Stewart <null@damianstewart.com> Co-authored-by: Cyrus Chan <82143712+cyruschan360@users.noreply.github.com> Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> Co-authored-by: Andre LaBranche <dre@mac.com> Co-authored-by: victorca25 <41912303+victorca25@users.noreply.github.com> Co-authored-by: Victor <victorca25@users.noreply.github.com>
2022-11-30 21:12:23 +00:00
embiggen_strength // strength for embiggen. 0.0 preserves image exactly, 1.0 replaces it completely
Refactoring simplet2i (#387) * start refactoring -not yet functional * first phase of refactor done - not sure weighted prompts working * Second phase of refactoring. Everything mostly working. * The refactoring has moved all the hard-core inference work into ldm.dream.generator.*, where there are submodules for txt2img and img2img. inpaint will go in there as well. * Some additional refactoring will be done soon, but relatively minor work. * fix -save_orig flag to actually work * add @neonsecret attention.py memory optimization * remove unneeded imports * move token logging into conditioning.py * add placeholder version of inpaint; porting in progress * fix crash in img2img * inpainting working; not tested on variations * fix crashes in img2img * ported attention.py memory optimization #117 from basujindal branch * added @torch_no_grad() decorators to img2img, txt2img, inpaint closures * Final commit prior to PR against development * fixup crash when generating intermediate images in web UI * rename ldm.simplet2i to ldm.generate * add backward-compatibility simplet2i shell with deprecation warning * add back in mps exception, addresses @vargol comment in #354 * replaced Conditioning class with exported functions * fix wrong type of with_variations attribute during intialization * changed "image_iterator()" to "get_make_image()" * raise NotImplementedError for calling get_make_image() in parent class * Update ldm/generate.py better error message Co-authored-by: Kevin Gibbons <bakkot@gmail.com> * minor stylistic fixes and assertion checks from code review * moved get_noise() method into img2img class * break get_noise() into two methods, one for txt2img and the other for img2img * inpainting works on non-square images now * make get_noise() an abstract method in base class * much improved inpainting Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
2022-09-06 00:40:10 +00:00
To use the step callback, define a function that receives two arguments:
- Image GPU data
- The step number
To use the image callback, define a function of method that receives two arguments, an Image object
and the seed. You can then do whatever you like with the image, including converting it to
different formats and manipulating it. For example:
def process_image(image,seed):
image.save(f{'images/seed.png'})
The code used to save images to a directory can be found in ldm/invoke/pngwriter.py.
It contains code to create the requested output directory, select a unique informative
name for each image, and write the prompt into the PNG metadata.
Refactoring simplet2i (#387) * start refactoring -not yet functional * first phase of refactor done - not sure weighted prompts working * Second phase of refactoring. Everything mostly working. * The refactoring has moved all the hard-core inference work into ldm.dream.generator.*, where there are submodules for txt2img and img2img. inpaint will go in there as well. * Some additional refactoring will be done soon, but relatively minor work. * fix -save_orig flag to actually work * add @neonsecret attention.py memory optimization * remove unneeded imports * move token logging into conditioning.py * add placeholder version of inpaint; porting in progress * fix crash in img2img * inpainting working; not tested on variations * fix crashes in img2img * ported attention.py memory optimization #117 from basujindal branch * added @torch_no_grad() decorators to img2img, txt2img, inpaint closures * Final commit prior to PR against development * fixup crash when generating intermediate images in web UI * rename ldm.simplet2i to ldm.generate * add backward-compatibility simplet2i shell with deprecation warning * add back in mps exception, addresses @vargol comment in #354 * replaced Conditioning class with exported functions * fix wrong type of with_variations attribute during intialization * changed "image_iterator()" to "get_make_image()" * raise NotImplementedError for calling get_make_image() in parent class * Update ldm/generate.py better error message Co-authored-by: Kevin Gibbons <bakkot@gmail.com> * minor stylistic fixes and assertion checks from code review * moved get_noise() method into img2img class * break get_noise() into two methods, one for txt2img and the other for img2img * inpainting works on non-square images now * make get_noise() an abstract method in base class * much improved inpainting Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
2022-09-06 00:40:10 +00:00
"""
# TODO: convert this into a getattr() loop
steps = steps or self.steps
width = width or self.width
height = height or self.height
seamless = seamless or self.seamless
2022-10-17 02:45:18 +00:00
seamless_axes = seamless_axes or self.seamless_axes
hires_fix = hires_fix or self.hires_fix
cfg_scale = cfg_scale or self.cfg_scale
ddim_eta = ddim_eta or self.ddim_eta
iterations = iterations or self.iterations
strength = strength or self.strength
merge release-candidate-1-3-2 into main. Squashed commit of the following: commit 9a1fe8e7fbbd81d9e9e47c4fda6bde6f66fba30c Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 12 17:07:40 2022 +0000 swap in release URLs for installers commit ff56f5251ba8502833cb561317e82b028cd2da5d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 12 17:03:21 2022 +0000 fix up bad unicode chars in invoke.py commit ed943bd6c785d968d1e31fbbb814fea8688fc8bb Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 12 16:05:45 2022 +0000 outcrop improvements, hand-added commit 7ad2355b1da53861bb75312edead8f9db0b0f44d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 12 15:14:33 2022 +0000 documentation fixes commit 66c920fc197d9206be9e0e2d1eb2a1cb86362887 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 16:49:25 2022 -0500 Revert "Resize hires as an image" This reverts commit d05b1b3544dfa7b3c071ac05b4f014a52e08fa50. commit 3fc5cb09f8bc03ea96e67a3e49fb087019d2f9d5 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 12 12:43:17 2022 +0000 fix incorrect link in install commit 1345ec77ab58f70e1bf5a0f587ca40aba4e906b7 Author: tildebyte <337875+tildebyte@users.noreply.github.com> Date: Sun Nov 6 19:07:31 2022 -0500 toil(repo): add tildebyte as owner of installer/ directory commit b116715490f390a59e5bee1022a6a758aee0918d Author: Kyle Schouviller <kyle0654@hotmail.com> Date: Thu Nov 10 21:43:56 2022 -0800 Fix performance issue introduced by torch cuda cache clear during generation commit fa3670270e7aae6bfd8d47fb7bdd32b707310c23 Author: mauwii <Mauwii@outlook.de> Date: Fri Nov 11 12:42:03 2022 +0100 small update to dockers huggingface section commit c304250ef663b3e202b4da8332365288589d94c7 Author: mauwii <Mauwii@outlook.de> Date: Fri Nov 11 12:19:27 2022 +0100 fix format and Link in INSTALL_INVOKE.md commit 802ce5dde5ca68f24aa4609cdba428044e0c7fa1 Author: mauwii <Mauwii@outlook.de> Date: Fri Nov 11 11:17:49 2022 +0100 small fixex to format and a link in INSTALL_MANUAL commit 311ee320ecac892cb4a1bcd012374fa051b1d011 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 07:23:35 2022 +0000 ignore installer intermediate files commit e9df17b374df58a44d3ae3ba33cbdc58794bcf5d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 07:19:25 2022 +0000 fix backslash-related syntax error commit 061fb4ef00482bdd4fba635aeaeff4ca7510190d Merge: 52be0d23 4095acd1 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 06:50:04 2022 +0000 Merge branch 'release-candidate-2-1-3' of github.com:/invoke-ai/InvokeAI into release-candidate-2-1-3 commit 52be0d2396de2de02030855c92e3367008b50377 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 06:49:45 2022 +0000 add WindowsLongFileName batfile to source installer commit 4095acd10ebae05a8cb14cc2faf7c79936d9e6a9 Author: mauwii <Mauwii@outlook.de> Date: Fri Nov 11 07:05:17 2022 +0100 Doc Updates A lot of re-formating of new Installation Docs also some content updates/corrections commit 201eb22d7650b00f55249c2646fa4f47ac3e0ec2 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 04:41:02 2022 +0000 prevent two models from being marked default in models.yaml commit 17ab98220034dfbb798a9a0460bc2837f0c1e2cb Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 03:56:54 2022 +0000 installers download branch HEAD not tag commit a04965b0e9e9d1170cf284af9acbd1186d681255 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 03:48:21 2022 +0000 improve messaging during installation process commit 0b529f0c574dd91fb9593e924ebc41c8c219b6ce Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 15:22:32 2022 +0000 enable outcropping of random JPG/PNG images - Works best with runwayML inpainting model - Numerous code changes required to propagate seed to final metadata. Original code predicated on the image being generated within InvokeAI. commit 6f9f84834557eb3c48562dc5d0ace51ca9e9cca2 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 17:27:42 2022 +0000 enhance outcropping with ability to direct contents of new regions - When outcropping an image you can now add a `--new_prompt` option, to specify a new prompt to be used instead of the original one used to generate the image. - Similarly you can provide a new seed using `--seed` (or `-S`). A seed of zero will pick one randomly. - This PR also fixes the crash that happened when trying to outcrop an image that does not contain InvokeAI metadata. commit 918c1589ef30595668899f4259ece6a4ad605c69 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 20:16:47 2022 +0000 fix #1402 commit 116415b3fcec8415f8e6de9b23c0bbd0dbc6845b Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 21:27:25 2022 +0000 fix invoke.py crash if no models.yaml file present - Script will now offer the user the ability to create a minimal models.yaml and then gracefully exit. - Closes #1420 commit b4b6eabaac94896e38123be331c44d1b63065b0d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 16:49:25 2022 -0500 Revert "Log strength with hires" This reverts commit 82d4904c07670d514e9a541de7c9ecd8489eeae2. commit 4ef1f4a854717c953f9192454d0adabef32af36c Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 20:01:49 2022 +0000 remove temporary directory from repo commit 510fc4ebaa5f9dc0e77b47cf04e0c265423e0a44 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 19:59:03 2022 +0000 remove -e from clipseg load in installer commit a20914434bb3609cf1d883cabf048d4cc25f881a Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 19:37:07 2022 +0000 change clipseg repo branch to avoid clipseg not found error commit 0d134195fda5c69fce5a95d6da90248eba8d226d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 18:39:29 2022 +0000 update repo URL to point to rc commit 649d8c8573896fdb5a73453b69ee4b54cf4d6241 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 18:13:28 2022 +0000 integrate tildebyte installer commit a358d370a05ea985a9e26fa9c1101d9c14fdb3ab Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 17:48:14 2022 +0000 add @tildebyte compiled pip installer commit 94a9033c4f6214e604be149a3de6d7c747af7f3a Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 14:52:00 2022 +0000 ignore source installer zip files commit 18a947c503c83c95cd83f27424696219ff3c4c95 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 14:46:36 2022 +0000 documentation and environment file fixes - Have clarified the relationship between the @tildebyte and @cmdr2 installers; However, @tildebyte installer merge is still a WIP due to conflicts over such things as `invoke.sh`. - Rechristened 1click installer as "source" installer. @tildebyte installer will be "the" installer. (We'll see which one generates the least support requests and maintenance work.) - Sync'd `environment-mac.yml` with `development`. The former was failing with a taming-transformers error as per https://discord.com/channels/@me/1037201214154231899/1040060947378749460 commit a23b03189526a49da8ddae90ce71b0e902784d29 Author: Mike DiGiovanni <vinblau@gmail.com> Date: Wed Nov 9 16:44:59 2022 -0500 Fixes typos in README.md commit 23af68c7d79d947f1bd3441c91bb44d655238f01 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 07:02:27 2022 -0500 downgrade win installs to basicsr==1.4.1 commit e258beeb51f3e645b9ea60e52d69d18722221cc5 Merge: 7460c069 e481bfac Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 06:37:45 2022 -0500 Merge branch 'release-candidate-2-1-3' of github.com:invoke-ai/InvokeAI into release-candidate-2-1-3 commit 7460c069b880b10c84b55f2e0c0998e350d6cf12 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 06:36:48 2022 -0500 remove --prefer-binary from requirements-base.txt It appears that some versions of pip do not recognize this option when it appears in the requirements file. Did not explore this further but recommend --prefer-binary in the manual install instructions on the command line. commit e481bfac615e0c798ceb5e59e8fbe3038f85b431 Merge: 5040747c d1ab65a4 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 11:21:56 2022 +0000 Merge branch 'release-candidate-2-1-3' of github.com:/invoke-ai/InvokeAI into release-candidate-2-1-3 commit 5040747c6700c9b949e3f3e1d2c3f21daffcec6c Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 11:21:43 2022 +0000 fix windows install instructions & bat file commit d1ab65a43122f73c20533d5815590ec10bc05eca Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 07:18:59 2022 +0100 update WEBUIHOTKEYS.md commit af4ee7feb8a7d2528bf4e2b3f7deee7a7c4c3dec Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 06:33:49 2022 +0100 update INSTALL_DOCKER.md commit 764fb29aded8114984d05932c4266ea24614b932 Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 06:30:15 2022 +0100 fix formatting in INSTALL.md commit 1014d3ba44aa4cd4cfdc6e3650c24a0dc9568a6e Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 06:29:14 2022 +0100 fix build.sh invokeai_conda_env_file default value commit 40a48aca88e337e9f4475f80a03b7d6d4751d09b Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 05:25:30 2022 +0100 fix environment-mac.yml moved taming-transformers-rom1504 to pip dependencies commit 92abc00f16a34a586dd16d3c64408f00e23fcb53 Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 05:19:52 2022 +0100 fix test-invoke-conda - copy required conda environment yaml - use environment.yml - I use cp instead of ln since would be compatible for windows runners commit a5719aabf89c8c5f29c6044e2882ccdcd0c6916b Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 04:14:35 2022 +0100 update Dockerfile - link environment.yml from new environemnts path - change default conda_env_file - quote all variables to avoid splitting - also remove paths from conda-env-files in build-container.yml commit 44a18511fa7accfec6a20345774583a1ce745b02 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 20:51:06 2022 +0000 update paths in container build workflow commit b850dbadafba052310327ca759d96f49a9d25d03 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 20:16:57 2022 +0000 finished reorganization of install docs commit 9ef8b944d53afb1fed94c418b2fd936d2d743797 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 18:50:58 2022 +0000 tweaks to manual install documentation --prefer-binary is an iffy option in the requirements file. It isn't supported by some versions of pip, so I removed it from requirements-base.txt and inserted it into the manual install instructions where it seems to do what it is supposed to. commit efc5a9848803b4250d726bc1913b9fd5a33fad75 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 18:20:03 2022 +0000 manual installation documentation tested on Linux commit 1417c87928e13b0ed21bf1c5604f8636d3b50a8d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 17:37:06 2022 +0000 change name of requirements.txt to avoid confusion commit 2dd6fc2b93ff7bbb4038568a3b28d36a8fafaeb8 Merge: 22213612 71ee44a8 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 17:26:24 2022 +0000 Merge branch 'release-candidate-2-1-3' of github.com:/invoke-ai/InvokeAI into release-candidate-2-1-3 commit 22213612a08bbece46eafd48994f985b097cb141 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 17:25:59 2022 +0000 directory cleanup; working on install docs commit 71ee44a827898759fd457f774c0b2ac7a1ef6519 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 02:07:13 2022 +0000 prevent crash when switching to an invalid model commit b17ca0a5e731c142101bbdbf34d121df949e86d7 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 14:28:38 2022 +0100 don't suppress exceptions when doing cross-attention control commit 71bbfe4a1a5b70f90e5f41c94df50fb104dbdd79 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 12:59:34 2022 +0100 Fix #1362 by improving VRAM usage patterns when doing .swap() commit ef3f7a26e242b73c2beb0195c7fd8f654ef47f55 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 12:18:37 2022 +0100 remove log spam commit 7189d649622d4668b120b0dd278388ad672142c4 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 12:10:28 2022 +0100 change the way saved slicing strategy is applied commit 01c40f751ab72955140165c16f95ae411732265b Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 12:04:43 2022 +0100 fix slicing_strategy_getter callsite commit f8cfe25150a346958903316bc710737d99839923 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 11:56:22 2022 +0100 cleanup, consistent dim=0 also tested commit 5bf9b1e890d48e962afd4a668a219b68271e5dc1 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 11:34:09 2022 +0100 refactored context, tested with non-sliced cross attention control commit d58a46e39bf562e7459290d2444256e8c08ad0b6 Author: damian0815 <null@damianstewart.com> Date: Sun Nov 6 00:41:52 2022 +0100 cleanup commit 7e2c658b4c06fe239311b65b9bb16fa3adec7fd7 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:57:31 2022 +0100 disable logs commit 20ee89d93841b070738b3d8a4385c93b097d92eb Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:36:58 2022 +0100 slice saved attention if necessary commit 0a7684a22c880ec0f48cc22bfed4526358f71546 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:32:38 2022 +0100 raise instead of asserting commit 7083104c7f3a0d8fd96e94a2f391de50a3c942e4 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:31:00 2022 +0100 store dim when saving slices commit f7c0808ed383ec1dc70645288a798ed2aa4fa85c Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:27:16 2022 +0100 don't retry on exception commit 749a721e939b3fe7c1741e7998dab6bd2c85a0cb Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:24:50 2022 +0100 stuff commit 032ab90e9533be8726301ec91b97137e2aadef9a Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:20:17 2022 +0100 more logging commit 3dc34b387f033482305360e605809d95a40bf6f8 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:16:47 2022 +0100 logs commit 901c4c1aa4b9bcef695a6551867ec8149e6e6a93 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:12:39 2022 +0100 actually set save_slicing_strategy to True commit f780e0a0a7c6b6a3db320891064da82589358c8a Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:10:35 2022 +0100 store slicing strategy commit 93bb6d566fd18c5c69ef7dacc8f74ba2cf671cb7 Author: damian <git@damianstewart.com> Date: Sat Nov 5 20:43:48 2022 +0100 still not it commit 5e3a9541f8ae00bde524046963910323e20c40b7 Author: damian <git@damianstewart.com> Date: Sat Nov 5 17:20:02 2022 +0100 wip offloading attention slices on-demand commit 4c2966aa856b6f3b446216da3619ae931552ef08 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 15:47:40 2022 +0100 pre-emptive offloading, idk if it works commit 572576755e9f0a878d38e8173e485126c0efbefb Author: root <you@example.com> Date: Sat Nov 5 11:25:32 2022 +0000 push attention slices to cpu. slow but saves memory. commit b57c83a68f2ac03976ebc89ce2ff03812d6d185f Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 12:04:22 2022 +0100 verbose logging commit 3a5dae116f110a96585d9eb71d713b5ed2bc3d2b Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 11:50:48 2022 +0100 wip fixing mem strategy crash (4 test on runpod) commit 3cf237db5fae0c7b0b4cc3c47c81830bdb2ae7de Author: damian0815 <null@damianstewart.com> Date: Fri Nov 4 09:02:40 2022 +0100 wip, only works on cuda commit 5702271991e126c026aa1ff41c44f8ad37b26e3a Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 14:09:36 2022 +0000 speculative reorganization of the requirements & environment files - This is only a test! - The various environment*.yml and requirements*.txt files have all been moved into a directory named "environments-and-requirements". - The idea is to clean up our root directory so that the github home page is tidy. - The manual install instructions will start with the instructions to create a symbolic link from environment.yml to the appropriate file for OS and GPU. - The 1-click installers have been updated to accommodate this change. commit 10781e7dc4f4551583a110d14f2a1f60393112b8 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 01:59:45 2022 +0000 refactoring requirements commit 099d1157c579c7b9fea20945e8504cc15745c598 Author: mauwii <Mauwii@outlook.de> Date: Wed Nov 9 00:16:18 2022 +0100 better way to make sure if conda is useable commit ab825bf7ee5f0b82d2273da1cda64fc9266a978e Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 22:05:33 2022 +0000 add back --prefer-binaries to requirements commit 10cfeb5ada7bcfc9f3aff3716ab8ea4961a8b528 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 8 22:27:19 2022 +0100 add quotes to set and use `$environment_file` commit e97515d0453583e013674b4dd1f3739c7de402cc Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 8 22:24:21 2022 +0100 set environment file for conda update commit 0f04bc5789c712bf7c7319b1d93064914993f4ec Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 8 22:21:25 2022 +0100 use conda env update commit 3f74aabecd08ed25fac158463ae12b775bd1fca2 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 8 22:20:44 2022 +0100 use command instead of hash commit b1a99a51b7ca23c4b895855bd7b4c82dbdc431e4 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 14:44:44 2022 -0500 remove --global git config from 1-click installers commit 8004f8a6d99f6ff75e00c170da40f1dec93a8914 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Mon Nov 7 09:07:20 2022 -0500 Revert "Use array slicing to calc ddim timesteps" This reverts commit 1f0c5b4cf196716c21f2db74f92c8750ad8f889d. commit ff8ff2212afb1e1c2dce4f6a61f29e2bc8302eb5 Merge: 8e5363cd 636620b1 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 14:01:40 2022 +0000 add initfile support from PR #1386 commit 8e5363cd83bff0e6be0f002c644283955f7fcbfd Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 13:26:18 2022 +0000 move 'installer/' to '1-click-installer' to make room for tildebyte installer commit 1450779146e89510d12b8c90eb316d9861c3375e Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 12:56:36 2022 +0000 update branch for installer to pull against commit 8cd5d95b8a1cb213cce2f949c394c841a09d9cab Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 05:30:20 2022 +0000 move all models into subdirectories of ./models - this required an update to the invoke-ai fork of gfpgan - simultaneously reverted consolidation of environment and requirements files, as their presence in a directory triggered setup.py to try to install a sub-package. commit abd6407394d55d4f6c064a05f3ac989dd3817c59 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 03:52:46 2022 +0000 leave a copy of environment-cuda.yml at top level - named it environment.yml - need to avoid a big change for users and breaking older support instructions. commit 734dacfbe9d8c86ca943c6541e7b5ff5ef787ff4 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 03:50:07 2022 +0000 consolidate environment files - starting to remove unneeded entries and pins - no longer require -e in front of github dependencies - update setup.py with release number - update manual installation instructions commit 636620b1d5e2466613d0dcc2a604522be12fa3a4 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 03:26:16 2022 +0000 change initfile to ~/.invokeai - adjust documentation - also fix 'clipseg_models' to 'clipseg', which seems to be working now commit 1fe41146f0975bbc9d552208473490a9ccb9fc56 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 5 14:28:01 2022 -0400 add support for an initialization file, invokeai.init - Place preferred startup command switches in a file named "invokeai.init". The file can consist of a single line of switches such as "--web --steps=28", a series of switches on each line, or any combination of the two. Example: ``` --web --host=0.0.0.0 --steps=28 --grid -f 0.6 -C 11.0 -A k_euler_a ``` - The following options, which were previously only available within the CLI, are now available on the command line as well: --steps --strength --cfg_scale --width --height --fit commit 2ad6ef355a9b9c4b17bae71edea2346c2e8708c5 Merge: 865502ee 8b47c829 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sun Nov 6 18:08:36 2022 +0000 update discord link commit 865502ee4f681de4516d231370ae603983354d8f Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 18:00:16 2022 +0100 update changelog commit c7984f3299c5c8f56a70d80907d527af458674af Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 17:07:27 2022 +0100 update TROUBLESHOOT.md commit 7f150ed83302ba875c3e0c0f39d8ac0f32c6e362 Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 16:56:58 2022 +0100 remove `:`from headlines in CONTRIBUTORS.md commit badf4e256ce6e3201df1a9a87a7072b36b18d699 Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 16:56:37 2022 +0100 enable navigation tabs Since the docs are growing, this way they look cleaner commit e64c60bbb38fc1620e08ce52bf28bd17003c7ef6 Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 16:18:59 2022 +0100 remove preflight checks from assets seems like somebody executed tests and commited them commit 178061854300632b024810e65922b54b64d95939 Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 16:15:06 2022 +0100 update INSTALLING_MODELS.md commit f91fd276242a0c92b301e99d02982d30f7b712c3 Author: Kyle Schouviller <kyle0654@hotmail.com> Date: Sat Nov 5 14:47:53 2022 -0700 Bug fix for inpaint size commit 09e41e8f769457b9ffd56901aae13991cdc6eeb8 Author: Kyle Schouviller <kyle0654@hotmail.com> Date: Sat Nov 5 14:34:52 2022 -0700 Add inpaint size options to inpaint at a larger size than the actual inpaint image, then scale back down for recombination commit 6eeb2107b300fc27cfe6134b43e5570c246b8e96 Author: mauwii <Mauwii@outlook.de> Date: Sat Nov 5 21:01:14 2022 +0100 remove create-caches.yml since not used anywhere commit 17053ad8b7efecb21a9b4eb32695089f683f72e3 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 5 16:01:55 2022 -0400 fix duplicated argument introduced by conflict resolution commit fefb4dc1f88bc6551a39602a2bc79b278cd83c59 Merge: 762ca60a d05b1b35 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 5 12:47:35 2022 -0700 Merge branch 'development' into fix_generate.py commit d05b1b3544dfa7b3c071ac05b4f014a52e08fa50 Author: Craig <cwallen@users.noreply.github.com> Date: Sat Oct 29 20:40:30 2022 -0400 Resize hires as an image commit 82d4904c07670d514e9a541de7c9ecd8489eeae2 Author: Craig <cwallen@users.noreply.github.com> Date: Sat Oct 29 20:37:40 2022 -0400 Log strength with hires commit 1cdcf33cfa39e90f9660fabf8f5936dcfb6c3aa5 Merge: 6616fa83 cbc029c6 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 5 09:57:38 2022 -0400 Merge branch 'main' into development - this synchronizes recent document fixes by mauwii commit 6616fa835ac4318bf53419f2b54b88c962559578 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 4 00:47:03 2022 -0400 fix Windows library dependency issues This commit addresses two bugs: 1) invokeai.py crashes immediately with a message about an undefined attritube sigKILL (closes #1288). The fix is to pin torch at 1.12.1. 2) Version 1.4.2 of basicsr fails to load properly on Windows, and is a requirement of realesrgan, however 1.4.1 works. Pinning basicsr in our requirements file resulted in a dependency conflict, so I ended up cloning realesrgan into the invoke-ai Git space and changing the requirements file there. If there is a more elegant solution, please advise. commit 7b9a4564b11f4181b9b3c06ecda2a4a25fd1849e Author: Matthias Wild <40327258+mauwii@users.noreply.github.com> Date: Sat Nov 5 14:36:45 2022 +0100 Update-docs (#1382) * update IMG2IMG.md * update INPAINTING.md * update WEBUIHOTKEYS.md * more doc updates (mostly fix formatting): - OUTPAINTING.md - POSTPROCESS.md - PROMPTS.md - VARIATIONS.md - WEB.md - WEBUIHOTKEYS.md commit fcdefa0620761472718afa14b2955a5d0603cfcc Author: Matthias Wild <40327258+mauwii@users.noreply.github.com> Date: Fri Nov 4 20:47:31 2022 +0100 Hotifx docs (#1376) (#1377) commit ef8b3ce639954259a95a38f44fa5329687bee781 Merge: b7042095 36870a8f Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 4 12:08:44 2022 -0400 Merge-main-into-development (#1373) To get the rid of the difference between main and development. Since otherwise it will be a pain to start fixing the documentatino (when the state between main and development is not the same ...) Also this should fix the problem of all tests failing since environment yamls get updated. commit 36870a8f53217d4b733e9bb8b119190b5e36da59 Merge: 6b89adfa b7042095 Author: Matthias Wild <40327258+mauwii@users.noreply.github.com> Date: Fri Nov 4 16:25:00 2022 +0100 Merge branch 'development' into merge-main-into-development commit b70420951d5b70937c0c07e4f8a552a01c3008bc Author: damian0815 <null@damianstewart.com> Date: Thu Nov 3 12:39:45 2022 +0100 fix parsing error doing eg `forest ().swap(in winter)` commit 1f0c5b4cf196716c21f2db74f92c8750ad8f889d Author: wfng92 <43742196+wfng92@users.noreply.github.com> Date: Thu Nov 3 17:13:52 2022 +0800 Use array slicing to calc ddim timesteps commit 8648da811190fc8bcf237d83aff38cf605851300 Author: mauwii <Mauwii@outlook.de> Date: Fri Nov 4 00:06:19 2022 +0100 update environment-linux-aarch64 to use python 3.9 commit 45b459356399f8cfb7e9af571c1643fab04218fe Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 3 22:31:46 2022 +0100 update environment-linux-aarch64.yml - move getpass_asterisk to pip commit 41b04316cf5118ea9518dc77934d135a489dd684 Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 3 20:40:08 2022 +0100 rename job, remove debug branch from triggers commit e97c6db2a3c0157a8a5ab74cd28ebee480a2d078 Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 3 20:34:01 2022 +0100 include build matrix to build x86_64 and aarch64 commit 896820a349292b0e14bbc32f0c557fe8a6b45395 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 05:01:15 2022 +0100 disable caching commit 06c8f468bff7e1dfecc1a1990164be1005b114a7 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 04:26:39 2022 +0100 disable PR-Validation since there are no files passed from context this is unecesarry commit 61920e2701c4a9cea94c03ab933c4482458215b7 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 04:09:39 2022 +0100 update action to use current branch also update build-args of dockerfile and build.sh commit f34ba7ca70f1c417ee97e8b0c57abff57614d78f Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 02:30:24 2022 +0100 remove unecesarry mkdir command again commit c30ef0895dbf0565345ac6ccb136d98a174470a6 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 01:51:12 2022 +0100 remove symlink to GFPGANv1.4 also re-add mkdir to prevent action from failing commit aa3a774f73d5004571ea42fea14cd2b525fffb1c Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 01:48:59 2022 +0100 update build-container.yml to use cachev3 commit 2c30555b844293764123baa4137fcf952d40a4e7 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 01:34:20 2022 +0100 update Dockerfile - create models.yaml from models.yaml.example - run preload_models.py with --no-interactive commit 743f60577364d43237eeb46aefd523371c36e56b Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 01:21:15 2022 +0100 update build.sh to download sd-v1.5 model commit 519c661abbae83aa62b3ee536635c39192890441 Author: mauwii <Mauwii@outlook.de> Date: Tue Oct 25 01:26:50 2022 +0200 replace old fashined markdown templates with forms this will help the readability of issues a lot 🤓 commit 22c956c75f4797ddc2dffa944e3ea84b4eb3477c Merge: 13696adc 0196571a Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 3 10:20:21 2022 -0400 Merge branch 'development' of github.com:invoke-ai/InvokeAI into development commit 13696adc3a3a2b169e68048a5b511660d0430fae Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 3 10:20:10 2022 -0400 speculative change to solve windows esrgan issues commit 0196571a12992eb8207d36e022721fe3ad2cfd19 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 2 22:39:35 2022 -0400 remove merge markers from preload_models.py commit 9666f466ab1c710dfda2e59be9e8a26fcd7e8718 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 2 18:29:34 2022 -0400 use refined model by default commit 240e5486c89552ef480c3443a63283fb86a493c3 Merge: 8164b6b9 aa247e68 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 2 18:35:00 2022 -0400 Merge branch 'spezialspezial-patch-9' into development commit 8164b6b9cff077e4131384195af65e30a40733a7 Merge: 4fc82d55 dd5a88dc Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 2 17:06:46 2022 -0400 Merge branch 'development' of github.com:invoke-ai/InvokeAI into development commit 4fc82d554ff573780c0af562a6bc9586aa56012d Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 04:17:28 2022 +1300 [WebUI] Final 2.1 Release Build commit 96b34c0f85f6ed52707fe43456d20b81822c7d1d Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 09:08:11 2022 +0100 Final WebUI build for Release 2.1 - squashed commit of 52 commits from PR #1327 don't log base64 progress images Fresh Build For WebUI [WebUI] Loopback Default False Fixes bugs/styling - Fixes missing web app state on new version: Adds stateReconciler to redux-persist. When we add more values to the state and then release the update app, they will be automatically merged in. Reseting web UI will be needed far less. 7159ec - Fixes console z-index - Moves reset web UI button to visible area Decreases gallery width on inpainting Increases workarea split padding to 1rem Adds missing tooltips to site header Changes inpainting controls settings to hover Fixes hotkeys and settings buttons not working Improves bounding box interactions - Bounding box can now be moved by dragging any of its edges - Bounding box does not affect drawing if already drawing a stroke - Can lock bounding box to draw directly on the bounding box edges - Removes spacebar-hold behaviour due to technical issues Fixes silent crash when init image too large To send the mask to the server, the UI rendered the mask onto the init image and sent the whole image. The mask was then cropped by the server. If the image was too large, the app silently failed. Maybe it exceeds the websocket size limit. Fixed by cropping the mask in the UI layer, sending only bounding-box-sized mask image data. Disabled bounding box settings when locked Styles image uploader Builds fresh bundle Improves bounding box interaction Added spacebar-hold-to-transform back. Address bounding box feedback - Adds back toggle to hide bounding box - Box quick toggle = q, normal toggle = shift + q - Styles canvas alert icons Adds hints when unable to invoke - Popover on Invoke button indicates why exactly it is disabled, e.g. prompt is empty, something else is processing, etc. - There may be more than one reason; all are displayed. Fix Inpainting Alerts Styling Preventing unnecessary re-renders across the app Code Split Inpaint Options Isolate features to their own components so they dont re-render the other stuff each time. [TESTING] Remove global isReady checking I dont believe this is need at all because the isready state is constantly updated when needed and tracked real time in the Redux store. This causes massive re-renders. @psychedelicious If this is absolutely essential for a reason that I do not see, please hit me up on Discord. Fresh Bundle Fix Bounding Box Settings re-rendering on brush stroke [Code Splitting] Bounding Box Options Isolated all bounding box components to trigger unnecessary re-renders. Still need to fix bounding box triggering re-renders on the control panel inside the canvas itself. But the options panel should be a good to go with this change. Inpainting Controls Code Spitting and Performance Codesplit the entirety of the inpainting controls. Created new selectors for each and every component to ensure there are no unnecessary re-renders. App feels a lot smoother. Fixes rerenders on ClearBrushHistory Fixes crash when requesting post-generation upscale/face restoration - Moves the inpainting paste to before the postprocessing. Removes unused isReady state Changes Report Bug icon to a bug Restores shift+q bounding box shortcut Adds alert for bounding box size to status icons Adds asCheckbox to IAIIconButton Rough draft of this. Not happy with the styling but it's clearer than having them look just like buttons. Fixes crash related to old value of progress_latents in state Styling changes and settings modal minor refactor Fixes: uploaded JPG images not loading Reworks CurrentImageButtons.tsx - Change all icons to FA iconset for consistency - Refactors IAIIconButton, IAIButton, IAIPopover to handle ref forwarding - Redesigns buttons into group Only generate 1 iteration when seed fixed & variations disabled Fixes progress images select Fixes edge case: upload over gets stuck while alt tabbing - Press esc to close it now Fixes display progress images select typing Fixes current image button rerenders Adds min width to ImageUploader Makes fast-latents in progress default Update Icon Button Checkbox Style Styling Fixes next/prev image buttons Refactor canvas buttons + more Add Save Intermediates Step Count For accurate mode only. Co-Authored-By: Richard Macarthy <richardmacarthy@protonmail.com> Restores "initial image" text Address feedback - moves mask clear button - fixes intermediates - shrinks inpainting icons by 10% Fix Loopback Styling Adds escape hotkey to close floating panels Readd Hotkey for Dual Display Updated Current Image Button Styling commit dd5a88dceeec53ceb1722a62e3689ae3dd871154 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 04:17:28 2022 +1300 [WebUI] Final 2.1 Release Build commit 95ed56bf82825a47cfe406fa34eaf4e32c129143 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 04:16:31 2022 +1300 Updated Current Image Button Styling commit 1ae80f5ab9d00a25e0c3a21e2eccd318c5343401 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 04:07:57 2022 +1300 Readd Hotkey for Dual Display commit 1f0bd3ca6cda4221d1a7a46325f235cd23bd0af9 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu Nov 3 02:07:00 2022 +1100 Adds escape hotkey to close floating panels commit a1971f6830306b3d748f7f36c2243f6dee682f97 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 03:38:15 2022 +1300 Fix Loopback Styling commit c6118e889895ba35a191124ce1beb5d2b719366d Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu Nov 3 01:29:51 2022 +1100 Address feedback - moves mask clear button - fixes intermediates - shrinks inpainting icons by 10% commit 7ba958cf7ff4e804a127b71c88666084f81e7340 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu Nov 3 01:10:38 2022 +1100 Restores "initial image" text commit 383905d5d24359aa1824de96ff124a8f8a87e015 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 02:59:11 2022 +1300 Add Save Intermediates Step Count For accurate mode only. Co-Authored-By: Richard Macarthy <richardmacarthy@protonmail.com> commit 6173e3e9cabd5e74fb466d55d7bb6a80a77b3fa8 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu Nov 3 00:53:53 2022 +1100 Refactor canvas buttons + more commit 3feb7d8922b0e4c9f944e96b95211003f40d9705 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu Nov 3 00:49:23 2022 +1100 Fixes next/prev image buttons commit 1d9edbd0ddd6e10cf120fe0de3db0b56ae374db4 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 00:50:44 2022 +1300 Update Icon Button Checkbox Style Styling commit d439abdb89db73e652add9df371234861189d90c Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 21:37:24 2022 +1100 Makes fast-latents in progress default commit ee47ea0c891a33049bdec12f1c254926f341eff2 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 21:37:09 2022 +1100 Adds min width to ImageUploader commit 300bb2e6279c1c477131b9e57425db348062f19c Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 21:28:22 2022 +1100 Fixes current image button rerenders commit ccf8593501d23e00979f7340f8991514e6ca3428 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 21:27:43 2022 +1100 Fixes display progress images select typing commit 0fda612f3ff8ad75932e158b9b29cf64c3f30eb6 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 21:02:01 2022 +1100 Fixes edge case: upload over gets stuck while alt tabbing - Press esc to close it now commit 5afff65b71bb60d067392c120efff1a17adc66af Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 20:33:19 2022 +1100 Fixes progress images select commit 7e55bdefce8920831cac7b9fa857bfbffe9e9d5d Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 20:27:47 2022 +1100 Only generate 1 iteration when seed fixed & variations disabled commit 620cf84d3dd54b8498e84574f33040a26d4d315f Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 19:51:38 2022 +1100 Reworks CurrentImageButtons.tsx - Change all icons to FA iconset for consistency - Refactors IAIIconButton, IAIButton, IAIPopover to handle ref forwarding - Redesigns buttons into group commit cfe567c62ad3fd0cff5e3e579a2250ca5dfa2d53 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 16:14:50 2022 +1100 Fixes: uploaded JPG images not loading commit cefe12f1df72e051f109ed77ce46f18093b3b8bb Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 15:31:18 2022 +1100 Styling changes and settings modal minor refactor commit 1e51c3992853ad4643d8eda2443a3bd0d65f5f90 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 15:27:46 2022 +1100 Fixes crash related to old value of progress_latents in state commit 42a02bbb8087cd46a1b5c795b1b41e38c08ba229 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 13:15:06 2022 +1100 Adds asCheckbox to IAIIconButton Rough draft of this. Not happy with the styling but it's clearer than having them look just like buttons. commit f1ae6dae4c36e74ca8dedf8b57eb8933c059dcf4 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 13:13:56 2022 +1100 Adds alert for bounding box size to status icons commit 6195579910a91fb2ab7e1186aa1c1145566c3122 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 11:52:19 2022 +1100 Restores shift+q bounding box shortcut commit 16c8b23b347792d7811cff66a27d350fe5d0d62c Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 11:32:07 2022 +1100 Changes Report Bug icon to a bug commit 07ae626b22554b5222a3b71d1ce3974e2c3fb284 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 11:17:16 2022 +1100 Removes unused isReady state commit 8d171bb044f578d4b9cc4911edfa05b20a01d373 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 11:13:26 2022 +1100 Fixes crash when requesting post-generation upscale/face restoration - Moves the inpainting paste to before the postprocessing. commit 6e33ca7e9e64fb355430511e28bb08c32c9c68b1 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 10:59:01 2022 +1100 Fixes rerenders on ClearBrushHistory commit db46e12f2b8c98dac8895ea4d04242d3754dbec4 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 11:36:28 2022 +1300 Inpainting Controls Code Spitting and Performance Codesplit the entirety of the inpainting controls. Created new selectors for each and every component to ensure there are no unnecessary re-renders. App feels a lot smoother. commit 868e4b2db82fa8556b423111f2f8d565a70ec129 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 07:40:31 2022 +1300 [Code Splitting] Bounding Box Options Isolated all bounding box components to trigger unnecessary re-renders. Still need to fix bounding box triggering re-renders on the control panel inside the canvas itself. But the options panel should be a good to go with this change. commit 2e562742c13988a1fc299c673a97ba4e4a645aaf Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 06:40:27 2022 +1300 Fix Bounding Box Settings re-rendering on brush stroke commit 68e69580091fc1dc1d8b6e03c9e7ef777c7ebf61 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 06:28:34 2022 +1300 Fresh Bundle commit ea6e3a7949f2743711516261cb7e450517d39702 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 06:26:56 2022 +1300 [TESTING] Remove global isReady checking I dont believe this is need at all because the isready state is constantly updated when needed and tracked real time in the Redux store. This causes massive re-renders. @psychedelicious If this is absolutely essential for a reason that I do not see, please hit me up on Discord. commit b2879ca99f88869277c474185ade049914b0bf26 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 06:08:59 2022 +1300 Code Split Inpaint Options Isolate features to their own components so they dont re-render the other stuff each time. commit 4e911566c33989392eb3279049b15331ca98594a Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 03:50:56 2022 +1300 Preventing unnecessary re-renders across the app commit 9bafda6a152778893df143776ae859a3b8b7f192 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 03:02:35 2022 +1300 Fix Inpainting Alerts Styling commit 871a8a5375cae891f22eb853ffd2d22298298b11 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 23:52:07 2022 +1100 Adds hints when unable to invoke - Popover on Invoke button indicates why exactly it is disabled, e.g. prompt is empty, something else is processing, etc. - There may be more than one reason; all are displayed. commit 0eef74bc00d3c0cedc5037c1deeef1d9a5b6d33d Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 23:40:11 2022 +1100 Address bounding box feedback - Adds back toggle to hide bounding box - Box quick toggle = q, normal toggle = shift + q - Styles canvas alert icons commit 423ae3209782f1d8d321b2ed9ed00712b726adf7 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 17:06:07 2022 +1100 Improves bounding box interaction Added spacebar-hold-to-transform back. commit 8282e5d0458ca1bba5565c069093b5389f2228d4 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 16:57:07 2022 +1100 Builds fresh bundle commit 19305cdbdf6ac74833bd6011bff0ced8e9d36f69 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 16:51:11 2022 +1100 Styles image uploader commit eb9028ab3069bca9d747aca664ca60ae13ba6df8 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 16:51:03 2022 +1100 Disabled bounding box settings when locked commit 21483f5d0731bce5aa97985e722a64bf0d7cd12c Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 16:50:24 2022 +1100 Fixes silent crash when init image too large To send the mask to the server, the UI rendered the mask onto the init image and sent the whole image. The mask was then cropped by the server. If the image was too large, the app silently failed. Maybe it exceeds the websocket size limit. Fixed by cropping the mask in the UI layer, sending only bounding-box-sized mask image data. commit 82dcbac28f140aa7bd89d967bcc7fa31cb03a267 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 16:28:30 2022 +1100 Improves bounding box interactions - Bounding box can now be moved by dragging any of its edges - Bounding box does not affect drawing if already drawing a stroke - Can lock bounding box to draw directly on the bounding box edges - Removes spacebar-hold behaviour due to technical issues commit d43bd4625d64a03d90de0458ad5fcacef211a8a6 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 15:10:49 2022 +1100 Fixes hotkeys and settings buttons not working commit ea891324a2086faf8eeeeac7eaf47ae2935322fb Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 11:04:02 2022 +1100 Changes inpainting controls settings to hover commit 8fd9ea219390493f392e690eadb23c4209a4ecfc Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 11:03:41 2022 +1100 Adds missing tooltips to site header commit fb026668563b3179805819a1630c654c9ce260d9 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 11:03:25 2022 +1100 Increases workarea split padding to 1rem commit f6f5c2731b0c37089c5d7382736f973e857df712 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 11:03:10 2022 +1100 Decreases gallery width on inpainting commit b4e3f771e0314e0a18ad5cedc80b28f246fced59 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 10:54:59 2022 +1100 Fixes bugs/styling - Fixes missing web app state on new version: Adds stateReconciler to redux-persist. When we add more values to the state and then release the update app, they will be automatically merged in. Reseting web UI will be needed far less. 7159ec - Fixes console z-index - Moves reset web UI button to visible area commit 99bb9491ac97f1f733accab839ea38cdf4870ba0 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Tue Nov 1 08:35:45 2022 +1300 [WebUI] Loopback Default False commit 0453f211278a533a49fb1aee54dd989b69179c10 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 23:23:51 2022 +1300 Fresh Build For WebUI commit 9fc09aa4bda3b3e6139b026f24733a37747d373f Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 09:08:11 2022 +0100 don't log base64 progress images commit 5e87062cf809a08242d3b006b66d3bbb834ddb16 Author: spezialspezial <75758219+spezialspezial@users.noreply.github.com> Date: Wed Nov 2 00:21:27 2022 +0100 Option to directly invert the grayscale heatmap - fix commit 3e7a459990407ad1679f38d4027c19d50a9d36e3 Author: spezialspezial <75758219+spezialspezial@users.noreply.github.com> Date: Tue Nov 1 21:37:33 2022 +0100 Update txt2mask.py commit bbf4c03e500bafc8627c2a70f8b3396efeddabb3 Author: spezialspezial <75758219+spezialspezial@users.noreply.github.com> Date: Tue Nov 1 21:11:19 2022 +0100 Option to directly invert the grayscale heatmap Theoretically less work inverting the image while it's small but I can't measure a significant difference. Though, handy option to have in some cases. commit 611a3a975328a7e276c2781214d5e14108708ed7 Author: mauwii <Mauwii@outlook.de> Date: Wed Nov 2 02:23:09 2022 +0100 fix name of caching step commit 1611f0d1815022fe90d33f41c21d670251a75f29 Author: mauwii <Mauwii@outlook.de> Date: Wed Nov 2 02:18:46 2022 +0100 readd caching of sd-models - this would remove the necesarrity of the secret availability in PRs commit 08835115e4c5c0ee3587ce07ab769a04d55cb3c5 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 22:10:12 2022 -0400 pin pytorch_lightning to 1.7.7, issue #1331 commit 2d84e28d329be282b51a4cbc22f7c200d80c8f0e Merge: 533fd04e ef17aae8 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 22:11:04 2022 -0400 Merge branch 'development' of github.com:invoke-ai/InvokeAI into development commit ef17aae8abe03fd87dc6f91b3c6d2fe03375f6c5 Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 00:39:48 2022 +0100 add damian0815 to contributors list commit 0cc39f01a3c67f32873b7888e1e032d33626e269 Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 01:18:50 2022 +0100 report full size for fast latents and update conversion matrix for v1.5 commit 688d7258f185035a5924bee23322b001574da931 Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 00:33:00 2022 +0100 fix a bug that broke cross attention control index mapping commit 4513320bf161d3efdd99e2aef4f7c37472131373 Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 00:31:58 2022 +0100 save VRAM by not recombining tensors that have been sliced to save VRAM commit 533fd04ef0d1ba9d2cb25d556991b999e7d44aba Merge: 6215592b dff5681c Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 17:40:36 2022 -0400 Merge branch 'development' of github.com:invoke-ai/InvokeAI into development commit dff5681cf0e24faf67d5eb5903203c4ea39f89bd Author: damian0815 <d@d.com> Date: Tue Nov 1 13:56:03 2022 +0100 shorter strings commit 5a2790a69b11e049d2507bc22eab7812915d867f Author: damian0815 <d@d.com> Date: Tue Nov 1 13:19:20 2022 +0100 convert progress display to a drop-down commit 7c5305ccbaf7926162536aa3a9e51dcdd8574d0d Author: damian0815 <d@d.com> Date: Tue Nov 1 12:54:46 2022 +0100 do not try to save base64 intermediates in gallery on cancellation commit 4013e8ad6fa5e5c2a710c607fe7e1d040f353299 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 21:54:35 2022 +1100 Fixes b64 image sending and displaying commit d1dfd257f9e1cafd352d9007a56194226b9d6b63 Author: damian <d@d.com> Date: Tue Nov 1 11:40:40 2022 +0100 wip base64 commit 5322d735ee4515d89293b7fb015b2ce048262f68 Author: damian <d@d.com> Date: Tue Nov 1 11:31:42 2022 +0100 update frontend commit cdb107dcda858a8bb64455cc60a196a42345f8f7 Author: damian <d@d.com> Date: Tue Nov 1 11:17:43 2022 +0100 add option to show intermediate latent space commit be1393a41ce7a75ed8de7f648a93c5e5974a50d2 Author: damian <d@d.com> Date: Tue Nov 1 10:16:55 2022 +0100 ensure existing exception handling code also handles new exception class commit e554c2607f00a5e51c03052acb9861ff21ec1c12 Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Tue Nov 1 10:08:42 2022 +0100 Rebuilt prompt parsing logic Complete re-write of the prompt parsing logic to be more readable and logical, and therefore also hopefully easier to debug, maintain, and augment. In the process it has also become more robust to badly-formed prompts. Squashed commit of the following: commit 8fcfa88a16e1390d41717e940d72aed64712171c Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Sun Oct 30 17:05:57 2022 +0100 further cleanup commit 1a1fd78bcfeb49d072e3e6d5808aa8df15441629 Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Sun Oct 30 16:07:57 2022 +0100 cleanup and document commit 099c9659fa8b8135876f9a5a50fe80b20bc0635c Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Sun Oct 30 15:54:58 2022 +0100 works fully commit 5e6887ea8c25a1e21438ff6defb381fd027d25fd Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Sun Oct 30 15:24:31 2022 +0100 further... commit 492fda120844d9bc1ad4ec7dd408a3374762d0ff Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Sun Oct 30 14:08:57 2022 +0100 getting there... commit c6aab05a8450cc3c95c8691daf38fdc64c74f52d Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Fri Oct 28 14:29:03 2022 +0200 wip doesn't compile commit 5e533f731cfd20cd435330eeb0012e5689e87e81 Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Fri Oct 28 13:21:43 2022 +0200 working with CrossAttentionCtonrol but no Attention support yet commit 9678348773431e500e110e8aede99086bb7b5955 Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Fri Oct 28 13:04:52 2022 +0200 wip rebuiling prompt parser commit 6215592b12dea3822c727913b771012789a52477 Merge: ef24d76a 349cc254 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 17:34:55 2022 -0400 Merge branch 'development' of github.com:invoke-ai/InvokeAI into development commit 349cc25433e1d358c6c61cca4a6c300ecc8ca3d7 Author: damian0815 <d@d.com> Date: Tue Nov 1 20:08:52 2022 +0100 fix crash (be a little less aggressive clearing out the attention slice) commit 214d276379387ae0fa2259602ab00884ec1ad03e Author: damian0815 <d@d.com> Date: Tue Nov 1 19:57:55 2022 +0100 be more aggressive at clearing out saved_attn_slice commit ef24d76adc5a192297714707cd6794d4f44bcf67 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 14:34:23 2022 -0400 fix library problems in preload_modules commit ab2b5a691dadb292f7cecf5db94a165db3e3e126 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 17:22:48 2022 -0400 fix model_cache memory management issues commit c7de2b2801ad5d6ce52a5f44e88c5705f1dbf524 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 02:02:14 2022 +0100 disable checks with sd-V1.4 model... ...to save some resources, since V1.5 is the default now commit e8075658acf675346d35435d0cfb7710becab42a Author: mauwii <Mauwii@outlook.de> Date: Mon Oct 31 22:20:51 2022 +0100 update test-invoke-conda.yml - fix model dl path for sd-v1-4.ckpt - copy configs/models.yaml.example to configs/models.yaml commit 4202dabee1143f597f4c3946420fbfa7b8eccddf Author: mauwii <Mauwii@outlook.de> Date: Mon Oct 31 22:17:21 2022 +0100 fix models example weights for sd-v1.4 commit d67db2bcf1ac26d8bb7c5f8bfd056f2172597780 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Tue Nov 1 08:35:45 2022 +1300 [WebUI] Loopback Default False commit 7159ec885faa1117a3506689d547618be1d91808 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Mon Oct 31 11:33:05 2022 -0400 further improvements to preload_models.py - Faster startup for command line switch processing - Specify configuration file to modify using --config option: ./scripts/preload_models.ply --config models/my-models-file.yaml commit b5cf734ba9f1aeaab14075b55cc13ed9a0ae31e2 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Mon Oct 31 11:08:19 2022 -0400 improve behavior of preload_models.py - NEVER overwrite user's existing models.yaml - Instead, merge its contents into new config file, and rename original to models.yaml.orig (with message) - models.yaml has been removed from repository and renamed models.yaml.example commit f7dc8eafeef991e135b5541c01d0ff740dda9591 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Mon Oct 31 10:47:35 2022 -0400 restore models.yaml to virgin state commit 762ca60a309f70daaf1b9e79b6273f76fd9474b6 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Oct 4 22:55:10 2022 -0400 Update INPAINTING.md commit e7fb9f342cb5ed0c09e6215026d60d45eef3ebcb Author: Hideyuki Katsushiro <h.katsushiro@qualia.tokyo.jp> Date: Wed Oct 5 10:08:53 2022 +0900 add argument --outdir
2022-11-12 17:17:07 +00:00
outdir = outdir or self.outdir
self.seed = seed
Refactoring simplet2i (#387) * start refactoring -not yet functional * first phase of refactor done - not sure weighted prompts working * Second phase of refactoring. Everything mostly working. * The refactoring has moved all the hard-core inference work into ldm.dream.generator.*, where there are submodules for txt2img and img2img. inpaint will go in there as well. * Some additional refactoring will be done soon, but relatively minor work. * fix -save_orig flag to actually work * add @neonsecret attention.py memory optimization * remove unneeded imports * move token logging into conditioning.py * add placeholder version of inpaint; porting in progress * fix crash in img2img * inpainting working; not tested on variations * fix crashes in img2img * ported attention.py memory optimization #117 from basujindal branch * added @torch_no_grad() decorators to img2img, txt2img, inpaint closures * Final commit prior to PR against development * fixup crash when generating intermediate images in web UI * rename ldm.simplet2i to ldm.generate * add backward-compatibility simplet2i shell with deprecation warning * add back in mps exception, addresses @vargol comment in #354 * replaced Conditioning class with exported functions * fix wrong type of with_variations attribute during intialization * changed "image_iterator()" to "get_make_image()" * raise NotImplementedError for calling get_make_image() in parent class * Update ldm/generate.py better error message Co-authored-by: Kevin Gibbons <bakkot@gmail.com> * minor stylistic fixes and assertion checks from code review * moved get_noise() method into img2img class * break get_noise() into two methods, one for txt2img and the other for img2img * inpainting works on non-square images now * make get_noise() an abstract method in base class * much improved inpainting Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
2022-09-06 00:40:10 +00:00
self.log_tokenization = log_tokenization
self.step_callback = step_callback
self.karras_max = karras_max
self.infill_method = infill_method or infill_methods()[0], # The infill method to use
Refactoring simplet2i (#387) * start refactoring -not yet functional * first phase of refactor done - not sure weighted prompts working * Second phase of refactoring. Everything mostly working. * The refactoring has moved all the hard-core inference work into ldm.dream.generator.*, where there are submodules for txt2img and img2img. inpaint will go in there as well. * Some additional refactoring will be done soon, but relatively minor work. * fix -save_orig flag to actually work * add @neonsecret attention.py memory optimization * remove unneeded imports * move token logging into conditioning.py * add placeholder version of inpaint; porting in progress * fix crash in img2img * inpainting working; not tested on variations * fix crashes in img2img * ported attention.py memory optimization #117 from basujindal branch * added @torch_no_grad() decorators to img2img, txt2img, inpaint closures * Final commit prior to PR against development * fixup crash when generating intermediate images in web UI * rename ldm.simplet2i to ldm.generate * add backward-compatibility simplet2i shell with deprecation warning * add back in mps exception, addresses @vargol comment in #354 * replaced Conditioning class with exported functions * fix wrong type of with_variations attribute during intialization * changed "image_iterator()" to "get_make_image()" * raise NotImplementedError for calling get_make_image() in parent class * Update ldm/generate.py better error message Co-authored-by: Kevin Gibbons <bakkot@gmail.com> * minor stylistic fixes and assertion checks from code review * moved get_noise() method into img2img class * break get_noise() into two methods, one for txt2img and the other for img2img * inpainting works on non-square images now * make get_noise() an abstract method in base class * much improved inpainting Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
2022-09-06 00:40:10 +00:00
with_variations = [] if with_variations is None else with_variations
# will instantiate the model or return it from cache
enable fast switching between models in invoke.py - This PR enables two new commands in the invoke.py script !models -- list the available models and their cache status !switch <model> -- switch to the indicated model Example: invoke> !models laion400m not loaded Latent Diffusion LAION400M model stable-diffusion-1.4 active Stable Diffusion inference model version 1.4 waifu-1.3 cached Waifu anime model version 1.3 invoke> !switch waifu-1.3 >> Caching model stable-diffusion-1.4 in system RAM >> Retrieving model waifu-1.3 from system RAM cache The name and descriptions of the models are taken from `config/models.yaml`. A future enhancement to `model_cache.py` will be to enable new model stanzas to be added to the file programmatically. This will be useful for the WebGUI. More details: - Use fast switching algorithm described in PR #948 - Models are selected using their configuration stanza name given in models.yaml. - To avoid filling up CPU RAM with cached models, this PR implements an LRU cache that monitors available CPU RAM. - The caching code allows the minimum value of available RAM to be adjusted, but invoke.py does not currently have a command-line argument that allows you to set it. The minimum free RAM is arbitrarily set to 2 GB. - Add optional description field to configs/models.yaml Unrelated fixes: - Added ">>" to CompViz model loading messages in order to make user experience more consistent. - When generating an image greater than defaults, will only warn about possible VRAM filling the first time. - Fixed bug that was causing help message to be printed twice. This involved moving the import line for the web backend into the section where it is called. Coauthored by: @ArDiouscuros
2022-10-12 06:14:59 +00:00
model = self.set_model(self.model_name)
# self.width and self.height are set by set_model()
# to the width and height of the image training set
width = width or self.width
height = height or self.height
use 🧨diffusers model (#1583) * initial commit of DiffusionPipeline class * spike: proof of concept using diffusers for txt2img * doc: type hints for Generator * refactor(model_cache): factor out load_ckpt * model_cache: add ability to load a diffusers model pipeline and update associated things in Generate & Generator to not instantly fail when that happens * model_cache: fix model default image dimensions * txt2img: support switching diffusers schedulers * diffusers: let the scheduler do its scaling of the initial latents Remove IPNDM scheduler; it is not behaving. * web server: update image_progress callback for diffusers data * diffusers: restore prompt weighting feature * diffusers: fix set-sampler error following model switch * diffusers: use InvokeAIDiffuserComponent for conditioning * cross_attention_control: stub (no-op) implementations for diffusers * model_cache: let offload_model work with DiffusionPipeline, sorta. * models.yaml.example: add diffusers-format model, set as default * test-invoke-conda: use diffusers-format model test-invoke-conda: put huggingface-token where the library can use it * environment-mac: upgrade to diffusers 0.7 (from 0.6) this was already done for linux; mac must have been lost in the merge. * preload_models: explicitly load diffusers models In non-interactive mode too, as long as you're logged in. * fix(model_cache): don't check `model.config` in diffusers format clean-up from recent merge. * diffusers integration: support img2img * dev: upgrade to diffusers 0.8 (from 0.7.1) We get to remove some code by using methods that were factored out in the base class. * refactor: remove backported img2img.get_timesteps now that we can use it directly from diffusers 0.8.1 * ci: use diffusers model * dev: upgrade to diffusers 0.9 (from 0.8.1) * lint: correct annotations for Python 3.9. * lint: correct AttributeError.name reference for Python 3.9. * CI: prefer diffusers-1.4 because it no longer requires a token The RunwayML models still do. * build: there's yet another place to update requirements? * configure: try to download models even without token Models in the CompVis and stabilityai repos no longer require them. (But runwayml still does.) * configure: add troubleshooting info for config-not-found * fix(configure): prepend root to config path * fix(configure): remove second `default: true` from models example * CI: simplify test-on-push logic now that we don't need secrets The "test on push but only in forks" logic was only necessary when tests didn't work for PRs-from-forks. * create an embedding_manager for diffusers * internal: avoid importing diffusers DummyObject see https://github.com/huggingface/diffusers/issues/1479 * fix "config attributes…not expected" diffusers warnings. * fix deprecated scheduler construction * work around an apparent MPS torch bug that causes conditioning to have no effect * 🚧 post-rebase repair * preliminary support for outpainting (no masking yet) * monkey-patch diffusers.attention and use Invoke lowvram code * add always_use_cpu arg to bypass MPS * add cross-attention control support to diffusers (fails on MPS) For unknown reasons MPS produces garbage output with .swap(). Use --always_use_cpu arg to invoke.py for now to test this code on MPS. * diffusers support for the inpainting model * fix debug_image to not crash with non-RGB images. * inpainting for the normal model [WIP] This seems to be performing well until the LAST STEP, at which point it dissolves to confetti. * fix off-by-one bug in cross-attention-control (#1774) prompt token sequences begin with a "beginning-of-sequence" marker <bos> and end with a repeated "end-of-sequence" marker <eos> - to make a default prompt length of <bos> + 75 prompt tokens + <eos>. the .swap() code was failing to take the column for <bos> at index 0 into account. the changes here do that, and also add extra handling for a single <eos> (which may be redundant but which is included for completeness). based on my understanding and some assumptions about how this all works, the reason .swap() nevertheless seemed to do the right thing, to some extent, is because over multiple steps the conditioning process in Stable Diffusion operates as a feedback loop. a change to token n-1 has flow-on effects to how the [1x4x64x64] latent tensor is modified by all the tokens after it, - and as the next step is processed, all the tokens before it as well. intuitively, a token's conditioning effects "echo" throughout the whole length of the prompt. so even though the token at n-1 was being edited when what the user actually wanted was to edit the token at n, it nevertheless still had some non-negligible effect, in roughly the right direction, often enough that it seemed like it was working properly. * refactor common CrossAttention stuff into a mixin so that the old ldm code can still work if necessary * inpainting for the normal model. I think it works this time. * diffusers: reset num_vectors_per_token sync with 44a00555718f1df173c60da0ed646cf700e29537 * diffusers: txt2img2img (hires_fix) with so much slicing and dicing of pipeline methods to stitch them together * refactor(diffusers): reduce some code duplication amongst the different tasks * fixup! refactor(diffusers): reduce some code duplication amongst the different tasks * diffusers: enable DPMSolver++ scheduler * diffusers: upgrade to diffusers 0.10, add Heun scheduler * diffusers(ModelCache): stopgap to make from_cpu compatible with diffusers * CI: default to diffusers-1.5 now that runwayml token requirement is gone * diffusers: update to 0.10 (and transformers to 4.25) * diffusers: use xformers when available diffusers no longer auto-enables this as of 0.10.2. * diffusers: make masked img2img behave better with multi-step schedulers re-randomizing the noise each step was confusing them. * diffusers: work more better with more models. fixed relative path problem with local models. fixed models on hub not always having a `fp16` branch. * diffusers: stopgap fix for attention_maps_callback crash after recent merge * fixup import merge conflicts correction for 061c5369a2247c6c92cd69606bcf54c4f1962a0b * test: add tests/inpainting inputs for masked img2img * diffusers(AddsMaskedGuidance): partial fix for k-schedulers Prevents them from crashing, but results are still hot garbage. * fix --safety_checker arg parsing and add note to diffusers loader about where safety checker gets called * generate: fix import error * CI: don't try to read the old init location * diffusers: support loading an alternate VAE * CI: remove sh-syntax if-statement so it doesn't crash powershell * CI: fold strings in yaml because backslash is not line-continuation in powershell * attention maps callback stuff for diffusers * build: fix syntax error in environment-mac * diffusers: add INITIAL_MODELS with diffusers-compatible repos * re-enable the embedding manager; closes #1778 * Squashed commit of the following: commit e4a956abc37fcb5cf188388b76b617bc5c8fda7d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:43:07 2022 +0100 import new load handling from EmbeddingManager and cleanup commit c4abe91a5ba0d415b45bf734068385668b7a66e6 Merge: 032e856e 1efc6397 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:09:53 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers_with_textual_inversion_manager commit 032e856eefb3bbc39534f5daafd25764bcfcef8b Merge: 8b4f0fe9 bc515e24 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:08:01 2022 +0100 Merge remote-tracking branch 'upstream/dev/diffusers' into dev/diffusers_with_textual_inversion_manager commit 1efc6397fc6e61c1aff4b0258b93089d61de5955 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:04:28 2022 +0100 cleanup and add performance notes commit e400f804ac471a0ca2ba432fd658778b20c7bdab Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:45:07 2022 +0100 fix bug and update unit tests commit deb9ae0ae1016750e93ce8275734061f7285a231 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:28:29 2022 +0100 textual inversion manager seems to work commit 162e02505dec777e91a983c4d0fb52e950d25ff0 Merge: cbad4583 12769b3d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:58:03 2022 +0100 Merge branch 'main' into feature_textual_inversion_mgr commit cbad45836c6aace6871a90f2621a953f49433131 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:54:10 2022 +0100 use position embeddings commit 070344c69b0e0db340a183857d0a787b348681d3 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:53:47 2022 +0100 Don't crash CLI on exceptions commit b035ac8c6772dfd9ba41b8eeb9103181cda028f8 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:11:55 2022 +0100 add missing position_embeddings commit 12769b3d3562ef71e0f54946b532ad077e10043c Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:33:25 2022 +0100 debugging why it don't work commit bafb7215eabe1515ca5e8388fd3bb2f3ac5362cf Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:21:33 2022 +0100 debugging why it don't work commit 664a6e9e146b42d96703f0cc8baf8f5efec04ee1 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit 8b4f0fe9d6e4e2643b36dfa27864294785d7ba4e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit ffbe1ab11163ba712e353d89404e301d0e0c6cdf Merge: 6e4dad60 023df37e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:37:31 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers commit 023df37efffa67434f77def7fc3c9dfb29f699fd Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:36:54 2022 +0100 cleanup commit 05fac594eaf79d0058e3c48deee93df603f136c2 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:07:49 2022 +0100 tweak error checking commit 009f32ed39a7280997c3ffab112adadee0b44279 Author: damian <null@damianstewart.com> Date: Thu Dec 15 21:29:47 2022 +0100 unit tests passing for embeddings with vector length >1 commit beb1b08d9a98112ed2fe073580568e1a18698da3 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:39:09 2022 +0100 more explicit equality tests when overwriting commit 44d8a5a7c85cdabc9ce3a54fd0769a10597b3ca9 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:30:13 2022 +0100 wip textual inversion manager (unit tests passing for 1v embedding overwriting) commit 417c2b57d90924a839616bfb66804faab8039e4c Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 12:30:55 2022 +0100 wip textual inversion manager (unit tests passing for base stuff + padding) commit 2e80872e3b6f7fd7d8eb8928822bd824b63cb2ff Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 10:57:57 2022 +0100 wip new TextualInversionManager * stop using WeightedFrozenCLIPEmbedder * store diffusion models locally - configure_invokeai.py reconfigured to store diffusion models rather than CompVis models - hugging face caching model is used, but cache is set to ~/invokeai/models/repo_id - models.yaml does **NOT** use path, just repo_id - "repo_name" changed to "repo_id" to following hugging face conventions - Models are loaded with full precision pending further work. * allow non-local files during development * path takes priority over repo_id * MVP for model_cache and configure_invokeai - Feature complete (almost) - configure_invokeai.py downloads both .ckpt and diffuser models, along with their VAEs. Both types of download are controlled by a unified INITIAL_MODELS.yaml file. - model_cache can load both type of model and switches back and forth in CPU. No memory leaks detected TO DO: 1. I have not yet turned on the LocalOnly flag for diffuser models, so the code will check the Hugging Face repo for updates before using the locally cached models. This will break firewalled systems. I am thinking of putting in a global check for internet connectivity at startup time and setting the LocalOnly flag based on this. It would be good to check updates if there is connectivity. 2. I have not gone completely through INITIAL_MODELS.yaml to check which models are available as diffusers and which are not. So models like PaperCut and VoxelArt may not load properly. The runway and stability models are checked, as well as the Trinart models. 3. Add stanzas for SD 2.0 and 2.1 in INITIAL_MODELS.yaml REMAINING PROBLEMS NOT DIRECTLY RELATED TO MODEL_CACHE: 1. When loading a .ckpt file there are lots of messages like this: Warning! ldm.modules.attention.CrossAttention is no longer being maintained. Please use InvokeAICrossAttention instead. I'm not sure how to address this. 2. The ckpt models ***don't actually run*** due to the lack of special-case support for them in the generator objects. For example, here's the hard crash you get when you run txt2img against the legacy waifu-diffusion-1.3 model: ``` >> An error occurred: Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 140, in main main_loop(gen, opt) File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 371, in main_loop gen.prompt2image( File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1265, in __getattr__ raise AttributeError("'{}' object has no attribute '{}'".format( AttributeError: 'LatentDiffusion' object has no attribute 'image_from_embeddings' ``` 3. The inpainting diffusion model isn't working. Here's the output of "banana sushi" when inpainting-1.5 is loaded: ``` Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 301, in image_from_embeddings result_latents, result_attention_map_saver = self.latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 330, in latents_from_embeddings result: PipelineIntermediateState = infer_latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 185, in __call__ for result in self.generator_method(*args, **kwargs): File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 367, in generate_latents_from_embeddings step_output = self.step(batched_t, latents, guidance_scale, File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context return func(*args, **kwargs) File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 409, in step step_output = self.scheduler.step(noise_pred, timestep, latents, **extra_step_kwargs) File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/diffusers/schedulers/scheduling_lms_discrete.py", line 223, in step pred_original_sample = sample - sigma * model_output RuntimeError: The size of tensor a (9) must match the size of tensor b (4) at non-singleton dimension 1 ``` * proper support for float32/float16 - configure script now correctly detects user's preference for fp16/32 and downloads the correct diffuser version. If fp16 version not available, falls back to fp32 version. - misc code cleanup and simplification in model_cache * add on-the-fly conversion of .ckpt to diffusers models 1. On-the-fly conversion code can be found in the file ldm/invoke/ckpt_to_diffusers.py. 2. A new !optimize command has been added to the CLI. Should be ported to Web GUI. User experience on the CLI is this: ``` invoke> !optimize /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt INFO: Converting legacy weights file /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt to optimized diffuser model. This operation will take 30-60s to complete. Success. Optimized model is now located at /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 Writing new config file entry for sd-v1-4... >> New configuration: sd-v1-4: description: Optimized version of sd-v1-4 format: diffusers path: /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 OK to import [n]? y >> Verifying that new model loads... >> Current VRAM usage: 2.60G >> Offloading stable-diffusion-2.1 to CPU >> Loading diffusers model from /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 | Using faster float16 precision You have disabled the safety checker for <class 'ldm.invoke.generator.diffusers_pipeline.StableDiffusionGeneratorPipeline'> by passing `safety_checker=None`. Ensure that you abide to the conditions of the Stable Diffusion \ license and do not expose unfiltered results in services or applications open to the public. Both the diffusers team and Hugging Face strongly recommend to keep the safety filter enabled in all public facing circumstances,\ disabling it only for use-cases that involve analyzing network behavior or auditing its results. For more information, please have a look at https://github.com/huggingface/diffusers/pull/254 . | training width x height = (512 x 512) >> Model loaded in 3.48s >> Max VRAM used to load the model: 2.17G >> Current VRAM usage:2.17G >> Textual inversions available: >> Setting Sampler to k_lms (LMSDiscreteScheduler) Keep model loaded? [y] ``` * add parallel set of generator files for ckpt legacy generation * generation using legacy ckpt models now working * diffusers: fix missing attention_maps_callback fix for 23eb80b40421b2bb8f4b6d3dd30490d11c447b36 * associate legacy CrossAttention with .ckpt models * enable autoconvert New --autoconvert CLI option will scan a designated directory for new .ckpt files, convert them into diffuser models, and import them into models.yaml. Works like this: invoke.py --autoconvert /path/to/weights/directory In ModelCache added two new methods: autoconvert_weights(config_path, weights_directory_path, models_directory_path) convert_and_import(ckpt_path, diffuser_path) * diffusers: update to diffusers 0.11 (from 0.10.2) * fix vae loading & width/height calculation * refactor: encapsulate these conditioning data into one container * diffusers: fix some noise-scaling issues by pushing the noise-mixing down to the common function * add support for safetensors and accelerate * set local_files_only when internet unreachable * diffusers: fix error-handling path when model repo has no fp16 branch * fix generatorinpaint error Fixes : "ModuleNotFoundError: No module named 'ldm.invoke.generatorinpaint' https://github.com/invoke-ai/InvokeAI/pull/1583#issuecomment-1363634318 * quench diffuser safety-checker warning * diffusers: support stochastic DDIM eta parameter * fix conda env creation on macos * fix cross-attention with diffusers 0.11 * diffusers: the VAE needs to be tiling as well as the U-Net * diffusers: comment on subfolders * diffusers: embiggen! * diffusers: make model_cache.list_models serializable * diffusers(inpaint): restore scaling functionality * fix requirements clash between numba and numpy 1.24 * diffusers: allow inpainting model to do non-inpainting tasks * start expanding model_cache functionality * add import_ckpt_model() and import_diffuser_model() methods to model_manager - in addition, model_cache.py is now renamed to model_manager.py * allow "recommended" flag to be optional in INITIAL_MODELS.yaml * configure_invokeai now downloads VAE diffusers in advance * rename ModelCache to ModelManager * remove support for `repo_name` in models.yaml * check for and refuse to load embeddings trained on incompatible models * models.yaml.example: s/repo_name/repo_id and remove extra INITIAL_MODELS now that the main one has diffusers models in it. * add MVP textual inversion script * refactor(InvokeAIDiffuserComponent): factor out _combine() * InvokeAIDiffuserComponent: implement threshold * InvokeAIDiffuserComponent: diagnostic logs for threshold ...this does not look right * add a curses-based frontend to textual inversion - not quite working yet - requires npyscreen installed - on windows will also have the windows-curses requirement, but not added to requirements yet * add curses-based interface for textual inversion * fix crash in convert_and_import() - This corrects a "local variable referenced before assignment" error in model_manager.convert_and_import() * potential workaround for no 'state_dict' key error - As reported in https://github.com/huggingface/diffusers/issues/1876 * create TI output dir if needed * Update environment-lin-cuda.yml (#2159) Fixing line 42 to be the proper order to define the transformers requirement: ~= instead of =~ * diffusers: update sampler-to-scheduler mapping based on https://github.com/huggingface/diffusers/issues/277#issuecomment-1371428672 * improve user exp for ckt to diffusers conversion - !optimize_models command now operates on an existing ckpt file entry in models.yaml - replaces existing entry, rather than adding a new one - offers to delete the ckpt file after conversion * web: adapt progress callback to deal with old generator or new diffusers pipeline * clean-up model_manager code - add_model() verified to work for .ckpt local paths, .ckpt remote URLs, diffusers local paths, and diffusers repo_ids - convert_and_import() verified to work for local and remove .ckpt files * handle edge cases for import_model() and convert_model() * add support for safetensor .ckpt files * fix name error * code cleanup with pyflake * improve model setting behavior - If the user enters an invalid model name at startup time, will not try to load it, warn, and use default model - CLI UI enhancement: include currently active model in the command line prompt. * update test-invoke-pip.yml - fix model cache path to point to runwayml/stable-diffusion-v1-5 - remove `skip-sd-weights` from configure_invokeai.py args * exclude dev/diffusers from "fail for draft PRs" * disable "fail on PR jobs" * re-add `--skip-sd-weights` since no space * update workflow environments - include `INVOKE_MODEL_RECONFIGURE: '--yes'` * clean up model load failure handling - Allow CLI to run even when no model is defined or loadable. - Inhibit stack trace when model load fails - only show last error - Give user *option* to run configure_invokeai.py when no models successfully load. - Restart invokeai after reconfiguration. * further edge-case handling 1) only one model in models.yaml file, and that model is broken 2) no models in models.yaml 3) models.yaml doesn't exist at all * fix incorrect model status listing - "cached" was not being returned from list_models() - normalize handling of exceptions during model loading: - Passing an invalid model name to generate.set_model() will return a KeyError - All other exceptions are returned as the appropriate Exception * CI: do download weights (if not already cached) * diffusers: fix scheduler loading in offline mode * CI: fix model name (no longer has `diffusers-` prefix) * Update txt2img2img.py (#2256) * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * feat - make model storage compatible with hugging face caching system This commit alters the InvokeAI model directory to be compatible with hugging face, making it easier to share diffusers (and other models) across different programs. - If the HF_HOME environment variable is not set, then models are cached in ~/invokeai/models in a format that is identical to the HuggingFace cache. - If HF_HOME is set, then models are cached wherever HF_HOME points. - To enable sharing with other HuggingFace library clients, set HF_HOME to ~/.cache/huggingface to set the default cache location or to ~/invokeai/models to have huggingface cache inside InvokeAI. * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * fix error "no attribute CkptInpaint" * model_manager.list_models() returns entire model config stanza+status * Initial Draft - Model Manager Diffusers * added hash function to diffusers * implement sha256 hashes on diffusers models * Add Model Manager Support for Diffusers * fix various problems with model manager - in cli import functions, fix not enough values to unpack from _get_name_and_desc() - fix crash when using old-style vae: value with new-style diffuser * rebuild frontend * fix dictconfig-not-serializable issue * fix NoneType' object is not subscriptable crash in model_manager * fix "str has no attribute get" error in model_manager list_models() * Add path and repo_id support for Diffusers Model Manager Also fixes bugs * Fix tooltip IT localization not working * Add Version Number To WebUI * Optimize Model Search * Fix incorrect font on the Model Manager UI * Fix image degradation on merge fixes - [Experimental] This change should effectively fix a couple of things. - Fix image degradation on subsequent merges of the canvas layers. - Fix the slight transparent border that is left behind when filling the bounding box with a color. - Fix the left over line of color when filling a bounding box with color. So far there are no side effects for this. If any, please report. * Add local model filtering for Diffusers / Checkpoints * Go to home on modal close for the Add Modal UI * Styling Fixes * Model Manager Diffusers Localization Update * Add Safe Tensor scanning to Model Manager * Fix model edit form dispatching string values instead of numbers. * Resolve VAE handling / edge cases for supplied repos * defer injecting tokens for textual inversions until they're used for the first time * squash a console warning * implement model migration check * add_model() overwrites previous config rather than merges * fix model config file attribute merging * fix precision handling in textual inversion script * allow ckpt conversion script to work with safetensors .ckpts Applied patch here: https://github.com/huggingface/diffusers/commit/beb932c5d111872c5e45387e7b1b2b3dd0524a47 * fix name "args" is not defined crash in textual_inversion_training * fix a second NameError: name 'args' is not defined crash * fix loading of the safety checker from the global cache dir * add installation step to textual inversion frontend - After a successful training run, the script will copy learned_embeds.bin to a subfolder of the embeddings directory. - User given the option to delete the logs and intermediate checkpoints (which together use 7-8G of space) - If textual inversion training fails, reports the error gracefully. * don't crash out on incompatible embeddings - put try: blocks around places where the system tries to load an embedding which is incompatible with the currently loaded model * add support for checkpoint resuming * textual inversion preferences are saved and restored between sessions - Preferences are stored in a file named text-inversion-training/preferences.conf - Currently the resume-from-checkpoint option is not working correctly. Possible bug in textual_inversion_training.py? * copy learned_embeddings.bin into right location * add front end for diffusers model merging - Front end doesn't do anything yet!!!! - Made change to model name parsing in CLI to support ability to have merged models with the "+" character in their names. * improve inpainting experience - recommend ckpt version of inpainting-1.5 to user - fix get_noise() bug in ckpt version of omnibus.py * update environment*yml * tweak instructions to install HuggingFace token * bump version number * enhance update scripts - update scripts will now fetch new INITIAL_MODELS.yaml so that configure_invokeai.py will know about the diffusers versions. * enhance invoke.sh/invoke.bat launchers - added configure_invokeai.py to menu - menu defaults to browser-based invoke * remove conda workflow (#2321) * fix `token_ids has shape torch.Size([79]) - expected [77]` * update CHANGELOG.md with 2.3.* info - Add information on how formats have changed and the upgrade process. - Add short bug list. Co-authored-by: Damian Stewart <d@damianstewart.com> Co-authored-by: Damian Stewart <null@damianstewart.com> Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> Co-authored-by: Wybartel-luxmc <37852506+Wybartel-luxmc@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> Co-authored-by: mickr777 <115216705+mickr777@users.noreply.github.com> Co-authored-by: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Co-authored-by: Eugene Brodsky <ebr@users.noreply.github.com> Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com>
2023-01-15 14:22:46 +00:00
if isinstance(model, DiffusionPipeline):
configure_model_padding(model.unet, seamless, seamless_axes)
configure_model_padding(model.vae, seamless, seamless_axes)
else:
configure_model_padding(model, seamless, seamless_axes)
Refactoring simplet2i (#387) * start refactoring -not yet functional * first phase of refactor done - not sure weighted prompts working * Second phase of refactoring. Everything mostly working. * The refactoring has moved all the hard-core inference work into ldm.dream.generator.*, where there are submodules for txt2img and img2img. inpaint will go in there as well. * Some additional refactoring will be done soon, but relatively minor work. * fix -save_orig flag to actually work * add @neonsecret attention.py memory optimization * remove unneeded imports * move token logging into conditioning.py * add placeholder version of inpaint; porting in progress * fix crash in img2img * inpainting working; not tested on variations * fix crashes in img2img * ported attention.py memory optimization #117 from basujindal branch * added @torch_no_grad() decorators to img2img, txt2img, inpaint closures * Final commit prior to PR against development * fixup crash when generating intermediate images in web UI * rename ldm.simplet2i to ldm.generate * add backward-compatibility simplet2i shell with deprecation warning * add back in mps exception, addresses @vargol comment in #354 * replaced Conditioning class with exported functions * fix wrong type of with_variations attribute during intialization * changed "image_iterator()" to "get_make_image()" * raise NotImplementedError for calling get_make_image() in parent class * Update ldm/generate.py better error message Co-authored-by: Kevin Gibbons <bakkot@gmail.com> * minor stylistic fixes and assertion checks from code review * moved get_noise() method into img2img class * break get_noise() into two methods, one for txt2img and the other for img2img * inpainting works on non-square images now * make get_noise() an abstract method in base class * much improved inpainting Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
2022-09-06 00:40:10 +00:00
assert cfg_scale > 1.0, 'CFG_Scale (-C) must be >1.0'
2022-09-14 01:56:17 +00:00
assert threshold >= 0.0, '--threshold must be >=0.0'
Refactoring simplet2i (#387) * start refactoring -not yet functional * first phase of refactor done - not sure weighted prompts working * Second phase of refactoring. Everything mostly working. * The refactoring has moved all the hard-core inference work into ldm.dream.generator.*, where there are submodules for txt2img and img2img. inpaint will go in there as well. * Some additional refactoring will be done soon, but relatively minor work. * fix -save_orig flag to actually work * add @neonsecret attention.py memory optimization * remove unneeded imports * move token logging into conditioning.py * add placeholder version of inpaint; porting in progress * fix crash in img2img * inpainting working; not tested on variations * fix crashes in img2img * ported attention.py memory optimization #117 from basujindal branch * added @torch_no_grad() decorators to img2img, txt2img, inpaint closures * Final commit prior to PR against development * fixup crash when generating intermediate images in web UI * rename ldm.simplet2i to ldm.generate * add backward-compatibility simplet2i shell with deprecation warning * add back in mps exception, addresses @vargol comment in #354 * replaced Conditioning class with exported functions * fix wrong type of with_variations attribute during intialization * changed "image_iterator()" to "get_make_image()" * raise NotImplementedError for calling get_make_image() in parent class * Update ldm/generate.py better error message Co-authored-by: Kevin Gibbons <bakkot@gmail.com> * minor stylistic fixes and assertion checks from code review * moved get_noise() method into img2img class * break get_noise() into two methods, one for txt2img and the other for img2img * inpainting works on non-square images now * make get_noise() an abstract method in base class * much improved inpainting Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
2022-09-06 00:40:10 +00:00
assert (
0.0 < strength < 1.0
), 'img2img and inpaint strength can only work with 0.0 < strength < 1.0'
assert (
0.0 <= variation_amount <= 1.0
Refactoring simplet2i (#387) * start refactoring -not yet functional * first phase of refactor done - not sure weighted prompts working * Second phase of refactoring. Everything mostly working. * The refactoring has moved all the hard-core inference work into ldm.dream.generator.*, where there are submodules for txt2img and img2img. inpaint will go in there as well. * Some additional refactoring will be done soon, but relatively minor work. * fix -save_orig flag to actually work * add @neonsecret attention.py memory optimization * remove unneeded imports * move token logging into conditioning.py * add placeholder version of inpaint; porting in progress * fix crash in img2img * inpainting working; not tested on variations * fix crashes in img2img * ported attention.py memory optimization #117 from basujindal branch * added @torch_no_grad() decorators to img2img, txt2img, inpaint closures * Final commit prior to PR against development * fixup crash when generating intermediate images in web UI * rename ldm.simplet2i to ldm.generate * add backward-compatibility simplet2i shell with deprecation warning * add back in mps exception, addresses @vargol comment in #354 * replaced Conditioning class with exported functions * fix wrong type of with_variations attribute during intialization * changed "image_iterator()" to "get_make_image()" * raise NotImplementedError for calling get_make_image() in parent class * Update ldm/generate.py better error message Co-authored-by: Kevin Gibbons <bakkot@gmail.com> * minor stylistic fixes and assertion checks from code review * moved get_noise() method into img2img class * break get_noise() into two methods, one for txt2img and the other for img2img * inpainting works on non-square images now * make get_noise() an abstract method in base class * much improved inpainting Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
2022-09-06 00:40:10 +00:00
), '-v --variation_amount must be in [0.0, 1.0]'
2022-09-14 01:56:17 +00:00
assert (
0.0 <= perlin <= 1.0
), '--perlin must be in [0.0, 1.0]'
assert (
(embiggen == None and embiggen_tiles == None) or (
(embiggen != None or embiggen_tiles != None) and init_img != None)
), 'Embiggen requires an init/input image to be specified'
Refactoring simplet2i (#387) * start refactoring -not yet functional * first phase of refactor done - not sure weighted prompts working * Second phase of refactoring. Everything mostly working. * The refactoring has moved all the hard-core inference work into ldm.dream.generator.*, where there are submodules for txt2img and img2img. inpaint will go in there as well. * Some additional refactoring will be done soon, but relatively minor work. * fix -save_orig flag to actually work * add @neonsecret attention.py memory optimization * remove unneeded imports * move token logging into conditioning.py * add placeholder version of inpaint; porting in progress * fix crash in img2img * inpainting working; not tested on variations * fix crashes in img2img * ported attention.py memory optimization #117 from basujindal branch * added @torch_no_grad() decorators to img2img, txt2img, inpaint closures * Final commit prior to PR against development * fixup crash when generating intermediate images in web UI * rename ldm.simplet2i to ldm.generate * add backward-compatibility simplet2i shell with deprecation warning * add back in mps exception, addresses @vargol comment in #354 * replaced Conditioning class with exported functions * fix wrong type of with_variations attribute during intialization * changed "image_iterator()" to "get_make_image()" * raise NotImplementedError for calling get_make_image() in parent class * Update ldm/generate.py better error message Co-authored-by: Kevin Gibbons <bakkot@gmail.com> * minor stylistic fixes and assertion checks from code review * moved get_noise() method into img2img class * break get_noise() into two methods, one for txt2img and the other for img2img * inpainting works on non-square images now * make get_noise() an abstract method in base class * much improved inpainting Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
2022-09-06 00:40:10 +00:00
if len(with_variations) > 0 or variation_amount > 1.0:
assert seed is not None,\
'seed must be specified when using with_variations'
if variation_amount == 0.0:
assert iterations == 1,\
'when using --with_variations, multiple iterations are only possible when using --variation_amount'
assert all(0 <= weight <= 1 for _, weight in with_variations),\
f'variation weights must be in [0.0, 1.0]: got {[weight for _, weight in with_variations]}'
width, height, _ = self._resolution_check(width, height, log=True)
assert inpaint_replace >=0.0 and inpaint_replace <= 1.0,'inpaint_replace must be between 0.0 and 1.0'
Refactoring simplet2i (#387) * start refactoring -not yet functional * first phase of refactor done - not sure weighted prompts working * Second phase of refactoring. Everything mostly working. * The refactoring has moved all the hard-core inference work into ldm.dream.generator.*, where there are submodules for txt2img and img2img. inpaint will go in there as well. * Some additional refactoring will be done soon, but relatively minor work. * fix -save_orig flag to actually work * add @neonsecret attention.py memory optimization * remove unneeded imports * move token logging into conditioning.py * add placeholder version of inpaint; porting in progress * fix crash in img2img * inpainting working; not tested on variations * fix crashes in img2img * ported attention.py memory optimization #117 from basujindal branch * added @torch_no_grad() decorators to img2img, txt2img, inpaint closures * Final commit prior to PR against development * fixup crash when generating intermediate images in web UI * rename ldm.simplet2i to ldm.generate * add backward-compatibility simplet2i shell with deprecation warning * add back in mps exception, addresses @vargol comment in #354 * replaced Conditioning class with exported functions * fix wrong type of with_variations attribute during intialization * changed "image_iterator()" to "get_make_image()" * raise NotImplementedError for calling get_make_image() in parent class * Update ldm/generate.py better error message Co-authored-by: Kevin Gibbons <bakkot@gmail.com> * minor stylistic fixes and assertion checks from code review * moved get_noise() method into img2img class * break get_noise() into two methods, one for txt2img and the other for img2img * inpainting works on non-square images now * make get_noise() an abstract method in base class * much improved inpainting Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
2022-09-06 00:40:10 +00:00
if sampler_name and (sampler_name != self.sampler_name):
self.sampler_name = sampler_name
self._set_sampler()
Merge dev into main for 2.2.0 (#1642) * Fixes inpainting + code cleanup * Disable stage info in Inpainting Tab * Mask Brush Preview now always at 0.5 opacity The new mask is only visible properly at max opacity but at max opacity the brush preview becomes fully opaque blocking the view. So the mask brush preview no remains at 0.5 no matter what the Brush opacity is. * Remove save button from Canvas Controls (cleanup) * Implements invert mask * Changes "Invert Mask" to "Preserve Masked Areas" * Fixes (?) spacebar issues * Patches redux-persist and redux-deep-persist with debounced persists Our app changes redux state very, very often. As our undo/redo history grows, the calls to persist state start to take in the 100ms range, due to a the deep cloning of the history. This causes very noticeable performance lag. The deep cloning is required because we need to blacklist certain items in redux from being persisted (e.g. the app's connection status). Debouncing the whole process of persistence is a simple and effective solution. Unfortunately, `redux-persist` dropped `debounce` between v4 and v5, replacing it with `throttle`. `throttle`, instead of delaying the expensive action until a period of X ms of inactivity, simply ensures the action is executed at least every X ms. Of course, this does not fix our performance issue. The patch is very simple. It adds a `debounce` argument - a number of milliseconds - and debounces `redux-persist`'s `update()` method (provided by `createPersistoid`) by that many ms. Before this, I also tried writing a custom storage adapter for `redux-persist` to debounce the calls to `localStorage.setItem()`. While this worked and was far less invasive, it doesn't actually address the issue. It turns out `setItem()` is a very fast part of the process. We use `redux-deep-persist` to simplify the `redux-persist` configuration, which can get complicated when you need to blacklist or whitelist deeply nested state. There is also a patch here for that library because it uses the same types as `redux-persist`. Unfortunately, the last release of `redux-persist` used a package `flat-stream` which was malicious and has been removed from npm. The latest commits to `redux-persist` (about 1 year ago) do not build; we cannot use the master branch. And between the last release and last commit, the changes have all been breaking. Patching this last release (about 3 years old at this point) directly is far simpler than attempting to fix the upstream library's master branch or figuring out an alternative to the malicious and now non-existent dependency. * Adds debouncing * Fixes AttributeError: 'dict' object has no attribute 'invert_mask' * Updates package.json to use redux-persist patches * Attempts to fix redux-persist debounce patch * Fixes undo/redo * Fixes invert mask * Debounce > 300ms * Limits history to 256 for each of undo and redo * Canvas styling * Hotkeys improvement * Add Metadata To Viewer * Increases CFG Scale max to 200 * Fix gallery width size for Outpainting Also fixes the canvas resizing failing n fast pushes * Fixes disappearing canvas grid lines * Adds staging area * Fixes "use all" not setting variationAmount Now sets to 0 when the image had variations. * Builds fresh bundle * Outpainting tab loads to empty canvas instead of upload * Fixes wonky canvas layer ordering & compositing * Fixes error on inpainting paste back `TypeError: 'float' object cannot be interpreted as an integer` * Hides staging area outline on mouseover prev/next * Fixes inpainting not doing img2img when no mask * Fixes bbox not resizing in outpainting if partially off screen * Fixes crashes during iterative outpaint. Still doesn't work correctly though. * Fix iterative outpainting by restoring original images * Moves image uploading to HTTP - It all seems to work fine - A lot of cleanup is still needed - Logging needs to be added - May need types to be reviewed * Fixes: outpainting temp images show in gallery * WIP refactor to unified canvas * Removes console.log from redux-persist patch * Initial unification of canvas * Removes all references to split inpainting/outpainting canvas * Add patchmatch and infill_method parameter to prompt2image (options are 'patchmatch' or 'tile'). * Fixes app after removing in/out-painting refs * Rebases on dev, updates new env files w/ patchmatch * Organises features/canvas * Fixes bounding box ending up offscreen * Organises features/canvas * Stops unnecessary canvas rescales on gallery state change * Fixes 2px layout shift on toggle canvas lock * Clips lines drawn while canvas locked When drawing with the locked canvas, if a brush stroke gets too close to the edge of the canvas and its stroke would extend past the edge of the canvas, the edge of that stroke will be seen after unlocking the canvas. This could cause a problem if you unlock the canvas and now have a bunch of strokes just outside the init image area, which are far back in undo history and you cannot easily erase. With this change, lines drawn while the canvas is locked get clipped to the initial image bbox, fixing this issue. Additionally, the merge and save to gallery functions have been updated to respect the initial image bbox so they function how you'd expect. * Fixes reset canvas view when locked * Fixes send to buttons * Fixes bounding box not being rounded to 64 * Abandons "inpainting" canvas lock * Fixes save to gallery including empty area, adds download and copy image * Fix Current Image display background going over image bounds * Sets status immediately when clicking Invoke * Adds hotkeys and refactors sharing of konva instances Adds hotkeys to canvas. As part of this change, the access to konva instance objects was refactored: Previously closure'd refs were used to indirectly get access to the konva instances outside of react components. Now, a getter and setter function are used to provide access directly to the konva objects. * Updates hotkeys * Fixes canvas showing spinner on first load Also adds good default canvas scale and positioning when no image is on it * Fixes possible hang on MaskCompositer * Improves behaviour when setting init canvas image/reset view * Resets bounding box coords/dims when no image present * Disables canvas actions which cannot be done during processing * Adds useToastWatcher hook - Dispatch an `addToast` action with standard Chakra toast options object to add a toast to the toastQueue - The hook is called in App.tsx and just useEffect's w/ toastQueue as dependency to create the toasts - So now you can add toasts anywhere you have access to `dispatch`, which includes middleware and thunks - Adds first usage of this for the save image buttons in canvas * Update Hotkey Info Add missing tooltip hotkeys and update the hotkeys modal to reflect the new hotkeys for the Unified Canvas. * Fix theme changer not displaying current theme on page refresh * Fix tab count in hotkeys panel * Unify Brush and Eraser Sizes * Fix staging area display toggle not working * Staging Area delete button is now red So it doesnt feel blended into to the rest of them. * Revert "Fix theme changer not displaying current theme on page refresh" This reverts commit 903edfb803e743500242589ff093a8a8a0912726. * Add arguments to use SSL to webserver * Integrates #1487 - touch events Need to add: - Pinch zoom - Touch-specific handling (some things aren't quite right) * Refactors upload-related async thunks - Now standard thunks instead of RTK createAsyncThunk() - Adds toasts for all canvas upload-related actions * Reorganises app file structure * Fixes Canvas Auto Save to Gallery * Fixes staging area outline * Adds staging area hotkeys, disables gallery left/right when staging * Fixes Use All Parameters * Fix metadata viewer image url length when viewing intermediate * Fixes intermediate images being tiny in txt2img/img2img * Removes stale code * Improves canvas status text and adds option to toggle debug info * Fixes paste image to upload * Adds model drop-down to site header * Adds theme changer popover * Fix missing key on ThemeChanger map * Fixes stage position changing on zoom * Hotkey Cleanup - Viewer is now Z - Canvas Move tool is V - sync with PS - Removed some unused hotkeys * Fix canvas resizing when both options and gallery are unpinned * Implements thumbnails for gallery - Thumbnails are saved whenever an image is saved, and when gallery requests images from server - Thumbnails saved at original image aspect ratio with width of 128px as WEBP - If the thumbnail property of an image is unavailable for whatever reason, the image's full size URL is used instead * Saves thumbnails to separate thumbnails directory * Thumbnail size = 256px * Fix Lightbox Issues * Disables canvas image saving functions when processing * Fix index error on going past last image in Gallery * WIP - Lightbox Fixes Still need to fix the images not being centered on load when the image res changes * Fixes another similar index error, simplifies logic * Reworks canvas toolbar * Fixes canvas toolbar upload button * Cleans up IAICanvasStatusText * Improves metadata handling, fixes #1450 - Removes model list from metadata - Adds generation's specific model to metadata - Displays full metadata in JSON viewer * Gracefully handles corrupted images; fixes #1486 - App does not crash if corrupted image loaded - Error is displayed in the UI console and CLI output if an image cannot be loaded * Adds hotkey to reset canvas interaction state If the canvas' interaction state (e.g. isMovingBoundingBox, isDrawing, etc) get stuck somehow, user can press Escape to reset the state. * Removes stray console.log() * Fixes bug causing gallery to close on context menu open * Minor bugfixes - When doing long-running canvas image exporting actions, display indeterminate progress bar - Fix staging area image outline not displaying after committing/discarding results * Removes unused imports * Fixes repo root .gitignore ignoring frontend things * Builds fresh bundle * Styling updates * Removes reasonsWhyNotReady The popover doesn't play well with the button being disabled, and I don't think adds any value. * Image gallery resize/style tweaks * Styles buttons for clearing canvas history and mask * First pass on Canvas options panel * Fixes bug where discarding staged images results in loss of history * Adds Save to Gallery button to staging toolbar * Rearrange some canvas toolbar icons Put brush stuff together and canvas movement stuff together * Fix gallery maxwidth on unified canvas * Update Layer hotkey display to UI * Adds option to crop to bounding box on save * Masking option tweaks * Crop to Bounding Box > Save Box Region Only * Adds clear temp folder * Updates mask options popover behavior * Builds fresh bundle * Fix styling on alert modals * Fix input checkbox styling being incorrect on light theme * Styling fixes * Improves gallery resize behaviour * Cap gallery size on canvas tab so it doesnt overflow * Fixes bug when postprocessing image with no metadata * Adds IAIAlertDialog component * Moves Loopback to app settings * Fixes metadata viewer not showing metadata after refresh Also adds Dream-style prompt to metadata * Adds outpainting specific options * Linting * Fixes gallery width on lightbox, fixes gallery button expansion * Builds fresh bundle * Fix Lightbox images of different res not centering * Update feature tooltip text * Highlight mask icon when on mask layer * Fix gallery not resizing correctly on open and close * Add loopback to just img2img. Remove from settings. * Fix to gallery resizing * Removes Advanced checkbox, cleans up options panel for unified canvas * Minor styling fixes to new options panel layout * Styling Updates * Adds infill method * Tab Styling Fixes * memoize outpainting options * Fix unnecessary gallery re-renders * Isolate Cursor Pos debug text on canvas to prevent rerenders * Fixes missing postprocessed image metadata before refresh * Builds fresh bundle * Fix rerenders on model select * Floating panel re-render fix * Simplify fullscreen hotkey selector * Add Training WIP Tab * Adds Training icon * Move full screen hotkey to floating to prevent tab rerenders * Adds single-column gallery layout * Fixes crash on cancel with intermediates enabled, fixes #1416 * Updates npm dependencies * Fixes img2img attempting inpaint when init image has transparency * Fixes missing threshold and perlin parameters in metadata viewer * Renames "Threshold" > "Noise Threshold" * Fixes postprocessing not being disabled when clicking use all * Builds fresh bundle * Adds color picker * Lints & builds fresh bundle * Fixes iterations being disabled when seed random & variations are off * Un-floors cursor position * Changes color picker preview to circles * Fixes variation params not set correctly when recalled * Fixes invoke hotkey not working in input fields * Simplifies Accordion Prep for adding reset buttons for each section * Fixes mask brush preview color * Committing color picker color changes tool to brush * Color picker does not overwrite user-selected alpha * Adds brush color alpha hotkey * Lints * Removes force_outpaint param * Add inpaint size options to inpaint at a larger size than the actual inpaint image, then scale back down for recombination * Bug fix for inpaint size * Adds inpaint size (as scale bounding box) to UI * Adds auto-scaling for inpaint size * Improves scaled bbox display logic * Fixes bug with clear mask and history * Fixes shouldShowStagingImage not resetting to true on commit * Builds fresh bundle * Fixes canvas failing to scale on first run * Builds fresh bundle * Fixes unnecessary canvas scaling * Adds gallery drag and drop to img2img/canvas * Builds fresh bundle * Fix desktop mode being broken with new versions of flaskwebgui * Fixes canvas dimensions not setting on first load * Builds fresh bundle * stop crash on !import_models call on model inside rootdir - addresses bug report #1546 * prevent "!switch state gets confused if model switching fails" - If !switch were to fail on a particular model, then generate got confused and wouldn't try again until you switch to a different working model and back again. - This commit fixes and closes #1547 * Revert "make the docstring more readable and improve the list_models logic" This reverts commit 248068fe5d57b5639ea7a87ee6cbf023104d957d. * fix model cache path * also set fail-fast to it's default (true) in this way the whole action fails if one job fails this should unblock the runners!!! * fix output path for Archive results * disable checks for python 3.9 * Update-requirements and test-invoke-pip workflow (#1574) * update requirements files * update test-invoke-pip workflow * move requirements-mkdocs.txt to docs folder (#1575) * move requirements-mkdocs.txt to docs folder * update copyright * Fixes outpainting with resized inpaint size * Interactive configuration (#1517) * Update scripts/configure_invokeai.py prevent crash if output exists Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> * implement changes requested by reviews * default to correct root and output directory on Windows systems - Previously the script was relying on the readline buffer editing feature to set up the correct default. But this feature doesn't exist on windows. - This commit detects when user typed return with an empty directory value and replaces with the default directory. * improved readability of directory choices * Update scripts/configure_invokeai.py Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> * better error reporting at startup - If user tries to run the script outside of the repo or runtime directory, a more informative message will appear explaining the problem. Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> * Embedding merging (#1526) * add whole <style token> to vocab for concept library embeddings * add ability to load multiple concept .bin files * make --log_tokenization respect custom tokens * start working on concept downloading system * preliminary support for dynamic loading and merging of multiple embedded models - The embedding_manager is now enhanced with ldm.invoke.concepts_lib, which handles dynamic downloading and caching of embedded models from the Hugging Face concepts library (https://huggingface.co/sd-concepts-library) - Downloading of a embedded model is triggered by the presence of one or more <concept> tags in the prompt. - Once the embedded model is downloaded, its trigger phrase will be loaded into the embedding manager and the prompt's <concept> tag will be replaced with the <trigger_phrase> - The downloaded model stays on disk for fast loading later. - The CLI autocomplete will complete partial <concept> tags for you. Type a '<' and hit tab to get all ~700 concepts. BUGS AND LIMITATIONS: - MODEL NAME VS TRIGGER PHRASE You must use the name of the concept embed model from the SD library, and not the trigger phrase itself. Usually these are the same, but not always. For example, the model named "hoi4-leaders" corresponds to the trigger "<HOI4-Leader>" One reason for this design choice is that there is no apparent constraint on the uniqueness of the trigger phrases and one trigger phrase may map onto multiple models. So we use the model name instead. The second reason is that there is no way I know of to search Hugging Face for models with certain trigger phrases. So we'd have to download all 700 models to index the phrases. The problem this presents is that this may confuse users, who will want to reuse prompts from distributions that use the trigger phrase directly. Usually this will work, but not always. - WON'T WORK ON A FIREWALLED SYSTEM If the host running IAI has no internet connection, it can't download the concept libraries. I will add a script that allows users to preload a list of concept models. - BUG IN PROMPT REPLACEMENT WHEN MODEL NOT FOUND There's a small bug that occurs when the user provides an invalid model name. The <concept> gets replaced with <None> in the prompt. * fix loading .pt embeddings; allow multi-vector embeddings; warn on dupes * simplify replacement logic and remove cuda assumption * download list of concepts from hugging face * remove misleading customization of '*' placeholder the existing code as-is did not do anything; unclear what it was supposed to do. the obvious alternative -- setting using 'placeholder_strings' instead of 'placeholder_tokens' to match model.params.personalization_config.params.placeholder_strings -- caused a crash. i think this is because the passed string also needed to be handed over on init of the PersonalizedBase as the 'placeholder_token' argument. this is weird config dict magic and i don't want to touch it. put a breakpoint in personalzied.py line 116 (top of PersonalizedBase.__init__) if you want to have a crack at it yourself. * address all the issues raised by damian0815 in review of PR #1526 * actually resize the token_embeddings * multiple improvements to the concept loader based on code reviews 1. Activated the --embedding_directory option (alias --embedding_path) to load a single embedding or an entire directory of embeddings at startup time. 2. Can turn off automatic loading of embeddings using --no-embeddings. 3. Embedding checkpoints are scanned with the pickle scanner. 4. More informative error messages when a concept can't be loaded due either to a 404 not found error or a network error. * autocomplete terms end with ">" now * fix startup error and network unreachable 1. If the .invokeai file does not contain the --root and --outdir options, invoke.py will now fix it. 2. Catch and handle network problems when downloading hugging face textual inversion concepts. * fix misformatted error string Co-authored-by: Damian Stewart <d@damianstewart.com> * model_cache.py: fix list_models Signed-off-by: devops117 <55235206+devops117@users.noreply.github.com> * add statement of values (#1584) * this adds the Statement of Values Google doc source = https://docs.google.com/document/d/1-PrUKDJcxy8OyNGc8CyiHhv2VgLvjt7LRGlEpbg1nmQ/edit?usp=sharing * Fix heading * Update InvokeAI_Statement_of_Values.md * Update InvokeAI_Statement_of_Values.md * Update InvokeAI_Statement_of_Values.md * Update InvokeAI_Statement_of_Values.md * Update InvokeAI_Statement_of_Values.md * add keturn and mauwii to the team member list * Fix punctuation * this adds the Statement of Values Google doc source = https://docs.google.com/document/d/1-PrUKDJcxy8OyNGc8CyiHhv2VgLvjt7LRGlEpbg1nmQ/edit?usp=sharing * add keturn and mauwii to the team member list * fix formating - make sub bullets use * (decide to all use - or *) - indent sub bullets Sorry, first only looked at the code version and found this only after looking at the markdown rendered version * use multiparagraph numbered sections * Break up Statement Of Values as per comments on #1584 * remove duplicated word, reduce vagueness it's important not to overstate how many artists we are consulting. * fix typo (sorry blessedcoolant) Co-authored-by: mauwii <Mauwii@outlook.de> Co-authored-by: damian <git@damianstewart.com> * update dockerfile (#1551) * update dockerfile * remove not existing file from .dockerignore * remove bloat and unecesary step also use --no-cache-dir for pip install image is now close to 2GB * make Dockerfile a variable * set base image to `ubuntu:22.10` * add build-essential * link outputs folder for persistence * update tag variable * update docs * fix not customizeable build args, add reqs output * !model_import autocompletes in ROOTDIR * Adds psychedelicious to statement of values signature (#1602) * add a --no-patchmatch option to disable patchmatch loading (#1598) This feature was added to prevent the CI Macintosh tests from erroring out when patchmatch is unable to retrieve its shared library from github assets. * Fix #1599 by relaxing the `match_trigger` regex (#1601) * Fix #1599 by relaxing the `match_trigger` regex Also simplify logic and reduce duplication. * restrict trigger regex again (but not so far) * make concepts library work with Web UI This PR makes it possible to include a Hugging Face concepts library <style-or-subject-trigger> in the WebUI prompt. The metadata seems to be correctly handled. * documentation enhancements (#1603) - Add documentation for the Hugging Face concepts library and TI embedding. - Fixup index.md to point to each of the feature documentation files, including ones that are pending. * tweak setup and environment files for linux & pypatchmatch (#1580) * tweak setup and environment files for linux & pypatchmatch - Downgrade python requirements to 3.9 because 3.10 is not supported on Ubuntu 20.04 LTS (widely-used distro) - Use our github pypatchmatch 0.1.3 in order to install Makefile where it needs to be. - Restored "-e ." as the last install step on pip installs. Hopefully this will not trigger the high-CPU hang we've previously experienced. * keep windows on basicsr 1.4.1 * keep windows on basicsr 1.4.1 * bump pypatchmatch requirement to 0.1.4 - This brings in a version of pypatchmatch that will gracefully handle internet connection not available at startup time. - Also refactors and simplifies the handling of gfpgan's basicsr requirement across various platforms. * revert to older version of list_models() (#1611) This restores the correct behavior of list_models() and quenches the bug of list_models() returning a single model entry named "name". I have not investigated what was wrong with the new version, but I think it may have to do with changes to the behavior in dict.update() * Fixes for #1604 (#1605) * Converts ESRGAN image input to RGB - Also adds typing for image input. - Partially resolves #1604 * ensure there are unmasked pixels before color matching Co-authored-by: Kyle Schouviller <kyle0654@hotmail.com> * update index.md (#1609) - comment out non existing link - fix indention - add seperator between feature categories * Debloat-docker (#1612) * debloat Dockerfile - less options more but more userfriendly - better Entrypoint to simulate CLI usage - without command the container still starts the web-host * debloat build.sh * better syntax in run.sh * update Docker docs - fix description of VOLUMENAME - update run script example to reflect new entrypoint * Test installer (#1618) * test linux install * try removing http from parsed requirements * pip install confirmed working on linux * ready for linux testing - rebuilt py3.10-linux-x86_64-cuda-reqs.txt to include pypatchmatch dependency. - point install.sh and install.bat to test-installer branch. * Updates MPS reqs * detect broken readline history files * fix download.pytorch.org URL * Test installer (Win 11) (#1620) Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> * Test installer (MacOS 13.0.1 w/ torch==1.12.0) (#1621) * Test installer (Win 11) * Test installer (MacOS 13.0.1 w/ torch==1.12.0) Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> * change sourceball to development for testing * Test installer (MacOS 13.0.1 w/ torch==1.12.1 & torchvision==1.13.1) (#1622) * Test installer (Win 11) * Test installer (MacOS 13.0.1 w/ torch==1.12.0) * Test installer (MacOS 13.0.1 w/ torch==1.12.1 & torchvision==1.13.1) Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Co-authored-by: Cyrus Chan <82143712+cyruschan360@users.noreply.github.com> Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> * 2.2 Doc Updates (#1589) * Unified Canvas Docs & Assets Unified Canvas draft Advanced Tools Updates Doc Updates (lstein feedback) * copy edits to Unified Canvas docs - consistent capitalisation and feature naming - more intimate address (replace "the user" with "you") for improved User Engagement(tm) - grammatical massaging and *poesie* Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> Co-authored-by: damian <git@damianstewart.com> * include a step after config to `cat ~/.invokeai` (#1629) * disable patchmatch in CI actions (#1626) * disable patchmatch in CI actions * fix indention * replace tab with spaces Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> * Fix installer script for macOS. (#1630) * refer to the platform as 'osx' instead of 'mac', otherwise the composed URL to micromamba is wrong. * move the `-O` option to `tar` to be grouped with the other tar flags to avoid the `-O` being interpreted as something to unarchive. * Removes symlinked environment.yaml (#1631) Was unintentionally added in #1621 * Fix inpainting with iterations (#1635) * fix error when inpainting using runwayml inpainting model (#1634) - error was "Omnibus object has no attribute pil_image" - closes #1596 * add k_dpmpp_2_a and k_dpmpp_2 solvers options (#1389) * add k_dpmpp_2_a and k_dpmpp_2 solvers options * update frontend Co-authored-by: Victor <victorca25@users.noreply.github.com> Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> * add .editorconfig (#1636) * Web UI 2.2 bugfixes (#1572) * Fixes bug preventing multiple images from being generated * Fixes valid seam strength value range * Update Delete Alert Text Indicates to the user that images are not permanently deleted. * Fixes left/right arrows not working on gallery * Fixes initial image on load erroneously set to a user uploaded image Should be a result gallery image. * Lightbox Fixes - Lightbox is now a button in the current image buttons - Lightbox is also now available in the gallery context menu - Lightbox zoom issues fixed - Lightbox has a fade in animation. * Fix image display wrapper in current preview not overflow bounds * Revert "Fix image display wrapper in current preview not overflow bounds" This reverts commit 5511c82714dbf1d1999d64e8bc357bafa34ddf37. * Change Staging Area discard icon from Bin to X * Expose Snap Threshold and Move Snap Settings to BBox Panel * Changes img2img strength default to 0.75 * Fixes drawing triggering when mouse enters canvas w/ button down When we only supported inpainting and no zoom, this was useful. It allowed the cursor to leave the canvas (which was easy to do given the limited canvas dimensions) and without losing the "I am drawing" state. With a zoomable canvas this is no longer as useful. Additionally, we have more popovers and tools (like the color pickers) which result in unexpected brush strokes. This fixes that issue. * Revert "Expose Snap Threshold and Move Snap Settings to BBox Panel" We will handle this a bit differently - by allowing the grid origin to be moved. I will dig in at some point. This reverts commit 33c92ecf4da724c2f17d9d91c7ea31a43a2f6deb. * Adds Limit Strokes to Box * Adds fill bounding box button * Adds erase bounding box button * Changes Staging area discard icon to match others * Fixes right click breaking move tool * Fixes brush preview visibility issue with "darken outside box" * Fixes history bugs with addFillRect, addEraseRect, and other actions * Adds missing `key` * Fixes postprocessing being applied to canvas generations * Fixes bbox not getting scaled in various situations * Fixes staging area show image toggle not resetting on accept/discard * Locks down canvas while generating/staging * Fixes move tool breaking when canvas loses focus during move/transform * Hides cursor when restrict strokes is on and mouse outside bbox * Lints * Builds fresh bundle * Fix overlapping hotkey for Fill Bounding Box * Build Fresh Bundle * Fixes bug with mask and bbox overlay * Builds fresh bundle Co-authored-by: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> * disable NSFW checker loading during the CI tests (#1641) * disable NSFW checker loading during the CI tests The NSFW filter apparently causes invoke.py to crash during CI testing, possibly due to out of memory errors. This workaround disables NSFW model loading. * doc change * fix formatting errors in yml files * Configure the NSFW checker at install time with default on (#1624) * configure the NSFW checker at install time with default on 1. Changes the --safety_checker argument to --nsfw_checker and --no-nsfw_checker. The original argument is recognized for backward compatibility. 2. The configure script asks users whether to enable the checker (default yes). Also offers users ability to select default sampler and number of generation steps. 3.Enables the pasting of the caution icon on blurred images when InvokeAI is installed into the package directory. 4. Adds documentation for the NSFW checker, including caveats about accuracy, memory requirements, and intermediate image dispaly. * use better fitting icon * NSFW defaults false for testing * set default back to nsfw active Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> Signed-off-by: devops117 <55235206+devops117@users.noreply.github.com> Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Co-authored-by: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Co-authored-by: Kyle Schouviller <kyle0654@hotmail.com> Co-authored-by: javl <mail@jaspervanloenen.com> Co-authored-by: Kent Keirsey <31807370+hipsterusername@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com> Co-authored-by: Damian Stewart <d@damianstewart.com> Co-authored-by: DevOps117 <55235206+devops117@users.noreply.github.com> Co-authored-by: damian <git@damianstewart.com> Co-authored-by: Damian Stewart <null@damianstewart.com> Co-authored-by: Cyrus Chan <82143712+cyruschan360@users.noreply.github.com> Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> Co-authored-by: Andre LaBranche <dre@mac.com> Co-authored-by: victorca25 <41912303+victorca25@users.noreply.github.com> Co-authored-by: Victor <victorca25@users.noreply.github.com>
2022-11-30 21:12:23 +00:00
# apply the concepts library to the prompt
use 🧨diffusers model (#1583) * initial commit of DiffusionPipeline class * spike: proof of concept using diffusers for txt2img * doc: type hints for Generator * refactor(model_cache): factor out load_ckpt * model_cache: add ability to load a diffusers model pipeline and update associated things in Generate & Generator to not instantly fail when that happens * model_cache: fix model default image dimensions * txt2img: support switching diffusers schedulers * diffusers: let the scheduler do its scaling of the initial latents Remove IPNDM scheduler; it is not behaving. * web server: update image_progress callback for diffusers data * diffusers: restore prompt weighting feature * diffusers: fix set-sampler error following model switch * diffusers: use InvokeAIDiffuserComponent for conditioning * cross_attention_control: stub (no-op) implementations for diffusers * model_cache: let offload_model work with DiffusionPipeline, sorta. * models.yaml.example: add diffusers-format model, set as default * test-invoke-conda: use diffusers-format model test-invoke-conda: put huggingface-token where the library can use it * environment-mac: upgrade to diffusers 0.7 (from 0.6) this was already done for linux; mac must have been lost in the merge. * preload_models: explicitly load diffusers models In non-interactive mode too, as long as you're logged in. * fix(model_cache): don't check `model.config` in diffusers format clean-up from recent merge. * diffusers integration: support img2img * dev: upgrade to diffusers 0.8 (from 0.7.1) We get to remove some code by using methods that were factored out in the base class. * refactor: remove backported img2img.get_timesteps now that we can use it directly from diffusers 0.8.1 * ci: use diffusers model * dev: upgrade to diffusers 0.9 (from 0.8.1) * lint: correct annotations for Python 3.9. * lint: correct AttributeError.name reference for Python 3.9. * CI: prefer diffusers-1.4 because it no longer requires a token The RunwayML models still do. * build: there's yet another place to update requirements? * configure: try to download models even without token Models in the CompVis and stabilityai repos no longer require them. (But runwayml still does.) * configure: add troubleshooting info for config-not-found * fix(configure): prepend root to config path * fix(configure): remove second `default: true` from models example * CI: simplify test-on-push logic now that we don't need secrets The "test on push but only in forks" logic was only necessary when tests didn't work for PRs-from-forks. * create an embedding_manager for diffusers * internal: avoid importing diffusers DummyObject see https://github.com/huggingface/diffusers/issues/1479 * fix "config attributes…not expected" diffusers warnings. * fix deprecated scheduler construction * work around an apparent MPS torch bug that causes conditioning to have no effect * 🚧 post-rebase repair * preliminary support for outpainting (no masking yet) * monkey-patch diffusers.attention and use Invoke lowvram code * add always_use_cpu arg to bypass MPS * add cross-attention control support to diffusers (fails on MPS) For unknown reasons MPS produces garbage output with .swap(). Use --always_use_cpu arg to invoke.py for now to test this code on MPS. * diffusers support for the inpainting model * fix debug_image to not crash with non-RGB images. * inpainting for the normal model [WIP] This seems to be performing well until the LAST STEP, at which point it dissolves to confetti. * fix off-by-one bug in cross-attention-control (#1774) prompt token sequences begin with a "beginning-of-sequence" marker <bos> and end with a repeated "end-of-sequence" marker <eos> - to make a default prompt length of <bos> + 75 prompt tokens + <eos>. the .swap() code was failing to take the column for <bos> at index 0 into account. the changes here do that, and also add extra handling for a single <eos> (which may be redundant but which is included for completeness). based on my understanding and some assumptions about how this all works, the reason .swap() nevertheless seemed to do the right thing, to some extent, is because over multiple steps the conditioning process in Stable Diffusion operates as a feedback loop. a change to token n-1 has flow-on effects to how the [1x4x64x64] latent tensor is modified by all the tokens after it, - and as the next step is processed, all the tokens before it as well. intuitively, a token's conditioning effects "echo" throughout the whole length of the prompt. so even though the token at n-1 was being edited when what the user actually wanted was to edit the token at n, it nevertheless still had some non-negligible effect, in roughly the right direction, often enough that it seemed like it was working properly. * refactor common CrossAttention stuff into a mixin so that the old ldm code can still work if necessary * inpainting for the normal model. I think it works this time. * diffusers: reset num_vectors_per_token sync with 44a00555718f1df173c60da0ed646cf700e29537 * diffusers: txt2img2img (hires_fix) with so much slicing and dicing of pipeline methods to stitch them together * refactor(diffusers): reduce some code duplication amongst the different tasks * fixup! refactor(diffusers): reduce some code duplication amongst the different tasks * diffusers: enable DPMSolver++ scheduler * diffusers: upgrade to diffusers 0.10, add Heun scheduler * diffusers(ModelCache): stopgap to make from_cpu compatible with diffusers * CI: default to diffusers-1.5 now that runwayml token requirement is gone * diffusers: update to 0.10 (and transformers to 4.25) * diffusers: use xformers when available diffusers no longer auto-enables this as of 0.10.2. * diffusers: make masked img2img behave better with multi-step schedulers re-randomizing the noise each step was confusing them. * diffusers: work more better with more models. fixed relative path problem with local models. fixed models on hub not always having a `fp16` branch. * diffusers: stopgap fix for attention_maps_callback crash after recent merge * fixup import merge conflicts correction for 061c5369a2247c6c92cd69606bcf54c4f1962a0b * test: add tests/inpainting inputs for masked img2img * diffusers(AddsMaskedGuidance): partial fix for k-schedulers Prevents them from crashing, but results are still hot garbage. * fix --safety_checker arg parsing and add note to diffusers loader about where safety checker gets called * generate: fix import error * CI: don't try to read the old init location * diffusers: support loading an alternate VAE * CI: remove sh-syntax if-statement so it doesn't crash powershell * CI: fold strings in yaml because backslash is not line-continuation in powershell * attention maps callback stuff for diffusers * build: fix syntax error in environment-mac * diffusers: add INITIAL_MODELS with diffusers-compatible repos * re-enable the embedding manager; closes #1778 * Squashed commit of the following: commit e4a956abc37fcb5cf188388b76b617bc5c8fda7d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:43:07 2022 +0100 import new load handling from EmbeddingManager and cleanup commit c4abe91a5ba0d415b45bf734068385668b7a66e6 Merge: 032e856e 1efc6397 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:09:53 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers_with_textual_inversion_manager commit 032e856eefb3bbc39534f5daafd25764bcfcef8b Merge: 8b4f0fe9 bc515e24 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:08:01 2022 +0100 Merge remote-tracking branch 'upstream/dev/diffusers' into dev/diffusers_with_textual_inversion_manager commit 1efc6397fc6e61c1aff4b0258b93089d61de5955 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:04:28 2022 +0100 cleanup and add performance notes commit e400f804ac471a0ca2ba432fd658778b20c7bdab Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:45:07 2022 +0100 fix bug and update unit tests commit deb9ae0ae1016750e93ce8275734061f7285a231 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:28:29 2022 +0100 textual inversion manager seems to work commit 162e02505dec777e91a983c4d0fb52e950d25ff0 Merge: cbad4583 12769b3d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:58:03 2022 +0100 Merge branch 'main' into feature_textual_inversion_mgr commit cbad45836c6aace6871a90f2621a953f49433131 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:54:10 2022 +0100 use position embeddings commit 070344c69b0e0db340a183857d0a787b348681d3 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:53:47 2022 +0100 Don't crash CLI on exceptions commit b035ac8c6772dfd9ba41b8eeb9103181cda028f8 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:11:55 2022 +0100 add missing position_embeddings commit 12769b3d3562ef71e0f54946b532ad077e10043c Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:33:25 2022 +0100 debugging why it don't work commit bafb7215eabe1515ca5e8388fd3bb2f3ac5362cf Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:21:33 2022 +0100 debugging why it don't work commit 664a6e9e146b42d96703f0cc8baf8f5efec04ee1 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit 8b4f0fe9d6e4e2643b36dfa27864294785d7ba4e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit ffbe1ab11163ba712e353d89404e301d0e0c6cdf Merge: 6e4dad60 023df37e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:37:31 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers commit 023df37efffa67434f77def7fc3c9dfb29f699fd Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:36:54 2022 +0100 cleanup commit 05fac594eaf79d0058e3c48deee93df603f136c2 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:07:49 2022 +0100 tweak error checking commit 009f32ed39a7280997c3ffab112adadee0b44279 Author: damian <null@damianstewart.com> Date: Thu Dec 15 21:29:47 2022 +0100 unit tests passing for embeddings with vector length >1 commit beb1b08d9a98112ed2fe073580568e1a18698da3 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:39:09 2022 +0100 more explicit equality tests when overwriting commit 44d8a5a7c85cdabc9ce3a54fd0769a10597b3ca9 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:30:13 2022 +0100 wip textual inversion manager (unit tests passing for 1v embedding overwriting) commit 417c2b57d90924a839616bfb66804faab8039e4c Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 12:30:55 2022 +0100 wip textual inversion manager (unit tests passing for base stuff + padding) commit 2e80872e3b6f7fd7d8eb8928822bd824b63cb2ff Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 10:57:57 2022 +0100 wip new TextualInversionManager * stop using WeightedFrozenCLIPEmbedder * store diffusion models locally - configure_invokeai.py reconfigured to store diffusion models rather than CompVis models - hugging face caching model is used, but cache is set to ~/invokeai/models/repo_id - models.yaml does **NOT** use path, just repo_id - "repo_name" changed to "repo_id" to following hugging face conventions - Models are loaded with full precision pending further work. * allow non-local files during development * path takes priority over repo_id * MVP for model_cache and configure_invokeai - Feature complete (almost) - configure_invokeai.py downloads both .ckpt and diffuser models, along with their VAEs. Both types of download are controlled by a unified INITIAL_MODELS.yaml file. - model_cache can load both type of model and switches back and forth in CPU. No memory leaks detected TO DO: 1. I have not yet turned on the LocalOnly flag for diffuser models, so the code will check the Hugging Face repo for updates before using the locally cached models. This will break firewalled systems. I am thinking of putting in a global check for internet connectivity at startup time and setting the LocalOnly flag based on this. It would be good to check updates if there is connectivity. 2. I have not gone completely through INITIAL_MODELS.yaml to check which models are available as diffusers and which are not. So models like PaperCut and VoxelArt may not load properly. The runway and stability models are checked, as well as the Trinart models. 3. Add stanzas for SD 2.0 and 2.1 in INITIAL_MODELS.yaml REMAINING PROBLEMS NOT DIRECTLY RELATED TO MODEL_CACHE: 1. When loading a .ckpt file there are lots of messages like this: Warning! ldm.modules.attention.CrossAttention is no longer being maintained. Please use InvokeAICrossAttention instead. I'm not sure how to address this. 2. The ckpt models ***don't actually run*** due to the lack of special-case support for them in the generator objects. For example, here's the hard crash you get when you run txt2img against the legacy waifu-diffusion-1.3 model: ``` >> An error occurred: Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 140, in main main_loop(gen, opt) File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 371, in main_loop gen.prompt2image( File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1265, in __getattr__ raise AttributeError("'{}' object has no attribute '{}'".format( AttributeError: 'LatentDiffusion' object has no attribute 'image_from_embeddings' ``` 3. The inpainting diffusion model isn't working. Here's the output of "banana sushi" when inpainting-1.5 is loaded: ``` Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 301, in image_from_embeddings result_latents, result_attention_map_saver = self.latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 330, in latents_from_embeddings result: PipelineIntermediateState = infer_latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 185, in __call__ for result in self.generator_method(*args, **kwargs): File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 367, in generate_latents_from_embeddings step_output = self.step(batched_t, latents, guidance_scale, File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context return func(*args, **kwargs) File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 409, in step step_output = self.scheduler.step(noise_pred, timestep, latents, **extra_step_kwargs) File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/diffusers/schedulers/scheduling_lms_discrete.py", line 223, in step pred_original_sample = sample - sigma * model_output RuntimeError: The size of tensor a (9) must match the size of tensor b (4) at non-singleton dimension 1 ``` * proper support for float32/float16 - configure script now correctly detects user's preference for fp16/32 and downloads the correct diffuser version. If fp16 version not available, falls back to fp32 version. - misc code cleanup and simplification in model_cache * add on-the-fly conversion of .ckpt to diffusers models 1. On-the-fly conversion code can be found in the file ldm/invoke/ckpt_to_diffusers.py. 2. A new !optimize command has been added to the CLI. Should be ported to Web GUI. User experience on the CLI is this: ``` invoke> !optimize /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt INFO: Converting legacy weights file /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt to optimized diffuser model. This operation will take 30-60s to complete. Success. Optimized model is now located at /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 Writing new config file entry for sd-v1-4... >> New configuration: sd-v1-4: description: Optimized version of sd-v1-4 format: diffusers path: /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 OK to import [n]? y >> Verifying that new model loads... >> Current VRAM usage: 2.60G >> Offloading stable-diffusion-2.1 to CPU >> Loading diffusers model from /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 | Using faster float16 precision You have disabled the safety checker for <class 'ldm.invoke.generator.diffusers_pipeline.StableDiffusionGeneratorPipeline'> by passing `safety_checker=None`. Ensure that you abide to the conditions of the Stable Diffusion \ license and do not expose unfiltered results in services or applications open to the public. Both the diffusers team and Hugging Face strongly recommend to keep the safety filter enabled in all public facing circumstances,\ disabling it only for use-cases that involve analyzing network behavior or auditing its results. For more information, please have a look at https://github.com/huggingface/diffusers/pull/254 . | training width x height = (512 x 512) >> Model loaded in 3.48s >> Max VRAM used to load the model: 2.17G >> Current VRAM usage:2.17G >> Textual inversions available: >> Setting Sampler to k_lms (LMSDiscreteScheduler) Keep model loaded? [y] ``` * add parallel set of generator files for ckpt legacy generation * generation using legacy ckpt models now working * diffusers: fix missing attention_maps_callback fix for 23eb80b40421b2bb8f4b6d3dd30490d11c447b36 * associate legacy CrossAttention with .ckpt models * enable autoconvert New --autoconvert CLI option will scan a designated directory for new .ckpt files, convert them into diffuser models, and import them into models.yaml. Works like this: invoke.py --autoconvert /path/to/weights/directory In ModelCache added two new methods: autoconvert_weights(config_path, weights_directory_path, models_directory_path) convert_and_import(ckpt_path, diffuser_path) * diffusers: update to diffusers 0.11 (from 0.10.2) * fix vae loading & width/height calculation * refactor: encapsulate these conditioning data into one container * diffusers: fix some noise-scaling issues by pushing the noise-mixing down to the common function * add support for safetensors and accelerate * set local_files_only when internet unreachable * diffusers: fix error-handling path when model repo has no fp16 branch * fix generatorinpaint error Fixes : "ModuleNotFoundError: No module named 'ldm.invoke.generatorinpaint' https://github.com/invoke-ai/InvokeAI/pull/1583#issuecomment-1363634318 * quench diffuser safety-checker warning * diffusers: support stochastic DDIM eta parameter * fix conda env creation on macos * fix cross-attention with diffusers 0.11 * diffusers: the VAE needs to be tiling as well as the U-Net * diffusers: comment on subfolders * diffusers: embiggen! * diffusers: make model_cache.list_models serializable * diffusers(inpaint): restore scaling functionality * fix requirements clash between numba and numpy 1.24 * diffusers: allow inpainting model to do non-inpainting tasks * start expanding model_cache functionality * add import_ckpt_model() and import_diffuser_model() methods to model_manager - in addition, model_cache.py is now renamed to model_manager.py * allow "recommended" flag to be optional in INITIAL_MODELS.yaml * configure_invokeai now downloads VAE diffusers in advance * rename ModelCache to ModelManager * remove support for `repo_name` in models.yaml * check for and refuse to load embeddings trained on incompatible models * models.yaml.example: s/repo_name/repo_id and remove extra INITIAL_MODELS now that the main one has diffusers models in it. * add MVP textual inversion script * refactor(InvokeAIDiffuserComponent): factor out _combine() * InvokeAIDiffuserComponent: implement threshold * InvokeAIDiffuserComponent: diagnostic logs for threshold ...this does not look right * add a curses-based frontend to textual inversion - not quite working yet - requires npyscreen installed - on windows will also have the windows-curses requirement, but not added to requirements yet * add curses-based interface for textual inversion * fix crash in convert_and_import() - This corrects a "local variable referenced before assignment" error in model_manager.convert_and_import() * potential workaround for no 'state_dict' key error - As reported in https://github.com/huggingface/diffusers/issues/1876 * create TI output dir if needed * Update environment-lin-cuda.yml (#2159) Fixing line 42 to be the proper order to define the transformers requirement: ~= instead of =~ * diffusers: update sampler-to-scheduler mapping based on https://github.com/huggingface/diffusers/issues/277#issuecomment-1371428672 * improve user exp for ckt to diffusers conversion - !optimize_models command now operates on an existing ckpt file entry in models.yaml - replaces existing entry, rather than adding a new one - offers to delete the ckpt file after conversion * web: adapt progress callback to deal with old generator or new diffusers pipeline * clean-up model_manager code - add_model() verified to work for .ckpt local paths, .ckpt remote URLs, diffusers local paths, and diffusers repo_ids - convert_and_import() verified to work for local and remove .ckpt files * handle edge cases for import_model() and convert_model() * add support for safetensor .ckpt files * fix name error * code cleanup with pyflake * improve model setting behavior - If the user enters an invalid model name at startup time, will not try to load it, warn, and use default model - CLI UI enhancement: include currently active model in the command line prompt. * update test-invoke-pip.yml - fix model cache path to point to runwayml/stable-diffusion-v1-5 - remove `skip-sd-weights` from configure_invokeai.py args * exclude dev/diffusers from "fail for draft PRs" * disable "fail on PR jobs" * re-add `--skip-sd-weights` since no space * update workflow environments - include `INVOKE_MODEL_RECONFIGURE: '--yes'` * clean up model load failure handling - Allow CLI to run even when no model is defined or loadable. - Inhibit stack trace when model load fails - only show last error - Give user *option* to run configure_invokeai.py when no models successfully load. - Restart invokeai after reconfiguration. * further edge-case handling 1) only one model in models.yaml file, and that model is broken 2) no models in models.yaml 3) models.yaml doesn't exist at all * fix incorrect model status listing - "cached" was not being returned from list_models() - normalize handling of exceptions during model loading: - Passing an invalid model name to generate.set_model() will return a KeyError - All other exceptions are returned as the appropriate Exception * CI: do download weights (if not already cached) * diffusers: fix scheduler loading in offline mode * CI: fix model name (no longer has `diffusers-` prefix) * Update txt2img2img.py (#2256) * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * feat - make model storage compatible with hugging face caching system This commit alters the InvokeAI model directory to be compatible with hugging face, making it easier to share diffusers (and other models) across different programs. - If the HF_HOME environment variable is not set, then models are cached in ~/invokeai/models in a format that is identical to the HuggingFace cache. - If HF_HOME is set, then models are cached wherever HF_HOME points. - To enable sharing with other HuggingFace library clients, set HF_HOME to ~/.cache/huggingface to set the default cache location or to ~/invokeai/models to have huggingface cache inside InvokeAI. * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * fix error "no attribute CkptInpaint" * model_manager.list_models() returns entire model config stanza+status * Initial Draft - Model Manager Diffusers * added hash function to diffusers * implement sha256 hashes on diffusers models * Add Model Manager Support for Diffusers * fix various problems with model manager - in cli import functions, fix not enough values to unpack from _get_name_and_desc() - fix crash when using old-style vae: value with new-style diffuser * rebuild frontend * fix dictconfig-not-serializable issue * fix NoneType' object is not subscriptable crash in model_manager * fix "str has no attribute get" error in model_manager list_models() * Add path and repo_id support for Diffusers Model Manager Also fixes bugs * Fix tooltip IT localization not working * Add Version Number To WebUI * Optimize Model Search * Fix incorrect font on the Model Manager UI * Fix image degradation on merge fixes - [Experimental] This change should effectively fix a couple of things. - Fix image degradation on subsequent merges of the canvas layers. - Fix the slight transparent border that is left behind when filling the bounding box with a color. - Fix the left over line of color when filling a bounding box with color. So far there are no side effects for this. If any, please report. * Add local model filtering for Diffusers / Checkpoints * Go to home on modal close for the Add Modal UI * Styling Fixes * Model Manager Diffusers Localization Update * Add Safe Tensor scanning to Model Manager * Fix model edit form dispatching string values instead of numbers. * Resolve VAE handling / edge cases for supplied repos * defer injecting tokens for textual inversions until they're used for the first time * squash a console warning * implement model migration check * add_model() overwrites previous config rather than merges * fix model config file attribute merging * fix precision handling in textual inversion script * allow ckpt conversion script to work with safetensors .ckpts Applied patch here: https://github.com/huggingface/diffusers/commit/beb932c5d111872c5e45387e7b1b2b3dd0524a47 * fix name "args" is not defined crash in textual_inversion_training * fix a second NameError: name 'args' is not defined crash * fix loading of the safety checker from the global cache dir * add installation step to textual inversion frontend - After a successful training run, the script will copy learned_embeds.bin to a subfolder of the embeddings directory. - User given the option to delete the logs and intermediate checkpoints (which together use 7-8G of space) - If textual inversion training fails, reports the error gracefully. * don't crash out on incompatible embeddings - put try: blocks around places where the system tries to load an embedding which is incompatible with the currently loaded model * add support for checkpoint resuming * textual inversion preferences are saved and restored between sessions - Preferences are stored in a file named text-inversion-training/preferences.conf - Currently the resume-from-checkpoint option is not working correctly. Possible bug in textual_inversion_training.py? * copy learned_embeddings.bin into right location * add front end for diffusers model merging - Front end doesn't do anything yet!!!! - Made change to model name parsing in CLI to support ability to have merged models with the "+" character in their names. * improve inpainting experience - recommend ckpt version of inpainting-1.5 to user - fix get_noise() bug in ckpt version of omnibus.py * update environment*yml * tweak instructions to install HuggingFace token * bump version number * enhance update scripts - update scripts will now fetch new INITIAL_MODELS.yaml so that configure_invokeai.py will know about the diffusers versions. * enhance invoke.sh/invoke.bat launchers - added configure_invokeai.py to menu - menu defaults to browser-based invoke * remove conda workflow (#2321) * fix `token_ids has shape torch.Size([79]) - expected [77]` * update CHANGELOG.md with 2.3.* info - Add information on how formats have changed and the upgrade process. - Add short bug list. Co-authored-by: Damian Stewart <d@damianstewart.com> Co-authored-by: Damian Stewart <null@damianstewart.com> Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> Co-authored-by: Wybartel-luxmc <37852506+Wybartel-luxmc@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> Co-authored-by: mickr777 <115216705+mickr777@users.noreply.github.com> Co-authored-by: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Co-authored-by: Eugene Brodsky <ebr@users.noreply.github.com> Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com>
2023-01-15 14:22:46 +00:00
prompt = self.huggingface_concepts_library.replace_concepts_with_triggers(prompt, lambda concepts: self.load_huggingface_concepts(concepts))
Merge dev into main for 2.2.0 (#1642) * Fixes inpainting + code cleanup * Disable stage info in Inpainting Tab * Mask Brush Preview now always at 0.5 opacity The new mask is only visible properly at max opacity but at max opacity the brush preview becomes fully opaque blocking the view. So the mask brush preview no remains at 0.5 no matter what the Brush opacity is. * Remove save button from Canvas Controls (cleanup) * Implements invert mask * Changes "Invert Mask" to "Preserve Masked Areas" * Fixes (?) spacebar issues * Patches redux-persist and redux-deep-persist with debounced persists Our app changes redux state very, very often. As our undo/redo history grows, the calls to persist state start to take in the 100ms range, due to a the deep cloning of the history. This causes very noticeable performance lag. The deep cloning is required because we need to blacklist certain items in redux from being persisted (e.g. the app's connection status). Debouncing the whole process of persistence is a simple and effective solution. Unfortunately, `redux-persist` dropped `debounce` between v4 and v5, replacing it with `throttle`. `throttle`, instead of delaying the expensive action until a period of X ms of inactivity, simply ensures the action is executed at least every X ms. Of course, this does not fix our performance issue. The patch is very simple. It adds a `debounce` argument - a number of milliseconds - and debounces `redux-persist`'s `update()` method (provided by `createPersistoid`) by that many ms. Before this, I also tried writing a custom storage adapter for `redux-persist` to debounce the calls to `localStorage.setItem()`. While this worked and was far less invasive, it doesn't actually address the issue. It turns out `setItem()` is a very fast part of the process. We use `redux-deep-persist` to simplify the `redux-persist` configuration, which can get complicated when you need to blacklist or whitelist deeply nested state. There is also a patch here for that library because it uses the same types as `redux-persist`. Unfortunately, the last release of `redux-persist` used a package `flat-stream` which was malicious and has been removed from npm. The latest commits to `redux-persist` (about 1 year ago) do not build; we cannot use the master branch. And between the last release and last commit, the changes have all been breaking. Patching this last release (about 3 years old at this point) directly is far simpler than attempting to fix the upstream library's master branch or figuring out an alternative to the malicious and now non-existent dependency. * Adds debouncing * Fixes AttributeError: 'dict' object has no attribute 'invert_mask' * Updates package.json to use redux-persist patches * Attempts to fix redux-persist debounce patch * Fixes undo/redo * Fixes invert mask * Debounce > 300ms * Limits history to 256 for each of undo and redo * Canvas styling * Hotkeys improvement * Add Metadata To Viewer * Increases CFG Scale max to 200 * Fix gallery width size for Outpainting Also fixes the canvas resizing failing n fast pushes * Fixes disappearing canvas grid lines * Adds staging area * Fixes "use all" not setting variationAmount Now sets to 0 when the image had variations. * Builds fresh bundle * Outpainting tab loads to empty canvas instead of upload * Fixes wonky canvas layer ordering & compositing * Fixes error on inpainting paste back `TypeError: 'float' object cannot be interpreted as an integer` * Hides staging area outline on mouseover prev/next * Fixes inpainting not doing img2img when no mask * Fixes bbox not resizing in outpainting if partially off screen * Fixes crashes during iterative outpaint. Still doesn't work correctly though. * Fix iterative outpainting by restoring original images * Moves image uploading to HTTP - It all seems to work fine - A lot of cleanup is still needed - Logging needs to be added - May need types to be reviewed * Fixes: outpainting temp images show in gallery * WIP refactor to unified canvas * Removes console.log from redux-persist patch * Initial unification of canvas * Removes all references to split inpainting/outpainting canvas * Add patchmatch and infill_method parameter to prompt2image (options are 'patchmatch' or 'tile'). * Fixes app after removing in/out-painting refs * Rebases on dev, updates new env files w/ patchmatch * Organises features/canvas * Fixes bounding box ending up offscreen * Organises features/canvas * Stops unnecessary canvas rescales on gallery state change * Fixes 2px layout shift on toggle canvas lock * Clips lines drawn while canvas locked When drawing with the locked canvas, if a brush stroke gets too close to the edge of the canvas and its stroke would extend past the edge of the canvas, the edge of that stroke will be seen after unlocking the canvas. This could cause a problem if you unlock the canvas and now have a bunch of strokes just outside the init image area, which are far back in undo history and you cannot easily erase. With this change, lines drawn while the canvas is locked get clipped to the initial image bbox, fixing this issue. Additionally, the merge and save to gallery functions have been updated to respect the initial image bbox so they function how you'd expect. * Fixes reset canvas view when locked * Fixes send to buttons * Fixes bounding box not being rounded to 64 * Abandons "inpainting" canvas lock * Fixes save to gallery including empty area, adds download and copy image * Fix Current Image display background going over image bounds * Sets status immediately when clicking Invoke * Adds hotkeys and refactors sharing of konva instances Adds hotkeys to canvas. As part of this change, the access to konva instance objects was refactored: Previously closure'd refs were used to indirectly get access to the konva instances outside of react components. Now, a getter and setter function are used to provide access directly to the konva objects. * Updates hotkeys * Fixes canvas showing spinner on first load Also adds good default canvas scale and positioning when no image is on it * Fixes possible hang on MaskCompositer * Improves behaviour when setting init canvas image/reset view * Resets bounding box coords/dims when no image present * Disables canvas actions which cannot be done during processing * Adds useToastWatcher hook - Dispatch an `addToast` action with standard Chakra toast options object to add a toast to the toastQueue - The hook is called in App.tsx and just useEffect's w/ toastQueue as dependency to create the toasts - So now you can add toasts anywhere you have access to `dispatch`, which includes middleware and thunks - Adds first usage of this for the save image buttons in canvas * Update Hotkey Info Add missing tooltip hotkeys and update the hotkeys modal to reflect the new hotkeys for the Unified Canvas. * Fix theme changer not displaying current theme on page refresh * Fix tab count in hotkeys panel * Unify Brush and Eraser Sizes * Fix staging area display toggle not working * Staging Area delete button is now red So it doesnt feel blended into to the rest of them. * Revert "Fix theme changer not displaying current theme on page refresh" This reverts commit 903edfb803e743500242589ff093a8a8a0912726. * Add arguments to use SSL to webserver * Integrates #1487 - touch events Need to add: - Pinch zoom - Touch-specific handling (some things aren't quite right) * Refactors upload-related async thunks - Now standard thunks instead of RTK createAsyncThunk() - Adds toasts for all canvas upload-related actions * Reorganises app file structure * Fixes Canvas Auto Save to Gallery * Fixes staging area outline * Adds staging area hotkeys, disables gallery left/right when staging * Fixes Use All Parameters * Fix metadata viewer image url length when viewing intermediate * Fixes intermediate images being tiny in txt2img/img2img * Removes stale code * Improves canvas status text and adds option to toggle debug info * Fixes paste image to upload * Adds model drop-down to site header * Adds theme changer popover * Fix missing key on ThemeChanger map * Fixes stage position changing on zoom * Hotkey Cleanup - Viewer is now Z - Canvas Move tool is V - sync with PS - Removed some unused hotkeys * Fix canvas resizing when both options and gallery are unpinned * Implements thumbnails for gallery - Thumbnails are saved whenever an image is saved, and when gallery requests images from server - Thumbnails saved at original image aspect ratio with width of 128px as WEBP - If the thumbnail property of an image is unavailable for whatever reason, the image's full size URL is used instead * Saves thumbnails to separate thumbnails directory * Thumbnail size = 256px * Fix Lightbox Issues * Disables canvas image saving functions when processing * Fix index error on going past last image in Gallery * WIP - Lightbox Fixes Still need to fix the images not being centered on load when the image res changes * Fixes another similar index error, simplifies logic * Reworks canvas toolbar * Fixes canvas toolbar upload button * Cleans up IAICanvasStatusText * Improves metadata handling, fixes #1450 - Removes model list from metadata - Adds generation's specific model to metadata - Displays full metadata in JSON viewer * Gracefully handles corrupted images; fixes #1486 - App does not crash if corrupted image loaded - Error is displayed in the UI console and CLI output if an image cannot be loaded * Adds hotkey to reset canvas interaction state If the canvas' interaction state (e.g. isMovingBoundingBox, isDrawing, etc) get stuck somehow, user can press Escape to reset the state. * Removes stray console.log() * Fixes bug causing gallery to close on context menu open * Minor bugfixes - When doing long-running canvas image exporting actions, display indeterminate progress bar - Fix staging area image outline not displaying after committing/discarding results * Removes unused imports * Fixes repo root .gitignore ignoring frontend things * Builds fresh bundle * Styling updates * Removes reasonsWhyNotReady The popover doesn't play well with the button being disabled, and I don't think adds any value. * Image gallery resize/style tweaks * Styles buttons for clearing canvas history and mask * First pass on Canvas options panel * Fixes bug where discarding staged images results in loss of history * Adds Save to Gallery button to staging toolbar * Rearrange some canvas toolbar icons Put brush stuff together and canvas movement stuff together * Fix gallery maxwidth on unified canvas * Update Layer hotkey display to UI * Adds option to crop to bounding box on save * Masking option tweaks * Crop to Bounding Box > Save Box Region Only * Adds clear temp folder * Updates mask options popover behavior * Builds fresh bundle * Fix styling on alert modals * Fix input checkbox styling being incorrect on light theme * Styling fixes * Improves gallery resize behaviour * Cap gallery size on canvas tab so it doesnt overflow * Fixes bug when postprocessing image with no metadata * Adds IAIAlertDialog component * Moves Loopback to app settings * Fixes metadata viewer not showing metadata after refresh Also adds Dream-style prompt to metadata * Adds outpainting specific options * Linting * Fixes gallery width on lightbox, fixes gallery button expansion * Builds fresh bundle * Fix Lightbox images of different res not centering * Update feature tooltip text * Highlight mask icon when on mask layer * Fix gallery not resizing correctly on open and close * Add loopback to just img2img. Remove from settings. * Fix to gallery resizing * Removes Advanced checkbox, cleans up options panel for unified canvas * Minor styling fixes to new options panel layout * Styling Updates * Adds infill method * Tab Styling Fixes * memoize outpainting options * Fix unnecessary gallery re-renders * Isolate Cursor Pos debug text on canvas to prevent rerenders * Fixes missing postprocessed image metadata before refresh * Builds fresh bundle * Fix rerenders on model select * Floating panel re-render fix * Simplify fullscreen hotkey selector * Add Training WIP Tab * Adds Training icon * Move full screen hotkey to floating to prevent tab rerenders * Adds single-column gallery layout * Fixes crash on cancel with intermediates enabled, fixes #1416 * Updates npm dependencies * Fixes img2img attempting inpaint when init image has transparency * Fixes missing threshold and perlin parameters in metadata viewer * Renames "Threshold" > "Noise Threshold" * Fixes postprocessing not being disabled when clicking use all * Builds fresh bundle * Adds color picker * Lints & builds fresh bundle * Fixes iterations being disabled when seed random & variations are off * Un-floors cursor position * Changes color picker preview to circles * Fixes variation params not set correctly when recalled * Fixes invoke hotkey not working in input fields * Simplifies Accordion Prep for adding reset buttons for each section * Fixes mask brush preview color * Committing color picker color changes tool to brush * Color picker does not overwrite user-selected alpha * Adds brush color alpha hotkey * Lints * Removes force_outpaint param * Add inpaint size options to inpaint at a larger size than the actual inpaint image, then scale back down for recombination * Bug fix for inpaint size * Adds inpaint size (as scale bounding box) to UI * Adds auto-scaling for inpaint size * Improves scaled bbox display logic * Fixes bug with clear mask and history * Fixes shouldShowStagingImage not resetting to true on commit * Builds fresh bundle * Fixes canvas failing to scale on first run * Builds fresh bundle * Fixes unnecessary canvas scaling * Adds gallery drag and drop to img2img/canvas * Builds fresh bundle * Fix desktop mode being broken with new versions of flaskwebgui * Fixes canvas dimensions not setting on first load * Builds fresh bundle * stop crash on !import_models call on model inside rootdir - addresses bug report #1546 * prevent "!switch state gets confused if model switching fails" - If !switch were to fail on a particular model, then generate got confused and wouldn't try again until you switch to a different working model and back again. - This commit fixes and closes #1547 * Revert "make the docstring more readable and improve the list_models logic" This reverts commit 248068fe5d57b5639ea7a87ee6cbf023104d957d. * fix model cache path * also set fail-fast to it's default (true) in this way the whole action fails if one job fails this should unblock the runners!!! * fix output path for Archive results * disable checks for python 3.9 * Update-requirements and test-invoke-pip workflow (#1574) * update requirements files * update test-invoke-pip workflow * move requirements-mkdocs.txt to docs folder (#1575) * move requirements-mkdocs.txt to docs folder * update copyright * Fixes outpainting with resized inpaint size * Interactive configuration (#1517) * Update scripts/configure_invokeai.py prevent crash if output exists Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> * implement changes requested by reviews * default to correct root and output directory on Windows systems - Previously the script was relying on the readline buffer editing feature to set up the correct default. But this feature doesn't exist on windows. - This commit detects when user typed return with an empty directory value and replaces with the default directory. * improved readability of directory choices * Update scripts/configure_invokeai.py Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> * better error reporting at startup - If user tries to run the script outside of the repo or runtime directory, a more informative message will appear explaining the problem. Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> * Embedding merging (#1526) * add whole <style token> to vocab for concept library embeddings * add ability to load multiple concept .bin files * make --log_tokenization respect custom tokens * start working on concept downloading system * preliminary support for dynamic loading and merging of multiple embedded models - The embedding_manager is now enhanced with ldm.invoke.concepts_lib, which handles dynamic downloading and caching of embedded models from the Hugging Face concepts library (https://huggingface.co/sd-concepts-library) - Downloading of a embedded model is triggered by the presence of one or more <concept> tags in the prompt. - Once the embedded model is downloaded, its trigger phrase will be loaded into the embedding manager and the prompt's <concept> tag will be replaced with the <trigger_phrase> - The downloaded model stays on disk for fast loading later. - The CLI autocomplete will complete partial <concept> tags for you. Type a '<' and hit tab to get all ~700 concepts. BUGS AND LIMITATIONS: - MODEL NAME VS TRIGGER PHRASE You must use the name of the concept embed model from the SD library, and not the trigger phrase itself. Usually these are the same, but not always. For example, the model named "hoi4-leaders" corresponds to the trigger "<HOI4-Leader>" One reason for this design choice is that there is no apparent constraint on the uniqueness of the trigger phrases and one trigger phrase may map onto multiple models. So we use the model name instead. The second reason is that there is no way I know of to search Hugging Face for models with certain trigger phrases. So we'd have to download all 700 models to index the phrases. The problem this presents is that this may confuse users, who will want to reuse prompts from distributions that use the trigger phrase directly. Usually this will work, but not always. - WON'T WORK ON A FIREWALLED SYSTEM If the host running IAI has no internet connection, it can't download the concept libraries. I will add a script that allows users to preload a list of concept models. - BUG IN PROMPT REPLACEMENT WHEN MODEL NOT FOUND There's a small bug that occurs when the user provides an invalid model name. The <concept> gets replaced with <None> in the prompt. * fix loading .pt embeddings; allow multi-vector embeddings; warn on dupes * simplify replacement logic and remove cuda assumption * download list of concepts from hugging face * remove misleading customization of '*' placeholder the existing code as-is did not do anything; unclear what it was supposed to do. the obvious alternative -- setting using 'placeholder_strings' instead of 'placeholder_tokens' to match model.params.personalization_config.params.placeholder_strings -- caused a crash. i think this is because the passed string also needed to be handed over on init of the PersonalizedBase as the 'placeholder_token' argument. this is weird config dict magic and i don't want to touch it. put a breakpoint in personalzied.py line 116 (top of PersonalizedBase.__init__) if you want to have a crack at it yourself. * address all the issues raised by damian0815 in review of PR #1526 * actually resize the token_embeddings * multiple improvements to the concept loader based on code reviews 1. Activated the --embedding_directory option (alias --embedding_path) to load a single embedding or an entire directory of embeddings at startup time. 2. Can turn off automatic loading of embeddings using --no-embeddings. 3. Embedding checkpoints are scanned with the pickle scanner. 4. More informative error messages when a concept can't be loaded due either to a 404 not found error or a network error. * autocomplete terms end with ">" now * fix startup error and network unreachable 1. If the .invokeai file does not contain the --root and --outdir options, invoke.py will now fix it. 2. Catch and handle network problems when downloading hugging face textual inversion concepts. * fix misformatted error string Co-authored-by: Damian Stewart <d@damianstewart.com> * model_cache.py: fix list_models Signed-off-by: devops117 <55235206+devops117@users.noreply.github.com> * add statement of values (#1584) * this adds the Statement of Values Google doc source = https://docs.google.com/document/d/1-PrUKDJcxy8OyNGc8CyiHhv2VgLvjt7LRGlEpbg1nmQ/edit?usp=sharing * Fix heading * Update InvokeAI_Statement_of_Values.md * Update InvokeAI_Statement_of_Values.md * Update InvokeAI_Statement_of_Values.md * Update InvokeAI_Statement_of_Values.md * Update InvokeAI_Statement_of_Values.md * add keturn and mauwii to the team member list * Fix punctuation * this adds the Statement of Values Google doc source = https://docs.google.com/document/d/1-PrUKDJcxy8OyNGc8CyiHhv2VgLvjt7LRGlEpbg1nmQ/edit?usp=sharing * add keturn and mauwii to the team member list * fix formating - make sub bullets use * (decide to all use - or *) - indent sub bullets Sorry, first only looked at the code version and found this only after looking at the markdown rendered version * use multiparagraph numbered sections * Break up Statement Of Values as per comments on #1584 * remove duplicated word, reduce vagueness it's important not to overstate how many artists we are consulting. * fix typo (sorry blessedcoolant) Co-authored-by: mauwii <Mauwii@outlook.de> Co-authored-by: damian <git@damianstewart.com> * update dockerfile (#1551) * update dockerfile * remove not existing file from .dockerignore * remove bloat and unecesary step also use --no-cache-dir for pip install image is now close to 2GB * make Dockerfile a variable * set base image to `ubuntu:22.10` * add build-essential * link outputs folder for persistence * update tag variable * update docs * fix not customizeable build args, add reqs output * !model_import autocompletes in ROOTDIR * Adds psychedelicious to statement of values signature (#1602) * add a --no-patchmatch option to disable patchmatch loading (#1598) This feature was added to prevent the CI Macintosh tests from erroring out when patchmatch is unable to retrieve its shared library from github assets. * Fix #1599 by relaxing the `match_trigger` regex (#1601) * Fix #1599 by relaxing the `match_trigger` regex Also simplify logic and reduce duplication. * restrict trigger regex again (but not so far) * make concepts library work with Web UI This PR makes it possible to include a Hugging Face concepts library <style-or-subject-trigger> in the WebUI prompt. The metadata seems to be correctly handled. * documentation enhancements (#1603) - Add documentation for the Hugging Face concepts library and TI embedding. - Fixup index.md to point to each of the feature documentation files, including ones that are pending. * tweak setup and environment files for linux & pypatchmatch (#1580) * tweak setup and environment files for linux & pypatchmatch - Downgrade python requirements to 3.9 because 3.10 is not supported on Ubuntu 20.04 LTS (widely-used distro) - Use our github pypatchmatch 0.1.3 in order to install Makefile where it needs to be. - Restored "-e ." as the last install step on pip installs. Hopefully this will not trigger the high-CPU hang we've previously experienced. * keep windows on basicsr 1.4.1 * keep windows on basicsr 1.4.1 * bump pypatchmatch requirement to 0.1.4 - This brings in a version of pypatchmatch that will gracefully handle internet connection not available at startup time. - Also refactors and simplifies the handling of gfpgan's basicsr requirement across various platforms. * revert to older version of list_models() (#1611) This restores the correct behavior of list_models() and quenches the bug of list_models() returning a single model entry named "name". I have not investigated what was wrong with the new version, but I think it may have to do with changes to the behavior in dict.update() * Fixes for #1604 (#1605) * Converts ESRGAN image input to RGB - Also adds typing for image input. - Partially resolves #1604 * ensure there are unmasked pixels before color matching Co-authored-by: Kyle Schouviller <kyle0654@hotmail.com> * update index.md (#1609) - comment out non existing link - fix indention - add seperator between feature categories * Debloat-docker (#1612) * debloat Dockerfile - less options more but more userfriendly - better Entrypoint to simulate CLI usage - without command the container still starts the web-host * debloat build.sh * better syntax in run.sh * update Docker docs - fix description of VOLUMENAME - update run script example to reflect new entrypoint * Test installer (#1618) * test linux install * try removing http from parsed requirements * pip install confirmed working on linux * ready for linux testing - rebuilt py3.10-linux-x86_64-cuda-reqs.txt to include pypatchmatch dependency. - point install.sh and install.bat to test-installer branch. * Updates MPS reqs * detect broken readline history files * fix download.pytorch.org URL * Test installer (Win 11) (#1620) Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> * Test installer (MacOS 13.0.1 w/ torch==1.12.0) (#1621) * Test installer (Win 11) * Test installer (MacOS 13.0.1 w/ torch==1.12.0) Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> * change sourceball to development for testing * Test installer (MacOS 13.0.1 w/ torch==1.12.1 & torchvision==1.13.1) (#1622) * Test installer (Win 11) * Test installer (MacOS 13.0.1 w/ torch==1.12.0) * Test installer (MacOS 13.0.1 w/ torch==1.12.1 & torchvision==1.13.1) Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Co-authored-by: Cyrus Chan <82143712+cyruschan360@users.noreply.github.com> Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> * 2.2 Doc Updates (#1589) * Unified Canvas Docs & Assets Unified Canvas draft Advanced Tools Updates Doc Updates (lstein feedback) * copy edits to Unified Canvas docs - consistent capitalisation and feature naming - more intimate address (replace "the user" with "you") for improved User Engagement(tm) - grammatical massaging and *poesie* Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> Co-authored-by: damian <git@damianstewart.com> * include a step after config to `cat ~/.invokeai` (#1629) * disable patchmatch in CI actions (#1626) * disable patchmatch in CI actions * fix indention * replace tab with spaces Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> * Fix installer script for macOS. (#1630) * refer to the platform as 'osx' instead of 'mac', otherwise the composed URL to micromamba is wrong. * move the `-O` option to `tar` to be grouped with the other tar flags to avoid the `-O` being interpreted as something to unarchive. * Removes symlinked environment.yaml (#1631) Was unintentionally added in #1621 * Fix inpainting with iterations (#1635) * fix error when inpainting using runwayml inpainting model (#1634) - error was "Omnibus object has no attribute pil_image" - closes #1596 * add k_dpmpp_2_a and k_dpmpp_2 solvers options (#1389) * add k_dpmpp_2_a and k_dpmpp_2 solvers options * update frontend Co-authored-by: Victor <victorca25@users.noreply.github.com> Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> * add .editorconfig (#1636) * Web UI 2.2 bugfixes (#1572) * Fixes bug preventing multiple images from being generated * Fixes valid seam strength value range * Update Delete Alert Text Indicates to the user that images are not permanently deleted. * Fixes left/right arrows not working on gallery * Fixes initial image on load erroneously set to a user uploaded image Should be a result gallery image. * Lightbox Fixes - Lightbox is now a button in the current image buttons - Lightbox is also now available in the gallery context menu - Lightbox zoom issues fixed - Lightbox has a fade in animation. * Fix image display wrapper in current preview not overflow bounds * Revert "Fix image display wrapper in current preview not overflow bounds" This reverts commit 5511c82714dbf1d1999d64e8bc357bafa34ddf37. * Change Staging Area discard icon from Bin to X * Expose Snap Threshold and Move Snap Settings to BBox Panel * Changes img2img strength default to 0.75 * Fixes drawing triggering when mouse enters canvas w/ button down When we only supported inpainting and no zoom, this was useful. It allowed the cursor to leave the canvas (which was easy to do given the limited canvas dimensions) and without losing the "I am drawing" state. With a zoomable canvas this is no longer as useful. Additionally, we have more popovers and tools (like the color pickers) which result in unexpected brush strokes. This fixes that issue. * Revert "Expose Snap Threshold and Move Snap Settings to BBox Panel" We will handle this a bit differently - by allowing the grid origin to be moved. I will dig in at some point. This reverts commit 33c92ecf4da724c2f17d9d91c7ea31a43a2f6deb. * Adds Limit Strokes to Box * Adds fill bounding box button * Adds erase bounding box button * Changes Staging area discard icon to match others * Fixes right click breaking move tool * Fixes brush preview visibility issue with "darken outside box" * Fixes history bugs with addFillRect, addEraseRect, and other actions * Adds missing `key` * Fixes postprocessing being applied to canvas generations * Fixes bbox not getting scaled in various situations * Fixes staging area show image toggle not resetting on accept/discard * Locks down canvas while generating/staging * Fixes move tool breaking when canvas loses focus during move/transform * Hides cursor when restrict strokes is on and mouse outside bbox * Lints * Builds fresh bundle * Fix overlapping hotkey for Fill Bounding Box * Build Fresh Bundle * Fixes bug with mask and bbox overlay * Builds fresh bundle Co-authored-by: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> * disable NSFW checker loading during the CI tests (#1641) * disable NSFW checker loading during the CI tests The NSFW filter apparently causes invoke.py to crash during CI testing, possibly due to out of memory errors. This workaround disables NSFW model loading. * doc change * fix formatting errors in yml files * Configure the NSFW checker at install time with default on (#1624) * configure the NSFW checker at install time with default on 1. Changes the --safety_checker argument to --nsfw_checker and --no-nsfw_checker. The original argument is recognized for backward compatibility. 2. The configure script asks users whether to enable the checker (default yes). Also offers users ability to select default sampler and number of generation steps. 3.Enables the pasting of the caution icon on blurred images when InvokeAI is installed into the package directory. 4. Adds documentation for the NSFW checker, including caveats about accuracy, memory requirements, and intermediate image dispaly. * use better fitting icon * NSFW defaults false for testing * set default back to nsfw active Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> Signed-off-by: devops117 <55235206+devops117@users.noreply.github.com> Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Co-authored-by: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Co-authored-by: Kyle Schouviller <kyle0654@hotmail.com> Co-authored-by: javl <mail@jaspervanloenen.com> Co-authored-by: Kent Keirsey <31807370+hipsterusername@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com> Co-authored-by: Damian Stewart <d@damianstewart.com> Co-authored-by: DevOps117 <55235206+devops117@users.noreply.github.com> Co-authored-by: damian <git@damianstewart.com> Co-authored-by: Damian Stewart <null@damianstewart.com> Co-authored-by: Cyrus Chan <82143712+cyruschan360@users.noreply.github.com> Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> Co-authored-by: Andre LaBranche <dre@mac.com> Co-authored-by: victorca25 <41912303+victorca25@users.noreply.github.com> Co-authored-by: Victor <victorca25@users.noreply.github.com>
2022-11-30 21:12:23 +00:00
# bit of a hack to change the cached sampler's karras threshold to
# whatever the user asked for
if karras_max is not None and isinstance(self.sampler,KSampler):
self.sampler.adjust_settings(karras_max=karras_max)
Refactoring simplet2i (#387) * start refactoring -not yet functional * first phase of refactor done - not sure weighted prompts working * Second phase of refactoring. Everything mostly working. * The refactoring has moved all the hard-core inference work into ldm.dream.generator.*, where there are submodules for txt2img and img2img. inpaint will go in there as well. * Some additional refactoring will be done soon, but relatively minor work. * fix -save_orig flag to actually work * add @neonsecret attention.py memory optimization * remove unneeded imports * move token logging into conditioning.py * add placeholder version of inpaint; porting in progress * fix crash in img2img * inpainting working; not tested on variations * fix crashes in img2img * ported attention.py memory optimization #117 from basujindal branch * added @torch_no_grad() decorators to img2img, txt2img, inpaint closures * Final commit prior to PR against development * fixup crash when generating intermediate images in web UI * rename ldm.simplet2i to ldm.generate * add backward-compatibility simplet2i shell with deprecation warning * add back in mps exception, addresses @vargol comment in #354 * replaced Conditioning class with exported functions * fix wrong type of with_variations attribute during intialization * changed "image_iterator()" to "get_make_image()" * raise NotImplementedError for calling get_make_image() in parent class * Update ldm/generate.py better error message Co-authored-by: Kevin Gibbons <bakkot@gmail.com> * minor stylistic fixes and assertion checks from code review * moved get_noise() method into img2img class * break get_noise() into two methods, one for txt2img and the other for img2img * inpainting works on non-square images now * make get_noise() an abstract method in base class * much improved inpainting Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
2022-09-06 00:40:10 +00:00
tic = time.time()
if self._has_cuda():
Refactoring simplet2i (#387) * start refactoring -not yet functional * first phase of refactor done - not sure weighted prompts working * Second phase of refactoring. Everything mostly working. * The refactoring has moved all the hard-core inference work into ldm.dream.generator.*, where there are submodules for txt2img and img2img. inpaint will go in there as well. * Some additional refactoring will be done soon, but relatively minor work. * fix -save_orig flag to actually work * add @neonsecret attention.py memory optimization * remove unneeded imports * move token logging into conditioning.py * add placeholder version of inpaint; porting in progress * fix crash in img2img * inpainting working; not tested on variations * fix crashes in img2img * ported attention.py memory optimization #117 from basujindal branch * added @torch_no_grad() decorators to img2img, txt2img, inpaint closures * Final commit prior to PR against development * fixup crash when generating intermediate images in web UI * rename ldm.simplet2i to ldm.generate * add backward-compatibility simplet2i shell with deprecation warning * add back in mps exception, addresses @vargol comment in #354 * replaced Conditioning class with exported functions * fix wrong type of with_variations attribute during intialization * changed "image_iterator()" to "get_make_image()" * raise NotImplementedError for calling get_make_image() in parent class * Update ldm/generate.py better error message Co-authored-by: Kevin Gibbons <bakkot@gmail.com> * minor stylistic fixes and assertion checks from code review * moved get_noise() method into img2img class * break get_noise() into two methods, one for txt2img and the other for img2img * inpainting works on non-square images now * make get_noise() an abstract method in base class * much improved inpainting Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
2022-09-06 00:40:10 +00:00
torch.cuda.reset_peak_memory_stats()
results = list()
init_image = None
mask_image = None
Refactoring simplet2i (#387) * start refactoring -not yet functional * first phase of refactor done - not sure weighted prompts working * Second phase of refactoring. Everything mostly working. * The refactoring has moved all the hard-core inference work into ldm.dream.generator.*, where there are submodules for txt2img and img2img. inpaint will go in there as well. * Some additional refactoring will be done soon, but relatively minor work. * fix -save_orig flag to actually work * add @neonsecret attention.py memory optimization * remove unneeded imports * move token logging into conditioning.py * add placeholder version of inpaint; porting in progress * fix crash in img2img * inpainting working; not tested on variations * fix crashes in img2img * ported attention.py memory optimization #117 from basujindal branch * added @torch_no_grad() decorators to img2img, txt2img, inpaint closures * Final commit prior to PR against development * fixup crash when generating intermediate images in web UI * rename ldm.simplet2i to ldm.generate * add backward-compatibility simplet2i shell with deprecation warning * add back in mps exception, addresses @vargol comment in #354 * replaced Conditioning class with exported functions * fix wrong type of with_variations attribute during intialization * changed "image_iterator()" to "get_make_image()" * raise NotImplementedError for calling get_make_image() in parent class * Update ldm/generate.py better error message Co-authored-by: Kevin Gibbons <bakkot@gmail.com> * minor stylistic fixes and assertion checks from code review * moved get_noise() method into img2img class * break get_noise() into two methods, one for txt2img and the other for img2img * inpainting works on non-square images now * make get_noise() an abstract method in base class * much improved inpainting Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
2022-09-06 00:40:10 +00:00
if self.free_gpu_mem and self.model.cond_stage_model.device != self.model.device:
self.model.cond_stage_model.device = self.model.device
self.model.cond_stage_model.to(self.model.device)
Refactoring simplet2i (#387) * start refactoring -not yet functional * first phase of refactor done - not sure weighted prompts working * Second phase of refactoring. Everything mostly working. * The refactoring has moved all the hard-core inference work into ldm.dream.generator.*, where there are submodules for txt2img and img2img. inpaint will go in there as well. * Some additional refactoring will be done soon, but relatively minor work. * fix -save_orig flag to actually work * add @neonsecret attention.py memory optimization * remove unneeded imports * move token logging into conditioning.py * add placeholder version of inpaint; porting in progress * fix crash in img2img * inpainting working; not tested on variations * fix crashes in img2img * ported attention.py memory optimization #117 from basujindal branch * added @torch_no_grad() decorators to img2img, txt2img, inpaint closures * Final commit prior to PR against development * fixup crash when generating intermediate images in web UI * rename ldm.simplet2i to ldm.generate * add backward-compatibility simplet2i shell with deprecation warning * add back in mps exception, addresses @vargol comment in #354 * replaced Conditioning class with exported functions * fix wrong type of with_variations attribute during intialization * changed "image_iterator()" to "get_make_image()" * raise NotImplementedError for calling get_make_image() in parent class * Update ldm/generate.py better error message Co-authored-by: Kevin Gibbons <bakkot@gmail.com> * minor stylistic fixes and assertion checks from code review * moved get_noise() method into img2img class * break get_noise() into two methods, one for txt2img and the other for img2img * inpainting works on non-square images now * make get_noise() an abstract method in base class * much improved inpainting Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
2022-09-06 00:40:10 +00:00
try:
2022-10-23 12:58:25 +00:00
uc, c, extra_conditioning_info = get_uc_and_c_and_ec(
prompt, model =self.model,
skip_normalize_legacy_blend=skip_normalize,
log_tokens =self.log_tokenization
Refactoring simplet2i (#387) * start refactoring -not yet functional * first phase of refactor done - not sure weighted prompts working * Second phase of refactoring. Everything mostly working. * The refactoring has moved all the hard-core inference work into ldm.dream.generator.*, where there are submodules for txt2img and img2img. inpaint will go in there as well. * Some additional refactoring will be done soon, but relatively minor work. * fix -save_orig flag to actually work * add @neonsecret attention.py memory optimization * remove unneeded imports * move token logging into conditioning.py * add placeholder version of inpaint; porting in progress * fix crash in img2img * inpainting working; not tested on variations * fix crashes in img2img * ported attention.py memory optimization #117 from basujindal branch * added @torch_no_grad() decorators to img2img, txt2img, inpaint closures * Final commit prior to PR against development * fixup crash when generating intermediate images in web UI * rename ldm.simplet2i to ldm.generate * add backward-compatibility simplet2i shell with deprecation warning * add back in mps exception, addresses @vargol comment in #354 * replaced Conditioning class with exported functions * fix wrong type of with_variations attribute during intialization * changed "image_iterator()" to "get_make_image()" * raise NotImplementedError for calling get_make_image() in parent class * Update ldm/generate.py better error message Co-authored-by: Kevin Gibbons <bakkot@gmail.com> * minor stylistic fixes and assertion checks from code review * moved get_noise() method into img2img class * break get_noise() into two methods, one for txt2img and the other for img2img * inpainting works on non-square images now * make get_noise() an abstract method in base class * much improved inpainting Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
2022-09-06 00:40:10 +00:00
)
init_image, mask_image = self._make_images(
init_img,
init_mask,
width,
height,
fit=fit,
text_mask=text_mask,
invert_mask=invert_mask,
force_outpaint=force_outpaint,
)
# TODO: Hacky selection of operation to perform. Needs to be refactored.
Merge dev into main for 2.2.0 (#1642) * Fixes inpainting + code cleanup * Disable stage info in Inpainting Tab * Mask Brush Preview now always at 0.5 opacity The new mask is only visible properly at max opacity but at max opacity the brush preview becomes fully opaque blocking the view. So the mask brush preview no remains at 0.5 no matter what the Brush opacity is. * Remove save button from Canvas Controls (cleanup) * Implements invert mask * Changes "Invert Mask" to "Preserve Masked Areas" * Fixes (?) spacebar issues * Patches redux-persist and redux-deep-persist with debounced persists Our app changes redux state very, very often. As our undo/redo history grows, the calls to persist state start to take in the 100ms range, due to a the deep cloning of the history. This causes very noticeable performance lag. The deep cloning is required because we need to blacklist certain items in redux from being persisted (e.g. the app's connection status). Debouncing the whole process of persistence is a simple and effective solution. Unfortunately, `redux-persist` dropped `debounce` between v4 and v5, replacing it with `throttle`. `throttle`, instead of delaying the expensive action until a period of X ms of inactivity, simply ensures the action is executed at least every X ms. Of course, this does not fix our performance issue. The patch is very simple. It adds a `debounce` argument - a number of milliseconds - and debounces `redux-persist`'s `update()` method (provided by `createPersistoid`) by that many ms. Before this, I also tried writing a custom storage adapter for `redux-persist` to debounce the calls to `localStorage.setItem()`. While this worked and was far less invasive, it doesn't actually address the issue. It turns out `setItem()` is a very fast part of the process. We use `redux-deep-persist` to simplify the `redux-persist` configuration, which can get complicated when you need to blacklist or whitelist deeply nested state. There is also a patch here for that library because it uses the same types as `redux-persist`. Unfortunately, the last release of `redux-persist` used a package `flat-stream` which was malicious and has been removed from npm. The latest commits to `redux-persist` (about 1 year ago) do not build; we cannot use the master branch. And between the last release and last commit, the changes have all been breaking. Patching this last release (about 3 years old at this point) directly is far simpler than attempting to fix the upstream library's master branch or figuring out an alternative to the malicious and now non-existent dependency. * Adds debouncing * Fixes AttributeError: 'dict' object has no attribute 'invert_mask' * Updates package.json to use redux-persist patches * Attempts to fix redux-persist debounce patch * Fixes undo/redo * Fixes invert mask * Debounce > 300ms * Limits history to 256 for each of undo and redo * Canvas styling * Hotkeys improvement * Add Metadata To Viewer * Increases CFG Scale max to 200 * Fix gallery width size for Outpainting Also fixes the canvas resizing failing n fast pushes * Fixes disappearing canvas grid lines * Adds staging area * Fixes "use all" not setting variationAmount Now sets to 0 when the image had variations. * Builds fresh bundle * Outpainting tab loads to empty canvas instead of upload * Fixes wonky canvas layer ordering & compositing * Fixes error on inpainting paste back `TypeError: 'float' object cannot be interpreted as an integer` * Hides staging area outline on mouseover prev/next * Fixes inpainting not doing img2img when no mask * Fixes bbox not resizing in outpainting if partially off screen * Fixes crashes during iterative outpaint. Still doesn't work correctly though. * Fix iterative outpainting by restoring original images * Moves image uploading to HTTP - It all seems to work fine - A lot of cleanup is still needed - Logging needs to be added - May need types to be reviewed * Fixes: outpainting temp images show in gallery * WIP refactor to unified canvas * Removes console.log from redux-persist patch * Initial unification of canvas * Removes all references to split inpainting/outpainting canvas * Add patchmatch and infill_method parameter to prompt2image (options are 'patchmatch' or 'tile'). * Fixes app after removing in/out-painting refs * Rebases on dev, updates new env files w/ patchmatch * Organises features/canvas * Fixes bounding box ending up offscreen * Organises features/canvas * Stops unnecessary canvas rescales on gallery state change * Fixes 2px layout shift on toggle canvas lock * Clips lines drawn while canvas locked When drawing with the locked canvas, if a brush stroke gets too close to the edge of the canvas and its stroke would extend past the edge of the canvas, the edge of that stroke will be seen after unlocking the canvas. This could cause a problem if you unlock the canvas and now have a bunch of strokes just outside the init image area, which are far back in undo history and you cannot easily erase. With this change, lines drawn while the canvas is locked get clipped to the initial image bbox, fixing this issue. Additionally, the merge and save to gallery functions have been updated to respect the initial image bbox so they function how you'd expect. * Fixes reset canvas view when locked * Fixes send to buttons * Fixes bounding box not being rounded to 64 * Abandons "inpainting" canvas lock * Fixes save to gallery including empty area, adds download and copy image * Fix Current Image display background going over image bounds * Sets status immediately when clicking Invoke * Adds hotkeys and refactors sharing of konva instances Adds hotkeys to canvas. As part of this change, the access to konva instance objects was refactored: Previously closure'd refs were used to indirectly get access to the konva instances outside of react components. Now, a getter and setter function are used to provide access directly to the konva objects. * Updates hotkeys * Fixes canvas showing spinner on first load Also adds good default canvas scale and positioning when no image is on it * Fixes possible hang on MaskCompositer * Improves behaviour when setting init canvas image/reset view * Resets bounding box coords/dims when no image present * Disables canvas actions which cannot be done during processing * Adds useToastWatcher hook - Dispatch an `addToast` action with standard Chakra toast options object to add a toast to the toastQueue - The hook is called in App.tsx and just useEffect's w/ toastQueue as dependency to create the toasts - So now you can add toasts anywhere you have access to `dispatch`, which includes middleware and thunks - Adds first usage of this for the save image buttons in canvas * Update Hotkey Info Add missing tooltip hotkeys and update the hotkeys modal to reflect the new hotkeys for the Unified Canvas. * Fix theme changer not displaying current theme on page refresh * Fix tab count in hotkeys panel * Unify Brush and Eraser Sizes * Fix staging area display toggle not working * Staging Area delete button is now red So it doesnt feel blended into to the rest of them. * Revert "Fix theme changer not displaying current theme on page refresh" This reverts commit 903edfb803e743500242589ff093a8a8a0912726. * Add arguments to use SSL to webserver * Integrates #1487 - touch events Need to add: - Pinch zoom - Touch-specific handling (some things aren't quite right) * Refactors upload-related async thunks - Now standard thunks instead of RTK createAsyncThunk() - Adds toasts for all canvas upload-related actions * Reorganises app file structure * Fixes Canvas Auto Save to Gallery * Fixes staging area outline * Adds staging area hotkeys, disables gallery left/right when staging * Fixes Use All Parameters * Fix metadata viewer image url length when viewing intermediate * Fixes intermediate images being tiny in txt2img/img2img * Removes stale code * Improves canvas status text and adds option to toggle debug info * Fixes paste image to upload * Adds model drop-down to site header * Adds theme changer popover * Fix missing key on ThemeChanger map * Fixes stage position changing on zoom * Hotkey Cleanup - Viewer is now Z - Canvas Move tool is V - sync with PS - Removed some unused hotkeys * Fix canvas resizing when both options and gallery are unpinned * Implements thumbnails for gallery - Thumbnails are saved whenever an image is saved, and when gallery requests images from server - Thumbnails saved at original image aspect ratio with width of 128px as WEBP - If the thumbnail property of an image is unavailable for whatever reason, the image's full size URL is used instead * Saves thumbnails to separate thumbnails directory * Thumbnail size = 256px * Fix Lightbox Issues * Disables canvas image saving functions when processing * Fix index error on going past last image in Gallery * WIP - Lightbox Fixes Still need to fix the images not being centered on load when the image res changes * Fixes another similar index error, simplifies logic * Reworks canvas toolbar * Fixes canvas toolbar upload button * Cleans up IAICanvasStatusText * Improves metadata handling, fixes #1450 - Removes model list from metadata - Adds generation's specific model to metadata - Displays full metadata in JSON viewer * Gracefully handles corrupted images; fixes #1486 - App does not crash if corrupted image loaded - Error is displayed in the UI console and CLI output if an image cannot be loaded * Adds hotkey to reset canvas interaction state If the canvas' interaction state (e.g. isMovingBoundingBox, isDrawing, etc) get stuck somehow, user can press Escape to reset the state. * Removes stray console.log() * Fixes bug causing gallery to close on context menu open * Minor bugfixes - When doing long-running canvas image exporting actions, display indeterminate progress bar - Fix staging area image outline not displaying after committing/discarding results * Removes unused imports * Fixes repo root .gitignore ignoring frontend things * Builds fresh bundle * Styling updates * Removes reasonsWhyNotReady The popover doesn't play well with the button being disabled, and I don't think adds any value. * Image gallery resize/style tweaks * Styles buttons for clearing canvas history and mask * First pass on Canvas options panel * Fixes bug where discarding staged images results in loss of history * Adds Save to Gallery button to staging toolbar * Rearrange some canvas toolbar icons Put brush stuff together and canvas movement stuff together * Fix gallery maxwidth on unified canvas * Update Layer hotkey display to UI * Adds option to crop to bounding box on save * Masking option tweaks * Crop to Bounding Box > Save Box Region Only * Adds clear temp folder * Updates mask options popover behavior * Builds fresh bundle * Fix styling on alert modals * Fix input checkbox styling being incorrect on light theme * Styling fixes * Improves gallery resize behaviour * Cap gallery size on canvas tab so it doesnt overflow * Fixes bug when postprocessing image with no metadata * Adds IAIAlertDialog component * Moves Loopback to app settings * Fixes metadata viewer not showing metadata after refresh Also adds Dream-style prompt to metadata * Adds outpainting specific options * Linting * Fixes gallery width on lightbox, fixes gallery button expansion * Builds fresh bundle * Fix Lightbox images of different res not centering * Update feature tooltip text * Highlight mask icon when on mask layer * Fix gallery not resizing correctly on open and close * Add loopback to just img2img. Remove from settings. * Fix to gallery resizing * Removes Advanced checkbox, cleans up options panel for unified canvas * Minor styling fixes to new options panel layout * Styling Updates * Adds infill method * Tab Styling Fixes * memoize outpainting options * Fix unnecessary gallery re-renders * Isolate Cursor Pos debug text on canvas to prevent rerenders * Fixes missing postprocessed image metadata before refresh * Builds fresh bundle * Fix rerenders on model select * Floating panel re-render fix * Simplify fullscreen hotkey selector * Add Training WIP Tab * Adds Training icon * Move full screen hotkey to floating to prevent tab rerenders * Adds single-column gallery layout * Fixes crash on cancel with intermediates enabled, fixes #1416 * Updates npm dependencies * Fixes img2img attempting inpaint when init image has transparency * Fixes missing threshold and perlin parameters in metadata viewer * Renames "Threshold" > "Noise Threshold" * Fixes postprocessing not being disabled when clicking use all * Builds fresh bundle * Adds color picker * Lints & builds fresh bundle * Fixes iterations being disabled when seed random & variations are off * Un-floors cursor position * Changes color picker preview to circles * Fixes variation params not set correctly when recalled * Fixes invoke hotkey not working in input fields * Simplifies Accordion Prep for adding reset buttons for each section * Fixes mask brush preview color * Committing color picker color changes tool to brush * Color picker does not overwrite user-selected alpha * Adds brush color alpha hotkey * Lints * Removes force_outpaint param * Add inpaint size options to inpaint at a larger size than the actual inpaint image, then scale back down for recombination * Bug fix for inpaint size * Adds inpaint size (as scale bounding box) to UI * Adds auto-scaling for inpaint size * Improves scaled bbox display logic * Fixes bug with clear mask and history * Fixes shouldShowStagingImage not resetting to true on commit * Builds fresh bundle * Fixes canvas failing to scale on first run * Builds fresh bundle * Fixes unnecessary canvas scaling * Adds gallery drag and drop to img2img/canvas * Builds fresh bundle * Fix desktop mode being broken with new versions of flaskwebgui * Fixes canvas dimensions not setting on first load * Builds fresh bundle * stop crash on !import_models call on model inside rootdir - addresses bug report #1546 * prevent "!switch state gets confused if model switching fails" - If !switch were to fail on a particular model, then generate got confused and wouldn't try again until you switch to a different working model and back again. - This commit fixes and closes #1547 * Revert "make the docstring more readable and improve the list_models logic" This reverts commit 248068fe5d57b5639ea7a87ee6cbf023104d957d. * fix model cache path * also set fail-fast to it's default (true) in this way the whole action fails if one job fails this should unblock the runners!!! * fix output path for Archive results * disable checks for python 3.9 * Update-requirements and test-invoke-pip workflow (#1574) * update requirements files * update test-invoke-pip workflow * move requirements-mkdocs.txt to docs folder (#1575) * move requirements-mkdocs.txt to docs folder * update copyright * Fixes outpainting with resized inpaint size * Interactive configuration (#1517) * Update scripts/configure_invokeai.py prevent crash if output exists Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> * implement changes requested by reviews * default to correct root and output directory on Windows systems - Previously the script was relying on the readline buffer editing feature to set up the correct default. But this feature doesn't exist on windows. - This commit detects when user typed return with an empty directory value and replaces with the default directory. * improved readability of directory choices * Update scripts/configure_invokeai.py Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> * better error reporting at startup - If user tries to run the script outside of the repo or runtime directory, a more informative message will appear explaining the problem. Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> * Embedding merging (#1526) * add whole <style token> to vocab for concept library embeddings * add ability to load multiple concept .bin files * make --log_tokenization respect custom tokens * start working on concept downloading system * preliminary support for dynamic loading and merging of multiple embedded models - The embedding_manager is now enhanced with ldm.invoke.concepts_lib, which handles dynamic downloading and caching of embedded models from the Hugging Face concepts library (https://huggingface.co/sd-concepts-library) - Downloading of a embedded model is triggered by the presence of one or more <concept> tags in the prompt. - Once the embedded model is downloaded, its trigger phrase will be loaded into the embedding manager and the prompt's <concept> tag will be replaced with the <trigger_phrase> - The downloaded model stays on disk for fast loading later. - The CLI autocomplete will complete partial <concept> tags for you. Type a '<' and hit tab to get all ~700 concepts. BUGS AND LIMITATIONS: - MODEL NAME VS TRIGGER PHRASE You must use the name of the concept embed model from the SD library, and not the trigger phrase itself. Usually these are the same, but not always. For example, the model named "hoi4-leaders" corresponds to the trigger "<HOI4-Leader>" One reason for this design choice is that there is no apparent constraint on the uniqueness of the trigger phrases and one trigger phrase may map onto multiple models. So we use the model name instead. The second reason is that there is no way I know of to search Hugging Face for models with certain trigger phrases. So we'd have to download all 700 models to index the phrases. The problem this presents is that this may confuse users, who will want to reuse prompts from distributions that use the trigger phrase directly. Usually this will work, but not always. - WON'T WORK ON A FIREWALLED SYSTEM If the host running IAI has no internet connection, it can't download the concept libraries. I will add a script that allows users to preload a list of concept models. - BUG IN PROMPT REPLACEMENT WHEN MODEL NOT FOUND There's a small bug that occurs when the user provides an invalid model name. The <concept> gets replaced with <None> in the prompt. * fix loading .pt embeddings; allow multi-vector embeddings; warn on dupes * simplify replacement logic and remove cuda assumption * download list of concepts from hugging face * remove misleading customization of '*' placeholder the existing code as-is did not do anything; unclear what it was supposed to do. the obvious alternative -- setting using 'placeholder_strings' instead of 'placeholder_tokens' to match model.params.personalization_config.params.placeholder_strings -- caused a crash. i think this is because the passed string also needed to be handed over on init of the PersonalizedBase as the 'placeholder_token' argument. this is weird config dict magic and i don't want to touch it. put a breakpoint in personalzied.py line 116 (top of PersonalizedBase.__init__) if you want to have a crack at it yourself. * address all the issues raised by damian0815 in review of PR #1526 * actually resize the token_embeddings * multiple improvements to the concept loader based on code reviews 1. Activated the --embedding_directory option (alias --embedding_path) to load a single embedding or an entire directory of embeddings at startup time. 2. Can turn off automatic loading of embeddings using --no-embeddings. 3. Embedding checkpoints are scanned with the pickle scanner. 4. More informative error messages when a concept can't be loaded due either to a 404 not found error or a network error. * autocomplete terms end with ">" now * fix startup error and network unreachable 1. If the .invokeai file does not contain the --root and --outdir options, invoke.py will now fix it. 2. Catch and handle network problems when downloading hugging face textual inversion concepts. * fix misformatted error string Co-authored-by: Damian Stewart <d@damianstewart.com> * model_cache.py: fix list_models Signed-off-by: devops117 <55235206+devops117@users.noreply.github.com> * add statement of values (#1584) * this adds the Statement of Values Google doc source = https://docs.google.com/document/d/1-PrUKDJcxy8OyNGc8CyiHhv2VgLvjt7LRGlEpbg1nmQ/edit?usp=sharing * Fix heading * Update InvokeAI_Statement_of_Values.md * Update InvokeAI_Statement_of_Values.md * Update InvokeAI_Statement_of_Values.md * Update InvokeAI_Statement_of_Values.md * Update InvokeAI_Statement_of_Values.md * add keturn and mauwii to the team member list * Fix punctuation * this adds the Statement of Values Google doc source = https://docs.google.com/document/d/1-PrUKDJcxy8OyNGc8CyiHhv2VgLvjt7LRGlEpbg1nmQ/edit?usp=sharing * add keturn and mauwii to the team member list * fix formating - make sub bullets use * (decide to all use - or *) - indent sub bullets Sorry, first only looked at the code version and found this only after looking at the markdown rendered version * use multiparagraph numbered sections * Break up Statement Of Values as per comments on #1584 * remove duplicated word, reduce vagueness it's important not to overstate how many artists we are consulting. * fix typo (sorry blessedcoolant) Co-authored-by: mauwii <Mauwii@outlook.de> Co-authored-by: damian <git@damianstewart.com> * update dockerfile (#1551) * update dockerfile * remove not existing file from .dockerignore * remove bloat and unecesary step also use --no-cache-dir for pip install image is now close to 2GB * make Dockerfile a variable * set base image to `ubuntu:22.10` * add build-essential * link outputs folder for persistence * update tag variable * update docs * fix not customizeable build args, add reqs output * !model_import autocompletes in ROOTDIR * Adds psychedelicious to statement of values signature (#1602) * add a --no-patchmatch option to disable patchmatch loading (#1598) This feature was added to prevent the CI Macintosh tests from erroring out when patchmatch is unable to retrieve its shared library from github assets. * Fix #1599 by relaxing the `match_trigger` regex (#1601) * Fix #1599 by relaxing the `match_trigger` regex Also simplify logic and reduce duplication. * restrict trigger regex again (but not so far) * make concepts library work with Web UI This PR makes it possible to include a Hugging Face concepts library <style-or-subject-trigger> in the WebUI prompt. The metadata seems to be correctly handled. * documentation enhancements (#1603) - Add documentation for the Hugging Face concepts library and TI embedding. - Fixup index.md to point to each of the feature documentation files, including ones that are pending. * tweak setup and environment files for linux & pypatchmatch (#1580) * tweak setup and environment files for linux & pypatchmatch - Downgrade python requirements to 3.9 because 3.10 is not supported on Ubuntu 20.04 LTS (widely-used distro) - Use our github pypatchmatch 0.1.3 in order to install Makefile where it needs to be. - Restored "-e ." as the last install step on pip installs. Hopefully this will not trigger the high-CPU hang we've previously experienced. * keep windows on basicsr 1.4.1 * keep windows on basicsr 1.4.1 * bump pypatchmatch requirement to 0.1.4 - This brings in a version of pypatchmatch that will gracefully handle internet connection not available at startup time. - Also refactors and simplifies the handling of gfpgan's basicsr requirement across various platforms. * revert to older version of list_models() (#1611) This restores the correct behavior of list_models() and quenches the bug of list_models() returning a single model entry named "name". I have not investigated what was wrong with the new version, but I think it may have to do with changes to the behavior in dict.update() * Fixes for #1604 (#1605) * Converts ESRGAN image input to RGB - Also adds typing for image input. - Partially resolves #1604 * ensure there are unmasked pixels before color matching Co-authored-by: Kyle Schouviller <kyle0654@hotmail.com> * update index.md (#1609) - comment out non existing link - fix indention - add seperator between feature categories * Debloat-docker (#1612) * debloat Dockerfile - less options more but more userfriendly - better Entrypoint to simulate CLI usage - without command the container still starts the web-host * debloat build.sh * better syntax in run.sh * update Docker docs - fix description of VOLUMENAME - update run script example to reflect new entrypoint * Test installer (#1618) * test linux install * try removing http from parsed requirements * pip install confirmed working on linux * ready for linux testing - rebuilt py3.10-linux-x86_64-cuda-reqs.txt to include pypatchmatch dependency. - point install.sh and install.bat to test-installer branch. * Updates MPS reqs * detect broken readline history files * fix download.pytorch.org URL * Test installer (Win 11) (#1620) Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> * Test installer (MacOS 13.0.1 w/ torch==1.12.0) (#1621) * Test installer (Win 11) * Test installer (MacOS 13.0.1 w/ torch==1.12.0) Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> * change sourceball to development for testing * Test installer (MacOS 13.0.1 w/ torch==1.12.1 & torchvision==1.13.1) (#1622) * Test installer (Win 11) * Test installer (MacOS 13.0.1 w/ torch==1.12.0) * Test installer (MacOS 13.0.1 w/ torch==1.12.1 & torchvision==1.13.1) Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Co-authored-by: Cyrus Chan <82143712+cyruschan360@users.noreply.github.com> Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> * 2.2 Doc Updates (#1589) * Unified Canvas Docs & Assets Unified Canvas draft Advanced Tools Updates Doc Updates (lstein feedback) * copy edits to Unified Canvas docs - consistent capitalisation and feature naming - more intimate address (replace "the user" with "you") for improved User Engagement(tm) - grammatical massaging and *poesie* Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> Co-authored-by: damian <git@damianstewart.com> * include a step after config to `cat ~/.invokeai` (#1629) * disable patchmatch in CI actions (#1626) * disable patchmatch in CI actions * fix indention * replace tab with spaces Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> * Fix installer script for macOS. (#1630) * refer to the platform as 'osx' instead of 'mac', otherwise the composed URL to micromamba is wrong. * move the `-O` option to `tar` to be grouped with the other tar flags to avoid the `-O` being interpreted as something to unarchive. * Removes symlinked environment.yaml (#1631) Was unintentionally added in #1621 * Fix inpainting with iterations (#1635) * fix error when inpainting using runwayml inpainting model (#1634) - error was "Omnibus object has no attribute pil_image" - closes #1596 * add k_dpmpp_2_a and k_dpmpp_2 solvers options (#1389) * add k_dpmpp_2_a and k_dpmpp_2 solvers options * update frontend Co-authored-by: Victor <victorca25@users.noreply.github.com> Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> * add .editorconfig (#1636) * Web UI 2.2 bugfixes (#1572) * Fixes bug preventing multiple images from being generated * Fixes valid seam strength value range * Update Delete Alert Text Indicates to the user that images are not permanently deleted. * Fixes left/right arrows not working on gallery * Fixes initial image on load erroneously set to a user uploaded image Should be a result gallery image. * Lightbox Fixes - Lightbox is now a button in the current image buttons - Lightbox is also now available in the gallery context menu - Lightbox zoom issues fixed - Lightbox has a fade in animation. * Fix image display wrapper in current preview not overflow bounds * Revert "Fix image display wrapper in current preview not overflow bounds" This reverts commit 5511c82714dbf1d1999d64e8bc357bafa34ddf37. * Change Staging Area discard icon from Bin to X * Expose Snap Threshold and Move Snap Settings to BBox Panel * Changes img2img strength default to 0.75 * Fixes drawing triggering when mouse enters canvas w/ button down When we only supported inpainting and no zoom, this was useful. It allowed the cursor to leave the canvas (which was easy to do given the limited canvas dimensions) and without losing the "I am drawing" state. With a zoomable canvas this is no longer as useful. Additionally, we have more popovers and tools (like the color pickers) which result in unexpected brush strokes. This fixes that issue. * Revert "Expose Snap Threshold and Move Snap Settings to BBox Panel" We will handle this a bit differently - by allowing the grid origin to be moved. I will dig in at some point. This reverts commit 33c92ecf4da724c2f17d9d91c7ea31a43a2f6deb. * Adds Limit Strokes to Box * Adds fill bounding box button * Adds erase bounding box button * Changes Staging area discard icon to match others * Fixes right click breaking move tool * Fixes brush preview visibility issue with "darken outside box" * Fixes history bugs with addFillRect, addEraseRect, and other actions * Adds missing `key` * Fixes postprocessing being applied to canvas generations * Fixes bbox not getting scaled in various situations * Fixes staging area show image toggle not resetting on accept/discard * Locks down canvas while generating/staging * Fixes move tool breaking when canvas loses focus during move/transform * Hides cursor when restrict strokes is on and mouse outside bbox * Lints * Builds fresh bundle * Fix overlapping hotkey for Fill Bounding Box * Build Fresh Bundle * Fixes bug with mask and bbox overlay * Builds fresh bundle Co-authored-by: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> * disable NSFW checker loading during the CI tests (#1641) * disable NSFW checker loading during the CI tests The NSFW filter apparently causes invoke.py to crash during CI testing, possibly due to out of memory errors. This workaround disables NSFW model loading. * doc change * fix formatting errors in yml files * Configure the NSFW checker at install time with default on (#1624) * configure the NSFW checker at install time with default on 1. Changes the --safety_checker argument to --nsfw_checker and --no-nsfw_checker. The original argument is recognized for backward compatibility. 2. The configure script asks users whether to enable the checker (default yes). Also offers users ability to select default sampler and number of generation steps. 3.Enables the pasting of the caution icon on blurred images when InvokeAI is installed into the package directory. 4. Adds documentation for the NSFW checker, including caveats about accuracy, memory requirements, and intermediate image dispaly. * use better fitting icon * NSFW defaults false for testing * set default back to nsfw active Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> Signed-off-by: devops117 <55235206+devops117@users.noreply.github.com> Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Co-authored-by: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Co-authored-by: Kyle Schouviller <kyle0654@hotmail.com> Co-authored-by: javl <mail@jaspervanloenen.com> Co-authored-by: Kent Keirsey <31807370+hipsterusername@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com> Co-authored-by: Damian Stewart <d@damianstewart.com> Co-authored-by: DevOps117 <55235206+devops117@users.noreply.github.com> Co-authored-by: damian <git@damianstewart.com> Co-authored-by: Damian Stewart <null@damianstewart.com> Co-authored-by: Cyrus Chan <82143712+cyruschan360@users.noreply.github.com> Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> Co-authored-by: Andre LaBranche <dre@mac.com> Co-authored-by: victorca25 <41912303+victorca25@users.noreply.github.com> Co-authored-by: Victor <victorca25@users.noreply.github.com>
2022-11-30 21:12:23 +00:00
generator = self.select_generator(init_image, mask_image, embiggen, hires_fix, force_outpaint)
Refactoring simplet2i (#387) * start refactoring -not yet functional * first phase of refactor done - not sure weighted prompts working * Second phase of refactoring. Everything mostly working. * The refactoring has moved all the hard-core inference work into ldm.dream.generator.*, where there are submodules for txt2img and img2img. inpaint will go in there as well. * Some additional refactoring will be done soon, but relatively minor work. * fix -save_orig flag to actually work * add @neonsecret attention.py memory optimization * remove unneeded imports * move token logging into conditioning.py * add placeholder version of inpaint; porting in progress * fix crash in img2img * inpainting working; not tested on variations * fix crashes in img2img * ported attention.py memory optimization #117 from basujindal branch * added @torch_no_grad() decorators to img2img, txt2img, inpaint closures * Final commit prior to PR against development * fixup crash when generating intermediate images in web UI * rename ldm.simplet2i to ldm.generate * add backward-compatibility simplet2i shell with deprecation warning * add back in mps exception, addresses @vargol comment in #354 * replaced Conditioning class with exported functions * fix wrong type of with_variations attribute during intialization * changed "image_iterator()" to "get_make_image()" * raise NotImplementedError for calling get_make_image() in parent class * Update ldm/generate.py better error message Co-authored-by: Kevin Gibbons <bakkot@gmail.com> * minor stylistic fixes and assertion checks from code review * moved get_noise() method into img2img class * break get_noise() into two methods, one for txt2img and the other for img2img * inpainting works on non-square images now * make get_noise() an abstract method in base class * much improved inpainting Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
2022-09-06 00:40:10 +00:00
generator.set_variation(
self.seed, variation_amount, with_variations
)
generator.use_mps_noise = use_mps_noise
checker = {
'checker':self.safety_checker,
'extractor':self.safety_feature_extractor
} if self.safety_checker else None
Refactoring simplet2i (#387) * start refactoring -not yet functional * first phase of refactor done - not sure weighted prompts working * Second phase of refactoring. Everything mostly working. * The refactoring has moved all the hard-core inference work into ldm.dream.generator.*, where there are submodules for txt2img and img2img. inpaint will go in there as well. * Some additional refactoring will be done soon, but relatively minor work. * fix -save_orig flag to actually work * add @neonsecret attention.py memory optimization * remove unneeded imports * move token logging into conditioning.py * add placeholder version of inpaint; porting in progress * fix crash in img2img * inpainting working; not tested on variations * fix crashes in img2img * ported attention.py memory optimization #117 from basujindal branch * added @torch_no_grad() decorators to img2img, txt2img, inpaint closures * Final commit prior to PR against development * fixup crash when generating intermediate images in web UI * rename ldm.simplet2i to ldm.generate * add backward-compatibility simplet2i shell with deprecation warning * add back in mps exception, addresses @vargol comment in #354 * replaced Conditioning class with exported functions * fix wrong type of with_variations attribute during intialization * changed "image_iterator()" to "get_make_image()" * raise NotImplementedError for calling get_make_image() in parent class * Update ldm/generate.py better error message Co-authored-by: Kevin Gibbons <bakkot@gmail.com> * minor stylistic fixes and assertion checks from code review * moved get_noise() method into img2img class * break get_noise() into two methods, one for txt2img and the other for img2img * inpainting works on non-square images now * make get_noise() an abstract method in base class * much improved inpainting Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
2022-09-06 00:40:10 +00:00
results = generator.generate(
prompt,
iterations=iterations,
seed=self.seed,
sampler=self.sampler,
steps=steps,
cfg_scale=cfg_scale,
2022-10-23 12:58:25 +00:00
conditioning=(uc, c, extra_conditioning_info),
ddim_eta=ddim_eta,
image_callback=image_callback, # called after the final image is generated
step_callback=step_callback, # called after each intermediate image is generated
width=width,
height=height,
init_img=init_img, # embiggen needs to manipulate from the unmodified init_img
init_image=init_image, # notice that init_image is different from init_img
mask_image=mask_image,
strength=strength,
threshold=threshold,
perlin=perlin,
embiggen=embiggen,
embiggen_tiles=embiggen_tiles,
Merge dev into main for 2.2.0 (#1642) * Fixes inpainting + code cleanup * Disable stage info in Inpainting Tab * Mask Brush Preview now always at 0.5 opacity The new mask is only visible properly at max opacity but at max opacity the brush preview becomes fully opaque blocking the view. So the mask brush preview no remains at 0.5 no matter what the Brush opacity is. * Remove save button from Canvas Controls (cleanup) * Implements invert mask * Changes "Invert Mask" to "Preserve Masked Areas" * Fixes (?) spacebar issues * Patches redux-persist and redux-deep-persist with debounced persists Our app changes redux state very, very often. As our undo/redo history grows, the calls to persist state start to take in the 100ms range, due to a the deep cloning of the history. This causes very noticeable performance lag. The deep cloning is required because we need to blacklist certain items in redux from being persisted (e.g. the app's connection status). Debouncing the whole process of persistence is a simple and effective solution. Unfortunately, `redux-persist` dropped `debounce` between v4 and v5, replacing it with `throttle`. `throttle`, instead of delaying the expensive action until a period of X ms of inactivity, simply ensures the action is executed at least every X ms. Of course, this does not fix our performance issue. The patch is very simple. It adds a `debounce` argument - a number of milliseconds - and debounces `redux-persist`'s `update()` method (provided by `createPersistoid`) by that many ms. Before this, I also tried writing a custom storage adapter for `redux-persist` to debounce the calls to `localStorage.setItem()`. While this worked and was far less invasive, it doesn't actually address the issue. It turns out `setItem()` is a very fast part of the process. We use `redux-deep-persist` to simplify the `redux-persist` configuration, which can get complicated when you need to blacklist or whitelist deeply nested state. There is also a patch here for that library because it uses the same types as `redux-persist`. Unfortunately, the last release of `redux-persist` used a package `flat-stream` which was malicious and has been removed from npm. The latest commits to `redux-persist` (about 1 year ago) do not build; we cannot use the master branch. And between the last release and last commit, the changes have all been breaking. Patching this last release (about 3 years old at this point) directly is far simpler than attempting to fix the upstream library's master branch or figuring out an alternative to the malicious and now non-existent dependency. * Adds debouncing * Fixes AttributeError: 'dict' object has no attribute 'invert_mask' * Updates package.json to use redux-persist patches * Attempts to fix redux-persist debounce patch * Fixes undo/redo * Fixes invert mask * Debounce > 300ms * Limits history to 256 for each of undo and redo * Canvas styling * Hotkeys improvement * Add Metadata To Viewer * Increases CFG Scale max to 200 * Fix gallery width size for Outpainting Also fixes the canvas resizing failing n fast pushes * Fixes disappearing canvas grid lines * Adds staging area * Fixes "use all" not setting variationAmount Now sets to 0 when the image had variations. * Builds fresh bundle * Outpainting tab loads to empty canvas instead of upload * Fixes wonky canvas layer ordering & compositing * Fixes error on inpainting paste back `TypeError: 'float' object cannot be interpreted as an integer` * Hides staging area outline on mouseover prev/next * Fixes inpainting not doing img2img when no mask * Fixes bbox not resizing in outpainting if partially off screen * Fixes crashes during iterative outpaint. Still doesn't work correctly though. * Fix iterative outpainting by restoring original images * Moves image uploading to HTTP - It all seems to work fine - A lot of cleanup is still needed - Logging needs to be added - May need types to be reviewed * Fixes: outpainting temp images show in gallery * WIP refactor to unified canvas * Removes console.log from redux-persist patch * Initial unification of canvas * Removes all references to split inpainting/outpainting canvas * Add patchmatch and infill_method parameter to prompt2image (options are 'patchmatch' or 'tile'). * Fixes app after removing in/out-painting refs * Rebases on dev, updates new env files w/ patchmatch * Organises features/canvas * Fixes bounding box ending up offscreen * Organises features/canvas * Stops unnecessary canvas rescales on gallery state change * Fixes 2px layout shift on toggle canvas lock * Clips lines drawn while canvas locked When drawing with the locked canvas, if a brush stroke gets too close to the edge of the canvas and its stroke would extend past the edge of the canvas, the edge of that stroke will be seen after unlocking the canvas. This could cause a problem if you unlock the canvas and now have a bunch of strokes just outside the init image area, which are far back in undo history and you cannot easily erase. With this change, lines drawn while the canvas is locked get clipped to the initial image bbox, fixing this issue. Additionally, the merge and save to gallery functions have been updated to respect the initial image bbox so they function how you'd expect. * Fixes reset canvas view when locked * Fixes send to buttons * Fixes bounding box not being rounded to 64 * Abandons "inpainting" canvas lock * Fixes save to gallery including empty area, adds download and copy image * Fix Current Image display background going over image bounds * Sets status immediately when clicking Invoke * Adds hotkeys and refactors sharing of konva instances Adds hotkeys to canvas. As part of this change, the access to konva instance objects was refactored: Previously closure'd refs were used to indirectly get access to the konva instances outside of react components. Now, a getter and setter function are used to provide access directly to the konva objects. * Updates hotkeys * Fixes canvas showing spinner on first load Also adds good default canvas scale and positioning when no image is on it * Fixes possible hang on MaskCompositer * Improves behaviour when setting init canvas image/reset view * Resets bounding box coords/dims when no image present * Disables canvas actions which cannot be done during processing * Adds useToastWatcher hook - Dispatch an `addToast` action with standard Chakra toast options object to add a toast to the toastQueue - The hook is called in App.tsx and just useEffect's w/ toastQueue as dependency to create the toasts - So now you can add toasts anywhere you have access to `dispatch`, which includes middleware and thunks - Adds first usage of this for the save image buttons in canvas * Update Hotkey Info Add missing tooltip hotkeys and update the hotkeys modal to reflect the new hotkeys for the Unified Canvas. * Fix theme changer not displaying current theme on page refresh * Fix tab count in hotkeys panel * Unify Brush and Eraser Sizes * Fix staging area display toggle not working * Staging Area delete button is now red So it doesnt feel blended into to the rest of them. * Revert "Fix theme changer not displaying current theme on page refresh" This reverts commit 903edfb803e743500242589ff093a8a8a0912726. * Add arguments to use SSL to webserver * Integrates #1487 - touch events Need to add: - Pinch zoom - Touch-specific handling (some things aren't quite right) * Refactors upload-related async thunks - Now standard thunks instead of RTK createAsyncThunk() - Adds toasts for all canvas upload-related actions * Reorganises app file structure * Fixes Canvas Auto Save to Gallery * Fixes staging area outline * Adds staging area hotkeys, disables gallery left/right when staging * Fixes Use All Parameters * Fix metadata viewer image url length when viewing intermediate * Fixes intermediate images being tiny in txt2img/img2img * Removes stale code * Improves canvas status text and adds option to toggle debug info * Fixes paste image to upload * Adds model drop-down to site header * Adds theme changer popover * Fix missing key on ThemeChanger map * Fixes stage position changing on zoom * Hotkey Cleanup - Viewer is now Z - Canvas Move tool is V - sync with PS - Removed some unused hotkeys * Fix canvas resizing when both options and gallery are unpinned * Implements thumbnails for gallery - Thumbnails are saved whenever an image is saved, and when gallery requests images from server - Thumbnails saved at original image aspect ratio with width of 128px as WEBP - If the thumbnail property of an image is unavailable for whatever reason, the image's full size URL is used instead * Saves thumbnails to separate thumbnails directory * Thumbnail size = 256px * Fix Lightbox Issues * Disables canvas image saving functions when processing * Fix index error on going past last image in Gallery * WIP - Lightbox Fixes Still need to fix the images not being centered on load when the image res changes * Fixes another similar index error, simplifies logic * Reworks canvas toolbar * Fixes canvas toolbar upload button * Cleans up IAICanvasStatusText * Improves metadata handling, fixes #1450 - Removes model list from metadata - Adds generation's specific model to metadata - Displays full metadata in JSON viewer * Gracefully handles corrupted images; fixes #1486 - App does not crash if corrupted image loaded - Error is displayed in the UI console and CLI output if an image cannot be loaded * Adds hotkey to reset canvas interaction state If the canvas' interaction state (e.g. isMovingBoundingBox, isDrawing, etc) get stuck somehow, user can press Escape to reset the state. * Removes stray console.log() * Fixes bug causing gallery to close on context menu open * Minor bugfixes - When doing long-running canvas image exporting actions, display indeterminate progress bar - Fix staging area image outline not displaying after committing/discarding results * Removes unused imports * Fixes repo root .gitignore ignoring frontend things * Builds fresh bundle * Styling updates * Removes reasonsWhyNotReady The popover doesn't play well with the button being disabled, and I don't think adds any value. * Image gallery resize/style tweaks * Styles buttons for clearing canvas history and mask * First pass on Canvas options panel * Fixes bug where discarding staged images results in loss of history * Adds Save to Gallery button to staging toolbar * Rearrange some canvas toolbar icons Put brush stuff together and canvas movement stuff together * Fix gallery maxwidth on unified canvas * Update Layer hotkey display to UI * Adds option to crop to bounding box on save * Masking option tweaks * Crop to Bounding Box > Save Box Region Only * Adds clear temp folder * Updates mask options popover behavior * Builds fresh bundle * Fix styling on alert modals * Fix input checkbox styling being incorrect on light theme * Styling fixes * Improves gallery resize behaviour * Cap gallery size on canvas tab so it doesnt overflow * Fixes bug when postprocessing image with no metadata * Adds IAIAlertDialog component * Moves Loopback to app settings * Fixes metadata viewer not showing metadata after refresh Also adds Dream-style prompt to metadata * Adds outpainting specific options * Linting * Fixes gallery width on lightbox, fixes gallery button expansion * Builds fresh bundle * Fix Lightbox images of different res not centering * Update feature tooltip text * Highlight mask icon when on mask layer * Fix gallery not resizing correctly on open and close * Add loopback to just img2img. Remove from settings. * Fix to gallery resizing * Removes Advanced checkbox, cleans up options panel for unified canvas * Minor styling fixes to new options panel layout * Styling Updates * Adds infill method * Tab Styling Fixes * memoize outpainting options * Fix unnecessary gallery re-renders * Isolate Cursor Pos debug text on canvas to prevent rerenders * Fixes missing postprocessed image metadata before refresh * Builds fresh bundle * Fix rerenders on model select * Floating panel re-render fix * Simplify fullscreen hotkey selector * Add Training WIP Tab * Adds Training icon * Move full screen hotkey to floating to prevent tab rerenders * Adds single-column gallery layout * Fixes crash on cancel with intermediates enabled, fixes #1416 * Updates npm dependencies * Fixes img2img attempting inpaint when init image has transparency * Fixes missing threshold and perlin parameters in metadata viewer * Renames "Threshold" > "Noise Threshold" * Fixes postprocessing not being disabled when clicking use all * Builds fresh bundle * Adds color picker * Lints & builds fresh bundle * Fixes iterations being disabled when seed random & variations are off * Un-floors cursor position * Changes color picker preview to circles * Fixes variation params not set correctly when recalled * Fixes invoke hotkey not working in input fields * Simplifies Accordion Prep for adding reset buttons for each section * Fixes mask brush preview color * Committing color picker color changes tool to brush * Color picker does not overwrite user-selected alpha * Adds brush color alpha hotkey * Lints * Removes force_outpaint param * Add inpaint size options to inpaint at a larger size than the actual inpaint image, then scale back down for recombination * Bug fix for inpaint size * Adds inpaint size (as scale bounding box) to UI * Adds auto-scaling for inpaint size * Improves scaled bbox display logic * Fixes bug with clear mask and history * Fixes shouldShowStagingImage not resetting to true on commit * Builds fresh bundle * Fixes canvas failing to scale on first run * Builds fresh bundle * Fixes unnecessary canvas scaling * Adds gallery drag and drop to img2img/canvas * Builds fresh bundle * Fix desktop mode being broken with new versions of flaskwebgui * Fixes canvas dimensions not setting on first load * Builds fresh bundle * stop crash on !import_models call on model inside rootdir - addresses bug report #1546 * prevent "!switch state gets confused if model switching fails" - If !switch were to fail on a particular model, then generate got confused and wouldn't try again until you switch to a different working model and back again. - This commit fixes and closes #1547 * Revert "make the docstring more readable and improve the list_models logic" This reverts commit 248068fe5d57b5639ea7a87ee6cbf023104d957d. * fix model cache path * also set fail-fast to it's default (true) in this way the whole action fails if one job fails this should unblock the runners!!! * fix output path for Archive results * disable checks for python 3.9 * Update-requirements and test-invoke-pip workflow (#1574) * update requirements files * update test-invoke-pip workflow * move requirements-mkdocs.txt to docs folder (#1575) * move requirements-mkdocs.txt to docs folder * update copyright * Fixes outpainting with resized inpaint size * Interactive configuration (#1517) * Update scripts/configure_invokeai.py prevent crash if output exists Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> * implement changes requested by reviews * default to correct root and output directory on Windows systems - Previously the script was relying on the readline buffer editing feature to set up the correct default. But this feature doesn't exist on windows. - This commit detects when user typed return with an empty directory value and replaces with the default directory. * improved readability of directory choices * Update scripts/configure_invokeai.py Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> * better error reporting at startup - If user tries to run the script outside of the repo or runtime directory, a more informative message will appear explaining the problem. Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> * Embedding merging (#1526) * add whole <style token> to vocab for concept library embeddings * add ability to load multiple concept .bin files * make --log_tokenization respect custom tokens * start working on concept downloading system * preliminary support for dynamic loading and merging of multiple embedded models - The embedding_manager is now enhanced with ldm.invoke.concepts_lib, which handles dynamic downloading and caching of embedded models from the Hugging Face concepts library (https://huggingface.co/sd-concepts-library) - Downloading of a embedded model is triggered by the presence of one or more <concept> tags in the prompt. - Once the embedded model is downloaded, its trigger phrase will be loaded into the embedding manager and the prompt's <concept> tag will be replaced with the <trigger_phrase> - The downloaded model stays on disk for fast loading later. - The CLI autocomplete will complete partial <concept> tags for you. Type a '<' and hit tab to get all ~700 concepts. BUGS AND LIMITATIONS: - MODEL NAME VS TRIGGER PHRASE You must use the name of the concept embed model from the SD library, and not the trigger phrase itself. Usually these are the same, but not always. For example, the model named "hoi4-leaders" corresponds to the trigger "<HOI4-Leader>" One reason for this design choice is that there is no apparent constraint on the uniqueness of the trigger phrases and one trigger phrase may map onto multiple models. So we use the model name instead. The second reason is that there is no way I know of to search Hugging Face for models with certain trigger phrases. So we'd have to download all 700 models to index the phrases. The problem this presents is that this may confuse users, who will want to reuse prompts from distributions that use the trigger phrase directly. Usually this will work, but not always. - WON'T WORK ON A FIREWALLED SYSTEM If the host running IAI has no internet connection, it can't download the concept libraries. I will add a script that allows users to preload a list of concept models. - BUG IN PROMPT REPLACEMENT WHEN MODEL NOT FOUND There's a small bug that occurs when the user provides an invalid model name. The <concept> gets replaced with <None> in the prompt. * fix loading .pt embeddings; allow multi-vector embeddings; warn on dupes * simplify replacement logic and remove cuda assumption * download list of concepts from hugging face * remove misleading customization of '*' placeholder the existing code as-is did not do anything; unclear what it was supposed to do. the obvious alternative -- setting using 'placeholder_strings' instead of 'placeholder_tokens' to match model.params.personalization_config.params.placeholder_strings -- caused a crash. i think this is because the passed string also needed to be handed over on init of the PersonalizedBase as the 'placeholder_token' argument. this is weird config dict magic and i don't want to touch it. put a breakpoint in personalzied.py line 116 (top of PersonalizedBase.__init__) if you want to have a crack at it yourself. * address all the issues raised by damian0815 in review of PR #1526 * actually resize the token_embeddings * multiple improvements to the concept loader based on code reviews 1. Activated the --embedding_directory option (alias --embedding_path) to load a single embedding or an entire directory of embeddings at startup time. 2. Can turn off automatic loading of embeddings using --no-embeddings. 3. Embedding checkpoints are scanned with the pickle scanner. 4. More informative error messages when a concept can't be loaded due either to a 404 not found error or a network error. * autocomplete terms end with ">" now * fix startup error and network unreachable 1. If the .invokeai file does not contain the --root and --outdir options, invoke.py will now fix it. 2. Catch and handle network problems when downloading hugging face textual inversion concepts. * fix misformatted error string Co-authored-by: Damian Stewart <d@damianstewart.com> * model_cache.py: fix list_models Signed-off-by: devops117 <55235206+devops117@users.noreply.github.com> * add statement of values (#1584) * this adds the Statement of Values Google doc source = https://docs.google.com/document/d/1-PrUKDJcxy8OyNGc8CyiHhv2VgLvjt7LRGlEpbg1nmQ/edit?usp=sharing * Fix heading * Update InvokeAI_Statement_of_Values.md * Update InvokeAI_Statement_of_Values.md * Update InvokeAI_Statement_of_Values.md * Update InvokeAI_Statement_of_Values.md * Update InvokeAI_Statement_of_Values.md * add keturn and mauwii to the team member list * Fix punctuation * this adds the Statement of Values Google doc source = https://docs.google.com/document/d/1-PrUKDJcxy8OyNGc8CyiHhv2VgLvjt7LRGlEpbg1nmQ/edit?usp=sharing * add keturn and mauwii to the team member list * fix formating - make sub bullets use * (decide to all use - or *) - indent sub bullets Sorry, first only looked at the code version and found this only after looking at the markdown rendered version * use multiparagraph numbered sections * Break up Statement Of Values as per comments on #1584 * remove duplicated word, reduce vagueness it's important not to overstate how many artists we are consulting. * fix typo (sorry blessedcoolant) Co-authored-by: mauwii <Mauwii@outlook.de> Co-authored-by: damian <git@damianstewart.com> * update dockerfile (#1551) * update dockerfile * remove not existing file from .dockerignore * remove bloat and unecesary step also use --no-cache-dir for pip install image is now close to 2GB * make Dockerfile a variable * set base image to `ubuntu:22.10` * add build-essential * link outputs folder for persistence * update tag variable * update docs * fix not customizeable build args, add reqs output * !model_import autocompletes in ROOTDIR * Adds psychedelicious to statement of values signature (#1602) * add a --no-patchmatch option to disable patchmatch loading (#1598) This feature was added to prevent the CI Macintosh tests from erroring out when patchmatch is unable to retrieve its shared library from github assets. * Fix #1599 by relaxing the `match_trigger` regex (#1601) * Fix #1599 by relaxing the `match_trigger` regex Also simplify logic and reduce duplication. * restrict trigger regex again (but not so far) * make concepts library work with Web UI This PR makes it possible to include a Hugging Face concepts library <style-or-subject-trigger> in the WebUI prompt. The metadata seems to be correctly handled. * documentation enhancements (#1603) - Add documentation for the Hugging Face concepts library and TI embedding. - Fixup index.md to point to each of the feature documentation files, including ones that are pending. * tweak setup and environment files for linux & pypatchmatch (#1580) * tweak setup and environment files for linux & pypatchmatch - Downgrade python requirements to 3.9 because 3.10 is not supported on Ubuntu 20.04 LTS (widely-used distro) - Use our github pypatchmatch 0.1.3 in order to install Makefile where it needs to be. - Restored "-e ." as the last install step on pip installs. Hopefully this will not trigger the high-CPU hang we've previously experienced. * keep windows on basicsr 1.4.1 * keep windows on basicsr 1.4.1 * bump pypatchmatch requirement to 0.1.4 - This brings in a version of pypatchmatch that will gracefully handle internet connection not available at startup time. - Also refactors and simplifies the handling of gfpgan's basicsr requirement across various platforms. * revert to older version of list_models() (#1611) This restores the correct behavior of list_models() and quenches the bug of list_models() returning a single model entry named "name". I have not investigated what was wrong with the new version, but I think it may have to do with changes to the behavior in dict.update() * Fixes for #1604 (#1605) * Converts ESRGAN image input to RGB - Also adds typing for image input. - Partially resolves #1604 * ensure there are unmasked pixels before color matching Co-authored-by: Kyle Schouviller <kyle0654@hotmail.com> * update index.md (#1609) - comment out non existing link - fix indention - add seperator between feature categories * Debloat-docker (#1612) * debloat Dockerfile - less options more but more userfriendly - better Entrypoint to simulate CLI usage - without command the container still starts the web-host * debloat build.sh * better syntax in run.sh * update Docker docs - fix description of VOLUMENAME - update run script example to reflect new entrypoint * Test installer (#1618) * test linux install * try removing http from parsed requirements * pip install confirmed working on linux * ready for linux testing - rebuilt py3.10-linux-x86_64-cuda-reqs.txt to include pypatchmatch dependency. - point install.sh and install.bat to test-installer branch. * Updates MPS reqs * detect broken readline history files * fix download.pytorch.org URL * Test installer (Win 11) (#1620) Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> * Test installer (MacOS 13.0.1 w/ torch==1.12.0) (#1621) * Test installer (Win 11) * Test installer (MacOS 13.0.1 w/ torch==1.12.0) Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> * change sourceball to development for testing * Test installer (MacOS 13.0.1 w/ torch==1.12.1 & torchvision==1.13.1) (#1622) * Test installer (Win 11) * Test installer (MacOS 13.0.1 w/ torch==1.12.0) * Test installer (MacOS 13.0.1 w/ torch==1.12.1 & torchvision==1.13.1) Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Co-authored-by: Cyrus Chan <82143712+cyruschan360@users.noreply.github.com> Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> * 2.2 Doc Updates (#1589) * Unified Canvas Docs & Assets Unified Canvas draft Advanced Tools Updates Doc Updates (lstein feedback) * copy edits to Unified Canvas docs - consistent capitalisation and feature naming - more intimate address (replace "the user" with "you") for improved User Engagement(tm) - grammatical massaging and *poesie* Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> Co-authored-by: damian <git@damianstewart.com> * include a step after config to `cat ~/.invokeai` (#1629) * disable patchmatch in CI actions (#1626) * disable patchmatch in CI actions * fix indention * replace tab with spaces Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> * Fix installer script for macOS. (#1630) * refer to the platform as 'osx' instead of 'mac', otherwise the composed URL to micromamba is wrong. * move the `-O` option to `tar` to be grouped with the other tar flags to avoid the `-O` being interpreted as something to unarchive. * Removes symlinked environment.yaml (#1631) Was unintentionally added in #1621 * Fix inpainting with iterations (#1635) * fix error when inpainting using runwayml inpainting model (#1634) - error was "Omnibus object has no attribute pil_image" - closes #1596 * add k_dpmpp_2_a and k_dpmpp_2 solvers options (#1389) * add k_dpmpp_2_a and k_dpmpp_2 solvers options * update frontend Co-authored-by: Victor <victorca25@users.noreply.github.com> Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> * add .editorconfig (#1636) * Web UI 2.2 bugfixes (#1572) * Fixes bug preventing multiple images from being generated * Fixes valid seam strength value range * Update Delete Alert Text Indicates to the user that images are not permanently deleted. * Fixes left/right arrows not working on gallery * Fixes initial image on load erroneously set to a user uploaded image Should be a result gallery image. * Lightbox Fixes - Lightbox is now a button in the current image buttons - Lightbox is also now available in the gallery context menu - Lightbox zoom issues fixed - Lightbox has a fade in animation. * Fix image display wrapper in current preview not overflow bounds * Revert "Fix image display wrapper in current preview not overflow bounds" This reverts commit 5511c82714dbf1d1999d64e8bc357bafa34ddf37. * Change Staging Area discard icon from Bin to X * Expose Snap Threshold and Move Snap Settings to BBox Panel * Changes img2img strength default to 0.75 * Fixes drawing triggering when mouse enters canvas w/ button down When we only supported inpainting and no zoom, this was useful. It allowed the cursor to leave the canvas (which was easy to do given the limited canvas dimensions) and without losing the "I am drawing" state. With a zoomable canvas this is no longer as useful. Additionally, we have more popovers and tools (like the color pickers) which result in unexpected brush strokes. This fixes that issue. * Revert "Expose Snap Threshold and Move Snap Settings to BBox Panel" We will handle this a bit differently - by allowing the grid origin to be moved. I will dig in at some point. This reverts commit 33c92ecf4da724c2f17d9d91c7ea31a43a2f6deb. * Adds Limit Strokes to Box * Adds fill bounding box button * Adds erase bounding box button * Changes Staging area discard icon to match others * Fixes right click breaking move tool * Fixes brush preview visibility issue with "darken outside box" * Fixes history bugs with addFillRect, addEraseRect, and other actions * Adds missing `key` * Fixes postprocessing being applied to canvas generations * Fixes bbox not getting scaled in various situations * Fixes staging area show image toggle not resetting on accept/discard * Locks down canvas while generating/staging * Fixes move tool breaking when canvas loses focus during move/transform * Hides cursor when restrict strokes is on and mouse outside bbox * Lints * Builds fresh bundle * Fix overlapping hotkey for Fill Bounding Box * Build Fresh Bundle * Fixes bug with mask and bbox overlay * Builds fresh bundle Co-authored-by: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> * disable NSFW checker loading during the CI tests (#1641) * disable NSFW checker loading during the CI tests The NSFW filter apparently causes invoke.py to crash during CI testing, possibly due to out of memory errors. This workaround disables NSFW model loading. * doc change * fix formatting errors in yml files * Configure the NSFW checker at install time with default on (#1624) * configure the NSFW checker at install time with default on 1. Changes the --safety_checker argument to --nsfw_checker and --no-nsfw_checker. The original argument is recognized for backward compatibility. 2. The configure script asks users whether to enable the checker (default yes). Also offers users ability to select default sampler and number of generation steps. 3.Enables the pasting of the caution icon on blurred images when InvokeAI is installed into the package directory. 4. Adds documentation for the NSFW checker, including caveats about accuracy, memory requirements, and intermediate image dispaly. * use better fitting icon * NSFW defaults false for testing * set default back to nsfw active Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> Signed-off-by: devops117 <55235206+devops117@users.noreply.github.com> Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Co-authored-by: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Co-authored-by: Kyle Schouviller <kyle0654@hotmail.com> Co-authored-by: javl <mail@jaspervanloenen.com> Co-authored-by: Kent Keirsey <31807370+hipsterusername@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com> Co-authored-by: Damian Stewart <d@damianstewart.com> Co-authored-by: DevOps117 <55235206+devops117@users.noreply.github.com> Co-authored-by: damian <git@damianstewart.com> Co-authored-by: Damian Stewart <null@damianstewart.com> Co-authored-by: Cyrus Chan <82143712+cyruschan360@users.noreply.github.com> Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> Co-authored-by: Andre LaBranche <dre@mac.com> Co-authored-by: victorca25 <41912303+victorca25@users.noreply.github.com> Co-authored-by: Victor <victorca25@users.noreply.github.com>
2022-11-30 21:12:23 +00:00
embiggen_strength=embiggen_strength,
inpaint_replace=inpaint_replace,
mask_blur_radius=mask_blur_radius,
safety_checker=checker,
seam_size = seam_size,
seam_blur = seam_blur,
seam_strength = seam_strength,
seam_steps = seam_steps,
tile_size = tile_size,
Merge dev into main for 2.2.0 (#1642) * Fixes inpainting + code cleanup * Disable stage info in Inpainting Tab * Mask Brush Preview now always at 0.5 opacity The new mask is only visible properly at max opacity but at max opacity the brush preview becomes fully opaque blocking the view. So the mask brush preview no remains at 0.5 no matter what the Brush opacity is. * Remove save button from Canvas Controls (cleanup) * Implements invert mask * Changes "Invert Mask" to "Preserve Masked Areas" * Fixes (?) spacebar issues * Patches redux-persist and redux-deep-persist with debounced persists Our app changes redux state very, very often. As our undo/redo history grows, the calls to persist state start to take in the 100ms range, due to a the deep cloning of the history. This causes very noticeable performance lag. The deep cloning is required because we need to blacklist certain items in redux from being persisted (e.g. the app's connection status). Debouncing the whole process of persistence is a simple and effective solution. Unfortunately, `redux-persist` dropped `debounce` between v4 and v5, replacing it with `throttle`. `throttle`, instead of delaying the expensive action until a period of X ms of inactivity, simply ensures the action is executed at least every X ms. Of course, this does not fix our performance issue. The patch is very simple. It adds a `debounce` argument - a number of milliseconds - and debounces `redux-persist`'s `update()` method (provided by `createPersistoid`) by that many ms. Before this, I also tried writing a custom storage adapter for `redux-persist` to debounce the calls to `localStorage.setItem()`. While this worked and was far less invasive, it doesn't actually address the issue. It turns out `setItem()` is a very fast part of the process. We use `redux-deep-persist` to simplify the `redux-persist` configuration, which can get complicated when you need to blacklist or whitelist deeply nested state. There is also a patch here for that library because it uses the same types as `redux-persist`. Unfortunately, the last release of `redux-persist` used a package `flat-stream` which was malicious and has been removed from npm. The latest commits to `redux-persist` (about 1 year ago) do not build; we cannot use the master branch. And between the last release and last commit, the changes have all been breaking. Patching this last release (about 3 years old at this point) directly is far simpler than attempting to fix the upstream library's master branch or figuring out an alternative to the malicious and now non-existent dependency. * Adds debouncing * Fixes AttributeError: 'dict' object has no attribute 'invert_mask' * Updates package.json to use redux-persist patches * Attempts to fix redux-persist debounce patch * Fixes undo/redo * Fixes invert mask * Debounce > 300ms * Limits history to 256 for each of undo and redo * Canvas styling * Hotkeys improvement * Add Metadata To Viewer * Increases CFG Scale max to 200 * Fix gallery width size for Outpainting Also fixes the canvas resizing failing n fast pushes * Fixes disappearing canvas grid lines * Adds staging area * Fixes "use all" not setting variationAmount Now sets to 0 when the image had variations. * Builds fresh bundle * Outpainting tab loads to empty canvas instead of upload * Fixes wonky canvas layer ordering & compositing * Fixes error on inpainting paste back `TypeError: 'float' object cannot be interpreted as an integer` * Hides staging area outline on mouseover prev/next * Fixes inpainting not doing img2img when no mask * Fixes bbox not resizing in outpainting if partially off screen * Fixes crashes during iterative outpaint. Still doesn't work correctly though. * Fix iterative outpainting by restoring original images * Moves image uploading to HTTP - It all seems to work fine - A lot of cleanup is still needed - Logging needs to be added - May need types to be reviewed * Fixes: outpainting temp images show in gallery * WIP refactor to unified canvas * Removes console.log from redux-persist patch * Initial unification of canvas * Removes all references to split inpainting/outpainting canvas * Add patchmatch and infill_method parameter to prompt2image (options are 'patchmatch' or 'tile'). * Fixes app after removing in/out-painting refs * Rebases on dev, updates new env files w/ patchmatch * Organises features/canvas * Fixes bounding box ending up offscreen * Organises features/canvas * Stops unnecessary canvas rescales on gallery state change * Fixes 2px layout shift on toggle canvas lock * Clips lines drawn while canvas locked When drawing with the locked canvas, if a brush stroke gets too close to the edge of the canvas and its stroke would extend past the edge of the canvas, the edge of that stroke will be seen after unlocking the canvas. This could cause a problem if you unlock the canvas and now have a bunch of strokes just outside the init image area, which are far back in undo history and you cannot easily erase. With this change, lines drawn while the canvas is locked get clipped to the initial image bbox, fixing this issue. Additionally, the merge and save to gallery functions have been updated to respect the initial image bbox so they function how you'd expect. * Fixes reset canvas view when locked * Fixes send to buttons * Fixes bounding box not being rounded to 64 * Abandons "inpainting" canvas lock * Fixes save to gallery including empty area, adds download and copy image * Fix Current Image display background going over image bounds * Sets status immediately when clicking Invoke * Adds hotkeys and refactors sharing of konva instances Adds hotkeys to canvas. As part of this change, the access to konva instance objects was refactored: Previously closure'd refs were used to indirectly get access to the konva instances outside of react components. Now, a getter and setter function are used to provide access directly to the konva objects. * Updates hotkeys * Fixes canvas showing spinner on first load Also adds good default canvas scale and positioning when no image is on it * Fixes possible hang on MaskCompositer * Improves behaviour when setting init canvas image/reset view * Resets bounding box coords/dims when no image present * Disables canvas actions which cannot be done during processing * Adds useToastWatcher hook - Dispatch an `addToast` action with standard Chakra toast options object to add a toast to the toastQueue - The hook is called in App.tsx and just useEffect's w/ toastQueue as dependency to create the toasts - So now you can add toasts anywhere you have access to `dispatch`, which includes middleware and thunks - Adds first usage of this for the save image buttons in canvas * Update Hotkey Info Add missing tooltip hotkeys and update the hotkeys modal to reflect the new hotkeys for the Unified Canvas. * Fix theme changer not displaying current theme on page refresh * Fix tab count in hotkeys panel * Unify Brush and Eraser Sizes * Fix staging area display toggle not working * Staging Area delete button is now red So it doesnt feel blended into to the rest of them. * Revert "Fix theme changer not displaying current theme on page refresh" This reverts commit 903edfb803e743500242589ff093a8a8a0912726. * Add arguments to use SSL to webserver * Integrates #1487 - touch events Need to add: - Pinch zoom - Touch-specific handling (some things aren't quite right) * Refactors upload-related async thunks - Now standard thunks instead of RTK createAsyncThunk() - Adds toasts for all canvas upload-related actions * Reorganises app file structure * Fixes Canvas Auto Save to Gallery * Fixes staging area outline * Adds staging area hotkeys, disables gallery left/right when staging * Fixes Use All Parameters * Fix metadata viewer image url length when viewing intermediate * Fixes intermediate images being tiny in txt2img/img2img * Removes stale code * Improves canvas status text and adds option to toggle debug info * Fixes paste image to upload * Adds model drop-down to site header * Adds theme changer popover * Fix missing key on ThemeChanger map * Fixes stage position changing on zoom * Hotkey Cleanup - Viewer is now Z - Canvas Move tool is V - sync with PS - Removed some unused hotkeys * Fix canvas resizing when both options and gallery are unpinned * Implements thumbnails for gallery - Thumbnails are saved whenever an image is saved, and when gallery requests images from server - Thumbnails saved at original image aspect ratio with width of 128px as WEBP - If the thumbnail property of an image is unavailable for whatever reason, the image's full size URL is used instead * Saves thumbnails to separate thumbnails directory * Thumbnail size = 256px * Fix Lightbox Issues * Disables canvas image saving functions when processing * Fix index error on going past last image in Gallery * WIP - Lightbox Fixes Still need to fix the images not being centered on load when the image res changes * Fixes another similar index error, simplifies logic * Reworks canvas toolbar * Fixes canvas toolbar upload button * Cleans up IAICanvasStatusText * Improves metadata handling, fixes #1450 - Removes model list from metadata - Adds generation's specific model to metadata - Displays full metadata in JSON viewer * Gracefully handles corrupted images; fixes #1486 - App does not crash if corrupted image loaded - Error is displayed in the UI console and CLI output if an image cannot be loaded * Adds hotkey to reset canvas interaction state If the canvas' interaction state (e.g. isMovingBoundingBox, isDrawing, etc) get stuck somehow, user can press Escape to reset the state. * Removes stray console.log() * Fixes bug causing gallery to close on context menu open * Minor bugfixes - When doing long-running canvas image exporting actions, display indeterminate progress bar - Fix staging area image outline not displaying after committing/discarding results * Removes unused imports * Fixes repo root .gitignore ignoring frontend things * Builds fresh bundle * Styling updates * Removes reasonsWhyNotReady The popover doesn't play well with the button being disabled, and I don't think adds any value. * Image gallery resize/style tweaks * Styles buttons for clearing canvas history and mask * First pass on Canvas options panel * Fixes bug where discarding staged images results in loss of history * Adds Save to Gallery button to staging toolbar * Rearrange some canvas toolbar icons Put brush stuff together and canvas movement stuff together * Fix gallery maxwidth on unified canvas * Update Layer hotkey display to UI * Adds option to crop to bounding box on save * Masking option tweaks * Crop to Bounding Box > Save Box Region Only * Adds clear temp folder * Updates mask options popover behavior * Builds fresh bundle * Fix styling on alert modals * Fix input checkbox styling being incorrect on light theme * Styling fixes * Improves gallery resize behaviour * Cap gallery size on canvas tab so it doesnt overflow * Fixes bug when postprocessing image with no metadata * Adds IAIAlertDialog component * Moves Loopback to app settings * Fixes metadata viewer not showing metadata after refresh Also adds Dream-style prompt to metadata * Adds outpainting specific options * Linting * Fixes gallery width on lightbox, fixes gallery button expansion * Builds fresh bundle * Fix Lightbox images of different res not centering * Update feature tooltip text * Highlight mask icon when on mask layer * Fix gallery not resizing correctly on open and close * Add loopback to just img2img. Remove from settings. * Fix to gallery resizing * Removes Advanced checkbox, cleans up options panel for unified canvas * Minor styling fixes to new options panel layout * Styling Updates * Adds infill method * Tab Styling Fixes * memoize outpainting options * Fix unnecessary gallery re-renders * Isolate Cursor Pos debug text on canvas to prevent rerenders * Fixes missing postprocessed image metadata before refresh * Builds fresh bundle * Fix rerenders on model select * Floating panel re-render fix * Simplify fullscreen hotkey selector * Add Training WIP Tab * Adds Training icon * Move full screen hotkey to floating to prevent tab rerenders * Adds single-column gallery layout * Fixes crash on cancel with intermediates enabled, fixes #1416 * Updates npm dependencies * Fixes img2img attempting inpaint when init image has transparency * Fixes missing threshold and perlin parameters in metadata viewer * Renames "Threshold" > "Noise Threshold" * Fixes postprocessing not being disabled when clicking use all * Builds fresh bundle * Adds color picker * Lints & builds fresh bundle * Fixes iterations being disabled when seed random & variations are off * Un-floors cursor position * Changes color picker preview to circles * Fixes variation params not set correctly when recalled * Fixes invoke hotkey not working in input fields * Simplifies Accordion Prep for adding reset buttons for each section * Fixes mask brush preview color * Committing color picker color changes tool to brush * Color picker does not overwrite user-selected alpha * Adds brush color alpha hotkey * Lints * Removes force_outpaint param * Add inpaint size options to inpaint at a larger size than the actual inpaint image, then scale back down for recombination * Bug fix for inpaint size * Adds inpaint size (as scale bounding box) to UI * Adds auto-scaling for inpaint size * Improves scaled bbox display logic * Fixes bug with clear mask and history * Fixes shouldShowStagingImage not resetting to true on commit * Builds fresh bundle * Fixes canvas failing to scale on first run * Builds fresh bundle * Fixes unnecessary canvas scaling * Adds gallery drag and drop to img2img/canvas * Builds fresh bundle * Fix desktop mode being broken with new versions of flaskwebgui * Fixes canvas dimensions not setting on first load * Builds fresh bundle * stop crash on !import_models call on model inside rootdir - addresses bug report #1546 * prevent "!switch state gets confused if model switching fails" - If !switch were to fail on a particular model, then generate got confused and wouldn't try again until you switch to a different working model and back again. - This commit fixes and closes #1547 * Revert "make the docstring more readable and improve the list_models logic" This reverts commit 248068fe5d57b5639ea7a87ee6cbf023104d957d. * fix model cache path * also set fail-fast to it's default (true) in this way the whole action fails if one job fails this should unblock the runners!!! * fix output path for Archive results * disable checks for python 3.9 * Update-requirements and test-invoke-pip workflow (#1574) * update requirements files * update test-invoke-pip workflow * move requirements-mkdocs.txt to docs folder (#1575) * move requirements-mkdocs.txt to docs folder * update copyright * Fixes outpainting with resized inpaint size * Interactive configuration (#1517) * Update scripts/configure_invokeai.py prevent crash if output exists Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> * implement changes requested by reviews * default to correct root and output directory on Windows systems - Previously the script was relying on the readline buffer editing feature to set up the correct default. But this feature doesn't exist on windows. - This commit detects when user typed return with an empty directory value and replaces with the default directory. * improved readability of directory choices * Update scripts/configure_invokeai.py Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> * better error reporting at startup - If user tries to run the script outside of the repo or runtime directory, a more informative message will appear explaining the problem. Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> * Embedding merging (#1526) * add whole <style token> to vocab for concept library embeddings * add ability to load multiple concept .bin files * make --log_tokenization respect custom tokens * start working on concept downloading system * preliminary support for dynamic loading and merging of multiple embedded models - The embedding_manager is now enhanced with ldm.invoke.concepts_lib, which handles dynamic downloading and caching of embedded models from the Hugging Face concepts library (https://huggingface.co/sd-concepts-library) - Downloading of a embedded model is triggered by the presence of one or more <concept> tags in the prompt. - Once the embedded model is downloaded, its trigger phrase will be loaded into the embedding manager and the prompt's <concept> tag will be replaced with the <trigger_phrase> - The downloaded model stays on disk for fast loading later. - The CLI autocomplete will complete partial <concept> tags for you. Type a '<' and hit tab to get all ~700 concepts. BUGS AND LIMITATIONS: - MODEL NAME VS TRIGGER PHRASE You must use the name of the concept embed model from the SD library, and not the trigger phrase itself. Usually these are the same, but not always. For example, the model named "hoi4-leaders" corresponds to the trigger "<HOI4-Leader>" One reason for this design choice is that there is no apparent constraint on the uniqueness of the trigger phrases and one trigger phrase may map onto multiple models. So we use the model name instead. The second reason is that there is no way I know of to search Hugging Face for models with certain trigger phrases. So we'd have to download all 700 models to index the phrases. The problem this presents is that this may confuse users, who will want to reuse prompts from distributions that use the trigger phrase directly. Usually this will work, but not always. - WON'T WORK ON A FIREWALLED SYSTEM If the host running IAI has no internet connection, it can't download the concept libraries. I will add a script that allows users to preload a list of concept models. - BUG IN PROMPT REPLACEMENT WHEN MODEL NOT FOUND There's a small bug that occurs when the user provides an invalid model name. The <concept> gets replaced with <None> in the prompt. * fix loading .pt embeddings; allow multi-vector embeddings; warn on dupes * simplify replacement logic and remove cuda assumption * download list of concepts from hugging face * remove misleading customization of '*' placeholder the existing code as-is did not do anything; unclear what it was supposed to do. the obvious alternative -- setting using 'placeholder_strings' instead of 'placeholder_tokens' to match model.params.personalization_config.params.placeholder_strings -- caused a crash. i think this is because the passed string also needed to be handed over on init of the PersonalizedBase as the 'placeholder_token' argument. this is weird config dict magic and i don't want to touch it. put a breakpoint in personalzied.py line 116 (top of PersonalizedBase.__init__) if you want to have a crack at it yourself. * address all the issues raised by damian0815 in review of PR #1526 * actually resize the token_embeddings * multiple improvements to the concept loader based on code reviews 1. Activated the --embedding_directory option (alias --embedding_path) to load a single embedding or an entire directory of embeddings at startup time. 2. Can turn off automatic loading of embeddings using --no-embeddings. 3. Embedding checkpoints are scanned with the pickle scanner. 4. More informative error messages when a concept can't be loaded due either to a 404 not found error or a network error. * autocomplete terms end with ">" now * fix startup error and network unreachable 1. If the .invokeai file does not contain the --root and --outdir options, invoke.py will now fix it. 2. Catch and handle network problems when downloading hugging face textual inversion concepts. * fix misformatted error string Co-authored-by: Damian Stewart <d@damianstewart.com> * model_cache.py: fix list_models Signed-off-by: devops117 <55235206+devops117@users.noreply.github.com> * add statement of values (#1584) * this adds the Statement of Values Google doc source = https://docs.google.com/document/d/1-PrUKDJcxy8OyNGc8CyiHhv2VgLvjt7LRGlEpbg1nmQ/edit?usp=sharing * Fix heading * Update InvokeAI_Statement_of_Values.md * Update InvokeAI_Statement_of_Values.md * Update InvokeAI_Statement_of_Values.md * Update InvokeAI_Statement_of_Values.md * Update InvokeAI_Statement_of_Values.md * add keturn and mauwii to the team member list * Fix punctuation * this adds the Statement of Values Google doc source = https://docs.google.com/document/d/1-PrUKDJcxy8OyNGc8CyiHhv2VgLvjt7LRGlEpbg1nmQ/edit?usp=sharing * add keturn and mauwii to the team member list * fix formating - make sub bullets use * (decide to all use - or *) - indent sub bullets Sorry, first only looked at the code version and found this only after looking at the markdown rendered version * use multiparagraph numbered sections * Break up Statement Of Values as per comments on #1584 * remove duplicated word, reduce vagueness it's important not to overstate how many artists we are consulting. * fix typo (sorry blessedcoolant) Co-authored-by: mauwii <Mauwii@outlook.de> Co-authored-by: damian <git@damianstewart.com> * update dockerfile (#1551) * update dockerfile * remove not existing file from .dockerignore * remove bloat and unecesary step also use --no-cache-dir for pip install image is now close to 2GB * make Dockerfile a variable * set base image to `ubuntu:22.10` * add build-essential * link outputs folder for persistence * update tag variable * update docs * fix not customizeable build args, add reqs output * !model_import autocompletes in ROOTDIR * Adds psychedelicious to statement of values signature (#1602) * add a --no-patchmatch option to disable patchmatch loading (#1598) This feature was added to prevent the CI Macintosh tests from erroring out when patchmatch is unable to retrieve its shared library from github assets. * Fix #1599 by relaxing the `match_trigger` regex (#1601) * Fix #1599 by relaxing the `match_trigger` regex Also simplify logic and reduce duplication. * restrict trigger regex again (but not so far) * make concepts library work with Web UI This PR makes it possible to include a Hugging Face concepts library <style-or-subject-trigger> in the WebUI prompt. The metadata seems to be correctly handled. * documentation enhancements (#1603) - Add documentation for the Hugging Face concepts library and TI embedding. - Fixup index.md to point to each of the feature documentation files, including ones that are pending. * tweak setup and environment files for linux & pypatchmatch (#1580) * tweak setup and environment files for linux & pypatchmatch - Downgrade python requirements to 3.9 because 3.10 is not supported on Ubuntu 20.04 LTS (widely-used distro) - Use our github pypatchmatch 0.1.3 in order to install Makefile where it needs to be. - Restored "-e ." as the last install step on pip installs. Hopefully this will not trigger the high-CPU hang we've previously experienced. * keep windows on basicsr 1.4.1 * keep windows on basicsr 1.4.1 * bump pypatchmatch requirement to 0.1.4 - This brings in a version of pypatchmatch that will gracefully handle internet connection not available at startup time. - Also refactors and simplifies the handling of gfpgan's basicsr requirement across various platforms. * revert to older version of list_models() (#1611) This restores the correct behavior of list_models() and quenches the bug of list_models() returning a single model entry named "name". I have not investigated what was wrong with the new version, but I think it may have to do with changes to the behavior in dict.update() * Fixes for #1604 (#1605) * Converts ESRGAN image input to RGB - Also adds typing for image input. - Partially resolves #1604 * ensure there are unmasked pixels before color matching Co-authored-by: Kyle Schouviller <kyle0654@hotmail.com> * update index.md (#1609) - comment out non existing link - fix indention - add seperator between feature categories * Debloat-docker (#1612) * debloat Dockerfile - less options more but more userfriendly - better Entrypoint to simulate CLI usage - without command the container still starts the web-host * debloat build.sh * better syntax in run.sh * update Docker docs - fix description of VOLUMENAME - update run script example to reflect new entrypoint * Test installer (#1618) * test linux install * try removing http from parsed requirements * pip install confirmed working on linux * ready for linux testing - rebuilt py3.10-linux-x86_64-cuda-reqs.txt to include pypatchmatch dependency. - point install.sh and install.bat to test-installer branch. * Updates MPS reqs * detect broken readline history files * fix download.pytorch.org URL * Test installer (Win 11) (#1620) Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> * Test installer (MacOS 13.0.1 w/ torch==1.12.0) (#1621) * Test installer (Win 11) * Test installer (MacOS 13.0.1 w/ torch==1.12.0) Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> * change sourceball to development for testing * Test installer (MacOS 13.0.1 w/ torch==1.12.1 & torchvision==1.13.1) (#1622) * Test installer (Win 11) * Test installer (MacOS 13.0.1 w/ torch==1.12.0) * Test installer (MacOS 13.0.1 w/ torch==1.12.1 & torchvision==1.13.1) Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Co-authored-by: Cyrus Chan <82143712+cyruschan360@users.noreply.github.com> Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> * 2.2 Doc Updates (#1589) * Unified Canvas Docs & Assets Unified Canvas draft Advanced Tools Updates Doc Updates (lstein feedback) * copy edits to Unified Canvas docs - consistent capitalisation and feature naming - more intimate address (replace "the user" with "you") for improved User Engagement(tm) - grammatical massaging and *poesie* Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> Co-authored-by: damian <git@damianstewart.com> * include a step after config to `cat ~/.invokeai` (#1629) * disable patchmatch in CI actions (#1626) * disable patchmatch in CI actions * fix indention * replace tab with spaces Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> * Fix installer script for macOS. (#1630) * refer to the platform as 'osx' instead of 'mac', otherwise the composed URL to micromamba is wrong. * move the `-O` option to `tar` to be grouped with the other tar flags to avoid the `-O` being interpreted as something to unarchive. * Removes symlinked environment.yaml (#1631) Was unintentionally added in #1621 * Fix inpainting with iterations (#1635) * fix error when inpainting using runwayml inpainting model (#1634) - error was "Omnibus object has no attribute pil_image" - closes #1596 * add k_dpmpp_2_a and k_dpmpp_2 solvers options (#1389) * add k_dpmpp_2_a and k_dpmpp_2 solvers options * update frontend Co-authored-by: Victor <victorca25@users.noreply.github.com> Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> * add .editorconfig (#1636) * Web UI 2.2 bugfixes (#1572) * Fixes bug preventing multiple images from being generated * Fixes valid seam strength value range * Update Delete Alert Text Indicates to the user that images are not permanently deleted. * Fixes left/right arrows not working on gallery * Fixes initial image on load erroneously set to a user uploaded image Should be a result gallery image. * Lightbox Fixes - Lightbox is now a button in the current image buttons - Lightbox is also now available in the gallery context menu - Lightbox zoom issues fixed - Lightbox has a fade in animation. * Fix image display wrapper in current preview not overflow bounds * Revert "Fix image display wrapper in current preview not overflow bounds" This reverts commit 5511c82714dbf1d1999d64e8bc357bafa34ddf37. * Change Staging Area discard icon from Bin to X * Expose Snap Threshold and Move Snap Settings to BBox Panel * Changes img2img strength default to 0.75 * Fixes drawing triggering when mouse enters canvas w/ button down When we only supported inpainting and no zoom, this was useful. It allowed the cursor to leave the canvas (which was easy to do given the limited canvas dimensions) and without losing the "I am drawing" state. With a zoomable canvas this is no longer as useful. Additionally, we have more popovers and tools (like the color pickers) which result in unexpected brush strokes. This fixes that issue. * Revert "Expose Snap Threshold and Move Snap Settings to BBox Panel" We will handle this a bit differently - by allowing the grid origin to be moved. I will dig in at some point. This reverts commit 33c92ecf4da724c2f17d9d91c7ea31a43a2f6deb. * Adds Limit Strokes to Box * Adds fill bounding box button * Adds erase bounding box button * Changes Staging area discard icon to match others * Fixes right click breaking move tool * Fixes brush preview visibility issue with "darken outside box" * Fixes history bugs with addFillRect, addEraseRect, and other actions * Adds missing `key` * Fixes postprocessing being applied to canvas generations * Fixes bbox not getting scaled in various situations * Fixes staging area show image toggle not resetting on accept/discard * Locks down canvas while generating/staging * Fixes move tool breaking when canvas loses focus during move/transform * Hides cursor when restrict strokes is on and mouse outside bbox * Lints * Builds fresh bundle * Fix overlapping hotkey for Fill Bounding Box * Build Fresh Bundle * Fixes bug with mask and bbox overlay * Builds fresh bundle Co-authored-by: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> * disable NSFW checker loading during the CI tests (#1641) * disable NSFW checker loading during the CI tests The NSFW filter apparently causes invoke.py to crash during CI testing, possibly due to out of memory errors. This workaround disables NSFW model loading. * doc change * fix formatting errors in yml files * Configure the NSFW checker at install time with default on (#1624) * configure the NSFW checker at install time with default on 1. Changes the --safety_checker argument to --nsfw_checker and --no-nsfw_checker. The original argument is recognized for backward compatibility. 2. The configure script asks users whether to enable the checker (default yes). Also offers users ability to select default sampler and number of generation steps. 3.Enables the pasting of the caution icon on blurred images when InvokeAI is installed into the package directory. 4. Adds documentation for the NSFW checker, including caveats about accuracy, memory requirements, and intermediate image dispaly. * use better fitting icon * NSFW defaults false for testing * set default back to nsfw active Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> Signed-off-by: devops117 <55235206+devops117@users.noreply.github.com> Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Co-authored-by: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Co-authored-by: Kyle Schouviller <kyle0654@hotmail.com> Co-authored-by: javl <mail@jaspervanloenen.com> Co-authored-by: Kent Keirsey <31807370+hipsterusername@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com> Co-authored-by: Damian Stewart <d@damianstewart.com> Co-authored-by: DevOps117 <55235206+devops117@users.noreply.github.com> Co-authored-by: damian <git@damianstewart.com> Co-authored-by: Damian Stewart <null@damianstewart.com> Co-authored-by: Cyrus Chan <82143712+cyruschan360@users.noreply.github.com> Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> Co-authored-by: Andre LaBranche <dre@mac.com> Co-authored-by: victorca25 <41912303+victorca25@users.noreply.github.com> Co-authored-by: Victor <victorca25@users.noreply.github.com>
2022-11-30 21:12:23 +00:00
infill_method = infill_method,
merge release-candidate-1-3-2 into main. Squashed commit of the following: commit 9a1fe8e7fbbd81d9e9e47c4fda6bde6f66fba30c Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 12 17:07:40 2022 +0000 swap in release URLs for installers commit ff56f5251ba8502833cb561317e82b028cd2da5d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 12 17:03:21 2022 +0000 fix up bad unicode chars in invoke.py commit ed943bd6c785d968d1e31fbbb814fea8688fc8bb Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 12 16:05:45 2022 +0000 outcrop improvements, hand-added commit 7ad2355b1da53861bb75312edead8f9db0b0f44d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 12 15:14:33 2022 +0000 documentation fixes commit 66c920fc197d9206be9e0e2d1eb2a1cb86362887 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 16:49:25 2022 -0500 Revert "Resize hires as an image" This reverts commit d05b1b3544dfa7b3c071ac05b4f014a52e08fa50. commit 3fc5cb09f8bc03ea96e67a3e49fb087019d2f9d5 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 12 12:43:17 2022 +0000 fix incorrect link in install commit 1345ec77ab58f70e1bf5a0f587ca40aba4e906b7 Author: tildebyte <337875+tildebyte@users.noreply.github.com> Date: Sun Nov 6 19:07:31 2022 -0500 toil(repo): add tildebyte as owner of installer/ directory commit b116715490f390a59e5bee1022a6a758aee0918d Author: Kyle Schouviller <kyle0654@hotmail.com> Date: Thu Nov 10 21:43:56 2022 -0800 Fix performance issue introduced by torch cuda cache clear during generation commit fa3670270e7aae6bfd8d47fb7bdd32b707310c23 Author: mauwii <Mauwii@outlook.de> Date: Fri Nov 11 12:42:03 2022 +0100 small update to dockers huggingface section commit c304250ef663b3e202b4da8332365288589d94c7 Author: mauwii <Mauwii@outlook.de> Date: Fri Nov 11 12:19:27 2022 +0100 fix format and Link in INSTALL_INVOKE.md commit 802ce5dde5ca68f24aa4609cdba428044e0c7fa1 Author: mauwii <Mauwii@outlook.de> Date: Fri Nov 11 11:17:49 2022 +0100 small fixex to format and a link in INSTALL_MANUAL commit 311ee320ecac892cb4a1bcd012374fa051b1d011 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 07:23:35 2022 +0000 ignore installer intermediate files commit e9df17b374df58a44d3ae3ba33cbdc58794bcf5d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 07:19:25 2022 +0000 fix backslash-related syntax error commit 061fb4ef00482bdd4fba635aeaeff4ca7510190d Merge: 52be0d23 4095acd1 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 06:50:04 2022 +0000 Merge branch 'release-candidate-2-1-3' of github.com:/invoke-ai/InvokeAI into release-candidate-2-1-3 commit 52be0d2396de2de02030855c92e3367008b50377 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 06:49:45 2022 +0000 add WindowsLongFileName batfile to source installer commit 4095acd10ebae05a8cb14cc2faf7c79936d9e6a9 Author: mauwii <Mauwii@outlook.de> Date: Fri Nov 11 07:05:17 2022 +0100 Doc Updates A lot of re-formating of new Installation Docs also some content updates/corrections commit 201eb22d7650b00f55249c2646fa4f47ac3e0ec2 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 04:41:02 2022 +0000 prevent two models from being marked default in models.yaml commit 17ab98220034dfbb798a9a0460bc2837f0c1e2cb Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 03:56:54 2022 +0000 installers download branch HEAD not tag commit a04965b0e9e9d1170cf284af9acbd1186d681255 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 03:48:21 2022 +0000 improve messaging during installation process commit 0b529f0c574dd91fb9593e924ebc41c8c219b6ce Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 15:22:32 2022 +0000 enable outcropping of random JPG/PNG images - Works best with runwayML inpainting model - Numerous code changes required to propagate seed to final metadata. Original code predicated on the image being generated within InvokeAI. commit 6f9f84834557eb3c48562dc5d0ace51ca9e9cca2 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 17:27:42 2022 +0000 enhance outcropping with ability to direct contents of new regions - When outcropping an image you can now add a `--new_prompt` option, to specify a new prompt to be used instead of the original one used to generate the image. - Similarly you can provide a new seed using `--seed` (or `-S`). A seed of zero will pick one randomly. - This PR also fixes the crash that happened when trying to outcrop an image that does not contain InvokeAI metadata. commit 918c1589ef30595668899f4259ece6a4ad605c69 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 20:16:47 2022 +0000 fix #1402 commit 116415b3fcec8415f8e6de9b23c0bbd0dbc6845b Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 21:27:25 2022 +0000 fix invoke.py crash if no models.yaml file present - Script will now offer the user the ability to create a minimal models.yaml and then gracefully exit. - Closes #1420 commit b4b6eabaac94896e38123be331c44d1b63065b0d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 16:49:25 2022 -0500 Revert "Log strength with hires" This reverts commit 82d4904c07670d514e9a541de7c9ecd8489eeae2. commit 4ef1f4a854717c953f9192454d0adabef32af36c Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 20:01:49 2022 +0000 remove temporary directory from repo commit 510fc4ebaa5f9dc0e77b47cf04e0c265423e0a44 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 19:59:03 2022 +0000 remove -e from clipseg load in installer commit a20914434bb3609cf1d883cabf048d4cc25f881a Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 19:37:07 2022 +0000 change clipseg repo branch to avoid clipseg not found error commit 0d134195fda5c69fce5a95d6da90248eba8d226d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 18:39:29 2022 +0000 update repo URL to point to rc commit 649d8c8573896fdb5a73453b69ee4b54cf4d6241 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 18:13:28 2022 +0000 integrate tildebyte installer commit a358d370a05ea985a9e26fa9c1101d9c14fdb3ab Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 17:48:14 2022 +0000 add @tildebyte compiled pip installer commit 94a9033c4f6214e604be149a3de6d7c747af7f3a Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 14:52:00 2022 +0000 ignore source installer zip files commit 18a947c503c83c95cd83f27424696219ff3c4c95 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 14:46:36 2022 +0000 documentation and environment file fixes - Have clarified the relationship between the @tildebyte and @cmdr2 installers; However, @tildebyte installer merge is still a WIP due to conflicts over such things as `invoke.sh`. - Rechristened 1click installer as "source" installer. @tildebyte installer will be "the" installer. (We'll see which one generates the least support requests and maintenance work.) - Sync'd `environment-mac.yml` with `development`. The former was failing with a taming-transformers error as per https://discord.com/channels/@me/1037201214154231899/1040060947378749460 commit a23b03189526a49da8ddae90ce71b0e902784d29 Author: Mike DiGiovanni <vinblau@gmail.com> Date: Wed Nov 9 16:44:59 2022 -0500 Fixes typos in README.md commit 23af68c7d79d947f1bd3441c91bb44d655238f01 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 07:02:27 2022 -0500 downgrade win installs to basicsr==1.4.1 commit e258beeb51f3e645b9ea60e52d69d18722221cc5 Merge: 7460c069 e481bfac Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 06:37:45 2022 -0500 Merge branch 'release-candidate-2-1-3' of github.com:invoke-ai/InvokeAI into release-candidate-2-1-3 commit 7460c069b880b10c84b55f2e0c0998e350d6cf12 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 06:36:48 2022 -0500 remove --prefer-binary from requirements-base.txt It appears that some versions of pip do not recognize this option when it appears in the requirements file. Did not explore this further but recommend --prefer-binary in the manual install instructions on the command line. commit e481bfac615e0c798ceb5e59e8fbe3038f85b431 Merge: 5040747c d1ab65a4 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 11:21:56 2022 +0000 Merge branch 'release-candidate-2-1-3' of github.com:/invoke-ai/InvokeAI into release-candidate-2-1-3 commit 5040747c6700c9b949e3f3e1d2c3f21daffcec6c Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 11:21:43 2022 +0000 fix windows install instructions & bat file commit d1ab65a43122f73c20533d5815590ec10bc05eca Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 07:18:59 2022 +0100 update WEBUIHOTKEYS.md commit af4ee7feb8a7d2528bf4e2b3f7deee7a7c4c3dec Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 06:33:49 2022 +0100 update INSTALL_DOCKER.md commit 764fb29aded8114984d05932c4266ea24614b932 Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 06:30:15 2022 +0100 fix formatting in INSTALL.md commit 1014d3ba44aa4cd4cfdc6e3650c24a0dc9568a6e Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 06:29:14 2022 +0100 fix build.sh invokeai_conda_env_file default value commit 40a48aca88e337e9f4475f80a03b7d6d4751d09b Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 05:25:30 2022 +0100 fix environment-mac.yml moved taming-transformers-rom1504 to pip dependencies commit 92abc00f16a34a586dd16d3c64408f00e23fcb53 Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 05:19:52 2022 +0100 fix test-invoke-conda - copy required conda environment yaml - use environment.yml - I use cp instead of ln since would be compatible for windows runners commit a5719aabf89c8c5f29c6044e2882ccdcd0c6916b Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 04:14:35 2022 +0100 update Dockerfile - link environment.yml from new environemnts path - change default conda_env_file - quote all variables to avoid splitting - also remove paths from conda-env-files in build-container.yml commit 44a18511fa7accfec6a20345774583a1ce745b02 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 20:51:06 2022 +0000 update paths in container build workflow commit b850dbadafba052310327ca759d96f49a9d25d03 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 20:16:57 2022 +0000 finished reorganization of install docs commit 9ef8b944d53afb1fed94c418b2fd936d2d743797 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 18:50:58 2022 +0000 tweaks to manual install documentation --prefer-binary is an iffy option in the requirements file. It isn't supported by some versions of pip, so I removed it from requirements-base.txt and inserted it into the manual install instructions where it seems to do what it is supposed to. commit efc5a9848803b4250d726bc1913b9fd5a33fad75 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 18:20:03 2022 +0000 manual installation documentation tested on Linux commit 1417c87928e13b0ed21bf1c5604f8636d3b50a8d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 17:37:06 2022 +0000 change name of requirements.txt to avoid confusion commit 2dd6fc2b93ff7bbb4038568a3b28d36a8fafaeb8 Merge: 22213612 71ee44a8 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 17:26:24 2022 +0000 Merge branch 'release-candidate-2-1-3' of github.com:/invoke-ai/InvokeAI into release-candidate-2-1-3 commit 22213612a08bbece46eafd48994f985b097cb141 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 17:25:59 2022 +0000 directory cleanup; working on install docs commit 71ee44a827898759fd457f774c0b2ac7a1ef6519 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 02:07:13 2022 +0000 prevent crash when switching to an invalid model commit b17ca0a5e731c142101bbdbf34d121df949e86d7 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 14:28:38 2022 +0100 don't suppress exceptions when doing cross-attention control commit 71bbfe4a1a5b70f90e5f41c94df50fb104dbdd79 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 12:59:34 2022 +0100 Fix #1362 by improving VRAM usage patterns when doing .swap() commit ef3f7a26e242b73c2beb0195c7fd8f654ef47f55 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 12:18:37 2022 +0100 remove log spam commit 7189d649622d4668b120b0dd278388ad672142c4 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 12:10:28 2022 +0100 change the way saved slicing strategy is applied commit 01c40f751ab72955140165c16f95ae411732265b Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 12:04:43 2022 +0100 fix slicing_strategy_getter callsite commit f8cfe25150a346958903316bc710737d99839923 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 11:56:22 2022 +0100 cleanup, consistent dim=0 also tested commit 5bf9b1e890d48e962afd4a668a219b68271e5dc1 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 11:34:09 2022 +0100 refactored context, tested with non-sliced cross attention control commit d58a46e39bf562e7459290d2444256e8c08ad0b6 Author: damian0815 <null@damianstewart.com> Date: Sun Nov 6 00:41:52 2022 +0100 cleanup commit 7e2c658b4c06fe239311b65b9bb16fa3adec7fd7 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:57:31 2022 +0100 disable logs commit 20ee89d93841b070738b3d8a4385c93b097d92eb Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:36:58 2022 +0100 slice saved attention if necessary commit 0a7684a22c880ec0f48cc22bfed4526358f71546 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:32:38 2022 +0100 raise instead of asserting commit 7083104c7f3a0d8fd96e94a2f391de50a3c942e4 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:31:00 2022 +0100 store dim when saving slices commit f7c0808ed383ec1dc70645288a798ed2aa4fa85c Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:27:16 2022 +0100 don't retry on exception commit 749a721e939b3fe7c1741e7998dab6bd2c85a0cb Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:24:50 2022 +0100 stuff commit 032ab90e9533be8726301ec91b97137e2aadef9a Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:20:17 2022 +0100 more logging commit 3dc34b387f033482305360e605809d95a40bf6f8 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:16:47 2022 +0100 logs commit 901c4c1aa4b9bcef695a6551867ec8149e6e6a93 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:12:39 2022 +0100 actually set save_slicing_strategy to True commit f780e0a0a7c6b6a3db320891064da82589358c8a Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:10:35 2022 +0100 store slicing strategy commit 93bb6d566fd18c5c69ef7dacc8f74ba2cf671cb7 Author: damian <git@damianstewart.com> Date: Sat Nov 5 20:43:48 2022 +0100 still not it commit 5e3a9541f8ae00bde524046963910323e20c40b7 Author: damian <git@damianstewart.com> Date: Sat Nov 5 17:20:02 2022 +0100 wip offloading attention slices on-demand commit 4c2966aa856b6f3b446216da3619ae931552ef08 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 15:47:40 2022 +0100 pre-emptive offloading, idk if it works commit 572576755e9f0a878d38e8173e485126c0efbefb Author: root <you@example.com> Date: Sat Nov 5 11:25:32 2022 +0000 push attention slices to cpu. slow but saves memory. commit b57c83a68f2ac03976ebc89ce2ff03812d6d185f Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 12:04:22 2022 +0100 verbose logging commit 3a5dae116f110a96585d9eb71d713b5ed2bc3d2b Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 11:50:48 2022 +0100 wip fixing mem strategy crash (4 test on runpod) commit 3cf237db5fae0c7b0b4cc3c47c81830bdb2ae7de Author: damian0815 <null@damianstewart.com> Date: Fri Nov 4 09:02:40 2022 +0100 wip, only works on cuda commit 5702271991e126c026aa1ff41c44f8ad37b26e3a Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 14:09:36 2022 +0000 speculative reorganization of the requirements & environment files - This is only a test! - The various environment*.yml and requirements*.txt files have all been moved into a directory named "environments-and-requirements". - The idea is to clean up our root directory so that the github home page is tidy. - The manual install instructions will start with the instructions to create a symbolic link from environment.yml to the appropriate file for OS and GPU. - The 1-click installers have been updated to accommodate this change. commit 10781e7dc4f4551583a110d14f2a1f60393112b8 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 01:59:45 2022 +0000 refactoring requirements commit 099d1157c579c7b9fea20945e8504cc15745c598 Author: mauwii <Mauwii@outlook.de> Date: Wed Nov 9 00:16:18 2022 +0100 better way to make sure if conda is useable commit ab825bf7ee5f0b82d2273da1cda64fc9266a978e Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 22:05:33 2022 +0000 add back --prefer-binaries to requirements commit 10cfeb5ada7bcfc9f3aff3716ab8ea4961a8b528 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 8 22:27:19 2022 +0100 add quotes to set and use `$environment_file` commit e97515d0453583e013674b4dd1f3739c7de402cc Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 8 22:24:21 2022 +0100 set environment file for conda update commit 0f04bc5789c712bf7c7319b1d93064914993f4ec Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 8 22:21:25 2022 +0100 use conda env update commit 3f74aabecd08ed25fac158463ae12b775bd1fca2 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 8 22:20:44 2022 +0100 use command instead of hash commit b1a99a51b7ca23c4b895855bd7b4c82dbdc431e4 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 14:44:44 2022 -0500 remove --global git config from 1-click installers commit 8004f8a6d99f6ff75e00c170da40f1dec93a8914 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Mon Nov 7 09:07:20 2022 -0500 Revert "Use array slicing to calc ddim timesteps" This reverts commit 1f0c5b4cf196716c21f2db74f92c8750ad8f889d. commit ff8ff2212afb1e1c2dce4f6a61f29e2bc8302eb5 Merge: 8e5363cd 636620b1 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 14:01:40 2022 +0000 add initfile support from PR #1386 commit 8e5363cd83bff0e6be0f002c644283955f7fcbfd Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 13:26:18 2022 +0000 move 'installer/' to '1-click-installer' to make room for tildebyte installer commit 1450779146e89510d12b8c90eb316d9861c3375e Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 12:56:36 2022 +0000 update branch for installer to pull against commit 8cd5d95b8a1cb213cce2f949c394c841a09d9cab Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 05:30:20 2022 +0000 move all models into subdirectories of ./models - this required an update to the invoke-ai fork of gfpgan - simultaneously reverted consolidation of environment and requirements files, as their presence in a directory triggered setup.py to try to install a sub-package. commit abd6407394d55d4f6c064a05f3ac989dd3817c59 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 03:52:46 2022 +0000 leave a copy of environment-cuda.yml at top level - named it environment.yml - need to avoid a big change for users and breaking older support instructions. commit 734dacfbe9d8c86ca943c6541e7b5ff5ef787ff4 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 03:50:07 2022 +0000 consolidate environment files - starting to remove unneeded entries and pins - no longer require -e in front of github dependencies - update setup.py with release number - update manual installation instructions commit 636620b1d5e2466613d0dcc2a604522be12fa3a4 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 03:26:16 2022 +0000 change initfile to ~/.invokeai - adjust documentation - also fix 'clipseg_models' to 'clipseg', which seems to be working now commit 1fe41146f0975bbc9d552208473490a9ccb9fc56 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 5 14:28:01 2022 -0400 add support for an initialization file, invokeai.init - Place preferred startup command switches in a file named "invokeai.init". The file can consist of a single line of switches such as "--web --steps=28", a series of switches on each line, or any combination of the two. Example: ``` --web --host=0.0.0.0 --steps=28 --grid -f 0.6 -C 11.0 -A k_euler_a ``` - The following options, which were previously only available within the CLI, are now available on the command line as well: --steps --strength --cfg_scale --width --height --fit commit 2ad6ef355a9b9c4b17bae71edea2346c2e8708c5 Merge: 865502ee 8b47c829 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sun Nov 6 18:08:36 2022 +0000 update discord link commit 865502ee4f681de4516d231370ae603983354d8f Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 18:00:16 2022 +0100 update changelog commit c7984f3299c5c8f56a70d80907d527af458674af Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 17:07:27 2022 +0100 update TROUBLESHOOT.md commit 7f150ed83302ba875c3e0c0f39d8ac0f32c6e362 Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 16:56:58 2022 +0100 remove `:`from headlines in CONTRIBUTORS.md commit badf4e256ce6e3201df1a9a87a7072b36b18d699 Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 16:56:37 2022 +0100 enable navigation tabs Since the docs are growing, this way they look cleaner commit e64c60bbb38fc1620e08ce52bf28bd17003c7ef6 Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 16:18:59 2022 +0100 remove preflight checks from assets seems like somebody executed tests and commited them commit 178061854300632b024810e65922b54b64d95939 Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 16:15:06 2022 +0100 update INSTALLING_MODELS.md commit f91fd276242a0c92b301e99d02982d30f7b712c3 Author: Kyle Schouviller <kyle0654@hotmail.com> Date: Sat Nov 5 14:47:53 2022 -0700 Bug fix for inpaint size commit 09e41e8f769457b9ffd56901aae13991cdc6eeb8 Author: Kyle Schouviller <kyle0654@hotmail.com> Date: Sat Nov 5 14:34:52 2022 -0700 Add inpaint size options to inpaint at a larger size than the actual inpaint image, then scale back down for recombination commit 6eeb2107b300fc27cfe6134b43e5570c246b8e96 Author: mauwii <Mauwii@outlook.de> Date: Sat Nov 5 21:01:14 2022 +0100 remove create-caches.yml since not used anywhere commit 17053ad8b7efecb21a9b4eb32695089f683f72e3 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 5 16:01:55 2022 -0400 fix duplicated argument introduced by conflict resolution commit fefb4dc1f88bc6551a39602a2bc79b278cd83c59 Merge: 762ca60a d05b1b35 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 5 12:47:35 2022 -0700 Merge branch 'development' into fix_generate.py commit d05b1b3544dfa7b3c071ac05b4f014a52e08fa50 Author: Craig <cwallen@users.noreply.github.com> Date: Sat Oct 29 20:40:30 2022 -0400 Resize hires as an image commit 82d4904c07670d514e9a541de7c9ecd8489eeae2 Author: Craig <cwallen@users.noreply.github.com> Date: Sat Oct 29 20:37:40 2022 -0400 Log strength with hires commit 1cdcf33cfa39e90f9660fabf8f5936dcfb6c3aa5 Merge: 6616fa83 cbc029c6 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 5 09:57:38 2022 -0400 Merge branch 'main' into development - this synchronizes recent document fixes by mauwii commit 6616fa835ac4318bf53419f2b54b88c962559578 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 4 00:47:03 2022 -0400 fix Windows library dependency issues This commit addresses two bugs: 1) invokeai.py crashes immediately with a message about an undefined attritube sigKILL (closes #1288). The fix is to pin torch at 1.12.1. 2) Version 1.4.2 of basicsr fails to load properly on Windows, and is a requirement of realesrgan, however 1.4.1 works. Pinning basicsr in our requirements file resulted in a dependency conflict, so I ended up cloning realesrgan into the invoke-ai Git space and changing the requirements file there. If there is a more elegant solution, please advise. commit 7b9a4564b11f4181b9b3c06ecda2a4a25fd1849e Author: Matthias Wild <40327258+mauwii@users.noreply.github.com> Date: Sat Nov 5 14:36:45 2022 +0100 Update-docs (#1382) * update IMG2IMG.md * update INPAINTING.md * update WEBUIHOTKEYS.md * more doc updates (mostly fix formatting): - OUTPAINTING.md - POSTPROCESS.md - PROMPTS.md - VARIATIONS.md - WEB.md - WEBUIHOTKEYS.md commit fcdefa0620761472718afa14b2955a5d0603cfcc Author: Matthias Wild <40327258+mauwii@users.noreply.github.com> Date: Fri Nov 4 20:47:31 2022 +0100 Hotifx docs (#1376) (#1377) commit ef8b3ce639954259a95a38f44fa5329687bee781 Merge: b7042095 36870a8f Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 4 12:08:44 2022 -0400 Merge-main-into-development (#1373) To get the rid of the difference between main and development. Since otherwise it will be a pain to start fixing the documentatino (when the state between main and development is not the same ...) Also this should fix the problem of all tests failing since environment yamls get updated. commit 36870a8f53217d4b733e9bb8b119190b5e36da59 Merge: 6b89adfa b7042095 Author: Matthias Wild <40327258+mauwii@users.noreply.github.com> Date: Fri Nov 4 16:25:00 2022 +0100 Merge branch 'development' into merge-main-into-development commit b70420951d5b70937c0c07e4f8a552a01c3008bc Author: damian0815 <null@damianstewart.com> Date: Thu Nov 3 12:39:45 2022 +0100 fix parsing error doing eg `forest ().swap(in winter)` commit 1f0c5b4cf196716c21f2db74f92c8750ad8f889d Author: wfng92 <43742196+wfng92@users.noreply.github.com> Date: Thu Nov 3 17:13:52 2022 +0800 Use array slicing to calc ddim timesteps commit 8648da811190fc8bcf237d83aff38cf605851300 Author: mauwii <Mauwii@outlook.de> Date: Fri Nov 4 00:06:19 2022 +0100 update environment-linux-aarch64 to use python 3.9 commit 45b459356399f8cfb7e9af571c1643fab04218fe Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 3 22:31:46 2022 +0100 update environment-linux-aarch64.yml - move getpass_asterisk to pip commit 41b04316cf5118ea9518dc77934d135a489dd684 Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 3 20:40:08 2022 +0100 rename job, remove debug branch from triggers commit e97c6db2a3c0157a8a5ab74cd28ebee480a2d078 Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 3 20:34:01 2022 +0100 include build matrix to build x86_64 and aarch64 commit 896820a349292b0e14bbc32f0c557fe8a6b45395 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 05:01:15 2022 +0100 disable caching commit 06c8f468bff7e1dfecc1a1990164be1005b114a7 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 04:26:39 2022 +0100 disable PR-Validation since there are no files passed from context this is unecesarry commit 61920e2701c4a9cea94c03ab933c4482458215b7 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 04:09:39 2022 +0100 update action to use current branch also update build-args of dockerfile and build.sh commit f34ba7ca70f1c417ee97e8b0c57abff57614d78f Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 02:30:24 2022 +0100 remove unecesarry mkdir command again commit c30ef0895dbf0565345ac6ccb136d98a174470a6 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 01:51:12 2022 +0100 remove symlink to GFPGANv1.4 also re-add mkdir to prevent action from failing commit aa3a774f73d5004571ea42fea14cd2b525fffb1c Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 01:48:59 2022 +0100 update build-container.yml to use cachev3 commit 2c30555b844293764123baa4137fcf952d40a4e7 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 01:34:20 2022 +0100 update Dockerfile - create models.yaml from models.yaml.example - run preload_models.py with --no-interactive commit 743f60577364d43237eeb46aefd523371c36e56b Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 01:21:15 2022 +0100 update build.sh to download sd-v1.5 model commit 519c661abbae83aa62b3ee536635c39192890441 Author: mauwii <Mauwii@outlook.de> Date: Tue Oct 25 01:26:50 2022 +0200 replace old fashined markdown templates with forms this will help the readability of issues a lot 🤓 commit 22c956c75f4797ddc2dffa944e3ea84b4eb3477c Merge: 13696adc 0196571a Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 3 10:20:21 2022 -0400 Merge branch 'development' of github.com:invoke-ai/InvokeAI into development commit 13696adc3a3a2b169e68048a5b511660d0430fae Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 3 10:20:10 2022 -0400 speculative change to solve windows esrgan issues commit 0196571a12992eb8207d36e022721fe3ad2cfd19 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 2 22:39:35 2022 -0400 remove merge markers from preload_models.py commit 9666f466ab1c710dfda2e59be9e8a26fcd7e8718 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 2 18:29:34 2022 -0400 use refined model by default commit 240e5486c89552ef480c3443a63283fb86a493c3 Merge: 8164b6b9 aa247e68 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 2 18:35:00 2022 -0400 Merge branch 'spezialspezial-patch-9' into development commit 8164b6b9cff077e4131384195af65e30a40733a7 Merge: 4fc82d55 dd5a88dc Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 2 17:06:46 2022 -0400 Merge branch 'development' of github.com:invoke-ai/InvokeAI into development commit 4fc82d554ff573780c0af562a6bc9586aa56012d Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 04:17:28 2022 +1300 [WebUI] Final 2.1 Release Build commit 96b34c0f85f6ed52707fe43456d20b81822c7d1d Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 09:08:11 2022 +0100 Final WebUI build for Release 2.1 - squashed commit of 52 commits from PR #1327 don't log base64 progress images Fresh Build For WebUI [WebUI] Loopback Default False Fixes bugs/styling - Fixes missing web app state on new version: Adds stateReconciler to redux-persist. When we add more values to the state and then release the update app, they will be automatically merged in. Reseting web UI will be needed far less. 7159ec - Fixes console z-index - Moves reset web UI button to visible area Decreases gallery width on inpainting Increases workarea split padding to 1rem Adds missing tooltips to site header Changes inpainting controls settings to hover Fixes hotkeys and settings buttons not working Improves bounding box interactions - Bounding box can now be moved by dragging any of its edges - Bounding box does not affect drawing if already drawing a stroke - Can lock bounding box to draw directly on the bounding box edges - Removes spacebar-hold behaviour due to technical issues Fixes silent crash when init image too large To send the mask to the server, the UI rendered the mask onto the init image and sent the whole image. The mask was then cropped by the server. If the image was too large, the app silently failed. Maybe it exceeds the websocket size limit. Fixed by cropping the mask in the UI layer, sending only bounding-box-sized mask image data. Disabled bounding box settings when locked Styles image uploader Builds fresh bundle Improves bounding box interaction Added spacebar-hold-to-transform back. Address bounding box feedback - Adds back toggle to hide bounding box - Box quick toggle = q, normal toggle = shift + q - Styles canvas alert icons Adds hints when unable to invoke - Popover on Invoke button indicates why exactly it is disabled, e.g. prompt is empty, something else is processing, etc. - There may be more than one reason; all are displayed. Fix Inpainting Alerts Styling Preventing unnecessary re-renders across the app Code Split Inpaint Options Isolate features to their own components so they dont re-render the other stuff each time. [TESTING] Remove global isReady checking I dont believe this is need at all because the isready state is constantly updated when needed and tracked real time in the Redux store. This causes massive re-renders. @psychedelicious If this is absolutely essential for a reason that I do not see, please hit me up on Discord. Fresh Bundle Fix Bounding Box Settings re-rendering on brush stroke [Code Splitting] Bounding Box Options Isolated all bounding box components to trigger unnecessary re-renders. Still need to fix bounding box triggering re-renders on the control panel inside the canvas itself. But the options panel should be a good to go with this change. Inpainting Controls Code Spitting and Performance Codesplit the entirety of the inpainting controls. Created new selectors for each and every component to ensure there are no unnecessary re-renders. App feels a lot smoother. Fixes rerenders on ClearBrushHistory Fixes crash when requesting post-generation upscale/face restoration - Moves the inpainting paste to before the postprocessing. Removes unused isReady state Changes Report Bug icon to a bug Restores shift+q bounding box shortcut Adds alert for bounding box size to status icons Adds asCheckbox to IAIIconButton Rough draft of this. Not happy with the styling but it's clearer than having them look just like buttons. Fixes crash related to old value of progress_latents in state Styling changes and settings modal minor refactor Fixes: uploaded JPG images not loading Reworks CurrentImageButtons.tsx - Change all icons to FA iconset for consistency - Refactors IAIIconButton, IAIButton, IAIPopover to handle ref forwarding - Redesigns buttons into group Only generate 1 iteration when seed fixed & variations disabled Fixes progress images select Fixes edge case: upload over gets stuck while alt tabbing - Press esc to close it now Fixes display progress images select typing Fixes current image button rerenders Adds min width to ImageUploader Makes fast-latents in progress default Update Icon Button Checkbox Style Styling Fixes next/prev image buttons Refactor canvas buttons + more Add Save Intermediates Step Count For accurate mode only. Co-Authored-By: Richard Macarthy <richardmacarthy@protonmail.com> Restores "initial image" text Address feedback - moves mask clear button - fixes intermediates - shrinks inpainting icons by 10% Fix Loopback Styling Adds escape hotkey to close floating panels Readd Hotkey for Dual Display Updated Current Image Button Styling commit dd5a88dceeec53ceb1722a62e3689ae3dd871154 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 04:17:28 2022 +1300 [WebUI] Final 2.1 Release Build commit 95ed56bf82825a47cfe406fa34eaf4e32c129143 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 04:16:31 2022 +1300 Updated Current Image Button Styling commit 1ae80f5ab9d00a25e0c3a21e2eccd318c5343401 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 04:07:57 2022 +1300 Readd Hotkey for Dual Display commit 1f0bd3ca6cda4221d1a7a46325f235cd23bd0af9 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu Nov 3 02:07:00 2022 +1100 Adds escape hotkey to close floating panels commit a1971f6830306b3d748f7f36c2243f6dee682f97 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 03:38:15 2022 +1300 Fix Loopback Styling commit c6118e889895ba35a191124ce1beb5d2b719366d Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu Nov 3 01:29:51 2022 +1100 Address feedback - moves mask clear button - fixes intermediates - shrinks inpainting icons by 10% commit 7ba958cf7ff4e804a127b71c88666084f81e7340 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu Nov 3 01:10:38 2022 +1100 Restores "initial image" text commit 383905d5d24359aa1824de96ff124a8f8a87e015 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 02:59:11 2022 +1300 Add Save Intermediates Step Count For accurate mode only. Co-Authored-By: Richard Macarthy <richardmacarthy@protonmail.com> commit 6173e3e9cabd5e74fb466d55d7bb6a80a77b3fa8 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu Nov 3 00:53:53 2022 +1100 Refactor canvas buttons + more commit 3feb7d8922b0e4c9f944e96b95211003f40d9705 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu Nov 3 00:49:23 2022 +1100 Fixes next/prev image buttons commit 1d9edbd0ddd6e10cf120fe0de3db0b56ae374db4 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 00:50:44 2022 +1300 Update Icon Button Checkbox Style Styling commit d439abdb89db73e652add9df371234861189d90c Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 21:37:24 2022 +1100 Makes fast-latents in progress default commit ee47ea0c891a33049bdec12f1c254926f341eff2 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 21:37:09 2022 +1100 Adds min width to ImageUploader commit 300bb2e6279c1c477131b9e57425db348062f19c Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 21:28:22 2022 +1100 Fixes current image button rerenders commit ccf8593501d23e00979f7340f8991514e6ca3428 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 21:27:43 2022 +1100 Fixes display progress images select typing commit 0fda612f3ff8ad75932e158b9b29cf64c3f30eb6 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 21:02:01 2022 +1100 Fixes edge case: upload over gets stuck while alt tabbing - Press esc to close it now commit 5afff65b71bb60d067392c120efff1a17adc66af Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 20:33:19 2022 +1100 Fixes progress images select commit 7e55bdefce8920831cac7b9fa857bfbffe9e9d5d Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 20:27:47 2022 +1100 Only generate 1 iteration when seed fixed & variations disabled commit 620cf84d3dd54b8498e84574f33040a26d4d315f Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 19:51:38 2022 +1100 Reworks CurrentImageButtons.tsx - Change all icons to FA iconset for consistency - Refactors IAIIconButton, IAIButton, IAIPopover to handle ref forwarding - Redesigns buttons into group commit cfe567c62ad3fd0cff5e3e579a2250ca5dfa2d53 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 16:14:50 2022 +1100 Fixes: uploaded JPG images not loading commit cefe12f1df72e051f109ed77ce46f18093b3b8bb Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 15:31:18 2022 +1100 Styling changes and settings modal minor refactor commit 1e51c3992853ad4643d8eda2443a3bd0d65f5f90 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 15:27:46 2022 +1100 Fixes crash related to old value of progress_latents in state commit 42a02bbb8087cd46a1b5c795b1b41e38c08ba229 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 13:15:06 2022 +1100 Adds asCheckbox to IAIIconButton Rough draft of this. Not happy with the styling but it's clearer than having them look just like buttons. commit f1ae6dae4c36e74ca8dedf8b57eb8933c059dcf4 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 13:13:56 2022 +1100 Adds alert for bounding box size to status icons commit 6195579910a91fb2ab7e1186aa1c1145566c3122 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 11:52:19 2022 +1100 Restores shift+q bounding box shortcut commit 16c8b23b347792d7811cff66a27d350fe5d0d62c Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 11:32:07 2022 +1100 Changes Report Bug icon to a bug commit 07ae626b22554b5222a3b71d1ce3974e2c3fb284 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 11:17:16 2022 +1100 Removes unused isReady state commit 8d171bb044f578d4b9cc4911edfa05b20a01d373 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 11:13:26 2022 +1100 Fixes crash when requesting post-generation upscale/face restoration - Moves the inpainting paste to before the postprocessing. commit 6e33ca7e9e64fb355430511e28bb08c32c9c68b1 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 10:59:01 2022 +1100 Fixes rerenders on ClearBrushHistory commit db46e12f2b8c98dac8895ea4d04242d3754dbec4 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 11:36:28 2022 +1300 Inpainting Controls Code Spitting and Performance Codesplit the entirety of the inpainting controls. Created new selectors for each and every component to ensure there are no unnecessary re-renders. App feels a lot smoother. commit 868e4b2db82fa8556b423111f2f8d565a70ec129 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 07:40:31 2022 +1300 [Code Splitting] Bounding Box Options Isolated all bounding box components to trigger unnecessary re-renders. Still need to fix bounding box triggering re-renders on the control panel inside the canvas itself. But the options panel should be a good to go with this change. commit 2e562742c13988a1fc299c673a97ba4e4a645aaf Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 06:40:27 2022 +1300 Fix Bounding Box Settings re-rendering on brush stroke commit 68e69580091fc1dc1d8b6e03c9e7ef777c7ebf61 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 06:28:34 2022 +1300 Fresh Bundle commit ea6e3a7949f2743711516261cb7e450517d39702 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 06:26:56 2022 +1300 [TESTING] Remove global isReady checking I dont believe this is need at all because the isready state is constantly updated when needed and tracked real time in the Redux store. This causes massive re-renders. @psychedelicious If this is absolutely essential for a reason that I do not see, please hit me up on Discord. commit b2879ca99f88869277c474185ade049914b0bf26 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 06:08:59 2022 +1300 Code Split Inpaint Options Isolate features to their own components so they dont re-render the other stuff each time. commit 4e911566c33989392eb3279049b15331ca98594a Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 03:50:56 2022 +1300 Preventing unnecessary re-renders across the app commit 9bafda6a152778893df143776ae859a3b8b7f192 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 03:02:35 2022 +1300 Fix Inpainting Alerts Styling commit 871a8a5375cae891f22eb853ffd2d22298298b11 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 23:52:07 2022 +1100 Adds hints when unable to invoke - Popover on Invoke button indicates why exactly it is disabled, e.g. prompt is empty, something else is processing, etc. - There may be more than one reason; all are displayed. commit 0eef74bc00d3c0cedc5037c1deeef1d9a5b6d33d Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 23:40:11 2022 +1100 Address bounding box feedback - Adds back toggle to hide bounding box - Box quick toggle = q, normal toggle = shift + q - Styles canvas alert icons commit 423ae3209782f1d8d321b2ed9ed00712b726adf7 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 17:06:07 2022 +1100 Improves bounding box interaction Added spacebar-hold-to-transform back. commit 8282e5d0458ca1bba5565c069093b5389f2228d4 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 16:57:07 2022 +1100 Builds fresh bundle commit 19305cdbdf6ac74833bd6011bff0ced8e9d36f69 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 16:51:11 2022 +1100 Styles image uploader commit eb9028ab3069bca9d747aca664ca60ae13ba6df8 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 16:51:03 2022 +1100 Disabled bounding box settings when locked commit 21483f5d0731bce5aa97985e722a64bf0d7cd12c Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 16:50:24 2022 +1100 Fixes silent crash when init image too large To send the mask to the server, the UI rendered the mask onto the init image and sent the whole image. The mask was then cropped by the server. If the image was too large, the app silently failed. Maybe it exceeds the websocket size limit. Fixed by cropping the mask in the UI layer, sending only bounding-box-sized mask image data. commit 82dcbac28f140aa7bd89d967bcc7fa31cb03a267 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 16:28:30 2022 +1100 Improves bounding box interactions - Bounding box can now be moved by dragging any of its edges - Bounding box does not affect drawing if already drawing a stroke - Can lock bounding box to draw directly on the bounding box edges - Removes spacebar-hold behaviour due to technical issues commit d43bd4625d64a03d90de0458ad5fcacef211a8a6 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 15:10:49 2022 +1100 Fixes hotkeys and settings buttons not working commit ea891324a2086faf8eeeeac7eaf47ae2935322fb Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 11:04:02 2022 +1100 Changes inpainting controls settings to hover commit 8fd9ea219390493f392e690eadb23c4209a4ecfc Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 11:03:41 2022 +1100 Adds missing tooltips to site header commit fb026668563b3179805819a1630c654c9ce260d9 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 11:03:25 2022 +1100 Increases workarea split padding to 1rem commit f6f5c2731b0c37089c5d7382736f973e857df712 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 11:03:10 2022 +1100 Decreases gallery width on inpainting commit b4e3f771e0314e0a18ad5cedc80b28f246fced59 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 10:54:59 2022 +1100 Fixes bugs/styling - Fixes missing web app state on new version: Adds stateReconciler to redux-persist. When we add more values to the state and then release the update app, they will be automatically merged in. Reseting web UI will be needed far less. 7159ec - Fixes console z-index - Moves reset web UI button to visible area commit 99bb9491ac97f1f733accab839ea38cdf4870ba0 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Tue Nov 1 08:35:45 2022 +1300 [WebUI] Loopback Default False commit 0453f211278a533a49fb1aee54dd989b69179c10 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 23:23:51 2022 +1300 Fresh Build For WebUI commit 9fc09aa4bda3b3e6139b026f24733a37747d373f Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 09:08:11 2022 +0100 don't log base64 progress images commit 5e87062cf809a08242d3b006b66d3bbb834ddb16 Author: spezialspezial <75758219+spezialspezial@users.noreply.github.com> Date: Wed Nov 2 00:21:27 2022 +0100 Option to directly invert the grayscale heatmap - fix commit 3e7a459990407ad1679f38d4027c19d50a9d36e3 Author: spezialspezial <75758219+spezialspezial@users.noreply.github.com> Date: Tue Nov 1 21:37:33 2022 +0100 Update txt2mask.py commit bbf4c03e500bafc8627c2a70f8b3396efeddabb3 Author: spezialspezial <75758219+spezialspezial@users.noreply.github.com> Date: Tue Nov 1 21:11:19 2022 +0100 Option to directly invert the grayscale heatmap Theoretically less work inverting the image while it's small but I can't measure a significant difference. Though, handy option to have in some cases. commit 611a3a975328a7e276c2781214d5e14108708ed7 Author: mauwii <Mauwii@outlook.de> Date: Wed Nov 2 02:23:09 2022 +0100 fix name of caching step commit 1611f0d1815022fe90d33f41c21d670251a75f29 Author: mauwii <Mauwii@outlook.de> Date: Wed Nov 2 02:18:46 2022 +0100 readd caching of sd-models - this would remove the necesarrity of the secret availability in PRs commit 08835115e4c5c0ee3587ce07ab769a04d55cb3c5 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 22:10:12 2022 -0400 pin pytorch_lightning to 1.7.7, issue #1331 commit 2d84e28d329be282b51a4cbc22f7c200d80c8f0e Merge: 533fd04e ef17aae8 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 22:11:04 2022 -0400 Merge branch 'development' of github.com:invoke-ai/InvokeAI into development commit ef17aae8abe03fd87dc6f91b3c6d2fe03375f6c5 Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 00:39:48 2022 +0100 add damian0815 to contributors list commit 0cc39f01a3c67f32873b7888e1e032d33626e269 Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 01:18:50 2022 +0100 report full size for fast latents and update conversion matrix for v1.5 commit 688d7258f185035a5924bee23322b001574da931 Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 00:33:00 2022 +0100 fix a bug that broke cross attention control index mapping commit 4513320bf161d3efdd99e2aef4f7c37472131373 Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 00:31:58 2022 +0100 save VRAM by not recombining tensors that have been sliced to save VRAM commit 533fd04ef0d1ba9d2cb25d556991b999e7d44aba Merge: 6215592b dff5681c Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 17:40:36 2022 -0400 Merge branch 'development' of github.com:invoke-ai/InvokeAI into development commit dff5681cf0e24faf67d5eb5903203c4ea39f89bd Author: damian0815 <d@d.com> Date: Tue Nov 1 13:56:03 2022 +0100 shorter strings commit 5a2790a69b11e049d2507bc22eab7812915d867f Author: damian0815 <d@d.com> Date: Tue Nov 1 13:19:20 2022 +0100 convert progress display to a drop-down commit 7c5305ccbaf7926162536aa3a9e51dcdd8574d0d Author: damian0815 <d@d.com> Date: Tue Nov 1 12:54:46 2022 +0100 do not try to save base64 intermediates in gallery on cancellation commit 4013e8ad6fa5e5c2a710c607fe7e1d040f353299 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 21:54:35 2022 +1100 Fixes b64 image sending and displaying commit d1dfd257f9e1cafd352d9007a56194226b9d6b63 Author: damian <d@d.com> Date: Tue Nov 1 11:40:40 2022 +0100 wip base64 commit 5322d735ee4515d89293b7fb015b2ce048262f68 Author: damian <d@d.com> Date: Tue Nov 1 11:31:42 2022 +0100 update frontend commit cdb107dcda858a8bb64455cc60a196a42345f8f7 Author: damian <d@d.com> Date: Tue Nov 1 11:17:43 2022 +0100 add option to show intermediate latent space commit be1393a41ce7a75ed8de7f648a93c5e5974a50d2 Author: damian <d@d.com> Date: Tue Nov 1 10:16:55 2022 +0100 ensure existing exception handling code also handles new exception class commit e554c2607f00a5e51c03052acb9861ff21ec1c12 Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Tue Nov 1 10:08:42 2022 +0100 Rebuilt prompt parsing logic Complete re-write of the prompt parsing logic to be more readable and logical, and therefore also hopefully easier to debug, maintain, and augment. In the process it has also become more robust to badly-formed prompts. Squashed commit of the following: commit 8fcfa88a16e1390d41717e940d72aed64712171c Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Sun Oct 30 17:05:57 2022 +0100 further cleanup commit 1a1fd78bcfeb49d072e3e6d5808aa8df15441629 Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Sun Oct 30 16:07:57 2022 +0100 cleanup and document commit 099c9659fa8b8135876f9a5a50fe80b20bc0635c Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Sun Oct 30 15:54:58 2022 +0100 works fully commit 5e6887ea8c25a1e21438ff6defb381fd027d25fd Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Sun Oct 30 15:24:31 2022 +0100 further... commit 492fda120844d9bc1ad4ec7dd408a3374762d0ff Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Sun Oct 30 14:08:57 2022 +0100 getting there... commit c6aab05a8450cc3c95c8691daf38fdc64c74f52d Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Fri Oct 28 14:29:03 2022 +0200 wip doesn't compile commit 5e533f731cfd20cd435330eeb0012e5689e87e81 Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Fri Oct 28 13:21:43 2022 +0200 working with CrossAttentionCtonrol but no Attention support yet commit 9678348773431e500e110e8aede99086bb7b5955 Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Fri Oct 28 13:04:52 2022 +0200 wip rebuiling prompt parser commit 6215592b12dea3822c727913b771012789a52477 Merge: ef24d76a 349cc254 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 17:34:55 2022 -0400 Merge branch 'development' of github.com:invoke-ai/InvokeAI into development commit 349cc25433e1d358c6c61cca4a6c300ecc8ca3d7 Author: damian0815 <d@d.com> Date: Tue Nov 1 20:08:52 2022 +0100 fix crash (be a little less aggressive clearing out the attention slice) commit 214d276379387ae0fa2259602ab00884ec1ad03e Author: damian0815 <d@d.com> Date: Tue Nov 1 19:57:55 2022 +0100 be more aggressive at clearing out saved_attn_slice commit ef24d76adc5a192297714707cd6794d4f44bcf67 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 14:34:23 2022 -0400 fix library problems in preload_modules commit ab2b5a691dadb292f7cecf5db94a165db3e3e126 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 17:22:48 2022 -0400 fix model_cache memory management issues commit c7de2b2801ad5d6ce52a5f44e88c5705f1dbf524 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 02:02:14 2022 +0100 disable checks with sd-V1.4 model... ...to save some resources, since V1.5 is the default now commit e8075658acf675346d35435d0cfb7710becab42a Author: mauwii <Mauwii@outlook.de> Date: Mon Oct 31 22:20:51 2022 +0100 update test-invoke-conda.yml - fix model dl path for sd-v1-4.ckpt - copy configs/models.yaml.example to configs/models.yaml commit 4202dabee1143f597f4c3946420fbfa7b8eccddf Author: mauwii <Mauwii@outlook.de> Date: Mon Oct 31 22:17:21 2022 +0100 fix models example weights for sd-v1.4 commit d67db2bcf1ac26d8bb7c5f8bfd056f2172597780 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Tue Nov 1 08:35:45 2022 +1300 [WebUI] Loopback Default False commit 7159ec885faa1117a3506689d547618be1d91808 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Mon Oct 31 11:33:05 2022 -0400 further improvements to preload_models.py - Faster startup for command line switch processing - Specify configuration file to modify using --config option: ./scripts/preload_models.ply --config models/my-models-file.yaml commit b5cf734ba9f1aeaab14075b55cc13ed9a0ae31e2 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Mon Oct 31 11:08:19 2022 -0400 improve behavior of preload_models.py - NEVER overwrite user's existing models.yaml - Instead, merge its contents into new config file, and rename original to models.yaml.orig (with message) - models.yaml has been removed from repository and renamed models.yaml.example commit f7dc8eafeef991e135b5541c01d0ff740dda9591 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Mon Oct 31 10:47:35 2022 -0400 restore models.yaml to virgin state commit 762ca60a309f70daaf1b9e79b6273f76fd9474b6 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Oct 4 22:55:10 2022 -0400 Update INPAINTING.md commit e7fb9f342cb5ed0c09e6215026d60d45eef3ebcb Author: Hideyuki Katsushiro <h.katsushiro@qualia.tokyo.jp> Date: Wed Oct 5 10:08:53 2022 +0900 add argument --outdir
2022-11-12 17:17:07 +00:00
force_outpaint = force_outpaint,
Merge dev into main for 2.2.0 (#1642) * Fixes inpainting + code cleanup * Disable stage info in Inpainting Tab * Mask Brush Preview now always at 0.5 opacity The new mask is only visible properly at max opacity but at max opacity the brush preview becomes fully opaque blocking the view. So the mask brush preview no remains at 0.5 no matter what the Brush opacity is. * Remove save button from Canvas Controls (cleanup) * Implements invert mask * Changes "Invert Mask" to "Preserve Masked Areas" * Fixes (?) spacebar issues * Patches redux-persist and redux-deep-persist with debounced persists Our app changes redux state very, very often. As our undo/redo history grows, the calls to persist state start to take in the 100ms range, due to a the deep cloning of the history. This causes very noticeable performance lag. The deep cloning is required because we need to blacklist certain items in redux from being persisted (e.g. the app's connection status). Debouncing the whole process of persistence is a simple and effective solution. Unfortunately, `redux-persist` dropped `debounce` between v4 and v5, replacing it with `throttle`. `throttle`, instead of delaying the expensive action until a period of X ms of inactivity, simply ensures the action is executed at least every X ms. Of course, this does not fix our performance issue. The patch is very simple. It adds a `debounce` argument - a number of milliseconds - and debounces `redux-persist`'s `update()` method (provided by `createPersistoid`) by that many ms. Before this, I also tried writing a custom storage adapter for `redux-persist` to debounce the calls to `localStorage.setItem()`. While this worked and was far less invasive, it doesn't actually address the issue. It turns out `setItem()` is a very fast part of the process. We use `redux-deep-persist` to simplify the `redux-persist` configuration, which can get complicated when you need to blacklist or whitelist deeply nested state. There is also a patch here for that library because it uses the same types as `redux-persist`. Unfortunately, the last release of `redux-persist` used a package `flat-stream` which was malicious and has been removed from npm. The latest commits to `redux-persist` (about 1 year ago) do not build; we cannot use the master branch. And between the last release and last commit, the changes have all been breaking. Patching this last release (about 3 years old at this point) directly is far simpler than attempting to fix the upstream library's master branch or figuring out an alternative to the malicious and now non-existent dependency. * Adds debouncing * Fixes AttributeError: 'dict' object has no attribute 'invert_mask' * Updates package.json to use redux-persist patches * Attempts to fix redux-persist debounce patch * Fixes undo/redo * Fixes invert mask * Debounce > 300ms * Limits history to 256 for each of undo and redo * Canvas styling * Hotkeys improvement * Add Metadata To Viewer * Increases CFG Scale max to 200 * Fix gallery width size for Outpainting Also fixes the canvas resizing failing n fast pushes * Fixes disappearing canvas grid lines * Adds staging area * Fixes "use all" not setting variationAmount Now sets to 0 when the image had variations. * Builds fresh bundle * Outpainting tab loads to empty canvas instead of upload * Fixes wonky canvas layer ordering & compositing * Fixes error on inpainting paste back `TypeError: 'float' object cannot be interpreted as an integer` * Hides staging area outline on mouseover prev/next * Fixes inpainting not doing img2img when no mask * Fixes bbox not resizing in outpainting if partially off screen * Fixes crashes during iterative outpaint. Still doesn't work correctly though. * Fix iterative outpainting by restoring original images * Moves image uploading to HTTP - It all seems to work fine - A lot of cleanup is still needed - Logging needs to be added - May need types to be reviewed * Fixes: outpainting temp images show in gallery * WIP refactor to unified canvas * Removes console.log from redux-persist patch * Initial unification of canvas * Removes all references to split inpainting/outpainting canvas * Add patchmatch and infill_method parameter to prompt2image (options are 'patchmatch' or 'tile'). * Fixes app after removing in/out-painting refs * Rebases on dev, updates new env files w/ patchmatch * Organises features/canvas * Fixes bounding box ending up offscreen * Organises features/canvas * Stops unnecessary canvas rescales on gallery state change * Fixes 2px layout shift on toggle canvas lock * Clips lines drawn while canvas locked When drawing with the locked canvas, if a brush stroke gets too close to the edge of the canvas and its stroke would extend past the edge of the canvas, the edge of that stroke will be seen after unlocking the canvas. This could cause a problem if you unlock the canvas and now have a bunch of strokes just outside the init image area, which are far back in undo history and you cannot easily erase. With this change, lines drawn while the canvas is locked get clipped to the initial image bbox, fixing this issue. Additionally, the merge and save to gallery functions have been updated to respect the initial image bbox so they function how you'd expect. * Fixes reset canvas view when locked * Fixes send to buttons * Fixes bounding box not being rounded to 64 * Abandons "inpainting" canvas lock * Fixes save to gallery including empty area, adds download and copy image * Fix Current Image display background going over image bounds * Sets status immediately when clicking Invoke * Adds hotkeys and refactors sharing of konva instances Adds hotkeys to canvas. As part of this change, the access to konva instance objects was refactored: Previously closure'd refs were used to indirectly get access to the konva instances outside of react components. Now, a getter and setter function are used to provide access directly to the konva objects. * Updates hotkeys * Fixes canvas showing spinner on first load Also adds good default canvas scale and positioning when no image is on it * Fixes possible hang on MaskCompositer * Improves behaviour when setting init canvas image/reset view * Resets bounding box coords/dims when no image present * Disables canvas actions which cannot be done during processing * Adds useToastWatcher hook - Dispatch an `addToast` action with standard Chakra toast options object to add a toast to the toastQueue - The hook is called in App.tsx and just useEffect's w/ toastQueue as dependency to create the toasts - So now you can add toasts anywhere you have access to `dispatch`, which includes middleware and thunks - Adds first usage of this for the save image buttons in canvas * Update Hotkey Info Add missing tooltip hotkeys and update the hotkeys modal to reflect the new hotkeys for the Unified Canvas. * Fix theme changer not displaying current theme on page refresh * Fix tab count in hotkeys panel * Unify Brush and Eraser Sizes * Fix staging area display toggle not working * Staging Area delete button is now red So it doesnt feel blended into to the rest of them. * Revert "Fix theme changer not displaying current theme on page refresh" This reverts commit 903edfb803e743500242589ff093a8a8a0912726. * Add arguments to use SSL to webserver * Integrates #1487 - touch events Need to add: - Pinch zoom - Touch-specific handling (some things aren't quite right) * Refactors upload-related async thunks - Now standard thunks instead of RTK createAsyncThunk() - Adds toasts for all canvas upload-related actions * Reorganises app file structure * Fixes Canvas Auto Save to Gallery * Fixes staging area outline * Adds staging area hotkeys, disables gallery left/right when staging * Fixes Use All Parameters * Fix metadata viewer image url length when viewing intermediate * Fixes intermediate images being tiny in txt2img/img2img * Removes stale code * Improves canvas status text and adds option to toggle debug info * Fixes paste image to upload * Adds model drop-down to site header * Adds theme changer popover * Fix missing key on ThemeChanger map * Fixes stage position changing on zoom * Hotkey Cleanup - Viewer is now Z - Canvas Move tool is V - sync with PS - Removed some unused hotkeys * Fix canvas resizing when both options and gallery are unpinned * Implements thumbnails for gallery - Thumbnails are saved whenever an image is saved, and when gallery requests images from server - Thumbnails saved at original image aspect ratio with width of 128px as WEBP - If the thumbnail property of an image is unavailable for whatever reason, the image's full size URL is used instead * Saves thumbnails to separate thumbnails directory * Thumbnail size = 256px * Fix Lightbox Issues * Disables canvas image saving functions when processing * Fix index error on going past last image in Gallery * WIP - Lightbox Fixes Still need to fix the images not being centered on load when the image res changes * Fixes another similar index error, simplifies logic * Reworks canvas toolbar * Fixes canvas toolbar upload button * Cleans up IAICanvasStatusText * Improves metadata handling, fixes #1450 - Removes model list from metadata - Adds generation's specific model to metadata - Displays full metadata in JSON viewer * Gracefully handles corrupted images; fixes #1486 - App does not crash if corrupted image loaded - Error is displayed in the UI console and CLI output if an image cannot be loaded * Adds hotkey to reset canvas interaction state If the canvas' interaction state (e.g. isMovingBoundingBox, isDrawing, etc) get stuck somehow, user can press Escape to reset the state. * Removes stray console.log() * Fixes bug causing gallery to close on context menu open * Minor bugfixes - When doing long-running canvas image exporting actions, display indeterminate progress bar - Fix staging area image outline not displaying after committing/discarding results * Removes unused imports * Fixes repo root .gitignore ignoring frontend things * Builds fresh bundle * Styling updates * Removes reasonsWhyNotReady The popover doesn't play well with the button being disabled, and I don't think adds any value. * Image gallery resize/style tweaks * Styles buttons for clearing canvas history and mask * First pass on Canvas options panel * Fixes bug where discarding staged images results in loss of history * Adds Save to Gallery button to staging toolbar * Rearrange some canvas toolbar icons Put brush stuff together and canvas movement stuff together * Fix gallery maxwidth on unified canvas * Update Layer hotkey display to UI * Adds option to crop to bounding box on save * Masking option tweaks * Crop to Bounding Box > Save Box Region Only * Adds clear temp folder * Updates mask options popover behavior * Builds fresh bundle * Fix styling on alert modals * Fix input checkbox styling being incorrect on light theme * Styling fixes * Improves gallery resize behaviour * Cap gallery size on canvas tab so it doesnt overflow * Fixes bug when postprocessing image with no metadata * Adds IAIAlertDialog component * Moves Loopback to app settings * Fixes metadata viewer not showing metadata after refresh Also adds Dream-style prompt to metadata * Adds outpainting specific options * Linting * Fixes gallery width on lightbox, fixes gallery button expansion * Builds fresh bundle * Fix Lightbox images of different res not centering * Update feature tooltip text * Highlight mask icon when on mask layer * Fix gallery not resizing correctly on open and close * Add loopback to just img2img. Remove from settings. * Fix to gallery resizing * Removes Advanced checkbox, cleans up options panel for unified canvas * Minor styling fixes to new options panel layout * Styling Updates * Adds infill method * Tab Styling Fixes * memoize outpainting options * Fix unnecessary gallery re-renders * Isolate Cursor Pos debug text on canvas to prevent rerenders * Fixes missing postprocessed image metadata before refresh * Builds fresh bundle * Fix rerenders on model select * Floating panel re-render fix * Simplify fullscreen hotkey selector * Add Training WIP Tab * Adds Training icon * Move full screen hotkey to floating to prevent tab rerenders * Adds single-column gallery layout * Fixes crash on cancel with intermediates enabled, fixes #1416 * Updates npm dependencies * Fixes img2img attempting inpaint when init image has transparency * Fixes missing threshold and perlin parameters in metadata viewer * Renames "Threshold" > "Noise Threshold" * Fixes postprocessing not being disabled when clicking use all * Builds fresh bundle * Adds color picker * Lints & builds fresh bundle * Fixes iterations being disabled when seed random & variations are off * Un-floors cursor position * Changes color picker preview to circles * Fixes variation params not set correctly when recalled * Fixes invoke hotkey not working in input fields * Simplifies Accordion Prep for adding reset buttons for each section * Fixes mask brush preview color * Committing color picker color changes tool to brush * Color picker does not overwrite user-selected alpha * Adds brush color alpha hotkey * Lints * Removes force_outpaint param * Add inpaint size options to inpaint at a larger size than the actual inpaint image, then scale back down for recombination * Bug fix for inpaint size * Adds inpaint size (as scale bounding box) to UI * Adds auto-scaling for inpaint size * Improves scaled bbox display logic * Fixes bug with clear mask and history * Fixes shouldShowStagingImage not resetting to true on commit * Builds fresh bundle * Fixes canvas failing to scale on first run * Builds fresh bundle * Fixes unnecessary canvas scaling * Adds gallery drag and drop to img2img/canvas * Builds fresh bundle * Fix desktop mode being broken with new versions of flaskwebgui * Fixes canvas dimensions not setting on first load * Builds fresh bundle * stop crash on !import_models call on model inside rootdir - addresses bug report #1546 * prevent "!switch state gets confused if model switching fails" - If !switch were to fail on a particular model, then generate got confused and wouldn't try again until you switch to a different working model and back again. - This commit fixes and closes #1547 * Revert "make the docstring more readable and improve the list_models logic" This reverts commit 248068fe5d57b5639ea7a87ee6cbf023104d957d. * fix model cache path * also set fail-fast to it's default (true) in this way the whole action fails if one job fails this should unblock the runners!!! * fix output path for Archive results * disable checks for python 3.9 * Update-requirements and test-invoke-pip workflow (#1574) * update requirements files * update test-invoke-pip workflow * move requirements-mkdocs.txt to docs folder (#1575) * move requirements-mkdocs.txt to docs folder * update copyright * Fixes outpainting with resized inpaint size * Interactive configuration (#1517) * Update scripts/configure_invokeai.py prevent crash if output exists Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> * implement changes requested by reviews * default to correct root and output directory on Windows systems - Previously the script was relying on the readline buffer editing feature to set up the correct default. But this feature doesn't exist on windows. - This commit detects when user typed return with an empty directory value and replaces with the default directory. * improved readability of directory choices * Update scripts/configure_invokeai.py Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> * better error reporting at startup - If user tries to run the script outside of the repo or runtime directory, a more informative message will appear explaining the problem. Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> * Embedding merging (#1526) * add whole <style token> to vocab for concept library embeddings * add ability to load multiple concept .bin files * make --log_tokenization respect custom tokens * start working on concept downloading system * preliminary support for dynamic loading and merging of multiple embedded models - The embedding_manager is now enhanced with ldm.invoke.concepts_lib, which handles dynamic downloading and caching of embedded models from the Hugging Face concepts library (https://huggingface.co/sd-concepts-library) - Downloading of a embedded model is triggered by the presence of one or more <concept> tags in the prompt. - Once the embedded model is downloaded, its trigger phrase will be loaded into the embedding manager and the prompt's <concept> tag will be replaced with the <trigger_phrase> - The downloaded model stays on disk for fast loading later. - The CLI autocomplete will complete partial <concept> tags for you. Type a '<' and hit tab to get all ~700 concepts. BUGS AND LIMITATIONS: - MODEL NAME VS TRIGGER PHRASE You must use the name of the concept embed model from the SD library, and not the trigger phrase itself. Usually these are the same, but not always. For example, the model named "hoi4-leaders" corresponds to the trigger "<HOI4-Leader>" One reason for this design choice is that there is no apparent constraint on the uniqueness of the trigger phrases and one trigger phrase may map onto multiple models. So we use the model name instead. The second reason is that there is no way I know of to search Hugging Face for models with certain trigger phrases. So we'd have to download all 700 models to index the phrases. The problem this presents is that this may confuse users, who will want to reuse prompts from distributions that use the trigger phrase directly. Usually this will work, but not always. - WON'T WORK ON A FIREWALLED SYSTEM If the host running IAI has no internet connection, it can't download the concept libraries. I will add a script that allows users to preload a list of concept models. - BUG IN PROMPT REPLACEMENT WHEN MODEL NOT FOUND There's a small bug that occurs when the user provides an invalid model name. The <concept> gets replaced with <None> in the prompt. * fix loading .pt embeddings; allow multi-vector embeddings; warn on dupes * simplify replacement logic and remove cuda assumption * download list of concepts from hugging face * remove misleading customization of '*' placeholder the existing code as-is did not do anything; unclear what it was supposed to do. the obvious alternative -- setting using 'placeholder_strings' instead of 'placeholder_tokens' to match model.params.personalization_config.params.placeholder_strings -- caused a crash. i think this is because the passed string also needed to be handed over on init of the PersonalizedBase as the 'placeholder_token' argument. this is weird config dict magic and i don't want to touch it. put a breakpoint in personalzied.py line 116 (top of PersonalizedBase.__init__) if you want to have a crack at it yourself. * address all the issues raised by damian0815 in review of PR #1526 * actually resize the token_embeddings * multiple improvements to the concept loader based on code reviews 1. Activated the --embedding_directory option (alias --embedding_path) to load a single embedding or an entire directory of embeddings at startup time. 2. Can turn off automatic loading of embeddings using --no-embeddings. 3. Embedding checkpoints are scanned with the pickle scanner. 4. More informative error messages when a concept can't be loaded due either to a 404 not found error or a network error. * autocomplete terms end with ">" now * fix startup error and network unreachable 1. If the .invokeai file does not contain the --root and --outdir options, invoke.py will now fix it. 2. Catch and handle network problems when downloading hugging face textual inversion concepts. * fix misformatted error string Co-authored-by: Damian Stewart <d@damianstewart.com> * model_cache.py: fix list_models Signed-off-by: devops117 <55235206+devops117@users.noreply.github.com> * add statement of values (#1584) * this adds the Statement of Values Google doc source = https://docs.google.com/document/d/1-PrUKDJcxy8OyNGc8CyiHhv2VgLvjt7LRGlEpbg1nmQ/edit?usp=sharing * Fix heading * Update InvokeAI_Statement_of_Values.md * Update InvokeAI_Statement_of_Values.md * Update InvokeAI_Statement_of_Values.md * Update InvokeAI_Statement_of_Values.md * Update InvokeAI_Statement_of_Values.md * add keturn and mauwii to the team member list * Fix punctuation * this adds the Statement of Values Google doc source = https://docs.google.com/document/d/1-PrUKDJcxy8OyNGc8CyiHhv2VgLvjt7LRGlEpbg1nmQ/edit?usp=sharing * add keturn and mauwii to the team member list * fix formating - make sub bullets use * (decide to all use - or *) - indent sub bullets Sorry, first only looked at the code version and found this only after looking at the markdown rendered version * use multiparagraph numbered sections * Break up Statement Of Values as per comments on #1584 * remove duplicated word, reduce vagueness it's important not to overstate how many artists we are consulting. * fix typo (sorry blessedcoolant) Co-authored-by: mauwii <Mauwii@outlook.de> Co-authored-by: damian <git@damianstewart.com> * update dockerfile (#1551) * update dockerfile * remove not existing file from .dockerignore * remove bloat and unecesary step also use --no-cache-dir for pip install image is now close to 2GB * make Dockerfile a variable * set base image to `ubuntu:22.10` * add build-essential * link outputs folder for persistence * update tag variable * update docs * fix not customizeable build args, add reqs output * !model_import autocompletes in ROOTDIR * Adds psychedelicious to statement of values signature (#1602) * add a --no-patchmatch option to disable patchmatch loading (#1598) This feature was added to prevent the CI Macintosh tests from erroring out when patchmatch is unable to retrieve its shared library from github assets. * Fix #1599 by relaxing the `match_trigger` regex (#1601) * Fix #1599 by relaxing the `match_trigger` regex Also simplify logic and reduce duplication. * restrict trigger regex again (but not so far) * make concepts library work with Web UI This PR makes it possible to include a Hugging Face concepts library <style-or-subject-trigger> in the WebUI prompt. The metadata seems to be correctly handled. * documentation enhancements (#1603) - Add documentation for the Hugging Face concepts library and TI embedding. - Fixup index.md to point to each of the feature documentation files, including ones that are pending. * tweak setup and environment files for linux & pypatchmatch (#1580) * tweak setup and environment files for linux & pypatchmatch - Downgrade python requirements to 3.9 because 3.10 is not supported on Ubuntu 20.04 LTS (widely-used distro) - Use our github pypatchmatch 0.1.3 in order to install Makefile where it needs to be. - Restored "-e ." as the last install step on pip installs. Hopefully this will not trigger the high-CPU hang we've previously experienced. * keep windows on basicsr 1.4.1 * keep windows on basicsr 1.4.1 * bump pypatchmatch requirement to 0.1.4 - This brings in a version of pypatchmatch that will gracefully handle internet connection not available at startup time. - Also refactors and simplifies the handling of gfpgan's basicsr requirement across various platforms. * revert to older version of list_models() (#1611) This restores the correct behavior of list_models() and quenches the bug of list_models() returning a single model entry named "name". I have not investigated what was wrong with the new version, but I think it may have to do with changes to the behavior in dict.update() * Fixes for #1604 (#1605) * Converts ESRGAN image input to RGB - Also adds typing for image input. - Partially resolves #1604 * ensure there are unmasked pixels before color matching Co-authored-by: Kyle Schouviller <kyle0654@hotmail.com> * update index.md (#1609) - comment out non existing link - fix indention - add seperator between feature categories * Debloat-docker (#1612) * debloat Dockerfile - less options more but more userfriendly - better Entrypoint to simulate CLI usage - without command the container still starts the web-host * debloat build.sh * better syntax in run.sh * update Docker docs - fix description of VOLUMENAME - update run script example to reflect new entrypoint * Test installer (#1618) * test linux install * try removing http from parsed requirements * pip install confirmed working on linux * ready for linux testing - rebuilt py3.10-linux-x86_64-cuda-reqs.txt to include pypatchmatch dependency. - point install.sh and install.bat to test-installer branch. * Updates MPS reqs * detect broken readline history files * fix download.pytorch.org URL * Test installer (Win 11) (#1620) Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> * Test installer (MacOS 13.0.1 w/ torch==1.12.0) (#1621) * Test installer (Win 11) * Test installer (MacOS 13.0.1 w/ torch==1.12.0) Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> * change sourceball to development for testing * Test installer (MacOS 13.0.1 w/ torch==1.12.1 & torchvision==1.13.1) (#1622) * Test installer (Win 11) * Test installer (MacOS 13.0.1 w/ torch==1.12.0) * Test installer (MacOS 13.0.1 w/ torch==1.12.1 & torchvision==1.13.1) Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Co-authored-by: Cyrus Chan <82143712+cyruschan360@users.noreply.github.com> Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> * 2.2 Doc Updates (#1589) * Unified Canvas Docs & Assets Unified Canvas draft Advanced Tools Updates Doc Updates (lstein feedback) * copy edits to Unified Canvas docs - consistent capitalisation and feature naming - more intimate address (replace "the user" with "you") for improved User Engagement(tm) - grammatical massaging and *poesie* Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> Co-authored-by: damian <git@damianstewart.com> * include a step after config to `cat ~/.invokeai` (#1629) * disable patchmatch in CI actions (#1626) * disable patchmatch in CI actions * fix indention * replace tab with spaces Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> * Fix installer script for macOS. (#1630) * refer to the platform as 'osx' instead of 'mac', otherwise the composed URL to micromamba is wrong. * move the `-O` option to `tar` to be grouped with the other tar flags to avoid the `-O` being interpreted as something to unarchive. * Removes symlinked environment.yaml (#1631) Was unintentionally added in #1621 * Fix inpainting with iterations (#1635) * fix error when inpainting using runwayml inpainting model (#1634) - error was "Omnibus object has no attribute pil_image" - closes #1596 * add k_dpmpp_2_a and k_dpmpp_2 solvers options (#1389) * add k_dpmpp_2_a and k_dpmpp_2 solvers options * update frontend Co-authored-by: Victor <victorca25@users.noreply.github.com> Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> * add .editorconfig (#1636) * Web UI 2.2 bugfixes (#1572) * Fixes bug preventing multiple images from being generated * Fixes valid seam strength value range * Update Delete Alert Text Indicates to the user that images are not permanently deleted. * Fixes left/right arrows not working on gallery * Fixes initial image on load erroneously set to a user uploaded image Should be a result gallery image. * Lightbox Fixes - Lightbox is now a button in the current image buttons - Lightbox is also now available in the gallery context menu - Lightbox zoom issues fixed - Lightbox has a fade in animation. * Fix image display wrapper in current preview not overflow bounds * Revert "Fix image display wrapper in current preview not overflow bounds" This reverts commit 5511c82714dbf1d1999d64e8bc357bafa34ddf37. * Change Staging Area discard icon from Bin to X * Expose Snap Threshold and Move Snap Settings to BBox Panel * Changes img2img strength default to 0.75 * Fixes drawing triggering when mouse enters canvas w/ button down When we only supported inpainting and no zoom, this was useful. It allowed the cursor to leave the canvas (which was easy to do given the limited canvas dimensions) and without losing the "I am drawing" state. With a zoomable canvas this is no longer as useful. Additionally, we have more popovers and tools (like the color pickers) which result in unexpected brush strokes. This fixes that issue. * Revert "Expose Snap Threshold and Move Snap Settings to BBox Panel" We will handle this a bit differently - by allowing the grid origin to be moved. I will dig in at some point. This reverts commit 33c92ecf4da724c2f17d9d91c7ea31a43a2f6deb. * Adds Limit Strokes to Box * Adds fill bounding box button * Adds erase bounding box button * Changes Staging area discard icon to match others * Fixes right click breaking move tool * Fixes brush preview visibility issue with "darken outside box" * Fixes history bugs with addFillRect, addEraseRect, and other actions * Adds missing `key` * Fixes postprocessing being applied to canvas generations * Fixes bbox not getting scaled in various situations * Fixes staging area show image toggle not resetting on accept/discard * Locks down canvas while generating/staging * Fixes move tool breaking when canvas loses focus during move/transform * Hides cursor when restrict strokes is on and mouse outside bbox * Lints * Builds fresh bundle * Fix overlapping hotkey for Fill Bounding Box * Build Fresh Bundle * Fixes bug with mask and bbox overlay * Builds fresh bundle Co-authored-by: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> * disable NSFW checker loading during the CI tests (#1641) * disable NSFW checker loading during the CI tests The NSFW filter apparently causes invoke.py to crash during CI testing, possibly due to out of memory errors. This workaround disables NSFW model loading. * doc change * fix formatting errors in yml files * Configure the NSFW checker at install time with default on (#1624) * configure the NSFW checker at install time with default on 1. Changes the --safety_checker argument to --nsfw_checker and --no-nsfw_checker. The original argument is recognized for backward compatibility. 2. The configure script asks users whether to enable the checker (default yes). Also offers users ability to select default sampler and number of generation steps. 3.Enables the pasting of the caution icon on blurred images when InvokeAI is installed into the package directory. 4. Adds documentation for the NSFW checker, including caveats about accuracy, memory requirements, and intermediate image dispaly. * use better fitting icon * NSFW defaults false for testing * set default back to nsfw active Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> Signed-off-by: devops117 <55235206+devops117@users.noreply.github.com> Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Co-authored-by: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Co-authored-by: Kyle Schouviller <kyle0654@hotmail.com> Co-authored-by: javl <mail@jaspervanloenen.com> Co-authored-by: Kent Keirsey <31807370+hipsterusername@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com> Co-authored-by: Damian Stewart <d@damianstewart.com> Co-authored-by: DevOps117 <55235206+devops117@users.noreply.github.com> Co-authored-by: damian <git@damianstewart.com> Co-authored-by: Damian Stewart <null@damianstewart.com> Co-authored-by: Cyrus Chan <82143712+cyruschan360@users.noreply.github.com> Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> Co-authored-by: Andre LaBranche <dre@mac.com> Co-authored-by: victorca25 <41912303+victorca25@users.noreply.github.com> Co-authored-by: Victor <victorca25@users.noreply.github.com>
2022-11-30 21:12:23 +00:00
inpaint_height = inpaint_height,
inpaint_width = inpaint_width,
enable_image_debugging = enable_image_debugging,
Refactoring simplet2i (#387) * start refactoring -not yet functional * first phase of refactor done - not sure weighted prompts working * Second phase of refactoring. Everything mostly working. * The refactoring has moved all the hard-core inference work into ldm.dream.generator.*, where there are submodules for txt2img and img2img. inpaint will go in there as well. * Some additional refactoring will be done soon, but relatively minor work. * fix -save_orig flag to actually work * add @neonsecret attention.py memory optimization * remove unneeded imports * move token logging into conditioning.py * add placeholder version of inpaint; porting in progress * fix crash in img2img * inpainting working; not tested on variations * fix crashes in img2img * ported attention.py memory optimization #117 from basujindal branch * added @torch_no_grad() decorators to img2img, txt2img, inpaint closures * Final commit prior to PR against development * fixup crash when generating intermediate images in web UI * rename ldm.simplet2i to ldm.generate * add backward-compatibility simplet2i shell with deprecation warning * add back in mps exception, addresses @vargol comment in #354 * replaced Conditioning class with exported functions * fix wrong type of with_variations attribute during intialization * changed "image_iterator()" to "get_make_image()" * raise NotImplementedError for calling get_make_image() in parent class * Update ldm/generate.py better error message Co-authored-by: Kevin Gibbons <bakkot@gmail.com> * minor stylistic fixes and assertion checks from code review * moved get_noise() method into img2img class * break get_noise() into two methods, one for txt2img and the other for img2img * inpainting works on non-square images now * make get_noise() an abstract method in base class * much improved inpainting Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
2022-09-06 00:40:10 +00:00
)
if init_color:
self.correct_colors(image_list = results,
reference_image_path = init_color,
image_callback = image_callback)
2022-10-13 13:14:21 +00:00
if upscale is not None or facetool_strength > 0:
Refactoring simplet2i (#387) * start refactoring -not yet functional * first phase of refactor done - not sure weighted prompts working * Second phase of refactoring. Everything mostly working. * The refactoring has moved all the hard-core inference work into ldm.dream.generator.*, where there are submodules for txt2img and img2img. inpaint will go in there as well. * Some additional refactoring will be done soon, but relatively minor work. * fix -save_orig flag to actually work * add @neonsecret attention.py memory optimization * remove unneeded imports * move token logging into conditioning.py * add placeholder version of inpaint; porting in progress * fix crash in img2img * inpainting working; not tested on variations * fix crashes in img2img * ported attention.py memory optimization #117 from basujindal branch * added @torch_no_grad() decorators to img2img, txt2img, inpaint closures * Final commit prior to PR against development * fixup crash when generating intermediate images in web UI * rename ldm.simplet2i to ldm.generate * add backward-compatibility simplet2i shell with deprecation warning * add back in mps exception, addresses @vargol comment in #354 * replaced Conditioning class with exported functions * fix wrong type of with_variations attribute during intialization * changed "image_iterator()" to "get_make_image()" * raise NotImplementedError for calling get_make_image() in parent class * Update ldm/generate.py better error message Co-authored-by: Kevin Gibbons <bakkot@gmail.com> * minor stylistic fixes and assertion checks from code review * moved get_noise() method into img2img class * break get_noise() into two methods, one for txt2img and the other for img2img * inpainting works on non-square images now * make get_noise() an abstract method in base class * much improved inpainting Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
2022-09-06 00:40:10 +00:00
self.upscale_and_reconstruct(results,
upscale = upscale,
facetool = facetool,
2022-10-13 13:14:21 +00:00
strength = facetool_strength,
codeformer_fidelity = codeformer_fidelity,
Refactoring simplet2i (#387) * start refactoring -not yet functional * first phase of refactor done - not sure weighted prompts working * Second phase of refactoring. Everything mostly working. * The refactoring has moved all the hard-core inference work into ldm.dream.generator.*, where there are submodules for txt2img and img2img. inpaint will go in there as well. * Some additional refactoring will be done soon, but relatively minor work. * fix -save_orig flag to actually work * add @neonsecret attention.py memory optimization * remove unneeded imports * move token logging into conditioning.py * add placeholder version of inpaint; porting in progress * fix crash in img2img * inpainting working; not tested on variations * fix crashes in img2img * ported attention.py memory optimization #117 from basujindal branch * added @torch_no_grad() decorators to img2img, txt2img, inpaint closures * Final commit prior to PR against development * fixup crash when generating intermediate images in web UI * rename ldm.simplet2i to ldm.generate * add backward-compatibility simplet2i shell with deprecation warning * add back in mps exception, addresses @vargol comment in #354 * replaced Conditioning class with exported functions * fix wrong type of with_variations attribute during intialization * changed "image_iterator()" to "get_make_image()" * raise NotImplementedError for calling get_make_image() in parent class * Update ldm/generate.py better error message Co-authored-by: Kevin Gibbons <bakkot@gmail.com> * minor stylistic fixes and assertion checks from code review * moved get_noise() method into img2img class * break get_noise() into two methods, one for txt2img and the other for img2img * inpainting works on non-square images now * make get_noise() an abstract method in base class * much improved inpainting Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
2022-09-06 00:40:10 +00:00
save_original = save_original,
image_callback = image_callback)
except KeyboardInterrupt:
if catch_interrupts:
print('**Interrupted** Partial results will be returned.')
else:
raise KeyboardInterrupt
use 🧨diffusers model (#1583) * initial commit of DiffusionPipeline class * spike: proof of concept using diffusers for txt2img * doc: type hints for Generator * refactor(model_cache): factor out load_ckpt * model_cache: add ability to load a diffusers model pipeline and update associated things in Generate & Generator to not instantly fail when that happens * model_cache: fix model default image dimensions * txt2img: support switching diffusers schedulers * diffusers: let the scheduler do its scaling of the initial latents Remove IPNDM scheduler; it is not behaving. * web server: update image_progress callback for diffusers data * diffusers: restore prompt weighting feature * diffusers: fix set-sampler error following model switch * diffusers: use InvokeAIDiffuserComponent for conditioning * cross_attention_control: stub (no-op) implementations for diffusers * model_cache: let offload_model work with DiffusionPipeline, sorta. * models.yaml.example: add diffusers-format model, set as default * test-invoke-conda: use diffusers-format model test-invoke-conda: put huggingface-token where the library can use it * environment-mac: upgrade to diffusers 0.7 (from 0.6) this was already done for linux; mac must have been lost in the merge. * preload_models: explicitly load diffusers models In non-interactive mode too, as long as you're logged in. * fix(model_cache): don't check `model.config` in diffusers format clean-up from recent merge. * diffusers integration: support img2img * dev: upgrade to diffusers 0.8 (from 0.7.1) We get to remove some code by using methods that were factored out in the base class. * refactor: remove backported img2img.get_timesteps now that we can use it directly from diffusers 0.8.1 * ci: use diffusers model * dev: upgrade to diffusers 0.9 (from 0.8.1) * lint: correct annotations for Python 3.9. * lint: correct AttributeError.name reference for Python 3.9. * CI: prefer diffusers-1.4 because it no longer requires a token The RunwayML models still do. * build: there's yet another place to update requirements? * configure: try to download models even without token Models in the CompVis and stabilityai repos no longer require them. (But runwayml still does.) * configure: add troubleshooting info for config-not-found * fix(configure): prepend root to config path * fix(configure): remove second `default: true` from models example * CI: simplify test-on-push logic now that we don't need secrets The "test on push but only in forks" logic was only necessary when tests didn't work for PRs-from-forks. * create an embedding_manager for diffusers * internal: avoid importing diffusers DummyObject see https://github.com/huggingface/diffusers/issues/1479 * fix "config attributes…not expected" diffusers warnings. * fix deprecated scheduler construction * work around an apparent MPS torch bug that causes conditioning to have no effect * 🚧 post-rebase repair * preliminary support for outpainting (no masking yet) * monkey-patch diffusers.attention and use Invoke lowvram code * add always_use_cpu arg to bypass MPS * add cross-attention control support to diffusers (fails on MPS) For unknown reasons MPS produces garbage output with .swap(). Use --always_use_cpu arg to invoke.py for now to test this code on MPS. * diffusers support for the inpainting model * fix debug_image to not crash with non-RGB images. * inpainting for the normal model [WIP] This seems to be performing well until the LAST STEP, at which point it dissolves to confetti. * fix off-by-one bug in cross-attention-control (#1774) prompt token sequences begin with a "beginning-of-sequence" marker <bos> and end with a repeated "end-of-sequence" marker <eos> - to make a default prompt length of <bos> + 75 prompt tokens + <eos>. the .swap() code was failing to take the column for <bos> at index 0 into account. the changes here do that, and also add extra handling for a single <eos> (which may be redundant but which is included for completeness). based on my understanding and some assumptions about how this all works, the reason .swap() nevertheless seemed to do the right thing, to some extent, is because over multiple steps the conditioning process in Stable Diffusion operates as a feedback loop. a change to token n-1 has flow-on effects to how the [1x4x64x64] latent tensor is modified by all the tokens after it, - and as the next step is processed, all the tokens before it as well. intuitively, a token's conditioning effects "echo" throughout the whole length of the prompt. so even though the token at n-1 was being edited when what the user actually wanted was to edit the token at n, it nevertheless still had some non-negligible effect, in roughly the right direction, often enough that it seemed like it was working properly. * refactor common CrossAttention stuff into a mixin so that the old ldm code can still work if necessary * inpainting for the normal model. I think it works this time. * diffusers: reset num_vectors_per_token sync with 44a00555718f1df173c60da0ed646cf700e29537 * diffusers: txt2img2img (hires_fix) with so much slicing and dicing of pipeline methods to stitch them together * refactor(diffusers): reduce some code duplication amongst the different tasks * fixup! refactor(diffusers): reduce some code duplication amongst the different tasks * diffusers: enable DPMSolver++ scheduler * diffusers: upgrade to diffusers 0.10, add Heun scheduler * diffusers(ModelCache): stopgap to make from_cpu compatible with diffusers * CI: default to diffusers-1.5 now that runwayml token requirement is gone * diffusers: update to 0.10 (and transformers to 4.25) * diffusers: use xformers when available diffusers no longer auto-enables this as of 0.10.2. * diffusers: make masked img2img behave better with multi-step schedulers re-randomizing the noise each step was confusing them. * diffusers: work more better with more models. fixed relative path problem with local models. fixed models on hub not always having a `fp16` branch. * diffusers: stopgap fix for attention_maps_callback crash after recent merge * fixup import merge conflicts correction for 061c5369a2247c6c92cd69606bcf54c4f1962a0b * test: add tests/inpainting inputs for masked img2img * diffusers(AddsMaskedGuidance): partial fix for k-schedulers Prevents them from crashing, but results are still hot garbage. * fix --safety_checker arg parsing and add note to diffusers loader about where safety checker gets called * generate: fix import error * CI: don't try to read the old init location * diffusers: support loading an alternate VAE * CI: remove sh-syntax if-statement so it doesn't crash powershell * CI: fold strings in yaml because backslash is not line-continuation in powershell * attention maps callback stuff for diffusers * build: fix syntax error in environment-mac * diffusers: add INITIAL_MODELS with diffusers-compatible repos * re-enable the embedding manager; closes #1778 * Squashed commit of the following: commit e4a956abc37fcb5cf188388b76b617bc5c8fda7d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:43:07 2022 +0100 import new load handling from EmbeddingManager and cleanup commit c4abe91a5ba0d415b45bf734068385668b7a66e6 Merge: 032e856e 1efc6397 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:09:53 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers_with_textual_inversion_manager commit 032e856eefb3bbc39534f5daafd25764bcfcef8b Merge: 8b4f0fe9 bc515e24 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:08:01 2022 +0100 Merge remote-tracking branch 'upstream/dev/diffusers' into dev/diffusers_with_textual_inversion_manager commit 1efc6397fc6e61c1aff4b0258b93089d61de5955 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:04:28 2022 +0100 cleanup and add performance notes commit e400f804ac471a0ca2ba432fd658778b20c7bdab Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:45:07 2022 +0100 fix bug and update unit tests commit deb9ae0ae1016750e93ce8275734061f7285a231 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:28:29 2022 +0100 textual inversion manager seems to work commit 162e02505dec777e91a983c4d0fb52e950d25ff0 Merge: cbad4583 12769b3d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:58:03 2022 +0100 Merge branch 'main' into feature_textual_inversion_mgr commit cbad45836c6aace6871a90f2621a953f49433131 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:54:10 2022 +0100 use position embeddings commit 070344c69b0e0db340a183857d0a787b348681d3 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:53:47 2022 +0100 Don't crash CLI on exceptions commit b035ac8c6772dfd9ba41b8eeb9103181cda028f8 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:11:55 2022 +0100 add missing position_embeddings commit 12769b3d3562ef71e0f54946b532ad077e10043c Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:33:25 2022 +0100 debugging why it don't work commit bafb7215eabe1515ca5e8388fd3bb2f3ac5362cf Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:21:33 2022 +0100 debugging why it don't work commit 664a6e9e146b42d96703f0cc8baf8f5efec04ee1 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit 8b4f0fe9d6e4e2643b36dfa27864294785d7ba4e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit ffbe1ab11163ba712e353d89404e301d0e0c6cdf Merge: 6e4dad60 023df37e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:37:31 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers commit 023df37efffa67434f77def7fc3c9dfb29f699fd Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:36:54 2022 +0100 cleanup commit 05fac594eaf79d0058e3c48deee93df603f136c2 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:07:49 2022 +0100 tweak error checking commit 009f32ed39a7280997c3ffab112adadee0b44279 Author: damian <null@damianstewart.com> Date: Thu Dec 15 21:29:47 2022 +0100 unit tests passing for embeddings with vector length >1 commit beb1b08d9a98112ed2fe073580568e1a18698da3 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:39:09 2022 +0100 more explicit equality tests when overwriting commit 44d8a5a7c85cdabc9ce3a54fd0769a10597b3ca9 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:30:13 2022 +0100 wip textual inversion manager (unit tests passing for 1v embedding overwriting) commit 417c2b57d90924a839616bfb66804faab8039e4c Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 12:30:55 2022 +0100 wip textual inversion manager (unit tests passing for base stuff + padding) commit 2e80872e3b6f7fd7d8eb8928822bd824b63cb2ff Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 10:57:57 2022 +0100 wip new TextualInversionManager * stop using WeightedFrozenCLIPEmbedder * store diffusion models locally - configure_invokeai.py reconfigured to store diffusion models rather than CompVis models - hugging face caching model is used, but cache is set to ~/invokeai/models/repo_id - models.yaml does **NOT** use path, just repo_id - "repo_name" changed to "repo_id" to following hugging face conventions - Models are loaded with full precision pending further work. * allow non-local files during development * path takes priority over repo_id * MVP for model_cache and configure_invokeai - Feature complete (almost) - configure_invokeai.py downloads both .ckpt and diffuser models, along with their VAEs. Both types of download are controlled by a unified INITIAL_MODELS.yaml file. - model_cache can load both type of model and switches back and forth in CPU. No memory leaks detected TO DO: 1. I have not yet turned on the LocalOnly flag for diffuser models, so the code will check the Hugging Face repo for updates before using the locally cached models. This will break firewalled systems. I am thinking of putting in a global check for internet connectivity at startup time and setting the LocalOnly flag based on this. It would be good to check updates if there is connectivity. 2. I have not gone completely through INITIAL_MODELS.yaml to check which models are available as diffusers and which are not. So models like PaperCut and VoxelArt may not load properly. The runway and stability models are checked, as well as the Trinart models. 3. Add stanzas for SD 2.0 and 2.1 in INITIAL_MODELS.yaml REMAINING PROBLEMS NOT DIRECTLY RELATED TO MODEL_CACHE: 1. When loading a .ckpt file there are lots of messages like this: Warning! ldm.modules.attention.CrossAttention is no longer being maintained. Please use InvokeAICrossAttention instead. I'm not sure how to address this. 2. The ckpt models ***don't actually run*** due to the lack of special-case support for them in the generator objects. For example, here's the hard crash you get when you run txt2img against the legacy waifu-diffusion-1.3 model: ``` >> An error occurred: Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 140, in main main_loop(gen, opt) File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 371, in main_loop gen.prompt2image( File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1265, in __getattr__ raise AttributeError("'{}' object has no attribute '{}'".format( AttributeError: 'LatentDiffusion' object has no attribute 'image_from_embeddings' ``` 3. The inpainting diffusion model isn't working. Here's the output of "banana sushi" when inpainting-1.5 is loaded: ``` Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 301, in image_from_embeddings result_latents, result_attention_map_saver = self.latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 330, in latents_from_embeddings result: PipelineIntermediateState = infer_latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 185, in __call__ for result in self.generator_method(*args, **kwargs): File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 367, in generate_latents_from_embeddings step_output = self.step(batched_t, latents, guidance_scale, File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context return func(*args, **kwargs) File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 409, in step step_output = self.scheduler.step(noise_pred, timestep, latents, **extra_step_kwargs) File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/diffusers/schedulers/scheduling_lms_discrete.py", line 223, in step pred_original_sample = sample - sigma * model_output RuntimeError: The size of tensor a (9) must match the size of tensor b (4) at non-singleton dimension 1 ``` * proper support for float32/float16 - configure script now correctly detects user's preference for fp16/32 and downloads the correct diffuser version. If fp16 version not available, falls back to fp32 version. - misc code cleanup and simplification in model_cache * add on-the-fly conversion of .ckpt to diffusers models 1. On-the-fly conversion code can be found in the file ldm/invoke/ckpt_to_diffusers.py. 2. A new !optimize command has been added to the CLI. Should be ported to Web GUI. User experience on the CLI is this: ``` invoke> !optimize /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt INFO: Converting legacy weights file /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt to optimized diffuser model. This operation will take 30-60s to complete. Success. Optimized model is now located at /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 Writing new config file entry for sd-v1-4... >> New configuration: sd-v1-4: description: Optimized version of sd-v1-4 format: diffusers path: /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 OK to import [n]? y >> Verifying that new model loads... >> Current VRAM usage: 2.60G >> Offloading stable-diffusion-2.1 to CPU >> Loading diffusers model from /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 | Using faster float16 precision You have disabled the safety checker for <class 'ldm.invoke.generator.diffusers_pipeline.StableDiffusionGeneratorPipeline'> by passing `safety_checker=None`. Ensure that you abide to the conditions of the Stable Diffusion \ license and do not expose unfiltered results in services or applications open to the public. Both the diffusers team and Hugging Face strongly recommend to keep the safety filter enabled in all public facing circumstances,\ disabling it only for use-cases that involve analyzing network behavior or auditing its results. For more information, please have a look at https://github.com/huggingface/diffusers/pull/254 . | training width x height = (512 x 512) >> Model loaded in 3.48s >> Max VRAM used to load the model: 2.17G >> Current VRAM usage:2.17G >> Textual inversions available: >> Setting Sampler to k_lms (LMSDiscreteScheduler) Keep model loaded? [y] ``` * add parallel set of generator files for ckpt legacy generation * generation using legacy ckpt models now working * diffusers: fix missing attention_maps_callback fix for 23eb80b40421b2bb8f4b6d3dd30490d11c447b36 * associate legacy CrossAttention with .ckpt models * enable autoconvert New --autoconvert CLI option will scan a designated directory for new .ckpt files, convert them into diffuser models, and import them into models.yaml. Works like this: invoke.py --autoconvert /path/to/weights/directory In ModelCache added two new methods: autoconvert_weights(config_path, weights_directory_path, models_directory_path) convert_and_import(ckpt_path, diffuser_path) * diffusers: update to diffusers 0.11 (from 0.10.2) * fix vae loading & width/height calculation * refactor: encapsulate these conditioning data into one container * diffusers: fix some noise-scaling issues by pushing the noise-mixing down to the common function * add support for safetensors and accelerate * set local_files_only when internet unreachable * diffusers: fix error-handling path when model repo has no fp16 branch * fix generatorinpaint error Fixes : "ModuleNotFoundError: No module named 'ldm.invoke.generatorinpaint' https://github.com/invoke-ai/InvokeAI/pull/1583#issuecomment-1363634318 * quench diffuser safety-checker warning * diffusers: support stochastic DDIM eta parameter * fix conda env creation on macos * fix cross-attention with diffusers 0.11 * diffusers: the VAE needs to be tiling as well as the U-Net * diffusers: comment on subfolders * diffusers: embiggen! * diffusers: make model_cache.list_models serializable * diffusers(inpaint): restore scaling functionality * fix requirements clash between numba and numpy 1.24 * diffusers: allow inpainting model to do non-inpainting tasks * start expanding model_cache functionality * add import_ckpt_model() and import_diffuser_model() methods to model_manager - in addition, model_cache.py is now renamed to model_manager.py * allow "recommended" flag to be optional in INITIAL_MODELS.yaml * configure_invokeai now downloads VAE diffusers in advance * rename ModelCache to ModelManager * remove support for `repo_name` in models.yaml * check for and refuse to load embeddings trained on incompatible models * models.yaml.example: s/repo_name/repo_id and remove extra INITIAL_MODELS now that the main one has diffusers models in it. * add MVP textual inversion script * refactor(InvokeAIDiffuserComponent): factor out _combine() * InvokeAIDiffuserComponent: implement threshold * InvokeAIDiffuserComponent: diagnostic logs for threshold ...this does not look right * add a curses-based frontend to textual inversion - not quite working yet - requires npyscreen installed - on windows will also have the windows-curses requirement, but not added to requirements yet * add curses-based interface for textual inversion * fix crash in convert_and_import() - This corrects a "local variable referenced before assignment" error in model_manager.convert_and_import() * potential workaround for no 'state_dict' key error - As reported in https://github.com/huggingface/diffusers/issues/1876 * create TI output dir if needed * Update environment-lin-cuda.yml (#2159) Fixing line 42 to be the proper order to define the transformers requirement: ~= instead of =~ * diffusers: update sampler-to-scheduler mapping based on https://github.com/huggingface/diffusers/issues/277#issuecomment-1371428672 * improve user exp for ckt to diffusers conversion - !optimize_models command now operates on an existing ckpt file entry in models.yaml - replaces existing entry, rather than adding a new one - offers to delete the ckpt file after conversion * web: adapt progress callback to deal with old generator or new diffusers pipeline * clean-up model_manager code - add_model() verified to work for .ckpt local paths, .ckpt remote URLs, diffusers local paths, and diffusers repo_ids - convert_and_import() verified to work for local and remove .ckpt files * handle edge cases for import_model() and convert_model() * add support for safetensor .ckpt files * fix name error * code cleanup with pyflake * improve model setting behavior - If the user enters an invalid model name at startup time, will not try to load it, warn, and use default model - CLI UI enhancement: include currently active model in the command line prompt. * update test-invoke-pip.yml - fix model cache path to point to runwayml/stable-diffusion-v1-5 - remove `skip-sd-weights` from configure_invokeai.py args * exclude dev/diffusers from "fail for draft PRs" * disable "fail on PR jobs" * re-add `--skip-sd-weights` since no space * update workflow environments - include `INVOKE_MODEL_RECONFIGURE: '--yes'` * clean up model load failure handling - Allow CLI to run even when no model is defined or loadable. - Inhibit stack trace when model load fails - only show last error - Give user *option* to run configure_invokeai.py when no models successfully load. - Restart invokeai after reconfiguration. * further edge-case handling 1) only one model in models.yaml file, and that model is broken 2) no models in models.yaml 3) models.yaml doesn't exist at all * fix incorrect model status listing - "cached" was not being returned from list_models() - normalize handling of exceptions during model loading: - Passing an invalid model name to generate.set_model() will return a KeyError - All other exceptions are returned as the appropriate Exception * CI: do download weights (if not already cached) * diffusers: fix scheduler loading in offline mode * CI: fix model name (no longer has `diffusers-` prefix) * Update txt2img2img.py (#2256) * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * feat - make model storage compatible with hugging face caching system This commit alters the InvokeAI model directory to be compatible with hugging face, making it easier to share diffusers (and other models) across different programs. - If the HF_HOME environment variable is not set, then models are cached in ~/invokeai/models in a format that is identical to the HuggingFace cache. - If HF_HOME is set, then models are cached wherever HF_HOME points. - To enable sharing with other HuggingFace library clients, set HF_HOME to ~/.cache/huggingface to set the default cache location or to ~/invokeai/models to have huggingface cache inside InvokeAI. * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * fix error "no attribute CkptInpaint" * model_manager.list_models() returns entire model config stanza+status * Initial Draft - Model Manager Diffusers * added hash function to diffusers * implement sha256 hashes on diffusers models * Add Model Manager Support for Diffusers * fix various problems with model manager - in cli import functions, fix not enough values to unpack from _get_name_and_desc() - fix crash when using old-style vae: value with new-style diffuser * rebuild frontend * fix dictconfig-not-serializable issue * fix NoneType' object is not subscriptable crash in model_manager * fix "str has no attribute get" error in model_manager list_models() * Add path and repo_id support for Diffusers Model Manager Also fixes bugs * Fix tooltip IT localization not working * Add Version Number To WebUI * Optimize Model Search * Fix incorrect font on the Model Manager UI * Fix image degradation on merge fixes - [Experimental] This change should effectively fix a couple of things. - Fix image degradation on subsequent merges of the canvas layers. - Fix the slight transparent border that is left behind when filling the bounding box with a color. - Fix the left over line of color when filling a bounding box with color. So far there are no side effects for this. If any, please report. * Add local model filtering for Diffusers / Checkpoints * Go to home on modal close for the Add Modal UI * Styling Fixes * Model Manager Diffusers Localization Update * Add Safe Tensor scanning to Model Manager * Fix model edit form dispatching string values instead of numbers. * Resolve VAE handling / edge cases for supplied repos * defer injecting tokens for textual inversions until they're used for the first time * squash a console warning * implement model migration check * add_model() overwrites previous config rather than merges * fix model config file attribute merging * fix precision handling in textual inversion script * allow ckpt conversion script to work with safetensors .ckpts Applied patch here: https://github.com/huggingface/diffusers/commit/beb932c5d111872c5e45387e7b1b2b3dd0524a47 * fix name "args" is not defined crash in textual_inversion_training * fix a second NameError: name 'args' is not defined crash * fix loading of the safety checker from the global cache dir * add installation step to textual inversion frontend - After a successful training run, the script will copy learned_embeds.bin to a subfolder of the embeddings directory. - User given the option to delete the logs and intermediate checkpoints (which together use 7-8G of space) - If textual inversion training fails, reports the error gracefully. * don't crash out on incompatible embeddings - put try: blocks around places where the system tries to load an embedding which is incompatible with the currently loaded model * add support for checkpoint resuming * textual inversion preferences are saved and restored between sessions - Preferences are stored in a file named text-inversion-training/preferences.conf - Currently the resume-from-checkpoint option is not working correctly. Possible bug in textual_inversion_training.py? * copy learned_embeddings.bin into right location * add front end for diffusers model merging - Front end doesn't do anything yet!!!! - Made change to model name parsing in CLI to support ability to have merged models with the "+" character in their names. * improve inpainting experience - recommend ckpt version of inpainting-1.5 to user - fix get_noise() bug in ckpt version of omnibus.py * update environment*yml * tweak instructions to install HuggingFace token * bump version number * enhance update scripts - update scripts will now fetch new INITIAL_MODELS.yaml so that configure_invokeai.py will know about the diffusers versions. * enhance invoke.sh/invoke.bat launchers - added configure_invokeai.py to menu - menu defaults to browser-based invoke * remove conda workflow (#2321) * fix `token_ids has shape torch.Size([79]) - expected [77]` * update CHANGELOG.md with 2.3.* info - Add information on how formats have changed and the upgrade process. - Add short bug list. Co-authored-by: Damian Stewart <d@damianstewart.com> Co-authored-by: Damian Stewart <null@damianstewart.com> Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> Co-authored-by: Wybartel-luxmc <37852506+Wybartel-luxmc@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> Co-authored-by: mickr777 <115216705+mickr777@users.noreply.github.com> Co-authored-by: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Co-authored-by: Eugene Brodsky <ebr@users.noreply.github.com> Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com>
2023-01-15 14:22:46 +00:00
except RuntimeError:
print(traceback.format_exc(), file=sys.stderr)
print('>> Could not generate image.')
Refactoring simplet2i (#387) * start refactoring -not yet functional * first phase of refactor done - not sure weighted prompts working * Second phase of refactoring. Everything mostly working. * The refactoring has moved all the hard-core inference work into ldm.dream.generator.*, where there are submodules for txt2img and img2img. inpaint will go in there as well. * Some additional refactoring will be done soon, but relatively minor work. * fix -save_orig flag to actually work * add @neonsecret attention.py memory optimization * remove unneeded imports * move token logging into conditioning.py * add placeholder version of inpaint; porting in progress * fix crash in img2img * inpainting working; not tested on variations * fix crashes in img2img * ported attention.py memory optimization #117 from basujindal branch * added @torch_no_grad() decorators to img2img, txt2img, inpaint closures * Final commit prior to PR against development * fixup crash when generating intermediate images in web UI * rename ldm.simplet2i to ldm.generate * add backward-compatibility simplet2i shell with deprecation warning * add back in mps exception, addresses @vargol comment in #354 * replaced Conditioning class with exported functions * fix wrong type of with_variations attribute during intialization * changed "image_iterator()" to "get_make_image()" * raise NotImplementedError for calling get_make_image() in parent class * Update ldm/generate.py better error message Co-authored-by: Kevin Gibbons <bakkot@gmail.com> * minor stylistic fixes and assertion checks from code review * moved get_noise() method into img2img class * break get_noise() into two methods, one for txt2img and the other for img2img * inpainting works on non-square images now * make get_noise() an abstract method in base class * much improved inpainting Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
2022-09-06 00:40:10 +00:00
toc = time.time()
print('>> Usage stats:')
print(
f'>> {len(results)} image(s) generated in', '%4.2fs' % (
toc - tic)
Refactoring simplet2i (#387) * start refactoring -not yet functional * first phase of refactor done - not sure weighted prompts working * Second phase of refactoring. Everything mostly working. * The refactoring has moved all the hard-core inference work into ldm.dream.generator.*, where there are submodules for txt2img and img2img. inpaint will go in there as well. * Some additional refactoring will be done soon, but relatively minor work. * fix -save_orig flag to actually work * add @neonsecret attention.py memory optimization * remove unneeded imports * move token logging into conditioning.py * add placeholder version of inpaint; porting in progress * fix crash in img2img * inpainting working; not tested on variations * fix crashes in img2img * ported attention.py memory optimization #117 from basujindal branch * added @torch_no_grad() decorators to img2img, txt2img, inpaint closures * Final commit prior to PR against development * fixup crash when generating intermediate images in web UI * rename ldm.simplet2i to ldm.generate * add backward-compatibility simplet2i shell with deprecation warning * add back in mps exception, addresses @vargol comment in #354 * replaced Conditioning class with exported functions * fix wrong type of with_variations attribute during intialization * changed "image_iterator()" to "get_make_image()" * raise NotImplementedError for calling get_make_image() in parent class * Update ldm/generate.py better error message Co-authored-by: Kevin Gibbons <bakkot@gmail.com> * minor stylistic fixes and assertion checks from code review * moved get_noise() method into img2img class * break get_noise() into two methods, one for txt2img and the other for img2img * inpainting works on non-square images now * make get_noise() an abstract method in base class * much improved inpainting Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
2022-09-06 00:40:10 +00:00
)
if self._has_cuda():
print(
use 🧨diffusers model (#1583) * initial commit of DiffusionPipeline class * spike: proof of concept using diffusers for txt2img * doc: type hints for Generator * refactor(model_cache): factor out load_ckpt * model_cache: add ability to load a diffusers model pipeline and update associated things in Generate & Generator to not instantly fail when that happens * model_cache: fix model default image dimensions * txt2img: support switching diffusers schedulers * diffusers: let the scheduler do its scaling of the initial latents Remove IPNDM scheduler; it is not behaving. * web server: update image_progress callback for diffusers data * diffusers: restore prompt weighting feature * diffusers: fix set-sampler error following model switch * diffusers: use InvokeAIDiffuserComponent for conditioning * cross_attention_control: stub (no-op) implementations for diffusers * model_cache: let offload_model work with DiffusionPipeline, sorta. * models.yaml.example: add diffusers-format model, set as default * test-invoke-conda: use diffusers-format model test-invoke-conda: put huggingface-token where the library can use it * environment-mac: upgrade to diffusers 0.7 (from 0.6) this was already done for linux; mac must have been lost in the merge. * preload_models: explicitly load diffusers models In non-interactive mode too, as long as you're logged in. * fix(model_cache): don't check `model.config` in diffusers format clean-up from recent merge. * diffusers integration: support img2img * dev: upgrade to diffusers 0.8 (from 0.7.1) We get to remove some code by using methods that were factored out in the base class. * refactor: remove backported img2img.get_timesteps now that we can use it directly from diffusers 0.8.1 * ci: use diffusers model * dev: upgrade to diffusers 0.9 (from 0.8.1) * lint: correct annotations for Python 3.9. * lint: correct AttributeError.name reference for Python 3.9. * CI: prefer diffusers-1.4 because it no longer requires a token The RunwayML models still do. * build: there's yet another place to update requirements? * configure: try to download models even without token Models in the CompVis and stabilityai repos no longer require them. (But runwayml still does.) * configure: add troubleshooting info for config-not-found * fix(configure): prepend root to config path * fix(configure): remove second `default: true` from models example * CI: simplify test-on-push logic now that we don't need secrets The "test on push but only in forks" logic was only necessary when tests didn't work for PRs-from-forks. * create an embedding_manager for diffusers * internal: avoid importing diffusers DummyObject see https://github.com/huggingface/diffusers/issues/1479 * fix "config attributes…not expected" diffusers warnings. * fix deprecated scheduler construction * work around an apparent MPS torch bug that causes conditioning to have no effect * 🚧 post-rebase repair * preliminary support for outpainting (no masking yet) * monkey-patch diffusers.attention and use Invoke lowvram code * add always_use_cpu arg to bypass MPS * add cross-attention control support to diffusers (fails on MPS) For unknown reasons MPS produces garbage output with .swap(). Use --always_use_cpu arg to invoke.py for now to test this code on MPS. * diffusers support for the inpainting model * fix debug_image to not crash with non-RGB images. * inpainting for the normal model [WIP] This seems to be performing well until the LAST STEP, at which point it dissolves to confetti. * fix off-by-one bug in cross-attention-control (#1774) prompt token sequences begin with a "beginning-of-sequence" marker <bos> and end with a repeated "end-of-sequence" marker <eos> - to make a default prompt length of <bos> + 75 prompt tokens + <eos>. the .swap() code was failing to take the column for <bos> at index 0 into account. the changes here do that, and also add extra handling for a single <eos> (which may be redundant but which is included for completeness). based on my understanding and some assumptions about how this all works, the reason .swap() nevertheless seemed to do the right thing, to some extent, is because over multiple steps the conditioning process in Stable Diffusion operates as a feedback loop. a change to token n-1 has flow-on effects to how the [1x4x64x64] latent tensor is modified by all the tokens after it, - and as the next step is processed, all the tokens before it as well. intuitively, a token's conditioning effects "echo" throughout the whole length of the prompt. so even though the token at n-1 was being edited when what the user actually wanted was to edit the token at n, it nevertheless still had some non-negligible effect, in roughly the right direction, often enough that it seemed like it was working properly. * refactor common CrossAttention stuff into a mixin so that the old ldm code can still work if necessary * inpainting for the normal model. I think it works this time. * diffusers: reset num_vectors_per_token sync with 44a00555718f1df173c60da0ed646cf700e29537 * diffusers: txt2img2img (hires_fix) with so much slicing and dicing of pipeline methods to stitch them together * refactor(diffusers): reduce some code duplication amongst the different tasks * fixup! refactor(diffusers): reduce some code duplication amongst the different tasks * diffusers: enable DPMSolver++ scheduler * diffusers: upgrade to diffusers 0.10, add Heun scheduler * diffusers(ModelCache): stopgap to make from_cpu compatible with diffusers * CI: default to diffusers-1.5 now that runwayml token requirement is gone * diffusers: update to 0.10 (and transformers to 4.25) * diffusers: use xformers when available diffusers no longer auto-enables this as of 0.10.2. * diffusers: make masked img2img behave better with multi-step schedulers re-randomizing the noise each step was confusing them. * diffusers: work more better with more models. fixed relative path problem with local models. fixed models on hub not always having a `fp16` branch. * diffusers: stopgap fix for attention_maps_callback crash after recent merge * fixup import merge conflicts correction for 061c5369a2247c6c92cd69606bcf54c4f1962a0b * test: add tests/inpainting inputs for masked img2img * diffusers(AddsMaskedGuidance): partial fix for k-schedulers Prevents them from crashing, but results are still hot garbage. * fix --safety_checker arg parsing and add note to diffusers loader about where safety checker gets called * generate: fix import error * CI: don't try to read the old init location * diffusers: support loading an alternate VAE * CI: remove sh-syntax if-statement so it doesn't crash powershell * CI: fold strings in yaml because backslash is not line-continuation in powershell * attention maps callback stuff for diffusers * build: fix syntax error in environment-mac * diffusers: add INITIAL_MODELS with diffusers-compatible repos * re-enable the embedding manager; closes #1778 * Squashed commit of the following: commit e4a956abc37fcb5cf188388b76b617bc5c8fda7d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:43:07 2022 +0100 import new load handling from EmbeddingManager and cleanup commit c4abe91a5ba0d415b45bf734068385668b7a66e6 Merge: 032e856e 1efc6397 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:09:53 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers_with_textual_inversion_manager commit 032e856eefb3bbc39534f5daafd25764bcfcef8b Merge: 8b4f0fe9 bc515e24 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:08:01 2022 +0100 Merge remote-tracking branch 'upstream/dev/diffusers' into dev/diffusers_with_textual_inversion_manager commit 1efc6397fc6e61c1aff4b0258b93089d61de5955 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:04:28 2022 +0100 cleanup and add performance notes commit e400f804ac471a0ca2ba432fd658778b20c7bdab Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:45:07 2022 +0100 fix bug and update unit tests commit deb9ae0ae1016750e93ce8275734061f7285a231 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:28:29 2022 +0100 textual inversion manager seems to work commit 162e02505dec777e91a983c4d0fb52e950d25ff0 Merge: cbad4583 12769b3d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:58:03 2022 +0100 Merge branch 'main' into feature_textual_inversion_mgr commit cbad45836c6aace6871a90f2621a953f49433131 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:54:10 2022 +0100 use position embeddings commit 070344c69b0e0db340a183857d0a787b348681d3 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:53:47 2022 +0100 Don't crash CLI on exceptions commit b035ac8c6772dfd9ba41b8eeb9103181cda028f8 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:11:55 2022 +0100 add missing position_embeddings commit 12769b3d3562ef71e0f54946b532ad077e10043c Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:33:25 2022 +0100 debugging why it don't work commit bafb7215eabe1515ca5e8388fd3bb2f3ac5362cf Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:21:33 2022 +0100 debugging why it don't work commit 664a6e9e146b42d96703f0cc8baf8f5efec04ee1 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit 8b4f0fe9d6e4e2643b36dfa27864294785d7ba4e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit ffbe1ab11163ba712e353d89404e301d0e0c6cdf Merge: 6e4dad60 023df37e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:37:31 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers commit 023df37efffa67434f77def7fc3c9dfb29f699fd Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:36:54 2022 +0100 cleanup commit 05fac594eaf79d0058e3c48deee93df603f136c2 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:07:49 2022 +0100 tweak error checking commit 009f32ed39a7280997c3ffab112adadee0b44279 Author: damian <null@damianstewart.com> Date: Thu Dec 15 21:29:47 2022 +0100 unit tests passing for embeddings with vector length >1 commit beb1b08d9a98112ed2fe073580568e1a18698da3 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:39:09 2022 +0100 more explicit equality tests when overwriting commit 44d8a5a7c85cdabc9ce3a54fd0769a10597b3ca9 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:30:13 2022 +0100 wip textual inversion manager (unit tests passing for 1v embedding overwriting) commit 417c2b57d90924a839616bfb66804faab8039e4c Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 12:30:55 2022 +0100 wip textual inversion manager (unit tests passing for base stuff + padding) commit 2e80872e3b6f7fd7d8eb8928822bd824b63cb2ff Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 10:57:57 2022 +0100 wip new TextualInversionManager * stop using WeightedFrozenCLIPEmbedder * store diffusion models locally - configure_invokeai.py reconfigured to store diffusion models rather than CompVis models - hugging face caching model is used, but cache is set to ~/invokeai/models/repo_id - models.yaml does **NOT** use path, just repo_id - "repo_name" changed to "repo_id" to following hugging face conventions - Models are loaded with full precision pending further work. * allow non-local files during development * path takes priority over repo_id * MVP for model_cache and configure_invokeai - Feature complete (almost) - configure_invokeai.py downloads both .ckpt and diffuser models, along with their VAEs. Both types of download are controlled by a unified INITIAL_MODELS.yaml file. - model_cache can load both type of model and switches back and forth in CPU. No memory leaks detected TO DO: 1. I have not yet turned on the LocalOnly flag for diffuser models, so the code will check the Hugging Face repo for updates before using the locally cached models. This will break firewalled systems. I am thinking of putting in a global check for internet connectivity at startup time and setting the LocalOnly flag based on this. It would be good to check updates if there is connectivity. 2. I have not gone completely through INITIAL_MODELS.yaml to check which models are available as diffusers and which are not. So models like PaperCut and VoxelArt may not load properly. The runway and stability models are checked, as well as the Trinart models. 3. Add stanzas for SD 2.0 and 2.1 in INITIAL_MODELS.yaml REMAINING PROBLEMS NOT DIRECTLY RELATED TO MODEL_CACHE: 1. When loading a .ckpt file there are lots of messages like this: Warning! ldm.modules.attention.CrossAttention is no longer being maintained. Please use InvokeAICrossAttention instead. I'm not sure how to address this. 2. The ckpt models ***don't actually run*** due to the lack of special-case support for them in the generator objects. For example, here's the hard crash you get when you run txt2img against the legacy waifu-diffusion-1.3 model: ``` >> An error occurred: Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 140, in main main_loop(gen, opt) File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 371, in main_loop gen.prompt2image( File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1265, in __getattr__ raise AttributeError("'{}' object has no attribute '{}'".format( AttributeError: 'LatentDiffusion' object has no attribute 'image_from_embeddings' ``` 3. The inpainting diffusion model isn't working. Here's the output of "banana sushi" when inpainting-1.5 is loaded: ``` Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 301, in image_from_embeddings result_latents, result_attention_map_saver = self.latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 330, in latents_from_embeddings result: PipelineIntermediateState = infer_latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 185, in __call__ for result in self.generator_method(*args, **kwargs): File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 367, in generate_latents_from_embeddings step_output = self.step(batched_t, latents, guidance_scale, File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context return func(*args, **kwargs) File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 409, in step step_output = self.scheduler.step(noise_pred, timestep, latents, **extra_step_kwargs) File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/diffusers/schedulers/scheduling_lms_discrete.py", line 223, in step pred_original_sample = sample - sigma * model_output RuntimeError: The size of tensor a (9) must match the size of tensor b (4) at non-singleton dimension 1 ``` * proper support for float32/float16 - configure script now correctly detects user's preference for fp16/32 and downloads the correct diffuser version. If fp16 version not available, falls back to fp32 version. - misc code cleanup and simplification in model_cache * add on-the-fly conversion of .ckpt to diffusers models 1. On-the-fly conversion code can be found in the file ldm/invoke/ckpt_to_diffusers.py. 2. A new !optimize command has been added to the CLI. Should be ported to Web GUI. User experience on the CLI is this: ``` invoke> !optimize /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt INFO: Converting legacy weights file /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt to optimized diffuser model. This operation will take 30-60s to complete. Success. Optimized model is now located at /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 Writing new config file entry for sd-v1-4... >> New configuration: sd-v1-4: description: Optimized version of sd-v1-4 format: diffusers path: /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 OK to import [n]? y >> Verifying that new model loads... >> Current VRAM usage: 2.60G >> Offloading stable-diffusion-2.1 to CPU >> Loading diffusers model from /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 | Using faster float16 precision You have disabled the safety checker for <class 'ldm.invoke.generator.diffusers_pipeline.StableDiffusionGeneratorPipeline'> by passing `safety_checker=None`. Ensure that you abide to the conditions of the Stable Diffusion \ license and do not expose unfiltered results in services or applications open to the public. Both the diffusers team and Hugging Face strongly recommend to keep the safety filter enabled in all public facing circumstances,\ disabling it only for use-cases that involve analyzing network behavior or auditing its results. For more information, please have a look at https://github.com/huggingface/diffusers/pull/254 . | training width x height = (512 x 512) >> Model loaded in 3.48s >> Max VRAM used to load the model: 2.17G >> Current VRAM usage:2.17G >> Textual inversions available: >> Setting Sampler to k_lms (LMSDiscreteScheduler) Keep model loaded? [y] ``` * add parallel set of generator files for ckpt legacy generation * generation using legacy ckpt models now working * diffusers: fix missing attention_maps_callback fix for 23eb80b40421b2bb8f4b6d3dd30490d11c447b36 * associate legacy CrossAttention with .ckpt models * enable autoconvert New --autoconvert CLI option will scan a designated directory for new .ckpt files, convert them into diffuser models, and import them into models.yaml. Works like this: invoke.py --autoconvert /path/to/weights/directory In ModelCache added two new methods: autoconvert_weights(config_path, weights_directory_path, models_directory_path) convert_and_import(ckpt_path, diffuser_path) * diffusers: update to diffusers 0.11 (from 0.10.2) * fix vae loading & width/height calculation * refactor: encapsulate these conditioning data into one container * diffusers: fix some noise-scaling issues by pushing the noise-mixing down to the common function * add support for safetensors and accelerate * set local_files_only when internet unreachable * diffusers: fix error-handling path when model repo has no fp16 branch * fix generatorinpaint error Fixes : "ModuleNotFoundError: No module named 'ldm.invoke.generatorinpaint' https://github.com/invoke-ai/InvokeAI/pull/1583#issuecomment-1363634318 * quench diffuser safety-checker warning * diffusers: support stochastic DDIM eta parameter * fix conda env creation on macos * fix cross-attention with diffusers 0.11 * diffusers: the VAE needs to be tiling as well as the U-Net * diffusers: comment on subfolders * diffusers: embiggen! * diffusers: make model_cache.list_models serializable * diffusers(inpaint): restore scaling functionality * fix requirements clash between numba and numpy 1.24 * diffusers: allow inpainting model to do non-inpainting tasks * start expanding model_cache functionality * add import_ckpt_model() and import_diffuser_model() methods to model_manager - in addition, model_cache.py is now renamed to model_manager.py * allow "recommended" flag to be optional in INITIAL_MODELS.yaml * configure_invokeai now downloads VAE diffusers in advance * rename ModelCache to ModelManager * remove support for `repo_name` in models.yaml * check for and refuse to load embeddings trained on incompatible models * models.yaml.example: s/repo_name/repo_id and remove extra INITIAL_MODELS now that the main one has diffusers models in it. * add MVP textual inversion script * refactor(InvokeAIDiffuserComponent): factor out _combine() * InvokeAIDiffuserComponent: implement threshold * InvokeAIDiffuserComponent: diagnostic logs for threshold ...this does not look right * add a curses-based frontend to textual inversion - not quite working yet - requires npyscreen installed - on windows will also have the windows-curses requirement, but not added to requirements yet * add curses-based interface for textual inversion * fix crash in convert_and_import() - This corrects a "local variable referenced before assignment" error in model_manager.convert_and_import() * potential workaround for no 'state_dict' key error - As reported in https://github.com/huggingface/diffusers/issues/1876 * create TI output dir if needed * Update environment-lin-cuda.yml (#2159) Fixing line 42 to be the proper order to define the transformers requirement: ~= instead of =~ * diffusers: update sampler-to-scheduler mapping based on https://github.com/huggingface/diffusers/issues/277#issuecomment-1371428672 * improve user exp for ckt to diffusers conversion - !optimize_models command now operates on an existing ckpt file entry in models.yaml - replaces existing entry, rather than adding a new one - offers to delete the ckpt file after conversion * web: adapt progress callback to deal with old generator or new diffusers pipeline * clean-up model_manager code - add_model() verified to work for .ckpt local paths, .ckpt remote URLs, diffusers local paths, and diffusers repo_ids - convert_and_import() verified to work for local and remove .ckpt files * handle edge cases for import_model() and convert_model() * add support for safetensor .ckpt files * fix name error * code cleanup with pyflake * improve model setting behavior - If the user enters an invalid model name at startup time, will not try to load it, warn, and use default model - CLI UI enhancement: include currently active model in the command line prompt. * update test-invoke-pip.yml - fix model cache path to point to runwayml/stable-diffusion-v1-5 - remove `skip-sd-weights` from configure_invokeai.py args * exclude dev/diffusers from "fail for draft PRs" * disable "fail on PR jobs" * re-add `--skip-sd-weights` since no space * update workflow environments - include `INVOKE_MODEL_RECONFIGURE: '--yes'` * clean up model load failure handling - Allow CLI to run even when no model is defined or loadable. - Inhibit stack trace when model load fails - only show last error - Give user *option* to run configure_invokeai.py when no models successfully load. - Restart invokeai after reconfiguration. * further edge-case handling 1) only one model in models.yaml file, and that model is broken 2) no models in models.yaml 3) models.yaml doesn't exist at all * fix incorrect model status listing - "cached" was not being returned from list_models() - normalize handling of exceptions during model loading: - Passing an invalid model name to generate.set_model() will return a KeyError - All other exceptions are returned as the appropriate Exception * CI: do download weights (if not already cached) * diffusers: fix scheduler loading in offline mode * CI: fix model name (no longer has `diffusers-` prefix) * Update txt2img2img.py (#2256) * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * feat - make model storage compatible with hugging face caching system This commit alters the InvokeAI model directory to be compatible with hugging face, making it easier to share diffusers (and other models) across different programs. - If the HF_HOME environment variable is not set, then models are cached in ~/invokeai/models in a format that is identical to the HuggingFace cache. - If HF_HOME is set, then models are cached wherever HF_HOME points. - To enable sharing with other HuggingFace library clients, set HF_HOME to ~/.cache/huggingface to set the default cache location or to ~/invokeai/models to have huggingface cache inside InvokeAI. * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * fix error "no attribute CkptInpaint" * model_manager.list_models() returns entire model config stanza+status * Initial Draft - Model Manager Diffusers * added hash function to diffusers * implement sha256 hashes on diffusers models * Add Model Manager Support for Diffusers * fix various problems with model manager - in cli import functions, fix not enough values to unpack from _get_name_and_desc() - fix crash when using old-style vae: value with new-style diffuser * rebuild frontend * fix dictconfig-not-serializable issue * fix NoneType' object is not subscriptable crash in model_manager * fix "str has no attribute get" error in model_manager list_models() * Add path and repo_id support for Diffusers Model Manager Also fixes bugs * Fix tooltip IT localization not working * Add Version Number To WebUI * Optimize Model Search * Fix incorrect font on the Model Manager UI * Fix image degradation on merge fixes - [Experimental] This change should effectively fix a couple of things. - Fix image degradation on subsequent merges of the canvas layers. - Fix the slight transparent border that is left behind when filling the bounding box with a color. - Fix the left over line of color when filling a bounding box with color. So far there are no side effects for this. If any, please report. * Add local model filtering for Diffusers / Checkpoints * Go to home on modal close for the Add Modal UI * Styling Fixes * Model Manager Diffusers Localization Update * Add Safe Tensor scanning to Model Manager * Fix model edit form dispatching string values instead of numbers. * Resolve VAE handling / edge cases for supplied repos * defer injecting tokens for textual inversions until they're used for the first time * squash a console warning * implement model migration check * add_model() overwrites previous config rather than merges * fix model config file attribute merging * fix precision handling in textual inversion script * allow ckpt conversion script to work with safetensors .ckpts Applied patch here: https://github.com/huggingface/diffusers/commit/beb932c5d111872c5e45387e7b1b2b3dd0524a47 * fix name "args" is not defined crash in textual_inversion_training * fix a second NameError: name 'args' is not defined crash * fix loading of the safety checker from the global cache dir * add installation step to textual inversion frontend - After a successful training run, the script will copy learned_embeds.bin to a subfolder of the embeddings directory. - User given the option to delete the logs and intermediate checkpoints (which together use 7-8G of space) - If textual inversion training fails, reports the error gracefully. * don't crash out on incompatible embeddings - put try: blocks around places where the system tries to load an embedding which is incompatible with the currently loaded model * add support for checkpoint resuming * textual inversion preferences are saved and restored between sessions - Preferences are stored in a file named text-inversion-training/preferences.conf - Currently the resume-from-checkpoint option is not working correctly. Possible bug in textual_inversion_training.py? * copy learned_embeddings.bin into right location * add front end for diffusers model merging - Front end doesn't do anything yet!!!! - Made change to model name parsing in CLI to support ability to have merged models with the "+" character in their names. * improve inpainting experience - recommend ckpt version of inpainting-1.5 to user - fix get_noise() bug in ckpt version of omnibus.py * update environment*yml * tweak instructions to install HuggingFace token * bump version number * enhance update scripts - update scripts will now fetch new INITIAL_MODELS.yaml so that configure_invokeai.py will know about the diffusers versions. * enhance invoke.sh/invoke.bat launchers - added configure_invokeai.py to menu - menu defaults to browser-based invoke * remove conda workflow (#2321) * fix `token_ids has shape torch.Size([79]) - expected [77]` * update CHANGELOG.md with 2.3.* info - Add information on how formats have changed and the upgrade process. - Add short bug list. Co-authored-by: Damian Stewart <d@damianstewart.com> Co-authored-by: Damian Stewart <null@damianstewart.com> Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> Co-authored-by: Wybartel-luxmc <37852506+Wybartel-luxmc@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> Co-authored-by: mickr777 <115216705+mickr777@users.noreply.github.com> Co-authored-by: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Co-authored-by: Eugene Brodsky <ebr@users.noreply.github.com> Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com>
2023-01-15 14:22:46 +00:00
'>> Max VRAM used for this generation:',
'%4.2fG.' % (torch.cuda.max_memory_allocated() / 1e9),
'Current VRAM utilization:',
'%4.2fG' % (torch.cuda.memory_allocated() / 1e9),
)
Refactoring simplet2i (#387) * start refactoring -not yet functional * first phase of refactor done - not sure weighted prompts working * Second phase of refactoring. Everything mostly working. * The refactoring has moved all the hard-core inference work into ldm.dream.generator.*, where there are submodules for txt2img and img2img. inpaint will go in there as well. * Some additional refactoring will be done soon, but relatively minor work. * fix -save_orig flag to actually work * add @neonsecret attention.py memory optimization * remove unneeded imports * move token logging into conditioning.py * add placeholder version of inpaint; porting in progress * fix crash in img2img * inpainting working; not tested on variations * fix crashes in img2img * ported attention.py memory optimization #117 from basujindal branch * added @torch_no_grad() decorators to img2img, txt2img, inpaint closures * Final commit prior to PR against development * fixup crash when generating intermediate images in web UI * rename ldm.simplet2i to ldm.generate * add backward-compatibility simplet2i shell with deprecation warning * add back in mps exception, addresses @vargol comment in #354 * replaced Conditioning class with exported functions * fix wrong type of with_variations attribute during intialization * changed "image_iterator()" to "get_make_image()" * raise NotImplementedError for calling get_make_image() in parent class * Update ldm/generate.py better error message Co-authored-by: Kevin Gibbons <bakkot@gmail.com> * minor stylistic fixes and assertion checks from code review * moved get_noise() method into img2img class * break get_noise() into two methods, one for txt2img and the other for img2img * inpainting works on non-square images now * make get_noise() an abstract method in base class * much improved inpainting Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
2022-09-06 00:40:10 +00:00
self.session_peakmem = max(
self.session_peakmem, torch.cuda.max_memory_allocated()
)
print(
use 🧨diffusers model (#1583) * initial commit of DiffusionPipeline class * spike: proof of concept using diffusers for txt2img * doc: type hints for Generator * refactor(model_cache): factor out load_ckpt * model_cache: add ability to load a diffusers model pipeline and update associated things in Generate & Generator to not instantly fail when that happens * model_cache: fix model default image dimensions * txt2img: support switching diffusers schedulers * diffusers: let the scheduler do its scaling of the initial latents Remove IPNDM scheduler; it is not behaving. * web server: update image_progress callback for diffusers data * diffusers: restore prompt weighting feature * diffusers: fix set-sampler error following model switch * diffusers: use InvokeAIDiffuserComponent for conditioning * cross_attention_control: stub (no-op) implementations for diffusers * model_cache: let offload_model work with DiffusionPipeline, sorta. * models.yaml.example: add diffusers-format model, set as default * test-invoke-conda: use diffusers-format model test-invoke-conda: put huggingface-token where the library can use it * environment-mac: upgrade to diffusers 0.7 (from 0.6) this was already done for linux; mac must have been lost in the merge. * preload_models: explicitly load diffusers models In non-interactive mode too, as long as you're logged in. * fix(model_cache): don't check `model.config` in diffusers format clean-up from recent merge. * diffusers integration: support img2img * dev: upgrade to diffusers 0.8 (from 0.7.1) We get to remove some code by using methods that were factored out in the base class. * refactor: remove backported img2img.get_timesteps now that we can use it directly from diffusers 0.8.1 * ci: use diffusers model * dev: upgrade to diffusers 0.9 (from 0.8.1) * lint: correct annotations for Python 3.9. * lint: correct AttributeError.name reference for Python 3.9. * CI: prefer diffusers-1.4 because it no longer requires a token The RunwayML models still do. * build: there's yet another place to update requirements? * configure: try to download models even without token Models in the CompVis and stabilityai repos no longer require them. (But runwayml still does.) * configure: add troubleshooting info for config-not-found * fix(configure): prepend root to config path * fix(configure): remove second `default: true` from models example * CI: simplify test-on-push logic now that we don't need secrets The "test on push but only in forks" logic was only necessary when tests didn't work for PRs-from-forks. * create an embedding_manager for diffusers * internal: avoid importing diffusers DummyObject see https://github.com/huggingface/diffusers/issues/1479 * fix "config attributes…not expected" diffusers warnings. * fix deprecated scheduler construction * work around an apparent MPS torch bug that causes conditioning to have no effect * 🚧 post-rebase repair * preliminary support for outpainting (no masking yet) * monkey-patch diffusers.attention and use Invoke lowvram code * add always_use_cpu arg to bypass MPS * add cross-attention control support to diffusers (fails on MPS) For unknown reasons MPS produces garbage output with .swap(). Use --always_use_cpu arg to invoke.py for now to test this code on MPS. * diffusers support for the inpainting model * fix debug_image to not crash with non-RGB images. * inpainting for the normal model [WIP] This seems to be performing well until the LAST STEP, at which point it dissolves to confetti. * fix off-by-one bug in cross-attention-control (#1774) prompt token sequences begin with a "beginning-of-sequence" marker <bos> and end with a repeated "end-of-sequence" marker <eos> - to make a default prompt length of <bos> + 75 prompt tokens + <eos>. the .swap() code was failing to take the column for <bos> at index 0 into account. the changes here do that, and also add extra handling for a single <eos> (which may be redundant but which is included for completeness). based on my understanding and some assumptions about how this all works, the reason .swap() nevertheless seemed to do the right thing, to some extent, is because over multiple steps the conditioning process in Stable Diffusion operates as a feedback loop. a change to token n-1 has flow-on effects to how the [1x4x64x64] latent tensor is modified by all the tokens after it, - and as the next step is processed, all the tokens before it as well. intuitively, a token's conditioning effects "echo" throughout the whole length of the prompt. so even though the token at n-1 was being edited when what the user actually wanted was to edit the token at n, it nevertheless still had some non-negligible effect, in roughly the right direction, often enough that it seemed like it was working properly. * refactor common CrossAttention stuff into a mixin so that the old ldm code can still work if necessary * inpainting for the normal model. I think it works this time. * diffusers: reset num_vectors_per_token sync with 44a00555718f1df173c60da0ed646cf700e29537 * diffusers: txt2img2img (hires_fix) with so much slicing and dicing of pipeline methods to stitch them together * refactor(diffusers): reduce some code duplication amongst the different tasks * fixup! refactor(diffusers): reduce some code duplication amongst the different tasks * diffusers: enable DPMSolver++ scheduler * diffusers: upgrade to diffusers 0.10, add Heun scheduler * diffusers(ModelCache): stopgap to make from_cpu compatible with diffusers * CI: default to diffusers-1.5 now that runwayml token requirement is gone * diffusers: update to 0.10 (and transformers to 4.25) * diffusers: use xformers when available diffusers no longer auto-enables this as of 0.10.2. * diffusers: make masked img2img behave better with multi-step schedulers re-randomizing the noise each step was confusing them. * diffusers: work more better with more models. fixed relative path problem with local models. fixed models on hub not always having a `fp16` branch. * diffusers: stopgap fix for attention_maps_callback crash after recent merge * fixup import merge conflicts correction for 061c5369a2247c6c92cd69606bcf54c4f1962a0b * test: add tests/inpainting inputs for masked img2img * diffusers(AddsMaskedGuidance): partial fix for k-schedulers Prevents them from crashing, but results are still hot garbage. * fix --safety_checker arg parsing and add note to diffusers loader about where safety checker gets called * generate: fix import error * CI: don't try to read the old init location * diffusers: support loading an alternate VAE * CI: remove sh-syntax if-statement so it doesn't crash powershell * CI: fold strings in yaml because backslash is not line-continuation in powershell * attention maps callback stuff for diffusers * build: fix syntax error in environment-mac * diffusers: add INITIAL_MODELS with diffusers-compatible repos * re-enable the embedding manager; closes #1778 * Squashed commit of the following: commit e4a956abc37fcb5cf188388b76b617bc5c8fda7d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:43:07 2022 +0100 import new load handling from EmbeddingManager and cleanup commit c4abe91a5ba0d415b45bf734068385668b7a66e6 Merge: 032e856e 1efc6397 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:09:53 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers_with_textual_inversion_manager commit 032e856eefb3bbc39534f5daafd25764bcfcef8b Merge: 8b4f0fe9 bc515e24 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:08:01 2022 +0100 Merge remote-tracking branch 'upstream/dev/diffusers' into dev/diffusers_with_textual_inversion_manager commit 1efc6397fc6e61c1aff4b0258b93089d61de5955 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:04:28 2022 +0100 cleanup and add performance notes commit e400f804ac471a0ca2ba432fd658778b20c7bdab Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:45:07 2022 +0100 fix bug and update unit tests commit deb9ae0ae1016750e93ce8275734061f7285a231 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:28:29 2022 +0100 textual inversion manager seems to work commit 162e02505dec777e91a983c4d0fb52e950d25ff0 Merge: cbad4583 12769b3d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:58:03 2022 +0100 Merge branch 'main' into feature_textual_inversion_mgr commit cbad45836c6aace6871a90f2621a953f49433131 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:54:10 2022 +0100 use position embeddings commit 070344c69b0e0db340a183857d0a787b348681d3 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:53:47 2022 +0100 Don't crash CLI on exceptions commit b035ac8c6772dfd9ba41b8eeb9103181cda028f8 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:11:55 2022 +0100 add missing position_embeddings commit 12769b3d3562ef71e0f54946b532ad077e10043c Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:33:25 2022 +0100 debugging why it don't work commit bafb7215eabe1515ca5e8388fd3bb2f3ac5362cf Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:21:33 2022 +0100 debugging why it don't work commit 664a6e9e146b42d96703f0cc8baf8f5efec04ee1 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit 8b4f0fe9d6e4e2643b36dfa27864294785d7ba4e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit ffbe1ab11163ba712e353d89404e301d0e0c6cdf Merge: 6e4dad60 023df37e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:37:31 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers commit 023df37efffa67434f77def7fc3c9dfb29f699fd Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:36:54 2022 +0100 cleanup commit 05fac594eaf79d0058e3c48deee93df603f136c2 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:07:49 2022 +0100 tweak error checking commit 009f32ed39a7280997c3ffab112adadee0b44279 Author: damian <null@damianstewart.com> Date: Thu Dec 15 21:29:47 2022 +0100 unit tests passing for embeddings with vector length >1 commit beb1b08d9a98112ed2fe073580568e1a18698da3 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:39:09 2022 +0100 more explicit equality tests when overwriting commit 44d8a5a7c85cdabc9ce3a54fd0769a10597b3ca9 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:30:13 2022 +0100 wip textual inversion manager (unit tests passing for 1v embedding overwriting) commit 417c2b57d90924a839616bfb66804faab8039e4c Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 12:30:55 2022 +0100 wip textual inversion manager (unit tests passing for base stuff + padding) commit 2e80872e3b6f7fd7d8eb8928822bd824b63cb2ff Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 10:57:57 2022 +0100 wip new TextualInversionManager * stop using WeightedFrozenCLIPEmbedder * store diffusion models locally - configure_invokeai.py reconfigured to store diffusion models rather than CompVis models - hugging face caching model is used, but cache is set to ~/invokeai/models/repo_id - models.yaml does **NOT** use path, just repo_id - "repo_name" changed to "repo_id" to following hugging face conventions - Models are loaded with full precision pending further work. * allow non-local files during development * path takes priority over repo_id * MVP for model_cache and configure_invokeai - Feature complete (almost) - configure_invokeai.py downloads both .ckpt and diffuser models, along with their VAEs. Both types of download are controlled by a unified INITIAL_MODELS.yaml file. - model_cache can load both type of model and switches back and forth in CPU. No memory leaks detected TO DO: 1. I have not yet turned on the LocalOnly flag for diffuser models, so the code will check the Hugging Face repo for updates before using the locally cached models. This will break firewalled systems. I am thinking of putting in a global check for internet connectivity at startup time and setting the LocalOnly flag based on this. It would be good to check updates if there is connectivity. 2. I have not gone completely through INITIAL_MODELS.yaml to check which models are available as diffusers and which are not. So models like PaperCut and VoxelArt may not load properly. The runway and stability models are checked, as well as the Trinart models. 3. Add stanzas for SD 2.0 and 2.1 in INITIAL_MODELS.yaml REMAINING PROBLEMS NOT DIRECTLY RELATED TO MODEL_CACHE: 1. When loading a .ckpt file there are lots of messages like this: Warning! ldm.modules.attention.CrossAttention is no longer being maintained. Please use InvokeAICrossAttention instead. I'm not sure how to address this. 2. The ckpt models ***don't actually run*** due to the lack of special-case support for them in the generator objects. For example, here's the hard crash you get when you run txt2img against the legacy waifu-diffusion-1.3 model: ``` >> An error occurred: Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 140, in main main_loop(gen, opt) File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 371, in main_loop gen.prompt2image( File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1265, in __getattr__ raise AttributeError("'{}' object has no attribute '{}'".format( AttributeError: 'LatentDiffusion' object has no attribute 'image_from_embeddings' ``` 3. The inpainting diffusion model isn't working. Here's the output of "banana sushi" when inpainting-1.5 is loaded: ``` Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 301, in image_from_embeddings result_latents, result_attention_map_saver = self.latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 330, in latents_from_embeddings result: PipelineIntermediateState = infer_latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 185, in __call__ for result in self.generator_method(*args, **kwargs): File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 367, in generate_latents_from_embeddings step_output = self.step(batched_t, latents, guidance_scale, File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context return func(*args, **kwargs) File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 409, in step step_output = self.scheduler.step(noise_pred, timestep, latents, **extra_step_kwargs) File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/diffusers/schedulers/scheduling_lms_discrete.py", line 223, in step pred_original_sample = sample - sigma * model_output RuntimeError: The size of tensor a (9) must match the size of tensor b (4) at non-singleton dimension 1 ``` * proper support for float32/float16 - configure script now correctly detects user's preference for fp16/32 and downloads the correct diffuser version. If fp16 version not available, falls back to fp32 version. - misc code cleanup and simplification in model_cache * add on-the-fly conversion of .ckpt to diffusers models 1. On-the-fly conversion code can be found in the file ldm/invoke/ckpt_to_diffusers.py. 2. A new !optimize command has been added to the CLI. Should be ported to Web GUI. User experience on the CLI is this: ``` invoke> !optimize /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt INFO: Converting legacy weights file /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt to optimized diffuser model. This operation will take 30-60s to complete. Success. Optimized model is now located at /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 Writing new config file entry for sd-v1-4... >> New configuration: sd-v1-4: description: Optimized version of sd-v1-4 format: diffusers path: /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 OK to import [n]? y >> Verifying that new model loads... >> Current VRAM usage: 2.60G >> Offloading stable-diffusion-2.1 to CPU >> Loading diffusers model from /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 | Using faster float16 precision You have disabled the safety checker for <class 'ldm.invoke.generator.diffusers_pipeline.StableDiffusionGeneratorPipeline'> by passing `safety_checker=None`. Ensure that you abide to the conditions of the Stable Diffusion \ license and do not expose unfiltered results in services or applications open to the public. Both the diffusers team and Hugging Face strongly recommend to keep the safety filter enabled in all public facing circumstances,\ disabling it only for use-cases that involve analyzing network behavior or auditing its results. For more information, please have a look at https://github.com/huggingface/diffusers/pull/254 . | training width x height = (512 x 512) >> Model loaded in 3.48s >> Max VRAM used to load the model: 2.17G >> Current VRAM usage:2.17G >> Textual inversions available: >> Setting Sampler to k_lms (LMSDiscreteScheduler) Keep model loaded? [y] ``` * add parallel set of generator files for ckpt legacy generation * generation using legacy ckpt models now working * diffusers: fix missing attention_maps_callback fix for 23eb80b40421b2bb8f4b6d3dd30490d11c447b36 * associate legacy CrossAttention with .ckpt models * enable autoconvert New --autoconvert CLI option will scan a designated directory for new .ckpt files, convert them into diffuser models, and import them into models.yaml. Works like this: invoke.py --autoconvert /path/to/weights/directory In ModelCache added two new methods: autoconvert_weights(config_path, weights_directory_path, models_directory_path) convert_and_import(ckpt_path, diffuser_path) * diffusers: update to diffusers 0.11 (from 0.10.2) * fix vae loading & width/height calculation * refactor: encapsulate these conditioning data into one container * diffusers: fix some noise-scaling issues by pushing the noise-mixing down to the common function * add support for safetensors and accelerate * set local_files_only when internet unreachable * diffusers: fix error-handling path when model repo has no fp16 branch * fix generatorinpaint error Fixes : "ModuleNotFoundError: No module named 'ldm.invoke.generatorinpaint' https://github.com/invoke-ai/InvokeAI/pull/1583#issuecomment-1363634318 * quench diffuser safety-checker warning * diffusers: support stochastic DDIM eta parameter * fix conda env creation on macos * fix cross-attention with diffusers 0.11 * diffusers: the VAE needs to be tiling as well as the U-Net * diffusers: comment on subfolders * diffusers: embiggen! * diffusers: make model_cache.list_models serializable * diffusers(inpaint): restore scaling functionality * fix requirements clash between numba and numpy 1.24 * diffusers: allow inpainting model to do non-inpainting tasks * start expanding model_cache functionality * add import_ckpt_model() and import_diffuser_model() methods to model_manager - in addition, model_cache.py is now renamed to model_manager.py * allow "recommended" flag to be optional in INITIAL_MODELS.yaml * configure_invokeai now downloads VAE diffusers in advance * rename ModelCache to ModelManager * remove support for `repo_name` in models.yaml * check for and refuse to load embeddings trained on incompatible models * models.yaml.example: s/repo_name/repo_id and remove extra INITIAL_MODELS now that the main one has diffusers models in it. * add MVP textual inversion script * refactor(InvokeAIDiffuserComponent): factor out _combine() * InvokeAIDiffuserComponent: implement threshold * InvokeAIDiffuserComponent: diagnostic logs for threshold ...this does not look right * add a curses-based frontend to textual inversion - not quite working yet - requires npyscreen installed - on windows will also have the windows-curses requirement, but not added to requirements yet * add curses-based interface for textual inversion * fix crash in convert_and_import() - This corrects a "local variable referenced before assignment" error in model_manager.convert_and_import() * potential workaround for no 'state_dict' key error - As reported in https://github.com/huggingface/diffusers/issues/1876 * create TI output dir if needed * Update environment-lin-cuda.yml (#2159) Fixing line 42 to be the proper order to define the transformers requirement: ~= instead of =~ * diffusers: update sampler-to-scheduler mapping based on https://github.com/huggingface/diffusers/issues/277#issuecomment-1371428672 * improve user exp for ckt to diffusers conversion - !optimize_models command now operates on an existing ckpt file entry in models.yaml - replaces existing entry, rather than adding a new one - offers to delete the ckpt file after conversion * web: adapt progress callback to deal with old generator or new diffusers pipeline * clean-up model_manager code - add_model() verified to work for .ckpt local paths, .ckpt remote URLs, diffusers local paths, and diffusers repo_ids - convert_and_import() verified to work for local and remove .ckpt files * handle edge cases for import_model() and convert_model() * add support for safetensor .ckpt files * fix name error * code cleanup with pyflake * improve model setting behavior - If the user enters an invalid model name at startup time, will not try to load it, warn, and use default model - CLI UI enhancement: include currently active model in the command line prompt. * update test-invoke-pip.yml - fix model cache path to point to runwayml/stable-diffusion-v1-5 - remove `skip-sd-weights` from configure_invokeai.py args * exclude dev/diffusers from "fail for draft PRs" * disable "fail on PR jobs" * re-add `--skip-sd-weights` since no space * update workflow environments - include `INVOKE_MODEL_RECONFIGURE: '--yes'` * clean up model load failure handling - Allow CLI to run even when no model is defined or loadable. - Inhibit stack trace when model load fails - only show last error - Give user *option* to run configure_invokeai.py when no models successfully load. - Restart invokeai after reconfiguration. * further edge-case handling 1) only one model in models.yaml file, and that model is broken 2) no models in models.yaml 3) models.yaml doesn't exist at all * fix incorrect model status listing - "cached" was not being returned from list_models() - normalize handling of exceptions during model loading: - Passing an invalid model name to generate.set_model() will return a KeyError - All other exceptions are returned as the appropriate Exception * CI: do download weights (if not already cached) * diffusers: fix scheduler loading in offline mode * CI: fix model name (no longer has `diffusers-` prefix) * Update txt2img2img.py (#2256) * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * feat - make model storage compatible with hugging face caching system This commit alters the InvokeAI model directory to be compatible with hugging face, making it easier to share diffusers (and other models) across different programs. - If the HF_HOME environment variable is not set, then models are cached in ~/invokeai/models in a format that is identical to the HuggingFace cache. - If HF_HOME is set, then models are cached wherever HF_HOME points. - To enable sharing with other HuggingFace library clients, set HF_HOME to ~/.cache/huggingface to set the default cache location or to ~/invokeai/models to have huggingface cache inside InvokeAI. * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * fix error "no attribute CkptInpaint" * model_manager.list_models() returns entire model config stanza+status * Initial Draft - Model Manager Diffusers * added hash function to diffusers * implement sha256 hashes on diffusers models * Add Model Manager Support for Diffusers * fix various problems with model manager - in cli import functions, fix not enough values to unpack from _get_name_and_desc() - fix crash when using old-style vae: value with new-style diffuser * rebuild frontend * fix dictconfig-not-serializable issue * fix NoneType' object is not subscriptable crash in model_manager * fix "str has no attribute get" error in model_manager list_models() * Add path and repo_id support for Diffusers Model Manager Also fixes bugs * Fix tooltip IT localization not working * Add Version Number To WebUI * Optimize Model Search * Fix incorrect font on the Model Manager UI * Fix image degradation on merge fixes - [Experimental] This change should effectively fix a couple of things. - Fix image degradation on subsequent merges of the canvas layers. - Fix the slight transparent border that is left behind when filling the bounding box with a color. - Fix the left over line of color when filling a bounding box with color. So far there are no side effects for this. If any, please report. * Add local model filtering for Diffusers / Checkpoints * Go to home on modal close for the Add Modal UI * Styling Fixes * Model Manager Diffusers Localization Update * Add Safe Tensor scanning to Model Manager * Fix model edit form dispatching string values instead of numbers. * Resolve VAE handling / edge cases for supplied repos * defer injecting tokens for textual inversions until they're used for the first time * squash a console warning * implement model migration check * add_model() overwrites previous config rather than merges * fix model config file attribute merging * fix precision handling in textual inversion script * allow ckpt conversion script to work with safetensors .ckpts Applied patch here: https://github.com/huggingface/diffusers/commit/beb932c5d111872c5e45387e7b1b2b3dd0524a47 * fix name "args" is not defined crash in textual_inversion_training * fix a second NameError: name 'args' is not defined crash * fix loading of the safety checker from the global cache dir * add installation step to textual inversion frontend - After a successful training run, the script will copy learned_embeds.bin to a subfolder of the embeddings directory. - User given the option to delete the logs and intermediate checkpoints (which together use 7-8G of space) - If textual inversion training fails, reports the error gracefully. * don't crash out on incompatible embeddings - put try: blocks around places where the system tries to load an embedding which is incompatible with the currently loaded model * add support for checkpoint resuming * textual inversion preferences are saved and restored between sessions - Preferences are stored in a file named text-inversion-training/preferences.conf - Currently the resume-from-checkpoint option is not working correctly. Possible bug in textual_inversion_training.py? * copy learned_embeddings.bin into right location * add front end for diffusers model merging - Front end doesn't do anything yet!!!! - Made change to model name parsing in CLI to support ability to have merged models with the "+" character in their names. * improve inpainting experience - recommend ckpt version of inpainting-1.5 to user - fix get_noise() bug in ckpt version of omnibus.py * update environment*yml * tweak instructions to install HuggingFace token * bump version number * enhance update scripts - update scripts will now fetch new INITIAL_MODELS.yaml so that configure_invokeai.py will know about the diffusers versions. * enhance invoke.sh/invoke.bat launchers - added configure_invokeai.py to menu - menu defaults to browser-based invoke * remove conda workflow (#2321) * fix `token_ids has shape torch.Size([79]) - expected [77]` * update CHANGELOG.md with 2.3.* info - Add information on how formats have changed and the upgrade process. - Add short bug list. Co-authored-by: Damian Stewart <d@damianstewart.com> Co-authored-by: Damian Stewart <null@damianstewart.com> Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> Co-authored-by: Wybartel-luxmc <37852506+Wybartel-luxmc@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> Co-authored-by: mickr777 <115216705+mickr777@users.noreply.github.com> Co-authored-by: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Co-authored-by: Eugene Brodsky <ebr@users.noreply.github.com> Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com>
2023-01-15 14:22:46 +00:00
'>> Max VRAM used since script start: ',
Refactoring simplet2i (#387) * start refactoring -not yet functional * first phase of refactor done - not sure weighted prompts working * Second phase of refactoring. Everything mostly working. * The refactoring has moved all the hard-core inference work into ldm.dream.generator.*, where there are submodules for txt2img and img2img. inpaint will go in there as well. * Some additional refactoring will be done soon, but relatively minor work. * fix -save_orig flag to actually work * add @neonsecret attention.py memory optimization * remove unneeded imports * move token logging into conditioning.py * add placeholder version of inpaint; porting in progress * fix crash in img2img * inpainting working; not tested on variations * fix crashes in img2img * ported attention.py memory optimization #117 from basujindal branch * added @torch_no_grad() decorators to img2img, txt2img, inpaint closures * Final commit prior to PR against development * fixup crash when generating intermediate images in web UI * rename ldm.simplet2i to ldm.generate * add backward-compatibility simplet2i shell with deprecation warning * add back in mps exception, addresses @vargol comment in #354 * replaced Conditioning class with exported functions * fix wrong type of with_variations attribute during intialization * changed "image_iterator()" to "get_make_image()" * raise NotImplementedError for calling get_make_image() in parent class * Update ldm/generate.py better error message Co-authored-by: Kevin Gibbons <bakkot@gmail.com> * minor stylistic fixes and assertion checks from code review * moved get_noise() method into img2img class * break get_noise() into two methods, one for txt2img and the other for img2img * inpainting works on non-square images now * make get_noise() an abstract method in base class * much improved inpainting Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
2022-09-06 00:40:10 +00:00
'%4.2fG' % (self.session_peakmem / 1e9),
)
return results
# this needs to be generalized to all sorts of postprocessors, which should be wrapped
# in a nice harmonized call signature. For now we have a bunch of if/elses!
def apply_postprocessor(
self,
image_path,
tool = 'gfpgan', # one of 'upscale', 'gfpgan', 'codeformer', 'outpaint', or 'embiggen'
2022-10-13 13:14:21 +00:00
facetool_strength = 0.0,
codeformer_fidelity = 0.75,
upscale = None,
out_direction = None,
2022-10-03 18:39:58 +00:00
outcrop = [],
save_original = True, # to get new name
callback = None,
opt = None,
):
# retrieve the seed from the image;
seed = None
prompt = None
merge release-candidate-1-3-2 into main. Squashed commit of the following: commit 9a1fe8e7fbbd81d9e9e47c4fda6bde6f66fba30c Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 12 17:07:40 2022 +0000 swap in release URLs for installers commit ff56f5251ba8502833cb561317e82b028cd2da5d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 12 17:03:21 2022 +0000 fix up bad unicode chars in invoke.py commit ed943bd6c785d968d1e31fbbb814fea8688fc8bb Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 12 16:05:45 2022 +0000 outcrop improvements, hand-added commit 7ad2355b1da53861bb75312edead8f9db0b0f44d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 12 15:14:33 2022 +0000 documentation fixes commit 66c920fc197d9206be9e0e2d1eb2a1cb86362887 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 16:49:25 2022 -0500 Revert "Resize hires as an image" This reverts commit d05b1b3544dfa7b3c071ac05b4f014a52e08fa50. commit 3fc5cb09f8bc03ea96e67a3e49fb087019d2f9d5 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 12 12:43:17 2022 +0000 fix incorrect link in install commit 1345ec77ab58f70e1bf5a0f587ca40aba4e906b7 Author: tildebyte <337875+tildebyte@users.noreply.github.com> Date: Sun Nov 6 19:07:31 2022 -0500 toil(repo): add tildebyte as owner of installer/ directory commit b116715490f390a59e5bee1022a6a758aee0918d Author: Kyle Schouviller <kyle0654@hotmail.com> Date: Thu Nov 10 21:43:56 2022 -0800 Fix performance issue introduced by torch cuda cache clear during generation commit fa3670270e7aae6bfd8d47fb7bdd32b707310c23 Author: mauwii <Mauwii@outlook.de> Date: Fri Nov 11 12:42:03 2022 +0100 small update to dockers huggingface section commit c304250ef663b3e202b4da8332365288589d94c7 Author: mauwii <Mauwii@outlook.de> Date: Fri Nov 11 12:19:27 2022 +0100 fix format and Link in INSTALL_INVOKE.md commit 802ce5dde5ca68f24aa4609cdba428044e0c7fa1 Author: mauwii <Mauwii@outlook.de> Date: Fri Nov 11 11:17:49 2022 +0100 small fixex to format and a link in INSTALL_MANUAL commit 311ee320ecac892cb4a1bcd012374fa051b1d011 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 07:23:35 2022 +0000 ignore installer intermediate files commit e9df17b374df58a44d3ae3ba33cbdc58794bcf5d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 07:19:25 2022 +0000 fix backslash-related syntax error commit 061fb4ef00482bdd4fba635aeaeff4ca7510190d Merge: 52be0d23 4095acd1 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 06:50:04 2022 +0000 Merge branch 'release-candidate-2-1-3' of github.com:/invoke-ai/InvokeAI into release-candidate-2-1-3 commit 52be0d2396de2de02030855c92e3367008b50377 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 06:49:45 2022 +0000 add WindowsLongFileName batfile to source installer commit 4095acd10ebae05a8cb14cc2faf7c79936d9e6a9 Author: mauwii <Mauwii@outlook.de> Date: Fri Nov 11 07:05:17 2022 +0100 Doc Updates A lot of re-formating of new Installation Docs also some content updates/corrections commit 201eb22d7650b00f55249c2646fa4f47ac3e0ec2 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 04:41:02 2022 +0000 prevent two models from being marked default in models.yaml commit 17ab98220034dfbb798a9a0460bc2837f0c1e2cb Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 03:56:54 2022 +0000 installers download branch HEAD not tag commit a04965b0e9e9d1170cf284af9acbd1186d681255 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 03:48:21 2022 +0000 improve messaging during installation process commit 0b529f0c574dd91fb9593e924ebc41c8c219b6ce Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 15:22:32 2022 +0000 enable outcropping of random JPG/PNG images - Works best with runwayML inpainting model - Numerous code changes required to propagate seed to final metadata. Original code predicated on the image being generated within InvokeAI. commit 6f9f84834557eb3c48562dc5d0ace51ca9e9cca2 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 17:27:42 2022 +0000 enhance outcropping with ability to direct contents of new regions - When outcropping an image you can now add a `--new_prompt` option, to specify a new prompt to be used instead of the original one used to generate the image. - Similarly you can provide a new seed using `--seed` (or `-S`). A seed of zero will pick one randomly. - This PR also fixes the crash that happened when trying to outcrop an image that does not contain InvokeAI metadata. commit 918c1589ef30595668899f4259ece6a4ad605c69 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 20:16:47 2022 +0000 fix #1402 commit 116415b3fcec8415f8e6de9b23c0bbd0dbc6845b Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 21:27:25 2022 +0000 fix invoke.py crash if no models.yaml file present - Script will now offer the user the ability to create a minimal models.yaml and then gracefully exit. - Closes #1420 commit b4b6eabaac94896e38123be331c44d1b63065b0d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 16:49:25 2022 -0500 Revert "Log strength with hires" This reverts commit 82d4904c07670d514e9a541de7c9ecd8489eeae2. commit 4ef1f4a854717c953f9192454d0adabef32af36c Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 20:01:49 2022 +0000 remove temporary directory from repo commit 510fc4ebaa5f9dc0e77b47cf04e0c265423e0a44 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 19:59:03 2022 +0000 remove -e from clipseg load in installer commit a20914434bb3609cf1d883cabf048d4cc25f881a Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 19:37:07 2022 +0000 change clipseg repo branch to avoid clipseg not found error commit 0d134195fda5c69fce5a95d6da90248eba8d226d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 18:39:29 2022 +0000 update repo URL to point to rc commit 649d8c8573896fdb5a73453b69ee4b54cf4d6241 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 18:13:28 2022 +0000 integrate tildebyte installer commit a358d370a05ea985a9e26fa9c1101d9c14fdb3ab Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 17:48:14 2022 +0000 add @tildebyte compiled pip installer commit 94a9033c4f6214e604be149a3de6d7c747af7f3a Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 14:52:00 2022 +0000 ignore source installer zip files commit 18a947c503c83c95cd83f27424696219ff3c4c95 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 14:46:36 2022 +0000 documentation and environment file fixes - Have clarified the relationship between the @tildebyte and @cmdr2 installers; However, @tildebyte installer merge is still a WIP due to conflicts over such things as `invoke.sh`. - Rechristened 1click installer as "source" installer. @tildebyte installer will be "the" installer. (We'll see which one generates the least support requests and maintenance work.) - Sync'd `environment-mac.yml` with `development`. The former was failing with a taming-transformers error as per https://discord.com/channels/@me/1037201214154231899/1040060947378749460 commit a23b03189526a49da8ddae90ce71b0e902784d29 Author: Mike DiGiovanni <vinblau@gmail.com> Date: Wed Nov 9 16:44:59 2022 -0500 Fixes typos in README.md commit 23af68c7d79d947f1bd3441c91bb44d655238f01 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 07:02:27 2022 -0500 downgrade win installs to basicsr==1.4.1 commit e258beeb51f3e645b9ea60e52d69d18722221cc5 Merge: 7460c069 e481bfac Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 06:37:45 2022 -0500 Merge branch 'release-candidate-2-1-3' of github.com:invoke-ai/InvokeAI into release-candidate-2-1-3 commit 7460c069b880b10c84b55f2e0c0998e350d6cf12 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 06:36:48 2022 -0500 remove --prefer-binary from requirements-base.txt It appears that some versions of pip do not recognize this option when it appears in the requirements file. Did not explore this further but recommend --prefer-binary in the manual install instructions on the command line. commit e481bfac615e0c798ceb5e59e8fbe3038f85b431 Merge: 5040747c d1ab65a4 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 11:21:56 2022 +0000 Merge branch 'release-candidate-2-1-3' of github.com:/invoke-ai/InvokeAI into release-candidate-2-1-3 commit 5040747c6700c9b949e3f3e1d2c3f21daffcec6c Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 11:21:43 2022 +0000 fix windows install instructions & bat file commit d1ab65a43122f73c20533d5815590ec10bc05eca Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 07:18:59 2022 +0100 update WEBUIHOTKEYS.md commit af4ee7feb8a7d2528bf4e2b3f7deee7a7c4c3dec Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 06:33:49 2022 +0100 update INSTALL_DOCKER.md commit 764fb29aded8114984d05932c4266ea24614b932 Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 06:30:15 2022 +0100 fix formatting in INSTALL.md commit 1014d3ba44aa4cd4cfdc6e3650c24a0dc9568a6e Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 06:29:14 2022 +0100 fix build.sh invokeai_conda_env_file default value commit 40a48aca88e337e9f4475f80a03b7d6d4751d09b Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 05:25:30 2022 +0100 fix environment-mac.yml moved taming-transformers-rom1504 to pip dependencies commit 92abc00f16a34a586dd16d3c64408f00e23fcb53 Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 05:19:52 2022 +0100 fix test-invoke-conda - copy required conda environment yaml - use environment.yml - I use cp instead of ln since would be compatible for windows runners commit a5719aabf89c8c5f29c6044e2882ccdcd0c6916b Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 04:14:35 2022 +0100 update Dockerfile - link environment.yml from new environemnts path - change default conda_env_file - quote all variables to avoid splitting - also remove paths from conda-env-files in build-container.yml commit 44a18511fa7accfec6a20345774583a1ce745b02 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 20:51:06 2022 +0000 update paths in container build workflow commit b850dbadafba052310327ca759d96f49a9d25d03 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 20:16:57 2022 +0000 finished reorganization of install docs commit 9ef8b944d53afb1fed94c418b2fd936d2d743797 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 18:50:58 2022 +0000 tweaks to manual install documentation --prefer-binary is an iffy option in the requirements file. It isn't supported by some versions of pip, so I removed it from requirements-base.txt and inserted it into the manual install instructions where it seems to do what it is supposed to. commit efc5a9848803b4250d726bc1913b9fd5a33fad75 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 18:20:03 2022 +0000 manual installation documentation tested on Linux commit 1417c87928e13b0ed21bf1c5604f8636d3b50a8d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 17:37:06 2022 +0000 change name of requirements.txt to avoid confusion commit 2dd6fc2b93ff7bbb4038568a3b28d36a8fafaeb8 Merge: 22213612 71ee44a8 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 17:26:24 2022 +0000 Merge branch 'release-candidate-2-1-3' of github.com:/invoke-ai/InvokeAI into release-candidate-2-1-3 commit 22213612a08bbece46eafd48994f985b097cb141 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 17:25:59 2022 +0000 directory cleanup; working on install docs commit 71ee44a827898759fd457f774c0b2ac7a1ef6519 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 02:07:13 2022 +0000 prevent crash when switching to an invalid model commit b17ca0a5e731c142101bbdbf34d121df949e86d7 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 14:28:38 2022 +0100 don't suppress exceptions when doing cross-attention control commit 71bbfe4a1a5b70f90e5f41c94df50fb104dbdd79 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 12:59:34 2022 +0100 Fix #1362 by improving VRAM usage patterns when doing .swap() commit ef3f7a26e242b73c2beb0195c7fd8f654ef47f55 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 12:18:37 2022 +0100 remove log spam commit 7189d649622d4668b120b0dd278388ad672142c4 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 12:10:28 2022 +0100 change the way saved slicing strategy is applied commit 01c40f751ab72955140165c16f95ae411732265b Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 12:04:43 2022 +0100 fix slicing_strategy_getter callsite commit f8cfe25150a346958903316bc710737d99839923 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 11:56:22 2022 +0100 cleanup, consistent dim=0 also tested commit 5bf9b1e890d48e962afd4a668a219b68271e5dc1 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 11:34:09 2022 +0100 refactored context, tested with non-sliced cross attention control commit d58a46e39bf562e7459290d2444256e8c08ad0b6 Author: damian0815 <null@damianstewart.com> Date: Sun Nov 6 00:41:52 2022 +0100 cleanup commit 7e2c658b4c06fe239311b65b9bb16fa3adec7fd7 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:57:31 2022 +0100 disable logs commit 20ee89d93841b070738b3d8a4385c93b097d92eb Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:36:58 2022 +0100 slice saved attention if necessary commit 0a7684a22c880ec0f48cc22bfed4526358f71546 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:32:38 2022 +0100 raise instead of asserting commit 7083104c7f3a0d8fd96e94a2f391de50a3c942e4 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:31:00 2022 +0100 store dim when saving slices commit f7c0808ed383ec1dc70645288a798ed2aa4fa85c Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:27:16 2022 +0100 don't retry on exception commit 749a721e939b3fe7c1741e7998dab6bd2c85a0cb Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:24:50 2022 +0100 stuff commit 032ab90e9533be8726301ec91b97137e2aadef9a Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:20:17 2022 +0100 more logging commit 3dc34b387f033482305360e605809d95a40bf6f8 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:16:47 2022 +0100 logs commit 901c4c1aa4b9bcef695a6551867ec8149e6e6a93 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:12:39 2022 +0100 actually set save_slicing_strategy to True commit f780e0a0a7c6b6a3db320891064da82589358c8a Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:10:35 2022 +0100 store slicing strategy commit 93bb6d566fd18c5c69ef7dacc8f74ba2cf671cb7 Author: damian <git@damianstewart.com> Date: Sat Nov 5 20:43:48 2022 +0100 still not it commit 5e3a9541f8ae00bde524046963910323e20c40b7 Author: damian <git@damianstewart.com> Date: Sat Nov 5 17:20:02 2022 +0100 wip offloading attention slices on-demand commit 4c2966aa856b6f3b446216da3619ae931552ef08 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 15:47:40 2022 +0100 pre-emptive offloading, idk if it works commit 572576755e9f0a878d38e8173e485126c0efbefb Author: root <you@example.com> Date: Sat Nov 5 11:25:32 2022 +0000 push attention slices to cpu. slow but saves memory. commit b57c83a68f2ac03976ebc89ce2ff03812d6d185f Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 12:04:22 2022 +0100 verbose logging commit 3a5dae116f110a96585d9eb71d713b5ed2bc3d2b Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 11:50:48 2022 +0100 wip fixing mem strategy crash (4 test on runpod) commit 3cf237db5fae0c7b0b4cc3c47c81830bdb2ae7de Author: damian0815 <null@damianstewart.com> Date: Fri Nov 4 09:02:40 2022 +0100 wip, only works on cuda commit 5702271991e126c026aa1ff41c44f8ad37b26e3a Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 14:09:36 2022 +0000 speculative reorganization of the requirements & environment files - This is only a test! - The various environment*.yml and requirements*.txt files have all been moved into a directory named "environments-and-requirements". - The idea is to clean up our root directory so that the github home page is tidy. - The manual install instructions will start with the instructions to create a symbolic link from environment.yml to the appropriate file for OS and GPU. - The 1-click installers have been updated to accommodate this change. commit 10781e7dc4f4551583a110d14f2a1f60393112b8 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 01:59:45 2022 +0000 refactoring requirements commit 099d1157c579c7b9fea20945e8504cc15745c598 Author: mauwii <Mauwii@outlook.de> Date: Wed Nov 9 00:16:18 2022 +0100 better way to make sure if conda is useable commit ab825bf7ee5f0b82d2273da1cda64fc9266a978e Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 22:05:33 2022 +0000 add back --prefer-binaries to requirements commit 10cfeb5ada7bcfc9f3aff3716ab8ea4961a8b528 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 8 22:27:19 2022 +0100 add quotes to set and use `$environment_file` commit e97515d0453583e013674b4dd1f3739c7de402cc Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 8 22:24:21 2022 +0100 set environment file for conda update commit 0f04bc5789c712bf7c7319b1d93064914993f4ec Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 8 22:21:25 2022 +0100 use conda env update commit 3f74aabecd08ed25fac158463ae12b775bd1fca2 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 8 22:20:44 2022 +0100 use command instead of hash commit b1a99a51b7ca23c4b895855bd7b4c82dbdc431e4 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 14:44:44 2022 -0500 remove --global git config from 1-click installers commit 8004f8a6d99f6ff75e00c170da40f1dec93a8914 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Mon Nov 7 09:07:20 2022 -0500 Revert "Use array slicing to calc ddim timesteps" This reverts commit 1f0c5b4cf196716c21f2db74f92c8750ad8f889d. commit ff8ff2212afb1e1c2dce4f6a61f29e2bc8302eb5 Merge: 8e5363cd 636620b1 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 14:01:40 2022 +0000 add initfile support from PR #1386 commit 8e5363cd83bff0e6be0f002c644283955f7fcbfd Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 13:26:18 2022 +0000 move 'installer/' to '1-click-installer' to make room for tildebyte installer commit 1450779146e89510d12b8c90eb316d9861c3375e Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 12:56:36 2022 +0000 update branch for installer to pull against commit 8cd5d95b8a1cb213cce2f949c394c841a09d9cab Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 05:30:20 2022 +0000 move all models into subdirectories of ./models - this required an update to the invoke-ai fork of gfpgan - simultaneously reverted consolidation of environment and requirements files, as their presence in a directory triggered setup.py to try to install a sub-package. commit abd6407394d55d4f6c064a05f3ac989dd3817c59 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 03:52:46 2022 +0000 leave a copy of environment-cuda.yml at top level - named it environment.yml - need to avoid a big change for users and breaking older support instructions. commit 734dacfbe9d8c86ca943c6541e7b5ff5ef787ff4 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 03:50:07 2022 +0000 consolidate environment files - starting to remove unneeded entries and pins - no longer require -e in front of github dependencies - update setup.py with release number - update manual installation instructions commit 636620b1d5e2466613d0dcc2a604522be12fa3a4 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 03:26:16 2022 +0000 change initfile to ~/.invokeai - adjust documentation - also fix 'clipseg_models' to 'clipseg', which seems to be working now commit 1fe41146f0975bbc9d552208473490a9ccb9fc56 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 5 14:28:01 2022 -0400 add support for an initialization file, invokeai.init - Place preferred startup command switches in a file named "invokeai.init". The file can consist of a single line of switches such as "--web --steps=28", a series of switches on each line, or any combination of the two. Example: ``` --web --host=0.0.0.0 --steps=28 --grid -f 0.6 -C 11.0 -A k_euler_a ``` - The following options, which were previously only available within the CLI, are now available on the command line as well: --steps --strength --cfg_scale --width --height --fit commit 2ad6ef355a9b9c4b17bae71edea2346c2e8708c5 Merge: 865502ee 8b47c829 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sun Nov 6 18:08:36 2022 +0000 update discord link commit 865502ee4f681de4516d231370ae603983354d8f Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 18:00:16 2022 +0100 update changelog commit c7984f3299c5c8f56a70d80907d527af458674af Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 17:07:27 2022 +0100 update TROUBLESHOOT.md commit 7f150ed83302ba875c3e0c0f39d8ac0f32c6e362 Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 16:56:58 2022 +0100 remove `:`from headlines in CONTRIBUTORS.md commit badf4e256ce6e3201df1a9a87a7072b36b18d699 Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 16:56:37 2022 +0100 enable navigation tabs Since the docs are growing, this way they look cleaner commit e64c60bbb38fc1620e08ce52bf28bd17003c7ef6 Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 16:18:59 2022 +0100 remove preflight checks from assets seems like somebody executed tests and commited them commit 178061854300632b024810e65922b54b64d95939 Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 16:15:06 2022 +0100 update INSTALLING_MODELS.md commit f91fd276242a0c92b301e99d02982d30f7b712c3 Author: Kyle Schouviller <kyle0654@hotmail.com> Date: Sat Nov 5 14:47:53 2022 -0700 Bug fix for inpaint size commit 09e41e8f769457b9ffd56901aae13991cdc6eeb8 Author: Kyle Schouviller <kyle0654@hotmail.com> Date: Sat Nov 5 14:34:52 2022 -0700 Add inpaint size options to inpaint at a larger size than the actual inpaint image, then scale back down for recombination commit 6eeb2107b300fc27cfe6134b43e5570c246b8e96 Author: mauwii <Mauwii@outlook.de> Date: Sat Nov 5 21:01:14 2022 +0100 remove create-caches.yml since not used anywhere commit 17053ad8b7efecb21a9b4eb32695089f683f72e3 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 5 16:01:55 2022 -0400 fix duplicated argument introduced by conflict resolution commit fefb4dc1f88bc6551a39602a2bc79b278cd83c59 Merge: 762ca60a d05b1b35 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 5 12:47:35 2022 -0700 Merge branch 'development' into fix_generate.py commit d05b1b3544dfa7b3c071ac05b4f014a52e08fa50 Author: Craig <cwallen@users.noreply.github.com> Date: Sat Oct 29 20:40:30 2022 -0400 Resize hires as an image commit 82d4904c07670d514e9a541de7c9ecd8489eeae2 Author: Craig <cwallen@users.noreply.github.com> Date: Sat Oct 29 20:37:40 2022 -0400 Log strength with hires commit 1cdcf33cfa39e90f9660fabf8f5936dcfb6c3aa5 Merge: 6616fa83 cbc029c6 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 5 09:57:38 2022 -0400 Merge branch 'main' into development - this synchronizes recent document fixes by mauwii commit 6616fa835ac4318bf53419f2b54b88c962559578 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 4 00:47:03 2022 -0400 fix Windows library dependency issues This commit addresses two bugs: 1) invokeai.py crashes immediately with a message about an undefined attritube sigKILL (closes #1288). The fix is to pin torch at 1.12.1. 2) Version 1.4.2 of basicsr fails to load properly on Windows, and is a requirement of realesrgan, however 1.4.1 works. Pinning basicsr in our requirements file resulted in a dependency conflict, so I ended up cloning realesrgan into the invoke-ai Git space and changing the requirements file there. If there is a more elegant solution, please advise. commit 7b9a4564b11f4181b9b3c06ecda2a4a25fd1849e Author: Matthias Wild <40327258+mauwii@users.noreply.github.com> Date: Sat Nov 5 14:36:45 2022 +0100 Update-docs (#1382) * update IMG2IMG.md * update INPAINTING.md * update WEBUIHOTKEYS.md * more doc updates (mostly fix formatting): - OUTPAINTING.md - POSTPROCESS.md - PROMPTS.md - VARIATIONS.md - WEB.md - WEBUIHOTKEYS.md commit fcdefa0620761472718afa14b2955a5d0603cfcc Author: Matthias Wild <40327258+mauwii@users.noreply.github.com> Date: Fri Nov 4 20:47:31 2022 +0100 Hotifx docs (#1376) (#1377) commit ef8b3ce639954259a95a38f44fa5329687bee781 Merge: b7042095 36870a8f Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 4 12:08:44 2022 -0400 Merge-main-into-development (#1373) To get the rid of the difference between main and development. Since otherwise it will be a pain to start fixing the documentatino (when the state between main and development is not the same ...) Also this should fix the problem of all tests failing since environment yamls get updated. commit 36870a8f53217d4b733e9bb8b119190b5e36da59 Merge: 6b89adfa b7042095 Author: Matthias Wild <40327258+mauwii@users.noreply.github.com> Date: Fri Nov 4 16:25:00 2022 +0100 Merge branch 'development' into merge-main-into-development commit b70420951d5b70937c0c07e4f8a552a01c3008bc Author: damian0815 <null@damianstewart.com> Date: Thu Nov 3 12:39:45 2022 +0100 fix parsing error doing eg `forest ().swap(in winter)` commit 1f0c5b4cf196716c21f2db74f92c8750ad8f889d Author: wfng92 <43742196+wfng92@users.noreply.github.com> Date: Thu Nov 3 17:13:52 2022 +0800 Use array slicing to calc ddim timesteps commit 8648da811190fc8bcf237d83aff38cf605851300 Author: mauwii <Mauwii@outlook.de> Date: Fri Nov 4 00:06:19 2022 +0100 update environment-linux-aarch64 to use python 3.9 commit 45b459356399f8cfb7e9af571c1643fab04218fe Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 3 22:31:46 2022 +0100 update environment-linux-aarch64.yml - move getpass_asterisk to pip commit 41b04316cf5118ea9518dc77934d135a489dd684 Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 3 20:40:08 2022 +0100 rename job, remove debug branch from triggers commit e97c6db2a3c0157a8a5ab74cd28ebee480a2d078 Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 3 20:34:01 2022 +0100 include build matrix to build x86_64 and aarch64 commit 896820a349292b0e14bbc32f0c557fe8a6b45395 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 05:01:15 2022 +0100 disable caching commit 06c8f468bff7e1dfecc1a1990164be1005b114a7 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 04:26:39 2022 +0100 disable PR-Validation since there are no files passed from context this is unecesarry commit 61920e2701c4a9cea94c03ab933c4482458215b7 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 04:09:39 2022 +0100 update action to use current branch also update build-args of dockerfile and build.sh commit f34ba7ca70f1c417ee97e8b0c57abff57614d78f Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 02:30:24 2022 +0100 remove unecesarry mkdir command again commit c30ef0895dbf0565345ac6ccb136d98a174470a6 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 01:51:12 2022 +0100 remove symlink to GFPGANv1.4 also re-add mkdir to prevent action from failing commit aa3a774f73d5004571ea42fea14cd2b525fffb1c Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 01:48:59 2022 +0100 update build-container.yml to use cachev3 commit 2c30555b844293764123baa4137fcf952d40a4e7 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 01:34:20 2022 +0100 update Dockerfile - create models.yaml from models.yaml.example - run preload_models.py with --no-interactive commit 743f60577364d43237eeb46aefd523371c36e56b Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 01:21:15 2022 +0100 update build.sh to download sd-v1.5 model commit 519c661abbae83aa62b3ee536635c39192890441 Author: mauwii <Mauwii@outlook.de> Date: Tue Oct 25 01:26:50 2022 +0200 replace old fashined markdown templates with forms this will help the readability of issues a lot 🤓 commit 22c956c75f4797ddc2dffa944e3ea84b4eb3477c Merge: 13696adc 0196571a Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 3 10:20:21 2022 -0400 Merge branch 'development' of github.com:invoke-ai/InvokeAI into development commit 13696adc3a3a2b169e68048a5b511660d0430fae Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 3 10:20:10 2022 -0400 speculative change to solve windows esrgan issues commit 0196571a12992eb8207d36e022721fe3ad2cfd19 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 2 22:39:35 2022 -0400 remove merge markers from preload_models.py commit 9666f466ab1c710dfda2e59be9e8a26fcd7e8718 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 2 18:29:34 2022 -0400 use refined model by default commit 240e5486c89552ef480c3443a63283fb86a493c3 Merge: 8164b6b9 aa247e68 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 2 18:35:00 2022 -0400 Merge branch 'spezialspezial-patch-9' into development commit 8164b6b9cff077e4131384195af65e30a40733a7 Merge: 4fc82d55 dd5a88dc Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 2 17:06:46 2022 -0400 Merge branch 'development' of github.com:invoke-ai/InvokeAI into development commit 4fc82d554ff573780c0af562a6bc9586aa56012d Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 04:17:28 2022 +1300 [WebUI] Final 2.1 Release Build commit 96b34c0f85f6ed52707fe43456d20b81822c7d1d Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 09:08:11 2022 +0100 Final WebUI build for Release 2.1 - squashed commit of 52 commits from PR #1327 don't log base64 progress images Fresh Build For WebUI [WebUI] Loopback Default False Fixes bugs/styling - Fixes missing web app state on new version: Adds stateReconciler to redux-persist. When we add more values to the state and then release the update app, they will be automatically merged in. Reseting web UI will be needed far less. 7159ec - Fixes console z-index - Moves reset web UI button to visible area Decreases gallery width on inpainting Increases workarea split padding to 1rem Adds missing tooltips to site header Changes inpainting controls settings to hover Fixes hotkeys and settings buttons not working Improves bounding box interactions - Bounding box can now be moved by dragging any of its edges - Bounding box does not affect drawing if already drawing a stroke - Can lock bounding box to draw directly on the bounding box edges - Removes spacebar-hold behaviour due to technical issues Fixes silent crash when init image too large To send the mask to the server, the UI rendered the mask onto the init image and sent the whole image. The mask was then cropped by the server. If the image was too large, the app silently failed. Maybe it exceeds the websocket size limit. Fixed by cropping the mask in the UI layer, sending only bounding-box-sized mask image data. Disabled bounding box settings when locked Styles image uploader Builds fresh bundle Improves bounding box interaction Added spacebar-hold-to-transform back. Address bounding box feedback - Adds back toggle to hide bounding box - Box quick toggle = q, normal toggle = shift + q - Styles canvas alert icons Adds hints when unable to invoke - Popover on Invoke button indicates why exactly it is disabled, e.g. prompt is empty, something else is processing, etc. - There may be more than one reason; all are displayed. Fix Inpainting Alerts Styling Preventing unnecessary re-renders across the app Code Split Inpaint Options Isolate features to their own components so they dont re-render the other stuff each time. [TESTING] Remove global isReady checking I dont believe this is need at all because the isready state is constantly updated when needed and tracked real time in the Redux store. This causes massive re-renders. @psychedelicious If this is absolutely essential for a reason that I do not see, please hit me up on Discord. Fresh Bundle Fix Bounding Box Settings re-rendering on brush stroke [Code Splitting] Bounding Box Options Isolated all bounding box components to trigger unnecessary re-renders. Still need to fix bounding box triggering re-renders on the control panel inside the canvas itself. But the options panel should be a good to go with this change. Inpainting Controls Code Spitting and Performance Codesplit the entirety of the inpainting controls. Created new selectors for each and every component to ensure there are no unnecessary re-renders. App feels a lot smoother. Fixes rerenders on ClearBrushHistory Fixes crash when requesting post-generation upscale/face restoration - Moves the inpainting paste to before the postprocessing. Removes unused isReady state Changes Report Bug icon to a bug Restores shift+q bounding box shortcut Adds alert for bounding box size to status icons Adds asCheckbox to IAIIconButton Rough draft of this. Not happy with the styling but it's clearer than having them look just like buttons. Fixes crash related to old value of progress_latents in state Styling changes and settings modal minor refactor Fixes: uploaded JPG images not loading Reworks CurrentImageButtons.tsx - Change all icons to FA iconset for consistency - Refactors IAIIconButton, IAIButton, IAIPopover to handle ref forwarding - Redesigns buttons into group Only generate 1 iteration when seed fixed & variations disabled Fixes progress images select Fixes edge case: upload over gets stuck while alt tabbing - Press esc to close it now Fixes display progress images select typing Fixes current image button rerenders Adds min width to ImageUploader Makes fast-latents in progress default Update Icon Button Checkbox Style Styling Fixes next/prev image buttons Refactor canvas buttons + more Add Save Intermediates Step Count For accurate mode only. Co-Authored-By: Richard Macarthy <richardmacarthy@protonmail.com> Restores "initial image" text Address feedback - moves mask clear button - fixes intermediates - shrinks inpainting icons by 10% Fix Loopback Styling Adds escape hotkey to close floating panels Readd Hotkey for Dual Display Updated Current Image Button Styling commit dd5a88dceeec53ceb1722a62e3689ae3dd871154 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 04:17:28 2022 +1300 [WebUI] Final 2.1 Release Build commit 95ed56bf82825a47cfe406fa34eaf4e32c129143 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 04:16:31 2022 +1300 Updated Current Image Button Styling commit 1ae80f5ab9d00a25e0c3a21e2eccd318c5343401 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 04:07:57 2022 +1300 Readd Hotkey for Dual Display commit 1f0bd3ca6cda4221d1a7a46325f235cd23bd0af9 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu Nov 3 02:07:00 2022 +1100 Adds escape hotkey to close floating panels commit a1971f6830306b3d748f7f36c2243f6dee682f97 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 03:38:15 2022 +1300 Fix Loopback Styling commit c6118e889895ba35a191124ce1beb5d2b719366d Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu Nov 3 01:29:51 2022 +1100 Address feedback - moves mask clear button - fixes intermediates - shrinks inpainting icons by 10% commit 7ba958cf7ff4e804a127b71c88666084f81e7340 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu Nov 3 01:10:38 2022 +1100 Restores "initial image" text commit 383905d5d24359aa1824de96ff124a8f8a87e015 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 02:59:11 2022 +1300 Add Save Intermediates Step Count For accurate mode only. Co-Authored-By: Richard Macarthy <richardmacarthy@protonmail.com> commit 6173e3e9cabd5e74fb466d55d7bb6a80a77b3fa8 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu Nov 3 00:53:53 2022 +1100 Refactor canvas buttons + more commit 3feb7d8922b0e4c9f944e96b95211003f40d9705 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu Nov 3 00:49:23 2022 +1100 Fixes next/prev image buttons commit 1d9edbd0ddd6e10cf120fe0de3db0b56ae374db4 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 00:50:44 2022 +1300 Update Icon Button Checkbox Style Styling commit d439abdb89db73e652add9df371234861189d90c Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 21:37:24 2022 +1100 Makes fast-latents in progress default commit ee47ea0c891a33049bdec12f1c254926f341eff2 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 21:37:09 2022 +1100 Adds min width to ImageUploader commit 300bb2e6279c1c477131b9e57425db348062f19c Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 21:28:22 2022 +1100 Fixes current image button rerenders commit ccf8593501d23e00979f7340f8991514e6ca3428 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 21:27:43 2022 +1100 Fixes display progress images select typing commit 0fda612f3ff8ad75932e158b9b29cf64c3f30eb6 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 21:02:01 2022 +1100 Fixes edge case: upload over gets stuck while alt tabbing - Press esc to close it now commit 5afff65b71bb60d067392c120efff1a17adc66af Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 20:33:19 2022 +1100 Fixes progress images select commit 7e55bdefce8920831cac7b9fa857bfbffe9e9d5d Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 20:27:47 2022 +1100 Only generate 1 iteration when seed fixed & variations disabled commit 620cf84d3dd54b8498e84574f33040a26d4d315f Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 19:51:38 2022 +1100 Reworks CurrentImageButtons.tsx - Change all icons to FA iconset for consistency - Refactors IAIIconButton, IAIButton, IAIPopover to handle ref forwarding - Redesigns buttons into group commit cfe567c62ad3fd0cff5e3e579a2250ca5dfa2d53 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 16:14:50 2022 +1100 Fixes: uploaded JPG images not loading commit cefe12f1df72e051f109ed77ce46f18093b3b8bb Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 15:31:18 2022 +1100 Styling changes and settings modal minor refactor commit 1e51c3992853ad4643d8eda2443a3bd0d65f5f90 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 15:27:46 2022 +1100 Fixes crash related to old value of progress_latents in state commit 42a02bbb8087cd46a1b5c795b1b41e38c08ba229 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 13:15:06 2022 +1100 Adds asCheckbox to IAIIconButton Rough draft of this. Not happy with the styling but it's clearer than having them look just like buttons. commit f1ae6dae4c36e74ca8dedf8b57eb8933c059dcf4 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 13:13:56 2022 +1100 Adds alert for bounding box size to status icons commit 6195579910a91fb2ab7e1186aa1c1145566c3122 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 11:52:19 2022 +1100 Restores shift+q bounding box shortcut commit 16c8b23b347792d7811cff66a27d350fe5d0d62c Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 11:32:07 2022 +1100 Changes Report Bug icon to a bug commit 07ae626b22554b5222a3b71d1ce3974e2c3fb284 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 11:17:16 2022 +1100 Removes unused isReady state commit 8d171bb044f578d4b9cc4911edfa05b20a01d373 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 11:13:26 2022 +1100 Fixes crash when requesting post-generation upscale/face restoration - Moves the inpainting paste to before the postprocessing. commit 6e33ca7e9e64fb355430511e28bb08c32c9c68b1 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 10:59:01 2022 +1100 Fixes rerenders on ClearBrushHistory commit db46e12f2b8c98dac8895ea4d04242d3754dbec4 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 11:36:28 2022 +1300 Inpainting Controls Code Spitting and Performance Codesplit the entirety of the inpainting controls. Created new selectors for each and every component to ensure there are no unnecessary re-renders. App feels a lot smoother. commit 868e4b2db82fa8556b423111f2f8d565a70ec129 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 07:40:31 2022 +1300 [Code Splitting] Bounding Box Options Isolated all bounding box components to trigger unnecessary re-renders. Still need to fix bounding box triggering re-renders on the control panel inside the canvas itself. But the options panel should be a good to go with this change. commit 2e562742c13988a1fc299c673a97ba4e4a645aaf Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 06:40:27 2022 +1300 Fix Bounding Box Settings re-rendering on brush stroke commit 68e69580091fc1dc1d8b6e03c9e7ef777c7ebf61 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 06:28:34 2022 +1300 Fresh Bundle commit ea6e3a7949f2743711516261cb7e450517d39702 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 06:26:56 2022 +1300 [TESTING] Remove global isReady checking I dont believe this is need at all because the isready state is constantly updated when needed and tracked real time in the Redux store. This causes massive re-renders. @psychedelicious If this is absolutely essential for a reason that I do not see, please hit me up on Discord. commit b2879ca99f88869277c474185ade049914b0bf26 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 06:08:59 2022 +1300 Code Split Inpaint Options Isolate features to their own components so they dont re-render the other stuff each time. commit 4e911566c33989392eb3279049b15331ca98594a Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 03:50:56 2022 +1300 Preventing unnecessary re-renders across the app commit 9bafda6a152778893df143776ae859a3b8b7f192 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 03:02:35 2022 +1300 Fix Inpainting Alerts Styling commit 871a8a5375cae891f22eb853ffd2d22298298b11 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 23:52:07 2022 +1100 Adds hints when unable to invoke - Popover on Invoke button indicates why exactly it is disabled, e.g. prompt is empty, something else is processing, etc. - There may be more than one reason; all are displayed. commit 0eef74bc00d3c0cedc5037c1deeef1d9a5b6d33d Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 23:40:11 2022 +1100 Address bounding box feedback - Adds back toggle to hide bounding box - Box quick toggle = q, normal toggle = shift + q - Styles canvas alert icons commit 423ae3209782f1d8d321b2ed9ed00712b726adf7 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 17:06:07 2022 +1100 Improves bounding box interaction Added spacebar-hold-to-transform back. commit 8282e5d0458ca1bba5565c069093b5389f2228d4 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 16:57:07 2022 +1100 Builds fresh bundle commit 19305cdbdf6ac74833bd6011bff0ced8e9d36f69 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 16:51:11 2022 +1100 Styles image uploader commit eb9028ab3069bca9d747aca664ca60ae13ba6df8 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 16:51:03 2022 +1100 Disabled bounding box settings when locked commit 21483f5d0731bce5aa97985e722a64bf0d7cd12c Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 16:50:24 2022 +1100 Fixes silent crash when init image too large To send the mask to the server, the UI rendered the mask onto the init image and sent the whole image. The mask was then cropped by the server. If the image was too large, the app silently failed. Maybe it exceeds the websocket size limit. Fixed by cropping the mask in the UI layer, sending only bounding-box-sized mask image data. commit 82dcbac28f140aa7bd89d967bcc7fa31cb03a267 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 16:28:30 2022 +1100 Improves bounding box interactions - Bounding box can now be moved by dragging any of its edges - Bounding box does not affect drawing if already drawing a stroke - Can lock bounding box to draw directly on the bounding box edges - Removes spacebar-hold behaviour due to technical issues commit d43bd4625d64a03d90de0458ad5fcacef211a8a6 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 15:10:49 2022 +1100 Fixes hotkeys and settings buttons not working commit ea891324a2086faf8eeeeac7eaf47ae2935322fb Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 11:04:02 2022 +1100 Changes inpainting controls settings to hover commit 8fd9ea219390493f392e690eadb23c4209a4ecfc Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 11:03:41 2022 +1100 Adds missing tooltips to site header commit fb026668563b3179805819a1630c654c9ce260d9 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 11:03:25 2022 +1100 Increases workarea split padding to 1rem commit f6f5c2731b0c37089c5d7382736f973e857df712 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 11:03:10 2022 +1100 Decreases gallery width on inpainting commit b4e3f771e0314e0a18ad5cedc80b28f246fced59 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 10:54:59 2022 +1100 Fixes bugs/styling - Fixes missing web app state on new version: Adds stateReconciler to redux-persist. When we add more values to the state and then release the update app, they will be automatically merged in. Reseting web UI will be needed far less. 7159ec - Fixes console z-index - Moves reset web UI button to visible area commit 99bb9491ac97f1f733accab839ea38cdf4870ba0 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Tue Nov 1 08:35:45 2022 +1300 [WebUI] Loopback Default False commit 0453f211278a533a49fb1aee54dd989b69179c10 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 23:23:51 2022 +1300 Fresh Build For WebUI commit 9fc09aa4bda3b3e6139b026f24733a37747d373f Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 09:08:11 2022 +0100 don't log base64 progress images commit 5e87062cf809a08242d3b006b66d3bbb834ddb16 Author: spezialspezial <75758219+spezialspezial@users.noreply.github.com> Date: Wed Nov 2 00:21:27 2022 +0100 Option to directly invert the grayscale heatmap - fix commit 3e7a459990407ad1679f38d4027c19d50a9d36e3 Author: spezialspezial <75758219+spezialspezial@users.noreply.github.com> Date: Tue Nov 1 21:37:33 2022 +0100 Update txt2mask.py commit bbf4c03e500bafc8627c2a70f8b3396efeddabb3 Author: spezialspezial <75758219+spezialspezial@users.noreply.github.com> Date: Tue Nov 1 21:11:19 2022 +0100 Option to directly invert the grayscale heatmap Theoretically less work inverting the image while it's small but I can't measure a significant difference. Though, handy option to have in some cases. commit 611a3a975328a7e276c2781214d5e14108708ed7 Author: mauwii <Mauwii@outlook.de> Date: Wed Nov 2 02:23:09 2022 +0100 fix name of caching step commit 1611f0d1815022fe90d33f41c21d670251a75f29 Author: mauwii <Mauwii@outlook.de> Date: Wed Nov 2 02:18:46 2022 +0100 readd caching of sd-models - this would remove the necesarrity of the secret availability in PRs commit 08835115e4c5c0ee3587ce07ab769a04d55cb3c5 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 22:10:12 2022 -0400 pin pytorch_lightning to 1.7.7, issue #1331 commit 2d84e28d329be282b51a4cbc22f7c200d80c8f0e Merge: 533fd04e ef17aae8 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 22:11:04 2022 -0400 Merge branch 'development' of github.com:invoke-ai/InvokeAI into development commit ef17aae8abe03fd87dc6f91b3c6d2fe03375f6c5 Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 00:39:48 2022 +0100 add damian0815 to contributors list commit 0cc39f01a3c67f32873b7888e1e032d33626e269 Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 01:18:50 2022 +0100 report full size for fast latents and update conversion matrix for v1.5 commit 688d7258f185035a5924bee23322b001574da931 Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 00:33:00 2022 +0100 fix a bug that broke cross attention control index mapping commit 4513320bf161d3efdd99e2aef4f7c37472131373 Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 00:31:58 2022 +0100 save VRAM by not recombining tensors that have been sliced to save VRAM commit 533fd04ef0d1ba9d2cb25d556991b999e7d44aba Merge: 6215592b dff5681c Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 17:40:36 2022 -0400 Merge branch 'development' of github.com:invoke-ai/InvokeAI into development commit dff5681cf0e24faf67d5eb5903203c4ea39f89bd Author: damian0815 <d@d.com> Date: Tue Nov 1 13:56:03 2022 +0100 shorter strings commit 5a2790a69b11e049d2507bc22eab7812915d867f Author: damian0815 <d@d.com> Date: Tue Nov 1 13:19:20 2022 +0100 convert progress display to a drop-down commit 7c5305ccbaf7926162536aa3a9e51dcdd8574d0d Author: damian0815 <d@d.com> Date: Tue Nov 1 12:54:46 2022 +0100 do not try to save base64 intermediates in gallery on cancellation commit 4013e8ad6fa5e5c2a710c607fe7e1d040f353299 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 21:54:35 2022 +1100 Fixes b64 image sending and displaying commit d1dfd257f9e1cafd352d9007a56194226b9d6b63 Author: damian <d@d.com> Date: Tue Nov 1 11:40:40 2022 +0100 wip base64 commit 5322d735ee4515d89293b7fb015b2ce048262f68 Author: damian <d@d.com> Date: Tue Nov 1 11:31:42 2022 +0100 update frontend commit cdb107dcda858a8bb64455cc60a196a42345f8f7 Author: damian <d@d.com> Date: Tue Nov 1 11:17:43 2022 +0100 add option to show intermediate latent space commit be1393a41ce7a75ed8de7f648a93c5e5974a50d2 Author: damian <d@d.com> Date: Tue Nov 1 10:16:55 2022 +0100 ensure existing exception handling code also handles new exception class commit e554c2607f00a5e51c03052acb9861ff21ec1c12 Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Tue Nov 1 10:08:42 2022 +0100 Rebuilt prompt parsing logic Complete re-write of the prompt parsing logic to be more readable and logical, and therefore also hopefully easier to debug, maintain, and augment. In the process it has also become more robust to badly-formed prompts. Squashed commit of the following: commit 8fcfa88a16e1390d41717e940d72aed64712171c Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Sun Oct 30 17:05:57 2022 +0100 further cleanup commit 1a1fd78bcfeb49d072e3e6d5808aa8df15441629 Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Sun Oct 30 16:07:57 2022 +0100 cleanup and document commit 099c9659fa8b8135876f9a5a50fe80b20bc0635c Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Sun Oct 30 15:54:58 2022 +0100 works fully commit 5e6887ea8c25a1e21438ff6defb381fd027d25fd Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Sun Oct 30 15:24:31 2022 +0100 further... commit 492fda120844d9bc1ad4ec7dd408a3374762d0ff Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Sun Oct 30 14:08:57 2022 +0100 getting there... commit c6aab05a8450cc3c95c8691daf38fdc64c74f52d Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Fri Oct 28 14:29:03 2022 +0200 wip doesn't compile commit 5e533f731cfd20cd435330eeb0012e5689e87e81 Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Fri Oct 28 13:21:43 2022 +0200 working with CrossAttentionCtonrol but no Attention support yet commit 9678348773431e500e110e8aede99086bb7b5955 Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Fri Oct 28 13:04:52 2022 +0200 wip rebuiling prompt parser commit 6215592b12dea3822c727913b771012789a52477 Merge: ef24d76a 349cc254 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 17:34:55 2022 -0400 Merge branch 'development' of github.com:invoke-ai/InvokeAI into development commit 349cc25433e1d358c6c61cca4a6c300ecc8ca3d7 Author: damian0815 <d@d.com> Date: Tue Nov 1 20:08:52 2022 +0100 fix crash (be a little less aggressive clearing out the attention slice) commit 214d276379387ae0fa2259602ab00884ec1ad03e Author: damian0815 <d@d.com> Date: Tue Nov 1 19:57:55 2022 +0100 be more aggressive at clearing out saved_attn_slice commit ef24d76adc5a192297714707cd6794d4f44bcf67 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 14:34:23 2022 -0400 fix library problems in preload_modules commit ab2b5a691dadb292f7cecf5db94a165db3e3e126 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 17:22:48 2022 -0400 fix model_cache memory management issues commit c7de2b2801ad5d6ce52a5f44e88c5705f1dbf524 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 02:02:14 2022 +0100 disable checks with sd-V1.4 model... ...to save some resources, since V1.5 is the default now commit e8075658acf675346d35435d0cfb7710becab42a Author: mauwii <Mauwii@outlook.de> Date: Mon Oct 31 22:20:51 2022 +0100 update test-invoke-conda.yml - fix model dl path for sd-v1-4.ckpt - copy configs/models.yaml.example to configs/models.yaml commit 4202dabee1143f597f4c3946420fbfa7b8eccddf Author: mauwii <Mauwii@outlook.de> Date: Mon Oct 31 22:17:21 2022 +0100 fix models example weights for sd-v1.4 commit d67db2bcf1ac26d8bb7c5f8bfd056f2172597780 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Tue Nov 1 08:35:45 2022 +1300 [WebUI] Loopback Default False commit 7159ec885faa1117a3506689d547618be1d91808 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Mon Oct 31 11:33:05 2022 -0400 further improvements to preload_models.py - Faster startup for command line switch processing - Specify configuration file to modify using --config option: ./scripts/preload_models.ply --config models/my-models-file.yaml commit b5cf734ba9f1aeaab14075b55cc13ed9a0ae31e2 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Mon Oct 31 11:08:19 2022 -0400 improve behavior of preload_models.py - NEVER overwrite user's existing models.yaml - Instead, merge its contents into new config file, and rename original to models.yaml.orig (with message) - models.yaml has been removed from repository and renamed models.yaml.example commit f7dc8eafeef991e135b5541c01d0ff740dda9591 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Mon Oct 31 10:47:35 2022 -0400 restore models.yaml to virgin state commit 762ca60a309f70daaf1b9e79b6273f76fd9474b6 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Oct 4 22:55:10 2022 -0400 Update INPAINTING.md commit e7fb9f342cb5ed0c09e6215026d60d45eef3ebcb Author: Hideyuki Katsushiro <h.katsushiro@qualia.tokyo.jp> Date: Wed Oct 5 10:08:53 2022 +0900 add argument --outdir
2022-11-12 17:17:07 +00:00
args = metadata_from_png(image_path)
seed = opt.seed or args.seed
if seed is None or seed < 0:
seed = random.randrange(0, np.iinfo(np.uint32).max)
merge release-candidate-1-3-2 into main. Squashed commit of the following: commit 9a1fe8e7fbbd81d9e9e47c4fda6bde6f66fba30c Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 12 17:07:40 2022 +0000 swap in release URLs for installers commit ff56f5251ba8502833cb561317e82b028cd2da5d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 12 17:03:21 2022 +0000 fix up bad unicode chars in invoke.py commit ed943bd6c785d968d1e31fbbb814fea8688fc8bb Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 12 16:05:45 2022 +0000 outcrop improvements, hand-added commit 7ad2355b1da53861bb75312edead8f9db0b0f44d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 12 15:14:33 2022 +0000 documentation fixes commit 66c920fc197d9206be9e0e2d1eb2a1cb86362887 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 16:49:25 2022 -0500 Revert "Resize hires as an image" This reverts commit d05b1b3544dfa7b3c071ac05b4f014a52e08fa50. commit 3fc5cb09f8bc03ea96e67a3e49fb087019d2f9d5 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 12 12:43:17 2022 +0000 fix incorrect link in install commit 1345ec77ab58f70e1bf5a0f587ca40aba4e906b7 Author: tildebyte <337875+tildebyte@users.noreply.github.com> Date: Sun Nov 6 19:07:31 2022 -0500 toil(repo): add tildebyte as owner of installer/ directory commit b116715490f390a59e5bee1022a6a758aee0918d Author: Kyle Schouviller <kyle0654@hotmail.com> Date: Thu Nov 10 21:43:56 2022 -0800 Fix performance issue introduced by torch cuda cache clear during generation commit fa3670270e7aae6bfd8d47fb7bdd32b707310c23 Author: mauwii <Mauwii@outlook.de> Date: Fri Nov 11 12:42:03 2022 +0100 small update to dockers huggingface section commit c304250ef663b3e202b4da8332365288589d94c7 Author: mauwii <Mauwii@outlook.de> Date: Fri Nov 11 12:19:27 2022 +0100 fix format and Link in INSTALL_INVOKE.md commit 802ce5dde5ca68f24aa4609cdba428044e0c7fa1 Author: mauwii <Mauwii@outlook.de> Date: Fri Nov 11 11:17:49 2022 +0100 small fixex to format and a link in INSTALL_MANUAL commit 311ee320ecac892cb4a1bcd012374fa051b1d011 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 07:23:35 2022 +0000 ignore installer intermediate files commit e9df17b374df58a44d3ae3ba33cbdc58794bcf5d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 07:19:25 2022 +0000 fix backslash-related syntax error commit 061fb4ef00482bdd4fba635aeaeff4ca7510190d Merge: 52be0d23 4095acd1 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 06:50:04 2022 +0000 Merge branch 'release-candidate-2-1-3' of github.com:/invoke-ai/InvokeAI into release-candidate-2-1-3 commit 52be0d2396de2de02030855c92e3367008b50377 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 06:49:45 2022 +0000 add WindowsLongFileName batfile to source installer commit 4095acd10ebae05a8cb14cc2faf7c79936d9e6a9 Author: mauwii <Mauwii@outlook.de> Date: Fri Nov 11 07:05:17 2022 +0100 Doc Updates A lot of re-formating of new Installation Docs also some content updates/corrections commit 201eb22d7650b00f55249c2646fa4f47ac3e0ec2 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 04:41:02 2022 +0000 prevent two models from being marked default in models.yaml commit 17ab98220034dfbb798a9a0460bc2837f0c1e2cb Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 03:56:54 2022 +0000 installers download branch HEAD not tag commit a04965b0e9e9d1170cf284af9acbd1186d681255 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 03:48:21 2022 +0000 improve messaging during installation process commit 0b529f0c574dd91fb9593e924ebc41c8c219b6ce Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 15:22:32 2022 +0000 enable outcropping of random JPG/PNG images - Works best with runwayML inpainting model - Numerous code changes required to propagate seed to final metadata. Original code predicated on the image being generated within InvokeAI. commit 6f9f84834557eb3c48562dc5d0ace51ca9e9cca2 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 17:27:42 2022 +0000 enhance outcropping with ability to direct contents of new regions - When outcropping an image you can now add a `--new_prompt` option, to specify a new prompt to be used instead of the original one used to generate the image. - Similarly you can provide a new seed using `--seed` (or `-S`). A seed of zero will pick one randomly. - This PR also fixes the crash that happened when trying to outcrop an image that does not contain InvokeAI metadata. commit 918c1589ef30595668899f4259ece6a4ad605c69 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 20:16:47 2022 +0000 fix #1402 commit 116415b3fcec8415f8e6de9b23c0bbd0dbc6845b Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 21:27:25 2022 +0000 fix invoke.py crash if no models.yaml file present - Script will now offer the user the ability to create a minimal models.yaml and then gracefully exit. - Closes #1420 commit b4b6eabaac94896e38123be331c44d1b63065b0d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 16:49:25 2022 -0500 Revert "Log strength with hires" This reverts commit 82d4904c07670d514e9a541de7c9ecd8489eeae2. commit 4ef1f4a854717c953f9192454d0adabef32af36c Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 20:01:49 2022 +0000 remove temporary directory from repo commit 510fc4ebaa5f9dc0e77b47cf04e0c265423e0a44 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 19:59:03 2022 +0000 remove -e from clipseg load in installer commit a20914434bb3609cf1d883cabf048d4cc25f881a Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 19:37:07 2022 +0000 change clipseg repo branch to avoid clipseg not found error commit 0d134195fda5c69fce5a95d6da90248eba8d226d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 18:39:29 2022 +0000 update repo URL to point to rc commit 649d8c8573896fdb5a73453b69ee4b54cf4d6241 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 18:13:28 2022 +0000 integrate tildebyte installer commit a358d370a05ea985a9e26fa9c1101d9c14fdb3ab Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 17:48:14 2022 +0000 add @tildebyte compiled pip installer commit 94a9033c4f6214e604be149a3de6d7c747af7f3a Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 14:52:00 2022 +0000 ignore source installer zip files commit 18a947c503c83c95cd83f27424696219ff3c4c95 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 14:46:36 2022 +0000 documentation and environment file fixes - Have clarified the relationship between the @tildebyte and @cmdr2 installers; However, @tildebyte installer merge is still a WIP due to conflicts over such things as `invoke.sh`. - Rechristened 1click installer as "source" installer. @tildebyte installer will be "the" installer. (We'll see which one generates the least support requests and maintenance work.) - Sync'd `environment-mac.yml` with `development`. The former was failing with a taming-transformers error as per https://discord.com/channels/@me/1037201214154231899/1040060947378749460 commit a23b03189526a49da8ddae90ce71b0e902784d29 Author: Mike DiGiovanni <vinblau@gmail.com> Date: Wed Nov 9 16:44:59 2022 -0500 Fixes typos in README.md commit 23af68c7d79d947f1bd3441c91bb44d655238f01 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 07:02:27 2022 -0500 downgrade win installs to basicsr==1.4.1 commit e258beeb51f3e645b9ea60e52d69d18722221cc5 Merge: 7460c069 e481bfac Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 06:37:45 2022 -0500 Merge branch 'release-candidate-2-1-3' of github.com:invoke-ai/InvokeAI into release-candidate-2-1-3 commit 7460c069b880b10c84b55f2e0c0998e350d6cf12 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 06:36:48 2022 -0500 remove --prefer-binary from requirements-base.txt It appears that some versions of pip do not recognize this option when it appears in the requirements file. Did not explore this further but recommend --prefer-binary in the manual install instructions on the command line. commit e481bfac615e0c798ceb5e59e8fbe3038f85b431 Merge: 5040747c d1ab65a4 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 11:21:56 2022 +0000 Merge branch 'release-candidate-2-1-3' of github.com:/invoke-ai/InvokeAI into release-candidate-2-1-3 commit 5040747c6700c9b949e3f3e1d2c3f21daffcec6c Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 11:21:43 2022 +0000 fix windows install instructions & bat file commit d1ab65a43122f73c20533d5815590ec10bc05eca Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 07:18:59 2022 +0100 update WEBUIHOTKEYS.md commit af4ee7feb8a7d2528bf4e2b3f7deee7a7c4c3dec Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 06:33:49 2022 +0100 update INSTALL_DOCKER.md commit 764fb29aded8114984d05932c4266ea24614b932 Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 06:30:15 2022 +0100 fix formatting in INSTALL.md commit 1014d3ba44aa4cd4cfdc6e3650c24a0dc9568a6e Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 06:29:14 2022 +0100 fix build.sh invokeai_conda_env_file default value commit 40a48aca88e337e9f4475f80a03b7d6d4751d09b Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 05:25:30 2022 +0100 fix environment-mac.yml moved taming-transformers-rom1504 to pip dependencies commit 92abc00f16a34a586dd16d3c64408f00e23fcb53 Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 05:19:52 2022 +0100 fix test-invoke-conda - copy required conda environment yaml - use environment.yml - I use cp instead of ln since would be compatible for windows runners commit a5719aabf89c8c5f29c6044e2882ccdcd0c6916b Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 04:14:35 2022 +0100 update Dockerfile - link environment.yml from new environemnts path - change default conda_env_file - quote all variables to avoid splitting - also remove paths from conda-env-files in build-container.yml commit 44a18511fa7accfec6a20345774583a1ce745b02 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 20:51:06 2022 +0000 update paths in container build workflow commit b850dbadafba052310327ca759d96f49a9d25d03 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 20:16:57 2022 +0000 finished reorganization of install docs commit 9ef8b944d53afb1fed94c418b2fd936d2d743797 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 18:50:58 2022 +0000 tweaks to manual install documentation --prefer-binary is an iffy option in the requirements file. It isn't supported by some versions of pip, so I removed it from requirements-base.txt and inserted it into the manual install instructions where it seems to do what it is supposed to. commit efc5a9848803b4250d726bc1913b9fd5a33fad75 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 18:20:03 2022 +0000 manual installation documentation tested on Linux commit 1417c87928e13b0ed21bf1c5604f8636d3b50a8d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 17:37:06 2022 +0000 change name of requirements.txt to avoid confusion commit 2dd6fc2b93ff7bbb4038568a3b28d36a8fafaeb8 Merge: 22213612 71ee44a8 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 17:26:24 2022 +0000 Merge branch 'release-candidate-2-1-3' of github.com:/invoke-ai/InvokeAI into release-candidate-2-1-3 commit 22213612a08bbece46eafd48994f985b097cb141 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 17:25:59 2022 +0000 directory cleanup; working on install docs commit 71ee44a827898759fd457f774c0b2ac7a1ef6519 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 02:07:13 2022 +0000 prevent crash when switching to an invalid model commit b17ca0a5e731c142101bbdbf34d121df949e86d7 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 14:28:38 2022 +0100 don't suppress exceptions when doing cross-attention control commit 71bbfe4a1a5b70f90e5f41c94df50fb104dbdd79 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 12:59:34 2022 +0100 Fix #1362 by improving VRAM usage patterns when doing .swap() commit ef3f7a26e242b73c2beb0195c7fd8f654ef47f55 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 12:18:37 2022 +0100 remove log spam commit 7189d649622d4668b120b0dd278388ad672142c4 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 12:10:28 2022 +0100 change the way saved slicing strategy is applied commit 01c40f751ab72955140165c16f95ae411732265b Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 12:04:43 2022 +0100 fix slicing_strategy_getter callsite commit f8cfe25150a346958903316bc710737d99839923 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 11:56:22 2022 +0100 cleanup, consistent dim=0 also tested commit 5bf9b1e890d48e962afd4a668a219b68271e5dc1 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 11:34:09 2022 +0100 refactored context, tested with non-sliced cross attention control commit d58a46e39bf562e7459290d2444256e8c08ad0b6 Author: damian0815 <null@damianstewart.com> Date: Sun Nov 6 00:41:52 2022 +0100 cleanup commit 7e2c658b4c06fe239311b65b9bb16fa3adec7fd7 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:57:31 2022 +0100 disable logs commit 20ee89d93841b070738b3d8a4385c93b097d92eb Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:36:58 2022 +0100 slice saved attention if necessary commit 0a7684a22c880ec0f48cc22bfed4526358f71546 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:32:38 2022 +0100 raise instead of asserting commit 7083104c7f3a0d8fd96e94a2f391de50a3c942e4 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:31:00 2022 +0100 store dim when saving slices commit f7c0808ed383ec1dc70645288a798ed2aa4fa85c Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:27:16 2022 +0100 don't retry on exception commit 749a721e939b3fe7c1741e7998dab6bd2c85a0cb Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:24:50 2022 +0100 stuff commit 032ab90e9533be8726301ec91b97137e2aadef9a Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:20:17 2022 +0100 more logging commit 3dc34b387f033482305360e605809d95a40bf6f8 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:16:47 2022 +0100 logs commit 901c4c1aa4b9bcef695a6551867ec8149e6e6a93 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:12:39 2022 +0100 actually set save_slicing_strategy to True commit f780e0a0a7c6b6a3db320891064da82589358c8a Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:10:35 2022 +0100 store slicing strategy commit 93bb6d566fd18c5c69ef7dacc8f74ba2cf671cb7 Author: damian <git@damianstewart.com> Date: Sat Nov 5 20:43:48 2022 +0100 still not it commit 5e3a9541f8ae00bde524046963910323e20c40b7 Author: damian <git@damianstewart.com> Date: Sat Nov 5 17:20:02 2022 +0100 wip offloading attention slices on-demand commit 4c2966aa856b6f3b446216da3619ae931552ef08 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 15:47:40 2022 +0100 pre-emptive offloading, idk if it works commit 572576755e9f0a878d38e8173e485126c0efbefb Author: root <you@example.com> Date: Sat Nov 5 11:25:32 2022 +0000 push attention slices to cpu. slow but saves memory. commit b57c83a68f2ac03976ebc89ce2ff03812d6d185f Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 12:04:22 2022 +0100 verbose logging commit 3a5dae116f110a96585d9eb71d713b5ed2bc3d2b Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 11:50:48 2022 +0100 wip fixing mem strategy crash (4 test on runpod) commit 3cf237db5fae0c7b0b4cc3c47c81830bdb2ae7de Author: damian0815 <null@damianstewart.com> Date: Fri Nov 4 09:02:40 2022 +0100 wip, only works on cuda commit 5702271991e126c026aa1ff41c44f8ad37b26e3a Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 14:09:36 2022 +0000 speculative reorganization of the requirements & environment files - This is only a test! - The various environment*.yml and requirements*.txt files have all been moved into a directory named "environments-and-requirements". - The idea is to clean up our root directory so that the github home page is tidy. - The manual install instructions will start with the instructions to create a symbolic link from environment.yml to the appropriate file for OS and GPU. - The 1-click installers have been updated to accommodate this change. commit 10781e7dc4f4551583a110d14f2a1f60393112b8 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 01:59:45 2022 +0000 refactoring requirements commit 099d1157c579c7b9fea20945e8504cc15745c598 Author: mauwii <Mauwii@outlook.de> Date: Wed Nov 9 00:16:18 2022 +0100 better way to make sure if conda is useable commit ab825bf7ee5f0b82d2273da1cda64fc9266a978e Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 22:05:33 2022 +0000 add back --prefer-binaries to requirements commit 10cfeb5ada7bcfc9f3aff3716ab8ea4961a8b528 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 8 22:27:19 2022 +0100 add quotes to set and use `$environment_file` commit e97515d0453583e013674b4dd1f3739c7de402cc Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 8 22:24:21 2022 +0100 set environment file for conda update commit 0f04bc5789c712bf7c7319b1d93064914993f4ec Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 8 22:21:25 2022 +0100 use conda env update commit 3f74aabecd08ed25fac158463ae12b775bd1fca2 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 8 22:20:44 2022 +0100 use command instead of hash commit b1a99a51b7ca23c4b895855bd7b4c82dbdc431e4 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 14:44:44 2022 -0500 remove --global git config from 1-click installers commit 8004f8a6d99f6ff75e00c170da40f1dec93a8914 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Mon Nov 7 09:07:20 2022 -0500 Revert "Use array slicing to calc ddim timesteps" This reverts commit 1f0c5b4cf196716c21f2db74f92c8750ad8f889d. commit ff8ff2212afb1e1c2dce4f6a61f29e2bc8302eb5 Merge: 8e5363cd 636620b1 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 14:01:40 2022 +0000 add initfile support from PR #1386 commit 8e5363cd83bff0e6be0f002c644283955f7fcbfd Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 13:26:18 2022 +0000 move 'installer/' to '1-click-installer' to make room for tildebyte installer commit 1450779146e89510d12b8c90eb316d9861c3375e Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 12:56:36 2022 +0000 update branch for installer to pull against commit 8cd5d95b8a1cb213cce2f949c394c841a09d9cab Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 05:30:20 2022 +0000 move all models into subdirectories of ./models - this required an update to the invoke-ai fork of gfpgan - simultaneously reverted consolidation of environment and requirements files, as their presence in a directory triggered setup.py to try to install a sub-package. commit abd6407394d55d4f6c064a05f3ac989dd3817c59 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 03:52:46 2022 +0000 leave a copy of environment-cuda.yml at top level - named it environment.yml - need to avoid a big change for users and breaking older support instructions. commit 734dacfbe9d8c86ca943c6541e7b5ff5ef787ff4 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 03:50:07 2022 +0000 consolidate environment files - starting to remove unneeded entries and pins - no longer require -e in front of github dependencies - update setup.py with release number - update manual installation instructions commit 636620b1d5e2466613d0dcc2a604522be12fa3a4 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 03:26:16 2022 +0000 change initfile to ~/.invokeai - adjust documentation - also fix 'clipseg_models' to 'clipseg', which seems to be working now commit 1fe41146f0975bbc9d552208473490a9ccb9fc56 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 5 14:28:01 2022 -0400 add support for an initialization file, invokeai.init - Place preferred startup command switches in a file named "invokeai.init". The file can consist of a single line of switches such as "--web --steps=28", a series of switches on each line, or any combination of the two. Example: ``` --web --host=0.0.0.0 --steps=28 --grid -f 0.6 -C 11.0 -A k_euler_a ``` - The following options, which were previously only available within the CLI, are now available on the command line as well: --steps --strength --cfg_scale --width --height --fit commit 2ad6ef355a9b9c4b17bae71edea2346c2e8708c5 Merge: 865502ee 8b47c829 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sun Nov 6 18:08:36 2022 +0000 update discord link commit 865502ee4f681de4516d231370ae603983354d8f Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 18:00:16 2022 +0100 update changelog commit c7984f3299c5c8f56a70d80907d527af458674af Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 17:07:27 2022 +0100 update TROUBLESHOOT.md commit 7f150ed83302ba875c3e0c0f39d8ac0f32c6e362 Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 16:56:58 2022 +0100 remove `:`from headlines in CONTRIBUTORS.md commit badf4e256ce6e3201df1a9a87a7072b36b18d699 Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 16:56:37 2022 +0100 enable navigation tabs Since the docs are growing, this way they look cleaner commit e64c60bbb38fc1620e08ce52bf28bd17003c7ef6 Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 16:18:59 2022 +0100 remove preflight checks from assets seems like somebody executed tests and commited them commit 178061854300632b024810e65922b54b64d95939 Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 16:15:06 2022 +0100 update INSTALLING_MODELS.md commit f91fd276242a0c92b301e99d02982d30f7b712c3 Author: Kyle Schouviller <kyle0654@hotmail.com> Date: Sat Nov 5 14:47:53 2022 -0700 Bug fix for inpaint size commit 09e41e8f769457b9ffd56901aae13991cdc6eeb8 Author: Kyle Schouviller <kyle0654@hotmail.com> Date: Sat Nov 5 14:34:52 2022 -0700 Add inpaint size options to inpaint at a larger size than the actual inpaint image, then scale back down for recombination commit 6eeb2107b300fc27cfe6134b43e5570c246b8e96 Author: mauwii <Mauwii@outlook.de> Date: Sat Nov 5 21:01:14 2022 +0100 remove create-caches.yml since not used anywhere commit 17053ad8b7efecb21a9b4eb32695089f683f72e3 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 5 16:01:55 2022 -0400 fix duplicated argument introduced by conflict resolution commit fefb4dc1f88bc6551a39602a2bc79b278cd83c59 Merge: 762ca60a d05b1b35 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 5 12:47:35 2022 -0700 Merge branch 'development' into fix_generate.py commit d05b1b3544dfa7b3c071ac05b4f014a52e08fa50 Author: Craig <cwallen@users.noreply.github.com> Date: Sat Oct 29 20:40:30 2022 -0400 Resize hires as an image commit 82d4904c07670d514e9a541de7c9ecd8489eeae2 Author: Craig <cwallen@users.noreply.github.com> Date: Sat Oct 29 20:37:40 2022 -0400 Log strength with hires commit 1cdcf33cfa39e90f9660fabf8f5936dcfb6c3aa5 Merge: 6616fa83 cbc029c6 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 5 09:57:38 2022 -0400 Merge branch 'main' into development - this synchronizes recent document fixes by mauwii commit 6616fa835ac4318bf53419f2b54b88c962559578 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 4 00:47:03 2022 -0400 fix Windows library dependency issues This commit addresses two bugs: 1) invokeai.py crashes immediately with a message about an undefined attritube sigKILL (closes #1288). The fix is to pin torch at 1.12.1. 2) Version 1.4.2 of basicsr fails to load properly on Windows, and is a requirement of realesrgan, however 1.4.1 works. Pinning basicsr in our requirements file resulted in a dependency conflict, so I ended up cloning realesrgan into the invoke-ai Git space and changing the requirements file there. If there is a more elegant solution, please advise. commit 7b9a4564b11f4181b9b3c06ecda2a4a25fd1849e Author: Matthias Wild <40327258+mauwii@users.noreply.github.com> Date: Sat Nov 5 14:36:45 2022 +0100 Update-docs (#1382) * update IMG2IMG.md * update INPAINTING.md * update WEBUIHOTKEYS.md * more doc updates (mostly fix formatting): - OUTPAINTING.md - POSTPROCESS.md - PROMPTS.md - VARIATIONS.md - WEB.md - WEBUIHOTKEYS.md commit fcdefa0620761472718afa14b2955a5d0603cfcc Author: Matthias Wild <40327258+mauwii@users.noreply.github.com> Date: Fri Nov 4 20:47:31 2022 +0100 Hotifx docs (#1376) (#1377) commit ef8b3ce639954259a95a38f44fa5329687bee781 Merge: b7042095 36870a8f Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 4 12:08:44 2022 -0400 Merge-main-into-development (#1373) To get the rid of the difference between main and development. Since otherwise it will be a pain to start fixing the documentatino (when the state between main and development is not the same ...) Also this should fix the problem of all tests failing since environment yamls get updated. commit 36870a8f53217d4b733e9bb8b119190b5e36da59 Merge: 6b89adfa b7042095 Author: Matthias Wild <40327258+mauwii@users.noreply.github.com> Date: Fri Nov 4 16:25:00 2022 +0100 Merge branch 'development' into merge-main-into-development commit b70420951d5b70937c0c07e4f8a552a01c3008bc Author: damian0815 <null@damianstewart.com> Date: Thu Nov 3 12:39:45 2022 +0100 fix parsing error doing eg `forest ().swap(in winter)` commit 1f0c5b4cf196716c21f2db74f92c8750ad8f889d Author: wfng92 <43742196+wfng92@users.noreply.github.com> Date: Thu Nov 3 17:13:52 2022 +0800 Use array slicing to calc ddim timesteps commit 8648da811190fc8bcf237d83aff38cf605851300 Author: mauwii <Mauwii@outlook.de> Date: Fri Nov 4 00:06:19 2022 +0100 update environment-linux-aarch64 to use python 3.9 commit 45b459356399f8cfb7e9af571c1643fab04218fe Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 3 22:31:46 2022 +0100 update environment-linux-aarch64.yml - move getpass_asterisk to pip commit 41b04316cf5118ea9518dc77934d135a489dd684 Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 3 20:40:08 2022 +0100 rename job, remove debug branch from triggers commit e97c6db2a3c0157a8a5ab74cd28ebee480a2d078 Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 3 20:34:01 2022 +0100 include build matrix to build x86_64 and aarch64 commit 896820a349292b0e14bbc32f0c557fe8a6b45395 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 05:01:15 2022 +0100 disable caching commit 06c8f468bff7e1dfecc1a1990164be1005b114a7 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 04:26:39 2022 +0100 disable PR-Validation since there are no files passed from context this is unecesarry commit 61920e2701c4a9cea94c03ab933c4482458215b7 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 04:09:39 2022 +0100 update action to use current branch also update build-args of dockerfile and build.sh commit f34ba7ca70f1c417ee97e8b0c57abff57614d78f Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 02:30:24 2022 +0100 remove unecesarry mkdir command again commit c30ef0895dbf0565345ac6ccb136d98a174470a6 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 01:51:12 2022 +0100 remove symlink to GFPGANv1.4 also re-add mkdir to prevent action from failing commit aa3a774f73d5004571ea42fea14cd2b525fffb1c Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 01:48:59 2022 +0100 update build-container.yml to use cachev3 commit 2c30555b844293764123baa4137fcf952d40a4e7 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 01:34:20 2022 +0100 update Dockerfile - create models.yaml from models.yaml.example - run preload_models.py with --no-interactive commit 743f60577364d43237eeb46aefd523371c36e56b Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 01:21:15 2022 +0100 update build.sh to download sd-v1.5 model commit 519c661abbae83aa62b3ee536635c39192890441 Author: mauwii <Mauwii@outlook.de> Date: Tue Oct 25 01:26:50 2022 +0200 replace old fashined markdown templates with forms this will help the readability of issues a lot 🤓 commit 22c956c75f4797ddc2dffa944e3ea84b4eb3477c Merge: 13696adc 0196571a Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 3 10:20:21 2022 -0400 Merge branch 'development' of github.com:invoke-ai/InvokeAI into development commit 13696adc3a3a2b169e68048a5b511660d0430fae Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 3 10:20:10 2022 -0400 speculative change to solve windows esrgan issues commit 0196571a12992eb8207d36e022721fe3ad2cfd19 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 2 22:39:35 2022 -0400 remove merge markers from preload_models.py commit 9666f466ab1c710dfda2e59be9e8a26fcd7e8718 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 2 18:29:34 2022 -0400 use refined model by default commit 240e5486c89552ef480c3443a63283fb86a493c3 Merge: 8164b6b9 aa247e68 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 2 18:35:00 2022 -0400 Merge branch 'spezialspezial-patch-9' into development commit 8164b6b9cff077e4131384195af65e30a40733a7 Merge: 4fc82d55 dd5a88dc Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 2 17:06:46 2022 -0400 Merge branch 'development' of github.com:invoke-ai/InvokeAI into development commit 4fc82d554ff573780c0af562a6bc9586aa56012d Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 04:17:28 2022 +1300 [WebUI] Final 2.1 Release Build commit 96b34c0f85f6ed52707fe43456d20b81822c7d1d Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 09:08:11 2022 +0100 Final WebUI build for Release 2.1 - squashed commit of 52 commits from PR #1327 don't log base64 progress images Fresh Build For WebUI [WebUI] Loopback Default False Fixes bugs/styling - Fixes missing web app state on new version: Adds stateReconciler to redux-persist. When we add more values to the state and then release the update app, they will be automatically merged in. Reseting web UI will be needed far less. 7159ec - Fixes console z-index - Moves reset web UI button to visible area Decreases gallery width on inpainting Increases workarea split padding to 1rem Adds missing tooltips to site header Changes inpainting controls settings to hover Fixes hotkeys and settings buttons not working Improves bounding box interactions - Bounding box can now be moved by dragging any of its edges - Bounding box does not affect drawing if already drawing a stroke - Can lock bounding box to draw directly on the bounding box edges - Removes spacebar-hold behaviour due to technical issues Fixes silent crash when init image too large To send the mask to the server, the UI rendered the mask onto the init image and sent the whole image. The mask was then cropped by the server. If the image was too large, the app silently failed. Maybe it exceeds the websocket size limit. Fixed by cropping the mask in the UI layer, sending only bounding-box-sized mask image data. Disabled bounding box settings when locked Styles image uploader Builds fresh bundle Improves bounding box interaction Added spacebar-hold-to-transform back. Address bounding box feedback - Adds back toggle to hide bounding box - Box quick toggle = q, normal toggle = shift + q - Styles canvas alert icons Adds hints when unable to invoke - Popover on Invoke button indicates why exactly it is disabled, e.g. prompt is empty, something else is processing, etc. - There may be more than one reason; all are displayed. Fix Inpainting Alerts Styling Preventing unnecessary re-renders across the app Code Split Inpaint Options Isolate features to their own components so they dont re-render the other stuff each time. [TESTING] Remove global isReady checking I dont believe this is need at all because the isready state is constantly updated when needed and tracked real time in the Redux store. This causes massive re-renders. @psychedelicious If this is absolutely essential for a reason that I do not see, please hit me up on Discord. Fresh Bundle Fix Bounding Box Settings re-rendering on brush stroke [Code Splitting] Bounding Box Options Isolated all bounding box components to trigger unnecessary re-renders. Still need to fix bounding box triggering re-renders on the control panel inside the canvas itself. But the options panel should be a good to go with this change. Inpainting Controls Code Spitting and Performance Codesplit the entirety of the inpainting controls. Created new selectors for each and every component to ensure there are no unnecessary re-renders. App feels a lot smoother. Fixes rerenders on ClearBrushHistory Fixes crash when requesting post-generation upscale/face restoration - Moves the inpainting paste to before the postprocessing. Removes unused isReady state Changes Report Bug icon to a bug Restores shift+q bounding box shortcut Adds alert for bounding box size to status icons Adds asCheckbox to IAIIconButton Rough draft of this. Not happy with the styling but it's clearer than having them look just like buttons. Fixes crash related to old value of progress_latents in state Styling changes and settings modal minor refactor Fixes: uploaded JPG images not loading Reworks CurrentImageButtons.tsx - Change all icons to FA iconset for consistency - Refactors IAIIconButton, IAIButton, IAIPopover to handle ref forwarding - Redesigns buttons into group Only generate 1 iteration when seed fixed & variations disabled Fixes progress images select Fixes edge case: upload over gets stuck while alt tabbing - Press esc to close it now Fixes display progress images select typing Fixes current image button rerenders Adds min width to ImageUploader Makes fast-latents in progress default Update Icon Button Checkbox Style Styling Fixes next/prev image buttons Refactor canvas buttons + more Add Save Intermediates Step Count For accurate mode only. Co-Authored-By: Richard Macarthy <richardmacarthy@protonmail.com> Restores "initial image" text Address feedback - moves mask clear button - fixes intermediates - shrinks inpainting icons by 10% Fix Loopback Styling Adds escape hotkey to close floating panels Readd Hotkey for Dual Display Updated Current Image Button Styling commit dd5a88dceeec53ceb1722a62e3689ae3dd871154 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 04:17:28 2022 +1300 [WebUI] Final 2.1 Release Build commit 95ed56bf82825a47cfe406fa34eaf4e32c129143 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 04:16:31 2022 +1300 Updated Current Image Button Styling commit 1ae80f5ab9d00a25e0c3a21e2eccd318c5343401 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 04:07:57 2022 +1300 Readd Hotkey for Dual Display commit 1f0bd3ca6cda4221d1a7a46325f235cd23bd0af9 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu Nov 3 02:07:00 2022 +1100 Adds escape hotkey to close floating panels commit a1971f6830306b3d748f7f36c2243f6dee682f97 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 03:38:15 2022 +1300 Fix Loopback Styling commit c6118e889895ba35a191124ce1beb5d2b719366d Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu Nov 3 01:29:51 2022 +1100 Address feedback - moves mask clear button - fixes intermediates - shrinks inpainting icons by 10% commit 7ba958cf7ff4e804a127b71c88666084f81e7340 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu Nov 3 01:10:38 2022 +1100 Restores "initial image" text commit 383905d5d24359aa1824de96ff124a8f8a87e015 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 02:59:11 2022 +1300 Add Save Intermediates Step Count For accurate mode only. Co-Authored-By: Richard Macarthy <richardmacarthy@protonmail.com> commit 6173e3e9cabd5e74fb466d55d7bb6a80a77b3fa8 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu Nov 3 00:53:53 2022 +1100 Refactor canvas buttons + more commit 3feb7d8922b0e4c9f944e96b95211003f40d9705 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu Nov 3 00:49:23 2022 +1100 Fixes next/prev image buttons commit 1d9edbd0ddd6e10cf120fe0de3db0b56ae374db4 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 00:50:44 2022 +1300 Update Icon Button Checkbox Style Styling commit d439abdb89db73e652add9df371234861189d90c Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 21:37:24 2022 +1100 Makes fast-latents in progress default commit ee47ea0c891a33049bdec12f1c254926f341eff2 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 21:37:09 2022 +1100 Adds min width to ImageUploader commit 300bb2e6279c1c477131b9e57425db348062f19c Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 21:28:22 2022 +1100 Fixes current image button rerenders commit ccf8593501d23e00979f7340f8991514e6ca3428 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 21:27:43 2022 +1100 Fixes display progress images select typing commit 0fda612f3ff8ad75932e158b9b29cf64c3f30eb6 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 21:02:01 2022 +1100 Fixes edge case: upload over gets stuck while alt tabbing - Press esc to close it now commit 5afff65b71bb60d067392c120efff1a17adc66af Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 20:33:19 2022 +1100 Fixes progress images select commit 7e55bdefce8920831cac7b9fa857bfbffe9e9d5d Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 20:27:47 2022 +1100 Only generate 1 iteration when seed fixed & variations disabled commit 620cf84d3dd54b8498e84574f33040a26d4d315f Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 19:51:38 2022 +1100 Reworks CurrentImageButtons.tsx - Change all icons to FA iconset for consistency - Refactors IAIIconButton, IAIButton, IAIPopover to handle ref forwarding - Redesigns buttons into group commit cfe567c62ad3fd0cff5e3e579a2250ca5dfa2d53 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 16:14:50 2022 +1100 Fixes: uploaded JPG images not loading commit cefe12f1df72e051f109ed77ce46f18093b3b8bb Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 15:31:18 2022 +1100 Styling changes and settings modal minor refactor commit 1e51c3992853ad4643d8eda2443a3bd0d65f5f90 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 15:27:46 2022 +1100 Fixes crash related to old value of progress_latents in state commit 42a02bbb8087cd46a1b5c795b1b41e38c08ba229 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 13:15:06 2022 +1100 Adds asCheckbox to IAIIconButton Rough draft of this. Not happy with the styling but it's clearer than having them look just like buttons. commit f1ae6dae4c36e74ca8dedf8b57eb8933c059dcf4 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 13:13:56 2022 +1100 Adds alert for bounding box size to status icons commit 6195579910a91fb2ab7e1186aa1c1145566c3122 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 11:52:19 2022 +1100 Restores shift+q bounding box shortcut commit 16c8b23b347792d7811cff66a27d350fe5d0d62c Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 11:32:07 2022 +1100 Changes Report Bug icon to a bug commit 07ae626b22554b5222a3b71d1ce3974e2c3fb284 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 11:17:16 2022 +1100 Removes unused isReady state commit 8d171bb044f578d4b9cc4911edfa05b20a01d373 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 11:13:26 2022 +1100 Fixes crash when requesting post-generation upscale/face restoration - Moves the inpainting paste to before the postprocessing. commit 6e33ca7e9e64fb355430511e28bb08c32c9c68b1 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 10:59:01 2022 +1100 Fixes rerenders on ClearBrushHistory commit db46e12f2b8c98dac8895ea4d04242d3754dbec4 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 11:36:28 2022 +1300 Inpainting Controls Code Spitting and Performance Codesplit the entirety of the inpainting controls. Created new selectors for each and every component to ensure there are no unnecessary re-renders. App feels a lot smoother. commit 868e4b2db82fa8556b423111f2f8d565a70ec129 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 07:40:31 2022 +1300 [Code Splitting] Bounding Box Options Isolated all bounding box components to trigger unnecessary re-renders. Still need to fix bounding box triggering re-renders on the control panel inside the canvas itself. But the options panel should be a good to go with this change. commit 2e562742c13988a1fc299c673a97ba4e4a645aaf Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 06:40:27 2022 +1300 Fix Bounding Box Settings re-rendering on brush stroke commit 68e69580091fc1dc1d8b6e03c9e7ef777c7ebf61 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 06:28:34 2022 +1300 Fresh Bundle commit ea6e3a7949f2743711516261cb7e450517d39702 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 06:26:56 2022 +1300 [TESTING] Remove global isReady checking I dont believe this is need at all because the isready state is constantly updated when needed and tracked real time in the Redux store. This causes massive re-renders. @psychedelicious If this is absolutely essential for a reason that I do not see, please hit me up on Discord. commit b2879ca99f88869277c474185ade049914b0bf26 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 06:08:59 2022 +1300 Code Split Inpaint Options Isolate features to their own components so they dont re-render the other stuff each time. commit 4e911566c33989392eb3279049b15331ca98594a Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 03:50:56 2022 +1300 Preventing unnecessary re-renders across the app commit 9bafda6a152778893df143776ae859a3b8b7f192 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 03:02:35 2022 +1300 Fix Inpainting Alerts Styling commit 871a8a5375cae891f22eb853ffd2d22298298b11 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 23:52:07 2022 +1100 Adds hints when unable to invoke - Popover on Invoke button indicates why exactly it is disabled, e.g. prompt is empty, something else is processing, etc. - There may be more than one reason; all are displayed. commit 0eef74bc00d3c0cedc5037c1deeef1d9a5b6d33d Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 23:40:11 2022 +1100 Address bounding box feedback - Adds back toggle to hide bounding box - Box quick toggle = q, normal toggle = shift + q - Styles canvas alert icons commit 423ae3209782f1d8d321b2ed9ed00712b726adf7 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 17:06:07 2022 +1100 Improves bounding box interaction Added spacebar-hold-to-transform back. commit 8282e5d0458ca1bba5565c069093b5389f2228d4 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 16:57:07 2022 +1100 Builds fresh bundle commit 19305cdbdf6ac74833bd6011bff0ced8e9d36f69 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 16:51:11 2022 +1100 Styles image uploader commit eb9028ab3069bca9d747aca664ca60ae13ba6df8 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 16:51:03 2022 +1100 Disabled bounding box settings when locked commit 21483f5d0731bce5aa97985e722a64bf0d7cd12c Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 16:50:24 2022 +1100 Fixes silent crash when init image too large To send the mask to the server, the UI rendered the mask onto the init image and sent the whole image. The mask was then cropped by the server. If the image was too large, the app silently failed. Maybe it exceeds the websocket size limit. Fixed by cropping the mask in the UI layer, sending only bounding-box-sized mask image data. commit 82dcbac28f140aa7bd89d967bcc7fa31cb03a267 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 16:28:30 2022 +1100 Improves bounding box interactions - Bounding box can now be moved by dragging any of its edges - Bounding box does not affect drawing if already drawing a stroke - Can lock bounding box to draw directly on the bounding box edges - Removes spacebar-hold behaviour due to technical issues commit d43bd4625d64a03d90de0458ad5fcacef211a8a6 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 15:10:49 2022 +1100 Fixes hotkeys and settings buttons not working commit ea891324a2086faf8eeeeac7eaf47ae2935322fb Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 11:04:02 2022 +1100 Changes inpainting controls settings to hover commit 8fd9ea219390493f392e690eadb23c4209a4ecfc Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 11:03:41 2022 +1100 Adds missing tooltips to site header commit fb026668563b3179805819a1630c654c9ce260d9 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 11:03:25 2022 +1100 Increases workarea split padding to 1rem commit f6f5c2731b0c37089c5d7382736f973e857df712 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 11:03:10 2022 +1100 Decreases gallery width on inpainting commit b4e3f771e0314e0a18ad5cedc80b28f246fced59 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 10:54:59 2022 +1100 Fixes bugs/styling - Fixes missing web app state on new version: Adds stateReconciler to redux-persist. When we add more values to the state and then release the update app, they will be automatically merged in. Reseting web UI will be needed far less. 7159ec - Fixes console z-index - Moves reset web UI button to visible area commit 99bb9491ac97f1f733accab839ea38cdf4870ba0 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Tue Nov 1 08:35:45 2022 +1300 [WebUI] Loopback Default False commit 0453f211278a533a49fb1aee54dd989b69179c10 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 23:23:51 2022 +1300 Fresh Build For WebUI commit 9fc09aa4bda3b3e6139b026f24733a37747d373f Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 09:08:11 2022 +0100 don't log base64 progress images commit 5e87062cf809a08242d3b006b66d3bbb834ddb16 Author: spezialspezial <75758219+spezialspezial@users.noreply.github.com> Date: Wed Nov 2 00:21:27 2022 +0100 Option to directly invert the grayscale heatmap - fix commit 3e7a459990407ad1679f38d4027c19d50a9d36e3 Author: spezialspezial <75758219+spezialspezial@users.noreply.github.com> Date: Tue Nov 1 21:37:33 2022 +0100 Update txt2mask.py commit bbf4c03e500bafc8627c2a70f8b3396efeddabb3 Author: spezialspezial <75758219+spezialspezial@users.noreply.github.com> Date: Tue Nov 1 21:11:19 2022 +0100 Option to directly invert the grayscale heatmap Theoretically less work inverting the image while it's small but I can't measure a significant difference. Though, handy option to have in some cases. commit 611a3a975328a7e276c2781214d5e14108708ed7 Author: mauwii <Mauwii@outlook.de> Date: Wed Nov 2 02:23:09 2022 +0100 fix name of caching step commit 1611f0d1815022fe90d33f41c21d670251a75f29 Author: mauwii <Mauwii@outlook.de> Date: Wed Nov 2 02:18:46 2022 +0100 readd caching of sd-models - this would remove the necesarrity of the secret availability in PRs commit 08835115e4c5c0ee3587ce07ab769a04d55cb3c5 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 22:10:12 2022 -0400 pin pytorch_lightning to 1.7.7, issue #1331 commit 2d84e28d329be282b51a4cbc22f7c200d80c8f0e Merge: 533fd04e ef17aae8 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 22:11:04 2022 -0400 Merge branch 'development' of github.com:invoke-ai/InvokeAI into development commit ef17aae8abe03fd87dc6f91b3c6d2fe03375f6c5 Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 00:39:48 2022 +0100 add damian0815 to contributors list commit 0cc39f01a3c67f32873b7888e1e032d33626e269 Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 01:18:50 2022 +0100 report full size for fast latents and update conversion matrix for v1.5 commit 688d7258f185035a5924bee23322b001574da931 Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 00:33:00 2022 +0100 fix a bug that broke cross attention control index mapping commit 4513320bf161d3efdd99e2aef4f7c37472131373 Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 00:31:58 2022 +0100 save VRAM by not recombining tensors that have been sliced to save VRAM commit 533fd04ef0d1ba9d2cb25d556991b999e7d44aba Merge: 6215592b dff5681c Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 17:40:36 2022 -0400 Merge branch 'development' of github.com:invoke-ai/InvokeAI into development commit dff5681cf0e24faf67d5eb5903203c4ea39f89bd Author: damian0815 <d@d.com> Date: Tue Nov 1 13:56:03 2022 +0100 shorter strings commit 5a2790a69b11e049d2507bc22eab7812915d867f Author: damian0815 <d@d.com> Date: Tue Nov 1 13:19:20 2022 +0100 convert progress display to a drop-down commit 7c5305ccbaf7926162536aa3a9e51dcdd8574d0d Author: damian0815 <d@d.com> Date: Tue Nov 1 12:54:46 2022 +0100 do not try to save base64 intermediates in gallery on cancellation commit 4013e8ad6fa5e5c2a710c607fe7e1d040f353299 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 21:54:35 2022 +1100 Fixes b64 image sending and displaying commit d1dfd257f9e1cafd352d9007a56194226b9d6b63 Author: damian <d@d.com> Date: Tue Nov 1 11:40:40 2022 +0100 wip base64 commit 5322d735ee4515d89293b7fb015b2ce048262f68 Author: damian <d@d.com> Date: Tue Nov 1 11:31:42 2022 +0100 update frontend commit cdb107dcda858a8bb64455cc60a196a42345f8f7 Author: damian <d@d.com> Date: Tue Nov 1 11:17:43 2022 +0100 add option to show intermediate latent space commit be1393a41ce7a75ed8de7f648a93c5e5974a50d2 Author: damian <d@d.com> Date: Tue Nov 1 10:16:55 2022 +0100 ensure existing exception handling code also handles new exception class commit e554c2607f00a5e51c03052acb9861ff21ec1c12 Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Tue Nov 1 10:08:42 2022 +0100 Rebuilt prompt parsing logic Complete re-write of the prompt parsing logic to be more readable and logical, and therefore also hopefully easier to debug, maintain, and augment. In the process it has also become more robust to badly-formed prompts. Squashed commit of the following: commit 8fcfa88a16e1390d41717e940d72aed64712171c Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Sun Oct 30 17:05:57 2022 +0100 further cleanup commit 1a1fd78bcfeb49d072e3e6d5808aa8df15441629 Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Sun Oct 30 16:07:57 2022 +0100 cleanup and document commit 099c9659fa8b8135876f9a5a50fe80b20bc0635c Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Sun Oct 30 15:54:58 2022 +0100 works fully commit 5e6887ea8c25a1e21438ff6defb381fd027d25fd Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Sun Oct 30 15:24:31 2022 +0100 further... commit 492fda120844d9bc1ad4ec7dd408a3374762d0ff Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Sun Oct 30 14:08:57 2022 +0100 getting there... commit c6aab05a8450cc3c95c8691daf38fdc64c74f52d Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Fri Oct 28 14:29:03 2022 +0200 wip doesn't compile commit 5e533f731cfd20cd435330eeb0012e5689e87e81 Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Fri Oct 28 13:21:43 2022 +0200 working with CrossAttentionCtonrol but no Attention support yet commit 9678348773431e500e110e8aede99086bb7b5955 Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Fri Oct 28 13:04:52 2022 +0200 wip rebuiling prompt parser commit 6215592b12dea3822c727913b771012789a52477 Merge: ef24d76a 349cc254 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 17:34:55 2022 -0400 Merge branch 'development' of github.com:invoke-ai/InvokeAI into development commit 349cc25433e1d358c6c61cca4a6c300ecc8ca3d7 Author: damian0815 <d@d.com> Date: Tue Nov 1 20:08:52 2022 +0100 fix crash (be a little less aggressive clearing out the attention slice) commit 214d276379387ae0fa2259602ab00884ec1ad03e Author: damian0815 <d@d.com> Date: Tue Nov 1 19:57:55 2022 +0100 be more aggressive at clearing out saved_attn_slice commit ef24d76adc5a192297714707cd6794d4f44bcf67 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 14:34:23 2022 -0400 fix library problems in preload_modules commit ab2b5a691dadb292f7cecf5db94a165db3e3e126 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 17:22:48 2022 -0400 fix model_cache memory management issues commit c7de2b2801ad5d6ce52a5f44e88c5705f1dbf524 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 02:02:14 2022 +0100 disable checks with sd-V1.4 model... ...to save some resources, since V1.5 is the default now commit e8075658acf675346d35435d0cfb7710becab42a Author: mauwii <Mauwii@outlook.de> Date: Mon Oct 31 22:20:51 2022 +0100 update test-invoke-conda.yml - fix model dl path for sd-v1-4.ckpt - copy configs/models.yaml.example to configs/models.yaml commit 4202dabee1143f597f4c3946420fbfa7b8eccddf Author: mauwii <Mauwii@outlook.de> Date: Mon Oct 31 22:17:21 2022 +0100 fix models example weights for sd-v1.4 commit d67db2bcf1ac26d8bb7c5f8bfd056f2172597780 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Tue Nov 1 08:35:45 2022 +1300 [WebUI] Loopback Default False commit 7159ec885faa1117a3506689d547618be1d91808 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Mon Oct 31 11:33:05 2022 -0400 further improvements to preload_models.py - Faster startup for command line switch processing - Specify configuration file to modify using --config option: ./scripts/preload_models.ply --config models/my-models-file.yaml commit b5cf734ba9f1aeaab14075b55cc13ed9a0ae31e2 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Mon Oct 31 11:08:19 2022 -0400 improve behavior of preload_models.py - NEVER overwrite user's existing models.yaml - Instead, merge its contents into new config file, and rename original to models.yaml.orig (with message) - models.yaml has been removed from repository and renamed models.yaml.example commit f7dc8eafeef991e135b5541c01d0ff740dda9591 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Mon Oct 31 10:47:35 2022 -0400 restore models.yaml to virgin state commit 762ca60a309f70daaf1b9e79b6273f76fd9474b6 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Oct 4 22:55:10 2022 -0400 Update INPAINTING.md commit e7fb9f342cb5ed0c09e6215026d60d45eef3ebcb Author: Hideyuki Katsushiro <h.katsushiro@qualia.tokyo.jp> Date: Wed Oct 5 10:08:53 2022 +0900 add argument --outdir
2022-11-12 17:17:07 +00:00
prompt = opt.prompt or args.prompt or ''
print(f'>> using seed {seed} and prompt "{prompt}" for {image_path}')
# try to reuse the same filename prefix as the original file.
# we take everything up to the first period
prefix = None
m = re.match(r'^([^.]+)\.',os.path.basename(image_path))
if m:
prefix = m.groups()[0]
# face fixers and esrgan take an Image, but embiggen takes a path
image = Image.open(image_path)
2022-10-03 18:39:58 +00:00
# used by multiple postfixers
2022-10-23 12:58:25 +00:00
# todo: cross-attention control
2022-10-31 02:57:15 +00:00
uc, c, extra_conditioning_info = get_uc_and_c_and_ec(
use 🧨diffusers model (#1583) * initial commit of DiffusionPipeline class * spike: proof of concept using diffusers for txt2img * doc: type hints for Generator * refactor(model_cache): factor out load_ckpt * model_cache: add ability to load a diffusers model pipeline and update associated things in Generate & Generator to not instantly fail when that happens * model_cache: fix model default image dimensions * txt2img: support switching diffusers schedulers * diffusers: let the scheduler do its scaling of the initial latents Remove IPNDM scheduler; it is not behaving. * web server: update image_progress callback for diffusers data * diffusers: restore prompt weighting feature * diffusers: fix set-sampler error following model switch * diffusers: use InvokeAIDiffuserComponent for conditioning * cross_attention_control: stub (no-op) implementations for diffusers * model_cache: let offload_model work with DiffusionPipeline, sorta. * models.yaml.example: add diffusers-format model, set as default * test-invoke-conda: use diffusers-format model test-invoke-conda: put huggingface-token where the library can use it * environment-mac: upgrade to diffusers 0.7 (from 0.6) this was already done for linux; mac must have been lost in the merge. * preload_models: explicitly load diffusers models In non-interactive mode too, as long as you're logged in. * fix(model_cache): don't check `model.config` in diffusers format clean-up from recent merge. * diffusers integration: support img2img * dev: upgrade to diffusers 0.8 (from 0.7.1) We get to remove some code by using methods that were factored out in the base class. * refactor: remove backported img2img.get_timesteps now that we can use it directly from diffusers 0.8.1 * ci: use diffusers model * dev: upgrade to diffusers 0.9 (from 0.8.1) * lint: correct annotations for Python 3.9. * lint: correct AttributeError.name reference for Python 3.9. * CI: prefer diffusers-1.4 because it no longer requires a token The RunwayML models still do. * build: there's yet another place to update requirements? * configure: try to download models even without token Models in the CompVis and stabilityai repos no longer require them. (But runwayml still does.) * configure: add troubleshooting info for config-not-found * fix(configure): prepend root to config path * fix(configure): remove second `default: true` from models example * CI: simplify test-on-push logic now that we don't need secrets The "test on push but only in forks" logic was only necessary when tests didn't work for PRs-from-forks. * create an embedding_manager for diffusers * internal: avoid importing diffusers DummyObject see https://github.com/huggingface/diffusers/issues/1479 * fix "config attributes…not expected" diffusers warnings. * fix deprecated scheduler construction * work around an apparent MPS torch bug that causes conditioning to have no effect * 🚧 post-rebase repair * preliminary support for outpainting (no masking yet) * monkey-patch diffusers.attention and use Invoke lowvram code * add always_use_cpu arg to bypass MPS * add cross-attention control support to diffusers (fails on MPS) For unknown reasons MPS produces garbage output with .swap(). Use --always_use_cpu arg to invoke.py for now to test this code on MPS. * diffusers support for the inpainting model * fix debug_image to not crash with non-RGB images. * inpainting for the normal model [WIP] This seems to be performing well until the LAST STEP, at which point it dissolves to confetti. * fix off-by-one bug in cross-attention-control (#1774) prompt token sequences begin with a "beginning-of-sequence" marker <bos> and end with a repeated "end-of-sequence" marker <eos> - to make a default prompt length of <bos> + 75 prompt tokens + <eos>. the .swap() code was failing to take the column for <bos> at index 0 into account. the changes here do that, and also add extra handling for a single <eos> (which may be redundant but which is included for completeness). based on my understanding and some assumptions about how this all works, the reason .swap() nevertheless seemed to do the right thing, to some extent, is because over multiple steps the conditioning process in Stable Diffusion operates as a feedback loop. a change to token n-1 has flow-on effects to how the [1x4x64x64] latent tensor is modified by all the tokens after it, - and as the next step is processed, all the tokens before it as well. intuitively, a token's conditioning effects "echo" throughout the whole length of the prompt. so even though the token at n-1 was being edited when what the user actually wanted was to edit the token at n, it nevertheless still had some non-negligible effect, in roughly the right direction, often enough that it seemed like it was working properly. * refactor common CrossAttention stuff into a mixin so that the old ldm code can still work if necessary * inpainting for the normal model. I think it works this time. * diffusers: reset num_vectors_per_token sync with 44a00555718f1df173c60da0ed646cf700e29537 * diffusers: txt2img2img (hires_fix) with so much slicing and dicing of pipeline methods to stitch them together * refactor(diffusers): reduce some code duplication amongst the different tasks * fixup! refactor(diffusers): reduce some code duplication amongst the different tasks * diffusers: enable DPMSolver++ scheduler * diffusers: upgrade to diffusers 0.10, add Heun scheduler * diffusers(ModelCache): stopgap to make from_cpu compatible with diffusers * CI: default to diffusers-1.5 now that runwayml token requirement is gone * diffusers: update to 0.10 (and transformers to 4.25) * diffusers: use xformers when available diffusers no longer auto-enables this as of 0.10.2. * diffusers: make masked img2img behave better with multi-step schedulers re-randomizing the noise each step was confusing them. * diffusers: work more better with more models. fixed relative path problem with local models. fixed models on hub not always having a `fp16` branch. * diffusers: stopgap fix for attention_maps_callback crash after recent merge * fixup import merge conflicts correction for 061c5369a2247c6c92cd69606bcf54c4f1962a0b * test: add tests/inpainting inputs for masked img2img * diffusers(AddsMaskedGuidance): partial fix for k-schedulers Prevents them from crashing, but results are still hot garbage. * fix --safety_checker arg parsing and add note to diffusers loader about where safety checker gets called * generate: fix import error * CI: don't try to read the old init location * diffusers: support loading an alternate VAE * CI: remove sh-syntax if-statement so it doesn't crash powershell * CI: fold strings in yaml because backslash is not line-continuation in powershell * attention maps callback stuff for diffusers * build: fix syntax error in environment-mac * diffusers: add INITIAL_MODELS with diffusers-compatible repos * re-enable the embedding manager; closes #1778 * Squashed commit of the following: commit e4a956abc37fcb5cf188388b76b617bc5c8fda7d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:43:07 2022 +0100 import new load handling from EmbeddingManager and cleanup commit c4abe91a5ba0d415b45bf734068385668b7a66e6 Merge: 032e856e 1efc6397 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:09:53 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers_with_textual_inversion_manager commit 032e856eefb3bbc39534f5daafd25764bcfcef8b Merge: 8b4f0fe9 bc515e24 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:08:01 2022 +0100 Merge remote-tracking branch 'upstream/dev/diffusers' into dev/diffusers_with_textual_inversion_manager commit 1efc6397fc6e61c1aff4b0258b93089d61de5955 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:04:28 2022 +0100 cleanup and add performance notes commit e400f804ac471a0ca2ba432fd658778b20c7bdab Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:45:07 2022 +0100 fix bug and update unit tests commit deb9ae0ae1016750e93ce8275734061f7285a231 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:28:29 2022 +0100 textual inversion manager seems to work commit 162e02505dec777e91a983c4d0fb52e950d25ff0 Merge: cbad4583 12769b3d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:58:03 2022 +0100 Merge branch 'main' into feature_textual_inversion_mgr commit cbad45836c6aace6871a90f2621a953f49433131 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:54:10 2022 +0100 use position embeddings commit 070344c69b0e0db340a183857d0a787b348681d3 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:53:47 2022 +0100 Don't crash CLI on exceptions commit b035ac8c6772dfd9ba41b8eeb9103181cda028f8 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:11:55 2022 +0100 add missing position_embeddings commit 12769b3d3562ef71e0f54946b532ad077e10043c Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:33:25 2022 +0100 debugging why it don't work commit bafb7215eabe1515ca5e8388fd3bb2f3ac5362cf Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:21:33 2022 +0100 debugging why it don't work commit 664a6e9e146b42d96703f0cc8baf8f5efec04ee1 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit 8b4f0fe9d6e4e2643b36dfa27864294785d7ba4e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit ffbe1ab11163ba712e353d89404e301d0e0c6cdf Merge: 6e4dad60 023df37e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:37:31 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers commit 023df37efffa67434f77def7fc3c9dfb29f699fd Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:36:54 2022 +0100 cleanup commit 05fac594eaf79d0058e3c48deee93df603f136c2 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:07:49 2022 +0100 tweak error checking commit 009f32ed39a7280997c3ffab112adadee0b44279 Author: damian <null@damianstewart.com> Date: Thu Dec 15 21:29:47 2022 +0100 unit tests passing for embeddings with vector length >1 commit beb1b08d9a98112ed2fe073580568e1a18698da3 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:39:09 2022 +0100 more explicit equality tests when overwriting commit 44d8a5a7c85cdabc9ce3a54fd0769a10597b3ca9 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:30:13 2022 +0100 wip textual inversion manager (unit tests passing for 1v embedding overwriting) commit 417c2b57d90924a839616bfb66804faab8039e4c Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 12:30:55 2022 +0100 wip textual inversion manager (unit tests passing for base stuff + padding) commit 2e80872e3b6f7fd7d8eb8928822bd824b63cb2ff Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 10:57:57 2022 +0100 wip new TextualInversionManager * stop using WeightedFrozenCLIPEmbedder * store diffusion models locally - configure_invokeai.py reconfigured to store diffusion models rather than CompVis models - hugging face caching model is used, but cache is set to ~/invokeai/models/repo_id - models.yaml does **NOT** use path, just repo_id - "repo_name" changed to "repo_id" to following hugging face conventions - Models are loaded with full precision pending further work. * allow non-local files during development * path takes priority over repo_id * MVP for model_cache and configure_invokeai - Feature complete (almost) - configure_invokeai.py downloads both .ckpt and diffuser models, along with their VAEs. Both types of download are controlled by a unified INITIAL_MODELS.yaml file. - model_cache can load both type of model and switches back and forth in CPU. No memory leaks detected TO DO: 1. I have not yet turned on the LocalOnly flag for diffuser models, so the code will check the Hugging Face repo for updates before using the locally cached models. This will break firewalled systems. I am thinking of putting in a global check for internet connectivity at startup time and setting the LocalOnly flag based on this. It would be good to check updates if there is connectivity. 2. I have not gone completely through INITIAL_MODELS.yaml to check which models are available as diffusers and which are not. So models like PaperCut and VoxelArt may not load properly. The runway and stability models are checked, as well as the Trinart models. 3. Add stanzas for SD 2.0 and 2.1 in INITIAL_MODELS.yaml REMAINING PROBLEMS NOT DIRECTLY RELATED TO MODEL_CACHE: 1. When loading a .ckpt file there are lots of messages like this: Warning! ldm.modules.attention.CrossAttention is no longer being maintained. Please use InvokeAICrossAttention instead. I'm not sure how to address this. 2. The ckpt models ***don't actually run*** due to the lack of special-case support for them in the generator objects. For example, here's the hard crash you get when you run txt2img against the legacy waifu-diffusion-1.3 model: ``` >> An error occurred: Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 140, in main main_loop(gen, opt) File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 371, in main_loop gen.prompt2image( File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1265, in __getattr__ raise AttributeError("'{}' object has no attribute '{}'".format( AttributeError: 'LatentDiffusion' object has no attribute 'image_from_embeddings' ``` 3. The inpainting diffusion model isn't working. Here's the output of "banana sushi" when inpainting-1.5 is loaded: ``` Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 301, in image_from_embeddings result_latents, result_attention_map_saver = self.latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 330, in latents_from_embeddings result: PipelineIntermediateState = infer_latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 185, in __call__ for result in self.generator_method(*args, **kwargs): File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 367, in generate_latents_from_embeddings step_output = self.step(batched_t, latents, guidance_scale, File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context return func(*args, **kwargs) File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 409, in step step_output = self.scheduler.step(noise_pred, timestep, latents, **extra_step_kwargs) File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/diffusers/schedulers/scheduling_lms_discrete.py", line 223, in step pred_original_sample = sample - sigma * model_output RuntimeError: The size of tensor a (9) must match the size of tensor b (4) at non-singleton dimension 1 ``` * proper support for float32/float16 - configure script now correctly detects user's preference for fp16/32 and downloads the correct diffuser version. If fp16 version not available, falls back to fp32 version. - misc code cleanup and simplification in model_cache * add on-the-fly conversion of .ckpt to diffusers models 1. On-the-fly conversion code can be found in the file ldm/invoke/ckpt_to_diffusers.py. 2. A new !optimize command has been added to the CLI. Should be ported to Web GUI. User experience on the CLI is this: ``` invoke> !optimize /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt INFO: Converting legacy weights file /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt to optimized diffuser model. This operation will take 30-60s to complete. Success. Optimized model is now located at /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 Writing new config file entry for sd-v1-4... >> New configuration: sd-v1-4: description: Optimized version of sd-v1-4 format: diffusers path: /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 OK to import [n]? y >> Verifying that new model loads... >> Current VRAM usage: 2.60G >> Offloading stable-diffusion-2.1 to CPU >> Loading diffusers model from /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 | Using faster float16 precision You have disabled the safety checker for <class 'ldm.invoke.generator.diffusers_pipeline.StableDiffusionGeneratorPipeline'> by passing `safety_checker=None`. Ensure that you abide to the conditions of the Stable Diffusion \ license and do not expose unfiltered results in services or applications open to the public. Both the diffusers team and Hugging Face strongly recommend to keep the safety filter enabled in all public facing circumstances,\ disabling it only for use-cases that involve analyzing network behavior or auditing its results. For more information, please have a look at https://github.com/huggingface/diffusers/pull/254 . | training width x height = (512 x 512) >> Model loaded in 3.48s >> Max VRAM used to load the model: 2.17G >> Current VRAM usage:2.17G >> Textual inversions available: >> Setting Sampler to k_lms (LMSDiscreteScheduler) Keep model loaded? [y] ``` * add parallel set of generator files for ckpt legacy generation * generation using legacy ckpt models now working * diffusers: fix missing attention_maps_callback fix for 23eb80b40421b2bb8f4b6d3dd30490d11c447b36 * associate legacy CrossAttention with .ckpt models * enable autoconvert New --autoconvert CLI option will scan a designated directory for new .ckpt files, convert them into diffuser models, and import them into models.yaml. Works like this: invoke.py --autoconvert /path/to/weights/directory In ModelCache added two new methods: autoconvert_weights(config_path, weights_directory_path, models_directory_path) convert_and_import(ckpt_path, diffuser_path) * diffusers: update to diffusers 0.11 (from 0.10.2) * fix vae loading & width/height calculation * refactor: encapsulate these conditioning data into one container * diffusers: fix some noise-scaling issues by pushing the noise-mixing down to the common function * add support for safetensors and accelerate * set local_files_only when internet unreachable * diffusers: fix error-handling path when model repo has no fp16 branch * fix generatorinpaint error Fixes : "ModuleNotFoundError: No module named 'ldm.invoke.generatorinpaint' https://github.com/invoke-ai/InvokeAI/pull/1583#issuecomment-1363634318 * quench diffuser safety-checker warning * diffusers: support stochastic DDIM eta parameter * fix conda env creation on macos * fix cross-attention with diffusers 0.11 * diffusers: the VAE needs to be tiling as well as the U-Net * diffusers: comment on subfolders * diffusers: embiggen! * diffusers: make model_cache.list_models serializable * diffusers(inpaint): restore scaling functionality * fix requirements clash between numba and numpy 1.24 * diffusers: allow inpainting model to do non-inpainting tasks * start expanding model_cache functionality * add import_ckpt_model() and import_diffuser_model() methods to model_manager - in addition, model_cache.py is now renamed to model_manager.py * allow "recommended" flag to be optional in INITIAL_MODELS.yaml * configure_invokeai now downloads VAE diffusers in advance * rename ModelCache to ModelManager * remove support for `repo_name` in models.yaml * check for and refuse to load embeddings trained on incompatible models * models.yaml.example: s/repo_name/repo_id and remove extra INITIAL_MODELS now that the main one has diffusers models in it. * add MVP textual inversion script * refactor(InvokeAIDiffuserComponent): factor out _combine() * InvokeAIDiffuserComponent: implement threshold * InvokeAIDiffuserComponent: diagnostic logs for threshold ...this does not look right * add a curses-based frontend to textual inversion - not quite working yet - requires npyscreen installed - on windows will also have the windows-curses requirement, but not added to requirements yet * add curses-based interface for textual inversion * fix crash in convert_and_import() - This corrects a "local variable referenced before assignment" error in model_manager.convert_and_import() * potential workaround for no 'state_dict' key error - As reported in https://github.com/huggingface/diffusers/issues/1876 * create TI output dir if needed * Update environment-lin-cuda.yml (#2159) Fixing line 42 to be the proper order to define the transformers requirement: ~= instead of =~ * diffusers: update sampler-to-scheduler mapping based on https://github.com/huggingface/diffusers/issues/277#issuecomment-1371428672 * improve user exp for ckt to diffusers conversion - !optimize_models command now operates on an existing ckpt file entry in models.yaml - replaces existing entry, rather than adding a new one - offers to delete the ckpt file after conversion * web: adapt progress callback to deal with old generator or new diffusers pipeline * clean-up model_manager code - add_model() verified to work for .ckpt local paths, .ckpt remote URLs, diffusers local paths, and diffusers repo_ids - convert_and_import() verified to work for local and remove .ckpt files * handle edge cases for import_model() and convert_model() * add support for safetensor .ckpt files * fix name error * code cleanup with pyflake * improve model setting behavior - If the user enters an invalid model name at startup time, will not try to load it, warn, and use default model - CLI UI enhancement: include currently active model in the command line prompt. * update test-invoke-pip.yml - fix model cache path to point to runwayml/stable-diffusion-v1-5 - remove `skip-sd-weights` from configure_invokeai.py args * exclude dev/diffusers from "fail for draft PRs" * disable "fail on PR jobs" * re-add `--skip-sd-weights` since no space * update workflow environments - include `INVOKE_MODEL_RECONFIGURE: '--yes'` * clean up model load failure handling - Allow CLI to run even when no model is defined or loadable. - Inhibit stack trace when model load fails - only show last error - Give user *option* to run configure_invokeai.py when no models successfully load. - Restart invokeai after reconfiguration. * further edge-case handling 1) only one model in models.yaml file, and that model is broken 2) no models in models.yaml 3) models.yaml doesn't exist at all * fix incorrect model status listing - "cached" was not being returned from list_models() - normalize handling of exceptions during model loading: - Passing an invalid model name to generate.set_model() will return a KeyError - All other exceptions are returned as the appropriate Exception * CI: do download weights (if not already cached) * diffusers: fix scheduler loading in offline mode * CI: fix model name (no longer has `diffusers-` prefix) * Update txt2img2img.py (#2256) * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * feat - make model storage compatible with hugging face caching system This commit alters the InvokeAI model directory to be compatible with hugging face, making it easier to share diffusers (and other models) across different programs. - If the HF_HOME environment variable is not set, then models are cached in ~/invokeai/models in a format that is identical to the HuggingFace cache. - If HF_HOME is set, then models are cached wherever HF_HOME points. - To enable sharing with other HuggingFace library clients, set HF_HOME to ~/.cache/huggingface to set the default cache location or to ~/invokeai/models to have huggingface cache inside InvokeAI. * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * fix error "no attribute CkptInpaint" * model_manager.list_models() returns entire model config stanza+status * Initial Draft - Model Manager Diffusers * added hash function to diffusers * implement sha256 hashes on diffusers models * Add Model Manager Support for Diffusers * fix various problems with model manager - in cli import functions, fix not enough values to unpack from _get_name_and_desc() - fix crash when using old-style vae: value with new-style diffuser * rebuild frontend * fix dictconfig-not-serializable issue * fix NoneType' object is not subscriptable crash in model_manager * fix "str has no attribute get" error in model_manager list_models() * Add path and repo_id support for Diffusers Model Manager Also fixes bugs * Fix tooltip IT localization not working * Add Version Number To WebUI * Optimize Model Search * Fix incorrect font on the Model Manager UI * Fix image degradation on merge fixes - [Experimental] This change should effectively fix a couple of things. - Fix image degradation on subsequent merges of the canvas layers. - Fix the slight transparent border that is left behind when filling the bounding box with a color. - Fix the left over line of color when filling a bounding box with color. So far there are no side effects for this. If any, please report. * Add local model filtering for Diffusers / Checkpoints * Go to home on modal close for the Add Modal UI * Styling Fixes * Model Manager Diffusers Localization Update * Add Safe Tensor scanning to Model Manager * Fix model edit form dispatching string values instead of numbers. * Resolve VAE handling / edge cases for supplied repos * defer injecting tokens for textual inversions until they're used for the first time * squash a console warning * implement model migration check * add_model() overwrites previous config rather than merges * fix model config file attribute merging * fix precision handling in textual inversion script * allow ckpt conversion script to work with safetensors .ckpts Applied patch here: https://github.com/huggingface/diffusers/commit/beb932c5d111872c5e45387e7b1b2b3dd0524a47 * fix name "args" is not defined crash in textual_inversion_training * fix a second NameError: name 'args' is not defined crash * fix loading of the safety checker from the global cache dir * add installation step to textual inversion frontend - After a successful training run, the script will copy learned_embeds.bin to a subfolder of the embeddings directory. - User given the option to delete the logs and intermediate checkpoints (which together use 7-8G of space) - If textual inversion training fails, reports the error gracefully. * don't crash out on incompatible embeddings - put try: blocks around places where the system tries to load an embedding which is incompatible with the currently loaded model * add support for checkpoint resuming * textual inversion preferences are saved and restored between sessions - Preferences are stored in a file named text-inversion-training/preferences.conf - Currently the resume-from-checkpoint option is not working correctly. Possible bug in textual_inversion_training.py? * copy learned_embeddings.bin into right location * add front end for diffusers model merging - Front end doesn't do anything yet!!!! - Made change to model name parsing in CLI to support ability to have merged models with the "+" character in their names. * improve inpainting experience - recommend ckpt version of inpainting-1.5 to user - fix get_noise() bug in ckpt version of omnibus.py * update environment*yml * tweak instructions to install HuggingFace token * bump version number * enhance update scripts - update scripts will now fetch new INITIAL_MODELS.yaml so that configure_invokeai.py will know about the diffusers versions. * enhance invoke.sh/invoke.bat launchers - added configure_invokeai.py to menu - menu defaults to browser-based invoke * remove conda workflow (#2321) * fix `token_ids has shape torch.Size([79]) - expected [77]` * update CHANGELOG.md with 2.3.* info - Add information on how formats have changed and the upgrade process. - Add short bug list. Co-authored-by: Damian Stewart <d@damianstewart.com> Co-authored-by: Damian Stewart <null@damianstewart.com> Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> Co-authored-by: Wybartel-luxmc <37852506+Wybartel-luxmc@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> Co-authored-by: mickr777 <115216705+mickr777@users.noreply.github.com> Co-authored-by: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Co-authored-by: Eugene Brodsky <ebr@users.noreply.github.com> Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com>
2023-01-15 14:22:46 +00:00
prompt, model=self.model,
skip_normalize_legacy_blend=opt.skip_normalize,
use 🧨diffusers model (#1583) * initial commit of DiffusionPipeline class * spike: proof of concept using diffusers for txt2img * doc: type hints for Generator * refactor(model_cache): factor out load_ckpt * model_cache: add ability to load a diffusers model pipeline and update associated things in Generate & Generator to not instantly fail when that happens * model_cache: fix model default image dimensions * txt2img: support switching diffusers schedulers * diffusers: let the scheduler do its scaling of the initial latents Remove IPNDM scheduler; it is not behaving. * web server: update image_progress callback for diffusers data * diffusers: restore prompt weighting feature * diffusers: fix set-sampler error following model switch * diffusers: use InvokeAIDiffuserComponent for conditioning * cross_attention_control: stub (no-op) implementations for diffusers * model_cache: let offload_model work with DiffusionPipeline, sorta. * models.yaml.example: add diffusers-format model, set as default * test-invoke-conda: use diffusers-format model test-invoke-conda: put huggingface-token where the library can use it * environment-mac: upgrade to diffusers 0.7 (from 0.6) this was already done for linux; mac must have been lost in the merge. * preload_models: explicitly load diffusers models In non-interactive mode too, as long as you're logged in. * fix(model_cache): don't check `model.config` in diffusers format clean-up from recent merge. * diffusers integration: support img2img * dev: upgrade to diffusers 0.8 (from 0.7.1) We get to remove some code by using methods that were factored out in the base class. * refactor: remove backported img2img.get_timesteps now that we can use it directly from diffusers 0.8.1 * ci: use diffusers model * dev: upgrade to diffusers 0.9 (from 0.8.1) * lint: correct annotations for Python 3.9. * lint: correct AttributeError.name reference for Python 3.9. * CI: prefer diffusers-1.4 because it no longer requires a token The RunwayML models still do. * build: there's yet another place to update requirements? * configure: try to download models even without token Models in the CompVis and stabilityai repos no longer require them. (But runwayml still does.) * configure: add troubleshooting info for config-not-found * fix(configure): prepend root to config path * fix(configure): remove second `default: true` from models example * CI: simplify test-on-push logic now that we don't need secrets The "test on push but only in forks" logic was only necessary when tests didn't work for PRs-from-forks. * create an embedding_manager for diffusers * internal: avoid importing diffusers DummyObject see https://github.com/huggingface/diffusers/issues/1479 * fix "config attributes…not expected" diffusers warnings. * fix deprecated scheduler construction * work around an apparent MPS torch bug that causes conditioning to have no effect * 🚧 post-rebase repair * preliminary support for outpainting (no masking yet) * monkey-patch diffusers.attention and use Invoke lowvram code * add always_use_cpu arg to bypass MPS * add cross-attention control support to diffusers (fails on MPS) For unknown reasons MPS produces garbage output with .swap(). Use --always_use_cpu arg to invoke.py for now to test this code on MPS. * diffusers support for the inpainting model * fix debug_image to not crash with non-RGB images. * inpainting for the normal model [WIP] This seems to be performing well until the LAST STEP, at which point it dissolves to confetti. * fix off-by-one bug in cross-attention-control (#1774) prompt token sequences begin with a "beginning-of-sequence" marker <bos> and end with a repeated "end-of-sequence" marker <eos> - to make a default prompt length of <bos> + 75 prompt tokens + <eos>. the .swap() code was failing to take the column for <bos> at index 0 into account. the changes here do that, and also add extra handling for a single <eos> (which may be redundant but which is included for completeness). based on my understanding and some assumptions about how this all works, the reason .swap() nevertheless seemed to do the right thing, to some extent, is because over multiple steps the conditioning process in Stable Diffusion operates as a feedback loop. a change to token n-1 has flow-on effects to how the [1x4x64x64] latent tensor is modified by all the tokens after it, - and as the next step is processed, all the tokens before it as well. intuitively, a token's conditioning effects "echo" throughout the whole length of the prompt. so even though the token at n-1 was being edited when what the user actually wanted was to edit the token at n, it nevertheless still had some non-negligible effect, in roughly the right direction, often enough that it seemed like it was working properly. * refactor common CrossAttention stuff into a mixin so that the old ldm code can still work if necessary * inpainting for the normal model. I think it works this time. * diffusers: reset num_vectors_per_token sync with 44a00555718f1df173c60da0ed646cf700e29537 * diffusers: txt2img2img (hires_fix) with so much slicing and dicing of pipeline methods to stitch them together * refactor(diffusers): reduce some code duplication amongst the different tasks * fixup! refactor(diffusers): reduce some code duplication amongst the different tasks * diffusers: enable DPMSolver++ scheduler * diffusers: upgrade to diffusers 0.10, add Heun scheduler * diffusers(ModelCache): stopgap to make from_cpu compatible with diffusers * CI: default to diffusers-1.5 now that runwayml token requirement is gone * diffusers: update to 0.10 (and transformers to 4.25) * diffusers: use xformers when available diffusers no longer auto-enables this as of 0.10.2. * diffusers: make masked img2img behave better with multi-step schedulers re-randomizing the noise each step was confusing them. * diffusers: work more better with more models. fixed relative path problem with local models. fixed models on hub not always having a `fp16` branch. * diffusers: stopgap fix for attention_maps_callback crash after recent merge * fixup import merge conflicts correction for 061c5369a2247c6c92cd69606bcf54c4f1962a0b * test: add tests/inpainting inputs for masked img2img * diffusers(AddsMaskedGuidance): partial fix for k-schedulers Prevents them from crashing, but results are still hot garbage. * fix --safety_checker arg parsing and add note to diffusers loader about where safety checker gets called * generate: fix import error * CI: don't try to read the old init location * diffusers: support loading an alternate VAE * CI: remove sh-syntax if-statement so it doesn't crash powershell * CI: fold strings in yaml because backslash is not line-continuation in powershell * attention maps callback stuff for diffusers * build: fix syntax error in environment-mac * diffusers: add INITIAL_MODELS with diffusers-compatible repos * re-enable the embedding manager; closes #1778 * Squashed commit of the following: commit e4a956abc37fcb5cf188388b76b617bc5c8fda7d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:43:07 2022 +0100 import new load handling from EmbeddingManager and cleanup commit c4abe91a5ba0d415b45bf734068385668b7a66e6 Merge: 032e856e 1efc6397 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:09:53 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers_with_textual_inversion_manager commit 032e856eefb3bbc39534f5daafd25764bcfcef8b Merge: 8b4f0fe9 bc515e24 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:08:01 2022 +0100 Merge remote-tracking branch 'upstream/dev/diffusers' into dev/diffusers_with_textual_inversion_manager commit 1efc6397fc6e61c1aff4b0258b93089d61de5955 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:04:28 2022 +0100 cleanup and add performance notes commit e400f804ac471a0ca2ba432fd658778b20c7bdab Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:45:07 2022 +0100 fix bug and update unit tests commit deb9ae0ae1016750e93ce8275734061f7285a231 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:28:29 2022 +0100 textual inversion manager seems to work commit 162e02505dec777e91a983c4d0fb52e950d25ff0 Merge: cbad4583 12769b3d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:58:03 2022 +0100 Merge branch 'main' into feature_textual_inversion_mgr commit cbad45836c6aace6871a90f2621a953f49433131 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:54:10 2022 +0100 use position embeddings commit 070344c69b0e0db340a183857d0a787b348681d3 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:53:47 2022 +0100 Don't crash CLI on exceptions commit b035ac8c6772dfd9ba41b8eeb9103181cda028f8 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:11:55 2022 +0100 add missing position_embeddings commit 12769b3d3562ef71e0f54946b532ad077e10043c Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:33:25 2022 +0100 debugging why it don't work commit bafb7215eabe1515ca5e8388fd3bb2f3ac5362cf Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:21:33 2022 +0100 debugging why it don't work commit 664a6e9e146b42d96703f0cc8baf8f5efec04ee1 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit 8b4f0fe9d6e4e2643b36dfa27864294785d7ba4e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit ffbe1ab11163ba712e353d89404e301d0e0c6cdf Merge: 6e4dad60 023df37e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:37:31 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers commit 023df37efffa67434f77def7fc3c9dfb29f699fd Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:36:54 2022 +0100 cleanup commit 05fac594eaf79d0058e3c48deee93df603f136c2 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:07:49 2022 +0100 tweak error checking commit 009f32ed39a7280997c3ffab112adadee0b44279 Author: damian <null@damianstewart.com> Date: Thu Dec 15 21:29:47 2022 +0100 unit tests passing for embeddings with vector length >1 commit beb1b08d9a98112ed2fe073580568e1a18698da3 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:39:09 2022 +0100 more explicit equality tests when overwriting commit 44d8a5a7c85cdabc9ce3a54fd0769a10597b3ca9 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:30:13 2022 +0100 wip textual inversion manager (unit tests passing for 1v embedding overwriting) commit 417c2b57d90924a839616bfb66804faab8039e4c Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 12:30:55 2022 +0100 wip textual inversion manager (unit tests passing for base stuff + padding) commit 2e80872e3b6f7fd7d8eb8928822bd824b63cb2ff Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 10:57:57 2022 +0100 wip new TextualInversionManager * stop using WeightedFrozenCLIPEmbedder * store diffusion models locally - configure_invokeai.py reconfigured to store diffusion models rather than CompVis models - hugging face caching model is used, but cache is set to ~/invokeai/models/repo_id - models.yaml does **NOT** use path, just repo_id - "repo_name" changed to "repo_id" to following hugging face conventions - Models are loaded with full precision pending further work. * allow non-local files during development * path takes priority over repo_id * MVP for model_cache and configure_invokeai - Feature complete (almost) - configure_invokeai.py downloads both .ckpt and diffuser models, along with their VAEs. Both types of download are controlled by a unified INITIAL_MODELS.yaml file. - model_cache can load both type of model and switches back and forth in CPU. No memory leaks detected TO DO: 1. I have not yet turned on the LocalOnly flag for diffuser models, so the code will check the Hugging Face repo for updates before using the locally cached models. This will break firewalled systems. I am thinking of putting in a global check for internet connectivity at startup time and setting the LocalOnly flag based on this. It would be good to check updates if there is connectivity. 2. I have not gone completely through INITIAL_MODELS.yaml to check which models are available as diffusers and which are not. So models like PaperCut and VoxelArt may not load properly. The runway and stability models are checked, as well as the Trinart models. 3. Add stanzas for SD 2.0 and 2.1 in INITIAL_MODELS.yaml REMAINING PROBLEMS NOT DIRECTLY RELATED TO MODEL_CACHE: 1. When loading a .ckpt file there are lots of messages like this: Warning! ldm.modules.attention.CrossAttention is no longer being maintained. Please use InvokeAICrossAttention instead. I'm not sure how to address this. 2. The ckpt models ***don't actually run*** due to the lack of special-case support for them in the generator objects. For example, here's the hard crash you get when you run txt2img against the legacy waifu-diffusion-1.3 model: ``` >> An error occurred: Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 140, in main main_loop(gen, opt) File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 371, in main_loop gen.prompt2image( File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1265, in __getattr__ raise AttributeError("'{}' object has no attribute '{}'".format( AttributeError: 'LatentDiffusion' object has no attribute 'image_from_embeddings' ``` 3. The inpainting diffusion model isn't working. Here's the output of "banana sushi" when inpainting-1.5 is loaded: ``` Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 301, in image_from_embeddings result_latents, result_attention_map_saver = self.latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 330, in latents_from_embeddings result: PipelineIntermediateState = infer_latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 185, in __call__ for result in self.generator_method(*args, **kwargs): File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 367, in generate_latents_from_embeddings step_output = self.step(batched_t, latents, guidance_scale, File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context return func(*args, **kwargs) File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 409, in step step_output = self.scheduler.step(noise_pred, timestep, latents, **extra_step_kwargs) File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/diffusers/schedulers/scheduling_lms_discrete.py", line 223, in step pred_original_sample = sample - sigma * model_output RuntimeError: The size of tensor a (9) must match the size of tensor b (4) at non-singleton dimension 1 ``` * proper support for float32/float16 - configure script now correctly detects user's preference for fp16/32 and downloads the correct diffuser version. If fp16 version not available, falls back to fp32 version. - misc code cleanup and simplification in model_cache * add on-the-fly conversion of .ckpt to diffusers models 1. On-the-fly conversion code can be found in the file ldm/invoke/ckpt_to_diffusers.py. 2. A new !optimize command has been added to the CLI. Should be ported to Web GUI. User experience on the CLI is this: ``` invoke> !optimize /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt INFO: Converting legacy weights file /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt to optimized diffuser model. This operation will take 30-60s to complete. Success. Optimized model is now located at /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 Writing new config file entry for sd-v1-4... >> New configuration: sd-v1-4: description: Optimized version of sd-v1-4 format: diffusers path: /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 OK to import [n]? y >> Verifying that new model loads... >> Current VRAM usage: 2.60G >> Offloading stable-diffusion-2.1 to CPU >> Loading diffusers model from /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 | Using faster float16 precision You have disabled the safety checker for <class 'ldm.invoke.generator.diffusers_pipeline.StableDiffusionGeneratorPipeline'> by passing `safety_checker=None`. Ensure that you abide to the conditions of the Stable Diffusion \ license and do not expose unfiltered results in services or applications open to the public. Both the diffusers team and Hugging Face strongly recommend to keep the safety filter enabled in all public facing circumstances,\ disabling it only for use-cases that involve analyzing network behavior or auditing its results. For more information, please have a look at https://github.com/huggingface/diffusers/pull/254 . | training width x height = (512 x 512) >> Model loaded in 3.48s >> Max VRAM used to load the model: 2.17G >> Current VRAM usage:2.17G >> Textual inversions available: >> Setting Sampler to k_lms (LMSDiscreteScheduler) Keep model loaded? [y] ``` * add parallel set of generator files for ckpt legacy generation * generation using legacy ckpt models now working * diffusers: fix missing attention_maps_callback fix for 23eb80b40421b2bb8f4b6d3dd30490d11c447b36 * associate legacy CrossAttention with .ckpt models * enable autoconvert New --autoconvert CLI option will scan a designated directory for new .ckpt files, convert them into diffuser models, and import them into models.yaml. Works like this: invoke.py --autoconvert /path/to/weights/directory In ModelCache added two new methods: autoconvert_weights(config_path, weights_directory_path, models_directory_path) convert_and_import(ckpt_path, diffuser_path) * diffusers: update to diffusers 0.11 (from 0.10.2) * fix vae loading & width/height calculation * refactor: encapsulate these conditioning data into one container * diffusers: fix some noise-scaling issues by pushing the noise-mixing down to the common function * add support for safetensors and accelerate * set local_files_only when internet unreachable * diffusers: fix error-handling path when model repo has no fp16 branch * fix generatorinpaint error Fixes : "ModuleNotFoundError: No module named 'ldm.invoke.generatorinpaint' https://github.com/invoke-ai/InvokeAI/pull/1583#issuecomment-1363634318 * quench diffuser safety-checker warning * diffusers: support stochastic DDIM eta parameter * fix conda env creation on macos * fix cross-attention with diffusers 0.11 * diffusers: the VAE needs to be tiling as well as the U-Net * diffusers: comment on subfolders * diffusers: embiggen! * diffusers: make model_cache.list_models serializable * diffusers(inpaint): restore scaling functionality * fix requirements clash between numba and numpy 1.24 * diffusers: allow inpainting model to do non-inpainting tasks * start expanding model_cache functionality * add import_ckpt_model() and import_diffuser_model() methods to model_manager - in addition, model_cache.py is now renamed to model_manager.py * allow "recommended" flag to be optional in INITIAL_MODELS.yaml * configure_invokeai now downloads VAE diffusers in advance * rename ModelCache to ModelManager * remove support for `repo_name` in models.yaml * check for and refuse to load embeddings trained on incompatible models * models.yaml.example: s/repo_name/repo_id and remove extra INITIAL_MODELS now that the main one has diffusers models in it. * add MVP textual inversion script * refactor(InvokeAIDiffuserComponent): factor out _combine() * InvokeAIDiffuserComponent: implement threshold * InvokeAIDiffuserComponent: diagnostic logs for threshold ...this does not look right * add a curses-based frontend to textual inversion - not quite working yet - requires npyscreen installed - on windows will also have the windows-curses requirement, but not added to requirements yet * add curses-based interface for textual inversion * fix crash in convert_and_import() - This corrects a "local variable referenced before assignment" error in model_manager.convert_and_import() * potential workaround for no 'state_dict' key error - As reported in https://github.com/huggingface/diffusers/issues/1876 * create TI output dir if needed * Update environment-lin-cuda.yml (#2159) Fixing line 42 to be the proper order to define the transformers requirement: ~= instead of =~ * diffusers: update sampler-to-scheduler mapping based on https://github.com/huggingface/diffusers/issues/277#issuecomment-1371428672 * improve user exp for ckt to diffusers conversion - !optimize_models command now operates on an existing ckpt file entry in models.yaml - replaces existing entry, rather than adding a new one - offers to delete the ckpt file after conversion * web: adapt progress callback to deal with old generator or new diffusers pipeline * clean-up model_manager code - add_model() verified to work for .ckpt local paths, .ckpt remote URLs, diffusers local paths, and diffusers repo_ids - convert_and_import() verified to work for local and remove .ckpt files * handle edge cases for import_model() and convert_model() * add support for safetensor .ckpt files * fix name error * code cleanup with pyflake * improve model setting behavior - If the user enters an invalid model name at startup time, will not try to load it, warn, and use default model - CLI UI enhancement: include currently active model in the command line prompt. * update test-invoke-pip.yml - fix model cache path to point to runwayml/stable-diffusion-v1-5 - remove `skip-sd-weights` from configure_invokeai.py args * exclude dev/diffusers from "fail for draft PRs" * disable "fail on PR jobs" * re-add `--skip-sd-weights` since no space * update workflow environments - include `INVOKE_MODEL_RECONFIGURE: '--yes'` * clean up model load failure handling - Allow CLI to run even when no model is defined or loadable. - Inhibit stack trace when model load fails - only show last error - Give user *option* to run configure_invokeai.py when no models successfully load. - Restart invokeai after reconfiguration. * further edge-case handling 1) only one model in models.yaml file, and that model is broken 2) no models in models.yaml 3) models.yaml doesn't exist at all * fix incorrect model status listing - "cached" was not being returned from list_models() - normalize handling of exceptions during model loading: - Passing an invalid model name to generate.set_model() will return a KeyError - All other exceptions are returned as the appropriate Exception * CI: do download weights (if not already cached) * diffusers: fix scheduler loading in offline mode * CI: fix model name (no longer has `diffusers-` prefix) * Update txt2img2img.py (#2256) * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * feat - make model storage compatible with hugging face caching system This commit alters the InvokeAI model directory to be compatible with hugging face, making it easier to share diffusers (and other models) across different programs. - If the HF_HOME environment variable is not set, then models are cached in ~/invokeai/models in a format that is identical to the HuggingFace cache. - If HF_HOME is set, then models are cached wherever HF_HOME points. - To enable sharing with other HuggingFace library clients, set HF_HOME to ~/.cache/huggingface to set the default cache location or to ~/invokeai/models to have huggingface cache inside InvokeAI. * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * fix error "no attribute CkptInpaint" * model_manager.list_models() returns entire model config stanza+status * Initial Draft - Model Manager Diffusers * added hash function to diffusers * implement sha256 hashes on diffusers models * Add Model Manager Support for Diffusers * fix various problems with model manager - in cli import functions, fix not enough values to unpack from _get_name_and_desc() - fix crash when using old-style vae: value with new-style diffuser * rebuild frontend * fix dictconfig-not-serializable issue * fix NoneType' object is not subscriptable crash in model_manager * fix "str has no attribute get" error in model_manager list_models() * Add path and repo_id support for Diffusers Model Manager Also fixes bugs * Fix tooltip IT localization not working * Add Version Number To WebUI * Optimize Model Search * Fix incorrect font on the Model Manager UI * Fix image degradation on merge fixes - [Experimental] This change should effectively fix a couple of things. - Fix image degradation on subsequent merges of the canvas layers. - Fix the slight transparent border that is left behind when filling the bounding box with a color. - Fix the left over line of color when filling a bounding box with color. So far there are no side effects for this. If any, please report. * Add local model filtering for Diffusers / Checkpoints * Go to home on modal close for the Add Modal UI * Styling Fixes * Model Manager Diffusers Localization Update * Add Safe Tensor scanning to Model Manager * Fix model edit form dispatching string values instead of numbers. * Resolve VAE handling / edge cases for supplied repos * defer injecting tokens for textual inversions until they're used for the first time * squash a console warning * implement model migration check * add_model() overwrites previous config rather than merges * fix model config file attribute merging * fix precision handling in textual inversion script * allow ckpt conversion script to work with safetensors .ckpts Applied patch here: https://github.com/huggingface/diffusers/commit/beb932c5d111872c5e45387e7b1b2b3dd0524a47 * fix name "args" is not defined crash in textual_inversion_training * fix a second NameError: name 'args' is not defined crash * fix loading of the safety checker from the global cache dir * add installation step to textual inversion frontend - After a successful training run, the script will copy learned_embeds.bin to a subfolder of the embeddings directory. - User given the option to delete the logs and intermediate checkpoints (which together use 7-8G of space) - If textual inversion training fails, reports the error gracefully. * don't crash out on incompatible embeddings - put try: blocks around places where the system tries to load an embedding which is incompatible with the currently loaded model * add support for checkpoint resuming * textual inversion preferences are saved and restored between sessions - Preferences are stored in a file named text-inversion-training/preferences.conf - Currently the resume-from-checkpoint option is not working correctly. Possible bug in textual_inversion_training.py? * copy learned_embeddings.bin into right location * add front end for diffusers model merging - Front end doesn't do anything yet!!!! - Made change to model name parsing in CLI to support ability to have merged models with the "+" character in their names. * improve inpainting experience - recommend ckpt version of inpainting-1.5 to user - fix get_noise() bug in ckpt version of omnibus.py * update environment*yml * tweak instructions to install HuggingFace token * bump version number * enhance update scripts - update scripts will now fetch new INITIAL_MODELS.yaml so that configure_invokeai.py will know about the diffusers versions. * enhance invoke.sh/invoke.bat launchers - added configure_invokeai.py to menu - menu defaults to browser-based invoke * remove conda workflow (#2321) * fix `token_ids has shape torch.Size([79]) - expected [77]` * update CHANGELOG.md with 2.3.* info - Add information on how formats have changed and the upgrade process. - Add short bug list. Co-authored-by: Damian Stewart <d@damianstewart.com> Co-authored-by: Damian Stewart <null@damianstewart.com> Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> Co-authored-by: Wybartel-luxmc <37852506+Wybartel-luxmc@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> Co-authored-by: mickr777 <115216705+mickr777@users.noreply.github.com> Co-authored-by: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Co-authored-by: Eugene Brodsky <ebr@users.noreply.github.com> Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com>
2023-01-15 14:22:46 +00:00
log_tokens=ldm.invoke.conditioning.log_tokenization
2022-10-03 18:39:58 +00:00
)
if tool in ('gfpgan','codeformer','upscale'):
if tool == 'gfpgan':
facetool = 'gfpgan'
elif tool == 'codeformer':
facetool = 'codeformer'
elif tool == 'upscale':
facetool = 'gfpgan' # but won't be run
2022-10-13 13:14:21 +00:00
facetool_strength = 0
return self.upscale_and_reconstruct(
[[image,seed]],
facetool = facetool,
2022-10-13 13:14:21 +00:00
strength = facetool_strength,
codeformer_fidelity = codeformer_fidelity,
save_original = save_original,
upscale = upscale,
image_callback = callback,
prefix = prefix,
)
2022-10-03 18:39:58 +00:00
elif tool == 'outcrop':
from ldm.invoke.restoration.outcrop import Outcrop
2022-10-03 18:39:58 +00:00
extend_instructions = {}
for direction,pixels in _pairwise(opt.outcrop):
try:
extend_instructions[direction]=int(pixels)
except ValueError:
use 🧨diffusers model (#1583) * initial commit of DiffusionPipeline class * spike: proof of concept using diffusers for txt2img * doc: type hints for Generator * refactor(model_cache): factor out load_ckpt * model_cache: add ability to load a diffusers model pipeline and update associated things in Generate & Generator to not instantly fail when that happens * model_cache: fix model default image dimensions * txt2img: support switching diffusers schedulers * diffusers: let the scheduler do its scaling of the initial latents Remove IPNDM scheduler; it is not behaving. * web server: update image_progress callback for diffusers data * diffusers: restore prompt weighting feature * diffusers: fix set-sampler error following model switch * diffusers: use InvokeAIDiffuserComponent for conditioning * cross_attention_control: stub (no-op) implementations for diffusers * model_cache: let offload_model work with DiffusionPipeline, sorta. * models.yaml.example: add diffusers-format model, set as default * test-invoke-conda: use diffusers-format model test-invoke-conda: put huggingface-token where the library can use it * environment-mac: upgrade to diffusers 0.7 (from 0.6) this was already done for linux; mac must have been lost in the merge. * preload_models: explicitly load diffusers models In non-interactive mode too, as long as you're logged in. * fix(model_cache): don't check `model.config` in diffusers format clean-up from recent merge. * diffusers integration: support img2img * dev: upgrade to diffusers 0.8 (from 0.7.1) We get to remove some code by using methods that were factored out in the base class. * refactor: remove backported img2img.get_timesteps now that we can use it directly from diffusers 0.8.1 * ci: use diffusers model * dev: upgrade to diffusers 0.9 (from 0.8.1) * lint: correct annotations for Python 3.9. * lint: correct AttributeError.name reference for Python 3.9. * CI: prefer diffusers-1.4 because it no longer requires a token The RunwayML models still do. * build: there's yet another place to update requirements? * configure: try to download models even without token Models in the CompVis and stabilityai repos no longer require them. (But runwayml still does.) * configure: add troubleshooting info for config-not-found * fix(configure): prepend root to config path * fix(configure): remove second `default: true` from models example * CI: simplify test-on-push logic now that we don't need secrets The "test on push but only in forks" logic was only necessary when tests didn't work for PRs-from-forks. * create an embedding_manager for diffusers * internal: avoid importing diffusers DummyObject see https://github.com/huggingface/diffusers/issues/1479 * fix "config attributes…not expected" diffusers warnings. * fix deprecated scheduler construction * work around an apparent MPS torch bug that causes conditioning to have no effect * 🚧 post-rebase repair * preliminary support for outpainting (no masking yet) * monkey-patch diffusers.attention and use Invoke lowvram code * add always_use_cpu arg to bypass MPS * add cross-attention control support to diffusers (fails on MPS) For unknown reasons MPS produces garbage output with .swap(). Use --always_use_cpu arg to invoke.py for now to test this code on MPS. * diffusers support for the inpainting model * fix debug_image to not crash with non-RGB images. * inpainting for the normal model [WIP] This seems to be performing well until the LAST STEP, at which point it dissolves to confetti. * fix off-by-one bug in cross-attention-control (#1774) prompt token sequences begin with a "beginning-of-sequence" marker <bos> and end with a repeated "end-of-sequence" marker <eos> - to make a default prompt length of <bos> + 75 prompt tokens + <eos>. the .swap() code was failing to take the column for <bos> at index 0 into account. the changes here do that, and also add extra handling for a single <eos> (which may be redundant but which is included for completeness). based on my understanding and some assumptions about how this all works, the reason .swap() nevertheless seemed to do the right thing, to some extent, is because over multiple steps the conditioning process in Stable Diffusion operates as a feedback loop. a change to token n-1 has flow-on effects to how the [1x4x64x64] latent tensor is modified by all the tokens after it, - and as the next step is processed, all the tokens before it as well. intuitively, a token's conditioning effects "echo" throughout the whole length of the prompt. so even though the token at n-1 was being edited when what the user actually wanted was to edit the token at n, it nevertheless still had some non-negligible effect, in roughly the right direction, often enough that it seemed like it was working properly. * refactor common CrossAttention stuff into a mixin so that the old ldm code can still work if necessary * inpainting for the normal model. I think it works this time. * diffusers: reset num_vectors_per_token sync with 44a00555718f1df173c60da0ed646cf700e29537 * diffusers: txt2img2img (hires_fix) with so much slicing and dicing of pipeline methods to stitch them together * refactor(diffusers): reduce some code duplication amongst the different tasks * fixup! refactor(diffusers): reduce some code duplication amongst the different tasks * diffusers: enable DPMSolver++ scheduler * diffusers: upgrade to diffusers 0.10, add Heun scheduler * diffusers(ModelCache): stopgap to make from_cpu compatible with diffusers * CI: default to diffusers-1.5 now that runwayml token requirement is gone * diffusers: update to 0.10 (and transformers to 4.25) * diffusers: use xformers when available diffusers no longer auto-enables this as of 0.10.2. * diffusers: make masked img2img behave better with multi-step schedulers re-randomizing the noise each step was confusing them. * diffusers: work more better with more models. fixed relative path problem with local models. fixed models on hub not always having a `fp16` branch. * diffusers: stopgap fix for attention_maps_callback crash after recent merge * fixup import merge conflicts correction for 061c5369a2247c6c92cd69606bcf54c4f1962a0b * test: add tests/inpainting inputs for masked img2img * diffusers(AddsMaskedGuidance): partial fix for k-schedulers Prevents them from crashing, but results are still hot garbage. * fix --safety_checker arg parsing and add note to diffusers loader about where safety checker gets called * generate: fix import error * CI: don't try to read the old init location * diffusers: support loading an alternate VAE * CI: remove sh-syntax if-statement so it doesn't crash powershell * CI: fold strings in yaml because backslash is not line-continuation in powershell * attention maps callback stuff for diffusers * build: fix syntax error in environment-mac * diffusers: add INITIAL_MODELS with diffusers-compatible repos * re-enable the embedding manager; closes #1778 * Squashed commit of the following: commit e4a956abc37fcb5cf188388b76b617bc5c8fda7d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:43:07 2022 +0100 import new load handling from EmbeddingManager and cleanup commit c4abe91a5ba0d415b45bf734068385668b7a66e6 Merge: 032e856e 1efc6397 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:09:53 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers_with_textual_inversion_manager commit 032e856eefb3bbc39534f5daafd25764bcfcef8b Merge: 8b4f0fe9 bc515e24 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:08:01 2022 +0100 Merge remote-tracking branch 'upstream/dev/diffusers' into dev/diffusers_with_textual_inversion_manager commit 1efc6397fc6e61c1aff4b0258b93089d61de5955 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:04:28 2022 +0100 cleanup and add performance notes commit e400f804ac471a0ca2ba432fd658778b20c7bdab Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:45:07 2022 +0100 fix bug and update unit tests commit deb9ae0ae1016750e93ce8275734061f7285a231 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:28:29 2022 +0100 textual inversion manager seems to work commit 162e02505dec777e91a983c4d0fb52e950d25ff0 Merge: cbad4583 12769b3d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:58:03 2022 +0100 Merge branch 'main' into feature_textual_inversion_mgr commit cbad45836c6aace6871a90f2621a953f49433131 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:54:10 2022 +0100 use position embeddings commit 070344c69b0e0db340a183857d0a787b348681d3 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:53:47 2022 +0100 Don't crash CLI on exceptions commit b035ac8c6772dfd9ba41b8eeb9103181cda028f8 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:11:55 2022 +0100 add missing position_embeddings commit 12769b3d3562ef71e0f54946b532ad077e10043c Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:33:25 2022 +0100 debugging why it don't work commit bafb7215eabe1515ca5e8388fd3bb2f3ac5362cf Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:21:33 2022 +0100 debugging why it don't work commit 664a6e9e146b42d96703f0cc8baf8f5efec04ee1 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit 8b4f0fe9d6e4e2643b36dfa27864294785d7ba4e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit ffbe1ab11163ba712e353d89404e301d0e0c6cdf Merge: 6e4dad60 023df37e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:37:31 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers commit 023df37efffa67434f77def7fc3c9dfb29f699fd Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:36:54 2022 +0100 cleanup commit 05fac594eaf79d0058e3c48deee93df603f136c2 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:07:49 2022 +0100 tweak error checking commit 009f32ed39a7280997c3ffab112adadee0b44279 Author: damian <null@damianstewart.com> Date: Thu Dec 15 21:29:47 2022 +0100 unit tests passing for embeddings with vector length >1 commit beb1b08d9a98112ed2fe073580568e1a18698da3 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:39:09 2022 +0100 more explicit equality tests when overwriting commit 44d8a5a7c85cdabc9ce3a54fd0769a10597b3ca9 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:30:13 2022 +0100 wip textual inversion manager (unit tests passing for 1v embedding overwriting) commit 417c2b57d90924a839616bfb66804faab8039e4c Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 12:30:55 2022 +0100 wip textual inversion manager (unit tests passing for base stuff + padding) commit 2e80872e3b6f7fd7d8eb8928822bd824b63cb2ff Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 10:57:57 2022 +0100 wip new TextualInversionManager * stop using WeightedFrozenCLIPEmbedder * store diffusion models locally - configure_invokeai.py reconfigured to store diffusion models rather than CompVis models - hugging face caching model is used, but cache is set to ~/invokeai/models/repo_id - models.yaml does **NOT** use path, just repo_id - "repo_name" changed to "repo_id" to following hugging face conventions - Models are loaded with full precision pending further work. * allow non-local files during development * path takes priority over repo_id * MVP for model_cache and configure_invokeai - Feature complete (almost) - configure_invokeai.py downloads both .ckpt and diffuser models, along with their VAEs. Both types of download are controlled by a unified INITIAL_MODELS.yaml file. - model_cache can load both type of model and switches back and forth in CPU. No memory leaks detected TO DO: 1. I have not yet turned on the LocalOnly flag for diffuser models, so the code will check the Hugging Face repo for updates before using the locally cached models. This will break firewalled systems. I am thinking of putting in a global check for internet connectivity at startup time and setting the LocalOnly flag based on this. It would be good to check updates if there is connectivity. 2. I have not gone completely through INITIAL_MODELS.yaml to check which models are available as diffusers and which are not. So models like PaperCut and VoxelArt may not load properly. The runway and stability models are checked, as well as the Trinart models. 3. Add stanzas for SD 2.0 and 2.1 in INITIAL_MODELS.yaml REMAINING PROBLEMS NOT DIRECTLY RELATED TO MODEL_CACHE: 1. When loading a .ckpt file there are lots of messages like this: Warning! ldm.modules.attention.CrossAttention is no longer being maintained. Please use InvokeAICrossAttention instead. I'm not sure how to address this. 2. The ckpt models ***don't actually run*** due to the lack of special-case support for them in the generator objects. For example, here's the hard crash you get when you run txt2img against the legacy waifu-diffusion-1.3 model: ``` >> An error occurred: Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 140, in main main_loop(gen, opt) File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 371, in main_loop gen.prompt2image( File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1265, in __getattr__ raise AttributeError("'{}' object has no attribute '{}'".format( AttributeError: 'LatentDiffusion' object has no attribute 'image_from_embeddings' ``` 3. The inpainting diffusion model isn't working. Here's the output of "banana sushi" when inpainting-1.5 is loaded: ``` Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 301, in image_from_embeddings result_latents, result_attention_map_saver = self.latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 330, in latents_from_embeddings result: PipelineIntermediateState = infer_latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 185, in __call__ for result in self.generator_method(*args, **kwargs): File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 367, in generate_latents_from_embeddings step_output = self.step(batched_t, latents, guidance_scale, File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context return func(*args, **kwargs) File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 409, in step step_output = self.scheduler.step(noise_pred, timestep, latents, **extra_step_kwargs) File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/diffusers/schedulers/scheduling_lms_discrete.py", line 223, in step pred_original_sample = sample - sigma * model_output RuntimeError: The size of tensor a (9) must match the size of tensor b (4) at non-singleton dimension 1 ``` * proper support for float32/float16 - configure script now correctly detects user's preference for fp16/32 and downloads the correct diffuser version. If fp16 version not available, falls back to fp32 version. - misc code cleanup and simplification in model_cache * add on-the-fly conversion of .ckpt to diffusers models 1. On-the-fly conversion code can be found in the file ldm/invoke/ckpt_to_diffusers.py. 2. A new !optimize command has been added to the CLI. Should be ported to Web GUI. User experience on the CLI is this: ``` invoke> !optimize /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt INFO: Converting legacy weights file /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt to optimized diffuser model. This operation will take 30-60s to complete. Success. Optimized model is now located at /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 Writing new config file entry for sd-v1-4... >> New configuration: sd-v1-4: description: Optimized version of sd-v1-4 format: diffusers path: /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 OK to import [n]? y >> Verifying that new model loads... >> Current VRAM usage: 2.60G >> Offloading stable-diffusion-2.1 to CPU >> Loading diffusers model from /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 | Using faster float16 precision You have disabled the safety checker for <class 'ldm.invoke.generator.diffusers_pipeline.StableDiffusionGeneratorPipeline'> by passing `safety_checker=None`. Ensure that you abide to the conditions of the Stable Diffusion \ license and do not expose unfiltered results in services or applications open to the public. Both the diffusers team and Hugging Face strongly recommend to keep the safety filter enabled in all public facing circumstances,\ disabling it only for use-cases that involve analyzing network behavior or auditing its results. For more information, please have a look at https://github.com/huggingface/diffusers/pull/254 . | training width x height = (512 x 512) >> Model loaded in 3.48s >> Max VRAM used to load the model: 2.17G >> Current VRAM usage:2.17G >> Textual inversions available: >> Setting Sampler to k_lms (LMSDiscreteScheduler) Keep model loaded? [y] ``` * add parallel set of generator files for ckpt legacy generation * generation using legacy ckpt models now working * diffusers: fix missing attention_maps_callback fix for 23eb80b40421b2bb8f4b6d3dd30490d11c447b36 * associate legacy CrossAttention with .ckpt models * enable autoconvert New --autoconvert CLI option will scan a designated directory for new .ckpt files, convert them into diffuser models, and import them into models.yaml. Works like this: invoke.py --autoconvert /path/to/weights/directory In ModelCache added two new methods: autoconvert_weights(config_path, weights_directory_path, models_directory_path) convert_and_import(ckpt_path, diffuser_path) * diffusers: update to diffusers 0.11 (from 0.10.2) * fix vae loading & width/height calculation * refactor: encapsulate these conditioning data into one container * diffusers: fix some noise-scaling issues by pushing the noise-mixing down to the common function * add support for safetensors and accelerate * set local_files_only when internet unreachable * diffusers: fix error-handling path when model repo has no fp16 branch * fix generatorinpaint error Fixes : "ModuleNotFoundError: No module named 'ldm.invoke.generatorinpaint' https://github.com/invoke-ai/InvokeAI/pull/1583#issuecomment-1363634318 * quench diffuser safety-checker warning * diffusers: support stochastic DDIM eta parameter * fix conda env creation on macos * fix cross-attention with diffusers 0.11 * diffusers: the VAE needs to be tiling as well as the U-Net * diffusers: comment on subfolders * diffusers: embiggen! * diffusers: make model_cache.list_models serializable * diffusers(inpaint): restore scaling functionality * fix requirements clash between numba and numpy 1.24 * diffusers: allow inpainting model to do non-inpainting tasks * start expanding model_cache functionality * add import_ckpt_model() and import_diffuser_model() methods to model_manager - in addition, model_cache.py is now renamed to model_manager.py * allow "recommended" flag to be optional in INITIAL_MODELS.yaml * configure_invokeai now downloads VAE diffusers in advance * rename ModelCache to ModelManager * remove support for `repo_name` in models.yaml * check for and refuse to load embeddings trained on incompatible models * models.yaml.example: s/repo_name/repo_id and remove extra INITIAL_MODELS now that the main one has diffusers models in it. * add MVP textual inversion script * refactor(InvokeAIDiffuserComponent): factor out _combine() * InvokeAIDiffuserComponent: implement threshold * InvokeAIDiffuserComponent: diagnostic logs for threshold ...this does not look right * add a curses-based frontend to textual inversion - not quite working yet - requires npyscreen installed - on windows will also have the windows-curses requirement, but not added to requirements yet * add curses-based interface for textual inversion * fix crash in convert_and_import() - This corrects a "local variable referenced before assignment" error in model_manager.convert_and_import() * potential workaround for no 'state_dict' key error - As reported in https://github.com/huggingface/diffusers/issues/1876 * create TI output dir if needed * Update environment-lin-cuda.yml (#2159) Fixing line 42 to be the proper order to define the transformers requirement: ~= instead of =~ * diffusers: update sampler-to-scheduler mapping based on https://github.com/huggingface/diffusers/issues/277#issuecomment-1371428672 * improve user exp for ckt to diffusers conversion - !optimize_models command now operates on an existing ckpt file entry in models.yaml - replaces existing entry, rather than adding a new one - offers to delete the ckpt file after conversion * web: adapt progress callback to deal with old generator or new diffusers pipeline * clean-up model_manager code - add_model() verified to work for .ckpt local paths, .ckpt remote URLs, diffusers local paths, and diffusers repo_ids - convert_and_import() verified to work for local and remove .ckpt files * handle edge cases for import_model() and convert_model() * add support for safetensor .ckpt files * fix name error * code cleanup with pyflake * improve model setting behavior - If the user enters an invalid model name at startup time, will not try to load it, warn, and use default model - CLI UI enhancement: include currently active model in the command line prompt. * update test-invoke-pip.yml - fix model cache path to point to runwayml/stable-diffusion-v1-5 - remove `skip-sd-weights` from configure_invokeai.py args * exclude dev/diffusers from "fail for draft PRs" * disable "fail on PR jobs" * re-add `--skip-sd-weights` since no space * update workflow environments - include `INVOKE_MODEL_RECONFIGURE: '--yes'` * clean up model load failure handling - Allow CLI to run even when no model is defined or loadable. - Inhibit stack trace when model load fails - only show last error - Give user *option* to run configure_invokeai.py when no models successfully load. - Restart invokeai after reconfiguration. * further edge-case handling 1) only one model in models.yaml file, and that model is broken 2) no models in models.yaml 3) models.yaml doesn't exist at all * fix incorrect model status listing - "cached" was not being returned from list_models() - normalize handling of exceptions during model loading: - Passing an invalid model name to generate.set_model() will return a KeyError - All other exceptions are returned as the appropriate Exception * CI: do download weights (if not already cached) * diffusers: fix scheduler loading in offline mode * CI: fix model name (no longer has `diffusers-` prefix) * Update txt2img2img.py (#2256) * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * feat - make model storage compatible with hugging face caching system This commit alters the InvokeAI model directory to be compatible with hugging face, making it easier to share diffusers (and other models) across different programs. - If the HF_HOME environment variable is not set, then models are cached in ~/invokeai/models in a format that is identical to the HuggingFace cache. - If HF_HOME is set, then models are cached wherever HF_HOME points. - To enable sharing with other HuggingFace library clients, set HF_HOME to ~/.cache/huggingface to set the default cache location or to ~/invokeai/models to have huggingface cache inside InvokeAI. * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * fix error "no attribute CkptInpaint" * model_manager.list_models() returns entire model config stanza+status * Initial Draft - Model Manager Diffusers * added hash function to diffusers * implement sha256 hashes on diffusers models * Add Model Manager Support for Diffusers * fix various problems with model manager - in cli import functions, fix not enough values to unpack from _get_name_and_desc() - fix crash when using old-style vae: value with new-style diffuser * rebuild frontend * fix dictconfig-not-serializable issue * fix NoneType' object is not subscriptable crash in model_manager * fix "str has no attribute get" error in model_manager list_models() * Add path and repo_id support for Diffusers Model Manager Also fixes bugs * Fix tooltip IT localization not working * Add Version Number To WebUI * Optimize Model Search * Fix incorrect font on the Model Manager UI * Fix image degradation on merge fixes - [Experimental] This change should effectively fix a couple of things. - Fix image degradation on subsequent merges of the canvas layers. - Fix the slight transparent border that is left behind when filling the bounding box with a color. - Fix the left over line of color when filling a bounding box with color. So far there are no side effects for this. If any, please report. * Add local model filtering for Diffusers / Checkpoints * Go to home on modal close for the Add Modal UI * Styling Fixes * Model Manager Diffusers Localization Update * Add Safe Tensor scanning to Model Manager * Fix model edit form dispatching string values instead of numbers. * Resolve VAE handling / edge cases for supplied repos * defer injecting tokens for textual inversions until they're used for the first time * squash a console warning * implement model migration check * add_model() overwrites previous config rather than merges * fix model config file attribute merging * fix precision handling in textual inversion script * allow ckpt conversion script to work with safetensors .ckpts Applied patch here: https://github.com/huggingface/diffusers/commit/beb932c5d111872c5e45387e7b1b2b3dd0524a47 * fix name "args" is not defined crash in textual_inversion_training * fix a second NameError: name 'args' is not defined crash * fix loading of the safety checker from the global cache dir * add installation step to textual inversion frontend - After a successful training run, the script will copy learned_embeds.bin to a subfolder of the embeddings directory. - User given the option to delete the logs and intermediate checkpoints (which together use 7-8G of space) - If textual inversion training fails, reports the error gracefully. * don't crash out on incompatible embeddings - put try: blocks around places where the system tries to load an embedding which is incompatible with the currently loaded model * add support for checkpoint resuming * textual inversion preferences are saved and restored between sessions - Preferences are stored in a file named text-inversion-training/preferences.conf - Currently the resume-from-checkpoint option is not working correctly. Possible bug in textual_inversion_training.py? * copy learned_embeddings.bin into right location * add front end for diffusers model merging - Front end doesn't do anything yet!!!! - Made change to model name parsing in CLI to support ability to have merged models with the "+" character in their names. * improve inpainting experience - recommend ckpt version of inpainting-1.5 to user - fix get_noise() bug in ckpt version of omnibus.py * update environment*yml * tweak instructions to install HuggingFace token * bump version number * enhance update scripts - update scripts will now fetch new INITIAL_MODELS.yaml so that configure_invokeai.py will know about the diffusers versions. * enhance invoke.sh/invoke.bat launchers - added configure_invokeai.py to menu - menu defaults to browser-based invoke * remove conda workflow (#2321) * fix `token_ids has shape torch.Size([79]) - expected [77]` * update CHANGELOG.md with 2.3.* info - Add information on how formats have changed and the upgrade process. - Add short bug list. Co-authored-by: Damian Stewart <d@damianstewart.com> Co-authored-by: Damian Stewart <null@damianstewart.com> Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> Co-authored-by: Wybartel-luxmc <37852506+Wybartel-luxmc@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> Co-authored-by: mickr777 <115216705+mickr777@users.noreply.github.com> Co-authored-by: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Co-authored-by: Eugene Brodsky <ebr@users.noreply.github.com> Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com>
2023-01-15 14:22:46 +00:00
print('** invalid extension instruction. Use <directions> <pixels>..., as in "top 64 left 128 right 64 bottom 64"')
merge release-candidate-1-3-2 into main. Squashed commit of the following: commit 9a1fe8e7fbbd81d9e9e47c4fda6bde6f66fba30c Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 12 17:07:40 2022 +0000 swap in release URLs for installers commit ff56f5251ba8502833cb561317e82b028cd2da5d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 12 17:03:21 2022 +0000 fix up bad unicode chars in invoke.py commit ed943bd6c785d968d1e31fbbb814fea8688fc8bb Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 12 16:05:45 2022 +0000 outcrop improvements, hand-added commit 7ad2355b1da53861bb75312edead8f9db0b0f44d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 12 15:14:33 2022 +0000 documentation fixes commit 66c920fc197d9206be9e0e2d1eb2a1cb86362887 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 16:49:25 2022 -0500 Revert "Resize hires as an image" This reverts commit d05b1b3544dfa7b3c071ac05b4f014a52e08fa50. commit 3fc5cb09f8bc03ea96e67a3e49fb087019d2f9d5 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 12 12:43:17 2022 +0000 fix incorrect link in install commit 1345ec77ab58f70e1bf5a0f587ca40aba4e906b7 Author: tildebyte <337875+tildebyte@users.noreply.github.com> Date: Sun Nov 6 19:07:31 2022 -0500 toil(repo): add tildebyte as owner of installer/ directory commit b116715490f390a59e5bee1022a6a758aee0918d Author: Kyle Schouviller <kyle0654@hotmail.com> Date: Thu Nov 10 21:43:56 2022 -0800 Fix performance issue introduced by torch cuda cache clear during generation commit fa3670270e7aae6bfd8d47fb7bdd32b707310c23 Author: mauwii <Mauwii@outlook.de> Date: Fri Nov 11 12:42:03 2022 +0100 small update to dockers huggingface section commit c304250ef663b3e202b4da8332365288589d94c7 Author: mauwii <Mauwii@outlook.de> Date: Fri Nov 11 12:19:27 2022 +0100 fix format and Link in INSTALL_INVOKE.md commit 802ce5dde5ca68f24aa4609cdba428044e0c7fa1 Author: mauwii <Mauwii@outlook.de> Date: Fri Nov 11 11:17:49 2022 +0100 small fixex to format and a link in INSTALL_MANUAL commit 311ee320ecac892cb4a1bcd012374fa051b1d011 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 07:23:35 2022 +0000 ignore installer intermediate files commit e9df17b374df58a44d3ae3ba33cbdc58794bcf5d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 07:19:25 2022 +0000 fix backslash-related syntax error commit 061fb4ef00482bdd4fba635aeaeff4ca7510190d Merge: 52be0d23 4095acd1 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 06:50:04 2022 +0000 Merge branch 'release-candidate-2-1-3' of github.com:/invoke-ai/InvokeAI into release-candidate-2-1-3 commit 52be0d2396de2de02030855c92e3367008b50377 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 06:49:45 2022 +0000 add WindowsLongFileName batfile to source installer commit 4095acd10ebae05a8cb14cc2faf7c79936d9e6a9 Author: mauwii <Mauwii@outlook.de> Date: Fri Nov 11 07:05:17 2022 +0100 Doc Updates A lot of re-formating of new Installation Docs also some content updates/corrections commit 201eb22d7650b00f55249c2646fa4f47ac3e0ec2 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 04:41:02 2022 +0000 prevent two models from being marked default in models.yaml commit 17ab98220034dfbb798a9a0460bc2837f0c1e2cb Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 03:56:54 2022 +0000 installers download branch HEAD not tag commit a04965b0e9e9d1170cf284af9acbd1186d681255 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 03:48:21 2022 +0000 improve messaging during installation process commit 0b529f0c574dd91fb9593e924ebc41c8c219b6ce Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 15:22:32 2022 +0000 enable outcropping of random JPG/PNG images - Works best with runwayML inpainting model - Numerous code changes required to propagate seed to final metadata. Original code predicated on the image being generated within InvokeAI. commit 6f9f84834557eb3c48562dc5d0ace51ca9e9cca2 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 17:27:42 2022 +0000 enhance outcropping with ability to direct contents of new regions - When outcropping an image you can now add a `--new_prompt` option, to specify a new prompt to be used instead of the original one used to generate the image. - Similarly you can provide a new seed using `--seed` (or `-S`). A seed of zero will pick one randomly. - This PR also fixes the crash that happened when trying to outcrop an image that does not contain InvokeAI metadata. commit 918c1589ef30595668899f4259ece6a4ad605c69 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 20:16:47 2022 +0000 fix #1402 commit 116415b3fcec8415f8e6de9b23c0bbd0dbc6845b Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 21:27:25 2022 +0000 fix invoke.py crash if no models.yaml file present - Script will now offer the user the ability to create a minimal models.yaml and then gracefully exit. - Closes #1420 commit b4b6eabaac94896e38123be331c44d1b63065b0d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 16:49:25 2022 -0500 Revert "Log strength with hires" This reverts commit 82d4904c07670d514e9a541de7c9ecd8489eeae2. commit 4ef1f4a854717c953f9192454d0adabef32af36c Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 20:01:49 2022 +0000 remove temporary directory from repo commit 510fc4ebaa5f9dc0e77b47cf04e0c265423e0a44 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 19:59:03 2022 +0000 remove -e from clipseg load in installer commit a20914434bb3609cf1d883cabf048d4cc25f881a Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 19:37:07 2022 +0000 change clipseg repo branch to avoid clipseg not found error commit 0d134195fda5c69fce5a95d6da90248eba8d226d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 18:39:29 2022 +0000 update repo URL to point to rc commit 649d8c8573896fdb5a73453b69ee4b54cf4d6241 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 18:13:28 2022 +0000 integrate tildebyte installer commit a358d370a05ea985a9e26fa9c1101d9c14fdb3ab Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 17:48:14 2022 +0000 add @tildebyte compiled pip installer commit 94a9033c4f6214e604be149a3de6d7c747af7f3a Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 14:52:00 2022 +0000 ignore source installer zip files commit 18a947c503c83c95cd83f27424696219ff3c4c95 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 14:46:36 2022 +0000 documentation and environment file fixes - Have clarified the relationship between the @tildebyte and @cmdr2 installers; However, @tildebyte installer merge is still a WIP due to conflicts over such things as `invoke.sh`. - Rechristened 1click installer as "source" installer. @tildebyte installer will be "the" installer. (We'll see which one generates the least support requests and maintenance work.) - Sync'd `environment-mac.yml` with `development`. The former was failing with a taming-transformers error as per https://discord.com/channels/@me/1037201214154231899/1040060947378749460 commit a23b03189526a49da8ddae90ce71b0e902784d29 Author: Mike DiGiovanni <vinblau@gmail.com> Date: Wed Nov 9 16:44:59 2022 -0500 Fixes typos in README.md commit 23af68c7d79d947f1bd3441c91bb44d655238f01 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 07:02:27 2022 -0500 downgrade win installs to basicsr==1.4.1 commit e258beeb51f3e645b9ea60e52d69d18722221cc5 Merge: 7460c069 e481bfac Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 06:37:45 2022 -0500 Merge branch 'release-candidate-2-1-3' of github.com:invoke-ai/InvokeAI into release-candidate-2-1-3 commit 7460c069b880b10c84b55f2e0c0998e350d6cf12 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 06:36:48 2022 -0500 remove --prefer-binary from requirements-base.txt It appears that some versions of pip do not recognize this option when it appears in the requirements file. Did not explore this further but recommend --prefer-binary in the manual install instructions on the command line. commit e481bfac615e0c798ceb5e59e8fbe3038f85b431 Merge: 5040747c d1ab65a4 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 11:21:56 2022 +0000 Merge branch 'release-candidate-2-1-3' of github.com:/invoke-ai/InvokeAI into release-candidate-2-1-3 commit 5040747c6700c9b949e3f3e1d2c3f21daffcec6c Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 11:21:43 2022 +0000 fix windows install instructions & bat file commit d1ab65a43122f73c20533d5815590ec10bc05eca Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 07:18:59 2022 +0100 update WEBUIHOTKEYS.md commit af4ee7feb8a7d2528bf4e2b3f7deee7a7c4c3dec Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 06:33:49 2022 +0100 update INSTALL_DOCKER.md commit 764fb29aded8114984d05932c4266ea24614b932 Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 06:30:15 2022 +0100 fix formatting in INSTALL.md commit 1014d3ba44aa4cd4cfdc6e3650c24a0dc9568a6e Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 06:29:14 2022 +0100 fix build.sh invokeai_conda_env_file default value commit 40a48aca88e337e9f4475f80a03b7d6d4751d09b Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 05:25:30 2022 +0100 fix environment-mac.yml moved taming-transformers-rom1504 to pip dependencies commit 92abc00f16a34a586dd16d3c64408f00e23fcb53 Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 05:19:52 2022 +0100 fix test-invoke-conda - copy required conda environment yaml - use environment.yml - I use cp instead of ln since would be compatible for windows runners commit a5719aabf89c8c5f29c6044e2882ccdcd0c6916b Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 04:14:35 2022 +0100 update Dockerfile - link environment.yml from new environemnts path - change default conda_env_file - quote all variables to avoid splitting - also remove paths from conda-env-files in build-container.yml commit 44a18511fa7accfec6a20345774583a1ce745b02 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 20:51:06 2022 +0000 update paths in container build workflow commit b850dbadafba052310327ca759d96f49a9d25d03 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 20:16:57 2022 +0000 finished reorganization of install docs commit 9ef8b944d53afb1fed94c418b2fd936d2d743797 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 18:50:58 2022 +0000 tweaks to manual install documentation --prefer-binary is an iffy option in the requirements file. It isn't supported by some versions of pip, so I removed it from requirements-base.txt and inserted it into the manual install instructions where it seems to do what it is supposed to. commit efc5a9848803b4250d726bc1913b9fd5a33fad75 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 18:20:03 2022 +0000 manual installation documentation tested on Linux commit 1417c87928e13b0ed21bf1c5604f8636d3b50a8d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 17:37:06 2022 +0000 change name of requirements.txt to avoid confusion commit 2dd6fc2b93ff7bbb4038568a3b28d36a8fafaeb8 Merge: 22213612 71ee44a8 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 17:26:24 2022 +0000 Merge branch 'release-candidate-2-1-3' of github.com:/invoke-ai/InvokeAI into release-candidate-2-1-3 commit 22213612a08bbece46eafd48994f985b097cb141 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 17:25:59 2022 +0000 directory cleanup; working on install docs commit 71ee44a827898759fd457f774c0b2ac7a1ef6519 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 02:07:13 2022 +0000 prevent crash when switching to an invalid model commit b17ca0a5e731c142101bbdbf34d121df949e86d7 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 14:28:38 2022 +0100 don't suppress exceptions when doing cross-attention control commit 71bbfe4a1a5b70f90e5f41c94df50fb104dbdd79 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 12:59:34 2022 +0100 Fix #1362 by improving VRAM usage patterns when doing .swap() commit ef3f7a26e242b73c2beb0195c7fd8f654ef47f55 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 12:18:37 2022 +0100 remove log spam commit 7189d649622d4668b120b0dd278388ad672142c4 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 12:10:28 2022 +0100 change the way saved slicing strategy is applied commit 01c40f751ab72955140165c16f95ae411732265b Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 12:04:43 2022 +0100 fix slicing_strategy_getter callsite commit f8cfe25150a346958903316bc710737d99839923 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 11:56:22 2022 +0100 cleanup, consistent dim=0 also tested commit 5bf9b1e890d48e962afd4a668a219b68271e5dc1 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 11:34:09 2022 +0100 refactored context, tested with non-sliced cross attention control commit d58a46e39bf562e7459290d2444256e8c08ad0b6 Author: damian0815 <null@damianstewart.com> Date: Sun Nov 6 00:41:52 2022 +0100 cleanup commit 7e2c658b4c06fe239311b65b9bb16fa3adec7fd7 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:57:31 2022 +0100 disable logs commit 20ee89d93841b070738b3d8a4385c93b097d92eb Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:36:58 2022 +0100 slice saved attention if necessary commit 0a7684a22c880ec0f48cc22bfed4526358f71546 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:32:38 2022 +0100 raise instead of asserting commit 7083104c7f3a0d8fd96e94a2f391de50a3c942e4 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:31:00 2022 +0100 store dim when saving slices commit f7c0808ed383ec1dc70645288a798ed2aa4fa85c Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:27:16 2022 +0100 don't retry on exception commit 749a721e939b3fe7c1741e7998dab6bd2c85a0cb Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:24:50 2022 +0100 stuff commit 032ab90e9533be8726301ec91b97137e2aadef9a Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:20:17 2022 +0100 more logging commit 3dc34b387f033482305360e605809d95a40bf6f8 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:16:47 2022 +0100 logs commit 901c4c1aa4b9bcef695a6551867ec8149e6e6a93 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:12:39 2022 +0100 actually set save_slicing_strategy to True commit f780e0a0a7c6b6a3db320891064da82589358c8a Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:10:35 2022 +0100 store slicing strategy commit 93bb6d566fd18c5c69ef7dacc8f74ba2cf671cb7 Author: damian <git@damianstewart.com> Date: Sat Nov 5 20:43:48 2022 +0100 still not it commit 5e3a9541f8ae00bde524046963910323e20c40b7 Author: damian <git@damianstewart.com> Date: Sat Nov 5 17:20:02 2022 +0100 wip offloading attention slices on-demand commit 4c2966aa856b6f3b446216da3619ae931552ef08 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 15:47:40 2022 +0100 pre-emptive offloading, idk if it works commit 572576755e9f0a878d38e8173e485126c0efbefb Author: root <you@example.com> Date: Sat Nov 5 11:25:32 2022 +0000 push attention slices to cpu. slow but saves memory. commit b57c83a68f2ac03976ebc89ce2ff03812d6d185f Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 12:04:22 2022 +0100 verbose logging commit 3a5dae116f110a96585d9eb71d713b5ed2bc3d2b Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 11:50:48 2022 +0100 wip fixing mem strategy crash (4 test on runpod) commit 3cf237db5fae0c7b0b4cc3c47c81830bdb2ae7de Author: damian0815 <null@damianstewart.com> Date: Fri Nov 4 09:02:40 2022 +0100 wip, only works on cuda commit 5702271991e126c026aa1ff41c44f8ad37b26e3a Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 14:09:36 2022 +0000 speculative reorganization of the requirements & environment files - This is only a test! - The various environment*.yml and requirements*.txt files have all been moved into a directory named "environments-and-requirements". - The idea is to clean up our root directory so that the github home page is tidy. - The manual install instructions will start with the instructions to create a symbolic link from environment.yml to the appropriate file for OS and GPU. - The 1-click installers have been updated to accommodate this change. commit 10781e7dc4f4551583a110d14f2a1f60393112b8 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 01:59:45 2022 +0000 refactoring requirements commit 099d1157c579c7b9fea20945e8504cc15745c598 Author: mauwii <Mauwii@outlook.de> Date: Wed Nov 9 00:16:18 2022 +0100 better way to make sure if conda is useable commit ab825bf7ee5f0b82d2273da1cda64fc9266a978e Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 22:05:33 2022 +0000 add back --prefer-binaries to requirements commit 10cfeb5ada7bcfc9f3aff3716ab8ea4961a8b528 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 8 22:27:19 2022 +0100 add quotes to set and use `$environment_file` commit e97515d0453583e013674b4dd1f3739c7de402cc Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 8 22:24:21 2022 +0100 set environment file for conda update commit 0f04bc5789c712bf7c7319b1d93064914993f4ec Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 8 22:21:25 2022 +0100 use conda env update commit 3f74aabecd08ed25fac158463ae12b775bd1fca2 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 8 22:20:44 2022 +0100 use command instead of hash commit b1a99a51b7ca23c4b895855bd7b4c82dbdc431e4 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 14:44:44 2022 -0500 remove --global git config from 1-click installers commit 8004f8a6d99f6ff75e00c170da40f1dec93a8914 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Mon Nov 7 09:07:20 2022 -0500 Revert "Use array slicing to calc ddim timesteps" This reverts commit 1f0c5b4cf196716c21f2db74f92c8750ad8f889d. commit ff8ff2212afb1e1c2dce4f6a61f29e2bc8302eb5 Merge: 8e5363cd 636620b1 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 14:01:40 2022 +0000 add initfile support from PR #1386 commit 8e5363cd83bff0e6be0f002c644283955f7fcbfd Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 13:26:18 2022 +0000 move 'installer/' to '1-click-installer' to make room for tildebyte installer commit 1450779146e89510d12b8c90eb316d9861c3375e Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 12:56:36 2022 +0000 update branch for installer to pull against commit 8cd5d95b8a1cb213cce2f949c394c841a09d9cab Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 05:30:20 2022 +0000 move all models into subdirectories of ./models - this required an update to the invoke-ai fork of gfpgan - simultaneously reverted consolidation of environment and requirements files, as their presence in a directory triggered setup.py to try to install a sub-package. commit abd6407394d55d4f6c064a05f3ac989dd3817c59 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 03:52:46 2022 +0000 leave a copy of environment-cuda.yml at top level - named it environment.yml - need to avoid a big change for users and breaking older support instructions. commit 734dacfbe9d8c86ca943c6541e7b5ff5ef787ff4 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 03:50:07 2022 +0000 consolidate environment files - starting to remove unneeded entries and pins - no longer require -e in front of github dependencies - update setup.py with release number - update manual installation instructions commit 636620b1d5e2466613d0dcc2a604522be12fa3a4 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 03:26:16 2022 +0000 change initfile to ~/.invokeai - adjust documentation - also fix 'clipseg_models' to 'clipseg', which seems to be working now commit 1fe41146f0975bbc9d552208473490a9ccb9fc56 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 5 14:28:01 2022 -0400 add support for an initialization file, invokeai.init - Place preferred startup command switches in a file named "invokeai.init". The file can consist of a single line of switches such as "--web --steps=28", a series of switches on each line, or any combination of the two. Example: ``` --web --host=0.0.0.0 --steps=28 --grid -f 0.6 -C 11.0 -A k_euler_a ``` - The following options, which were previously only available within the CLI, are now available on the command line as well: --steps --strength --cfg_scale --width --height --fit commit 2ad6ef355a9b9c4b17bae71edea2346c2e8708c5 Merge: 865502ee 8b47c829 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sun Nov 6 18:08:36 2022 +0000 update discord link commit 865502ee4f681de4516d231370ae603983354d8f Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 18:00:16 2022 +0100 update changelog commit c7984f3299c5c8f56a70d80907d527af458674af Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 17:07:27 2022 +0100 update TROUBLESHOOT.md commit 7f150ed83302ba875c3e0c0f39d8ac0f32c6e362 Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 16:56:58 2022 +0100 remove `:`from headlines in CONTRIBUTORS.md commit badf4e256ce6e3201df1a9a87a7072b36b18d699 Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 16:56:37 2022 +0100 enable navigation tabs Since the docs are growing, this way they look cleaner commit e64c60bbb38fc1620e08ce52bf28bd17003c7ef6 Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 16:18:59 2022 +0100 remove preflight checks from assets seems like somebody executed tests and commited them commit 178061854300632b024810e65922b54b64d95939 Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 16:15:06 2022 +0100 update INSTALLING_MODELS.md commit f91fd276242a0c92b301e99d02982d30f7b712c3 Author: Kyle Schouviller <kyle0654@hotmail.com> Date: Sat Nov 5 14:47:53 2022 -0700 Bug fix for inpaint size commit 09e41e8f769457b9ffd56901aae13991cdc6eeb8 Author: Kyle Schouviller <kyle0654@hotmail.com> Date: Sat Nov 5 14:34:52 2022 -0700 Add inpaint size options to inpaint at a larger size than the actual inpaint image, then scale back down for recombination commit 6eeb2107b300fc27cfe6134b43e5570c246b8e96 Author: mauwii <Mauwii@outlook.de> Date: Sat Nov 5 21:01:14 2022 +0100 remove create-caches.yml since not used anywhere commit 17053ad8b7efecb21a9b4eb32695089f683f72e3 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 5 16:01:55 2022 -0400 fix duplicated argument introduced by conflict resolution commit fefb4dc1f88bc6551a39602a2bc79b278cd83c59 Merge: 762ca60a d05b1b35 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 5 12:47:35 2022 -0700 Merge branch 'development' into fix_generate.py commit d05b1b3544dfa7b3c071ac05b4f014a52e08fa50 Author: Craig <cwallen@users.noreply.github.com> Date: Sat Oct 29 20:40:30 2022 -0400 Resize hires as an image commit 82d4904c07670d514e9a541de7c9ecd8489eeae2 Author: Craig <cwallen@users.noreply.github.com> Date: Sat Oct 29 20:37:40 2022 -0400 Log strength with hires commit 1cdcf33cfa39e90f9660fabf8f5936dcfb6c3aa5 Merge: 6616fa83 cbc029c6 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 5 09:57:38 2022 -0400 Merge branch 'main' into development - this synchronizes recent document fixes by mauwii commit 6616fa835ac4318bf53419f2b54b88c962559578 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 4 00:47:03 2022 -0400 fix Windows library dependency issues This commit addresses two bugs: 1) invokeai.py crashes immediately with a message about an undefined attritube sigKILL (closes #1288). The fix is to pin torch at 1.12.1. 2) Version 1.4.2 of basicsr fails to load properly on Windows, and is a requirement of realesrgan, however 1.4.1 works. Pinning basicsr in our requirements file resulted in a dependency conflict, so I ended up cloning realesrgan into the invoke-ai Git space and changing the requirements file there. If there is a more elegant solution, please advise. commit 7b9a4564b11f4181b9b3c06ecda2a4a25fd1849e Author: Matthias Wild <40327258+mauwii@users.noreply.github.com> Date: Sat Nov 5 14:36:45 2022 +0100 Update-docs (#1382) * update IMG2IMG.md * update INPAINTING.md * update WEBUIHOTKEYS.md * more doc updates (mostly fix formatting): - OUTPAINTING.md - POSTPROCESS.md - PROMPTS.md - VARIATIONS.md - WEB.md - WEBUIHOTKEYS.md commit fcdefa0620761472718afa14b2955a5d0603cfcc Author: Matthias Wild <40327258+mauwii@users.noreply.github.com> Date: Fri Nov 4 20:47:31 2022 +0100 Hotifx docs (#1376) (#1377) commit ef8b3ce639954259a95a38f44fa5329687bee781 Merge: b7042095 36870a8f Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 4 12:08:44 2022 -0400 Merge-main-into-development (#1373) To get the rid of the difference between main and development. Since otherwise it will be a pain to start fixing the documentatino (when the state between main and development is not the same ...) Also this should fix the problem of all tests failing since environment yamls get updated. commit 36870a8f53217d4b733e9bb8b119190b5e36da59 Merge: 6b89adfa b7042095 Author: Matthias Wild <40327258+mauwii@users.noreply.github.com> Date: Fri Nov 4 16:25:00 2022 +0100 Merge branch 'development' into merge-main-into-development commit b70420951d5b70937c0c07e4f8a552a01c3008bc Author: damian0815 <null@damianstewart.com> Date: Thu Nov 3 12:39:45 2022 +0100 fix parsing error doing eg `forest ().swap(in winter)` commit 1f0c5b4cf196716c21f2db74f92c8750ad8f889d Author: wfng92 <43742196+wfng92@users.noreply.github.com> Date: Thu Nov 3 17:13:52 2022 +0800 Use array slicing to calc ddim timesteps commit 8648da811190fc8bcf237d83aff38cf605851300 Author: mauwii <Mauwii@outlook.de> Date: Fri Nov 4 00:06:19 2022 +0100 update environment-linux-aarch64 to use python 3.9 commit 45b459356399f8cfb7e9af571c1643fab04218fe Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 3 22:31:46 2022 +0100 update environment-linux-aarch64.yml - move getpass_asterisk to pip commit 41b04316cf5118ea9518dc77934d135a489dd684 Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 3 20:40:08 2022 +0100 rename job, remove debug branch from triggers commit e97c6db2a3c0157a8a5ab74cd28ebee480a2d078 Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 3 20:34:01 2022 +0100 include build matrix to build x86_64 and aarch64 commit 896820a349292b0e14bbc32f0c557fe8a6b45395 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 05:01:15 2022 +0100 disable caching commit 06c8f468bff7e1dfecc1a1990164be1005b114a7 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 04:26:39 2022 +0100 disable PR-Validation since there are no files passed from context this is unecesarry commit 61920e2701c4a9cea94c03ab933c4482458215b7 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 04:09:39 2022 +0100 update action to use current branch also update build-args of dockerfile and build.sh commit f34ba7ca70f1c417ee97e8b0c57abff57614d78f Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 02:30:24 2022 +0100 remove unecesarry mkdir command again commit c30ef0895dbf0565345ac6ccb136d98a174470a6 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 01:51:12 2022 +0100 remove symlink to GFPGANv1.4 also re-add mkdir to prevent action from failing commit aa3a774f73d5004571ea42fea14cd2b525fffb1c Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 01:48:59 2022 +0100 update build-container.yml to use cachev3 commit 2c30555b844293764123baa4137fcf952d40a4e7 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 01:34:20 2022 +0100 update Dockerfile - create models.yaml from models.yaml.example - run preload_models.py with --no-interactive commit 743f60577364d43237eeb46aefd523371c36e56b Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 01:21:15 2022 +0100 update build.sh to download sd-v1.5 model commit 519c661abbae83aa62b3ee536635c39192890441 Author: mauwii <Mauwii@outlook.de> Date: Tue Oct 25 01:26:50 2022 +0200 replace old fashined markdown templates with forms this will help the readability of issues a lot 🤓 commit 22c956c75f4797ddc2dffa944e3ea84b4eb3477c Merge: 13696adc 0196571a Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 3 10:20:21 2022 -0400 Merge branch 'development' of github.com:invoke-ai/InvokeAI into development commit 13696adc3a3a2b169e68048a5b511660d0430fae Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 3 10:20:10 2022 -0400 speculative change to solve windows esrgan issues commit 0196571a12992eb8207d36e022721fe3ad2cfd19 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 2 22:39:35 2022 -0400 remove merge markers from preload_models.py commit 9666f466ab1c710dfda2e59be9e8a26fcd7e8718 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 2 18:29:34 2022 -0400 use refined model by default commit 240e5486c89552ef480c3443a63283fb86a493c3 Merge: 8164b6b9 aa247e68 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 2 18:35:00 2022 -0400 Merge branch 'spezialspezial-patch-9' into development commit 8164b6b9cff077e4131384195af65e30a40733a7 Merge: 4fc82d55 dd5a88dc Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 2 17:06:46 2022 -0400 Merge branch 'development' of github.com:invoke-ai/InvokeAI into development commit 4fc82d554ff573780c0af562a6bc9586aa56012d Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 04:17:28 2022 +1300 [WebUI] Final 2.1 Release Build commit 96b34c0f85f6ed52707fe43456d20b81822c7d1d Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 09:08:11 2022 +0100 Final WebUI build for Release 2.1 - squashed commit of 52 commits from PR #1327 don't log base64 progress images Fresh Build For WebUI [WebUI] Loopback Default False Fixes bugs/styling - Fixes missing web app state on new version: Adds stateReconciler to redux-persist. When we add more values to the state and then release the update app, they will be automatically merged in. Reseting web UI will be needed far less. 7159ec - Fixes console z-index - Moves reset web UI button to visible area Decreases gallery width on inpainting Increases workarea split padding to 1rem Adds missing tooltips to site header Changes inpainting controls settings to hover Fixes hotkeys and settings buttons not working Improves bounding box interactions - Bounding box can now be moved by dragging any of its edges - Bounding box does not affect drawing if already drawing a stroke - Can lock bounding box to draw directly on the bounding box edges - Removes spacebar-hold behaviour due to technical issues Fixes silent crash when init image too large To send the mask to the server, the UI rendered the mask onto the init image and sent the whole image. The mask was then cropped by the server. If the image was too large, the app silently failed. Maybe it exceeds the websocket size limit. Fixed by cropping the mask in the UI layer, sending only bounding-box-sized mask image data. Disabled bounding box settings when locked Styles image uploader Builds fresh bundle Improves bounding box interaction Added spacebar-hold-to-transform back. Address bounding box feedback - Adds back toggle to hide bounding box - Box quick toggle = q, normal toggle = shift + q - Styles canvas alert icons Adds hints when unable to invoke - Popover on Invoke button indicates why exactly it is disabled, e.g. prompt is empty, something else is processing, etc. - There may be more than one reason; all are displayed. Fix Inpainting Alerts Styling Preventing unnecessary re-renders across the app Code Split Inpaint Options Isolate features to their own components so they dont re-render the other stuff each time. [TESTING] Remove global isReady checking I dont believe this is need at all because the isready state is constantly updated when needed and tracked real time in the Redux store. This causes massive re-renders. @psychedelicious If this is absolutely essential for a reason that I do not see, please hit me up on Discord. Fresh Bundle Fix Bounding Box Settings re-rendering on brush stroke [Code Splitting] Bounding Box Options Isolated all bounding box components to trigger unnecessary re-renders. Still need to fix bounding box triggering re-renders on the control panel inside the canvas itself. But the options panel should be a good to go with this change. Inpainting Controls Code Spitting and Performance Codesplit the entirety of the inpainting controls. Created new selectors for each and every component to ensure there are no unnecessary re-renders. App feels a lot smoother. Fixes rerenders on ClearBrushHistory Fixes crash when requesting post-generation upscale/face restoration - Moves the inpainting paste to before the postprocessing. Removes unused isReady state Changes Report Bug icon to a bug Restores shift+q bounding box shortcut Adds alert for bounding box size to status icons Adds asCheckbox to IAIIconButton Rough draft of this. Not happy with the styling but it's clearer than having them look just like buttons. Fixes crash related to old value of progress_latents in state Styling changes and settings modal minor refactor Fixes: uploaded JPG images not loading Reworks CurrentImageButtons.tsx - Change all icons to FA iconset for consistency - Refactors IAIIconButton, IAIButton, IAIPopover to handle ref forwarding - Redesigns buttons into group Only generate 1 iteration when seed fixed & variations disabled Fixes progress images select Fixes edge case: upload over gets stuck while alt tabbing - Press esc to close it now Fixes display progress images select typing Fixes current image button rerenders Adds min width to ImageUploader Makes fast-latents in progress default Update Icon Button Checkbox Style Styling Fixes next/prev image buttons Refactor canvas buttons + more Add Save Intermediates Step Count For accurate mode only. Co-Authored-By: Richard Macarthy <richardmacarthy@protonmail.com> Restores "initial image" text Address feedback - moves mask clear button - fixes intermediates - shrinks inpainting icons by 10% Fix Loopback Styling Adds escape hotkey to close floating panels Readd Hotkey for Dual Display Updated Current Image Button Styling commit dd5a88dceeec53ceb1722a62e3689ae3dd871154 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 04:17:28 2022 +1300 [WebUI] Final 2.1 Release Build commit 95ed56bf82825a47cfe406fa34eaf4e32c129143 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 04:16:31 2022 +1300 Updated Current Image Button Styling commit 1ae80f5ab9d00a25e0c3a21e2eccd318c5343401 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 04:07:57 2022 +1300 Readd Hotkey for Dual Display commit 1f0bd3ca6cda4221d1a7a46325f235cd23bd0af9 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu Nov 3 02:07:00 2022 +1100 Adds escape hotkey to close floating panels commit a1971f6830306b3d748f7f36c2243f6dee682f97 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 03:38:15 2022 +1300 Fix Loopback Styling commit c6118e889895ba35a191124ce1beb5d2b719366d Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu Nov 3 01:29:51 2022 +1100 Address feedback - moves mask clear button - fixes intermediates - shrinks inpainting icons by 10% commit 7ba958cf7ff4e804a127b71c88666084f81e7340 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu Nov 3 01:10:38 2022 +1100 Restores "initial image" text commit 383905d5d24359aa1824de96ff124a8f8a87e015 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 02:59:11 2022 +1300 Add Save Intermediates Step Count For accurate mode only. Co-Authored-By: Richard Macarthy <richardmacarthy@protonmail.com> commit 6173e3e9cabd5e74fb466d55d7bb6a80a77b3fa8 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu Nov 3 00:53:53 2022 +1100 Refactor canvas buttons + more commit 3feb7d8922b0e4c9f944e96b95211003f40d9705 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu Nov 3 00:49:23 2022 +1100 Fixes next/prev image buttons commit 1d9edbd0ddd6e10cf120fe0de3db0b56ae374db4 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 00:50:44 2022 +1300 Update Icon Button Checkbox Style Styling commit d439abdb89db73e652add9df371234861189d90c Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 21:37:24 2022 +1100 Makes fast-latents in progress default commit ee47ea0c891a33049bdec12f1c254926f341eff2 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 21:37:09 2022 +1100 Adds min width to ImageUploader commit 300bb2e6279c1c477131b9e57425db348062f19c Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 21:28:22 2022 +1100 Fixes current image button rerenders commit ccf8593501d23e00979f7340f8991514e6ca3428 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 21:27:43 2022 +1100 Fixes display progress images select typing commit 0fda612f3ff8ad75932e158b9b29cf64c3f30eb6 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 21:02:01 2022 +1100 Fixes edge case: upload over gets stuck while alt tabbing - Press esc to close it now commit 5afff65b71bb60d067392c120efff1a17adc66af Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 20:33:19 2022 +1100 Fixes progress images select commit 7e55bdefce8920831cac7b9fa857bfbffe9e9d5d Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 20:27:47 2022 +1100 Only generate 1 iteration when seed fixed & variations disabled commit 620cf84d3dd54b8498e84574f33040a26d4d315f Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 19:51:38 2022 +1100 Reworks CurrentImageButtons.tsx - Change all icons to FA iconset for consistency - Refactors IAIIconButton, IAIButton, IAIPopover to handle ref forwarding - Redesigns buttons into group commit cfe567c62ad3fd0cff5e3e579a2250ca5dfa2d53 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 16:14:50 2022 +1100 Fixes: uploaded JPG images not loading commit cefe12f1df72e051f109ed77ce46f18093b3b8bb Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 15:31:18 2022 +1100 Styling changes and settings modal minor refactor commit 1e51c3992853ad4643d8eda2443a3bd0d65f5f90 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 15:27:46 2022 +1100 Fixes crash related to old value of progress_latents in state commit 42a02bbb8087cd46a1b5c795b1b41e38c08ba229 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 13:15:06 2022 +1100 Adds asCheckbox to IAIIconButton Rough draft of this. Not happy with the styling but it's clearer than having them look just like buttons. commit f1ae6dae4c36e74ca8dedf8b57eb8933c059dcf4 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 13:13:56 2022 +1100 Adds alert for bounding box size to status icons commit 6195579910a91fb2ab7e1186aa1c1145566c3122 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 11:52:19 2022 +1100 Restores shift+q bounding box shortcut commit 16c8b23b347792d7811cff66a27d350fe5d0d62c Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 11:32:07 2022 +1100 Changes Report Bug icon to a bug commit 07ae626b22554b5222a3b71d1ce3974e2c3fb284 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 11:17:16 2022 +1100 Removes unused isReady state commit 8d171bb044f578d4b9cc4911edfa05b20a01d373 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 11:13:26 2022 +1100 Fixes crash when requesting post-generation upscale/face restoration - Moves the inpainting paste to before the postprocessing. commit 6e33ca7e9e64fb355430511e28bb08c32c9c68b1 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 10:59:01 2022 +1100 Fixes rerenders on ClearBrushHistory commit db46e12f2b8c98dac8895ea4d04242d3754dbec4 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 11:36:28 2022 +1300 Inpainting Controls Code Spitting and Performance Codesplit the entirety of the inpainting controls. Created new selectors for each and every component to ensure there are no unnecessary re-renders. App feels a lot smoother. commit 868e4b2db82fa8556b423111f2f8d565a70ec129 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 07:40:31 2022 +1300 [Code Splitting] Bounding Box Options Isolated all bounding box components to trigger unnecessary re-renders. Still need to fix bounding box triggering re-renders on the control panel inside the canvas itself. But the options panel should be a good to go with this change. commit 2e562742c13988a1fc299c673a97ba4e4a645aaf Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 06:40:27 2022 +1300 Fix Bounding Box Settings re-rendering on brush stroke commit 68e69580091fc1dc1d8b6e03c9e7ef777c7ebf61 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 06:28:34 2022 +1300 Fresh Bundle commit ea6e3a7949f2743711516261cb7e450517d39702 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 06:26:56 2022 +1300 [TESTING] Remove global isReady checking I dont believe this is need at all because the isready state is constantly updated when needed and tracked real time in the Redux store. This causes massive re-renders. @psychedelicious If this is absolutely essential for a reason that I do not see, please hit me up on Discord. commit b2879ca99f88869277c474185ade049914b0bf26 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 06:08:59 2022 +1300 Code Split Inpaint Options Isolate features to their own components so they dont re-render the other stuff each time. commit 4e911566c33989392eb3279049b15331ca98594a Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 03:50:56 2022 +1300 Preventing unnecessary re-renders across the app commit 9bafda6a152778893df143776ae859a3b8b7f192 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 03:02:35 2022 +1300 Fix Inpainting Alerts Styling commit 871a8a5375cae891f22eb853ffd2d22298298b11 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 23:52:07 2022 +1100 Adds hints when unable to invoke - Popover on Invoke button indicates why exactly it is disabled, e.g. prompt is empty, something else is processing, etc. - There may be more than one reason; all are displayed. commit 0eef74bc00d3c0cedc5037c1deeef1d9a5b6d33d Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 23:40:11 2022 +1100 Address bounding box feedback - Adds back toggle to hide bounding box - Box quick toggle = q, normal toggle = shift + q - Styles canvas alert icons commit 423ae3209782f1d8d321b2ed9ed00712b726adf7 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 17:06:07 2022 +1100 Improves bounding box interaction Added spacebar-hold-to-transform back. commit 8282e5d0458ca1bba5565c069093b5389f2228d4 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 16:57:07 2022 +1100 Builds fresh bundle commit 19305cdbdf6ac74833bd6011bff0ced8e9d36f69 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 16:51:11 2022 +1100 Styles image uploader commit eb9028ab3069bca9d747aca664ca60ae13ba6df8 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 16:51:03 2022 +1100 Disabled bounding box settings when locked commit 21483f5d0731bce5aa97985e722a64bf0d7cd12c Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 16:50:24 2022 +1100 Fixes silent crash when init image too large To send the mask to the server, the UI rendered the mask onto the init image and sent the whole image. The mask was then cropped by the server. If the image was too large, the app silently failed. Maybe it exceeds the websocket size limit. Fixed by cropping the mask in the UI layer, sending only bounding-box-sized mask image data. commit 82dcbac28f140aa7bd89d967bcc7fa31cb03a267 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 16:28:30 2022 +1100 Improves bounding box interactions - Bounding box can now be moved by dragging any of its edges - Bounding box does not affect drawing if already drawing a stroke - Can lock bounding box to draw directly on the bounding box edges - Removes spacebar-hold behaviour due to technical issues commit d43bd4625d64a03d90de0458ad5fcacef211a8a6 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 15:10:49 2022 +1100 Fixes hotkeys and settings buttons not working commit ea891324a2086faf8eeeeac7eaf47ae2935322fb Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 11:04:02 2022 +1100 Changes inpainting controls settings to hover commit 8fd9ea219390493f392e690eadb23c4209a4ecfc Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 11:03:41 2022 +1100 Adds missing tooltips to site header commit fb026668563b3179805819a1630c654c9ce260d9 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 11:03:25 2022 +1100 Increases workarea split padding to 1rem commit f6f5c2731b0c37089c5d7382736f973e857df712 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 11:03:10 2022 +1100 Decreases gallery width on inpainting commit b4e3f771e0314e0a18ad5cedc80b28f246fced59 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 10:54:59 2022 +1100 Fixes bugs/styling - Fixes missing web app state on new version: Adds stateReconciler to redux-persist. When we add more values to the state and then release the update app, they will be automatically merged in. Reseting web UI will be needed far less. 7159ec - Fixes console z-index - Moves reset web UI button to visible area commit 99bb9491ac97f1f733accab839ea38cdf4870ba0 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Tue Nov 1 08:35:45 2022 +1300 [WebUI] Loopback Default False commit 0453f211278a533a49fb1aee54dd989b69179c10 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 23:23:51 2022 +1300 Fresh Build For WebUI commit 9fc09aa4bda3b3e6139b026f24733a37747d373f Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 09:08:11 2022 +0100 don't log base64 progress images commit 5e87062cf809a08242d3b006b66d3bbb834ddb16 Author: spezialspezial <75758219+spezialspezial@users.noreply.github.com> Date: Wed Nov 2 00:21:27 2022 +0100 Option to directly invert the grayscale heatmap - fix commit 3e7a459990407ad1679f38d4027c19d50a9d36e3 Author: spezialspezial <75758219+spezialspezial@users.noreply.github.com> Date: Tue Nov 1 21:37:33 2022 +0100 Update txt2mask.py commit bbf4c03e500bafc8627c2a70f8b3396efeddabb3 Author: spezialspezial <75758219+spezialspezial@users.noreply.github.com> Date: Tue Nov 1 21:11:19 2022 +0100 Option to directly invert the grayscale heatmap Theoretically less work inverting the image while it's small but I can't measure a significant difference. Though, handy option to have in some cases. commit 611a3a975328a7e276c2781214d5e14108708ed7 Author: mauwii <Mauwii@outlook.de> Date: Wed Nov 2 02:23:09 2022 +0100 fix name of caching step commit 1611f0d1815022fe90d33f41c21d670251a75f29 Author: mauwii <Mauwii@outlook.de> Date: Wed Nov 2 02:18:46 2022 +0100 readd caching of sd-models - this would remove the necesarrity of the secret availability in PRs commit 08835115e4c5c0ee3587ce07ab769a04d55cb3c5 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 22:10:12 2022 -0400 pin pytorch_lightning to 1.7.7, issue #1331 commit 2d84e28d329be282b51a4cbc22f7c200d80c8f0e Merge: 533fd04e ef17aae8 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 22:11:04 2022 -0400 Merge branch 'development' of github.com:invoke-ai/InvokeAI into development commit ef17aae8abe03fd87dc6f91b3c6d2fe03375f6c5 Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 00:39:48 2022 +0100 add damian0815 to contributors list commit 0cc39f01a3c67f32873b7888e1e032d33626e269 Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 01:18:50 2022 +0100 report full size for fast latents and update conversion matrix for v1.5 commit 688d7258f185035a5924bee23322b001574da931 Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 00:33:00 2022 +0100 fix a bug that broke cross attention control index mapping commit 4513320bf161d3efdd99e2aef4f7c37472131373 Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 00:31:58 2022 +0100 save VRAM by not recombining tensors that have been sliced to save VRAM commit 533fd04ef0d1ba9d2cb25d556991b999e7d44aba Merge: 6215592b dff5681c Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 17:40:36 2022 -0400 Merge branch 'development' of github.com:invoke-ai/InvokeAI into development commit dff5681cf0e24faf67d5eb5903203c4ea39f89bd Author: damian0815 <d@d.com> Date: Tue Nov 1 13:56:03 2022 +0100 shorter strings commit 5a2790a69b11e049d2507bc22eab7812915d867f Author: damian0815 <d@d.com> Date: Tue Nov 1 13:19:20 2022 +0100 convert progress display to a drop-down commit 7c5305ccbaf7926162536aa3a9e51dcdd8574d0d Author: damian0815 <d@d.com> Date: Tue Nov 1 12:54:46 2022 +0100 do not try to save base64 intermediates in gallery on cancellation commit 4013e8ad6fa5e5c2a710c607fe7e1d040f353299 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 21:54:35 2022 +1100 Fixes b64 image sending and displaying commit d1dfd257f9e1cafd352d9007a56194226b9d6b63 Author: damian <d@d.com> Date: Tue Nov 1 11:40:40 2022 +0100 wip base64 commit 5322d735ee4515d89293b7fb015b2ce048262f68 Author: damian <d@d.com> Date: Tue Nov 1 11:31:42 2022 +0100 update frontend commit cdb107dcda858a8bb64455cc60a196a42345f8f7 Author: damian <d@d.com> Date: Tue Nov 1 11:17:43 2022 +0100 add option to show intermediate latent space commit be1393a41ce7a75ed8de7f648a93c5e5974a50d2 Author: damian <d@d.com> Date: Tue Nov 1 10:16:55 2022 +0100 ensure existing exception handling code also handles new exception class commit e554c2607f00a5e51c03052acb9861ff21ec1c12 Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Tue Nov 1 10:08:42 2022 +0100 Rebuilt prompt parsing logic Complete re-write of the prompt parsing logic to be more readable and logical, and therefore also hopefully easier to debug, maintain, and augment. In the process it has also become more robust to badly-formed prompts. Squashed commit of the following: commit 8fcfa88a16e1390d41717e940d72aed64712171c Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Sun Oct 30 17:05:57 2022 +0100 further cleanup commit 1a1fd78bcfeb49d072e3e6d5808aa8df15441629 Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Sun Oct 30 16:07:57 2022 +0100 cleanup and document commit 099c9659fa8b8135876f9a5a50fe80b20bc0635c Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Sun Oct 30 15:54:58 2022 +0100 works fully commit 5e6887ea8c25a1e21438ff6defb381fd027d25fd Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Sun Oct 30 15:24:31 2022 +0100 further... commit 492fda120844d9bc1ad4ec7dd408a3374762d0ff Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Sun Oct 30 14:08:57 2022 +0100 getting there... commit c6aab05a8450cc3c95c8691daf38fdc64c74f52d Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Fri Oct 28 14:29:03 2022 +0200 wip doesn't compile commit 5e533f731cfd20cd435330eeb0012e5689e87e81 Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Fri Oct 28 13:21:43 2022 +0200 working with CrossAttentionCtonrol but no Attention support yet commit 9678348773431e500e110e8aede99086bb7b5955 Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Fri Oct 28 13:04:52 2022 +0200 wip rebuiling prompt parser commit 6215592b12dea3822c727913b771012789a52477 Merge: ef24d76a 349cc254 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 17:34:55 2022 -0400 Merge branch 'development' of github.com:invoke-ai/InvokeAI into development commit 349cc25433e1d358c6c61cca4a6c300ecc8ca3d7 Author: damian0815 <d@d.com> Date: Tue Nov 1 20:08:52 2022 +0100 fix crash (be a little less aggressive clearing out the attention slice) commit 214d276379387ae0fa2259602ab00884ec1ad03e Author: damian0815 <d@d.com> Date: Tue Nov 1 19:57:55 2022 +0100 be more aggressive at clearing out saved_attn_slice commit ef24d76adc5a192297714707cd6794d4f44bcf67 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 14:34:23 2022 -0400 fix library problems in preload_modules commit ab2b5a691dadb292f7cecf5db94a165db3e3e126 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 17:22:48 2022 -0400 fix model_cache memory management issues commit c7de2b2801ad5d6ce52a5f44e88c5705f1dbf524 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 02:02:14 2022 +0100 disable checks with sd-V1.4 model... ...to save some resources, since V1.5 is the default now commit e8075658acf675346d35435d0cfb7710becab42a Author: mauwii <Mauwii@outlook.de> Date: Mon Oct 31 22:20:51 2022 +0100 update test-invoke-conda.yml - fix model dl path for sd-v1-4.ckpt - copy configs/models.yaml.example to configs/models.yaml commit 4202dabee1143f597f4c3946420fbfa7b8eccddf Author: mauwii <Mauwii@outlook.de> Date: Mon Oct 31 22:17:21 2022 +0100 fix models example weights for sd-v1.4 commit d67db2bcf1ac26d8bb7c5f8bfd056f2172597780 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Tue Nov 1 08:35:45 2022 +1300 [WebUI] Loopback Default False commit 7159ec885faa1117a3506689d547618be1d91808 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Mon Oct 31 11:33:05 2022 -0400 further improvements to preload_models.py - Faster startup for command line switch processing - Specify configuration file to modify using --config option: ./scripts/preload_models.ply --config models/my-models-file.yaml commit b5cf734ba9f1aeaab14075b55cc13ed9a0ae31e2 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Mon Oct 31 11:08:19 2022 -0400 improve behavior of preload_models.py - NEVER overwrite user's existing models.yaml - Instead, merge its contents into new config file, and rename original to models.yaml.orig (with message) - models.yaml has been removed from repository and renamed models.yaml.example commit f7dc8eafeef991e135b5541c01d0ff740dda9591 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Mon Oct 31 10:47:35 2022 -0400 restore models.yaml to virgin state commit 762ca60a309f70daaf1b9e79b6273f76fd9474b6 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Oct 4 22:55:10 2022 -0400 Update INPAINTING.md commit e7fb9f342cb5ed0c09e6215026d60d45eef3ebcb Author: Hideyuki Katsushiro <h.katsushiro@qualia.tokyo.jp> Date: Wed Oct 5 10:08:53 2022 +0900 add argument --outdir
2022-11-12 17:17:07 +00:00
opt.seed = seed
opt.prompt = prompt
merge release-candidate-1-3-2 into main. Squashed commit of the following: commit 9a1fe8e7fbbd81d9e9e47c4fda6bde6f66fba30c Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 12 17:07:40 2022 +0000 swap in release URLs for installers commit ff56f5251ba8502833cb561317e82b028cd2da5d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 12 17:03:21 2022 +0000 fix up bad unicode chars in invoke.py commit ed943bd6c785d968d1e31fbbb814fea8688fc8bb Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 12 16:05:45 2022 +0000 outcrop improvements, hand-added commit 7ad2355b1da53861bb75312edead8f9db0b0f44d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 12 15:14:33 2022 +0000 documentation fixes commit 66c920fc197d9206be9e0e2d1eb2a1cb86362887 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 16:49:25 2022 -0500 Revert "Resize hires as an image" This reverts commit d05b1b3544dfa7b3c071ac05b4f014a52e08fa50. commit 3fc5cb09f8bc03ea96e67a3e49fb087019d2f9d5 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 12 12:43:17 2022 +0000 fix incorrect link in install commit 1345ec77ab58f70e1bf5a0f587ca40aba4e906b7 Author: tildebyte <337875+tildebyte@users.noreply.github.com> Date: Sun Nov 6 19:07:31 2022 -0500 toil(repo): add tildebyte as owner of installer/ directory commit b116715490f390a59e5bee1022a6a758aee0918d Author: Kyle Schouviller <kyle0654@hotmail.com> Date: Thu Nov 10 21:43:56 2022 -0800 Fix performance issue introduced by torch cuda cache clear during generation commit fa3670270e7aae6bfd8d47fb7bdd32b707310c23 Author: mauwii <Mauwii@outlook.de> Date: Fri Nov 11 12:42:03 2022 +0100 small update to dockers huggingface section commit c304250ef663b3e202b4da8332365288589d94c7 Author: mauwii <Mauwii@outlook.de> Date: Fri Nov 11 12:19:27 2022 +0100 fix format and Link in INSTALL_INVOKE.md commit 802ce5dde5ca68f24aa4609cdba428044e0c7fa1 Author: mauwii <Mauwii@outlook.de> Date: Fri Nov 11 11:17:49 2022 +0100 small fixex to format and a link in INSTALL_MANUAL commit 311ee320ecac892cb4a1bcd012374fa051b1d011 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 07:23:35 2022 +0000 ignore installer intermediate files commit e9df17b374df58a44d3ae3ba33cbdc58794bcf5d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 07:19:25 2022 +0000 fix backslash-related syntax error commit 061fb4ef00482bdd4fba635aeaeff4ca7510190d Merge: 52be0d23 4095acd1 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 06:50:04 2022 +0000 Merge branch 'release-candidate-2-1-3' of github.com:/invoke-ai/InvokeAI into release-candidate-2-1-3 commit 52be0d2396de2de02030855c92e3367008b50377 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 06:49:45 2022 +0000 add WindowsLongFileName batfile to source installer commit 4095acd10ebae05a8cb14cc2faf7c79936d9e6a9 Author: mauwii <Mauwii@outlook.de> Date: Fri Nov 11 07:05:17 2022 +0100 Doc Updates A lot of re-formating of new Installation Docs also some content updates/corrections commit 201eb22d7650b00f55249c2646fa4f47ac3e0ec2 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 04:41:02 2022 +0000 prevent two models from being marked default in models.yaml commit 17ab98220034dfbb798a9a0460bc2837f0c1e2cb Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 03:56:54 2022 +0000 installers download branch HEAD not tag commit a04965b0e9e9d1170cf284af9acbd1186d681255 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 03:48:21 2022 +0000 improve messaging during installation process commit 0b529f0c574dd91fb9593e924ebc41c8c219b6ce Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 15:22:32 2022 +0000 enable outcropping of random JPG/PNG images - Works best with runwayML inpainting model - Numerous code changes required to propagate seed to final metadata. Original code predicated on the image being generated within InvokeAI. commit 6f9f84834557eb3c48562dc5d0ace51ca9e9cca2 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 17:27:42 2022 +0000 enhance outcropping with ability to direct contents of new regions - When outcropping an image you can now add a `--new_prompt` option, to specify a new prompt to be used instead of the original one used to generate the image. - Similarly you can provide a new seed using `--seed` (or `-S`). A seed of zero will pick one randomly. - This PR also fixes the crash that happened when trying to outcrop an image that does not contain InvokeAI metadata. commit 918c1589ef30595668899f4259ece6a4ad605c69 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 20:16:47 2022 +0000 fix #1402 commit 116415b3fcec8415f8e6de9b23c0bbd0dbc6845b Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 21:27:25 2022 +0000 fix invoke.py crash if no models.yaml file present - Script will now offer the user the ability to create a minimal models.yaml and then gracefully exit. - Closes #1420 commit b4b6eabaac94896e38123be331c44d1b63065b0d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 16:49:25 2022 -0500 Revert "Log strength with hires" This reverts commit 82d4904c07670d514e9a541de7c9ecd8489eeae2. commit 4ef1f4a854717c953f9192454d0adabef32af36c Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 20:01:49 2022 +0000 remove temporary directory from repo commit 510fc4ebaa5f9dc0e77b47cf04e0c265423e0a44 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 19:59:03 2022 +0000 remove -e from clipseg load in installer commit a20914434bb3609cf1d883cabf048d4cc25f881a Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 19:37:07 2022 +0000 change clipseg repo branch to avoid clipseg not found error commit 0d134195fda5c69fce5a95d6da90248eba8d226d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 18:39:29 2022 +0000 update repo URL to point to rc commit 649d8c8573896fdb5a73453b69ee4b54cf4d6241 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 18:13:28 2022 +0000 integrate tildebyte installer commit a358d370a05ea985a9e26fa9c1101d9c14fdb3ab Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 17:48:14 2022 +0000 add @tildebyte compiled pip installer commit 94a9033c4f6214e604be149a3de6d7c747af7f3a Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 14:52:00 2022 +0000 ignore source installer zip files commit 18a947c503c83c95cd83f27424696219ff3c4c95 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 14:46:36 2022 +0000 documentation and environment file fixes - Have clarified the relationship between the @tildebyte and @cmdr2 installers; However, @tildebyte installer merge is still a WIP due to conflicts over such things as `invoke.sh`. - Rechristened 1click installer as "source" installer. @tildebyte installer will be "the" installer. (We'll see which one generates the least support requests and maintenance work.) - Sync'd `environment-mac.yml` with `development`. The former was failing with a taming-transformers error as per https://discord.com/channels/@me/1037201214154231899/1040060947378749460 commit a23b03189526a49da8ddae90ce71b0e902784d29 Author: Mike DiGiovanni <vinblau@gmail.com> Date: Wed Nov 9 16:44:59 2022 -0500 Fixes typos in README.md commit 23af68c7d79d947f1bd3441c91bb44d655238f01 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 07:02:27 2022 -0500 downgrade win installs to basicsr==1.4.1 commit e258beeb51f3e645b9ea60e52d69d18722221cc5 Merge: 7460c069 e481bfac Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 06:37:45 2022 -0500 Merge branch 'release-candidate-2-1-3' of github.com:invoke-ai/InvokeAI into release-candidate-2-1-3 commit 7460c069b880b10c84b55f2e0c0998e350d6cf12 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 06:36:48 2022 -0500 remove --prefer-binary from requirements-base.txt It appears that some versions of pip do not recognize this option when it appears in the requirements file. Did not explore this further but recommend --prefer-binary in the manual install instructions on the command line. commit e481bfac615e0c798ceb5e59e8fbe3038f85b431 Merge: 5040747c d1ab65a4 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 11:21:56 2022 +0000 Merge branch 'release-candidate-2-1-3' of github.com:/invoke-ai/InvokeAI into release-candidate-2-1-3 commit 5040747c6700c9b949e3f3e1d2c3f21daffcec6c Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 11:21:43 2022 +0000 fix windows install instructions & bat file commit d1ab65a43122f73c20533d5815590ec10bc05eca Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 07:18:59 2022 +0100 update WEBUIHOTKEYS.md commit af4ee7feb8a7d2528bf4e2b3f7deee7a7c4c3dec Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 06:33:49 2022 +0100 update INSTALL_DOCKER.md commit 764fb29aded8114984d05932c4266ea24614b932 Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 06:30:15 2022 +0100 fix formatting in INSTALL.md commit 1014d3ba44aa4cd4cfdc6e3650c24a0dc9568a6e Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 06:29:14 2022 +0100 fix build.sh invokeai_conda_env_file default value commit 40a48aca88e337e9f4475f80a03b7d6d4751d09b Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 05:25:30 2022 +0100 fix environment-mac.yml moved taming-transformers-rom1504 to pip dependencies commit 92abc00f16a34a586dd16d3c64408f00e23fcb53 Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 05:19:52 2022 +0100 fix test-invoke-conda - copy required conda environment yaml - use environment.yml - I use cp instead of ln since would be compatible for windows runners commit a5719aabf89c8c5f29c6044e2882ccdcd0c6916b Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 04:14:35 2022 +0100 update Dockerfile - link environment.yml from new environemnts path - change default conda_env_file - quote all variables to avoid splitting - also remove paths from conda-env-files in build-container.yml commit 44a18511fa7accfec6a20345774583a1ce745b02 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 20:51:06 2022 +0000 update paths in container build workflow commit b850dbadafba052310327ca759d96f49a9d25d03 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 20:16:57 2022 +0000 finished reorganization of install docs commit 9ef8b944d53afb1fed94c418b2fd936d2d743797 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 18:50:58 2022 +0000 tweaks to manual install documentation --prefer-binary is an iffy option in the requirements file. It isn't supported by some versions of pip, so I removed it from requirements-base.txt and inserted it into the manual install instructions where it seems to do what it is supposed to. commit efc5a9848803b4250d726bc1913b9fd5a33fad75 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 18:20:03 2022 +0000 manual installation documentation tested on Linux commit 1417c87928e13b0ed21bf1c5604f8636d3b50a8d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 17:37:06 2022 +0000 change name of requirements.txt to avoid confusion commit 2dd6fc2b93ff7bbb4038568a3b28d36a8fafaeb8 Merge: 22213612 71ee44a8 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 17:26:24 2022 +0000 Merge branch 'release-candidate-2-1-3' of github.com:/invoke-ai/InvokeAI into release-candidate-2-1-3 commit 22213612a08bbece46eafd48994f985b097cb141 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 17:25:59 2022 +0000 directory cleanup; working on install docs commit 71ee44a827898759fd457f774c0b2ac7a1ef6519 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 02:07:13 2022 +0000 prevent crash when switching to an invalid model commit b17ca0a5e731c142101bbdbf34d121df949e86d7 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 14:28:38 2022 +0100 don't suppress exceptions when doing cross-attention control commit 71bbfe4a1a5b70f90e5f41c94df50fb104dbdd79 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 12:59:34 2022 +0100 Fix #1362 by improving VRAM usage patterns when doing .swap() commit ef3f7a26e242b73c2beb0195c7fd8f654ef47f55 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 12:18:37 2022 +0100 remove log spam commit 7189d649622d4668b120b0dd278388ad672142c4 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 12:10:28 2022 +0100 change the way saved slicing strategy is applied commit 01c40f751ab72955140165c16f95ae411732265b Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 12:04:43 2022 +0100 fix slicing_strategy_getter callsite commit f8cfe25150a346958903316bc710737d99839923 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 11:56:22 2022 +0100 cleanup, consistent dim=0 also tested commit 5bf9b1e890d48e962afd4a668a219b68271e5dc1 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 11:34:09 2022 +0100 refactored context, tested with non-sliced cross attention control commit d58a46e39bf562e7459290d2444256e8c08ad0b6 Author: damian0815 <null@damianstewart.com> Date: Sun Nov 6 00:41:52 2022 +0100 cleanup commit 7e2c658b4c06fe239311b65b9bb16fa3adec7fd7 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:57:31 2022 +0100 disable logs commit 20ee89d93841b070738b3d8a4385c93b097d92eb Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:36:58 2022 +0100 slice saved attention if necessary commit 0a7684a22c880ec0f48cc22bfed4526358f71546 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:32:38 2022 +0100 raise instead of asserting commit 7083104c7f3a0d8fd96e94a2f391de50a3c942e4 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:31:00 2022 +0100 store dim when saving slices commit f7c0808ed383ec1dc70645288a798ed2aa4fa85c Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:27:16 2022 +0100 don't retry on exception commit 749a721e939b3fe7c1741e7998dab6bd2c85a0cb Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:24:50 2022 +0100 stuff commit 032ab90e9533be8726301ec91b97137e2aadef9a Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:20:17 2022 +0100 more logging commit 3dc34b387f033482305360e605809d95a40bf6f8 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:16:47 2022 +0100 logs commit 901c4c1aa4b9bcef695a6551867ec8149e6e6a93 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:12:39 2022 +0100 actually set save_slicing_strategy to True commit f780e0a0a7c6b6a3db320891064da82589358c8a Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:10:35 2022 +0100 store slicing strategy commit 93bb6d566fd18c5c69ef7dacc8f74ba2cf671cb7 Author: damian <git@damianstewart.com> Date: Sat Nov 5 20:43:48 2022 +0100 still not it commit 5e3a9541f8ae00bde524046963910323e20c40b7 Author: damian <git@damianstewart.com> Date: Sat Nov 5 17:20:02 2022 +0100 wip offloading attention slices on-demand commit 4c2966aa856b6f3b446216da3619ae931552ef08 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 15:47:40 2022 +0100 pre-emptive offloading, idk if it works commit 572576755e9f0a878d38e8173e485126c0efbefb Author: root <you@example.com> Date: Sat Nov 5 11:25:32 2022 +0000 push attention slices to cpu. slow but saves memory. commit b57c83a68f2ac03976ebc89ce2ff03812d6d185f Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 12:04:22 2022 +0100 verbose logging commit 3a5dae116f110a96585d9eb71d713b5ed2bc3d2b Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 11:50:48 2022 +0100 wip fixing mem strategy crash (4 test on runpod) commit 3cf237db5fae0c7b0b4cc3c47c81830bdb2ae7de Author: damian0815 <null@damianstewart.com> Date: Fri Nov 4 09:02:40 2022 +0100 wip, only works on cuda commit 5702271991e126c026aa1ff41c44f8ad37b26e3a Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 14:09:36 2022 +0000 speculative reorganization of the requirements & environment files - This is only a test! - The various environment*.yml and requirements*.txt files have all been moved into a directory named "environments-and-requirements". - The idea is to clean up our root directory so that the github home page is tidy. - The manual install instructions will start with the instructions to create a symbolic link from environment.yml to the appropriate file for OS and GPU. - The 1-click installers have been updated to accommodate this change. commit 10781e7dc4f4551583a110d14f2a1f60393112b8 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 01:59:45 2022 +0000 refactoring requirements commit 099d1157c579c7b9fea20945e8504cc15745c598 Author: mauwii <Mauwii@outlook.de> Date: Wed Nov 9 00:16:18 2022 +0100 better way to make sure if conda is useable commit ab825bf7ee5f0b82d2273da1cda64fc9266a978e Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 22:05:33 2022 +0000 add back --prefer-binaries to requirements commit 10cfeb5ada7bcfc9f3aff3716ab8ea4961a8b528 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 8 22:27:19 2022 +0100 add quotes to set and use `$environment_file` commit e97515d0453583e013674b4dd1f3739c7de402cc Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 8 22:24:21 2022 +0100 set environment file for conda update commit 0f04bc5789c712bf7c7319b1d93064914993f4ec Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 8 22:21:25 2022 +0100 use conda env update commit 3f74aabecd08ed25fac158463ae12b775bd1fca2 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 8 22:20:44 2022 +0100 use command instead of hash commit b1a99a51b7ca23c4b895855bd7b4c82dbdc431e4 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 14:44:44 2022 -0500 remove --global git config from 1-click installers commit 8004f8a6d99f6ff75e00c170da40f1dec93a8914 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Mon Nov 7 09:07:20 2022 -0500 Revert "Use array slicing to calc ddim timesteps" This reverts commit 1f0c5b4cf196716c21f2db74f92c8750ad8f889d. commit ff8ff2212afb1e1c2dce4f6a61f29e2bc8302eb5 Merge: 8e5363cd 636620b1 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 14:01:40 2022 +0000 add initfile support from PR #1386 commit 8e5363cd83bff0e6be0f002c644283955f7fcbfd Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 13:26:18 2022 +0000 move 'installer/' to '1-click-installer' to make room for tildebyte installer commit 1450779146e89510d12b8c90eb316d9861c3375e Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 12:56:36 2022 +0000 update branch for installer to pull against commit 8cd5d95b8a1cb213cce2f949c394c841a09d9cab Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 05:30:20 2022 +0000 move all models into subdirectories of ./models - this required an update to the invoke-ai fork of gfpgan - simultaneously reverted consolidation of environment and requirements files, as their presence in a directory triggered setup.py to try to install a sub-package. commit abd6407394d55d4f6c064a05f3ac989dd3817c59 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 03:52:46 2022 +0000 leave a copy of environment-cuda.yml at top level - named it environment.yml - need to avoid a big change for users and breaking older support instructions. commit 734dacfbe9d8c86ca943c6541e7b5ff5ef787ff4 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 03:50:07 2022 +0000 consolidate environment files - starting to remove unneeded entries and pins - no longer require -e in front of github dependencies - update setup.py with release number - update manual installation instructions commit 636620b1d5e2466613d0dcc2a604522be12fa3a4 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 03:26:16 2022 +0000 change initfile to ~/.invokeai - adjust documentation - also fix 'clipseg_models' to 'clipseg', which seems to be working now commit 1fe41146f0975bbc9d552208473490a9ccb9fc56 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 5 14:28:01 2022 -0400 add support for an initialization file, invokeai.init - Place preferred startup command switches in a file named "invokeai.init". The file can consist of a single line of switches such as "--web --steps=28", a series of switches on each line, or any combination of the two. Example: ``` --web --host=0.0.0.0 --steps=28 --grid -f 0.6 -C 11.0 -A k_euler_a ``` - The following options, which were previously only available within the CLI, are now available on the command line as well: --steps --strength --cfg_scale --width --height --fit commit 2ad6ef355a9b9c4b17bae71edea2346c2e8708c5 Merge: 865502ee 8b47c829 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sun Nov 6 18:08:36 2022 +0000 update discord link commit 865502ee4f681de4516d231370ae603983354d8f Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 18:00:16 2022 +0100 update changelog commit c7984f3299c5c8f56a70d80907d527af458674af Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 17:07:27 2022 +0100 update TROUBLESHOOT.md commit 7f150ed83302ba875c3e0c0f39d8ac0f32c6e362 Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 16:56:58 2022 +0100 remove `:`from headlines in CONTRIBUTORS.md commit badf4e256ce6e3201df1a9a87a7072b36b18d699 Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 16:56:37 2022 +0100 enable navigation tabs Since the docs are growing, this way they look cleaner commit e64c60bbb38fc1620e08ce52bf28bd17003c7ef6 Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 16:18:59 2022 +0100 remove preflight checks from assets seems like somebody executed tests and commited them commit 178061854300632b024810e65922b54b64d95939 Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 16:15:06 2022 +0100 update INSTALLING_MODELS.md commit f91fd276242a0c92b301e99d02982d30f7b712c3 Author: Kyle Schouviller <kyle0654@hotmail.com> Date: Sat Nov 5 14:47:53 2022 -0700 Bug fix for inpaint size commit 09e41e8f769457b9ffd56901aae13991cdc6eeb8 Author: Kyle Schouviller <kyle0654@hotmail.com> Date: Sat Nov 5 14:34:52 2022 -0700 Add inpaint size options to inpaint at a larger size than the actual inpaint image, then scale back down for recombination commit 6eeb2107b300fc27cfe6134b43e5570c246b8e96 Author: mauwii <Mauwii@outlook.de> Date: Sat Nov 5 21:01:14 2022 +0100 remove create-caches.yml since not used anywhere commit 17053ad8b7efecb21a9b4eb32695089f683f72e3 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 5 16:01:55 2022 -0400 fix duplicated argument introduced by conflict resolution commit fefb4dc1f88bc6551a39602a2bc79b278cd83c59 Merge: 762ca60a d05b1b35 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 5 12:47:35 2022 -0700 Merge branch 'development' into fix_generate.py commit d05b1b3544dfa7b3c071ac05b4f014a52e08fa50 Author: Craig <cwallen@users.noreply.github.com> Date: Sat Oct 29 20:40:30 2022 -0400 Resize hires as an image commit 82d4904c07670d514e9a541de7c9ecd8489eeae2 Author: Craig <cwallen@users.noreply.github.com> Date: Sat Oct 29 20:37:40 2022 -0400 Log strength with hires commit 1cdcf33cfa39e90f9660fabf8f5936dcfb6c3aa5 Merge: 6616fa83 cbc029c6 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 5 09:57:38 2022 -0400 Merge branch 'main' into development - this synchronizes recent document fixes by mauwii commit 6616fa835ac4318bf53419f2b54b88c962559578 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 4 00:47:03 2022 -0400 fix Windows library dependency issues This commit addresses two bugs: 1) invokeai.py crashes immediately with a message about an undefined attritube sigKILL (closes #1288). The fix is to pin torch at 1.12.1. 2) Version 1.4.2 of basicsr fails to load properly on Windows, and is a requirement of realesrgan, however 1.4.1 works. Pinning basicsr in our requirements file resulted in a dependency conflict, so I ended up cloning realesrgan into the invoke-ai Git space and changing the requirements file there. If there is a more elegant solution, please advise. commit 7b9a4564b11f4181b9b3c06ecda2a4a25fd1849e Author: Matthias Wild <40327258+mauwii@users.noreply.github.com> Date: Sat Nov 5 14:36:45 2022 +0100 Update-docs (#1382) * update IMG2IMG.md * update INPAINTING.md * update WEBUIHOTKEYS.md * more doc updates (mostly fix formatting): - OUTPAINTING.md - POSTPROCESS.md - PROMPTS.md - VARIATIONS.md - WEB.md - WEBUIHOTKEYS.md commit fcdefa0620761472718afa14b2955a5d0603cfcc Author: Matthias Wild <40327258+mauwii@users.noreply.github.com> Date: Fri Nov 4 20:47:31 2022 +0100 Hotifx docs (#1376) (#1377) commit ef8b3ce639954259a95a38f44fa5329687bee781 Merge: b7042095 36870a8f Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 4 12:08:44 2022 -0400 Merge-main-into-development (#1373) To get the rid of the difference between main and development. Since otherwise it will be a pain to start fixing the documentatino (when the state between main and development is not the same ...) Also this should fix the problem of all tests failing since environment yamls get updated. commit 36870a8f53217d4b733e9bb8b119190b5e36da59 Merge: 6b89adfa b7042095 Author: Matthias Wild <40327258+mauwii@users.noreply.github.com> Date: Fri Nov 4 16:25:00 2022 +0100 Merge branch 'development' into merge-main-into-development commit b70420951d5b70937c0c07e4f8a552a01c3008bc Author: damian0815 <null@damianstewart.com> Date: Thu Nov 3 12:39:45 2022 +0100 fix parsing error doing eg `forest ().swap(in winter)` commit 1f0c5b4cf196716c21f2db74f92c8750ad8f889d Author: wfng92 <43742196+wfng92@users.noreply.github.com> Date: Thu Nov 3 17:13:52 2022 +0800 Use array slicing to calc ddim timesteps commit 8648da811190fc8bcf237d83aff38cf605851300 Author: mauwii <Mauwii@outlook.de> Date: Fri Nov 4 00:06:19 2022 +0100 update environment-linux-aarch64 to use python 3.9 commit 45b459356399f8cfb7e9af571c1643fab04218fe Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 3 22:31:46 2022 +0100 update environment-linux-aarch64.yml - move getpass_asterisk to pip commit 41b04316cf5118ea9518dc77934d135a489dd684 Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 3 20:40:08 2022 +0100 rename job, remove debug branch from triggers commit e97c6db2a3c0157a8a5ab74cd28ebee480a2d078 Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 3 20:34:01 2022 +0100 include build matrix to build x86_64 and aarch64 commit 896820a349292b0e14bbc32f0c557fe8a6b45395 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 05:01:15 2022 +0100 disable caching commit 06c8f468bff7e1dfecc1a1990164be1005b114a7 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 04:26:39 2022 +0100 disable PR-Validation since there are no files passed from context this is unecesarry commit 61920e2701c4a9cea94c03ab933c4482458215b7 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 04:09:39 2022 +0100 update action to use current branch also update build-args of dockerfile and build.sh commit f34ba7ca70f1c417ee97e8b0c57abff57614d78f Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 02:30:24 2022 +0100 remove unecesarry mkdir command again commit c30ef0895dbf0565345ac6ccb136d98a174470a6 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 01:51:12 2022 +0100 remove symlink to GFPGANv1.4 also re-add mkdir to prevent action from failing commit aa3a774f73d5004571ea42fea14cd2b525fffb1c Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 01:48:59 2022 +0100 update build-container.yml to use cachev3 commit 2c30555b844293764123baa4137fcf952d40a4e7 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 01:34:20 2022 +0100 update Dockerfile - create models.yaml from models.yaml.example - run preload_models.py with --no-interactive commit 743f60577364d43237eeb46aefd523371c36e56b Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 01:21:15 2022 +0100 update build.sh to download sd-v1.5 model commit 519c661abbae83aa62b3ee536635c39192890441 Author: mauwii <Mauwii@outlook.de> Date: Tue Oct 25 01:26:50 2022 +0200 replace old fashined markdown templates with forms this will help the readability of issues a lot 🤓 commit 22c956c75f4797ddc2dffa944e3ea84b4eb3477c Merge: 13696adc 0196571a Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 3 10:20:21 2022 -0400 Merge branch 'development' of github.com:invoke-ai/InvokeAI into development commit 13696adc3a3a2b169e68048a5b511660d0430fae Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 3 10:20:10 2022 -0400 speculative change to solve windows esrgan issues commit 0196571a12992eb8207d36e022721fe3ad2cfd19 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 2 22:39:35 2022 -0400 remove merge markers from preload_models.py commit 9666f466ab1c710dfda2e59be9e8a26fcd7e8718 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 2 18:29:34 2022 -0400 use refined model by default commit 240e5486c89552ef480c3443a63283fb86a493c3 Merge: 8164b6b9 aa247e68 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 2 18:35:00 2022 -0400 Merge branch 'spezialspezial-patch-9' into development commit 8164b6b9cff077e4131384195af65e30a40733a7 Merge: 4fc82d55 dd5a88dc Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 2 17:06:46 2022 -0400 Merge branch 'development' of github.com:invoke-ai/InvokeAI into development commit 4fc82d554ff573780c0af562a6bc9586aa56012d Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 04:17:28 2022 +1300 [WebUI] Final 2.1 Release Build commit 96b34c0f85f6ed52707fe43456d20b81822c7d1d Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 09:08:11 2022 +0100 Final WebUI build for Release 2.1 - squashed commit of 52 commits from PR #1327 don't log base64 progress images Fresh Build For WebUI [WebUI] Loopback Default False Fixes bugs/styling - Fixes missing web app state on new version: Adds stateReconciler to redux-persist. When we add more values to the state and then release the update app, they will be automatically merged in. Reseting web UI will be needed far less. 7159ec - Fixes console z-index - Moves reset web UI button to visible area Decreases gallery width on inpainting Increases workarea split padding to 1rem Adds missing tooltips to site header Changes inpainting controls settings to hover Fixes hotkeys and settings buttons not working Improves bounding box interactions - Bounding box can now be moved by dragging any of its edges - Bounding box does not affect drawing if already drawing a stroke - Can lock bounding box to draw directly on the bounding box edges - Removes spacebar-hold behaviour due to technical issues Fixes silent crash when init image too large To send the mask to the server, the UI rendered the mask onto the init image and sent the whole image. The mask was then cropped by the server. If the image was too large, the app silently failed. Maybe it exceeds the websocket size limit. Fixed by cropping the mask in the UI layer, sending only bounding-box-sized mask image data. Disabled bounding box settings when locked Styles image uploader Builds fresh bundle Improves bounding box interaction Added spacebar-hold-to-transform back. Address bounding box feedback - Adds back toggle to hide bounding box - Box quick toggle = q, normal toggle = shift + q - Styles canvas alert icons Adds hints when unable to invoke - Popover on Invoke button indicates why exactly it is disabled, e.g. prompt is empty, something else is processing, etc. - There may be more than one reason; all are displayed. Fix Inpainting Alerts Styling Preventing unnecessary re-renders across the app Code Split Inpaint Options Isolate features to their own components so they dont re-render the other stuff each time. [TESTING] Remove global isReady checking I dont believe this is need at all because the isready state is constantly updated when needed and tracked real time in the Redux store. This causes massive re-renders. @psychedelicious If this is absolutely essential for a reason that I do not see, please hit me up on Discord. Fresh Bundle Fix Bounding Box Settings re-rendering on brush stroke [Code Splitting] Bounding Box Options Isolated all bounding box components to trigger unnecessary re-renders. Still need to fix bounding box triggering re-renders on the control panel inside the canvas itself. But the options panel should be a good to go with this change. Inpainting Controls Code Spitting and Performance Codesplit the entirety of the inpainting controls. Created new selectors for each and every component to ensure there are no unnecessary re-renders. App feels a lot smoother. Fixes rerenders on ClearBrushHistory Fixes crash when requesting post-generation upscale/face restoration - Moves the inpainting paste to before the postprocessing. Removes unused isReady state Changes Report Bug icon to a bug Restores shift+q bounding box shortcut Adds alert for bounding box size to status icons Adds asCheckbox to IAIIconButton Rough draft of this. Not happy with the styling but it's clearer than having them look just like buttons. Fixes crash related to old value of progress_latents in state Styling changes and settings modal minor refactor Fixes: uploaded JPG images not loading Reworks CurrentImageButtons.tsx - Change all icons to FA iconset for consistency - Refactors IAIIconButton, IAIButton, IAIPopover to handle ref forwarding - Redesigns buttons into group Only generate 1 iteration when seed fixed & variations disabled Fixes progress images select Fixes edge case: upload over gets stuck while alt tabbing - Press esc to close it now Fixes display progress images select typing Fixes current image button rerenders Adds min width to ImageUploader Makes fast-latents in progress default Update Icon Button Checkbox Style Styling Fixes next/prev image buttons Refactor canvas buttons + more Add Save Intermediates Step Count For accurate mode only. Co-Authored-By: Richard Macarthy <richardmacarthy@protonmail.com> Restores "initial image" text Address feedback - moves mask clear button - fixes intermediates - shrinks inpainting icons by 10% Fix Loopback Styling Adds escape hotkey to close floating panels Readd Hotkey for Dual Display Updated Current Image Button Styling commit dd5a88dceeec53ceb1722a62e3689ae3dd871154 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 04:17:28 2022 +1300 [WebUI] Final 2.1 Release Build commit 95ed56bf82825a47cfe406fa34eaf4e32c129143 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 04:16:31 2022 +1300 Updated Current Image Button Styling commit 1ae80f5ab9d00a25e0c3a21e2eccd318c5343401 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 04:07:57 2022 +1300 Readd Hotkey for Dual Display commit 1f0bd3ca6cda4221d1a7a46325f235cd23bd0af9 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu Nov 3 02:07:00 2022 +1100 Adds escape hotkey to close floating panels commit a1971f6830306b3d748f7f36c2243f6dee682f97 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 03:38:15 2022 +1300 Fix Loopback Styling commit c6118e889895ba35a191124ce1beb5d2b719366d Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu Nov 3 01:29:51 2022 +1100 Address feedback - moves mask clear button - fixes intermediates - shrinks inpainting icons by 10% commit 7ba958cf7ff4e804a127b71c88666084f81e7340 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu Nov 3 01:10:38 2022 +1100 Restores "initial image" text commit 383905d5d24359aa1824de96ff124a8f8a87e015 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 02:59:11 2022 +1300 Add Save Intermediates Step Count For accurate mode only. Co-Authored-By: Richard Macarthy <richardmacarthy@protonmail.com> commit 6173e3e9cabd5e74fb466d55d7bb6a80a77b3fa8 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu Nov 3 00:53:53 2022 +1100 Refactor canvas buttons + more commit 3feb7d8922b0e4c9f944e96b95211003f40d9705 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu Nov 3 00:49:23 2022 +1100 Fixes next/prev image buttons commit 1d9edbd0ddd6e10cf120fe0de3db0b56ae374db4 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 00:50:44 2022 +1300 Update Icon Button Checkbox Style Styling commit d439abdb89db73e652add9df371234861189d90c Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 21:37:24 2022 +1100 Makes fast-latents in progress default commit ee47ea0c891a33049bdec12f1c254926f341eff2 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 21:37:09 2022 +1100 Adds min width to ImageUploader commit 300bb2e6279c1c477131b9e57425db348062f19c Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 21:28:22 2022 +1100 Fixes current image button rerenders commit ccf8593501d23e00979f7340f8991514e6ca3428 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 21:27:43 2022 +1100 Fixes display progress images select typing commit 0fda612f3ff8ad75932e158b9b29cf64c3f30eb6 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 21:02:01 2022 +1100 Fixes edge case: upload over gets stuck while alt tabbing - Press esc to close it now commit 5afff65b71bb60d067392c120efff1a17adc66af Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 20:33:19 2022 +1100 Fixes progress images select commit 7e55bdefce8920831cac7b9fa857bfbffe9e9d5d Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 20:27:47 2022 +1100 Only generate 1 iteration when seed fixed & variations disabled commit 620cf84d3dd54b8498e84574f33040a26d4d315f Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 19:51:38 2022 +1100 Reworks CurrentImageButtons.tsx - Change all icons to FA iconset for consistency - Refactors IAIIconButton, IAIButton, IAIPopover to handle ref forwarding - Redesigns buttons into group commit cfe567c62ad3fd0cff5e3e579a2250ca5dfa2d53 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 16:14:50 2022 +1100 Fixes: uploaded JPG images not loading commit cefe12f1df72e051f109ed77ce46f18093b3b8bb Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 15:31:18 2022 +1100 Styling changes and settings modal minor refactor commit 1e51c3992853ad4643d8eda2443a3bd0d65f5f90 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 15:27:46 2022 +1100 Fixes crash related to old value of progress_latents in state commit 42a02bbb8087cd46a1b5c795b1b41e38c08ba229 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 13:15:06 2022 +1100 Adds asCheckbox to IAIIconButton Rough draft of this. Not happy with the styling but it's clearer than having them look just like buttons. commit f1ae6dae4c36e74ca8dedf8b57eb8933c059dcf4 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 13:13:56 2022 +1100 Adds alert for bounding box size to status icons commit 6195579910a91fb2ab7e1186aa1c1145566c3122 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 11:52:19 2022 +1100 Restores shift+q bounding box shortcut commit 16c8b23b347792d7811cff66a27d350fe5d0d62c Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 11:32:07 2022 +1100 Changes Report Bug icon to a bug commit 07ae626b22554b5222a3b71d1ce3974e2c3fb284 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 11:17:16 2022 +1100 Removes unused isReady state commit 8d171bb044f578d4b9cc4911edfa05b20a01d373 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 11:13:26 2022 +1100 Fixes crash when requesting post-generation upscale/face restoration - Moves the inpainting paste to before the postprocessing. commit 6e33ca7e9e64fb355430511e28bb08c32c9c68b1 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 10:59:01 2022 +1100 Fixes rerenders on ClearBrushHistory commit db46e12f2b8c98dac8895ea4d04242d3754dbec4 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 11:36:28 2022 +1300 Inpainting Controls Code Spitting and Performance Codesplit the entirety of the inpainting controls. Created new selectors for each and every component to ensure there are no unnecessary re-renders. App feels a lot smoother. commit 868e4b2db82fa8556b423111f2f8d565a70ec129 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 07:40:31 2022 +1300 [Code Splitting] Bounding Box Options Isolated all bounding box components to trigger unnecessary re-renders. Still need to fix bounding box triggering re-renders on the control panel inside the canvas itself. But the options panel should be a good to go with this change. commit 2e562742c13988a1fc299c673a97ba4e4a645aaf Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 06:40:27 2022 +1300 Fix Bounding Box Settings re-rendering on brush stroke commit 68e69580091fc1dc1d8b6e03c9e7ef777c7ebf61 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 06:28:34 2022 +1300 Fresh Bundle commit ea6e3a7949f2743711516261cb7e450517d39702 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 06:26:56 2022 +1300 [TESTING] Remove global isReady checking I dont believe this is need at all because the isready state is constantly updated when needed and tracked real time in the Redux store. This causes massive re-renders. @psychedelicious If this is absolutely essential for a reason that I do not see, please hit me up on Discord. commit b2879ca99f88869277c474185ade049914b0bf26 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 06:08:59 2022 +1300 Code Split Inpaint Options Isolate features to their own components so they dont re-render the other stuff each time. commit 4e911566c33989392eb3279049b15331ca98594a Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 03:50:56 2022 +1300 Preventing unnecessary re-renders across the app commit 9bafda6a152778893df143776ae859a3b8b7f192 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 03:02:35 2022 +1300 Fix Inpainting Alerts Styling commit 871a8a5375cae891f22eb853ffd2d22298298b11 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 23:52:07 2022 +1100 Adds hints when unable to invoke - Popover on Invoke button indicates why exactly it is disabled, e.g. prompt is empty, something else is processing, etc. - There may be more than one reason; all are displayed. commit 0eef74bc00d3c0cedc5037c1deeef1d9a5b6d33d Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 23:40:11 2022 +1100 Address bounding box feedback - Adds back toggle to hide bounding box - Box quick toggle = q, normal toggle = shift + q - Styles canvas alert icons commit 423ae3209782f1d8d321b2ed9ed00712b726adf7 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 17:06:07 2022 +1100 Improves bounding box interaction Added spacebar-hold-to-transform back. commit 8282e5d0458ca1bba5565c069093b5389f2228d4 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 16:57:07 2022 +1100 Builds fresh bundle commit 19305cdbdf6ac74833bd6011bff0ced8e9d36f69 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 16:51:11 2022 +1100 Styles image uploader commit eb9028ab3069bca9d747aca664ca60ae13ba6df8 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 16:51:03 2022 +1100 Disabled bounding box settings when locked commit 21483f5d0731bce5aa97985e722a64bf0d7cd12c Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 16:50:24 2022 +1100 Fixes silent crash when init image too large To send the mask to the server, the UI rendered the mask onto the init image and sent the whole image. The mask was then cropped by the server. If the image was too large, the app silently failed. Maybe it exceeds the websocket size limit. Fixed by cropping the mask in the UI layer, sending only bounding-box-sized mask image data. commit 82dcbac28f140aa7bd89d967bcc7fa31cb03a267 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 16:28:30 2022 +1100 Improves bounding box interactions - Bounding box can now be moved by dragging any of its edges - Bounding box does not affect drawing if already drawing a stroke - Can lock bounding box to draw directly on the bounding box edges - Removes spacebar-hold behaviour due to technical issues commit d43bd4625d64a03d90de0458ad5fcacef211a8a6 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 15:10:49 2022 +1100 Fixes hotkeys and settings buttons not working commit ea891324a2086faf8eeeeac7eaf47ae2935322fb Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 11:04:02 2022 +1100 Changes inpainting controls settings to hover commit 8fd9ea219390493f392e690eadb23c4209a4ecfc Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 11:03:41 2022 +1100 Adds missing tooltips to site header commit fb026668563b3179805819a1630c654c9ce260d9 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 11:03:25 2022 +1100 Increases workarea split padding to 1rem commit f6f5c2731b0c37089c5d7382736f973e857df712 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 11:03:10 2022 +1100 Decreases gallery width on inpainting commit b4e3f771e0314e0a18ad5cedc80b28f246fced59 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 10:54:59 2022 +1100 Fixes bugs/styling - Fixes missing web app state on new version: Adds stateReconciler to redux-persist. When we add more values to the state and then release the update app, they will be automatically merged in. Reseting web UI will be needed far less. 7159ec - Fixes console z-index - Moves reset web UI button to visible area commit 99bb9491ac97f1f733accab839ea38cdf4870ba0 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Tue Nov 1 08:35:45 2022 +1300 [WebUI] Loopback Default False commit 0453f211278a533a49fb1aee54dd989b69179c10 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 23:23:51 2022 +1300 Fresh Build For WebUI commit 9fc09aa4bda3b3e6139b026f24733a37747d373f Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 09:08:11 2022 +0100 don't log base64 progress images commit 5e87062cf809a08242d3b006b66d3bbb834ddb16 Author: spezialspezial <75758219+spezialspezial@users.noreply.github.com> Date: Wed Nov 2 00:21:27 2022 +0100 Option to directly invert the grayscale heatmap - fix commit 3e7a459990407ad1679f38d4027c19d50a9d36e3 Author: spezialspezial <75758219+spezialspezial@users.noreply.github.com> Date: Tue Nov 1 21:37:33 2022 +0100 Update txt2mask.py commit bbf4c03e500bafc8627c2a70f8b3396efeddabb3 Author: spezialspezial <75758219+spezialspezial@users.noreply.github.com> Date: Tue Nov 1 21:11:19 2022 +0100 Option to directly invert the grayscale heatmap Theoretically less work inverting the image while it's small but I can't measure a significant difference. Though, handy option to have in some cases. commit 611a3a975328a7e276c2781214d5e14108708ed7 Author: mauwii <Mauwii@outlook.de> Date: Wed Nov 2 02:23:09 2022 +0100 fix name of caching step commit 1611f0d1815022fe90d33f41c21d670251a75f29 Author: mauwii <Mauwii@outlook.de> Date: Wed Nov 2 02:18:46 2022 +0100 readd caching of sd-models - this would remove the necesarrity of the secret availability in PRs commit 08835115e4c5c0ee3587ce07ab769a04d55cb3c5 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 22:10:12 2022 -0400 pin pytorch_lightning to 1.7.7, issue #1331 commit 2d84e28d329be282b51a4cbc22f7c200d80c8f0e Merge: 533fd04e ef17aae8 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 22:11:04 2022 -0400 Merge branch 'development' of github.com:invoke-ai/InvokeAI into development commit ef17aae8abe03fd87dc6f91b3c6d2fe03375f6c5 Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 00:39:48 2022 +0100 add damian0815 to contributors list commit 0cc39f01a3c67f32873b7888e1e032d33626e269 Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 01:18:50 2022 +0100 report full size for fast latents and update conversion matrix for v1.5 commit 688d7258f185035a5924bee23322b001574da931 Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 00:33:00 2022 +0100 fix a bug that broke cross attention control index mapping commit 4513320bf161d3efdd99e2aef4f7c37472131373 Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 00:31:58 2022 +0100 save VRAM by not recombining tensors that have been sliced to save VRAM commit 533fd04ef0d1ba9d2cb25d556991b999e7d44aba Merge: 6215592b dff5681c Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 17:40:36 2022 -0400 Merge branch 'development' of github.com:invoke-ai/InvokeAI into development commit dff5681cf0e24faf67d5eb5903203c4ea39f89bd Author: damian0815 <d@d.com> Date: Tue Nov 1 13:56:03 2022 +0100 shorter strings commit 5a2790a69b11e049d2507bc22eab7812915d867f Author: damian0815 <d@d.com> Date: Tue Nov 1 13:19:20 2022 +0100 convert progress display to a drop-down commit 7c5305ccbaf7926162536aa3a9e51dcdd8574d0d Author: damian0815 <d@d.com> Date: Tue Nov 1 12:54:46 2022 +0100 do not try to save base64 intermediates in gallery on cancellation commit 4013e8ad6fa5e5c2a710c607fe7e1d040f353299 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 21:54:35 2022 +1100 Fixes b64 image sending and displaying commit d1dfd257f9e1cafd352d9007a56194226b9d6b63 Author: damian <d@d.com> Date: Tue Nov 1 11:40:40 2022 +0100 wip base64 commit 5322d735ee4515d89293b7fb015b2ce048262f68 Author: damian <d@d.com> Date: Tue Nov 1 11:31:42 2022 +0100 update frontend commit cdb107dcda858a8bb64455cc60a196a42345f8f7 Author: damian <d@d.com> Date: Tue Nov 1 11:17:43 2022 +0100 add option to show intermediate latent space commit be1393a41ce7a75ed8de7f648a93c5e5974a50d2 Author: damian <d@d.com> Date: Tue Nov 1 10:16:55 2022 +0100 ensure existing exception handling code also handles new exception class commit e554c2607f00a5e51c03052acb9861ff21ec1c12 Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Tue Nov 1 10:08:42 2022 +0100 Rebuilt prompt parsing logic Complete re-write of the prompt parsing logic to be more readable and logical, and therefore also hopefully easier to debug, maintain, and augment. In the process it has also become more robust to badly-formed prompts. Squashed commit of the following: commit 8fcfa88a16e1390d41717e940d72aed64712171c Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Sun Oct 30 17:05:57 2022 +0100 further cleanup commit 1a1fd78bcfeb49d072e3e6d5808aa8df15441629 Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Sun Oct 30 16:07:57 2022 +0100 cleanup and document commit 099c9659fa8b8135876f9a5a50fe80b20bc0635c Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Sun Oct 30 15:54:58 2022 +0100 works fully commit 5e6887ea8c25a1e21438ff6defb381fd027d25fd Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Sun Oct 30 15:24:31 2022 +0100 further... commit 492fda120844d9bc1ad4ec7dd408a3374762d0ff Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Sun Oct 30 14:08:57 2022 +0100 getting there... commit c6aab05a8450cc3c95c8691daf38fdc64c74f52d Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Fri Oct 28 14:29:03 2022 +0200 wip doesn't compile commit 5e533f731cfd20cd435330eeb0012e5689e87e81 Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Fri Oct 28 13:21:43 2022 +0200 working with CrossAttentionCtonrol but no Attention support yet commit 9678348773431e500e110e8aede99086bb7b5955 Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Fri Oct 28 13:04:52 2022 +0200 wip rebuiling prompt parser commit 6215592b12dea3822c727913b771012789a52477 Merge: ef24d76a 349cc254 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 17:34:55 2022 -0400 Merge branch 'development' of github.com:invoke-ai/InvokeAI into development commit 349cc25433e1d358c6c61cca4a6c300ecc8ca3d7 Author: damian0815 <d@d.com> Date: Tue Nov 1 20:08:52 2022 +0100 fix crash (be a little less aggressive clearing out the attention slice) commit 214d276379387ae0fa2259602ab00884ec1ad03e Author: damian0815 <d@d.com> Date: Tue Nov 1 19:57:55 2022 +0100 be more aggressive at clearing out saved_attn_slice commit ef24d76adc5a192297714707cd6794d4f44bcf67 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 14:34:23 2022 -0400 fix library problems in preload_modules commit ab2b5a691dadb292f7cecf5db94a165db3e3e126 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 17:22:48 2022 -0400 fix model_cache memory management issues commit c7de2b2801ad5d6ce52a5f44e88c5705f1dbf524 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 02:02:14 2022 +0100 disable checks with sd-V1.4 model... ...to save some resources, since V1.5 is the default now commit e8075658acf675346d35435d0cfb7710becab42a Author: mauwii <Mauwii@outlook.de> Date: Mon Oct 31 22:20:51 2022 +0100 update test-invoke-conda.yml - fix model dl path for sd-v1-4.ckpt - copy configs/models.yaml.example to configs/models.yaml commit 4202dabee1143f597f4c3946420fbfa7b8eccddf Author: mauwii <Mauwii@outlook.de> Date: Mon Oct 31 22:17:21 2022 +0100 fix models example weights for sd-v1.4 commit d67db2bcf1ac26d8bb7c5f8bfd056f2172597780 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Tue Nov 1 08:35:45 2022 +1300 [WebUI] Loopback Default False commit 7159ec885faa1117a3506689d547618be1d91808 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Mon Oct 31 11:33:05 2022 -0400 further improvements to preload_models.py - Faster startup for command line switch processing - Specify configuration file to modify using --config option: ./scripts/preload_models.ply --config models/my-models-file.yaml commit b5cf734ba9f1aeaab14075b55cc13ed9a0ae31e2 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Mon Oct 31 11:08:19 2022 -0400 improve behavior of preload_models.py - NEVER overwrite user's existing models.yaml - Instead, merge its contents into new config file, and rename original to models.yaml.orig (with message) - models.yaml has been removed from repository and renamed models.yaml.example commit f7dc8eafeef991e135b5541c01d0ff740dda9591 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Mon Oct 31 10:47:35 2022 -0400 restore models.yaml to virgin state commit 762ca60a309f70daaf1b9e79b6273f76fd9474b6 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Oct 4 22:55:10 2022 -0400 Update INPAINTING.md commit e7fb9f342cb5ed0c09e6215026d60d45eef3ebcb Author: Hideyuki Katsushiro <h.katsushiro@qualia.tokyo.jp> Date: Wed Oct 5 10:08:53 2022 +0900 add argument --outdir
2022-11-12 17:17:07 +00:00
if len(extend_instructions) > 0:
restorer = Outcrop(image,self,)
return restorer.process (
extend_instructions,
opt = opt,
orig_opt = args,
image_callback = callback,
prefix = prefix,
)
2022-10-03 18:39:58 +00:00
elif tool == 'embiggen':
# fetch the metadata from the image
generator = self.select_generator(embiggen=True)
Merge dev into main for 2.2.0 (#1642) * Fixes inpainting + code cleanup * Disable stage info in Inpainting Tab * Mask Brush Preview now always at 0.5 opacity The new mask is only visible properly at max opacity but at max opacity the brush preview becomes fully opaque blocking the view. So the mask brush preview no remains at 0.5 no matter what the Brush opacity is. * Remove save button from Canvas Controls (cleanup) * Implements invert mask * Changes "Invert Mask" to "Preserve Masked Areas" * Fixes (?) spacebar issues * Patches redux-persist and redux-deep-persist with debounced persists Our app changes redux state very, very often. As our undo/redo history grows, the calls to persist state start to take in the 100ms range, due to a the deep cloning of the history. This causes very noticeable performance lag. The deep cloning is required because we need to blacklist certain items in redux from being persisted (e.g. the app's connection status). Debouncing the whole process of persistence is a simple and effective solution. Unfortunately, `redux-persist` dropped `debounce` between v4 and v5, replacing it with `throttle`. `throttle`, instead of delaying the expensive action until a period of X ms of inactivity, simply ensures the action is executed at least every X ms. Of course, this does not fix our performance issue. The patch is very simple. It adds a `debounce` argument - a number of milliseconds - and debounces `redux-persist`'s `update()` method (provided by `createPersistoid`) by that many ms. Before this, I also tried writing a custom storage adapter for `redux-persist` to debounce the calls to `localStorage.setItem()`. While this worked and was far less invasive, it doesn't actually address the issue. It turns out `setItem()` is a very fast part of the process. We use `redux-deep-persist` to simplify the `redux-persist` configuration, which can get complicated when you need to blacklist or whitelist deeply nested state. There is also a patch here for that library because it uses the same types as `redux-persist`. Unfortunately, the last release of `redux-persist` used a package `flat-stream` which was malicious and has been removed from npm. The latest commits to `redux-persist` (about 1 year ago) do not build; we cannot use the master branch. And between the last release and last commit, the changes have all been breaking. Patching this last release (about 3 years old at this point) directly is far simpler than attempting to fix the upstream library's master branch or figuring out an alternative to the malicious and now non-existent dependency. * Adds debouncing * Fixes AttributeError: 'dict' object has no attribute 'invert_mask' * Updates package.json to use redux-persist patches * Attempts to fix redux-persist debounce patch * Fixes undo/redo * Fixes invert mask * Debounce > 300ms * Limits history to 256 for each of undo and redo * Canvas styling * Hotkeys improvement * Add Metadata To Viewer * Increases CFG Scale max to 200 * Fix gallery width size for Outpainting Also fixes the canvas resizing failing n fast pushes * Fixes disappearing canvas grid lines * Adds staging area * Fixes "use all" not setting variationAmount Now sets to 0 when the image had variations. * Builds fresh bundle * Outpainting tab loads to empty canvas instead of upload * Fixes wonky canvas layer ordering & compositing * Fixes error on inpainting paste back `TypeError: 'float' object cannot be interpreted as an integer` * Hides staging area outline on mouseover prev/next * Fixes inpainting not doing img2img when no mask * Fixes bbox not resizing in outpainting if partially off screen * Fixes crashes during iterative outpaint. Still doesn't work correctly though. * Fix iterative outpainting by restoring original images * Moves image uploading to HTTP - It all seems to work fine - A lot of cleanup is still needed - Logging needs to be added - May need types to be reviewed * Fixes: outpainting temp images show in gallery * WIP refactor to unified canvas * Removes console.log from redux-persist patch * Initial unification of canvas * Removes all references to split inpainting/outpainting canvas * Add patchmatch and infill_method parameter to prompt2image (options are 'patchmatch' or 'tile'). * Fixes app after removing in/out-painting refs * Rebases on dev, updates new env files w/ patchmatch * Organises features/canvas * Fixes bounding box ending up offscreen * Organises features/canvas * Stops unnecessary canvas rescales on gallery state change * Fixes 2px layout shift on toggle canvas lock * Clips lines drawn while canvas locked When drawing with the locked canvas, if a brush stroke gets too close to the edge of the canvas and its stroke would extend past the edge of the canvas, the edge of that stroke will be seen after unlocking the canvas. This could cause a problem if you unlock the canvas and now have a bunch of strokes just outside the init image area, which are far back in undo history and you cannot easily erase. With this change, lines drawn while the canvas is locked get clipped to the initial image bbox, fixing this issue. Additionally, the merge and save to gallery functions have been updated to respect the initial image bbox so they function how you'd expect. * Fixes reset canvas view when locked * Fixes send to buttons * Fixes bounding box not being rounded to 64 * Abandons "inpainting" canvas lock * Fixes save to gallery including empty area, adds download and copy image * Fix Current Image display background going over image bounds * Sets status immediately when clicking Invoke * Adds hotkeys and refactors sharing of konva instances Adds hotkeys to canvas. As part of this change, the access to konva instance objects was refactored: Previously closure'd refs were used to indirectly get access to the konva instances outside of react components. Now, a getter and setter function are used to provide access directly to the konva objects. * Updates hotkeys * Fixes canvas showing spinner on first load Also adds good default canvas scale and positioning when no image is on it * Fixes possible hang on MaskCompositer * Improves behaviour when setting init canvas image/reset view * Resets bounding box coords/dims when no image present * Disables canvas actions which cannot be done during processing * Adds useToastWatcher hook - Dispatch an `addToast` action with standard Chakra toast options object to add a toast to the toastQueue - The hook is called in App.tsx and just useEffect's w/ toastQueue as dependency to create the toasts - So now you can add toasts anywhere you have access to `dispatch`, which includes middleware and thunks - Adds first usage of this for the save image buttons in canvas * Update Hotkey Info Add missing tooltip hotkeys and update the hotkeys modal to reflect the new hotkeys for the Unified Canvas. * Fix theme changer not displaying current theme on page refresh * Fix tab count in hotkeys panel * Unify Brush and Eraser Sizes * Fix staging area display toggle not working * Staging Area delete button is now red So it doesnt feel blended into to the rest of them. * Revert "Fix theme changer not displaying current theme on page refresh" This reverts commit 903edfb803e743500242589ff093a8a8a0912726. * Add arguments to use SSL to webserver * Integrates #1487 - touch events Need to add: - Pinch zoom - Touch-specific handling (some things aren't quite right) * Refactors upload-related async thunks - Now standard thunks instead of RTK createAsyncThunk() - Adds toasts for all canvas upload-related actions * Reorganises app file structure * Fixes Canvas Auto Save to Gallery * Fixes staging area outline * Adds staging area hotkeys, disables gallery left/right when staging * Fixes Use All Parameters * Fix metadata viewer image url length when viewing intermediate * Fixes intermediate images being tiny in txt2img/img2img * Removes stale code * Improves canvas status text and adds option to toggle debug info * Fixes paste image to upload * Adds model drop-down to site header * Adds theme changer popover * Fix missing key on ThemeChanger map * Fixes stage position changing on zoom * Hotkey Cleanup - Viewer is now Z - Canvas Move tool is V - sync with PS - Removed some unused hotkeys * Fix canvas resizing when both options and gallery are unpinned * Implements thumbnails for gallery - Thumbnails are saved whenever an image is saved, and when gallery requests images from server - Thumbnails saved at original image aspect ratio with width of 128px as WEBP - If the thumbnail property of an image is unavailable for whatever reason, the image's full size URL is used instead * Saves thumbnails to separate thumbnails directory * Thumbnail size = 256px * Fix Lightbox Issues * Disables canvas image saving functions when processing * Fix index error on going past last image in Gallery * WIP - Lightbox Fixes Still need to fix the images not being centered on load when the image res changes * Fixes another similar index error, simplifies logic * Reworks canvas toolbar * Fixes canvas toolbar upload button * Cleans up IAICanvasStatusText * Improves metadata handling, fixes #1450 - Removes model list from metadata - Adds generation's specific model to metadata - Displays full metadata in JSON viewer * Gracefully handles corrupted images; fixes #1486 - App does not crash if corrupted image loaded - Error is displayed in the UI console and CLI output if an image cannot be loaded * Adds hotkey to reset canvas interaction state If the canvas' interaction state (e.g. isMovingBoundingBox, isDrawing, etc) get stuck somehow, user can press Escape to reset the state. * Removes stray console.log() * Fixes bug causing gallery to close on context menu open * Minor bugfixes - When doing long-running canvas image exporting actions, display indeterminate progress bar - Fix staging area image outline not displaying after committing/discarding results * Removes unused imports * Fixes repo root .gitignore ignoring frontend things * Builds fresh bundle * Styling updates * Removes reasonsWhyNotReady The popover doesn't play well with the button being disabled, and I don't think adds any value. * Image gallery resize/style tweaks * Styles buttons for clearing canvas history and mask * First pass on Canvas options panel * Fixes bug where discarding staged images results in loss of history * Adds Save to Gallery button to staging toolbar * Rearrange some canvas toolbar icons Put brush stuff together and canvas movement stuff together * Fix gallery maxwidth on unified canvas * Update Layer hotkey display to UI * Adds option to crop to bounding box on save * Masking option tweaks * Crop to Bounding Box > Save Box Region Only * Adds clear temp folder * Updates mask options popover behavior * Builds fresh bundle * Fix styling on alert modals * Fix input checkbox styling being incorrect on light theme * Styling fixes * Improves gallery resize behaviour * Cap gallery size on canvas tab so it doesnt overflow * Fixes bug when postprocessing image with no metadata * Adds IAIAlertDialog component * Moves Loopback to app settings * Fixes metadata viewer not showing metadata after refresh Also adds Dream-style prompt to metadata * Adds outpainting specific options * Linting * Fixes gallery width on lightbox, fixes gallery button expansion * Builds fresh bundle * Fix Lightbox images of different res not centering * Update feature tooltip text * Highlight mask icon when on mask layer * Fix gallery not resizing correctly on open and close * Add loopback to just img2img. Remove from settings. * Fix to gallery resizing * Removes Advanced checkbox, cleans up options panel for unified canvas * Minor styling fixes to new options panel layout * Styling Updates * Adds infill method * Tab Styling Fixes * memoize outpainting options * Fix unnecessary gallery re-renders * Isolate Cursor Pos debug text on canvas to prevent rerenders * Fixes missing postprocessed image metadata before refresh * Builds fresh bundle * Fix rerenders on model select * Floating panel re-render fix * Simplify fullscreen hotkey selector * Add Training WIP Tab * Adds Training icon * Move full screen hotkey to floating to prevent tab rerenders * Adds single-column gallery layout * Fixes crash on cancel with intermediates enabled, fixes #1416 * Updates npm dependencies * Fixes img2img attempting inpaint when init image has transparency * Fixes missing threshold and perlin parameters in metadata viewer * Renames "Threshold" > "Noise Threshold" * Fixes postprocessing not being disabled when clicking use all * Builds fresh bundle * Adds color picker * Lints & builds fresh bundle * Fixes iterations being disabled when seed random & variations are off * Un-floors cursor position * Changes color picker preview to circles * Fixes variation params not set correctly when recalled * Fixes invoke hotkey not working in input fields * Simplifies Accordion Prep for adding reset buttons for each section * Fixes mask brush preview color * Committing color picker color changes tool to brush * Color picker does not overwrite user-selected alpha * Adds brush color alpha hotkey * Lints * Removes force_outpaint param * Add inpaint size options to inpaint at a larger size than the actual inpaint image, then scale back down for recombination * Bug fix for inpaint size * Adds inpaint size (as scale bounding box) to UI * Adds auto-scaling for inpaint size * Improves scaled bbox display logic * Fixes bug with clear mask and history * Fixes shouldShowStagingImage not resetting to true on commit * Builds fresh bundle * Fixes canvas failing to scale on first run * Builds fresh bundle * Fixes unnecessary canvas scaling * Adds gallery drag and drop to img2img/canvas * Builds fresh bundle * Fix desktop mode being broken with new versions of flaskwebgui * Fixes canvas dimensions not setting on first load * Builds fresh bundle * stop crash on !import_models call on model inside rootdir - addresses bug report #1546 * prevent "!switch state gets confused if model switching fails" - If !switch were to fail on a particular model, then generate got confused and wouldn't try again until you switch to a different working model and back again. - This commit fixes and closes #1547 * Revert "make the docstring more readable and improve the list_models logic" This reverts commit 248068fe5d57b5639ea7a87ee6cbf023104d957d. * fix model cache path * also set fail-fast to it's default (true) in this way the whole action fails if one job fails this should unblock the runners!!! * fix output path for Archive results * disable checks for python 3.9 * Update-requirements and test-invoke-pip workflow (#1574) * update requirements files * update test-invoke-pip workflow * move requirements-mkdocs.txt to docs folder (#1575) * move requirements-mkdocs.txt to docs folder * update copyright * Fixes outpainting with resized inpaint size * Interactive configuration (#1517) * Update scripts/configure_invokeai.py prevent crash if output exists Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> * implement changes requested by reviews * default to correct root and output directory on Windows systems - Previously the script was relying on the readline buffer editing feature to set up the correct default. But this feature doesn't exist on windows. - This commit detects when user typed return with an empty directory value and replaces with the default directory. * improved readability of directory choices * Update scripts/configure_invokeai.py Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> * better error reporting at startup - If user tries to run the script outside of the repo or runtime directory, a more informative message will appear explaining the problem. Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> * Embedding merging (#1526) * add whole <style token> to vocab for concept library embeddings * add ability to load multiple concept .bin files * make --log_tokenization respect custom tokens * start working on concept downloading system * preliminary support for dynamic loading and merging of multiple embedded models - The embedding_manager is now enhanced with ldm.invoke.concepts_lib, which handles dynamic downloading and caching of embedded models from the Hugging Face concepts library (https://huggingface.co/sd-concepts-library) - Downloading of a embedded model is triggered by the presence of one or more <concept> tags in the prompt. - Once the embedded model is downloaded, its trigger phrase will be loaded into the embedding manager and the prompt's <concept> tag will be replaced with the <trigger_phrase> - The downloaded model stays on disk for fast loading later. - The CLI autocomplete will complete partial <concept> tags for you. Type a '<' and hit tab to get all ~700 concepts. BUGS AND LIMITATIONS: - MODEL NAME VS TRIGGER PHRASE You must use the name of the concept embed model from the SD library, and not the trigger phrase itself. Usually these are the same, but not always. For example, the model named "hoi4-leaders" corresponds to the trigger "<HOI4-Leader>" One reason for this design choice is that there is no apparent constraint on the uniqueness of the trigger phrases and one trigger phrase may map onto multiple models. So we use the model name instead. The second reason is that there is no way I know of to search Hugging Face for models with certain trigger phrases. So we'd have to download all 700 models to index the phrases. The problem this presents is that this may confuse users, who will want to reuse prompts from distributions that use the trigger phrase directly. Usually this will work, but not always. - WON'T WORK ON A FIREWALLED SYSTEM If the host running IAI has no internet connection, it can't download the concept libraries. I will add a script that allows users to preload a list of concept models. - BUG IN PROMPT REPLACEMENT WHEN MODEL NOT FOUND There's a small bug that occurs when the user provides an invalid model name. The <concept> gets replaced with <None> in the prompt. * fix loading .pt embeddings; allow multi-vector embeddings; warn on dupes * simplify replacement logic and remove cuda assumption * download list of concepts from hugging face * remove misleading customization of '*' placeholder the existing code as-is did not do anything; unclear what it was supposed to do. the obvious alternative -- setting using 'placeholder_strings' instead of 'placeholder_tokens' to match model.params.personalization_config.params.placeholder_strings -- caused a crash. i think this is because the passed string also needed to be handed over on init of the PersonalizedBase as the 'placeholder_token' argument. this is weird config dict magic and i don't want to touch it. put a breakpoint in personalzied.py line 116 (top of PersonalizedBase.__init__) if you want to have a crack at it yourself. * address all the issues raised by damian0815 in review of PR #1526 * actually resize the token_embeddings * multiple improvements to the concept loader based on code reviews 1. Activated the --embedding_directory option (alias --embedding_path) to load a single embedding or an entire directory of embeddings at startup time. 2. Can turn off automatic loading of embeddings using --no-embeddings. 3. Embedding checkpoints are scanned with the pickle scanner. 4. More informative error messages when a concept can't be loaded due either to a 404 not found error or a network error. * autocomplete terms end with ">" now * fix startup error and network unreachable 1. If the .invokeai file does not contain the --root and --outdir options, invoke.py will now fix it. 2. Catch and handle network problems when downloading hugging face textual inversion concepts. * fix misformatted error string Co-authored-by: Damian Stewart <d@damianstewart.com> * model_cache.py: fix list_models Signed-off-by: devops117 <55235206+devops117@users.noreply.github.com> * add statement of values (#1584) * this adds the Statement of Values Google doc source = https://docs.google.com/document/d/1-PrUKDJcxy8OyNGc8CyiHhv2VgLvjt7LRGlEpbg1nmQ/edit?usp=sharing * Fix heading * Update InvokeAI_Statement_of_Values.md * Update InvokeAI_Statement_of_Values.md * Update InvokeAI_Statement_of_Values.md * Update InvokeAI_Statement_of_Values.md * Update InvokeAI_Statement_of_Values.md * add keturn and mauwii to the team member list * Fix punctuation * this adds the Statement of Values Google doc source = https://docs.google.com/document/d/1-PrUKDJcxy8OyNGc8CyiHhv2VgLvjt7LRGlEpbg1nmQ/edit?usp=sharing * add keturn and mauwii to the team member list * fix formating - make sub bullets use * (decide to all use - or *) - indent sub bullets Sorry, first only looked at the code version and found this only after looking at the markdown rendered version * use multiparagraph numbered sections * Break up Statement Of Values as per comments on #1584 * remove duplicated word, reduce vagueness it's important not to overstate how many artists we are consulting. * fix typo (sorry blessedcoolant) Co-authored-by: mauwii <Mauwii@outlook.de> Co-authored-by: damian <git@damianstewart.com> * update dockerfile (#1551) * update dockerfile * remove not existing file from .dockerignore * remove bloat and unecesary step also use --no-cache-dir for pip install image is now close to 2GB * make Dockerfile a variable * set base image to `ubuntu:22.10` * add build-essential * link outputs folder for persistence * update tag variable * update docs * fix not customizeable build args, add reqs output * !model_import autocompletes in ROOTDIR * Adds psychedelicious to statement of values signature (#1602) * add a --no-patchmatch option to disable patchmatch loading (#1598) This feature was added to prevent the CI Macintosh tests from erroring out when patchmatch is unable to retrieve its shared library from github assets. * Fix #1599 by relaxing the `match_trigger` regex (#1601) * Fix #1599 by relaxing the `match_trigger` regex Also simplify logic and reduce duplication. * restrict trigger regex again (but not so far) * make concepts library work with Web UI This PR makes it possible to include a Hugging Face concepts library <style-or-subject-trigger> in the WebUI prompt. The metadata seems to be correctly handled. * documentation enhancements (#1603) - Add documentation for the Hugging Face concepts library and TI embedding. - Fixup index.md to point to each of the feature documentation files, including ones that are pending. * tweak setup and environment files for linux & pypatchmatch (#1580) * tweak setup and environment files for linux & pypatchmatch - Downgrade python requirements to 3.9 because 3.10 is not supported on Ubuntu 20.04 LTS (widely-used distro) - Use our github pypatchmatch 0.1.3 in order to install Makefile where it needs to be. - Restored "-e ." as the last install step on pip installs. Hopefully this will not trigger the high-CPU hang we've previously experienced. * keep windows on basicsr 1.4.1 * keep windows on basicsr 1.4.1 * bump pypatchmatch requirement to 0.1.4 - This brings in a version of pypatchmatch that will gracefully handle internet connection not available at startup time. - Also refactors and simplifies the handling of gfpgan's basicsr requirement across various platforms. * revert to older version of list_models() (#1611) This restores the correct behavior of list_models() and quenches the bug of list_models() returning a single model entry named "name". I have not investigated what was wrong with the new version, but I think it may have to do with changes to the behavior in dict.update() * Fixes for #1604 (#1605) * Converts ESRGAN image input to RGB - Also adds typing for image input. - Partially resolves #1604 * ensure there are unmasked pixels before color matching Co-authored-by: Kyle Schouviller <kyle0654@hotmail.com> * update index.md (#1609) - comment out non existing link - fix indention - add seperator between feature categories * Debloat-docker (#1612) * debloat Dockerfile - less options more but more userfriendly - better Entrypoint to simulate CLI usage - without command the container still starts the web-host * debloat build.sh * better syntax in run.sh * update Docker docs - fix description of VOLUMENAME - update run script example to reflect new entrypoint * Test installer (#1618) * test linux install * try removing http from parsed requirements * pip install confirmed working on linux * ready for linux testing - rebuilt py3.10-linux-x86_64-cuda-reqs.txt to include pypatchmatch dependency. - point install.sh and install.bat to test-installer branch. * Updates MPS reqs * detect broken readline history files * fix download.pytorch.org URL * Test installer (Win 11) (#1620) Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> * Test installer (MacOS 13.0.1 w/ torch==1.12.0) (#1621) * Test installer (Win 11) * Test installer (MacOS 13.0.1 w/ torch==1.12.0) Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> * change sourceball to development for testing * Test installer (MacOS 13.0.1 w/ torch==1.12.1 & torchvision==1.13.1) (#1622) * Test installer (Win 11) * Test installer (MacOS 13.0.1 w/ torch==1.12.0) * Test installer (MacOS 13.0.1 w/ torch==1.12.1 & torchvision==1.13.1) Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Co-authored-by: Cyrus Chan <82143712+cyruschan360@users.noreply.github.com> Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> * 2.2 Doc Updates (#1589) * Unified Canvas Docs & Assets Unified Canvas draft Advanced Tools Updates Doc Updates (lstein feedback) * copy edits to Unified Canvas docs - consistent capitalisation and feature naming - more intimate address (replace "the user" with "you") for improved User Engagement(tm) - grammatical massaging and *poesie* Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> Co-authored-by: damian <git@damianstewart.com> * include a step after config to `cat ~/.invokeai` (#1629) * disable patchmatch in CI actions (#1626) * disable patchmatch in CI actions * fix indention * replace tab with spaces Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> * Fix installer script for macOS. (#1630) * refer to the platform as 'osx' instead of 'mac', otherwise the composed URL to micromamba is wrong. * move the `-O` option to `tar` to be grouped with the other tar flags to avoid the `-O` being interpreted as something to unarchive. * Removes symlinked environment.yaml (#1631) Was unintentionally added in #1621 * Fix inpainting with iterations (#1635) * fix error when inpainting using runwayml inpainting model (#1634) - error was "Omnibus object has no attribute pil_image" - closes #1596 * add k_dpmpp_2_a and k_dpmpp_2 solvers options (#1389) * add k_dpmpp_2_a and k_dpmpp_2 solvers options * update frontend Co-authored-by: Victor <victorca25@users.noreply.github.com> Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> * add .editorconfig (#1636) * Web UI 2.2 bugfixes (#1572) * Fixes bug preventing multiple images from being generated * Fixes valid seam strength value range * Update Delete Alert Text Indicates to the user that images are not permanently deleted. * Fixes left/right arrows not working on gallery * Fixes initial image on load erroneously set to a user uploaded image Should be a result gallery image. * Lightbox Fixes - Lightbox is now a button in the current image buttons - Lightbox is also now available in the gallery context menu - Lightbox zoom issues fixed - Lightbox has a fade in animation. * Fix image display wrapper in current preview not overflow bounds * Revert "Fix image display wrapper in current preview not overflow bounds" This reverts commit 5511c82714dbf1d1999d64e8bc357bafa34ddf37. * Change Staging Area discard icon from Bin to X * Expose Snap Threshold and Move Snap Settings to BBox Panel * Changes img2img strength default to 0.75 * Fixes drawing triggering when mouse enters canvas w/ button down When we only supported inpainting and no zoom, this was useful. It allowed the cursor to leave the canvas (which was easy to do given the limited canvas dimensions) and without losing the "I am drawing" state. With a zoomable canvas this is no longer as useful. Additionally, we have more popovers and tools (like the color pickers) which result in unexpected brush strokes. This fixes that issue. * Revert "Expose Snap Threshold and Move Snap Settings to BBox Panel" We will handle this a bit differently - by allowing the grid origin to be moved. I will dig in at some point. This reverts commit 33c92ecf4da724c2f17d9d91c7ea31a43a2f6deb. * Adds Limit Strokes to Box * Adds fill bounding box button * Adds erase bounding box button * Changes Staging area discard icon to match others * Fixes right click breaking move tool * Fixes brush preview visibility issue with "darken outside box" * Fixes history bugs with addFillRect, addEraseRect, and other actions * Adds missing `key` * Fixes postprocessing being applied to canvas generations * Fixes bbox not getting scaled in various situations * Fixes staging area show image toggle not resetting on accept/discard * Locks down canvas while generating/staging * Fixes move tool breaking when canvas loses focus during move/transform * Hides cursor when restrict strokes is on and mouse outside bbox * Lints * Builds fresh bundle * Fix overlapping hotkey for Fill Bounding Box * Build Fresh Bundle * Fixes bug with mask and bbox overlay * Builds fresh bundle Co-authored-by: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> * disable NSFW checker loading during the CI tests (#1641) * disable NSFW checker loading during the CI tests The NSFW filter apparently causes invoke.py to crash during CI testing, possibly due to out of memory errors. This workaround disables NSFW model loading. * doc change * fix formatting errors in yml files * Configure the NSFW checker at install time with default on (#1624) * configure the NSFW checker at install time with default on 1. Changes the --safety_checker argument to --nsfw_checker and --no-nsfw_checker. The original argument is recognized for backward compatibility. 2. The configure script asks users whether to enable the checker (default yes). Also offers users ability to select default sampler and number of generation steps. 3.Enables the pasting of the caution icon on blurred images when InvokeAI is installed into the package directory. 4. Adds documentation for the NSFW checker, including caveats about accuracy, memory requirements, and intermediate image dispaly. * use better fitting icon * NSFW defaults false for testing * set default back to nsfw active Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> Signed-off-by: devops117 <55235206+devops117@users.noreply.github.com> Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Co-authored-by: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Co-authored-by: Kyle Schouviller <kyle0654@hotmail.com> Co-authored-by: javl <mail@jaspervanloenen.com> Co-authored-by: Kent Keirsey <31807370+hipsterusername@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com> Co-authored-by: Damian Stewart <d@damianstewart.com> Co-authored-by: DevOps117 <55235206+devops117@users.noreply.github.com> Co-authored-by: damian <git@damianstewart.com> Co-authored-by: Damian Stewart <null@damianstewart.com> Co-authored-by: Cyrus Chan <82143712+cyruschan360@users.noreply.github.com> Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> Co-authored-by: Andre LaBranche <dre@mac.com> Co-authored-by: victorca25 <41912303+victorca25@users.noreply.github.com> Co-authored-by: Victor <victorca25@users.noreply.github.com>
2022-11-30 21:12:23 +00:00
opt.strength = opt.embiggen_strength or 0.40
print(f'>> Setting img2img strength to {opt.strength} for happy embiggening')
generator.generate(
prompt,
sampler = self.sampler,
steps = opt.steps,
cfg_scale = opt.cfg_scale,
ddim_eta = self.ddim_eta,
2022-10-31 02:57:15 +00:00
conditioning= (uc, c, extra_conditioning_info),
init_img = image_path, # not the Image! (sigh)
init_image = image, # embiggen wants both! (sigh)
strength = opt.strength,
width = opt.width,
height = opt.height,
embiggen = opt.embiggen,
embiggen_tiles = opt.embiggen_tiles,
Merge dev into main for 2.2.0 (#1642) * Fixes inpainting + code cleanup * Disable stage info in Inpainting Tab * Mask Brush Preview now always at 0.5 opacity The new mask is only visible properly at max opacity but at max opacity the brush preview becomes fully opaque blocking the view. So the mask brush preview no remains at 0.5 no matter what the Brush opacity is. * Remove save button from Canvas Controls (cleanup) * Implements invert mask * Changes "Invert Mask" to "Preserve Masked Areas" * Fixes (?) spacebar issues * Patches redux-persist and redux-deep-persist with debounced persists Our app changes redux state very, very often. As our undo/redo history grows, the calls to persist state start to take in the 100ms range, due to a the deep cloning of the history. This causes very noticeable performance lag. The deep cloning is required because we need to blacklist certain items in redux from being persisted (e.g. the app's connection status). Debouncing the whole process of persistence is a simple and effective solution. Unfortunately, `redux-persist` dropped `debounce` between v4 and v5, replacing it with `throttle`. `throttle`, instead of delaying the expensive action until a period of X ms of inactivity, simply ensures the action is executed at least every X ms. Of course, this does not fix our performance issue. The patch is very simple. It adds a `debounce` argument - a number of milliseconds - and debounces `redux-persist`'s `update()` method (provided by `createPersistoid`) by that many ms. Before this, I also tried writing a custom storage adapter for `redux-persist` to debounce the calls to `localStorage.setItem()`. While this worked and was far less invasive, it doesn't actually address the issue. It turns out `setItem()` is a very fast part of the process. We use `redux-deep-persist` to simplify the `redux-persist` configuration, which can get complicated when you need to blacklist or whitelist deeply nested state. There is also a patch here for that library because it uses the same types as `redux-persist`. Unfortunately, the last release of `redux-persist` used a package `flat-stream` which was malicious and has been removed from npm. The latest commits to `redux-persist` (about 1 year ago) do not build; we cannot use the master branch. And between the last release and last commit, the changes have all been breaking. Patching this last release (about 3 years old at this point) directly is far simpler than attempting to fix the upstream library's master branch or figuring out an alternative to the malicious and now non-existent dependency. * Adds debouncing * Fixes AttributeError: 'dict' object has no attribute 'invert_mask' * Updates package.json to use redux-persist patches * Attempts to fix redux-persist debounce patch * Fixes undo/redo * Fixes invert mask * Debounce > 300ms * Limits history to 256 for each of undo and redo * Canvas styling * Hotkeys improvement * Add Metadata To Viewer * Increases CFG Scale max to 200 * Fix gallery width size for Outpainting Also fixes the canvas resizing failing n fast pushes * Fixes disappearing canvas grid lines * Adds staging area * Fixes "use all" not setting variationAmount Now sets to 0 when the image had variations. * Builds fresh bundle * Outpainting tab loads to empty canvas instead of upload * Fixes wonky canvas layer ordering & compositing * Fixes error on inpainting paste back `TypeError: 'float' object cannot be interpreted as an integer` * Hides staging area outline on mouseover prev/next * Fixes inpainting not doing img2img when no mask * Fixes bbox not resizing in outpainting if partially off screen * Fixes crashes during iterative outpaint. Still doesn't work correctly though. * Fix iterative outpainting by restoring original images * Moves image uploading to HTTP - It all seems to work fine - A lot of cleanup is still needed - Logging needs to be added - May need types to be reviewed * Fixes: outpainting temp images show in gallery * WIP refactor to unified canvas * Removes console.log from redux-persist patch * Initial unification of canvas * Removes all references to split inpainting/outpainting canvas * Add patchmatch and infill_method parameter to prompt2image (options are 'patchmatch' or 'tile'). * Fixes app after removing in/out-painting refs * Rebases on dev, updates new env files w/ patchmatch * Organises features/canvas * Fixes bounding box ending up offscreen * Organises features/canvas * Stops unnecessary canvas rescales on gallery state change * Fixes 2px layout shift on toggle canvas lock * Clips lines drawn while canvas locked When drawing with the locked canvas, if a brush stroke gets too close to the edge of the canvas and its stroke would extend past the edge of the canvas, the edge of that stroke will be seen after unlocking the canvas. This could cause a problem if you unlock the canvas and now have a bunch of strokes just outside the init image area, which are far back in undo history and you cannot easily erase. With this change, lines drawn while the canvas is locked get clipped to the initial image bbox, fixing this issue. Additionally, the merge and save to gallery functions have been updated to respect the initial image bbox so they function how you'd expect. * Fixes reset canvas view when locked * Fixes send to buttons * Fixes bounding box not being rounded to 64 * Abandons "inpainting" canvas lock * Fixes save to gallery including empty area, adds download and copy image * Fix Current Image display background going over image bounds * Sets status immediately when clicking Invoke * Adds hotkeys and refactors sharing of konva instances Adds hotkeys to canvas. As part of this change, the access to konva instance objects was refactored: Previously closure'd refs were used to indirectly get access to the konva instances outside of react components. Now, a getter and setter function are used to provide access directly to the konva objects. * Updates hotkeys * Fixes canvas showing spinner on first load Also adds good default canvas scale and positioning when no image is on it * Fixes possible hang on MaskCompositer * Improves behaviour when setting init canvas image/reset view * Resets bounding box coords/dims when no image present * Disables canvas actions which cannot be done during processing * Adds useToastWatcher hook - Dispatch an `addToast` action with standard Chakra toast options object to add a toast to the toastQueue - The hook is called in App.tsx and just useEffect's w/ toastQueue as dependency to create the toasts - So now you can add toasts anywhere you have access to `dispatch`, which includes middleware and thunks - Adds first usage of this for the save image buttons in canvas * Update Hotkey Info Add missing tooltip hotkeys and update the hotkeys modal to reflect the new hotkeys for the Unified Canvas. * Fix theme changer not displaying current theme on page refresh * Fix tab count in hotkeys panel * Unify Brush and Eraser Sizes * Fix staging area display toggle not working * Staging Area delete button is now red So it doesnt feel blended into to the rest of them. * Revert "Fix theme changer not displaying current theme on page refresh" This reverts commit 903edfb803e743500242589ff093a8a8a0912726. * Add arguments to use SSL to webserver * Integrates #1487 - touch events Need to add: - Pinch zoom - Touch-specific handling (some things aren't quite right) * Refactors upload-related async thunks - Now standard thunks instead of RTK createAsyncThunk() - Adds toasts for all canvas upload-related actions * Reorganises app file structure * Fixes Canvas Auto Save to Gallery * Fixes staging area outline * Adds staging area hotkeys, disables gallery left/right when staging * Fixes Use All Parameters * Fix metadata viewer image url length when viewing intermediate * Fixes intermediate images being tiny in txt2img/img2img * Removes stale code * Improves canvas status text and adds option to toggle debug info * Fixes paste image to upload * Adds model drop-down to site header * Adds theme changer popover * Fix missing key on ThemeChanger map * Fixes stage position changing on zoom * Hotkey Cleanup - Viewer is now Z - Canvas Move tool is V - sync with PS - Removed some unused hotkeys * Fix canvas resizing when both options and gallery are unpinned * Implements thumbnails for gallery - Thumbnails are saved whenever an image is saved, and when gallery requests images from server - Thumbnails saved at original image aspect ratio with width of 128px as WEBP - If the thumbnail property of an image is unavailable for whatever reason, the image's full size URL is used instead * Saves thumbnails to separate thumbnails directory * Thumbnail size = 256px * Fix Lightbox Issues * Disables canvas image saving functions when processing * Fix index error on going past last image in Gallery * WIP - Lightbox Fixes Still need to fix the images not being centered on load when the image res changes * Fixes another similar index error, simplifies logic * Reworks canvas toolbar * Fixes canvas toolbar upload button * Cleans up IAICanvasStatusText * Improves metadata handling, fixes #1450 - Removes model list from metadata - Adds generation's specific model to metadata - Displays full metadata in JSON viewer * Gracefully handles corrupted images; fixes #1486 - App does not crash if corrupted image loaded - Error is displayed in the UI console and CLI output if an image cannot be loaded * Adds hotkey to reset canvas interaction state If the canvas' interaction state (e.g. isMovingBoundingBox, isDrawing, etc) get stuck somehow, user can press Escape to reset the state. * Removes stray console.log() * Fixes bug causing gallery to close on context menu open * Minor bugfixes - When doing long-running canvas image exporting actions, display indeterminate progress bar - Fix staging area image outline not displaying after committing/discarding results * Removes unused imports * Fixes repo root .gitignore ignoring frontend things * Builds fresh bundle * Styling updates * Removes reasonsWhyNotReady The popover doesn't play well with the button being disabled, and I don't think adds any value. * Image gallery resize/style tweaks * Styles buttons for clearing canvas history and mask * First pass on Canvas options panel * Fixes bug where discarding staged images results in loss of history * Adds Save to Gallery button to staging toolbar * Rearrange some canvas toolbar icons Put brush stuff together and canvas movement stuff together * Fix gallery maxwidth on unified canvas * Update Layer hotkey display to UI * Adds option to crop to bounding box on save * Masking option tweaks * Crop to Bounding Box > Save Box Region Only * Adds clear temp folder * Updates mask options popover behavior * Builds fresh bundle * Fix styling on alert modals * Fix input checkbox styling being incorrect on light theme * Styling fixes * Improves gallery resize behaviour * Cap gallery size on canvas tab so it doesnt overflow * Fixes bug when postprocessing image with no metadata * Adds IAIAlertDialog component * Moves Loopback to app settings * Fixes metadata viewer not showing metadata after refresh Also adds Dream-style prompt to metadata * Adds outpainting specific options * Linting * Fixes gallery width on lightbox, fixes gallery button expansion * Builds fresh bundle * Fix Lightbox images of different res not centering * Update feature tooltip text * Highlight mask icon when on mask layer * Fix gallery not resizing correctly on open and close * Add loopback to just img2img. Remove from settings. * Fix to gallery resizing * Removes Advanced checkbox, cleans up options panel for unified canvas * Minor styling fixes to new options panel layout * Styling Updates * Adds infill method * Tab Styling Fixes * memoize outpainting options * Fix unnecessary gallery re-renders * Isolate Cursor Pos debug text on canvas to prevent rerenders * Fixes missing postprocessed image metadata before refresh * Builds fresh bundle * Fix rerenders on model select * Floating panel re-render fix * Simplify fullscreen hotkey selector * Add Training WIP Tab * Adds Training icon * Move full screen hotkey to floating to prevent tab rerenders * Adds single-column gallery layout * Fixes crash on cancel with intermediates enabled, fixes #1416 * Updates npm dependencies * Fixes img2img attempting inpaint when init image has transparency * Fixes missing threshold and perlin parameters in metadata viewer * Renames "Threshold" > "Noise Threshold" * Fixes postprocessing not being disabled when clicking use all * Builds fresh bundle * Adds color picker * Lints & builds fresh bundle * Fixes iterations being disabled when seed random & variations are off * Un-floors cursor position * Changes color picker preview to circles * Fixes variation params not set correctly when recalled * Fixes invoke hotkey not working in input fields * Simplifies Accordion Prep for adding reset buttons for each section * Fixes mask brush preview color * Committing color picker color changes tool to brush * Color picker does not overwrite user-selected alpha * Adds brush color alpha hotkey * Lints * Removes force_outpaint param * Add inpaint size options to inpaint at a larger size than the actual inpaint image, then scale back down for recombination * Bug fix for inpaint size * Adds inpaint size (as scale bounding box) to UI * Adds auto-scaling for inpaint size * Improves scaled bbox display logic * Fixes bug with clear mask and history * Fixes shouldShowStagingImage not resetting to true on commit * Builds fresh bundle * Fixes canvas failing to scale on first run * Builds fresh bundle * Fixes unnecessary canvas scaling * Adds gallery drag and drop to img2img/canvas * Builds fresh bundle * Fix desktop mode being broken with new versions of flaskwebgui * Fixes canvas dimensions not setting on first load * Builds fresh bundle * stop crash on !import_models call on model inside rootdir - addresses bug report #1546 * prevent "!switch state gets confused if model switching fails" - If !switch were to fail on a particular model, then generate got confused and wouldn't try again until you switch to a different working model and back again. - This commit fixes and closes #1547 * Revert "make the docstring more readable and improve the list_models logic" This reverts commit 248068fe5d57b5639ea7a87ee6cbf023104d957d. * fix model cache path * also set fail-fast to it's default (true) in this way the whole action fails if one job fails this should unblock the runners!!! * fix output path for Archive results * disable checks for python 3.9 * Update-requirements and test-invoke-pip workflow (#1574) * update requirements files * update test-invoke-pip workflow * move requirements-mkdocs.txt to docs folder (#1575) * move requirements-mkdocs.txt to docs folder * update copyright * Fixes outpainting with resized inpaint size * Interactive configuration (#1517) * Update scripts/configure_invokeai.py prevent crash if output exists Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> * implement changes requested by reviews * default to correct root and output directory on Windows systems - Previously the script was relying on the readline buffer editing feature to set up the correct default. But this feature doesn't exist on windows. - This commit detects when user typed return with an empty directory value and replaces with the default directory. * improved readability of directory choices * Update scripts/configure_invokeai.py Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> * better error reporting at startup - If user tries to run the script outside of the repo or runtime directory, a more informative message will appear explaining the problem. Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> * Embedding merging (#1526) * add whole <style token> to vocab for concept library embeddings * add ability to load multiple concept .bin files * make --log_tokenization respect custom tokens * start working on concept downloading system * preliminary support for dynamic loading and merging of multiple embedded models - The embedding_manager is now enhanced with ldm.invoke.concepts_lib, which handles dynamic downloading and caching of embedded models from the Hugging Face concepts library (https://huggingface.co/sd-concepts-library) - Downloading of a embedded model is triggered by the presence of one or more <concept> tags in the prompt. - Once the embedded model is downloaded, its trigger phrase will be loaded into the embedding manager and the prompt's <concept> tag will be replaced with the <trigger_phrase> - The downloaded model stays on disk for fast loading later. - The CLI autocomplete will complete partial <concept> tags for you. Type a '<' and hit tab to get all ~700 concepts. BUGS AND LIMITATIONS: - MODEL NAME VS TRIGGER PHRASE You must use the name of the concept embed model from the SD library, and not the trigger phrase itself. Usually these are the same, but not always. For example, the model named "hoi4-leaders" corresponds to the trigger "<HOI4-Leader>" One reason for this design choice is that there is no apparent constraint on the uniqueness of the trigger phrases and one trigger phrase may map onto multiple models. So we use the model name instead. The second reason is that there is no way I know of to search Hugging Face for models with certain trigger phrases. So we'd have to download all 700 models to index the phrases. The problem this presents is that this may confuse users, who will want to reuse prompts from distributions that use the trigger phrase directly. Usually this will work, but not always. - WON'T WORK ON A FIREWALLED SYSTEM If the host running IAI has no internet connection, it can't download the concept libraries. I will add a script that allows users to preload a list of concept models. - BUG IN PROMPT REPLACEMENT WHEN MODEL NOT FOUND There's a small bug that occurs when the user provides an invalid model name. The <concept> gets replaced with <None> in the prompt. * fix loading .pt embeddings; allow multi-vector embeddings; warn on dupes * simplify replacement logic and remove cuda assumption * download list of concepts from hugging face * remove misleading customization of '*' placeholder the existing code as-is did not do anything; unclear what it was supposed to do. the obvious alternative -- setting using 'placeholder_strings' instead of 'placeholder_tokens' to match model.params.personalization_config.params.placeholder_strings -- caused a crash. i think this is because the passed string also needed to be handed over on init of the PersonalizedBase as the 'placeholder_token' argument. this is weird config dict magic and i don't want to touch it. put a breakpoint in personalzied.py line 116 (top of PersonalizedBase.__init__) if you want to have a crack at it yourself. * address all the issues raised by damian0815 in review of PR #1526 * actually resize the token_embeddings * multiple improvements to the concept loader based on code reviews 1. Activated the --embedding_directory option (alias --embedding_path) to load a single embedding or an entire directory of embeddings at startup time. 2. Can turn off automatic loading of embeddings using --no-embeddings. 3. Embedding checkpoints are scanned with the pickle scanner. 4. More informative error messages when a concept can't be loaded due either to a 404 not found error or a network error. * autocomplete terms end with ">" now * fix startup error and network unreachable 1. If the .invokeai file does not contain the --root and --outdir options, invoke.py will now fix it. 2. Catch and handle network problems when downloading hugging face textual inversion concepts. * fix misformatted error string Co-authored-by: Damian Stewart <d@damianstewart.com> * model_cache.py: fix list_models Signed-off-by: devops117 <55235206+devops117@users.noreply.github.com> * add statement of values (#1584) * this adds the Statement of Values Google doc source = https://docs.google.com/document/d/1-PrUKDJcxy8OyNGc8CyiHhv2VgLvjt7LRGlEpbg1nmQ/edit?usp=sharing * Fix heading * Update InvokeAI_Statement_of_Values.md * Update InvokeAI_Statement_of_Values.md * Update InvokeAI_Statement_of_Values.md * Update InvokeAI_Statement_of_Values.md * Update InvokeAI_Statement_of_Values.md * add keturn and mauwii to the team member list * Fix punctuation * this adds the Statement of Values Google doc source = https://docs.google.com/document/d/1-PrUKDJcxy8OyNGc8CyiHhv2VgLvjt7LRGlEpbg1nmQ/edit?usp=sharing * add keturn and mauwii to the team member list * fix formating - make sub bullets use * (decide to all use - or *) - indent sub bullets Sorry, first only looked at the code version and found this only after looking at the markdown rendered version * use multiparagraph numbered sections * Break up Statement Of Values as per comments on #1584 * remove duplicated word, reduce vagueness it's important not to overstate how many artists we are consulting. * fix typo (sorry blessedcoolant) Co-authored-by: mauwii <Mauwii@outlook.de> Co-authored-by: damian <git@damianstewart.com> * update dockerfile (#1551) * update dockerfile * remove not existing file from .dockerignore * remove bloat and unecesary step also use --no-cache-dir for pip install image is now close to 2GB * make Dockerfile a variable * set base image to `ubuntu:22.10` * add build-essential * link outputs folder for persistence * update tag variable * update docs * fix not customizeable build args, add reqs output * !model_import autocompletes in ROOTDIR * Adds psychedelicious to statement of values signature (#1602) * add a --no-patchmatch option to disable patchmatch loading (#1598) This feature was added to prevent the CI Macintosh tests from erroring out when patchmatch is unable to retrieve its shared library from github assets. * Fix #1599 by relaxing the `match_trigger` regex (#1601) * Fix #1599 by relaxing the `match_trigger` regex Also simplify logic and reduce duplication. * restrict trigger regex again (but not so far) * make concepts library work with Web UI This PR makes it possible to include a Hugging Face concepts library <style-or-subject-trigger> in the WebUI prompt. The metadata seems to be correctly handled. * documentation enhancements (#1603) - Add documentation for the Hugging Face concepts library and TI embedding. - Fixup index.md to point to each of the feature documentation files, including ones that are pending. * tweak setup and environment files for linux & pypatchmatch (#1580) * tweak setup and environment files for linux & pypatchmatch - Downgrade python requirements to 3.9 because 3.10 is not supported on Ubuntu 20.04 LTS (widely-used distro) - Use our github pypatchmatch 0.1.3 in order to install Makefile where it needs to be. - Restored "-e ." as the last install step on pip installs. Hopefully this will not trigger the high-CPU hang we've previously experienced. * keep windows on basicsr 1.4.1 * keep windows on basicsr 1.4.1 * bump pypatchmatch requirement to 0.1.4 - This brings in a version of pypatchmatch that will gracefully handle internet connection not available at startup time. - Also refactors and simplifies the handling of gfpgan's basicsr requirement across various platforms. * revert to older version of list_models() (#1611) This restores the correct behavior of list_models() and quenches the bug of list_models() returning a single model entry named "name". I have not investigated what was wrong with the new version, but I think it may have to do with changes to the behavior in dict.update() * Fixes for #1604 (#1605) * Converts ESRGAN image input to RGB - Also adds typing for image input. - Partially resolves #1604 * ensure there are unmasked pixels before color matching Co-authored-by: Kyle Schouviller <kyle0654@hotmail.com> * update index.md (#1609) - comment out non existing link - fix indention - add seperator between feature categories * Debloat-docker (#1612) * debloat Dockerfile - less options more but more userfriendly - better Entrypoint to simulate CLI usage - without command the container still starts the web-host * debloat build.sh * better syntax in run.sh * update Docker docs - fix description of VOLUMENAME - update run script example to reflect new entrypoint * Test installer (#1618) * test linux install * try removing http from parsed requirements * pip install confirmed working on linux * ready for linux testing - rebuilt py3.10-linux-x86_64-cuda-reqs.txt to include pypatchmatch dependency. - point install.sh and install.bat to test-installer branch. * Updates MPS reqs * detect broken readline history files * fix download.pytorch.org URL * Test installer (Win 11) (#1620) Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> * Test installer (MacOS 13.0.1 w/ torch==1.12.0) (#1621) * Test installer (Win 11) * Test installer (MacOS 13.0.1 w/ torch==1.12.0) Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> * change sourceball to development for testing * Test installer (MacOS 13.0.1 w/ torch==1.12.1 & torchvision==1.13.1) (#1622) * Test installer (Win 11) * Test installer (MacOS 13.0.1 w/ torch==1.12.0) * Test installer (MacOS 13.0.1 w/ torch==1.12.1 & torchvision==1.13.1) Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Co-authored-by: Cyrus Chan <82143712+cyruschan360@users.noreply.github.com> Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> * 2.2 Doc Updates (#1589) * Unified Canvas Docs & Assets Unified Canvas draft Advanced Tools Updates Doc Updates (lstein feedback) * copy edits to Unified Canvas docs - consistent capitalisation and feature naming - more intimate address (replace "the user" with "you") for improved User Engagement(tm) - grammatical massaging and *poesie* Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> Co-authored-by: damian <git@damianstewart.com> * include a step after config to `cat ~/.invokeai` (#1629) * disable patchmatch in CI actions (#1626) * disable patchmatch in CI actions * fix indention * replace tab with spaces Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> * Fix installer script for macOS. (#1630) * refer to the platform as 'osx' instead of 'mac', otherwise the composed URL to micromamba is wrong. * move the `-O` option to `tar` to be grouped with the other tar flags to avoid the `-O` being interpreted as something to unarchive. * Removes symlinked environment.yaml (#1631) Was unintentionally added in #1621 * Fix inpainting with iterations (#1635) * fix error when inpainting using runwayml inpainting model (#1634) - error was "Omnibus object has no attribute pil_image" - closes #1596 * add k_dpmpp_2_a and k_dpmpp_2 solvers options (#1389) * add k_dpmpp_2_a and k_dpmpp_2 solvers options * update frontend Co-authored-by: Victor <victorca25@users.noreply.github.com> Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> * add .editorconfig (#1636) * Web UI 2.2 bugfixes (#1572) * Fixes bug preventing multiple images from being generated * Fixes valid seam strength value range * Update Delete Alert Text Indicates to the user that images are not permanently deleted. * Fixes left/right arrows not working on gallery * Fixes initial image on load erroneously set to a user uploaded image Should be a result gallery image. * Lightbox Fixes - Lightbox is now a button in the current image buttons - Lightbox is also now available in the gallery context menu - Lightbox zoom issues fixed - Lightbox has a fade in animation. * Fix image display wrapper in current preview not overflow bounds * Revert "Fix image display wrapper in current preview not overflow bounds" This reverts commit 5511c82714dbf1d1999d64e8bc357bafa34ddf37. * Change Staging Area discard icon from Bin to X * Expose Snap Threshold and Move Snap Settings to BBox Panel * Changes img2img strength default to 0.75 * Fixes drawing triggering when mouse enters canvas w/ button down When we only supported inpainting and no zoom, this was useful. It allowed the cursor to leave the canvas (which was easy to do given the limited canvas dimensions) and without losing the "I am drawing" state. With a zoomable canvas this is no longer as useful. Additionally, we have more popovers and tools (like the color pickers) which result in unexpected brush strokes. This fixes that issue. * Revert "Expose Snap Threshold and Move Snap Settings to BBox Panel" We will handle this a bit differently - by allowing the grid origin to be moved. I will dig in at some point. This reverts commit 33c92ecf4da724c2f17d9d91c7ea31a43a2f6deb. * Adds Limit Strokes to Box * Adds fill bounding box button * Adds erase bounding box button * Changes Staging area discard icon to match others * Fixes right click breaking move tool * Fixes brush preview visibility issue with "darken outside box" * Fixes history bugs with addFillRect, addEraseRect, and other actions * Adds missing `key` * Fixes postprocessing being applied to canvas generations * Fixes bbox not getting scaled in various situations * Fixes staging area show image toggle not resetting on accept/discard * Locks down canvas while generating/staging * Fixes move tool breaking when canvas loses focus during move/transform * Hides cursor when restrict strokes is on and mouse outside bbox * Lints * Builds fresh bundle * Fix overlapping hotkey for Fill Bounding Box * Build Fresh Bundle * Fixes bug with mask and bbox overlay * Builds fresh bundle Co-authored-by: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> * disable NSFW checker loading during the CI tests (#1641) * disable NSFW checker loading during the CI tests The NSFW filter apparently causes invoke.py to crash during CI testing, possibly due to out of memory errors. This workaround disables NSFW model loading. * doc change * fix formatting errors in yml files * Configure the NSFW checker at install time with default on (#1624) * configure the NSFW checker at install time with default on 1. Changes the --safety_checker argument to --nsfw_checker and --no-nsfw_checker. The original argument is recognized for backward compatibility. 2. The configure script asks users whether to enable the checker (default yes). Also offers users ability to select default sampler and number of generation steps. 3.Enables the pasting of the caution icon on blurred images when InvokeAI is installed into the package directory. 4. Adds documentation for the NSFW checker, including caveats about accuracy, memory requirements, and intermediate image dispaly. * use better fitting icon * NSFW defaults false for testing * set default back to nsfw active Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> Signed-off-by: devops117 <55235206+devops117@users.noreply.github.com> Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Co-authored-by: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Co-authored-by: Kyle Schouviller <kyle0654@hotmail.com> Co-authored-by: javl <mail@jaspervanloenen.com> Co-authored-by: Kent Keirsey <31807370+hipsterusername@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com> Co-authored-by: Damian Stewart <d@damianstewart.com> Co-authored-by: DevOps117 <55235206+devops117@users.noreply.github.com> Co-authored-by: damian <git@damianstewart.com> Co-authored-by: Damian Stewart <null@damianstewart.com> Co-authored-by: Cyrus Chan <82143712+cyruschan360@users.noreply.github.com> Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> Co-authored-by: Andre LaBranche <dre@mac.com> Co-authored-by: victorca25 <41912303+victorca25@users.noreply.github.com> Co-authored-by: Victor <victorca25@users.noreply.github.com>
2022-11-30 21:12:23 +00:00
embiggen_strength = opt.embiggen_strength,
image_callback = callback,
)
elif tool == 'outpaint':
from ldm.invoke.restoration.outpaint import Outpaint
restorer = Outpaint(image,self)
return restorer.process(
opt,
args,
image_callback = callback,
prefix = prefix
)
elif tool is None:
use 🧨diffusers model (#1583) * initial commit of DiffusionPipeline class * spike: proof of concept using diffusers for txt2img * doc: type hints for Generator * refactor(model_cache): factor out load_ckpt * model_cache: add ability to load a diffusers model pipeline and update associated things in Generate & Generator to not instantly fail when that happens * model_cache: fix model default image dimensions * txt2img: support switching diffusers schedulers * diffusers: let the scheduler do its scaling of the initial latents Remove IPNDM scheduler; it is not behaving. * web server: update image_progress callback for diffusers data * diffusers: restore prompt weighting feature * diffusers: fix set-sampler error following model switch * diffusers: use InvokeAIDiffuserComponent for conditioning * cross_attention_control: stub (no-op) implementations for diffusers * model_cache: let offload_model work with DiffusionPipeline, sorta. * models.yaml.example: add diffusers-format model, set as default * test-invoke-conda: use diffusers-format model test-invoke-conda: put huggingface-token where the library can use it * environment-mac: upgrade to diffusers 0.7 (from 0.6) this was already done for linux; mac must have been lost in the merge. * preload_models: explicitly load diffusers models In non-interactive mode too, as long as you're logged in. * fix(model_cache): don't check `model.config` in diffusers format clean-up from recent merge. * diffusers integration: support img2img * dev: upgrade to diffusers 0.8 (from 0.7.1) We get to remove some code by using methods that were factored out in the base class. * refactor: remove backported img2img.get_timesteps now that we can use it directly from diffusers 0.8.1 * ci: use diffusers model * dev: upgrade to diffusers 0.9 (from 0.8.1) * lint: correct annotations for Python 3.9. * lint: correct AttributeError.name reference for Python 3.9. * CI: prefer diffusers-1.4 because it no longer requires a token The RunwayML models still do. * build: there's yet another place to update requirements? * configure: try to download models even without token Models in the CompVis and stabilityai repos no longer require them. (But runwayml still does.) * configure: add troubleshooting info for config-not-found * fix(configure): prepend root to config path * fix(configure): remove second `default: true` from models example * CI: simplify test-on-push logic now that we don't need secrets The "test on push but only in forks" logic was only necessary when tests didn't work for PRs-from-forks. * create an embedding_manager for diffusers * internal: avoid importing diffusers DummyObject see https://github.com/huggingface/diffusers/issues/1479 * fix "config attributes…not expected" diffusers warnings. * fix deprecated scheduler construction * work around an apparent MPS torch bug that causes conditioning to have no effect * 🚧 post-rebase repair * preliminary support for outpainting (no masking yet) * monkey-patch diffusers.attention and use Invoke lowvram code * add always_use_cpu arg to bypass MPS * add cross-attention control support to diffusers (fails on MPS) For unknown reasons MPS produces garbage output with .swap(). Use --always_use_cpu arg to invoke.py for now to test this code on MPS. * diffusers support for the inpainting model * fix debug_image to not crash with non-RGB images. * inpainting for the normal model [WIP] This seems to be performing well until the LAST STEP, at which point it dissolves to confetti. * fix off-by-one bug in cross-attention-control (#1774) prompt token sequences begin with a "beginning-of-sequence" marker <bos> and end with a repeated "end-of-sequence" marker <eos> - to make a default prompt length of <bos> + 75 prompt tokens + <eos>. the .swap() code was failing to take the column for <bos> at index 0 into account. the changes here do that, and also add extra handling for a single <eos> (which may be redundant but which is included for completeness). based on my understanding and some assumptions about how this all works, the reason .swap() nevertheless seemed to do the right thing, to some extent, is because over multiple steps the conditioning process in Stable Diffusion operates as a feedback loop. a change to token n-1 has flow-on effects to how the [1x4x64x64] latent tensor is modified by all the tokens after it, - and as the next step is processed, all the tokens before it as well. intuitively, a token's conditioning effects "echo" throughout the whole length of the prompt. so even though the token at n-1 was being edited when what the user actually wanted was to edit the token at n, it nevertheless still had some non-negligible effect, in roughly the right direction, often enough that it seemed like it was working properly. * refactor common CrossAttention stuff into a mixin so that the old ldm code can still work if necessary * inpainting for the normal model. I think it works this time. * diffusers: reset num_vectors_per_token sync with 44a00555718f1df173c60da0ed646cf700e29537 * diffusers: txt2img2img (hires_fix) with so much slicing and dicing of pipeline methods to stitch them together * refactor(diffusers): reduce some code duplication amongst the different tasks * fixup! refactor(diffusers): reduce some code duplication amongst the different tasks * diffusers: enable DPMSolver++ scheduler * diffusers: upgrade to diffusers 0.10, add Heun scheduler * diffusers(ModelCache): stopgap to make from_cpu compatible with diffusers * CI: default to diffusers-1.5 now that runwayml token requirement is gone * diffusers: update to 0.10 (and transformers to 4.25) * diffusers: use xformers when available diffusers no longer auto-enables this as of 0.10.2. * diffusers: make masked img2img behave better with multi-step schedulers re-randomizing the noise each step was confusing them. * diffusers: work more better with more models. fixed relative path problem with local models. fixed models on hub not always having a `fp16` branch. * diffusers: stopgap fix for attention_maps_callback crash after recent merge * fixup import merge conflicts correction for 061c5369a2247c6c92cd69606bcf54c4f1962a0b * test: add tests/inpainting inputs for masked img2img * diffusers(AddsMaskedGuidance): partial fix for k-schedulers Prevents them from crashing, but results are still hot garbage. * fix --safety_checker arg parsing and add note to diffusers loader about where safety checker gets called * generate: fix import error * CI: don't try to read the old init location * diffusers: support loading an alternate VAE * CI: remove sh-syntax if-statement so it doesn't crash powershell * CI: fold strings in yaml because backslash is not line-continuation in powershell * attention maps callback stuff for diffusers * build: fix syntax error in environment-mac * diffusers: add INITIAL_MODELS with diffusers-compatible repos * re-enable the embedding manager; closes #1778 * Squashed commit of the following: commit e4a956abc37fcb5cf188388b76b617bc5c8fda7d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:43:07 2022 +0100 import new load handling from EmbeddingManager and cleanup commit c4abe91a5ba0d415b45bf734068385668b7a66e6 Merge: 032e856e 1efc6397 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:09:53 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers_with_textual_inversion_manager commit 032e856eefb3bbc39534f5daafd25764bcfcef8b Merge: 8b4f0fe9 bc515e24 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:08:01 2022 +0100 Merge remote-tracking branch 'upstream/dev/diffusers' into dev/diffusers_with_textual_inversion_manager commit 1efc6397fc6e61c1aff4b0258b93089d61de5955 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:04:28 2022 +0100 cleanup and add performance notes commit e400f804ac471a0ca2ba432fd658778b20c7bdab Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:45:07 2022 +0100 fix bug and update unit tests commit deb9ae0ae1016750e93ce8275734061f7285a231 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:28:29 2022 +0100 textual inversion manager seems to work commit 162e02505dec777e91a983c4d0fb52e950d25ff0 Merge: cbad4583 12769b3d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:58:03 2022 +0100 Merge branch 'main' into feature_textual_inversion_mgr commit cbad45836c6aace6871a90f2621a953f49433131 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:54:10 2022 +0100 use position embeddings commit 070344c69b0e0db340a183857d0a787b348681d3 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:53:47 2022 +0100 Don't crash CLI on exceptions commit b035ac8c6772dfd9ba41b8eeb9103181cda028f8 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:11:55 2022 +0100 add missing position_embeddings commit 12769b3d3562ef71e0f54946b532ad077e10043c Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:33:25 2022 +0100 debugging why it don't work commit bafb7215eabe1515ca5e8388fd3bb2f3ac5362cf Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:21:33 2022 +0100 debugging why it don't work commit 664a6e9e146b42d96703f0cc8baf8f5efec04ee1 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit 8b4f0fe9d6e4e2643b36dfa27864294785d7ba4e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit ffbe1ab11163ba712e353d89404e301d0e0c6cdf Merge: 6e4dad60 023df37e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:37:31 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers commit 023df37efffa67434f77def7fc3c9dfb29f699fd Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:36:54 2022 +0100 cleanup commit 05fac594eaf79d0058e3c48deee93df603f136c2 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:07:49 2022 +0100 tweak error checking commit 009f32ed39a7280997c3ffab112adadee0b44279 Author: damian <null@damianstewart.com> Date: Thu Dec 15 21:29:47 2022 +0100 unit tests passing for embeddings with vector length >1 commit beb1b08d9a98112ed2fe073580568e1a18698da3 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:39:09 2022 +0100 more explicit equality tests when overwriting commit 44d8a5a7c85cdabc9ce3a54fd0769a10597b3ca9 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:30:13 2022 +0100 wip textual inversion manager (unit tests passing for 1v embedding overwriting) commit 417c2b57d90924a839616bfb66804faab8039e4c Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 12:30:55 2022 +0100 wip textual inversion manager (unit tests passing for base stuff + padding) commit 2e80872e3b6f7fd7d8eb8928822bd824b63cb2ff Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 10:57:57 2022 +0100 wip new TextualInversionManager * stop using WeightedFrozenCLIPEmbedder * store diffusion models locally - configure_invokeai.py reconfigured to store diffusion models rather than CompVis models - hugging face caching model is used, but cache is set to ~/invokeai/models/repo_id - models.yaml does **NOT** use path, just repo_id - "repo_name" changed to "repo_id" to following hugging face conventions - Models are loaded with full precision pending further work. * allow non-local files during development * path takes priority over repo_id * MVP for model_cache and configure_invokeai - Feature complete (almost) - configure_invokeai.py downloads both .ckpt and diffuser models, along with their VAEs. Both types of download are controlled by a unified INITIAL_MODELS.yaml file. - model_cache can load both type of model and switches back and forth in CPU. No memory leaks detected TO DO: 1. I have not yet turned on the LocalOnly flag for diffuser models, so the code will check the Hugging Face repo for updates before using the locally cached models. This will break firewalled systems. I am thinking of putting in a global check for internet connectivity at startup time and setting the LocalOnly flag based on this. It would be good to check updates if there is connectivity. 2. I have not gone completely through INITIAL_MODELS.yaml to check which models are available as diffusers and which are not. So models like PaperCut and VoxelArt may not load properly. The runway and stability models are checked, as well as the Trinart models. 3. Add stanzas for SD 2.0 and 2.1 in INITIAL_MODELS.yaml REMAINING PROBLEMS NOT DIRECTLY RELATED TO MODEL_CACHE: 1. When loading a .ckpt file there are lots of messages like this: Warning! ldm.modules.attention.CrossAttention is no longer being maintained. Please use InvokeAICrossAttention instead. I'm not sure how to address this. 2. The ckpt models ***don't actually run*** due to the lack of special-case support for them in the generator objects. For example, here's the hard crash you get when you run txt2img against the legacy waifu-diffusion-1.3 model: ``` >> An error occurred: Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 140, in main main_loop(gen, opt) File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 371, in main_loop gen.prompt2image( File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1265, in __getattr__ raise AttributeError("'{}' object has no attribute '{}'".format( AttributeError: 'LatentDiffusion' object has no attribute 'image_from_embeddings' ``` 3. The inpainting diffusion model isn't working. Here's the output of "banana sushi" when inpainting-1.5 is loaded: ``` Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 301, in image_from_embeddings result_latents, result_attention_map_saver = self.latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 330, in latents_from_embeddings result: PipelineIntermediateState = infer_latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 185, in __call__ for result in self.generator_method(*args, **kwargs): File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 367, in generate_latents_from_embeddings step_output = self.step(batched_t, latents, guidance_scale, File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context return func(*args, **kwargs) File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 409, in step step_output = self.scheduler.step(noise_pred, timestep, latents, **extra_step_kwargs) File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/diffusers/schedulers/scheduling_lms_discrete.py", line 223, in step pred_original_sample = sample - sigma * model_output RuntimeError: The size of tensor a (9) must match the size of tensor b (4) at non-singleton dimension 1 ``` * proper support for float32/float16 - configure script now correctly detects user's preference for fp16/32 and downloads the correct diffuser version. If fp16 version not available, falls back to fp32 version. - misc code cleanup and simplification in model_cache * add on-the-fly conversion of .ckpt to diffusers models 1. On-the-fly conversion code can be found in the file ldm/invoke/ckpt_to_diffusers.py. 2. A new !optimize command has been added to the CLI. Should be ported to Web GUI. User experience on the CLI is this: ``` invoke> !optimize /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt INFO: Converting legacy weights file /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt to optimized diffuser model. This operation will take 30-60s to complete. Success. Optimized model is now located at /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 Writing new config file entry for sd-v1-4... >> New configuration: sd-v1-4: description: Optimized version of sd-v1-4 format: diffusers path: /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 OK to import [n]? y >> Verifying that new model loads... >> Current VRAM usage: 2.60G >> Offloading stable-diffusion-2.1 to CPU >> Loading diffusers model from /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 | Using faster float16 precision You have disabled the safety checker for <class 'ldm.invoke.generator.diffusers_pipeline.StableDiffusionGeneratorPipeline'> by passing `safety_checker=None`. Ensure that you abide to the conditions of the Stable Diffusion \ license and do not expose unfiltered results in services or applications open to the public. Both the diffusers team and Hugging Face strongly recommend to keep the safety filter enabled in all public facing circumstances,\ disabling it only for use-cases that involve analyzing network behavior or auditing its results. For more information, please have a look at https://github.com/huggingface/diffusers/pull/254 . | training width x height = (512 x 512) >> Model loaded in 3.48s >> Max VRAM used to load the model: 2.17G >> Current VRAM usage:2.17G >> Textual inversions available: >> Setting Sampler to k_lms (LMSDiscreteScheduler) Keep model loaded? [y] ``` * add parallel set of generator files for ckpt legacy generation * generation using legacy ckpt models now working * diffusers: fix missing attention_maps_callback fix for 23eb80b40421b2bb8f4b6d3dd30490d11c447b36 * associate legacy CrossAttention with .ckpt models * enable autoconvert New --autoconvert CLI option will scan a designated directory for new .ckpt files, convert them into diffuser models, and import them into models.yaml. Works like this: invoke.py --autoconvert /path/to/weights/directory In ModelCache added two new methods: autoconvert_weights(config_path, weights_directory_path, models_directory_path) convert_and_import(ckpt_path, diffuser_path) * diffusers: update to diffusers 0.11 (from 0.10.2) * fix vae loading & width/height calculation * refactor: encapsulate these conditioning data into one container * diffusers: fix some noise-scaling issues by pushing the noise-mixing down to the common function * add support for safetensors and accelerate * set local_files_only when internet unreachable * diffusers: fix error-handling path when model repo has no fp16 branch * fix generatorinpaint error Fixes : "ModuleNotFoundError: No module named 'ldm.invoke.generatorinpaint' https://github.com/invoke-ai/InvokeAI/pull/1583#issuecomment-1363634318 * quench diffuser safety-checker warning * diffusers: support stochastic DDIM eta parameter * fix conda env creation on macos * fix cross-attention with diffusers 0.11 * diffusers: the VAE needs to be tiling as well as the U-Net * diffusers: comment on subfolders * diffusers: embiggen! * diffusers: make model_cache.list_models serializable * diffusers(inpaint): restore scaling functionality * fix requirements clash between numba and numpy 1.24 * diffusers: allow inpainting model to do non-inpainting tasks * start expanding model_cache functionality * add import_ckpt_model() and import_diffuser_model() methods to model_manager - in addition, model_cache.py is now renamed to model_manager.py * allow "recommended" flag to be optional in INITIAL_MODELS.yaml * configure_invokeai now downloads VAE diffusers in advance * rename ModelCache to ModelManager * remove support for `repo_name` in models.yaml * check for and refuse to load embeddings trained on incompatible models * models.yaml.example: s/repo_name/repo_id and remove extra INITIAL_MODELS now that the main one has diffusers models in it. * add MVP textual inversion script * refactor(InvokeAIDiffuserComponent): factor out _combine() * InvokeAIDiffuserComponent: implement threshold * InvokeAIDiffuserComponent: diagnostic logs for threshold ...this does not look right * add a curses-based frontend to textual inversion - not quite working yet - requires npyscreen installed - on windows will also have the windows-curses requirement, but not added to requirements yet * add curses-based interface for textual inversion * fix crash in convert_and_import() - This corrects a "local variable referenced before assignment" error in model_manager.convert_and_import() * potential workaround for no 'state_dict' key error - As reported in https://github.com/huggingface/diffusers/issues/1876 * create TI output dir if needed * Update environment-lin-cuda.yml (#2159) Fixing line 42 to be the proper order to define the transformers requirement: ~= instead of =~ * diffusers: update sampler-to-scheduler mapping based on https://github.com/huggingface/diffusers/issues/277#issuecomment-1371428672 * improve user exp for ckt to diffusers conversion - !optimize_models command now operates on an existing ckpt file entry in models.yaml - replaces existing entry, rather than adding a new one - offers to delete the ckpt file after conversion * web: adapt progress callback to deal with old generator or new diffusers pipeline * clean-up model_manager code - add_model() verified to work for .ckpt local paths, .ckpt remote URLs, diffusers local paths, and diffusers repo_ids - convert_and_import() verified to work for local and remove .ckpt files * handle edge cases for import_model() and convert_model() * add support for safetensor .ckpt files * fix name error * code cleanup with pyflake * improve model setting behavior - If the user enters an invalid model name at startup time, will not try to load it, warn, and use default model - CLI UI enhancement: include currently active model in the command line prompt. * update test-invoke-pip.yml - fix model cache path to point to runwayml/stable-diffusion-v1-5 - remove `skip-sd-weights` from configure_invokeai.py args * exclude dev/diffusers from "fail for draft PRs" * disable "fail on PR jobs" * re-add `--skip-sd-weights` since no space * update workflow environments - include `INVOKE_MODEL_RECONFIGURE: '--yes'` * clean up model load failure handling - Allow CLI to run even when no model is defined or loadable. - Inhibit stack trace when model load fails - only show last error - Give user *option* to run configure_invokeai.py when no models successfully load. - Restart invokeai after reconfiguration. * further edge-case handling 1) only one model in models.yaml file, and that model is broken 2) no models in models.yaml 3) models.yaml doesn't exist at all * fix incorrect model status listing - "cached" was not being returned from list_models() - normalize handling of exceptions during model loading: - Passing an invalid model name to generate.set_model() will return a KeyError - All other exceptions are returned as the appropriate Exception * CI: do download weights (if not already cached) * diffusers: fix scheduler loading in offline mode * CI: fix model name (no longer has `diffusers-` prefix) * Update txt2img2img.py (#2256) * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * feat - make model storage compatible with hugging face caching system This commit alters the InvokeAI model directory to be compatible with hugging face, making it easier to share diffusers (and other models) across different programs. - If the HF_HOME environment variable is not set, then models are cached in ~/invokeai/models in a format that is identical to the HuggingFace cache. - If HF_HOME is set, then models are cached wherever HF_HOME points. - To enable sharing with other HuggingFace library clients, set HF_HOME to ~/.cache/huggingface to set the default cache location or to ~/invokeai/models to have huggingface cache inside InvokeAI. * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * fix error "no attribute CkptInpaint" * model_manager.list_models() returns entire model config stanza+status * Initial Draft - Model Manager Diffusers * added hash function to diffusers * implement sha256 hashes on diffusers models * Add Model Manager Support for Diffusers * fix various problems with model manager - in cli import functions, fix not enough values to unpack from _get_name_and_desc() - fix crash when using old-style vae: value with new-style diffuser * rebuild frontend * fix dictconfig-not-serializable issue * fix NoneType' object is not subscriptable crash in model_manager * fix "str has no attribute get" error in model_manager list_models() * Add path and repo_id support for Diffusers Model Manager Also fixes bugs * Fix tooltip IT localization not working * Add Version Number To WebUI * Optimize Model Search * Fix incorrect font on the Model Manager UI * Fix image degradation on merge fixes - [Experimental] This change should effectively fix a couple of things. - Fix image degradation on subsequent merges of the canvas layers. - Fix the slight transparent border that is left behind when filling the bounding box with a color. - Fix the left over line of color when filling a bounding box with color. So far there are no side effects for this. If any, please report. * Add local model filtering for Diffusers / Checkpoints * Go to home on modal close for the Add Modal UI * Styling Fixes * Model Manager Diffusers Localization Update * Add Safe Tensor scanning to Model Manager * Fix model edit form dispatching string values instead of numbers. * Resolve VAE handling / edge cases for supplied repos * defer injecting tokens for textual inversions until they're used for the first time * squash a console warning * implement model migration check * add_model() overwrites previous config rather than merges * fix model config file attribute merging * fix precision handling in textual inversion script * allow ckpt conversion script to work with safetensors .ckpts Applied patch here: https://github.com/huggingface/diffusers/commit/beb932c5d111872c5e45387e7b1b2b3dd0524a47 * fix name "args" is not defined crash in textual_inversion_training * fix a second NameError: name 'args' is not defined crash * fix loading of the safety checker from the global cache dir * add installation step to textual inversion frontend - After a successful training run, the script will copy learned_embeds.bin to a subfolder of the embeddings directory. - User given the option to delete the logs and intermediate checkpoints (which together use 7-8G of space) - If textual inversion training fails, reports the error gracefully. * don't crash out on incompatible embeddings - put try: blocks around places where the system tries to load an embedding which is incompatible with the currently loaded model * add support for checkpoint resuming * textual inversion preferences are saved and restored between sessions - Preferences are stored in a file named text-inversion-training/preferences.conf - Currently the resume-from-checkpoint option is not working correctly. Possible bug in textual_inversion_training.py? * copy learned_embeddings.bin into right location * add front end for diffusers model merging - Front end doesn't do anything yet!!!! - Made change to model name parsing in CLI to support ability to have merged models with the "+" character in their names. * improve inpainting experience - recommend ckpt version of inpainting-1.5 to user - fix get_noise() bug in ckpt version of omnibus.py * update environment*yml * tweak instructions to install HuggingFace token * bump version number * enhance update scripts - update scripts will now fetch new INITIAL_MODELS.yaml so that configure_invokeai.py will know about the diffusers versions. * enhance invoke.sh/invoke.bat launchers - added configure_invokeai.py to menu - menu defaults to browser-based invoke * remove conda workflow (#2321) * fix `token_ids has shape torch.Size([79]) - expected [77]` * update CHANGELOG.md with 2.3.* info - Add information on how formats have changed and the upgrade process. - Add short bug list. Co-authored-by: Damian Stewart <d@damianstewart.com> Co-authored-by: Damian Stewart <null@damianstewart.com> Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> Co-authored-by: Wybartel-luxmc <37852506+Wybartel-luxmc@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> Co-authored-by: mickr777 <115216705+mickr777@users.noreply.github.com> Co-authored-by: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Co-authored-by: Eugene Brodsky <ebr@users.noreply.github.com> Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com>
2023-01-15 14:22:46 +00:00
print('* please provide at least one postprocessing option, such as -G or -U')
return None
else:
print(f'* postprocessing tool {tool} is not yet supported')
return None
def select_generator(
self,
init_image:Image.Image=None,
mask_image:Image.Image=None,
embiggen:bool=False,
hires_fix:bool=False,
force_outpaint:bool=False,
):
inpainting_model_in_use = self.sampler.uses_inpainting_model()
if hires_fix:
return self._make_txt2img2img()
if embiggen is not None:
return self._make_embiggen()
if inpainting_model_in_use:
return self._make_omnibus()
if ((init_image is not None) and (mask_image is not None)) or force_outpaint:
return self._make_inpaint()
if init_image is not None:
return self._make_img2img()
return self._make_txt2img()
def _make_images(
self,
img,
mask,
width,
height,
fit=False,
text_mask=None,
invert_mask=False,
force_outpaint=False,
):
init_image = None
init_mask = None
if not img:
return None, None
image = self._load_img(img)
if image.width < self.width and image.height < self.height:
print(f'>> WARNING: img2img and inpainting may produce unexpected results with initial images smaller than {self.width}x{self.height} in both dimensions')
# if image has a transparent area and no mask was provided, then try to generate mask
if self._has_transparency(image):
self._transparency_check_and_warning(image, mask, force_outpaint)
init_mask = self._create_init_mask(image, width, height, fit=fit)
enable fast switching between models in invoke.py - This PR enables two new commands in the invoke.py script !models -- list the available models and their cache status !switch <model> -- switch to the indicated model Example: invoke> !models laion400m not loaded Latent Diffusion LAION400M model stable-diffusion-1.4 active Stable Diffusion inference model version 1.4 waifu-1.3 cached Waifu anime model version 1.3 invoke> !switch waifu-1.3 >> Caching model stable-diffusion-1.4 in system RAM >> Retrieving model waifu-1.3 from system RAM cache The name and descriptions of the models are taken from `config/models.yaml`. A future enhancement to `model_cache.py` will be to enable new model stanzas to be added to the file programmatically. This will be useful for the WebGUI. More details: - Use fast switching algorithm described in PR #948 - Models are selected using their configuration stanza name given in models.yaml. - To avoid filling up CPU RAM with cached models, this PR implements an LRU cache that monitors available CPU RAM. - The caching code allows the minimum value of available RAM to be adjusted, but invoke.py does not currently have a command-line argument that allows you to set it. The minimum free RAM is arbitrarily set to 2 GB. - Add optional description field to configs/models.yaml Unrelated fixes: - Added ">>" to CompViz model loading messages in order to make user experience more consistent. - When generating an image greater than defaults, will only warn about possible VRAM filling the first time. - Fixed bug that was causing help message to be printed twice. This involved moving the import line for the web backend into the section where it is called. Coauthored by: @ArDiouscuros
2022-10-12 06:14:59 +00:00
if (image.width * image.height) > (self.width * self.height) and self.size_matters:
print(">> This input is larger than your defaults. If you run out of memory, please use a smaller image.")
enable fast switching between models in invoke.py - This PR enables two new commands in the invoke.py script !models -- list the available models and their cache status !switch <model> -- switch to the indicated model Example: invoke> !models laion400m not loaded Latent Diffusion LAION400M model stable-diffusion-1.4 active Stable Diffusion inference model version 1.4 waifu-1.3 cached Waifu anime model version 1.3 invoke> !switch waifu-1.3 >> Caching model stable-diffusion-1.4 in system RAM >> Retrieving model waifu-1.3 from system RAM cache The name and descriptions of the models are taken from `config/models.yaml`. A future enhancement to `model_cache.py` will be to enable new model stanzas to be added to the file programmatically. This will be useful for the WebGUI. More details: - Use fast switching algorithm described in PR #948 - Models are selected using their configuration stanza name given in models.yaml. - To avoid filling up CPU RAM with cached models, this PR implements an LRU cache that monitors available CPU RAM. - The caching code allows the minimum value of available RAM to be adjusted, but invoke.py does not currently have a command-line argument that allows you to set it. The minimum free RAM is arbitrarily set to 2 GB. - Add optional description field to configs/models.yaml Unrelated fixes: - Added ">>" to CompViz model loading messages in order to make user experience more consistent. - When generating an image greater than defaults, will only warn about possible VRAM filling the first time. - Fixed bug that was causing help message to be printed twice. This involved moving the import line for the web backend into the section where it is called. Coauthored by: @ArDiouscuros
2022-10-12 06:14:59 +00:00
self.size_matters = False
init_image = self._create_init_image(image,width,height,fit=fit)
if mask:
mask_image = self._load_img(mask)
init_mask = self._create_init_mask(mask_image,width,height,fit=fit)
elif text_mask:
init_mask = self._txt2mask(image, text_mask, width, height, fit=fit)
if init_mask and invert_mask:
init_mask = ImageOps.invert(init_mask)
return init_image,init_mask
def _make_base(self):
use 🧨diffusers model (#1583) * initial commit of DiffusionPipeline class * spike: proof of concept using diffusers for txt2img * doc: type hints for Generator * refactor(model_cache): factor out load_ckpt * model_cache: add ability to load a diffusers model pipeline and update associated things in Generate & Generator to not instantly fail when that happens * model_cache: fix model default image dimensions * txt2img: support switching diffusers schedulers * diffusers: let the scheduler do its scaling of the initial latents Remove IPNDM scheduler; it is not behaving. * web server: update image_progress callback for diffusers data * diffusers: restore prompt weighting feature * diffusers: fix set-sampler error following model switch * diffusers: use InvokeAIDiffuserComponent for conditioning * cross_attention_control: stub (no-op) implementations for diffusers * model_cache: let offload_model work with DiffusionPipeline, sorta. * models.yaml.example: add diffusers-format model, set as default * test-invoke-conda: use diffusers-format model test-invoke-conda: put huggingface-token where the library can use it * environment-mac: upgrade to diffusers 0.7 (from 0.6) this was already done for linux; mac must have been lost in the merge. * preload_models: explicitly load diffusers models In non-interactive mode too, as long as you're logged in. * fix(model_cache): don't check `model.config` in diffusers format clean-up from recent merge. * diffusers integration: support img2img * dev: upgrade to diffusers 0.8 (from 0.7.1) We get to remove some code by using methods that were factored out in the base class. * refactor: remove backported img2img.get_timesteps now that we can use it directly from diffusers 0.8.1 * ci: use diffusers model * dev: upgrade to diffusers 0.9 (from 0.8.1) * lint: correct annotations for Python 3.9. * lint: correct AttributeError.name reference for Python 3.9. * CI: prefer diffusers-1.4 because it no longer requires a token The RunwayML models still do. * build: there's yet another place to update requirements? * configure: try to download models even without token Models in the CompVis and stabilityai repos no longer require them. (But runwayml still does.) * configure: add troubleshooting info for config-not-found * fix(configure): prepend root to config path * fix(configure): remove second `default: true` from models example * CI: simplify test-on-push logic now that we don't need secrets The "test on push but only in forks" logic was only necessary when tests didn't work for PRs-from-forks. * create an embedding_manager for diffusers * internal: avoid importing diffusers DummyObject see https://github.com/huggingface/diffusers/issues/1479 * fix "config attributes…not expected" diffusers warnings. * fix deprecated scheduler construction * work around an apparent MPS torch bug that causes conditioning to have no effect * 🚧 post-rebase repair * preliminary support for outpainting (no masking yet) * monkey-patch diffusers.attention and use Invoke lowvram code * add always_use_cpu arg to bypass MPS * add cross-attention control support to diffusers (fails on MPS) For unknown reasons MPS produces garbage output with .swap(). Use --always_use_cpu arg to invoke.py for now to test this code on MPS. * diffusers support for the inpainting model * fix debug_image to not crash with non-RGB images. * inpainting for the normal model [WIP] This seems to be performing well until the LAST STEP, at which point it dissolves to confetti. * fix off-by-one bug in cross-attention-control (#1774) prompt token sequences begin with a "beginning-of-sequence" marker <bos> and end with a repeated "end-of-sequence" marker <eos> - to make a default prompt length of <bos> + 75 prompt tokens + <eos>. the .swap() code was failing to take the column for <bos> at index 0 into account. the changes here do that, and also add extra handling for a single <eos> (which may be redundant but which is included for completeness). based on my understanding and some assumptions about how this all works, the reason .swap() nevertheless seemed to do the right thing, to some extent, is because over multiple steps the conditioning process in Stable Diffusion operates as a feedback loop. a change to token n-1 has flow-on effects to how the [1x4x64x64] latent tensor is modified by all the tokens after it, - and as the next step is processed, all the tokens before it as well. intuitively, a token's conditioning effects "echo" throughout the whole length of the prompt. so even though the token at n-1 was being edited when what the user actually wanted was to edit the token at n, it nevertheless still had some non-negligible effect, in roughly the right direction, often enough that it seemed like it was working properly. * refactor common CrossAttention stuff into a mixin so that the old ldm code can still work if necessary * inpainting for the normal model. I think it works this time. * diffusers: reset num_vectors_per_token sync with 44a00555718f1df173c60da0ed646cf700e29537 * diffusers: txt2img2img (hires_fix) with so much slicing and dicing of pipeline methods to stitch them together * refactor(diffusers): reduce some code duplication amongst the different tasks * fixup! refactor(diffusers): reduce some code duplication amongst the different tasks * diffusers: enable DPMSolver++ scheduler * diffusers: upgrade to diffusers 0.10, add Heun scheduler * diffusers(ModelCache): stopgap to make from_cpu compatible with diffusers * CI: default to diffusers-1.5 now that runwayml token requirement is gone * diffusers: update to 0.10 (and transformers to 4.25) * diffusers: use xformers when available diffusers no longer auto-enables this as of 0.10.2. * diffusers: make masked img2img behave better with multi-step schedulers re-randomizing the noise each step was confusing them. * diffusers: work more better with more models. fixed relative path problem with local models. fixed models on hub not always having a `fp16` branch. * diffusers: stopgap fix for attention_maps_callback crash after recent merge * fixup import merge conflicts correction for 061c5369a2247c6c92cd69606bcf54c4f1962a0b * test: add tests/inpainting inputs for masked img2img * diffusers(AddsMaskedGuidance): partial fix for k-schedulers Prevents them from crashing, but results are still hot garbage. * fix --safety_checker arg parsing and add note to diffusers loader about where safety checker gets called * generate: fix import error * CI: don't try to read the old init location * diffusers: support loading an alternate VAE * CI: remove sh-syntax if-statement so it doesn't crash powershell * CI: fold strings in yaml because backslash is not line-continuation in powershell * attention maps callback stuff for diffusers * build: fix syntax error in environment-mac * diffusers: add INITIAL_MODELS with diffusers-compatible repos * re-enable the embedding manager; closes #1778 * Squashed commit of the following: commit e4a956abc37fcb5cf188388b76b617bc5c8fda7d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:43:07 2022 +0100 import new load handling from EmbeddingManager and cleanup commit c4abe91a5ba0d415b45bf734068385668b7a66e6 Merge: 032e856e 1efc6397 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:09:53 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers_with_textual_inversion_manager commit 032e856eefb3bbc39534f5daafd25764bcfcef8b Merge: 8b4f0fe9 bc515e24 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:08:01 2022 +0100 Merge remote-tracking branch 'upstream/dev/diffusers' into dev/diffusers_with_textual_inversion_manager commit 1efc6397fc6e61c1aff4b0258b93089d61de5955 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:04:28 2022 +0100 cleanup and add performance notes commit e400f804ac471a0ca2ba432fd658778b20c7bdab Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:45:07 2022 +0100 fix bug and update unit tests commit deb9ae0ae1016750e93ce8275734061f7285a231 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:28:29 2022 +0100 textual inversion manager seems to work commit 162e02505dec777e91a983c4d0fb52e950d25ff0 Merge: cbad4583 12769b3d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:58:03 2022 +0100 Merge branch 'main' into feature_textual_inversion_mgr commit cbad45836c6aace6871a90f2621a953f49433131 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:54:10 2022 +0100 use position embeddings commit 070344c69b0e0db340a183857d0a787b348681d3 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:53:47 2022 +0100 Don't crash CLI on exceptions commit b035ac8c6772dfd9ba41b8eeb9103181cda028f8 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:11:55 2022 +0100 add missing position_embeddings commit 12769b3d3562ef71e0f54946b532ad077e10043c Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:33:25 2022 +0100 debugging why it don't work commit bafb7215eabe1515ca5e8388fd3bb2f3ac5362cf Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:21:33 2022 +0100 debugging why it don't work commit 664a6e9e146b42d96703f0cc8baf8f5efec04ee1 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit 8b4f0fe9d6e4e2643b36dfa27864294785d7ba4e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit ffbe1ab11163ba712e353d89404e301d0e0c6cdf Merge: 6e4dad60 023df37e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:37:31 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers commit 023df37efffa67434f77def7fc3c9dfb29f699fd Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:36:54 2022 +0100 cleanup commit 05fac594eaf79d0058e3c48deee93df603f136c2 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:07:49 2022 +0100 tweak error checking commit 009f32ed39a7280997c3ffab112adadee0b44279 Author: damian <null@damianstewart.com> Date: Thu Dec 15 21:29:47 2022 +0100 unit tests passing for embeddings with vector length >1 commit beb1b08d9a98112ed2fe073580568e1a18698da3 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:39:09 2022 +0100 more explicit equality tests when overwriting commit 44d8a5a7c85cdabc9ce3a54fd0769a10597b3ca9 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:30:13 2022 +0100 wip textual inversion manager (unit tests passing for 1v embedding overwriting) commit 417c2b57d90924a839616bfb66804faab8039e4c Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 12:30:55 2022 +0100 wip textual inversion manager (unit tests passing for base stuff + padding) commit 2e80872e3b6f7fd7d8eb8928822bd824b63cb2ff Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 10:57:57 2022 +0100 wip new TextualInversionManager * stop using WeightedFrozenCLIPEmbedder * store diffusion models locally - configure_invokeai.py reconfigured to store diffusion models rather than CompVis models - hugging face caching model is used, but cache is set to ~/invokeai/models/repo_id - models.yaml does **NOT** use path, just repo_id - "repo_name" changed to "repo_id" to following hugging face conventions - Models are loaded with full precision pending further work. * allow non-local files during development * path takes priority over repo_id * MVP for model_cache and configure_invokeai - Feature complete (almost) - configure_invokeai.py downloads both .ckpt and diffuser models, along with their VAEs. Both types of download are controlled by a unified INITIAL_MODELS.yaml file. - model_cache can load both type of model and switches back and forth in CPU. No memory leaks detected TO DO: 1. I have not yet turned on the LocalOnly flag for diffuser models, so the code will check the Hugging Face repo for updates before using the locally cached models. This will break firewalled systems. I am thinking of putting in a global check for internet connectivity at startup time and setting the LocalOnly flag based on this. It would be good to check updates if there is connectivity. 2. I have not gone completely through INITIAL_MODELS.yaml to check which models are available as diffusers and which are not. So models like PaperCut and VoxelArt may not load properly. The runway and stability models are checked, as well as the Trinart models. 3. Add stanzas for SD 2.0 and 2.1 in INITIAL_MODELS.yaml REMAINING PROBLEMS NOT DIRECTLY RELATED TO MODEL_CACHE: 1. When loading a .ckpt file there are lots of messages like this: Warning! ldm.modules.attention.CrossAttention is no longer being maintained. Please use InvokeAICrossAttention instead. I'm not sure how to address this. 2. The ckpt models ***don't actually run*** due to the lack of special-case support for them in the generator objects. For example, here's the hard crash you get when you run txt2img against the legacy waifu-diffusion-1.3 model: ``` >> An error occurred: Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 140, in main main_loop(gen, opt) File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 371, in main_loop gen.prompt2image( File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1265, in __getattr__ raise AttributeError("'{}' object has no attribute '{}'".format( AttributeError: 'LatentDiffusion' object has no attribute 'image_from_embeddings' ``` 3. The inpainting diffusion model isn't working. Here's the output of "banana sushi" when inpainting-1.5 is loaded: ``` Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 301, in image_from_embeddings result_latents, result_attention_map_saver = self.latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 330, in latents_from_embeddings result: PipelineIntermediateState = infer_latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 185, in __call__ for result in self.generator_method(*args, **kwargs): File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 367, in generate_latents_from_embeddings step_output = self.step(batched_t, latents, guidance_scale, File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context return func(*args, **kwargs) File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 409, in step step_output = self.scheduler.step(noise_pred, timestep, latents, **extra_step_kwargs) File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/diffusers/schedulers/scheduling_lms_discrete.py", line 223, in step pred_original_sample = sample - sigma * model_output RuntimeError: The size of tensor a (9) must match the size of tensor b (4) at non-singleton dimension 1 ``` * proper support for float32/float16 - configure script now correctly detects user's preference for fp16/32 and downloads the correct diffuser version. If fp16 version not available, falls back to fp32 version. - misc code cleanup and simplification in model_cache * add on-the-fly conversion of .ckpt to diffusers models 1. On-the-fly conversion code can be found in the file ldm/invoke/ckpt_to_diffusers.py. 2. A new !optimize command has been added to the CLI. Should be ported to Web GUI. User experience on the CLI is this: ``` invoke> !optimize /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt INFO: Converting legacy weights file /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt to optimized diffuser model. This operation will take 30-60s to complete. Success. Optimized model is now located at /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 Writing new config file entry for sd-v1-4... >> New configuration: sd-v1-4: description: Optimized version of sd-v1-4 format: diffusers path: /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 OK to import [n]? y >> Verifying that new model loads... >> Current VRAM usage: 2.60G >> Offloading stable-diffusion-2.1 to CPU >> Loading diffusers model from /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 | Using faster float16 precision You have disabled the safety checker for <class 'ldm.invoke.generator.diffusers_pipeline.StableDiffusionGeneratorPipeline'> by passing `safety_checker=None`. Ensure that you abide to the conditions of the Stable Diffusion \ license and do not expose unfiltered results in services or applications open to the public. Both the diffusers team and Hugging Face strongly recommend to keep the safety filter enabled in all public facing circumstances,\ disabling it only for use-cases that involve analyzing network behavior or auditing its results. For more information, please have a look at https://github.com/huggingface/diffusers/pull/254 . | training width x height = (512 x 512) >> Model loaded in 3.48s >> Max VRAM used to load the model: 2.17G >> Current VRAM usage:2.17G >> Textual inversions available: >> Setting Sampler to k_lms (LMSDiscreteScheduler) Keep model loaded? [y] ``` * add parallel set of generator files for ckpt legacy generation * generation using legacy ckpt models now working * diffusers: fix missing attention_maps_callback fix for 23eb80b40421b2bb8f4b6d3dd30490d11c447b36 * associate legacy CrossAttention with .ckpt models * enable autoconvert New --autoconvert CLI option will scan a designated directory for new .ckpt files, convert them into diffuser models, and import them into models.yaml. Works like this: invoke.py --autoconvert /path/to/weights/directory In ModelCache added two new methods: autoconvert_weights(config_path, weights_directory_path, models_directory_path) convert_and_import(ckpt_path, diffuser_path) * diffusers: update to diffusers 0.11 (from 0.10.2) * fix vae loading & width/height calculation * refactor: encapsulate these conditioning data into one container * diffusers: fix some noise-scaling issues by pushing the noise-mixing down to the common function * add support for safetensors and accelerate * set local_files_only when internet unreachable * diffusers: fix error-handling path when model repo has no fp16 branch * fix generatorinpaint error Fixes : "ModuleNotFoundError: No module named 'ldm.invoke.generatorinpaint' https://github.com/invoke-ai/InvokeAI/pull/1583#issuecomment-1363634318 * quench diffuser safety-checker warning * diffusers: support stochastic DDIM eta parameter * fix conda env creation on macos * fix cross-attention with diffusers 0.11 * diffusers: the VAE needs to be tiling as well as the U-Net * diffusers: comment on subfolders * diffusers: embiggen! * diffusers: make model_cache.list_models serializable * diffusers(inpaint): restore scaling functionality * fix requirements clash between numba and numpy 1.24 * diffusers: allow inpainting model to do non-inpainting tasks * start expanding model_cache functionality * add import_ckpt_model() and import_diffuser_model() methods to model_manager - in addition, model_cache.py is now renamed to model_manager.py * allow "recommended" flag to be optional in INITIAL_MODELS.yaml * configure_invokeai now downloads VAE diffusers in advance * rename ModelCache to ModelManager * remove support for `repo_name` in models.yaml * check for and refuse to load embeddings trained on incompatible models * models.yaml.example: s/repo_name/repo_id and remove extra INITIAL_MODELS now that the main one has diffusers models in it. * add MVP textual inversion script * refactor(InvokeAIDiffuserComponent): factor out _combine() * InvokeAIDiffuserComponent: implement threshold * InvokeAIDiffuserComponent: diagnostic logs for threshold ...this does not look right * add a curses-based frontend to textual inversion - not quite working yet - requires npyscreen installed - on windows will also have the windows-curses requirement, but not added to requirements yet * add curses-based interface for textual inversion * fix crash in convert_and_import() - This corrects a "local variable referenced before assignment" error in model_manager.convert_and_import() * potential workaround for no 'state_dict' key error - As reported in https://github.com/huggingface/diffusers/issues/1876 * create TI output dir if needed * Update environment-lin-cuda.yml (#2159) Fixing line 42 to be the proper order to define the transformers requirement: ~= instead of =~ * diffusers: update sampler-to-scheduler mapping based on https://github.com/huggingface/diffusers/issues/277#issuecomment-1371428672 * improve user exp for ckt to diffusers conversion - !optimize_models command now operates on an existing ckpt file entry in models.yaml - replaces existing entry, rather than adding a new one - offers to delete the ckpt file after conversion * web: adapt progress callback to deal with old generator or new diffusers pipeline * clean-up model_manager code - add_model() verified to work for .ckpt local paths, .ckpt remote URLs, diffusers local paths, and diffusers repo_ids - convert_and_import() verified to work for local and remove .ckpt files * handle edge cases for import_model() and convert_model() * add support for safetensor .ckpt files * fix name error * code cleanup with pyflake * improve model setting behavior - If the user enters an invalid model name at startup time, will not try to load it, warn, and use default model - CLI UI enhancement: include currently active model in the command line prompt. * update test-invoke-pip.yml - fix model cache path to point to runwayml/stable-diffusion-v1-5 - remove `skip-sd-weights` from configure_invokeai.py args * exclude dev/diffusers from "fail for draft PRs" * disable "fail on PR jobs" * re-add `--skip-sd-weights` since no space * update workflow environments - include `INVOKE_MODEL_RECONFIGURE: '--yes'` * clean up model load failure handling - Allow CLI to run even when no model is defined or loadable. - Inhibit stack trace when model load fails - only show last error - Give user *option* to run configure_invokeai.py when no models successfully load. - Restart invokeai after reconfiguration. * further edge-case handling 1) only one model in models.yaml file, and that model is broken 2) no models in models.yaml 3) models.yaml doesn't exist at all * fix incorrect model status listing - "cached" was not being returned from list_models() - normalize handling of exceptions during model loading: - Passing an invalid model name to generate.set_model() will return a KeyError - All other exceptions are returned as the appropriate Exception * CI: do download weights (if not already cached) * diffusers: fix scheduler loading in offline mode * CI: fix model name (no longer has `diffusers-` prefix) * Update txt2img2img.py (#2256) * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * feat - make model storage compatible with hugging face caching system This commit alters the InvokeAI model directory to be compatible with hugging face, making it easier to share diffusers (and other models) across different programs. - If the HF_HOME environment variable is not set, then models are cached in ~/invokeai/models in a format that is identical to the HuggingFace cache. - If HF_HOME is set, then models are cached wherever HF_HOME points. - To enable sharing with other HuggingFace library clients, set HF_HOME to ~/.cache/huggingface to set the default cache location or to ~/invokeai/models to have huggingface cache inside InvokeAI. * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * fix error "no attribute CkptInpaint" * model_manager.list_models() returns entire model config stanza+status * Initial Draft - Model Manager Diffusers * added hash function to diffusers * implement sha256 hashes on diffusers models * Add Model Manager Support for Diffusers * fix various problems with model manager - in cli import functions, fix not enough values to unpack from _get_name_and_desc() - fix crash when using old-style vae: value with new-style diffuser * rebuild frontend * fix dictconfig-not-serializable issue * fix NoneType' object is not subscriptable crash in model_manager * fix "str has no attribute get" error in model_manager list_models() * Add path and repo_id support for Diffusers Model Manager Also fixes bugs * Fix tooltip IT localization not working * Add Version Number To WebUI * Optimize Model Search * Fix incorrect font on the Model Manager UI * Fix image degradation on merge fixes - [Experimental] This change should effectively fix a couple of things. - Fix image degradation on subsequent merges of the canvas layers. - Fix the slight transparent border that is left behind when filling the bounding box with a color. - Fix the left over line of color when filling a bounding box with color. So far there are no side effects for this. If any, please report. * Add local model filtering for Diffusers / Checkpoints * Go to home on modal close for the Add Modal UI * Styling Fixes * Model Manager Diffusers Localization Update * Add Safe Tensor scanning to Model Manager * Fix model edit form dispatching string values instead of numbers. * Resolve VAE handling / edge cases for supplied repos * defer injecting tokens for textual inversions until they're used for the first time * squash a console warning * implement model migration check * add_model() overwrites previous config rather than merges * fix model config file attribute merging * fix precision handling in textual inversion script * allow ckpt conversion script to work with safetensors .ckpts Applied patch here: https://github.com/huggingface/diffusers/commit/beb932c5d111872c5e45387e7b1b2b3dd0524a47 * fix name "args" is not defined crash in textual_inversion_training * fix a second NameError: name 'args' is not defined crash * fix loading of the safety checker from the global cache dir * add installation step to textual inversion frontend - After a successful training run, the script will copy learned_embeds.bin to a subfolder of the embeddings directory. - User given the option to delete the logs and intermediate checkpoints (which together use 7-8G of space) - If textual inversion training fails, reports the error gracefully. * don't crash out on incompatible embeddings - put try: blocks around places where the system tries to load an embedding which is incompatible with the currently loaded model * add support for checkpoint resuming * textual inversion preferences are saved and restored between sessions - Preferences are stored in a file named text-inversion-training/preferences.conf - Currently the resume-from-checkpoint option is not working correctly. Possible bug in textual_inversion_training.py? * copy learned_embeddings.bin into right location * add front end for diffusers model merging - Front end doesn't do anything yet!!!! - Made change to model name parsing in CLI to support ability to have merged models with the "+" character in their names. * improve inpainting experience - recommend ckpt version of inpainting-1.5 to user - fix get_noise() bug in ckpt version of omnibus.py * update environment*yml * tweak instructions to install HuggingFace token * bump version number * enhance update scripts - update scripts will now fetch new INITIAL_MODELS.yaml so that configure_invokeai.py will know about the diffusers versions. * enhance invoke.sh/invoke.bat launchers - added configure_invokeai.py to menu - menu defaults to browser-based invoke * remove conda workflow (#2321) * fix `token_ids has shape torch.Size([79]) - expected [77]` * update CHANGELOG.md with 2.3.* info - Add information on how formats have changed and the upgrade process. - Add short bug list. Co-authored-by: Damian Stewart <d@damianstewart.com> Co-authored-by: Damian Stewart <null@damianstewart.com> Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> Co-authored-by: Wybartel-luxmc <37852506+Wybartel-luxmc@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> Co-authored-by: mickr777 <115216705+mickr777@users.noreply.github.com> Co-authored-by: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Co-authored-by: Eugene Brodsky <ebr@users.noreply.github.com> Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com>
2023-01-15 14:22:46 +00:00
return self._load_generator('','Generator')
def _make_txt2img(self):
return self._load_generator('.txt2img','Txt2Img')
Refactoring simplet2i (#387) * start refactoring -not yet functional * first phase of refactor done - not sure weighted prompts working * Second phase of refactoring. Everything mostly working. * The refactoring has moved all the hard-core inference work into ldm.dream.generator.*, where there are submodules for txt2img and img2img. inpaint will go in there as well. * Some additional refactoring will be done soon, but relatively minor work. * fix -save_orig flag to actually work * add @neonsecret attention.py memory optimization * remove unneeded imports * move token logging into conditioning.py * add placeholder version of inpaint; porting in progress * fix crash in img2img * inpainting working; not tested on variations * fix crashes in img2img * ported attention.py memory optimization #117 from basujindal branch * added @torch_no_grad() decorators to img2img, txt2img, inpaint closures * Final commit prior to PR against development * fixup crash when generating intermediate images in web UI * rename ldm.simplet2i to ldm.generate * add backward-compatibility simplet2i shell with deprecation warning * add back in mps exception, addresses @vargol comment in #354 * replaced Conditioning class with exported functions * fix wrong type of with_variations attribute during intialization * changed "image_iterator()" to "get_make_image()" * raise NotImplementedError for calling get_make_image() in parent class * Update ldm/generate.py better error message Co-authored-by: Kevin Gibbons <bakkot@gmail.com> * minor stylistic fixes and assertion checks from code review * moved get_noise() method into img2img class * break get_noise() into two methods, one for txt2img and the other for img2img * inpainting works on non-square images now * make get_noise() an abstract method in base class * much improved inpainting Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
2022-09-06 00:40:10 +00:00
def _make_img2img(self):
use 🧨diffusers model (#1583) * initial commit of DiffusionPipeline class * spike: proof of concept using diffusers for txt2img * doc: type hints for Generator * refactor(model_cache): factor out load_ckpt * model_cache: add ability to load a diffusers model pipeline and update associated things in Generate & Generator to not instantly fail when that happens * model_cache: fix model default image dimensions * txt2img: support switching diffusers schedulers * diffusers: let the scheduler do its scaling of the initial latents Remove IPNDM scheduler; it is not behaving. * web server: update image_progress callback for diffusers data * diffusers: restore prompt weighting feature * diffusers: fix set-sampler error following model switch * diffusers: use InvokeAIDiffuserComponent for conditioning * cross_attention_control: stub (no-op) implementations for diffusers * model_cache: let offload_model work with DiffusionPipeline, sorta. * models.yaml.example: add diffusers-format model, set as default * test-invoke-conda: use diffusers-format model test-invoke-conda: put huggingface-token where the library can use it * environment-mac: upgrade to diffusers 0.7 (from 0.6) this was already done for linux; mac must have been lost in the merge. * preload_models: explicitly load diffusers models In non-interactive mode too, as long as you're logged in. * fix(model_cache): don't check `model.config` in diffusers format clean-up from recent merge. * diffusers integration: support img2img * dev: upgrade to diffusers 0.8 (from 0.7.1) We get to remove some code by using methods that were factored out in the base class. * refactor: remove backported img2img.get_timesteps now that we can use it directly from diffusers 0.8.1 * ci: use diffusers model * dev: upgrade to diffusers 0.9 (from 0.8.1) * lint: correct annotations for Python 3.9. * lint: correct AttributeError.name reference for Python 3.9. * CI: prefer diffusers-1.4 because it no longer requires a token The RunwayML models still do. * build: there's yet another place to update requirements? * configure: try to download models even without token Models in the CompVis and stabilityai repos no longer require them. (But runwayml still does.) * configure: add troubleshooting info for config-not-found * fix(configure): prepend root to config path * fix(configure): remove second `default: true` from models example * CI: simplify test-on-push logic now that we don't need secrets The "test on push but only in forks" logic was only necessary when tests didn't work for PRs-from-forks. * create an embedding_manager for diffusers * internal: avoid importing diffusers DummyObject see https://github.com/huggingface/diffusers/issues/1479 * fix "config attributes…not expected" diffusers warnings. * fix deprecated scheduler construction * work around an apparent MPS torch bug that causes conditioning to have no effect * 🚧 post-rebase repair * preliminary support for outpainting (no masking yet) * monkey-patch diffusers.attention and use Invoke lowvram code * add always_use_cpu arg to bypass MPS * add cross-attention control support to diffusers (fails on MPS) For unknown reasons MPS produces garbage output with .swap(). Use --always_use_cpu arg to invoke.py for now to test this code on MPS. * diffusers support for the inpainting model * fix debug_image to not crash with non-RGB images. * inpainting for the normal model [WIP] This seems to be performing well until the LAST STEP, at which point it dissolves to confetti. * fix off-by-one bug in cross-attention-control (#1774) prompt token sequences begin with a "beginning-of-sequence" marker <bos> and end with a repeated "end-of-sequence" marker <eos> - to make a default prompt length of <bos> + 75 prompt tokens + <eos>. the .swap() code was failing to take the column for <bos> at index 0 into account. the changes here do that, and also add extra handling for a single <eos> (which may be redundant but which is included for completeness). based on my understanding and some assumptions about how this all works, the reason .swap() nevertheless seemed to do the right thing, to some extent, is because over multiple steps the conditioning process in Stable Diffusion operates as a feedback loop. a change to token n-1 has flow-on effects to how the [1x4x64x64] latent tensor is modified by all the tokens after it, - and as the next step is processed, all the tokens before it as well. intuitively, a token's conditioning effects "echo" throughout the whole length of the prompt. so even though the token at n-1 was being edited when what the user actually wanted was to edit the token at n, it nevertheless still had some non-negligible effect, in roughly the right direction, often enough that it seemed like it was working properly. * refactor common CrossAttention stuff into a mixin so that the old ldm code can still work if necessary * inpainting for the normal model. I think it works this time. * diffusers: reset num_vectors_per_token sync with 44a00555718f1df173c60da0ed646cf700e29537 * diffusers: txt2img2img (hires_fix) with so much slicing and dicing of pipeline methods to stitch them together * refactor(diffusers): reduce some code duplication amongst the different tasks * fixup! refactor(diffusers): reduce some code duplication amongst the different tasks * diffusers: enable DPMSolver++ scheduler * diffusers: upgrade to diffusers 0.10, add Heun scheduler * diffusers(ModelCache): stopgap to make from_cpu compatible with diffusers * CI: default to diffusers-1.5 now that runwayml token requirement is gone * diffusers: update to 0.10 (and transformers to 4.25) * diffusers: use xformers when available diffusers no longer auto-enables this as of 0.10.2. * diffusers: make masked img2img behave better with multi-step schedulers re-randomizing the noise each step was confusing them. * diffusers: work more better with more models. fixed relative path problem with local models. fixed models on hub not always having a `fp16` branch. * diffusers: stopgap fix for attention_maps_callback crash after recent merge * fixup import merge conflicts correction for 061c5369a2247c6c92cd69606bcf54c4f1962a0b * test: add tests/inpainting inputs for masked img2img * diffusers(AddsMaskedGuidance): partial fix for k-schedulers Prevents them from crashing, but results are still hot garbage. * fix --safety_checker arg parsing and add note to diffusers loader about where safety checker gets called * generate: fix import error * CI: don't try to read the old init location * diffusers: support loading an alternate VAE * CI: remove sh-syntax if-statement so it doesn't crash powershell * CI: fold strings in yaml because backslash is not line-continuation in powershell * attention maps callback stuff for diffusers * build: fix syntax error in environment-mac * diffusers: add INITIAL_MODELS with diffusers-compatible repos * re-enable the embedding manager; closes #1778 * Squashed commit of the following: commit e4a956abc37fcb5cf188388b76b617bc5c8fda7d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:43:07 2022 +0100 import new load handling from EmbeddingManager and cleanup commit c4abe91a5ba0d415b45bf734068385668b7a66e6 Merge: 032e856e 1efc6397 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:09:53 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers_with_textual_inversion_manager commit 032e856eefb3bbc39534f5daafd25764bcfcef8b Merge: 8b4f0fe9 bc515e24 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:08:01 2022 +0100 Merge remote-tracking branch 'upstream/dev/diffusers' into dev/diffusers_with_textual_inversion_manager commit 1efc6397fc6e61c1aff4b0258b93089d61de5955 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:04:28 2022 +0100 cleanup and add performance notes commit e400f804ac471a0ca2ba432fd658778b20c7bdab Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:45:07 2022 +0100 fix bug and update unit tests commit deb9ae0ae1016750e93ce8275734061f7285a231 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:28:29 2022 +0100 textual inversion manager seems to work commit 162e02505dec777e91a983c4d0fb52e950d25ff0 Merge: cbad4583 12769b3d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:58:03 2022 +0100 Merge branch 'main' into feature_textual_inversion_mgr commit cbad45836c6aace6871a90f2621a953f49433131 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:54:10 2022 +0100 use position embeddings commit 070344c69b0e0db340a183857d0a787b348681d3 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:53:47 2022 +0100 Don't crash CLI on exceptions commit b035ac8c6772dfd9ba41b8eeb9103181cda028f8 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:11:55 2022 +0100 add missing position_embeddings commit 12769b3d3562ef71e0f54946b532ad077e10043c Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:33:25 2022 +0100 debugging why it don't work commit bafb7215eabe1515ca5e8388fd3bb2f3ac5362cf Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:21:33 2022 +0100 debugging why it don't work commit 664a6e9e146b42d96703f0cc8baf8f5efec04ee1 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit 8b4f0fe9d6e4e2643b36dfa27864294785d7ba4e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit ffbe1ab11163ba712e353d89404e301d0e0c6cdf Merge: 6e4dad60 023df37e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:37:31 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers commit 023df37efffa67434f77def7fc3c9dfb29f699fd Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:36:54 2022 +0100 cleanup commit 05fac594eaf79d0058e3c48deee93df603f136c2 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:07:49 2022 +0100 tweak error checking commit 009f32ed39a7280997c3ffab112adadee0b44279 Author: damian <null@damianstewart.com> Date: Thu Dec 15 21:29:47 2022 +0100 unit tests passing for embeddings with vector length >1 commit beb1b08d9a98112ed2fe073580568e1a18698da3 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:39:09 2022 +0100 more explicit equality tests when overwriting commit 44d8a5a7c85cdabc9ce3a54fd0769a10597b3ca9 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:30:13 2022 +0100 wip textual inversion manager (unit tests passing for 1v embedding overwriting) commit 417c2b57d90924a839616bfb66804faab8039e4c Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 12:30:55 2022 +0100 wip textual inversion manager (unit tests passing for base stuff + padding) commit 2e80872e3b6f7fd7d8eb8928822bd824b63cb2ff Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 10:57:57 2022 +0100 wip new TextualInversionManager * stop using WeightedFrozenCLIPEmbedder * store diffusion models locally - configure_invokeai.py reconfigured to store diffusion models rather than CompVis models - hugging face caching model is used, but cache is set to ~/invokeai/models/repo_id - models.yaml does **NOT** use path, just repo_id - "repo_name" changed to "repo_id" to following hugging face conventions - Models are loaded with full precision pending further work. * allow non-local files during development * path takes priority over repo_id * MVP for model_cache and configure_invokeai - Feature complete (almost) - configure_invokeai.py downloads both .ckpt and diffuser models, along with their VAEs. Both types of download are controlled by a unified INITIAL_MODELS.yaml file. - model_cache can load both type of model and switches back and forth in CPU. No memory leaks detected TO DO: 1. I have not yet turned on the LocalOnly flag for diffuser models, so the code will check the Hugging Face repo for updates before using the locally cached models. This will break firewalled systems. I am thinking of putting in a global check for internet connectivity at startup time and setting the LocalOnly flag based on this. It would be good to check updates if there is connectivity. 2. I have not gone completely through INITIAL_MODELS.yaml to check which models are available as diffusers and which are not. So models like PaperCut and VoxelArt may not load properly. The runway and stability models are checked, as well as the Trinart models. 3. Add stanzas for SD 2.0 and 2.1 in INITIAL_MODELS.yaml REMAINING PROBLEMS NOT DIRECTLY RELATED TO MODEL_CACHE: 1. When loading a .ckpt file there are lots of messages like this: Warning! ldm.modules.attention.CrossAttention is no longer being maintained. Please use InvokeAICrossAttention instead. I'm not sure how to address this. 2. The ckpt models ***don't actually run*** due to the lack of special-case support for them in the generator objects. For example, here's the hard crash you get when you run txt2img against the legacy waifu-diffusion-1.3 model: ``` >> An error occurred: Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 140, in main main_loop(gen, opt) File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 371, in main_loop gen.prompt2image( File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1265, in __getattr__ raise AttributeError("'{}' object has no attribute '{}'".format( AttributeError: 'LatentDiffusion' object has no attribute 'image_from_embeddings' ``` 3. The inpainting diffusion model isn't working. Here's the output of "banana sushi" when inpainting-1.5 is loaded: ``` Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 301, in image_from_embeddings result_latents, result_attention_map_saver = self.latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 330, in latents_from_embeddings result: PipelineIntermediateState = infer_latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 185, in __call__ for result in self.generator_method(*args, **kwargs): File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 367, in generate_latents_from_embeddings step_output = self.step(batched_t, latents, guidance_scale, File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context return func(*args, **kwargs) File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 409, in step step_output = self.scheduler.step(noise_pred, timestep, latents, **extra_step_kwargs) File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/diffusers/schedulers/scheduling_lms_discrete.py", line 223, in step pred_original_sample = sample - sigma * model_output RuntimeError: The size of tensor a (9) must match the size of tensor b (4) at non-singleton dimension 1 ``` * proper support for float32/float16 - configure script now correctly detects user's preference for fp16/32 and downloads the correct diffuser version. If fp16 version not available, falls back to fp32 version. - misc code cleanup and simplification in model_cache * add on-the-fly conversion of .ckpt to diffusers models 1. On-the-fly conversion code can be found in the file ldm/invoke/ckpt_to_diffusers.py. 2. A new !optimize command has been added to the CLI. Should be ported to Web GUI. User experience on the CLI is this: ``` invoke> !optimize /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt INFO: Converting legacy weights file /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt to optimized diffuser model. This operation will take 30-60s to complete. Success. Optimized model is now located at /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 Writing new config file entry for sd-v1-4... >> New configuration: sd-v1-4: description: Optimized version of sd-v1-4 format: diffusers path: /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 OK to import [n]? y >> Verifying that new model loads... >> Current VRAM usage: 2.60G >> Offloading stable-diffusion-2.1 to CPU >> Loading diffusers model from /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 | Using faster float16 precision You have disabled the safety checker for <class 'ldm.invoke.generator.diffusers_pipeline.StableDiffusionGeneratorPipeline'> by passing `safety_checker=None`. Ensure that you abide to the conditions of the Stable Diffusion \ license and do not expose unfiltered results in services or applications open to the public. Both the diffusers team and Hugging Face strongly recommend to keep the safety filter enabled in all public facing circumstances,\ disabling it only for use-cases that involve analyzing network behavior or auditing its results. For more information, please have a look at https://github.com/huggingface/diffusers/pull/254 . | training width x height = (512 x 512) >> Model loaded in 3.48s >> Max VRAM used to load the model: 2.17G >> Current VRAM usage:2.17G >> Textual inversions available: >> Setting Sampler to k_lms (LMSDiscreteScheduler) Keep model loaded? [y] ``` * add parallel set of generator files for ckpt legacy generation * generation using legacy ckpt models now working * diffusers: fix missing attention_maps_callback fix for 23eb80b40421b2bb8f4b6d3dd30490d11c447b36 * associate legacy CrossAttention with .ckpt models * enable autoconvert New --autoconvert CLI option will scan a designated directory for new .ckpt files, convert them into diffuser models, and import them into models.yaml. Works like this: invoke.py --autoconvert /path/to/weights/directory In ModelCache added two new methods: autoconvert_weights(config_path, weights_directory_path, models_directory_path) convert_and_import(ckpt_path, diffuser_path) * diffusers: update to diffusers 0.11 (from 0.10.2) * fix vae loading & width/height calculation * refactor: encapsulate these conditioning data into one container * diffusers: fix some noise-scaling issues by pushing the noise-mixing down to the common function * add support for safetensors and accelerate * set local_files_only when internet unreachable * diffusers: fix error-handling path when model repo has no fp16 branch * fix generatorinpaint error Fixes : "ModuleNotFoundError: No module named 'ldm.invoke.generatorinpaint' https://github.com/invoke-ai/InvokeAI/pull/1583#issuecomment-1363634318 * quench diffuser safety-checker warning * diffusers: support stochastic DDIM eta parameter * fix conda env creation on macos * fix cross-attention with diffusers 0.11 * diffusers: the VAE needs to be tiling as well as the U-Net * diffusers: comment on subfolders * diffusers: embiggen! * diffusers: make model_cache.list_models serializable * diffusers(inpaint): restore scaling functionality * fix requirements clash between numba and numpy 1.24 * diffusers: allow inpainting model to do non-inpainting tasks * start expanding model_cache functionality * add import_ckpt_model() and import_diffuser_model() methods to model_manager - in addition, model_cache.py is now renamed to model_manager.py * allow "recommended" flag to be optional in INITIAL_MODELS.yaml * configure_invokeai now downloads VAE diffusers in advance * rename ModelCache to ModelManager * remove support for `repo_name` in models.yaml * check for and refuse to load embeddings trained on incompatible models * models.yaml.example: s/repo_name/repo_id and remove extra INITIAL_MODELS now that the main one has diffusers models in it. * add MVP textual inversion script * refactor(InvokeAIDiffuserComponent): factor out _combine() * InvokeAIDiffuserComponent: implement threshold * InvokeAIDiffuserComponent: diagnostic logs for threshold ...this does not look right * add a curses-based frontend to textual inversion - not quite working yet - requires npyscreen installed - on windows will also have the windows-curses requirement, but not added to requirements yet * add curses-based interface for textual inversion * fix crash in convert_and_import() - This corrects a "local variable referenced before assignment" error in model_manager.convert_and_import() * potential workaround for no 'state_dict' key error - As reported in https://github.com/huggingface/diffusers/issues/1876 * create TI output dir if needed * Update environment-lin-cuda.yml (#2159) Fixing line 42 to be the proper order to define the transformers requirement: ~= instead of =~ * diffusers: update sampler-to-scheduler mapping based on https://github.com/huggingface/diffusers/issues/277#issuecomment-1371428672 * improve user exp for ckt to diffusers conversion - !optimize_models command now operates on an existing ckpt file entry in models.yaml - replaces existing entry, rather than adding a new one - offers to delete the ckpt file after conversion * web: adapt progress callback to deal with old generator or new diffusers pipeline * clean-up model_manager code - add_model() verified to work for .ckpt local paths, .ckpt remote URLs, diffusers local paths, and diffusers repo_ids - convert_and_import() verified to work for local and remove .ckpt files * handle edge cases for import_model() and convert_model() * add support for safetensor .ckpt files * fix name error * code cleanup with pyflake * improve model setting behavior - If the user enters an invalid model name at startup time, will not try to load it, warn, and use default model - CLI UI enhancement: include currently active model in the command line prompt. * update test-invoke-pip.yml - fix model cache path to point to runwayml/stable-diffusion-v1-5 - remove `skip-sd-weights` from configure_invokeai.py args * exclude dev/diffusers from "fail for draft PRs" * disable "fail on PR jobs" * re-add `--skip-sd-weights` since no space * update workflow environments - include `INVOKE_MODEL_RECONFIGURE: '--yes'` * clean up model load failure handling - Allow CLI to run even when no model is defined or loadable. - Inhibit stack trace when model load fails - only show last error - Give user *option* to run configure_invokeai.py when no models successfully load. - Restart invokeai after reconfiguration. * further edge-case handling 1) only one model in models.yaml file, and that model is broken 2) no models in models.yaml 3) models.yaml doesn't exist at all * fix incorrect model status listing - "cached" was not being returned from list_models() - normalize handling of exceptions during model loading: - Passing an invalid model name to generate.set_model() will return a KeyError - All other exceptions are returned as the appropriate Exception * CI: do download weights (if not already cached) * diffusers: fix scheduler loading in offline mode * CI: fix model name (no longer has `diffusers-` prefix) * Update txt2img2img.py (#2256) * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * feat - make model storage compatible with hugging face caching system This commit alters the InvokeAI model directory to be compatible with hugging face, making it easier to share diffusers (and other models) across different programs. - If the HF_HOME environment variable is not set, then models are cached in ~/invokeai/models in a format that is identical to the HuggingFace cache. - If HF_HOME is set, then models are cached wherever HF_HOME points. - To enable sharing with other HuggingFace library clients, set HF_HOME to ~/.cache/huggingface to set the default cache location or to ~/invokeai/models to have huggingface cache inside InvokeAI. * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * fix error "no attribute CkptInpaint" * model_manager.list_models() returns entire model config stanza+status * Initial Draft - Model Manager Diffusers * added hash function to diffusers * implement sha256 hashes on diffusers models * Add Model Manager Support for Diffusers * fix various problems with model manager - in cli import functions, fix not enough values to unpack from _get_name_and_desc() - fix crash when using old-style vae: value with new-style diffuser * rebuild frontend * fix dictconfig-not-serializable issue * fix NoneType' object is not subscriptable crash in model_manager * fix "str has no attribute get" error in model_manager list_models() * Add path and repo_id support for Diffusers Model Manager Also fixes bugs * Fix tooltip IT localization not working * Add Version Number To WebUI * Optimize Model Search * Fix incorrect font on the Model Manager UI * Fix image degradation on merge fixes - [Experimental] This change should effectively fix a couple of things. - Fix image degradation on subsequent merges of the canvas layers. - Fix the slight transparent border that is left behind when filling the bounding box with a color. - Fix the left over line of color when filling a bounding box with color. So far there are no side effects for this. If any, please report. * Add local model filtering for Diffusers / Checkpoints * Go to home on modal close for the Add Modal UI * Styling Fixes * Model Manager Diffusers Localization Update * Add Safe Tensor scanning to Model Manager * Fix model edit form dispatching string values instead of numbers. * Resolve VAE handling / edge cases for supplied repos * defer injecting tokens for textual inversions until they're used for the first time * squash a console warning * implement model migration check * add_model() overwrites previous config rather than merges * fix model config file attribute merging * fix precision handling in textual inversion script * allow ckpt conversion script to work with safetensors .ckpts Applied patch here: https://github.com/huggingface/diffusers/commit/beb932c5d111872c5e45387e7b1b2b3dd0524a47 * fix name "args" is not defined crash in textual_inversion_training * fix a second NameError: name 'args' is not defined crash * fix loading of the safety checker from the global cache dir * add installation step to textual inversion frontend - After a successful training run, the script will copy learned_embeds.bin to a subfolder of the embeddings directory. - User given the option to delete the logs and intermediate checkpoints (which together use 7-8G of space) - If textual inversion training fails, reports the error gracefully. * don't crash out on incompatible embeddings - put try: blocks around places where the system tries to load an embedding which is incompatible with the currently loaded model * add support for checkpoint resuming * textual inversion preferences are saved and restored between sessions - Preferences are stored in a file named text-inversion-training/preferences.conf - Currently the resume-from-checkpoint option is not working correctly. Possible bug in textual_inversion_training.py? * copy learned_embeddings.bin into right location * add front end for diffusers model merging - Front end doesn't do anything yet!!!! - Made change to model name parsing in CLI to support ability to have merged models with the "+" character in their names. * improve inpainting experience - recommend ckpt version of inpainting-1.5 to user - fix get_noise() bug in ckpt version of omnibus.py * update environment*yml * tweak instructions to install HuggingFace token * bump version number * enhance update scripts - update scripts will now fetch new INITIAL_MODELS.yaml so that configure_invokeai.py will know about the diffusers versions. * enhance invoke.sh/invoke.bat launchers - added configure_invokeai.py to menu - menu defaults to browser-based invoke * remove conda workflow (#2321) * fix `token_ids has shape torch.Size([79]) - expected [77]` * update CHANGELOG.md with 2.3.* info - Add information on how formats have changed and the upgrade process. - Add short bug list. Co-authored-by: Damian Stewart <d@damianstewart.com> Co-authored-by: Damian Stewart <null@damianstewart.com> Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> Co-authored-by: Wybartel-luxmc <37852506+Wybartel-luxmc@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> Co-authored-by: mickr777 <115216705+mickr777@users.noreply.github.com> Co-authored-by: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Co-authored-by: Eugene Brodsky <ebr@users.noreply.github.com> Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com>
2023-01-15 14:22:46 +00:00
return self._load_generator('.img2img','Img2Img')
def _make_embiggen(self):
use 🧨diffusers model (#1583) * initial commit of DiffusionPipeline class * spike: proof of concept using diffusers for txt2img * doc: type hints for Generator * refactor(model_cache): factor out load_ckpt * model_cache: add ability to load a diffusers model pipeline and update associated things in Generate & Generator to not instantly fail when that happens * model_cache: fix model default image dimensions * txt2img: support switching diffusers schedulers * diffusers: let the scheduler do its scaling of the initial latents Remove IPNDM scheduler; it is not behaving. * web server: update image_progress callback for diffusers data * diffusers: restore prompt weighting feature * diffusers: fix set-sampler error following model switch * diffusers: use InvokeAIDiffuserComponent for conditioning * cross_attention_control: stub (no-op) implementations for diffusers * model_cache: let offload_model work with DiffusionPipeline, sorta. * models.yaml.example: add diffusers-format model, set as default * test-invoke-conda: use diffusers-format model test-invoke-conda: put huggingface-token where the library can use it * environment-mac: upgrade to diffusers 0.7 (from 0.6) this was already done for linux; mac must have been lost in the merge. * preload_models: explicitly load diffusers models In non-interactive mode too, as long as you're logged in. * fix(model_cache): don't check `model.config` in diffusers format clean-up from recent merge. * diffusers integration: support img2img * dev: upgrade to diffusers 0.8 (from 0.7.1) We get to remove some code by using methods that were factored out in the base class. * refactor: remove backported img2img.get_timesteps now that we can use it directly from diffusers 0.8.1 * ci: use diffusers model * dev: upgrade to diffusers 0.9 (from 0.8.1) * lint: correct annotations for Python 3.9. * lint: correct AttributeError.name reference for Python 3.9. * CI: prefer diffusers-1.4 because it no longer requires a token The RunwayML models still do. * build: there's yet another place to update requirements? * configure: try to download models even without token Models in the CompVis and stabilityai repos no longer require them. (But runwayml still does.) * configure: add troubleshooting info for config-not-found * fix(configure): prepend root to config path * fix(configure): remove second `default: true` from models example * CI: simplify test-on-push logic now that we don't need secrets The "test on push but only in forks" logic was only necessary when tests didn't work for PRs-from-forks. * create an embedding_manager for diffusers * internal: avoid importing diffusers DummyObject see https://github.com/huggingface/diffusers/issues/1479 * fix "config attributes…not expected" diffusers warnings. * fix deprecated scheduler construction * work around an apparent MPS torch bug that causes conditioning to have no effect * 🚧 post-rebase repair * preliminary support for outpainting (no masking yet) * monkey-patch diffusers.attention and use Invoke lowvram code * add always_use_cpu arg to bypass MPS * add cross-attention control support to diffusers (fails on MPS) For unknown reasons MPS produces garbage output with .swap(). Use --always_use_cpu arg to invoke.py for now to test this code on MPS. * diffusers support for the inpainting model * fix debug_image to not crash with non-RGB images. * inpainting for the normal model [WIP] This seems to be performing well until the LAST STEP, at which point it dissolves to confetti. * fix off-by-one bug in cross-attention-control (#1774) prompt token sequences begin with a "beginning-of-sequence" marker <bos> and end with a repeated "end-of-sequence" marker <eos> - to make a default prompt length of <bos> + 75 prompt tokens + <eos>. the .swap() code was failing to take the column for <bos> at index 0 into account. the changes here do that, and also add extra handling for a single <eos> (which may be redundant but which is included for completeness). based on my understanding and some assumptions about how this all works, the reason .swap() nevertheless seemed to do the right thing, to some extent, is because over multiple steps the conditioning process in Stable Diffusion operates as a feedback loop. a change to token n-1 has flow-on effects to how the [1x4x64x64] latent tensor is modified by all the tokens after it, - and as the next step is processed, all the tokens before it as well. intuitively, a token's conditioning effects "echo" throughout the whole length of the prompt. so even though the token at n-1 was being edited when what the user actually wanted was to edit the token at n, it nevertheless still had some non-negligible effect, in roughly the right direction, often enough that it seemed like it was working properly. * refactor common CrossAttention stuff into a mixin so that the old ldm code can still work if necessary * inpainting for the normal model. I think it works this time. * diffusers: reset num_vectors_per_token sync with 44a00555718f1df173c60da0ed646cf700e29537 * diffusers: txt2img2img (hires_fix) with so much slicing and dicing of pipeline methods to stitch them together * refactor(diffusers): reduce some code duplication amongst the different tasks * fixup! refactor(diffusers): reduce some code duplication amongst the different tasks * diffusers: enable DPMSolver++ scheduler * diffusers: upgrade to diffusers 0.10, add Heun scheduler * diffusers(ModelCache): stopgap to make from_cpu compatible with diffusers * CI: default to diffusers-1.5 now that runwayml token requirement is gone * diffusers: update to 0.10 (and transformers to 4.25) * diffusers: use xformers when available diffusers no longer auto-enables this as of 0.10.2. * diffusers: make masked img2img behave better with multi-step schedulers re-randomizing the noise each step was confusing them. * diffusers: work more better with more models. fixed relative path problem with local models. fixed models on hub not always having a `fp16` branch. * diffusers: stopgap fix for attention_maps_callback crash after recent merge * fixup import merge conflicts correction for 061c5369a2247c6c92cd69606bcf54c4f1962a0b * test: add tests/inpainting inputs for masked img2img * diffusers(AddsMaskedGuidance): partial fix for k-schedulers Prevents them from crashing, but results are still hot garbage. * fix --safety_checker arg parsing and add note to diffusers loader about where safety checker gets called * generate: fix import error * CI: don't try to read the old init location * diffusers: support loading an alternate VAE * CI: remove sh-syntax if-statement so it doesn't crash powershell * CI: fold strings in yaml because backslash is not line-continuation in powershell * attention maps callback stuff for diffusers * build: fix syntax error in environment-mac * diffusers: add INITIAL_MODELS with diffusers-compatible repos * re-enable the embedding manager; closes #1778 * Squashed commit of the following: commit e4a956abc37fcb5cf188388b76b617bc5c8fda7d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:43:07 2022 +0100 import new load handling from EmbeddingManager and cleanup commit c4abe91a5ba0d415b45bf734068385668b7a66e6 Merge: 032e856e 1efc6397 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:09:53 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers_with_textual_inversion_manager commit 032e856eefb3bbc39534f5daafd25764bcfcef8b Merge: 8b4f0fe9 bc515e24 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:08:01 2022 +0100 Merge remote-tracking branch 'upstream/dev/diffusers' into dev/diffusers_with_textual_inversion_manager commit 1efc6397fc6e61c1aff4b0258b93089d61de5955 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:04:28 2022 +0100 cleanup and add performance notes commit e400f804ac471a0ca2ba432fd658778b20c7bdab Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:45:07 2022 +0100 fix bug and update unit tests commit deb9ae0ae1016750e93ce8275734061f7285a231 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:28:29 2022 +0100 textual inversion manager seems to work commit 162e02505dec777e91a983c4d0fb52e950d25ff0 Merge: cbad4583 12769b3d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:58:03 2022 +0100 Merge branch 'main' into feature_textual_inversion_mgr commit cbad45836c6aace6871a90f2621a953f49433131 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:54:10 2022 +0100 use position embeddings commit 070344c69b0e0db340a183857d0a787b348681d3 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:53:47 2022 +0100 Don't crash CLI on exceptions commit b035ac8c6772dfd9ba41b8eeb9103181cda028f8 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:11:55 2022 +0100 add missing position_embeddings commit 12769b3d3562ef71e0f54946b532ad077e10043c Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:33:25 2022 +0100 debugging why it don't work commit bafb7215eabe1515ca5e8388fd3bb2f3ac5362cf Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:21:33 2022 +0100 debugging why it don't work commit 664a6e9e146b42d96703f0cc8baf8f5efec04ee1 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit 8b4f0fe9d6e4e2643b36dfa27864294785d7ba4e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit ffbe1ab11163ba712e353d89404e301d0e0c6cdf Merge: 6e4dad60 023df37e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:37:31 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers commit 023df37efffa67434f77def7fc3c9dfb29f699fd Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:36:54 2022 +0100 cleanup commit 05fac594eaf79d0058e3c48deee93df603f136c2 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:07:49 2022 +0100 tweak error checking commit 009f32ed39a7280997c3ffab112adadee0b44279 Author: damian <null@damianstewart.com> Date: Thu Dec 15 21:29:47 2022 +0100 unit tests passing for embeddings with vector length >1 commit beb1b08d9a98112ed2fe073580568e1a18698da3 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:39:09 2022 +0100 more explicit equality tests when overwriting commit 44d8a5a7c85cdabc9ce3a54fd0769a10597b3ca9 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:30:13 2022 +0100 wip textual inversion manager (unit tests passing for 1v embedding overwriting) commit 417c2b57d90924a839616bfb66804faab8039e4c Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 12:30:55 2022 +0100 wip textual inversion manager (unit tests passing for base stuff + padding) commit 2e80872e3b6f7fd7d8eb8928822bd824b63cb2ff Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 10:57:57 2022 +0100 wip new TextualInversionManager * stop using WeightedFrozenCLIPEmbedder * store diffusion models locally - configure_invokeai.py reconfigured to store diffusion models rather than CompVis models - hugging face caching model is used, but cache is set to ~/invokeai/models/repo_id - models.yaml does **NOT** use path, just repo_id - "repo_name" changed to "repo_id" to following hugging face conventions - Models are loaded with full precision pending further work. * allow non-local files during development * path takes priority over repo_id * MVP for model_cache and configure_invokeai - Feature complete (almost) - configure_invokeai.py downloads both .ckpt and diffuser models, along with their VAEs. Both types of download are controlled by a unified INITIAL_MODELS.yaml file. - model_cache can load both type of model and switches back and forth in CPU. No memory leaks detected TO DO: 1. I have not yet turned on the LocalOnly flag for diffuser models, so the code will check the Hugging Face repo for updates before using the locally cached models. This will break firewalled systems. I am thinking of putting in a global check for internet connectivity at startup time and setting the LocalOnly flag based on this. It would be good to check updates if there is connectivity. 2. I have not gone completely through INITIAL_MODELS.yaml to check which models are available as diffusers and which are not. So models like PaperCut and VoxelArt may not load properly. The runway and stability models are checked, as well as the Trinart models. 3. Add stanzas for SD 2.0 and 2.1 in INITIAL_MODELS.yaml REMAINING PROBLEMS NOT DIRECTLY RELATED TO MODEL_CACHE: 1. When loading a .ckpt file there are lots of messages like this: Warning! ldm.modules.attention.CrossAttention is no longer being maintained. Please use InvokeAICrossAttention instead. I'm not sure how to address this. 2. The ckpt models ***don't actually run*** due to the lack of special-case support for them in the generator objects. For example, here's the hard crash you get when you run txt2img against the legacy waifu-diffusion-1.3 model: ``` >> An error occurred: Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 140, in main main_loop(gen, opt) File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 371, in main_loop gen.prompt2image( File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1265, in __getattr__ raise AttributeError("'{}' object has no attribute '{}'".format( AttributeError: 'LatentDiffusion' object has no attribute 'image_from_embeddings' ``` 3. The inpainting diffusion model isn't working. Here's the output of "banana sushi" when inpainting-1.5 is loaded: ``` Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 301, in image_from_embeddings result_latents, result_attention_map_saver = self.latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 330, in latents_from_embeddings result: PipelineIntermediateState = infer_latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 185, in __call__ for result in self.generator_method(*args, **kwargs): File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 367, in generate_latents_from_embeddings step_output = self.step(batched_t, latents, guidance_scale, File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context return func(*args, **kwargs) File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 409, in step step_output = self.scheduler.step(noise_pred, timestep, latents, **extra_step_kwargs) File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/diffusers/schedulers/scheduling_lms_discrete.py", line 223, in step pred_original_sample = sample - sigma * model_output RuntimeError: The size of tensor a (9) must match the size of tensor b (4) at non-singleton dimension 1 ``` * proper support for float32/float16 - configure script now correctly detects user's preference for fp16/32 and downloads the correct diffuser version. If fp16 version not available, falls back to fp32 version. - misc code cleanup and simplification in model_cache * add on-the-fly conversion of .ckpt to diffusers models 1. On-the-fly conversion code can be found in the file ldm/invoke/ckpt_to_diffusers.py. 2. A new !optimize command has been added to the CLI. Should be ported to Web GUI. User experience on the CLI is this: ``` invoke> !optimize /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt INFO: Converting legacy weights file /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt to optimized diffuser model. This operation will take 30-60s to complete. Success. Optimized model is now located at /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 Writing new config file entry for sd-v1-4... >> New configuration: sd-v1-4: description: Optimized version of sd-v1-4 format: diffusers path: /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 OK to import [n]? y >> Verifying that new model loads... >> Current VRAM usage: 2.60G >> Offloading stable-diffusion-2.1 to CPU >> Loading diffusers model from /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 | Using faster float16 precision You have disabled the safety checker for <class 'ldm.invoke.generator.diffusers_pipeline.StableDiffusionGeneratorPipeline'> by passing `safety_checker=None`. Ensure that you abide to the conditions of the Stable Diffusion \ license and do not expose unfiltered results in services or applications open to the public. Both the diffusers team and Hugging Face strongly recommend to keep the safety filter enabled in all public facing circumstances,\ disabling it only for use-cases that involve analyzing network behavior or auditing its results. For more information, please have a look at https://github.com/huggingface/diffusers/pull/254 . | training width x height = (512 x 512) >> Model loaded in 3.48s >> Max VRAM used to load the model: 2.17G >> Current VRAM usage:2.17G >> Textual inversions available: >> Setting Sampler to k_lms (LMSDiscreteScheduler) Keep model loaded? [y] ``` * add parallel set of generator files for ckpt legacy generation * generation using legacy ckpt models now working * diffusers: fix missing attention_maps_callback fix for 23eb80b40421b2bb8f4b6d3dd30490d11c447b36 * associate legacy CrossAttention with .ckpt models * enable autoconvert New --autoconvert CLI option will scan a designated directory for new .ckpt files, convert them into diffuser models, and import them into models.yaml. Works like this: invoke.py --autoconvert /path/to/weights/directory In ModelCache added two new methods: autoconvert_weights(config_path, weights_directory_path, models_directory_path) convert_and_import(ckpt_path, diffuser_path) * diffusers: update to diffusers 0.11 (from 0.10.2) * fix vae loading & width/height calculation * refactor: encapsulate these conditioning data into one container * diffusers: fix some noise-scaling issues by pushing the noise-mixing down to the common function * add support for safetensors and accelerate * set local_files_only when internet unreachable * diffusers: fix error-handling path when model repo has no fp16 branch * fix generatorinpaint error Fixes : "ModuleNotFoundError: No module named 'ldm.invoke.generatorinpaint' https://github.com/invoke-ai/InvokeAI/pull/1583#issuecomment-1363634318 * quench diffuser safety-checker warning * diffusers: support stochastic DDIM eta parameter * fix conda env creation on macos * fix cross-attention with diffusers 0.11 * diffusers: the VAE needs to be tiling as well as the U-Net * diffusers: comment on subfolders * diffusers: embiggen! * diffusers: make model_cache.list_models serializable * diffusers(inpaint): restore scaling functionality * fix requirements clash between numba and numpy 1.24 * diffusers: allow inpainting model to do non-inpainting tasks * start expanding model_cache functionality * add import_ckpt_model() and import_diffuser_model() methods to model_manager - in addition, model_cache.py is now renamed to model_manager.py * allow "recommended" flag to be optional in INITIAL_MODELS.yaml * configure_invokeai now downloads VAE diffusers in advance * rename ModelCache to ModelManager * remove support for `repo_name` in models.yaml * check for and refuse to load embeddings trained on incompatible models * models.yaml.example: s/repo_name/repo_id and remove extra INITIAL_MODELS now that the main one has diffusers models in it. * add MVP textual inversion script * refactor(InvokeAIDiffuserComponent): factor out _combine() * InvokeAIDiffuserComponent: implement threshold * InvokeAIDiffuserComponent: diagnostic logs for threshold ...this does not look right * add a curses-based frontend to textual inversion - not quite working yet - requires npyscreen installed - on windows will also have the windows-curses requirement, but not added to requirements yet * add curses-based interface for textual inversion * fix crash in convert_and_import() - This corrects a "local variable referenced before assignment" error in model_manager.convert_and_import() * potential workaround for no 'state_dict' key error - As reported in https://github.com/huggingface/diffusers/issues/1876 * create TI output dir if needed * Update environment-lin-cuda.yml (#2159) Fixing line 42 to be the proper order to define the transformers requirement: ~= instead of =~ * diffusers: update sampler-to-scheduler mapping based on https://github.com/huggingface/diffusers/issues/277#issuecomment-1371428672 * improve user exp for ckt to diffusers conversion - !optimize_models command now operates on an existing ckpt file entry in models.yaml - replaces existing entry, rather than adding a new one - offers to delete the ckpt file after conversion * web: adapt progress callback to deal with old generator or new diffusers pipeline * clean-up model_manager code - add_model() verified to work for .ckpt local paths, .ckpt remote URLs, diffusers local paths, and diffusers repo_ids - convert_and_import() verified to work for local and remove .ckpt files * handle edge cases for import_model() and convert_model() * add support for safetensor .ckpt files * fix name error * code cleanup with pyflake * improve model setting behavior - If the user enters an invalid model name at startup time, will not try to load it, warn, and use default model - CLI UI enhancement: include currently active model in the command line prompt. * update test-invoke-pip.yml - fix model cache path to point to runwayml/stable-diffusion-v1-5 - remove `skip-sd-weights` from configure_invokeai.py args * exclude dev/diffusers from "fail for draft PRs" * disable "fail on PR jobs" * re-add `--skip-sd-weights` since no space * update workflow environments - include `INVOKE_MODEL_RECONFIGURE: '--yes'` * clean up model load failure handling - Allow CLI to run even when no model is defined or loadable. - Inhibit stack trace when model load fails - only show last error - Give user *option* to run configure_invokeai.py when no models successfully load. - Restart invokeai after reconfiguration. * further edge-case handling 1) only one model in models.yaml file, and that model is broken 2) no models in models.yaml 3) models.yaml doesn't exist at all * fix incorrect model status listing - "cached" was not being returned from list_models() - normalize handling of exceptions during model loading: - Passing an invalid model name to generate.set_model() will return a KeyError - All other exceptions are returned as the appropriate Exception * CI: do download weights (if not already cached) * diffusers: fix scheduler loading in offline mode * CI: fix model name (no longer has `diffusers-` prefix) * Update txt2img2img.py (#2256) * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * feat - make model storage compatible with hugging face caching system This commit alters the InvokeAI model directory to be compatible with hugging face, making it easier to share diffusers (and other models) across different programs. - If the HF_HOME environment variable is not set, then models are cached in ~/invokeai/models in a format that is identical to the HuggingFace cache. - If HF_HOME is set, then models are cached wherever HF_HOME points. - To enable sharing with other HuggingFace library clients, set HF_HOME to ~/.cache/huggingface to set the default cache location or to ~/invokeai/models to have huggingface cache inside InvokeAI. * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * fix error "no attribute CkptInpaint" * model_manager.list_models() returns entire model config stanza+status * Initial Draft - Model Manager Diffusers * added hash function to diffusers * implement sha256 hashes on diffusers models * Add Model Manager Support for Diffusers * fix various problems with model manager - in cli import functions, fix not enough values to unpack from _get_name_and_desc() - fix crash when using old-style vae: value with new-style diffuser * rebuild frontend * fix dictconfig-not-serializable issue * fix NoneType' object is not subscriptable crash in model_manager * fix "str has no attribute get" error in model_manager list_models() * Add path and repo_id support for Diffusers Model Manager Also fixes bugs * Fix tooltip IT localization not working * Add Version Number To WebUI * Optimize Model Search * Fix incorrect font on the Model Manager UI * Fix image degradation on merge fixes - [Experimental] This change should effectively fix a couple of things. - Fix image degradation on subsequent merges of the canvas layers. - Fix the slight transparent border that is left behind when filling the bounding box with a color. - Fix the left over line of color when filling a bounding box with color. So far there are no side effects for this. If any, please report. * Add local model filtering for Diffusers / Checkpoints * Go to home on modal close for the Add Modal UI * Styling Fixes * Model Manager Diffusers Localization Update * Add Safe Tensor scanning to Model Manager * Fix model edit form dispatching string values instead of numbers. * Resolve VAE handling / edge cases for supplied repos * defer injecting tokens for textual inversions until they're used for the first time * squash a console warning * implement model migration check * add_model() overwrites previous config rather than merges * fix model config file attribute merging * fix precision handling in textual inversion script * allow ckpt conversion script to work with safetensors .ckpts Applied patch here: https://github.com/huggingface/diffusers/commit/beb932c5d111872c5e45387e7b1b2b3dd0524a47 * fix name "args" is not defined crash in textual_inversion_training * fix a second NameError: name 'args' is not defined crash * fix loading of the safety checker from the global cache dir * add installation step to textual inversion frontend - After a successful training run, the script will copy learned_embeds.bin to a subfolder of the embeddings directory. - User given the option to delete the logs and intermediate checkpoints (which together use 7-8G of space) - If textual inversion training fails, reports the error gracefully. * don't crash out on incompatible embeddings - put try: blocks around places where the system tries to load an embedding which is incompatible with the currently loaded model * add support for checkpoint resuming * textual inversion preferences are saved and restored between sessions - Preferences are stored in a file named text-inversion-training/preferences.conf - Currently the resume-from-checkpoint option is not working correctly. Possible bug in textual_inversion_training.py? * copy learned_embeddings.bin into right location * add front end for diffusers model merging - Front end doesn't do anything yet!!!! - Made change to model name parsing in CLI to support ability to have merged models with the "+" character in their names. * improve inpainting experience - recommend ckpt version of inpainting-1.5 to user - fix get_noise() bug in ckpt version of omnibus.py * update environment*yml * tweak instructions to install HuggingFace token * bump version number * enhance update scripts - update scripts will now fetch new INITIAL_MODELS.yaml so that configure_invokeai.py will know about the diffusers versions. * enhance invoke.sh/invoke.bat launchers - added configure_invokeai.py to menu - menu defaults to browser-based invoke * remove conda workflow (#2321) * fix `token_ids has shape torch.Size([79]) - expected [77]` * update CHANGELOG.md with 2.3.* info - Add information on how formats have changed and the upgrade process. - Add short bug list. Co-authored-by: Damian Stewart <d@damianstewart.com> Co-authored-by: Damian Stewart <null@damianstewart.com> Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> Co-authored-by: Wybartel-luxmc <37852506+Wybartel-luxmc@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> Co-authored-by: mickr777 <115216705+mickr777@users.noreply.github.com> Co-authored-by: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Co-authored-by: Eugene Brodsky <ebr@users.noreply.github.com> Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com>
2023-01-15 14:22:46 +00:00
return self._load_generator('.embiggen','Embiggen')
Refactoring simplet2i (#387) * start refactoring -not yet functional * first phase of refactor done - not sure weighted prompts working * Second phase of refactoring. Everything mostly working. * The refactoring has moved all the hard-core inference work into ldm.dream.generator.*, where there are submodules for txt2img and img2img. inpaint will go in there as well. * Some additional refactoring will be done soon, but relatively minor work. * fix -save_orig flag to actually work * add @neonsecret attention.py memory optimization * remove unneeded imports * move token logging into conditioning.py * add placeholder version of inpaint; porting in progress * fix crash in img2img * inpainting working; not tested on variations * fix crashes in img2img * ported attention.py memory optimization #117 from basujindal branch * added @torch_no_grad() decorators to img2img, txt2img, inpaint closures * Final commit prior to PR against development * fixup crash when generating intermediate images in web UI * rename ldm.simplet2i to ldm.generate * add backward-compatibility simplet2i shell with deprecation warning * add back in mps exception, addresses @vargol comment in #354 * replaced Conditioning class with exported functions * fix wrong type of with_variations attribute during intialization * changed "image_iterator()" to "get_make_image()" * raise NotImplementedError for calling get_make_image() in parent class * Update ldm/generate.py better error message Co-authored-by: Kevin Gibbons <bakkot@gmail.com> * minor stylistic fixes and assertion checks from code review * moved get_noise() method into img2img class * break get_noise() into two methods, one for txt2img and the other for img2img * inpainting works on non-square images now * make get_noise() an abstract method in base class * much improved inpainting Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
2022-09-06 00:40:10 +00:00
def _make_txt2img2img(self):
use 🧨diffusers model (#1583) * initial commit of DiffusionPipeline class * spike: proof of concept using diffusers for txt2img * doc: type hints for Generator * refactor(model_cache): factor out load_ckpt * model_cache: add ability to load a diffusers model pipeline and update associated things in Generate & Generator to not instantly fail when that happens * model_cache: fix model default image dimensions * txt2img: support switching diffusers schedulers * diffusers: let the scheduler do its scaling of the initial latents Remove IPNDM scheduler; it is not behaving. * web server: update image_progress callback for diffusers data * diffusers: restore prompt weighting feature * diffusers: fix set-sampler error following model switch * diffusers: use InvokeAIDiffuserComponent for conditioning * cross_attention_control: stub (no-op) implementations for diffusers * model_cache: let offload_model work with DiffusionPipeline, sorta. * models.yaml.example: add diffusers-format model, set as default * test-invoke-conda: use diffusers-format model test-invoke-conda: put huggingface-token where the library can use it * environment-mac: upgrade to diffusers 0.7 (from 0.6) this was already done for linux; mac must have been lost in the merge. * preload_models: explicitly load diffusers models In non-interactive mode too, as long as you're logged in. * fix(model_cache): don't check `model.config` in diffusers format clean-up from recent merge. * diffusers integration: support img2img * dev: upgrade to diffusers 0.8 (from 0.7.1) We get to remove some code by using methods that were factored out in the base class. * refactor: remove backported img2img.get_timesteps now that we can use it directly from diffusers 0.8.1 * ci: use diffusers model * dev: upgrade to diffusers 0.9 (from 0.8.1) * lint: correct annotations for Python 3.9. * lint: correct AttributeError.name reference for Python 3.9. * CI: prefer diffusers-1.4 because it no longer requires a token The RunwayML models still do. * build: there's yet another place to update requirements? * configure: try to download models even without token Models in the CompVis and stabilityai repos no longer require them. (But runwayml still does.) * configure: add troubleshooting info for config-not-found * fix(configure): prepend root to config path * fix(configure): remove second `default: true` from models example * CI: simplify test-on-push logic now that we don't need secrets The "test on push but only in forks" logic was only necessary when tests didn't work for PRs-from-forks. * create an embedding_manager for diffusers * internal: avoid importing diffusers DummyObject see https://github.com/huggingface/diffusers/issues/1479 * fix "config attributes…not expected" diffusers warnings. * fix deprecated scheduler construction * work around an apparent MPS torch bug that causes conditioning to have no effect * 🚧 post-rebase repair * preliminary support for outpainting (no masking yet) * monkey-patch diffusers.attention and use Invoke lowvram code * add always_use_cpu arg to bypass MPS * add cross-attention control support to diffusers (fails on MPS) For unknown reasons MPS produces garbage output with .swap(). Use --always_use_cpu arg to invoke.py for now to test this code on MPS. * diffusers support for the inpainting model * fix debug_image to not crash with non-RGB images. * inpainting for the normal model [WIP] This seems to be performing well until the LAST STEP, at which point it dissolves to confetti. * fix off-by-one bug in cross-attention-control (#1774) prompt token sequences begin with a "beginning-of-sequence" marker <bos> and end with a repeated "end-of-sequence" marker <eos> - to make a default prompt length of <bos> + 75 prompt tokens + <eos>. the .swap() code was failing to take the column for <bos> at index 0 into account. the changes here do that, and also add extra handling for a single <eos> (which may be redundant but which is included for completeness). based on my understanding and some assumptions about how this all works, the reason .swap() nevertheless seemed to do the right thing, to some extent, is because over multiple steps the conditioning process in Stable Diffusion operates as a feedback loop. a change to token n-1 has flow-on effects to how the [1x4x64x64] latent tensor is modified by all the tokens after it, - and as the next step is processed, all the tokens before it as well. intuitively, a token's conditioning effects "echo" throughout the whole length of the prompt. so even though the token at n-1 was being edited when what the user actually wanted was to edit the token at n, it nevertheless still had some non-negligible effect, in roughly the right direction, often enough that it seemed like it was working properly. * refactor common CrossAttention stuff into a mixin so that the old ldm code can still work if necessary * inpainting for the normal model. I think it works this time. * diffusers: reset num_vectors_per_token sync with 44a00555718f1df173c60da0ed646cf700e29537 * diffusers: txt2img2img (hires_fix) with so much slicing and dicing of pipeline methods to stitch them together * refactor(diffusers): reduce some code duplication amongst the different tasks * fixup! refactor(diffusers): reduce some code duplication amongst the different tasks * diffusers: enable DPMSolver++ scheduler * diffusers: upgrade to diffusers 0.10, add Heun scheduler * diffusers(ModelCache): stopgap to make from_cpu compatible with diffusers * CI: default to diffusers-1.5 now that runwayml token requirement is gone * diffusers: update to 0.10 (and transformers to 4.25) * diffusers: use xformers when available diffusers no longer auto-enables this as of 0.10.2. * diffusers: make masked img2img behave better with multi-step schedulers re-randomizing the noise each step was confusing them. * diffusers: work more better with more models. fixed relative path problem with local models. fixed models on hub not always having a `fp16` branch. * diffusers: stopgap fix for attention_maps_callback crash after recent merge * fixup import merge conflicts correction for 061c5369a2247c6c92cd69606bcf54c4f1962a0b * test: add tests/inpainting inputs for masked img2img * diffusers(AddsMaskedGuidance): partial fix for k-schedulers Prevents them from crashing, but results are still hot garbage. * fix --safety_checker arg parsing and add note to diffusers loader about where safety checker gets called * generate: fix import error * CI: don't try to read the old init location * diffusers: support loading an alternate VAE * CI: remove sh-syntax if-statement so it doesn't crash powershell * CI: fold strings in yaml because backslash is not line-continuation in powershell * attention maps callback stuff for diffusers * build: fix syntax error in environment-mac * diffusers: add INITIAL_MODELS with diffusers-compatible repos * re-enable the embedding manager; closes #1778 * Squashed commit of the following: commit e4a956abc37fcb5cf188388b76b617bc5c8fda7d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:43:07 2022 +0100 import new load handling from EmbeddingManager and cleanup commit c4abe91a5ba0d415b45bf734068385668b7a66e6 Merge: 032e856e 1efc6397 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:09:53 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers_with_textual_inversion_manager commit 032e856eefb3bbc39534f5daafd25764bcfcef8b Merge: 8b4f0fe9 bc515e24 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:08:01 2022 +0100 Merge remote-tracking branch 'upstream/dev/diffusers' into dev/diffusers_with_textual_inversion_manager commit 1efc6397fc6e61c1aff4b0258b93089d61de5955 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:04:28 2022 +0100 cleanup and add performance notes commit e400f804ac471a0ca2ba432fd658778b20c7bdab Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:45:07 2022 +0100 fix bug and update unit tests commit deb9ae0ae1016750e93ce8275734061f7285a231 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:28:29 2022 +0100 textual inversion manager seems to work commit 162e02505dec777e91a983c4d0fb52e950d25ff0 Merge: cbad4583 12769b3d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:58:03 2022 +0100 Merge branch 'main' into feature_textual_inversion_mgr commit cbad45836c6aace6871a90f2621a953f49433131 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:54:10 2022 +0100 use position embeddings commit 070344c69b0e0db340a183857d0a787b348681d3 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:53:47 2022 +0100 Don't crash CLI on exceptions commit b035ac8c6772dfd9ba41b8eeb9103181cda028f8 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:11:55 2022 +0100 add missing position_embeddings commit 12769b3d3562ef71e0f54946b532ad077e10043c Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:33:25 2022 +0100 debugging why it don't work commit bafb7215eabe1515ca5e8388fd3bb2f3ac5362cf Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:21:33 2022 +0100 debugging why it don't work commit 664a6e9e146b42d96703f0cc8baf8f5efec04ee1 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit 8b4f0fe9d6e4e2643b36dfa27864294785d7ba4e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit ffbe1ab11163ba712e353d89404e301d0e0c6cdf Merge: 6e4dad60 023df37e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:37:31 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers commit 023df37efffa67434f77def7fc3c9dfb29f699fd Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:36:54 2022 +0100 cleanup commit 05fac594eaf79d0058e3c48deee93df603f136c2 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:07:49 2022 +0100 tweak error checking commit 009f32ed39a7280997c3ffab112adadee0b44279 Author: damian <null@damianstewart.com> Date: Thu Dec 15 21:29:47 2022 +0100 unit tests passing for embeddings with vector length >1 commit beb1b08d9a98112ed2fe073580568e1a18698da3 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:39:09 2022 +0100 more explicit equality tests when overwriting commit 44d8a5a7c85cdabc9ce3a54fd0769a10597b3ca9 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:30:13 2022 +0100 wip textual inversion manager (unit tests passing for 1v embedding overwriting) commit 417c2b57d90924a839616bfb66804faab8039e4c Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 12:30:55 2022 +0100 wip textual inversion manager (unit tests passing for base stuff + padding) commit 2e80872e3b6f7fd7d8eb8928822bd824b63cb2ff Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 10:57:57 2022 +0100 wip new TextualInversionManager * stop using WeightedFrozenCLIPEmbedder * store diffusion models locally - configure_invokeai.py reconfigured to store diffusion models rather than CompVis models - hugging face caching model is used, but cache is set to ~/invokeai/models/repo_id - models.yaml does **NOT** use path, just repo_id - "repo_name" changed to "repo_id" to following hugging face conventions - Models are loaded with full precision pending further work. * allow non-local files during development * path takes priority over repo_id * MVP for model_cache and configure_invokeai - Feature complete (almost) - configure_invokeai.py downloads both .ckpt and diffuser models, along with their VAEs. Both types of download are controlled by a unified INITIAL_MODELS.yaml file. - model_cache can load both type of model and switches back and forth in CPU. No memory leaks detected TO DO: 1. I have not yet turned on the LocalOnly flag for diffuser models, so the code will check the Hugging Face repo for updates before using the locally cached models. This will break firewalled systems. I am thinking of putting in a global check for internet connectivity at startup time and setting the LocalOnly flag based on this. It would be good to check updates if there is connectivity. 2. I have not gone completely through INITIAL_MODELS.yaml to check which models are available as diffusers and which are not. So models like PaperCut and VoxelArt may not load properly. The runway and stability models are checked, as well as the Trinart models. 3. Add stanzas for SD 2.0 and 2.1 in INITIAL_MODELS.yaml REMAINING PROBLEMS NOT DIRECTLY RELATED TO MODEL_CACHE: 1. When loading a .ckpt file there are lots of messages like this: Warning! ldm.modules.attention.CrossAttention is no longer being maintained. Please use InvokeAICrossAttention instead. I'm not sure how to address this. 2. The ckpt models ***don't actually run*** due to the lack of special-case support for them in the generator objects. For example, here's the hard crash you get when you run txt2img against the legacy waifu-diffusion-1.3 model: ``` >> An error occurred: Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 140, in main main_loop(gen, opt) File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 371, in main_loop gen.prompt2image( File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1265, in __getattr__ raise AttributeError("'{}' object has no attribute '{}'".format( AttributeError: 'LatentDiffusion' object has no attribute 'image_from_embeddings' ``` 3. The inpainting diffusion model isn't working. Here's the output of "banana sushi" when inpainting-1.5 is loaded: ``` Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 301, in image_from_embeddings result_latents, result_attention_map_saver = self.latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 330, in latents_from_embeddings result: PipelineIntermediateState = infer_latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 185, in __call__ for result in self.generator_method(*args, **kwargs): File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 367, in generate_latents_from_embeddings step_output = self.step(batched_t, latents, guidance_scale, File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context return func(*args, **kwargs) File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 409, in step step_output = self.scheduler.step(noise_pred, timestep, latents, **extra_step_kwargs) File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/diffusers/schedulers/scheduling_lms_discrete.py", line 223, in step pred_original_sample = sample - sigma * model_output RuntimeError: The size of tensor a (9) must match the size of tensor b (4) at non-singleton dimension 1 ``` * proper support for float32/float16 - configure script now correctly detects user's preference for fp16/32 and downloads the correct diffuser version. If fp16 version not available, falls back to fp32 version. - misc code cleanup and simplification in model_cache * add on-the-fly conversion of .ckpt to diffusers models 1. On-the-fly conversion code can be found in the file ldm/invoke/ckpt_to_diffusers.py. 2. A new !optimize command has been added to the CLI. Should be ported to Web GUI. User experience on the CLI is this: ``` invoke> !optimize /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt INFO: Converting legacy weights file /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt to optimized diffuser model. This operation will take 30-60s to complete. Success. Optimized model is now located at /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 Writing new config file entry for sd-v1-4... >> New configuration: sd-v1-4: description: Optimized version of sd-v1-4 format: diffusers path: /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 OK to import [n]? y >> Verifying that new model loads... >> Current VRAM usage: 2.60G >> Offloading stable-diffusion-2.1 to CPU >> Loading diffusers model from /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 | Using faster float16 precision You have disabled the safety checker for <class 'ldm.invoke.generator.diffusers_pipeline.StableDiffusionGeneratorPipeline'> by passing `safety_checker=None`. Ensure that you abide to the conditions of the Stable Diffusion \ license and do not expose unfiltered results in services or applications open to the public. Both the diffusers team and Hugging Face strongly recommend to keep the safety filter enabled in all public facing circumstances,\ disabling it only for use-cases that involve analyzing network behavior or auditing its results. For more information, please have a look at https://github.com/huggingface/diffusers/pull/254 . | training width x height = (512 x 512) >> Model loaded in 3.48s >> Max VRAM used to load the model: 2.17G >> Current VRAM usage:2.17G >> Textual inversions available: >> Setting Sampler to k_lms (LMSDiscreteScheduler) Keep model loaded? [y] ``` * add parallel set of generator files for ckpt legacy generation * generation using legacy ckpt models now working * diffusers: fix missing attention_maps_callback fix for 23eb80b40421b2bb8f4b6d3dd30490d11c447b36 * associate legacy CrossAttention with .ckpt models * enable autoconvert New --autoconvert CLI option will scan a designated directory for new .ckpt files, convert them into diffuser models, and import them into models.yaml. Works like this: invoke.py --autoconvert /path/to/weights/directory In ModelCache added two new methods: autoconvert_weights(config_path, weights_directory_path, models_directory_path) convert_and_import(ckpt_path, diffuser_path) * diffusers: update to diffusers 0.11 (from 0.10.2) * fix vae loading & width/height calculation * refactor: encapsulate these conditioning data into one container * diffusers: fix some noise-scaling issues by pushing the noise-mixing down to the common function * add support for safetensors and accelerate * set local_files_only when internet unreachable * diffusers: fix error-handling path when model repo has no fp16 branch * fix generatorinpaint error Fixes : "ModuleNotFoundError: No module named 'ldm.invoke.generatorinpaint' https://github.com/invoke-ai/InvokeAI/pull/1583#issuecomment-1363634318 * quench diffuser safety-checker warning * diffusers: support stochastic DDIM eta parameter * fix conda env creation on macos * fix cross-attention with diffusers 0.11 * diffusers: the VAE needs to be tiling as well as the U-Net * diffusers: comment on subfolders * diffusers: embiggen! * diffusers: make model_cache.list_models serializable * diffusers(inpaint): restore scaling functionality * fix requirements clash between numba and numpy 1.24 * diffusers: allow inpainting model to do non-inpainting tasks * start expanding model_cache functionality * add import_ckpt_model() and import_diffuser_model() methods to model_manager - in addition, model_cache.py is now renamed to model_manager.py * allow "recommended" flag to be optional in INITIAL_MODELS.yaml * configure_invokeai now downloads VAE diffusers in advance * rename ModelCache to ModelManager * remove support for `repo_name` in models.yaml * check for and refuse to load embeddings trained on incompatible models * models.yaml.example: s/repo_name/repo_id and remove extra INITIAL_MODELS now that the main one has diffusers models in it. * add MVP textual inversion script * refactor(InvokeAIDiffuserComponent): factor out _combine() * InvokeAIDiffuserComponent: implement threshold * InvokeAIDiffuserComponent: diagnostic logs for threshold ...this does not look right * add a curses-based frontend to textual inversion - not quite working yet - requires npyscreen installed - on windows will also have the windows-curses requirement, but not added to requirements yet * add curses-based interface for textual inversion * fix crash in convert_and_import() - This corrects a "local variable referenced before assignment" error in model_manager.convert_and_import() * potential workaround for no 'state_dict' key error - As reported in https://github.com/huggingface/diffusers/issues/1876 * create TI output dir if needed * Update environment-lin-cuda.yml (#2159) Fixing line 42 to be the proper order to define the transformers requirement: ~= instead of =~ * diffusers: update sampler-to-scheduler mapping based on https://github.com/huggingface/diffusers/issues/277#issuecomment-1371428672 * improve user exp for ckt to diffusers conversion - !optimize_models command now operates on an existing ckpt file entry in models.yaml - replaces existing entry, rather than adding a new one - offers to delete the ckpt file after conversion * web: adapt progress callback to deal with old generator or new diffusers pipeline * clean-up model_manager code - add_model() verified to work for .ckpt local paths, .ckpt remote URLs, diffusers local paths, and diffusers repo_ids - convert_and_import() verified to work for local and remove .ckpt files * handle edge cases for import_model() and convert_model() * add support for safetensor .ckpt files * fix name error * code cleanup with pyflake * improve model setting behavior - If the user enters an invalid model name at startup time, will not try to load it, warn, and use default model - CLI UI enhancement: include currently active model in the command line prompt. * update test-invoke-pip.yml - fix model cache path to point to runwayml/stable-diffusion-v1-5 - remove `skip-sd-weights` from configure_invokeai.py args * exclude dev/diffusers from "fail for draft PRs" * disable "fail on PR jobs" * re-add `--skip-sd-weights` since no space * update workflow environments - include `INVOKE_MODEL_RECONFIGURE: '--yes'` * clean up model load failure handling - Allow CLI to run even when no model is defined or loadable. - Inhibit stack trace when model load fails - only show last error - Give user *option* to run configure_invokeai.py when no models successfully load. - Restart invokeai after reconfiguration. * further edge-case handling 1) only one model in models.yaml file, and that model is broken 2) no models in models.yaml 3) models.yaml doesn't exist at all * fix incorrect model status listing - "cached" was not being returned from list_models() - normalize handling of exceptions during model loading: - Passing an invalid model name to generate.set_model() will return a KeyError - All other exceptions are returned as the appropriate Exception * CI: do download weights (if not already cached) * diffusers: fix scheduler loading in offline mode * CI: fix model name (no longer has `diffusers-` prefix) * Update txt2img2img.py (#2256) * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * feat - make model storage compatible with hugging face caching system This commit alters the InvokeAI model directory to be compatible with hugging face, making it easier to share diffusers (and other models) across different programs. - If the HF_HOME environment variable is not set, then models are cached in ~/invokeai/models in a format that is identical to the HuggingFace cache. - If HF_HOME is set, then models are cached wherever HF_HOME points. - To enable sharing with other HuggingFace library clients, set HF_HOME to ~/.cache/huggingface to set the default cache location or to ~/invokeai/models to have huggingface cache inside InvokeAI. * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * fix error "no attribute CkptInpaint" * model_manager.list_models() returns entire model config stanza+status * Initial Draft - Model Manager Diffusers * added hash function to diffusers * implement sha256 hashes on diffusers models * Add Model Manager Support for Diffusers * fix various problems with model manager - in cli import functions, fix not enough values to unpack from _get_name_and_desc() - fix crash when using old-style vae: value with new-style diffuser * rebuild frontend * fix dictconfig-not-serializable issue * fix NoneType' object is not subscriptable crash in model_manager * fix "str has no attribute get" error in model_manager list_models() * Add path and repo_id support for Diffusers Model Manager Also fixes bugs * Fix tooltip IT localization not working * Add Version Number To WebUI * Optimize Model Search * Fix incorrect font on the Model Manager UI * Fix image degradation on merge fixes - [Experimental] This change should effectively fix a couple of things. - Fix image degradation on subsequent merges of the canvas layers. - Fix the slight transparent border that is left behind when filling the bounding box with a color. - Fix the left over line of color when filling a bounding box with color. So far there are no side effects for this. If any, please report. * Add local model filtering for Diffusers / Checkpoints * Go to home on modal close for the Add Modal UI * Styling Fixes * Model Manager Diffusers Localization Update * Add Safe Tensor scanning to Model Manager * Fix model edit form dispatching string values instead of numbers. * Resolve VAE handling / edge cases for supplied repos * defer injecting tokens for textual inversions until they're used for the first time * squash a console warning * implement model migration check * add_model() overwrites previous config rather than merges * fix model config file attribute merging * fix precision handling in textual inversion script * allow ckpt conversion script to work with safetensors .ckpts Applied patch here: https://github.com/huggingface/diffusers/commit/beb932c5d111872c5e45387e7b1b2b3dd0524a47 * fix name "args" is not defined crash in textual_inversion_training * fix a second NameError: name 'args' is not defined crash * fix loading of the safety checker from the global cache dir * add installation step to textual inversion frontend - After a successful training run, the script will copy learned_embeds.bin to a subfolder of the embeddings directory. - User given the option to delete the logs and intermediate checkpoints (which together use 7-8G of space) - If textual inversion training fails, reports the error gracefully. * don't crash out on incompatible embeddings - put try: blocks around places where the system tries to load an embedding which is incompatible with the currently loaded model * add support for checkpoint resuming * textual inversion preferences are saved and restored between sessions - Preferences are stored in a file named text-inversion-training/preferences.conf - Currently the resume-from-checkpoint option is not working correctly. Possible bug in textual_inversion_training.py? * copy learned_embeddings.bin into right location * add front end for diffusers model merging - Front end doesn't do anything yet!!!! - Made change to model name parsing in CLI to support ability to have merged models with the "+" character in their names. * improve inpainting experience - recommend ckpt version of inpainting-1.5 to user - fix get_noise() bug in ckpt version of omnibus.py * update environment*yml * tweak instructions to install HuggingFace token * bump version number * enhance update scripts - update scripts will now fetch new INITIAL_MODELS.yaml so that configure_invokeai.py will know about the diffusers versions. * enhance invoke.sh/invoke.bat launchers - added configure_invokeai.py to menu - menu defaults to browser-based invoke * remove conda workflow (#2321) * fix `token_ids has shape torch.Size([79]) - expected [77]` * update CHANGELOG.md with 2.3.* info - Add information on how formats have changed and the upgrade process. - Add short bug list. Co-authored-by: Damian Stewart <d@damianstewart.com> Co-authored-by: Damian Stewart <null@damianstewart.com> Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> Co-authored-by: Wybartel-luxmc <37852506+Wybartel-luxmc@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> Co-authored-by: mickr777 <115216705+mickr777@users.noreply.github.com> Co-authored-by: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Co-authored-by: Eugene Brodsky <ebr@users.noreply.github.com> Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com>
2023-01-15 14:22:46 +00:00
return self._load_generator('.txt2img2img','Txt2Img2Img')
Refactoring simplet2i (#387) * start refactoring -not yet functional * first phase of refactor done - not sure weighted prompts working * Second phase of refactoring. Everything mostly working. * The refactoring has moved all the hard-core inference work into ldm.dream.generator.*, where there are submodules for txt2img and img2img. inpaint will go in there as well. * Some additional refactoring will be done soon, but relatively minor work. * fix -save_orig flag to actually work * add @neonsecret attention.py memory optimization * remove unneeded imports * move token logging into conditioning.py * add placeholder version of inpaint; porting in progress * fix crash in img2img * inpainting working; not tested on variations * fix crashes in img2img * ported attention.py memory optimization #117 from basujindal branch * added @torch_no_grad() decorators to img2img, txt2img, inpaint closures * Final commit prior to PR against development * fixup crash when generating intermediate images in web UI * rename ldm.simplet2i to ldm.generate * add backward-compatibility simplet2i shell with deprecation warning * add back in mps exception, addresses @vargol comment in #354 * replaced Conditioning class with exported functions * fix wrong type of with_variations attribute during intialization * changed "image_iterator()" to "get_make_image()" * raise NotImplementedError for calling get_make_image() in parent class * Update ldm/generate.py better error message Co-authored-by: Kevin Gibbons <bakkot@gmail.com> * minor stylistic fixes and assertion checks from code review * moved get_noise() method into img2img class * break get_noise() into two methods, one for txt2img and the other for img2img * inpainting works on non-square images now * make get_noise() an abstract method in base class * much improved inpainting Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
2022-09-06 00:40:10 +00:00
def _make_inpaint(self):
use 🧨diffusers model (#1583) * initial commit of DiffusionPipeline class * spike: proof of concept using diffusers for txt2img * doc: type hints for Generator * refactor(model_cache): factor out load_ckpt * model_cache: add ability to load a diffusers model pipeline and update associated things in Generate & Generator to not instantly fail when that happens * model_cache: fix model default image dimensions * txt2img: support switching diffusers schedulers * diffusers: let the scheduler do its scaling of the initial latents Remove IPNDM scheduler; it is not behaving. * web server: update image_progress callback for diffusers data * diffusers: restore prompt weighting feature * diffusers: fix set-sampler error following model switch * diffusers: use InvokeAIDiffuserComponent for conditioning * cross_attention_control: stub (no-op) implementations for diffusers * model_cache: let offload_model work with DiffusionPipeline, sorta. * models.yaml.example: add diffusers-format model, set as default * test-invoke-conda: use diffusers-format model test-invoke-conda: put huggingface-token where the library can use it * environment-mac: upgrade to diffusers 0.7 (from 0.6) this was already done for linux; mac must have been lost in the merge. * preload_models: explicitly load diffusers models In non-interactive mode too, as long as you're logged in. * fix(model_cache): don't check `model.config` in diffusers format clean-up from recent merge. * diffusers integration: support img2img * dev: upgrade to diffusers 0.8 (from 0.7.1) We get to remove some code by using methods that were factored out in the base class. * refactor: remove backported img2img.get_timesteps now that we can use it directly from diffusers 0.8.1 * ci: use diffusers model * dev: upgrade to diffusers 0.9 (from 0.8.1) * lint: correct annotations for Python 3.9. * lint: correct AttributeError.name reference for Python 3.9. * CI: prefer diffusers-1.4 because it no longer requires a token The RunwayML models still do. * build: there's yet another place to update requirements? * configure: try to download models even without token Models in the CompVis and stabilityai repos no longer require them. (But runwayml still does.) * configure: add troubleshooting info for config-not-found * fix(configure): prepend root to config path * fix(configure): remove second `default: true` from models example * CI: simplify test-on-push logic now that we don't need secrets The "test on push but only in forks" logic was only necessary when tests didn't work for PRs-from-forks. * create an embedding_manager for diffusers * internal: avoid importing diffusers DummyObject see https://github.com/huggingface/diffusers/issues/1479 * fix "config attributes…not expected" diffusers warnings. * fix deprecated scheduler construction * work around an apparent MPS torch bug that causes conditioning to have no effect * 🚧 post-rebase repair * preliminary support for outpainting (no masking yet) * monkey-patch diffusers.attention and use Invoke lowvram code * add always_use_cpu arg to bypass MPS * add cross-attention control support to diffusers (fails on MPS) For unknown reasons MPS produces garbage output with .swap(). Use --always_use_cpu arg to invoke.py for now to test this code on MPS. * diffusers support for the inpainting model * fix debug_image to not crash with non-RGB images. * inpainting for the normal model [WIP] This seems to be performing well until the LAST STEP, at which point it dissolves to confetti. * fix off-by-one bug in cross-attention-control (#1774) prompt token sequences begin with a "beginning-of-sequence" marker <bos> and end with a repeated "end-of-sequence" marker <eos> - to make a default prompt length of <bos> + 75 prompt tokens + <eos>. the .swap() code was failing to take the column for <bos> at index 0 into account. the changes here do that, and also add extra handling for a single <eos> (which may be redundant but which is included for completeness). based on my understanding and some assumptions about how this all works, the reason .swap() nevertheless seemed to do the right thing, to some extent, is because over multiple steps the conditioning process in Stable Diffusion operates as a feedback loop. a change to token n-1 has flow-on effects to how the [1x4x64x64] latent tensor is modified by all the tokens after it, - and as the next step is processed, all the tokens before it as well. intuitively, a token's conditioning effects "echo" throughout the whole length of the prompt. so even though the token at n-1 was being edited when what the user actually wanted was to edit the token at n, it nevertheless still had some non-negligible effect, in roughly the right direction, often enough that it seemed like it was working properly. * refactor common CrossAttention stuff into a mixin so that the old ldm code can still work if necessary * inpainting for the normal model. I think it works this time. * diffusers: reset num_vectors_per_token sync with 44a00555718f1df173c60da0ed646cf700e29537 * diffusers: txt2img2img (hires_fix) with so much slicing and dicing of pipeline methods to stitch them together * refactor(diffusers): reduce some code duplication amongst the different tasks * fixup! refactor(diffusers): reduce some code duplication amongst the different tasks * diffusers: enable DPMSolver++ scheduler * diffusers: upgrade to diffusers 0.10, add Heun scheduler * diffusers(ModelCache): stopgap to make from_cpu compatible with diffusers * CI: default to diffusers-1.5 now that runwayml token requirement is gone * diffusers: update to 0.10 (and transformers to 4.25) * diffusers: use xformers when available diffusers no longer auto-enables this as of 0.10.2. * diffusers: make masked img2img behave better with multi-step schedulers re-randomizing the noise each step was confusing them. * diffusers: work more better with more models. fixed relative path problem with local models. fixed models on hub not always having a `fp16` branch. * diffusers: stopgap fix for attention_maps_callback crash after recent merge * fixup import merge conflicts correction for 061c5369a2247c6c92cd69606bcf54c4f1962a0b * test: add tests/inpainting inputs for masked img2img * diffusers(AddsMaskedGuidance): partial fix for k-schedulers Prevents them from crashing, but results are still hot garbage. * fix --safety_checker arg parsing and add note to diffusers loader about where safety checker gets called * generate: fix import error * CI: don't try to read the old init location * diffusers: support loading an alternate VAE * CI: remove sh-syntax if-statement so it doesn't crash powershell * CI: fold strings in yaml because backslash is not line-continuation in powershell * attention maps callback stuff for diffusers * build: fix syntax error in environment-mac * diffusers: add INITIAL_MODELS with diffusers-compatible repos * re-enable the embedding manager; closes #1778 * Squashed commit of the following: commit e4a956abc37fcb5cf188388b76b617bc5c8fda7d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:43:07 2022 +0100 import new load handling from EmbeddingManager and cleanup commit c4abe91a5ba0d415b45bf734068385668b7a66e6 Merge: 032e856e 1efc6397 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:09:53 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers_with_textual_inversion_manager commit 032e856eefb3bbc39534f5daafd25764bcfcef8b Merge: 8b4f0fe9 bc515e24 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:08:01 2022 +0100 Merge remote-tracking branch 'upstream/dev/diffusers' into dev/diffusers_with_textual_inversion_manager commit 1efc6397fc6e61c1aff4b0258b93089d61de5955 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:04:28 2022 +0100 cleanup and add performance notes commit e400f804ac471a0ca2ba432fd658778b20c7bdab Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:45:07 2022 +0100 fix bug and update unit tests commit deb9ae0ae1016750e93ce8275734061f7285a231 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:28:29 2022 +0100 textual inversion manager seems to work commit 162e02505dec777e91a983c4d0fb52e950d25ff0 Merge: cbad4583 12769b3d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:58:03 2022 +0100 Merge branch 'main' into feature_textual_inversion_mgr commit cbad45836c6aace6871a90f2621a953f49433131 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:54:10 2022 +0100 use position embeddings commit 070344c69b0e0db340a183857d0a787b348681d3 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:53:47 2022 +0100 Don't crash CLI on exceptions commit b035ac8c6772dfd9ba41b8eeb9103181cda028f8 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:11:55 2022 +0100 add missing position_embeddings commit 12769b3d3562ef71e0f54946b532ad077e10043c Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:33:25 2022 +0100 debugging why it don't work commit bafb7215eabe1515ca5e8388fd3bb2f3ac5362cf Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:21:33 2022 +0100 debugging why it don't work commit 664a6e9e146b42d96703f0cc8baf8f5efec04ee1 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit 8b4f0fe9d6e4e2643b36dfa27864294785d7ba4e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit ffbe1ab11163ba712e353d89404e301d0e0c6cdf Merge: 6e4dad60 023df37e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:37:31 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers commit 023df37efffa67434f77def7fc3c9dfb29f699fd Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:36:54 2022 +0100 cleanup commit 05fac594eaf79d0058e3c48deee93df603f136c2 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:07:49 2022 +0100 tweak error checking commit 009f32ed39a7280997c3ffab112adadee0b44279 Author: damian <null@damianstewart.com> Date: Thu Dec 15 21:29:47 2022 +0100 unit tests passing for embeddings with vector length >1 commit beb1b08d9a98112ed2fe073580568e1a18698da3 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:39:09 2022 +0100 more explicit equality tests when overwriting commit 44d8a5a7c85cdabc9ce3a54fd0769a10597b3ca9 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:30:13 2022 +0100 wip textual inversion manager (unit tests passing for 1v embedding overwriting) commit 417c2b57d90924a839616bfb66804faab8039e4c Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 12:30:55 2022 +0100 wip textual inversion manager (unit tests passing for base stuff + padding) commit 2e80872e3b6f7fd7d8eb8928822bd824b63cb2ff Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 10:57:57 2022 +0100 wip new TextualInversionManager * stop using WeightedFrozenCLIPEmbedder * store diffusion models locally - configure_invokeai.py reconfigured to store diffusion models rather than CompVis models - hugging face caching model is used, but cache is set to ~/invokeai/models/repo_id - models.yaml does **NOT** use path, just repo_id - "repo_name" changed to "repo_id" to following hugging face conventions - Models are loaded with full precision pending further work. * allow non-local files during development * path takes priority over repo_id * MVP for model_cache and configure_invokeai - Feature complete (almost) - configure_invokeai.py downloads both .ckpt and diffuser models, along with their VAEs. Both types of download are controlled by a unified INITIAL_MODELS.yaml file. - model_cache can load both type of model and switches back and forth in CPU. No memory leaks detected TO DO: 1. I have not yet turned on the LocalOnly flag for diffuser models, so the code will check the Hugging Face repo for updates before using the locally cached models. This will break firewalled systems. I am thinking of putting in a global check for internet connectivity at startup time and setting the LocalOnly flag based on this. It would be good to check updates if there is connectivity. 2. I have not gone completely through INITIAL_MODELS.yaml to check which models are available as diffusers and which are not. So models like PaperCut and VoxelArt may not load properly. The runway and stability models are checked, as well as the Trinart models. 3. Add stanzas for SD 2.0 and 2.1 in INITIAL_MODELS.yaml REMAINING PROBLEMS NOT DIRECTLY RELATED TO MODEL_CACHE: 1. When loading a .ckpt file there are lots of messages like this: Warning! ldm.modules.attention.CrossAttention is no longer being maintained. Please use InvokeAICrossAttention instead. I'm not sure how to address this. 2. The ckpt models ***don't actually run*** due to the lack of special-case support for them in the generator objects. For example, here's the hard crash you get when you run txt2img against the legacy waifu-diffusion-1.3 model: ``` >> An error occurred: Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 140, in main main_loop(gen, opt) File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 371, in main_loop gen.prompt2image( File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1265, in __getattr__ raise AttributeError("'{}' object has no attribute '{}'".format( AttributeError: 'LatentDiffusion' object has no attribute 'image_from_embeddings' ``` 3. The inpainting diffusion model isn't working. Here's the output of "banana sushi" when inpainting-1.5 is loaded: ``` Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 301, in image_from_embeddings result_latents, result_attention_map_saver = self.latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 330, in latents_from_embeddings result: PipelineIntermediateState = infer_latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 185, in __call__ for result in self.generator_method(*args, **kwargs): File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 367, in generate_latents_from_embeddings step_output = self.step(batched_t, latents, guidance_scale, File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context return func(*args, **kwargs) File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 409, in step step_output = self.scheduler.step(noise_pred, timestep, latents, **extra_step_kwargs) File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/diffusers/schedulers/scheduling_lms_discrete.py", line 223, in step pred_original_sample = sample - sigma * model_output RuntimeError: The size of tensor a (9) must match the size of tensor b (4) at non-singleton dimension 1 ``` * proper support for float32/float16 - configure script now correctly detects user's preference for fp16/32 and downloads the correct diffuser version. If fp16 version not available, falls back to fp32 version. - misc code cleanup and simplification in model_cache * add on-the-fly conversion of .ckpt to diffusers models 1. On-the-fly conversion code can be found in the file ldm/invoke/ckpt_to_diffusers.py. 2. A new !optimize command has been added to the CLI. Should be ported to Web GUI. User experience on the CLI is this: ``` invoke> !optimize /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt INFO: Converting legacy weights file /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt to optimized diffuser model. This operation will take 30-60s to complete. Success. Optimized model is now located at /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 Writing new config file entry for sd-v1-4... >> New configuration: sd-v1-4: description: Optimized version of sd-v1-4 format: diffusers path: /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 OK to import [n]? y >> Verifying that new model loads... >> Current VRAM usage: 2.60G >> Offloading stable-diffusion-2.1 to CPU >> Loading diffusers model from /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 | Using faster float16 precision You have disabled the safety checker for <class 'ldm.invoke.generator.diffusers_pipeline.StableDiffusionGeneratorPipeline'> by passing `safety_checker=None`. Ensure that you abide to the conditions of the Stable Diffusion \ license and do not expose unfiltered results in services or applications open to the public. Both the diffusers team and Hugging Face strongly recommend to keep the safety filter enabled in all public facing circumstances,\ disabling it only for use-cases that involve analyzing network behavior or auditing its results. For more information, please have a look at https://github.com/huggingface/diffusers/pull/254 . | training width x height = (512 x 512) >> Model loaded in 3.48s >> Max VRAM used to load the model: 2.17G >> Current VRAM usage:2.17G >> Textual inversions available: >> Setting Sampler to k_lms (LMSDiscreteScheduler) Keep model loaded? [y] ``` * add parallel set of generator files for ckpt legacy generation * generation using legacy ckpt models now working * diffusers: fix missing attention_maps_callback fix for 23eb80b40421b2bb8f4b6d3dd30490d11c447b36 * associate legacy CrossAttention with .ckpt models * enable autoconvert New --autoconvert CLI option will scan a designated directory for new .ckpt files, convert them into diffuser models, and import them into models.yaml. Works like this: invoke.py --autoconvert /path/to/weights/directory In ModelCache added two new methods: autoconvert_weights(config_path, weights_directory_path, models_directory_path) convert_and_import(ckpt_path, diffuser_path) * diffusers: update to diffusers 0.11 (from 0.10.2) * fix vae loading & width/height calculation * refactor: encapsulate these conditioning data into one container * diffusers: fix some noise-scaling issues by pushing the noise-mixing down to the common function * add support for safetensors and accelerate * set local_files_only when internet unreachable * diffusers: fix error-handling path when model repo has no fp16 branch * fix generatorinpaint error Fixes : "ModuleNotFoundError: No module named 'ldm.invoke.generatorinpaint' https://github.com/invoke-ai/InvokeAI/pull/1583#issuecomment-1363634318 * quench diffuser safety-checker warning * diffusers: support stochastic DDIM eta parameter * fix conda env creation on macos * fix cross-attention with diffusers 0.11 * diffusers: the VAE needs to be tiling as well as the U-Net * diffusers: comment on subfolders * diffusers: embiggen! * diffusers: make model_cache.list_models serializable * diffusers(inpaint): restore scaling functionality * fix requirements clash between numba and numpy 1.24 * diffusers: allow inpainting model to do non-inpainting tasks * start expanding model_cache functionality * add import_ckpt_model() and import_diffuser_model() methods to model_manager - in addition, model_cache.py is now renamed to model_manager.py * allow "recommended" flag to be optional in INITIAL_MODELS.yaml * configure_invokeai now downloads VAE diffusers in advance * rename ModelCache to ModelManager * remove support for `repo_name` in models.yaml * check for and refuse to load embeddings trained on incompatible models * models.yaml.example: s/repo_name/repo_id and remove extra INITIAL_MODELS now that the main one has diffusers models in it. * add MVP textual inversion script * refactor(InvokeAIDiffuserComponent): factor out _combine() * InvokeAIDiffuserComponent: implement threshold * InvokeAIDiffuserComponent: diagnostic logs for threshold ...this does not look right * add a curses-based frontend to textual inversion - not quite working yet - requires npyscreen installed - on windows will also have the windows-curses requirement, but not added to requirements yet * add curses-based interface for textual inversion * fix crash in convert_and_import() - This corrects a "local variable referenced before assignment" error in model_manager.convert_and_import() * potential workaround for no 'state_dict' key error - As reported in https://github.com/huggingface/diffusers/issues/1876 * create TI output dir if needed * Update environment-lin-cuda.yml (#2159) Fixing line 42 to be the proper order to define the transformers requirement: ~= instead of =~ * diffusers: update sampler-to-scheduler mapping based on https://github.com/huggingface/diffusers/issues/277#issuecomment-1371428672 * improve user exp for ckt to diffusers conversion - !optimize_models command now operates on an existing ckpt file entry in models.yaml - replaces existing entry, rather than adding a new one - offers to delete the ckpt file after conversion * web: adapt progress callback to deal with old generator or new diffusers pipeline * clean-up model_manager code - add_model() verified to work for .ckpt local paths, .ckpt remote URLs, diffusers local paths, and diffusers repo_ids - convert_and_import() verified to work for local and remove .ckpt files * handle edge cases for import_model() and convert_model() * add support for safetensor .ckpt files * fix name error * code cleanup with pyflake * improve model setting behavior - If the user enters an invalid model name at startup time, will not try to load it, warn, and use default model - CLI UI enhancement: include currently active model in the command line prompt. * update test-invoke-pip.yml - fix model cache path to point to runwayml/stable-diffusion-v1-5 - remove `skip-sd-weights` from configure_invokeai.py args * exclude dev/diffusers from "fail for draft PRs" * disable "fail on PR jobs" * re-add `--skip-sd-weights` since no space * update workflow environments - include `INVOKE_MODEL_RECONFIGURE: '--yes'` * clean up model load failure handling - Allow CLI to run even when no model is defined or loadable. - Inhibit stack trace when model load fails - only show last error - Give user *option* to run configure_invokeai.py when no models successfully load. - Restart invokeai after reconfiguration. * further edge-case handling 1) only one model in models.yaml file, and that model is broken 2) no models in models.yaml 3) models.yaml doesn't exist at all * fix incorrect model status listing - "cached" was not being returned from list_models() - normalize handling of exceptions during model loading: - Passing an invalid model name to generate.set_model() will return a KeyError - All other exceptions are returned as the appropriate Exception * CI: do download weights (if not already cached) * diffusers: fix scheduler loading in offline mode * CI: fix model name (no longer has `diffusers-` prefix) * Update txt2img2img.py (#2256) * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * feat - make model storage compatible with hugging face caching system This commit alters the InvokeAI model directory to be compatible with hugging face, making it easier to share diffusers (and other models) across different programs. - If the HF_HOME environment variable is not set, then models are cached in ~/invokeai/models in a format that is identical to the HuggingFace cache. - If HF_HOME is set, then models are cached wherever HF_HOME points. - To enable sharing with other HuggingFace library clients, set HF_HOME to ~/.cache/huggingface to set the default cache location or to ~/invokeai/models to have huggingface cache inside InvokeAI. * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * fix error "no attribute CkptInpaint" * model_manager.list_models() returns entire model config stanza+status * Initial Draft - Model Manager Diffusers * added hash function to diffusers * implement sha256 hashes on diffusers models * Add Model Manager Support for Diffusers * fix various problems with model manager - in cli import functions, fix not enough values to unpack from _get_name_and_desc() - fix crash when using old-style vae: value with new-style diffuser * rebuild frontend * fix dictconfig-not-serializable issue * fix NoneType' object is not subscriptable crash in model_manager * fix "str has no attribute get" error in model_manager list_models() * Add path and repo_id support for Diffusers Model Manager Also fixes bugs * Fix tooltip IT localization not working * Add Version Number To WebUI * Optimize Model Search * Fix incorrect font on the Model Manager UI * Fix image degradation on merge fixes - [Experimental] This change should effectively fix a couple of things. - Fix image degradation on subsequent merges of the canvas layers. - Fix the slight transparent border that is left behind when filling the bounding box with a color. - Fix the left over line of color when filling a bounding box with color. So far there are no side effects for this. If any, please report. * Add local model filtering for Diffusers / Checkpoints * Go to home on modal close for the Add Modal UI * Styling Fixes * Model Manager Diffusers Localization Update * Add Safe Tensor scanning to Model Manager * Fix model edit form dispatching string values instead of numbers. * Resolve VAE handling / edge cases for supplied repos * defer injecting tokens for textual inversions until they're used for the first time * squash a console warning * implement model migration check * add_model() overwrites previous config rather than merges * fix model config file attribute merging * fix precision handling in textual inversion script * allow ckpt conversion script to work with safetensors .ckpts Applied patch here: https://github.com/huggingface/diffusers/commit/beb932c5d111872c5e45387e7b1b2b3dd0524a47 * fix name "args" is not defined crash in textual_inversion_training * fix a second NameError: name 'args' is not defined crash * fix loading of the safety checker from the global cache dir * add installation step to textual inversion frontend - After a successful training run, the script will copy learned_embeds.bin to a subfolder of the embeddings directory. - User given the option to delete the logs and intermediate checkpoints (which together use 7-8G of space) - If textual inversion training fails, reports the error gracefully. * don't crash out on incompatible embeddings - put try: blocks around places where the system tries to load an embedding which is incompatible with the currently loaded model * add support for checkpoint resuming * textual inversion preferences are saved and restored between sessions - Preferences are stored in a file named text-inversion-training/preferences.conf - Currently the resume-from-checkpoint option is not working correctly. Possible bug in textual_inversion_training.py? * copy learned_embeddings.bin into right location * add front end for diffusers model merging - Front end doesn't do anything yet!!!! - Made change to model name parsing in CLI to support ability to have merged models with the "+" character in their names. * improve inpainting experience - recommend ckpt version of inpainting-1.5 to user - fix get_noise() bug in ckpt version of omnibus.py * update environment*yml * tweak instructions to install HuggingFace token * bump version number * enhance update scripts - update scripts will now fetch new INITIAL_MODELS.yaml so that configure_invokeai.py will know about the diffusers versions. * enhance invoke.sh/invoke.bat launchers - added configure_invokeai.py to menu - menu defaults to browser-based invoke * remove conda workflow (#2321) * fix `token_ids has shape torch.Size([79]) - expected [77]` * update CHANGELOG.md with 2.3.* info - Add information on how formats have changed and the upgrade process. - Add short bug list. Co-authored-by: Damian Stewart <d@damianstewart.com> Co-authored-by: Damian Stewart <null@damianstewart.com> Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> Co-authored-by: Wybartel-luxmc <37852506+Wybartel-luxmc@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> Co-authored-by: mickr777 <115216705+mickr777@users.noreply.github.com> Co-authored-by: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Co-authored-by: Eugene Brodsky <ebr@users.noreply.github.com> Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com>
2023-01-15 14:22:46 +00:00
return self._load_generator('.inpaint','Inpaint')
def _make_omnibus(self):
use 🧨diffusers model (#1583) * initial commit of DiffusionPipeline class * spike: proof of concept using diffusers for txt2img * doc: type hints for Generator * refactor(model_cache): factor out load_ckpt * model_cache: add ability to load a diffusers model pipeline and update associated things in Generate & Generator to not instantly fail when that happens * model_cache: fix model default image dimensions * txt2img: support switching diffusers schedulers * diffusers: let the scheduler do its scaling of the initial latents Remove IPNDM scheduler; it is not behaving. * web server: update image_progress callback for diffusers data * diffusers: restore prompt weighting feature * diffusers: fix set-sampler error following model switch * diffusers: use InvokeAIDiffuserComponent for conditioning * cross_attention_control: stub (no-op) implementations for diffusers * model_cache: let offload_model work with DiffusionPipeline, sorta. * models.yaml.example: add diffusers-format model, set as default * test-invoke-conda: use diffusers-format model test-invoke-conda: put huggingface-token where the library can use it * environment-mac: upgrade to diffusers 0.7 (from 0.6) this was already done for linux; mac must have been lost in the merge. * preload_models: explicitly load diffusers models In non-interactive mode too, as long as you're logged in. * fix(model_cache): don't check `model.config` in diffusers format clean-up from recent merge. * diffusers integration: support img2img * dev: upgrade to diffusers 0.8 (from 0.7.1) We get to remove some code by using methods that were factored out in the base class. * refactor: remove backported img2img.get_timesteps now that we can use it directly from diffusers 0.8.1 * ci: use diffusers model * dev: upgrade to diffusers 0.9 (from 0.8.1) * lint: correct annotations for Python 3.9. * lint: correct AttributeError.name reference for Python 3.9. * CI: prefer diffusers-1.4 because it no longer requires a token The RunwayML models still do. * build: there's yet another place to update requirements? * configure: try to download models even without token Models in the CompVis and stabilityai repos no longer require them. (But runwayml still does.) * configure: add troubleshooting info for config-not-found * fix(configure): prepend root to config path * fix(configure): remove second `default: true` from models example * CI: simplify test-on-push logic now that we don't need secrets The "test on push but only in forks" logic was only necessary when tests didn't work for PRs-from-forks. * create an embedding_manager for diffusers * internal: avoid importing diffusers DummyObject see https://github.com/huggingface/diffusers/issues/1479 * fix "config attributes…not expected" diffusers warnings. * fix deprecated scheduler construction * work around an apparent MPS torch bug that causes conditioning to have no effect * 🚧 post-rebase repair * preliminary support for outpainting (no masking yet) * monkey-patch diffusers.attention and use Invoke lowvram code * add always_use_cpu arg to bypass MPS * add cross-attention control support to diffusers (fails on MPS) For unknown reasons MPS produces garbage output with .swap(). Use --always_use_cpu arg to invoke.py for now to test this code on MPS. * diffusers support for the inpainting model * fix debug_image to not crash with non-RGB images. * inpainting for the normal model [WIP] This seems to be performing well until the LAST STEP, at which point it dissolves to confetti. * fix off-by-one bug in cross-attention-control (#1774) prompt token sequences begin with a "beginning-of-sequence" marker <bos> and end with a repeated "end-of-sequence" marker <eos> - to make a default prompt length of <bos> + 75 prompt tokens + <eos>. the .swap() code was failing to take the column for <bos> at index 0 into account. the changes here do that, and also add extra handling for a single <eos> (which may be redundant but which is included for completeness). based on my understanding and some assumptions about how this all works, the reason .swap() nevertheless seemed to do the right thing, to some extent, is because over multiple steps the conditioning process in Stable Diffusion operates as a feedback loop. a change to token n-1 has flow-on effects to how the [1x4x64x64] latent tensor is modified by all the tokens after it, - and as the next step is processed, all the tokens before it as well. intuitively, a token's conditioning effects "echo" throughout the whole length of the prompt. so even though the token at n-1 was being edited when what the user actually wanted was to edit the token at n, it nevertheless still had some non-negligible effect, in roughly the right direction, often enough that it seemed like it was working properly. * refactor common CrossAttention stuff into a mixin so that the old ldm code can still work if necessary * inpainting for the normal model. I think it works this time. * diffusers: reset num_vectors_per_token sync with 44a00555718f1df173c60da0ed646cf700e29537 * diffusers: txt2img2img (hires_fix) with so much slicing and dicing of pipeline methods to stitch them together * refactor(diffusers): reduce some code duplication amongst the different tasks * fixup! refactor(diffusers): reduce some code duplication amongst the different tasks * diffusers: enable DPMSolver++ scheduler * diffusers: upgrade to diffusers 0.10, add Heun scheduler * diffusers(ModelCache): stopgap to make from_cpu compatible with diffusers * CI: default to diffusers-1.5 now that runwayml token requirement is gone * diffusers: update to 0.10 (and transformers to 4.25) * diffusers: use xformers when available diffusers no longer auto-enables this as of 0.10.2. * diffusers: make masked img2img behave better with multi-step schedulers re-randomizing the noise each step was confusing them. * diffusers: work more better with more models. fixed relative path problem with local models. fixed models on hub not always having a `fp16` branch. * diffusers: stopgap fix for attention_maps_callback crash after recent merge * fixup import merge conflicts correction for 061c5369a2247c6c92cd69606bcf54c4f1962a0b * test: add tests/inpainting inputs for masked img2img * diffusers(AddsMaskedGuidance): partial fix for k-schedulers Prevents them from crashing, but results are still hot garbage. * fix --safety_checker arg parsing and add note to diffusers loader about where safety checker gets called * generate: fix import error * CI: don't try to read the old init location * diffusers: support loading an alternate VAE * CI: remove sh-syntax if-statement so it doesn't crash powershell * CI: fold strings in yaml because backslash is not line-continuation in powershell * attention maps callback stuff for diffusers * build: fix syntax error in environment-mac * diffusers: add INITIAL_MODELS with diffusers-compatible repos * re-enable the embedding manager; closes #1778 * Squashed commit of the following: commit e4a956abc37fcb5cf188388b76b617bc5c8fda7d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:43:07 2022 +0100 import new load handling from EmbeddingManager and cleanup commit c4abe91a5ba0d415b45bf734068385668b7a66e6 Merge: 032e856e 1efc6397 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:09:53 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers_with_textual_inversion_manager commit 032e856eefb3bbc39534f5daafd25764bcfcef8b Merge: 8b4f0fe9 bc515e24 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:08:01 2022 +0100 Merge remote-tracking branch 'upstream/dev/diffusers' into dev/diffusers_with_textual_inversion_manager commit 1efc6397fc6e61c1aff4b0258b93089d61de5955 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:04:28 2022 +0100 cleanup and add performance notes commit e400f804ac471a0ca2ba432fd658778b20c7bdab Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:45:07 2022 +0100 fix bug and update unit tests commit deb9ae0ae1016750e93ce8275734061f7285a231 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:28:29 2022 +0100 textual inversion manager seems to work commit 162e02505dec777e91a983c4d0fb52e950d25ff0 Merge: cbad4583 12769b3d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:58:03 2022 +0100 Merge branch 'main' into feature_textual_inversion_mgr commit cbad45836c6aace6871a90f2621a953f49433131 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:54:10 2022 +0100 use position embeddings commit 070344c69b0e0db340a183857d0a787b348681d3 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:53:47 2022 +0100 Don't crash CLI on exceptions commit b035ac8c6772dfd9ba41b8eeb9103181cda028f8 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:11:55 2022 +0100 add missing position_embeddings commit 12769b3d3562ef71e0f54946b532ad077e10043c Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:33:25 2022 +0100 debugging why it don't work commit bafb7215eabe1515ca5e8388fd3bb2f3ac5362cf Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:21:33 2022 +0100 debugging why it don't work commit 664a6e9e146b42d96703f0cc8baf8f5efec04ee1 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit 8b4f0fe9d6e4e2643b36dfa27864294785d7ba4e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit ffbe1ab11163ba712e353d89404e301d0e0c6cdf Merge: 6e4dad60 023df37e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:37:31 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers commit 023df37efffa67434f77def7fc3c9dfb29f699fd Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:36:54 2022 +0100 cleanup commit 05fac594eaf79d0058e3c48deee93df603f136c2 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:07:49 2022 +0100 tweak error checking commit 009f32ed39a7280997c3ffab112adadee0b44279 Author: damian <null@damianstewart.com> Date: Thu Dec 15 21:29:47 2022 +0100 unit tests passing for embeddings with vector length >1 commit beb1b08d9a98112ed2fe073580568e1a18698da3 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:39:09 2022 +0100 more explicit equality tests when overwriting commit 44d8a5a7c85cdabc9ce3a54fd0769a10597b3ca9 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:30:13 2022 +0100 wip textual inversion manager (unit tests passing for 1v embedding overwriting) commit 417c2b57d90924a839616bfb66804faab8039e4c Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 12:30:55 2022 +0100 wip textual inversion manager (unit tests passing for base stuff + padding) commit 2e80872e3b6f7fd7d8eb8928822bd824b63cb2ff Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 10:57:57 2022 +0100 wip new TextualInversionManager * stop using WeightedFrozenCLIPEmbedder * store diffusion models locally - configure_invokeai.py reconfigured to store diffusion models rather than CompVis models - hugging face caching model is used, but cache is set to ~/invokeai/models/repo_id - models.yaml does **NOT** use path, just repo_id - "repo_name" changed to "repo_id" to following hugging face conventions - Models are loaded with full precision pending further work. * allow non-local files during development * path takes priority over repo_id * MVP for model_cache and configure_invokeai - Feature complete (almost) - configure_invokeai.py downloads both .ckpt and diffuser models, along with their VAEs. Both types of download are controlled by a unified INITIAL_MODELS.yaml file. - model_cache can load both type of model and switches back and forth in CPU. No memory leaks detected TO DO: 1. I have not yet turned on the LocalOnly flag for diffuser models, so the code will check the Hugging Face repo for updates before using the locally cached models. This will break firewalled systems. I am thinking of putting in a global check for internet connectivity at startup time and setting the LocalOnly flag based on this. It would be good to check updates if there is connectivity. 2. I have not gone completely through INITIAL_MODELS.yaml to check which models are available as diffusers and which are not. So models like PaperCut and VoxelArt may not load properly. The runway and stability models are checked, as well as the Trinart models. 3. Add stanzas for SD 2.0 and 2.1 in INITIAL_MODELS.yaml REMAINING PROBLEMS NOT DIRECTLY RELATED TO MODEL_CACHE: 1. When loading a .ckpt file there are lots of messages like this: Warning! ldm.modules.attention.CrossAttention is no longer being maintained. Please use InvokeAICrossAttention instead. I'm not sure how to address this. 2. The ckpt models ***don't actually run*** due to the lack of special-case support for them in the generator objects. For example, here's the hard crash you get when you run txt2img against the legacy waifu-diffusion-1.3 model: ``` >> An error occurred: Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 140, in main main_loop(gen, opt) File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 371, in main_loop gen.prompt2image( File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1265, in __getattr__ raise AttributeError("'{}' object has no attribute '{}'".format( AttributeError: 'LatentDiffusion' object has no attribute 'image_from_embeddings' ``` 3. The inpainting diffusion model isn't working. Here's the output of "banana sushi" when inpainting-1.5 is loaded: ``` Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 301, in image_from_embeddings result_latents, result_attention_map_saver = self.latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 330, in latents_from_embeddings result: PipelineIntermediateState = infer_latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 185, in __call__ for result in self.generator_method(*args, **kwargs): File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 367, in generate_latents_from_embeddings step_output = self.step(batched_t, latents, guidance_scale, File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context return func(*args, **kwargs) File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 409, in step step_output = self.scheduler.step(noise_pred, timestep, latents, **extra_step_kwargs) File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/diffusers/schedulers/scheduling_lms_discrete.py", line 223, in step pred_original_sample = sample - sigma * model_output RuntimeError: The size of tensor a (9) must match the size of tensor b (4) at non-singleton dimension 1 ``` * proper support for float32/float16 - configure script now correctly detects user's preference for fp16/32 and downloads the correct diffuser version. If fp16 version not available, falls back to fp32 version. - misc code cleanup and simplification in model_cache * add on-the-fly conversion of .ckpt to diffusers models 1. On-the-fly conversion code can be found in the file ldm/invoke/ckpt_to_diffusers.py. 2. A new !optimize command has been added to the CLI. Should be ported to Web GUI. User experience on the CLI is this: ``` invoke> !optimize /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt INFO: Converting legacy weights file /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt to optimized diffuser model. This operation will take 30-60s to complete. Success. Optimized model is now located at /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 Writing new config file entry for sd-v1-4... >> New configuration: sd-v1-4: description: Optimized version of sd-v1-4 format: diffusers path: /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 OK to import [n]? y >> Verifying that new model loads... >> Current VRAM usage: 2.60G >> Offloading stable-diffusion-2.1 to CPU >> Loading diffusers model from /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 | Using faster float16 precision You have disabled the safety checker for <class 'ldm.invoke.generator.diffusers_pipeline.StableDiffusionGeneratorPipeline'> by passing `safety_checker=None`. Ensure that you abide to the conditions of the Stable Diffusion \ license and do not expose unfiltered results in services or applications open to the public. Both the diffusers team and Hugging Face strongly recommend to keep the safety filter enabled in all public facing circumstances,\ disabling it only for use-cases that involve analyzing network behavior or auditing its results. For more information, please have a look at https://github.com/huggingface/diffusers/pull/254 . | training width x height = (512 x 512) >> Model loaded in 3.48s >> Max VRAM used to load the model: 2.17G >> Current VRAM usage:2.17G >> Textual inversions available: >> Setting Sampler to k_lms (LMSDiscreteScheduler) Keep model loaded? [y] ``` * add parallel set of generator files for ckpt legacy generation * generation using legacy ckpt models now working * diffusers: fix missing attention_maps_callback fix for 23eb80b40421b2bb8f4b6d3dd30490d11c447b36 * associate legacy CrossAttention with .ckpt models * enable autoconvert New --autoconvert CLI option will scan a designated directory for new .ckpt files, convert them into diffuser models, and import them into models.yaml. Works like this: invoke.py --autoconvert /path/to/weights/directory In ModelCache added two new methods: autoconvert_weights(config_path, weights_directory_path, models_directory_path) convert_and_import(ckpt_path, diffuser_path) * diffusers: update to diffusers 0.11 (from 0.10.2) * fix vae loading & width/height calculation * refactor: encapsulate these conditioning data into one container * diffusers: fix some noise-scaling issues by pushing the noise-mixing down to the common function * add support for safetensors and accelerate * set local_files_only when internet unreachable * diffusers: fix error-handling path when model repo has no fp16 branch * fix generatorinpaint error Fixes : "ModuleNotFoundError: No module named 'ldm.invoke.generatorinpaint' https://github.com/invoke-ai/InvokeAI/pull/1583#issuecomment-1363634318 * quench diffuser safety-checker warning * diffusers: support stochastic DDIM eta parameter * fix conda env creation on macos * fix cross-attention with diffusers 0.11 * diffusers: the VAE needs to be tiling as well as the U-Net * diffusers: comment on subfolders * diffusers: embiggen! * diffusers: make model_cache.list_models serializable * diffusers(inpaint): restore scaling functionality * fix requirements clash between numba and numpy 1.24 * diffusers: allow inpainting model to do non-inpainting tasks * start expanding model_cache functionality * add import_ckpt_model() and import_diffuser_model() methods to model_manager - in addition, model_cache.py is now renamed to model_manager.py * allow "recommended" flag to be optional in INITIAL_MODELS.yaml * configure_invokeai now downloads VAE diffusers in advance * rename ModelCache to ModelManager * remove support for `repo_name` in models.yaml * check for and refuse to load embeddings trained on incompatible models * models.yaml.example: s/repo_name/repo_id and remove extra INITIAL_MODELS now that the main one has diffusers models in it. * add MVP textual inversion script * refactor(InvokeAIDiffuserComponent): factor out _combine() * InvokeAIDiffuserComponent: implement threshold * InvokeAIDiffuserComponent: diagnostic logs for threshold ...this does not look right * add a curses-based frontend to textual inversion - not quite working yet - requires npyscreen installed - on windows will also have the windows-curses requirement, but not added to requirements yet * add curses-based interface for textual inversion * fix crash in convert_and_import() - This corrects a "local variable referenced before assignment" error in model_manager.convert_and_import() * potential workaround for no 'state_dict' key error - As reported in https://github.com/huggingface/diffusers/issues/1876 * create TI output dir if needed * Update environment-lin-cuda.yml (#2159) Fixing line 42 to be the proper order to define the transformers requirement: ~= instead of =~ * diffusers: update sampler-to-scheduler mapping based on https://github.com/huggingface/diffusers/issues/277#issuecomment-1371428672 * improve user exp for ckt to diffusers conversion - !optimize_models command now operates on an existing ckpt file entry in models.yaml - replaces existing entry, rather than adding a new one - offers to delete the ckpt file after conversion * web: adapt progress callback to deal with old generator or new diffusers pipeline * clean-up model_manager code - add_model() verified to work for .ckpt local paths, .ckpt remote URLs, diffusers local paths, and diffusers repo_ids - convert_and_import() verified to work for local and remove .ckpt files * handle edge cases for import_model() and convert_model() * add support for safetensor .ckpt files * fix name error * code cleanup with pyflake * improve model setting behavior - If the user enters an invalid model name at startup time, will not try to load it, warn, and use default model - CLI UI enhancement: include currently active model in the command line prompt. * update test-invoke-pip.yml - fix model cache path to point to runwayml/stable-diffusion-v1-5 - remove `skip-sd-weights` from configure_invokeai.py args * exclude dev/diffusers from "fail for draft PRs" * disable "fail on PR jobs" * re-add `--skip-sd-weights` since no space * update workflow environments - include `INVOKE_MODEL_RECONFIGURE: '--yes'` * clean up model load failure handling - Allow CLI to run even when no model is defined or loadable. - Inhibit stack trace when model load fails - only show last error - Give user *option* to run configure_invokeai.py when no models successfully load. - Restart invokeai after reconfiguration. * further edge-case handling 1) only one model in models.yaml file, and that model is broken 2) no models in models.yaml 3) models.yaml doesn't exist at all * fix incorrect model status listing - "cached" was not being returned from list_models() - normalize handling of exceptions during model loading: - Passing an invalid model name to generate.set_model() will return a KeyError - All other exceptions are returned as the appropriate Exception * CI: do download weights (if not already cached) * diffusers: fix scheduler loading in offline mode * CI: fix model name (no longer has `diffusers-` prefix) * Update txt2img2img.py (#2256) * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * feat - make model storage compatible with hugging face caching system This commit alters the InvokeAI model directory to be compatible with hugging face, making it easier to share diffusers (and other models) across different programs. - If the HF_HOME environment variable is not set, then models are cached in ~/invokeai/models in a format that is identical to the HuggingFace cache. - If HF_HOME is set, then models are cached wherever HF_HOME points. - To enable sharing with other HuggingFace library clients, set HF_HOME to ~/.cache/huggingface to set the default cache location or to ~/invokeai/models to have huggingface cache inside InvokeAI. * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * fix error "no attribute CkptInpaint" * model_manager.list_models() returns entire model config stanza+status * Initial Draft - Model Manager Diffusers * added hash function to diffusers * implement sha256 hashes on diffusers models * Add Model Manager Support for Diffusers * fix various problems with model manager - in cli import functions, fix not enough values to unpack from _get_name_and_desc() - fix crash when using old-style vae: value with new-style diffuser * rebuild frontend * fix dictconfig-not-serializable issue * fix NoneType' object is not subscriptable crash in model_manager * fix "str has no attribute get" error in model_manager list_models() * Add path and repo_id support for Diffusers Model Manager Also fixes bugs * Fix tooltip IT localization not working * Add Version Number To WebUI * Optimize Model Search * Fix incorrect font on the Model Manager UI * Fix image degradation on merge fixes - [Experimental] This change should effectively fix a couple of things. - Fix image degradation on subsequent merges of the canvas layers. - Fix the slight transparent border that is left behind when filling the bounding box with a color. - Fix the left over line of color when filling a bounding box with color. So far there are no side effects for this. If any, please report. * Add local model filtering for Diffusers / Checkpoints * Go to home on modal close for the Add Modal UI * Styling Fixes * Model Manager Diffusers Localization Update * Add Safe Tensor scanning to Model Manager * Fix model edit form dispatching string values instead of numbers. * Resolve VAE handling / edge cases for supplied repos * defer injecting tokens for textual inversions until they're used for the first time * squash a console warning * implement model migration check * add_model() overwrites previous config rather than merges * fix model config file attribute merging * fix precision handling in textual inversion script * allow ckpt conversion script to work with safetensors .ckpts Applied patch here: https://github.com/huggingface/diffusers/commit/beb932c5d111872c5e45387e7b1b2b3dd0524a47 * fix name "args" is not defined crash in textual_inversion_training * fix a second NameError: name 'args' is not defined crash * fix loading of the safety checker from the global cache dir * add installation step to textual inversion frontend - After a successful training run, the script will copy learned_embeds.bin to a subfolder of the embeddings directory. - User given the option to delete the logs and intermediate checkpoints (which together use 7-8G of space) - If textual inversion training fails, reports the error gracefully. * don't crash out on incompatible embeddings - put try: blocks around places where the system tries to load an embedding which is incompatible with the currently loaded model * add support for checkpoint resuming * textual inversion preferences are saved and restored between sessions - Preferences are stored in a file named text-inversion-training/preferences.conf - Currently the resume-from-checkpoint option is not working correctly. Possible bug in textual_inversion_training.py? * copy learned_embeddings.bin into right location * add front end for diffusers model merging - Front end doesn't do anything yet!!!! - Made change to model name parsing in CLI to support ability to have merged models with the "+" character in their names. * improve inpainting experience - recommend ckpt version of inpainting-1.5 to user - fix get_noise() bug in ckpt version of omnibus.py * update environment*yml * tweak instructions to install HuggingFace token * bump version number * enhance update scripts - update scripts will now fetch new INITIAL_MODELS.yaml so that configure_invokeai.py will know about the diffusers versions. * enhance invoke.sh/invoke.bat launchers - added configure_invokeai.py to menu - menu defaults to browser-based invoke * remove conda workflow (#2321) * fix `token_ids has shape torch.Size([79]) - expected [77]` * update CHANGELOG.md with 2.3.* info - Add information on how formats have changed and the upgrade process. - Add short bug list. Co-authored-by: Damian Stewart <d@damianstewart.com> Co-authored-by: Damian Stewart <null@damianstewart.com> Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> Co-authored-by: Wybartel-luxmc <37852506+Wybartel-luxmc@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> Co-authored-by: mickr777 <115216705+mickr777@users.noreply.github.com> Co-authored-by: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Co-authored-by: Eugene Brodsky <ebr@users.noreply.github.com> Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com>
2023-01-15 14:22:46 +00:00
return self._load_generator('.omnibus','Omnibus')
def _load_generator(self, module, class_name):
if self.is_legacy_model(self.model_name):
mn = f'ldm.invoke.ckpt_generator{module}'
cn = f'Ckpt{class_name}'
else:
mn = f'ldm.invoke.generator{module}'
cn = class_name
module = importlib.import_module(mn)
constructor = getattr(module,cn)
return constructor(self.model, self.precision)
Refactoring simplet2i (#387) * start refactoring -not yet functional * first phase of refactor done - not sure weighted prompts working * Second phase of refactoring. Everything mostly working. * The refactoring has moved all the hard-core inference work into ldm.dream.generator.*, where there are submodules for txt2img and img2img. inpaint will go in there as well. * Some additional refactoring will be done soon, but relatively minor work. * fix -save_orig flag to actually work * add @neonsecret attention.py memory optimization * remove unneeded imports * move token logging into conditioning.py * add placeholder version of inpaint; porting in progress * fix crash in img2img * inpainting working; not tested on variations * fix crashes in img2img * ported attention.py memory optimization #117 from basujindal branch * added @torch_no_grad() decorators to img2img, txt2img, inpaint closures * Final commit prior to PR against development * fixup crash when generating intermediate images in web UI * rename ldm.simplet2i to ldm.generate * add backward-compatibility simplet2i shell with deprecation warning * add back in mps exception, addresses @vargol comment in #354 * replaced Conditioning class with exported functions * fix wrong type of with_variations attribute during intialization * changed "image_iterator()" to "get_make_image()" * raise NotImplementedError for calling get_make_image() in parent class * Update ldm/generate.py better error message Co-authored-by: Kevin Gibbons <bakkot@gmail.com> * minor stylistic fixes and assertion checks from code review * moved get_noise() method into img2img class * break get_noise() into two methods, one for txt2img and the other for img2img * inpainting works on non-square images now * make get_noise() an abstract method in base class * much improved inpainting Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
2022-09-06 00:40:10 +00:00
def load_model(self):
enable fast switching between models in invoke.py - This PR enables two new commands in the invoke.py script !models -- list the available models and their cache status !switch <model> -- switch to the indicated model Example: invoke> !models laion400m not loaded Latent Diffusion LAION400M model stable-diffusion-1.4 active Stable Diffusion inference model version 1.4 waifu-1.3 cached Waifu anime model version 1.3 invoke> !switch waifu-1.3 >> Caching model stable-diffusion-1.4 in system RAM >> Retrieving model waifu-1.3 from system RAM cache The name and descriptions of the models are taken from `config/models.yaml`. A future enhancement to `model_cache.py` will be to enable new model stanzas to be added to the file programmatically. This will be useful for the WebGUI. More details: - Use fast switching algorithm described in PR #948 - Models are selected using their configuration stanza name given in models.yaml. - To avoid filling up CPU RAM with cached models, this PR implements an LRU cache that monitors available CPU RAM. - The caching code allows the minimum value of available RAM to be adjusted, but invoke.py does not currently have a command-line argument that allows you to set it. The minimum free RAM is arbitrarily set to 2 GB. - Add optional description field to configs/models.yaml Unrelated fixes: - Added ">>" to CompViz model loading messages in order to make user experience more consistent. - When generating an image greater than defaults, will only warn about possible VRAM filling the first time. - Fixed bug that was causing help message to be printed twice. This involved moving the import line for the web backend into the section where it is called. Coauthored by: @ArDiouscuros
2022-10-12 06:14:59 +00:00
'''
preload model identified in self.model_name
'''
use 🧨diffusers model (#1583) * initial commit of DiffusionPipeline class * spike: proof of concept using diffusers for txt2img * doc: type hints for Generator * refactor(model_cache): factor out load_ckpt * model_cache: add ability to load a diffusers model pipeline and update associated things in Generate & Generator to not instantly fail when that happens * model_cache: fix model default image dimensions * txt2img: support switching diffusers schedulers * diffusers: let the scheduler do its scaling of the initial latents Remove IPNDM scheduler; it is not behaving. * web server: update image_progress callback for diffusers data * diffusers: restore prompt weighting feature * diffusers: fix set-sampler error following model switch * diffusers: use InvokeAIDiffuserComponent for conditioning * cross_attention_control: stub (no-op) implementations for diffusers * model_cache: let offload_model work with DiffusionPipeline, sorta. * models.yaml.example: add diffusers-format model, set as default * test-invoke-conda: use diffusers-format model test-invoke-conda: put huggingface-token where the library can use it * environment-mac: upgrade to diffusers 0.7 (from 0.6) this was already done for linux; mac must have been lost in the merge. * preload_models: explicitly load diffusers models In non-interactive mode too, as long as you're logged in. * fix(model_cache): don't check `model.config` in diffusers format clean-up from recent merge. * diffusers integration: support img2img * dev: upgrade to diffusers 0.8 (from 0.7.1) We get to remove some code by using methods that were factored out in the base class. * refactor: remove backported img2img.get_timesteps now that we can use it directly from diffusers 0.8.1 * ci: use diffusers model * dev: upgrade to diffusers 0.9 (from 0.8.1) * lint: correct annotations for Python 3.9. * lint: correct AttributeError.name reference for Python 3.9. * CI: prefer diffusers-1.4 because it no longer requires a token The RunwayML models still do. * build: there's yet another place to update requirements? * configure: try to download models even without token Models in the CompVis and stabilityai repos no longer require them. (But runwayml still does.) * configure: add troubleshooting info for config-not-found * fix(configure): prepend root to config path * fix(configure): remove second `default: true` from models example * CI: simplify test-on-push logic now that we don't need secrets The "test on push but only in forks" logic was only necessary when tests didn't work for PRs-from-forks. * create an embedding_manager for diffusers * internal: avoid importing diffusers DummyObject see https://github.com/huggingface/diffusers/issues/1479 * fix "config attributes…not expected" diffusers warnings. * fix deprecated scheduler construction * work around an apparent MPS torch bug that causes conditioning to have no effect * 🚧 post-rebase repair * preliminary support for outpainting (no masking yet) * monkey-patch diffusers.attention and use Invoke lowvram code * add always_use_cpu arg to bypass MPS * add cross-attention control support to diffusers (fails on MPS) For unknown reasons MPS produces garbage output with .swap(). Use --always_use_cpu arg to invoke.py for now to test this code on MPS. * diffusers support for the inpainting model * fix debug_image to not crash with non-RGB images. * inpainting for the normal model [WIP] This seems to be performing well until the LAST STEP, at which point it dissolves to confetti. * fix off-by-one bug in cross-attention-control (#1774) prompt token sequences begin with a "beginning-of-sequence" marker <bos> and end with a repeated "end-of-sequence" marker <eos> - to make a default prompt length of <bos> + 75 prompt tokens + <eos>. the .swap() code was failing to take the column for <bos> at index 0 into account. the changes here do that, and also add extra handling for a single <eos> (which may be redundant but which is included for completeness). based on my understanding and some assumptions about how this all works, the reason .swap() nevertheless seemed to do the right thing, to some extent, is because over multiple steps the conditioning process in Stable Diffusion operates as a feedback loop. a change to token n-1 has flow-on effects to how the [1x4x64x64] latent tensor is modified by all the tokens after it, - and as the next step is processed, all the tokens before it as well. intuitively, a token's conditioning effects "echo" throughout the whole length of the prompt. so even though the token at n-1 was being edited when what the user actually wanted was to edit the token at n, it nevertheless still had some non-negligible effect, in roughly the right direction, often enough that it seemed like it was working properly. * refactor common CrossAttention stuff into a mixin so that the old ldm code can still work if necessary * inpainting for the normal model. I think it works this time. * diffusers: reset num_vectors_per_token sync with 44a00555718f1df173c60da0ed646cf700e29537 * diffusers: txt2img2img (hires_fix) with so much slicing and dicing of pipeline methods to stitch them together * refactor(diffusers): reduce some code duplication amongst the different tasks * fixup! refactor(diffusers): reduce some code duplication amongst the different tasks * diffusers: enable DPMSolver++ scheduler * diffusers: upgrade to diffusers 0.10, add Heun scheduler * diffusers(ModelCache): stopgap to make from_cpu compatible with diffusers * CI: default to diffusers-1.5 now that runwayml token requirement is gone * diffusers: update to 0.10 (and transformers to 4.25) * diffusers: use xformers when available diffusers no longer auto-enables this as of 0.10.2. * diffusers: make masked img2img behave better with multi-step schedulers re-randomizing the noise each step was confusing them. * diffusers: work more better with more models. fixed relative path problem with local models. fixed models on hub not always having a `fp16` branch. * diffusers: stopgap fix for attention_maps_callback crash after recent merge * fixup import merge conflicts correction for 061c5369a2247c6c92cd69606bcf54c4f1962a0b * test: add tests/inpainting inputs for masked img2img * diffusers(AddsMaskedGuidance): partial fix for k-schedulers Prevents them from crashing, but results are still hot garbage. * fix --safety_checker arg parsing and add note to diffusers loader about where safety checker gets called * generate: fix import error * CI: don't try to read the old init location * diffusers: support loading an alternate VAE * CI: remove sh-syntax if-statement so it doesn't crash powershell * CI: fold strings in yaml because backslash is not line-continuation in powershell * attention maps callback stuff for diffusers * build: fix syntax error in environment-mac * diffusers: add INITIAL_MODELS with diffusers-compatible repos * re-enable the embedding manager; closes #1778 * Squashed commit of the following: commit e4a956abc37fcb5cf188388b76b617bc5c8fda7d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:43:07 2022 +0100 import new load handling from EmbeddingManager and cleanup commit c4abe91a5ba0d415b45bf734068385668b7a66e6 Merge: 032e856e 1efc6397 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:09:53 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers_with_textual_inversion_manager commit 032e856eefb3bbc39534f5daafd25764bcfcef8b Merge: 8b4f0fe9 bc515e24 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:08:01 2022 +0100 Merge remote-tracking branch 'upstream/dev/diffusers' into dev/diffusers_with_textual_inversion_manager commit 1efc6397fc6e61c1aff4b0258b93089d61de5955 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:04:28 2022 +0100 cleanup and add performance notes commit e400f804ac471a0ca2ba432fd658778b20c7bdab Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:45:07 2022 +0100 fix bug and update unit tests commit deb9ae0ae1016750e93ce8275734061f7285a231 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:28:29 2022 +0100 textual inversion manager seems to work commit 162e02505dec777e91a983c4d0fb52e950d25ff0 Merge: cbad4583 12769b3d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:58:03 2022 +0100 Merge branch 'main' into feature_textual_inversion_mgr commit cbad45836c6aace6871a90f2621a953f49433131 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:54:10 2022 +0100 use position embeddings commit 070344c69b0e0db340a183857d0a787b348681d3 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:53:47 2022 +0100 Don't crash CLI on exceptions commit b035ac8c6772dfd9ba41b8eeb9103181cda028f8 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:11:55 2022 +0100 add missing position_embeddings commit 12769b3d3562ef71e0f54946b532ad077e10043c Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:33:25 2022 +0100 debugging why it don't work commit bafb7215eabe1515ca5e8388fd3bb2f3ac5362cf Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:21:33 2022 +0100 debugging why it don't work commit 664a6e9e146b42d96703f0cc8baf8f5efec04ee1 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit 8b4f0fe9d6e4e2643b36dfa27864294785d7ba4e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit ffbe1ab11163ba712e353d89404e301d0e0c6cdf Merge: 6e4dad60 023df37e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:37:31 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers commit 023df37efffa67434f77def7fc3c9dfb29f699fd Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:36:54 2022 +0100 cleanup commit 05fac594eaf79d0058e3c48deee93df603f136c2 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:07:49 2022 +0100 tweak error checking commit 009f32ed39a7280997c3ffab112adadee0b44279 Author: damian <null@damianstewart.com> Date: Thu Dec 15 21:29:47 2022 +0100 unit tests passing for embeddings with vector length >1 commit beb1b08d9a98112ed2fe073580568e1a18698da3 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:39:09 2022 +0100 more explicit equality tests when overwriting commit 44d8a5a7c85cdabc9ce3a54fd0769a10597b3ca9 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:30:13 2022 +0100 wip textual inversion manager (unit tests passing for 1v embedding overwriting) commit 417c2b57d90924a839616bfb66804faab8039e4c Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 12:30:55 2022 +0100 wip textual inversion manager (unit tests passing for base stuff + padding) commit 2e80872e3b6f7fd7d8eb8928822bd824b63cb2ff Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 10:57:57 2022 +0100 wip new TextualInversionManager * stop using WeightedFrozenCLIPEmbedder * store diffusion models locally - configure_invokeai.py reconfigured to store diffusion models rather than CompVis models - hugging face caching model is used, but cache is set to ~/invokeai/models/repo_id - models.yaml does **NOT** use path, just repo_id - "repo_name" changed to "repo_id" to following hugging face conventions - Models are loaded with full precision pending further work. * allow non-local files during development * path takes priority over repo_id * MVP for model_cache and configure_invokeai - Feature complete (almost) - configure_invokeai.py downloads both .ckpt and diffuser models, along with their VAEs. Both types of download are controlled by a unified INITIAL_MODELS.yaml file. - model_cache can load both type of model and switches back and forth in CPU. No memory leaks detected TO DO: 1. I have not yet turned on the LocalOnly flag for diffuser models, so the code will check the Hugging Face repo for updates before using the locally cached models. This will break firewalled systems. I am thinking of putting in a global check for internet connectivity at startup time and setting the LocalOnly flag based on this. It would be good to check updates if there is connectivity. 2. I have not gone completely through INITIAL_MODELS.yaml to check which models are available as diffusers and which are not. So models like PaperCut and VoxelArt may not load properly. The runway and stability models are checked, as well as the Trinart models. 3. Add stanzas for SD 2.0 and 2.1 in INITIAL_MODELS.yaml REMAINING PROBLEMS NOT DIRECTLY RELATED TO MODEL_CACHE: 1. When loading a .ckpt file there are lots of messages like this: Warning! ldm.modules.attention.CrossAttention is no longer being maintained. Please use InvokeAICrossAttention instead. I'm not sure how to address this. 2. The ckpt models ***don't actually run*** due to the lack of special-case support for them in the generator objects. For example, here's the hard crash you get when you run txt2img against the legacy waifu-diffusion-1.3 model: ``` >> An error occurred: Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 140, in main main_loop(gen, opt) File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 371, in main_loop gen.prompt2image( File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1265, in __getattr__ raise AttributeError("'{}' object has no attribute '{}'".format( AttributeError: 'LatentDiffusion' object has no attribute 'image_from_embeddings' ``` 3. The inpainting diffusion model isn't working. Here's the output of "banana sushi" when inpainting-1.5 is loaded: ``` Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 301, in image_from_embeddings result_latents, result_attention_map_saver = self.latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 330, in latents_from_embeddings result: PipelineIntermediateState = infer_latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 185, in __call__ for result in self.generator_method(*args, **kwargs): File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 367, in generate_latents_from_embeddings step_output = self.step(batched_t, latents, guidance_scale, File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context return func(*args, **kwargs) File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 409, in step step_output = self.scheduler.step(noise_pred, timestep, latents, **extra_step_kwargs) File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/diffusers/schedulers/scheduling_lms_discrete.py", line 223, in step pred_original_sample = sample - sigma * model_output RuntimeError: The size of tensor a (9) must match the size of tensor b (4) at non-singleton dimension 1 ``` * proper support for float32/float16 - configure script now correctly detects user's preference for fp16/32 and downloads the correct diffuser version. If fp16 version not available, falls back to fp32 version. - misc code cleanup and simplification in model_cache * add on-the-fly conversion of .ckpt to diffusers models 1. On-the-fly conversion code can be found in the file ldm/invoke/ckpt_to_diffusers.py. 2. A new !optimize command has been added to the CLI. Should be ported to Web GUI. User experience on the CLI is this: ``` invoke> !optimize /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt INFO: Converting legacy weights file /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt to optimized diffuser model. This operation will take 30-60s to complete. Success. Optimized model is now located at /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 Writing new config file entry for sd-v1-4... >> New configuration: sd-v1-4: description: Optimized version of sd-v1-4 format: diffusers path: /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 OK to import [n]? y >> Verifying that new model loads... >> Current VRAM usage: 2.60G >> Offloading stable-diffusion-2.1 to CPU >> Loading diffusers model from /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 | Using faster float16 precision You have disabled the safety checker for <class 'ldm.invoke.generator.diffusers_pipeline.StableDiffusionGeneratorPipeline'> by passing `safety_checker=None`. Ensure that you abide to the conditions of the Stable Diffusion \ license and do not expose unfiltered results in services or applications open to the public. Both the diffusers team and Hugging Face strongly recommend to keep the safety filter enabled in all public facing circumstances,\ disabling it only for use-cases that involve analyzing network behavior or auditing its results. For more information, please have a look at https://github.com/huggingface/diffusers/pull/254 . | training width x height = (512 x 512) >> Model loaded in 3.48s >> Max VRAM used to load the model: 2.17G >> Current VRAM usage:2.17G >> Textual inversions available: >> Setting Sampler to k_lms (LMSDiscreteScheduler) Keep model loaded? [y] ``` * add parallel set of generator files for ckpt legacy generation * generation using legacy ckpt models now working * diffusers: fix missing attention_maps_callback fix for 23eb80b40421b2bb8f4b6d3dd30490d11c447b36 * associate legacy CrossAttention with .ckpt models * enable autoconvert New --autoconvert CLI option will scan a designated directory for new .ckpt files, convert them into diffuser models, and import them into models.yaml. Works like this: invoke.py --autoconvert /path/to/weights/directory In ModelCache added two new methods: autoconvert_weights(config_path, weights_directory_path, models_directory_path) convert_and_import(ckpt_path, diffuser_path) * diffusers: update to diffusers 0.11 (from 0.10.2) * fix vae loading & width/height calculation * refactor: encapsulate these conditioning data into one container * diffusers: fix some noise-scaling issues by pushing the noise-mixing down to the common function * add support for safetensors and accelerate * set local_files_only when internet unreachable * diffusers: fix error-handling path when model repo has no fp16 branch * fix generatorinpaint error Fixes : "ModuleNotFoundError: No module named 'ldm.invoke.generatorinpaint' https://github.com/invoke-ai/InvokeAI/pull/1583#issuecomment-1363634318 * quench diffuser safety-checker warning * diffusers: support stochastic DDIM eta parameter * fix conda env creation on macos * fix cross-attention with diffusers 0.11 * diffusers: the VAE needs to be tiling as well as the U-Net * diffusers: comment on subfolders * diffusers: embiggen! * diffusers: make model_cache.list_models serializable * diffusers(inpaint): restore scaling functionality * fix requirements clash between numba and numpy 1.24 * diffusers: allow inpainting model to do non-inpainting tasks * start expanding model_cache functionality * add import_ckpt_model() and import_diffuser_model() methods to model_manager - in addition, model_cache.py is now renamed to model_manager.py * allow "recommended" flag to be optional in INITIAL_MODELS.yaml * configure_invokeai now downloads VAE diffusers in advance * rename ModelCache to ModelManager * remove support for `repo_name` in models.yaml * check for and refuse to load embeddings trained on incompatible models * models.yaml.example: s/repo_name/repo_id and remove extra INITIAL_MODELS now that the main one has diffusers models in it. * add MVP textual inversion script * refactor(InvokeAIDiffuserComponent): factor out _combine() * InvokeAIDiffuserComponent: implement threshold * InvokeAIDiffuserComponent: diagnostic logs for threshold ...this does not look right * add a curses-based frontend to textual inversion - not quite working yet - requires npyscreen installed - on windows will also have the windows-curses requirement, but not added to requirements yet * add curses-based interface for textual inversion * fix crash in convert_and_import() - This corrects a "local variable referenced before assignment" error in model_manager.convert_and_import() * potential workaround for no 'state_dict' key error - As reported in https://github.com/huggingface/diffusers/issues/1876 * create TI output dir if needed * Update environment-lin-cuda.yml (#2159) Fixing line 42 to be the proper order to define the transformers requirement: ~= instead of =~ * diffusers: update sampler-to-scheduler mapping based on https://github.com/huggingface/diffusers/issues/277#issuecomment-1371428672 * improve user exp for ckt to diffusers conversion - !optimize_models command now operates on an existing ckpt file entry in models.yaml - replaces existing entry, rather than adding a new one - offers to delete the ckpt file after conversion * web: adapt progress callback to deal with old generator or new diffusers pipeline * clean-up model_manager code - add_model() verified to work for .ckpt local paths, .ckpt remote URLs, diffusers local paths, and diffusers repo_ids - convert_and_import() verified to work for local and remove .ckpt files * handle edge cases for import_model() and convert_model() * add support for safetensor .ckpt files * fix name error * code cleanup with pyflake * improve model setting behavior - If the user enters an invalid model name at startup time, will not try to load it, warn, and use default model - CLI UI enhancement: include currently active model in the command line prompt. * update test-invoke-pip.yml - fix model cache path to point to runwayml/stable-diffusion-v1-5 - remove `skip-sd-weights` from configure_invokeai.py args * exclude dev/diffusers from "fail for draft PRs" * disable "fail on PR jobs" * re-add `--skip-sd-weights` since no space * update workflow environments - include `INVOKE_MODEL_RECONFIGURE: '--yes'` * clean up model load failure handling - Allow CLI to run even when no model is defined or loadable. - Inhibit stack trace when model load fails - only show last error - Give user *option* to run configure_invokeai.py when no models successfully load. - Restart invokeai after reconfiguration. * further edge-case handling 1) only one model in models.yaml file, and that model is broken 2) no models in models.yaml 3) models.yaml doesn't exist at all * fix incorrect model status listing - "cached" was not being returned from list_models() - normalize handling of exceptions during model loading: - Passing an invalid model name to generate.set_model() will return a KeyError - All other exceptions are returned as the appropriate Exception * CI: do download weights (if not already cached) * diffusers: fix scheduler loading in offline mode * CI: fix model name (no longer has `diffusers-` prefix) * Update txt2img2img.py (#2256) * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * feat - make model storage compatible with hugging face caching system This commit alters the InvokeAI model directory to be compatible with hugging face, making it easier to share diffusers (and other models) across different programs. - If the HF_HOME environment variable is not set, then models are cached in ~/invokeai/models in a format that is identical to the HuggingFace cache. - If HF_HOME is set, then models are cached wherever HF_HOME points. - To enable sharing with other HuggingFace library clients, set HF_HOME to ~/.cache/huggingface to set the default cache location or to ~/invokeai/models to have huggingface cache inside InvokeAI. * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * fix error "no attribute CkptInpaint" * model_manager.list_models() returns entire model config stanza+status * Initial Draft - Model Manager Diffusers * added hash function to diffusers * implement sha256 hashes on diffusers models * Add Model Manager Support for Diffusers * fix various problems with model manager - in cli import functions, fix not enough values to unpack from _get_name_and_desc() - fix crash when using old-style vae: value with new-style diffuser * rebuild frontend * fix dictconfig-not-serializable issue * fix NoneType' object is not subscriptable crash in model_manager * fix "str has no attribute get" error in model_manager list_models() * Add path and repo_id support for Diffusers Model Manager Also fixes bugs * Fix tooltip IT localization not working * Add Version Number To WebUI * Optimize Model Search * Fix incorrect font on the Model Manager UI * Fix image degradation on merge fixes - [Experimental] This change should effectively fix a couple of things. - Fix image degradation on subsequent merges of the canvas layers. - Fix the slight transparent border that is left behind when filling the bounding box with a color. - Fix the left over line of color when filling a bounding box with color. So far there are no side effects for this. If any, please report. * Add local model filtering for Diffusers / Checkpoints * Go to home on modal close for the Add Modal UI * Styling Fixes * Model Manager Diffusers Localization Update * Add Safe Tensor scanning to Model Manager * Fix model edit form dispatching string values instead of numbers. * Resolve VAE handling / edge cases for supplied repos * defer injecting tokens for textual inversions until they're used for the first time * squash a console warning * implement model migration check * add_model() overwrites previous config rather than merges * fix model config file attribute merging * fix precision handling in textual inversion script * allow ckpt conversion script to work with safetensors .ckpts Applied patch here: https://github.com/huggingface/diffusers/commit/beb932c5d111872c5e45387e7b1b2b3dd0524a47 * fix name "args" is not defined crash in textual_inversion_training * fix a second NameError: name 'args' is not defined crash * fix loading of the safety checker from the global cache dir * add installation step to textual inversion frontend - After a successful training run, the script will copy learned_embeds.bin to a subfolder of the embeddings directory. - User given the option to delete the logs and intermediate checkpoints (which together use 7-8G of space) - If textual inversion training fails, reports the error gracefully. * don't crash out on incompatible embeddings - put try: blocks around places where the system tries to load an embedding which is incompatible with the currently loaded model * add support for checkpoint resuming * textual inversion preferences are saved and restored between sessions - Preferences are stored in a file named text-inversion-training/preferences.conf - Currently the resume-from-checkpoint option is not working correctly. Possible bug in textual_inversion_training.py? * copy learned_embeddings.bin into right location * add front end for diffusers model merging - Front end doesn't do anything yet!!!! - Made change to model name parsing in CLI to support ability to have merged models with the "+" character in their names. * improve inpainting experience - recommend ckpt version of inpainting-1.5 to user - fix get_noise() bug in ckpt version of omnibus.py * update environment*yml * tweak instructions to install HuggingFace token * bump version number * enhance update scripts - update scripts will now fetch new INITIAL_MODELS.yaml so that configure_invokeai.py will know about the diffusers versions. * enhance invoke.sh/invoke.bat launchers - added configure_invokeai.py to menu - menu defaults to browser-based invoke * remove conda workflow (#2321) * fix `token_ids has shape torch.Size([79]) - expected [77]` * update CHANGELOG.md with 2.3.* info - Add information on how formats have changed and the upgrade process. - Add short bug list. Co-authored-by: Damian Stewart <d@damianstewart.com> Co-authored-by: Damian Stewart <null@damianstewart.com> Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> Co-authored-by: Wybartel-luxmc <37852506+Wybartel-luxmc@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> Co-authored-by: mickr777 <115216705+mickr777@users.noreply.github.com> Co-authored-by: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Co-authored-by: Eugene Brodsky <ebr@users.noreply.github.com> Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com>
2023-01-15 14:22:46 +00:00
return self.set_model(self.model_name)
enable fast switching between models in invoke.py - This PR enables two new commands in the invoke.py script !models -- list the available models and their cache status !switch <model> -- switch to the indicated model Example: invoke> !models laion400m not loaded Latent Diffusion LAION400M model stable-diffusion-1.4 active Stable Diffusion inference model version 1.4 waifu-1.3 cached Waifu anime model version 1.3 invoke> !switch waifu-1.3 >> Caching model stable-diffusion-1.4 in system RAM >> Retrieving model waifu-1.3 from system RAM cache The name and descriptions of the models are taken from `config/models.yaml`. A future enhancement to `model_cache.py` will be to enable new model stanzas to be added to the file programmatically. This will be useful for the WebGUI. More details: - Use fast switching algorithm described in PR #948 - Models are selected using their configuration stanza name given in models.yaml. - To avoid filling up CPU RAM with cached models, this PR implements an LRU cache that monitors available CPU RAM. - The caching code allows the minimum value of available RAM to be adjusted, but invoke.py does not currently have a command-line argument that allows you to set it. The minimum free RAM is arbitrarily set to 2 GB. - Add optional description field to configs/models.yaml Unrelated fixes: - Added ">>" to CompViz model loading messages in order to make user experience more consistent. - When generating an image greater than defaults, will only warn about possible VRAM filling the first time. - Fixed bug that was causing help message to be printed twice. This involved moving the import line for the web backend into the section where it is called. Coauthored by: @ArDiouscuros
2022-10-12 06:14:59 +00:00
def set_model(self,model_name):
"""
enable fast switching between models in invoke.py - This PR enables two new commands in the invoke.py script !models -- list the available models and their cache status !switch <model> -- switch to the indicated model Example: invoke> !models laion400m not loaded Latent Diffusion LAION400M model stable-diffusion-1.4 active Stable Diffusion inference model version 1.4 waifu-1.3 cached Waifu anime model version 1.3 invoke> !switch waifu-1.3 >> Caching model stable-diffusion-1.4 in system RAM >> Retrieving model waifu-1.3 from system RAM cache The name and descriptions of the models are taken from `config/models.yaml`. A future enhancement to `model_cache.py` will be to enable new model stanzas to be added to the file programmatically. This will be useful for the WebGUI. More details: - Use fast switching algorithm described in PR #948 - Models are selected using their configuration stanza name given in models.yaml. - To avoid filling up CPU RAM with cached models, this PR implements an LRU cache that monitors available CPU RAM. - The caching code allows the minimum value of available RAM to be adjusted, but invoke.py does not currently have a command-line argument that allows you to set it. The minimum free RAM is arbitrarily set to 2 GB. - Add optional description field to configs/models.yaml Unrelated fixes: - Added ">>" to CompViz model loading messages in order to make user experience more consistent. - When generating an image greater than defaults, will only warn about possible VRAM filling the first time. - Fixed bug that was causing help message to be printed twice. This involved moving the import line for the web backend into the section where it is called. Coauthored by: @ArDiouscuros
2022-10-12 06:14:59 +00:00
Given the name of a model defined in models.yaml, will load and initialize it
and return the model object. Previously-used models will be cached.
use 🧨diffusers model (#1583) * initial commit of DiffusionPipeline class * spike: proof of concept using diffusers for txt2img * doc: type hints for Generator * refactor(model_cache): factor out load_ckpt * model_cache: add ability to load a diffusers model pipeline and update associated things in Generate & Generator to not instantly fail when that happens * model_cache: fix model default image dimensions * txt2img: support switching diffusers schedulers * diffusers: let the scheduler do its scaling of the initial latents Remove IPNDM scheduler; it is not behaving. * web server: update image_progress callback for diffusers data * diffusers: restore prompt weighting feature * diffusers: fix set-sampler error following model switch * diffusers: use InvokeAIDiffuserComponent for conditioning * cross_attention_control: stub (no-op) implementations for diffusers * model_cache: let offload_model work with DiffusionPipeline, sorta. * models.yaml.example: add diffusers-format model, set as default * test-invoke-conda: use diffusers-format model test-invoke-conda: put huggingface-token where the library can use it * environment-mac: upgrade to diffusers 0.7 (from 0.6) this was already done for linux; mac must have been lost in the merge. * preload_models: explicitly load diffusers models In non-interactive mode too, as long as you're logged in. * fix(model_cache): don't check `model.config` in diffusers format clean-up from recent merge. * diffusers integration: support img2img * dev: upgrade to diffusers 0.8 (from 0.7.1) We get to remove some code by using methods that were factored out in the base class. * refactor: remove backported img2img.get_timesteps now that we can use it directly from diffusers 0.8.1 * ci: use diffusers model * dev: upgrade to diffusers 0.9 (from 0.8.1) * lint: correct annotations for Python 3.9. * lint: correct AttributeError.name reference for Python 3.9. * CI: prefer diffusers-1.4 because it no longer requires a token The RunwayML models still do. * build: there's yet another place to update requirements? * configure: try to download models even without token Models in the CompVis and stabilityai repos no longer require them. (But runwayml still does.) * configure: add troubleshooting info for config-not-found * fix(configure): prepend root to config path * fix(configure): remove second `default: true` from models example * CI: simplify test-on-push logic now that we don't need secrets The "test on push but only in forks" logic was only necessary when tests didn't work for PRs-from-forks. * create an embedding_manager for diffusers * internal: avoid importing diffusers DummyObject see https://github.com/huggingface/diffusers/issues/1479 * fix "config attributes…not expected" diffusers warnings. * fix deprecated scheduler construction * work around an apparent MPS torch bug that causes conditioning to have no effect * 🚧 post-rebase repair * preliminary support for outpainting (no masking yet) * monkey-patch diffusers.attention and use Invoke lowvram code * add always_use_cpu arg to bypass MPS * add cross-attention control support to diffusers (fails on MPS) For unknown reasons MPS produces garbage output with .swap(). Use --always_use_cpu arg to invoke.py for now to test this code on MPS. * diffusers support for the inpainting model * fix debug_image to not crash with non-RGB images. * inpainting for the normal model [WIP] This seems to be performing well until the LAST STEP, at which point it dissolves to confetti. * fix off-by-one bug in cross-attention-control (#1774) prompt token sequences begin with a "beginning-of-sequence" marker <bos> and end with a repeated "end-of-sequence" marker <eos> - to make a default prompt length of <bos> + 75 prompt tokens + <eos>. the .swap() code was failing to take the column for <bos> at index 0 into account. the changes here do that, and also add extra handling for a single <eos> (which may be redundant but which is included for completeness). based on my understanding and some assumptions about how this all works, the reason .swap() nevertheless seemed to do the right thing, to some extent, is because over multiple steps the conditioning process in Stable Diffusion operates as a feedback loop. a change to token n-1 has flow-on effects to how the [1x4x64x64] latent tensor is modified by all the tokens after it, - and as the next step is processed, all the tokens before it as well. intuitively, a token's conditioning effects "echo" throughout the whole length of the prompt. so even though the token at n-1 was being edited when what the user actually wanted was to edit the token at n, it nevertheless still had some non-negligible effect, in roughly the right direction, often enough that it seemed like it was working properly. * refactor common CrossAttention stuff into a mixin so that the old ldm code can still work if necessary * inpainting for the normal model. I think it works this time. * diffusers: reset num_vectors_per_token sync with 44a00555718f1df173c60da0ed646cf700e29537 * diffusers: txt2img2img (hires_fix) with so much slicing and dicing of pipeline methods to stitch them together * refactor(diffusers): reduce some code duplication amongst the different tasks * fixup! refactor(diffusers): reduce some code duplication amongst the different tasks * diffusers: enable DPMSolver++ scheduler * diffusers: upgrade to diffusers 0.10, add Heun scheduler * diffusers(ModelCache): stopgap to make from_cpu compatible with diffusers * CI: default to diffusers-1.5 now that runwayml token requirement is gone * diffusers: update to 0.10 (and transformers to 4.25) * diffusers: use xformers when available diffusers no longer auto-enables this as of 0.10.2. * diffusers: make masked img2img behave better with multi-step schedulers re-randomizing the noise each step was confusing them. * diffusers: work more better with more models. fixed relative path problem with local models. fixed models on hub not always having a `fp16` branch. * diffusers: stopgap fix for attention_maps_callback crash after recent merge * fixup import merge conflicts correction for 061c5369a2247c6c92cd69606bcf54c4f1962a0b * test: add tests/inpainting inputs for masked img2img * diffusers(AddsMaskedGuidance): partial fix for k-schedulers Prevents them from crashing, but results are still hot garbage. * fix --safety_checker arg parsing and add note to diffusers loader about where safety checker gets called * generate: fix import error * CI: don't try to read the old init location * diffusers: support loading an alternate VAE * CI: remove sh-syntax if-statement so it doesn't crash powershell * CI: fold strings in yaml because backslash is not line-continuation in powershell * attention maps callback stuff for diffusers * build: fix syntax error in environment-mac * diffusers: add INITIAL_MODELS with diffusers-compatible repos * re-enable the embedding manager; closes #1778 * Squashed commit of the following: commit e4a956abc37fcb5cf188388b76b617bc5c8fda7d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:43:07 2022 +0100 import new load handling from EmbeddingManager and cleanup commit c4abe91a5ba0d415b45bf734068385668b7a66e6 Merge: 032e856e 1efc6397 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:09:53 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers_with_textual_inversion_manager commit 032e856eefb3bbc39534f5daafd25764bcfcef8b Merge: 8b4f0fe9 bc515e24 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:08:01 2022 +0100 Merge remote-tracking branch 'upstream/dev/diffusers' into dev/diffusers_with_textual_inversion_manager commit 1efc6397fc6e61c1aff4b0258b93089d61de5955 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:04:28 2022 +0100 cleanup and add performance notes commit e400f804ac471a0ca2ba432fd658778b20c7bdab Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:45:07 2022 +0100 fix bug and update unit tests commit deb9ae0ae1016750e93ce8275734061f7285a231 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:28:29 2022 +0100 textual inversion manager seems to work commit 162e02505dec777e91a983c4d0fb52e950d25ff0 Merge: cbad4583 12769b3d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:58:03 2022 +0100 Merge branch 'main' into feature_textual_inversion_mgr commit cbad45836c6aace6871a90f2621a953f49433131 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:54:10 2022 +0100 use position embeddings commit 070344c69b0e0db340a183857d0a787b348681d3 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:53:47 2022 +0100 Don't crash CLI on exceptions commit b035ac8c6772dfd9ba41b8eeb9103181cda028f8 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:11:55 2022 +0100 add missing position_embeddings commit 12769b3d3562ef71e0f54946b532ad077e10043c Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:33:25 2022 +0100 debugging why it don't work commit bafb7215eabe1515ca5e8388fd3bb2f3ac5362cf Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:21:33 2022 +0100 debugging why it don't work commit 664a6e9e146b42d96703f0cc8baf8f5efec04ee1 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit 8b4f0fe9d6e4e2643b36dfa27864294785d7ba4e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit ffbe1ab11163ba712e353d89404e301d0e0c6cdf Merge: 6e4dad60 023df37e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:37:31 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers commit 023df37efffa67434f77def7fc3c9dfb29f699fd Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:36:54 2022 +0100 cleanup commit 05fac594eaf79d0058e3c48deee93df603f136c2 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:07:49 2022 +0100 tweak error checking commit 009f32ed39a7280997c3ffab112adadee0b44279 Author: damian <null@damianstewart.com> Date: Thu Dec 15 21:29:47 2022 +0100 unit tests passing for embeddings with vector length >1 commit beb1b08d9a98112ed2fe073580568e1a18698da3 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:39:09 2022 +0100 more explicit equality tests when overwriting commit 44d8a5a7c85cdabc9ce3a54fd0769a10597b3ca9 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:30:13 2022 +0100 wip textual inversion manager (unit tests passing for 1v embedding overwriting) commit 417c2b57d90924a839616bfb66804faab8039e4c Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 12:30:55 2022 +0100 wip textual inversion manager (unit tests passing for base stuff + padding) commit 2e80872e3b6f7fd7d8eb8928822bd824b63cb2ff Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 10:57:57 2022 +0100 wip new TextualInversionManager * stop using WeightedFrozenCLIPEmbedder * store diffusion models locally - configure_invokeai.py reconfigured to store diffusion models rather than CompVis models - hugging face caching model is used, but cache is set to ~/invokeai/models/repo_id - models.yaml does **NOT** use path, just repo_id - "repo_name" changed to "repo_id" to following hugging face conventions - Models are loaded with full precision pending further work. * allow non-local files during development * path takes priority over repo_id * MVP for model_cache and configure_invokeai - Feature complete (almost) - configure_invokeai.py downloads both .ckpt and diffuser models, along with their VAEs. Both types of download are controlled by a unified INITIAL_MODELS.yaml file. - model_cache can load both type of model and switches back and forth in CPU. No memory leaks detected TO DO: 1. I have not yet turned on the LocalOnly flag for diffuser models, so the code will check the Hugging Face repo for updates before using the locally cached models. This will break firewalled systems. I am thinking of putting in a global check for internet connectivity at startup time and setting the LocalOnly flag based on this. It would be good to check updates if there is connectivity. 2. I have not gone completely through INITIAL_MODELS.yaml to check which models are available as diffusers and which are not. So models like PaperCut and VoxelArt may not load properly. The runway and stability models are checked, as well as the Trinart models. 3. Add stanzas for SD 2.0 and 2.1 in INITIAL_MODELS.yaml REMAINING PROBLEMS NOT DIRECTLY RELATED TO MODEL_CACHE: 1. When loading a .ckpt file there are lots of messages like this: Warning! ldm.modules.attention.CrossAttention is no longer being maintained. Please use InvokeAICrossAttention instead. I'm not sure how to address this. 2. The ckpt models ***don't actually run*** due to the lack of special-case support for them in the generator objects. For example, here's the hard crash you get when you run txt2img against the legacy waifu-diffusion-1.3 model: ``` >> An error occurred: Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 140, in main main_loop(gen, opt) File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 371, in main_loop gen.prompt2image( File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1265, in __getattr__ raise AttributeError("'{}' object has no attribute '{}'".format( AttributeError: 'LatentDiffusion' object has no attribute 'image_from_embeddings' ``` 3. The inpainting diffusion model isn't working. Here's the output of "banana sushi" when inpainting-1.5 is loaded: ``` Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 301, in image_from_embeddings result_latents, result_attention_map_saver = self.latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 330, in latents_from_embeddings result: PipelineIntermediateState = infer_latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 185, in __call__ for result in self.generator_method(*args, **kwargs): File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 367, in generate_latents_from_embeddings step_output = self.step(batched_t, latents, guidance_scale, File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context return func(*args, **kwargs) File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 409, in step step_output = self.scheduler.step(noise_pred, timestep, latents, **extra_step_kwargs) File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/diffusers/schedulers/scheduling_lms_discrete.py", line 223, in step pred_original_sample = sample - sigma * model_output RuntimeError: The size of tensor a (9) must match the size of tensor b (4) at non-singleton dimension 1 ``` * proper support for float32/float16 - configure script now correctly detects user's preference for fp16/32 and downloads the correct diffuser version. If fp16 version not available, falls back to fp32 version. - misc code cleanup and simplification in model_cache * add on-the-fly conversion of .ckpt to diffusers models 1. On-the-fly conversion code can be found in the file ldm/invoke/ckpt_to_diffusers.py. 2. A new !optimize command has been added to the CLI. Should be ported to Web GUI. User experience on the CLI is this: ``` invoke> !optimize /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt INFO: Converting legacy weights file /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt to optimized diffuser model. This operation will take 30-60s to complete. Success. Optimized model is now located at /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 Writing new config file entry for sd-v1-4... >> New configuration: sd-v1-4: description: Optimized version of sd-v1-4 format: diffusers path: /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 OK to import [n]? y >> Verifying that new model loads... >> Current VRAM usage: 2.60G >> Offloading stable-diffusion-2.1 to CPU >> Loading diffusers model from /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 | Using faster float16 precision You have disabled the safety checker for <class 'ldm.invoke.generator.diffusers_pipeline.StableDiffusionGeneratorPipeline'> by passing `safety_checker=None`. Ensure that you abide to the conditions of the Stable Diffusion \ license and do not expose unfiltered results in services or applications open to the public. Both the diffusers team and Hugging Face strongly recommend to keep the safety filter enabled in all public facing circumstances,\ disabling it only for use-cases that involve analyzing network behavior or auditing its results. For more information, please have a look at https://github.com/huggingface/diffusers/pull/254 . | training width x height = (512 x 512) >> Model loaded in 3.48s >> Max VRAM used to load the model: 2.17G >> Current VRAM usage:2.17G >> Textual inversions available: >> Setting Sampler to k_lms (LMSDiscreteScheduler) Keep model loaded? [y] ``` * add parallel set of generator files for ckpt legacy generation * generation using legacy ckpt models now working * diffusers: fix missing attention_maps_callback fix for 23eb80b40421b2bb8f4b6d3dd30490d11c447b36 * associate legacy CrossAttention with .ckpt models * enable autoconvert New --autoconvert CLI option will scan a designated directory for new .ckpt files, convert them into diffuser models, and import them into models.yaml. Works like this: invoke.py --autoconvert /path/to/weights/directory In ModelCache added two new methods: autoconvert_weights(config_path, weights_directory_path, models_directory_path) convert_and_import(ckpt_path, diffuser_path) * diffusers: update to diffusers 0.11 (from 0.10.2) * fix vae loading & width/height calculation * refactor: encapsulate these conditioning data into one container * diffusers: fix some noise-scaling issues by pushing the noise-mixing down to the common function * add support for safetensors and accelerate * set local_files_only when internet unreachable * diffusers: fix error-handling path when model repo has no fp16 branch * fix generatorinpaint error Fixes : "ModuleNotFoundError: No module named 'ldm.invoke.generatorinpaint' https://github.com/invoke-ai/InvokeAI/pull/1583#issuecomment-1363634318 * quench diffuser safety-checker warning * diffusers: support stochastic DDIM eta parameter * fix conda env creation on macos * fix cross-attention with diffusers 0.11 * diffusers: the VAE needs to be tiling as well as the U-Net * diffusers: comment on subfolders * diffusers: embiggen! * diffusers: make model_cache.list_models serializable * diffusers(inpaint): restore scaling functionality * fix requirements clash between numba and numpy 1.24 * diffusers: allow inpainting model to do non-inpainting tasks * start expanding model_cache functionality * add import_ckpt_model() and import_diffuser_model() methods to model_manager - in addition, model_cache.py is now renamed to model_manager.py * allow "recommended" flag to be optional in INITIAL_MODELS.yaml * configure_invokeai now downloads VAE diffusers in advance * rename ModelCache to ModelManager * remove support for `repo_name` in models.yaml * check for and refuse to load embeddings trained on incompatible models * models.yaml.example: s/repo_name/repo_id and remove extra INITIAL_MODELS now that the main one has diffusers models in it. * add MVP textual inversion script * refactor(InvokeAIDiffuserComponent): factor out _combine() * InvokeAIDiffuserComponent: implement threshold * InvokeAIDiffuserComponent: diagnostic logs for threshold ...this does not look right * add a curses-based frontend to textual inversion - not quite working yet - requires npyscreen installed - on windows will also have the windows-curses requirement, but not added to requirements yet * add curses-based interface for textual inversion * fix crash in convert_and_import() - This corrects a "local variable referenced before assignment" error in model_manager.convert_and_import() * potential workaround for no 'state_dict' key error - As reported in https://github.com/huggingface/diffusers/issues/1876 * create TI output dir if needed * Update environment-lin-cuda.yml (#2159) Fixing line 42 to be the proper order to define the transformers requirement: ~= instead of =~ * diffusers: update sampler-to-scheduler mapping based on https://github.com/huggingface/diffusers/issues/277#issuecomment-1371428672 * improve user exp for ckt to diffusers conversion - !optimize_models command now operates on an existing ckpt file entry in models.yaml - replaces existing entry, rather than adding a new one - offers to delete the ckpt file after conversion * web: adapt progress callback to deal with old generator or new diffusers pipeline * clean-up model_manager code - add_model() verified to work for .ckpt local paths, .ckpt remote URLs, diffusers local paths, and diffusers repo_ids - convert_and_import() verified to work for local and remove .ckpt files * handle edge cases for import_model() and convert_model() * add support for safetensor .ckpt files * fix name error * code cleanup with pyflake * improve model setting behavior - If the user enters an invalid model name at startup time, will not try to load it, warn, and use default model - CLI UI enhancement: include currently active model in the command line prompt. * update test-invoke-pip.yml - fix model cache path to point to runwayml/stable-diffusion-v1-5 - remove `skip-sd-weights` from configure_invokeai.py args * exclude dev/diffusers from "fail for draft PRs" * disable "fail on PR jobs" * re-add `--skip-sd-weights` since no space * update workflow environments - include `INVOKE_MODEL_RECONFIGURE: '--yes'` * clean up model load failure handling - Allow CLI to run even when no model is defined or loadable. - Inhibit stack trace when model load fails - only show last error - Give user *option* to run configure_invokeai.py when no models successfully load. - Restart invokeai after reconfiguration. * further edge-case handling 1) only one model in models.yaml file, and that model is broken 2) no models in models.yaml 3) models.yaml doesn't exist at all * fix incorrect model status listing - "cached" was not being returned from list_models() - normalize handling of exceptions during model loading: - Passing an invalid model name to generate.set_model() will return a KeyError - All other exceptions are returned as the appropriate Exception * CI: do download weights (if not already cached) * diffusers: fix scheduler loading in offline mode * CI: fix model name (no longer has `diffusers-` prefix) * Update txt2img2img.py (#2256) * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * feat - make model storage compatible with hugging face caching system This commit alters the InvokeAI model directory to be compatible with hugging face, making it easier to share diffusers (and other models) across different programs. - If the HF_HOME environment variable is not set, then models are cached in ~/invokeai/models in a format that is identical to the HuggingFace cache. - If HF_HOME is set, then models are cached wherever HF_HOME points. - To enable sharing with other HuggingFace library clients, set HF_HOME to ~/.cache/huggingface to set the default cache location or to ~/invokeai/models to have huggingface cache inside InvokeAI. * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * fix error "no attribute CkptInpaint" * model_manager.list_models() returns entire model config stanza+status * Initial Draft - Model Manager Diffusers * added hash function to diffusers * implement sha256 hashes on diffusers models * Add Model Manager Support for Diffusers * fix various problems with model manager - in cli import functions, fix not enough values to unpack from _get_name_and_desc() - fix crash when using old-style vae: value with new-style diffuser * rebuild frontend * fix dictconfig-not-serializable issue * fix NoneType' object is not subscriptable crash in model_manager * fix "str has no attribute get" error in model_manager list_models() * Add path and repo_id support for Diffusers Model Manager Also fixes bugs * Fix tooltip IT localization not working * Add Version Number To WebUI * Optimize Model Search * Fix incorrect font on the Model Manager UI * Fix image degradation on merge fixes - [Experimental] This change should effectively fix a couple of things. - Fix image degradation on subsequent merges of the canvas layers. - Fix the slight transparent border that is left behind when filling the bounding box with a color. - Fix the left over line of color when filling a bounding box with color. So far there are no side effects for this. If any, please report. * Add local model filtering for Diffusers / Checkpoints * Go to home on modal close for the Add Modal UI * Styling Fixes * Model Manager Diffusers Localization Update * Add Safe Tensor scanning to Model Manager * Fix model edit form dispatching string values instead of numbers. * Resolve VAE handling / edge cases for supplied repos * defer injecting tokens for textual inversions until they're used for the first time * squash a console warning * implement model migration check * add_model() overwrites previous config rather than merges * fix model config file attribute merging * fix precision handling in textual inversion script * allow ckpt conversion script to work with safetensors .ckpts Applied patch here: https://github.com/huggingface/diffusers/commit/beb932c5d111872c5e45387e7b1b2b3dd0524a47 * fix name "args" is not defined crash in textual_inversion_training * fix a second NameError: name 'args' is not defined crash * fix loading of the safety checker from the global cache dir * add installation step to textual inversion frontend - After a successful training run, the script will copy learned_embeds.bin to a subfolder of the embeddings directory. - User given the option to delete the logs and intermediate checkpoints (which together use 7-8G of space) - If textual inversion training fails, reports the error gracefully. * don't crash out on incompatible embeddings - put try: blocks around places where the system tries to load an embedding which is incompatible with the currently loaded model * add support for checkpoint resuming * textual inversion preferences are saved and restored between sessions - Preferences are stored in a file named text-inversion-training/preferences.conf - Currently the resume-from-checkpoint option is not working correctly. Possible bug in textual_inversion_training.py? * copy learned_embeddings.bin into right location * add front end for diffusers model merging - Front end doesn't do anything yet!!!! - Made change to model name parsing in CLI to support ability to have merged models with the "+" character in their names. * improve inpainting experience - recommend ckpt version of inpainting-1.5 to user - fix get_noise() bug in ckpt version of omnibus.py * update environment*yml * tweak instructions to install HuggingFace token * bump version number * enhance update scripts - update scripts will now fetch new INITIAL_MODELS.yaml so that configure_invokeai.py will know about the diffusers versions. * enhance invoke.sh/invoke.bat launchers - added configure_invokeai.py to menu - menu defaults to browser-based invoke * remove conda workflow (#2321) * fix `token_ids has shape torch.Size([79]) - expected [77]` * update CHANGELOG.md with 2.3.* info - Add information on how formats have changed and the upgrade process. - Add short bug list. Co-authored-by: Damian Stewart <d@damianstewart.com> Co-authored-by: Damian Stewart <null@damianstewart.com> Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> Co-authored-by: Wybartel-luxmc <37852506+Wybartel-luxmc@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> Co-authored-by: mickr777 <115216705+mickr777@users.noreply.github.com> Co-authored-by: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Co-authored-by: Eugene Brodsky <ebr@users.noreply.github.com> Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com>
2023-01-15 14:22:46 +00:00
If the passed model_name is invalid, raises a KeyError.
If the model fails to load for some reason, will attempt to load the previously-
loaded model (if any). If that fallback fails, will raise an AssertionError
enable fast switching between models in invoke.py - This PR enables two new commands in the invoke.py script !models -- list the available models and their cache status !switch <model> -- switch to the indicated model Example: invoke> !models laion400m not loaded Latent Diffusion LAION400M model stable-diffusion-1.4 active Stable Diffusion inference model version 1.4 waifu-1.3 cached Waifu anime model version 1.3 invoke> !switch waifu-1.3 >> Caching model stable-diffusion-1.4 in system RAM >> Retrieving model waifu-1.3 from system RAM cache The name and descriptions of the models are taken from `config/models.yaml`. A future enhancement to `model_cache.py` will be to enable new model stanzas to be added to the file programmatically. This will be useful for the WebGUI. More details: - Use fast switching algorithm described in PR #948 - Models are selected using their configuration stanza name given in models.yaml. - To avoid filling up CPU RAM with cached models, this PR implements an LRU cache that monitors available CPU RAM. - The caching code allows the minimum value of available RAM to be adjusted, but invoke.py does not currently have a command-line argument that allows you to set it. The minimum free RAM is arbitrarily set to 2 GB. - Add optional description field to configs/models.yaml Unrelated fixes: - Added ">>" to CompViz model loading messages in order to make user experience more consistent. - When generating an image greater than defaults, will only warn about possible VRAM filling the first time. - Fixed bug that was causing help message to be printed twice. This involved moving the import line for the web backend into the section where it is called. Coauthored by: @ArDiouscuros
2022-10-12 06:14:59 +00:00
"""
if self.model_name == model_name and self.model is not None:
return self.model
Refactoring simplet2i (#387) * start refactoring -not yet functional * first phase of refactor done - not sure weighted prompts working * Second phase of refactoring. Everything mostly working. * The refactoring has moved all the hard-core inference work into ldm.dream.generator.*, where there are submodules for txt2img and img2img. inpaint will go in there as well. * Some additional refactoring will be done soon, but relatively minor work. * fix -save_orig flag to actually work * add @neonsecret attention.py memory optimization * remove unneeded imports * move token logging into conditioning.py * add placeholder version of inpaint; porting in progress * fix crash in img2img * inpainting working; not tested on variations * fix crashes in img2img * ported attention.py memory optimization #117 from basujindal branch * added @torch_no_grad() decorators to img2img, txt2img, inpaint closures * Final commit prior to PR against development * fixup crash when generating intermediate images in web UI * rename ldm.simplet2i to ldm.generate * add backward-compatibility simplet2i shell with deprecation warning * add back in mps exception, addresses @vargol comment in #354 * replaced Conditioning class with exported functions * fix wrong type of with_variations attribute during intialization * changed "image_iterator()" to "get_make_image()" * raise NotImplementedError for calling get_make_image() in parent class * Update ldm/generate.py better error message Co-authored-by: Kevin Gibbons <bakkot@gmail.com> * minor stylistic fixes and assertion checks from code review * moved get_noise() method into img2img class * break get_noise() into two methods, one for txt2img and the other for img2img * inpainting works on non-square images now * make get_noise() an abstract method in base class * much improved inpainting Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
2022-09-06 00:40:10 +00:00
use 🧨diffusers model (#1583) * initial commit of DiffusionPipeline class * spike: proof of concept using diffusers for txt2img * doc: type hints for Generator * refactor(model_cache): factor out load_ckpt * model_cache: add ability to load a diffusers model pipeline and update associated things in Generate & Generator to not instantly fail when that happens * model_cache: fix model default image dimensions * txt2img: support switching diffusers schedulers * diffusers: let the scheduler do its scaling of the initial latents Remove IPNDM scheduler; it is not behaving. * web server: update image_progress callback for diffusers data * diffusers: restore prompt weighting feature * diffusers: fix set-sampler error following model switch * diffusers: use InvokeAIDiffuserComponent for conditioning * cross_attention_control: stub (no-op) implementations for diffusers * model_cache: let offload_model work with DiffusionPipeline, sorta. * models.yaml.example: add diffusers-format model, set as default * test-invoke-conda: use diffusers-format model test-invoke-conda: put huggingface-token where the library can use it * environment-mac: upgrade to diffusers 0.7 (from 0.6) this was already done for linux; mac must have been lost in the merge. * preload_models: explicitly load diffusers models In non-interactive mode too, as long as you're logged in. * fix(model_cache): don't check `model.config` in diffusers format clean-up from recent merge. * diffusers integration: support img2img * dev: upgrade to diffusers 0.8 (from 0.7.1) We get to remove some code by using methods that were factored out in the base class. * refactor: remove backported img2img.get_timesteps now that we can use it directly from diffusers 0.8.1 * ci: use diffusers model * dev: upgrade to diffusers 0.9 (from 0.8.1) * lint: correct annotations for Python 3.9. * lint: correct AttributeError.name reference for Python 3.9. * CI: prefer diffusers-1.4 because it no longer requires a token The RunwayML models still do. * build: there's yet another place to update requirements? * configure: try to download models even without token Models in the CompVis and stabilityai repos no longer require them. (But runwayml still does.) * configure: add troubleshooting info for config-not-found * fix(configure): prepend root to config path * fix(configure): remove second `default: true` from models example * CI: simplify test-on-push logic now that we don't need secrets The "test on push but only in forks" logic was only necessary when tests didn't work for PRs-from-forks. * create an embedding_manager for diffusers * internal: avoid importing diffusers DummyObject see https://github.com/huggingface/diffusers/issues/1479 * fix "config attributes…not expected" diffusers warnings. * fix deprecated scheduler construction * work around an apparent MPS torch bug that causes conditioning to have no effect * 🚧 post-rebase repair * preliminary support for outpainting (no masking yet) * monkey-patch diffusers.attention and use Invoke lowvram code * add always_use_cpu arg to bypass MPS * add cross-attention control support to diffusers (fails on MPS) For unknown reasons MPS produces garbage output with .swap(). Use --always_use_cpu arg to invoke.py for now to test this code on MPS. * diffusers support for the inpainting model * fix debug_image to not crash with non-RGB images. * inpainting for the normal model [WIP] This seems to be performing well until the LAST STEP, at which point it dissolves to confetti. * fix off-by-one bug in cross-attention-control (#1774) prompt token sequences begin with a "beginning-of-sequence" marker <bos> and end with a repeated "end-of-sequence" marker <eos> - to make a default prompt length of <bos> + 75 prompt tokens + <eos>. the .swap() code was failing to take the column for <bos> at index 0 into account. the changes here do that, and also add extra handling for a single <eos> (which may be redundant but which is included for completeness). based on my understanding and some assumptions about how this all works, the reason .swap() nevertheless seemed to do the right thing, to some extent, is because over multiple steps the conditioning process in Stable Diffusion operates as a feedback loop. a change to token n-1 has flow-on effects to how the [1x4x64x64] latent tensor is modified by all the tokens after it, - and as the next step is processed, all the tokens before it as well. intuitively, a token's conditioning effects "echo" throughout the whole length of the prompt. so even though the token at n-1 was being edited when what the user actually wanted was to edit the token at n, it nevertheless still had some non-negligible effect, in roughly the right direction, often enough that it seemed like it was working properly. * refactor common CrossAttention stuff into a mixin so that the old ldm code can still work if necessary * inpainting for the normal model. I think it works this time. * diffusers: reset num_vectors_per_token sync with 44a00555718f1df173c60da0ed646cf700e29537 * diffusers: txt2img2img (hires_fix) with so much slicing and dicing of pipeline methods to stitch them together * refactor(diffusers): reduce some code duplication amongst the different tasks * fixup! refactor(diffusers): reduce some code duplication amongst the different tasks * diffusers: enable DPMSolver++ scheduler * diffusers: upgrade to diffusers 0.10, add Heun scheduler * diffusers(ModelCache): stopgap to make from_cpu compatible with diffusers * CI: default to diffusers-1.5 now that runwayml token requirement is gone * diffusers: update to 0.10 (and transformers to 4.25) * diffusers: use xformers when available diffusers no longer auto-enables this as of 0.10.2. * diffusers: make masked img2img behave better with multi-step schedulers re-randomizing the noise each step was confusing them. * diffusers: work more better with more models. fixed relative path problem with local models. fixed models on hub not always having a `fp16` branch. * diffusers: stopgap fix for attention_maps_callback crash after recent merge * fixup import merge conflicts correction for 061c5369a2247c6c92cd69606bcf54c4f1962a0b * test: add tests/inpainting inputs for masked img2img * diffusers(AddsMaskedGuidance): partial fix for k-schedulers Prevents them from crashing, but results are still hot garbage. * fix --safety_checker arg parsing and add note to diffusers loader about where safety checker gets called * generate: fix import error * CI: don't try to read the old init location * diffusers: support loading an alternate VAE * CI: remove sh-syntax if-statement so it doesn't crash powershell * CI: fold strings in yaml because backslash is not line-continuation in powershell * attention maps callback stuff for diffusers * build: fix syntax error in environment-mac * diffusers: add INITIAL_MODELS with diffusers-compatible repos * re-enable the embedding manager; closes #1778 * Squashed commit of the following: commit e4a956abc37fcb5cf188388b76b617bc5c8fda7d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:43:07 2022 +0100 import new load handling from EmbeddingManager and cleanup commit c4abe91a5ba0d415b45bf734068385668b7a66e6 Merge: 032e856e 1efc6397 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:09:53 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers_with_textual_inversion_manager commit 032e856eefb3bbc39534f5daafd25764bcfcef8b Merge: 8b4f0fe9 bc515e24 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:08:01 2022 +0100 Merge remote-tracking branch 'upstream/dev/diffusers' into dev/diffusers_with_textual_inversion_manager commit 1efc6397fc6e61c1aff4b0258b93089d61de5955 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:04:28 2022 +0100 cleanup and add performance notes commit e400f804ac471a0ca2ba432fd658778b20c7bdab Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:45:07 2022 +0100 fix bug and update unit tests commit deb9ae0ae1016750e93ce8275734061f7285a231 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:28:29 2022 +0100 textual inversion manager seems to work commit 162e02505dec777e91a983c4d0fb52e950d25ff0 Merge: cbad4583 12769b3d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:58:03 2022 +0100 Merge branch 'main' into feature_textual_inversion_mgr commit cbad45836c6aace6871a90f2621a953f49433131 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:54:10 2022 +0100 use position embeddings commit 070344c69b0e0db340a183857d0a787b348681d3 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:53:47 2022 +0100 Don't crash CLI on exceptions commit b035ac8c6772dfd9ba41b8eeb9103181cda028f8 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:11:55 2022 +0100 add missing position_embeddings commit 12769b3d3562ef71e0f54946b532ad077e10043c Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:33:25 2022 +0100 debugging why it don't work commit bafb7215eabe1515ca5e8388fd3bb2f3ac5362cf Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:21:33 2022 +0100 debugging why it don't work commit 664a6e9e146b42d96703f0cc8baf8f5efec04ee1 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit 8b4f0fe9d6e4e2643b36dfa27864294785d7ba4e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit ffbe1ab11163ba712e353d89404e301d0e0c6cdf Merge: 6e4dad60 023df37e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:37:31 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers commit 023df37efffa67434f77def7fc3c9dfb29f699fd Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:36:54 2022 +0100 cleanup commit 05fac594eaf79d0058e3c48deee93df603f136c2 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:07:49 2022 +0100 tweak error checking commit 009f32ed39a7280997c3ffab112adadee0b44279 Author: damian <null@damianstewart.com> Date: Thu Dec 15 21:29:47 2022 +0100 unit tests passing for embeddings with vector length >1 commit beb1b08d9a98112ed2fe073580568e1a18698da3 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:39:09 2022 +0100 more explicit equality tests when overwriting commit 44d8a5a7c85cdabc9ce3a54fd0769a10597b3ca9 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:30:13 2022 +0100 wip textual inversion manager (unit tests passing for 1v embedding overwriting) commit 417c2b57d90924a839616bfb66804faab8039e4c Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 12:30:55 2022 +0100 wip textual inversion manager (unit tests passing for base stuff + padding) commit 2e80872e3b6f7fd7d8eb8928822bd824b63cb2ff Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 10:57:57 2022 +0100 wip new TextualInversionManager * stop using WeightedFrozenCLIPEmbedder * store diffusion models locally - configure_invokeai.py reconfigured to store diffusion models rather than CompVis models - hugging face caching model is used, but cache is set to ~/invokeai/models/repo_id - models.yaml does **NOT** use path, just repo_id - "repo_name" changed to "repo_id" to following hugging face conventions - Models are loaded with full precision pending further work. * allow non-local files during development * path takes priority over repo_id * MVP for model_cache and configure_invokeai - Feature complete (almost) - configure_invokeai.py downloads both .ckpt and diffuser models, along with their VAEs. Both types of download are controlled by a unified INITIAL_MODELS.yaml file. - model_cache can load both type of model and switches back and forth in CPU. No memory leaks detected TO DO: 1. I have not yet turned on the LocalOnly flag for diffuser models, so the code will check the Hugging Face repo for updates before using the locally cached models. This will break firewalled systems. I am thinking of putting in a global check for internet connectivity at startup time and setting the LocalOnly flag based on this. It would be good to check updates if there is connectivity. 2. I have not gone completely through INITIAL_MODELS.yaml to check which models are available as diffusers and which are not. So models like PaperCut and VoxelArt may not load properly. The runway and stability models are checked, as well as the Trinart models. 3. Add stanzas for SD 2.0 and 2.1 in INITIAL_MODELS.yaml REMAINING PROBLEMS NOT DIRECTLY RELATED TO MODEL_CACHE: 1. When loading a .ckpt file there are lots of messages like this: Warning! ldm.modules.attention.CrossAttention is no longer being maintained. Please use InvokeAICrossAttention instead. I'm not sure how to address this. 2. The ckpt models ***don't actually run*** due to the lack of special-case support for them in the generator objects. For example, here's the hard crash you get when you run txt2img against the legacy waifu-diffusion-1.3 model: ``` >> An error occurred: Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 140, in main main_loop(gen, opt) File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 371, in main_loop gen.prompt2image( File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1265, in __getattr__ raise AttributeError("'{}' object has no attribute '{}'".format( AttributeError: 'LatentDiffusion' object has no attribute 'image_from_embeddings' ``` 3. The inpainting diffusion model isn't working. Here's the output of "banana sushi" when inpainting-1.5 is loaded: ``` Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 301, in image_from_embeddings result_latents, result_attention_map_saver = self.latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 330, in latents_from_embeddings result: PipelineIntermediateState = infer_latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 185, in __call__ for result in self.generator_method(*args, **kwargs): File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 367, in generate_latents_from_embeddings step_output = self.step(batched_t, latents, guidance_scale, File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context return func(*args, **kwargs) File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 409, in step step_output = self.scheduler.step(noise_pred, timestep, latents, **extra_step_kwargs) File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/diffusers/schedulers/scheduling_lms_discrete.py", line 223, in step pred_original_sample = sample - sigma * model_output RuntimeError: The size of tensor a (9) must match the size of tensor b (4) at non-singleton dimension 1 ``` * proper support for float32/float16 - configure script now correctly detects user's preference for fp16/32 and downloads the correct diffuser version. If fp16 version not available, falls back to fp32 version. - misc code cleanup and simplification in model_cache * add on-the-fly conversion of .ckpt to diffusers models 1. On-the-fly conversion code can be found in the file ldm/invoke/ckpt_to_diffusers.py. 2. A new !optimize command has been added to the CLI. Should be ported to Web GUI. User experience on the CLI is this: ``` invoke> !optimize /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt INFO: Converting legacy weights file /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt to optimized diffuser model. This operation will take 30-60s to complete. Success. Optimized model is now located at /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 Writing new config file entry for sd-v1-4... >> New configuration: sd-v1-4: description: Optimized version of sd-v1-4 format: diffusers path: /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 OK to import [n]? y >> Verifying that new model loads... >> Current VRAM usage: 2.60G >> Offloading stable-diffusion-2.1 to CPU >> Loading diffusers model from /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 | Using faster float16 precision You have disabled the safety checker for <class 'ldm.invoke.generator.diffusers_pipeline.StableDiffusionGeneratorPipeline'> by passing `safety_checker=None`. Ensure that you abide to the conditions of the Stable Diffusion \ license and do not expose unfiltered results in services or applications open to the public. Both the diffusers team and Hugging Face strongly recommend to keep the safety filter enabled in all public facing circumstances,\ disabling it only for use-cases that involve analyzing network behavior or auditing its results. For more information, please have a look at https://github.com/huggingface/diffusers/pull/254 . | training width x height = (512 x 512) >> Model loaded in 3.48s >> Max VRAM used to load the model: 2.17G >> Current VRAM usage:2.17G >> Textual inversions available: >> Setting Sampler to k_lms (LMSDiscreteScheduler) Keep model loaded? [y] ``` * add parallel set of generator files for ckpt legacy generation * generation using legacy ckpt models now working * diffusers: fix missing attention_maps_callback fix for 23eb80b40421b2bb8f4b6d3dd30490d11c447b36 * associate legacy CrossAttention with .ckpt models * enable autoconvert New --autoconvert CLI option will scan a designated directory for new .ckpt files, convert them into diffuser models, and import them into models.yaml. Works like this: invoke.py --autoconvert /path/to/weights/directory In ModelCache added two new methods: autoconvert_weights(config_path, weights_directory_path, models_directory_path) convert_and_import(ckpt_path, diffuser_path) * diffusers: update to diffusers 0.11 (from 0.10.2) * fix vae loading & width/height calculation * refactor: encapsulate these conditioning data into one container * diffusers: fix some noise-scaling issues by pushing the noise-mixing down to the common function * add support for safetensors and accelerate * set local_files_only when internet unreachable * diffusers: fix error-handling path when model repo has no fp16 branch * fix generatorinpaint error Fixes : "ModuleNotFoundError: No module named 'ldm.invoke.generatorinpaint' https://github.com/invoke-ai/InvokeAI/pull/1583#issuecomment-1363634318 * quench diffuser safety-checker warning * diffusers: support stochastic DDIM eta parameter * fix conda env creation on macos * fix cross-attention with diffusers 0.11 * diffusers: the VAE needs to be tiling as well as the U-Net * diffusers: comment on subfolders * diffusers: embiggen! * diffusers: make model_cache.list_models serializable * diffusers(inpaint): restore scaling functionality * fix requirements clash between numba and numpy 1.24 * diffusers: allow inpainting model to do non-inpainting tasks * start expanding model_cache functionality * add import_ckpt_model() and import_diffuser_model() methods to model_manager - in addition, model_cache.py is now renamed to model_manager.py * allow "recommended" flag to be optional in INITIAL_MODELS.yaml * configure_invokeai now downloads VAE diffusers in advance * rename ModelCache to ModelManager * remove support for `repo_name` in models.yaml * check for and refuse to load embeddings trained on incompatible models * models.yaml.example: s/repo_name/repo_id and remove extra INITIAL_MODELS now that the main one has diffusers models in it. * add MVP textual inversion script * refactor(InvokeAIDiffuserComponent): factor out _combine() * InvokeAIDiffuserComponent: implement threshold * InvokeAIDiffuserComponent: diagnostic logs for threshold ...this does not look right * add a curses-based frontend to textual inversion - not quite working yet - requires npyscreen installed - on windows will also have the windows-curses requirement, but not added to requirements yet * add curses-based interface for textual inversion * fix crash in convert_and_import() - This corrects a "local variable referenced before assignment" error in model_manager.convert_and_import() * potential workaround for no 'state_dict' key error - As reported in https://github.com/huggingface/diffusers/issues/1876 * create TI output dir if needed * Update environment-lin-cuda.yml (#2159) Fixing line 42 to be the proper order to define the transformers requirement: ~= instead of =~ * diffusers: update sampler-to-scheduler mapping based on https://github.com/huggingface/diffusers/issues/277#issuecomment-1371428672 * improve user exp for ckt to diffusers conversion - !optimize_models command now operates on an existing ckpt file entry in models.yaml - replaces existing entry, rather than adding a new one - offers to delete the ckpt file after conversion * web: adapt progress callback to deal with old generator or new diffusers pipeline * clean-up model_manager code - add_model() verified to work for .ckpt local paths, .ckpt remote URLs, diffusers local paths, and diffusers repo_ids - convert_and_import() verified to work for local and remove .ckpt files * handle edge cases for import_model() and convert_model() * add support for safetensor .ckpt files * fix name error * code cleanup with pyflake * improve model setting behavior - If the user enters an invalid model name at startup time, will not try to load it, warn, and use default model - CLI UI enhancement: include currently active model in the command line prompt. * update test-invoke-pip.yml - fix model cache path to point to runwayml/stable-diffusion-v1-5 - remove `skip-sd-weights` from configure_invokeai.py args * exclude dev/diffusers from "fail for draft PRs" * disable "fail on PR jobs" * re-add `--skip-sd-weights` since no space * update workflow environments - include `INVOKE_MODEL_RECONFIGURE: '--yes'` * clean up model load failure handling - Allow CLI to run even when no model is defined or loadable. - Inhibit stack trace when model load fails - only show last error - Give user *option* to run configure_invokeai.py when no models successfully load. - Restart invokeai after reconfiguration. * further edge-case handling 1) only one model in models.yaml file, and that model is broken 2) no models in models.yaml 3) models.yaml doesn't exist at all * fix incorrect model status listing - "cached" was not being returned from list_models() - normalize handling of exceptions during model loading: - Passing an invalid model name to generate.set_model() will return a KeyError - All other exceptions are returned as the appropriate Exception * CI: do download weights (if not already cached) * diffusers: fix scheduler loading in offline mode * CI: fix model name (no longer has `diffusers-` prefix) * Update txt2img2img.py (#2256) * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * feat - make model storage compatible with hugging face caching system This commit alters the InvokeAI model directory to be compatible with hugging face, making it easier to share diffusers (and other models) across different programs. - If the HF_HOME environment variable is not set, then models are cached in ~/invokeai/models in a format that is identical to the HuggingFace cache. - If HF_HOME is set, then models are cached wherever HF_HOME points. - To enable sharing with other HuggingFace library clients, set HF_HOME to ~/.cache/huggingface to set the default cache location or to ~/invokeai/models to have huggingface cache inside InvokeAI. * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * fix error "no attribute CkptInpaint" * model_manager.list_models() returns entire model config stanza+status * Initial Draft - Model Manager Diffusers * added hash function to diffusers * implement sha256 hashes on diffusers models * Add Model Manager Support for Diffusers * fix various problems with model manager - in cli import functions, fix not enough values to unpack from _get_name_and_desc() - fix crash when using old-style vae: value with new-style diffuser * rebuild frontend * fix dictconfig-not-serializable issue * fix NoneType' object is not subscriptable crash in model_manager * fix "str has no attribute get" error in model_manager list_models() * Add path and repo_id support for Diffusers Model Manager Also fixes bugs * Fix tooltip IT localization not working * Add Version Number To WebUI * Optimize Model Search * Fix incorrect font on the Model Manager UI * Fix image degradation on merge fixes - [Experimental] This change should effectively fix a couple of things. - Fix image degradation on subsequent merges of the canvas layers. - Fix the slight transparent border that is left behind when filling the bounding box with a color. - Fix the left over line of color when filling a bounding box with color. So far there are no side effects for this. If any, please report. * Add local model filtering for Diffusers / Checkpoints * Go to home on modal close for the Add Modal UI * Styling Fixes * Model Manager Diffusers Localization Update * Add Safe Tensor scanning to Model Manager * Fix model edit form dispatching string values instead of numbers. * Resolve VAE handling / edge cases for supplied repos * defer injecting tokens for textual inversions until they're used for the first time * squash a console warning * implement model migration check * add_model() overwrites previous config rather than merges * fix model config file attribute merging * fix precision handling in textual inversion script * allow ckpt conversion script to work with safetensors .ckpts Applied patch here: https://github.com/huggingface/diffusers/commit/beb932c5d111872c5e45387e7b1b2b3dd0524a47 * fix name "args" is not defined crash in textual_inversion_training * fix a second NameError: name 'args' is not defined crash * fix loading of the safety checker from the global cache dir * add installation step to textual inversion frontend - After a successful training run, the script will copy learned_embeds.bin to a subfolder of the embeddings directory. - User given the option to delete the logs and intermediate checkpoints (which together use 7-8G of space) - If textual inversion training fails, reports the error gracefully. * don't crash out on incompatible embeddings - put try: blocks around places where the system tries to load an embedding which is incompatible with the currently loaded model * add support for checkpoint resuming * textual inversion preferences are saved and restored between sessions - Preferences are stored in a file named text-inversion-training/preferences.conf - Currently the resume-from-checkpoint option is not working correctly. Possible bug in textual_inversion_training.py? * copy learned_embeddings.bin into right location * add front end for diffusers model merging - Front end doesn't do anything yet!!!! - Made change to model name parsing in CLI to support ability to have merged models with the "+" character in their names. * improve inpainting experience - recommend ckpt version of inpainting-1.5 to user - fix get_noise() bug in ckpt version of omnibus.py * update environment*yml * tweak instructions to install HuggingFace token * bump version number * enhance update scripts - update scripts will now fetch new INITIAL_MODELS.yaml so that configure_invokeai.py will know about the diffusers versions. * enhance invoke.sh/invoke.bat launchers - added configure_invokeai.py to menu - menu defaults to browser-based invoke * remove conda workflow (#2321) * fix `token_ids has shape torch.Size([79]) - expected [77]` * update CHANGELOG.md with 2.3.* info - Add information on how formats have changed and the upgrade process. - Add short bug list. Co-authored-by: Damian Stewart <d@damianstewart.com> Co-authored-by: Damian Stewart <null@damianstewart.com> Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> Co-authored-by: Wybartel-luxmc <37852506+Wybartel-luxmc@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> Co-authored-by: mickr777 <115216705+mickr777@users.noreply.github.com> Co-authored-by: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Co-authored-by: Eugene Brodsky <ebr@users.noreply.github.com> Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com>
2023-01-15 14:22:46 +00:00
previous_model_name = self.model_name
# the model cache does the loading and offloading
use 🧨diffusers model (#1583) * initial commit of DiffusionPipeline class * spike: proof of concept using diffusers for txt2img * doc: type hints for Generator * refactor(model_cache): factor out load_ckpt * model_cache: add ability to load a diffusers model pipeline and update associated things in Generate & Generator to not instantly fail when that happens * model_cache: fix model default image dimensions * txt2img: support switching diffusers schedulers * diffusers: let the scheduler do its scaling of the initial latents Remove IPNDM scheduler; it is not behaving. * web server: update image_progress callback for diffusers data * diffusers: restore prompt weighting feature * diffusers: fix set-sampler error following model switch * diffusers: use InvokeAIDiffuserComponent for conditioning * cross_attention_control: stub (no-op) implementations for diffusers * model_cache: let offload_model work with DiffusionPipeline, sorta. * models.yaml.example: add diffusers-format model, set as default * test-invoke-conda: use diffusers-format model test-invoke-conda: put huggingface-token where the library can use it * environment-mac: upgrade to diffusers 0.7 (from 0.6) this was already done for linux; mac must have been lost in the merge. * preload_models: explicitly load diffusers models In non-interactive mode too, as long as you're logged in. * fix(model_cache): don't check `model.config` in diffusers format clean-up from recent merge. * diffusers integration: support img2img * dev: upgrade to diffusers 0.8 (from 0.7.1) We get to remove some code by using methods that were factored out in the base class. * refactor: remove backported img2img.get_timesteps now that we can use it directly from diffusers 0.8.1 * ci: use diffusers model * dev: upgrade to diffusers 0.9 (from 0.8.1) * lint: correct annotations for Python 3.9. * lint: correct AttributeError.name reference for Python 3.9. * CI: prefer diffusers-1.4 because it no longer requires a token The RunwayML models still do. * build: there's yet another place to update requirements? * configure: try to download models even without token Models in the CompVis and stabilityai repos no longer require them. (But runwayml still does.) * configure: add troubleshooting info for config-not-found * fix(configure): prepend root to config path * fix(configure): remove second `default: true` from models example * CI: simplify test-on-push logic now that we don't need secrets The "test on push but only in forks" logic was only necessary when tests didn't work for PRs-from-forks. * create an embedding_manager for diffusers * internal: avoid importing diffusers DummyObject see https://github.com/huggingface/diffusers/issues/1479 * fix "config attributes…not expected" diffusers warnings. * fix deprecated scheduler construction * work around an apparent MPS torch bug that causes conditioning to have no effect * 🚧 post-rebase repair * preliminary support for outpainting (no masking yet) * monkey-patch diffusers.attention and use Invoke lowvram code * add always_use_cpu arg to bypass MPS * add cross-attention control support to diffusers (fails on MPS) For unknown reasons MPS produces garbage output with .swap(). Use --always_use_cpu arg to invoke.py for now to test this code on MPS. * diffusers support for the inpainting model * fix debug_image to not crash with non-RGB images. * inpainting for the normal model [WIP] This seems to be performing well until the LAST STEP, at which point it dissolves to confetti. * fix off-by-one bug in cross-attention-control (#1774) prompt token sequences begin with a "beginning-of-sequence" marker <bos> and end with a repeated "end-of-sequence" marker <eos> - to make a default prompt length of <bos> + 75 prompt tokens + <eos>. the .swap() code was failing to take the column for <bos> at index 0 into account. the changes here do that, and also add extra handling for a single <eos> (which may be redundant but which is included for completeness). based on my understanding and some assumptions about how this all works, the reason .swap() nevertheless seemed to do the right thing, to some extent, is because over multiple steps the conditioning process in Stable Diffusion operates as a feedback loop. a change to token n-1 has flow-on effects to how the [1x4x64x64] latent tensor is modified by all the tokens after it, - and as the next step is processed, all the tokens before it as well. intuitively, a token's conditioning effects "echo" throughout the whole length of the prompt. so even though the token at n-1 was being edited when what the user actually wanted was to edit the token at n, it nevertheless still had some non-negligible effect, in roughly the right direction, often enough that it seemed like it was working properly. * refactor common CrossAttention stuff into a mixin so that the old ldm code can still work if necessary * inpainting for the normal model. I think it works this time. * diffusers: reset num_vectors_per_token sync with 44a00555718f1df173c60da0ed646cf700e29537 * diffusers: txt2img2img (hires_fix) with so much slicing and dicing of pipeline methods to stitch them together * refactor(diffusers): reduce some code duplication amongst the different tasks * fixup! refactor(diffusers): reduce some code duplication amongst the different tasks * diffusers: enable DPMSolver++ scheduler * diffusers: upgrade to diffusers 0.10, add Heun scheduler * diffusers(ModelCache): stopgap to make from_cpu compatible with diffusers * CI: default to diffusers-1.5 now that runwayml token requirement is gone * diffusers: update to 0.10 (and transformers to 4.25) * diffusers: use xformers when available diffusers no longer auto-enables this as of 0.10.2. * diffusers: make masked img2img behave better with multi-step schedulers re-randomizing the noise each step was confusing them. * diffusers: work more better with more models. fixed relative path problem with local models. fixed models on hub not always having a `fp16` branch. * diffusers: stopgap fix for attention_maps_callback crash after recent merge * fixup import merge conflicts correction for 061c5369a2247c6c92cd69606bcf54c4f1962a0b * test: add tests/inpainting inputs for masked img2img * diffusers(AddsMaskedGuidance): partial fix for k-schedulers Prevents them from crashing, but results are still hot garbage. * fix --safety_checker arg parsing and add note to diffusers loader about where safety checker gets called * generate: fix import error * CI: don't try to read the old init location * diffusers: support loading an alternate VAE * CI: remove sh-syntax if-statement so it doesn't crash powershell * CI: fold strings in yaml because backslash is not line-continuation in powershell * attention maps callback stuff for diffusers * build: fix syntax error in environment-mac * diffusers: add INITIAL_MODELS with diffusers-compatible repos * re-enable the embedding manager; closes #1778 * Squashed commit of the following: commit e4a956abc37fcb5cf188388b76b617bc5c8fda7d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:43:07 2022 +0100 import new load handling from EmbeddingManager and cleanup commit c4abe91a5ba0d415b45bf734068385668b7a66e6 Merge: 032e856e 1efc6397 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:09:53 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers_with_textual_inversion_manager commit 032e856eefb3bbc39534f5daafd25764bcfcef8b Merge: 8b4f0fe9 bc515e24 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:08:01 2022 +0100 Merge remote-tracking branch 'upstream/dev/diffusers' into dev/diffusers_with_textual_inversion_manager commit 1efc6397fc6e61c1aff4b0258b93089d61de5955 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:04:28 2022 +0100 cleanup and add performance notes commit e400f804ac471a0ca2ba432fd658778b20c7bdab Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:45:07 2022 +0100 fix bug and update unit tests commit deb9ae0ae1016750e93ce8275734061f7285a231 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:28:29 2022 +0100 textual inversion manager seems to work commit 162e02505dec777e91a983c4d0fb52e950d25ff0 Merge: cbad4583 12769b3d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:58:03 2022 +0100 Merge branch 'main' into feature_textual_inversion_mgr commit cbad45836c6aace6871a90f2621a953f49433131 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:54:10 2022 +0100 use position embeddings commit 070344c69b0e0db340a183857d0a787b348681d3 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:53:47 2022 +0100 Don't crash CLI on exceptions commit b035ac8c6772dfd9ba41b8eeb9103181cda028f8 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:11:55 2022 +0100 add missing position_embeddings commit 12769b3d3562ef71e0f54946b532ad077e10043c Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:33:25 2022 +0100 debugging why it don't work commit bafb7215eabe1515ca5e8388fd3bb2f3ac5362cf Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:21:33 2022 +0100 debugging why it don't work commit 664a6e9e146b42d96703f0cc8baf8f5efec04ee1 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit 8b4f0fe9d6e4e2643b36dfa27864294785d7ba4e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit ffbe1ab11163ba712e353d89404e301d0e0c6cdf Merge: 6e4dad60 023df37e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:37:31 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers commit 023df37efffa67434f77def7fc3c9dfb29f699fd Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:36:54 2022 +0100 cleanup commit 05fac594eaf79d0058e3c48deee93df603f136c2 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:07:49 2022 +0100 tweak error checking commit 009f32ed39a7280997c3ffab112adadee0b44279 Author: damian <null@damianstewart.com> Date: Thu Dec 15 21:29:47 2022 +0100 unit tests passing for embeddings with vector length >1 commit beb1b08d9a98112ed2fe073580568e1a18698da3 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:39:09 2022 +0100 more explicit equality tests when overwriting commit 44d8a5a7c85cdabc9ce3a54fd0769a10597b3ca9 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:30:13 2022 +0100 wip textual inversion manager (unit tests passing for 1v embedding overwriting) commit 417c2b57d90924a839616bfb66804faab8039e4c Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 12:30:55 2022 +0100 wip textual inversion manager (unit tests passing for base stuff + padding) commit 2e80872e3b6f7fd7d8eb8928822bd824b63cb2ff Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 10:57:57 2022 +0100 wip new TextualInversionManager * stop using WeightedFrozenCLIPEmbedder * store diffusion models locally - configure_invokeai.py reconfigured to store diffusion models rather than CompVis models - hugging face caching model is used, but cache is set to ~/invokeai/models/repo_id - models.yaml does **NOT** use path, just repo_id - "repo_name" changed to "repo_id" to following hugging face conventions - Models are loaded with full precision pending further work. * allow non-local files during development * path takes priority over repo_id * MVP for model_cache and configure_invokeai - Feature complete (almost) - configure_invokeai.py downloads both .ckpt and diffuser models, along with their VAEs. Both types of download are controlled by a unified INITIAL_MODELS.yaml file. - model_cache can load both type of model and switches back and forth in CPU. No memory leaks detected TO DO: 1. I have not yet turned on the LocalOnly flag for diffuser models, so the code will check the Hugging Face repo for updates before using the locally cached models. This will break firewalled systems. I am thinking of putting in a global check for internet connectivity at startup time and setting the LocalOnly flag based on this. It would be good to check updates if there is connectivity. 2. I have not gone completely through INITIAL_MODELS.yaml to check which models are available as diffusers and which are not. So models like PaperCut and VoxelArt may not load properly. The runway and stability models are checked, as well as the Trinart models. 3. Add stanzas for SD 2.0 and 2.1 in INITIAL_MODELS.yaml REMAINING PROBLEMS NOT DIRECTLY RELATED TO MODEL_CACHE: 1. When loading a .ckpt file there are lots of messages like this: Warning! ldm.modules.attention.CrossAttention is no longer being maintained. Please use InvokeAICrossAttention instead. I'm not sure how to address this. 2. The ckpt models ***don't actually run*** due to the lack of special-case support for them in the generator objects. For example, here's the hard crash you get when you run txt2img against the legacy waifu-diffusion-1.3 model: ``` >> An error occurred: Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 140, in main main_loop(gen, opt) File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 371, in main_loop gen.prompt2image( File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1265, in __getattr__ raise AttributeError("'{}' object has no attribute '{}'".format( AttributeError: 'LatentDiffusion' object has no attribute 'image_from_embeddings' ``` 3. The inpainting diffusion model isn't working. Here's the output of "banana sushi" when inpainting-1.5 is loaded: ``` Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 301, in image_from_embeddings result_latents, result_attention_map_saver = self.latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 330, in latents_from_embeddings result: PipelineIntermediateState = infer_latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 185, in __call__ for result in self.generator_method(*args, **kwargs): File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 367, in generate_latents_from_embeddings step_output = self.step(batched_t, latents, guidance_scale, File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context return func(*args, **kwargs) File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 409, in step step_output = self.scheduler.step(noise_pred, timestep, latents, **extra_step_kwargs) File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/diffusers/schedulers/scheduling_lms_discrete.py", line 223, in step pred_original_sample = sample - sigma * model_output RuntimeError: The size of tensor a (9) must match the size of tensor b (4) at non-singleton dimension 1 ``` * proper support for float32/float16 - configure script now correctly detects user's preference for fp16/32 and downloads the correct diffuser version. If fp16 version not available, falls back to fp32 version. - misc code cleanup and simplification in model_cache * add on-the-fly conversion of .ckpt to diffusers models 1. On-the-fly conversion code can be found in the file ldm/invoke/ckpt_to_diffusers.py. 2. A new !optimize command has been added to the CLI. Should be ported to Web GUI. User experience on the CLI is this: ``` invoke> !optimize /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt INFO: Converting legacy weights file /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt to optimized diffuser model. This operation will take 30-60s to complete. Success. Optimized model is now located at /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 Writing new config file entry for sd-v1-4... >> New configuration: sd-v1-4: description: Optimized version of sd-v1-4 format: diffusers path: /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 OK to import [n]? y >> Verifying that new model loads... >> Current VRAM usage: 2.60G >> Offloading stable-diffusion-2.1 to CPU >> Loading diffusers model from /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 | Using faster float16 precision You have disabled the safety checker for <class 'ldm.invoke.generator.diffusers_pipeline.StableDiffusionGeneratorPipeline'> by passing `safety_checker=None`. Ensure that you abide to the conditions of the Stable Diffusion \ license and do not expose unfiltered results in services or applications open to the public. Both the diffusers team and Hugging Face strongly recommend to keep the safety filter enabled in all public facing circumstances,\ disabling it only for use-cases that involve analyzing network behavior or auditing its results. For more information, please have a look at https://github.com/huggingface/diffusers/pull/254 . | training width x height = (512 x 512) >> Model loaded in 3.48s >> Max VRAM used to load the model: 2.17G >> Current VRAM usage:2.17G >> Textual inversions available: >> Setting Sampler to k_lms (LMSDiscreteScheduler) Keep model loaded? [y] ``` * add parallel set of generator files for ckpt legacy generation * generation using legacy ckpt models now working * diffusers: fix missing attention_maps_callback fix for 23eb80b40421b2bb8f4b6d3dd30490d11c447b36 * associate legacy CrossAttention with .ckpt models * enable autoconvert New --autoconvert CLI option will scan a designated directory for new .ckpt files, convert them into diffuser models, and import them into models.yaml. Works like this: invoke.py --autoconvert /path/to/weights/directory In ModelCache added two new methods: autoconvert_weights(config_path, weights_directory_path, models_directory_path) convert_and_import(ckpt_path, diffuser_path) * diffusers: update to diffusers 0.11 (from 0.10.2) * fix vae loading & width/height calculation * refactor: encapsulate these conditioning data into one container * diffusers: fix some noise-scaling issues by pushing the noise-mixing down to the common function * add support for safetensors and accelerate * set local_files_only when internet unreachable * diffusers: fix error-handling path when model repo has no fp16 branch * fix generatorinpaint error Fixes : "ModuleNotFoundError: No module named 'ldm.invoke.generatorinpaint' https://github.com/invoke-ai/InvokeAI/pull/1583#issuecomment-1363634318 * quench diffuser safety-checker warning * diffusers: support stochastic DDIM eta parameter * fix conda env creation on macos * fix cross-attention with diffusers 0.11 * diffusers: the VAE needs to be tiling as well as the U-Net * diffusers: comment on subfolders * diffusers: embiggen! * diffusers: make model_cache.list_models serializable * diffusers(inpaint): restore scaling functionality * fix requirements clash between numba and numpy 1.24 * diffusers: allow inpainting model to do non-inpainting tasks * start expanding model_cache functionality * add import_ckpt_model() and import_diffuser_model() methods to model_manager - in addition, model_cache.py is now renamed to model_manager.py * allow "recommended" flag to be optional in INITIAL_MODELS.yaml * configure_invokeai now downloads VAE diffusers in advance * rename ModelCache to ModelManager * remove support for `repo_name` in models.yaml * check for and refuse to load embeddings trained on incompatible models * models.yaml.example: s/repo_name/repo_id and remove extra INITIAL_MODELS now that the main one has diffusers models in it. * add MVP textual inversion script * refactor(InvokeAIDiffuserComponent): factor out _combine() * InvokeAIDiffuserComponent: implement threshold * InvokeAIDiffuserComponent: diagnostic logs for threshold ...this does not look right * add a curses-based frontend to textual inversion - not quite working yet - requires npyscreen installed - on windows will also have the windows-curses requirement, but not added to requirements yet * add curses-based interface for textual inversion * fix crash in convert_and_import() - This corrects a "local variable referenced before assignment" error in model_manager.convert_and_import() * potential workaround for no 'state_dict' key error - As reported in https://github.com/huggingface/diffusers/issues/1876 * create TI output dir if needed * Update environment-lin-cuda.yml (#2159) Fixing line 42 to be the proper order to define the transformers requirement: ~= instead of =~ * diffusers: update sampler-to-scheduler mapping based on https://github.com/huggingface/diffusers/issues/277#issuecomment-1371428672 * improve user exp for ckt to diffusers conversion - !optimize_models command now operates on an existing ckpt file entry in models.yaml - replaces existing entry, rather than adding a new one - offers to delete the ckpt file after conversion * web: adapt progress callback to deal with old generator or new diffusers pipeline * clean-up model_manager code - add_model() verified to work for .ckpt local paths, .ckpt remote URLs, diffusers local paths, and diffusers repo_ids - convert_and_import() verified to work for local and remove .ckpt files * handle edge cases for import_model() and convert_model() * add support for safetensor .ckpt files * fix name error * code cleanup with pyflake * improve model setting behavior - If the user enters an invalid model name at startup time, will not try to load it, warn, and use default model - CLI UI enhancement: include currently active model in the command line prompt. * update test-invoke-pip.yml - fix model cache path to point to runwayml/stable-diffusion-v1-5 - remove `skip-sd-weights` from configure_invokeai.py args * exclude dev/diffusers from "fail for draft PRs" * disable "fail on PR jobs" * re-add `--skip-sd-weights` since no space * update workflow environments - include `INVOKE_MODEL_RECONFIGURE: '--yes'` * clean up model load failure handling - Allow CLI to run even when no model is defined or loadable. - Inhibit stack trace when model load fails - only show last error - Give user *option* to run configure_invokeai.py when no models successfully load. - Restart invokeai after reconfiguration. * further edge-case handling 1) only one model in models.yaml file, and that model is broken 2) no models in models.yaml 3) models.yaml doesn't exist at all * fix incorrect model status listing - "cached" was not being returned from list_models() - normalize handling of exceptions during model loading: - Passing an invalid model name to generate.set_model() will return a KeyError - All other exceptions are returned as the appropriate Exception * CI: do download weights (if not already cached) * diffusers: fix scheduler loading in offline mode * CI: fix model name (no longer has `diffusers-` prefix) * Update txt2img2img.py (#2256) * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * feat - make model storage compatible with hugging face caching system This commit alters the InvokeAI model directory to be compatible with hugging face, making it easier to share diffusers (and other models) across different programs. - If the HF_HOME environment variable is not set, then models are cached in ~/invokeai/models in a format that is identical to the HuggingFace cache. - If HF_HOME is set, then models are cached wherever HF_HOME points. - To enable sharing with other HuggingFace library clients, set HF_HOME to ~/.cache/huggingface to set the default cache location or to ~/invokeai/models to have huggingface cache inside InvokeAI. * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * fix error "no attribute CkptInpaint" * model_manager.list_models() returns entire model config stanza+status * Initial Draft - Model Manager Diffusers * added hash function to diffusers * implement sha256 hashes on diffusers models * Add Model Manager Support for Diffusers * fix various problems with model manager - in cli import functions, fix not enough values to unpack from _get_name_and_desc() - fix crash when using old-style vae: value with new-style diffuser * rebuild frontend * fix dictconfig-not-serializable issue * fix NoneType' object is not subscriptable crash in model_manager * fix "str has no attribute get" error in model_manager list_models() * Add path and repo_id support for Diffusers Model Manager Also fixes bugs * Fix tooltip IT localization not working * Add Version Number To WebUI * Optimize Model Search * Fix incorrect font on the Model Manager UI * Fix image degradation on merge fixes - [Experimental] This change should effectively fix a couple of things. - Fix image degradation on subsequent merges of the canvas layers. - Fix the slight transparent border that is left behind when filling the bounding box with a color. - Fix the left over line of color when filling a bounding box with color. So far there are no side effects for this. If any, please report. * Add local model filtering for Diffusers / Checkpoints * Go to home on modal close for the Add Modal UI * Styling Fixes * Model Manager Diffusers Localization Update * Add Safe Tensor scanning to Model Manager * Fix model edit form dispatching string values instead of numbers. * Resolve VAE handling / edge cases for supplied repos * defer injecting tokens for textual inversions until they're used for the first time * squash a console warning * implement model migration check * add_model() overwrites previous config rather than merges * fix model config file attribute merging * fix precision handling in textual inversion script * allow ckpt conversion script to work with safetensors .ckpts Applied patch here: https://github.com/huggingface/diffusers/commit/beb932c5d111872c5e45387e7b1b2b3dd0524a47 * fix name "args" is not defined crash in textual_inversion_training * fix a second NameError: name 'args' is not defined crash * fix loading of the safety checker from the global cache dir * add installation step to textual inversion frontend - After a successful training run, the script will copy learned_embeds.bin to a subfolder of the embeddings directory. - User given the option to delete the logs and intermediate checkpoints (which together use 7-8G of space) - If textual inversion training fails, reports the error gracefully. * don't crash out on incompatible embeddings - put try: blocks around places where the system tries to load an embedding which is incompatible with the currently loaded model * add support for checkpoint resuming * textual inversion preferences are saved and restored between sessions - Preferences are stored in a file named text-inversion-training/preferences.conf - Currently the resume-from-checkpoint option is not working correctly. Possible bug in textual_inversion_training.py? * copy learned_embeddings.bin into right location * add front end for diffusers model merging - Front end doesn't do anything yet!!!! - Made change to model name parsing in CLI to support ability to have merged models with the "+" character in their names. * improve inpainting experience - recommend ckpt version of inpainting-1.5 to user - fix get_noise() bug in ckpt version of omnibus.py * update environment*yml * tweak instructions to install HuggingFace token * bump version number * enhance update scripts - update scripts will now fetch new INITIAL_MODELS.yaml so that configure_invokeai.py will know about the diffusers versions. * enhance invoke.sh/invoke.bat launchers - added configure_invokeai.py to menu - menu defaults to browser-based invoke * remove conda workflow (#2321) * fix `token_ids has shape torch.Size([79]) - expected [77]` * update CHANGELOG.md with 2.3.* info - Add information on how formats have changed and the upgrade process. - Add short bug list. Co-authored-by: Damian Stewart <d@damianstewart.com> Co-authored-by: Damian Stewart <null@damianstewart.com> Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> Co-authored-by: Wybartel-luxmc <37852506+Wybartel-luxmc@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> Co-authored-by: mickr777 <115216705+mickr777@users.noreply.github.com> Co-authored-by: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Co-authored-by: Eugene Brodsky <ebr@users.noreply.github.com> Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com>
2023-01-15 14:22:46 +00:00
cache = self.model_manager
merge release-candidate-1-3-2 into main. Squashed commit of the following: commit 9a1fe8e7fbbd81d9e9e47c4fda6bde6f66fba30c Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 12 17:07:40 2022 +0000 swap in release URLs for installers commit ff56f5251ba8502833cb561317e82b028cd2da5d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 12 17:03:21 2022 +0000 fix up bad unicode chars in invoke.py commit ed943bd6c785d968d1e31fbbb814fea8688fc8bb Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 12 16:05:45 2022 +0000 outcrop improvements, hand-added commit 7ad2355b1da53861bb75312edead8f9db0b0f44d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 12 15:14:33 2022 +0000 documentation fixes commit 66c920fc197d9206be9e0e2d1eb2a1cb86362887 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 16:49:25 2022 -0500 Revert "Resize hires as an image" This reverts commit d05b1b3544dfa7b3c071ac05b4f014a52e08fa50. commit 3fc5cb09f8bc03ea96e67a3e49fb087019d2f9d5 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 12 12:43:17 2022 +0000 fix incorrect link in install commit 1345ec77ab58f70e1bf5a0f587ca40aba4e906b7 Author: tildebyte <337875+tildebyte@users.noreply.github.com> Date: Sun Nov 6 19:07:31 2022 -0500 toil(repo): add tildebyte as owner of installer/ directory commit b116715490f390a59e5bee1022a6a758aee0918d Author: Kyle Schouviller <kyle0654@hotmail.com> Date: Thu Nov 10 21:43:56 2022 -0800 Fix performance issue introduced by torch cuda cache clear during generation commit fa3670270e7aae6bfd8d47fb7bdd32b707310c23 Author: mauwii <Mauwii@outlook.de> Date: Fri Nov 11 12:42:03 2022 +0100 small update to dockers huggingface section commit c304250ef663b3e202b4da8332365288589d94c7 Author: mauwii <Mauwii@outlook.de> Date: Fri Nov 11 12:19:27 2022 +0100 fix format and Link in INSTALL_INVOKE.md commit 802ce5dde5ca68f24aa4609cdba428044e0c7fa1 Author: mauwii <Mauwii@outlook.de> Date: Fri Nov 11 11:17:49 2022 +0100 small fixex to format and a link in INSTALL_MANUAL commit 311ee320ecac892cb4a1bcd012374fa051b1d011 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 07:23:35 2022 +0000 ignore installer intermediate files commit e9df17b374df58a44d3ae3ba33cbdc58794bcf5d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 07:19:25 2022 +0000 fix backslash-related syntax error commit 061fb4ef00482bdd4fba635aeaeff4ca7510190d Merge: 52be0d23 4095acd1 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 06:50:04 2022 +0000 Merge branch 'release-candidate-2-1-3' of github.com:/invoke-ai/InvokeAI into release-candidate-2-1-3 commit 52be0d2396de2de02030855c92e3367008b50377 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 06:49:45 2022 +0000 add WindowsLongFileName batfile to source installer commit 4095acd10ebae05a8cb14cc2faf7c79936d9e6a9 Author: mauwii <Mauwii@outlook.de> Date: Fri Nov 11 07:05:17 2022 +0100 Doc Updates A lot of re-formating of new Installation Docs also some content updates/corrections commit 201eb22d7650b00f55249c2646fa4f47ac3e0ec2 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 04:41:02 2022 +0000 prevent two models from being marked default in models.yaml commit 17ab98220034dfbb798a9a0460bc2837f0c1e2cb Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 03:56:54 2022 +0000 installers download branch HEAD not tag commit a04965b0e9e9d1170cf284af9acbd1186d681255 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 03:48:21 2022 +0000 improve messaging during installation process commit 0b529f0c574dd91fb9593e924ebc41c8c219b6ce Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 15:22:32 2022 +0000 enable outcropping of random JPG/PNG images - Works best with runwayML inpainting model - Numerous code changes required to propagate seed to final metadata. Original code predicated on the image being generated within InvokeAI. commit 6f9f84834557eb3c48562dc5d0ace51ca9e9cca2 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 17:27:42 2022 +0000 enhance outcropping with ability to direct contents of new regions - When outcropping an image you can now add a `--new_prompt` option, to specify a new prompt to be used instead of the original one used to generate the image. - Similarly you can provide a new seed using `--seed` (or `-S`). A seed of zero will pick one randomly. - This PR also fixes the crash that happened when trying to outcrop an image that does not contain InvokeAI metadata. commit 918c1589ef30595668899f4259ece6a4ad605c69 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 20:16:47 2022 +0000 fix #1402 commit 116415b3fcec8415f8e6de9b23c0bbd0dbc6845b Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 21:27:25 2022 +0000 fix invoke.py crash if no models.yaml file present - Script will now offer the user the ability to create a minimal models.yaml and then gracefully exit. - Closes #1420 commit b4b6eabaac94896e38123be331c44d1b63065b0d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 16:49:25 2022 -0500 Revert "Log strength with hires" This reverts commit 82d4904c07670d514e9a541de7c9ecd8489eeae2. commit 4ef1f4a854717c953f9192454d0adabef32af36c Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 20:01:49 2022 +0000 remove temporary directory from repo commit 510fc4ebaa5f9dc0e77b47cf04e0c265423e0a44 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 19:59:03 2022 +0000 remove -e from clipseg load in installer commit a20914434bb3609cf1d883cabf048d4cc25f881a Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 19:37:07 2022 +0000 change clipseg repo branch to avoid clipseg not found error commit 0d134195fda5c69fce5a95d6da90248eba8d226d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 18:39:29 2022 +0000 update repo URL to point to rc commit 649d8c8573896fdb5a73453b69ee4b54cf4d6241 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 18:13:28 2022 +0000 integrate tildebyte installer commit a358d370a05ea985a9e26fa9c1101d9c14fdb3ab Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 17:48:14 2022 +0000 add @tildebyte compiled pip installer commit 94a9033c4f6214e604be149a3de6d7c747af7f3a Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 14:52:00 2022 +0000 ignore source installer zip files commit 18a947c503c83c95cd83f27424696219ff3c4c95 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 14:46:36 2022 +0000 documentation and environment file fixes - Have clarified the relationship between the @tildebyte and @cmdr2 installers; However, @tildebyte installer merge is still a WIP due to conflicts over such things as `invoke.sh`. - Rechristened 1click installer as "source" installer. @tildebyte installer will be "the" installer. (We'll see which one generates the least support requests and maintenance work.) - Sync'd `environment-mac.yml` with `development`. The former was failing with a taming-transformers error as per https://discord.com/channels/@me/1037201214154231899/1040060947378749460 commit a23b03189526a49da8ddae90ce71b0e902784d29 Author: Mike DiGiovanni <vinblau@gmail.com> Date: Wed Nov 9 16:44:59 2022 -0500 Fixes typos in README.md commit 23af68c7d79d947f1bd3441c91bb44d655238f01 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 07:02:27 2022 -0500 downgrade win installs to basicsr==1.4.1 commit e258beeb51f3e645b9ea60e52d69d18722221cc5 Merge: 7460c069 e481bfac Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 06:37:45 2022 -0500 Merge branch 'release-candidate-2-1-3' of github.com:invoke-ai/InvokeAI into release-candidate-2-1-3 commit 7460c069b880b10c84b55f2e0c0998e350d6cf12 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 06:36:48 2022 -0500 remove --prefer-binary from requirements-base.txt It appears that some versions of pip do not recognize this option when it appears in the requirements file. Did not explore this further but recommend --prefer-binary in the manual install instructions on the command line. commit e481bfac615e0c798ceb5e59e8fbe3038f85b431 Merge: 5040747c d1ab65a4 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 11:21:56 2022 +0000 Merge branch 'release-candidate-2-1-3' of github.com:/invoke-ai/InvokeAI into release-candidate-2-1-3 commit 5040747c6700c9b949e3f3e1d2c3f21daffcec6c Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 11:21:43 2022 +0000 fix windows install instructions & bat file commit d1ab65a43122f73c20533d5815590ec10bc05eca Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 07:18:59 2022 +0100 update WEBUIHOTKEYS.md commit af4ee7feb8a7d2528bf4e2b3f7deee7a7c4c3dec Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 06:33:49 2022 +0100 update INSTALL_DOCKER.md commit 764fb29aded8114984d05932c4266ea24614b932 Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 06:30:15 2022 +0100 fix formatting in INSTALL.md commit 1014d3ba44aa4cd4cfdc6e3650c24a0dc9568a6e Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 06:29:14 2022 +0100 fix build.sh invokeai_conda_env_file default value commit 40a48aca88e337e9f4475f80a03b7d6d4751d09b Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 05:25:30 2022 +0100 fix environment-mac.yml moved taming-transformers-rom1504 to pip dependencies commit 92abc00f16a34a586dd16d3c64408f00e23fcb53 Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 05:19:52 2022 +0100 fix test-invoke-conda - copy required conda environment yaml - use environment.yml - I use cp instead of ln since would be compatible for windows runners commit a5719aabf89c8c5f29c6044e2882ccdcd0c6916b Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 04:14:35 2022 +0100 update Dockerfile - link environment.yml from new environemnts path - change default conda_env_file - quote all variables to avoid splitting - also remove paths from conda-env-files in build-container.yml commit 44a18511fa7accfec6a20345774583a1ce745b02 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 20:51:06 2022 +0000 update paths in container build workflow commit b850dbadafba052310327ca759d96f49a9d25d03 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 20:16:57 2022 +0000 finished reorganization of install docs commit 9ef8b944d53afb1fed94c418b2fd936d2d743797 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 18:50:58 2022 +0000 tweaks to manual install documentation --prefer-binary is an iffy option in the requirements file. It isn't supported by some versions of pip, so I removed it from requirements-base.txt and inserted it into the manual install instructions where it seems to do what it is supposed to. commit efc5a9848803b4250d726bc1913b9fd5a33fad75 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 18:20:03 2022 +0000 manual installation documentation tested on Linux commit 1417c87928e13b0ed21bf1c5604f8636d3b50a8d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 17:37:06 2022 +0000 change name of requirements.txt to avoid confusion commit 2dd6fc2b93ff7bbb4038568a3b28d36a8fafaeb8 Merge: 22213612 71ee44a8 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 17:26:24 2022 +0000 Merge branch 'release-candidate-2-1-3' of github.com:/invoke-ai/InvokeAI into release-candidate-2-1-3 commit 22213612a08bbece46eafd48994f985b097cb141 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 17:25:59 2022 +0000 directory cleanup; working on install docs commit 71ee44a827898759fd457f774c0b2ac7a1ef6519 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 02:07:13 2022 +0000 prevent crash when switching to an invalid model commit b17ca0a5e731c142101bbdbf34d121df949e86d7 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 14:28:38 2022 +0100 don't suppress exceptions when doing cross-attention control commit 71bbfe4a1a5b70f90e5f41c94df50fb104dbdd79 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 12:59:34 2022 +0100 Fix #1362 by improving VRAM usage patterns when doing .swap() commit ef3f7a26e242b73c2beb0195c7fd8f654ef47f55 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 12:18:37 2022 +0100 remove log spam commit 7189d649622d4668b120b0dd278388ad672142c4 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 12:10:28 2022 +0100 change the way saved slicing strategy is applied commit 01c40f751ab72955140165c16f95ae411732265b Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 12:04:43 2022 +0100 fix slicing_strategy_getter callsite commit f8cfe25150a346958903316bc710737d99839923 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 11:56:22 2022 +0100 cleanup, consistent dim=0 also tested commit 5bf9b1e890d48e962afd4a668a219b68271e5dc1 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 11:34:09 2022 +0100 refactored context, tested with non-sliced cross attention control commit d58a46e39bf562e7459290d2444256e8c08ad0b6 Author: damian0815 <null@damianstewart.com> Date: Sun Nov 6 00:41:52 2022 +0100 cleanup commit 7e2c658b4c06fe239311b65b9bb16fa3adec7fd7 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:57:31 2022 +0100 disable logs commit 20ee89d93841b070738b3d8a4385c93b097d92eb Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:36:58 2022 +0100 slice saved attention if necessary commit 0a7684a22c880ec0f48cc22bfed4526358f71546 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:32:38 2022 +0100 raise instead of asserting commit 7083104c7f3a0d8fd96e94a2f391de50a3c942e4 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:31:00 2022 +0100 store dim when saving slices commit f7c0808ed383ec1dc70645288a798ed2aa4fa85c Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:27:16 2022 +0100 don't retry on exception commit 749a721e939b3fe7c1741e7998dab6bd2c85a0cb Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:24:50 2022 +0100 stuff commit 032ab90e9533be8726301ec91b97137e2aadef9a Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:20:17 2022 +0100 more logging commit 3dc34b387f033482305360e605809d95a40bf6f8 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:16:47 2022 +0100 logs commit 901c4c1aa4b9bcef695a6551867ec8149e6e6a93 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:12:39 2022 +0100 actually set save_slicing_strategy to True commit f780e0a0a7c6b6a3db320891064da82589358c8a Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:10:35 2022 +0100 store slicing strategy commit 93bb6d566fd18c5c69ef7dacc8f74ba2cf671cb7 Author: damian <git@damianstewart.com> Date: Sat Nov 5 20:43:48 2022 +0100 still not it commit 5e3a9541f8ae00bde524046963910323e20c40b7 Author: damian <git@damianstewart.com> Date: Sat Nov 5 17:20:02 2022 +0100 wip offloading attention slices on-demand commit 4c2966aa856b6f3b446216da3619ae931552ef08 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 15:47:40 2022 +0100 pre-emptive offloading, idk if it works commit 572576755e9f0a878d38e8173e485126c0efbefb Author: root <you@example.com> Date: Sat Nov 5 11:25:32 2022 +0000 push attention slices to cpu. slow but saves memory. commit b57c83a68f2ac03976ebc89ce2ff03812d6d185f Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 12:04:22 2022 +0100 verbose logging commit 3a5dae116f110a96585d9eb71d713b5ed2bc3d2b Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 11:50:48 2022 +0100 wip fixing mem strategy crash (4 test on runpod) commit 3cf237db5fae0c7b0b4cc3c47c81830bdb2ae7de Author: damian0815 <null@damianstewart.com> Date: Fri Nov 4 09:02:40 2022 +0100 wip, only works on cuda commit 5702271991e126c026aa1ff41c44f8ad37b26e3a Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 14:09:36 2022 +0000 speculative reorganization of the requirements & environment files - This is only a test! - The various environment*.yml and requirements*.txt files have all been moved into a directory named "environments-and-requirements". - The idea is to clean up our root directory so that the github home page is tidy. - The manual install instructions will start with the instructions to create a symbolic link from environment.yml to the appropriate file for OS and GPU. - The 1-click installers have been updated to accommodate this change. commit 10781e7dc4f4551583a110d14f2a1f60393112b8 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 01:59:45 2022 +0000 refactoring requirements commit 099d1157c579c7b9fea20945e8504cc15745c598 Author: mauwii <Mauwii@outlook.de> Date: Wed Nov 9 00:16:18 2022 +0100 better way to make sure if conda is useable commit ab825bf7ee5f0b82d2273da1cda64fc9266a978e Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 22:05:33 2022 +0000 add back --prefer-binaries to requirements commit 10cfeb5ada7bcfc9f3aff3716ab8ea4961a8b528 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 8 22:27:19 2022 +0100 add quotes to set and use `$environment_file` commit e97515d0453583e013674b4dd1f3739c7de402cc Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 8 22:24:21 2022 +0100 set environment file for conda update commit 0f04bc5789c712bf7c7319b1d93064914993f4ec Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 8 22:21:25 2022 +0100 use conda env update commit 3f74aabecd08ed25fac158463ae12b775bd1fca2 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 8 22:20:44 2022 +0100 use command instead of hash commit b1a99a51b7ca23c4b895855bd7b4c82dbdc431e4 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 14:44:44 2022 -0500 remove --global git config from 1-click installers commit 8004f8a6d99f6ff75e00c170da40f1dec93a8914 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Mon Nov 7 09:07:20 2022 -0500 Revert "Use array slicing to calc ddim timesteps" This reverts commit 1f0c5b4cf196716c21f2db74f92c8750ad8f889d. commit ff8ff2212afb1e1c2dce4f6a61f29e2bc8302eb5 Merge: 8e5363cd 636620b1 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 14:01:40 2022 +0000 add initfile support from PR #1386 commit 8e5363cd83bff0e6be0f002c644283955f7fcbfd Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 13:26:18 2022 +0000 move 'installer/' to '1-click-installer' to make room for tildebyte installer commit 1450779146e89510d12b8c90eb316d9861c3375e Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 12:56:36 2022 +0000 update branch for installer to pull against commit 8cd5d95b8a1cb213cce2f949c394c841a09d9cab Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 05:30:20 2022 +0000 move all models into subdirectories of ./models - this required an update to the invoke-ai fork of gfpgan - simultaneously reverted consolidation of environment and requirements files, as their presence in a directory triggered setup.py to try to install a sub-package. commit abd6407394d55d4f6c064a05f3ac989dd3817c59 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 03:52:46 2022 +0000 leave a copy of environment-cuda.yml at top level - named it environment.yml - need to avoid a big change for users and breaking older support instructions. commit 734dacfbe9d8c86ca943c6541e7b5ff5ef787ff4 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 03:50:07 2022 +0000 consolidate environment files - starting to remove unneeded entries and pins - no longer require -e in front of github dependencies - update setup.py with release number - update manual installation instructions commit 636620b1d5e2466613d0dcc2a604522be12fa3a4 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 03:26:16 2022 +0000 change initfile to ~/.invokeai - adjust documentation - also fix 'clipseg_models' to 'clipseg', which seems to be working now commit 1fe41146f0975bbc9d552208473490a9ccb9fc56 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 5 14:28:01 2022 -0400 add support for an initialization file, invokeai.init - Place preferred startup command switches in a file named "invokeai.init". The file can consist of a single line of switches such as "--web --steps=28", a series of switches on each line, or any combination of the two. Example: ``` --web --host=0.0.0.0 --steps=28 --grid -f 0.6 -C 11.0 -A k_euler_a ``` - The following options, which were previously only available within the CLI, are now available on the command line as well: --steps --strength --cfg_scale --width --height --fit commit 2ad6ef355a9b9c4b17bae71edea2346c2e8708c5 Merge: 865502ee 8b47c829 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sun Nov 6 18:08:36 2022 +0000 update discord link commit 865502ee4f681de4516d231370ae603983354d8f Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 18:00:16 2022 +0100 update changelog commit c7984f3299c5c8f56a70d80907d527af458674af Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 17:07:27 2022 +0100 update TROUBLESHOOT.md commit 7f150ed83302ba875c3e0c0f39d8ac0f32c6e362 Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 16:56:58 2022 +0100 remove `:`from headlines in CONTRIBUTORS.md commit badf4e256ce6e3201df1a9a87a7072b36b18d699 Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 16:56:37 2022 +0100 enable navigation tabs Since the docs are growing, this way they look cleaner commit e64c60bbb38fc1620e08ce52bf28bd17003c7ef6 Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 16:18:59 2022 +0100 remove preflight checks from assets seems like somebody executed tests and commited them commit 178061854300632b024810e65922b54b64d95939 Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 16:15:06 2022 +0100 update INSTALLING_MODELS.md commit f91fd276242a0c92b301e99d02982d30f7b712c3 Author: Kyle Schouviller <kyle0654@hotmail.com> Date: Sat Nov 5 14:47:53 2022 -0700 Bug fix for inpaint size commit 09e41e8f769457b9ffd56901aae13991cdc6eeb8 Author: Kyle Schouviller <kyle0654@hotmail.com> Date: Sat Nov 5 14:34:52 2022 -0700 Add inpaint size options to inpaint at a larger size than the actual inpaint image, then scale back down for recombination commit 6eeb2107b300fc27cfe6134b43e5570c246b8e96 Author: mauwii <Mauwii@outlook.de> Date: Sat Nov 5 21:01:14 2022 +0100 remove create-caches.yml since not used anywhere commit 17053ad8b7efecb21a9b4eb32695089f683f72e3 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 5 16:01:55 2022 -0400 fix duplicated argument introduced by conflict resolution commit fefb4dc1f88bc6551a39602a2bc79b278cd83c59 Merge: 762ca60a d05b1b35 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 5 12:47:35 2022 -0700 Merge branch 'development' into fix_generate.py commit d05b1b3544dfa7b3c071ac05b4f014a52e08fa50 Author: Craig <cwallen@users.noreply.github.com> Date: Sat Oct 29 20:40:30 2022 -0400 Resize hires as an image commit 82d4904c07670d514e9a541de7c9ecd8489eeae2 Author: Craig <cwallen@users.noreply.github.com> Date: Sat Oct 29 20:37:40 2022 -0400 Log strength with hires commit 1cdcf33cfa39e90f9660fabf8f5936dcfb6c3aa5 Merge: 6616fa83 cbc029c6 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 5 09:57:38 2022 -0400 Merge branch 'main' into development - this synchronizes recent document fixes by mauwii commit 6616fa835ac4318bf53419f2b54b88c962559578 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 4 00:47:03 2022 -0400 fix Windows library dependency issues This commit addresses two bugs: 1) invokeai.py crashes immediately with a message about an undefined attritube sigKILL (closes #1288). The fix is to pin torch at 1.12.1. 2) Version 1.4.2 of basicsr fails to load properly on Windows, and is a requirement of realesrgan, however 1.4.1 works. Pinning basicsr in our requirements file resulted in a dependency conflict, so I ended up cloning realesrgan into the invoke-ai Git space and changing the requirements file there. If there is a more elegant solution, please advise. commit 7b9a4564b11f4181b9b3c06ecda2a4a25fd1849e Author: Matthias Wild <40327258+mauwii@users.noreply.github.com> Date: Sat Nov 5 14:36:45 2022 +0100 Update-docs (#1382) * update IMG2IMG.md * update INPAINTING.md * update WEBUIHOTKEYS.md * more doc updates (mostly fix formatting): - OUTPAINTING.md - POSTPROCESS.md - PROMPTS.md - VARIATIONS.md - WEB.md - WEBUIHOTKEYS.md commit fcdefa0620761472718afa14b2955a5d0603cfcc Author: Matthias Wild <40327258+mauwii@users.noreply.github.com> Date: Fri Nov 4 20:47:31 2022 +0100 Hotifx docs (#1376) (#1377) commit ef8b3ce639954259a95a38f44fa5329687bee781 Merge: b7042095 36870a8f Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 4 12:08:44 2022 -0400 Merge-main-into-development (#1373) To get the rid of the difference between main and development. Since otherwise it will be a pain to start fixing the documentatino (when the state between main and development is not the same ...) Also this should fix the problem of all tests failing since environment yamls get updated. commit 36870a8f53217d4b733e9bb8b119190b5e36da59 Merge: 6b89adfa b7042095 Author: Matthias Wild <40327258+mauwii@users.noreply.github.com> Date: Fri Nov 4 16:25:00 2022 +0100 Merge branch 'development' into merge-main-into-development commit b70420951d5b70937c0c07e4f8a552a01c3008bc Author: damian0815 <null@damianstewart.com> Date: Thu Nov 3 12:39:45 2022 +0100 fix parsing error doing eg `forest ().swap(in winter)` commit 1f0c5b4cf196716c21f2db74f92c8750ad8f889d Author: wfng92 <43742196+wfng92@users.noreply.github.com> Date: Thu Nov 3 17:13:52 2022 +0800 Use array slicing to calc ddim timesteps commit 8648da811190fc8bcf237d83aff38cf605851300 Author: mauwii <Mauwii@outlook.de> Date: Fri Nov 4 00:06:19 2022 +0100 update environment-linux-aarch64 to use python 3.9 commit 45b459356399f8cfb7e9af571c1643fab04218fe Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 3 22:31:46 2022 +0100 update environment-linux-aarch64.yml - move getpass_asterisk to pip commit 41b04316cf5118ea9518dc77934d135a489dd684 Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 3 20:40:08 2022 +0100 rename job, remove debug branch from triggers commit e97c6db2a3c0157a8a5ab74cd28ebee480a2d078 Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 3 20:34:01 2022 +0100 include build matrix to build x86_64 and aarch64 commit 896820a349292b0e14bbc32f0c557fe8a6b45395 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 05:01:15 2022 +0100 disable caching commit 06c8f468bff7e1dfecc1a1990164be1005b114a7 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 04:26:39 2022 +0100 disable PR-Validation since there are no files passed from context this is unecesarry commit 61920e2701c4a9cea94c03ab933c4482458215b7 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 04:09:39 2022 +0100 update action to use current branch also update build-args of dockerfile and build.sh commit f34ba7ca70f1c417ee97e8b0c57abff57614d78f Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 02:30:24 2022 +0100 remove unecesarry mkdir command again commit c30ef0895dbf0565345ac6ccb136d98a174470a6 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 01:51:12 2022 +0100 remove symlink to GFPGANv1.4 also re-add mkdir to prevent action from failing commit aa3a774f73d5004571ea42fea14cd2b525fffb1c Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 01:48:59 2022 +0100 update build-container.yml to use cachev3 commit 2c30555b844293764123baa4137fcf952d40a4e7 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 01:34:20 2022 +0100 update Dockerfile - create models.yaml from models.yaml.example - run preload_models.py with --no-interactive commit 743f60577364d43237eeb46aefd523371c36e56b Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 01:21:15 2022 +0100 update build.sh to download sd-v1.5 model commit 519c661abbae83aa62b3ee536635c39192890441 Author: mauwii <Mauwii@outlook.de> Date: Tue Oct 25 01:26:50 2022 +0200 replace old fashined markdown templates with forms this will help the readability of issues a lot 🤓 commit 22c956c75f4797ddc2dffa944e3ea84b4eb3477c Merge: 13696adc 0196571a Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 3 10:20:21 2022 -0400 Merge branch 'development' of github.com:invoke-ai/InvokeAI into development commit 13696adc3a3a2b169e68048a5b511660d0430fae Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 3 10:20:10 2022 -0400 speculative change to solve windows esrgan issues commit 0196571a12992eb8207d36e022721fe3ad2cfd19 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 2 22:39:35 2022 -0400 remove merge markers from preload_models.py commit 9666f466ab1c710dfda2e59be9e8a26fcd7e8718 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 2 18:29:34 2022 -0400 use refined model by default commit 240e5486c89552ef480c3443a63283fb86a493c3 Merge: 8164b6b9 aa247e68 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 2 18:35:00 2022 -0400 Merge branch 'spezialspezial-patch-9' into development commit 8164b6b9cff077e4131384195af65e30a40733a7 Merge: 4fc82d55 dd5a88dc Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 2 17:06:46 2022 -0400 Merge branch 'development' of github.com:invoke-ai/InvokeAI into development commit 4fc82d554ff573780c0af562a6bc9586aa56012d Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 04:17:28 2022 +1300 [WebUI] Final 2.1 Release Build commit 96b34c0f85f6ed52707fe43456d20b81822c7d1d Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 09:08:11 2022 +0100 Final WebUI build for Release 2.1 - squashed commit of 52 commits from PR #1327 don't log base64 progress images Fresh Build For WebUI [WebUI] Loopback Default False Fixes bugs/styling - Fixes missing web app state on new version: Adds stateReconciler to redux-persist. When we add more values to the state and then release the update app, they will be automatically merged in. Reseting web UI will be needed far less. 7159ec - Fixes console z-index - Moves reset web UI button to visible area Decreases gallery width on inpainting Increases workarea split padding to 1rem Adds missing tooltips to site header Changes inpainting controls settings to hover Fixes hotkeys and settings buttons not working Improves bounding box interactions - Bounding box can now be moved by dragging any of its edges - Bounding box does not affect drawing if already drawing a stroke - Can lock bounding box to draw directly on the bounding box edges - Removes spacebar-hold behaviour due to technical issues Fixes silent crash when init image too large To send the mask to the server, the UI rendered the mask onto the init image and sent the whole image. The mask was then cropped by the server. If the image was too large, the app silently failed. Maybe it exceeds the websocket size limit. Fixed by cropping the mask in the UI layer, sending only bounding-box-sized mask image data. Disabled bounding box settings when locked Styles image uploader Builds fresh bundle Improves bounding box interaction Added spacebar-hold-to-transform back. Address bounding box feedback - Adds back toggle to hide bounding box - Box quick toggle = q, normal toggle = shift + q - Styles canvas alert icons Adds hints when unable to invoke - Popover on Invoke button indicates why exactly it is disabled, e.g. prompt is empty, something else is processing, etc. - There may be more than one reason; all are displayed. Fix Inpainting Alerts Styling Preventing unnecessary re-renders across the app Code Split Inpaint Options Isolate features to their own components so they dont re-render the other stuff each time. [TESTING] Remove global isReady checking I dont believe this is need at all because the isready state is constantly updated when needed and tracked real time in the Redux store. This causes massive re-renders. @psychedelicious If this is absolutely essential for a reason that I do not see, please hit me up on Discord. Fresh Bundle Fix Bounding Box Settings re-rendering on brush stroke [Code Splitting] Bounding Box Options Isolated all bounding box components to trigger unnecessary re-renders. Still need to fix bounding box triggering re-renders on the control panel inside the canvas itself. But the options panel should be a good to go with this change. Inpainting Controls Code Spitting and Performance Codesplit the entirety of the inpainting controls. Created new selectors for each and every component to ensure there are no unnecessary re-renders. App feels a lot smoother. Fixes rerenders on ClearBrushHistory Fixes crash when requesting post-generation upscale/face restoration - Moves the inpainting paste to before the postprocessing. Removes unused isReady state Changes Report Bug icon to a bug Restores shift+q bounding box shortcut Adds alert for bounding box size to status icons Adds asCheckbox to IAIIconButton Rough draft of this. Not happy with the styling but it's clearer than having them look just like buttons. Fixes crash related to old value of progress_latents in state Styling changes and settings modal minor refactor Fixes: uploaded JPG images not loading Reworks CurrentImageButtons.tsx - Change all icons to FA iconset for consistency - Refactors IAIIconButton, IAIButton, IAIPopover to handle ref forwarding - Redesigns buttons into group Only generate 1 iteration when seed fixed & variations disabled Fixes progress images select Fixes edge case: upload over gets stuck while alt tabbing - Press esc to close it now Fixes display progress images select typing Fixes current image button rerenders Adds min width to ImageUploader Makes fast-latents in progress default Update Icon Button Checkbox Style Styling Fixes next/prev image buttons Refactor canvas buttons + more Add Save Intermediates Step Count For accurate mode only. Co-Authored-By: Richard Macarthy <richardmacarthy@protonmail.com> Restores "initial image" text Address feedback - moves mask clear button - fixes intermediates - shrinks inpainting icons by 10% Fix Loopback Styling Adds escape hotkey to close floating panels Readd Hotkey for Dual Display Updated Current Image Button Styling commit dd5a88dceeec53ceb1722a62e3689ae3dd871154 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 04:17:28 2022 +1300 [WebUI] Final 2.1 Release Build commit 95ed56bf82825a47cfe406fa34eaf4e32c129143 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 04:16:31 2022 +1300 Updated Current Image Button Styling commit 1ae80f5ab9d00a25e0c3a21e2eccd318c5343401 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 04:07:57 2022 +1300 Readd Hotkey for Dual Display commit 1f0bd3ca6cda4221d1a7a46325f235cd23bd0af9 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu Nov 3 02:07:00 2022 +1100 Adds escape hotkey to close floating panels commit a1971f6830306b3d748f7f36c2243f6dee682f97 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 03:38:15 2022 +1300 Fix Loopback Styling commit c6118e889895ba35a191124ce1beb5d2b719366d Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu Nov 3 01:29:51 2022 +1100 Address feedback - moves mask clear button - fixes intermediates - shrinks inpainting icons by 10% commit 7ba958cf7ff4e804a127b71c88666084f81e7340 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu Nov 3 01:10:38 2022 +1100 Restores "initial image" text commit 383905d5d24359aa1824de96ff124a8f8a87e015 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 02:59:11 2022 +1300 Add Save Intermediates Step Count For accurate mode only. Co-Authored-By: Richard Macarthy <richardmacarthy@protonmail.com> commit 6173e3e9cabd5e74fb466d55d7bb6a80a77b3fa8 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu Nov 3 00:53:53 2022 +1100 Refactor canvas buttons + more commit 3feb7d8922b0e4c9f944e96b95211003f40d9705 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu Nov 3 00:49:23 2022 +1100 Fixes next/prev image buttons commit 1d9edbd0ddd6e10cf120fe0de3db0b56ae374db4 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 00:50:44 2022 +1300 Update Icon Button Checkbox Style Styling commit d439abdb89db73e652add9df371234861189d90c Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 21:37:24 2022 +1100 Makes fast-latents in progress default commit ee47ea0c891a33049bdec12f1c254926f341eff2 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 21:37:09 2022 +1100 Adds min width to ImageUploader commit 300bb2e6279c1c477131b9e57425db348062f19c Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 21:28:22 2022 +1100 Fixes current image button rerenders commit ccf8593501d23e00979f7340f8991514e6ca3428 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 21:27:43 2022 +1100 Fixes display progress images select typing commit 0fda612f3ff8ad75932e158b9b29cf64c3f30eb6 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 21:02:01 2022 +1100 Fixes edge case: upload over gets stuck while alt tabbing - Press esc to close it now commit 5afff65b71bb60d067392c120efff1a17adc66af Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 20:33:19 2022 +1100 Fixes progress images select commit 7e55bdefce8920831cac7b9fa857bfbffe9e9d5d Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 20:27:47 2022 +1100 Only generate 1 iteration when seed fixed & variations disabled commit 620cf84d3dd54b8498e84574f33040a26d4d315f Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 19:51:38 2022 +1100 Reworks CurrentImageButtons.tsx - Change all icons to FA iconset for consistency - Refactors IAIIconButton, IAIButton, IAIPopover to handle ref forwarding - Redesigns buttons into group commit cfe567c62ad3fd0cff5e3e579a2250ca5dfa2d53 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 16:14:50 2022 +1100 Fixes: uploaded JPG images not loading commit cefe12f1df72e051f109ed77ce46f18093b3b8bb Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 15:31:18 2022 +1100 Styling changes and settings modal minor refactor commit 1e51c3992853ad4643d8eda2443a3bd0d65f5f90 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 15:27:46 2022 +1100 Fixes crash related to old value of progress_latents in state commit 42a02bbb8087cd46a1b5c795b1b41e38c08ba229 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 13:15:06 2022 +1100 Adds asCheckbox to IAIIconButton Rough draft of this. Not happy with the styling but it's clearer than having them look just like buttons. commit f1ae6dae4c36e74ca8dedf8b57eb8933c059dcf4 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 13:13:56 2022 +1100 Adds alert for bounding box size to status icons commit 6195579910a91fb2ab7e1186aa1c1145566c3122 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 11:52:19 2022 +1100 Restores shift+q bounding box shortcut commit 16c8b23b347792d7811cff66a27d350fe5d0d62c Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 11:32:07 2022 +1100 Changes Report Bug icon to a bug commit 07ae626b22554b5222a3b71d1ce3974e2c3fb284 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 11:17:16 2022 +1100 Removes unused isReady state commit 8d171bb044f578d4b9cc4911edfa05b20a01d373 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 11:13:26 2022 +1100 Fixes crash when requesting post-generation upscale/face restoration - Moves the inpainting paste to before the postprocessing. commit 6e33ca7e9e64fb355430511e28bb08c32c9c68b1 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 10:59:01 2022 +1100 Fixes rerenders on ClearBrushHistory commit db46e12f2b8c98dac8895ea4d04242d3754dbec4 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 11:36:28 2022 +1300 Inpainting Controls Code Spitting and Performance Codesplit the entirety of the inpainting controls. Created new selectors for each and every component to ensure there are no unnecessary re-renders. App feels a lot smoother. commit 868e4b2db82fa8556b423111f2f8d565a70ec129 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 07:40:31 2022 +1300 [Code Splitting] Bounding Box Options Isolated all bounding box components to trigger unnecessary re-renders. Still need to fix bounding box triggering re-renders on the control panel inside the canvas itself. But the options panel should be a good to go with this change. commit 2e562742c13988a1fc299c673a97ba4e4a645aaf Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 06:40:27 2022 +1300 Fix Bounding Box Settings re-rendering on brush stroke commit 68e69580091fc1dc1d8b6e03c9e7ef777c7ebf61 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 06:28:34 2022 +1300 Fresh Bundle commit ea6e3a7949f2743711516261cb7e450517d39702 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 06:26:56 2022 +1300 [TESTING] Remove global isReady checking I dont believe this is need at all because the isready state is constantly updated when needed and tracked real time in the Redux store. This causes massive re-renders. @psychedelicious If this is absolutely essential for a reason that I do not see, please hit me up on Discord. commit b2879ca99f88869277c474185ade049914b0bf26 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 06:08:59 2022 +1300 Code Split Inpaint Options Isolate features to their own components so they dont re-render the other stuff each time. commit 4e911566c33989392eb3279049b15331ca98594a Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 03:50:56 2022 +1300 Preventing unnecessary re-renders across the app commit 9bafda6a152778893df143776ae859a3b8b7f192 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 03:02:35 2022 +1300 Fix Inpainting Alerts Styling commit 871a8a5375cae891f22eb853ffd2d22298298b11 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 23:52:07 2022 +1100 Adds hints when unable to invoke - Popover on Invoke button indicates why exactly it is disabled, e.g. prompt is empty, something else is processing, etc. - There may be more than one reason; all are displayed. commit 0eef74bc00d3c0cedc5037c1deeef1d9a5b6d33d Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 23:40:11 2022 +1100 Address bounding box feedback - Adds back toggle to hide bounding box - Box quick toggle = q, normal toggle = shift + q - Styles canvas alert icons commit 423ae3209782f1d8d321b2ed9ed00712b726adf7 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 17:06:07 2022 +1100 Improves bounding box interaction Added spacebar-hold-to-transform back. commit 8282e5d0458ca1bba5565c069093b5389f2228d4 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 16:57:07 2022 +1100 Builds fresh bundle commit 19305cdbdf6ac74833bd6011bff0ced8e9d36f69 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 16:51:11 2022 +1100 Styles image uploader commit eb9028ab3069bca9d747aca664ca60ae13ba6df8 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 16:51:03 2022 +1100 Disabled bounding box settings when locked commit 21483f5d0731bce5aa97985e722a64bf0d7cd12c Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 16:50:24 2022 +1100 Fixes silent crash when init image too large To send the mask to the server, the UI rendered the mask onto the init image and sent the whole image. The mask was then cropped by the server. If the image was too large, the app silently failed. Maybe it exceeds the websocket size limit. Fixed by cropping the mask in the UI layer, sending only bounding-box-sized mask image data. commit 82dcbac28f140aa7bd89d967bcc7fa31cb03a267 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 16:28:30 2022 +1100 Improves bounding box interactions - Bounding box can now be moved by dragging any of its edges - Bounding box does not affect drawing if already drawing a stroke - Can lock bounding box to draw directly on the bounding box edges - Removes spacebar-hold behaviour due to technical issues commit d43bd4625d64a03d90de0458ad5fcacef211a8a6 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 15:10:49 2022 +1100 Fixes hotkeys and settings buttons not working commit ea891324a2086faf8eeeeac7eaf47ae2935322fb Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 11:04:02 2022 +1100 Changes inpainting controls settings to hover commit 8fd9ea219390493f392e690eadb23c4209a4ecfc Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 11:03:41 2022 +1100 Adds missing tooltips to site header commit fb026668563b3179805819a1630c654c9ce260d9 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 11:03:25 2022 +1100 Increases workarea split padding to 1rem commit f6f5c2731b0c37089c5d7382736f973e857df712 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 11:03:10 2022 +1100 Decreases gallery width on inpainting commit b4e3f771e0314e0a18ad5cedc80b28f246fced59 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 10:54:59 2022 +1100 Fixes bugs/styling - Fixes missing web app state on new version: Adds stateReconciler to redux-persist. When we add more values to the state and then release the update app, they will be automatically merged in. Reseting web UI will be needed far less. 7159ec - Fixes console z-index - Moves reset web UI button to visible area commit 99bb9491ac97f1f733accab839ea38cdf4870ba0 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Tue Nov 1 08:35:45 2022 +1300 [WebUI] Loopback Default False commit 0453f211278a533a49fb1aee54dd989b69179c10 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 23:23:51 2022 +1300 Fresh Build For WebUI commit 9fc09aa4bda3b3e6139b026f24733a37747d373f Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 09:08:11 2022 +0100 don't log base64 progress images commit 5e87062cf809a08242d3b006b66d3bbb834ddb16 Author: spezialspezial <75758219+spezialspezial@users.noreply.github.com> Date: Wed Nov 2 00:21:27 2022 +0100 Option to directly invert the grayscale heatmap - fix commit 3e7a459990407ad1679f38d4027c19d50a9d36e3 Author: spezialspezial <75758219+spezialspezial@users.noreply.github.com> Date: Tue Nov 1 21:37:33 2022 +0100 Update txt2mask.py commit bbf4c03e500bafc8627c2a70f8b3396efeddabb3 Author: spezialspezial <75758219+spezialspezial@users.noreply.github.com> Date: Tue Nov 1 21:11:19 2022 +0100 Option to directly invert the grayscale heatmap Theoretically less work inverting the image while it's small but I can't measure a significant difference. Though, handy option to have in some cases. commit 611a3a975328a7e276c2781214d5e14108708ed7 Author: mauwii <Mauwii@outlook.de> Date: Wed Nov 2 02:23:09 2022 +0100 fix name of caching step commit 1611f0d1815022fe90d33f41c21d670251a75f29 Author: mauwii <Mauwii@outlook.de> Date: Wed Nov 2 02:18:46 2022 +0100 readd caching of sd-models - this would remove the necesarrity of the secret availability in PRs commit 08835115e4c5c0ee3587ce07ab769a04d55cb3c5 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 22:10:12 2022 -0400 pin pytorch_lightning to 1.7.7, issue #1331 commit 2d84e28d329be282b51a4cbc22f7c200d80c8f0e Merge: 533fd04e ef17aae8 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 22:11:04 2022 -0400 Merge branch 'development' of github.com:invoke-ai/InvokeAI into development commit ef17aae8abe03fd87dc6f91b3c6d2fe03375f6c5 Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 00:39:48 2022 +0100 add damian0815 to contributors list commit 0cc39f01a3c67f32873b7888e1e032d33626e269 Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 01:18:50 2022 +0100 report full size for fast latents and update conversion matrix for v1.5 commit 688d7258f185035a5924bee23322b001574da931 Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 00:33:00 2022 +0100 fix a bug that broke cross attention control index mapping commit 4513320bf161d3efdd99e2aef4f7c37472131373 Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 00:31:58 2022 +0100 save VRAM by not recombining tensors that have been sliced to save VRAM commit 533fd04ef0d1ba9d2cb25d556991b999e7d44aba Merge: 6215592b dff5681c Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 17:40:36 2022 -0400 Merge branch 'development' of github.com:invoke-ai/InvokeAI into development commit dff5681cf0e24faf67d5eb5903203c4ea39f89bd Author: damian0815 <d@d.com> Date: Tue Nov 1 13:56:03 2022 +0100 shorter strings commit 5a2790a69b11e049d2507bc22eab7812915d867f Author: damian0815 <d@d.com> Date: Tue Nov 1 13:19:20 2022 +0100 convert progress display to a drop-down commit 7c5305ccbaf7926162536aa3a9e51dcdd8574d0d Author: damian0815 <d@d.com> Date: Tue Nov 1 12:54:46 2022 +0100 do not try to save base64 intermediates in gallery on cancellation commit 4013e8ad6fa5e5c2a710c607fe7e1d040f353299 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 21:54:35 2022 +1100 Fixes b64 image sending and displaying commit d1dfd257f9e1cafd352d9007a56194226b9d6b63 Author: damian <d@d.com> Date: Tue Nov 1 11:40:40 2022 +0100 wip base64 commit 5322d735ee4515d89293b7fb015b2ce048262f68 Author: damian <d@d.com> Date: Tue Nov 1 11:31:42 2022 +0100 update frontend commit cdb107dcda858a8bb64455cc60a196a42345f8f7 Author: damian <d@d.com> Date: Tue Nov 1 11:17:43 2022 +0100 add option to show intermediate latent space commit be1393a41ce7a75ed8de7f648a93c5e5974a50d2 Author: damian <d@d.com> Date: Tue Nov 1 10:16:55 2022 +0100 ensure existing exception handling code also handles new exception class commit e554c2607f00a5e51c03052acb9861ff21ec1c12 Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Tue Nov 1 10:08:42 2022 +0100 Rebuilt prompt parsing logic Complete re-write of the prompt parsing logic to be more readable and logical, and therefore also hopefully easier to debug, maintain, and augment. In the process it has also become more robust to badly-formed prompts. Squashed commit of the following: commit 8fcfa88a16e1390d41717e940d72aed64712171c Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Sun Oct 30 17:05:57 2022 +0100 further cleanup commit 1a1fd78bcfeb49d072e3e6d5808aa8df15441629 Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Sun Oct 30 16:07:57 2022 +0100 cleanup and document commit 099c9659fa8b8135876f9a5a50fe80b20bc0635c Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Sun Oct 30 15:54:58 2022 +0100 works fully commit 5e6887ea8c25a1e21438ff6defb381fd027d25fd Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Sun Oct 30 15:24:31 2022 +0100 further... commit 492fda120844d9bc1ad4ec7dd408a3374762d0ff Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Sun Oct 30 14:08:57 2022 +0100 getting there... commit c6aab05a8450cc3c95c8691daf38fdc64c74f52d Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Fri Oct 28 14:29:03 2022 +0200 wip doesn't compile commit 5e533f731cfd20cd435330eeb0012e5689e87e81 Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Fri Oct 28 13:21:43 2022 +0200 working with CrossAttentionCtonrol but no Attention support yet commit 9678348773431e500e110e8aede99086bb7b5955 Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Fri Oct 28 13:04:52 2022 +0200 wip rebuiling prompt parser commit 6215592b12dea3822c727913b771012789a52477 Merge: ef24d76a 349cc254 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 17:34:55 2022 -0400 Merge branch 'development' of github.com:invoke-ai/InvokeAI into development commit 349cc25433e1d358c6c61cca4a6c300ecc8ca3d7 Author: damian0815 <d@d.com> Date: Tue Nov 1 20:08:52 2022 +0100 fix crash (be a little less aggressive clearing out the attention slice) commit 214d276379387ae0fa2259602ab00884ec1ad03e Author: damian0815 <d@d.com> Date: Tue Nov 1 19:57:55 2022 +0100 be more aggressive at clearing out saved_attn_slice commit ef24d76adc5a192297714707cd6794d4f44bcf67 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 14:34:23 2022 -0400 fix library problems in preload_modules commit ab2b5a691dadb292f7cecf5db94a165db3e3e126 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 17:22:48 2022 -0400 fix model_cache memory management issues commit c7de2b2801ad5d6ce52a5f44e88c5705f1dbf524 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 02:02:14 2022 +0100 disable checks with sd-V1.4 model... ...to save some resources, since V1.5 is the default now commit e8075658acf675346d35435d0cfb7710becab42a Author: mauwii <Mauwii@outlook.de> Date: Mon Oct 31 22:20:51 2022 +0100 update test-invoke-conda.yml - fix model dl path for sd-v1-4.ckpt - copy configs/models.yaml.example to configs/models.yaml commit 4202dabee1143f597f4c3946420fbfa7b8eccddf Author: mauwii <Mauwii@outlook.de> Date: Mon Oct 31 22:17:21 2022 +0100 fix models example weights for sd-v1.4 commit d67db2bcf1ac26d8bb7c5f8bfd056f2172597780 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Tue Nov 1 08:35:45 2022 +1300 [WebUI] Loopback Default False commit 7159ec885faa1117a3506689d547618be1d91808 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Mon Oct 31 11:33:05 2022 -0400 further improvements to preload_models.py - Faster startup for command line switch processing - Specify configuration file to modify using --config option: ./scripts/preload_models.ply --config models/my-models-file.yaml commit b5cf734ba9f1aeaab14075b55cc13ed9a0ae31e2 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Mon Oct 31 11:08:19 2022 -0400 improve behavior of preload_models.py - NEVER overwrite user's existing models.yaml - Instead, merge its contents into new config file, and rename original to models.yaml.orig (with message) - models.yaml has been removed from repository and renamed models.yaml.example commit f7dc8eafeef991e135b5541c01d0ff740dda9591 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Mon Oct 31 10:47:35 2022 -0400 restore models.yaml to virgin state commit 762ca60a309f70daaf1b9e79b6273f76fd9474b6 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Oct 4 22:55:10 2022 -0400 Update INPAINTING.md commit e7fb9f342cb5ed0c09e6215026d60d45eef3ebcb Author: Hideyuki Katsushiro <h.katsushiro@qualia.tokyo.jp> Date: Wed Oct 5 10:08:53 2022 +0900 add argument --outdir
2022-11-12 17:17:07 +00:00
if not cache.valid_model(model_name):
use 🧨diffusers model (#1583) * initial commit of DiffusionPipeline class * spike: proof of concept using diffusers for txt2img * doc: type hints for Generator * refactor(model_cache): factor out load_ckpt * model_cache: add ability to load a diffusers model pipeline and update associated things in Generate & Generator to not instantly fail when that happens * model_cache: fix model default image dimensions * txt2img: support switching diffusers schedulers * diffusers: let the scheduler do its scaling of the initial latents Remove IPNDM scheduler; it is not behaving. * web server: update image_progress callback for diffusers data * diffusers: restore prompt weighting feature * diffusers: fix set-sampler error following model switch * diffusers: use InvokeAIDiffuserComponent for conditioning * cross_attention_control: stub (no-op) implementations for diffusers * model_cache: let offload_model work with DiffusionPipeline, sorta. * models.yaml.example: add diffusers-format model, set as default * test-invoke-conda: use diffusers-format model test-invoke-conda: put huggingface-token where the library can use it * environment-mac: upgrade to diffusers 0.7 (from 0.6) this was already done for linux; mac must have been lost in the merge. * preload_models: explicitly load diffusers models In non-interactive mode too, as long as you're logged in. * fix(model_cache): don't check `model.config` in diffusers format clean-up from recent merge. * diffusers integration: support img2img * dev: upgrade to diffusers 0.8 (from 0.7.1) We get to remove some code by using methods that were factored out in the base class. * refactor: remove backported img2img.get_timesteps now that we can use it directly from diffusers 0.8.1 * ci: use diffusers model * dev: upgrade to diffusers 0.9 (from 0.8.1) * lint: correct annotations for Python 3.9. * lint: correct AttributeError.name reference for Python 3.9. * CI: prefer diffusers-1.4 because it no longer requires a token The RunwayML models still do. * build: there's yet another place to update requirements? * configure: try to download models even without token Models in the CompVis and stabilityai repos no longer require them. (But runwayml still does.) * configure: add troubleshooting info for config-not-found * fix(configure): prepend root to config path * fix(configure): remove second `default: true` from models example * CI: simplify test-on-push logic now that we don't need secrets The "test on push but only in forks" logic was only necessary when tests didn't work for PRs-from-forks. * create an embedding_manager for diffusers * internal: avoid importing diffusers DummyObject see https://github.com/huggingface/diffusers/issues/1479 * fix "config attributes…not expected" diffusers warnings. * fix deprecated scheduler construction * work around an apparent MPS torch bug that causes conditioning to have no effect * 🚧 post-rebase repair * preliminary support for outpainting (no masking yet) * monkey-patch diffusers.attention and use Invoke lowvram code * add always_use_cpu arg to bypass MPS * add cross-attention control support to diffusers (fails on MPS) For unknown reasons MPS produces garbage output with .swap(). Use --always_use_cpu arg to invoke.py for now to test this code on MPS. * diffusers support for the inpainting model * fix debug_image to not crash with non-RGB images. * inpainting for the normal model [WIP] This seems to be performing well until the LAST STEP, at which point it dissolves to confetti. * fix off-by-one bug in cross-attention-control (#1774) prompt token sequences begin with a "beginning-of-sequence" marker <bos> and end with a repeated "end-of-sequence" marker <eos> - to make a default prompt length of <bos> + 75 prompt tokens + <eos>. the .swap() code was failing to take the column for <bos> at index 0 into account. the changes here do that, and also add extra handling for a single <eos> (which may be redundant but which is included for completeness). based on my understanding and some assumptions about how this all works, the reason .swap() nevertheless seemed to do the right thing, to some extent, is because over multiple steps the conditioning process in Stable Diffusion operates as a feedback loop. a change to token n-1 has flow-on effects to how the [1x4x64x64] latent tensor is modified by all the tokens after it, - and as the next step is processed, all the tokens before it as well. intuitively, a token's conditioning effects "echo" throughout the whole length of the prompt. so even though the token at n-1 was being edited when what the user actually wanted was to edit the token at n, it nevertheless still had some non-negligible effect, in roughly the right direction, often enough that it seemed like it was working properly. * refactor common CrossAttention stuff into a mixin so that the old ldm code can still work if necessary * inpainting for the normal model. I think it works this time. * diffusers: reset num_vectors_per_token sync with 44a00555718f1df173c60da0ed646cf700e29537 * diffusers: txt2img2img (hires_fix) with so much slicing and dicing of pipeline methods to stitch them together * refactor(diffusers): reduce some code duplication amongst the different tasks * fixup! refactor(diffusers): reduce some code duplication amongst the different tasks * diffusers: enable DPMSolver++ scheduler * diffusers: upgrade to diffusers 0.10, add Heun scheduler * diffusers(ModelCache): stopgap to make from_cpu compatible with diffusers * CI: default to diffusers-1.5 now that runwayml token requirement is gone * diffusers: update to 0.10 (and transformers to 4.25) * diffusers: use xformers when available diffusers no longer auto-enables this as of 0.10.2. * diffusers: make masked img2img behave better with multi-step schedulers re-randomizing the noise each step was confusing them. * diffusers: work more better with more models. fixed relative path problem with local models. fixed models on hub not always having a `fp16` branch. * diffusers: stopgap fix for attention_maps_callback crash after recent merge * fixup import merge conflicts correction for 061c5369a2247c6c92cd69606bcf54c4f1962a0b * test: add tests/inpainting inputs for masked img2img * diffusers(AddsMaskedGuidance): partial fix for k-schedulers Prevents them from crashing, but results are still hot garbage. * fix --safety_checker arg parsing and add note to diffusers loader about where safety checker gets called * generate: fix import error * CI: don't try to read the old init location * diffusers: support loading an alternate VAE * CI: remove sh-syntax if-statement so it doesn't crash powershell * CI: fold strings in yaml because backslash is not line-continuation in powershell * attention maps callback stuff for diffusers * build: fix syntax error in environment-mac * diffusers: add INITIAL_MODELS with diffusers-compatible repos * re-enable the embedding manager; closes #1778 * Squashed commit of the following: commit e4a956abc37fcb5cf188388b76b617bc5c8fda7d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:43:07 2022 +0100 import new load handling from EmbeddingManager and cleanup commit c4abe91a5ba0d415b45bf734068385668b7a66e6 Merge: 032e856e 1efc6397 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:09:53 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers_with_textual_inversion_manager commit 032e856eefb3bbc39534f5daafd25764bcfcef8b Merge: 8b4f0fe9 bc515e24 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:08:01 2022 +0100 Merge remote-tracking branch 'upstream/dev/diffusers' into dev/diffusers_with_textual_inversion_manager commit 1efc6397fc6e61c1aff4b0258b93089d61de5955 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:04:28 2022 +0100 cleanup and add performance notes commit e400f804ac471a0ca2ba432fd658778b20c7bdab Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:45:07 2022 +0100 fix bug and update unit tests commit deb9ae0ae1016750e93ce8275734061f7285a231 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:28:29 2022 +0100 textual inversion manager seems to work commit 162e02505dec777e91a983c4d0fb52e950d25ff0 Merge: cbad4583 12769b3d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:58:03 2022 +0100 Merge branch 'main' into feature_textual_inversion_mgr commit cbad45836c6aace6871a90f2621a953f49433131 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:54:10 2022 +0100 use position embeddings commit 070344c69b0e0db340a183857d0a787b348681d3 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:53:47 2022 +0100 Don't crash CLI on exceptions commit b035ac8c6772dfd9ba41b8eeb9103181cda028f8 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:11:55 2022 +0100 add missing position_embeddings commit 12769b3d3562ef71e0f54946b532ad077e10043c Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:33:25 2022 +0100 debugging why it don't work commit bafb7215eabe1515ca5e8388fd3bb2f3ac5362cf Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:21:33 2022 +0100 debugging why it don't work commit 664a6e9e146b42d96703f0cc8baf8f5efec04ee1 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit 8b4f0fe9d6e4e2643b36dfa27864294785d7ba4e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit ffbe1ab11163ba712e353d89404e301d0e0c6cdf Merge: 6e4dad60 023df37e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:37:31 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers commit 023df37efffa67434f77def7fc3c9dfb29f699fd Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:36:54 2022 +0100 cleanup commit 05fac594eaf79d0058e3c48deee93df603f136c2 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:07:49 2022 +0100 tweak error checking commit 009f32ed39a7280997c3ffab112adadee0b44279 Author: damian <null@damianstewart.com> Date: Thu Dec 15 21:29:47 2022 +0100 unit tests passing for embeddings with vector length >1 commit beb1b08d9a98112ed2fe073580568e1a18698da3 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:39:09 2022 +0100 more explicit equality tests when overwriting commit 44d8a5a7c85cdabc9ce3a54fd0769a10597b3ca9 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:30:13 2022 +0100 wip textual inversion manager (unit tests passing for 1v embedding overwriting) commit 417c2b57d90924a839616bfb66804faab8039e4c Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 12:30:55 2022 +0100 wip textual inversion manager (unit tests passing for base stuff + padding) commit 2e80872e3b6f7fd7d8eb8928822bd824b63cb2ff Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 10:57:57 2022 +0100 wip new TextualInversionManager * stop using WeightedFrozenCLIPEmbedder * store diffusion models locally - configure_invokeai.py reconfigured to store diffusion models rather than CompVis models - hugging face caching model is used, but cache is set to ~/invokeai/models/repo_id - models.yaml does **NOT** use path, just repo_id - "repo_name" changed to "repo_id" to following hugging face conventions - Models are loaded with full precision pending further work. * allow non-local files during development * path takes priority over repo_id * MVP for model_cache and configure_invokeai - Feature complete (almost) - configure_invokeai.py downloads both .ckpt and diffuser models, along with their VAEs. Both types of download are controlled by a unified INITIAL_MODELS.yaml file. - model_cache can load both type of model and switches back and forth in CPU. No memory leaks detected TO DO: 1. I have not yet turned on the LocalOnly flag for diffuser models, so the code will check the Hugging Face repo for updates before using the locally cached models. This will break firewalled systems. I am thinking of putting in a global check for internet connectivity at startup time and setting the LocalOnly flag based on this. It would be good to check updates if there is connectivity. 2. I have not gone completely through INITIAL_MODELS.yaml to check which models are available as diffusers and which are not. So models like PaperCut and VoxelArt may not load properly. The runway and stability models are checked, as well as the Trinart models. 3. Add stanzas for SD 2.0 and 2.1 in INITIAL_MODELS.yaml REMAINING PROBLEMS NOT DIRECTLY RELATED TO MODEL_CACHE: 1. When loading a .ckpt file there are lots of messages like this: Warning! ldm.modules.attention.CrossAttention is no longer being maintained. Please use InvokeAICrossAttention instead. I'm not sure how to address this. 2. The ckpt models ***don't actually run*** due to the lack of special-case support for them in the generator objects. For example, here's the hard crash you get when you run txt2img against the legacy waifu-diffusion-1.3 model: ``` >> An error occurred: Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 140, in main main_loop(gen, opt) File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 371, in main_loop gen.prompt2image( File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1265, in __getattr__ raise AttributeError("'{}' object has no attribute '{}'".format( AttributeError: 'LatentDiffusion' object has no attribute 'image_from_embeddings' ``` 3. The inpainting diffusion model isn't working. Here's the output of "banana sushi" when inpainting-1.5 is loaded: ``` Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 301, in image_from_embeddings result_latents, result_attention_map_saver = self.latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 330, in latents_from_embeddings result: PipelineIntermediateState = infer_latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 185, in __call__ for result in self.generator_method(*args, **kwargs): File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 367, in generate_latents_from_embeddings step_output = self.step(batched_t, latents, guidance_scale, File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context return func(*args, **kwargs) File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 409, in step step_output = self.scheduler.step(noise_pred, timestep, latents, **extra_step_kwargs) File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/diffusers/schedulers/scheduling_lms_discrete.py", line 223, in step pred_original_sample = sample - sigma * model_output RuntimeError: The size of tensor a (9) must match the size of tensor b (4) at non-singleton dimension 1 ``` * proper support for float32/float16 - configure script now correctly detects user's preference for fp16/32 and downloads the correct diffuser version. If fp16 version not available, falls back to fp32 version. - misc code cleanup and simplification in model_cache * add on-the-fly conversion of .ckpt to diffusers models 1. On-the-fly conversion code can be found in the file ldm/invoke/ckpt_to_diffusers.py. 2. A new !optimize command has been added to the CLI. Should be ported to Web GUI. User experience on the CLI is this: ``` invoke> !optimize /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt INFO: Converting legacy weights file /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt to optimized diffuser model. This operation will take 30-60s to complete. Success. Optimized model is now located at /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 Writing new config file entry for sd-v1-4... >> New configuration: sd-v1-4: description: Optimized version of sd-v1-4 format: diffusers path: /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 OK to import [n]? y >> Verifying that new model loads... >> Current VRAM usage: 2.60G >> Offloading stable-diffusion-2.1 to CPU >> Loading diffusers model from /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 | Using faster float16 precision You have disabled the safety checker for <class 'ldm.invoke.generator.diffusers_pipeline.StableDiffusionGeneratorPipeline'> by passing `safety_checker=None`. Ensure that you abide to the conditions of the Stable Diffusion \ license and do not expose unfiltered results in services or applications open to the public. Both the diffusers team and Hugging Face strongly recommend to keep the safety filter enabled in all public facing circumstances,\ disabling it only for use-cases that involve analyzing network behavior or auditing its results. For more information, please have a look at https://github.com/huggingface/diffusers/pull/254 . | training width x height = (512 x 512) >> Model loaded in 3.48s >> Max VRAM used to load the model: 2.17G >> Current VRAM usage:2.17G >> Textual inversions available: >> Setting Sampler to k_lms (LMSDiscreteScheduler) Keep model loaded? [y] ``` * add parallel set of generator files for ckpt legacy generation * generation using legacy ckpt models now working * diffusers: fix missing attention_maps_callback fix for 23eb80b40421b2bb8f4b6d3dd30490d11c447b36 * associate legacy CrossAttention with .ckpt models * enable autoconvert New --autoconvert CLI option will scan a designated directory for new .ckpt files, convert them into diffuser models, and import them into models.yaml. Works like this: invoke.py --autoconvert /path/to/weights/directory In ModelCache added two new methods: autoconvert_weights(config_path, weights_directory_path, models_directory_path) convert_and_import(ckpt_path, diffuser_path) * diffusers: update to diffusers 0.11 (from 0.10.2) * fix vae loading & width/height calculation * refactor: encapsulate these conditioning data into one container * diffusers: fix some noise-scaling issues by pushing the noise-mixing down to the common function * add support for safetensors and accelerate * set local_files_only when internet unreachable * diffusers: fix error-handling path when model repo has no fp16 branch * fix generatorinpaint error Fixes : "ModuleNotFoundError: No module named 'ldm.invoke.generatorinpaint' https://github.com/invoke-ai/InvokeAI/pull/1583#issuecomment-1363634318 * quench diffuser safety-checker warning * diffusers: support stochastic DDIM eta parameter * fix conda env creation on macos * fix cross-attention with diffusers 0.11 * diffusers: the VAE needs to be tiling as well as the U-Net * diffusers: comment on subfolders * diffusers: embiggen! * diffusers: make model_cache.list_models serializable * diffusers(inpaint): restore scaling functionality * fix requirements clash between numba and numpy 1.24 * diffusers: allow inpainting model to do non-inpainting tasks * start expanding model_cache functionality * add import_ckpt_model() and import_diffuser_model() methods to model_manager - in addition, model_cache.py is now renamed to model_manager.py * allow "recommended" flag to be optional in INITIAL_MODELS.yaml * configure_invokeai now downloads VAE diffusers in advance * rename ModelCache to ModelManager * remove support for `repo_name` in models.yaml * check for and refuse to load embeddings trained on incompatible models * models.yaml.example: s/repo_name/repo_id and remove extra INITIAL_MODELS now that the main one has diffusers models in it. * add MVP textual inversion script * refactor(InvokeAIDiffuserComponent): factor out _combine() * InvokeAIDiffuserComponent: implement threshold * InvokeAIDiffuserComponent: diagnostic logs for threshold ...this does not look right * add a curses-based frontend to textual inversion - not quite working yet - requires npyscreen installed - on windows will also have the windows-curses requirement, but not added to requirements yet * add curses-based interface for textual inversion * fix crash in convert_and_import() - This corrects a "local variable referenced before assignment" error in model_manager.convert_and_import() * potential workaround for no 'state_dict' key error - As reported in https://github.com/huggingface/diffusers/issues/1876 * create TI output dir if needed * Update environment-lin-cuda.yml (#2159) Fixing line 42 to be the proper order to define the transformers requirement: ~= instead of =~ * diffusers: update sampler-to-scheduler mapping based on https://github.com/huggingface/diffusers/issues/277#issuecomment-1371428672 * improve user exp for ckt to diffusers conversion - !optimize_models command now operates on an existing ckpt file entry in models.yaml - replaces existing entry, rather than adding a new one - offers to delete the ckpt file after conversion * web: adapt progress callback to deal with old generator or new diffusers pipeline * clean-up model_manager code - add_model() verified to work for .ckpt local paths, .ckpt remote URLs, diffusers local paths, and diffusers repo_ids - convert_and_import() verified to work for local and remove .ckpt files * handle edge cases for import_model() and convert_model() * add support for safetensor .ckpt files * fix name error * code cleanup with pyflake * improve model setting behavior - If the user enters an invalid model name at startup time, will not try to load it, warn, and use default model - CLI UI enhancement: include currently active model in the command line prompt. * update test-invoke-pip.yml - fix model cache path to point to runwayml/stable-diffusion-v1-5 - remove `skip-sd-weights` from configure_invokeai.py args * exclude dev/diffusers from "fail for draft PRs" * disable "fail on PR jobs" * re-add `--skip-sd-weights` since no space * update workflow environments - include `INVOKE_MODEL_RECONFIGURE: '--yes'` * clean up model load failure handling - Allow CLI to run even when no model is defined or loadable. - Inhibit stack trace when model load fails - only show last error - Give user *option* to run configure_invokeai.py when no models successfully load. - Restart invokeai after reconfiguration. * further edge-case handling 1) only one model in models.yaml file, and that model is broken 2) no models in models.yaml 3) models.yaml doesn't exist at all * fix incorrect model status listing - "cached" was not being returned from list_models() - normalize handling of exceptions during model loading: - Passing an invalid model name to generate.set_model() will return a KeyError - All other exceptions are returned as the appropriate Exception * CI: do download weights (if not already cached) * diffusers: fix scheduler loading in offline mode * CI: fix model name (no longer has `diffusers-` prefix) * Update txt2img2img.py (#2256) * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * feat - make model storage compatible with hugging face caching system This commit alters the InvokeAI model directory to be compatible with hugging face, making it easier to share diffusers (and other models) across different programs. - If the HF_HOME environment variable is not set, then models are cached in ~/invokeai/models in a format that is identical to the HuggingFace cache. - If HF_HOME is set, then models are cached wherever HF_HOME points. - To enable sharing with other HuggingFace library clients, set HF_HOME to ~/.cache/huggingface to set the default cache location or to ~/invokeai/models to have huggingface cache inside InvokeAI. * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * fix error "no attribute CkptInpaint" * model_manager.list_models() returns entire model config stanza+status * Initial Draft - Model Manager Diffusers * added hash function to diffusers * implement sha256 hashes on diffusers models * Add Model Manager Support for Diffusers * fix various problems with model manager - in cli import functions, fix not enough values to unpack from _get_name_and_desc() - fix crash when using old-style vae: value with new-style diffuser * rebuild frontend * fix dictconfig-not-serializable issue * fix NoneType' object is not subscriptable crash in model_manager * fix "str has no attribute get" error in model_manager list_models() * Add path and repo_id support for Diffusers Model Manager Also fixes bugs * Fix tooltip IT localization not working * Add Version Number To WebUI * Optimize Model Search * Fix incorrect font on the Model Manager UI * Fix image degradation on merge fixes - [Experimental] This change should effectively fix a couple of things. - Fix image degradation on subsequent merges of the canvas layers. - Fix the slight transparent border that is left behind when filling the bounding box with a color. - Fix the left over line of color when filling a bounding box with color. So far there are no side effects for this. If any, please report. * Add local model filtering for Diffusers / Checkpoints * Go to home on modal close for the Add Modal UI * Styling Fixes * Model Manager Diffusers Localization Update * Add Safe Tensor scanning to Model Manager * Fix model edit form dispatching string values instead of numbers. * Resolve VAE handling / edge cases for supplied repos * defer injecting tokens for textual inversions until they're used for the first time * squash a console warning * implement model migration check * add_model() overwrites previous config rather than merges * fix model config file attribute merging * fix precision handling in textual inversion script * allow ckpt conversion script to work with safetensors .ckpts Applied patch here: https://github.com/huggingface/diffusers/commit/beb932c5d111872c5e45387e7b1b2b3dd0524a47 * fix name "args" is not defined crash in textual_inversion_training * fix a second NameError: name 'args' is not defined crash * fix loading of the safety checker from the global cache dir * add installation step to textual inversion frontend - After a successful training run, the script will copy learned_embeds.bin to a subfolder of the embeddings directory. - User given the option to delete the logs and intermediate checkpoints (which together use 7-8G of space) - If textual inversion training fails, reports the error gracefully. * don't crash out on incompatible embeddings - put try: blocks around places where the system tries to load an embedding which is incompatible with the currently loaded model * add support for checkpoint resuming * textual inversion preferences are saved and restored between sessions - Preferences are stored in a file named text-inversion-training/preferences.conf - Currently the resume-from-checkpoint option is not working correctly. Possible bug in textual_inversion_training.py? * copy learned_embeddings.bin into right location * add front end for diffusers model merging - Front end doesn't do anything yet!!!! - Made change to model name parsing in CLI to support ability to have merged models with the "+" character in their names. * improve inpainting experience - recommend ckpt version of inpainting-1.5 to user - fix get_noise() bug in ckpt version of omnibus.py * update environment*yml * tweak instructions to install HuggingFace token * bump version number * enhance update scripts - update scripts will now fetch new INITIAL_MODELS.yaml so that configure_invokeai.py will know about the diffusers versions. * enhance invoke.sh/invoke.bat launchers - added configure_invokeai.py to menu - menu defaults to browser-based invoke * remove conda workflow (#2321) * fix `token_ids has shape torch.Size([79]) - expected [77]` * update CHANGELOG.md with 2.3.* info - Add information on how formats have changed and the upgrade process. - Add short bug list. Co-authored-by: Damian Stewart <d@damianstewart.com> Co-authored-by: Damian Stewart <null@damianstewart.com> Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> Co-authored-by: Wybartel-luxmc <37852506+Wybartel-luxmc@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> Co-authored-by: mickr777 <115216705+mickr777@users.noreply.github.com> Co-authored-by: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Co-authored-by: Eugene Brodsky <ebr@users.noreply.github.com> Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com>
2023-01-15 14:22:46 +00:00
raise KeyError('** "{model_name}" is not a known model name. Cannot change.')
cache.print_vram_usage()
# have to get rid of all references to model in order
# to free it from GPU memory
self.model = None
self.sampler = None
self.generators = {}
gc.collect()
use 🧨diffusers model (#1583) * initial commit of DiffusionPipeline class * spike: proof of concept using diffusers for txt2img * doc: type hints for Generator * refactor(model_cache): factor out load_ckpt * model_cache: add ability to load a diffusers model pipeline and update associated things in Generate & Generator to not instantly fail when that happens * model_cache: fix model default image dimensions * txt2img: support switching diffusers schedulers * diffusers: let the scheduler do its scaling of the initial latents Remove IPNDM scheduler; it is not behaving. * web server: update image_progress callback for diffusers data * diffusers: restore prompt weighting feature * diffusers: fix set-sampler error following model switch * diffusers: use InvokeAIDiffuserComponent for conditioning * cross_attention_control: stub (no-op) implementations for diffusers * model_cache: let offload_model work with DiffusionPipeline, sorta. * models.yaml.example: add diffusers-format model, set as default * test-invoke-conda: use diffusers-format model test-invoke-conda: put huggingface-token where the library can use it * environment-mac: upgrade to diffusers 0.7 (from 0.6) this was already done for linux; mac must have been lost in the merge. * preload_models: explicitly load diffusers models In non-interactive mode too, as long as you're logged in. * fix(model_cache): don't check `model.config` in diffusers format clean-up from recent merge. * diffusers integration: support img2img * dev: upgrade to diffusers 0.8 (from 0.7.1) We get to remove some code by using methods that were factored out in the base class. * refactor: remove backported img2img.get_timesteps now that we can use it directly from diffusers 0.8.1 * ci: use diffusers model * dev: upgrade to diffusers 0.9 (from 0.8.1) * lint: correct annotations for Python 3.9. * lint: correct AttributeError.name reference for Python 3.9. * CI: prefer diffusers-1.4 because it no longer requires a token The RunwayML models still do. * build: there's yet another place to update requirements? * configure: try to download models even without token Models in the CompVis and stabilityai repos no longer require them. (But runwayml still does.) * configure: add troubleshooting info for config-not-found * fix(configure): prepend root to config path * fix(configure): remove second `default: true` from models example * CI: simplify test-on-push logic now that we don't need secrets The "test on push but only in forks" logic was only necessary when tests didn't work for PRs-from-forks. * create an embedding_manager for diffusers * internal: avoid importing diffusers DummyObject see https://github.com/huggingface/diffusers/issues/1479 * fix "config attributes…not expected" diffusers warnings. * fix deprecated scheduler construction * work around an apparent MPS torch bug that causes conditioning to have no effect * 🚧 post-rebase repair * preliminary support for outpainting (no masking yet) * monkey-patch diffusers.attention and use Invoke lowvram code * add always_use_cpu arg to bypass MPS * add cross-attention control support to diffusers (fails on MPS) For unknown reasons MPS produces garbage output with .swap(). Use --always_use_cpu arg to invoke.py for now to test this code on MPS. * diffusers support for the inpainting model * fix debug_image to not crash with non-RGB images. * inpainting for the normal model [WIP] This seems to be performing well until the LAST STEP, at which point it dissolves to confetti. * fix off-by-one bug in cross-attention-control (#1774) prompt token sequences begin with a "beginning-of-sequence" marker <bos> and end with a repeated "end-of-sequence" marker <eos> - to make a default prompt length of <bos> + 75 prompt tokens + <eos>. the .swap() code was failing to take the column for <bos> at index 0 into account. the changes here do that, and also add extra handling for a single <eos> (which may be redundant but which is included for completeness). based on my understanding and some assumptions about how this all works, the reason .swap() nevertheless seemed to do the right thing, to some extent, is because over multiple steps the conditioning process in Stable Diffusion operates as a feedback loop. a change to token n-1 has flow-on effects to how the [1x4x64x64] latent tensor is modified by all the tokens after it, - and as the next step is processed, all the tokens before it as well. intuitively, a token's conditioning effects "echo" throughout the whole length of the prompt. so even though the token at n-1 was being edited when what the user actually wanted was to edit the token at n, it nevertheless still had some non-negligible effect, in roughly the right direction, often enough that it seemed like it was working properly. * refactor common CrossAttention stuff into a mixin so that the old ldm code can still work if necessary * inpainting for the normal model. I think it works this time. * diffusers: reset num_vectors_per_token sync with 44a00555718f1df173c60da0ed646cf700e29537 * diffusers: txt2img2img (hires_fix) with so much slicing and dicing of pipeline methods to stitch them together * refactor(diffusers): reduce some code duplication amongst the different tasks * fixup! refactor(diffusers): reduce some code duplication amongst the different tasks * diffusers: enable DPMSolver++ scheduler * diffusers: upgrade to diffusers 0.10, add Heun scheduler * diffusers(ModelCache): stopgap to make from_cpu compatible with diffusers * CI: default to diffusers-1.5 now that runwayml token requirement is gone * diffusers: update to 0.10 (and transformers to 4.25) * diffusers: use xformers when available diffusers no longer auto-enables this as of 0.10.2. * diffusers: make masked img2img behave better with multi-step schedulers re-randomizing the noise each step was confusing them. * diffusers: work more better with more models. fixed relative path problem with local models. fixed models on hub not always having a `fp16` branch. * diffusers: stopgap fix for attention_maps_callback crash after recent merge * fixup import merge conflicts correction for 061c5369a2247c6c92cd69606bcf54c4f1962a0b * test: add tests/inpainting inputs for masked img2img * diffusers(AddsMaskedGuidance): partial fix for k-schedulers Prevents them from crashing, but results are still hot garbage. * fix --safety_checker arg parsing and add note to diffusers loader about where safety checker gets called * generate: fix import error * CI: don't try to read the old init location * diffusers: support loading an alternate VAE * CI: remove sh-syntax if-statement so it doesn't crash powershell * CI: fold strings in yaml because backslash is not line-continuation in powershell * attention maps callback stuff for diffusers * build: fix syntax error in environment-mac * diffusers: add INITIAL_MODELS with diffusers-compatible repos * re-enable the embedding manager; closes #1778 * Squashed commit of the following: commit e4a956abc37fcb5cf188388b76b617bc5c8fda7d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:43:07 2022 +0100 import new load handling from EmbeddingManager and cleanup commit c4abe91a5ba0d415b45bf734068385668b7a66e6 Merge: 032e856e 1efc6397 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:09:53 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers_with_textual_inversion_manager commit 032e856eefb3bbc39534f5daafd25764bcfcef8b Merge: 8b4f0fe9 bc515e24 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:08:01 2022 +0100 Merge remote-tracking branch 'upstream/dev/diffusers' into dev/diffusers_with_textual_inversion_manager commit 1efc6397fc6e61c1aff4b0258b93089d61de5955 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:04:28 2022 +0100 cleanup and add performance notes commit e400f804ac471a0ca2ba432fd658778b20c7bdab Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:45:07 2022 +0100 fix bug and update unit tests commit deb9ae0ae1016750e93ce8275734061f7285a231 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:28:29 2022 +0100 textual inversion manager seems to work commit 162e02505dec777e91a983c4d0fb52e950d25ff0 Merge: cbad4583 12769b3d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:58:03 2022 +0100 Merge branch 'main' into feature_textual_inversion_mgr commit cbad45836c6aace6871a90f2621a953f49433131 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:54:10 2022 +0100 use position embeddings commit 070344c69b0e0db340a183857d0a787b348681d3 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:53:47 2022 +0100 Don't crash CLI on exceptions commit b035ac8c6772dfd9ba41b8eeb9103181cda028f8 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:11:55 2022 +0100 add missing position_embeddings commit 12769b3d3562ef71e0f54946b532ad077e10043c Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:33:25 2022 +0100 debugging why it don't work commit bafb7215eabe1515ca5e8388fd3bb2f3ac5362cf Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:21:33 2022 +0100 debugging why it don't work commit 664a6e9e146b42d96703f0cc8baf8f5efec04ee1 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit 8b4f0fe9d6e4e2643b36dfa27864294785d7ba4e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit ffbe1ab11163ba712e353d89404e301d0e0c6cdf Merge: 6e4dad60 023df37e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:37:31 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers commit 023df37efffa67434f77def7fc3c9dfb29f699fd Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:36:54 2022 +0100 cleanup commit 05fac594eaf79d0058e3c48deee93df603f136c2 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:07:49 2022 +0100 tweak error checking commit 009f32ed39a7280997c3ffab112adadee0b44279 Author: damian <null@damianstewart.com> Date: Thu Dec 15 21:29:47 2022 +0100 unit tests passing for embeddings with vector length >1 commit beb1b08d9a98112ed2fe073580568e1a18698da3 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:39:09 2022 +0100 more explicit equality tests when overwriting commit 44d8a5a7c85cdabc9ce3a54fd0769a10597b3ca9 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:30:13 2022 +0100 wip textual inversion manager (unit tests passing for 1v embedding overwriting) commit 417c2b57d90924a839616bfb66804faab8039e4c Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 12:30:55 2022 +0100 wip textual inversion manager (unit tests passing for base stuff + padding) commit 2e80872e3b6f7fd7d8eb8928822bd824b63cb2ff Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 10:57:57 2022 +0100 wip new TextualInversionManager * stop using WeightedFrozenCLIPEmbedder * store diffusion models locally - configure_invokeai.py reconfigured to store diffusion models rather than CompVis models - hugging face caching model is used, but cache is set to ~/invokeai/models/repo_id - models.yaml does **NOT** use path, just repo_id - "repo_name" changed to "repo_id" to following hugging face conventions - Models are loaded with full precision pending further work. * allow non-local files during development * path takes priority over repo_id * MVP for model_cache and configure_invokeai - Feature complete (almost) - configure_invokeai.py downloads both .ckpt and diffuser models, along with their VAEs. Both types of download are controlled by a unified INITIAL_MODELS.yaml file. - model_cache can load both type of model and switches back and forth in CPU. No memory leaks detected TO DO: 1. I have not yet turned on the LocalOnly flag for diffuser models, so the code will check the Hugging Face repo for updates before using the locally cached models. This will break firewalled systems. I am thinking of putting in a global check for internet connectivity at startup time and setting the LocalOnly flag based on this. It would be good to check updates if there is connectivity. 2. I have not gone completely through INITIAL_MODELS.yaml to check which models are available as diffusers and which are not. So models like PaperCut and VoxelArt may not load properly. The runway and stability models are checked, as well as the Trinart models. 3. Add stanzas for SD 2.0 and 2.1 in INITIAL_MODELS.yaml REMAINING PROBLEMS NOT DIRECTLY RELATED TO MODEL_CACHE: 1. When loading a .ckpt file there are lots of messages like this: Warning! ldm.modules.attention.CrossAttention is no longer being maintained. Please use InvokeAICrossAttention instead. I'm not sure how to address this. 2. The ckpt models ***don't actually run*** due to the lack of special-case support for them in the generator objects. For example, here's the hard crash you get when you run txt2img against the legacy waifu-diffusion-1.3 model: ``` >> An error occurred: Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 140, in main main_loop(gen, opt) File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 371, in main_loop gen.prompt2image( File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1265, in __getattr__ raise AttributeError("'{}' object has no attribute '{}'".format( AttributeError: 'LatentDiffusion' object has no attribute 'image_from_embeddings' ``` 3. The inpainting diffusion model isn't working. Here's the output of "banana sushi" when inpainting-1.5 is loaded: ``` Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 301, in image_from_embeddings result_latents, result_attention_map_saver = self.latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 330, in latents_from_embeddings result: PipelineIntermediateState = infer_latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 185, in __call__ for result in self.generator_method(*args, **kwargs): File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 367, in generate_latents_from_embeddings step_output = self.step(batched_t, latents, guidance_scale, File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context return func(*args, **kwargs) File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 409, in step step_output = self.scheduler.step(noise_pred, timestep, latents, **extra_step_kwargs) File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/diffusers/schedulers/scheduling_lms_discrete.py", line 223, in step pred_original_sample = sample - sigma * model_output RuntimeError: The size of tensor a (9) must match the size of tensor b (4) at non-singleton dimension 1 ``` * proper support for float32/float16 - configure script now correctly detects user's preference for fp16/32 and downloads the correct diffuser version. If fp16 version not available, falls back to fp32 version. - misc code cleanup and simplification in model_cache * add on-the-fly conversion of .ckpt to diffusers models 1. On-the-fly conversion code can be found in the file ldm/invoke/ckpt_to_diffusers.py. 2. A new !optimize command has been added to the CLI. Should be ported to Web GUI. User experience on the CLI is this: ``` invoke> !optimize /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt INFO: Converting legacy weights file /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt to optimized diffuser model. This operation will take 30-60s to complete. Success. Optimized model is now located at /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 Writing new config file entry for sd-v1-4... >> New configuration: sd-v1-4: description: Optimized version of sd-v1-4 format: diffusers path: /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 OK to import [n]? y >> Verifying that new model loads... >> Current VRAM usage: 2.60G >> Offloading stable-diffusion-2.1 to CPU >> Loading diffusers model from /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 | Using faster float16 precision You have disabled the safety checker for <class 'ldm.invoke.generator.diffusers_pipeline.StableDiffusionGeneratorPipeline'> by passing `safety_checker=None`. Ensure that you abide to the conditions of the Stable Diffusion \ license and do not expose unfiltered results in services or applications open to the public. Both the diffusers team and Hugging Face strongly recommend to keep the safety filter enabled in all public facing circumstances,\ disabling it only for use-cases that involve analyzing network behavior or auditing its results. For more information, please have a look at https://github.com/huggingface/diffusers/pull/254 . | training width x height = (512 x 512) >> Model loaded in 3.48s >> Max VRAM used to load the model: 2.17G >> Current VRAM usage:2.17G >> Textual inversions available: >> Setting Sampler to k_lms (LMSDiscreteScheduler) Keep model loaded? [y] ``` * add parallel set of generator files for ckpt legacy generation * generation using legacy ckpt models now working * diffusers: fix missing attention_maps_callback fix for 23eb80b40421b2bb8f4b6d3dd30490d11c447b36 * associate legacy CrossAttention with .ckpt models * enable autoconvert New --autoconvert CLI option will scan a designated directory for new .ckpt files, convert them into diffuser models, and import them into models.yaml. Works like this: invoke.py --autoconvert /path/to/weights/directory In ModelCache added two new methods: autoconvert_weights(config_path, weights_directory_path, models_directory_path) convert_and_import(ckpt_path, diffuser_path) * diffusers: update to diffusers 0.11 (from 0.10.2) * fix vae loading & width/height calculation * refactor: encapsulate these conditioning data into one container * diffusers: fix some noise-scaling issues by pushing the noise-mixing down to the common function * add support for safetensors and accelerate * set local_files_only when internet unreachable * diffusers: fix error-handling path when model repo has no fp16 branch * fix generatorinpaint error Fixes : "ModuleNotFoundError: No module named 'ldm.invoke.generatorinpaint' https://github.com/invoke-ai/InvokeAI/pull/1583#issuecomment-1363634318 * quench diffuser safety-checker warning * diffusers: support stochastic DDIM eta parameter * fix conda env creation on macos * fix cross-attention with diffusers 0.11 * diffusers: the VAE needs to be tiling as well as the U-Net * diffusers: comment on subfolders * diffusers: embiggen! * diffusers: make model_cache.list_models serializable * diffusers(inpaint): restore scaling functionality * fix requirements clash between numba and numpy 1.24 * diffusers: allow inpainting model to do non-inpainting tasks * start expanding model_cache functionality * add import_ckpt_model() and import_diffuser_model() methods to model_manager - in addition, model_cache.py is now renamed to model_manager.py * allow "recommended" flag to be optional in INITIAL_MODELS.yaml * configure_invokeai now downloads VAE diffusers in advance * rename ModelCache to ModelManager * remove support for `repo_name` in models.yaml * check for and refuse to load embeddings trained on incompatible models * models.yaml.example: s/repo_name/repo_id and remove extra INITIAL_MODELS now that the main one has diffusers models in it. * add MVP textual inversion script * refactor(InvokeAIDiffuserComponent): factor out _combine() * InvokeAIDiffuserComponent: implement threshold * InvokeAIDiffuserComponent: diagnostic logs for threshold ...this does not look right * add a curses-based frontend to textual inversion - not quite working yet - requires npyscreen installed - on windows will also have the windows-curses requirement, but not added to requirements yet * add curses-based interface for textual inversion * fix crash in convert_and_import() - This corrects a "local variable referenced before assignment" error in model_manager.convert_and_import() * potential workaround for no 'state_dict' key error - As reported in https://github.com/huggingface/diffusers/issues/1876 * create TI output dir if needed * Update environment-lin-cuda.yml (#2159) Fixing line 42 to be the proper order to define the transformers requirement: ~= instead of =~ * diffusers: update sampler-to-scheduler mapping based on https://github.com/huggingface/diffusers/issues/277#issuecomment-1371428672 * improve user exp for ckt to diffusers conversion - !optimize_models command now operates on an existing ckpt file entry in models.yaml - replaces existing entry, rather than adding a new one - offers to delete the ckpt file after conversion * web: adapt progress callback to deal with old generator or new diffusers pipeline * clean-up model_manager code - add_model() verified to work for .ckpt local paths, .ckpt remote URLs, diffusers local paths, and diffusers repo_ids - convert_and_import() verified to work for local and remove .ckpt files * handle edge cases for import_model() and convert_model() * add support for safetensor .ckpt files * fix name error * code cleanup with pyflake * improve model setting behavior - If the user enters an invalid model name at startup time, will not try to load it, warn, and use default model - CLI UI enhancement: include currently active model in the command line prompt. * update test-invoke-pip.yml - fix model cache path to point to runwayml/stable-diffusion-v1-5 - remove `skip-sd-weights` from configure_invokeai.py args * exclude dev/diffusers from "fail for draft PRs" * disable "fail on PR jobs" * re-add `--skip-sd-weights` since no space * update workflow environments - include `INVOKE_MODEL_RECONFIGURE: '--yes'` * clean up model load failure handling - Allow CLI to run even when no model is defined or loadable. - Inhibit stack trace when model load fails - only show last error - Give user *option* to run configure_invokeai.py when no models successfully load. - Restart invokeai after reconfiguration. * further edge-case handling 1) only one model in models.yaml file, and that model is broken 2) no models in models.yaml 3) models.yaml doesn't exist at all * fix incorrect model status listing - "cached" was not being returned from list_models() - normalize handling of exceptions during model loading: - Passing an invalid model name to generate.set_model() will return a KeyError - All other exceptions are returned as the appropriate Exception * CI: do download weights (if not already cached) * diffusers: fix scheduler loading in offline mode * CI: fix model name (no longer has `diffusers-` prefix) * Update txt2img2img.py (#2256) * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * feat - make model storage compatible with hugging face caching system This commit alters the InvokeAI model directory to be compatible with hugging face, making it easier to share diffusers (and other models) across different programs. - If the HF_HOME environment variable is not set, then models are cached in ~/invokeai/models in a format that is identical to the HuggingFace cache. - If HF_HOME is set, then models are cached wherever HF_HOME points. - To enable sharing with other HuggingFace library clients, set HF_HOME to ~/.cache/huggingface to set the default cache location or to ~/invokeai/models to have huggingface cache inside InvokeAI. * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * fix error "no attribute CkptInpaint" * model_manager.list_models() returns entire model config stanza+status * Initial Draft - Model Manager Diffusers * added hash function to diffusers * implement sha256 hashes on diffusers models * Add Model Manager Support for Diffusers * fix various problems with model manager - in cli import functions, fix not enough values to unpack from _get_name_and_desc() - fix crash when using old-style vae: value with new-style diffuser * rebuild frontend * fix dictconfig-not-serializable issue * fix NoneType' object is not subscriptable crash in model_manager * fix "str has no attribute get" error in model_manager list_models() * Add path and repo_id support for Diffusers Model Manager Also fixes bugs * Fix tooltip IT localization not working * Add Version Number To WebUI * Optimize Model Search * Fix incorrect font on the Model Manager UI * Fix image degradation on merge fixes - [Experimental] This change should effectively fix a couple of things. - Fix image degradation on subsequent merges of the canvas layers. - Fix the slight transparent border that is left behind when filling the bounding box with a color. - Fix the left over line of color when filling a bounding box with color. So far there are no side effects for this. If any, please report. * Add local model filtering for Diffusers / Checkpoints * Go to home on modal close for the Add Modal UI * Styling Fixes * Model Manager Diffusers Localization Update * Add Safe Tensor scanning to Model Manager * Fix model edit form dispatching string values instead of numbers. * Resolve VAE handling / edge cases for supplied repos * defer injecting tokens for textual inversions until they're used for the first time * squash a console warning * implement model migration check * add_model() overwrites previous config rather than merges * fix model config file attribute merging * fix precision handling in textual inversion script * allow ckpt conversion script to work with safetensors .ckpts Applied patch here: https://github.com/huggingface/diffusers/commit/beb932c5d111872c5e45387e7b1b2b3dd0524a47 * fix name "args" is not defined crash in textual_inversion_training * fix a second NameError: name 'args' is not defined crash * fix loading of the safety checker from the global cache dir * add installation step to textual inversion frontend - After a successful training run, the script will copy learned_embeds.bin to a subfolder of the embeddings directory. - User given the option to delete the logs and intermediate checkpoints (which together use 7-8G of space) - If textual inversion training fails, reports the error gracefully. * don't crash out on incompatible embeddings - put try: blocks around places where the system tries to load an embedding which is incompatible with the currently loaded model * add support for checkpoint resuming * textual inversion preferences are saved and restored between sessions - Preferences are stored in a file named text-inversion-training/preferences.conf - Currently the resume-from-checkpoint option is not working correctly. Possible bug in textual_inversion_training.py? * copy learned_embeddings.bin into right location * add front end for diffusers model merging - Front end doesn't do anything yet!!!! - Made change to model name parsing in CLI to support ability to have merged models with the "+" character in their names. * improve inpainting experience - recommend ckpt version of inpainting-1.5 to user - fix get_noise() bug in ckpt version of omnibus.py * update environment*yml * tweak instructions to install HuggingFace token * bump version number * enhance update scripts - update scripts will now fetch new INITIAL_MODELS.yaml so that configure_invokeai.py will know about the diffusers versions. * enhance invoke.sh/invoke.bat launchers - added configure_invokeai.py to menu - menu defaults to browser-based invoke * remove conda workflow (#2321) * fix `token_ids has shape torch.Size([79]) - expected [77]` * update CHANGELOG.md with 2.3.* info - Add information on how formats have changed and the upgrade process. - Add short bug list. Co-authored-by: Damian Stewart <d@damianstewart.com> Co-authored-by: Damian Stewart <null@damianstewart.com> Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> Co-authored-by: Wybartel-luxmc <37852506+Wybartel-luxmc@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> Co-authored-by: mickr777 <115216705+mickr777@users.noreply.github.com> Co-authored-by: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Co-authored-by: Eugene Brodsky <ebr@users.noreply.github.com> Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com>
2023-01-15 14:22:46 +00:00
try:
model_data = cache.get_model(model_name)
except Exception as e:
print(f'** model {model_name} could not be loaded: {str(e)}')
if previous_model_name is None:
raise e
print(f'** trying to reload previous model')
model_data = cache.get_model(previous_model_name) # load previous
if model_data is None:
raise e
model_name = previous_model_name
Refactoring simplet2i (#387) * start refactoring -not yet functional * first phase of refactor done - not sure weighted prompts working * Second phase of refactoring. Everything mostly working. * The refactoring has moved all the hard-core inference work into ldm.dream.generator.*, where there are submodules for txt2img and img2img. inpaint will go in there as well. * Some additional refactoring will be done soon, but relatively minor work. * fix -save_orig flag to actually work * add @neonsecret attention.py memory optimization * remove unneeded imports * move token logging into conditioning.py * add placeholder version of inpaint; porting in progress * fix crash in img2img * inpainting working; not tested on variations * fix crashes in img2img * ported attention.py memory optimization #117 from basujindal branch * added @torch_no_grad() decorators to img2img, txt2img, inpaint closures * Final commit prior to PR against development * fixup crash when generating intermediate images in web UI * rename ldm.simplet2i to ldm.generate * add backward-compatibility simplet2i shell with deprecation warning * add back in mps exception, addresses @vargol comment in #354 * replaced Conditioning class with exported functions * fix wrong type of with_variations attribute during intialization * changed "image_iterator()" to "get_make_image()" * raise NotImplementedError for calling get_make_image() in parent class * Update ldm/generate.py better error message Co-authored-by: Kevin Gibbons <bakkot@gmail.com> * minor stylistic fixes and assertion checks from code review * moved get_noise() method into img2img class * break get_noise() into two methods, one for txt2img and the other for img2img * inpainting works on non-square images now * make get_noise() an abstract method in base class * much improved inpainting Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
2022-09-06 00:40:10 +00:00
enable fast switching between models in invoke.py - This PR enables two new commands in the invoke.py script !models -- list the available models and their cache status !switch <model> -- switch to the indicated model Example: invoke> !models laion400m not loaded Latent Diffusion LAION400M model stable-diffusion-1.4 active Stable Diffusion inference model version 1.4 waifu-1.3 cached Waifu anime model version 1.3 invoke> !switch waifu-1.3 >> Caching model stable-diffusion-1.4 in system RAM >> Retrieving model waifu-1.3 from system RAM cache The name and descriptions of the models are taken from `config/models.yaml`. A future enhancement to `model_cache.py` will be to enable new model stanzas to be added to the file programmatically. This will be useful for the WebGUI. More details: - Use fast switching algorithm described in PR #948 - Models are selected using their configuration stanza name given in models.yaml. - To avoid filling up CPU RAM with cached models, this PR implements an LRU cache that monitors available CPU RAM. - The caching code allows the minimum value of available RAM to be adjusted, but invoke.py does not currently have a command-line argument that allows you to set it. The minimum free RAM is arbitrarily set to 2 GB. - Add optional description field to configs/models.yaml Unrelated fixes: - Added ">>" to CompViz model loading messages in order to make user experience more consistent. - When generating an image greater than defaults, will only warn about possible VRAM filling the first time. - Fixed bug that was causing help message to be printed twice. This involved moving the import line for the web backend into the section where it is called. Coauthored by: @ArDiouscuros
2022-10-12 06:14:59 +00:00
self.model = model_data['model']
self.width = model_data['width']
self.height= model_data['height']
self.model_hash = model_data['hash']
Refactoring simplet2i (#387) * start refactoring -not yet functional * first phase of refactor done - not sure weighted prompts working * Second phase of refactoring. Everything mostly working. * The refactoring has moved all the hard-core inference work into ldm.dream.generator.*, where there are submodules for txt2img and img2img. inpaint will go in there as well. * Some additional refactoring will be done soon, but relatively minor work. * fix -save_orig flag to actually work * add @neonsecret attention.py memory optimization * remove unneeded imports * move token logging into conditioning.py * add placeholder version of inpaint; porting in progress * fix crash in img2img * inpainting working; not tested on variations * fix crashes in img2img * ported attention.py memory optimization #117 from basujindal branch * added @torch_no_grad() decorators to img2img, txt2img, inpaint closures * Final commit prior to PR against development * fixup crash when generating intermediate images in web UI * rename ldm.simplet2i to ldm.generate * add backward-compatibility simplet2i shell with deprecation warning * add back in mps exception, addresses @vargol comment in #354 * replaced Conditioning class with exported functions * fix wrong type of with_variations attribute during intialization * changed "image_iterator()" to "get_make_image()" * raise NotImplementedError for calling get_make_image() in parent class * Update ldm/generate.py better error message Co-authored-by: Kevin Gibbons <bakkot@gmail.com> * minor stylistic fixes and assertion checks from code review * moved get_noise() method into img2img class * break get_noise() into two methods, one for txt2img and the other for img2img * inpainting works on non-square images now * make get_noise() an abstract method in base class * much improved inpainting Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
2022-09-06 00:40:10 +00:00
enable fast switching between models in invoke.py - This PR enables two new commands in the invoke.py script !models -- list the available models and their cache status !switch <model> -- switch to the indicated model Example: invoke> !models laion400m not loaded Latent Diffusion LAION400M model stable-diffusion-1.4 active Stable Diffusion inference model version 1.4 waifu-1.3 cached Waifu anime model version 1.3 invoke> !switch waifu-1.3 >> Caching model stable-diffusion-1.4 in system RAM >> Retrieving model waifu-1.3 from system RAM cache The name and descriptions of the models are taken from `config/models.yaml`. A future enhancement to `model_cache.py` will be to enable new model stanzas to be added to the file programmatically. This will be useful for the WebGUI. More details: - Use fast switching algorithm described in PR #948 - Models are selected using their configuration stanza name given in models.yaml. - To avoid filling up CPU RAM with cached models, this PR implements an LRU cache that monitors available CPU RAM. - The caching code allows the minimum value of available RAM to be adjusted, but invoke.py does not currently have a command-line argument that allows you to set it. The minimum free RAM is arbitrarily set to 2 GB. - Add optional description field to configs/models.yaml Unrelated fixes: - Added ">>" to CompViz model loading messages in order to make user experience more consistent. - When generating an image greater than defaults, will only warn about possible VRAM filling the first time. - Fixed bug that was causing help message to be printed twice. This involved moving the import line for the web backend into the section where it is called. Coauthored by: @ArDiouscuros
2022-10-12 06:14:59 +00:00
# uncache generators so they pick up new models
self.generators = {}
enable fast switching between models in invoke.py - This PR enables two new commands in the invoke.py script !models -- list the available models and their cache status !switch <model> -- switch to the indicated model Example: invoke> !models laion400m not loaded Latent Diffusion LAION400M model stable-diffusion-1.4 active Stable Diffusion inference model version 1.4 waifu-1.3 cached Waifu anime model version 1.3 invoke> !switch waifu-1.3 >> Caching model stable-diffusion-1.4 in system RAM >> Retrieving model waifu-1.3 from system RAM cache The name and descriptions of the models are taken from `config/models.yaml`. A future enhancement to `model_cache.py` will be to enable new model stanzas to be added to the file programmatically. This will be useful for the WebGUI. More details: - Use fast switching algorithm described in PR #948 - Models are selected using their configuration stanza name given in models.yaml. - To avoid filling up CPU RAM with cached models, this PR implements an LRU cache that monitors available CPU RAM. - The caching code allows the minimum value of available RAM to be adjusted, but invoke.py does not currently have a command-line argument that allows you to set it. The minimum free RAM is arbitrarily set to 2 GB. - Add optional description field to configs/models.yaml Unrelated fixes: - Added ">>" to CompViz model loading messages in order to make user experience more consistent. - When generating an image greater than defaults, will only warn about possible VRAM filling the first time. - Fixed bug that was causing help message to be printed twice. This involved moving the import line for the web backend into the section where it is called. Coauthored by: @ArDiouscuros
2022-10-12 06:14:59 +00:00
seed_everything(random.randrange(0, np.iinfo(np.uint32).max))
if self.embedding_path is not None:
use 🧨diffusers model (#1583) * initial commit of DiffusionPipeline class * spike: proof of concept using diffusers for txt2img * doc: type hints for Generator * refactor(model_cache): factor out load_ckpt * model_cache: add ability to load a diffusers model pipeline and update associated things in Generate & Generator to not instantly fail when that happens * model_cache: fix model default image dimensions * txt2img: support switching diffusers schedulers * diffusers: let the scheduler do its scaling of the initial latents Remove IPNDM scheduler; it is not behaving. * web server: update image_progress callback for diffusers data * diffusers: restore prompt weighting feature * diffusers: fix set-sampler error following model switch * diffusers: use InvokeAIDiffuserComponent for conditioning * cross_attention_control: stub (no-op) implementations for diffusers * model_cache: let offload_model work with DiffusionPipeline, sorta. * models.yaml.example: add diffusers-format model, set as default * test-invoke-conda: use diffusers-format model test-invoke-conda: put huggingface-token where the library can use it * environment-mac: upgrade to diffusers 0.7 (from 0.6) this was already done for linux; mac must have been lost in the merge. * preload_models: explicitly load diffusers models In non-interactive mode too, as long as you're logged in. * fix(model_cache): don't check `model.config` in diffusers format clean-up from recent merge. * diffusers integration: support img2img * dev: upgrade to diffusers 0.8 (from 0.7.1) We get to remove some code by using methods that were factored out in the base class. * refactor: remove backported img2img.get_timesteps now that we can use it directly from diffusers 0.8.1 * ci: use diffusers model * dev: upgrade to diffusers 0.9 (from 0.8.1) * lint: correct annotations for Python 3.9. * lint: correct AttributeError.name reference for Python 3.9. * CI: prefer diffusers-1.4 because it no longer requires a token The RunwayML models still do. * build: there's yet another place to update requirements? * configure: try to download models even without token Models in the CompVis and stabilityai repos no longer require them. (But runwayml still does.) * configure: add troubleshooting info for config-not-found * fix(configure): prepend root to config path * fix(configure): remove second `default: true` from models example * CI: simplify test-on-push logic now that we don't need secrets The "test on push but only in forks" logic was only necessary when tests didn't work for PRs-from-forks. * create an embedding_manager for diffusers * internal: avoid importing diffusers DummyObject see https://github.com/huggingface/diffusers/issues/1479 * fix "config attributes…not expected" diffusers warnings. * fix deprecated scheduler construction * work around an apparent MPS torch bug that causes conditioning to have no effect * 🚧 post-rebase repair * preliminary support for outpainting (no masking yet) * monkey-patch diffusers.attention and use Invoke lowvram code * add always_use_cpu arg to bypass MPS * add cross-attention control support to diffusers (fails on MPS) For unknown reasons MPS produces garbage output with .swap(). Use --always_use_cpu arg to invoke.py for now to test this code on MPS. * diffusers support for the inpainting model * fix debug_image to not crash with non-RGB images. * inpainting for the normal model [WIP] This seems to be performing well until the LAST STEP, at which point it dissolves to confetti. * fix off-by-one bug in cross-attention-control (#1774) prompt token sequences begin with a "beginning-of-sequence" marker <bos> and end with a repeated "end-of-sequence" marker <eos> - to make a default prompt length of <bos> + 75 prompt tokens + <eos>. the .swap() code was failing to take the column for <bos> at index 0 into account. the changes here do that, and also add extra handling for a single <eos> (which may be redundant but which is included for completeness). based on my understanding and some assumptions about how this all works, the reason .swap() nevertheless seemed to do the right thing, to some extent, is because over multiple steps the conditioning process in Stable Diffusion operates as a feedback loop. a change to token n-1 has flow-on effects to how the [1x4x64x64] latent tensor is modified by all the tokens after it, - and as the next step is processed, all the tokens before it as well. intuitively, a token's conditioning effects "echo" throughout the whole length of the prompt. so even though the token at n-1 was being edited when what the user actually wanted was to edit the token at n, it nevertheless still had some non-negligible effect, in roughly the right direction, often enough that it seemed like it was working properly. * refactor common CrossAttention stuff into a mixin so that the old ldm code can still work if necessary * inpainting for the normal model. I think it works this time. * diffusers: reset num_vectors_per_token sync with 44a00555718f1df173c60da0ed646cf700e29537 * diffusers: txt2img2img (hires_fix) with so much slicing and dicing of pipeline methods to stitch them together * refactor(diffusers): reduce some code duplication amongst the different tasks * fixup! refactor(diffusers): reduce some code duplication amongst the different tasks * diffusers: enable DPMSolver++ scheduler * diffusers: upgrade to diffusers 0.10, add Heun scheduler * diffusers(ModelCache): stopgap to make from_cpu compatible with diffusers * CI: default to diffusers-1.5 now that runwayml token requirement is gone * diffusers: update to 0.10 (and transformers to 4.25) * diffusers: use xformers when available diffusers no longer auto-enables this as of 0.10.2. * diffusers: make masked img2img behave better with multi-step schedulers re-randomizing the noise each step was confusing them. * diffusers: work more better with more models. fixed relative path problem with local models. fixed models on hub not always having a `fp16` branch. * diffusers: stopgap fix for attention_maps_callback crash after recent merge * fixup import merge conflicts correction for 061c5369a2247c6c92cd69606bcf54c4f1962a0b * test: add tests/inpainting inputs for masked img2img * diffusers(AddsMaskedGuidance): partial fix for k-schedulers Prevents them from crashing, but results are still hot garbage. * fix --safety_checker arg parsing and add note to diffusers loader about where safety checker gets called * generate: fix import error * CI: don't try to read the old init location * diffusers: support loading an alternate VAE * CI: remove sh-syntax if-statement so it doesn't crash powershell * CI: fold strings in yaml because backslash is not line-continuation in powershell * attention maps callback stuff for diffusers * build: fix syntax error in environment-mac * diffusers: add INITIAL_MODELS with diffusers-compatible repos * re-enable the embedding manager; closes #1778 * Squashed commit of the following: commit e4a956abc37fcb5cf188388b76b617bc5c8fda7d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:43:07 2022 +0100 import new load handling from EmbeddingManager and cleanup commit c4abe91a5ba0d415b45bf734068385668b7a66e6 Merge: 032e856e 1efc6397 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:09:53 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers_with_textual_inversion_manager commit 032e856eefb3bbc39534f5daafd25764bcfcef8b Merge: 8b4f0fe9 bc515e24 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:08:01 2022 +0100 Merge remote-tracking branch 'upstream/dev/diffusers' into dev/diffusers_with_textual_inversion_manager commit 1efc6397fc6e61c1aff4b0258b93089d61de5955 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:04:28 2022 +0100 cleanup and add performance notes commit e400f804ac471a0ca2ba432fd658778b20c7bdab Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:45:07 2022 +0100 fix bug and update unit tests commit deb9ae0ae1016750e93ce8275734061f7285a231 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:28:29 2022 +0100 textual inversion manager seems to work commit 162e02505dec777e91a983c4d0fb52e950d25ff0 Merge: cbad4583 12769b3d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:58:03 2022 +0100 Merge branch 'main' into feature_textual_inversion_mgr commit cbad45836c6aace6871a90f2621a953f49433131 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:54:10 2022 +0100 use position embeddings commit 070344c69b0e0db340a183857d0a787b348681d3 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:53:47 2022 +0100 Don't crash CLI on exceptions commit b035ac8c6772dfd9ba41b8eeb9103181cda028f8 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:11:55 2022 +0100 add missing position_embeddings commit 12769b3d3562ef71e0f54946b532ad077e10043c Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:33:25 2022 +0100 debugging why it don't work commit bafb7215eabe1515ca5e8388fd3bb2f3ac5362cf Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:21:33 2022 +0100 debugging why it don't work commit 664a6e9e146b42d96703f0cc8baf8f5efec04ee1 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit 8b4f0fe9d6e4e2643b36dfa27864294785d7ba4e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit ffbe1ab11163ba712e353d89404e301d0e0c6cdf Merge: 6e4dad60 023df37e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:37:31 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers commit 023df37efffa67434f77def7fc3c9dfb29f699fd Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:36:54 2022 +0100 cleanup commit 05fac594eaf79d0058e3c48deee93df603f136c2 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:07:49 2022 +0100 tweak error checking commit 009f32ed39a7280997c3ffab112adadee0b44279 Author: damian <null@damianstewart.com> Date: Thu Dec 15 21:29:47 2022 +0100 unit tests passing for embeddings with vector length >1 commit beb1b08d9a98112ed2fe073580568e1a18698da3 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:39:09 2022 +0100 more explicit equality tests when overwriting commit 44d8a5a7c85cdabc9ce3a54fd0769a10597b3ca9 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:30:13 2022 +0100 wip textual inversion manager (unit tests passing for 1v embedding overwriting) commit 417c2b57d90924a839616bfb66804faab8039e4c Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 12:30:55 2022 +0100 wip textual inversion manager (unit tests passing for base stuff + padding) commit 2e80872e3b6f7fd7d8eb8928822bd824b63cb2ff Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 10:57:57 2022 +0100 wip new TextualInversionManager * stop using WeightedFrozenCLIPEmbedder * store diffusion models locally - configure_invokeai.py reconfigured to store diffusion models rather than CompVis models - hugging face caching model is used, but cache is set to ~/invokeai/models/repo_id - models.yaml does **NOT** use path, just repo_id - "repo_name" changed to "repo_id" to following hugging face conventions - Models are loaded with full precision pending further work. * allow non-local files during development * path takes priority over repo_id * MVP for model_cache and configure_invokeai - Feature complete (almost) - configure_invokeai.py downloads both .ckpt and diffuser models, along with their VAEs. Both types of download are controlled by a unified INITIAL_MODELS.yaml file. - model_cache can load both type of model and switches back and forth in CPU. No memory leaks detected TO DO: 1. I have not yet turned on the LocalOnly flag for diffuser models, so the code will check the Hugging Face repo for updates before using the locally cached models. This will break firewalled systems. I am thinking of putting in a global check for internet connectivity at startup time and setting the LocalOnly flag based on this. It would be good to check updates if there is connectivity. 2. I have not gone completely through INITIAL_MODELS.yaml to check which models are available as diffusers and which are not. So models like PaperCut and VoxelArt may not load properly. The runway and stability models are checked, as well as the Trinart models. 3. Add stanzas for SD 2.0 and 2.1 in INITIAL_MODELS.yaml REMAINING PROBLEMS NOT DIRECTLY RELATED TO MODEL_CACHE: 1. When loading a .ckpt file there are lots of messages like this: Warning! ldm.modules.attention.CrossAttention is no longer being maintained. Please use InvokeAICrossAttention instead. I'm not sure how to address this. 2. The ckpt models ***don't actually run*** due to the lack of special-case support for them in the generator objects. For example, here's the hard crash you get when you run txt2img against the legacy waifu-diffusion-1.3 model: ``` >> An error occurred: Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 140, in main main_loop(gen, opt) File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 371, in main_loop gen.prompt2image( File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1265, in __getattr__ raise AttributeError("'{}' object has no attribute '{}'".format( AttributeError: 'LatentDiffusion' object has no attribute 'image_from_embeddings' ``` 3. The inpainting diffusion model isn't working. Here's the output of "banana sushi" when inpainting-1.5 is loaded: ``` Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 301, in image_from_embeddings result_latents, result_attention_map_saver = self.latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 330, in latents_from_embeddings result: PipelineIntermediateState = infer_latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 185, in __call__ for result in self.generator_method(*args, **kwargs): File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 367, in generate_latents_from_embeddings step_output = self.step(batched_t, latents, guidance_scale, File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context return func(*args, **kwargs) File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 409, in step step_output = self.scheduler.step(noise_pred, timestep, latents, **extra_step_kwargs) File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/diffusers/schedulers/scheduling_lms_discrete.py", line 223, in step pred_original_sample = sample - sigma * model_output RuntimeError: The size of tensor a (9) must match the size of tensor b (4) at non-singleton dimension 1 ``` * proper support for float32/float16 - configure script now correctly detects user's preference for fp16/32 and downloads the correct diffuser version. If fp16 version not available, falls back to fp32 version. - misc code cleanup and simplification in model_cache * add on-the-fly conversion of .ckpt to diffusers models 1. On-the-fly conversion code can be found in the file ldm/invoke/ckpt_to_diffusers.py. 2. A new !optimize command has been added to the CLI. Should be ported to Web GUI. User experience on the CLI is this: ``` invoke> !optimize /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt INFO: Converting legacy weights file /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt to optimized diffuser model. This operation will take 30-60s to complete. Success. Optimized model is now located at /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 Writing new config file entry for sd-v1-4... >> New configuration: sd-v1-4: description: Optimized version of sd-v1-4 format: diffusers path: /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 OK to import [n]? y >> Verifying that new model loads... >> Current VRAM usage: 2.60G >> Offloading stable-diffusion-2.1 to CPU >> Loading diffusers model from /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 | Using faster float16 precision You have disabled the safety checker for <class 'ldm.invoke.generator.diffusers_pipeline.StableDiffusionGeneratorPipeline'> by passing `safety_checker=None`. Ensure that you abide to the conditions of the Stable Diffusion \ license and do not expose unfiltered results in services or applications open to the public. Both the diffusers team and Hugging Face strongly recommend to keep the safety filter enabled in all public facing circumstances,\ disabling it only for use-cases that involve analyzing network behavior or auditing its results. For more information, please have a look at https://github.com/huggingface/diffusers/pull/254 . | training width x height = (512 x 512) >> Model loaded in 3.48s >> Max VRAM used to load the model: 2.17G >> Current VRAM usage:2.17G >> Textual inversions available: >> Setting Sampler to k_lms (LMSDiscreteScheduler) Keep model loaded? [y] ``` * add parallel set of generator files for ckpt legacy generation * generation using legacy ckpt models now working * diffusers: fix missing attention_maps_callback fix for 23eb80b40421b2bb8f4b6d3dd30490d11c447b36 * associate legacy CrossAttention with .ckpt models * enable autoconvert New --autoconvert CLI option will scan a designated directory for new .ckpt files, convert them into diffuser models, and import them into models.yaml. Works like this: invoke.py --autoconvert /path/to/weights/directory In ModelCache added two new methods: autoconvert_weights(config_path, weights_directory_path, models_directory_path) convert_and_import(ckpt_path, diffuser_path) * diffusers: update to diffusers 0.11 (from 0.10.2) * fix vae loading & width/height calculation * refactor: encapsulate these conditioning data into one container * diffusers: fix some noise-scaling issues by pushing the noise-mixing down to the common function * add support for safetensors and accelerate * set local_files_only when internet unreachable * diffusers: fix error-handling path when model repo has no fp16 branch * fix generatorinpaint error Fixes : "ModuleNotFoundError: No module named 'ldm.invoke.generatorinpaint' https://github.com/invoke-ai/InvokeAI/pull/1583#issuecomment-1363634318 * quench diffuser safety-checker warning * diffusers: support stochastic DDIM eta parameter * fix conda env creation on macos * fix cross-attention with diffusers 0.11 * diffusers: the VAE needs to be tiling as well as the U-Net * diffusers: comment on subfolders * diffusers: embiggen! * diffusers: make model_cache.list_models serializable * diffusers(inpaint): restore scaling functionality * fix requirements clash between numba and numpy 1.24 * diffusers: allow inpainting model to do non-inpainting tasks * start expanding model_cache functionality * add import_ckpt_model() and import_diffuser_model() methods to model_manager - in addition, model_cache.py is now renamed to model_manager.py * allow "recommended" flag to be optional in INITIAL_MODELS.yaml * configure_invokeai now downloads VAE diffusers in advance * rename ModelCache to ModelManager * remove support for `repo_name` in models.yaml * check for and refuse to load embeddings trained on incompatible models * models.yaml.example: s/repo_name/repo_id and remove extra INITIAL_MODELS now that the main one has diffusers models in it. * add MVP textual inversion script * refactor(InvokeAIDiffuserComponent): factor out _combine() * InvokeAIDiffuserComponent: implement threshold * InvokeAIDiffuserComponent: diagnostic logs for threshold ...this does not look right * add a curses-based frontend to textual inversion - not quite working yet - requires npyscreen installed - on windows will also have the windows-curses requirement, but not added to requirements yet * add curses-based interface for textual inversion * fix crash in convert_and_import() - This corrects a "local variable referenced before assignment" error in model_manager.convert_and_import() * potential workaround for no 'state_dict' key error - As reported in https://github.com/huggingface/diffusers/issues/1876 * create TI output dir if needed * Update environment-lin-cuda.yml (#2159) Fixing line 42 to be the proper order to define the transformers requirement: ~= instead of =~ * diffusers: update sampler-to-scheduler mapping based on https://github.com/huggingface/diffusers/issues/277#issuecomment-1371428672 * improve user exp for ckt to diffusers conversion - !optimize_models command now operates on an existing ckpt file entry in models.yaml - replaces existing entry, rather than adding a new one - offers to delete the ckpt file after conversion * web: adapt progress callback to deal with old generator or new diffusers pipeline * clean-up model_manager code - add_model() verified to work for .ckpt local paths, .ckpt remote URLs, diffusers local paths, and diffusers repo_ids - convert_and_import() verified to work for local and remove .ckpt files * handle edge cases for import_model() and convert_model() * add support for safetensor .ckpt files * fix name error * code cleanup with pyflake * improve model setting behavior - If the user enters an invalid model name at startup time, will not try to load it, warn, and use default model - CLI UI enhancement: include currently active model in the command line prompt. * update test-invoke-pip.yml - fix model cache path to point to runwayml/stable-diffusion-v1-5 - remove `skip-sd-weights` from configure_invokeai.py args * exclude dev/diffusers from "fail for draft PRs" * disable "fail on PR jobs" * re-add `--skip-sd-weights` since no space * update workflow environments - include `INVOKE_MODEL_RECONFIGURE: '--yes'` * clean up model load failure handling - Allow CLI to run even when no model is defined or loadable. - Inhibit stack trace when model load fails - only show last error - Give user *option* to run configure_invokeai.py when no models successfully load. - Restart invokeai after reconfiguration. * further edge-case handling 1) only one model in models.yaml file, and that model is broken 2) no models in models.yaml 3) models.yaml doesn't exist at all * fix incorrect model status listing - "cached" was not being returned from list_models() - normalize handling of exceptions during model loading: - Passing an invalid model name to generate.set_model() will return a KeyError - All other exceptions are returned as the appropriate Exception * CI: do download weights (if not already cached) * diffusers: fix scheduler loading in offline mode * CI: fix model name (no longer has `diffusers-` prefix) * Update txt2img2img.py (#2256) * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * feat - make model storage compatible with hugging face caching system This commit alters the InvokeAI model directory to be compatible with hugging face, making it easier to share diffusers (and other models) across different programs. - If the HF_HOME environment variable is not set, then models are cached in ~/invokeai/models in a format that is identical to the HuggingFace cache. - If HF_HOME is set, then models are cached wherever HF_HOME points. - To enable sharing with other HuggingFace library clients, set HF_HOME to ~/.cache/huggingface to set the default cache location or to ~/invokeai/models to have huggingface cache inside InvokeAI. * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * fix error "no attribute CkptInpaint" * model_manager.list_models() returns entire model config stanza+status * Initial Draft - Model Manager Diffusers * added hash function to diffusers * implement sha256 hashes on diffusers models * Add Model Manager Support for Diffusers * fix various problems with model manager - in cli import functions, fix not enough values to unpack from _get_name_and_desc() - fix crash when using old-style vae: value with new-style diffuser * rebuild frontend * fix dictconfig-not-serializable issue * fix NoneType' object is not subscriptable crash in model_manager * fix "str has no attribute get" error in model_manager list_models() * Add path and repo_id support for Diffusers Model Manager Also fixes bugs * Fix tooltip IT localization not working * Add Version Number To WebUI * Optimize Model Search * Fix incorrect font on the Model Manager UI * Fix image degradation on merge fixes - [Experimental] This change should effectively fix a couple of things. - Fix image degradation on subsequent merges of the canvas layers. - Fix the slight transparent border that is left behind when filling the bounding box with a color. - Fix the left over line of color when filling a bounding box with color. So far there are no side effects for this. If any, please report. * Add local model filtering for Diffusers / Checkpoints * Go to home on modal close for the Add Modal UI * Styling Fixes * Model Manager Diffusers Localization Update * Add Safe Tensor scanning to Model Manager * Fix model edit form dispatching string values instead of numbers. * Resolve VAE handling / edge cases for supplied repos * defer injecting tokens for textual inversions until they're used for the first time * squash a console warning * implement model migration check * add_model() overwrites previous config rather than merges * fix model config file attribute merging * fix precision handling in textual inversion script * allow ckpt conversion script to work with safetensors .ckpts Applied patch here: https://github.com/huggingface/diffusers/commit/beb932c5d111872c5e45387e7b1b2b3dd0524a47 * fix name "args" is not defined crash in textual_inversion_training * fix a second NameError: name 'args' is not defined crash * fix loading of the safety checker from the global cache dir * add installation step to textual inversion frontend - After a successful training run, the script will copy learned_embeds.bin to a subfolder of the embeddings directory. - User given the option to delete the logs and intermediate checkpoints (which together use 7-8G of space) - If textual inversion training fails, reports the error gracefully. * don't crash out on incompatible embeddings - put try: blocks around places where the system tries to load an embedding which is incompatible with the currently loaded model * add support for checkpoint resuming * textual inversion preferences are saved and restored between sessions - Preferences are stored in a file named text-inversion-training/preferences.conf - Currently the resume-from-checkpoint option is not working correctly. Possible bug in textual_inversion_training.py? * copy learned_embeddings.bin into right location * add front end for diffusers model merging - Front end doesn't do anything yet!!!! - Made change to model name parsing in CLI to support ability to have merged models with the "+" character in their names. * improve inpainting experience - recommend ckpt version of inpainting-1.5 to user - fix get_noise() bug in ckpt version of omnibus.py * update environment*yml * tweak instructions to install HuggingFace token * bump version number * enhance update scripts - update scripts will now fetch new INITIAL_MODELS.yaml so that configure_invokeai.py will know about the diffusers versions. * enhance invoke.sh/invoke.bat launchers - added configure_invokeai.py to menu - menu defaults to browser-based invoke * remove conda workflow (#2321) * fix `token_ids has shape torch.Size([79]) - expected [77]` * update CHANGELOG.md with 2.3.* info - Add information on how formats have changed and the upgrade process. - Add short bug list. Co-authored-by: Damian Stewart <d@damianstewart.com> Co-authored-by: Damian Stewart <null@damianstewart.com> Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> Co-authored-by: Wybartel-luxmc <37852506+Wybartel-luxmc@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> Co-authored-by: mickr777 <115216705+mickr777@users.noreply.github.com> Co-authored-by: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Co-authored-by: Eugene Brodsky <ebr@users.noreply.github.com> Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com>
2023-01-15 14:22:46 +00:00
for root, _, files in os.walk(self.embedding_path):
for name in files:
ti_path = os.path.join(root, name)
self.model.textual_inversion_manager.load_textual_inversion(ti_path,
defer_injecting_tokens=True)
print(f'>> Textual inversions available: {", ".join(self.model.textual_inversion_manager.get_all_trigger_strings())}')
enable fast switching between models in invoke.py - This PR enables two new commands in the invoke.py script !models -- list the available models and their cache status !switch <model> -- switch to the indicated model Example: invoke> !models laion400m not loaded Latent Diffusion LAION400M model stable-diffusion-1.4 active Stable Diffusion inference model version 1.4 waifu-1.3 cached Waifu anime model version 1.3 invoke> !switch waifu-1.3 >> Caching model stable-diffusion-1.4 in system RAM >> Retrieving model waifu-1.3 from system RAM cache The name and descriptions of the models are taken from `config/models.yaml`. A future enhancement to `model_cache.py` will be to enable new model stanzas to be added to the file programmatically. This will be useful for the WebGUI. More details: - Use fast switching algorithm described in PR #948 - Models are selected using their configuration stanza name given in models.yaml. - To avoid filling up CPU RAM with cached models, this PR implements an LRU cache that monitors available CPU RAM. - The caching code allows the minimum value of available RAM to be adjusted, but invoke.py does not currently have a command-line argument that allows you to set it. The minimum free RAM is arbitrarily set to 2 GB. - Add optional description field to configs/models.yaml Unrelated fixes: - Added ">>" to CompViz model loading messages in order to make user experience more consistent. - When generating an image greater than defaults, will only warn about possible VRAM filling the first time. - Fixed bug that was causing help message to be printed twice. This involved moving the import line for the web backend into the section where it is called. Coauthored by: @ArDiouscuros
2022-10-12 06:14:59 +00:00
self.model_name = model_name
use 🧨diffusers model (#1583) * initial commit of DiffusionPipeline class * spike: proof of concept using diffusers for txt2img * doc: type hints for Generator * refactor(model_cache): factor out load_ckpt * model_cache: add ability to load a diffusers model pipeline and update associated things in Generate & Generator to not instantly fail when that happens * model_cache: fix model default image dimensions * txt2img: support switching diffusers schedulers * diffusers: let the scheduler do its scaling of the initial latents Remove IPNDM scheduler; it is not behaving. * web server: update image_progress callback for diffusers data * diffusers: restore prompt weighting feature * diffusers: fix set-sampler error following model switch * diffusers: use InvokeAIDiffuserComponent for conditioning * cross_attention_control: stub (no-op) implementations for diffusers * model_cache: let offload_model work with DiffusionPipeline, sorta. * models.yaml.example: add diffusers-format model, set as default * test-invoke-conda: use diffusers-format model test-invoke-conda: put huggingface-token where the library can use it * environment-mac: upgrade to diffusers 0.7 (from 0.6) this was already done for linux; mac must have been lost in the merge. * preload_models: explicitly load diffusers models In non-interactive mode too, as long as you're logged in. * fix(model_cache): don't check `model.config` in diffusers format clean-up from recent merge. * diffusers integration: support img2img * dev: upgrade to diffusers 0.8 (from 0.7.1) We get to remove some code by using methods that were factored out in the base class. * refactor: remove backported img2img.get_timesteps now that we can use it directly from diffusers 0.8.1 * ci: use diffusers model * dev: upgrade to diffusers 0.9 (from 0.8.1) * lint: correct annotations for Python 3.9. * lint: correct AttributeError.name reference for Python 3.9. * CI: prefer diffusers-1.4 because it no longer requires a token The RunwayML models still do. * build: there's yet another place to update requirements? * configure: try to download models even without token Models in the CompVis and stabilityai repos no longer require them. (But runwayml still does.) * configure: add troubleshooting info for config-not-found * fix(configure): prepend root to config path * fix(configure): remove second `default: true` from models example * CI: simplify test-on-push logic now that we don't need secrets The "test on push but only in forks" logic was only necessary when tests didn't work for PRs-from-forks. * create an embedding_manager for diffusers * internal: avoid importing diffusers DummyObject see https://github.com/huggingface/diffusers/issues/1479 * fix "config attributes…not expected" diffusers warnings. * fix deprecated scheduler construction * work around an apparent MPS torch bug that causes conditioning to have no effect * 🚧 post-rebase repair * preliminary support for outpainting (no masking yet) * monkey-patch diffusers.attention and use Invoke lowvram code * add always_use_cpu arg to bypass MPS * add cross-attention control support to diffusers (fails on MPS) For unknown reasons MPS produces garbage output with .swap(). Use --always_use_cpu arg to invoke.py for now to test this code on MPS. * diffusers support for the inpainting model * fix debug_image to not crash with non-RGB images. * inpainting for the normal model [WIP] This seems to be performing well until the LAST STEP, at which point it dissolves to confetti. * fix off-by-one bug in cross-attention-control (#1774) prompt token sequences begin with a "beginning-of-sequence" marker <bos> and end with a repeated "end-of-sequence" marker <eos> - to make a default prompt length of <bos> + 75 prompt tokens + <eos>. the .swap() code was failing to take the column for <bos> at index 0 into account. the changes here do that, and also add extra handling for a single <eos> (which may be redundant but which is included for completeness). based on my understanding and some assumptions about how this all works, the reason .swap() nevertheless seemed to do the right thing, to some extent, is because over multiple steps the conditioning process in Stable Diffusion operates as a feedback loop. a change to token n-1 has flow-on effects to how the [1x4x64x64] latent tensor is modified by all the tokens after it, - and as the next step is processed, all the tokens before it as well. intuitively, a token's conditioning effects "echo" throughout the whole length of the prompt. so even though the token at n-1 was being edited when what the user actually wanted was to edit the token at n, it nevertheless still had some non-negligible effect, in roughly the right direction, often enough that it seemed like it was working properly. * refactor common CrossAttention stuff into a mixin so that the old ldm code can still work if necessary * inpainting for the normal model. I think it works this time. * diffusers: reset num_vectors_per_token sync with 44a00555718f1df173c60da0ed646cf700e29537 * diffusers: txt2img2img (hires_fix) with so much slicing and dicing of pipeline methods to stitch them together * refactor(diffusers): reduce some code duplication amongst the different tasks * fixup! refactor(diffusers): reduce some code duplication amongst the different tasks * diffusers: enable DPMSolver++ scheduler * diffusers: upgrade to diffusers 0.10, add Heun scheduler * diffusers(ModelCache): stopgap to make from_cpu compatible with diffusers * CI: default to diffusers-1.5 now that runwayml token requirement is gone * diffusers: update to 0.10 (and transformers to 4.25) * diffusers: use xformers when available diffusers no longer auto-enables this as of 0.10.2. * diffusers: make masked img2img behave better with multi-step schedulers re-randomizing the noise each step was confusing them. * diffusers: work more better with more models. fixed relative path problem with local models. fixed models on hub not always having a `fp16` branch. * diffusers: stopgap fix for attention_maps_callback crash after recent merge * fixup import merge conflicts correction for 061c5369a2247c6c92cd69606bcf54c4f1962a0b * test: add tests/inpainting inputs for masked img2img * diffusers(AddsMaskedGuidance): partial fix for k-schedulers Prevents them from crashing, but results are still hot garbage. * fix --safety_checker arg parsing and add note to diffusers loader about where safety checker gets called * generate: fix import error * CI: don't try to read the old init location * diffusers: support loading an alternate VAE * CI: remove sh-syntax if-statement so it doesn't crash powershell * CI: fold strings in yaml because backslash is not line-continuation in powershell * attention maps callback stuff for diffusers * build: fix syntax error in environment-mac * diffusers: add INITIAL_MODELS with diffusers-compatible repos * re-enable the embedding manager; closes #1778 * Squashed commit of the following: commit e4a956abc37fcb5cf188388b76b617bc5c8fda7d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:43:07 2022 +0100 import new load handling from EmbeddingManager and cleanup commit c4abe91a5ba0d415b45bf734068385668b7a66e6 Merge: 032e856e 1efc6397 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:09:53 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers_with_textual_inversion_manager commit 032e856eefb3bbc39534f5daafd25764bcfcef8b Merge: 8b4f0fe9 bc515e24 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:08:01 2022 +0100 Merge remote-tracking branch 'upstream/dev/diffusers' into dev/diffusers_with_textual_inversion_manager commit 1efc6397fc6e61c1aff4b0258b93089d61de5955 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:04:28 2022 +0100 cleanup and add performance notes commit e400f804ac471a0ca2ba432fd658778b20c7bdab Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:45:07 2022 +0100 fix bug and update unit tests commit deb9ae0ae1016750e93ce8275734061f7285a231 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:28:29 2022 +0100 textual inversion manager seems to work commit 162e02505dec777e91a983c4d0fb52e950d25ff0 Merge: cbad4583 12769b3d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:58:03 2022 +0100 Merge branch 'main' into feature_textual_inversion_mgr commit cbad45836c6aace6871a90f2621a953f49433131 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:54:10 2022 +0100 use position embeddings commit 070344c69b0e0db340a183857d0a787b348681d3 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:53:47 2022 +0100 Don't crash CLI on exceptions commit b035ac8c6772dfd9ba41b8eeb9103181cda028f8 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:11:55 2022 +0100 add missing position_embeddings commit 12769b3d3562ef71e0f54946b532ad077e10043c Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:33:25 2022 +0100 debugging why it don't work commit bafb7215eabe1515ca5e8388fd3bb2f3ac5362cf Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:21:33 2022 +0100 debugging why it don't work commit 664a6e9e146b42d96703f0cc8baf8f5efec04ee1 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit 8b4f0fe9d6e4e2643b36dfa27864294785d7ba4e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit ffbe1ab11163ba712e353d89404e301d0e0c6cdf Merge: 6e4dad60 023df37e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:37:31 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers commit 023df37efffa67434f77def7fc3c9dfb29f699fd Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:36:54 2022 +0100 cleanup commit 05fac594eaf79d0058e3c48deee93df603f136c2 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:07:49 2022 +0100 tweak error checking commit 009f32ed39a7280997c3ffab112adadee0b44279 Author: damian <null@damianstewart.com> Date: Thu Dec 15 21:29:47 2022 +0100 unit tests passing for embeddings with vector length >1 commit beb1b08d9a98112ed2fe073580568e1a18698da3 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:39:09 2022 +0100 more explicit equality tests when overwriting commit 44d8a5a7c85cdabc9ce3a54fd0769a10597b3ca9 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:30:13 2022 +0100 wip textual inversion manager (unit tests passing for 1v embedding overwriting) commit 417c2b57d90924a839616bfb66804faab8039e4c Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 12:30:55 2022 +0100 wip textual inversion manager (unit tests passing for base stuff + padding) commit 2e80872e3b6f7fd7d8eb8928822bd824b63cb2ff Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 10:57:57 2022 +0100 wip new TextualInversionManager * stop using WeightedFrozenCLIPEmbedder * store diffusion models locally - configure_invokeai.py reconfigured to store diffusion models rather than CompVis models - hugging face caching model is used, but cache is set to ~/invokeai/models/repo_id - models.yaml does **NOT** use path, just repo_id - "repo_name" changed to "repo_id" to following hugging face conventions - Models are loaded with full precision pending further work. * allow non-local files during development * path takes priority over repo_id * MVP for model_cache and configure_invokeai - Feature complete (almost) - configure_invokeai.py downloads both .ckpt and diffuser models, along with their VAEs. Both types of download are controlled by a unified INITIAL_MODELS.yaml file. - model_cache can load both type of model and switches back and forth in CPU. No memory leaks detected TO DO: 1. I have not yet turned on the LocalOnly flag for diffuser models, so the code will check the Hugging Face repo for updates before using the locally cached models. This will break firewalled systems. I am thinking of putting in a global check for internet connectivity at startup time and setting the LocalOnly flag based on this. It would be good to check updates if there is connectivity. 2. I have not gone completely through INITIAL_MODELS.yaml to check which models are available as diffusers and which are not. So models like PaperCut and VoxelArt may not load properly. The runway and stability models are checked, as well as the Trinart models. 3. Add stanzas for SD 2.0 and 2.1 in INITIAL_MODELS.yaml REMAINING PROBLEMS NOT DIRECTLY RELATED TO MODEL_CACHE: 1. When loading a .ckpt file there are lots of messages like this: Warning! ldm.modules.attention.CrossAttention is no longer being maintained. Please use InvokeAICrossAttention instead. I'm not sure how to address this. 2. The ckpt models ***don't actually run*** due to the lack of special-case support for them in the generator objects. For example, here's the hard crash you get when you run txt2img against the legacy waifu-diffusion-1.3 model: ``` >> An error occurred: Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 140, in main main_loop(gen, opt) File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 371, in main_loop gen.prompt2image( File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1265, in __getattr__ raise AttributeError("'{}' object has no attribute '{}'".format( AttributeError: 'LatentDiffusion' object has no attribute 'image_from_embeddings' ``` 3. The inpainting diffusion model isn't working. Here's the output of "banana sushi" when inpainting-1.5 is loaded: ``` Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 301, in image_from_embeddings result_latents, result_attention_map_saver = self.latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 330, in latents_from_embeddings result: PipelineIntermediateState = infer_latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 185, in __call__ for result in self.generator_method(*args, **kwargs): File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 367, in generate_latents_from_embeddings step_output = self.step(batched_t, latents, guidance_scale, File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context return func(*args, **kwargs) File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 409, in step step_output = self.scheduler.step(noise_pred, timestep, latents, **extra_step_kwargs) File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/diffusers/schedulers/scheduling_lms_discrete.py", line 223, in step pred_original_sample = sample - sigma * model_output RuntimeError: The size of tensor a (9) must match the size of tensor b (4) at non-singleton dimension 1 ``` * proper support for float32/float16 - configure script now correctly detects user's preference for fp16/32 and downloads the correct diffuser version. If fp16 version not available, falls back to fp32 version. - misc code cleanup and simplification in model_cache * add on-the-fly conversion of .ckpt to diffusers models 1. On-the-fly conversion code can be found in the file ldm/invoke/ckpt_to_diffusers.py. 2. A new !optimize command has been added to the CLI. Should be ported to Web GUI. User experience on the CLI is this: ``` invoke> !optimize /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt INFO: Converting legacy weights file /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt to optimized diffuser model. This operation will take 30-60s to complete. Success. Optimized model is now located at /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 Writing new config file entry for sd-v1-4... >> New configuration: sd-v1-4: description: Optimized version of sd-v1-4 format: diffusers path: /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 OK to import [n]? y >> Verifying that new model loads... >> Current VRAM usage: 2.60G >> Offloading stable-diffusion-2.1 to CPU >> Loading diffusers model from /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 | Using faster float16 precision You have disabled the safety checker for <class 'ldm.invoke.generator.diffusers_pipeline.StableDiffusionGeneratorPipeline'> by passing `safety_checker=None`. Ensure that you abide to the conditions of the Stable Diffusion \ license and do not expose unfiltered results in services or applications open to the public. Both the diffusers team and Hugging Face strongly recommend to keep the safety filter enabled in all public facing circumstances,\ disabling it only for use-cases that involve analyzing network behavior or auditing its results. For more information, please have a look at https://github.com/huggingface/diffusers/pull/254 . | training width x height = (512 x 512) >> Model loaded in 3.48s >> Max VRAM used to load the model: 2.17G >> Current VRAM usage:2.17G >> Textual inversions available: >> Setting Sampler to k_lms (LMSDiscreteScheduler) Keep model loaded? [y] ``` * add parallel set of generator files for ckpt legacy generation * generation using legacy ckpt models now working * diffusers: fix missing attention_maps_callback fix for 23eb80b40421b2bb8f4b6d3dd30490d11c447b36 * associate legacy CrossAttention with .ckpt models * enable autoconvert New --autoconvert CLI option will scan a designated directory for new .ckpt files, convert them into diffuser models, and import them into models.yaml. Works like this: invoke.py --autoconvert /path/to/weights/directory In ModelCache added two new methods: autoconvert_weights(config_path, weights_directory_path, models_directory_path) convert_and_import(ckpt_path, diffuser_path) * diffusers: update to diffusers 0.11 (from 0.10.2) * fix vae loading & width/height calculation * refactor: encapsulate these conditioning data into one container * diffusers: fix some noise-scaling issues by pushing the noise-mixing down to the common function * add support for safetensors and accelerate * set local_files_only when internet unreachable * diffusers: fix error-handling path when model repo has no fp16 branch * fix generatorinpaint error Fixes : "ModuleNotFoundError: No module named 'ldm.invoke.generatorinpaint' https://github.com/invoke-ai/InvokeAI/pull/1583#issuecomment-1363634318 * quench diffuser safety-checker warning * diffusers: support stochastic DDIM eta parameter * fix conda env creation on macos * fix cross-attention with diffusers 0.11 * diffusers: the VAE needs to be tiling as well as the U-Net * diffusers: comment on subfolders * diffusers: embiggen! * diffusers: make model_cache.list_models serializable * diffusers(inpaint): restore scaling functionality * fix requirements clash between numba and numpy 1.24 * diffusers: allow inpainting model to do non-inpainting tasks * start expanding model_cache functionality * add import_ckpt_model() and import_diffuser_model() methods to model_manager - in addition, model_cache.py is now renamed to model_manager.py * allow "recommended" flag to be optional in INITIAL_MODELS.yaml * configure_invokeai now downloads VAE diffusers in advance * rename ModelCache to ModelManager * remove support for `repo_name` in models.yaml * check for and refuse to load embeddings trained on incompatible models * models.yaml.example: s/repo_name/repo_id and remove extra INITIAL_MODELS now that the main one has diffusers models in it. * add MVP textual inversion script * refactor(InvokeAIDiffuserComponent): factor out _combine() * InvokeAIDiffuserComponent: implement threshold * InvokeAIDiffuserComponent: diagnostic logs for threshold ...this does not look right * add a curses-based frontend to textual inversion - not quite working yet - requires npyscreen installed - on windows will also have the windows-curses requirement, but not added to requirements yet * add curses-based interface for textual inversion * fix crash in convert_and_import() - This corrects a "local variable referenced before assignment" error in model_manager.convert_and_import() * potential workaround for no 'state_dict' key error - As reported in https://github.com/huggingface/diffusers/issues/1876 * create TI output dir if needed * Update environment-lin-cuda.yml (#2159) Fixing line 42 to be the proper order to define the transformers requirement: ~= instead of =~ * diffusers: update sampler-to-scheduler mapping based on https://github.com/huggingface/diffusers/issues/277#issuecomment-1371428672 * improve user exp for ckt to diffusers conversion - !optimize_models command now operates on an existing ckpt file entry in models.yaml - replaces existing entry, rather than adding a new one - offers to delete the ckpt file after conversion * web: adapt progress callback to deal with old generator or new diffusers pipeline * clean-up model_manager code - add_model() verified to work for .ckpt local paths, .ckpt remote URLs, diffusers local paths, and diffusers repo_ids - convert_and_import() verified to work for local and remove .ckpt files * handle edge cases for import_model() and convert_model() * add support for safetensor .ckpt files * fix name error * code cleanup with pyflake * improve model setting behavior - If the user enters an invalid model name at startup time, will not try to load it, warn, and use default model - CLI UI enhancement: include currently active model in the command line prompt. * update test-invoke-pip.yml - fix model cache path to point to runwayml/stable-diffusion-v1-5 - remove `skip-sd-weights` from configure_invokeai.py args * exclude dev/diffusers from "fail for draft PRs" * disable "fail on PR jobs" * re-add `--skip-sd-weights` since no space * update workflow environments - include `INVOKE_MODEL_RECONFIGURE: '--yes'` * clean up model load failure handling - Allow CLI to run even when no model is defined or loadable. - Inhibit stack trace when model load fails - only show last error - Give user *option* to run configure_invokeai.py when no models successfully load. - Restart invokeai after reconfiguration. * further edge-case handling 1) only one model in models.yaml file, and that model is broken 2) no models in models.yaml 3) models.yaml doesn't exist at all * fix incorrect model status listing - "cached" was not being returned from list_models() - normalize handling of exceptions during model loading: - Passing an invalid model name to generate.set_model() will return a KeyError - All other exceptions are returned as the appropriate Exception * CI: do download weights (if not already cached) * diffusers: fix scheduler loading in offline mode * CI: fix model name (no longer has `diffusers-` prefix) * Update txt2img2img.py (#2256) * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * feat - make model storage compatible with hugging face caching system This commit alters the InvokeAI model directory to be compatible with hugging face, making it easier to share diffusers (and other models) across different programs. - If the HF_HOME environment variable is not set, then models are cached in ~/invokeai/models in a format that is identical to the HuggingFace cache. - If HF_HOME is set, then models are cached wherever HF_HOME points. - To enable sharing with other HuggingFace library clients, set HF_HOME to ~/.cache/huggingface to set the default cache location or to ~/invokeai/models to have huggingface cache inside InvokeAI. * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * fix error "no attribute CkptInpaint" * model_manager.list_models() returns entire model config stanza+status * Initial Draft - Model Manager Diffusers * added hash function to diffusers * implement sha256 hashes on diffusers models * Add Model Manager Support for Diffusers * fix various problems with model manager - in cli import functions, fix not enough values to unpack from _get_name_and_desc() - fix crash when using old-style vae: value with new-style diffuser * rebuild frontend * fix dictconfig-not-serializable issue * fix NoneType' object is not subscriptable crash in model_manager * fix "str has no attribute get" error in model_manager list_models() * Add path and repo_id support for Diffusers Model Manager Also fixes bugs * Fix tooltip IT localization not working * Add Version Number To WebUI * Optimize Model Search * Fix incorrect font on the Model Manager UI * Fix image degradation on merge fixes - [Experimental] This change should effectively fix a couple of things. - Fix image degradation on subsequent merges of the canvas layers. - Fix the slight transparent border that is left behind when filling the bounding box with a color. - Fix the left over line of color when filling a bounding box with color. So far there are no side effects for this. If any, please report. * Add local model filtering for Diffusers / Checkpoints * Go to home on modal close for the Add Modal UI * Styling Fixes * Model Manager Diffusers Localization Update * Add Safe Tensor scanning to Model Manager * Fix model edit form dispatching string values instead of numbers. * Resolve VAE handling / edge cases for supplied repos * defer injecting tokens for textual inversions until they're used for the first time * squash a console warning * implement model migration check * add_model() overwrites previous config rather than merges * fix model config file attribute merging * fix precision handling in textual inversion script * allow ckpt conversion script to work with safetensors .ckpts Applied patch here: https://github.com/huggingface/diffusers/commit/beb932c5d111872c5e45387e7b1b2b3dd0524a47 * fix name "args" is not defined crash in textual_inversion_training * fix a second NameError: name 'args' is not defined crash * fix loading of the safety checker from the global cache dir * add installation step to textual inversion frontend - After a successful training run, the script will copy learned_embeds.bin to a subfolder of the embeddings directory. - User given the option to delete the logs and intermediate checkpoints (which together use 7-8G of space) - If textual inversion training fails, reports the error gracefully. * don't crash out on incompatible embeddings - put try: blocks around places where the system tries to load an embedding which is incompatible with the currently loaded model * add support for checkpoint resuming * textual inversion preferences are saved and restored between sessions - Preferences are stored in a file named text-inversion-training/preferences.conf - Currently the resume-from-checkpoint option is not working correctly. Possible bug in textual_inversion_training.py? * copy learned_embeddings.bin into right location * add front end for diffusers model merging - Front end doesn't do anything yet!!!! - Made change to model name parsing in CLI to support ability to have merged models with the "+" character in their names. * improve inpainting experience - recommend ckpt version of inpainting-1.5 to user - fix get_noise() bug in ckpt version of omnibus.py * update environment*yml * tweak instructions to install HuggingFace token * bump version number * enhance update scripts - update scripts will now fetch new INITIAL_MODELS.yaml so that configure_invokeai.py will know about the diffusers versions. * enhance invoke.sh/invoke.bat launchers - added configure_invokeai.py to menu - menu defaults to browser-based invoke * remove conda workflow (#2321) * fix `token_ids has shape torch.Size([79]) - expected [77]` * update CHANGELOG.md with 2.3.* info - Add information on how formats have changed and the upgrade process. - Add short bug list. Co-authored-by: Damian Stewart <d@damianstewart.com> Co-authored-by: Damian Stewart <null@damianstewart.com> Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> Co-authored-by: Wybartel-luxmc <37852506+Wybartel-luxmc@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> Co-authored-by: mickr777 <115216705+mickr777@users.noreply.github.com> Co-authored-by: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Co-authored-by: Eugene Brodsky <ebr@users.noreply.github.com> Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com>
2023-01-15 14:22:46 +00:00
self._set_sampler() # requires self.model_name to be set first
Refactoring simplet2i (#387) * start refactoring -not yet functional * first phase of refactor done - not sure weighted prompts working * Second phase of refactoring. Everything mostly working. * The refactoring has moved all the hard-core inference work into ldm.dream.generator.*, where there are submodules for txt2img and img2img. inpaint will go in there as well. * Some additional refactoring will be done soon, but relatively minor work. * fix -save_orig flag to actually work * add @neonsecret attention.py memory optimization * remove unneeded imports * move token logging into conditioning.py * add placeholder version of inpaint; porting in progress * fix crash in img2img * inpainting working; not tested on variations * fix crashes in img2img * ported attention.py memory optimization #117 from basujindal branch * added @torch_no_grad() decorators to img2img, txt2img, inpaint closures * Final commit prior to PR against development * fixup crash when generating intermediate images in web UI * rename ldm.simplet2i to ldm.generate * add backward-compatibility simplet2i shell with deprecation warning * add back in mps exception, addresses @vargol comment in #354 * replaced Conditioning class with exported functions * fix wrong type of with_variations attribute during intialization * changed "image_iterator()" to "get_make_image()" * raise NotImplementedError for calling get_make_image() in parent class * Update ldm/generate.py better error message Co-authored-by: Kevin Gibbons <bakkot@gmail.com> * minor stylistic fixes and assertion checks from code review * moved get_noise() method into img2img class * break get_noise() into two methods, one for txt2img and the other for img2img * inpainting works on non-square images now * make get_noise() an abstract method in base class * much improved inpainting Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
2022-09-06 00:40:10 +00:00
return self.model
use 🧨diffusers model (#1583) * initial commit of DiffusionPipeline class * spike: proof of concept using diffusers for txt2img * doc: type hints for Generator * refactor(model_cache): factor out load_ckpt * model_cache: add ability to load a diffusers model pipeline and update associated things in Generate & Generator to not instantly fail when that happens * model_cache: fix model default image dimensions * txt2img: support switching diffusers schedulers * diffusers: let the scheduler do its scaling of the initial latents Remove IPNDM scheduler; it is not behaving. * web server: update image_progress callback for diffusers data * diffusers: restore prompt weighting feature * diffusers: fix set-sampler error following model switch * diffusers: use InvokeAIDiffuserComponent for conditioning * cross_attention_control: stub (no-op) implementations for diffusers * model_cache: let offload_model work with DiffusionPipeline, sorta. * models.yaml.example: add diffusers-format model, set as default * test-invoke-conda: use diffusers-format model test-invoke-conda: put huggingface-token where the library can use it * environment-mac: upgrade to diffusers 0.7 (from 0.6) this was already done for linux; mac must have been lost in the merge. * preload_models: explicitly load diffusers models In non-interactive mode too, as long as you're logged in. * fix(model_cache): don't check `model.config` in diffusers format clean-up from recent merge. * diffusers integration: support img2img * dev: upgrade to diffusers 0.8 (from 0.7.1) We get to remove some code by using methods that were factored out in the base class. * refactor: remove backported img2img.get_timesteps now that we can use it directly from diffusers 0.8.1 * ci: use diffusers model * dev: upgrade to diffusers 0.9 (from 0.8.1) * lint: correct annotations for Python 3.9. * lint: correct AttributeError.name reference for Python 3.9. * CI: prefer diffusers-1.4 because it no longer requires a token The RunwayML models still do. * build: there's yet another place to update requirements? * configure: try to download models even without token Models in the CompVis and stabilityai repos no longer require them. (But runwayml still does.) * configure: add troubleshooting info for config-not-found * fix(configure): prepend root to config path * fix(configure): remove second `default: true` from models example * CI: simplify test-on-push logic now that we don't need secrets The "test on push but only in forks" logic was only necessary when tests didn't work for PRs-from-forks. * create an embedding_manager for diffusers * internal: avoid importing diffusers DummyObject see https://github.com/huggingface/diffusers/issues/1479 * fix "config attributes…not expected" diffusers warnings. * fix deprecated scheduler construction * work around an apparent MPS torch bug that causes conditioning to have no effect * 🚧 post-rebase repair * preliminary support for outpainting (no masking yet) * monkey-patch diffusers.attention and use Invoke lowvram code * add always_use_cpu arg to bypass MPS * add cross-attention control support to diffusers (fails on MPS) For unknown reasons MPS produces garbage output with .swap(). Use --always_use_cpu arg to invoke.py for now to test this code on MPS. * diffusers support for the inpainting model * fix debug_image to not crash with non-RGB images. * inpainting for the normal model [WIP] This seems to be performing well until the LAST STEP, at which point it dissolves to confetti. * fix off-by-one bug in cross-attention-control (#1774) prompt token sequences begin with a "beginning-of-sequence" marker <bos> and end with a repeated "end-of-sequence" marker <eos> - to make a default prompt length of <bos> + 75 prompt tokens + <eos>. the .swap() code was failing to take the column for <bos> at index 0 into account. the changes here do that, and also add extra handling for a single <eos> (which may be redundant but which is included for completeness). based on my understanding and some assumptions about how this all works, the reason .swap() nevertheless seemed to do the right thing, to some extent, is because over multiple steps the conditioning process in Stable Diffusion operates as a feedback loop. a change to token n-1 has flow-on effects to how the [1x4x64x64] latent tensor is modified by all the tokens after it, - and as the next step is processed, all the tokens before it as well. intuitively, a token's conditioning effects "echo" throughout the whole length of the prompt. so even though the token at n-1 was being edited when what the user actually wanted was to edit the token at n, it nevertheless still had some non-negligible effect, in roughly the right direction, often enough that it seemed like it was working properly. * refactor common CrossAttention stuff into a mixin so that the old ldm code can still work if necessary * inpainting for the normal model. I think it works this time. * diffusers: reset num_vectors_per_token sync with 44a00555718f1df173c60da0ed646cf700e29537 * diffusers: txt2img2img (hires_fix) with so much slicing and dicing of pipeline methods to stitch them together * refactor(diffusers): reduce some code duplication amongst the different tasks * fixup! refactor(diffusers): reduce some code duplication amongst the different tasks * diffusers: enable DPMSolver++ scheduler * diffusers: upgrade to diffusers 0.10, add Heun scheduler * diffusers(ModelCache): stopgap to make from_cpu compatible with diffusers * CI: default to diffusers-1.5 now that runwayml token requirement is gone * diffusers: update to 0.10 (and transformers to 4.25) * diffusers: use xformers when available diffusers no longer auto-enables this as of 0.10.2. * diffusers: make masked img2img behave better with multi-step schedulers re-randomizing the noise each step was confusing them. * diffusers: work more better with more models. fixed relative path problem with local models. fixed models on hub not always having a `fp16` branch. * diffusers: stopgap fix for attention_maps_callback crash after recent merge * fixup import merge conflicts correction for 061c5369a2247c6c92cd69606bcf54c4f1962a0b * test: add tests/inpainting inputs for masked img2img * diffusers(AddsMaskedGuidance): partial fix for k-schedulers Prevents them from crashing, but results are still hot garbage. * fix --safety_checker arg parsing and add note to diffusers loader about where safety checker gets called * generate: fix import error * CI: don't try to read the old init location * diffusers: support loading an alternate VAE * CI: remove sh-syntax if-statement so it doesn't crash powershell * CI: fold strings in yaml because backslash is not line-continuation in powershell * attention maps callback stuff for diffusers * build: fix syntax error in environment-mac * diffusers: add INITIAL_MODELS with diffusers-compatible repos * re-enable the embedding manager; closes #1778 * Squashed commit of the following: commit e4a956abc37fcb5cf188388b76b617bc5c8fda7d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:43:07 2022 +0100 import new load handling from EmbeddingManager and cleanup commit c4abe91a5ba0d415b45bf734068385668b7a66e6 Merge: 032e856e 1efc6397 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:09:53 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers_with_textual_inversion_manager commit 032e856eefb3bbc39534f5daafd25764bcfcef8b Merge: 8b4f0fe9 bc515e24 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:08:01 2022 +0100 Merge remote-tracking branch 'upstream/dev/diffusers' into dev/diffusers_with_textual_inversion_manager commit 1efc6397fc6e61c1aff4b0258b93089d61de5955 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:04:28 2022 +0100 cleanup and add performance notes commit e400f804ac471a0ca2ba432fd658778b20c7bdab Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:45:07 2022 +0100 fix bug and update unit tests commit deb9ae0ae1016750e93ce8275734061f7285a231 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:28:29 2022 +0100 textual inversion manager seems to work commit 162e02505dec777e91a983c4d0fb52e950d25ff0 Merge: cbad4583 12769b3d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:58:03 2022 +0100 Merge branch 'main' into feature_textual_inversion_mgr commit cbad45836c6aace6871a90f2621a953f49433131 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:54:10 2022 +0100 use position embeddings commit 070344c69b0e0db340a183857d0a787b348681d3 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:53:47 2022 +0100 Don't crash CLI on exceptions commit b035ac8c6772dfd9ba41b8eeb9103181cda028f8 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:11:55 2022 +0100 add missing position_embeddings commit 12769b3d3562ef71e0f54946b532ad077e10043c Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:33:25 2022 +0100 debugging why it don't work commit bafb7215eabe1515ca5e8388fd3bb2f3ac5362cf Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:21:33 2022 +0100 debugging why it don't work commit 664a6e9e146b42d96703f0cc8baf8f5efec04ee1 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit 8b4f0fe9d6e4e2643b36dfa27864294785d7ba4e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit ffbe1ab11163ba712e353d89404e301d0e0c6cdf Merge: 6e4dad60 023df37e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:37:31 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers commit 023df37efffa67434f77def7fc3c9dfb29f699fd Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:36:54 2022 +0100 cleanup commit 05fac594eaf79d0058e3c48deee93df603f136c2 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:07:49 2022 +0100 tweak error checking commit 009f32ed39a7280997c3ffab112adadee0b44279 Author: damian <null@damianstewart.com> Date: Thu Dec 15 21:29:47 2022 +0100 unit tests passing for embeddings with vector length >1 commit beb1b08d9a98112ed2fe073580568e1a18698da3 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:39:09 2022 +0100 more explicit equality tests when overwriting commit 44d8a5a7c85cdabc9ce3a54fd0769a10597b3ca9 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:30:13 2022 +0100 wip textual inversion manager (unit tests passing for 1v embedding overwriting) commit 417c2b57d90924a839616bfb66804faab8039e4c Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 12:30:55 2022 +0100 wip textual inversion manager (unit tests passing for base stuff + padding) commit 2e80872e3b6f7fd7d8eb8928822bd824b63cb2ff Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 10:57:57 2022 +0100 wip new TextualInversionManager * stop using WeightedFrozenCLIPEmbedder * store diffusion models locally - configure_invokeai.py reconfigured to store diffusion models rather than CompVis models - hugging face caching model is used, but cache is set to ~/invokeai/models/repo_id - models.yaml does **NOT** use path, just repo_id - "repo_name" changed to "repo_id" to following hugging face conventions - Models are loaded with full precision pending further work. * allow non-local files during development * path takes priority over repo_id * MVP for model_cache and configure_invokeai - Feature complete (almost) - configure_invokeai.py downloads both .ckpt and diffuser models, along with their VAEs. Both types of download are controlled by a unified INITIAL_MODELS.yaml file. - model_cache can load both type of model and switches back and forth in CPU. No memory leaks detected TO DO: 1. I have not yet turned on the LocalOnly flag for diffuser models, so the code will check the Hugging Face repo for updates before using the locally cached models. This will break firewalled systems. I am thinking of putting in a global check for internet connectivity at startup time and setting the LocalOnly flag based on this. It would be good to check updates if there is connectivity. 2. I have not gone completely through INITIAL_MODELS.yaml to check which models are available as diffusers and which are not. So models like PaperCut and VoxelArt may not load properly. The runway and stability models are checked, as well as the Trinart models. 3. Add stanzas for SD 2.0 and 2.1 in INITIAL_MODELS.yaml REMAINING PROBLEMS NOT DIRECTLY RELATED TO MODEL_CACHE: 1. When loading a .ckpt file there are lots of messages like this: Warning! ldm.modules.attention.CrossAttention is no longer being maintained. Please use InvokeAICrossAttention instead. I'm not sure how to address this. 2. The ckpt models ***don't actually run*** due to the lack of special-case support for them in the generator objects. For example, here's the hard crash you get when you run txt2img against the legacy waifu-diffusion-1.3 model: ``` >> An error occurred: Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 140, in main main_loop(gen, opt) File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 371, in main_loop gen.prompt2image( File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1265, in __getattr__ raise AttributeError("'{}' object has no attribute '{}'".format( AttributeError: 'LatentDiffusion' object has no attribute 'image_from_embeddings' ``` 3. The inpainting diffusion model isn't working. Here's the output of "banana sushi" when inpainting-1.5 is loaded: ``` Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 301, in image_from_embeddings result_latents, result_attention_map_saver = self.latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 330, in latents_from_embeddings result: PipelineIntermediateState = infer_latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 185, in __call__ for result in self.generator_method(*args, **kwargs): File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 367, in generate_latents_from_embeddings step_output = self.step(batched_t, latents, guidance_scale, File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context return func(*args, **kwargs) File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 409, in step step_output = self.scheduler.step(noise_pred, timestep, latents, **extra_step_kwargs) File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/diffusers/schedulers/scheduling_lms_discrete.py", line 223, in step pred_original_sample = sample - sigma * model_output RuntimeError: The size of tensor a (9) must match the size of tensor b (4) at non-singleton dimension 1 ``` * proper support for float32/float16 - configure script now correctly detects user's preference for fp16/32 and downloads the correct diffuser version. If fp16 version not available, falls back to fp32 version. - misc code cleanup and simplification in model_cache * add on-the-fly conversion of .ckpt to diffusers models 1. On-the-fly conversion code can be found in the file ldm/invoke/ckpt_to_diffusers.py. 2. A new !optimize command has been added to the CLI. Should be ported to Web GUI. User experience on the CLI is this: ``` invoke> !optimize /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt INFO: Converting legacy weights file /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt to optimized diffuser model. This operation will take 30-60s to complete. Success. Optimized model is now located at /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 Writing new config file entry for sd-v1-4... >> New configuration: sd-v1-4: description: Optimized version of sd-v1-4 format: diffusers path: /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 OK to import [n]? y >> Verifying that new model loads... >> Current VRAM usage: 2.60G >> Offloading stable-diffusion-2.1 to CPU >> Loading diffusers model from /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 | Using faster float16 precision You have disabled the safety checker for <class 'ldm.invoke.generator.diffusers_pipeline.StableDiffusionGeneratorPipeline'> by passing `safety_checker=None`. Ensure that you abide to the conditions of the Stable Diffusion \ license and do not expose unfiltered results in services or applications open to the public. Both the diffusers team and Hugging Face strongly recommend to keep the safety filter enabled in all public facing circumstances,\ disabling it only for use-cases that involve analyzing network behavior or auditing its results. For more information, please have a look at https://github.com/huggingface/diffusers/pull/254 . | training width x height = (512 x 512) >> Model loaded in 3.48s >> Max VRAM used to load the model: 2.17G >> Current VRAM usage:2.17G >> Textual inversions available: >> Setting Sampler to k_lms (LMSDiscreteScheduler) Keep model loaded? [y] ``` * add parallel set of generator files for ckpt legacy generation * generation using legacy ckpt models now working * diffusers: fix missing attention_maps_callback fix for 23eb80b40421b2bb8f4b6d3dd30490d11c447b36 * associate legacy CrossAttention with .ckpt models * enable autoconvert New --autoconvert CLI option will scan a designated directory for new .ckpt files, convert them into diffuser models, and import them into models.yaml. Works like this: invoke.py --autoconvert /path/to/weights/directory In ModelCache added two new methods: autoconvert_weights(config_path, weights_directory_path, models_directory_path) convert_and_import(ckpt_path, diffuser_path) * diffusers: update to diffusers 0.11 (from 0.10.2) * fix vae loading & width/height calculation * refactor: encapsulate these conditioning data into one container * diffusers: fix some noise-scaling issues by pushing the noise-mixing down to the common function * add support for safetensors and accelerate * set local_files_only when internet unreachable * diffusers: fix error-handling path when model repo has no fp16 branch * fix generatorinpaint error Fixes : "ModuleNotFoundError: No module named 'ldm.invoke.generatorinpaint' https://github.com/invoke-ai/InvokeAI/pull/1583#issuecomment-1363634318 * quench diffuser safety-checker warning * diffusers: support stochastic DDIM eta parameter * fix conda env creation on macos * fix cross-attention with diffusers 0.11 * diffusers: the VAE needs to be tiling as well as the U-Net * diffusers: comment on subfolders * diffusers: embiggen! * diffusers: make model_cache.list_models serializable * diffusers(inpaint): restore scaling functionality * fix requirements clash between numba and numpy 1.24 * diffusers: allow inpainting model to do non-inpainting tasks * start expanding model_cache functionality * add import_ckpt_model() and import_diffuser_model() methods to model_manager - in addition, model_cache.py is now renamed to model_manager.py * allow "recommended" flag to be optional in INITIAL_MODELS.yaml * configure_invokeai now downloads VAE diffusers in advance * rename ModelCache to ModelManager * remove support for `repo_name` in models.yaml * check for and refuse to load embeddings trained on incompatible models * models.yaml.example: s/repo_name/repo_id and remove extra INITIAL_MODELS now that the main one has diffusers models in it. * add MVP textual inversion script * refactor(InvokeAIDiffuserComponent): factor out _combine() * InvokeAIDiffuserComponent: implement threshold * InvokeAIDiffuserComponent: diagnostic logs for threshold ...this does not look right * add a curses-based frontend to textual inversion - not quite working yet - requires npyscreen installed - on windows will also have the windows-curses requirement, but not added to requirements yet * add curses-based interface for textual inversion * fix crash in convert_and_import() - This corrects a "local variable referenced before assignment" error in model_manager.convert_and_import() * potential workaround for no 'state_dict' key error - As reported in https://github.com/huggingface/diffusers/issues/1876 * create TI output dir if needed * Update environment-lin-cuda.yml (#2159) Fixing line 42 to be the proper order to define the transformers requirement: ~= instead of =~ * diffusers: update sampler-to-scheduler mapping based on https://github.com/huggingface/diffusers/issues/277#issuecomment-1371428672 * improve user exp for ckt to diffusers conversion - !optimize_models command now operates on an existing ckpt file entry in models.yaml - replaces existing entry, rather than adding a new one - offers to delete the ckpt file after conversion * web: adapt progress callback to deal with old generator or new diffusers pipeline * clean-up model_manager code - add_model() verified to work for .ckpt local paths, .ckpt remote URLs, diffusers local paths, and diffusers repo_ids - convert_and_import() verified to work for local and remove .ckpt files * handle edge cases for import_model() and convert_model() * add support for safetensor .ckpt files * fix name error * code cleanup with pyflake * improve model setting behavior - If the user enters an invalid model name at startup time, will not try to load it, warn, and use default model - CLI UI enhancement: include currently active model in the command line prompt. * update test-invoke-pip.yml - fix model cache path to point to runwayml/stable-diffusion-v1-5 - remove `skip-sd-weights` from configure_invokeai.py args * exclude dev/diffusers from "fail for draft PRs" * disable "fail on PR jobs" * re-add `--skip-sd-weights` since no space * update workflow environments - include `INVOKE_MODEL_RECONFIGURE: '--yes'` * clean up model load failure handling - Allow CLI to run even when no model is defined or loadable. - Inhibit stack trace when model load fails - only show last error - Give user *option* to run configure_invokeai.py when no models successfully load. - Restart invokeai after reconfiguration. * further edge-case handling 1) only one model in models.yaml file, and that model is broken 2) no models in models.yaml 3) models.yaml doesn't exist at all * fix incorrect model status listing - "cached" was not being returned from list_models() - normalize handling of exceptions during model loading: - Passing an invalid model name to generate.set_model() will return a KeyError - All other exceptions are returned as the appropriate Exception * CI: do download weights (if not already cached) * diffusers: fix scheduler loading in offline mode * CI: fix model name (no longer has `diffusers-` prefix) * Update txt2img2img.py (#2256) * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * feat - make model storage compatible with hugging face caching system This commit alters the InvokeAI model directory to be compatible with hugging face, making it easier to share diffusers (and other models) across different programs. - If the HF_HOME environment variable is not set, then models are cached in ~/invokeai/models in a format that is identical to the HuggingFace cache. - If HF_HOME is set, then models are cached wherever HF_HOME points. - To enable sharing with other HuggingFace library clients, set HF_HOME to ~/.cache/huggingface to set the default cache location or to ~/invokeai/models to have huggingface cache inside InvokeAI. * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * fix error "no attribute CkptInpaint" * model_manager.list_models() returns entire model config stanza+status * Initial Draft - Model Manager Diffusers * added hash function to diffusers * implement sha256 hashes on diffusers models * Add Model Manager Support for Diffusers * fix various problems with model manager - in cli import functions, fix not enough values to unpack from _get_name_and_desc() - fix crash when using old-style vae: value with new-style diffuser * rebuild frontend * fix dictconfig-not-serializable issue * fix NoneType' object is not subscriptable crash in model_manager * fix "str has no attribute get" error in model_manager list_models() * Add path and repo_id support for Diffusers Model Manager Also fixes bugs * Fix tooltip IT localization not working * Add Version Number To WebUI * Optimize Model Search * Fix incorrect font on the Model Manager UI * Fix image degradation on merge fixes - [Experimental] This change should effectively fix a couple of things. - Fix image degradation on subsequent merges of the canvas layers. - Fix the slight transparent border that is left behind when filling the bounding box with a color. - Fix the left over line of color when filling a bounding box with color. So far there are no side effects for this. If any, please report. * Add local model filtering for Diffusers / Checkpoints * Go to home on modal close for the Add Modal UI * Styling Fixes * Model Manager Diffusers Localization Update * Add Safe Tensor scanning to Model Manager * Fix model edit form dispatching string values instead of numbers. * Resolve VAE handling / edge cases for supplied repos * defer injecting tokens for textual inversions until they're used for the first time * squash a console warning * implement model migration check * add_model() overwrites previous config rather than merges * fix model config file attribute merging * fix precision handling in textual inversion script * allow ckpt conversion script to work with safetensors .ckpts Applied patch here: https://github.com/huggingface/diffusers/commit/beb932c5d111872c5e45387e7b1b2b3dd0524a47 * fix name "args" is not defined crash in textual_inversion_training * fix a second NameError: name 'args' is not defined crash * fix loading of the safety checker from the global cache dir * add installation step to textual inversion frontend - After a successful training run, the script will copy learned_embeds.bin to a subfolder of the embeddings directory. - User given the option to delete the logs and intermediate checkpoints (which together use 7-8G of space) - If textual inversion training fails, reports the error gracefully. * don't crash out on incompatible embeddings - put try: blocks around places where the system tries to load an embedding which is incompatible with the currently loaded model * add support for checkpoint resuming * textual inversion preferences are saved and restored between sessions - Preferences are stored in a file named text-inversion-training/preferences.conf - Currently the resume-from-checkpoint option is not working correctly. Possible bug in textual_inversion_training.py? * copy learned_embeddings.bin into right location * add front end for diffusers model merging - Front end doesn't do anything yet!!!! - Made change to model name parsing in CLI to support ability to have merged models with the "+" character in their names. * improve inpainting experience - recommend ckpt version of inpainting-1.5 to user - fix get_noise() bug in ckpt version of omnibus.py * update environment*yml * tweak instructions to install HuggingFace token * bump version number * enhance update scripts - update scripts will now fetch new INITIAL_MODELS.yaml so that configure_invokeai.py will know about the diffusers versions. * enhance invoke.sh/invoke.bat launchers - added configure_invokeai.py to menu - menu defaults to browser-based invoke * remove conda workflow (#2321) * fix `token_ids has shape torch.Size([79]) - expected [77]` * update CHANGELOG.md with 2.3.* info - Add information on how formats have changed and the upgrade process. - Add short bug list. Co-authored-by: Damian Stewart <d@damianstewart.com> Co-authored-by: Damian Stewart <null@damianstewart.com> Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> Co-authored-by: Wybartel-luxmc <37852506+Wybartel-luxmc@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> Co-authored-by: mickr777 <115216705+mickr777@users.noreply.github.com> Co-authored-by: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Co-authored-by: Eugene Brodsky <ebr@users.noreply.github.com> Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com>
2023-01-15 14:22:46 +00:00
def load_huggingface_concepts(self, concepts:list[str]):
self.model.textual_inversion_manager.load_huggingface_concepts(concepts)
Merge dev into main for 2.2.0 (#1642) * Fixes inpainting + code cleanup * Disable stage info in Inpainting Tab * Mask Brush Preview now always at 0.5 opacity The new mask is only visible properly at max opacity but at max opacity the brush preview becomes fully opaque blocking the view. So the mask brush preview no remains at 0.5 no matter what the Brush opacity is. * Remove save button from Canvas Controls (cleanup) * Implements invert mask * Changes "Invert Mask" to "Preserve Masked Areas" * Fixes (?) spacebar issues * Patches redux-persist and redux-deep-persist with debounced persists Our app changes redux state very, very often. As our undo/redo history grows, the calls to persist state start to take in the 100ms range, due to a the deep cloning of the history. This causes very noticeable performance lag. The deep cloning is required because we need to blacklist certain items in redux from being persisted (e.g. the app's connection status). Debouncing the whole process of persistence is a simple and effective solution. Unfortunately, `redux-persist` dropped `debounce` between v4 and v5, replacing it with `throttle`. `throttle`, instead of delaying the expensive action until a period of X ms of inactivity, simply ensures the action is executed at least every X ms. Of course, this does not fix our performance issue. The patch is very simple. It adds a `debounce` argument - a number of milliseconds - and debounces `redux-persist`'s `update()` method (provided by `createPersistoid`) by that many ms. Before this, I also tried writing a custom storage adapter for `redux-persist` to debounce the calls to `localStorage.setItem()`. While this worked and was far less invasive, it doesn't actually address the issue. It turns out `setItem()` is a very fast part of the process. We use `redux-deep-persist` to simplify the `redux-persist` configuration, which can get complicated when you need to blacklist or whitelist deeply nested state. There is also a patch here for that library because it uses the same types as `redux-persist`. Unfortunately, the last release of `redux-persist` used a package `flat-stream` which was malicious and has been removed from npm. The latest commits to `redux-persist` (about 1 year ago) do not build; we cannot use the master branch. And between the last release and last commit, the changes have all been breaking. Patching this last release (about 3 years old at this point) directly is far simpler than attempting to fix the upstream library's master branch or figuring out an alternative to the malicious and now non-existent dependency. * Adds debouncing * Fixes AttributeError: 'dict' object has no attribute 'invert_mask' * Updates package.json to use redux-persist patches * Attempts to fix redux-persist debounce patch * Fixes undo/redo * Fixes invert mask * Debounce > 300ms * Limits history to 256 for each of undo and redo * Canvas styling * Hotkeys improvement * Add Metadata To Viewer * Increases CFG Scale max to 200 * Fix gallery width size for Outpainting Also fixes the canvas resizing failing n fast pushes * Fixes disappearing canvas grid lines * Adds staging area * Fixes "use all" not setting variationAmount Now sets to 0 when the image had variations. * Builds fresh bundle * Outpainting tab loads to empty canvas instead of upload * Fixes wonky canvas layer ordering & compositing * Fixes error on inpainting paste back `TypeError: 'float' object cannot be interpreted as an integer` * Hides staging area outline on mouseover prev/next * Fixes inpainting not doing img2img when no mask * Fixes bbox not resizing in outpainting if partially off screen * Fixes crashes during iterative outpaint. Still doesn't work correctly though. * Fix iterative outpainting by restoring original images * Moves image uploading to HTTP - It all seems to work fine - A lot of cleanup is still needed - Logging needs to be added - May need types to be reviewed * Fixes: outpainting temp images show in gallery * WIP refactor to unified canvas * Removes console.log from redux-persist patch * Initial unification of canvas * Removes all references to split inpainting/outpainting canvas * Add patchmatch and infill_method parameter to prompt2image (options are 'patchmatch' or 'tile'). * Fixes app after removing in/out-painting refs * Rebases on dev, updates new env files w/ patchmatch * Organises features/canvas * Fixes bounding box ending up offscreen * Organises features/canvas * Stops unnecessary canvas rescales on gallery state change * Fixes 2px layout shift on toggle canvas lock * Clips lines drawn while canvas locked When drawing with the locked canvas, if a brush stroke gets too close to the edge of the canvas and its stroke would extend past the edge of the canvas, the edge of that stroke will be seen after unlocking the canvas. This could cause a problem if you unlock the canvas and now have a bunch of strokes just outside the init image area, which are far back in undo history and you cannot easily erase. With this change, lines drawn while the canvas is locked get clipped to the initial image bbox, fixing this issue. Additionally, the merge and save to gallery functions have been updated to respect the initial image bbox so they function how you'd expect. * Fixes reset canvas view when locked * Fixes send to buttons * Fixes bounding box not being rounded to 64 * Abandons "inpainting" canvas lock * Fixes save to gallery including empty area, adds download and copy image * Fix Current Image display background going over image bounds * Sets status immediately when clicking Invoke * Adds hotkeys and refactors sharing of konva instances Adds hotkeys to canvas. As part of this change, the access to konva instance objects was refactored: Previously closure'd refs were used to indirectly get access to the konva instances outside of react components. Now, a getter and setter function are used to provide access directly to the konva objects. * Updates hotkeys * Fixes canvas showing spinner on first load Also adds good default canvas scale and positioning when no image is on it * Fixes possible hang on MaskCompositer * Improves behaviour when setting init canvas image/reset view * Resets bounding box coords/dims when no image present * Disables canvas actions which cannot be done during processing * Adds useToastWatcher hook - Dispatch an `addToast` action with standard Chakra toast options object to add a toast to the toastQueue - The hook is called in App.tsx and just useEffect's w/ toastQueue as dependency to create the toasts - So now you can add toasts anywhere you have access to `dispatch`, which includes middleware and thunks - Adds first usage of this for the save image buttons in canvas * Update Hotkey Info Add missing tooltip hotkeys and update the hotkeys modal to reflect the new hotkeys for the Unified Canvas. * Fix theme changer not displaying current theme on page refresh * Fix tab count in hotkeys panel * Unify Brush and Eraser Sizes * Fix staging area display toggle not working * Staging Area delete button is now red So it doesnt feel blended into to the rest of them. * Revert "Fix theme changer not displaying current theme on page refresh" This reverts commit 903edfb803e743500242589ff093a8a8a0912726. * Add arguments to use SSL to webserver * Integrates #1487 - touch events Need to add: - Pinch zoom - Touch-specific handling (some things aren't quite right) * Refactors upload-related async thunks - Now standard thunks instead of RTK createAsyncThunk() - Adds toasts for all canvas upload-related actions * Reorganises app file structure * Fixes Canvas Auto Save to Gallery * Fixes staging area outline * Adds staging area hotkeys, disables gallery left/right when staging * Fixes Use All Parameters * Fix metadata viewer image url length when viewing intermediate * Fixes intermediate images being tiny in txt2img/img2img * Removes stale code * Improves canvas status text and adds option to toggle debug info * Fixes paste image to upload * Adds model drop-down to site header * Adds theme changer popover * Fix missing key on ThemeChanger map * Fixes stage position changing on zoom * Hotkey Cleanup - Viewer is now Z - Canvas Move tool is V - sync with PS - Removed some unused hotkeys * Fix canvas resizing when both options and gallery are unpinned * Implements thumbnails for gallery - Thumbnails are saved whenever an image is saved, and when gallery requests images from server - Thumbnails saved at original image aspect ratio with width of 128px as WEBP - If the thumbnail property of an image is unavailable for whatever reason, the image's full size URL is used instead * Saves thumbnails to separate thumbnails directory * Thumbnail size = 256px * Fix Lightbox Issues * Disables canvas image saving functions when processing * Fix index error on going past last image in Gallery * WIP - Lightbox Fixes Still need to fix the images not being centered on load when the image res changes * Fixes another similar index error, simplifies logic * Reworks canvas toolbar * Fixes canvas toolbar upload button * Cleans up IAICanvasStatusText * Improves metadata handling, fixes #1450 - Removes model list from metadata - Adds generation's specific model to metadata - Displays full metadata in JSON viewer * Gracefully handles corrupted images; fixes #1486 - App does not crash if corrupted image loaded - Error is displayed in the UI console and CLI output if an image cannot be loaded * Adds hotkey to reset canvas interaction state If the canvas' interaction state (e.g. isMovingBoundingBox, isDrawing, etc) get stuck somehow, user can press Escape to reset the state. * Removes stray console.log() * Fixes bug causing gallery to close on context menu open * Minor bugfixes - When doing long-running canvas image exporting actions, display indeterminate progress bar - Fix staging area image outline not displaying after committing/discarding results * Removes unused imports * Fixes repo root .gitignore ignoring frontend things * Builds fresh bundle * Styling updates * Removes reasonsWhyNotReady The popover doesn't play well with the button being disabled, and I don't think adds any value. * Image gallery resize/style tweaks * Styles buttons for clearing canvas history and mask * First pass on Canvas options panel * Fixes bug where discarding staged images results in loss of history * Adds Save to Gallery button to staging toolbar * Rearrange some canvas toolbar icons Put brush stuff together and canvas movement stuff together * Fix gallery maxwidth on unified canvas * Update Layer hotkey display to UI * Adds option to crop to bounding box on save * Masking option tweaks * Crop to Bounding Box > Save Box Region Only * Adds clear temp folder * Updates mask options popover behavior * Builds fresh bundle * Fix styling on alert modals * Fix input checkbox styling being incorrect on light theme * Styling fixes * Improves gallery resize behaviour * Cap gallery size on canvas tab so it doesnt overflow * Fixes bug when postprocessing image with no metadata * Adds IAIAlertDialog component * Moves Loopback to app settings * Fixes metadata viewer not showing metadata after refresh Also adds Dream-style prompt to metadata * Adds outpainting specific options * Linting * Fixes gallery width on lightbox, fixes gallery button expansion * Builds fresh bundle * Fix Lightbox images of different res not centering * Update feature tooltip text * Highlight mask icon when on mask layer * Fix gallery not resizing correctly on open and close * Add loopback to just img2img. Remove from settings. * Fix to gallery resizing * Removes Advanced checkbox, cleans up options panel for unified canvas * Minor styling fixes to new options panel layout * Styling Updates * Adds infill method * Tab Styling Fixes * memoize outpainting options * Fix unnecessary gallery re-renders * Isolate Cursor Pos debug text on canvas to prevent rerenders * Fixes missing postprocessed image metadata before refresh * Builds fresh bundle * Fix rerenders on model select * Floating panel re-render fix * Simplify fullscreen hotkey selector * Add Training WIP Tab * Adds Training icon * Move full screen hotkey to floating to prevent tab rerenders * Adds single-column gallery layout * Fixes crash on cancel with intermediates enabled, fixes #1416 * Updates npm dependencies * Fixes img2img attempting inpaint when init image has transparency * Fixes missing threshold and perlin parameters in metadata viewer * Renames "Threshold" > "Noise Threshold" * Fixes postprocessing not being disabled when clicking use all * Builds fresh bundle * Adds color picker * Lints & builds fresh bundle * Fixes iterations being disabled when seed random & variations are off * Un-floors cursor position * Changes color picker preview to circles * Fixes variation params not set correctly when recalled * Fixes invoke hotkey not working in input fields * Simplifies Accordion Prep for adding reset buttons for each section * Fixes mask brush preview color * Committing color picker color changes tool to brush * Color picker does not overwrite user-selected alpha * Adds brush color alpha hotkey * Lints * Removes force_outpaint param * Add inpaint size options to inpaint at a larger size than the actual inpaint image, then scale back down for recombination * Bug fix for inpaint size * Adds inpaint size (as scale bounding box) to UI * Adds auto-scaling for inpaint size * Improves scaled bbox display logic * Fixes bug with clear mask and history * Fixes shouldShowStagingImage not resetting to true on commit * Builds fresh bundle * Fixes canvas failing to scale on first run * Builds fresh bundle * Fixes unnecessary canvas scaling * Adds gallery drag and drop to img2img/canvas * Builds fresh bundle * Fix desktop mode being broken with new versions of flaskwebgui * Fixes canvas dimensions not setting on first load * Builds fresh bundle * stop crash on !import_models call on model inside rootdir - addresses bug report #1546 * prevent "!switch state gets confused if model switching fails" - If !switch were to fail on a particular model, then generate got confused and wouldn't try again until you switch to a different working model and back again. - This commit fixes and closes #1547 * Revert "make the docstring more readable and improve the list_models logic" This reverts commit 248068fe5d57b5639ea7a87ee6cbf023104d957d. * fix model cache path * also set fail-fast to it's default (true) in this way the whole action fails if one job fails this should unblock the runners!!! * fix output path for Archive results * disable checks for python 3.9 * Update-requirements and test-invoke-pip workflow (#1574) * update requirements files * update test-invoke-pip workflow * move requirements-mkdocs.txt to docs folder (#1575) * move requirements-mkdocs.txt to docs folder * update copyright * Fixes outpainting with resized inpaint size * Interactive configuration (#1517) * Update scripts/configure_invokeai.py prevent crash if output exists Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> * implement changes requested by reviews * default to correct root and output directory on Windows systems - Previously the script was relying on the readline buffer editing feature to set up the correct default. But this feature doesn't exist on windows. - This commit detects when user typed return with an empty directory value and replaces with the default directory. * improved readability of directory choices * Update scripts/configure_invokeai.py Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> * better error reporting at startup - If user tries to run the script outside of the repo or runtime directory, a more informative message will appear explaining the problem. Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> * Embedding merging (#1526) * add whole <style token> to vocab for concept library embeddings * add ability to load multiple concept .bin files * make --log_tokenization respect custom tokens * start working on concept downloading system * preliminary support for dynamic loading and merging of multiple embedded models - The embedding_manager is now enhanced with ldm.invoke.concepts_lib, which handles dynamic downloading and caching of embedded models from the Hugging Face concepts library (https://huggingface.co/sd-concepts-library) - Downloading of a embedded model is triggered by the presence of one or more <concept> tags in the prompt. - Once the embedded model is downloaded, its trigger phrase will be loaded into the embedding manager and the prompt's <concept> tag will be replaced with the <trigger_phrase> - The downloaded model stays on disk for fast loading later. - The CLI autocomplete will complete partial <concept> tags for you. Type a '<' and hit tab to get all ~700 concepts. BUGS AND LIMITATIONS: - MODEL NAME VS TRIGGER PHRASE You must use the name of the concept embed model from the SD library, and not the trigger phrase itself. Usually these are the same, but not always. For example, the model named "hoi4-leaders" corresponds to the trigger "<HOI4-Leader>" One reason for this design choice is that there is no apparent constraint on the uniqueness of the trigger phrases and one trigger phrase may map onto multiple models. So we use the model name instead. The second reason is that there is no way I know of to search Hugging Face for models with certain trigger phrases. So we'd have to download all 700 models to index the phrases. The problem this presents is that this may confuse users, who will want to reuse prompts from distributions that use the trigger phrase directly. Usually this will work, but not always. - WON'T WORK ON A FIREWALLED SYSTEM If the host running IAI has no internet connection, it can't download the concept libraries. I will add a script that allows users to preload a list of concept models. - BUG IN PROMPT REPLACEMENT WHEN MODEL NOT FOUND There's a small bug that occurs when the user provides an invalid model name. The <concept> gets replaced with <None> in the prompt. * fix loading .pt embeddings; allow multi-vector embeddings; warn on dupes * simplify replacement logic and remove cuda assumption * download list of concepts from hugging face * remove misleading customization of '*' placeholder the existing code as-is did not do anything; unclear what it was supposed to do. the obvious alternative -- setting using 'placeholder_strings' instead of 'placeholder_tokens' to match model.params.personalization_config.params.placeholder_strings -- caused a crash. i think this is because the passed string also needed to be handed over on init of the PersonalizedBase as the 'placeholder_token' argument. this is weird config dict magic and i don't want to touch it. put a breakpoint in personalzied.py line 116 (top of PersonalizedBase.__init__) if you want to have a crack at it yourself. * address all the issues raised by damian0815 in review of PR #1526 * actually resize the token_embeddings * multiple improvements to the concept loader based on code reviews 1. Activated the --embedding_directory option (alias --embedding_path) to load a single embedding or an entire directory of embeddings at startup time. 2. Can turn off automatic loading of embeddings using --no-embeddings. 3. Embedding checkpoints are scanned with the pickle scanner. 4. More informative error messages when a concept can't be loaded due either to a 404 not found error or a network error. * autocomplete terms end with ">" now * fix startup error and network unreachable 1. If the .invokeai file does not contain the --root and --outdir options, invoke.py will now fix it. 2. Catch and handle network problems when downloading hugging face textual inversion concepts. * fix misformatted error string Co-authored-by: Damian Stewart <d@damianstewart.com> * model_cache.py: fix list_models Signed-off-by: devops117 <55235206+devops117@users.noreply.github.com> * add statement of values (#1584) * this adds the Statement of Values Google doc source = https://docs.google.com/document/d/1-PrUKDJcxy8OyNGc8CyiHhv2VgLvjt7LRGlEpbg1nmQ/edit?usp=sharing * Fix heading * Update InvokeAI_Statement_of_Values.md * Update InvokeAI_Statement_of_Values.md * Update InvokeAI_Statement_of_Values.md * Update InvokeAI_Statement_of_Values.md * Update InvokeAI_Statement_of_Values.md * add keturn and mauwii to the team member list * Fix punctuation * this adds the Statement of Values Google doc source = https://docs.google.com/document/d/1-PrUKDJcxy8OyNGc8CyiHhv2VgLvjt7LRGlEpbg1nmQ/edit?usp=sharing * add keturn and mauwii to the team member list * fix formating - make sub bullets use * (decide to all use - or *) - indent sub bullets Sorry, first only looked at the code version and found this only after looking at the markdown rendered version * use multiparagraph numbered sections * Break up Statement Of Values as per comments on #1584 * remove duplicated word, reduce vagueness it's important not to overstate how many artists we are consulting. * fix typo (sorry blessedcoolant) Co-authored-by: mauwii <Mauwii@outlook.de> Co-authored-by: damian <git@damianstewart.com> * update dockerfile (#1551) * update dockerfile * remove not existing file from .dockerignore * remove bloat and unecesary step also use --no-cache-dir for pip install image is now close to 2GB * make Dockerfile a variable * set base image to `ubuntu:22.10` * add build-essential * link outputs folder for persistence * update tag variable * update docs * fix not customizeable build args, add reqs output * !model_import autocompletes in ROOTDIR * Adds psychedelicious to statement of values signature (#1602) * add a --no-patchmatch option to disable patchmatch loading (#1598) This feature was added to prevent the CI Macintosh tests from erroring out when patchmatch is unable to retrieve its shared library from github assets. * Fix #1599 by relaxing the `match_trigger` regex (#1601) * Fix #1599 by relaxing the `match_trigger` regex Also simplify logic and reduce duplication. * restrict trigger regex again (but not so far) * make concepts library work with Web UI This PR makes it possible to include a Hugging Face concepts library <style-or-subject-trigger> in the WebUI prompt. The metadata seems to be correctly handled. * documentation enhancements (#1603) - Add documentation for the Hugging Face concepts library and TI embedding. - Fixup index.md to point to each of the feature documentation files, including ones that are pending. * tweak setup and environment files for linux & pypatchmatch (#1580) * tweak setup and environment files for linux & pypatchmatch - Downgrade python requirements to 3.9 because 3.10 is not supported on Ubuntu 20.04 LTS (widely-used distro) - Use our github pypatchmatch 0.1.3 in order to install Makefile where it needs to be. - Restored "-e ." as the last install step on pip installs. Hopefully this will not trigger the high-CPU hang we've previously experienced. * keep windows on basicsr 1.4.1 * keep windows on basicsr 1.4.1 * bump pypatchmatch requirement to 0.1.4 - This brings in a version of pypatchmatch that will gracefully handle internet connection not available at startup time. - Also refactors and simplifies the handling of gfpgan's basicsr requirement across various platforms. * revert to older version of list_models() (#1611) This restores the correct behavior of list_models() and quenches the bug of list_models() returning a single model entry named "name". I have not investigated what was wrong with the new version, but I think it may have to do with changes to the behavior in dict.update() * Fixes for #1604 (#1605) * Converts ESRGAN image input to RGB - Also adds typing for image input. - Partially resolves #1604 * ensure there are unmasked pixels before color matching Co-authored-by: Kyle Schouviller <kyle0654@hotmail.com> * update index.md (#1609) - comment out non existing link - fix indention - add seperator between feature categories * Debloat-docker (#1612) * debloat Dockerfile - less options more but more userfriendly - better Entrypoint to simulate CLI usage - without command the container still starts the web-host * debloat build.sh * better syntax in run.sh * update Docker docs - fix description of VOLUMENAME - update run script example to reflect new entrypoint * Test installer (#1618) * test linux install * try removing http from parsed requirements * pip install confirmed working on linux * ready for linux testing - rebuilt py3.10-linux-x86_64-cuda-reqs.txt to include pypatchmatch dependency. - point install.sh and install.bat to test-installer branch. * Updates MPS reqs * detect broken readline history files * fix download.pytorch.org URL * Test installer (Win 11) (#1620) Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> * Test installer (MacOS 13.0.1 w/ torch==1.12.0) (#1621) * Test installer (Win 11) * Test installer (MacOS 13.0.1 w/ torch==1.12.0) Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> * change sourceball to development for testing * Test installer (MacOS 13.0.1 w/ torch==1.12.1 & torchvision==1.13.1) (#1622) * Test installer (Win 11) * Test installer (MacOS 13.0.1 w/ torch==1.12.0) * Test installer (MacOS 13.0.1 w/ torch==1.12.1 & torchvision==1.13.1) Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Co-authored-by: Cyrus Chan <82143712+cyruschan360@users.noreply.github.com> Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> * 2.2 Doc Updates (#1589) * Unified Canvas Docs & Assets Unified Canvas draft Advanced Tools Updates Doc Updates (lstein feedback) * copy edits to Unified Canvas docs - consistent capitalisation and feature naming - more intimate address (replace "the user" with "you") for improved User Engagement(tm) - grammatical massaging and *poesie* Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> Co-authored-by: damian <git@damianstewart.com> * include a step after config to `cat ~/.invokeai` (#1629) * disable patchmatch in CI actions (#1626) * disable patchmatch in CI actions * fix indention * replace tab with spaces Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> * Fix installer script for macOS. (#1630) * refer to the platform as 'osx' instead of 'mac', otherwise the composed URL to micromamba is wrong. * move the `-O` option to `tar` to be grouped with the other tar flags to avoid the `-O` being interpreted as something to unarchive. * Removes symlinked environment.yaml (#1631) Was unintentionally added in #1621 * Fix inpainting with iterations (#1635) * fix error when inpainting using runwayml inpainting model (#1634) - error was "Omnibus object has no attribute pil_image" - closes #1596 * add k_dpmpp_2_a and k_dpmpp_2 solvers options (#1389) * add k_dpmpp_2_a and k_dpmpp_2 solvers options * update frontend Co-authored-by: Victor <victorca25@users.noreply.github.com> Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> * add .editorconfig (#1636) * Web UI 2.2 bugfixes (#1572) * Fixes bug preventing multiple images from being generated * Fixes valid seam strength value range * Update Delete Alert Text Indicates to the user that images are not permanently deleted. * Fixes left/right arrows not working on gallery * Fixes initial image on load erroneously set to a user uploaded image Should be a result gallery image. * Lightbox Fixes - Lightbox is now a button in the current image buttons - Lightbox is also now available in the gallery context menu - Lightbox zoom issues fixed - Lightbox has a fade in animation. * Fix image display wrapper in current preview not overflow bounds * Revert "Fix image display wrapper in current preview not overflow bounds" This reverts commit 5511c82714dbf1d1999d64e8bc357bafa34ddf37. * Change Staging Area discard icon from Bin to X * Expose Snap Threshold and Move Snap Settings to BBox Panel * Changes img2img strength default to 0.75 * Fixes drawing triggering when mouse enters canvas w/ button down When we only supported inpainting and no zoom, this was useful. It allowed the cursor to leave the canvas (which was easy to do given the limited canvas dimensions) and without losing the "I am drawing" state. With a zoomable canvas this is no longer as useful. Additionally, we have more popovers and tools (like the color pickers) which result in unexpected brush strokes. This fixes that issue. * Revert "Expose Snap Threshold and Move Snap Settings to BBox Panel" We will handle this a bit differently - by allowing the grid origin to be moved. I will dig in at some point. This reverts commit 33c92ecf4da724c2f17d9d91c7ea31a43a2f6deb. * Adds Limit Strokes to Box * Adds fill bounding box button * Adds erase bounding box button * Changes Staging area discard icon to match others * Fixes right click breaking move tool * Fixes brush preview visibility issue with "darken outside box" * Fixes history bugs with addFillRect, addEraseRect, and other actions * Adds missing `key` * Fixes postprocessing being applied to canvas generations * Fixes bbox not getting scaled in various situations * Fixes staging area show image toggle not resetting on accept/discard * Locks down canvas while generating/staging * Fixes move tool breaking when canvas loses focus during move/transform * Hides cursor when restrict strokes is on and mouse outside bbox * Lints * Builds fresh bundle * Fix overlapping hotkey for Fill Bounding Box * Build Fresh Bundle * Fixes bug with mask and bbox overlay * Builds fresh bundle Co-authored-by: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> * disable NSFW checker loading during the CI tests (#1641) * disable NSFW checker loading during the CI tests The NSFW filter apparently causes invoke.py to crash during CI testing, possibly due to out of memory errors. This workaround disables NSFW model loading. * doc change * fix formatting errors in yml files * Configure the NSFW checker at install time with default on (#1624) * configure the NSFW checker at install time with default on 1. Changes the --safety_checker argument to --nsfw_checker and --no-nsfw_checker. The original argument is recognized for backward compatibility. 2. The configure script asks users whether to enable the checker (default yes). Also offers users ability to select default sampler and number of generation steps. 3.Enables the pasting of the caution icon on blurred images when InvokeAI is installed into the package directory. 4. Adds documentation for the NSFW checker, including caveats about accuracy, memory requirements, and intermediate image dispaly. * use better fitting icon * NSFW defaults false for testing * set default back to nsfw active Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> Signed-off-by: devops117 <55235206+devops117@users.noreply.github.com> Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Co-authored-by: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Co-authored-by: Kyle Schouviller <kyle0654@hotmail.com> Co-authored-by: javl <mail@jaspervanloenen.com> Co-authored-by: Kent Keirsey <31807370+hipsterusername@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com> Co-authored-by: Damian Stewart <d@damianstewart.com> Co-authored-by: DevOps117 <55235206+devops117@users.noreply.github.com> Co-authored-by: damian <git@damianstewart.com> Co-authored-by: Damian Stewart <null@damianstewart.com> Co-authored-by: Cyrus Chan <82143712+cyruschan360@users.noreply.github.com> Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> Co-authored-by: Andre LaBranche <dre@mac.com> Co-authored-by: victorca25 <41912303+victorca25@users.noreply.github.com> Co-authored-by: Victor <victorca25@users.noreply.github.com>
2022-11-30 21:12:23 +00:00
use 🧨diffusers model (#1583) * initial commit of DiffusionPipeline class * spike: proof of concept using diffusers for txt2img * doc: type hints for Generator * refactor(model_cache): factor out load_ckpt * model_cache: add ability to load a diffusers model pipeline and update associated things in Generate & Generator to not instantly fail when that happens * model_cache: fix model default image dimensions * txt2img: support switching diffusers schedulers * diffusers: let the scheduler do its scaling of the initial latents Remove IPNDM scheduler; it is not behaving. * web server: update image_progress callback for diffusers data * diffusers: restore prompt weighting feature * diffusers: fix set-sampler error following model switch * diffusers: use InvokeAIDiffuserComponent for conditioning * cross_attention_control: stub (no-op) implementations for diffusers * model_cache: let offload_model work with DiffusionPipeline, sorta. * models.yaml.example: add diffusers-format model, set as default * test-invoke-conda: use diffusers-format model test-invoke-conda: put huggingface-token where the library can use it * environment-mac: upgrade to diffusers 0.7 (from 0.6) this was already done for linux; mac must have been lost in the merge. * preload_models: explicitly load diffusers models In non-interactive mode too, as long as you're logged in. * fix(model_cache): don't check `model.config` in diffusers format clean-up from recent merge. * diffusers integration: support img2img * dev: upgrade to diffusers 0.8 (from 0.7.1) We get to remove some code by using methods that were factored out in the base class. * refactor: remove backported img2img.get_timesteps now that we can use it directly from diffusers 0.8.1 * ci: use diffusers model * dev: upgrade to diffusers 0.9 (from 0.8.1) * lint: correct annotations for Python 3.9. * lint: correct AttributeError.name reference for Python 3.9. * CI: prefer diffusers-1.4 because it no longer requires a token The RunwayML models still do. * build: there's yet another place to update requirements? * configure: try to download models even without token Models in the CompVis and stabilityai repos no longer require them. (But runwayml still does.) * configure: add troubleshooting info for config-not-found * fix(configure): prepend root to config path * fix(configure): remove second `default: true` from models example * CI: simplify test-on-push logic now that we don't need secrets The "test on push but only in forks" logic was only necessary when tests didn't work for PRs-from-forks. * create an embedding_manager for diffusers * internal: avoid importing diffusers DummyObject see https://github.com/huggingface/diffusers/issues/1479 * fix "config attributes…not expected" diffusers warnings. * fix deprecated scheduler construction * work around an apparent MPS torch bug that causes conditioning to have no effect * 🚧 post-rebase repair * preliminary support for outpainting (no masking yet) * monkey-patch diffusers.attention and use Invoke lowvram code * add always_use_cpu arg to bypass MPS * add cross-attention control support to diffusers (fails on MPS) For unknown reasons MPS produces garbage output with .swap(). Use --always_use_cpu arg to invoke.py for now to test this code on MPS. * diffusers support for the inpainting model * fix debug_image to not crash with non-RGB images. * inpainting for the normal model [WIP] This seems to be performing well until the LAST STEP, at which point it dissolves to confetti. * fix off-by-one bug in cross-attention-control (#1774) prompt token sequences begin with a "beginning-of-sequence" marker <bos> and end with a repeated "end-of-sequence" marker <eos> - to make a default prompt length of <bos> + 75 prompt tokens + <eos>. the .swap() code was failing to take the column for <bos> at index 0 into account. the changes here do that, and also add extra handling for a single <eos> (which may be redundant but which is included for completeness). based on my understanding and some assumptions about how this all works, the reason .swap() nevertheless seemed to do the right thing, to some extent, is because over multiple steps the conditioning process in Stable Diffusion operates as a feedback loop. a change to token n-1 has flow-on effects to how the [1x4x64x64] latent tensor is modified by all the tokens after it, - and as the next step is processed, all the tokens before it as well. intuitively, a token's conditioning effects "echo" throughout the whole length of the prompt. so even though the token at n-1 was being edited when what the user actually wanted was to edit the token at n, it nevertheless still had some non-negligible effect, in roughly the right direction, often enough that it seemed like it was working properly. * refactor common CrossAttention stuff into a mixin so that the old ldm code can still work if necessary * inpainting for the normal model. I think it works this time. * diffusers: reset num_vectors_per_token sync with 44a00555718f1df173c60da0ed646cf700e29537 * diffusers: txt2img2img (hires_fix) with so much slicing and dicing of pipeline methods to stitch them together * refactor(diffusers): reduce some code duplication amongst the different tasks * fixup! refactor(diffusers): reduce some code duplication amongst the different tasks * diffusers: enable DPMSolver++ scheduler * diffusers: upgrade to diffusers 0.10, add Heun scheduler * diffusers(ModelCache): stopgap to make from_cpu compatible with diffusers * CI: default to diffusers-1.5 now that runwayml token requirement is gone * diffusers: update to 0.10 (and transformers to 4.25) * diffusers: use xformers when available diffusers no longer auto-enables this as of 0.10.2. * diffusers: make masked img2img behave better with multi-step schedulers re-randomizing the noise each step was confusing them. * diffusers: work more better with more models. fixed relative path problem with local models. fixed models on hub not always having a `fp16` branch. * diffusers: stopgap fix for attention_maps_callback crash after recent merge * fixup import merge conflicts correction for 061c5369a2247c6c92cd69606bcf54c4f1962a0b * test: add tests/inpainting inputs for masked img2img * diffusers(AddsMaskedGuidance): partial fix for k-schedulers Prevents them from crashing, but results are still hot garbage. * fix --safety_checker arg parsing and add note to diffusers loader about where safety checker gets called * generate: fix import error * CI: don't try to read the old init location * diffusers: support loading an alternate VAE * CI: remove sh-syntax if-statement so it doesn't crash powershell * CI: fold strings in yaml because backslash is not line-continuation in powershell * attention maps callback stuff for diffusers * build: fix syntax error in environment-mac * diffusers: add INITIAL_MODELS with diffusers-compatible repos * re-enable the embedding manager; closes #1778 * Squashed commit of the following: commit e4a956abc37fcb5cf188388b76b617bc5c8fda7d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:43:07 2022 +0100 import new load handling from EmbeddingManager and cleanup commit c4abe91a5ba0d415b45bf734068385668b7a66e6 Merge: 032e856e 1efc6397 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:09:53 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers_with_textual_inversion_manager commit 032e856eefb3bbc39534f5daafd25764bcfcef8b Merge: 8b4f0fe9 bc515e24 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:08:01 2022 +0100 Merge remote-tracking branch 'upstream/dev/diffusers' into dev/diffusers_with_textual_inversion_manager commit 1efc6397fc6e61c1aff4b0258b93089d61de5955 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:04:28 2022 +0100 cleanup and add performance notes commit e400f804ac471a0ca2ba432fd658778b20c7bdab Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:45:07 2022 +0100 fix bug and update unit tests commit deb9ae0ae1016750e93ce8275734061f7285a231 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:28:29 2022 +0100 textual inversion manager seems to work commit 162e02505dec777e91a983c4d0fb52e950d25ff0 Merge: cbad4583 12769b3d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:58:03 2022 +0100 Merge branch 'main' into feature_textual_inversion_mgr commit cbad45836c6aace6871a90f2621a953f49433131 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:54:10 2022 +0100 use position embeddings commit 070344c69b0e0db340a183857d0a787b348681d3 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:53:47 2022 +0100 Don't crash CLI on exceptions commit b035ac8c6772dfd9ba41b8eeb9103181cda028f8 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:11:55 2022 +0100 add missing position_embeddings commit 12769b3d3562ef71e0f54946b532ad077e10043c Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:33:25 2022 +0100 debugging why it don't work commit bafb7215eabe1515ca5e8388fd3bb2f3ac5362cf Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:21:33 2022 +0100 debugging why it don't work commit 664a6e9e146b42d96703f0cc8baf8f5efec04ee1 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit 8b4f0fe9d6e4e2643b36dfa27864294785d7ba4e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit ffbe1ab11163ba712e353d89404e301d0e0c6cdf Merge: 6e4dad60 023df37e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:37:31 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers commit 023df37efffa67434f77def7fc3c9dfb29f699fd Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:36:54 2022 +0100 cleanup commit 05fac594eaf79d0058e3c48deee93df603f136c2 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:07:49 2022 +0100 tweak error checking commit 009f32ed39a7280997c3ffab112adadee0b44279 Author: damian <null@damianstewart.com> Date: Thu Dec 15 21:29:47 2022 +0100 unit tests passing for embeddings with vector length >1 commit beb1b08d9a98112ed2fe073580568e1a18698da3 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:39:09 2022 +0100 more explicit equality tests when overwriting commit 44d8a5a7c85cdabc9ce3a54fd0769a10597b3ca9 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:30:13 2022 +0100 wip textual inversion manager (unit tests passing for 1v embedding overwriting) commit 417c2b57d90924a839616bfb66804faab8039e4c Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 12:30:55 2022 +0100 wip textual inversion manager (unit tests passing for base stuff + padding) commit 2e80872e3b6f7fd7d8eb8928822bd824b63cb2ff Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 10:57:57 2022 +0100 wip new TextualInversionManager * stop using WeightedFrozenCLIPEmbedder * store diffusion models locally - configure_invokeai.py reconfigured to store diffusion models rather than CompVis models - hugging face caching model is used, but cache is set to ~/invokeai/models/repo_id - models.yaml does **NOT** use path, just repo_id - "repo_name" changed to "repo_id" to following hugging face conventions - Models are loaded with full precision pending further work. * allow non-local files during development * path takes priority over repo_id * MVP for model_cache and configure_invokeai - Feature complete (almost) - configure_invokeai.py downloads both .ckpt and diffuser models, along with their VAEs. Both types of download are controlled by a unified INITIAL_MODELS.yaml file. - model_cache can load both type of model and switches back and forth in CPU. No memory leaks detected TO DO: 1. I have not yet turned on the LocalOnly flag for diffuser models, so the code will check the Hugging Face repo for updates before using the locally cached models. This will break firewalled systems. I am thinking of putting in a global check for internet connectivity at startup time and setting the LocalOnly flag based on this. It would be good to check updates if there is connectivity. 2. I have not gone completely through INITIAL_MODELS.yaml to check which models are available as diffusers and which are not. So models like PaperCut and VoxelArt may not load properly. The runway and stability models are checked, as well as the Trinart models. 3. Add stanzas for SD 2.0 and 2.1 in INITIAL_MODELS.yaml REMAINING PROBLEMS NOT DIRECTLY RELATED TO MODEL_CACHE: 1. When loading a .ckpt file there are lots of messages like this: Warning! ldm.modules.attention.CrossAttention is no longer being maintained. Please use InvokeAICrossAttention instead. I'm not sure how to address this. 2. The ckpt models ***don't actually run*** due to the lack of special-case support for them in the generator objects. For example, here's the hard crash you get when you run txt2img against the legacy waifu-diffusion-1.3 model: ``` >> An error occurred: Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 140, in main main_loop(gen, opt) File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 371, in main_loop gen.prompt2image( File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1265, in __getattr__ raise AttributeError("'{}' object has no attribute '{}'".format( AttributeError: 'LatentDiffusion' object has no attribute 'image_from_embeddings' ``` 3. The inpainting diffusion model isn't working. Here's the output of "banana sushi" when inpainting-1.5 is loaded: ``` Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 301, in image_from_embeddings result_latents, result_attention_map_saver = self.latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 330, in latents_from_embeddings result: PipelineIntermediateState = infer_latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 185, in __call__ for result in self.generator_method(*args, **kwargs): File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 367, in generate_latents_from_embeddings step_output = self.step(batched_t, latents, guidance_scale, File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context return func(*args, **kwargs) File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 409, in step step_output = self.scheduler.step(noise_pred, timestep, latents, **extra_step_kwargs) File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/diffusers/schedulers/scheduling_lms_discrete.py", line 223, in step pred_original_sample = sample - sigma * model_output RuntimeError: The size of tensor a (9) must match the size of tensor b (4) at non-singleton dimension 1 ``` * proper support for float32/float16 - configure script now correctly detects user's preference for fp16/32 and downloads the correct diffuser version. If fp16 version not available, falls back to fp32 version. - misc code cleanup and simplification in model_cache * add on-the-fly conversion of .ckpt to diffusers models 1. On-the-fly conversion code can be found in the file ldm/invoke/ckpt_to_diffusers.py. 2. A new !optimize command has been added to the CLI. Should be ported to Web GUI. User experience on the CLI is this: ``` invoke> !optimize /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt INFO: Converting legacy weights file /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt to optimized diffuser model. This operation will take 30-60s to complete. Success. Optimized model is now located at /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 Writing new config file entry for sd-v1-4... >> New configuration: sd-v1-4: description: Optimized version of sd-v1-4 format: diffusers path: /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 OK to import [n]? y >> Verifying that new model loads... >> Current VRAM usage: 2.60G >> Offloading stable-diffusion-2.1 to CPU >> Loading diffusers model from /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 | Using faster float16 precision You have disabled the safety checker for <class 'ldm.invoke.generator.diffusers_pipeline.StableDiffusionGeneratorPipeline'> by passing `safety_checker=None`. Ensure that you abide to the conditions of the Stable Diffusion \ license and do not expose unfiltered results in services or applications open to the public. Both the diffusers team and Hugging Face strongly recommend to keep the safety filter enabled in all public facing circumstances,\ disabling it only for use-cases that involve analyzing network behavior or auditing its results. For more information, please have a look at https://github.com/huggingface/diffusers/pull/254 . | training width x height = (512 x 512) >> Model loaded in 3.48s >> Max VRAM used to load the model: 2.17G >> Current VRAM usage:2.17G >> Textual inversions available: >> Setting Sampler to k_lms (LMSDiscreteScheduler) Keep model loaded? [y] ``` * add parallel set of generator files for ckpt legacy generation * generation using legacy ckpt models now working * diffusers: fix missing attention_maps_callback fix for 23eb80b40421b2bb8f4b6d3dd30490d11c447b36 * associate legacy CrossAttention with .ckpt models * enable autoconvert New --autoconvert CLI option will scan a designated directory for new .ckpt files, convert them into diffuser models, and import them into models.yaml. Works like this: invoke.py --autoconvert /path/to/weights/directory In ModelCache added two new methods: autoconvert_weights(config_path, weights_directory_path, models_directory_path) convert_and_import(ckpt_path, diffuser_path) * diffusers: update to diffusers 0.11 (from 0.10.2) * fix vae loading & width/height calculation * refactor: encapsulate these conditioning data into one container * diffusers: fix some noise-scaling issues by pushing the noise-mixing down to the common function * add support for safetensors and accelerate * set local_files_only when internet unreachable * diffusers: fix error-handling path when model repo has no fp16 branch * fix generatorinpaint error Fixes : "ModuleNotFoundError: No module named 'ldm.invoke.generatorinpaint' https://github.com/invoke-ai/InvokeAI/pull/1583#issuecomment-1363634318 * quench diffuser safety-checker warning * diffusers: support stochastic DDIM eta parameter * fix conda env creation on macos * fix cross-attention with diffusers 0.11 * diffusers: the VAE needs to be tiling as well as the U-Net * diffusers: comment on subfolders * diffusers: embiggen! * diffusers: make model_cache.list_models serializable * diffusers(inpaint): restore scaling functionality * fix requirements clash between numba and numpy 1.24 * diffusers: allow inpainting model to do non-inpainting tasks * start expanding model_cache functionality * add import_ckpt_model() and import_diffuser_model() methods to model_manager - in addition, model_cache.py is now renamed to model_manager.py * allow "recommended" flag to be optional in INITIAL_MODELS.yaml * configure_invokeai now downloads VAE diffusers in advance * rename ModelCache to ModelManager * remove support for `repo_name` in models.yaml * check for and refuse to load embeddings trained on incompatible models * models.yaml.example: s/repo_name/repo_id and remove extra INITIAL_MODELS now that the main one has diffusers models in it. * add MVP textual inversion script * refactor(InvokeAIDiffuserComponent): factor out _combine() * InvokeAIDiffuserComponent: implement threshold * InvokeAIDiffuserComponent: diagnostic logs for threshold ...this does not look right * add a curses-based frontend to textual inversion - not quite working yet - requires npyscreen installed - on windows will also have the windows-curses requirement, but not added to requirements yet * add curses-based interface for textual inversion * fix crash in convert_and_import() - This corrects a "local variable referenced before assignment" error in model_manager.convert_and_import() * potential workaround for no 'state_dict' key error - As reported in https://github.com/huggingface/diffusers/issues/1876 * create TI output dir if needed * Update environment-lin-cuda.yml (#2159) Fixing line 42 to be the proper order to define the transformers requirement: ~= instead of =~ * diffusers: update sampler-to-scheduler mapping based on https://github.com/huggingface/diffusers/issues/277#issuecomment-1371428672 * improve user exp for ckt to diffusers conversion - !optimize_models command now operates on an existing ckpt file entry in models.yaml - replaces existing entry, rather than adding a new one - offers to delete the ckpt file after conversion * web: adapt progress callback to deal with old generator or new diffusers pipeline * clean-up model_manager code - add_model() verified to work for .ckpt local paths, .ckpt remote URLs, diffusers local paths, and diffusers repo_ids - convert_and_import() verified to work for local and remove .ckpt files * handle edge cases for import_model() and convert_model() * add support for safetensor .ckpt files * fix name error * code cleanup with pyflake * improve model setting behavior - If the user enters an invalid model name at startup time, will not try to load it, warn, and use default model - CLI UI enhancement: include currently active model in the command line prompt. * update test-invoke-pip.yml - fix model cache path to point to runwayml/stable-diffusion-v1-5 - remove `skip-sd-weights` from configure_invokeai.py args * exclude dev/diffusers from "fail for draft PRs" * disable "fail on PR jobs" * re-add `--skip-sd-weights` since no space * update workflow environments - include `INVOKE_MODEL_RECONFIGURE: '--yes'` * clean up model load failure handling - Allow CLI to run even when no model is defined or loadable. - Inhibit stack trace when model load fails - only show last error - Give user *option* to run configure_invokeai.py when no models successfully load. - Restart invokeai after reconfiguration. * further edge-case handling 1) only one model in models.yaml file, and that model is broken 2) no models in models.yaml 3) models.yaml doesn't exist at all * fix incorrect model status listing - "cached" was not being returned from list_models() - normalize handling of exceptions during model loading: - Passing an invalid model name to generate.set_model() will return a KeyError - All other exceptions are returned as the appropriate Exception * CI: do download weights (if not already cached) * diffusers: fix scheduler loading in offline mode * CI: fix model name (no longer has `diffusers-` prefix) * Update txt2img2img.py (#2256) * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * feat - make model storage compatible with hugging face caching system This commit alters the InvokeAI model directory to be compatible with hugging face, making it easier to share diffusers (and other models) across different programs. - If the HF_HOME environment variable is not set, then models are cached in ~/invokeai/models in a format that is identical to the HuggingFace cache. - If HF_HOME is set, then models are cached wherever HF_HOME points. - To enable sharing with other HuggingFace library clients, set HF_HOME to ~/.cache/huggingface to set the default cache location or to ~/invokeai/models to have huggingface cache inside InvokeAI. * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * fix error "no attribute CkptInpaint" * model_manager.list_models() returns entire model config stanza+status * Initial Draft - Model Manager Diffusers * added hash function to diffusers * implement sha256 hashes on diffusers models * Add Model Manager Support for Diffusers * fix various problems with model manager - in cli import functions, fix not enough values to unpack from _get_name_and_desc() - fix crash when using old-style vae: value with new-style diffuser * rebuild frontend * fix dictconfig-not-serializable issue * fix NoneType' object is not subscriptable crash in model_manager * fix "str has no attribute get" error in model_manager list_models() * Add path and repo_id support for Diffusers Model Manager Also fixes bugs * Fix tooltip IT localization not working * Add Version Number To WebUI * Optimize Model Search * Fix incorrect font on the Model Manager UI * Fix image degradation on merge fixes - [Experimental] This change should effectively fix a couple of things. - Fix image degradation on subsequent merges of the canvas layers. - Fix the slight transparent border that is left behind when filling the bounding box with a color. - Fix the left over line of color when filling a bounding box with color. So far there are no side effects for this. If any, please report. * Add local model filtering for Diffusers / Checkpoints * Go to home on modal close for the Add Modal UI * Styling Fixes * Model Manager Diffusers Localization Update * Add Safe Tensor scanning to Model Manager * Fix model edit form dispatching string values instead of numbers. * Resolve VAE handling / edge cases for supplied repos * defer injecting tokens for textual inversions until they're used for the first time * squash a console warning * implement model migration check * add_model() overwrites previous config rather than merges * fix model config file attribute merging * fix precision handling in textual inversion script * allow ckpt conversion script to work with safetensors .ckpts Applied patch here: https://github.com/huggingface/diffusers/commit/beb932c5d111872c5e45387e7b1b2b3dd0524a47 * fix name "args" is not defined crash in textual_inversion_training * fix a second NameError: name 'args' is not defined crash * fix loading of the safety checker from the global cache dir * add installation step to textual inversion frontend - After a successful training run, the script will copy learned_embeds.bin to a subfolder of the embeddings directory. - User given the option to delete the logs and intermediate checkpoints (which together use 7-8G of space) - If textual inversion training fails, reports the error gracefully. * don't crash out on incompatible embeddings - put try: blocks around places where the system tries to load an embedding which is incompatible with the currently loaded model * add support for checkpoint resuming * textual inversion preferences are saved and restored between sessions - Preferences are stored in a file named text-inversion-training/preferences.conf - Currently the resume-from-checkpoint option is not working correctly. Possible bug in textual_inversion_training.py? * copy learned_embeddings.bin into right location * add front end for diffusers model merging - Front end doesn't do anything yet!!!! - Made change to model name parsing in CLI to support ability to have merged models with the "+" character in their names. * improve inpainting experience - recommend ckpt version of inpainting-1.5 to user - fix get_noise() bug in ckpt version of omnibus.py * update environment*yml * tweak instructions to install HuggingFace token * bump version number * enhance update scripts - update scripts will now fetch new INITIAL_MODELS.yaml so that configure_invokeai.py will know about the diffusers versions. * enhance invoke.sh/invoke.bat launchers - added configure_invokeai.py to menu - menu defaults to browser-based invoke * remove conda workflow (#2321) * fix `token_ids has shape torch.Size([79]) - expected [77]` * update CHANGELOG.md with 2.3.* info - Add information on how formats have changed and the upgrade process. - Add short bug list. Co-authored-by: Damian Stewart <d@damianstewart.com> Co-authored-by: Damian Stewart <null@damianstewart.com> Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> Co-authored-by: Wybartel-luxmc <37852506+Wybartel-luxmc@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> Co-authored-by: mickr777 <115216705+mickr777@users.noreply.github.com> Co-authored-by: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Co-authored-by: Eugene Brodsky <ebr@users.noreply.github.com> Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com>
2023-01-15 14:22:46 +00:00
@property
def huggingface_concepts_library(self) -> HuggingFaceConceptsLibrary:
return self.model.textual_inversion_manager.hf_concepts_library
Merge dev into main for 2.2.0 (#1642) * Fixes inpainting + code cleanup * Disable stage info in Inpainting Tab * Mask Brush Preview now always at 0.5 opacity The new mask is only visible properly at max opacity but at max opacity the brush preview becomes fully opaque blocking the view. So the mask brush preview no remains at 0.5 no matter what the Brush opacity is. * Remove save button from Canvas Controls (cleanup) * Implements invert mask * Changes "Invert Mask" to "Preserve Masked Areas" * Fixes (?) spacebar issues * Patches redux-persist and redux-deep-persist with debounced persists Our app changes redux state very, very often. As our undo/redo history grows, the calls to persist state start to take in the 100ms range, due to a the deep cloning of the history. This causes very noticeable performance lag. The deep cloning is required because we need to blacklist certain items in redux from being persisted (e.g. the app's connection status). Debouncing the whole process of persistence is a simple and effective solution. Unfortunately, `redux-persist` dropped `debounce` between v4 and v5, replacing it with `throttle`. `throttle`, instead of delaying the expensive action until a period of X ms of inactivity, simply ensures the action is executed at least every X ms. Of course, this does not fix our performance issue. The patch is very simple. It adds a `debounce` argument - a number of milliseconds - and debounces `redux-persist`'s `update()` method (provided by `createPersistoid`) by that many ms. Before this, I also tried writing a custom storage adapter for `redux-persist` to debounce the calls to `localStorage.setItem()`. While this worked and was far less invasive, it doesn't actually address the issue. It turns out `setItem()` is a very fast part of the process. We use `redux-deep-persist` to simplify the `redux-persist` configuration, which can get complicated when you need to blacklist or whitelist deeply nested state. There is also a patch here for that library because it uses the same types as `redux-persist`. Unfortunately, the last release of `redux-persist` used a package `flat-stream` which was malicious and has been removed from npm. The latest commits to `redux-persist` (about 1 year ago) do not build; we cannot use the master branch. And between the last release and last commit, the changes have all been breaking. Patching this last release (about 3 years old at this point) directly is far simpler than attempting to fix the upstream library's master branch or figuring out an alternative to the malicious and now non-existent dependency. * Adds debouncing * Fixes AttributeError: 'dict' object has no attribute 'invert_mask' * Updates package.json to use redux-persist patches * Attempts to fix redux-persist debounce patch * Fixes undo/redo * Fixes invert mask * Debounce > 300ms * Limits history to 256 for each of undo and redo * Canvas styling * Hotkeys improvement * Add Metadata To Viewer * Increases CFG Scale max to 200 * Fix gallery width size for Outpainting Also fixes the canvas resizing failing n fast pushes * Fixes disappearing canvas grid lines * Adds staging area * Fixes "use all" not setting variationAmount Now sets to 0 when the image had variations. * Builds fresh bundle * Outpainting tab loads to empty canvas instead of upload * Fixes wonky canvas layer ordering & compositing * Fixes error on inpainting paste back `TypeError: 'float' object cannot be interpreted as an integer` * Hides staging area outline on mouseover prev/next * Fixes inpainting not doing img2img when no mask * Fixes bbox not resizing in outpainting if partially off screen * Fixes crashes during iterative outpaint. Still doesn't work correctly though. * Fix iterative outpainting by restoring original images * Moves image uploading to HTTP - It all seems to work fine - A lot of cleanup is still needed - Logging needs to be added - May need types to be reviewed * Fixes: outpainting temp images show in gallery * WIP refactor to unified canvas * Removes console.log from redux-persist patch * Initial unification of canvas * Removes all references to split inpainting/outpainting canvas * Add patchmatch and infill_method parameter to prompt2image (options are 'patchmatch' or 'tile'). * Fixes app after removing in/out-painting refs * Rebases on dev, updates new env files w/ patchmatch * Organises features/canvas * Fixes bounding box ending up offscreen * Organises features/canvas * Stops unnecessary canvas rescales on gallery state change * Fixes 2px layout shift on toggle canvas lock * Clips lines drawn while canvas locked When drawing with the locked canvas, if a brush stroke gets too close to the edge of the canvas and its stroke would extend past the edge of the canvas, the edge of that stroke will be seen after unlocking the canvas. This could cause a problem if you unlock the canvas and now have a bunch of strokes just outside the init image area, which are far back in undo history and you cannot easily erase. With this change, lines drawn while the canvas is locked get clipped to the initial image bbox, fixing this issue. Additionally, the merge and save to gallery functions have been updated to respect the initial image bbox so they function how you'd expect. * Fixes reset canvas view when locked * Fixes send to buttons * Fixes bounding box not being rounded to 64 * Abandons "inpainting" canvas lock * Fixes save to gallery including empty area, adds download and copy image * Fix Current Image display background going over image bounds * Sets status immediately when clicking Invoke * Adds hotkeys and refactors sharing of konva instances Adds hotkeys to canvas. As part of this change, the access to konva instance objects was refactored: Previously closure'd refs were used to indirectly get access to the konva instances outside of react components. Now, a getter and setter function are used to provide access directly to the konva objects. * Updates hotkeys * Fixes canvas showing spinner on first load Also adds good default canvas scale and positioning when no image is on it * Fixes possible hang on MaskCompositer * Improves behaviour when setting init canvas image/reset view * Resets bounding box coords/dims when no image present * Disables canvas actions which cannot be done during processing * Adds useToastWatcher hook - Dispatch an `addToast` action with standard Chakra toast options object to add a toast to the toastQueue - The hook is called in App.tsx and just useEffect's w/ toastQueue as dependency to create the toasts - So now you can add toasts anywhere you have access to `dispatch`, which includes middleware and thunks - Adds first usage of this for the save image buttons in canvas * Update Hotkey Info Add missing tooltip hotkeys and update the hotkeys modal to reflect the new hotkeys for the Unified Canvas. * Fix theme changer not displaying current theme on page refresh * Fix tab count in hotkeys panel * Unify Brush and Eraser Sizes * Fix staging area display toggle not working * Staging Area delete button is now red So it doesnt feel blended into to the rest of them. * Revert "Fix theme changer not displaying current theme on page refresh" This reverts commit 903edfb803e743500242589ff093a8a8a0912726. * Add arguments to use SSL to webserver * Integrates #1487 - touch events Need to add: - Pinch zoom - Touch-specific handling (some things aren't quite right) * Refactors upload-related async thunks - Now standard thunks instead of RTK createAsyncThunk() - Adds toasts for all canvas upload-related actions * Reorganises app file structure * Fixes Canvas Auto Save to Gallery * Fixes staging area outline * Adds staging area hotkeys, disables gallery left/right when staging * Fixes Use All Parameters * Fix metadata viewer image url length when viewing intermediate * Fixes intermediate images being tiny in txt2img/img2img * Removes stale code * Improves canvas status text and adds option to toggle debug info * Fixes paste image to upload * Adds model drop-down to site header * Adds theme changer popover * Fix missing key on ThemeChanger map * Fixes stage position changing on zoom * Hotkey Cleanup - Viewer is now Z - Canvas Move tool is V - sync with PS - Removed some unused hotkeys * Fix canvas resizing when both options and gallery are unpinned * Implements thumbnails for gallery - Thumbnails are saved whenever an image is saved, and when gallery requests images from server - Thumbnails saved at original image aspect ratio with width of 128px as WEBP - If the thumbnail property of an image is unavailable for whatever reason, the image's full size URL is used instead * Saves thumbnails to separate thumbnails directory * Thumbnail size = 256px * Fix Lightbox Issues * Disables canvas image saving functions when processing * Fix index error on going past last image in Gallery * WIP - Lightbox Fixes Still need to fix the images not being centered on load when the image res changes * Fixes another similar index error, simplifies logic * Reworks canvas toolbar * Fixes canvas toolbar upload button * Cleans up IAICanvasStatusText * Improves metadata handling, fixes #1450 - Removes model list from metadata - Adds generation's specific model to metadata - Displays full metadata in JSON viewer * Gracefully handles corrupted images; fixes #1486 - App does not crash if corrupted image loaded - Error is displayed in the UI console and CLI output if an image cannot be loaded * Adds hotkey to reset canvas interaction state If the canvas' interaction state (e.g. isMovingBoundingBox, isDrawing, etc) get stuck somehow, user can press Escape to reset the state. * Removes stray console.log() * Fixes bug causing gallery to close on context menu open * Minor bugfixes - When doing long-running canvas image exporting actions, display indeterminate progress bar - Fix staging area image outline not displaying after committing/discarding results * Removes unused imports * Fixes repo root .gitignore ignoring frontend things * Builds fresh bundle * Styling updates * Removes reasonsWhyNotReady The popover doesn't play well with the button being disabled, and I don't think adds any value. * Image gallery resize/style tweaks * Styles buttons for clearing canvas history and mask * First pass on Canvas options panel * Fixes bug where discarding staged images results in loss of history * Adds Save to Gallery button to staging toolbar * Rearrange some canvas toolbar icons Put brush stuff together and canvas movement stuff together * Fix gallery maxwidth on unified canvas * Update Layer hotkey display to UI * Adds option to crop to bounding box on save * Masking option tweaks * Crop to Bounding Box > Save Box Region Only * Adds clear temp folder * Updates mask options popover behavior * Builds fresh bundle * Fix styling on alert modals * Fix input checkbox styling being incorrect on light theme * Styling fixes * Improves gallery resize behaviour * Cap gallery size on canvas tab so it doesnt overflow * Fixes bug when postprocessing image with no metadata * Adds IAIAlertDialog component * Moves Loopback to app settings * Fixes metadata viewer not showing metadata after refresh Also adds Dream-style prompt to metadata * Adds outpainting specific options * Linting * Fixes gallery width on lightbox, fixes gallery button expansion * Builds fresh bundle * Fix Lightbox images of different res not centering * Update feature tooltip text * Highlight mask icon when on mask layer * Fix gallery not resizing correctly on open and close * Add loopback to just img2img. Remove from settings. * Fix to gallery resizing * Removes Advanced checkbox, cleans up options panel for unified canvas * Minor styling fixes to new options panel layout * Styling Updates * Adds infill method * Tab Styling Fixes * memoize outpainting options * Fix unnecessary gallery re-renders * Isolate Cursor Pos debug text on canvas to prevent rerenders * Fixes missing postprocessed image metadata before refresh * Builds fresh bundle * Fix rerenders on model select * Floating panel re-render fix * Simplify fullscreen hotkey selector * Add Training WIP Tab * Adds Training icon * Move full screen hotkey to floating to prevent tab rerenders * Adds single-column gallery layout * Fixes crash on cancel with intermediates enabled, fixes #1416 * Updates npm dependencies * Fixes img2img attempting inpaint when init image has transparency * Fixes missing threshold and perlin parameters in metadata viewer * Renames "Threshold" > "Noise Threshold" * Fixes postprocessing not being disabled when clicking use all * Builds fresh bundle * Adds color picker * Lints & builds fresh bundle * Fixes iterations being disabled when seed random & variations are off * Un-floors cursor position * Changes color picker preview to circles * Fixes variation params not set correctly when recalled * Fixes invoke hotkey not working in input fields * Simplifies Accordion Prep for adding reset buttons for each section * Fixes mask brush preview color * Committing color picker color changes tool to brush * Color picker does not overwrite user-selected alpha * Adds brush color alpha hotkey * Lints * Removes force_outpaint param * Add inpaint size options to inpaint at a larger size than the actual inpaint image, then scale back down for recombination * Bug fix for inpaint size * Adds inpaint size (as scale bounding box) to UI * Adds auto-scaling for inpaint size * Improves scaled bbox display logic * Fixes bug with clear mask and history * Fixes shouldShowStagingImage not resetting to true on commit * Builds fresh bundle * Fixes canvas failing to scale on first run * Builds fresh bundle * Fixes unnecessary canvas scaling * Adds gallery drag and drop to img2img/canvas * Builds fresh bundle * Fix desktop mode being broken with new versions of flaskwebgui * Fixes canvas dimensions not setting on first load * Builds fresh bundle * stop crash on !import_models call on model inside rootdir - addresses bug report #1546 * prevent "!switch state gets confused if model switching fails" - If !switch were to fail on a particular model, then generate got confused and wouldn't try again until you switch to a different working model and back again. - This commit fixes and closes #1547 * Revert "make the docstring more readable and improve the list_models logic" This reverts commit 248068fe5d57b5639ea7a87ee6cbf023104d957d. * fix model cache path * also set fail-fast to it's default (true) in this way the whole action fails if one job fails this should unblock the runners!!! * fix output path for Archive results * disable checks for python 3.9 * Update-requirements and test-invoke-pip workflow (#1574) * update requirements files * update test-invoke-pip workflow * move requirements-mkdocs.txt to docs folder (#1575) * move requirements-mkdocs.txt to docs folder * update copyright * Fixes outpainting with resized inpaint size * Interactive configuration (#1517) * Update scripts/configure_invokeai.py prevent crash if output exists Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> * implement changes requested by reviews * default to correct root and output directory on Windows systems - Previously the script was relying on the readline buffer editing feature to set up the correct default. But this feature doesn't exist on windows. - This commit detects when user typed return with an empty directory value and replaces with the default directory. * improved readability of directory choices * Update scripts/configure_invokeai.py Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> * better error reporting at startup - If user tries to run the script outside of the repo or runtime directory, a more informative message will appear explaining the problem. Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> * Embedding merging (#1526) * add whole <style token> to vocab for concept library embeddings * add ability to load multiple concept .bin files * make --log_tokenization respect custom tokens * start working on concept downloading system * preliminary support for dynamic loading and merging of multiple embedded models - The embedding_manager is now enhanced with ldm.invoke.concepts_lib, which handles dynamic downloading and caching of embedded models from the Hugging Face concepts library (https://huggingface.co/sd-concepts-library) - Downloading of a embedded model is triggered by the presence of one or more <concept> tags in the prompt. - Once the embedded model is downloaded, its trigger phrase will be loaded into the embedding manager and the prompt's <concept> tag will be replaced with the <trigger_phrase> - The downloaded model stays on disk for fast loading later. - The CLI autocomplete will complete partial <concept> tags for you. Type a '<' and hit tab to get all ~700 concepts. BUGS AND LIMITATIONS: - MODEL NAME VS TRIGGER PHRASE You must use the name of the concept embed model from the SD library, and not the trigger phrase itself. Usually these are the same, but not always. For example, the model named "hoi4-leaders" corresponds to the trigger "<HOI4-Leader>" One reason for this design choice is that there is no apparent constraint on the uniqueness of the trigger phrases and one trigger phrase may map onto multiple models. So we use the model name instead. The second reason is that there is no way I know of to search Hugging Face for models with certain trigger phrases. So we'd have to download all 700 models to index the phrases. The problem this presents is that this may confuse users, who will want to reuse prompts from distributions that use the trigger phrase directly. Usually this will work, but not always. - WON'T WORK ON A FIREWALLED SYSTEM If the host running IAI has no internet connection, it can't download the concept libraries. I will add a script that allows users to preload a list of concept models. - BUG IN PROMPT REPLACEMENT WHEN MODEL NOT FOUND There's a small bug that occurs when the user provides an invalid model name. The <concept> gets replaced with <None> in the prompt. * fix loading .pt embeddings; allow multi-vector embeddings; warn on dupes * simplify replacement logic and remove cuda assumption * download list of concepts from hugging face * remove misleading customization of '*' placeholder the existing code as-is did not do anything; unclear what it was supposed to do. the obvious alternative -- setting using 'placeholder_strings' instead of 'placeholder_tokens' to match model.params.personalization_config.params.placeholder_strings -- caused a crash. i think this is because the passed string also needed to be handed over on init of the PersonalizedBase as the 'placeholder_token' argument. this is weird config dict magic and i don't want to touch it. put a breakpoint in personalzied.py line 116 (top of PersonalizedBase.__init__) if you want to have a crack at it yourself. * address all the issues raised by damian0815 in review of PR #1526 * actually resize the token_embeddings * multiple improvements to the concept loader based on code reviews 1. Activated the --embedding_directory option (alias --embedding_path) to load a single embedding or an entire directory of embeddings at startup time. 2. Can turn off automatic loading of embeddings using --no-embeddings. 3. Embedding checkpoints are scanned with the pickle scanner. 4. More informative error messages when a concept can't be loaded due either to a 404 not found error or a network error. * autocomplete terms end with ">" now * fix startup error and network unreachable 1. If the .invokeai file does not contain the --root and --outdir options, invoke.py will now fix it. 2. Catch and handle network problems when downloading hugging face textual inversion concepts. * fix misformatted error string Co-authored-by: Damian Stewart <d@damianstewart.com> * model_cache.py: fix list_models Signed-off-by: devops117 <55235206+devops117@users.noreply.github.com> * add statement of values (#1584) * this adds the Statement of Values Google doc source = https://docs.google.com/document/d/1-PrUKDJcxy8OyNGc8CyiHhv2VgLvjt7LRGlEpbg1nmQ/edit?usp=sharing * Fix heading * Update InvokeAI_Statement_of_Values.md * Update InvokeAI_Statement_of_Values.md * Update InvokeAI_Statement_of_Values.md * Update InvokeAI_Statement_of_Values.md * Update InvokeAI_Statement_of_Values.md * add keturn and mauwii to the team member list * Fix punctuation * this adds the Statement of Values Google doc source = https://docs.google.com/document/d/1-PrUKDJcxy8OyNGc8CyiHhv2VgLvjt7LRGlEpbg1nmQ/edit?usp=sharing * add keturn and mauwii to the team member list * fix formating - make sub bullets use * (decide to all use - or *) - indent sub bullets Sorry, first only looked at the code version and found this only after looking at the markdown rendered version * use multiparagraph numbered sections * Break up Statement Of Values as per comments on #1584 * remove duplicated word, reduce vagueness it's important not to overstate how many artists we are consulting. * fix typo (sorry blessedcoolant) Co-authored-by: mauwii <Mauwii@outlook.de> Co-authored-by: damian <git@damianstewart.com> * update dockerfile (#1551) * update dockerfile * remove not existing file from .dockerignore * remove bloat and unecesary step also use --no-cache-dir for pip install image is now close to 2GB * make Dockerfile a variable * set base image to `ubuntu:22.10` * add build-essential * link outputs folder for persistence * update tag variable * update docs * fix not customizeable build args, add reqs output * !model_import autocompletes in ROOTDIR * Adds psychedelicious to statement of values signature (#1602) * add a --no-patchmatch option to disable patchmatch loading (#1598) This feature was added to prevent the CI Macintosh tests from erroring out when patchmatch is unable to retrieve its shared library from github assets. * Fix #1599 by relaxing the `match_trigger` regex (#1601) * Fix #1599 by relaxing the `match_trigger` regex Also simplify logic and reduce duplication. * restrict trigger regex again (but not so far) * make concepts library work with Web UI This PR makes it possible to include a Hugging Face concepts library <style-or-subject-trigger> in the WebUI prompt. The metadata seems to be correctly handled. * documentation enhancements (#1603) - Add documentation for the Hugging Face concepts library and TI embedding. - Fixup index.md to point to each of the feature documentation files, including ones that are pending. * tweak setup and environment files for linux & pypatchmatch (#1580) * tweak setup and environment files for linux & pypatchmatch - Downgrade python requirements to 3.9 because 3.10 is not supported on Ubuntu 20.04 LTS (widely-used distro) - Use our github pypatchmatch 0.1.3 in order to install Makefile where it needs to be. - Restored "-e ." as the last install step on pip installs. Hopefully this will not trigger the high-CPU hang we've previously experienced. * keep windows on basicsr 1.4.1 * keep windows on basicsr 1.4.1 * bump pypatchmatch requirement to 0.1.4 - This brings in a version of pypatchmatch that will gracefully handle internet connection not available at startup time. - Also refactors and simplifies the handling of gfpgan's basicsr requirement across various platforms. * revert to older version of list_models() (#1611) This restores the correct behavior of list_models() and quenches the bug of list_models() returning a single model entry named "name". I have not investigated what was wrong with the new version, but I think it may have to do with changes to the behavior in dict.update() * Fixes for #1604 (#1605) * Converts ESRGAN image input to RGB - Also adds typing for image input. - Partially resolves #1604 * ensure there are unmasked pixels before color matching Co-authored-by: Kyle Schouviller <kyle0654@hotmail.com> * update index.md (#1609) - comment out non existing link - fix indention - add seperator between feature categories * Debloat-docker (#1612) * debloat Dockerfile - less options more but more userfriendly - better Entrypoint to simulate CLI usage - without command the container still starts the web-host * debloat build.sh * better syntax in run.sh * update Docker docs - fix description of VOLUMENAME - update run script example to reflect new entrypoint * Test installer (#1618) * test linux install * try removing http from parsed requirements * pip install confirmed working on linux * ready for linux testing - rebuilt py3.10-linux-x86_64-cuda-reqs.txt to include pypatchmatch dependency. - point install.sh and install.bat to test-installer branch. * Updates MPS reqs * detect broken readline history files * fix download.pytorch.org URL * Test installer (Win 11) (#1620) Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> * Test installer (MacOS 13.0.1 w/ torch==1.12.0) (#1621) * Test installer (Win 11) * Test installer (MacOS 13.0.1 w/ torch==1.12.0) Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> * change sourceball to development for testing * Test installer (MacOS 13.0.1 w/ torch==1.12.1 & torchvision==1.13.1) (#1622) * Test installer (Win 11) * Test installer (MacOS 13.0.1 w/ torch==1.12.0) * Test installer (MacOS 13.0.1 w/ torch==1.12.1 & torchvision==1.13.1) Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Co-authored-by: Cyrus Chan <82143712+cyruschan360@users.noreply.github.com> Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> * 2.2 Doc Updates (#1589) * Unified Canvas Docs & Assets Unified Canvas draft Advanced Tools Updates Doc Updates (lstein feedback) * copy edits to Unified Canvas docs - consistent capitalisation and feature naming - more intimate address (replace "the user" with "you") for improved User Engagement(tm) - grammatical massaging and *poesie* Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> Co-authored-by: damian <git@damianstewart.com> * include a step after config to `cat ~/.invokeai` (#1629) * disable patchmatch in CI actions (#1626) * disable patchmatch in CI actions * fix indention * replace tab with spaces Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> * Fix installer script for macOS. (#1630) * refer to the platform as 'osx' instead of 'mac', otherwise the composed URL to micromamba is wrong. * move the `-O` option to `tar` to be grouped with the other tar flags to avoid the `-O` being interpreted as something to unarchive. * Removes symlinked environment.yaml (#1631) Was unintentionally added in #1621 * Fix inpainting with iterations (#1635) * fix error when inpainting using runwayml inpainting model (#1634) - error was "Omnibus object has no attribute pil_image" - closes #1596 * add k_dpmpp_2_a and k_dpmpp_2 solvers options (#1389) * add k_dpmpp_2_a and k_dpmpp_2 solvers options * update frontend Co-authored-by: Victor <victorca25@users.noreply.github.com> Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> * add .editorconfig (#1636) * Web UI 2.2 bugfixes (#1572) * Fixes bug preventing multiple images from being generated * Fixes valid seam strength value range * Update Delete Alert Text Indicates to the user that images are not permanently deleted. * Fixes left/right arrows not working on gallery * Fixes initial image on load erroneously set to a user uploaded image Should be a result gallery image. * Lightbox Fixes - Lightbox is now a button in the current image buttons - Lightbox is also now available in the gallery context menu - Lightbox zoom issues fixed - Lightbox has a fade in animation. * Fix image display wrapper in current preview not overflow bounds * Revert "Fix image display wrapper in current preview not overflow bounds" This reverts commit 5511c82714dbf1d1999d64e8bc357bafa34ddf37. * Change Staging Area discard icon from Bin to X * Expose Snap Threshold and Move Snap Settings to BBox Panel * Changes img2img strength default to 0.75 * Fixes drawing triggering when mouse enters canvas w/ button down When we only supported inpainting and no zoom, this was useful. It allowed the cursor to leave the canvas (which was easy to do given the limited canvas dimensions) and without losing the "I am drawing" state. With a zoomable canvas this is no longer as useful. Additionally, we have more popovers and tools (like the color pickers) which result in unexpected brush strokes. This fixes that issue. * Revert "Expose Snap Threshold and Move Snap Settings to BBox Panel" We will handle this a bit differently - by allowing the grid origin to be moved. I will dig in at some point. This reverts commit 33c92ecf4da724c2f17d9d91c7ea31a43a2f6deb. * Adds Limit Strokes to Box * Adds fill bounding box button * Adds erase bounding box button * Changes Staging area discard icon to match others * Fixes right click breaking move tool * Fixes brush preview visibility issue with "darken outside box" * Fixes history bugs with addFillRect, addEraseRect, and other actions * Adds missing `key` * Fixes postprocessing being applied to canvas generations * Fixes bbox not getting scaled in various situations * Fixes staging area show image toggle not resetting on accept/discard * Locks down canvas while generating/staging * Fixes move tool breaking when canvas loses focus during move/transform * Hides cursor when restrict strokes is on and mouse outside bbox * Lints * Builds fresh bundle * Fix overlapping hotkey for Fill Bounding Box * Build Fresh Bundle * Fixes bug with mask and bbox overlay * Builds fresh bundle Co-authored-by: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> * disable NSFW checker loading during the CI tests (#1641) * disable NSFW checker loading during the CI tests The NSFW filter apparently causes invoke.py to crash during CI testing, possibly due to out of memory errors. This workaround disables NSFW model loading. * doc change * fix formatting errors in yml files * Configure the NSFW checker at install time with default on (#1624) * configure the NSFW checker at install time with default on 1. Changes the --safety_checker argument to --nsfw_checker and --no-nsfw_checker. The original argument is recognized for backward compatibility. 2. The configure script asks users whether to enable the checker (default yes). Also offers users ability to select default sampler and number of generation steps. 3.Enables the pasting of the caution icon on blurred images when InvokeAI is installed into the package directory. 4. Adds documentation for the NSFW checker, including caveats about accuracy, memory requirements, and intermediate image dispaly. * use better fitting icon * NSFW defaults false for testing * set default back to nsfw active Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> Signed-off-by: devops117 <55235206+devops117@users.noreply.github.com> Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Co-authored-by: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Co-authored-by: Kyle Schouviller <kyle0654@hotmail.com> Co-authored-by: javl <mail@jaspervanloenen.com> Co-authored-by: Kent Keirsey <31807370+hipsterusername@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com> Co-authored-by: Damian Stewart <d@damianstewart.com> Co-authored-by: DevOps117 <55235206+devops117@users.noreply.github.com> Co-authored-by: damian <git@damianstewart.com> Co-authored-by: Damian Stewart <null@damianstewart.com> Co-authored-by: Cyrus Chan <82143712+cyruschan360@users.noreply.github.com> Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> Co-authored-by: Andre LaBranche <dre@mac.com> Co-authored-by: victorca25 <41912303+victorca25@users.noreply.github.com> Co-authored-by: Victor <victorca25@users.noreply.github.com>
2022-11-30 21:12:23 +00:00
def correct_colors(self,
image_list,
reference_image_path,
image_callback = None):
reference_image = Image.open(reference_image_path)
correction_target = cv2.cvtColor(np.asarray(reference_image),
cv2.COLOR_RGB2LAB)
for r in image_list:
image, seed = r
image = cv2.cvtColor(np.asarray(image),
cv2.COLOR_RGB2LAB)
image = skimage.exposure.match_histograms(image,
correction_target,
channel_axis=2)
image = Image.fromarray(
cv2.cvtColor(image, cv2.COLOR_LAB2RGB).astype("uint8")
)
if image_callback is not None:
image_callback(image, seed)
else:
r[0] = image
Refactoring simplet2i (#387) * start refactoring -not yet functional * first phase of refactor done - not sure weighted prompts working * Second phase of refactoring. Everything mostly working. * The refactoring has moved all the hard-core inference work into ldm.dream.generator.*, where there are submodules for txt2img and img2img. inpaint will go in there as well. * Some additional refactoring will be done soon, but relatively minor work. * fix -save_orig flag to actually work * add @neonsecret attention.py memory optimization * remove unneeded imports * move token logging into conditioning.py * add placeholder version of inpaint; porting in progress * fix crash in img2img * inpainting working; not tested on variations * fix crashes in img2img * ported attention.py memory optimization #117 from basujindal branch * added @torch_no_grad() decorators to img2img, txt2img, inpaint closures * Final commit prior to PR against development * fixup crash when generating intermediate images in web UI * rename ldm.simplet2i to ldm.generate * add backward-compatibility simplet2i shell with deprecation warning * add back in mps exception, addresses @vargol comment in #354 * replaced Conditioning class with exported functions * fix wrong type of with_variations attribute during intialization * changed "image_iterator()" to "get_make_image()" * raise NotImplementedError for calling get_make_image() in parent class * Update ldm/generate.py better error message Co-authored-by: Kevin Gibbons <bakkot@gmail.com> * minor stylistic fixes and assertion checks from code review * moved get_noise() method into img2img class * break get_noise() into two methods, one for txt2img and the other for img2img * inpainting works on non-square images now * make get_noise() an abstract method in base class * much improved inpainting Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
2022-09-06 00:40:10 +00:00
def upscale_and_reconstruct(self,
image_list,
facetool = 'gfpgan',
Refactoring simplet2i (#387) * start refactoring -not yet functional * first phase of refactor done - not sure weighted prompts working * Second phase of refactoring. Everything mostly working. * The refactoring has moved all the hard-core inference work into ldm.dream.generator.*, where there are submodules for txt2img and img2img. inpaint will go in there as well. * Some additional refactoring will be done soon, but relatively minor work. * fix -save_orig flag to actually work * add @neonsecret attention.py memory optimization * remove unneeded imports * move token logging into conditioning.py * add placeholder version of inpaint; porting in progress * fix crash in img2img * inpainting working; not tested on variations * fix crashes in img2img * ported attention.py memory optimization #117 from basujindal branch * added @torch_no_grad() decorators to img2img, txt2img, inpaint closures * Final commit prior to PR against development * fixup crash when generating intermediate images in web UI * rename ldm.simplet2i to ldm.generate * add backward-compatibility simplet2i shell with deprecation warning * add back in mps exception, addresses @vargol comment in #354 * replaced Conditioning class with exported functions * fix wrong type of with_variations attribute during intialization * changed "image_iterator()" to "get_make_image()" * raise NotImplementedError for calling get_make_image() in parent class * Update ldm/generate.py better error message Co-authored-by: Kevin Gibbons <bakkot@gmail.com> * minor stylistic fixes and assertion checks from code review * moved get_noise() method into img2img class * break get_noise() into two methods, one for txt2img and the other for img2img * inpainting works on non-square images now * make get_noise() an abstract method in base class * much improved inpainting Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
2022-09-06 00:40:10 +00:00
upscale = None,
strength = 0.0,
codeformer_fidelity = 0.75,
Refactoring simplet2i (#387) * start refactoring -not yet functional * first phase of refactor done - not sure weighted prompts working * Second phase of refactoring. Everything mostly working. * The refactoring has moved all the hard-core inference work into ldm.dream.generator.*, where there are submodules for txt2img and img2img. inpaint will go in there as well. * Some additional refactoring will be done soon, but relatively minor work. * fix -save_orig flag to actually work * add @neonsecret attention.py memory optimization * remove unneeded imports * move token logging into conditioning.py * add placeholder version of inpaint; porting in progress * fix crash in img2img * inpainting working; not tested on variations * fix crashes in img2img * ported attention.py memory optimization #117 from basujindal branch * added @torch_no_grad() decorators to img2img, txt2img, inpaint closures * Final commit prior to PR against development * fixup crash when generating intermediate images in web UI * rename ldm.simplet2i to ldm.generate * add backward-compatibility simplet2i shell with deprecation warning * add back in mps exception, addresses @vargol comment in #354 * replaced Conditioning class with exported functions * fix wrong type of with_variations attribute during intialization * changed "image_iterator()" to "get_make_image()" * raise NotImplementedError for calling get_make_image() in parent class * Update ldm/generate.py better error message Co-authored-by: Kevin Gibbons <bakkot@gmail.com> * minor stylistic fixes and assertion checks from code review * moved get_noise() method into img2img class * break get_noise() into two methods, one for txt2img and the other for img2img * inpainting works on non-square images now * make get_noise() an abstract method in base class * much improved inpainting Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
2022-09-06 00:40:10 +00:00
save_original = False,
image_callback = None,
prefix = None,
):
Refactoring simplet2i (#387) * start refactoring -not yet functional * first phase of refactor done - not sure weighted prompts working * Second phase of refactoring. Everything mostly working. * The refactoring has moved all the hard-core inference work into ldm.dream.generator.*, where there are submodules for txt2img and img2img. inpaint will go in there as well. * Some additional refactoring will be done soon, but relatively minor work. * fix -save_orig flag to actually work * add @neonsecret attention.py memory optimization * remove unneeded imports * move token logging into conditioning.py * add placeholder version of inpaint; porting in progress * fix crash in img2img * inpainting working; not tested on variations * fix crashes in img2img * ported attention.py memory optimization #117 from basujindal branch * added @torch_no_grad() decorators to img2img, txt2img, inpaint closures * Final commit prior to PR against development * fixup crash when generating intermediate images in web UI * rename ldm.simplet2i to ldm.generate * add backward-compatibility simplet2i shell with deprecation warning * add back in mps exception, addresses @vargol comment in #354 * replaced Conditioning class with exported functions * fix wrong type of with_variations attribute during intialization * changed "image_iterator()" to "get_make_image()" * raise NotImplementedError for calling get_make_image() in parent class * Update ldm/generate.py better error message Co-authored-by: Kevin Gibbons <bakkot@gmail.com> * minor stylistic fixes and assertion checks from code review * moved get_noise() method into img2img class * break get_noise() into two methods, one for txt2img and the other for img2img * inpainting works on non-square images now * make get_noise() an abstract method in base class * much improved inpainting Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
2022-09-06 00:40:10 +00:00
for r in image_list:
image, seed = r
try:
if strength > 0:
2022-09-23 07:40:31 +00:00
if self.gfpgan is not None or self.codeformer is not None:
if facetool == 'gfpgan':
if self.gfpgan is None:
2022-09-23 07:40:31 +00:00
print('>> GFPGAN not found. Face restoration is disabled.')
else:
image = self.gfpgan.process(image, strength, seed)
if facetool == 'codeformer':
if self.codeformer is None:
print('>> CodeFormer not found. Face restoration is disabled.')
else:
cf_device = 'cpu' if str(self.device) == 'mps' else self.device
image = self.codeformer.process(image=image, strength=strength, device=cf_device, seed=seed, fidelity=codeformer_fidelity)
else:
print(">> Face Restoration is disabled.")
2022-09-25 22:11:59 +00:00
if upscale is not None:
if self.esrgan is not None:
if len(upscale) < 2:
upscale.append(0.75)
image = self.esrgan.process(
image, upscale[1], seed, int(upscale[0]))
else:
print(">> ESRGAN is disabled. Image not upscaled.")
Refactoring simplet2i (#387) * start refactoring -not yet functional * first phase of refactor done - not sure weighted prompts working * Second phase of refactoring. Everything mostly working. * The refactoring has moved all the hard-core inference work into ldm.dream.generator.*, where there are submodules for txt2img and img2img. inpaint will go in there as well. * Some additional refactoring will be done soon, but relatively minor work. * fix -save_orig flag to actually work * add @neonsecret attention.py memory optimization * remove unneeded imports * move token logging into conditioning.py * add placeholder version of inpaint; porting in progress * fix crash in img2img * inpainting working; not tested on variations * fix crashes in img2img * ported attention.py memory optimization #117 from basujindal branch * added @torch_no_grad() decorators to img2img, txt2img, inpaint closures * Final commit prior to PR against development * fixup crash when generating intermediate images in web UI * rename ldm.simplet2i to ldm.generate * add backward-compatibility simplet2i shell with deprecation warning * add back in mps exception, addresses @vargol comment in #354 * replaced Conditioning class with exported functions * fix wrong type of with_variations attribute during intialization * changed "image_iterator()" to "get_make_image()" * raise NotImplementedError for calling get_make_image() in parent class * Update ldm/generate.py better error message Co-authored-by: Kevin Gibbons <bakkot@gmail.com> * minor stylistic fixes and assertion checks from code review * moved get_noise() method into img2img class * break get_noise() into two methods, one for txt2img and the other for img2img * inpainting works on non-square images now * make get_noise() an abstract method in base class * much improved inpainting Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
2022-09-06 00:40:10 +00:00
except Exception as e:
print(
f'>> Error running RealESRGAN or GFPGAN. Your image was not upscaled.\n{e}'
)
if image_callback is not None:
image_callback(image, seed, upscaled=True, use_prefix=prefix)
Refactoring simplet2i (#387) * start refactoring -not yet functional * first phase of refactor done - not sure weighted prompts working * Second phase of refactoring. Everything mostly working. * The refactoring has moved all the hard-core inference work into ldm.dream.generator.*, where there are submodules for txt2img and img2img. inpaint will go in there as well. * Some additional refactoring will be done soon, but relatively minor work. * fix -save_orig flag to actually work * add @neonsecret attention.py memory optimization * remove unneeded imports * move token logging into conditioning.py * add placeholder version of inpaint; porting in progress * fix crash in img2img * inpainting working; not tested on variations * fix crashes in img2img * ported attention.py memory optimization #117 from basujindal branch * added @torch_no_grad() decorators to img2img, txt2img, inpaint closures * Final commit prior to PR against development * fixup crash when generating intermediate images in web UI * rename ldm.simplet2i to ldm.generate * add backward-compatibility simplet2i shell with deprecation warning * add back in mps exception, addresses @vargol comment in #354 * replaced Conditioning class with exported functions * fix wrong type of with_variations attribute during intialization * changed "image_iterator()" to "get_make_image()" * raise NotImplementedError for calling get_make_image() in parent class * Update ldm/generate.py better error message Co-authored-by: Kevin Gibbons <bakkot@gmail.com> * minor stylistic fixes and assertion checks from code review * moved get_noise() method into img2img class * break get_noise() into two methods, one for txt2img and the other for img2img * inpainting works on non-square images now * make get_noise() an abstract method in base class * much improved inpainting Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
2022-09-06 00:40:10 +00:00
else:
r[0] = image
def apply_textmask(self, image_path:str, prompt:str, callback, threshold:float=0.5):
Merge dev into main for 2.2.0 (#1642) * Fixes inpainting + code cleanup * Disable stage info in Inpainting Tab * Mask Brush Preview now always at 0.5 opacity The new mask is only visible properly at max opacity but at max opacity the brush preview becomes fully opaque blocking the view. So the mask brush preview no remains at 0.5 no matter what the Brush opacity is. * Remove save button from Canvas Controls (cleanup) * Implements invert mask * Changes "Invert Mask" to "Preserve Masked Areas" * Fixes (?) spacebar issues * Patches redux-persist and redux-deep-persist with debounced persists Our app changes redux state very, very often. As our undo/redo history grows, the calls to persist state start to take in the 100ms range, due to a the deep cloning of the history. This causes very noticeable performance lag. The deep cloning is required because we need to blacklist certain items in redux from being persisted (e.g. the app's connection status). Debouncing the whole process of persistence is a simple and effective solution. Unfortunately, `redux-persist` dropped `debounce` between v4 and v5, replacing it with `throttle`. `throttle`, instead of delaying the expensive action until a period of X ms of inactivity, simply ensures the action is executed at least every X ms. Of course, this does not fix our performance issue. The patch is very simple. It adds a `debounce` argument - a number of milliseconds - and debounces `redux-persist`'s `update()` method (provided by `createPersistoid`) by that many ms. Before this, I also tried writing a custom storage adapter for `redux-persist` to debounce the calls to `localStorage.setItem()`. While this worked and was far less invasive, it doesn't actually address the issue. It turns out `setItem()` is a very fast part of the process. We use `redux-deep-persist` to simplify the `redux-persist` configuration, which can get complicated when you need to blacklist or whitelist deeply nested state. There is also a patch here for that library because it uses the same types as `redux-persist`. Unfortunately, the last release of `redux-persist` used a package `flat-stream` which was malicious and has been removed from npm. The latest commits to `redux-persist` (about 1 year ago) do not build; we cannot use the master branch. And between the last release and last commit, the changes have all been breaking. Patching this last release (about 3 years old at this point) directly is far simpler than attempting to fix the upstream library's master branch or figuring out an alternative to the malicious and now non-existent dependency. * Adds debouncing * Fixes AttributeError: 'dict' object has no attribute 'invert_mask' * Updates package.json to use redux-persist patches * Attempts to fix redux-persist debounce patch * Fixes undo/redo * Fixes invert mask * Debounce > 300ms * Limits history to 256 for each of undo and redo * Canvas styling * Hotkeys improvement * Add Metadata To Viewer * Increases CFG Scale max to 200 * Fix gallery width size for Outpainting Also fixes the canvas resizing failing n fast pushes * Fixes disappearing canvas grid lines * Adds staging area * Fixes "use all" not setting variationAmount Now sets to 0 when the image had variations. * Builds fresh bundle * Outpainting tab loads to empty canvas instead of upload * Fixes wonky canvas layer ordering & compositing * Fixes error on inpainting paste back `TypeError: 'float' object cannot be interpreted as an integer` * Hides staging area outline on mouseover prev/next * Fixes inpainting not doing img2img when no mask * Fixes bbox not resizing in outpainting if partially off screen * Fixes crashes during iterative outpaint. Still doesn't work correctly though. * Fix iterative outpainting by restoring original images * Moves image uploading to HTTP - It all seems to work fine - A lot of cleanup is still needed - Logging needs to be added - May need types to be reviewed * Fixes: outpainting temp images show in gallery * WIP refactor to unified canvas * Removes console.log from redux-persist patch * Initial unification of canvas * Removes all references to split inpainting/outpainting canvas * Add patchmatch and infill_method parameter to prompt2image (options are 'patchmatch' or 'tile'). * Fixes app after removing in/out-painting refs * Rebases on dev, updates new env files w/ patchmatch * Organises features/canvas * Fixes bounding box ending up offscreen * Organises features/canvas * Stops unnecessary canvas rescales on gallery state change * Fixes 2px layout shift on toggle canvas lock * Clips lines drawn while canvas locked When drawing with the locked canvas, if a brush stroke gets too close to the edge of the canvas and its stroke would extend past the edge of the canvas, the edge of that stroke will be seen after unlocking the canvas. This could cause a problem if you unlock the canvas and now have a bunch of strokes just outside the init image area, which are far back in undo history and you cannot easily erase. With this change, lines drawn while the canvas is locked get clipped to the initial image bbox, fixing this issue. Additionally, the merge and save to gallery functions have been updated to respect the initial image bbox so they function how you'd expect. * Fixes reset canvas view when locked * Fixes send to buttons * Fixes bounding box not being rounded to 64 * Abandons "inpainting" canvas lock * Fixes save to gallery including empty area, adds download and copy image * Fix Current Image display background going over image bounds * Sets status immediately when clicking Invoke * Adds hotkeys and refactors sharing of konva instances Adds hotkeys to canvas. As part of this change, the access to konva instance objects was refactored: Previously closure'd refs were used to indirectly get access to the konva instances outside of react components. Now, a getter and setter function are used to provide access directly to the konva objects. * Updates hotkeys * Fixes canvas showing spinner on first load Also adds good default canvas scale and positioning when no image is on it * Fixes possible hang on MaskCompositer * Improves behaviour when setting init canvas image/reset view * Resets bounding box coords/dims when no image present * Disables canvas actions which cannot be done during processing * Adds useToastWatcher hook - Dispatch an `addToast` action with standard Chakra toast options object to add a toast to the toastQueue - The hook is called in App.tsx and just useEffect's w/ toastQueue as dependency to create the toasts - So now you can add toasts anywhere you have access to `dispatch`, which includes middleware and thunks - Adds first usage of this for the save image buttons in canvas * Update Hotkey Info Add missing tooltip hotkeys and update the hotkeys modal to reflect the new hotkeys for the Unified Canvas. * Fix theme changer not displaying current theme on page refresh * Fix tab count in hotkeys panel * Unify Brush and Eraser Sizes * Fix staging area display toggle not working * Staging Area delete button is now red So it doesnt feel blended into to the rest of them. * Revert "Fix theme changer not displaying current theme on page refresh" This reverts commit 903edfb803e743500242589ff093a8a8a0912726. * Add arguments to use SSL to webserver * Integrates #1487 - touch events Need to add: - Pinch zoom - Touch-specific handling (some things aren't quite right) * Refactors upload-related async thunks - Now standard thunks instead of RTK createAsyncThunk() - Adds toasts for all canvas upload-related actions * Reorganises app file structure * Fixes Canvas Auto Save to Gallery * Fixes staging area outline * Adds staging area hotkeys, disables gallery left/right when staging * Fixes Use All Parameters * Fix metadata viewer image url length when viewing intermediate * Fixes intermediate images being tiny in txt2img/img2img * Removes stale code * Improves canvas status text and adds option to toggle debug info * Fixes paste image to upload * Adds model drop-down to site header * Adds theme changer popover * Fix missing key on ThemeChanger map * Fixes stage position changing on zoom * Hotkey Cleanup - Viewer is now Z - Canvas Move tool is V - sync with PS - Removed some unused hotkeys * Fix canvas resizing when both options and gallery are unpinned * Implements thumbnails for gallery - Thumbnails are saved whenever an image is saved, and when gallery requests images from server - Thumbnails saved at original image aspect ratio with width of 128px as WEBP - If the thumbnail property of an image is unavailable for whatever reason, the image's full size URL is used instead * Saves thumbnails to separate thumbnails directory * Thumbnail size = 256px * Fix Lightbox Issues * Disables canvas image saving functions when processing * Fix index error on going past last image in Gallery * WIP - Lightbox Fixes Still need to fix the images not being centered on load when the image res changes * Fixes another similar index error, simplifies logic * Reworks canvas toolbar * Fixes canvas toolbar upload button * Cleans up IAICanvasStatusText * Improves metadata handling, fixes #1450 - Removes model list from metadata - Adds generation's specific model to metadata - Displays full metadata in JSON viewer * Gracefully handles corrupted images; fixes #1486 - App does not crash if corrupted image loaded - Error is displayed in the UI console and CLI output if an image cannot be loaded * Adds hotkey to reset canvas interaction state If the canvas' interaction state (e.g. isMovingBoundingBox, isDrawing, etc) get stuck somehow, user can press Escape to reset the state. * Removes stray console.log() * Fixes bug causing gallery to close on context menu open * Minor bugfixes - When doing long-running canvas image exporting actions, display indeterminate progress bar - Fix staging area image outline not displaying after committing/discarding results * Removes unused imports * Fixes repo root .gitignore ignoring frontend things * Builds fresh bundle * Styling updates * Removes reasonsWhyNotReady The popover doesn't play well with the button being disabled, and I don't think adds any value. * Image gallery resize/style tweaks * Styles buttons for clearing canvas history and mask * First pass on Canvas options panel * Fixes bug where discarding staged images results in loss of history * Adds Save to Gallery button to staging toolbar * Rearrange some canvas toolbar icons Put brush stuff together and canvas movement stuff together * Fix gallery maxwidth on unified canvas * Update Layer hotkey display to UI * Adds option to crop to bounding box on save * Masking option tweaks * Crop to Bounding Box > Save Box Region Only * Adds clear temp folder * Updates mask options popover behavior * Builds fresh bundle * Fix styling on alert modals * Fix input checkbox styling being incorrect on light theme * Styling fixes * Improves gallery resize behaviour * Cap gallery size on canvas tab so it doesnt overflow * Fixes bug when postprocessing image with no metadata * Adds IAIAlertDialog component * Moves Loopback to app settings * Fixes metadata viewer not showing metadata after refresh Also adds Dream-style prompt to metadata * Adds outpainting specific options * Linting * Fixes gallery width on lightbox, fixes gallery button expansion * Builds fresh bundle * Fix Lightbox images of different res not centering * Update feature tooltip text * Highlight mask icon when on mask layer * Fix gallery not resizing correctly on open and close * Add loopback to just img2img. Remove from settings. * Fix to gallery resizing * Removes Advanced checkbox, cleans up options panel for unified canvas * Minor styling fixes to new options panel layout * Styling Updates * Adds infill method * Tab Styling Fixes * memoize outpainting options * Fix unnecessary gallery re-renders * Isolate Cursor Pos debug text on canvas to prevent rerenders * Fixes missing postprocessed image metadata before refresh * Builds fresh bundle * Fix rerenders on model select * Floating panel re-render fix * Simplify fullscreen hotkey selector * Add Training WIP Tab * Adds Training icon * Move full screen hotkey to floating to prevent tab rerenders * Adds single-column gallery layout * Fixes crash on cancel with intermediates enabled, fixes #1416 * Updates npm dependencies * Fixes img2img attempting inpaint when init image has transparency * Fixes missing threshold and perlin parameters in metadata viewer * Renames "Threshold" > "Noise Threshold" * Fixes postprocessing not being disabled when clicking use all * Builds fresh bundle * Adds color picker * Lints & builds fresh bundle * Fixes iterations being disabled when seed random & variations are off * Un-floors cursor position * Changes color picker preview to circles * Fixes variation params not set correctly when recalled * Fixes invoke hotkey not working in input fields * Simplifies Accordion Prep for adding reset buttons for each section * Fixes mask brush preview color * Committing color picker color changes tool to brush * Color picker does not overwrite user-selected alpha * Adds brush color alpha hotkey * Lints * Removes force_outpaint param * Add inpaint size options to inpaint at a larger size than the actual inpaint image, then scale back down for recombination * Bug fix for inpaint size * Adds inpaint size (as scale bounding box) to UI * Adds auto-scaling for inpaint size * Improves scaled bbox display logic * Fixes bug with clear mask and history * Fixes shouldShowStagingImage not resetting to true on commit * Builds fresh bundle * Fixes canvas failing to scale on first run * Builds fresh bundle * Fixes unnecessary canvas scaling * Adds gallery drag and drop to img2img/canvas * Builds fresh bundle * Fix desktop mode being broken with new versions of flaskwebgui * Fixes canvas dimensions not setting on first load * Builds fresh bundle * stop crash on !import_models call on model inside rootdir - addresses bug report #1546 * prevent "!switch state gets confused if model switching fails" - If !switch were to fail on a particular model, then generate got confused and wouldn't try again until you switch to a different working model and back again. - This commit fixes and closes #1547 * Revert "make the docstring more readable and improve the list_models logic" This reverts commit 248068fe5d57b5639ea7a87ee6cbf023104d957d. * fix model cache path * also set fail-fast to it's default (true) in this way the whole action fails if one job fails this should unblock the runners!!! * fix output path for Archive results * disable checks for python 3.9 * Update-requirements and test-invoke-pip workflow (#1574) * update requirements files * update test-invoke-pip workflow * move requirements-mkdocs.txt to docs folder (#1575) * move requirements-mkdocs.txt to docs folder * update copyright * Fixes outpainting with resized inpaint size * Interactive configuration (#1517) * Update scripts/configure_invokeai.py prevent crash if output exists Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> * implement changes requested by reviews * default to correct root and output directory on Windows systems - Previously the script was relying on the readline buffer editing feature to set up the correct default. But this feature doesn't exist on windows. - This commit detects when user typed return with an empty directory value and replaces with the default directory. * improved readability of directory choices * Update scripts/configure_invokeai.py Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> * better error reporting at startup - If user tries to run the script outside of the repo or runtime directory, a more informative message will appear explaining the problem. Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> * Embedding merging (#1526) * add whole <style token> to vocab for concept library embeddings * add ability to load multiple concept .bin files * make --log_tokenization respect custom tokens * start working on concept downloading system * preliminary support for dynamic loading and merging of multiple embedded models - The embedding_manager is now enhanced with ldm.invoke.concepts_lib, which handles dynamic downloading and caching of embedded models from the Hugging Face concepts library (https://huggingface.co/sd-concepts-library) - Downloading of a embedded model is triggered by the presence of one or more <concept> tags in the prompt. - Once the embedded model is downloaded, its trigger phrase will be loaded into the embedding manager and the prompt's <concept> tag will be replaced with the <trigger_phrase> - The downloaded model stays on disk for fast loading later. - The CLI autocomplete will complete partial <concept> tags for you. Type a '<' and hit tab to get all ~700 concepts. BUGS AND LIMITATIONS: - MODEL NAME VS TRIGGER PHRASE You must use the name of the concept embed model from the SD library, and not the trigger phrase itself. Usually these are the same, but not always. For example, the model named "hoi4-leaders" corresponds to the trigger "<HOI4-Leader>" One reason for this design choice is that there is no apparent constraint on the uniqueness of the trigger phrases and one trigger phrase may map onto multiple models. So we use the model name instead. The second reason is that there is no way I know of to search Hugging Face for models with certain trigger phrases. So we'd have to download all 700 models to index the phrases. The problem this presents is that this may confuse users, who will want to reuse prompts from distributions that use the trigger phrase directly. Usually this will work, but not always. - WON'T WORK ON A FIREWALLED SYSTEM If the host running IAI has no internet connection, it can't download the concept libraries. I will add a script that allows users to preload a list of concept models. - BUG IN PROMPT REPLACEMENT WHEN MODEL NOT FOUND There's a small bug that occurs when the user provides an invalid model name. The <concept> gets replaced with <None> in the prompt. * fix loading .pt embeddings; allow multi-vector embeddings; warn on dupes * simplify replacement logic and remove cuda assumption * download list of concepts from hugging face * remove misleading customization of '*' placeholder the existing code as-is did not do anything; unclear what it was supposed to do. the obvious alternative -- setting using 'placeholder_strings' instead of 'placeholder_tokens' to match model.params.personalization_config.params.placeholder_strings -- caused a crash. i think this is because the passed string also needed to be handed over on init of the PersonalizedBase as the 'placeholder_token' argument. this is weird config dict magic and i don't want to touch it. put a breakpoint in personalzied.py line 116 (top of PersonalizedBase.__init__) if you want to have a crack at it yourself. * address all the issues raised by damian0815 in review of PR #1526 * actually resize the token_embeddings * multiple improvements to the concept loader based on code reviews 1. Activated the --embedding_directory option (alias --embedding_path) to load a single embedding or an entire directory of embeddings at startup time. 2. Can turn off automatic loading of embeddings using --no-embeddings. 3. Embedding checkpoints are scanned with the pickle scanner. 4. More informative error messages when a concept can't be loaded due either to a 404 not found error or a network error. * autocomplete terms end with ">" now * fix startup error and network unreachable 1. If the .invokeai file does not contain the --root and --outdir options, invoke.py will now fix it. 2. Catch and handle network problems when downloading hugging face textual inversion concepts. * fix misformatted error string Co-authored-by: Damian Stewart <d@damianstewart.com> * model_cache.py: fix list_models Signed-off-by: devops117 <55235206+devops117@users.noreply.github.com> * add statement of values (#1584) * this adds the Statement of Values Google doc source = https://docs.google.com/document/d/1-PrUKDJcxy8OyNGc8CyiHhv2VgLvjt7LRGlEpbg1nmQ/edit?usp=sharing * Fix heading * Update InvokeAI_Statement_of_Values.md * Update InvokeAI_Statement_of_Values.md * Update InvokeAI_Statement_of_Values.md * Update InvokeAI_Statement_of_Values.md * Update InvokeAI_Statement_of_Values.md * add keturn and mauwii to the team member list * Fix punctuation * this adds the Statement of Values Google doc source = https://docs.google.com/document/d/1-PrUKDJcxy8OyNGc8CyiHhv2VgLvjt7LRGlEpbg1nmQ/edit?usp=sharing * add keturn and mauwii to the team member list * fix formating - make sub bullets use * (decide to all use - or *) - indent sub bullets Sorry, first only looked at the code version and found this only after looking at the markdown rendered version * use multiparagraph numbered sections * Break up Statement Of Values as per comments on #1584 * remove duplicated word, reduce vagueness it's important not to overstate how many artists we are consulting. * fix typo (sorry blessedcoolant) Co-authored-by: mauwii <Mauwii@outlook.de> Co-authored-by: damian <git@damianstewart.com> * update dockerfile (#1551) * update dockerfile * remove not existing file from .dockerignore * remove bloat and unecesary step also use --no-cache-dir for pip install image is now close to 2GB * make Dockerfile a variable * set base image to `ubuntu:22.10` * add build-essential * link outputs folder for persistence * update tag variable * update docs * fix not customizeable build args, add reqs output * !model_import autocompletes in ROOTDIR * Adds psychedelicious to statement of values signature (#1602) * add a --no-patchmatch option to disable patchmatch loading (#1598) This feature was added to prevent the CI Macintosh tests from erroring out when patchmatch is unable to retrieve its shared library from github assets. * Fix #1599 by relaxing the `match_trigger` regex (#1601) * Fix #1599 by relaxing the `match_trigger` regex Also simplify logic and reduce duplication. * restrict trigger regex again (but not so far) * make concepts library work with Web UI This PR makes it possible to include a Hugging Face concepts library <style-or-subject-trigger> in the WebUI prompt. The metadata seems to be correctly handled. * documentation enhancements (#1603) - Add documentation for the Hugging Face concepts library and TI embedding. - Fixup index.md to point to each of the feature documentation files, including ones that are pending. * tweak setup and environment files for linux & pypatchmatch (#1580) * tweak setup and environment files for linux & pypatchmatch - Downgrade python requirements to 3.9 because 3.10 is not supported on Ubuntu 20.04 LTS (widely-used distro) - Use our github pypatchmatch 0.1.3 in order to install Makefile where it needs to be. - Restored "-e ." as the last install step on pip installs. Hopefully this will not trigger the high-CPU hang we've previously experienced. * keep windows on basicsr 1.4.1 * keep windows on basicsr 1.4.1 * bump pypatchmatch requirement to 0.1.4 - This brings in a version of pypatchmatch that will gracefully handle internet connection not available at startup time. - Also refactors and simplifies the handling of gfpgan's basicsr requirement across various platforms. * revert to older version of list_models() (#1611) This restores the correct behavior of list_models() and quenches the bug of list_models() returning a single model entry named "name". I have not investigated what was wrong with the new version, but I think it may have to do with changes to the behavior in dict.update() * Fixes for #1604 (#1605) * Converts ESRGAN image input to RGB - Also adds typing for image input. - Partially resolves #1604 * ensure there are unmasked pixels before color matching Co-authored-by: Kyle Schouviller <kyle0654@hotmail.com> * update index.md (#1609) - comment out non existing link - fix indention - add seperator between feature categories * Debloat-docker (#1612) * debloat Dockerfile - less options more but more userfriendly - better Entrypoint to simulate CLI usage - without command the container still starts the web-host * debloat build.sh * better syntax in run.sh * update Docker docs - fix description of VOLUMENAME - update run script example to reflect new entrypoint * Test installer (#1618) * test linux install * try removing http from parsed requirements * pip install confirmed working on linux * ready for linux testing - rebuilt py3.10-linux-x86_64-cuda-reqs.txt to include pypatchmatch dependency. - point install.sh and install.bat to test-installer branch. * Updates MPS reqs * detect broken readline history files * fix download.pytorch.org URL * Test installer (Win 11) (#1620) Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> * Test installer (MacOS 13.0.1 w/ torch==1.12.0) (#1621) * Test installer (Win 11) * Test installer (MacOS 13.0.1 w/ torch==1.12.0) Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> * change sourceball to development for testing * Test installer (MacOS 13.0.1 w/ torch==1.12.1 & torchvision==1.13.1) (#1622) * Test installer (Win 11) * Test installer (MacOS 13.0.1 w/ torch==1.12.0) * Test installer (MacOS 13.0.1 w/ torch==1.12.1 & torchvision==1.13.1) Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Co-authored-by: Cyrus Chan <82143712+cyruschan360@users.noreply.github.com> Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> * 2.2 Doc Updates (#1589) * Unified Canvas Docs & Assets Unified Canvas draft Advanced Tools Updates Doc Updates (lstein feedback) * copy edits to Unified Canvas docs - consistent capitalisation and feature naming - more intimate address (replace "the user" with "you") for improved User Engagement(tm) - grammatical massaging and *poesie* Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> Co-authored-by: damian <git@damianstewart.com> * include a step after config to `cat ~/.invokeai` (#1629) * disable patchmatch in CI actions (#1626) * disable patchmatch in CI actions * fix indention * replace tab with spaces Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> * Fix installer script for macOS. (#1630) * refer to the platform as 'osx' instead of 'mac', otherwise the composed URL to micromamba is wrong. * move the `-O` option to `tar` to be grouped with the other tar flags to avoid the `-O` being interpreted as something to unarchive. * Removes symlinked environment.yaml (#1631) Was unintentionally added in #1621 * Fix inpainting with iterations (#1635) * fix error when inpainting using runwayml inpainting model (#1634) - error was "Omnibus object has no attribute pil_image" - closes #1596 * add k_dpmpp_2_a and k_dpmpp_2 solvers options (#1389) * add k_dpmpp_2_a and k_dpmpp_2 solvers options * update frontend Co-authored-by: Victor <victorca25@users.noreply.github.com> Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> * add .editorconfig (#1636) * Web UI 2.2 bugfixes (#1572) * Fixes bug preventing multiple images from being generated * Fixes valid seam strength value range * Update Delete Alert Text Indicates to the user that images are not permanently deleted. * Fixes left/right arrows not working on gallery * Fixes initial image on load erroneously set to a user uploaded image Should be a result gallery image. * Lightbox Fixes - Lightbox is now a button in the current image buttons - Lightbox is also now available in the gallery context menu - Lightbox zoom issues fixed - Lightbox has a fade in animation. * Fix image display wrapper in current preview not overflow bounds * Revert "Fix image display wrapper in current preview not overflow bounds" This reverts commit 5511c82714dbf1d1999d64e8bc357bafa34ddf37. * Change Staging Area discard icon from Bin to X * Expose Snap Threshold and Move Snap Settings to BBox Panel * Changes img2img strength default to 0.75 * Fixes drawing triggering when mouse enters canvas w/ button down When we only supported inpainting and no zoom, this was useful. It allowed the cursor to leave the canvas (which was easy to do given the limited canvas dimensions) and without losing the "I am drawing" state. With a zoomable canvas this is no longer as useful. Additionally, we have more popovers and tools (like the color pickers) which result in unexpected brush strokes. This fixes that issue. * Revert "Expose Snap Threshold and Move Snap Settings to BBox Panel" We will handle this a bit differently - by allowing the grid origin to be moved. I will dig in at some point. This reverts commit 33c92ecf4da724c2f17d9d91c7ea31a43a2f6deb. * Adds Limit Strokes to Box * Adds fill bounding box button * Adds erase bounding box button * Changes Staging area discard icon to match others * Fixes right click breaking move tool * Fixes brush preview visibility issue with "darken outside box" * Fixes history bugs with addFillRect, addEraseRect, and other actions * Adds missing `key` * Fixes postprocessing being applied to canvas generations * Fixes bbox not getting scaled in various situations * Fixes staging area show image toggle not resetting on accept/discard * Locks down canvas while generating/staging * Fixes move tool breaking when canvas loses focus during move/transform * Hides cursor when restrict strokes is on and mouse outside bbox * Lints * Builds fresh bundle * Fix overlapping hotkey for Fill Bounding Box * Build Fresh Bundle * Fixes bug with mask and bbox overlay * Builds fresh bundle Co-authored-by: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> * disable NSFW checker loading during the CI tests (#1641) * disable NSFW checker loading during the CI tests The NSFW filter apparently causes invoke.py to crash during CI testing, possibly due to out of memory errors. This workaround disables NSFW model loading. * doc change * fix formatting errors in yml files * Configure the NSFW checker at install time with default on (#1624) * configure the NSFW checker at install time with default on 1. Changes the --safety_checker argument to --nsfw_checker and --no-nsfw_checker. The original argument is recognized for backward compatibility. 2. The configure script asks users whether to enable the checker (default yes). Also offers users ability to select default sampler and number of generation steps. 3.Enables the pasting of the caution icon on blurred images when InvokeAI is installed into the package directory. 4. Adds documentation for the NSFW checker, including caveats about accuracy, memory requirements, and intermediate image dispaly. * use better fitting icon * NSFW defaults false for testing * set default back to nsfw active Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> Signed-off-by: devops117 <55235206+devops117@users.noreply.github.com> Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Co-authored-by: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Co-authored-by: Kyle Schouviller <kyle0654@hotmail.com> Co-authored-by: javl <mail@jaspervanloenen.com> Co-authored-by: Kent Keirsey <31807370+hipsterusername@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com> Co-authored-by: Damian Stewart <d@damianstewart.com> Co-authored-by: DevOps117 <55235206+devops117@users.noreply.github.com> Co-authored-by: damian <git@damianstewart.com> Co-authored-by: Damian Stewart <null@damianstewart.com> Co-authored-by: Cyrus Chan <82143712+cyruschan360@users.noreply.github.com> Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> Co-authored-by: Andre LaBranche <dre@mac.com> Co-authored-by: victorca25 <41912303+victorca25@users.noreply.github.com> Co-authored-by: Victor <victorca25@users.noreply.github.com>
2022-11-30 21:12:23 +00:00
assert os.path.exists(image_path), f'** "{image_path}" not found. Please enter the name of an existing image file to mask **'
basename,_ = os.path.splitext(os.path.basename(image_path))
if self.txt2mask is None:
2022-11-02 22:29:34 +00:00
self.txt2mask = Txt2Mask(device = self.device, refined=True)
segmented = self.txt2mask.segment(image_path,prompt)
trans = segmented.to_transparent()
inverse = segmented.to_transparent(invert=True)
mask = segmented.to_mask(threshold)
path_filter = re.compile(r'[<>:"/\\|?*]')
safe_prompt = path_filter.sub('_', prompt)[:50].rstrip(' .')
callback(trans,f'{safe_prompt}.deselected',use_prefix=basename)
callback(inverse,f'{safe_prompt}.selected',use_prefix=basename)
callback(mask,f'{safe_prompt}.masked',use_prefix=basename)
Refactoring simplet2i (#387) * start refactoring -not yet functional * first phase of refactor done - not sure weighted prompts working * Second phase of refactoring. Everything mostly working. * The refactoring has moved all the hard-core inference work into ldm.dream.generator.*, where there are submodules for txt2img and img2img. inpaint will go in there as well. * Some additional refactoring will be done soon, but relatively minor work. * fix -save_orig flag to actually work * add @neonsecret attention.py memory optimization * remove unneeded imports * move token logging into conditioning.py * add placeholder version of inpaint; porting in progress * fix crash in img2img * inpainting working; not tested on variations * fix crashes in img2img * ported attention.py memory optimization #117 from basujindal branch * added @torch_no_grad() decorators to img2img, txt2img, inpaint closures * Final commit prior to PR against development * fixup crash when generating intermediate images in web UI * rename ldm.simplet2i to ldm.generate * add backward-compatibility simplet2i shell with deprecation warning * add back in mps exception, addresses @vargol comment in #354 * replaced Conditioning class with exported functions * fix wrong type of with_variations attribute during intialization * changed "image_iterator()" to "get_make_image()" * raise NotImplementedError for calling get_make_image() in parent class * Update ldm/generate.py better error message Co-authored-by: Kevin Gibbons <bakkot@gmail.com> * minor stylistic fixes and assertion checks from code review * moved get_noise() method into img2img class * break get_noise() into two methods, one for txt2img and the other for img2img * inpainting works on non-square images now * make get_noise() an abstract method in base class * much improved inpainting Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
2022-09-06 00:40:10 +00:00
# to help WebGUI - front end to generator util function
def sample_to_image(self, samples):
return self._make_base().sample_to_image(samples)
Refactoring simplet2i (#387) * start refactoring -not yet functional * first phase of refactor done - not sure weighted prompts working * Second phase of refactoring. Everything mostly working. * The refactoring has moved all the hard-core inference work into ldm.dream.generator.*, where there are submodules for txt2img and img2img. inpaint will go in there as well. * Some additional refactoring will be done soon, but relatively minor work. * fix -save_orig flag to actually work * add @neonsecret attention.py memory optimization * remove unneeded imports * move token logging into conditioning.py * add placeholder version of inpaint; porting in progress * fix crash in img2img * inpainting working; not tested on variations * fix crashes in img2img * ported attention.py memory optimization #117 from basujindal branch * added @torch_no_grad() decorators to img2img, txt2img, inpaint closures * Final commit prior to PR against development * fixup crash when generating intermediate images in web UI * rename ldm.simplet2i to ldm.generate * add backward-compatibility simplet2i shell with deprecation warning * add back in mps exception, addresses @vargol comment in #354 * replaced Conditioning class with exported functions * fix wrong type of with_variations attribute during intialization * changed "image_iterator()" to "get_make_image()" * raise NotImplementedError for calling get_make_image() in parent class * Update ldm/generate.py better error message Co-authored-by: Kevin Gibbons <bakkot@gmail.com> * minor stylistic fixes and assertion checks from code review * moved get_noise() method into img2img class * break get_noise() into two methods, one for txt2img and the other for img2img * inpainting works on non-square images now * make get_noise() an abstract method in base class * much improved inpainting Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
2022-09-06 00:40:10 +00:00
def sample_to_lowres_estimated_image(self, samples):
return self._make_base().sample_to_lowres_estimated_image(samples)
use 🧨diffusers model (#1583) * initial commit of DiffusionPipeline class * spike: proof of concept using diffusers for txt2img * doc: type hints for Generator * refactor(model_cache): factor out load_ckpt * model_cache: add ability to load a diffusers model pipeline and update associated things in Generate & Generator to not instantly fail when that happens * model_cache: fix model default image dimensions * txt2img: support switching diffusers schedulers * diffusers: let the scheduler do its scaling of the initial latents Remove IPNDM scheduler; it is not behaving. * web server: update image_progress callback for diffusers data * diffusers: restore prompt weighting feature * diffusers: fix set-sampler error following model switch * diffusers: use InvokeAIDiffuserComponent for conditioning * cross_attention_control: stub (no-op) implementations for diffusers * model_cache: let offload_model work with DiffusionPipeline, sorta. * models.yaml.example: add diffusers-format model, set as default * test-invoke-conda: use diffusers-format model test-invoke-conda: put huggingface-token where the library can use it * environment-mac: upgrade to diffusers 0.7 (from 0.6) this was already done for linux; mac must have been lost in the merge. * preload_models: explicitly load diffusers models In non-interactive mode too, as long as you're logged in. * fix(model_cache): don't check `model.config` in diffusers format clean-up from recent merge. * diffusers integration: support img2img * dev: upgrade to diffusers 0.8 (from 0.7.1) We get to remove some code by using methods that were factored out in the base class. * refactor: remove backported img2img.get_timesteps now that we can use it directly from diffusers 0.8.1 * ci: use diffusers model * dev: upgrade to diffusers 0.9 (from 0.8.1) * lint: correct annotations for Python 3.9. * lint: correct AttributeError.name reference for Python 3.9. * CI: prefer diffusers-1.4 because it no longer requires a token The RunwayML models still do. * build: there's yet another place to update requirements? * configure: try to download models even without token Models in the CompVis and stabilityai repos no longer require them. (But runwayml still does.) * configure: add troubleshooting info for config-not-found * fix(configure): prepend root to config path * fix(configure): remove second `default: true` from models example * CI: simplify test-on-push logic now that we don't need secrets The "test on push but only in forks" logic was only necessary when tests didn't work for PRs-from-forks. * create an embedding_manager for diffusers * internal: avoid importing diffusers DummyObject see https://github.com/huggingface/diffusers/issues/1479 * fix "config attributes…not expected" diffusers warnings. * fix deprecated scheduler construction * work around an apparent MPS torch bug that causes conditioning to have no effect * 🚧 post-rebase repair * preliminary support for outpainting (no masking yet) * monkey-patch diffusers.attention and use Invoke lowvram code * add always_use_cpu arg to bypass MPS * add cross-attention control support to diffusers (fails on MPS) For unknown reasons MPS produces garbage output with .swap(). Use --always_use_cpu arg to invoke.py for now to test this code on MPS. * diffusers support for the inpainting model * fix debug_image to not crash with non-RGB images. * inpainting for the normal model [WIP] This seems to be performing well until the LAST STEP, at which point it dissolves to confetti. * fix off-by-one bug in cross-attention-control (#1774) prompt token sequences begin with a "beginning-of-sequence" marker <bos> and end with a repeated "end-of-sequence" marker <eos> - to make a default prompt length of <bos> + 75 prompt tokens + <eos>. the .swap() code was failing to take the column for <bos> at index 0 into account. the changes here do that, and also add extra handling for a single <eos> (which may be redundant but which is included for completeness). based on my understanding and some assumptions about how this all works, the reason .swap() nevertheless seemed to do the right thing, to some extent, is because over multiple steps the conditioning process in Stable Diffusion operates as a feedback loop. a change to token n-1 has flow-on effects to how the [1x4x64x64] latent tensor is modified by all the tokens after it, - and as the next step is processed, all the tokens before it as well. intuitively, a token's conditioning effects "echo" throughout the whole length of the prompt. so even though the token at n-1 was being edited when what the user actually wanted was to edit the token at n, it nevertheless still had some non-negligible effect, in roughly the right direction, often enough that it seemed like it was working properly. * refactor common CrossAttention stuff into a mixin so that the old ldm code can still work if necessary * inpainting for the normal model. I think it works this time. * diffusers: reset num_vectors_per_token sync with 44a00555718f1df173c60da0ed646cf700e29537 * diffusers: txt2img2img (hires_fix) with so much slicing and dicing of pipeline methods to stitch them together * refactor(diffusers): reduce some code duplication amongst the different tasks * fixup! refactor(diffusers): reduce some code duplication amongst the different tasks * diffusers: enable DPMSolver++ scheduler * diffusers: upgrade to diffusers 0.10, add Heun scheduler * diffusers(ModelCache): stopgap to make from_cpu compatible with diffusers * CI: default to diffusers-1.5 now that runwayml token requirement is gone * diffusers: update to 0.10 (and transformers to 4.25) * diffusers: use xformers when available diffusers no longer auto-enables this as of 0.10.2. * diffusers: make masked img2img behave better with multi-step schedulers re-randomizing the noise each step was confusing them. * diffusers: work more better with more models. fixed relative path problem with local models. fixed models on hub not always having a `fp16` branch. * diffusers: stopgap fix for attention_maps_callback crash after recent merge * fixup import merge conflicts correction for 061c5369a2247c6c92cd69606bcf54c4f1962a0b * test: add tests/inpainting inputs for masked img2img * diffusers(AddsMaskedGuidance): partial fix for k-schedulers Prevents them from crashing, but results are still hot garbage. * fix --safety_checker arg parsing and add note to diffusers loader about where safety checker gets called * generate: fix import error * CI: don't try to read the old init location * diffusers: support loading an alternate VAE * CI: remove sh-syntax if-statement so it doesn't crash powershell * CI: fold strings in yaml because backslash is not line-continuation in powershell * attention maps callback stuff for diffusers * build: fix syntax error in environment-mac * diffusers: add INITIAL_MODELS with diffusers-compatible repos * re-enable the embedding manager; closes #1778 * Squashed commit of the following: commit e4a956abc37fcb5cf188388b76b617bc5c8fda7d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:43:07 2022 +0100 import new load handling from EmbeddingManager and cleanup commit c4abe91a5ba0d415b45bf734068385668b7a66e6 Merge: 032e856e 1efc6397 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:09:53 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers_with_textual_inversion_manager commit 032e856eefb3bbc39534f5daafd25764bcfcef8b Merge: 8b4f0fe9 bc515e24 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:08:01 2022 +0100 Merge remote-tracking branch 'upstream/dev/diffusers' into dev/diffusers_with_textual_inversion_manager commit 1efc6397fc6e61c1aff4b0258b93089d61de5955 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:04:28 2022 +0100 cleanup and add performance notes commit e400f804ac471a0ca2ba432fd658778b20c7bdab Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:45:07 2022 +0100 fix bug and update unit tests commit deb9ae0ae1016750e93ce8275734061f7285a231 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:28:29 2022 +0100 textual inversion manager seems to work commit 162e02505dec777e91a983c4d0fb52e950d25ff0 Merge: cbad4583 12769b3d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:58:03 2022 +0100 Merge branch 'main' into feature_textual_inversion_mgr commit cbad45836c6aace6871a90f2621a953f49433131 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:54:10 2022 +0100 use position embeddings commit 070344c69b0e0db340a183857d0a787b348681d3 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:53:47 2022 +0100 Don't crash CLI on exceptions commit b035ac8c6772dfd9ba41b8eeb9103181cda028f8 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:11:55 2022 +0100 add missing position_embeddings commit 12769b3d3562ef71e0f54946b532ad077e10043c Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:33:25 2022 +0100 debugging why it don't work commit bafb7215eabe1515ca5e8388fd3bb2f3ac5362cf Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:21:33 2022 +0100 debugging why it don't work commit 664a6e9e146b42d96703f0cc8baf8f5efec04ee1 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit 8b4f0fe9d6e4e2643b36dfa27864294785d7ba4e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit ffbe1ab11163ba712e353d89404e301d0e0c6cdf Merge: 6e4dad60 023df37e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:37:31 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers commit 023df37efffa67434f77def7fc3c9dfb29f699fd Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:36:54 2022 +0100 cleanup commit 05fac594eaf79d0058e3c48deee93df603f136c2 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:07:49 2022 +0100 tweak error checking commit 009f32ed39a7280997c3ffab112adadee0b44279 Author: damian <null@damianstewart.com> Date: Thu Dec 15 21:29:47 2022 +0100 unit tests passing for embeddings with vector length >1 commit beb1b08d9a98112ed2fe073580568e1a18698da3 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:39:09 2022 +0100 more explicit equality tests when overwriting commit 44d8a5a7c85cdabc9ce3a54fd0769a10597b3ca9 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:30:13 2022 +0100 wip textual inversion manager (unit tests passing for 1v embedding overwriting) commit 417c2b57d90924a839616bfb66804faab8039e4c Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 12:30:55 2022 +0100 wip textual inversion manager (unit tests passing for base stuff + padding) commit 2e80872e3b6f7fd7d8eb8928822bd824b63cb2ff Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 10:57:57 2022 +0100 wip new TextualInversionManager * stop using WeightedFrozenCLIPEmbedder * store diffusion models locally - configure_invokeai.py reconfigured to store diffusion models rather than CompVis models - hugging face caching model is used, but cache is set to ~/invokeai/models/repo_id - models.yaml does **NOT** use path, just repo_id - "repo_name" changed to "repo_id" to following hugging face conventions - Models are loaded with full precision pending further work. * allow non-local files during development * path takes priority over repo_id * MVP for model_cache and configure_invokeai - Feature complete (almost) - configure_invokeai.py downloads both .ckpt and diffuser models, along with their VAEs. Both types of download are controlled by a unified INITIAL_MODELS.yaml file. - model_cache can load both type of model and switches back and forth in CPU. No memory leaks detected TO DO: 1. I have not yet turned on the LocalOnly flag for diffuser models, so the code will check the Hugging Face repo for updates before using the locally cached models. This will break firewalled systems. I am thinking of putting in a global check for internet connectivity at startup time and setting the LocalOnly flag based on this. It would be good to check updates if there is connectivity. 2. I have not gone completely through INITIAL_MODELS.yaml to check which models are available as diffusers and which are not. So models like PaperCut and VoxelArt may not load properly. The runway and stability models are checked, as well as the Trinart models. 3. Add stanzas for SD 2.0 and 2.1 in INITIAL_MODELS.yaml REMAINING PROBLEMS NOT DIRECTLY RELATED TO MODEL_CACHE: 1. When loading a .ckpt file there are lots of messages like this: Warning! ldm.modules.attention.CrossAttention is no longer being maintained. Please use InvokeAICrossAttention instead. I'm not sure how to address this. 2. The ckpt models ***don't actually run*** due to the lack of special-case support for them in the generator objects. For example, here's the hard crash you get when you run txt2img against the legacy waifu-diffusion-1.3 model: ``` >> An error occurred: Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 140, in main main_loop(gen, opt) File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 371, in main_loop gen.prompt2image( File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1265, in __getattr__ raise AttributeError("'{}' object has no attribute '{}'".format( AttributeError: 'LatentDiffusion' object has no attribute 'image_from_embeddings' ``` 3. The inpainting diffusion model isn't working. Here's the output of "banana sushi" when inpainting-1.5 is loaded: ``` Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 301, in image_from_embeddings result_latents, result_attention_map_saver = self.latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 330, in latents_from_embeddings result: PipelineIntermediateState = infer_latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 185, in __call__ for result in self.generator_method(*args, **kwargs): File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 367, in generate_latents_from_embeddings step_output = self.step(batched_t, latents, guidance_scale, File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context return func(*args, **kwargs) File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 409, in step step_output = self.scheduler.step(noise_pred, timestep, latents, **extra_step_kwargs) File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/diffusers/schedulers/scheduling_lms_discrete.py", line 223, in step pred_original_sample = sample - sigma * model_output RuntimeError: The size of tensor a (9) must match the size of tensor b (4) at non-singleton dimension 1 ``` * proper support for float32/float16 - configure script now correctly detects user's preference for fp16/32 and downloads the correct diffuser version. If fp16 version not available, falls back to fp32 version. - misc code cleanup and simplification in model_cache * add on-the-fly conversion of .ckpt to diffusers models 1. On-the-fly conversion code can be found in the file ldm/invoke/ckpt_to_diffusers.py. 2. A new !optimize command has been added to the CLI. Should be ported to Web GUI. User experience on the CLI is this: ``` invoke> !optimize /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt INFO: Converting legacy weights file /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt to optimized diffuser model. This operation will take 30-60s to complete. Success. Optimized model is now located at /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 Writing new config file entry for sd-v1-4... >> New configuration: sd-v1-4: description: Optimized version of sd-v1-4 format: diffusers path: /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 OK to import [n]? y >> Verifying that new model loads... >> Current VRAM usage: 2.60G >> Offloading stable-diffusion-2.1 to CPU >> Loading diffusers model from /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 | Using faster float16 precision You have disabled the safety checker for <class 'ldm.invoke.generator.diffusers_pipeline.StableDiffusionGeneratorPipeline'> by passing `safety_checker=None`. Ensure that you abide to the conditions of the Stable Diffusion \ license and do not expose unfiltered results in services or applications open to the public. Both the diffusers team and Hugging Face strongly recommend to keep the safety filter enabled in all public facing circumstances,\ disabling it only for use-cases that involve analyzing network behavior or auditing its results. For more information, please have a look at https://github.com/huggingface/diffusers/pull/254 . | training width x height = (512 x 512) >> Model loaded in 3.48s >> Max VRAM used to load the model: 2.17G >> Current VRAM usage:2.17G >> Textual inversions available: >> Setting Sampler to k_lms (LMSDiscreteScheduler) Keep model loaded? [y] ``` * add parallel set of generator files for ckpt legacy generation * generation using legacy ckpt models now working * diffusers: fix missing attention_maps_callback fix for 23eb80b40421b2bb8f4b6d3dd30490d11c447b36 * associate legacy CrossAttention with .ckpt models * enable autoconvert New --autoconvert CLI option will scan a designated directory for new .ckpt files, convert them into diffuser models, and import them into models.yaml. Works like this: invoke.py --autoconvert /path/to/weights/directory In ModelCache added two new methods: autoconvert_weights(config_path, weights_directory_path, models_directory_path) convert_and_import(ckpt_path, diffuser_path) * diffusers: update to diffusers 0.11 (from 0.10.2) * fix vae loading & width/height calculation * refactor: encapsulate these conditioning data into one container * diffusers: fix some noise-scaling issues by pushing the noise-mixing down to the common function * add support for safetensors and accelerate * set local_files_only when internet unreachable * diffusers: fix error-handling path when model repo has no fp16 branch * fix generatorinpaint error Fixes : "ModuleNotFoundError: No module named 'ldm.invoke.generatorinpaint' https://github.com/invoke-ai/InvokeAI/pull/1583#issuecomment-1363634318 * quench diffuser safety-checker warning * diffusers: support stochastic DDIM eta parameter * fix conda env creation on macos * fix cross-attention with diffusers 0.11 * diffusers: the VAE needs to be tiling as well as the U-Net * diffusers: comment on subfolders * diffusers: embiggen! * diffusers: make model_cache.list_models serializable * diffusers(inpaint): restore scaling functionality * fix requirements clash between numba and numpy 1.24 * diffusers: allow inpainting model to do non-inpainting tasks * start expanding model_cache functionality * add import_ckpt_model() and import_diffuser_model() methods to model_manager - in addition, model_cache.py is now renamed to model_manager.py * allow "recommended" flag to be optional in INITIAL_MODELS.yaml * configure_invokeai now downloads VAE diffusers in advance * rename ModelCache to ModelManager * remove support for `repo_name` in models.yaml * check for and refuse to load embeddings trained on incompatible models * models.yaml.example: s/repo_name/repo_id and remove extra INITIAL_MODELS now that the main one has diffusers models in it. * add MVP textual inversion script * refactor(InvokeAIDiffuserComponent): factor out _combine() * InvokeAIDiffuserComponent: implement threshold * InvokeAIDiffuserComponent: diagnostic logs for threshold ...this does not look right * add a curses-based frontend to textual inversion - not quite working yet - requires npyscreen installed - on windows will also have the windows-curses requirement, but not added to requirements yet * add curses-based interface for textual inversion * fix crash in convert_and_import() - This corrects a "local variable referenced before assignment" error in model_manager.convert_and_import() * potential workaround for no 'state_dict' key error - As reported in https://github.com/huggingface/diffusers/issues/1876 * create TI output dir if needed * Update environment-lin-cuda.yml (#2159) Fixing line 42 to be the proper order to define the transformers requirement: ~= instead of =~ * diffusers: update sampler-to-scheduler mapping based on https://github.com/huggingface/diffusers/issues/277#issuecomment-1371428672 * improve user exp for ckt to diffusers conversion - !optimize_models command now operates on an existing ckpt file entry in models.yaml - replaces existing entry, rather than adding a new one - offers to delete the ckpt file after conversion * web: adapt progress callback to deal with old generator or new diffusers pipeline * clean-up model_manager code - add_model() verified to work for .ckpt local paths, .ckpt remote URLs, diffusers local paths, and diffusers repo_ids - convert_and_import() verified to work for local and remove .ckpt files * handle edge cases for import_model() and convert_model() * add support for safetensor .ckpt files * fix name error * code cleanup with pyflake * improve model setting behavior - If the user enters an invalid model name at startup time, will not try to load it, warn, and use default model - CLI UI enhancement: include currently active model in the command line prompt. * update test-invoke-pip.yml - fix model cache path to point to runwayml/stable-diffusion-v1-5 - remove `skip-sd-weights` from configure_invokeai.py args * exclude dev/diffusers from "fail for draft PRs" * disable "fail on PR jobs" * re-add `--skip-sd-weights` since no space * update workflow environments - include `INVOKE_MODEL_RECONFIGURE: '--yes'` * clean up model load failure handling - Allow CLI to run even when no model is defined or loadable. - Inhibit stack trace when model load fails - only show last error - Give user *option* to run configure_invokeai.py when no models successfully load. - Restart invokeai after reconfiguration. * further edge-case handling 1) only one model in models.yaml file, and that model is broken 2) no models in models.yaml 3) models.yaml doesn't exist at all * fix incorrect model status listing - "cached" was not being returned from list_models() - normalize handling of exceptions during model loading: - Passing an invalid model name to generate.set_model() will return a KeyError - All other exceptions are returned as the appropriate Exception * CI: do download weights (if not already cached) * diffusers: fix scheduler loading in offline mode * CI: fix model name (no longer has `diffusers-` prefix) * Update txt2img2img.py (#2256) * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * feat - make model storage compatible with hugging face caching system This commit alters the InvokeAI model directory to be compatible with hugging face, making it easier to share diffusers (and other models) across different programs. - If the HF_HOME environment variable is not set, then models are cached in ~/invokeai/models in a format that is identical to the HuggingFace cache. - If HF_HOME is set, then models are cached wherever HF_HOME points. - To enable sharing with other HuggingFace library clients, set HF_HOME to ~/.cache/huggingface to set the default cache location or to ~/invokeai/models to have huggingface cache inside InvokeAI. * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * fix error "no attribute CkptInpaint" * model_manager.list_models() returns entire model config stanza+status * Initial Draft - Model Manager Diffusers * added hash function to diffusers * implement sha256 hashes on diffusers models * Add Model Manager Support for Diffusers * fix various problems with model manager - in cli import functions, fix not enough values to unpack from _get_name_and_desc() - fix crash when using old-style vae: value with new-style diffuser * rebuild frontend * fix dictconfig-not-serializable issue * fix NoneType' object is not subscriptable crash in model_manager * fix "str has no attribute get" error in model_manager list_models() * Add path and repo_id support for Diffusers Model Manager Also fixes bugs * Fix tooltip IT localization not working * Add Version Number To WebUI * Optimize Model Search * Fix incorrect font on the Model Manager UI * Fix image degradation on merge fixes - [Experimental] This change should effectively fix a couple of things. - Fix image degradation on subsequent merges of the canvas layers. - Fix the slight transparent border that is left behind when filling the bounding box with a color. - Fix the left over line of color when filling a bounding box with color. So far there are no side effects for this. If any, please report. * Add local model filtering for Diffusers / Checkpoints * Go to home on modal close for the Add Modal UI * Styling Fixes * Model Manager Diffusers Localization Update * Add Safe Tensor scanning to Model Manager * Fix model edit form dispatching string values instead of numbers. * Resolve VAE handling / edge cases for supplied repos * defer injecting tokens for textual inversions until they're used for the first time * squash a console warning * implement model migration check * add_model() overwrites previous config rather than merges * fix model config file attribute merging * fix precision handling in textual inversion script * allow ckpt conversion script to work with safetensors .ckpts Applied patch here: https://github.com/huggingface/diffusers/commit/beb932c5d111872c5e45387e7b1b2b3dd0524a47 * fix name "args" is not defined crash in textual_inversion_training * fix a second NameError: name 'args' is not defined crash * fix loading of the safety checker from the global cache dir * add installation step to textual inversion frontend - After a successful training run, the script will copy learned_embeds.bin to a subfolder of the embeddings directory. - User given the option to delete the logs and intermediate checkpoints (which together use 7-8G of space) - If textual inversion training fails, reports the error gracefully. * don't crash out on incompatible embeddings - put try: blocks around places where the system tries to load an embedding which is incompatible with the currently loaded model * add support for checkpoint resuming * textual inversion preferences are saved and restored between sessions - Preferences are stored in a file named text-inversion-training/preferences.conf - Currently the resume-from-checkpoint option is not working correctly. Possible bug in textual_inversion_training.py? * copy learned_embeddings.bin into right location * add front end for diffusers model merging - Front end doesn't do anything yet!!!! - Made change to model name parsing in CLI to support ability to have merged models with the "+" character in their names. * improve inpainting experience - recommend ckpt version of inpainting-1.5 to user - fix get_noise() bug in ckpt version of omnibus.py * update environment*yml * tweak instructions to install HuggingFace token * bump version number * enhance update scripts - update scripts will now fetch new INITIAL_MODELS.yaml so that configure_invokeai.py will know about the diffusers versions. * enhance invoke.sh/invoke.bat launchers - added configure_invokeai.py to menu - menu defaults to browser-based invoke * remove conda workflow (#2321) * fix `token_ids has shape torch.Size([79]) - expected [77]` * update CHANGELOG.md with 2.3.* info - Add information on how formats have changed and the upgrade process. - Add short bug list. Co-authored-by: Damian Stewart <d@damianstewart.com> Co-authored-by: Damian Stewart <null@damianstewart.com> Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> Co-authored-by: Wybartel-luxmc <37852506+Wybartel-luxmc@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> Co-authored-by: mickr777 <115216705+mickr777@users.noreply.github.com> Co-authored-by: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Co-authored-by: Eugene Brodsky <ebr@users.noreply.github.com> Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com>
2023-01-15 14:22:46 +00:00
def is_legacy_model(self,model_name)->bool:
return self.model_manager.is_legacy(model_name)
def _set_sampler(self):
if isinstance(self.model, DiffusionPipeline):
return self._set_scheduler()
else:
return self._set_sampler_legacy()
# very repetitive code - can this be simplified? The KSampler names are
# consistent, at least
use 🧨diffusers model (#1583) * initial commit of DiffusionPipeline class * spike: proof of concept using diffusers for txt2img * doc: type hints for Generator * refactor(model_cache): factor out load_ckpt * model_cache: add ability to load a diffusers model pipeline and update associated things in Generate & Generator to not instantly fail when that happens * model_cache: fix model default image dimensions * txt2img: support switching diffusers schedulers * diffusers: let the scheduler do its scaling of the initial latents Remove IPNDM scheduler; it is not behaving. * web server: update image_progress callback for diffusers data * diffusers: restore prompt weighting feature * diffusers: fix set-sampler error following model switch * diffusers: use InvokeAIDiffuserComponent for conditioning * cross_attention_control: stub (no-op) implementations for diffusers * model_cache: let offload_model work with DiffusionPipeline, sorta. * models.yaml.example: add diffusers-format model, set as default * test-invoke-conda: use diffusers-format model test-invoke-conda: put huggingface-token where the library can use it * environment-mac: upgrade to diffusers 0.7 (from 0.6) this was already done for linux; mac must have been lost in the merge. * preload_models: explicitly load diffusers models In non-interactive mode too, as long as you're logged in. * fix(model_cache): don't check `model.config` in diffusers format clean-up from recent merge. * diffusers integration: support img2img * dev: upgrade to diffusers 0.8 (from 0.7.1) We get to remove some code by using methods that were factored out in the base class. * refactor: remove backported img2img.get_timesteps now that we can use it directly from diffusers 0.8.1 * ci: use diffusers model * dev: upgrade to diffusers 0.9 (from 0.8.1) * lint: correct annotations for Python 3.9. * lint: correct AttributeError.name reference for Python 3.9. * CI: prefer diffusers-1.4 because it no longer requires a token The RunwayML models still do. * build: there's yet another place to update requirements? * configure: try to download models even without token Models in the CompVis and stabilityai repos no longer require them. (But runwayml still does.) * configure: add troubleshooting info for config-not-found * fix(configure): prepend root to config path * fix(configure): remove second `default: true` from models example * CI: simplify test-on-push logic now that we don't need secrets The "test on push but only in forks" logic was only necessary when tests didn't work for PRs-from-forks. * create an embedding_manager for diffusers * internal: avoid importing diffusers DummyObject see https://github.com/huggingface/diffusers/issues/1479 * fix "config attributes…not expected" diffusers warnings. * fix deprecated scheduler construction * work around an apparent MPS torch bug that causes conditioning to have no effect * 🚧 post-rebase repair * preliminary support for outpainting (no masking yet) * monkey-patch diffusers.attention and use Invoke lowvram code * add always_use_cpu arg to bypass MPS * add cross-attention control support to diffusers (fails on MPS) For unknown reasons MPS produces garbage output with .swap(). Use --always_use_cpu arg to invoke.py for now to test this code on MPS. * diffusers support for the inpainting model * fix debug_image to not crash with non-RGB images. * inpainting for the normal model [WIP] This seems to be performing well until the LAST STEP, at which point it dissolves to confetti. * fix off-by-one bug in cross-attention-control (#1774) prompt token sequences begin with a "beginning-of-sequence" marker <bos> and end with a repeated "end-of-sequence" marker <eos> - to make a default prompt length of <bos> + 75 prompt tokens + <eos>. the .swap() code was failing to take the column for <bos> at index 0 into account. the changes here do that, and also add extra handling for a single <eos> (which may be redundant but which is included for completeness). based on my understanding and some assumptions about how this all works, the reason .swap() nevertheless seemed to do the right thing, to some extent, is because over multiple steps the conditioning process in Stable Diffusion operates as a feedback loop. a change to token n-1 has flow-on effects to how the [1x4x64x64] latent tensor is modified by all the tokens after it, - and as the next step is processed, all the tokens before it as well. intuitively, a token's conditioning effects "echo" throughout the whole length of the prompt. so even though the token at n-1 was being edited when what the user actually wanted was to edit the token at n, it nevertheless still had some non-negligible effect, in roughly the right direction, often enough that it seemed like it was working properly. * refactor common CrossAttention stuff into a mixin so that the old ldm code can still work if necessary * inpainting for the normal model. I think it works this time. * diffusers: reset num_vectors_per_token sync with 44a00555718f1df173c60da0ed646cf700e29537 * diffusers: txt2img2img (hires_fix) with so much slicing and dicing of pipeline methods to stitch them together * refactor(diffusers): reduce some code duplication amongst the different tasks * fixup! refactor(diffusers): reduce some code duplication amongst the different tasks * diffusers: enable DPMSolver++ scheduler * diffusers: upgrade to diffusers 0.10, add Heun scheduler * diffusers(ModelCache): stopgap to make from_cpu compatible with diffusers * CI: default to diffusers-1.5 now that runwayml token requirement is gone * diffusers: update to 0.10 (and transformers to 4.25) * diffusers: use xformers when available diffusers no longer auto-enables this as of 0.10.2. * diffusers: make masked img2img behave better with multi-step schedulers re-randomizing the noise each step was confusing them. * diffusers: work more better with more models. fixed relative path problem with local models. fixed models on hub not always having a `fp16` branch. * diffusers: stopgap fix for attention_maps_callback crash after recent merge * fixup import merge conflicts correction for 061c5369a2247c6c92cd69606bcf54c4f1962a0b * test: add tests/inpainting inputs for masked img2img * diffusers(AddsMaskedGuidance): partial fix for k-schedulers Prevents them from crashing, but results are still hot garbage. * fix --safety_checker arg parsing and add note to diffusers loader about where safety checker gets called * generate: fix import error * CI: don't try to read the old init location * diffusers: support loading an alternate VAE * CI: remove sh-syntax if-statement so it doesn't crash powershell * CI: fold strings in yaml because backslash is not line-continuation in powershell * attention maps callback stuff for diffusers * build: fix syntax error in environment-mac * diffusers: add INITIAL_MODELS with diffusers-compatible repos * re-enable the embedding manager; closes #1778 * Squashed commit of the following: commit e4a956abc37fcb5cf188388b76b617bc5c8fda7d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:43:07 2022 +0100 import new load handling from EmbeddingManager and cleanup commit c4abe91a5ba0d415b45bf734068385668b7a66e6 Merge: 032e856e 1efc6397 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:09:53 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers_with_textual_inversion_manager commit 032e856eefb3bbc39534f5daafd25764bcfcef8b Merge: 8b4f0fe9 bc515e24 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:08:01 2022 +0100 Merge remote-tracking branch 'upstream/dev/diffusers' into dev/diffusers_with_textual_inversion_manager commit 1efc6397fc6e61c1aff4b0258b93089d61de5955 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:04:28 2022 +0100 cleanup and add performance notes commit e400f804ac471a0ca2ba432fd658778b20c7bdab Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:45:07 2022 +0100 fix bug and update unit tests commit deb9ae0ae1016750e93ce8275734061f7285a231 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:28:29 2022 +0100 textual inversion manager seems to work commit 162e02505dec777e91a983c4d0fb52e950d25ff0 Merge: cbad4583 12769b3d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:58:03 2022 +0100 Merge branch 'main' into feature_textual_inversion_mgr commit cbad45836c6aace6871a90f2621a953f49433131 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:54:10 2022 +0100 use position embeddings commit 070344c69b0e0db340a183857d0a787b348681d3 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:53:47 2022 +0100 Don't crash CLI on exceptions commit b035ac8c6772dfd9ba41b8eeb9103181cda028f8 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:11:55 2022 +0100 add missing position_embeddings commit 12769b3d3562ef71e0f54946b532ad077e10043c Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:33:25 2022 +0100 debugging why it don't work commit bafb7215eabe1515ca5e8388fd3bb2f3ac5362cf Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:21:33 2022 +0100 debugging why it don't work commit 664a6e9e146b42d96703f0cc8baf8f5efec04ee1 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit 8b4f0fe9d6e4e2643b36dfa27864294785d7ba4e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit ffbe1ab11163ba712e353d89404e301d0e0c6cdf Merge: 6e4dad60 023df37e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:37:31 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers commit 023df37efffa67434f77def7fc3c9dfb29f699fd Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:36:54 2022 +0100 cleanup commit 05fac594eaf79d0058e3c48deee93df603f136c2 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:07:49 2022 +0100 tweak error checking commit 009f32ed39a7280997c3ffab112adadee0b44279 Author: damian <null@damianstewart.com> Date: Thu Dec 15 21:29:47 2022 +0100 unit tests passing for embeddings with vector length >1 commit beb1b08d9a98112ed2fe073580568e1a18698da3 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:39:09 2022 +0100 more explicit equality tests when overwriting commit 44d8a5a7c85cdabc9ce3a54fd0769a10597b3ca9 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:30:13 2022 +0100 wip textual inversion manager (unit tests passing for 1v embedding overwriting) commit 417c2b57d90924a839616bfb66804faab8039e4c Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 12:30:55 2022 +0100 wip textual inversion manager (unit tests passing for base stuff + padding) commit 2e80872e3b6f7fd7d8eb8928822bd824b63cb2ff Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 10:57:57 2022 +0100 wip new TextualInversionManager * stop using WeightedFrozenCLIPEmbedder * store diffusion models locally - configure_invokeai.py reconfigured to store diffusion models rather than CompVis models - hugging face caching model is used, but cache is set to ~/invokeai/models/repo_id - models.yaml does **NOT** use path, just repo_id - "repo_name" changed to "repo_id" to following hugging face conventions - Models are loaded with full precision pending further work. * allow non-local files during development * path takes priority over repo_id * MVP for model_cache and configure_invokeai - Feature complete (almost) - configure_invokeai.py downloads both .ckpt and diffuser models, along with their VAEs. Both types of download are controlled by a unified INITIAL_MODELS.yaml file. - model_cache can load both type of model and switches back and forth in CPU. No memory leaks detected TO DO: 1. I have not yet turned on the LocalOnly flag for diffuser models, so the code will check the Hugging Face repo for updates before using the locally cached models. This will break firewalled systems. I am thinking of putting in a global check for internet connectivity at startup time and setting the LocalOnly flag based on this. It would be good to check updates if there is connectivity. 2. I have not gone completely through INITIAL_MODELS.yaml to check which models are available as diffusers and which are not. So models like PaperCut and VoxelArt may not load properly. The runway and stability models are checked, as well as the Trinart models. 3. Add stanzas for SD 2.0 and 2.1 in INITIAL_MODELS.yaml REMAINING PROBLEMS NOT DIRECTLY RELATED TO MODEL_CACHE: 1. When loading a .ckpt file there are lots of messages like this: Warning! ldm.modules.attention.CrossAttention is no longer being maintained. Please use InvokeAICrossAttention instead. I'm not sure how to address this. 2. The ckpt models ***don't actually run*** due to the lack of special-case support for them in the generator objects. For example, here's the hard crash you get when you run txt2img against the legacy waifu-diffusion-1.3 model: ``` >> An error occurred: Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 140, in main main_loop(gen, opt) File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 371, in main_loop gen.prompt2image( File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1265, in __getattr__ raise AttributeError("'{}' object has no attribute '{}'".format( AttributeError: 'LatentDiffusion' object has no attribute 'image_from_embeddings' ``` 3. The inpainting diffusion model isn't working. Here's the output of "banana sushi" when inpainting-1.5 is loaded: ``` Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 301, in image_from_embeddings result_latents, result_attention_map_saver = self.latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 330, in latents_from_embeddings result: PipelineIntermediateState = infer_latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 185, in __call__ for result in self.generator_method(*args, **kwargs): File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 367, in generate_latents_from_embeddings step_output = self.step(batched_t, latents, guidance_scale, File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context return func(*args, **kwargs) File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 409, in step step_output = self.scheduler.step(noise_pred, timestep, latents, **extra_step_kwargs) File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/diffusers/schedulers/scheduling_lms_discrete.py", line 223, in step pred_original_sample = sample - sigma * model_output RuntimeError: The size of tensor a (9) must match the size of tensor b (4) at non-singleton dimension 1 ``` * proper support for float32/float16 - configure script now correctly detects user's preference for fp16/32 and downloads the correct diffuser version. If fp16 version not available, falls back to fp32 version. - misc code cleanup and simplification in model_cache * add on-the-fly conversion of .ckpt to diffusers models 1. On-the-fly conversion code can be found in the file ldm/invoke/ckpt_to_diffusers.py. 2. A new !optimize command has been added to the CLI. Should be ported to Web GUI. User experience on the CLI is this: ``` invoke> !optimize /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt INFO: Converting legacy weights file /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt to optimized diffuser model. This operation will take 30-60s to complete. Success. Optimized model is now located at /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 Writing new config file entry for sd-v1-4... >> New configuration: sd-v1-4: description: Optimized version of sd-v1-4 format: diffusers path: /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 OK to import [n]? y >> Verifying that new model loads... >> Current VRAM usage: 2.60G >> Offloading stable-diffusion-2.1 to CPU >> Loading diffusers model from /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 | Using faster float16 precision You have disabled the safety checker for <class 'ldm.invoke.generator.diffusers_pipeline.StableDiffusionGeneratorPipeline'> by passing `safety_checker=None`. Ensure that you abide to the conditions of the Stable Diffusion \ license and do not expose unfiltered results in services or applications open to the public. Both the diffusers team and Hugging Face strongly recommend to keep the safety filter enabled in all public facing circumstances,\ disabling it only for use-cases that involve analyzing network behavior or auditing its results. For more information, please have a look at https://github.com/huggingface/diffusers/pull/254 . | training width x height = (512 x 512) >> Model loaded in 3.48s >> Max VRAM used to load the model: 2.17G >> Current VRAM usage:2.17G >> Textual inversions available: >> Setting Sampler to k_lms (LMSDiscreteScheduler) Keep model loaded? [y] ``` * add parallel set of generator files for ckpt legacy generation * generation using legacy ckpt models now working * diffusers: fix missing attention_maps_callback fix for 23eb80b40421b2bb8f4b6d3dd30490d11c447b36 * associate legacy CrossAttention with .ckpt models * enable autoconvert New --autoconvert CLI option will scan a designated directory for new .ckpt files, convert them into diffuser models, and import them into models.yaml. Works like this: invoke.py --autoconvert /path/to/weights/directory In ModelCache added two new methods: autoconvert_weights(config_path, weights_directory_path, models_directory_path) convert_and_import(ckpt_path, diffuser_path) * diffusers: update to diffusers 0.11 (from 0.10.2) * fix vae loading & width/height calculation * refactor: encapsulate these conditioning data into one container * diffusers: fix some noise-scaling issues by pushing the noise-mixing down to the common function * add support for safetensors and accelerate * set local_files_only when internet unreachable * diffusers: fix error-handling path when model repo has no fp16 branch * fix generatorinpaint error Fixes : "ModuleNotFoundError: No module named 'ldm.invoke.generatorinpaint' https://github.com/invoke-ai/InvokeAI/pull/1583#issuecomment-1363634318 * quench diffuser safety-checker warning * diffusers: support stochastic DDIM eta parameter * fix conda env creation on macos * fix cross-attention with diffusers 0.11 * diffusers: the VAE needs to be tiling as well as the U-Net * diffusers: comment on subfolders * diffusers: embiggen! * diffusers: make model_cache.list_models serializable * diffusers(inpaint): restore scaling functionality * fix requirements clash between numba and numpy 1.24 * diffusers: allow inpainting model to do non-inpainting tasks * start expanding model_cache functionality * add import_ckpt_model() and import_diffuser_model() methods to model_manager - in addition, model_cache.py is now renamed to model_manager.py * allow "recommended" flag to be optional in INITIAL_MODELS.yaml * configure_invokeai now downloads VAE diffusers in advance * rename ModelCache to ModelManager * remove support for `repo_name` in models.yaml * check for and refuse to load embeddings trained on incompatible models * models.yaml.example: s/repo_name/repo_id and remove extra INITIAL_MODELS now that the main one has diffusers models in it. * add MVP textual inversion script * refactor(InvokeAIDiffuserComponent): factor out _combine() * InvokeAIDiffuserComponent: implement threshold * InvokeAIDiffuserComponent: diagnostic logs for threshold ...this does not look right * add a curses-based frontend to textual inversion - not quite working yet - requires npyscreen installed - on windows will also have the windows-curses requirement, but not added to requirements yet * add curses-based interface for textual inversion * fix crash in convert_and_import() - This corrects a "local variable referenced before assignment" error in model_manager.convert_and_import() * potential workaround for no 'state_dict' key error - As reported in https://github.com/huggingface/diffusers/issues/1876 * create TI output dir if needed * Update environment-lin-cuda.yml (#2159) Fixing line 42 to be the proper order to define the transformers requirement: ~= instead of =~ * diffusers: update sampler-to-scheduler mapping based on https://github.com/huggingface/diffusers/issues/277#issuecomment-1371428672 * improve user exp for ckt to diffusers conversion - !optimize_models command now operates on an existing ckpt file entry in models.yaml - replaces existing entry, rather than adding a new one - offers to delete the ckpt file after conversion * web: adapt progress callback to deal with old generator or new diffusers pipeline * clean-up model_manager code - add_model() verified to work for .ckpt local paths, .ckpt remote URLs, diffusers local paths, and diffusers repo_ids - convert_and_import() verified to work for local and remove .ckpt files * handle edge cases for import_model() and convert_model() * add support for safetensor .ckpt files * fix name error * code cleanup with pyflake * improve model setting behavior - If the user enters an invalid model name at startup time, will not try to load it, warn, and use default model - CLI UI enhancement: include currently active model in the command line prompt. * update test-invoke-pip.yml - fix model cache path to point to runwayml/stable-diffusion-v1-5 - remove `skip-sd-weights` from configure_invokeai.py args * exclude dev/diffusers from "fail for draft PRs" * disable "fail on PR jobs" * re-add `--skip-sd-weights` since no space * update workflow environments - include `INVOKE_MODEL_RECONFIGURE: '--yes'` * clean up model load failure handling - Allow CLI to run even when no model is defined or loadable. - Inhibit stack trace when model load fails - only show last error - Give user *option* to run configure_invokeai.py when no models successfully load. - Restart invokeai after reconfiguration. * further edge-case handling 1) only one model in models.yaml file, and that model is broken 2) no models in models.yaml 3) models.yaml doesn't exist at all * fix incorrect model status listing - "cached" was not being returned from list_models() - normalize handling of exceptions during model loading: - Passing an invalid model name to generate.set_model() will return a KeyError - All other exceptions are returned as the appropriate Exception * CI: do download weights (if not already cached) * diffusers: fix scheduler loading in offline mode * CI: fix model name (no longer has `diffusers-` prefix) * Update txt2img2img.py (#2256) * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * feat - make model storage compatible with hugging face caching system This commit alters the InvokeAI model directory to be compatible with hugging face, making it easier to share diffusers (and other models) across different programs. - If the HF_HOME environment variable is not set, then models are cached in ~/invokeai/models in a format that is identical to the HuggingFace cache. - If HF_HOME is set, then models are cached wherever HF_HOME points. - To enable sharing with other HuggingFace library clients, set HF_HOME to ~/.cache/huggingface to set the default cache location or to ~/invokeai/models to have huggingface cache inside InvokeAI. * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * fix error "no attribute CkptInpaint" * model_manager.list_models() returns entire model config stanza+status * Initial Draft - Model Manager Diffusers * added hash function to diffusers * implement sha256 hashes on diffusers models * Add Model Manager Support for Diffusers * fix various problems with model manager - in cli import functions, fix not enough values to unpack from _get_name_and_desc() - fix crash when using old-style vae: value with new-style diffuser * rebuild frontend * fix dictconfig-not-serializable issue * fix NoneType' object is not subscriptable crash in model_manager * fix "str has no attribute get" error in model_manager list_models() * Add path and repo_id support for Diffusers Model Manager Also fixes bugs * Fix tooltip IT localization not working * Add Version Number To WebUI * Optimize Model Search * Fix incorrect font on the Model Manager UI * Fix image degradation on merge fixes - [Experimental] This change should effectively fix a couple of things. - Fix image degradation on subsequent merges of the canvas layers. - Fix the slight transparent border that is left behind when filling the bounding box with a color. - Fix the left over line of color when filling a bounding box with color. So far there are no side effects for this. If any, please report. * Add local model filtering for Diffusers / Checkpoints * Go to home on modal close for the Add Modal UI * Styling Fixes * Model Manager Diffusers Localization Update * Add Safe Tensor scanning to Model Manager * Fix model edit form dispatching string values instead of numbers. * Resolve VAE handling / edge cases for supplied repos * defer injecting tokens for textual inversions until they're used for the first time * squash a console warning * implement model migration check * add_model() overwrites previous config rather than merges * fix model config file attribute merging * fix precision handling in textual inversion script * allow ckpt conversion script to work with safetensors .ckpts Applied patch here: https://github.com/huggingface/diffusers/commit/beb932c5d111872c5e45387e7b1b2b3dd0524a47 * fix name "args" is not defined crash in textual_inversion_training * fix a second NameError: name 'args' is not defined crash * fix loading of the safety checker from the global cache dir * add installation step to textual inversion frontend - After a successful training run, the script will copy learned_embeds.bin to a subfolder of the embeddings directory. - User given the option to delete the logs and intermediate checkpoints (which together use 7-8G of space) - If textual inversion training fails, reports the error gracefully. * don't crash out on incompatible embeddings - put try: blocks around places where the system tries to load an embedding which is incompatible with the currently loaded model * add support for checkpoint resuming * textual inversion preferences are saved and restored between sessions - Preferences are stored in a file named text-inversion-training/preferences.conf - Currently the resume-from-checkpoint option is not working correctly. Possible bug in textual_inversion_training.py? * copy learned_embeddings.bin into right location * add front end for diffusers model merging - Front end doesn't do anything yet!!!! - Made change to model name parsing in CLI to support ability to have merged models with the "+" character in their names. * improve inpainting experience - recommend ckpt version of inpainting-1.5 to user - fix get_noise() bug in ckpt version of omnibus.py * update environment*yml * tweak instructions to install HuggingFace token * bump version number * enhance update scripts - update scripts will now fetch new INITIAL_MODELS.yaml so that configure_invokeai.py will know about the diffusers versions. * enhance invoke.sh/invoke.bat launchers - added configure_invokeai.py to menu - menu defaults to browser-based invoke * remove conda workflow (#2321) * fix `token_ids has shape torch.Size([79]) - expected [77]` * update CHANGELOG.md with 2.3.* info - Add information on how formats have changed and the upgrade process. - Add short bug list. Co-authored-by: Damian Stewart <d@damianstewart.com> Co-authored-by: Damian Stewart <null@damianstewart.com> Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> Co-authored-by: Wybartel-luxmc <37852506+Wybartel-luxmc@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> Co-authored-by: mickr777 <115216705+mickr777@users.noreply.github.com> Co-authored-by: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Co-authored-by: Eugene Brodsky <ebr@users.noreply.github.com> Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com>
2023-01-15 14:22:46 +00:00
def _set_sampler_legacy(self):
Refactoring simplet2i (#387) * start refactoring -not yet functional * first phase of refactor done - not sure weighted prompts working * Second phase of refactoring. Everything mostly working. * The refactoring has moved all the hard-core inference work into ldm.dream.generator.*, where there are submodules for txt2img and img2img. inpaint will go in there as well. * Some additional refactoring will be done soon, but relatively minor work. * fix -save_orig flag to actually work * add @neonsecret attention.py memory optimization * remove unneeded imports * move token logging into conditioning.py * add placeholder version of inpaint; porting in progress * fix crash in img2img * inpainting working; not tested on variations * fix crashes in img2img * ported attention.py memory optimization #117 from basujindal branch * added @torch_no_grad() decorators to img2img, txt2img, inpaint closures * Final commit prior to PR against development * fixup crash when generating intermediate images in web UI * rename ldm.simplet2i to ldm.generate * add backward-compatibility simplet2i shell with deprecation warning * add back in mps exception, addresses @vargol comment in #354 * replaced Conditioning class with exported functions * fix wrong type of with_variations attribute during intialization * changed "image_iterator()" to "get_make_image()" * raise NotImplementedError for calling get_make_image() in parent class * Update ldm/generate.py better error message Co-authored-by: Kevin Gibbons <bakkot@gmail.com> * minor stylistic fixes and assertion checks from code review * moved get_noise() method into img2img class * break get_noise() into two methods, one for txt2img and the other for img2img * inpainting works on non-square images now * make get_noise() an abstract method in base class * much improved inpainting Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
2022-09-06 00:40:10 +00:00
msg = f'>> Setting Sampler to {self.sampler_name}'
if self.sampler_name == 'plms':
self.sampler = PLMSSampler(self.model, device=self.device)
elif self.sampler_name == 'ddim':
self.sampler = DDIMSampler(self.model, device=self.device)
elif self.sampler_name == 'k_dpm_2_a':
2022-10-27 21:12:22 +00:00
self.sampler = KSampler(self.model, 'dpm_2_ancestral', device=self.device)
Refactoring simplet2i (#387) * start refactoring -not yet functional * first phase of refactor done - not sure weighted prompts working * Second phase of refactoring. Everything mostly working. * The refactoring has moved all the hard-core inference work into ldm.dream.generator.*, where there are submodules for txt2img and img2img. inpaint will go in there as well. * Some additional refactoring will be done soon, but relatively minor work. * fix -save_orig flag to actually work * add @neonsecret attention.py memory optimization * remove unneeded imports * move token logging into conditioning.py * add placeholder version of inpaint; porting in progress * fix crash in img2img * inpainting working; not tested on variations * fix crashes in img2img * ported attention.py memory optimization #117 from basujindal branch * added @torch_no_grad() decorators to img2img, txt2img, inpaint closures * Final commit prior to PR against development * fixup crash when generating intermediate images in web UI * rename ldm.simplet2i to ldm.generate * add backward-compatibility simplet2i shell with deprecation warning * add back in mps exception, addresses @vargol comment in #354 * replaced Conditioning class with exported functions * fix wrong type of with_variations attribute during intialization * changed "image_iterator()" to "get_make_image()" * raise NotImplementedError for calling get_make_image() in parent class * Update ldm/generate.py better error message Co-authored-by: Kevin Gibbons <bakkot@gmail.com> * minor stylistic fixes and assertion checks from code review * moved get_noise() method into img2img class * break get_noise() into two methods, one for txt2img and the other for img2img * inpainting works on non-square images now * make get_noise() an abstract method in base class * much improved inpainting Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
2022-09-06 00:40:10 +00:00
elif self.sampler_name == 'k_dpm_2':
self.sampler = KSampler(self.model, 'dpm_2', device=self.device)
Merge dev into main for 2.2.0 (#1642) * Fixes inpainting + code cleanup * Disable stage info in Inpainting Tab * Mask Brush Preview now always at 0.5 opacity The new mask is only visible properly at max opacity but at max opacity the brush preview becomes fully opaque blocking the view. So the mask brush preview no remains at 0.5 no matter what the Brush opacity is. * Remove save button from Canvas Controls (cleanup) * Implements invert mask * Changes "Invert Mask" to "Preserve Masked Areas" * Fixes (?) spacebar issues * Patches redux-persist and redux-deep-persist with debounced persists Our app changes redux state very, very often. As our undo/redo history grows, the calls to persist state start to take in the 100ms range, due to a the deep cloning of the history. This causes very noticeable performance lag. The deep cloning is required because we need to blacklist certain items in redux from being persisted (e.g. the app's connection status). Debouncing the whole process of persistence is a simple and effective solution. Unfortunately, `redux-persist` dropped `debounce` between v4 and v5, replacing it with `throttle`. `throttle`, instead of delaying the expensive action until a period of X ms of inactivity, simply ensures the action is executed at least every X ms. Of course, this does not fix our performance issue. The patch is very simple. It adds a `debounce` argument - a number of milliseconds - and debounces `redux-persist`'s `update()` method (provided by `createPersistoid`) by that many ms. Before this, I also tried writing a custom storage adapter for `redux-persist` to debounce the calls to `localStorage.setItem()`. While this worked and was far less invasive, it doesn't actually address the issue. It turns out `setItem()` is a very fast part of the process. We use `redux-deep-persist` to simplify the `redux-persist` configuration, which can get complicated when you need to blacklist or whitelist deeply nested state. There is also a patch here for that library because it uses the same types as `redux-persist`. Unfortunately, the last release of `redux-persist` used a package `flat-stream` which was malicious and has been removed from npm. The latest commits to `redux-persist` (about 1 year ago) do not build; we cannot use the master branch. And between the last release and last commit, the changes have all been breaking. Patching this last release (about 3 years old at this point) directly is far simpler than attempting to fix the upstream library's master branch or figuring out an alternative to the malicious and now non-existent dependency. * Adds debouncing * Fixes AttributeError: 'dict' object has no attribute 'invert_mask' * Updates package.json to use redux-persist patches * Attempts to fix redux-persist debounce patch * Fixes undo/redo * Fixes invert mask * Debounce > 300ms * Limits history to 256 for each of undo and redo * Canvas styling * Hotkeys improvement * Add Metadata To Viewer * Increases CFG Scale max to 200 * Fix gallery width size for Outpainting Also fixes the canvas resizing failing n fast pushes * Fixes disappearing canvas grid lines * Adds staging area * Fixes "use all" not setting variationAmount Now sets to 0 when the image had variations. * Builds fresh bundle * Outpainting tab loads to empty canvas instead of upload * Fixes wonky canvas layer ordering & compositing * Fixes error on inpainting paste back `TypeError: 'float' object cannot be interpreted as an integer` * Hides staging area outline on mouseover prev/next * Fixes inpainting not doing img2img when no mask * Fixes bbox not resizing in outpainting if partially off screen * Fixes crashes during iterative outpaint. Still doesn't work correctly though. * Fix iterative outpainting by restoring original images * Moves image uploading to HTTP - It all seems to work fine - A lot of cleanup is still needed - Logging needs to be added - May need types to be reviewed * Fixes: outpainting temp images show in gallery * WIP refactor to unified canvas * Removes console.log from redux-persist patch * Initial unification of canvas * Removes all references to split inpainting/outpainting canvas * Add patchmatch and infill_method parameter to prompt2image (options are 'patchmatch' or 'tile'). * Fixes app after removing in/out-painting refs * Rebases on dev, updates new env files w/ patchmatch * Organises features/canvas * Fixes bounding box ending up offscreen * Organises features/canvas * Stops unnecessary canvas rescales on gallery state change * Fixes 2px layout shift on toggle canvas lock * Clips lines drawn while canvas locked When drawing with the locked canvas, if a brush stroke gets too close to the edge of the canvas and its stroke would extend past the edge of the canvas, the edge of that stroke will be seen after unlocking the canvas. This could cause a problem if you unlock the canvas and now have a bunch of strokes just outside the init image area, which are far back in undo history and you cannot easily erase. With this change, lines drawn while the canvas is locked get clipped to the initial image bbox, fixing this issue. Additionally, the merge and save to gallery functions have been updated to respect the initial image bbox so they function how you'd expect. * Fixes reset canvas view when locked * Fixes send to buttons * Fixes bounding box not being rounded to 64 * Abandons "inpainting" canvas lock * Fixes save to gallery including empty area, adds download and copy image * Fix Current Image display background going over image bounds * Sets status immediately when clicking Invoke * Adds hotkeys and refactors sharing of konva instances Adds hotkeys to canvas. As part of this change, the access to konva instance objects was refactored: Previously closure'd refs were used to indirectly get access to the konva instances outside of react components. Now, a getter and setter function are used to provide access directly to the konva objects. * Updates hotkeys * Fixes canvas showing spinner on first load Also adds good default canvas scale and positioning when no image is on it * Fixes possible hang on MaskCompositer * Improves behaviour when setting init canvas image/reset view * Resets bounding box coords/dims when no image present * Disables canvas actions which cannot be done during processing * Adds useToastWatcher hook - Dispatch an `addToast` action with standard Chakra toast options object to add a toast to the toastQueue - The hook is called in App.tsx and just useEffect's w/ toastQueue as dependency to create the toasts - So now you can add toasts anywhere you have access to `dispatch`, which includes middleware and thunks - Adds first usage of this for the save image buttons in canvas * Update Hotkey Info Add missing tooltip hotkeys and update the hotkeys modal to reflect the new hotkeys for the Unified Canvas. * Fix theme changer not displaying current theme on page refresh * Fix tab count in hotkeys panel * Unify Brush and Eraser Sizes * Fix staging area display toggle not working * Staging Area delete button is now red So it doesnt feel blended into to the rest of them. * Revert "Fix theme changer not displaying current theme on page refresh" This reverts commit 903edfb803e743500242589ff093a8a8a0912726. * Add arguments to use SSL to webserver * Integrates #1487 - touch events Need to add: - Pinch zoom - Touch-specific handling (some things aren't quite right) * Refactors upload-related async thunks - Now standard thunks instead of RTK createAsyncThunk() - Adds toasts for all canvas upload-related actions * Reorganises app file structure * Fixes Canvas Auto Save to Gallery * Fixes staging area outline * Adds staging area hotkeys, disables gallery left/right when staging * Fixes Use All Parameters * Fix metadata viewer image url length when viewing intermediate * Fixes intermediate images being tiny in txt2img/img2img * Removes stale code * Improves canvas status text and adds option to toggle debug info * Fixes paste image to upload * Adds model drop-down to site header * Adds theme changer popover * Fix missing key on ThemeChanger map * Fixes stage position changing on zoom * Hotkey Cleanup - Viewer is now Z - Canvas Move tool is V - sync with PS - Removed some unused hotkeys * Fix canvas resizing when both options and gallery are unpinned * Implements thumbnails for gallery - Thumbnails are saved whenever an image is saved, and when gallery requests images from server - Thumbnails saved at original image aspect ratio with width of 128px as WEBP - If the thumbnail property of an image is unavailable for whatever reason, the image's full size URL is used instead * Saves thumbnails to separate thumbnails directory * Thumbnail size = 256px * Fix Lightbox Issues * Disables canvas image saving functions when processing * Fix index error on going past last image in Gallery * WIP - Lightbox Fixes Still need to fix the images not being centered on load when the image res changes * Fixes another similar index error, simplifies logic * Reworks canvas toolbar * Fixes canvas toolbar upload button * Cleans up IAICanvasStatusText * Improves metadata handling, fixes #1450 - Removes model list from metadata - Adds generation's specific model to metadata - Displays full metadata in JSON viewer * Gracefully handles corrupted images; fixes #1486 - App does not crash if corrupted image loaded - Error is displayed in the UI console and CLI output if an image cannot be loaded * Adds hotkey to reset canvas interaction state If the canvas' interaction state (e.g. isMovingBoundingBox, isDrawing, etc) get stuck somehow, user can press Escape to reset the state. * Removes stray console.log() * Fixes bug causing gallery to close on context menu open * Minor bugfixes - When doing long-running canvas image exporting actions, display indeterminate progress bar - Fix staging area image outline not displaying after committing/discarding results * Removes unused imports * Fixes repo root .gitignore ignoring frontend things * Builds fresh bundle * Styling updates * Removes reasonsWhyNotReady The popover doesn't play well with the button being disabled, and I don't think adds any value. * Image gallery resize/style tweaks * Styles buttons for clearing canvas history and mask * First pass on Canvas options panel * Fixes bug where discarding staged images results in loss of history * Adds Save to Gallery button to staging toolbar * Rearrange some canvas toolbar icons Put brush stuff together and canvas movement stuff together * Fix gallery maxwidth on unified canvas * Update Layer hotkey display to UI * Adds option to crop to bounding box on save * Masking option tweaks * Crop to Bounding Box > Save Box Region Only * Adds clear temp folder * Updates mask options popover behavior * Builds fresh bundle * Fix styling on alert modals * Fix input checkbox styling being incorrect on light theme * Styling fixes * Improves gallery resize behaviour * Cap gallery size on canvas tab so it doesnt overflow * Fixes bug when postprocessing image with no metadata * Adds IAIAlertDialog component * Moves Loopback to app settings * Fixes metadata viewer not showing metadata after refresh Also adds Dream-style prompt to metadata * Adds outpainting specific options * Linting * Fixes gallery width on lightbox, fixes gallery button expansion * Builds fresh bundle * Fix Lightbox images of different res not centering * Update feature tooltip text * Highlight mask icon when on mask layer * Fix gallery not resizing correctly on open and close * Add loopback to just img2img. Remove from settings. * Fix to gallery resizing * Removes Advanced checkbox, cleans up options panel for unified canvas * Minor styling fixes to new options panel layout * Styling Updates * Adds infill method * Tab Styling Fixes * memoize outpainting options * Fix unnecessary gallery re-renders * Isolate Cursor Pos debug text on canvas to prevent rerenders * Fixes missing postprocessed image metadata before refresh * Builds fresh bundle * Fix rerenders on model select * Floating panel re-render fix * Simplify fullscreen hotkey selector * Add Training WIP Tab * Adds Training icon * Move full screen hotkey to floating to prevent tab rerenders * Adds single-column gallery layout * Fixes crash on cancel with intermediates enabled, fixes #1416 * Updates npm dependencies * Fixes img2img attempting inpaint when init image has transparency * Fixes missing threshold and perlin parameters in metadata viewer * Renames "Threshold" > "Noise Threshold" * Fixes postprocessing not being disabled when clicking use all * Builds fresh bundle * Adds color picker * Lints & builds fresh bundle * Fixes iterations being disabled when seed random & variations are off * Un-floors cursor position * Changes color picker preview to circles * Fixes variation params not set correctly when recalled * Fixes invoke hotkey not working in input fields * Simplifies Accordion Prep for adding reset buttons for each section * Fixes mask brush preview color * Committing color picker color changes tool to brush * Color picker does not overwrite user-selected alpha * Adds brush color alpha hotkey * Lints * Removes force_outpaint param * Add inpaint size options to inpaint at a larger size than the actual inpaint image, then scale back down for recombination * Bug fix for inpaint size * Adds inpaint size (as scale bounding box) to UI * Adds auto-scaling for inpaint size * Improves scaled bbox display logic * Fixes bug with clear mask and history * Fixes shouldShowStagingImage not resetting to true on commit * Builds fresh bundle * Fixes canvas failing to scale on first run * Builds fresh bundle * Fixes unnecessary canvas scaling * Adds gallery drag and drop to img2img/canvas * Builds fresh bundle * Fix desktop mode being broken with new versions of flaskwebgui * Fixes canvas dimensions not setting on first load * Builds fresh bundle * stop crash on !import_models call on model inside rootdir - addresses bug report #1546 * prevent "!switch state gets confused if model switching fails" - If !switch were to fail on a particular model, then generate got confused and wouldn't try again until you switch to a different working model and back again. - This commit fixes and closes #1547 * Revert "make the docstring more readable and improve the list_models logic" This reverts commit 248068fe5d57b5639ea7a87ee6cbf023104d957d. * fix model cache path * also set fail-fast to it's default (true) in this way the whole action fails if one job fails this should unblock the runners!!! * fix output path for Archive results * disable checks for python 3.9 * Update-requirements and test-invoke-pip workflow (#1574) * update requirements files * update test-invoke-pip workflow * move requirements-mkdocs.txt to docs folder (#1575) * move requirements-mkdocs.txt to docs folder * update copyright * Fixes outpainting with resized inpaint size * Interactive configuration (#1517) * Update scripts/configure_invokeai.py prevent crash if output exists Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> * implement changes requested by reviews * default to correct root and output directory on Windows systems - Previously the script was relying on the readline buffer editing feature to set up the correct default. But this feature doesn't exist on windows. - This commit detects when user typed return with an empty directory value and replaces with the default directory. * improved readability of directory choices * Update scripts/configure_invokeai.py Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> * better error reporting at startup - If user tries to run the script outside of the repo or runtime directory, a more informative message will appear explaining the problem. Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> * Embedding merging (#1526) * add whole <style token> to vocab for concept library embeddings * add ability to load multiple concept .bin files * make --log_tokenization respect custom tokens * start working on concept downloading system * preliminary support for dynamic loading and merging of multiple embedded models - The embedding_manager is now enhanced with ldm.invoke.concepts_lib, which handles dynamic downloading and caching of embedded models from the Hugging Face concepts library (https://huggingface.co/sd-concepts-library) - Downloading of a embedded model is triggered by the presence of one or more <concept> tags in the prompt. - Once the embedded model is downloaded, its trigger phrase will be loaded into the embedding manager and the prompt's <concept> tag will be replaced with the <trigger_phrase> - The downloaded model stays on disk for fast loading later. - The CLI autocomplete will complete partial <concept> tags for you. Type a '<' and hit tab to get all ~700 concepts. BUGS AND LIMITATIONS: - MODEL NAME VS TRIGGER PHRASE You must use the name of the concept embed model from the SD library, and not the trigger phrase itself. Usually these are the same, but not always. For example, the model named "hoi4-leaders" corresponds to the trigger "<HOI4-Leader>" One reason for this design choice is that there is no apparent constraint on the uniqueness of the trigger phrases and one trigger phrase may map onto multiple models. So we use the model name instead. The second reason is that there is no way I know of to search Hugging Face for models with certain trigger phrases. So we'd have to download all 700 models to index the phrases. The problem this presents is that this may confuse users, who will want to reuse prompts from distributions that use the trigger phrase directly. Usually this will work, but not always. - WON'T WORK ON A FIREWALLED SYSTEM If the host running IAI has no internet connection, it can't download the concept libraries. I will add a script that allows users to preload a list of concept models. - BUG IN PROMPT REPLACEMENT WHEN MODEL NOT FOUND There's a small bug that occurs when the user provides an invalid model name. The <concept> gets replaced with <None> in the prompt. * fix loading .pt embeddings; allow multi-vector embeddings; warn on dupes * simplify replacement logic and remove cuda assumption * download list of concepts from hugging face * remove misleading customization of '*' placeholder the existing code as-is did not do anything; unclear what it was supposed to do. the obvious alternative -- setting using 'placeholder_strings' instead of 'placeholder_tokens' to match model.params.personalization_config.params.placeholder_strings -- caused a crash. i think this is because the passed string also needed to be handed over on init of the PersonalizedBase as the 'placeholder_token' argument. this is weird config dict magic and i don't want to touch it. put a breakpoint in personalzied.py line 116 (top of PersonalizedBase.__init__) if you want to have a crack at it yourself. * address all the issues raised by damian0815 in review of PR #1526 * actually resize the token_embeddings * multiple improvements to the concept loader based on code reviews 1. Activated the --embedding_directory option (alias --embedding_path) to load a single embedding or an entire directory of embeddings at startup time. 2. Can turn off automatic loading of embeddings using --no-embeddings. 3. Embedding checkpoints are scanned with the pickle scanner. 4. More informative error messages when a concept can't be loaded due either to a 404 not found error or a network error. * autocomplete terms end with ">" now * fix startup error and network unreachable 1. If the .invokeai file does not contain the --root and --outdir options, invoke.py will now fix it. 2. Catch and handle network problems when downloading hugging face textual inversion concepts. * fix misformatted error string Co-authored-by: Damian Stewart <d@damianstewart.com> * model_cache.py: fix list_models Signed-off-by: devops117 <55235206+devops117@users.noreply.github.com> * add statement of values (#1584) * this adds the Statement of Values Google doc source = https://docs.google.com/document/d/1-PrUKDJcxy8OyNGc8CyiHhv2VgLvjt7LRGlEpbg1nmQ/edit?usp=sharing * Fix heading * Update InvokeAI_Statement_of_Values.md * Update InvokeAI_Statement_of_Values.md * Update InvokeAI_Statement_of_Values.md * Update InvokeAI_Statement_of_Values.md * Update InvokeAI_Statement_of_Values.md * add keturn and mauwii to the team member list * Fix punctuation * this adds the Statement of Values Google doc source = https://docs.google.com/document/d/1-PrUKDJcxy8OyNGc8CyiHhv2VgLvjt7LRGlEpbg1nmQ/edit?usp=sharing * add keturn and mauwii to the team member list * fix formating - make sub bullets use * (decide to all use - or *) - indent sub bullets Sorry, first only looked at the code version and found this only after looking at the markdown rendered version * use multiparagraph numbered sections * Break up Statement Of Values as per comments on #1584 * remove duplicated word, reduce vagueness it's important not to overstate how many artists we are consulting. * fix typo (sorry blessedcoolant) Co-authored-by: mauwii <Mauwii@outlook.de> Co-authored-by: damian <git@damianstewart.com> * update dockerfile (#1551) * update dockerfile * remove not existing file from .dockerignore * remove bloat and unecesary step also use --no-cache-dir for pip install image is now close to 2GB * make Dockerfile a variable * set base image to `ubuntu:22.10` * add build-essential * link outputs folder for persistence * update tag variable * update docs * fix not customizeable build args, add reqs output * !model_import autocompletes in ROOTDIR * Adds psychedelicious to statement of values signature (#1602) * add a --no-patchmatch option to disable patchmatch loading (#1598) This feature was added to prevent the CI Macintosh tests from erroring out when patchmatch is unable to retrieve its shared library from github assets. * Fix #1599 by relaxing the `match_trigger` regex (#1601) * Fix #1599 by relaxing the `match_trigger` regex Also simplify logic and reduce duplication. * restrict trigger regex again (but not so far) * make concepts library work with Web UI This PR makes it possible to include a Hugging Face concepts library <style-or-subject-trigger> in the WebUI prompt. The metadata seems to be correctly handled. * documentation enhancements (#1603) - Add documentation for the Hugging Face concepts library and TI embedding. - Fixup index.md to point to each of the feature documentation files, including ones that are pending. * tweak setup and environment files for linux & pypatchmatch (#1580) * tweak setup and environment files for linux & pypatchmatch - Downgrade python requirements to 3.9 because 3.10 is not supported on Ubuntu 20.04 LTS (widely-used distro) - Use our github pypatchmatch 0.1.3 in order to install Makefile where it needs to be. - Restored "-e ." as the last install step on pip installs. Hopefully this will not trigger the high-CPU hang we've previously experienced. * keep windows on basicsr 1.4.1 * keep windows on basicsr 1.4.1 * bump pypatchmatch requirement to 0.1.4 - This brings in a version of pypatchmatch that will gracefully handle internet connection not available at startup time. - Also refactors and simplifies the handling of gfpgan's basicsr requirement across various platforms. * revert to older version of list_models() (#1611) This restores the correct behavior of list_models() and quenches the bug of list_models() returning a single model entry named "name". I have not investigated what was wrong with the new version, but I think it may have to do with changes to the behavior in dict.update() * Fixes for #1604 (#1605) * Converts ESRGAN image input to RGB - Also adds typing for image input. - Partially resolves #1604 * ensure there are unmasked pixels before color matching Co-authored-by: Kyle Schouviller <kyle0654@hotmail.com> * update index.md (#1609) - comment out non existing link - fix indention - add seperator between feature categories * Debloat-docker (#1612) * debloat Dockerfile - less options more but more userfriendly - better Entrypoint to simulate CLI usage - without command the container still starts the web-host * debloat build.sh * better syntax in run.sh * update Docker docs - fix description of VOLUMENAME - update run script example to reflect new entrypoint * Test installer (#1618) * test linux install * try removing http from parsed requirements * pip install confirmed working on linux * ready for linux testing - rebuilt py3.10-linux-x86_64-cuda-reqs.txt to include pypatchmatch dependency. - point install.sh and install.bat to test-installer branch. * Updates MPS reqs * detect broken readline history files * fix download.pytorch.org URL * Test installer (Win 11) (#1620) Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> * Test installer (MacOS 13.0.1 w/ torch==1.12.0) (#1621) * Test installer (Win 11) * Test installer (MacOS 13.0.1 w/ torch==1.12.0) Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> * change sourceball to development for testing * Test installer (MacOS 13.0.1 w/ torch==1.12.1 & torchvision==1.13.1) (#1622) * Test installer (Win 11) * Test installer (MacOS 13.0.1 w/ torch==1.12.0) * Test installer (MacOS 13.0.1 w/ torch==1.12.1 & torchvision==1.13.1) Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Co-authored-by: Cyrus Chan <82143712+cyruschan360@users.noreply.github.com> Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> * 2.2 Doc Updates (#1589) * Unified Canvas Docs & Assets Unified Canvas draft Advanced Tools Updates Doc Updates (lstein feedback) * copy edits to Unified Canvas docs - consistent capitalisation and feature naming - more intimate address (replace "the user" with "you") for improved User Engagement(tm) - grammatical massaging and *poesie* Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> Co-authored-by: damian <git@damianstewart.com> * include a step after config to `cat ~/.invokeai` (#1629) * disable patchmatch in CI actions (#1626) * disable patchmatch in CI actions * fix indention * replace tab with spaces Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> * Fix installer script for macOS. (#1630) * refer to the platform as 'osx' instead of 'mac', otherwise the composed URL to micromamba is wrong. * move the `-O` option to `tar` to be grouped with the other tar flags to avoid the `-O` being interpreted as something to unarchive. * Removes symlinked environment.yaml (#1631) Was unintentionally added in #1621 * Fix inpainting with iterations (#1635) * fix error when inpainting using runwayml inpainting model (#1634) - error was "Omnibus object has no attribute pil_image" - closes #1596 * add k_dpmpp_2_a and k_dpmpp_2 solvers options (#1389) * add k_dpmpp_2_a and k_dpmpp_2 solvers options * update frontend Co-authored-by: Victor <victorca25@users.noreply.github.com> Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> * add .editorconfig (#1636) * Web UI 2.2 bugfixes (#1572) * Fixes bug preventing multiple images from being generated * Fixes valid seam strength value range * Update Delete Alert Text Indicates to the user that images are not permanently deleted. * Fixes left/right arrows not working on gallery * Fixes initial image on load erroneously set to a user uploaded image Should be a result gallery image. * Lightbox Fixes - Lightbox is now a button in the current image buttons - Lightbox is also now available in the gallery context menu - Lightbox zoom issues fixed - Lightbox has a fade in animation. * Fix image display wrapper in current preview not overflow bounds * Revert "Fix image display wrapper in current preview not overflow bounds" This reverts commit 5511c82714dbf1d1999d64e8bc357bafa34ddf37. * Change Staging Area discard icon from Bin to X * Expose Snap Threshold and Move Snap Settings to BBox Panel * Changes img2img strength default to 0.75 * Fixes drawing triggering when mouse enters canvas w/ button down When we only supported inpainting and no zoom, this was useful. It allowed the cursor to leave the canvas (which was easy to do given the limited canvas dimensions) and without losing the "I am drawing" state. With a zoomable canvas this is no longer as useful. Additionally, we have more popovers and tools (like the color pickers) which result in unexpected brush strokes. This fixes that issue. * Revert "Expose Snap Threshold and Move Snap Settings to BBox Panel" We will handle this a bit differently - by allowing the grid origin to be moved. I will dig in at some point. This reverts commit 33c92ecf4da724c2f17d9d91c7ea31a43a2f6deb. * Adds Limit Strokes to Box * Adds fill bounding box button * Adds erase bounding box button * Changes Staging area discard icon to match others * Fixes right click breaking move tool * Fixes brush preview visibility issue with "darken outside box" * Fixes history bugs with addFillRect, addEraseRect, and other actions * Adds missing `key` * Fixes postprocessing being applied to canvas generations * Fixes bbox not getting scaled in various situations * Fixes staging area show image toggle not resetting on accept/discard * Locks down canvas while generating/staging * Fixes move tool breaking when canvas loses focus during move/transform * Hides cursor when restrict strokes is on and mouse outside bbox * Lints * Builds fresh bundle * Fix overlapping hotkey for Fill Bounding Box * Build Fresh Bundle * Fixes bug with mask and bbox overlay * Builds fresh bundle Co-authored-by: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> * disable NSFW checker loading during the CI tests (#1641) * disable NSFW checker loading during the CI tests The NSFW filter apparently causes invoke.py to crash during CI testing, possibly due to out of memory errors. This workaround disables NSFW model loading. * doc change * fix formatting errors in yml files * Configure the NSFW checker at install time with default on (#1624) * configure the NSFW checker at install time with default on 1. Changes the --safety_checker argument to --nsfw_checker and --no-nsfw_checker. The original argument is recognized for backward compatibility. 2. The configure script asks users whether to enable the checker (default yes). Also offers users ability to select default sampler and number of generation steps. 3.Enables the pasting of the caution icon on blurred images when InvokeAI is installed into the package directory. 4. Adds documentation for the NSFW checker, including caveats about accuracy, memory requirements, and intermediate image dispaly. * use better fitting icon * NSFW defaults false for testing * set default back to nsfw active Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> Signed-off-by: devops117 <55235206+devops117@users.noreply.github.com> Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Co-authored-by: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Co-authored-by: Kyle Schouviller <kyle0654@hotmail.com> Co-authored-by: javl <mail@jaspervanloenen.com> Co-authored-by: Kent Keirsey <31807370+hipsterusername@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com> Co-authored-by: Damian Stewart <d@damianstewart.com> Co-authored-by: DevOps117 <55235206+devops117@users.noreply.github.com> Co-authored-by: damian <git@damianstewart.com> Co-authored-by: Damian Stewart <null@damianstewart.com> Co-authored-by: Cyrus Chan <82143712+cyruschan360@users.noreply.github.com> Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> Co-authored-by: Andre LaBranche <dre@mac.com> Co-authored-by: victorca25 <41912303+victorca25@users.noreply.github.com> Co-authored-by: Victor <victorca25@users.noreply.github.com>
2022-11-30 21:12:23 +00:00
elif self.sampler_name == 'k_dpmpp_2_a':
self.sampler = KSampler(self.model, 'dpmpp_2s_ancestral', device=self.device)
elif self.sampler_name == 'k_dpmpp_2':
self.sampler = KSampler(self.model, 'dpmpp_2m', device=self.device)
Refactoring simplet2i (#387) * start refactoring -not yet functional * first phase of refactor done - not sure weighted prompts working * Second phase of refactoring. Everything mostly working. * The refactoring has moved all the hard-core inference work into ldm.dream.generator.*, where there are submodules for txt2img and img2img. inpaint will go in there as well. * Some additional refactoring will be done soon, but relatively minor work. * fix -save_orig flag to actually work * add @neonsecret attention.py memory optimization * remove unneeded imports * move token logging into conditioning.py * add placeholder version of inpaint; porting in progress * fix crash in img2img * inpainting working; not tested on variations * fix crashes in img2img * ported attention.py memory optimization #117 from basujindal branch * added @torch_no_grad() decorators to img2img, txt2img, inpaint closures * Final commit prior to PR against development * fixup crash when generating intermediate images in web UI * rename ldm.simplet2i to ldm.generate * add backward-compatibility simplet2i shell with deprecation warning * add back in mps exception, addresses @vargol comment in #354 * replaced Conditioning class with exported functions * fix wrong type of with_variations attribute during intialization * changed "image_iterator()" to "get_make_image()" * raise NotImplementedError for calling get_make_image() in parent class * Update ldm/generate.py better error message Co-authored-by: Kevin Gibbons <bakkot@gmail.com> * minor stylistic fixes and assertion checks from code review * moved get_noise() method into img2img class * break get_noise() into two methods, one for txt2img and the other for img2img * inpainting works on non-square images now * make get_noise() an abstract method in base class * much improved inpainting Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
2022-09-06 00:40:10 +00:00
elif self.sampler_name == 'k_euler_a':
2022-10-27 21:12:22 +00:00
self.sampler = KSampler(self.model, 'euler_ancestral', device=self.device)
Refactoring simplet2i (#387) * start refactoring -not yet functional * first phase of refactor done - not sure weighted prompts working * Second phase of refactoring. Everything mostly working. * The refactoring has moved all the hard-core inference work into ldm.dream.generator.*, where there are submodules for txt2img and img2img. inpaint will go in there as well. * Some additional refactoring will be done soon, but relatively minor work. * fix -save_orig flag to actually work * add @neonsecret attention.py memory optimization * remove unneeded imports * move token logging into conditioning.py * add placeholder version of inpaint; porting in progress * fix crash in img2img * inpainting working; not tested on variations * fix crashes in img2img * ported attention.py memory optimization #117 from basujindal branch * added @torch_no_grad() decorators to img2img, txt2img, inpaint closures * Final commit prior to PR against development * fixup crash when generating intermediate images in web UI * rename ldm.simplet2i to ldm.generate * add backward-compatibility simplet2i shell with deprecation warning * add back in mps exception, addresses @vargol comment in #354 * replaced Conditioning class with exported functions * fix wrong type of with_variations attribute during intialization * changed "image_iterator()" to "get_make_image()" * raise NotImplementedError for calling get_make_image() in parent class * Update ldm/generate.py better error message Co-authored-by: Kevin Gibbons <bakkot@gmail.com> * minor stylistic fixes and assertion checks from code review * moved get_noise() method into img2img class * break get_noise() into two methods, one for txt2img and the other for img2img * inpainting works on non-square images now * make get_noise() an abstract method in base class * much improved inpainting Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
2022-09-06 00:40:10 +00:00
elif self.sampler_name == 'k_euler':
self.sampler = KSampler(self.model, 'euler', device=self.device)
elif self.sampler_name == 'k_heun':
self.sampler = KSampler(self.model, 'heun', device=self.device)
elif self.sampler_name == 'k_lms':
self.sampler = KSampler(self.model, 'lms', device=self.device)
else:
msg = f'>> Unsupported Sampler: {self.sampler_name}, Defaulting to plms'
self.sampler = PLMSSampler(self.model, device=self.device)
print(msg)
use 🧨diffusers model (#1583) * initial commit of DiffusionPipeline class * spike: proof of concept using diffusers for txt2img * doc: type hints for Generator * refactor(model_cache): factor out load_ckpt * model_cache: add ability to load a diffusers model pipeline and update associated things in Generate & Generator to not instantly fail when that happens * model_cache: fix model default image dimensions * txt2img: support switching diffusers schedulers * diffusers: let the scheduler do its scaling of the initial latents Remove IPNDM scheduler; it is not behaving. * web server: update image_progress callback for diffusers data * diffusers: restore prompt weighting feature * diffusers: fix set-sampler error following model switch * diffusers: use InvokeAIDiffuserComponent for conditioning * cross_attention_control: stub (no-op) implementations for diffusers * model_cache: let offload_model work with DiffusionPipeline, sorta. * models.yaml.example: add diffusers-format model, set as default * test-invoke-conda: use diffusers-format model test-invoke-conda: put huggingface-token where the library can use it * environment-mac: upgrade to diffusers 0.7 (from 0.6) this was already done for linux; mac must have been lost in the merge. * preload_models: explicitly load diffusers models In non-interactive mode too, as long as you're logged in. * fix(model_cache): don't check `model.config` in diffusers format clean-up from recent merge. * diffusers integration: support img2img * dev: upgrade to diffusers 0.8 (from 0.7.1) We get to remove some code by using methods that were factored out in the base class. * refactor: remove backported img2img.get_timesteps now that we can use it directly from diffusers 0.8.1 * ci: use diffusers model * dev: upgrade to diffusers 0.9 (from 0.8.1) * lint: correct annotations for Python 3.9. * lint: correct AttributeError.name reference for Python 3.9. * CI: prefer diffusers-1.4 because it no longer requires a token The RunwayML models still do. * build: there's yet another place to update requirements? * configure: try to download models even without token Models in the CompVis and stabilityai repos no longer require them. (But runwayml still does.) * configure: add troubleshooting info for config-not-found * fix(configure): prepend root to config path * fix(configure): remove second `default: true` from models example * CI: simplify test-on-push logic now that we don't need secrets The "test on push but only in forks" logic was only necessary when tests didn't work for PRs-from-forks. * create an embedding_manager for diffusers * internal: avoid importing diffusers DummyObject see https://github.com/huggingface/diffusers/issues/1479 * fix "config attributes…not expected" diffusers warnings. * fix deprecated scheduler construction * work around an apparent MPS torch bug that causes conditioning to have no effect * 🚧 post-rebase repair * preliminary support for outpainting (no masking yet) * monkey-patch diffusers.attention and use Invoke lowvram code * add always_use_cpu arg to bypass MPS * add cross-attention control support to diffusers (fails on MPS) For unknown reasons MPS produces garbage output with .swap(). Use --always_use_cpu arg to invoke.py for now to test this code on MPS. * diffusers support for the inpainting model * fix debug_image to not crash with non-RGB images. * inpainting for the normal model [WIP] This seems to be performing well until the LAST STEP, at which point it dissolves to confetti. * fix off-by-one bug in cross-attention-control (#1774) prompt token sequences begin with a "beginning-of-sequence" marker <bos> and end with a repeated "end-of-sequence" marker <eos> - to make a default prompt length of <bos> + 75 prompt tokens + <eos>. the .swap() code was failing to take the column for <bos> at index 0 into account. the changes here do that, and also add extra handling for a single <eos> (which may be redundant but which is included for completeness). based on my understanding and some assumptions about how this all works, the reason .swap() nevertheless seemed to do the right thing, to some extent, is because over multiple steps the conditioning process in Stable Diffusion operates as a feedback loop. a change to token n-1 has flow-on effects to how the [1x4x64x64] latent tensor is modified by all the tokens after it, - and as the next step is processed, all the tokens before it as well. intuitively, a token's conditioning effects "echo" throughout the whole length of the prompt. so even though the token at n-1 was being edited when what the user actually wanted was to edit the token at n, it nevertheless still had some non-negligible effect, in roughly the right direction, often enough that it seemed like it was working properly. * refactor common CrossAttention stuff into a mixin so that the old ldm code can still work if necessary * inpainting for the normal model. I think it works this time. * diffusers: reset num_vectors_per_token sync with 44a00555718f1df173c60da0ed646cf700e29537 * diffusers: txt2img2img (hires_fix) with so much slicing and dicing of pipeline methods to stitch them together * refactor(diffusers): reduce some code duplication amongst the different tasks * fixup! refactor(diffusers): reduce some code duplication amongst the different tasks * diffusers: enable DPMSolver++ scheduler * diffusers: upgrade to diffusers 0.10, add Heun scheduler * diffusers(ModelCache): stopgap to make from_cpu compatible with diffusers * CI: default to diffusers-1.5 now that runwayml token requirement is gone * diffusers: update to 0.10 (and transformers to 4.25) * diffusers: use xformers when available diffusers no longer auto-enables this as of 0.10.2. * diffusers: make masked img2img behave better with multi-step schedulers re-randomizing the noise each step was confusing them. * diffusers: work more better with more models. fixed relative path problem with local models. fixed models on hub not always having a `fp16` branch. * diffusers: stopgap fix for attention_maps_callback crash after recent merge * fixup import merge conflicts correction for 061c5369a2247c6c92cd69606bcf54c4f1962a0b * test: add tests/inpainting inputs for masked img2img * diffusers(AddsMaskedGuidance): partial fix for k-schedulers Prevents them from crashing, but results are still hot garbage. * fix --safety_checker arg parsing and add note to diffusers loader about where safety checker gets called * generate: fix import error * CI: don't try to read the old init location * diffusers: support loading an alternate VAE * CI: remove sh-syntax if-statement so it doesn't crash powershell * CI: fold strings in yaml because backslash is not line-continuation in powershell * attention maps callback stuff for diffusers * build: fix syntax error in environment-mac * diffusers: add INITIAL_MODELS with diffusers-compatible repos * re-enable the embedding manager; closes #1778 * Squashed commit of the following: commit e4a956abc37fcb5cf188388b76b617bc5c8fda7d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:43:07 2022 +0100 import new load handling from EmbeddingManager and cleanup commit c4abe91a5ba0d415b45bf734068385668b7a66e6 Merge: 032e856e 1efc6397 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:09:53 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers_with_textual_inversion_manager commit 032e856eefb3bbc39534f5daafd25764bcfcef8b Merge: 8b4f0fe9 bc515e24 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:08:01 2022 +0100 Merge remote-tracking branch 'upstream/dev/diffusers' into dev/diffusers_with_textual_inversion_manager commit 1efc6397fc6e61c1aff4b0258b93089d61de5955 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 15:04:28 2022 +0100 cleanup and add performance notes commit e400f804ac471a0ca2ba432fd658778b20c7bdab Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:45:07 2022 +0100 fix bug and update unit tests commit deb9ae0ae1016750e93ce8275734061f7285a231 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 14:28:29 2022 +0100 textual inversion manager seems to work commit 162e02505dec777e91a983c4d0fb52e950d25ff0 Merge: cbad4583 12769b3d Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:58:03 2022 +0100 Merge branch 'main' into feature_textual_inversion_mgr commit cbad45836c6aace6871a90f2621a953f49433131 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:54:10 2022 +0100 use position embeddings commit 070344c69b0e0db340a183857d0a787b348681d3 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:53:47 2022 +0100 Don't crash CLI on exceptions commit b035ac8c6772dfd9ba41b8eeb9103181cda028f8 Author: Damian Stewart <d@damianstewart.com> Date: Sun Dec 18 11:11:55 2022 +0100 add missing position_embeddings commit 12769b3d3562ef71e0f54946b532ad077e10043c Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:33:25 2022 +0100 debugging why it don't work commit bafb7215eabe1515ca5e8388fd3bb2f3ac5362cf Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 13:21:33 2022 +0100 debugging why it don't work commit 664a6e9e146b42d96703f0cc8baf8f5efec04ee1 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit 8b4f0fe9d6e4e2643b36dfa27864294785d7ba4e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit ffbe1ab11163ba712e353d89404e301d0e0c6cdf Merge: 6e4dad60 023df37e Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:37:31 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers commit 023df37efffa67434f77def7fc3c9dfb29f699fd Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:36:54 2022 +0100 cleanup commit 05fac594eaf79d0058e3c48deee93df603f136c2 Author: Damian Stewart <d@damianstewart.com> Date: Fri Dec 16 02:07:49 2022 +0100 tweak error checking commit 009f32ed39a7280997c3ffab112adadee0b44279 Author: damian <null@damianstewart.com> Date: Thu Dec 15 21:29:47 2022 +0100 unit tests passing for embeddings with vector length >1 commit beb1b08d9a98112ed2fe073580568e1a18698da3 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:39:09 2022 +0100 more explicit equality tests when overwriting commit 44d8a5a7c85cdabc9ce3a54fd0769a10597b3ca9 Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 13:30:13 2022 +0100 wip textual inversion manager (unit tests passing for 1v embedding overwriting) commit 417c2b57d90924a839616bfb66804faab8039e4c Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 12:30:55 2022 +0100 wip textual inversion manager (unit tests passing for base stuff + padding) commit 2e80872e3b6f7fd7d8eb8928822bd824b63cb2ff Author: Damian Stewart <d@damianstewart.com> Date: Thu Dec 15 10:57:57 2022 +0100 wip new TextualInversionManager * stop using WeightedFrozenCLIPEmbedder * store diffusion models locally - configure_invokeai.py reconfigured to store diffusion models rather than CompVis models - hugging face caching model is used, but cache is set to ~/invokeai/models/repo_id - models.yaml does **NOT** use path, just repo_id - "repo_name" changed to "repo_id" to following hugging face conventions - Models are loaded with full precision pending further work. * allow non-local files during development * path takes priority over repo_id * MVP for model_cache and configure_invokeai - Feature complete (almost) - configure_invokeai.py downloads both .ckpt and diffuser models, along with their VAEs. Both types of download are controlled by a unified INITIAL_MODELS.yaml file. - model_cache can load both type of model and switches back and forth in CPU. No memory leaks detected TO DO: 1. I have not yet turned on the LocalOnly flag for diffuser models, so the code will check the Hugging Face repo for updates before using the locally cached models. This will break firewalled systems. I am thinking of putting in a global check for internet connectivity at startup time and setting the LocalOnly flag based on this. It would be good to check updates if there is connectivity. 2. I have not gone completely through INITIAL_MODELS.yaml to check which models are available as diffusers and which are not. So models like PaperCut and VoxelArt may not load properly. The runway and stability models are checked, as well as the Trinart models. 3. Add stanzas for SD 2.0 and 2.1 in INITIAL_MODELS.yaml REMAINING PROBLEMS NOT DIRECTLY RELATED TO MODEL_CACHE: 1. When loading a .ckpt file there are lots of messages like this: Warning! ldm.modules.attention.CrossAttention is no longer being maintained. Please use InvokeAICrossAttention instead. I'm not sure how to address this. 2. The ckpt models ***don't actually run*** due to the lack of special-case support for them in the generator objects. For example, here's the hard crash you get when you run txt2img against the legacy waifu-diffusion-1.3 model: ``` >> An error occurred: Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 140, in main main_loop(gen, opt) File "/data/lstein/InvokeAI/ldm/invoke/CLI.py", line 371, in main_loop gen.prompt2image( File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1265, in __getattr__ raise AttributeError("'{}' object has no attribute '{}'".format( AttributeError: 'LatentDiffusion' object has no attribute 'image_from_embeddings' ``` 3. The inpainting diffusion model isn't working. Here's the output of "banana sushi" when inpainting-1.5 is loaded: ``` Traceback (most recent call last): File "/data/lstein/InvokeAI/ldm/generate.py", line 496, in prompt2image results = generator.generate( File "/data/lstein/InvokeAI/ldm/invoke/generator/base.py", line 108, in generate image = make_image(x_T) File "/data/lstein/InvokeAI/ldm/invoke/generator/txt2img.py", line 33, in make_image pipeline_output = pipeline.image_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 301, in image_from_embeddings result_latents, result_attention_map_saver = self.latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 330, in latents_from_embeddings result: PipelineIntermediateState = infer_latents_from_embeddings( File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 185, in __call__ for result in self.generator_method(*args, **kwargs): File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 367, in generate_latents_from_embeddings step_output = self.step(batched_t, latents, guidance_scale, File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context return func(*args, **kwargs) File "/data/lstein/InvokeAI/ldm/invoke/generator/diffusers_pipeline.py", line 409, in step step_output = self.scheduler.step(noise_pred, timestep, latents, **extra_step_kwargs) File "/home/lstein/invokeai/.venv/lib/python3.9/site-packages/diffusers/schedulers/scheduling_lms_discrete.py", line 223, in step pred_original_sample = sample - sigma * model_output RuntimeError: The size of tensor a (9) must match the size of tensor b (4) at non-singleton dimension 1 ``` * proper support for float32/float16 - configure script now correctly detects user's preference for fp16/32 and downloads the correct diffuser version. If fp16 version not available, falls back to fp32 version. - misc code cleanup and simplification in model_cache * add on-the-fly conversion of .ckpt to diffusers models 1. On-the-fly conversion code can be found in the file ldm/invoke/ckpt_to_diffusers.py. 2. A new !optimize command has been added to the CLI. Should be ported to Web GUI. User experience on the CLI is this: ``` invoke> !optimize /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt INFO: Converting legacy weights file /home/lstein/invokeai/models/ldm/stable-diffusion-v1/sd-v1-4.ckpt to optimized diffuser model. This operation will take 30-60s to complete. Success. Optimized model is now located at /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 Writing new config file entry for sd-v1-4... >> New configuration: sd-v1-4: description: Optimized version of sd-v1-4 format: diffusers path: /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 OK to import [n]? y >> Verifying that new model loads... >> Current VRAM usage: 2.60G >> Offloading stable-diffusion-2.1 to CPU >> Loading diffusers model from /home/lstein/tmp/invokeai/models/optimized-ckpts/sd-v1-4 | Using faster float16 precision You have disabled the safety checker for <class 'ldm.invoke.generator.diffusers_pipeline.StableDiffusionGeneratorPipeline'> by passing `safety_checker=None`. Ensure that you abide to the conditions of the Stable Diffusion \ license and do not expose unfiltered results in services or applications open to the public. Both the diffusers team and Hugging Face strongly recommend to keep the safety filter enabled in all public facing circumstances,\ disabling it only for use-cases that involve analyzing network behavior or auditing its results. For more information, please have a look at https://github.com/huggingface/diffusers/pull/254 . | training width x height = (512 x 512) >> Model loaded in 3.48s >> Max VRAM used to load the model: 2.17G >> Current VRAM usage:2.17G >> Textual inversions available: >> Setting Sampler to k_lms (LMSDiscreteScheduler) Keep model loaded? [y] ``` * add parallel set of generator files for ckpt legacy generation * generation using legacy ckpt models now working * diffusers: fix missing attention_maps_callback fix for 23eb80b40421b2bb8f4b6d3dd30490d11c447b36 * associate legacy CrossAttention with .ckpt models * enable autoconvert New --autoconvert CLI option will scan a designated directory for new .ckpt files, convert them into diffuser models, and import them into models.yaml. Works like this: invoke.py --autoconvert /path/to/weights/directory In ModelCache added two new methods: autoconvert_weights(config_path, weights_directory_path, models_directory_path) convert_and_import(ckpt_path, diffuser_path) * diffusers: update to diffusers 0.11 (from 0.10.2) * fix vae loading & width/height calculation * refactor: encapsulate these conditioning data into one container * diffusers: fix some noise-scaling issues by pushing the noise-mixing down to the common function * add support for safetensors and accelerate * set local_files_only when internet unreachable * diffusers: fix error-handling path when model repo has no fp16 branch * fix generatorinpaint error Fixes : "ModuleNotFoundError: No module named 'ldm.invoke.generatorinpaint' https://github.com/invoke-ai/InvokeAI/pull/1583#issuecomment-1363634318 * quench diffuser safety-checker warning * diffusers: support stochastic DDIM eta parameter * fix conda env creation on macos * fix cross-attention with diffusers 0.11 * diffusers: the VAE needs to be tiling as well as the U-Net * diffusers: comment on subfolders * diffusers: embiggen! * diffusers: make model_cache.list_models serializable * diffusers(inpaint): restore scaling functionality * fix requirements clash between numba and numpy 1.24 * diffusers: allow inpainting model to do non-inpainting tasks * start expanding model_cache functionality * add import_ckpt_model() and import_diffuser_model() methods to model_manager - in addition, model_cache.py is now renamed to model_manager.py * allow "recommended" flag to be optional in INITIAL_MODELS.yaml * configure_invokeai now downloads VAE diffusers in advance * rename ModelCache to ModelManager * remove support for `repo_name` in models.yaml * check for and refuse to load embeddings trained on incompatible models * models.yaml.example: s/repo_name/repo_id and remove extra INITIAL_MODELS now that the main one has diffusers models in it. * add MVP textual inversion script * refactor(InvokeAIDiffuserComponent): factor out _combine() * InvokeAIDiffuserComponent: implement threshold * InvokeAIDiffuserComponent: diagnostic logs for threshold ...this does not look right * add a curses-based frontend to textual inversion - not quite working yet - requires npyscreen installed - on windows will also have the windows-curses requirement, but not added to requirements yet * add curses-based interface for textual inversion * fix crash in convert_and_import() - This corrects a "local variable referenced before assignment" error in model_manager.convert_and_import() * potential workaround for no 'state_dict' key error - As reported in https://github.com/huggingface/diffusers/issues/1876 * create TI output dir if needed * Update environment-lin-cuda.yml (#2159) Fixing line 42 to be the proper order to define the transformers requirement: ~= instead of =~ * diffusers: update sampler-to-scheduler mapping based on https://github.com/huggingface/diffusers/issues/277#issuecomment-1371428672 * improve user exp for ckt to diffusers conversion - !optimize_models command now operates on an existing ckpt file entry in models.yaml - replaces existing entry, rather than adding a new one - offers to delete the ckpt file after conversion * web: adapt progress callback to deal with old generator or new diffusers pipeline * clean-up model_manager code - add_model() verified to work for .ckpt local paths, .ckpt remote URLs, diffusers local paths, and diffusers repo_ids - convert_and_import() verified to work for local and remove .ckpt files * handle edge cases for import_model() and convert_model() * add support for safetensor .ckpt files * fix name error * code cleanup with pyflake * improve model setting behavior - If the user enters an invalid model name at startup time, will not try to load it, warn, and use default model - CLI UI enhancement: include currently active model in the command line prompt. * update test-invoke-pip.yml - fix model cache path to point to runwayml/stable-diffusion-v1-5 - remove `skip-sd-weights` from configure_invokeai.py args * exclude dev/diffusers from "fail for draft PRs" * disable "fail on PR jobs" * re-add `--skip-sd-weights` since no space * update workflow environments - include `INVOKE_MODEL_RECONFIGURE: '--yes'` * clean up model load failure handling - Allow CLI to run even when no model is defined or loadable. - Inhibit stack trace when model load fails - only show last error - Give user *option* to run configure_invokeai.py when no models successfully load. - Restart invokeai after reconfiguration. * further edge-case handling 1) only one model in models.yaml file, and that model is broken 2) no models in models.yaml 3) models.yaml doesn't exist at all * fix incorrect model status listing - "cached" was not being returned from list_models() - normalize handling of exceptions during model loading: - Passing an invalid model name to generate.set_model() will return a KeyError - All other exceptions are returned as the appropriate Exception * CI: do download weights (if not already cached) * diffusers: fix scheduler loading in offline mode * CI: fix model name (no longer has `diffusers-` prefix) * Update txt2img2img.py (#2256) * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * feat - make model storage compatible with hugging face caching system This commit alters the InvokeAI model directory to be compatible with hugging face, making it easier to share diffusers (and other models) across different programs. - If the HF_HOME environment variable is not set, then models are cached in ~/invokeai/models in a format that is identical to the HuggingFace cache. - If HF_HOME is set, then models are cached wherever HF_HOME points. - To enable sharing with other HuggingFace library clients, set HF_HOME to ~/.cache/huggingface to set the default cache location or to ~/invokeai/models to have huggingface cache inside InvokeAI. * fixes to share models with HuggingFace cache system - If HF_HOME environment variable is defined, then all huggingface models are stored in that directory following the standard conventions. - For seamless interoperability, set HF_HOME to ~/.cache/huggingface - If HF_HOME not defined, then models are stored in ~/invokeai/models. This is equivalent to setting HF_HOME to ~/invokeai/models A future commit will add a migration mechanism so that this change doesn't break previous installs. * fix error "no attribute CkptInpaint" * model_manager.list_models() returns entire model config stanza+status * Initial Draft - Model Manager Diffusers * added hash function to diffusers * implement sha256 hashes on diffusers models * Add Model Manager Support for Diffusers * fix various problems with model manager - in cli import functions, fix not enough values to unpack from _get_name_and_desc() - fix crash when using old-style vae: value with new-style diffuser * rebuild frontend * fix dictconfig-not-serializable issue * fix NoneType' object is not subscriptable crash in model_manager * fix "str has no attribute get" error in model_manager list_models() * Add path and repo_id support for Diffusers Model Manager Also fixes bugs * Fix tooltip IT localization not working * Add Version Number To WebUI * Optimize Model Search * Fix incorrect font on the Model Manager UI * Fix image degradation on merge fixes - [Experimental] This change should effectively fix a couple of things. - Fix image degradation on subsequent merges of the canvas layers. - Fix the slight transparent border that is left behind when filling the bounding box with a color. - Fix the left over line of color when filling a bounding box with color. So far there are no side effects for this. If any, please report. * Add local model filtering for Diffusers / Checkpoints * Go to home on modal close for the Add Modal UI * Styling Fixes * Model Manager Diffusers Localization Update * Add Safe Tensor scanning to Model Manager * Fix model edit form dispatching string values instead of numbers. * Resolve VAE handling / edge cases for supplied repos * defer injecting tokens for textual inversions until they're used for the first time * squash a console warning * implement model migration check * add_model() overwrites previous config rather than merges * fix model config file attribute merging * fix precision handling in textual inversion script * allow ckpt conversion script to work with safetensors .ckpts Applied patch here: https://github.com/huggingface/diffusers/commit/beb932c5d111872c5e45387e7b1b2b3dd0524a47 * fix name "args" is not defined crash in textual_inversion_training * fix a second NameError: name 'args' is not defined crash * fix loading of the safety checker from the global cache dir * add installation step to textual inversion frontend - After a successful training run, the script will copy learned_embeds.bin to a subfolder of the embeddings directory. - User given the option to delete the logs and intermediate checkpoints (which together use 7-8G of space) - If textual inversion training fails, reports the error gracefully. * don't crash out on incompatible embeddings - put try: blocks around places where the system tries to load an embedding which is incompatible with the currently loaded model * add support for checkpoint resuming * textual inversion preferences are saved and restored between sessions - Preferences are stored in a file named text-inversion-training/preferences.conf - Currently the resume-from-checkpoint option is not working correctly. Possible bug in textual_inversion_training.py? * copy learned_embeddings.bin into right location * add front end for diffusers model merging - Front end doesn't do anything yet!!!! - Made change to model name parsing in CLI to support ability to have merged models with the "+" character in their names. * improve inpainting experience - recommend ckpt version of inpainting-1.5 to user - fix get_noise() bug in ckpt version of omnibus.py * update environment*yml * tweak instructions to install HuggingFace token * bump version number * enhance update scripts - update scripts will now fetch new INITIAL_MODELS.yaml so that configure_invokeai.py will know about the diffusers versions. * enhance invoke.sh/invoke.bat launchers - added configure_invokeai.py to menu - menu defaults to browser-based invoke * remove conda workflow (#2321) * fix `token_ids has shape torch.Size([79]) - expected [77]` * update CHANGELOG.md with 2.3.* info - Add information on how formats have changed and the upgrade process. - Add short bug list. Co-authored-by: Damian Stewart <d@damianstewart.com> Co-authored-by: Damian Stewart <null@damianstewart.com> Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> Co-authored-by: Wybartel-luxmc <37852506+Wybartel-luxmc@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> Co-authored-by: mickr777 <115216705+mickr777@users.noreply.github.com> Co-authored-by: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Co-authored-by: Eugene Brodsky <ebr@users.noreply.github.com> Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com>
2023-01-15 14:22:46 +00:00
def _set_scheduler(self):
default = self.model.scheduler
# See https://github.com/huggingface/diffusers/issues/277#issuecomment-1371428672
scheduler_map = dict(
ddim=diffusers.DDIMScheduler,
dpmpp_2=diffusers.DPMSolverMultistepScheduler,
k_dpm_2=diffusers.KDPM2DiscreteScheduler,
k_dpm_2_a=diffusers.KDPM2AncestralDiscreteScheduler,
# DPMSolverMultistepScheduler is technically not `k_` anything, as it is neither
# the k-diffusers implementation nor included in EDM (Karras 2022), but we can
# provide an alias for compatibility.
k_dpmpp_2=diffusers.DPMSolverMultistepScheduler,
k_euler=diffusers.EulerDiscreteScheduler,
k_euler_a=diffusers.EulerAncestralDiscreteScheduler,
k_heun=diffusers.HeunDiscreteScheduler,
k_lms=diffusers.LMSDiscreteScheduler,
plms=diffusers.PNDMScheduler,
)
if self.sampler_name in scheduler_map:
sampler_class = scheduler_map[self.sampler_name]
msg = f'>> Setting Sampler to {self.sampler_name} ({sampler_class.__name__})'
self.sampler = sampler_class.from_config(self.model.scheduler.config)
else:
msg = (f'>> Unsupported Sampler: {self.sampler_name} '
f'Defaulting to {default}')
self.sampler = default
print(msg)
if not hasattr(self.sampler, 'uses_inpainting_model'):
# FIXME: terrible kludge!
self.sampler.uses_inpainting_model = lambda: False
def _load_img(self, img)->Image:
if isinstance(img, Image.Image):
image = img
print(
f'>> using provided input image of size {image.width}x{image.height}'
)
2022-09-24 08:54:57 +00:00
elif isinstance(img, str):
assert os.path.exists(img), f'>> {img}: File not found'
image = Image.open(img)
print(
f'>> loaded input image of size {image.width}x{image.height} from {img}'
)
else:
image = Image.open(img)
print(
f'>> loaded input image of size {image.width}x{image.height}'
)
image = ImageOps.exif_transpose(image)
return image
def _create_init_image(self, image: Image.Image, width, height, fit=True):
if image.mode != 'RGBA':
2022-10-29 15:47:06 +00:00
image = image.convert('RGBA')
image = self._fit_image(image, (width, height)) if fit else self._squeeze_image(image)
return image
Refactoring simplet2i (#387) * start refactoring -not yet functional * first phase of refactor done - not sure weighted prompts working * Second phase of refactoring. Everything mostly working. * The refactoring has moved all the hard-core inference work into ldm.dream.generator.*, where there are submodules for txt2img and img2img. inpaint will go in there as well. * Some additional refactoring will be done soon, but relatively minor work. * fix -save_orig flag to actually work * add @neonsecret attention.py memory optimization * remove unneeded imports * move token logging into conditioning.py * add placeholder version of inpaint; porting in progress * fix crash in img2img * inpainting working; not tested on variations * fix crashes in img2img * ported attention.py memory optimization #117 from basujindal branch * added @torch_no_grad() decorators to img2img, txt2img, inpaint closures * Final commit prior to PR against development * fixup crash when generating intermediate images in web UI * rename ldm.simplet2i to ldm.generate * add backward-compatibility simplet2i shell with deprecation warning * add back in mps exception, addresses @vargol comment in #354 * replaced Conditioning class with exported functions * fix wrong type of with_variations attribute during intialization * changed "image_iterator()" to "get_make_image()" * raise NotImplementedError for calling get_make_image() in parent class * Update ldm/generate.py better error message Co-authored-by: Kevin Gibbons <bakkot@gmail.com> * minor stylistic fixes and assertion checks from code review * moved get_noise() method into img2img class * break get_noise() into two methods, one for txt2img and the other for img2img * inpainting works on non-square images now * make get_noise() an abstract method in base class * much improved inpainting Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
2022-09-06 00:40:10 +00:00
def _create_init_mask(self, image, width, height, fit=True):
Refactoring simplet2i (#387) * start refactoring -not yet functional * first phase of refactor done - not sure weighted prompts working * Second phase of refactoring. Everything mostly working. * The refactoring has moved all the hard-core inference work into ldm.dream.generator.*, where there are submodules for txt2img and img2img. inpaint will go in there as well. * Some additional refactoring will be done soon, but relatively minor work. * fix -save_orig flag to actually work * add @neonsecret attention.py memory optimization * remove unneeded imports * move token logging into conditioning.py * add placeholder version of inpaint; porting in progress * fix crash in img2img * inpainting working; not tested on variations * fix crashes in img2img * ported attention.py memory optimization #117 from basujindal branch * added @torch_no_grad() decorators to img2img, txt2img, inpaint closures * Final commit prior to PR against development * fixup crash when generating intermediate images in web UI * rename ldm.simplet2i to ldm.generate * add backward-compatibility simplet2i shell with deprecation warning * add back in mps exception, addresses @vargol comment in #354 * replaced Conditioning class with exported functions * fix wrong type of with_variations attribute during intialization * changed "image_iterator()" to "get_make_image()" * raise NotImplementedError for calling get_make_image() in parent class * Update ldm/generate.py better error message Co-authored-by: Kevin Gibbons <bakkot@gmail.com> * minor stylistic fixes and assertion checks from code review * moved get_noise() method into img2img class * break get_noise() into two methods, one for txt2img and the other for img2img * inpainting works on non-square images now * make get_noise() an abstract method in base class * much improved inpainting Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
2022-09-06 00:40:10 +00:00
# convert into a black/white mask
image = self._image_to_mask(image)
Refactoring simplet2i (#387) * start refactoring -not yet functional * first phase of refactor done - not sure weighted prompts working * Second phase of refactoring. Everything mostly working. * The refactoring has moved all the hard-core inference work into ldm.dream.generator.*, where there are submodules for txt2img and img2img. inpaint will go in there as well. * Some additional refactoring will be done soon, but relatively minor work. * fix -save_orig flag to actually work * add @neonsecret attention.py memory optimization * remove unneeded imports * move token logging into conditioning.py * add placeholder version of inpaint; porting in progress * fix crash in img2img * inpainting working; not tested on variations * fix crashes in img2img * ported attention.py memory optimization #117 from basujindal branch * added @torch_no_grad() decorators to img2img, txt2img, inpaint closures * Final commit prior to PR against development * fixup crash when generating intermediate images in web UI * rename ldm.simplet2i to ldm.generate * add backward-compatibility simplet2i shell with deprecation warning * add back in mps exception, addresses @vargol comment in #354 * replaced Conditioning class with exported functions * fix wrong type of with_variations attribute during intialization * changed "image_iterator()" to "get_make_image()" * raise NotImplementedError for calling get_make_image() in parent class * Update ldm/generate.py better error message Co-authored-by: Kevin Gibbons <bakkot@gmail.com> * minor stylistic fixes and assertion checks from code review * moved get_noise() method into img2img class * break get_noise() into two methods, one for txt2img and the other for img2img * inpainting works on non-square images now * make get_noise() an abstract method in base class * much improved inpainting Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
2022-09-06 00:40:10 +00:00
image = image.convert('RGB')
image = self._fit_image(image, (width, height)) if fit else self._squeeze_image(image)
return image
Refactoring simplet2i (#387) * start refactoring -not yet functional * first phase of refactor done - not sure weighted prompts working * Second phase of refactoring. Everything mostly working. * The refactoring has moved all the hard-core inference work into ldm.dream.generator.*, where there are submodules for txt2img and img2img. inpaint will go in there as well. * Some additional refactoring will be done soon, but relatively minor work. * fix -save_orig flag to actually work * add @neonsecret attention.py memory optimization * remove unneeded imports * move token logging into conditioning.py * add placeholder version of inpaint; porting in progress * fix crash in img2img * inpainting working; not tested on variations * fix crashes in img2img * ported attention.py memory optimization #117 from basujindal branch * added @torch_no_grad() decorators to img2img, txt2img, inpaint closures * Final commit prior to PR against development * fixup crash when generating intermediate images in web UI * rename ldm.simplet2i to ldm.generate * add backward-compatibility simplet2i shell with deprecation warning * add back in mps exception, addresses @vargol comment in #354 * replaced Conditioning class with exported functions * fix wrong type of with_variations attribute during intialization * changed "image_iterator()" to "get_make_image()" * raise NotImplementedError for calling get_make_image() in parent class * Update ldm/generate.py better error message Co-authored-by: Kevin Gibbons <bakkot@gmail.com> * minor stylistic fixes and assertion checks from code review * moved get_noise() method into img2img class * break get_noise() into two methods, one for txt2img and the other for img2img * inpainting works on non-square images now * make get_noise() an abstract method in base class * much improved inpainting Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
2022-09-06 00:40:10 +00:00
# The mask is expected to have the region to be inpainted
# with alpha transparency. It converts it into a black/white
# image with the transparent part black.
def _image_to_mask(self, mask_image: Image.Image, invert=False) -> Image:
# Obtain the mask from the transparency channel
if mask_image.mode == 'L':
mask = mask_image
elif mask_image.mode in ('RGB', 'P'):
mask = mask_image.convert('L')
else:
# Obtain the mask from the transparency channel
mask = Image.new(mode="L", size=mask_image.size, color=255)
mask.putdata(mask_image.getdata(band=3))
if invert:
mask = ImageOps.invert(mask)
return mask
Refactoring simplet2i (#387) * start refactoring -not yet functional * first phase of refactor done - not sure weighted prompts working * Second phase of refactoring. Everything mostly working. * The refactoring has moved all the hard-core inference work into ldm.dream.generator.*, where there are submodules for txt2img and img2img. inpaint will go in there as well. * Some additional refactoring will be done soon, but relatively minor work. * fix -save_orig flag to actually work * add @neonsecret attention.py memory optimization * remove unneeded imports * move token logging into conditioning.py * add placeholder version of inpaint; porting in progress * fix crash in img2img * inpainting working; not tested on variations * fix crashes in img2img * ported attention.py memory optimization #117 from basujindal branch * added @torch_no_grad() decorators to img2img, txt2img, inpaint closures * Final commit prior to PR against development * fixup crash when generating intermediate images in web UI * rename ldm.simplet2i to ldm.generate * add backward-compatibility simplet2i shell with deprecation warning * add back in mps exception, addresses @vargol comment in #354 * replaced Conditioning class with exported functions * fix wrong type of with_variations attribute during intialization * changed "image_iterator()" to "get_make_image()" * raise NotImplementedError for calling get_make_image() in parent class * Update ldm/generate.py better error message Co-authored-by: Kevin Gibbons <bakkot@gmail.com> * minor stylistic fixes and assertion checks from code review * moved get_noise() method into img2img class * break get_noise() into two methods, one for txt2img and the other for img2img * inpainting works on non-square images now * make get_noise() an abstract method in base class * much improved inpainting Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
2022-09-06 00:40:10 +00:00
def _txt2mask(self, image:Image, text_mask:list, width, height, fit=True) -> Image:
prompt = text_mask[0]
confidence_level = text_mask[1] if len(text_mask)>1 else 0.5
if self.txt2mask is None:
self.txt2mask = Txt2Mask(device = self.device)
segmented = self.txt2mask.segment(image, prompt)
mask = segmented.to_mask(float(confidence_level))
mask = mask.convert('RGB')
mask = self._fit_image(mask, (width, height)) if fit else self._squeeze_image(mask)
return mask
def _has_transparency(self, image):
Refactoring simplet2i (#387) * start refactoring -not yet functional * first phase of refactor done - not sure weighted prompts working * Second phase of refactoring. Everything mostly working. * The refactoring has moved all the hard-core inference work into ldm.dream.generator.*, where there are submodules for txt2img and img2img. inpaint will go in there as well. * Some additional refactoring will be done soon, but relatively minor work. * fix -save_orig flag to actually work * add @neonsecret attention.py memory optimization * remove unneeded imports * move token logging into conditioning.py * add placeholder version of inpaint; porting in progress * fix crash in img2img * inpainting working; not tested on variations * fix crashes in img2img * ported attention.py memory optimization #117 from basujindal branch * added @torch_no_grad() decorators to img2img, txt2img, inpaint closures * Final commit prior to PR against development * fixup crash when generating intermediate images in web UI * rename ldm.simplet2i to ldm.generate * add backward-compatibility simplet2i shell with deprecation warning * add back in mps exception, addresses @vargol comment in #354 * replaced Conditioning class with exported functions * fix wrong type of with_variations attribute during intialization * changed "image_iterator()" to "get_make_image()" * raise NotImplementedError for calling get_make_image() in parent class * Update ldm/generate.py better error message Co-authored-by: Kevin Gibbons <bakkot@gmail.com> * minor stylistic fixes and assertion checks from code review * moved get_noise() method into img2img class * break get_noise() into two methods, one for txt2img and the other for img2img * inpainting works on non-square images now * make get_noise() an abstract method in base class * much improved inpainting Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
2022-09-06 00:40:10 +00:00
if image.info.get("transparency", None) is not None:
return True
if image.mode == "P":
transparent = image.info.get("transparency", -1)
for _, index in image.getcolors():
if index == transparent:
return True
elif image.mode == "RGBA":
extrema = image.getextrema()
if extrema[3][0] < 255:
return True
return False
merge release-candidate-1-3-2 into main. Squashed commit of the following: commit 9a1fe8e7fbbd81d9e9e47c4fda6bde6f66fba30c Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 12 17:07:40 2022 +0000 swap in release URLs for installers commit ff56f5251ba8502833cb561317e82b028cd2da5d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 12 17:03:21 2022 +0000 fix up bad unicode chars in invoke.py commit ed943bd6c785d968d1e31fbbb814fea8688fc8bb Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 12 16:05:45 2022 +0000 outcrop improvements, hand-added commit 7ad2355b1da53861bb75312edead8f9db0b0f44d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 12 15:14:33 2022 +0000 documentation fixes commit 66c920fc197d9206be9e0e2d1eb2a1cb86362887 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 16:49:25 2022 -0500 Revert "Resize hires as an image" This reverts commit d05b1b3544dfa7b3c071ac05b4f014a52e08fa50. commit 3fc5cb09f8bc03ea96e67a3e49fb087019d2f9d5 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 12 12:43:17 2022 +0000 fix incorrect link in install commit 1345ec77ab58f70e1bf5a0f587ca40aba4e906b7 Author: tildebyte <337875+tildebyte@users.noreply.github.com> Date: Sun Nov 6 19:07:31 2022 -0500 toil(repo): add tildebyte as owner of installer/ directory commit b116715490f390a59e5bee1022a6a758aee0918d Author: Kyle Schouviller <kyle0654@hotmail.com> Date: Thu Nov 10 21:43:56 2022 -0800 Fix performance issue introduced by torch cuda cache clear during generation commit fa3670270e7aae6bfd8d47fb7bdd32b707310c23 Author: mauwii <Mauwii@outlook.de> Date: Fri Nov 11 12:42:03 2022 +0100 small update to dockers huggingface section commit c304250ef663b3e202b4da8332365288589d94c7 Author: mauwii <Mauwii@outlook.de> Date: Fri Nov 11 12:19:27 2022 +0100 fix format and Link in INSTALL_INVOKE.md commit 802ce5dde5ca68f24aa4609cdba428044e0c7fa1 Author: mauwii <Mauwii@outlook.de> Date: Fri Nov 11 11:17:49 2022 +0100 small fixex to format and a link in INSTALL_MANUAL commit 311ee320ecac892cb4a1bcd012374fa051b1d011 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 07:23:35 2022 +0000 ignore installer intermediate files commit e9df17b374df58a44d3ae3ba33cbdc58794bcf5d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 07:19:25 2022 +0000 fix backslash-related syntax error commit 061fb4ef00482bdd4fba635aeaeff4ca7510190d Merge: 52be0d23 4095acd1 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 06:50:04 2022 +0000 Merge branch 'release-candidate-2-1-3' of github.com:/invoke-ai/InvokeAI into release-candidate-2-1-3 commit 52be0d2396de2de02030855c92e3367008b50377 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 06:49:45 2022 +0000 add WindowsLongFileName batfile to source installer commit 4095acd10ebae05a8cb14cc2faf7c79936d9e6a9 Author: mauwii <Mauwii@outlook.de> Date: Fri Nov 11 07:05:17 2022 +0100 Doc Updates A lot of re-formating of new Installation Docs also some content updates/corrections commit 201eb22d7650b00f55249c2646fa4f47ac3e0ec2 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 04:41:02 2022 +0000 prevent two models from being marked default in models.yaml commit 17ab98220034dfbb798a9a0460bc2837f0c1e2cb Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 03:56:54 2022 +0000 installers download branch HEAD not tag commit a04965b0e9e9d1170cf284af9acbd1186d681255 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 11 03:48:21 2022 +0000 improve messaging during installation process commit 0b529f0c574dd91fb9593e924ebc41c8c219b6ce Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 15:22:32 2022 +0000 enable outcropping of random JPG/PNG images - Works best with runwayML inpainting model - Numerous code changes required to propagate seed to final metadata. Original code predicated on the image being generated within InvokeAI. commit 6f9f84834557eb3c48562dc5d0ace51ca9e9cca2 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 17:27:42 2022 +0000 enhance outcropping with ability to direct contents of new regions - When outcropping an image you can now add a `--new_prompt` option, to specify a new prompt to be used instead of the original one used to generate the image. - Similarly you can provide a new seed using `--seed` (or `-S`). A seed of zero will pick one randomly. - This PR also fixes the crash that happened when trying to outcrop an image that does not contain InvokeAI metadata. commit 918c1589ef30595668899f4259ece6a4ad605c69 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 20:16:47 2022 +0000 fix #1402 commit 116415b3fcec8415f8e6de9b23c0bbd0dbc6845b Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 21:27:25 2022 +0000 fix invoke.py crash if no models.yaml file present - Script will now offer the user the ability to create a minimal models.yaml and then gracefully exit. - Closes #1420 commit b4b6eabaac94896e38123be331c44d1b63065b0d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 16:49:25 2022 -0500 Revert "Log strength with hires" This reverts commit 82d4904c07670d514e9a541de7c9ecd8489eeae2. commit 4ef1f4a854717c953f9192454d0adabef32af36c Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 20:01:49 2022 +0000 remove temporary directory from repo commit 510fc4ebaa5f9dc0e77b47cf04e0c265423e0a44 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 19:59:03 2022 +0000 remove -e from clipseg load in installer commit a20914434bb3609cf1d883cabf048d4cc25f881a Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 19:37:07 2022 +0000 change clipseg repo branch to avoid clipseg not found error commit 0d134195fda5c69fce5a95d6da90248eba8d226d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 18:39:29 2022 +0000 update repo URL to point to rc commit 649d8c8573896fdb5a73453b69ee4b54cf4d6241 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 18:13:28 2022 +0000 integrate tildebyte installer commit a358d370a05ea985a9e26fa9c1101d9c14fdb3ab Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 17:48:14 2022 +0000 add @tildebyte compiled pip installer commit 94a9033c4f6214e604be149a3de6d7c747af7f3a Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 14:52:00 2022 +0000 ignore source installer zip files commit 18a947c503c83c95cd83f27424696219ff3c4c95 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 14:46:36 2022 +0000 documentation and environment file fixes - Have clarified the relationship between the @tildebyte and @cmdr2 installers; However, @tildebyte installer merge is still a WIP due to conflicts over such things as `invoke.sh`. - Rechristened 1click installer as "source" installer. @tildebyte installer will be "the" installer. (We'll see which one generates the least support requests and maintenance work.) - Sync'd `environment-mac.yml` with `development`. The former was failing with a taming-transformers error as per https://discord.com/channels/@me/1037201214154231899/1040060947378749460 commit a23b03189526a49da8ddae90ce71b0e902784d29 Author: Mike DiGiovanni <vinblau@gmail.com> Date: Wed Nov 9 16:44:59 2022 -0500 Fixes typos in README.md commit 23af68c7d79d947f1bd3441c91bb44d655238f01 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 07:02:27 2022 -0500 downgrade win installs to basicsr==1.4.1 commit e258beeb51f3e645b9ea60e52d69d18722221cc5 Merge: 7460c069 e481bfac Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 06:37:45 2022 -0500 Merge branch 'release-candidate-2-1-3' of github.com:invoke-ai/InvokeAI into release-candidate-2-1-3 commit 7460c069b880b10c84b55f2e0c0998e350d6cf12 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 06:36:48 2022 -0500 remove --prefer-binary from requirements-base.txt It appears that some versions of pip do not recognize this option when it appears in the requirements file. Did not explore this further but recommend --prefer-binary in the manual install instructions on the command line. commit e481bfac615e0c798ceb5e59e8fbe3038f85b431 Merge: 5040747c d1ab65a4 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 11:21:56 2022 +0000 Merge branch 'release-candidate-2-1-3' of github.com:/invoke-ai/InvokeAI into release-candidate-2-1-3 commit 5040747c6700c9b949e3f3e1d2c3f21daffcec6c Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 10 11:21:43 2022 +0000 fix windows install instructions & bat file commit d1ab65a43122f73c20533d5815590ec10bc05eca Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 07:18:59 2022 +0100 update WEBUIHOTKEYS.md commit af4ee7feb8a7d2528bf4e2b3f7deee7a7c4c3dec Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 06:33:49 2022 +0100 update INSTALL_DOCKER.md commit 764fb29aded8114984d05932c4266ea24614b932 Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 06:30:15 2022 +0100 fix formatting in INSTALL.md commit 1014d3ba44aa4cd4cfdc6e3650c24a0dc9568a6e Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 06:29:14 2022 +0100 fix build.sh invokeai_conda_env_file default value commit 40a48aca88e337e9f4475f80a03b7d6d4751d09b Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 05:25:30 2022 +0100 fix environment-mac.yml moved taming-transformers-rom1504 to pip dependencies commit 92abc00f16a34a586dd16d3c64408f00e23fcb53 Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 05:19:52 2022 +0100 fix test-invoke-conda - copy required conda environment yaml - use environment.yml - I use cp instead of ln since would be compatible for windows runners commit a5719aabf89c8c5f29c6044e2882ccdcd0c6916b Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 10 04:14:35 2022 +0100 update Dockerfile - link environment.yml from new environemnts path - change default conda_env_file - quote all variables to avoid splitting - also remove paths from conda-env-files in build-container.yml commit 44a18511fa7accfec6a20345774583a1ce745b02 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 20:51:06 2022 +0000 update paths in container build workflow commit b850dbadafba052310327ca759d96f49a9d25d03 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 20:16:57 2022 +0000 finished reorganization of install docs commit 9ef8b944d53afb1fed94c418b2fd936d2d743797 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 18:50:58 2022 +0000 tweaks to manual install documentation --prefer-binary is an iffy option in the requirements file. It isn't supported by some versions of pip, so I removed it from requirements-base.txt and inserted it into the manual install instructions where it seems to do what it is supposed to. commit efc5a9848803b4250d726bc1913b9fd5a33fad75 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 18:20:03 2022 +0000 manual installation documentation tested on Linux commit 1417c87928e13b0ed21bf1c5604f8636d3b50a8d Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 17:37:06 2022 +0000 change name of requirements.txt to avoid confusion commit 2dd6fc2b93ff7bbb4038568a3b28d36a8fafaeb8 Merge: 22213612 71ee44a8 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 17:26:24 2022 +0000 Merge branch 'release-candidate-2-1-3' of github.com:/invoke-ai/InvokeAI into release-candidate-2-1-3 commit 22213612a08bbece46eafd48994f985b097cb141 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 17:25:59 2022 +0000 directory cleanup; working on install docs commit 71ee44a827898759fd457f774c0b2ac7a1ef6519 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 02:07:13 2022 +0000 prevent crash when switching to an invalid model commit b17ca0a5e731c142101bbdbf34d121df949e86d7 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 14:28:38 2022 +0100 don't suppress exceptions when doing cross-attention control commit 71bbfe4a1a5b70f90e5f41c94df50fb104dbdd79 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 12:59:34 2022 +0100 Fix #1362 by improving VRAM usage patterns when doing .swap() commit ef3f7a26e242b73c2beb0195c7fd8f654ef47f55 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 12:18:37 2022 +0100 remove log spam commit 7189d649622d4668b120b0dd278388ad672142c4 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 12:10:28 2022 +0100 change the way saved slicing strategy is applied commit 01c40f751ab72955140165c16f95ae411732265b Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 12:04:43 2022 +0100 fix slicing_strategy_getter callsite commit f8cfe25150a346958903316bc710737d99839923 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 11:56:22 2022 +0100 cleanup, consistent dim=0 also tested commit 5bf9b1e890d48e962afd4a668a219b68271e5dc1 Author: damian0815 <null@damianstewart.com> Date: Tue Nov 8 11:34:09 2022 +0100 refactored context, tested with non-sliced cross attention control commit d58a46e39bf562e7459290d2444256e8c08ad0b6 Author: damian0815 <null@damianstewart.com> Date: Sun Nov 6 00:41:52 2022 +0100 cleanup commit 7e2c658b4c06fe239311b65b9bb16fa3adec7fd7 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:57:31 2022 +0100 disable logs commit 20ee89d93841b070738b3d8a4385c93b097d92eb Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:36:58 2022 +0100 slice saved attention if necessary commit 0a7684a22c880ec0f48cc22bfed4526358f71546 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:32:38 2022 +0100 raise instead of asserting commit 7083104c7f3a0d8fd96e94a2f391de50a3c942e4 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:31:00 2022 +0100 store dim when saving slices commit f7c0808ed383ec1dc70645288a798ed2aa4fa85c Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:27:16 2022 +0100 don't retry on exception commit 749a721e939b3fe7c1741e7998dab6bd2c85a0cb Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:24:50 2022 +0100 stuff commit 032ab90e9533be8726301ec91b97137e2aadef9a Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:20:17 2022 +0100 more logging commit 3dc34b387f033482305360e605809d95a40bf6f8 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:16:47 2022 +0100 logs commit 901c4c1aa4b9bcef695a6551867ec8149e6e6a93 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:12:39 2022 +0100 actually set save_slicing_strategy to True commit f780e0a0a7c6b6a3db320891064da82589358c8a Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 22:10:35 2022 +0100 store slicing strategy commit 93bb6d566fd18c5c69ef7dacc8f74ba2cf671cb7 Author: damian <git@damianstewart.com> Date: Sat Nov 5 20:43:48 2022 +0100 still not it commit 5e3a9541f8ae00bde524046963910323e20c40b7 Author: damian <git@damianstewart.com> Date: Sat Nov 5 17:20:02 2022 +0100 wip offloading attention slices on-demand commit 4c2966aa856b6f3b446216da3619ae931552ef08 Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 15:47:40 2022 +0100 pre-emptive offloading, idk if it works commit 572576755e9f0a878d38e8173e485126c0efbefb Author: root <you@example.com> Date: Sat Nov 5 11:25:32 2022 +0000 push attention slices to cpu. slow but saves memory. commit b57c83a68f2ac03976ebc89ce2ff03812d6d185f Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 12:04:22 2022 +0100 verbose logging commit 3a5dae116f110a96585d9eb71d713b5ed2bc3d2b Author: damian0815 <null@damianstewart.com> Date: Sat Nov 5 11:50:48 2022 +0100 wip fixing mem strategy crash (4 test on runpod) commit 3cf237db5fae0c7b0b4cc3c47c81830bdb2ae7de Author: damian0815 <null@damianstewart.com> Date: Fri Nov 4 09:02:40 2022 +0100 wip, only works on cuda commit 5702271991e126c026aa1ff41c44f8ad37b26e3a Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 14:09:36 2022 +0000 speculative reorganization of the requirements & environment files - This is only a test! - The various environment*.yml and requirements*.txt files have all been moved into a directory named "environments-and-requirements". - The idea is to clean up our root directory so that the github home page is tidy. - The manual install instructions will start with the instructions to create a symbolic link from environment.yml to the appropriate file for OS and GPU. - The 1-click installers have been updated to accommodate this change. commit 10781e7dc4f4551583a110d14f2a1f60393112b8 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 9 01:59:45 2022 +0000 refactoring requirements commit 099d1157c579c7b9fea20945e8504cc15745c598 Author: mauwii <Mauwii@outlook.de> Date: Wed Nov 9 00:16:18 2022 +0100 better way to make sure if conda is useable commit ab825bf7ee5f0b82d2273da1cda64fc9266a978e Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 22:05:33 2022 +0000 add back --prefer-binaries to requirements commit 10cfeb5ada7bcfc9f3aff3716ab8ea4961a8b528 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 8 22:27:19 2022 +0100 add quotes to set and use `$environment_file` commit e97515d0453583e013674b4dd1f3739c7de402cc Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 8 22:24:21 2022 +0100 set environment file for conda update commit 0f04bc5789c712bf7c7319b1d93064914993f4ec Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 8 22:21:25 2022 +0100 use conda env update commit 3f74aabecd08ed25fac158463ae12b775bd1fca2 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 8 22:20:44 2022 +0100 use command instead of hash commit b1a99a51b7ca23c4b895855bd7b4c82dbdc431e4 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 14:44:44 2022 -0500 remove --global git config from 1-click installers commit 8004f8a6d99f6ff75e00c170da40f1dec93a8914 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Mon Nov 7 09:07:20 2022 -0500 Revert "Use array slicing to calc ddim timesteps" This reverts commit 1f0c5b4cf196716c21f2db74f92c8750ad8f889d. commit ff8ff2212afb1e1c2dce4f6a61f29e2bc8302eb5 Merge: 8e5363cd 636620b1 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 14:01:40 2022 +0000 add initfile support from PR #1386 commit 8e5363cd83bff0e6be0f002c644283955f7fcbfd Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 13:26:18 2022 +0000 move 'installer/' to '1-click-installer' to make room for tildebyte installer commit 1450779146e89510d12b8c90eb316d9861c3375e Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 12:56:36 2022 +0000 update branch for installer to pull against commit 8cd5d95b8a1cb213cce2f949c394c841a09d9cab Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 05:30:20 2022 +0000 move all models into subdirectories of ./models - this required an update to the invoke-ai fork of gfpgan - simultaneously reverted consolidation of environment and requirements files, as their presence in a directory triggered setup.py to try to install a sub-package. commit abd6407394d55d4f6c064a05f3ac989dd3817c59 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 03:52:46 2022 +0000 leave a copy of environment-cuda.yml at top level - named it environment.yml - need to avoid a big change for users and breaking older support instructions. commit 734dacfbe9d8c86ca943c6541e7b5ff5ef787ff4 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 03:50:07 2022 +0000 consolidate environment files - starting to remove unneeded entries and pins - no longer require -e in front of github dependencies - update setup.py with release number - update manual installation instructions commit 636620b1d5e2466613d0dcc2a604522be12fa3a4 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 8 03:26:16 2022 +0000 change initfile to ~/.invokeai - adjust documentation - also fix 'clipseg_models' to 'clipseg', which seems to be working now commit 1fe41146f0975bbc9d552208473490a9ccb9fc56 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 5 14:28:01 2022 -0400 add support for an initialization file, invokeai.init - Place preferred startup command switches in a file named "invokeai.init". The file can consist of a single line of switches such as "--web --steps=28", a series of switches on each line, or any combination of the two. Example: ``` --web --host=0.0.0.0 --steps=28 --grid -f 0.6 -C 11.0 -A k_euler_a ``` - The following options, which were previously only available within the CLI, are now available on the command line as well: --steps --strength --cfg_scale --width --height --fit commit 2ad6ef355a9b9c4b17bae71edea2346c2e8708c5 Merge: 865502ee 8b47c829 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sun Nov 6 18:08:36 2022 +0000 update discord link commit 865502ee4f681de4516d231370ae603983354d8f Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 18:00:16 2022 +0100 update changelog commit c7984f3299c5c8f56a70d80907d527af458674af Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 17:07:27 2022 +0100 update TROUBLESHOOT.md commit 7f150ed83302ba875c3e0c0f39d8ac0f32c6e362 Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 16:56:58 2022 +0100 remove `:`from headlines in CONTRIBUTORS.md commit badf4e256ce6e3201df1a9a87a7072b36b18d699 Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 16:56:37 2022 +0100 enable navigation tabs Since the docs are growing, this way they look cleaner commit e64c60bbb38fc1620e08ce52bf28bd17003c7ef6 Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 16:18:59 2022 +0100 remove preflight checks from assets seems like somebody executed tests and commited them commit 178061854300632b024810e65922b54b64d95939 Author: mauwii <Mauwii@outlook.de> Date: Sun Nov 6 16:15:06 2022 +0100 update INSTALLING_MODELS.md commit f91fd276242a0c92b301e99d02982d30f7b712c3 Author: Kyle Schouviller <kyle0654@hotmail.com> Date: Sat Nov 5 14:47:53 2022 -0700 Bug fix for inpaint size commit 09e41e8f769457b9ffd56901aae13991cdc6eeb8 Author: Kyle Schouviller <kyle0654@hotmail.com> Date: Sat Nov 5 14:34:52 2022 -0700 Add inpaint size options to inpaint at a larger size than the actual inpaint image, then scale back down for recombination commit 6eeb2107b300fc27cfe6134b43e5570c246b8e96 Author: mauwii <Mauwii@outlook.de> Date: Sat Nov 5 21:01:14 2022 +0100 remove create-caches.yml since not used anywhere commit 17053ad8b7efecb21a9b4eb32695089f683f72e3 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 5 16:01:55 2022 -0400 fix duplicated argument introduced by conflict resolution commit fefb4dc1f88bc6551a39602a2bc79b278cd83c59 Merge: 762ca60a d05b1b35 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 5 12:47:35 2022 -0700 Merge branch 'development' into fix_generate.py commit d05b1b3544dfa7b3c071ac05b4f014a52e08fa50 Author: Craig <cwallen@users.noreply.github.com> Date: Sat Oct 29 20:40:30 2022 -0400 Resize hires as an image commit 82d4904c07670d514e9a541de7c9ecd8489eeae2 Author: Craig <cwallen@users.noreply.github.com> Date: Sat Oct 29 20:37:40 2022 -0400 Log strength with hires commit 1cdcf33cfa39e90f9660fabf8f5936dcfb6c3aa5 Merge: 6616fa83 cbc029c6 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Sat Nov 5 09:57:38 2022 -0400 Merge branch 'main' into development - this synchronizes recent document fixes by mauwii commit 6616fa835ac4318bf53419f2b54b88c962559578 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 4 00:47:03 2022 -0400 fix Windows library dependency issues This commit addresses two bugs: 1) invokeai.py crashes immediately with a message about an undefined attritube sigKILL (closes #1288). The fix is to pin torch at 1.12.1. 2) Version 1.4.2 of basicsr fails to load properly on Windows, and is a requirement of realesrgan, however 1.4.1 works. Pinning basicsr in our requirements file resulted in a dependency conflict, so I ended up cloning realesrgan into the invoke-ai Git space and changing the requirements file there. If there is a more elegant solution, please advise. commit 7b9a4564b11f4181b9b3c06ecda2a4a25fd1849e Author: Matthias Wild <40327258+mauwii@users.noreply.github.com> Date: Sat Nov 5 14:36:45 2022 +0100 Update-docs (#1382) * update IMG2IMG.md * update INPAINTING.md * update WEBUIHOTKEYS.md * more doc updates (mostly fix formatting): - OUTPAINTING.md - POSTPROCESS.md - PROMPTS.md - VARIATIONS.md - WEB.md - WEBUIHOTKEYS.md commit fcdefa0620761472718afa14b2955a5d0603cfcc Author: Matthias Wild <40327258+mauwii@users.noreply.github.com> Date: Fri Nov 4 20:47:31 2022 +0100 Hotifx docs (#1376) (#1377) commit ef8b3ce639954259a95a38f44fa5329687bee781 Merge: b7042095 36870a8f Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Fri Nov 4 12:08:44 2022 -0400 Merge-main-into-development (#1373) To get the rid of the difference between main and development. Since otherwise it will be a pain to start fixing the documentatino (when the state between main and development is not the same ...) Also this should fix the problem of all tests failing since environment yamls get updated. commit 36870a8f53217d4b733e9bb8b119190b5e36da59 Merge: 6b89adfa b7042095 Author: Matthias Wild <40327258+mauwii@users.noreply.github.com> Date: Fri Nov 4 16:25:00 2022 +0100 Merge branch 'development' into merge-main-into-development commit b70420951d5b70937c0c07e4f8a552a01c3008bc Author: damian0815 <null@damianstewart.com> Date: Thu Nov 3 12:39:45 2022 +0100 fix parsing error doing eg `forest ().swap(in winter)` commit 1f0c5b4cf196716c21f2db74f92c8750ad8f889d Author: wfng92 <43742196+wfng92@users.noreply.github.com> Date: Thu Nov 3 17:13:52 2022 +0800 Use array slicing to calc ddim timesteps commit 8648da811190fc8bcf237d83aff38cf605851300 Author: mauwii <Mauwii@outlook.de> Date: Fri Nov 4 00:06:19 2022 +0100 update environment-linux-aarch64 to use python 3.9 commit 45b459356399f8cfb7e9af571c1643fab04218fe Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 3 22:31:46 2022 +0100 update environment-linux-aarch64.yml - move getpass_asterisk to pip commit 41b04316cf5118ea9518dc77934d135a489dd684 Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 3 20:40:08 2022 +0100 rename job, remove debug branch from triggers commit e97c6db2a3c0157a8a5ab74cd28ebee480a2d078 Author: mauwii <Mauwii@outlook.de> Date: Thu Nov 3 20:34:01 2022 +0100 include build matrix to build x86_64 and aarch64 commit 896820a349292b0e14bbc32f0c557fe8a6b45395 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 05:01:15 2022 +0100 disable caching commit 06c8f468bff7e1dfecc1a1990164be1005b114a7 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 04:26:39 2022 +0100 disable PR-Validation since there are no files passed from context this is unecesarry commit 61920e2701c4a9cea94c03ab933c4482458215b7 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 04:09:39 2022 +0100 update action to use current branch also update build-args of dockerfile and build.sh commit f34ba7ca70f1c417ee97e8b0c57abff57614d78f Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 02:30:24 2022 +0100 remove unecesarry mkdir command again commit c30ef0895dbf0565345ac6ccb136d98a174470a6 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 01:51:12 2022 +0100 remove symlink to GFPGANv1.4 also re-add mkdir to prevent action from failing commit aa3a774f73d5004571ea42fea14cd2b525fffb1c Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 01:48:59 2022 +0100 update build-container.yml to use cachev3 commit 2c30555b844293764123baa4137fcf952d40a4e7 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 01:34:20 2022 +0100 update Dockerfile - create models.yaml from models.yaml.example - run preload_models.py with --no-interactive commit 743f60577364d43237eeb46aefd523371c36e56b Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 01:21:15 2022 +0100 update build.sh to download sd-v1.5 model commit 519c661abbae83aa62b3ee536635c39192890441 Author: mauwii <Mauwii@outlook.de> Date: Tue Oct 25 01:26:50 2022 +0200 replace old fashined markdown templates with forms this will help the readability of issues a lot 🤓 commit 22c956c75f4797ddc2dffa944e3ea84b4eb3477c Merge: 13696adc 0196571a Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 3 10:20:21 2022 -0400 Merge branch 'development' of github.com:invoke-ai/InvokeAI into development commit 13696adc3a3a2b169e68048a5b511660d0430fae Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Thu Nov 3 10:20:10 2022 -0400 speculative change to solve windows esrgan issues commit 0196571a12992eb8207d36e022721fe3ad2cfd19 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 2 22:39:35 2022 -0400 remove merge markers from preload_models.py commit 9666f466ab1c710dfda2e59be9e8a26fcd7e8718 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 2 18:29:34 2022 -0400 use refined model by default commit 240e5486c89552ef480c3443a63283fb86a493c3 Merge: 8164b6b9 aa247e68 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 2 18:35:00 2022 -0400 Merge branch 'spezialspezial-patch-9' into development commit 8164b6b9cff077e4131384195af65e30a40733a7 Merge: 4fc82d55 dd5a88dc Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Wed Nov 2 17:06:46 2022 -0400 Merge branch 'development' of github.com:invoke-ai/InvokeAI into development commit 4fc82d554ff573780c0af562a6bc9586aa56012d Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 04:17:28 2022 +1300 [WebUI] Final 2.1 Release Build commit 96b34c0f85f6ed52707fe43456d20b81822c7d1d Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 09:08:11 2022 +0100 Final WebUI build for Release 2.1 - squashed commit of 52 commits from PR #1327 don't log base64 progress images Fresh Build For WebUI [WebUI] Loopback Default False Fixes bugs/styling - Fixes missing web app state on new version: Adds stateReconciler to redux-persist. When we add more values to the state and then release the update app, they will be automatically merged in. Reseting web UI will be needed far less. 7159ec - Fixes console z-index - Moves reset web UI button to visible area Decreases gallery width on inpainting Increases workarea split padding to 1rem Adds missing tooltips to site header Changes inpainting controls settings to hover Fixes hotkeys and settings buttons not working Improves bounding box interactions - Bounding box can now be moved by dragging any of its edges - Bounding box does not affect drawing if already drawing a stroke - Can lock bounding box to draw directly on the bounding box edges - Removes spacebar-hold behaviour due to technical issues Fixes silent crash when init image too large To send the mask to the server, the UI rendered the mask onto the init image and sent the whole image. The mask was then cropped by the server. If the image was too large, the app silently failed. Maybe it exceeds the websocket size limit. Fixed by cropping the mask in the UI layer, sending only bounding-box-sized mask image data. Disabled bounding box settings when locked Styles image uploader Builds fresh bundle Improves bounding box interaction Added spacebar-hold-to-transform back. Address bounding box feedback - Adds back toggle to hide bounding box - Box quick toggle = q, normal toggle = shift + q - Styles canvas alert icons Adds hints when unable to invoke - Popover on Invoke button indicates why exactly it is disabled, e.g. prompt is empty, something else is processing, etc. - There may be more than one reason; all are displayed. Fix Inpainting Alerts Styling Preventing unnecessary re-renders across the app Code Split Inpaint Options Isolate features to their own components so they dont re-render the other stuff each time. [TESTING] Remove global isReady checking I dont believe this is need at all because the isready state is constantly updated when needed and tracked real time in the Redux store. This causes massive re-renders. @psychedelicious If this is absolutely essential for a reason that I do not see, please hit me up on Discord. Fresh Bundle Fix Bounding Box Settings re-rendering on brush stroke [Code Splitting] Bounding Box Options Isolated all bounding box components to trigger unnecessary re-renders. Still need to fix bounding box triggering re-renders on the control panel inside the canvas itself. But the options panel should be a good to go with this change. Inpainting Controls Code Spitting and Performance Codesplit the entirety of the inpainting controls. Created new selectors for each and every component to ensure there are no unnecessary re-renders. App feels a lot smoother. Fixes rerenders on ClearBrushHistory Fixes crash when requesting post-generation upscale/face restoration - Moves the inpainting paste to before the postprocessing. Removes unused isReady state Changes Report Bug icon to a bug Restores shift+q bounding box shortcut Adds alert for bounding box size to status icons Adds asCheckbox to IAIIconButton Rough draft of this. Not happy with the styling but it's clearer than having them look just like buttons. Fixes crash related to old value of progress_latents in state Styling changes and settings modal minor refactor Fixes: uploaded JPG images not loading Reworks CurrentImageButtons.tsx - Change all icons to FA iconset for consistency - Refactors IAIIconButton, IAIButton, IAIPopover to handle ref forwarding - Redesigns buttons into group Only generate 1 iteration when seed fixed & variations disabled Fixes progress images select Fixes edge case: upload over gets stuck while alt tabbing - Press esc to close it now Fixes display progress images select typing Fixes current image button rerenders Adds min width to ImageUploader Makes fast-latents in progress default Update Icon Button Checkbox Style Styling Fixes next/prev image buttons Refactor canvas buttons + more Add Save Intermediates Step Count For accurate mode only. Co-Authored-By: Richard Macarthy <richardmacarthy@protonmail.com> Restores "initial image" text Address feedback - moves mask clear button - fixes intermediates - shrinks inpainting icons by 10% Fix Loopback Styling Adds escape hotkey to close floating panels Readd Hotkey for Dual Display Updated Current Image Button Styling commit dd5a88dceeec53ceb1722a62e3689ae3dd871154 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 04:17:28 2022 +1300 [WebUI] Final 2.1 Release Build commit 95ed56bf82825a47cfe406fa34eaf4e32c129143 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 04:16:31 2022 +1300 Updated Current Image Button Styling commit 1ae80f5ab9d00a25e0c3a21e2eccd318c5343401 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 04:07:57 2022 +1300 Readd Hotkey for Dual Display commit 1f0bd3ca6cda4221d1a7a46325f235cd23bd0af9 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu Nov 3 02:07:00 2022 +1100 Adds escape hotkey to close floating panels commit a1971f6830306b3d748f7f36c2243f6dee682f97 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 03:38:15 2022 +1300 Fix Loopback Styling commit c6118e889895ba35a191124ce1beb5d2b719366d Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu Nov 3 01:29:51 2022 +1100 Address feedback - moves mask clear button - fixes intermediates - shrinks inpainting icons by 10% commit 7ba958cf7ff4e804a127b71c88666084f81e7340 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu Nov 3 01:10:38 2022 +1100 Restores "initial image" text commit 383905d5d24359aa1824de96ff124a8f8a87e015 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 02:59:11 2022 +1300 Add Save Intermediates Step Count For accurate mode only. Co-Authored-By: Richard Macarthy <richardmacarthy@protonmail.com> commit 6173e3e9cabd5e74fb466d55d7bb6a80a77b3fa8 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu Nov 3 00:53:53 2022 +1100 Refactor canvas buttons + more commit 3feb7d8922b0e4c9f944e96b95211003f40d9705 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu Nov 3 00:49:23 2022 +1100 Fixes next/prev image buttons commit 1d9edbd0ddd6e10cf120fe0de3db0b56ae374db4 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Thu Nov 3 00:50:44 2022 +1300 Update Icon Button Checkbox Style Styling commit d439abdb89db73e652add9df371234861189d90c Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 21:37:24 2022 +1100 Makes fast-latents in progress default commit ee47ea0c891a33049bdec12f1c254926f341eff2 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 21:37:09 2022 +1100 Adds min width to ImageUploader commit 300bb2e6279c1c477131b9e57425db348062f19c Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 21:28:22 2022 +1100 Fixes current image button rerenders commit ccf8593501d23e00979f7340f8991514e6ca3428 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 21:27:43 2022 +1100 Fixes display progress images select typing commit 0fda612f3ff8ad75932e158b9b29cf64c3f30eb6 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 21:02:01 2022 +1100 Fixes edge case: upload over gets stuck while alt tabbing - Press esc to close it now commit 5afff65b71bb60d067392c120efff1a17adc66af Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 20:33:19 2022 +1100 Fixes progress images select commit 7e55bdefce8920831cac7b9fa857bfbffe9e9d5d Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 20:27:47 2022 +1100 Only generate 1 iteration when seed fixed & variations disabled commit 620cf84d3dd54b8498e84574f33040a26d4d315f Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 19:51:38 2022 +1100 Reworks CurrentImageButtons.tsx - Change all icons to FA iconset for consistency - Refactors IAIIconButton, IAIButton, IAIPopover to handle ref forwarding - Redesigns buttons into group commit cfe567c62ad3fd0cff5e3e579a2250ca5dfa2d53 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 16:14:50 2022 +1100 Fixes: uploaded JPG images not loading commit cefe12f1df72e051f109ed77ce46f18093b3b8bb Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 15:31:18 2022 +1100 Styling changes and settings modal minor refactor commit 1e51c3992853ad4643d8eda2443a3bd0d65f5f90 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 15:27:46 2022 +1100 Fixes crash related to old value of progress_latents in state commit 42a02bbb8087cd46a1b5c795b1b41e38c08ba229 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 13:15:06 2022 +1100 Adds asCheckbox to IAIIconButton Rough draft of this. Not happy with the styling but it's clearer than having them look just like buttons. commit f1ae6dae4c36e74ca8dedf8b57eb8933c059dcf4 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 13:13:56 2022 +1100 Adds alert for bounding box size to status icons commit 6195579910a91fb2ab7e1186aa1c1145566c3122 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 11:52:19 2022 +1100 Restores shift+q bounding box shortcut commit 16c8b23b347792d7811cff66a27d350fe5d0d62c Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 11:32:07 2022 +1100 Changes Report Bug icon to a bug commit 07ae626b22554b5222a3b71d1ce3974e2c3fb284 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 11:17:16 2022 +1100 Removes unused isReady state commit 8d171bb044f578d4b9cc4911edfa05b20a01d373 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 11:13:26 2022 +1100 Fixes crash when requesting post-generation upscale/face restoration - Moves the inpainting paste to before the postprocessing. commit 6e33ca7e9e64fb355430511e28bb08c32c9c68b1 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Wed Nov 2 10:59:01 2022 +1100 Fixes rerenders on ClearBrushHistory commit db46e12f2b8c98dac8895ea4d04242d3754dbec4 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 11:36:28 2022 +1300 Inpainting Controls Code Spitting and Performance Codesplit the entirety of the inpainting controls. Created new selectors for each and every component to ensure there are no unnecessary re-renders. App feels a lot smoother. commit 868e4b2db82fa8556b423111f2f8d565a70ec129 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 07:40:31 2022 +1300 [Code Splitting] Bounding Box Options Isolated all bounding box components to trigger unnecessary re-renders. Still need to fix bounding box triggering re-renders on the control panel inside the canvas itself. But the options panel should be a good to go with this change. commit 2e562742c13988a1fc299c673a97ba4e4a645aaf Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 06:40:27 2022 +1300 Fix Bounding Box Settings re-rendering on brush stroke commit 68e69580091fc1dc1d8b6e03c9e7ef777c7ebf61 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 06:28:34 2022 +1300 Fresh Bundle commit ea6e3a7949f2743711516261cb7e450517d39702 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 06:26:56 2022 +1300 [TESTING] Remove global isReady checking I dont believe this is need at all because the isready state is constantly updated when needed and tracked real time in the Redux store. This causes massive re-renders. @psychedelicious If this is absolutely essential for a reason that I do not see, please hit me up on Discord. commit b2879ca99f88869277c474185ade049914b0bf26 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 06:08:59 2022 +1300 Code Split Inpaint Options Isolate features to their own components so they dont re-render the other stuff each time. commit 4e911566c33989392eb3279049b15331ca98594a Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 03:50:56 2022 +1300 Preventing unnecessary re-renders across the app commit 9bafda6a152778893df143776ae859a3b8b7f192 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 03:02:35 2022 +1300 Fix Inpainting Alerts Styling commit 871a8a5375cae891f22eb853ffd2d22298298b11 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 23:52:07 2022 +1100 Adds hints when unable to invoke - Popover on Invoke button indicates why exactly it is disabled, e.g. prompt is empty, something else is processing, etc. - There may be more than one reason; all are displayed. commit 0eef74bc00d3c0cedc5037c1deeef1d9a5b6d33d Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 23:40:11 2022 +1100 Address bounding box feedback - Adds back toggle to hide bounding box - Box quick toggle = q, normal toggle = shift + q - Styles canvas alert icons commit 423ae3209782f1d8d321b2ed9ed00712b726adf7 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 17:06:07 2022 +1100 Improves bounding box interaction Added spacebar-hold-to-transform back. commit 8282e5d0458ca1bba5565c069093b5389f2228d4 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 16:57:07 2022 +1100 Builds fresh bundle commit 19305cdbdf6ac74833bd6011bff0ced8e9d36f69 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 16:51:11 2022 +1100 Styles image uploader commit eb9028ab3069bca9d747aca664ca60ae13ba6df8 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 16:51:03 2022 +1100 Disabled bounding box settings when locked commit 21483f5d0731bce5aa97985e722a64bf0d7cd12c Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 16:50:24 2022 +1100 Fixes silent crash when init image too large To send the mask to the server, the UI rendered the mask onto the init image and sent the whole image. The mask was then cropped by the server. If the image was too large, the app silently failed. Maybe it exceeds the websocket size limit. Fixed by cropping the mask in the UI layer, sending only bounding-box-sized mask image data. commit 82dcbac28f140aa7bd89d967bcc7fa31cb03a267 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 16:28:30 2022 +1100 Improves bounding box interactions - Bounding box can now be moved by dragging any of its edges - Bounding box does not affect drawing if already drawing a stroke - Can lock bounding box to draw directly on the bounding box edges - Removes spacebar-hold behaviour due to technical issues commit d43bd4625d64a03d90de0458ad5fcacef211a8a6 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 15:10:49 2022 +1100 Fixes hotkeys and settings buttons not working commit ea891324a2086faf8eeeeac7eaf47ae2935322fb Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 11:04:02 2022 +1100 Changes inpainting controls settings to hover commit 8fd9ea219390493f392e690eadb23c4209a4ecfc Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 11:03:41 2022 +1100 Adds missing tooltips to site header commit fb026668563b3179805819a1630c654c9ce260d9 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 11:03:25 2022 +1100 Increases workarea split padding to 1rem commit f6f5c2731b0c37089c5d7382736f973e857df712 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 11:03:10 2022 +1100 Decreases gallery width on inpainting commit b4e3f771e0314e0a18ad5cedc80b28f246fced59 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 10:54:59 2022 +1100 Fixes bugs/styling - Fixes missing web app state on new version: Adds stateReconciler to redux-persist. When we add more values to the state and then release the update app, they will be automatically merged in. Reseting web UI will be needed far less. 7159ec - Fixes console z-index - Moves reset web UI button to visible area commit 99bb9491ac97f1f733accab839ea38cdf4870ba0 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Tue Nov 1 08:35:45 2022 +1300 [WebUI] Loopback Default False commit 0453f211278a533a49fb1aee54dd989b69179c10 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Wed Nov 2 23:23:51 2022 +1300 Fresh Build For WebUI commit 9fc09aa4bda3b3e6139b026f24733a37747d373f Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 09:08:11 2022 +0100 don't log base64 progress images commit 5e87062cf809a08242d3b006b66d3bbb834ddb16 Author: spezialspezial <75758219+spezialspezial@users.noreply.github.com> Date: Wed Nov 2 00:21:27 2022 +0100 Option to directly invert the grayscale heatmap - fix commit 3e7a459990407ad1679f38d4027c19d50a9d36e3 Author: spezialspezial <75758219+spezialspezial@users.noreply.github.com> Date: Tue Nov 1 21:37:33 2022 +0100 Update txt2mask.py commit bbf4c03e500bafc8627c2a70f8b3396efeddabb3 Author: spezialspezial <75758219+spezialspezial@users.noreply.github.com> Date: Tue Nov 1 21:11:19 2022 +0100 Option to directly invert the grayscale heatmap Theoretically less work inverting the image while it's small but I can't measure a significant difference. Though, handy option to have in some cases. commit 611a3a975328a7e276c2781214d5e14108708ed7 Author: mauwii <Mauwii@outlook.de> Date: Wed Nov 2 02:23:09 2022 +0100 fix name of caching step commit 1611f0d1815022fe90d33f41c21d670251a75f29 Author: mauwii <Mauwii@outlook.de> Date: Wed Nov 2 02:18:46 2022 +0100 readd caching of sd-models - this would remove the necesarrity of the secret availability in PRs commit 08835115e4c5c0ee3587ce07ab769a04d55cb3c5 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 22:10:12 2022 -0400 pin pytorch_lightning to 1.7.7, issue #1331 commit 2d84e28d329be282b51a4cbc22f7c200d80c8f0e Merge: 533fd04e ef17aae8 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 22:11:04 2022 -0400 Merge branch 'development' of github.com:invoke-ai/InvokeAI into development commit ef17aae8abe03fd87dc6f91b3c6d2fe03375f6c5 Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 00:39:48 2022 +0100 add damian0815 to contributors list commit 0cc39f01a3c67f32873b7888e1e032d33626e269 Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 01:18:50 2022 +0100 report full size for fast latents and update conversion matrix for v1.5 commit 688d7258f185035a5924bee23322b001574da931 Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 00:33:00 2022 +0100 fix a bug that broke cross attention control index mapping commit 4513320bf161d3efdd99e2aef4f7c37472131373 Author: damian0815 <null@damianstewart.com> Date: Wed Nov 2 00:31:58 2022 +0100 save VRAM by not recombining tensors that have been sliced to save VRAM commit 533fd04ef0d1ba9d2cb25d556991b999e7d44aba Merge: 6215592b dff5681c Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 17:40:36 2022 -0400 Merge branch 'development' of github.com:invoke-ai/InvokeAI into development commit dff5681cf0e24faf67d5eb5903203c4ea39f89bd Author: damian0815 <d@d.com> Date: Tue Nov 1 13:56:03 2022 +0100 shorter strings commit 5a2790a69b11e049d2507bc22eab7812915d867f Author: damian0815 <d@d.com> Date: Tue Nov 1 13:19:20 2022 +0100 convert progress display to a drop-down commit 7c5305ccbaf7926162536aa3a9e51dcdd8574d0d Author: damian0815 <d@d.com> Date: Tue Nov 1 12:54:46 2022 +0100 do not try to save base64 intermediates in gallery on cancellation commit 4013e8ad6fa5e5c2a710c607fe7e1d040f353299 Author: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue Nov 1 21:54:35 2022 +1100 Fixes b64 image sending and displaying commit d1dfd257f9e1cafd352d9007a56194226b9d6b63 Author: damian <d@d.com> Date: Tue Nov 1 11:40:40 2022 +0100 wip base64 commit 5322d735ee4515d89293b7fb015b2ce048262f68 Author: damian <d@d.com> Date: Tue Nov 1 11:31:42 2022 +0100 update frontend commit cdb107dcda858a8bb64455cc60a196a42345f8f7 Author: damian <d@d.com> Date: Tue Nov 1 11:17:43 2022 +0100 add option to show intermediate latent space commit be1393a41ce7a75ed8de7f648a93c5e5974a50d2 Author: damian <d@d.com> Date: Tue Nov 1 10:16:55 2022 +0100 ensure existing exception handling code also handles new exception class commit e554c2607f00a5e51c03052acb9861ff21ec1c12 Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Tue Nov 1 10:08:42 2022 +0100 Rebuilt prompt parsing logic Complete re-write of the prompt parsing logic to be more readable and logical, and therefore also hopefully easier to debug, maintain, and augment. In the process it has also become more robust to badly-formed prompts. Squashed commit of the following: commit 8fcfa88a16e1390d41717e940d72aed64712171c Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Sun Oct 30 17:05:57 2022 +0100 further cleanup commit 1a1fd78bcfeb49d072e3e6d5808aa8df15441629 Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Sun Oct 30 16:07:57 2022 +0100 cleanup and document commit 099c9659fa8b8135876f9a5a50fe80b20bc0635c Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Sun Oct 30 15:54:58 2022 +0100 works fully commit 5e6887ea8c25a1e21438ff6defb381fd027d25fd Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Sun Oct 30 15:24:31 2022 +0100 further... commit 492fda120844d9bc1ad4ec7dd408a3374762d0ff Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Sun Oct 30 14:08:57 2022 +0100 getting there... commit c6aab05a8450cc3c95c8691daf38fdc64c74f52d Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Fri Oct 28 14:29:03 2022 +0200 wip doesn't compile commit 5e533f731cfd20cd435330eeb0012e5689e87e81 Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Fri Oct 28 13:21:43 2022 +0200 working with CrossAttentionCtonrol but no Attention support yet commit 9678348773431e500e110e8aede99086bb7b5955 Author: Damian at mba <damian@frey.NOSPAMco.nz> Date: Fri Oct 28 13:04:52 2022 +0200 wip rebuiling prompt parser commit 6215592b12dea3822c727913b771012789a52477 Merge: ef24d76a 349cc254 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 17:34:55 2022 -0400 Merge branch 'development' of github.com:invoke-ai/InvokeAI into development commit 349cc25433e1d358c6c61cca4a6c300ecc8ca3d7 Author: damian0815 <d@d.com> Date: Tue Nov 1 20:08:52 2022 +0100 fix crash (be a little less aggressive clearing out the attention slice) commit 214d276379387ae0fa2259602ab00884ec1ad03e Author: damian0815 <d@d.com> Date: Tue Nov 1 19:57:55 2022 +0100 be more aggressive at clearing out saved_attn_slice commit ef24d76adc5a192297714707cd6794d4f44bcf67 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 14:34:23 2022 -0400 fix library problems in preload_modules commit ab2b5a691dadb292f7cecf5db94a165db3e3e126 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Nov 1 17:22:48 2022 -0400 fix model_cache memory management issues commit c7de2b2801ad5d6ce52a5f44e88c5705f1dbf524 Author: mauwii <Mauwii@outlook.de> Date: Tue Nov 1 02:02:14 2022 +0100 disable checks with sd-V1.4 model... ...to save some resources, since V1.5 is the default now commit e8075658acf675346d35435d0cfb7710becab42a Author: mauwii <Mauwii@outlook.de> Date: Mon Oct 31 22:20:51 2022 +0100 update test-invoke-conda.yml - fix model dl path for sd-v1-4.ckpt - copy configs/models.yaml.example to configs/models.yaml commit 4202dabee1143f597f4c3946420fbfa7b8eccddf Author: mauwii <Mauwii@outlook.de> Date: Mon Oct 31 22:17:21 2022 +0100 fix models example weights for sd-v1.4 commit d67db2bcf1ac26d8bb7c5f8bfd056f2172597780 Author: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Date: Tue Nov 1 08:35:45 2022 +1300 [WebUI] Loopback Default False commit 7159ec885faa1117a3506689d547618be1d91808 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Mon Oct 31 11:33:05 2022 -0400 further improvements to preload_models.py - Faster startup for command line switch processing - Specify configuration file to modify using --config option: ./scripts/preload_models.ply --config models/my-models-file.yaml commit b5cf734ba9f1aeaab14075b55cc13ed9a0ae31e2 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Mon Oct 31 11:08:19 2022 -0400 improve behavior of preload_models.py - NEVER overwrite user's existing models.yaml - Instead, merge its contents into new config file, and rename original to models.yaml.orig (with message) - models.yaml has been removed from repository and renamed models.yaml.example commit f7dc8eafeef991e135b5541c01d0ff740dda9591 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Mon Oct 31 10:47:35 2022 -0400 restore models.yaml to virgin state commit 762ca60a309f70daaf1b9e79b6273f76fd9474b6 Author: Lincoln Stein <lincoln.stein@gmail.com> Date: Tue Oct 4 22:55:10 2022 -0400 Update INPAINTING.md commit e7fb9f342cb5ed0c09e6215026d60d45eef3ebcb Author: Hideyuki Katsushiro <h.katsushiro@qualia.tokyo.jp> Date: Wed Oct 5 10:08:53 2022 +0900 add argument --outdir
2022-11-12 17:17:07 +00:00
def _check_for_erasure(self, image:Image.Image)->bool:
if image.mode not in ('RGBA','RGB'):
return False
width, height = image.size
pixdata = image.load()
colored = 0
for y in range(height):
for x in range(width):
if pixdata[x, y][3] == 0:
r, g, b, _ = pixdata[x, y]
if (r, g, b) != (0, 0, 0) and \
(r, g, b) != (255, 255, 255):
colored += 1
return colored == 0
def _transparency_check_and_warning(self,image, mask, force_outpaint=False):
if not mask:
print(
'>> Initial image has transparent areas. Will inpaint in these regions.')
if (not force_outpaint) and self._check_for_erasure(image):
print(
'>> WARNING: Colors underneath the transparent region seem to have been erased.\n',
'>> Inpainting will be suboptimal. Please preserve the colors when making\n',
'>> a transparency mask, or provide mask explicitly using --init_mask (-M).'
)
def _squeeze_image(self, image):
x, y, resize_needed = self._resolution_check(image.width, image.height)
Refactoring simplet2i (#387) * start refactoring -not yet functional * first phase of refactor done - not sure weighted prompts working * Second phase of refactoring. Everything mostly working. * The refactoring has moved all the hard-core inference work into ldm.dream.generator.*, where there are submodules for txt2img and img2img. inpaint will go in there as well. * Some additional refactoring will be done soon, but relatively minor work. * fix -save_orig flag to actually work * add @neonsecret attention.py memory optimization * remove unneeded imports * move token logging into conditioning.py * add placeholder version of inpaint; porting in progress * fix crash in img2img * inpainting working; not tested on variations * fix crashes in img2img * ported attention.py memory optimization #117 from basujindal branch * added @torch_no_grad() decorators to img2img, txt2img, inpaint closures * Final commit prior to PR against development * fixup crash when generating intermediate images in web UI * rename ldm.simplet2i to ldm.generate * add backward-compatibility simplet2i shell with deprecation warning * add back in mps exception, addresses @vargol comment in #354 * replaced Conditioning class with exported functions * fix wrong type of with_variations attribute during intialization * changed "image_iterator()" to "get_make_image()" * raise NotImplementedError for calling get_make_image() in parent class * Update ldm/generate.py better error message Co-authored-by: Kevin Gibbons <bakkot@gmail.com> * minor stylistic fixes and assertion checks from code review * moved get_noise() method into img2img class * break get_noise() into two methods, one for txt2img and the other for img2img * inpainting works on non-square images now * make get_noise() an abstract method in base class * much improved inpainting Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
2022-09-06 00:40:10 +00:00
if resize_needed:
return InitImageResizer(image).resize(x, y)
Refactoring simplet2i (#387) * start refactoring -not yet functional * first phase of refactor done - not sure weighted prompts working * Second phase of refactoring. Everything mostly working. * The refactoring has moved all the hard-core inference work into ldm.dream.generator.*, where there are submodules for txt2img and img2img. inpaint will go in there as well. * Some additional refactoring will be done soon, but relatively minor work. * fix -save_orig flag to actually work * add @neonsecret attention.py memory optimization * remove unneeded imports * move token logging into conditioning.py * add placeholder version of inpaint; porting in progress * fix crash in img2img * inpainting working; not tested on variations * fix crashes in img2img * ported attention.py memory optimization #117 from basujindal branch * added @torch_no_grad() decorators to img2img, txt2img, inpaint closures * Final commit prior to PR against development * fixup crash when generating intermediate images in web UI * rename ldm.simplet2i to ldm.generate * add backward-compatibility simplet2i shell with deprecation warning * add back in mps exception, addresses @vargol comment in #354 * replaced Conditioning class with exported functions * fix wrong type of with_variations attribute during intialization * changed "image_iterator()" to "get_make_image()" * raise NotImplementedError for calling get_make_image() in parent class * Update ldm/generate.py better error message Co-authored-by: Kevin Gibbons <bakkot@gmail.com> * minor stylistic fixes and assertion checks from code review * moved get_noise() method into img2img class * break get_noise() into two methods, one for txt2img and the other for img2img * inpainting works on non-square images now * make get_noise() an abstract method in base class * much improved inpainting Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
2022-09-06 00:40:10 +00:00
return image
def _fit_image(self, image, max_dimensions):
w, h = max_dimensions
Refactoring simplet2i (#387) * start refactoring -not yet functional * first phase of refactor done - not sure weighted prompts working * Second phase of refactoring. Everything mostly working. * The refactoring has moved all the hard-core inference work into ldm.dream.generator.*, where there are submodules for txt2img and img2img. inpaint will go in there as well. * Some additional refactoring will be done soon, but relatively minor work. * fix -save_orig flag to actually work * add @neonsecret attention.py memory optimization * remove unneeded imports * move token logging into conditioning.py * add placeholder version of inpaint; porting in progress * fix crash in img2img * inpainting working; not tested on variations * fix crashes in img2img * ported attention.py memory optimization #117 from basujindal branch * added @torch_no_grad() decorators to img2img, txt2img, inpaint closures * Final commit prior to PR against development * fixup crash when generating intermediate images in web UI * rename ldm.simplet2i to ldm.generate * add backward-compatibility simplet2i shell with deprecation warning * add back in mps exception, addresses @vargol comment in #354 * replaced Conditioning class with exported functions * fix wrong type of with_variations attribute during intialization * changed "image_iterator()" to "get_make_image()" * raise NotImplementedError for calling get_make_image() in parent class * Update ldm/generate.py better error message Co-authored-by: Kevin Gibbons <bakkot@gmail.com> * minor stylistic fixes and assertion checks from code review * moved get_noise() method into img2img class * break get_noise() into two methods, one for txt2img and the other for img2img * inpainting works on non-square images now * make get_noise() an abstract method in base class * much improved inpainting Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
2022-09-06 00:40:10 +00:00
print(
f'>> image will be resized to fit inside a box {w}x{h} in size.'
)
# note that InitImageResizer does the multiple of 64 truncation internally
Merge dev into main for 2.2.0 (#1642) * Fixes inpainting + code cleanup * Disable stage info in Inpainting Tab * Mask Brush Preview now always at 0.5 opacity The new mask is only visible properly at max opacity but at max opacity the brush preview becomes fully opaque blocking the view. So the mask brush preview no remains at 0.5 no matter what the Brush opacity is. * Remove save button from Canvas Controls (cleanup) * Implements invert mask * Changes "Invert Mask" to "Preserve Masked Areas" * Fixes (?) spacebar issues * Patches redux-persist and redux-deep-persist with debounced persists Our app changes redux state very, very often. As our undo/redo history grows, the calls to persist state start to take in the 100ms range, due to a the deep cloning of the history. This causes very noticeable performance lag. The deep cloning is required because we need to blacklist certain items in redux from being persisted (e.g. the app's connection status). Debouncing the whole process of persistence is a simple and effective solution. Unfortunately, `redux-persist` dropped `debounce` between v4 and v5, replacing it with `throttle`. `throttle`, instead of delaying the expensive action until a period of X ms of inactivity, simply ensures the action is executed at least every X ms. Of course, this does not fix our performance issue. The patch is very simple. It adds a `debounce` argument - a number of milliseconds - and debounces `redux-persist`'s `update()` method (provided by `createPersistoid`) by that many ms. Before this, I also tried writing a custom storage adapter for `redux-persist` to debounce the calls to `localStorage.setItem()`. While this worked and was far less invasive, it doesn't actually address the issue. It turns out `setItem()` is a very fast part of the process. We use `redux-deep-persist` to simplify the `redux-persist` configuration, which can get complicated when you need to blacklist or whitelist deeply nested state. There is also a patch here for that library because it uses the same types as `redux-persist`. Unfortunately, the last release of `redux-persist` used a package `flat-stream` which was malicious and has been removed from npm. The latest commits to `redux-persist` (about 1 year ago) do not build; we cannot use the master branch. And between the last release and last commit, the changes have all been breaking. Patching this last release (about 3 years old at this point) directly is far simpler than attempting to fix the upstream library's master branch or figuring out an alternative to the malicious and now non-existent dependency. * Adds debouncing * Fixes AttributeError: 'dict' object has no attribute 'invert_mask' * Updates package.json to use redux-persist patches * Attempts to fix redux-persist debounce patch * Fixes undo/redo * Fixes invert mask * Debounce > 300ms * Limits history to 256 for each of undo and redo * Canvas styling * Hotkeys improvement * Add Metadata To Viewer * Increases CFG Scale max to 200 * Fix gallery width size for Outpainting Also fixes the canvas resizing failing n fast pushes * Fixes disappearing canvas grid lines * Adds staging area * Fixes "use all" not setting variationAmount Now sets to 0 when the image had variations. * Builds fresh bundle * Outpainting tab loads to empty canvas instead of upload * Fixes wonky canvas layer ordering & compositing * Fixes error on inpainting paste back `TypeError: 'float' object cannot be interpreted as an integer` * Hides staging area outline on mouseover prev/next * Fixes inpainting not doing img2img when no mask * Fixes bbox not resizing in outpainting if partially off screen * Fixes crashes during iterative outpaint. Still doesn't work correctly though. * Fix iterative outpainting by restoring original images * Moves image uploading to HTTP - It all seems to work fine - A lot of cleanup is still needed - Logging needs to be added - May need types to be reviewed * Fixes: outpainting temp images show in gallery * WIP refactor to unified canvas * Removes console.log from redux-persist patch * Initial unification of canvas * Removes all references to split inpainting/outpainting canvas * Add patchmatch and infill_method parameter to prompt2image (options are 'patchmatch' or 'tile'). * Fixes app after removing in/out-painting refs * Rebases on dev, updates new env files w/ patchmatch * Organises features/canvas * Fixes bounding box ending up offscreen * Organises features/canvas * Stops unnecessary canvas rescales on gallery state change * Fixes 2px layout shift on toggle canvas lock * Clips lines drawn while canvas locked When drawing with the locked canvas, if a brush stroke gets too close to the edge of the canvas and its stroke would extend past the edge of the canvas, the edge of that stroke will be seen after unlocking the canvas. This could cause a problem if you unlock the canvas and now have a bunch of strokes just outside the init image area, which are far back in undo history and you cannot easily erase. With this change, lines drawn while the canvas is locked get clipped to the initial image bbox, fixing this issue. Additionally, the merge and save to gallery functions have been updated to respect the initial image bbox so they function how you'd expect. * Fixes reset canvas view when locked * Fixes send to buttons * Fixes bounding box not being rounded to 64 * Abandons "inpainting" canvas lock * Fixes save to gallery including empty area, adds download and copy image * Fix Current Image display background going over image bounds * Sets status immediately when clicking Invoke * Adds hotkeys and refactors sharing of konva instances Adds hotkeys to canvas. As part of this change, the access to konva instance objects was refactored: Previously closure'd refs were used to indirectly get access to the konva instances outside of react components. Now, a getter and setter function are used to provide access directly to the konva objects. * Updates hotkeys * Fixes canvas showing spinner on first load Also adds good default canvas scale and positioning when no image is on it * Fixes possible hang on MaskCompositer * Improves behaviour when setting init canvas image/reset view * Resets bounding box coords/dims when no image present * Disables canvas actions which cannot be done during processing * Adds useToastWatcher hook - Dispatch an `addToast` action with standard Chakra toast options object to add a toast to the toastQueue - The hook is called in App.tsx and just useEffect's w/ toastQueue as dependency to create the toasts - So now you can add toasts anywhere you have access to `dispatch`, which includes middleware and thunks - Adds first usage of this for the save image buttons in canvas * Update Hotkey Info Add missing tooltip hotkeys and update the hotkeys modal to reflect the new hotkeys for the Unified Canvas. * Fix theme changer not displaying current theme on page refresh * Fix tab count in hotkeys panel * Unify Brush and Eraser Sizes * Fix staging area display toggle not working * Staging Area delete button is now red So it doesnt feel blended into to the rest of them. * Revert "Fix theme changer not displaying current theme on page refresh" This reverts commit 903edfb803e743500242589ff093a8a8a0912726. * Add arguments to use SSL to webserver * Integrates #1487 - touch events Need to add: - Pinch zoom - Touch-specific handling (some things aren't quite right) * Refactors upload-related async thunks - Now standard thunks instead of RTK createAsyncThunk() - Adds toasts for all canvas upload-related actions * Reorganises app file structure * Fixes Canvas Auto Save to Gallery * Fixes staging area outline * Adds staging area hotkeys, disables gallery left/right when staging * Fixes Use All Parameters * Fix metadata viewer image url length when viewing intermediate * Fixes intermediate images being tiny in txt2img/img2img * Removes stale code * Improves canvas status text and adds option to toggle debug info * Fixes paste image to upload * Adds model drop-down to site header * Adds theme changer popover * Fix missing key on ThemeChanger map * Fixes stage position changing on zoom * Hotkey Cleanup - Viewer is now Z - Canvas Move tool is V - sync with PS - Removed some unused hotkeys * Fix canvas resizing when both options and gallery are unpinned * Implements thumbnails for gallery - Thumbnails are saved whenever an image is saved, and when gallery requests images from server - Thumbnails saved at original image aspect ratio with width of 128px as WEBP - If the thumbnail property of an image is unavailable for whatever reason, the image's full size URL is used instead * Saves thumbnails to separate thumbnails directory * Thumbnail size = 256px * Fix Lightbox Issues * Disables canvas image saving functions when processing * Fix index error on going past last image in Gallery * WIP - Lightbox Fixes Still need to fix the images not being centered on load when the image res changes * Fixes another similar index error, simplifies logic * Reworks canvas toolbar * Fixes canvas toolbar upload button * Cleans up IAICanvasStatusText * Improves metadata handling, fixes #1450 - Removes model list from metadata - Adds generation's specific model to metadata - Displays full metadata in JSON viewer * Gracefully handles corrupted images; fixes #1486 - App does not crash if corrupted image loaded - Error is displayed in the UI console and CLI output if an image cannot be loaded * Adds hotkey to reset canvas interaction state If the canvas' interaction state (e.g. isMovingBoundingBox, isDrawing, etc) get stuck somehow, user can press Escape to reset the state. * Removes stray console.log() * Fixes bug causing gallery to close on context menu open * Minor bugfixes - When doing long-running canvas image exporting actions, display indeterminate progress bar - Fix staging area image outline not displaying after committing/discarding results * Removes unused imports * Fixes repo root .gitignore ignoring frontend things * Builds fresh bundle * Styling updates * Removes reasonsWhyNotReady The popover doesn't play well with the button being disabled, and I don't think adds any value. * Image gallery resize/style tweaks * Styles buttons for clearing canvas history and mask * First pass on Canvas options panel * Fixes bug where discarding staged images results in loss of history * Adds Save to Gallery button to staging toolbar * Rearrange some canvas toolbar icons Put brush stuff together and canvas movement stuff together * Fix gallery maxwidth on unified canvas * Update Layer hotkey display to UI * Adds option to crop to bounding box on save * Masking option tweaks * Crop to Bounding Box > Save Box Region Only * Adds clear temp folder * Updates mask options popover behavior * Builds fresh bundle * Fix styling on alert modals * Fix input checkbox styling being incorrect on light theme * Styling fixes * Improves gallery resize behaviour * Cap gallery size on canvas tab so it doesnt overflow * Fixes bug when postprocessing image with no metadata * Adds IAIAlertDialog component * Moves Loopback to app settings * Fixes metadata viewer not showing metadata after refresh Also adds Dream-style prompt to metadata * Adds outpainting specific options * Linting * Fixes gallery width on lightbox, fixes gallery button expansion * Builds fresh bundle * Fix Lightbox images of different res not centering * Update feature tooltip text * Highlight mask icon when on mask layer * Fix gallery not resizing correctly on open and close * Add loopback to just img2img. Remove from settings. * Fix to gallery resizing * Removes Advanced checkbox, cleans up options panel for unified canvas * Minor styling fixes to new options panel layout * Styling Updates * Adds infill method * Tab Styling Fixes * memoize outpainting options * Fix unnecessary gallery re-renders * Isolate Cursor Pos debug text on canvas to prevent rerenders * Fixes missing postprocessed image metadata before refresh * Builds fresh bundle * Fix rerenders on model select * Floating panel re-render fix * Simplify fullscreen hotkey selector * Add Training WIP Tab * Adds Training icon * Move full screen hotkey to floating to prevent tab rerenders * Adds single-column gallery layout * Fixes crash on cancel with intermediates enabled, fixes #1416 * Updates npm dependencies * Fixes img2img attempting inpaint when init image has transparency * Fixes missing threshold and perlin parameters in metadata viewer * Renames "Threshold" > "Noise Threshold" * Fixes postprocessing not being disabled when clicking use all * Builds fresh bundle * Adds color picker * Lints & builds fresh bundle * Fixes iterations being disabled when seed random & variations are off * Un-floors cursor position * Changes color picker preview to circles * Fixes variation params not set correctly when recalled * Fixes invoke hotkey not working in input fields * Simplifies Accordion Prep for adding reset buttons for each section * Fixes mask brush preview color * Committing color picker color changes tool to brush * Color picker does not overwrite user-selected alpha * Adds brush color alpha hotkey * Lints * Removes force_outpaint param * Add inpaint size options to inpaint at a larger size than the actual inpaint image, then scale back down for recombination * Bug fix for inpaint size * Adds inpaint size (as scale bounding box) to UI * Adds auto-scaling for inpaint size * Improves scaled bbox display logic * Fixes bug with clear mask and history * Fixes shouldShowStagingImage not resetting to true on commit * Builds fresh bundle * Fixes canvas failing to scale on first run * Builds fresh bundle * Fixes unnecessary canvas scaling * Adds gallery drag and drop to img2img/canvas * Builds fresh bundle * Fix desktop mode being broken with new versions of flaskwebgui * Fixes canvas dimensions not setting on first load * Builds fresh bundle * stop crash on !import_models call on model inside rootdir - addresses bug report #1546 * prevent "!switch state gets confused if model switching fails" - If !switch were to fail on a particular model, then generate got confused and wouldn't try again until you switch to a different working model and back again. - This commit fixes and closes #1547 * Revert "make the docstring more readable and improve the list_models logic" This reverts commit 248068fe5d57b5639ea7a87ee6cbf023104d957d. * fix model cache path * also set fail-fast to it's default (true) in this way the whole action fails if one job fails this should unblock the runners!!! * fix output path for Archive results * disable checks for python 3.9 * Update-requirements and test-invoke-pip workflow (#1574) * update requirements files * update test-invoke-pip workflow * move requirements-mkdocs.txt to docs folder (#1575) * move requirements-mkdocs.txt to docs folder * update copyright * Fixes outpainting with resized inpaint size * Interactive configuration (#1517) * Update scripts/configure_invokeai.py prevent crash if output exists Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> * implement changes requested by reviews * default to correct root and output directory on Windows systems - Previously the script was relying on the readline buffer editing feature to set up the correct default. But this feature doesn't exist on windows. - This commit detects when user typed return with an empty directory value and replaces with the default directory. * improved readability of directory choices * Update scripts/configure_invokeai.py Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> * better error reporting at startup - If user tries to run the script outside of the repo or runtime directory, a more informative message will appear explaining the problem. Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> * Embedding merging (#1526) * add whole <style token> to vocab for concept library embeddings * add ability to load multiple concept .bin files * make --log_tokenization respect custom tokens * start working on concept downloading system * preliminary support for dynamic loading and merging of multiple embedded models - The embedding_manager is now enhanced with ldm.invoke.concepts_lib, which handles dynamic downloading and caching of embedded models from the Hugging Face concepts library (https://huggingface.co/sd-concepts-library) - Downloading of a embedded model is triggered by the presence of one or more <concept> tags in the prompt. - Once the embedded model is downloaded, its trigger phrase will be loaded into the embedding manager and the prompt's <concept> tag will be replaced with the <trigger_phrase> - The downloaded model stays on disk for fast loading later. - The CLI autocomplete will complete partial <concept> tags for you. Type a '<' and hit tab to get all ~700 concepts. BUGS AND LIMITATIONS: - MODEL NAME VS TRIGGER PHRASE You must use the name of the concept embed model from the SD library, and not the trigger phrase itself. Usually these are the same, but not always. For example, the model named "hoi4-leaders" corresponds to the trigger "<HOI4-Leader>" One reason for this design choice is that there is no apparent constraint on the uniqueness of the trigger phrases and one trigger phrase may map onto multiple models. So we use the model name instead. The second reason is that there is no way I know of to search Hugging Face for models with certain trigger phrases. So we'd have to download all 700 models to index the phrases. The problem this presents is that this may confuse users, who will want to reuse prompts from distributions that use the trigger phrase directly. Usually this will work, but not always. - WON'T WORK ON A FIREWALLED SYSTEM If the host running IAI has no internet connection, it can't download the concept libraries. I will add a script that allows users to preload a list of concept models. - BUG IN PROMPT REPLACEMENT WHEN MODEL NOT FOUND There's a small bug that occurs when the user provides an invalid model name. The <concept> gets replaced with <None> in the prompt. * fix loading .pt embeddings; allow multi-vector embeddings; warn on dupes * simplify replacement logic and remove cuda assumption * download list of concepts from hugging face * remove misleading customization of '*' placeholder the existing code as-is did not do anything; unclear what it was supposed to do. the obvious alternative -- setting using 'placeholder_strings' instead of 'placeholder_tokens' to match model.params.personalization_config.params.placeholder_strings -- caused a crash. i think this is because the passed string also needed to be handed over on init of the PersonalizedBase as the 'placeholder_token' argument. this is weird config dict magic and i don't want to touch it. put a breakpoint in personalzied.py line 116 (top of PersonalizedBase.__init__) if you want to have a crack at it yourself. * address all the issues raised by damian0815 in review of PR #1526 * actually resize the token_embeddings * multiple improvements to the concept loader based on code reviews 1. Activated the --embedding_directory option (alias --embedding_path) to load a single embedding or an entire directory of embeddings at startup time. 2. Can turn off automatic loading of embeddings using --no-embeddings. 3. Embedding checkpoints are scanned with the pickle scanner. 4. More informative error messages when a concept can't be loaded due either to a 404 not found error or a network error. * autocomplete terms end with ">" now * fix startup error and network unreachable 1. If the .invokeai file does not contain the --root and --outdir options, invoke.py will now fix it. 2. Catch and handle network problems when downloading hugging face textual inversion concepts. * fix misformatted error string Co-authored-by: Damian Stewart <d@damianstewart.com> * model_cache.py: fix list_models Signed-off-by: devops117 <55235206+devops117@users.noreply.github.com> * add statement of values (#1584) * this adds the Statement of Values Google doc source = https://docs.google.com/document/d/1-PrUKDJcxy8OyNGc8CyiHhv2VgLvjt7LRGlEpbg1nmQ/edit?usp=sharing * Fix heading * Update InvokeAI_Statement_of_Values.md * Update InvokeAI_Statement_of_Values.md * Update InvokeAI_Statement_of_Values.md * Update InvokeAI_Statement_of_Values.md * Update InvokeAI_Statement_of_Values.md * add keturn and mauwii to the team member list * Fix punctuation * this adds the Statement of Values Google doc source = https://docs.google.com/document/d/1-PrUKDJcxy8OyNGc8CyiHhv2VgLvjt7LRGlEpbg1nmQ/edit?usp=sharing * add keturn and mauwii to the team member list * fix formating - make sub bullets use * (decide to all use - or *) - indent sub bullets Sorry, first only looked at the code version and found this only after looking at the markdown rendered version * use multiparagraph numbered sections * Break up Statement Of Values as per comments on #1584 * remove duplicated word, reduce vagueness it's important not to overstate how many artists we are consulting. * fix typo (sorry blessedcoolant) Co-authored-by: mauwii <Mauwii@outlook.de> Co-authored-by: damian <git@damianstewart.com> * update dockerfile (#1551) * update dockerfile * remove not existing file from .dockerignore * remove bloat and unecesary step also use --no-cache-dir for pip install image is now close to 2GB * make Dockerfile a variable * set base image to `ubuntu:22.10` * add build-essential * link outputs folder for persistence * update tag variable * update docs * fix not customizeable build args, add reqs output * !model_import autocompletes in ROOTDIR * Adds psychedelicious to statement of values signature (#1602) * add a --no-patchmatch option to disable patchmatch loading (#1598) This feature was added to prevent the CI Macintosh tests from erroring out when patchmatch is unable to retrieve its shared library from github assets. * Fix #1599 by relaxing the `match_trigger` regex (#1601) * Fix #1599 by relaxing the `match_trigger` regex Also simplify logic and reduce duplication. * restrict trigger regex again (but not so far) * make concepts library work with Web UI This PR makes it possible to include a Hugging Face concepts library <style-or-subject-trigger> in the WebUI prompt. The metadata seems to be correctly handled. * documentation enhancements (#1603) - Add documentation for the Hugging Face concepts library and TI embedding. - Fixup index.md to point to each of the feature documentation files, including ones that are pending. * tweak setup and environment files for linux & pypatchmatch (#1580) * tweak setup and environment files for linux & pypatchmatch - Downgrade python requirements to 3.9 because 3.10 is not supported on Ubuntu 20.04 LTS (widely-used distro) - Use our github pypatchmatch 0.1.3 in order to install Makefile where it needs to be. - Restored "-e ." as the last install step on pip installs. Hopefully this will not trigger the high-CPU hang we've previously experienced. * keep windows on basicsr 1.4.1 * keep windows on basicsr 1.4.1 * bump pypatchmatch requirement to 0.1.4 - This brings in a version of pypatchmatch that will gracefully handle internet connection not available at startup time. - Also refactors and simplifies the handling of gfpgan's basicsr requirement across various platforms. * revert to older version of list_models() (#1611) This restores the correct behavior of list_models() and quenches the bug of list_models() returning a single model entry named "name". I have not investigated what was wrong with the new version, but I think it may have to do with changes to the behavior in dict.update() * Fixes for #1604 (#1605) * Converts ESRGAN image input to RGB - Also adds typing for image input. - Partially resolves #1604 * ensure there are unmasked pixels before color matching Co-authored-by: Kyle Schouviller <kyle0654@hotmail.com> * update index.md (#1609) - comment out non existing link - fix indention - add seperator between feature categories * Debloat-docker (#1612) * debloat Dockerfile - less options more but more userfriendly - better Entrypoint to simulate CLI usage - without command the container still starts the web-host * debloat build.sh * better syntax in run.sh * update Docker docs - fix description of VOLUMENAME - update run script example to reflect new entrypoint * Test installer (#1618) * test linux install * try removing http from parsed requirements * pip install confirmed working on linux * ready for linux testing - rebuilt py3.10-linux-x86_64-cuda-reqs.txt to include pypatchmatch dependency. - point install.sh and install.bat to test-installer branch. * Updates MPS reqs * detect broken readline history files * fix download.pytorch.org URL * Test installer (Win 11) (#1620) Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> * Test installer (MacOS 13.0.1 w/ torch==1.12.0) (#1621) * Test installer (Win 11) * Test installer (MacOS 13.0.1 w/ torch==1.12.0) Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> * change sourceball to development for testing * Test installer (MacOS 13.0.1 w/ torch==1.12.1 & torchvision==1.13.1) (#1622) * Test installer (Win 11) * Test installer (MacOS 13.0.1 w/ torch==1.12.0) * Test installer (MacOS 13.0.1 w/ torch==1.12.1 & torchvision==1.13.1) Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Co-authored-by: Cyrus Chan <82143712+cyruschan360@users.noreply.github.com> Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> * 2.2 Doc Updates (#1589) * Unified Canvas Docs & Assets Unified Canvas draft Advanced Tools Updates Doc Updates (lstein feedback) * copy edits to Unified Canvas docs - consistent capitalisation and feature naming - more intimate address (replace "the user" with "you") for improved User Engagement(tm) - grammatical massaging and *poesie* Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> Co-authored-by: damian <git@damianstewart.com> * include a step after config to `cat ~/.invokeai` (#1629) * disable patchmatch in CI actions (#1626) * disable patchmatch in CI actions * fix indention * replace tab with spaces Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> * Fix installer script for macOS. (#1630) * refer to the platform as 'osx' instead of 'mac', otherwise the composed URL to micromamba is wrong. * move the `-O` option to `tar` to be grouped with the other tar flags to avoid the `-O` being interpreted as something to unarchive. * Removes symlinked environment.yaml (#1631) Was unintentionally added in #1621 * Fix inpainting with iterations (#1635) * fix error when inpainting using runwayml inpainting model (#1634) - error was "Omnibus object has no attribute pil_image" - closes #1596 * add k_dpmpp_2_a and k_dpmpp_2 solvers options (#1389) * add k_dpmpp_2_a and k_dpmpp_2 solvers options * update frontend Co-authored-by: Victor <victorca25@users.noreply.github.com> Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> * add .editorconfig (#1636) * Web UI 2.2 bugfixes (#1572) * Fixes bug preventing multiple images from being generated * Fixes valid seam strength value range * Update Delete Alert Text Indicates to the user that images are not permanently deleted. * Fixes left/right arrows not working on gallery * Fixes initial image on load erroneously set to a user uploaded image Should be a result gallery image. * Lightbox Fixes - Lightbox is now a button in the current image buttons - Lightbox is also now available in the gallery context menu - Lightbox zoom issues fixed - Lightbox has a fade in animation. * Fix image display wrapper in current preview not overflow bounds * Revert "Fix image display wrapper in current preview not overflow bounds" This reverts commit 5511c82714dbf1d1999d64e8bc357bafa34ddf37. * Change Staging Area discard icon from Bin to X * Expose Snap Threshold and Move Snap Settings to BBox Panel * Changes img2img strength default to 0.75 * Fixes drawing triggering when mouse enters canvas w/ button down When we only supported inpainting and no zoom, this was useful. It allowed the cursor to leave the canvas (which was easy to do given the limited canvas dimensions) and without losing the "I am drawing" state. With a zoomable canvas this is no longer as useful. Additionally, we have more popovers and tools (like the color pickers) which result in unexpected brush strokes. This fixes that issue. * Revert "Expose Snap Threshold and Move Snap Settings to BBox Panel" We will handle this a bit differently - by allowing the grid origin to be moved. I will dig in at some point. This reverts commit 33c92ecf4da724c2f17d9d91c7ea31a43a2f6deb. * Adds Limit Strokes to Box * Adds fill bounding box button * Adds erase bounding box button * Changes Staging area discard icon to match others * Fixes right click breaking move tool * Fixes brush preview visibility issue with "darken outside box" * Fixes history bugs with addFillRect, addEraseRect, and other actions * Adds missing `key` * Fixes postprocessing being applied to canvas generations * Fixes bbox not getting scaled in various situations * Fixes staging area show image toggle not resetting on accept/discard * Locks down canvas while generating/staging * Fixes move tool breaking when canvas loses focus during move/transform * Hides cursor when restrict strokes is on and mouse outside bbox * Lints * Builds fresh bundle * Fix overlapping hotkey for Fill Bounding Box * Build Fresh Bundle * Fixes bug with mask and bbox overlay * Builds fresh bundle Co-authored-by: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com> * disable NSFW checker loading during the CI tests (#1641) * disable NSFW checker loading during the CI tests The NSFW filter apparently causes invoke.py to crash during CI testing, possibly due to out of memory errors. This workaround disables NSFW model loading. * doc change * fix formatting errors in yml files * Configure the NSFW checker at install time with default on (#1624) * configure the NSFW checker at install time with default on 1. Changes the --safety_checker argument to --nsfw_checker and --no-nsfw_checker. The original argument is recognized for backward compatibility. 2. The configure script asks users whether to enable the checker (default yes). Also offers users ability to select default sampler and number of generation steps. 3.Enables the pasting of the caution icon on blurred images when InvokeAI is installed into the package directory. 4. Adds documentation for the NSFW checker, including caveats about accuracy, memory requirements, and intermediate image dispaly. * use better fitting icon * NSFW defaults false for testing * set default back to nsfw active Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> Signed-off-by: devops117 <55235206+devops117@users.noreply.github.com> Co-authored-by: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Co-authored-by: blessedcoolant <54517381+blessedcoolant@users.noreply.github.com> Co-authored-by: Kyle Schouviller <kyle0654@hotmail.com> Co-authored-by: javl <mail@jaspervanloenen.com> Co-authored-by: Kent Keirsey <31807370+hipsterusername@users.noreply.github.com> Co-authored-by: mauwii <Mauwii@outlook.de> Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com> Co-authored-by: Damian Stewart <d@damianstewart.com> Co-authored-by: DevOps117 <55235206+devops117@users.noreply.github.com> Co-authored-by: damian <git@damianstewart.com> Co-authored-by: Damian Stewart <null@damianstewart.com> Co-authored-by: Cyrus Chan <82143712+cyruschan360@users.noreply.github.com> Co-authored-by: Cyrus Chan <cyruswkc@hku.hk> Co-authored-by: Andre LaBranche <dre@mac.com> Co-authored-by: victorca25 <41912303+victorca25@users.noreply.github.com> Co-authored-by: Victor <victorca25@users.noreply.github.com>
2022-11-30 21:12:23 +00:00
image = InitImageResizer(image).resize(width=w, height=h)
Refactoring simplet2i (#387) * start refactoring -not yet functional * first phase of refactor done - not sure weighted prompts working * Second phase of refactoring. Everything mostly working. * The refactoring has moved all the hard-core inference work into ldm.dream.generator.*, where there are submodules for txt2img and img2img. inpaint will go in there as well. * Some additional refactoring will be done soon, but relatively minor work. * fix -save_orig flag to actually work * add @neonsecret attention.py memory optimization * remove unneeded imports * move token logging into conditioning.py * add placeholder version of inpaint; porting in progress * fix crash in img2img * inpainting working; not tested on variations * fix crashes in img2img * ported attention.py memory optimization #117 from basujindal branch * added @torch_no_grad() decorators to img2img, txt2img, inpaint closures * Final commit prior to PR against development * fixup crash when generating intermediate images in web UI * rename ldm.simplet2i to ldm.generate * add backward-compatibility simplet2i shell with deprecation warning * add back in mps exception, addresses @vargol comment in #354 * replaced Conditioning class with exported functions * fix wrong type of with_variations attribute during intialization * changed "image_iterator()" to "get_make_image()" * raise NotImplementedError for calling get_make_image() in parent class * Update ldm/generate.py better error message Co-authored-by: Kevin Gibbons <bakkot@gmail.com> * minor stylistic fixes and assertion checks from code review * moved get_noise() method into img2img class * break get_noise() into two methods, one for txt2img and the other for img2img * inpainting works on non-square images now * make get_noise() an abstract method in base class * much improved inpainting Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
2022-09-06 00:40:10 +00:00
print(
f'>> after adjusting image dimensions to be multiples of 64, init image is {image.width}x{image.height}'
)
Refactoring simplet2i (#387) * start refactoring -not yet functional * first phase of refactor done - not sure weighted prompts working * Second phase of refactoring. Everything mostly working. * The refactoring has moved all the hard-core inference work into ldm.dream.generator.*, where there are submodules for txt2img and img2img. inpaint will go in there as well. * Some additional refactoring will be done soon, but relatively minor work. * fix -save_orig flag to actually work * add @neonsecret attention.py memory optimization * remove unneeded imports * move token logging into conditioning.py * add placeholder version of inpaint; porting in progress * fix crash in img2img * inpainting working; not tested on variations * fix crashes in img2img * ported attention.py memory optimization #117 from basujindal branch * added @torch_no_grad() decorators to img2img, txt2img, inpaint closures * Final commit prior to PR against development * fixup crash when generating intermediate images in web UI * rename ldm.simplet2i to ldm.generate * add backward-compatibility simplet2i shell with deprecation warning * add back in mps exception, addresses @vargol comment in #354 * replaced Conditioning class with exported functions * fix wrong type of with_variations attribute during intialization * changed "image_iterator()" to "get_make_image()" * raise NotImplementedError for calling get_make_image() in parent class * Update ldm/generate.py better error message Co-authored-by: Kevin Gibbons <bakkot@gmail.com> * minor stylistic fixes and assertion checks from code review * moved get_noise() method into img2img class * break get_noise() into two methods, one for txt2img and the other for img2img * inpainting works on non-square images now * make get_noise() an abstract method in base class * much improved inpainting Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
2022-09-06 00:40:10 +00:00
return image
def _resolution_check(self, width, height, log=False):
resize_needed = False
w, h = map(
lambda x: x - x % 64, (width, height)
) # resize to integer multiple of 64
if h != height or w != width:
if log:
print(
f'>> Provided width and height must be multiples of 64. Auto-resizing to {w}x{h}'
)
height = h
width = w
Refactoring simplet2i (#387) * start refactoring -not yet functional * first phase of refactor done - not sure weighted prompts working * Second phase of refactoring. Everything mostly working. * The refactoring has moved all the hard-core inference work into ldm.dream.generator.*, where there are submodules for txt2img and img2img. inpaint will go in there as well. * Some additional refactoring will be done soon, but relatively minor work. * fix -save_orig flag to actually work * add @neonsecret attention.py memory optimization * remove unneeded imports * move token logging into conditioning.py * add placeholder version of inpaint; porting in progress * fix crash in img2img * inpainting working; not tested on variations * fix crashes in img2img * ported attention.py memory optimization #117 from basujindal branch * added @torch_no_grad() decorators to img2img, txt2img, inpaint closures * Final commit prior to PR against development * fixup crash when generating intermediate images in web UI * rename ldm.simplet2i to ldm.generate * add backward-compatibility simplet2i shell with deprecation warning * add back in mps exception, addresses @vargol comment in #354 * replaced Conditioning class with exported functions * fix wrong type of with_variations attribute during intialization * changed "image_iterator()" to "get_make_image()" * raise NotImplementedError for calling get_make_image() in parent class * Update ldm/generate.py better error message Co-authored-by: Kevin Gibbons <bakkot@gmail.com> * minor stylistic fixes and assertion checks from code review * moved get_noise() method into img2img class * break get_noise() into two methods, one for txt2img and the other for img2img * inpainting works on non-square images now * make get_noise() an abstract method in base class * much improved inpainting Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
2022-09-06 00:40:10 +00:00
resize_needed = True
return width, height, resize_needed
def _has_cuda(self):
return self.device.type == 'cuda'
def write_intermediate_images(self,modulus,path):
counter = -1
if not os.path.exists(path):
os.makedirs(path)
def callback(img):
nonlocal counter
counter += 1
if counter % modulus != 0:
return;
image = self.sample_to_image(img)
image.save(os.path.join(path,f'{counter:03}.png'),'PNG')
return callback
2022-10-03 18:39:58 +00:00
def _pairwise(iterable):
"s -> (s0, s1), (s2, s3), (s4, s5), ..."
a = iter(iterable)
return zip(a, a)