stable-diffusion-webui icon indicating copy to clipboard operation
stable-diffusion-webui copied to clipboard

[Bug]: "1" checkpoint caching is useless

Open R-N opened this issue 3 years ago • 0 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues and checked the recent builds/commits

What happened?

"1" checkpoint caching is useless. When you set the webui to keep n caches, only n-1 is actually useful. This happens because model is cached after loading it. When you set caching to 1, what's in the cache is really just your currently loaded checkpoint. When you load another one, the other checkpoint can't possibly be in the cache, so it's loaded and inserted into cache dict. Then, the cache dict now has 2 entries, and so the oldest one will be discarded. Leaving you with 1 cache of the current model, again. So when caching is set to 1, there's practically no caching. There's always the current model taking up 1 cache "space" (it's not duplicated in memory though).

Steps to reproduce the problem

  1. Set caching to 1
  2. Load a model
  3. Load another model
  4. Load the first model

What should have happened?

Step 4 should be loading the first model from cache, but it doesn't. Because the current model in cache is from step 3.

Commit where the problem happens

17a2076f72562b428052ee3fc8c43d19c03ecd1e

What platforms do you use to access UI ?

Other/Cloud

What browsers do you use to access the UI ?

Google Chrome

Command Line Arguments

--autolaunch --ckpt {workspace3}/novelai/final_pruned.ckpt --vae-path {workspace3}/novelai/animevae.pt --deepdanbooru --disable-safe-unpickle  --no-half-vae --xformers

Additional information, context and logs

Caching should keep cache of previous models, not current model.

my log
To create a public link, set `share=True` in `launch()`.
(CheckpointInfo(filename='/content/nai/stable-diffusion-webui/models/Stable-diffusion/novelai/final_pruned.ckpt', title='novelai/final_pruned.ckpt [925997e9]', hash='925997e9', model_name='novelai_final_pruned', config='/content/nai/stable-diffusion-webui/repositories/stable-diffusion/configs/stable-diffusion/v1-inference.yaml'), '/content/nai/stable-diffusion-webui/models/Stable-diffusion/novelai/animevae.pt')
{(CheckpointInfo(filename='/content/nai/stable-diffusion-webui/models/Stable-diffusion/novelai/final_pruned.ckpt', title='novelai/final_pruned.ckpt [925997e9]', hash='925997e9', model_name='novelai_final_pruned', config='/content/nai/stable-diffusion-webui/repositories/stable-diffusion/configs/stable-diffusion/v1-inference.yaml'), '/content/nai/stable-diffusion-webui/models/Stable-diffusion/novelai/animevae.pt')}
Loading weights [925997e9] with animevae VAE from cache
Applying xformers cross attention optimization.
Weights loaded.
(CheckpointInfo(filename='/content/nai/stable-diffusion-webui/models/Stable-diffusion/novelai/final_pruned.ckpt', title='novelai/final_pruned.ckpt [925997e9]', hash='925997e9', model_name='novelai_final_pruned', config='/content/nai/stable-diffusion-webui/repositories/stable-diffusion/configs/stable-diffusion/v1-inference.yaml'), None)
{(CheckpointInfo(filename='/content/nai/stable-diffusion-webui/models/Stable-diffusion/novelai/final_pruned.ckpt', title='novelai/final_pruned.ckpt [925997e9]', hash='925997e9', model_name='novelai_final_pruned', config='/content/nai/stable-diffusion-webui/repositories/stable-diffusion/configs/stable-diffusion/v1-inference.yaml'), '/content/nai/stable-diffusion-webui/models/Stable-diffusion/novelai/animevae.pt')}
Loading weights [925997e9] from /content/nai/stable-diffusion-webui/models/Stable-diffusion/novelai/final_pruned.ckpt
{(CheckpointInfo(filename='/content/nai/stable-diffusion-webui/models/Stable-diffusion/novelai/final_pruned.ckpt', title='novelai/final_pruned.ckpt [925997e9]', hash='925997e9', model_name='novelai_final_pruned', config='/content/nai/stable-diffusion-webui/repositories/stable-diffusion/configs/stable-diffusion/v1-inference.yaml'), None)}
Applying xformers cross attention optimization.
Weights loaded.
(CheckpointInfo(filename='/content/nai/stable-diffusion-webui/models/Stable-diffusion/novelai/final_pruned.ckpt', title='novelai/final_pruned.ckpt [925997e9]', hash='925997e9', model_name='novelai_final_pruned', config='/content/nai/stable-diffusion-webui/repositories/stable-diffusion/configs/stable-diffusion/v1-inference.yaml'), '/content/nai/stable-diffusion-webui/models/Stable-diffusion/novelai/animevae.pt')
{(CheckpointInfo(filename='/content/nai/stable-diffusion-webui/models/Stable-diffusion/novelai/final_pruned.ckpt', title='novelai/final_pruned.ckpt [925997e9]', hash='925997e9', model_name='novelai_final_pruned', config='/content/nai/stable-diffusion-webui/repositories/stable-diffusion/configs/stable-diffusion/v1-inference.yaml'), None)}
Loading weights [925997e9] from /content/nai/stable-diffusion-webui/models/Stable-diffusion/novelai/final_pruned.ckpt
Loading VAE weights from: /content/nai/stable-diffusion-webui/models/Stable-diffusion/novelai/animevae.pt
{(CheckpointInfo(filename='/content/nai/stable-diffusion-webui/models/Stable-diffusion/novelai/final_pruned.ckpt', title='novelai/final_pruned.ckpt [925997e9]', hash='925997e9', model_name='novelai_final_pruned', config='/content/nai/stable-diffusion-webui/repositories/stable-diffusion/configs/stable-diffusion/v1-inference.yaml'), '/content/nai/stable-diffusion-webui/models/Stable-diffusion/novelai/animevae.pt')}
Applying xformers cross attention optimization.
Weights loaded.
(CheckpointInfo(filename='/content/nai/stable-diffusion-webui/models/Stable-diffusion/novelai/final_pruned.ckpt', title='novelai/final_pruned.ckpt [925997e9]', hash='925997e9', model_name='novelai_final_pruned', config='/content/nai/stable-diffusion-webui/repositories/stable-diffusion/configs/stable-diffusion/v1-inference.yaml'), None)
{(CheckpointInfo(filename='/content/nai/stable-diffusion-webui/models/Stable-diffusion/novelai/final_pruned.ckpt', title='novelai/final_pruned.ckpt [925997e9]', hash='925997e9', model_name='novelai_final_pruned', config='/content/nai/stable-diffusion-webui/repositories/stable-diffusion/configs/stable-diffusion/v1-inference.yaml'), '/content/nai/stable-diffusion-webui/models/Stable-diffusion/novelai/animevae.pt')}
Loading weights [925997e9] from /content/nai/stable-diffusion-webui/models/Stable-diffusion/novelai/final_pruned.ckpt
2022-10-31T08:19:07Z INF Initiating graceful shutdown due to signal interrupt ...

R-N avatar Oct 31 '22 08:10 R-N