From 6fdbc1978dce19913af2e53ce70d15db8951e461 Mon Sep 17 00:00:00 2001 From: Kevin Turner <83819+keturn@users.noreply.github.com> Date: Sun, 15 Jan 2023 06:22:46 -0800 Subject: [PATCH] =?UTF-8?q?use=20=F0=9F=A7=A8diffusers=20model=20(#1583)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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 and end with a repeated "end-of-sequence" marker - to make a default prompt length of + 75 prompt tokens + . the .swap() code was failing to take the column for at index 0 into account. the changes here do that, and also add extra handling for a single (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 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 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 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 Date: Sun Dec 18 15:04:28 2022 +0100 cleanup and add performance notes commit e400f804ac471a0ca2ba432fd658778b20c7bdab Author: Damian Stewart Date: Sun Dec 18 14:45:07 2022 +0100 fix bug and update unit tests commit deb9ae0ae1016750e93ce8275734061f7285a231 Author: Damian Stewart Date: Sun Dec 18 14:28:29 2022 +0100 textual inversion manager seems to work commit 162e02505dec777e91a983c4d0fb52e950d25ff0 Merge: cbad4583 12769b3d Author: Damian Stewart Date: Sun Dec 18 11:58:03 2022 +0100 Merge branch 'main' into feature_textual_inversion_mgr commit cbad45836c6aace6871a90f2621a953f49433131 Author: Damian Stewart Date: Sun Dec 18 11:54:10 2022 +0100 use position embeddings commit 070344c69b0e0db340a183857d0a787b348681d3 Author: Damian Stewart Date: Sun Dec 18 11:53:47 2022 +0100 Don't crash CLI on exceptions commit b035ac8c6772dfd9ba41b8eeb9103181cda028f8 Author: Damian Stewart Date: Sun Dec 18 11:11:55 2022 +0100 add missing position_embeddings commit 12769b3d3562ef71e0f54946b532ad077e10043c Author: Damian Stewart Date: Fri Dec 16 13:33:25 2022 +0100 debugging why it don't work commit bafb7215eabe1515ca5e8388fd3bb2f3ac5362cf Author: Damian Stewart Date: Fri Dec 16 13:21:33 2022 +0100 debugging why it don't work commit 664a6e9e146b42d96703f0cc8baf8f5efec04ee1 Author: Damian Stewart Date: Fri Dec 16 12:48:38 2022 +0100 use TextualInversionManager in place of embeddings (wip, doesn't work) commit 8b4f0fe9d6e4e2643b36dfa27864294785d7ba4e Author: Damian Stewart 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 Date: Fri Dec 16 02:37:31 2022 +0100 Merge branch 'feature_textual_inversion_mgr' into dev/diffusers commit 023df37efffa67434f77def7fc3c9dfb29f699fd Author: Damian Stewart Date: Fri Dec 16 02:36:54 2022 +0100 cleanup commit 05fac594eaf79d0058e3c48deee93df603f136c2 Author: Damian Stewart Date: Fri Dec 16 02:07:49 2022 +0100 tweak error checking commit 009f32ed39a7280997c3ffab112adadee0b44279 Author: damian Date: Thu Dec 15 21:29:47 2022 +0100 unit tests passing for embeddings with vector length >1 commit beb1b08d9a98112ed2fe073580568e1a18698da3 Author: Damian Stewart Date: Thu Dec 15 13:39:09 2022 +0100 more explicit equality tests when overwriting commit 44d8a5a7c85cdabc9ce3a54fd0769a10597b3ca9 Author: Damian Stewart 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 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 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 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 Co-authored-by: Damian Stewart Co-authored-by: Lincoln Stein Co-authored-by: Wybartel-luxmc <37852506+Wybartel-luxmc@users.noreply.github.com> Co-authored-by: mauwii 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 Co-authored-by: Matthias Wild <40327258+mauwii@users.noreply.github.com> --- .github/workflows/test-invoke-conda.yml | 161 --- .github/workflows/test-invoke-pip.yml | 81 +- README.md | 9 +- backend/invoke_ai_web_server.py | 76 +- backend/modules/parameters.py | 2 + binary_installer/requirements.in | 5 +- configs/INITIAL_MODELS.yaml | 88 +- configs/models.yaml.example | 20 +- configs/stable-diffusion/v2-inference-v.yaml | 68 ++ docs/CHANGELOG.md | 91 ++ .../environment-lin-aarch64.yml | 7 +- .../environment-lin-amd.yml | 8 +- .../environment-lin-cuda.yml | 8 +- .../environment-mac.yml | 10 +- .../environment-win-cuda.yml | 9 +- .../requirements-base.txt | 9 +- ...y-5c5a479d.js => index-legacy-474a75fe.js} | 8 +- .../{index.ec2d89c6.js => index.1b59e83a.js} | 98 +- frontend/dist/index.html | 4 +- frontend/public/locales/common/en-US.json | 3 + frontend/public/locales/common/en.json | 1 + .../public/locales/modelmanager/en-US.json | 19 +- frontend/public/locales/modelmanager/en.json | 16 +- frontend/public/locales/tooltip/it.json | 16 +- frontend/public/locales/tooltips/it.json | 15 - frontend/src/app/invokeai.d.ts | 30 +- frontend/src/app/socketio/actions.ts | 6 +- .../features/canvas/util/layerToDataURL.ts | 24 +- .../features/options/store/optionsSlice.ts | 9 + .../src/features/system/components/Modal.scss | 1 + .../ModelManager/AddCheckpointModel.tsx | 328 ++++++ .../ModelManager/AddDiffusersModel.tsx | 310 ++++++ .../components/ModelManager/AddModel.tsx | 357 +------ ...{ModelEdit.tsx => CheckpointModelEdit.tsx} | 12 +- .../ModelManager/DiffusersModelEdit.tsx | 270 +++++ .../components/ModelManager/ModelList.tsx | 179 +++- .../ModelManager/ModelManagerModal.tsx | 30 +- .../components/ModelManager/SearchModels.tsx | 1 + .../system/components/SiteHeader.scss | 4 - .../features/system/components/SiteHeader.tsx | 22 +- installer/templates/invoke.bat.in | 13 +- installer/templates/invoke.sh.in | 13 +- installer/templates/update.bat.in | 3 + installer/templates/update.sh.in | 2 + ldm/generate.py | 248 +++-- ldm/invoke/CLI.py | 416 +++++--- ldm/invoke/__init__.py | 2 +- ldm/invoke/_version.py | 2 +- ldm/invoke/args.py | 70 +- ldm/invoke/ckpt_generator/__init__.py | 4 + ldm/invoke/ckpt_generator/base.py | 338 +++++++ ldm/invoke/ckpt_generator/embiggen.py | 501 +++++++++ ldm/invoke/ckpt_generator/img2img.py | 97 ++ ldm/invoke/ckpt_generator/inpaint.py | 358 +++++++ ldm/invoke/ckpt_generator/omnibus.py | 175 ++++ ldm/invoke/ckpt_generator/txt2img.py | 88 ++ ldm/invoke/ckpt_generator/txt2img2img.py | 182 ++++ ldm/invoke/ckpt_to_diffuser.py | 953 ++++++++++++++++++ ldm/invoke/concepts_lib.py | 14 +- ldm/invoke/conditioning.py | 10 +- ldm/invoke/devices.py | 3 + ldm/invoke/generator/base.py | 32 +- ldm/invoke/generator/diffusers_pipeline.py | 632 ++++++++++++ ldm/invoke/generator/embiggen.py | 32 +- ldm/invoke/generator/img2img.py | 115 +-- ldm/invoke/generator/inpaint.py | 161 ++- ldm/invoke/generator/omnibus.py | 10 +- ldm/invoke/generator/txt2img.py | 71 +- ldm/invoke/generator/txt2img2img.py | 160 +-- ldm/invoke/globals.py | 38 + ldm/invoke/model_cache.py | 451 --------- ldm/invoke/model_manager.py | 953 ++++++++++++++++++ ldm/invoke/readline.py | 41 +- ldm/invoke/seamless.py | 1 + ldm/invoke/textual_inversion_training.py | 799 +++++++++++++++ .../diffusion/cross_attention_control.py | 22 +- ldm/models/diffusion/ddpm.py | 8 + ldm/models/diffusion/ksampler.py | 10 +- .../diffusion/shared_invokeai_diffusion.py | 79 +- ldm/modules/attention.py | 1 - ldm/modules/embedding_manager.py | 106 +- ldm/modules/encoders/modules.py | 140 ++- ldm/modules/prompt_to_embeddings_converter.py | 236 +++++ ldm/modules/textual_inversion_manager.py | 293 ++++++ ldm/util.py | 52 +- scripts/configure_invokeai.py | 224 ++-- scripts/merge_fe.py | 156 +++ scripts/textual_inversion.py | 11 + scripts/textual_inversion_fe.py | 333 ++++++ setup.py | 4 +- tests/inpainting/coyote-inpainting.prompt | 14 + tests/inpainting/coyote-input.webp | Bin 0 -> 36320 bytes tests/inpainting/coyote-mask.webp | Bin 0 -> 1576 bytes tests/inpainting/original.json | 30 + tests/test_textual_inversion.py | 301 ++++++ 95 files changed, 9387 insertions(+), 2036 deletions(-) delete mode 100644 .github/workflows/test-invoke-conda.yml create mode 100644 configs/stable-diffusion/v2-inference-v.yaml rename frontend/dist/assets/{index-legacy-5c5a479d.js => index-legacy-474a75fe.js} (78%) rename frontend/dist/assets/{index.ec2d89c6.js => index.1b59e83a.js} (65%) delete mode 100644 frontend/public/locales/tooltips/it.json create mode 100644 frontend/src/features/system/components/ModelManager/AddCheckpointModel.tsx create mode 100644 frontend/src/features/system/components/ModelManager/AddDiffusersModel.tsx rename frontend/src/features/system/components/ModelManager/{ModelEdit.tsx => CheckpointModelEdit.tsx} (97%) create mode 100644 frontend/src/features/system/components/ModelManager/DiffusersModelEdit.tsx create mode 100644 ldm/invoke/ckpt_generator/__init__.py create mode 100644 ldm/invoke/ckpt_generator/base.py create mode 100644 ldm/invoke/ckpt_generator/embiggen.py create mode 100644 ldm/invoke/ckpt_generator/img2img.py create mode 100644 ldm/invoke/ckpt_generator/inpaint.py create mode 100644 ldm/invoke/ckpt_generator/omnibus.py create mode 100644 ldm/invoke/ckpt_generator/txt2img.py create mode 100644 ldm/invoke/ckpt_generator/txt2img2img.py create mode 100644 ldm/invoke/ckpt_to_diffuser.py create mode 100644 ldm/invoke/generator/diffusers_pipeline.py delete mode 100644 ldm/invoke/model_cache.py create mode 100644 ldm/invoke/model_manager.py create mode 100644 ldm/invoke/textual_inversion_training.py create mode 100644 ldm/modules/prompt_to_embeddings_converter.py create mode 100644 ldm/modules/textual_inversion_manager.py create mode 100644 scripts/merge_fe.py create mode 100755 scripts/textual_inversion.py create mode 100755 scripts/textual_inversion_fe.py create mode 100644 tests/inpainting/coyote-inpainting.prompt create mode 100644 tests/inpainting/coyote-input.webp create mode 100644 tests/inpainting/coyote-mask.webp create mode 100644 tests/inpainting/original.json create mode 100644 tests/test_textual_inversion.py diff --git a/.github/workflows/test-invoke-conda.yml b/.github/workflows/test-invoke-conda.yml deleted file mode 100644 index fd6caf47fe..0000000000 --- a/.github/workflows/test-invoke-conda.yml +++ /dev/null @@ -1,161 +0,0 @@ -name: Test invoke.py -on: - push: - branches: - - 'main' - pull_request: - branches: - - 'main' - types: - - 'ready_for_review' - - 'opened' - - 'synchronize' - - 'converted_to_draft' - -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true - -jobs: - fail_if_pull_request_is_draft: - if: github.event.pull_request.draft == true - runs-on: ubuntu-22.04 - steps: - - name: Fails in order to indicate that pull request needs to be marked as ready to review and unit tests workflow needs to pass. - run: exit 1 - - matrix: - if: github.event.pull_request.draft == false - strategy: - matrix: - stable-diffusion-model: - - 'stable-diffusion-1.5' - environment-yaml: - - environment-lin-amd.yml - - environment-lin-cuda.yml - - environment-mac.yml - - environment-win-cuda.yml - include: - - environment-yaml: environment-lin-amd.yml - os: ubuntu-22.04 - curl-command: curl - github-env: $GITHUB_ENV - default-shell: bash -l {0} - - environment-yaml: environment-lin-cuda.yml - os: ubuntu-22.04 - curl-command: curl - github-env: $GITHUB_ENV - default-shell: bash -l {0} - - environment-yaml: environment-mac.yml - os: macos-12 - curl-command: curl - github-env: $GITHUB_ENV - default-shell: bash -l {0} - - environment-yaml: environment-win-cuda.yml - os: windows-2022 - curl-command: curl.exe - github-env: $env:GITHUB_ENV - default-shell: pwsh - - stable-diffusion-model: stable-diffusion-1.5 - stable-diffusion-model-url: https://huggingface.co/runwayml/stable-diffusion-v1-5/resolve/main/v1-5-pruned-emaonly.ckpt - stable-diffusion-model-dl-path: models/ldm/stable-diffusion-v1 - stable-diffusion-model-dl-name: v1-5-pruned-emaonly.ckpt - name: ${{ matrix.environment-yaml }} on ${{ matrix.os }} - runs-on: ${{ matrix.os }} - env: - CONDA_ENV_NAME: invokeai - INVOKEAI_ROOT: '${{ github.workspace }}/invokeai' - defaults: - run: - shell: ${{ matrix.default-shell }} - steps: - - name: Checkout sources - id: checkout-sources - uses: actions/checkout@v3 - - - name: create models.yaml from example - run: | - mkdir -p ${{ env.INVOKEAI_ROOT }}/configs - cp configs/models.yaml.example ${{ env.INVOKEAI_ROOT }}/configs/models.yaml - - - name: create environment.yml - run: cp "environments-and-requirements/${{ matrix.environment-yaml }}" environment.yml - - - name: Use cached conda packages - id: use-cached-conda-packages - uses: actions/cache@v3 - with: - path: ~/conda_pkgs_dir - key: conda-pkgs-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles(matrix.environment-yaml) }} - - - name: Activate Conda Env - id: activate-conda-env - uses: conda-incubator/setup-miniconda@v2 - with: - activate-environment: ${{ env.CONDA_ENV_NAME }} - environment-file: environment.yml - miniconda-version: latest - - - name: set test prompt to main branch validation - if: ${{ github.ref == 'refs/heads/main' }} - run: echo "TEST_PROMPTS=tests/preflight_prompts.txt" >> ${{ matrix.github-env }} - - - name: set test prompt to development branch validation - if: ${{ github.ref == 'refs/heads/development' }} - run: echo "TEST_PROMPTS=tests/dev_prompts.txt" >> ${{ matrix.github-env }} - - - name: set test prompt to Pull Request validation - if: ${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/development' }} - run: echo "TEST_PROMPTS=tests/validate_pr_prompt.txt" >> ${{ matrix.github-env }} - - - name: Use Cached Stable Diffusion Model - id: cache-sd-model - uses: actions/cache@v3 - env: - cache-name: cache-${{ matrix.stable-diffusion-model }} - with: - path: ${{ env.INVOKEAI_ROOT }}/${{ matrix.stable-diffusion-model-dl-path }} - key: ${{ env.cache-name }} - - - name: Download ${{ matrix.stable-diffusion-model }} - id: download-stable-diffusion-model - if: ${{ steps.cache-sd-model.outputs.cache-hit != 'true' }} - run: | - mkdir -p "${{ env.INVOKEAI_ROOT }}/${{ matrix.stable-diffusion-model-dl-path }}" - ${{ matrix.curl-command }} -H "Authorization: Bearer ${{ secrets.HUGGINGFACE_TOKEN }}" -o "${{ env.INVOKEAI_ROOT }}/${{ matrix.stable-diffusion-model-dl-path }}/${{ matrix.stable-diffusion-model-dl-name }}" -L ${{ matrix.stable-diffusion-model-url }} - - - name: run configure_invokeai.py - id: run-preload-models - run: | - python scripts/configure_invokeai.py --skip-sd-weights --yes - - - name: cat invokeai.init - id: cat-invokeai - run: cat ${{ env.INVOKEAI_ROOT }}/invokeai.init - - - name: Run the tests - id: run-tests - if: matrix.os != 'windows-2022' - run: | - time python scripts/invoke.py \ - --no-patchmatch \ - --no-nsfw_checker \ - --model ${{ matrix.stable-diffusion-model }} \ - --from_file ${{ env.TEST_PROMPTS }} \ - --root="${{ env.INVOKEAI_ROOT }}" \ - --outdir="${{ env.INVOKEAI_ROOT }}/outputs" - - - name: export conda env - id: export-conda-env - if: matrix.os != 'windows-2022' - run: | - mkdir -p outputs/img-samples - conda env export --name ${{ env.CONDA_ENV_NAME }} > ${{ env.INVOKEAI_ROOT }}/outputs/environment-${{ runner.os }}-${{ runner.arch }}.yml - - - name: Archive results - if: matrix.os != 'windows-2022' - id: archive-results - uses: actions/upload-artifact@v3 - with: - name: results_${{ matrix.requirements-file }}_${{ matrix.python-version }} - path: ${{ env.INVOKEAI_ROOT }}/outputs diff --git a/.github/workflows/test-invoke-pip.yml b/.github/workflows/test-invoke-pip.yml index b12a7ca879..34c90f10c5 100644 --- a/.github/workflows/test-invoke-pip.yml +++ b/.github/workflows/test-invoke-pip.yml @@ -4,8 +4,6 @@ on: branches: - 'main' pull_request: - branches: - - 'main' types: - 'ready_for_review' - 'opened' @@ -17,14 +15,14 @@ concurrency: cancel-in-progress: true jobs: - fail_if_pull_request_is_draft: - if: github.event.pull_request.draft == true - runs-on: ubuntu-18.04 - steps: - - name: Fails in order to indicate that pull request needs to be marked as ready to review and unit tests workflow needs to pass. - run: exit 1 + # fail_if_pull_request_is_draft: + # if: github.event.pull_request.draft == true && github.head_ref != 'dev/diffusers' + # runs-on: ubuntu-18.04 + # steps: + # - name: Fails in order to indicate that pull request needs to be marked as ready to review and unit tests workflow needs to pass. + # run: exit 1 matrix: - if: github.event.pull_request.draft == false + if: github.event.pull_request.draft == false || github.head_ref == 'dev/diffusers' strategy: matrix: stable-diffusion-model: @@ -40,26 +38,23 @@ jobs: include: - requirements-file: requirements-lin-cuda.txt os: ubuntu-22.04 - curl-command: curl github-env: $GITHUB_ENV - requirements-file: requirements-lin-amd.txt os: ubuntu-22.04 - curl-command: curl github-env: $GITHUB_ENV - requirements-file: requirements-mac-mps-cpu.txt os: macOS-12 - curl-command: curl github-env: $GITHUB_ENV - requirements-file: requirements-win-colab-cuda.txt os: windows-2022 - curl-command: curl.exe github-env: $env:GITHUB_ENV - - stable-diffusion-model: stable-diffusion-1.5 - stable-diffusion-model-url: https://huggingface.co/runwayml/stable-diffusion-v1-5/resolve/main/v1-5-pruned-emaonly.ckpt - stable-diffusion-model-dl-path: models/ldm/stable-diffusion-v1 - stable-diffusion-model-dl-name: v1-5-pruned-emaonly.ckpt name: ${{ matrix.requirements-file }} on ${{ matrix.python-version }} runs-on: ${{ matrix.os }} + env: + INVOKE_MODEL_RECONFIGURE: '--yes' + INVOKEAI_ROOT: '${{ github.workspace }}/invokeai' + PYTHONUNBUFFERED: 1 + HAVE_SECRETS: ${{ secrets.HUGGINGFACE_TOKEN != '' }} steps: - name: Checkout sources id: checkout-sources @@ -77,10 +72,17 @@ jobs: echo "INVOKEAI_ROOT=${{ github.workspace }}/invokeai" >> ${{ matrix.github-env }} echo "INVOKEAI_OUTDIR=${{ github.workspace }}/invokeai/outputs" >> ${{ matrix.github-env }} - - name: create models.yaml from example - run: | - mkdir -p ${{ env.INVOKEAI_ROOT }}/configs - cp configs/models.yaml.example ${{ env.INVOKEAI_ROOT }}/configs/models.yaml + - name: Use Cached diffusers-1.5 + id: cache-sd-model + uses: actions/cache@v3 + env: + cache-name: huggingface-${{ matrix.stable-diffusion-model }} + with: + path: | + ${{ env.INVOKEAI_ROOT }}/models/runwayml + ${{ env.INVOKEAI_ROOT }}/models/stabilityai + ${{ env.INVOKEAI_ROOT }}/models/CompVis + key: ${{ env.cache-name }} - name: set test prompt to main branch validation if: ${{ github.ref == 'refs/heads/main' }} @@ -110,30 +112,31 @@ jobs: - name: install requirements run: pip3 install -r '${{ matrix.requirements-file }}' - - name: Use Cached Stable Diffusion Model - id: cache-sd-model - uses: actions/cache@v3 - env: - cache-name: cache-${{ matrix.stable-diffusion-model }} - with: - path: ${{ env.INVOKEAI_ROOT }}/${{ matrix.stable-diffusion-model-dl-path }} - key: ${{ env.cache-name }} - - - name: Download ${{ matrix.stable-diffusion-model }} - id: download-stable-diffusion-model - if: ${{ steps.cache-sd-model.outputs.cache-hit != 'true' }} - run: | - mkdir -p "${{ env.INVOKEAI_ROOT }}/${{ matrix.stable-diffusion-model-dl-path }}" - ${{ matrix.curl-command }} -H "Authorization: Bearer ${{ secrets.HUGGINGFACE_TOKEN }}" -o "${{ env.INVOKEAI_ROOT }}/${{ matrix.stable-diffusion-model-dl-path }}/${{ matrix.stable-diffusion-model-dl-name }}" -L ${{ matrix.stable-diffusion-model-url }} - - name: run configure_invokeai.py id: run-preload-models - run: python3 scripts/configure_invokeai.py --skip-sd-weights --yes + env: + HUGGING_FACE_HUB_TOKEN: ${{ secrets.HUGGINGFACE_TOKEN }} + run: > + configure_invokeai.py + --yes + --full-precision # can't use fp16 weights without a GPU - name: Run the tests id: run-tests if: matrix.os != 'windows-2022' - run: python3 scripts/invoke.py --no-patchmatch --no-nsfw_checker --model ${{ matrix.stable-diffusion-model }} --from_file ${{ env.TEST_PROMPTS }} --root="${{ env.INVOKEAI_ROOT }}" --outdir="${{ env.INVOKEAI_OUTDIR }}" + env: + # Set offline mode to make sure configure preloaded successfully. + HF_HUB_OFFLINE: 1 + HF_DATASETS_OFFLINE: 1 + TRANSFORMERS_OFFLINE: 1 + run: > + python3 scripts/invoke.py + --no-patchmatch + --no-nsfw_checker + --model ${{ matrix.stable-diffusion-model }} + --from_file ${{ env.TEST_PROMPTS }} + --root="${{ env.INVOKEAI_ROOT }}" + --outdir="${{ env.INVOKEAI_OUTDIR }}" - name: Archive results id: archive-results diff --git a/README.md b/README.md index e4f841641c..07501a4242 100644 --- a/README.md +++ b/README.md @@ -100,7 +100,6 @@ to render 512x512 images. - At least 12 GB of free disk space for the machine learning model, Python, and all its dependencies. - ## Features Feature documentation can be reviewed by navigating to [the InvokeAI Documentation page](https://invoke-ai.github.io/InvokeAI/features/) @@ -118,6 +117,8 @@ InvokeAI's advanced prompt syntax allows for token weighting, cross-attention co For users utilizing a terminal-based environment, or who want to take advantage of CLI features, InvokeAI offers an extensive and actively supported command-line interface that provides the full suite of generation functionality available in the tool. ### Other features +- *Support for both ckpt and diffusers models* +- *SD 2.0, 2.1 support* - *Noise Control & Tresholding* - *Popular Sampler Support* - *Upscaling & Face Restoration Tools* @@ -125,14 +126,14 @@ For users utilizing a terminal-based environment, or who want to take advantage - *Model Manager & Support* ### Coming Soon -- *2.0/2.1 Model Support* -- *Depth2Img Support* - *Node-Based Architecture & UI* - And more... ### Latest Changes -For our latest changes, view our [Release Notes](https://github.com/invoke-ai/InvokeAI/releases) +For our latest changes, view our [Release +Notes](https://github.com/invoke-ai/InvokeAI/releases) and the +[CHANGELOG](docs/CHANGELOG.md). ## Troubleshooting diff --git a/backend/invoke_ai_web_server.py b/backend/invoke_ai_web_server.py index 02e8504589..1720c44f28 100644 --- a/backend/invoke_ai_web_server.py +++ b/backend/invoke_ai_web_server.py @@ -1,35 +1,34 @@ -import eventlet +import base64 import glob +import io +import json +import math +import mimetypes import os import shutil -import mimetypes import traceback -import math -import io -import base64 -import os -import json +from threading import Event +from uuid import uuid4 -from werkzeug.utils import secure_filename +import eventlet +from PIL import Image +from PIL.Image import Image as ImageType from flask import Flask, redirect, send_from_directory, request, make_response from flask_socketio import SocketIO -from PIL import Image, ImageOps -from PIL.Image import Image as ImageType -from uuid import uuid4 -from threading import Event +from werkzeug.utils import secure_filename -from ldm.generate import Generate -from ldm.invoke.args import Args, APP_ID, APP_VERSION, calculate_init_img_hash -from ldm.invoke.conditioning import get_tokens_for_prompt, get_prompt_structure -from ldm.invoke.globals import Globals -from ldm.invoke.pngwriter import PngWriter, retrieve_metadata -from ldm.invoke.prompt_parser import split_weighted_subprompts, Blend -from ldm.invoke.generator.inpaint import infill_methods - -from backend.modules.parameters import parameters_to_command from backend.modules.get_canvas_generation_mode import ( get_canvas_generation_mode, ) +from backend.modules.parameters import parameters_to_command +from ldm.generate import Generate +from ldm.invoke.args import Args, APP_ID, APP_VERSION, calculate_init_img_hash +from ldm.invoke.conditioning import get_tokens_for_prompt, get_prompt_structure +from ldm.invoke.generator.diffusers_pipeline import PipelineIntermediateState +from ldm.invoke.generator.inpaint import infill_methods +from ldm.invoke.globals import Globals +from ldm.invoke.pngwriter import PngWriter, retrieve_metadata +from ldm.invoke.prompt_parser import split_weighted_subprompts, Blend # Loading Arguments opt = Args() @@ -304,7 +303,7 @@ class InvokeAIWebServer: def handle_request_capabilities(): print(f">> System config requested") config = self.get_system_config() - config["model_list"] = self.generate.model_cache.list_models() + config["model_list"] = self.generate.model_manager.list_models() config["infill_methods"] = infill_methods() socketio.emit("systemConfig", config) @@ -317,11 +316,11 @@ class InvokeAIWebServer: {'search_folder': None, 'found_models': None}, ) else: - search_folder, found_models = self.generate.model_cache.search_models(search_folder) + search_folder, found_models = self.generate.model_manager.search_models(search_folder) socketio.emit( "foundModels", {'search_folder': search_folder, 'found_models': found_models}, - ) + ) except Exception as e: self.socketio.emit("error", {"message": (str(e))}) print("\n") @@ -335,18 +334,20 @@ class InvokeAIWebServer: model_name = new_model_config['name'] del new_model_config['name'] model_attributes = new_model_config + if len(model_attributes['vae']) == 0: + del model_attributes['vae'] update = False - current_model_list = self.generate.model_cache.list_models() + current_model_list = self.generate.model_manager.list_models() if model_name in current_model_list: update = True print(f">> Adding New Model: {model_name}") - self.generate.model_cache.add_model( + self.generate.model_manager.add_model( model_name=model_name, model_attributes=model_attributes, clobber=True) - self.generate.model_cache.commit(opt.conf) + self.generate.model_manager.commit(opt.conf) - new_model_list = self.generate.model_cache.list_models() + new_model_list = self.generate.model_manager.list_models() socketio.emit( "newModelAdded", {"new_model_name": model_name, @@ -364,9 +365,9 @@ class InvokeAIWebServer: def handle_delete_model(model_name: str): try: print(f">> Deleting Model: {model_name}") - self.generate.model_cache.del_model(model_name) - self.generate.model_cache.commit(opt.conf) - updated_model_list = self.generate.model_cache.list_models() + self.generate.model_manager.del_model(model_name) + self.generate.model_manager.commit(opt.conf) + updated_model_list = self.generate.model_manager.list_models() socketio.emit( "modelDeleted", {"deleted_model_name": model_name, @@ -385,7 +386,7 @@ class InvokeAIWebServer: try: print(f">> Model change requested: {model_name}") model = self.generate.set_model(model_name) - model_list = self.generate.model_cache.list_models() + model_list = self.generate.model_manager.list_models() if model is None: socketio.emit( "modelChangeFailed", @@ -797,7 +798,7 @@ class InvokeAIWebServer: # App Functions def get_system_config(self): - model_list: dict = self.generate.model_cache.list_models() + model_list: dict = self.generate.model_manager.list_models() active_model_name = None for model_name, model_dict in model_list.items(): @@ -1205,9 +1206,16 @@ class InvokeAIWebServer: print(generation_parameters) + def diffusers_step_callback_adapter(*cb_args, **kwargs): + if isinstance(cb_args[0], PipelineIntermediateState): + progress_state: PipelineIntermediateState = cb_args[0] + return image_progress(progress_state.latents, progress_state.step) + else: + return image_progress(*cb_args, **kwargs) + self.generate.prompt2image( **generation_parameters, - step_callback=image_progress, + step_callback=diffusers_step_callback_adapter, image_callback=image_done ) diff --git a/backend/modules/parameters.py b/backend/modules/parameters.py index 10af5ece3a..9055297671 100644 --- a/backend/modules/parameters.py +++ b/backend/modules/parameters.py @@ -12,6 +12,8 @@ SAMPLER_CHOICES = [ "k_heun", "k_lms", "plms", + # diffusers: + "pndm", ] diff --git a/binary_installer/requirements.in b/binary_installer/requirements.in index b4436a6ec0..66e0618f78 100644 --- a/binary_installer/requirements.in +++ b/binary_installer/requirements.in @@ -2,9 +2,10 @@ --extra-index-url https://download.pytorch.org/whl/torch_stable.html --extra-index-url https://download.pytorch.org/whl/cu116 --trusted-host https://download.pytorch.org -accelerate~=0.14 +accelerate~=0.15 albumentations -diffusers +diffusers[torch]~=0.11 +einops eventlet flask_cors flask_socketio diff --git a/configs/INITIAL_MODELS.yaml b/configs/INITIAL_MODELS.yaml index 6cfb863df8..5df64d742d 100644 --- a/configs/INITIAL_MODELS.yaml +++ b/configs/INITIAL_MODELS.yaml @@ -1,9 +1,15 @@ +stable-diffusion-2.1: + description: Stable Diffusion version 2.1 diffusers model (5.21 GB) + repo_id: stabilityai/stable-diffusion-2-1 + format: diffusers + recommended: True stable-diffusion-1.5: - description: The newest Stable Diffusion version 1.5 weight file (4.27 GB) + description: Stable Diffusion version 1.5 weight file (4.27 GB) repo_id: runwayml/stable-diffusion-v1-5 - config: v1-inference.yaml - file: v1-5-pruned-emaonly.ckpt - recommended: true + format: diffusers + recommended: True + vae: + repo_id: stabilityai/sd-vae-ft-mse width: 512 height: 512 inpainting-1.5: @@ -11,23 +17,20 @@ inpainting-1.5: repo_id: runwayml/stable-diffusion-inpainting config: v1-inpainting-inference.yaml file: sd-v1-5-inpainting.ckpt - recommended: True - width: 512 - height: 512 -ft-mse-improved-autoencoder-840000: - description: StabilityAI improved autoencoder fine-tuned for human faces (recommended; 335 MB) - repo_id: stabilityai/sd-vae-ft-mse-original - config: VAE/default - file: vae-ft-mse-840000-ema-pruned.ckpt + format: ckpt + vae: + repo_id: stabilityai/sd-vae-ft-mse-original + file: vae-ft-mse-840000-ema-pruned.ckpt recommended: True width: 512 height: 512 stable-diffusion-1.4: description: The original Stable Diffusion version 1.4 weight file (4.27 GB) - repo_id: CompVis/stable-diffusion-v-1-4-original - config: v1-inference.yaml - file: sd-v1-4.ckpt + repo_id: CompVis/stable-diffusion-v1-4 recommended: False + format: diffusers + vae: + repo_id: stabilityai/sd-vae-ft-mse width: 512 height: 512 waifu-diffusion-1.3: @@ -35,38 +38,40 @@ waifu-diffusion-1.3: repo_id: hakurei/waifu-diffusion-v1-3 config: v1-inference.yaml file: model-epoch09-float32.ckpt + format: ckpt + vae: + repo_id: stabilityai/sd-vae-ft-mse-original + file: vae-ft-mse-840000-ema-pruned.ckpt recommended: False width: 512 height: 512 trinart-2.0: description: An SD model finetuned with ~40,000 assorted high resolution manga/anime-style pictures (2.13 GB) repo_id: naclbit/trinart_stable_diffusion_v2 - config: v1-inference.yaml - file: trinart2_step95000.ckpt + format: diffusers recommended: False + vae: + repo_id: stabilityai/sd-vae-ft-mse width: 512 height: 512 -trinart_characters-1.0: - description: An SD model finetuned with 19.2M anime/manga style images (2.13 GB) - repo_id: naclbit/trinart_characters_19.2m_stable_diffusion_v1 +trinart_characters-2.0: + description: An SD model finetuned with 19.2M anime/manga style images (4.27 GB) + repo_id: naclbit/trinart_derrida_characters_v2_stable_diffusion config: v1-inference.yaml - file: trinart_characters_it4_v1.ckpt - recommended: False - width: 512 - height: 512 -trinart_vae: - description: Custom autoencoder for trinart_characters - repo_id: naclbit/trinart_characters_19.2m_stable_diffusion_v1 - config: VAE/trinart - file: autoencoder_fix_kl-f8-trinart_characters.ckpt + file: derrida_final.ckpt + format: ckpt + vae: + repo_id: naclbit/trinart_derrida_characters_v2_stable_diffusion + file: autoencoder_fix_kl-f8-trinart_characters.ckpt recommended: False width: 512 height: 512 papercut-1.0: description: SD 1.5 fine-tuned for papercut art (use "PaperCut" in your prompts) (2.13 GB) repo_id: Fictiverse/Stable_Diffusion_PaperCut_Model - config: v1-inference.yaml - file: PaperCut_v1.ckpt + format: diffusers + vae: + repo_id: stabilityai/sd-vae-ft-mse recommended: False width: 512 height: 512 @@ -75,6 +80,27 @@ voxel_art-1.0: repo_id: Fictiverse/Stable_Diffusion_VoxelArt_Model config: v1-inference.yaml file: VoxelArt_v1.ckpt + format: ckpt + vae: + repo_id: stabilityai/sd-vae-ft-mse + recommended: False + width: 512 + height: 512 +ft-mse-improved-autoencoder-840000: + description: StabilityAI improved autoencoder fine-tuned for human faces. Use with legacy .ckpt models ONLY (335 MB) + repo_id: stabilityai/sd-vae-ft-mse-original + format: ckpt + config: VAE/default + file: vae-ft-mse-840000-ema-pruned.ckpt + recommended: False + width: 512 + height: 512 +trinart_vae: + description: Custom autoencoder for trinart_characters for legacy .ckpt models only (335 MB) + repo_id: naclbit/trinart_characters_19.2m_stable_diffusion_v1 + config: VAE/trinart + format: ckpt + file: autoencoder_fix_kl-f8-trinart_characters.ckpt recommended: False width: 512 height: 512 diff --git a/configs/models.yaml.example b/configs/models.yaml.example index 61e1fe24be..98f8f77e62 100644 --- a/configs/models.yaml.example +++ b/configs/models.yaml.example @@ -5,6 +5,25 @@ # model requires a model config file, a weights file, # and the width and height of the images it # was trained on. +diffusers-1.4: + description: 🤗🧨 Stable Diffusion v1.4 + format: diffusers + repo_id: CompVis/stable-diffusion-v1-4 +diffusers-1.5: + description: 🤗🧨 Stable Diffusion v1.5 + format: diffusers + repo_id: runwayml/stable-diffusion-v1-5 + default: true +diffusers-1.5+mse: + description: 🤗🧨 Stable Diffusion v1.5 + MSE-finetuned VAE + format: diffusers + repo_id: runwayml/stable-diffusion-v1-5 + vae: + repo_id: stabilityai/sd-vae-ft-mse +diffusers-inpainting-1.5: + description: 🤗🧨 inpainting for Stable Diffusion v1.5 + format: diffusers + repo_id: runwayml/stable-diffusion-inpainting stable-diffusion-1.5: description: The newest Stable Diffusion version 1.5 weight file (4.27 GB) weights: models/ldm/stable-diffusion-v1/v1-5-pruned-emaonly.ckpt @@ -12,7 +31,6 @@ stable-diffusion-1.5: width: 512 height: 512 vae: ./models/ldm/stable-diffusion-v1/vae-ft-mse-840000-ema-pruned.ckpt - default: true stable-diffusion-1.4: description: Stable Diffusion inference model version 1.4 config: configs/stable-diffusion/v1-inference.yaml diff --git a/configs/stable-diffusion/v2-inference-v.yaml b/configs/stable-diffusion/v2-inference-v.yaml new file mode 100644 index 0000000000..8ec8dfbfef --- /dev/null +++ b/configs/stable-diffusion/v2-inference-v.yaml @@ -0,0 +1,68 @@ +model: + base_learning_rate: 1.0e-4 + target: ldm.models.diffusion.ddpm.LatentDiffusion + params: + parameterization: "v" + linear_start: 0.00085 + linear_end: 0.0120 + num_timesteps_cond: 1 + log_every_t: 200 + timesteps: 1000 + first_stage_key: "jpg" + cond_stage_key: "txt" + image_size: 64 + channels: 4 + cond_stage_trainable: false + conditioning_key: crossattn + monitor: val/loss_simple_ema + scale_factor: 0.18215 + use_ema: False # we set this to false because this is an inference only config + + unet_config: + target: ldm.modules.diffusionmodules.openaimodel.UNetModel + params: + use_checkpoint: True + use_fp16: True + image_size: 32 # unused + in_channels: 4 + out_channels: 4 + model_channels: 320 + attention_resolutions: [ 4, 2, 1 ] + num_res_blocks: 2 + channel_mult: [ 1, 2, 4, 4 ] + num_head_channels: 64 # need to fix for flash-attn + use_spatial_transformer: True + use_linear_in_transformer: True + transformer_depth: 1 + context_dim: 1024 + legacy: False + + first_stage_config: + target: ldm.models.autoencoder.AutoencoderKL + params: + embed_dim: 4 + monitor: val/rec_loss + ddconfig: + #attn_type: "vanilla-xformers" + double_z: true + z_channels: 4 + resolution: 256 + in_channels: 3 + out_ch: 3 + ch: 128 + ch_mult: + - 1 + - 2 + - 4 + - 4 + num_res_blocks: 2 + attn_resolutions: [] + dropout: 0.0 + lossconfig: + target: torch.nn.Identity + + cond_stage_config: + target: ldm.modules.encoders.modules.FrozenOpenCLIPEmbedder + params: + freeze: True + layer: "penultimate" diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 639a9a9466..e9461264db 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -4,6 +4,97 @@ title: Changelog # :octicons-log-16: **Changelog** +## v2.3.0 (15 January 2023) + +**Transition to diffusers + +Version 2.3 provides support for both the traditional `.ckpt` weight +checkpoint files as well as the HuggingFace `diffusers` format. This +introduces several changes you should know about. + +1. The models.yaml format has been updated. There are now two + different type of configuration stanza. The traditional ckpt + one will look like this, with a `format` of `ckpt` and a + `weights` field that points to the absolute or ROOTDIR-relative + location of the ckpt file. + + ``` + inpainting-1.5: + description: RunwayML SD 1.5 model optimized for inpainting (4.27 GB) + repo_id: runwayml/stable-diffusion-inpainting + format: ckpt + width: 512 + height: 512 + weights: models/ldm/stable-diffusion-v1/sd-v1-5-inpainting.ckpt + config: configs/stable-diffusion/v1-inpainting-inference.yaml + vae: models/ldm/stable-diffusion-v1/vae-ft-mse-840000-ema-pruned.ckpt + ``` + + A configuration stanza for a diffusers model hosted at HuggingFace will look like this, + with a `format` of `diffusers` and a `repo_id` that points to the + repository ID of the model on HuggingFace: + + ``` + stable-diffusion-2.1: + description: Stable Diffusion version 2.1 diffusers model (5.21 GB) + repo_id: stabilityai/stable-diffusion-2-1 + format: diffusers + ``` + + A configuration stanza for a diffuers model stored locally should + look like this, with a `format` of `diffusers`, but a `path` field + that points at the directory that contains `model_index.json`: + + ``` + waifu-diffusion: + description: Latest waifu diffusion 1.4 + format: diffusers + path: models/diffusers/hakurei-haifu-diffusion-1.4 + ``` + +2. The format of the models directory has changed to mimic the + HuggingFace cache directory. By default, diffusers models are + now automatically downloaded and retrieved from the directory + `ROOTDIR/models/diffusers`, while other models are stored in + the directory `ROOTDIR/models/hub`. This organization is the + same as that used by HuggingFace for its cache management. + + This allows you to share diffusers and ckpt model files easily with + other machine learning applications that use the HuggingFace + libraries. To do this, set the environment variable HF_HOME + before starting up InvokeAI to tell it what directory to + cache models in. To tell InvokeAI to use the standard HuggingFace + cache directory, you would set HF_HOME like this (Linux/Mac): + + `export HF_HOME=~/.cache/hugging_face` + +3. If you upgrade to InvokeAI 2.3.* from an earlier version, there + will be a one-time migration from the old models directory format + to the new one. You will see a message about this the first time + you start `invoke.py`. + +4. Both the front end back ends of the model manager have been + rewritten to accommodate diffusers. You can import models using + their local file path, using their URLs, or their HuggingFace + repo_ids. On the command line, all these syntaxes work: + + ``` + !import_model stabilityai/stable-diffusion-2-1-base + !import_model /opt/sd-models/sd-1.4.ckpt + !import_model https://huggingface.co/Fictiverse/Stable_Diffusion_PaperCut_Model/blob/main/PaperCut_v1.ckpt + ``` + +**KNOWN BUGS (15 January 2023) + +1. On CUDA systems, the 768 pixel stable-diffusion-2.0 and + stable-diffusion-2.1 models can only be run as `diffusers` models + when the `xformer` library is installed and configured. Without + `xformers`, InvokeAI returns black images. + +2. Inpainting and outpainting have regressed in quality. + +Both these issues are being actively worked on. + ## v2.2.4 (11 December 2022) **the `invokeai` directory** diff --git a/environments-and-requirements/environment-lin-aarch64.yml b/environments-and-requirements/environment-lin-aarch64.yml index c1e7553a28..9dc49c1255 100644 --- a/environments-and-requirements/environment-lin-aarch64.yml +++ b/environments-and-requirements/environment-lin-aarch64.yml @@ -28,13 +28,18 @@ dependencies: - torch-fidelity=0.3.0 - torchmetrics=0.7.0 - torchvision - - transformers=4.21.3 + - transformers~=4.25 - pip: + - accelerate + - diffusers[torch]~=0.11 - getpass_asterisk + - huggingface-hub>=0.11.1 - omegaconf==2.1.1 - picklescan - pyreadline3 - realesrgan + - requests==2.25.1 + - safetensors - taming-transformers-rom1504 - test-tube>=0.7.5 - git+https://github.com/openai/CLIP.git@main#egg=clip diff --git a/environments-and-requirements/environment-lin-amd.yml b/environments-and-requirements/environment-lin-amd.yml index 42ebf37266..cbddbb5fc8 100644 --- a/environments-and-requirements/environment-lin-amd.yml +++ b/environments-and-requirements/environment-lin-amd.yml @@ -9,14 +9,16 @@ dependencies: - numpy=1.23.3 - pip: - --extra-index-url https://download.pytorch.org/whl/rocm5.2/ + - accelerate - albumentations==0.4.3 - - diffusers==0.6.0 + - diffusers[torch]~=0.11 - einops==0.3.0 - eventlet - flask==2.1.3 - flask_cors==3.0.10 - flask_socketio==5.3.0 - getpass_asterisk + - huggingface-hub>=0.11.1 - imageio-ffmpeg==0.4.2 - imageio==2.9.0 - kornia==0.6.0 @@ -28,6 +30,8 @@ dependencies: - pyreadline3 - pytorch-lightning==1.7.7 - realesrgan + - requests==2.25.1 + - safetensors - send2trash==1.8.0 - streamlit==1.12.0 - taming-transformers-rom1504 @@ -38,7 +42,7 @@ dependencies: - torchaudio - torchmetrics==0.7.0 - torchvision - - transformers==4.21.3 + - transformers~=4.25 - git+https://github.com/openai/CLIP.git@main#egg=clip - git+https://github.com/Birch-san/k-diffusion.git@mps#egg=k-diffusion - git+https://github.com/invoke-ai/clipseg.git@relaxed-python-requirement#egg=clipseg diff --git a/environments-and-requirements/environment-lin-cuda.yml b/environments-and-requirements/environment-lin-cuda.yml index ce60cfd96b..20cc636624 100644 --- a/environments-and-requirements/environment-lin-cuda.yml +++ b/environments-and-requirements/environment-lin-cuda.yml @@ -12,14 +12,16 @@ dependencies: - pytorch=1.12.1 - cudatoolkit=11.6 - pip: + - accelerate~=0.13 - albumentations==0.4.3 - - diffusers==0.6.0 + - diffusers[torch]~=0.11 - einops==0.3.0 - eventlet - flask==2.1.3 - flask_cors==3.0.10 - flask_socketio==5.3.0 - getpass_asterisk + - huggingface-hub>=0.11.1 - imageio-ffmpeg==0.4.2 - imageio==2.9.0 - kornia==0.6.0 @@ -31,13 +33,15 @@ dependencies: - pyreadline3 - pytorch-lightning==1.7.7 - realesrgan + - requests==2.25.1 + - safetensors~=0.2 - send2trash==1.8.0 - streamlit==1.12.0 - taming-transformers-rom1504 - test-tube>=0.7.5 - torch-fidelity==0.3.0 - torchmetrics==0.7.0 - - transformers==4.21.3 + - transformers~=4.25 - git+https://github.com/openai/CLIP.git@main#egg=clip - git+https://github.com/Birch-san/k-diffusion.git@mps#egg=k-diffusion - git+https://github.com/invoke-ai/clipseg.git@relaxed-python-requirement#egg=clipseg diff --git a/environments-and-requirements/environment-mac.yml b/environments-and-requirements/environment-mac.yml index 3e78d9ac95..7ced428ebf 100644 --- a/environments-and-requirements/environment-mac.yml +++ b/environments-and-requirements/environment-mac.yml @@ -1,6 +1,7 @@ name: invokeai channels: - pytorch + - huggingface - conda-forge - defaults dependencies: @@ -19,10 +20,9 @@ dependencies: # sed -E 's/invokeai/invokeai-updated/;20,99s/- ([^=]+)==.+/- \1/' environment-mac.yml > environment-mac-updated.yml # CONDA_SUBDIR=osx-arm64 conda env create -f environment-mac-updated.yml && conda list -n invokeai-updated | awk ' {print " - " $1 "==" $2;} ' # ``` - + - accelerate - albumentations=1.2 - coloredlogs=15.0 - - diffusers=0.6 - einops=0.3 - eventlet - grpcio=1.46 @@ -49,10 +49,14 @@ dependencies: - sympy=1.10 - send2trash=1.8 - tensorboard=2.10 - - transformers=4.23 + - transformers~=4.25 - pip: + - diffusers[torch]~=0.11 + - safetensors~=0.2 - getpass_asterisk + - huggingface-hub - picklescan + - requests==2.25.1 - taming-transformers-rom1504 - test-tube==0.7.5 - git+https://github.com/openai/CLIP.git@main#egg=clip diff --git a/environments-and-requirements/environment-win-cuda.yml b/environments-and-requirements/environment-win-cuda.yml index 580f84f8ec..c7ad599641 100644 --- a/environments-and-requirements/environment-win-cuda.yml +++ b/environments-and-requirements/environment-win-cuda.yml @@ -12,14 +12,16 @@ dependencies: - pytorch=1.12.1 - cudatoolkit=11.6 - pip: + - accelerate - albumentations==0.4.3 - - diffusers==0.6.0 + - diffusers[torch]~=0.11 - einops==0.3.0 - eventlet - flask==2.1.3 - flask_cors==3.0.10 - flask_socketio==5.3.0 - getpass_asterisk + - huggingface-hub>=0.11.1 - imageio-ffmpeg==0.4.2 - imageio==2.9.0 - kornia==0.6.0 @@ -31,13 +33,16 @@ dependencies: - pyreadline3 - pytorch-lightning==1.7.7 - realesrgan + - requests==2.25.1 + - safetensors - send2trash==1.8.0 - streamlit==1.12.0 - taming-transformers-rom1504 - test-tube>=0.7.5 - torch-fidelity==0.3.0 - torchmetrics==0.7.0 - - transformers==4.21.3 + - transformers~=4.25 + - windows-curses - git+https://github.com/openai/CLIP.git@main#egg=clip - git+https://github.com/Birch-san/k-diffusion.git@mps#egg=k_diffusion - git+https://github.com/invoke-ai/clipseg.git@relaxed-python-requirement#egg=clipseg diff --git a/environments-and-requirements/requirements-base.txt b/environments-and-requirements/requirements-base.txt index f52df20b5c..882e1c8b4b 100644 --- a/environments-and-requirements/requirements-base.txt +++ b/environments-and-requirements/requirements-base.txt @@ -1,6 +1,8 @@ # pip will resolve the version which matches torch +accelerate albumentations -diffusers==0.10.* +datasets +diffusers[torch]~=0.11 einops eventlet facexlib @@ -14,6 +16,7 @@ huggingface-hub>=0.11.1 imageio imageio-ffmpeg kornia +npyscreen numpy==1.23.* omegaconf opencv-python @@ -25,6 +28,7 @@ pyreadline3 pytorch-lightning==1.7.7 realesrgan requests==2.25.1 +safetensors scikit-image>=0.19 send2trash streamlit @@ -32,7 +36,8 @@ taming-transformers-rom1504 test-tube>=0.7.5 torch-fidelity torchmetrics -transformers==4.25.* +transformers~=4.25 +windows-curses; sys_platform == 'win32' https://github.com/Birch-san/k-diffusion/archive/refs/heads/mps.zip#egg=k-diffusion https://github.com/invoke-ai/PyPatchMatch/archive/refs/tags/0.1.5.zip#egg=pypatchmatch https://github.com/openai/CLIP/archive/eaa22acb90a5876642d0507623e859909230a52d.zip#egg=clip diff --git a/frontend/dist/assets/index-legacy-5c5a479d.js b/frontend/dist/assets/index-legacy-474a75fe.js similarity index 78% rename from frontend/dist/assets/index-legacy-5c5a479d.js rename to frontend/dist/assets/index-legacy-474a75fe.js index 3babd3134a..b48c03f8f8 100644 --- a/frontend/dist/assets/index-legacy-5c5a479d.js +++ b/frontend/dist/assets/index-legacy-474a75fe.js @@ -18,7 +18,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -var Y=a.exports,Z=G.exports;function X(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n