InvokeAI/scripts
Lincoln Stein 488334710b 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 02:37:42 -04:00
..
orig_scripts rename all modules from ldm.dream to ldm.invoke 2022-10-08 11:37:23 -04:00
dream.py rebrand CLI from "dream" to "invoke" 2022-10-08 09:32:06 -04:00
images2prompt.py rename all modules from ldm.dream to ldm.invoke 2022-10-08 11:37:23 -04:00
invoke.py enable fast switching between models in invoke.py 2022-10-12 02:37:42 -04:00
merge_embeddings.py Fix merging embeddings (#226) 2022-08-31 11:24:11 -04:00
preload_models.py rename all modules from ldm.dream to ldm.invoke 2022-10-08 11:37:23 -04:00
sd-metadata.py rename all modules from ldm.dream to ldm.invoke 2022-10-08 11:37:23 -04:00