InvokeAI icon indicating copy to clipboard operation
InvokeAI copied to clipboard

[bug]: PaperCut checkpoint cannot be loaded

Open Connum opened this issue 2 years ago • 5 comments
trafficstars

Is there an existing issue for this?

  • [X] I have searched the existing issues

OS

Windows

GPU

cuda

VRAM

6GB

What happened?

Using the web interface in the most recent version installed by the binary installer, changing the model to "papercut-1.0" results in the following error in the cmd window:

>> Loading papercut-1.0 from C:\Users\***\AppData\Roaming\InvokeAI\models\ldm\stable-diffusion-v1\PaperCut_v1.ckpt
   | LatentDiffusion: Running in eps-prediction mode
   | DiffusionWrapper has 859.52 M params.
   | Making attention of type 'vanilla' with 512 in_channels
   | Working with z of shape (1, 4, 32, 32) = 4096 dimensions.
   | Making attention of type 'vanilla' with 512 in_channels
** model papercut-1.0 could not be loaded: Error(s) in loading state_dict for LatentDiffusion:
        size mismatch for embedding_manager.string_to_param_dict.*: copying a param with shape torch.Size([1, 768]) from checkpoint, the shape in current model is torch.Size([8, 768]).
        size mismatch for embedding_manager.initial_embeddings.*: copying a param with shape torch.Size([1, 768]) from checkpoint, the shape in current model is torch.Size([8, 768]).
Traceback (most recent call last):
  File "d:\ai\invokeai\ldm\invoke\model_cache.py", line 80, in get_model
    requested_model, width, height, hash = self._load_model(model_name)
  File "d:\ai\invokeai\ldm\invoke\model_cache.py", line 232, in _load_model
    model.load_state_dict(sd, strict=False)
  File "D:\AI\InvokeAI\.venv\lib\site-packages\torch\nn\modules\module.py", line 1604, in load_state_dict
    raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
RuntimeError: Error(s) in loading state_dict for LatentDiffusion:
        size mismatch for embedding_manager.string_to_param_dict.*: copying a param with shape torch.Size([1, 768]) from checkpoint, the shape in current model is torch.Size([8, 768]).
        size mismatch for embedding_manager.initial_embeddings.*: copying a param with shape torch.Size([1, 768]) from checkpoint, the shape in current model is torch.Size([8, 768]).

Screenshots

No response

Additional context

No response

Contact Details

No response

Connum avatar Dec 02 '22 17:12 Connum

Same issue, fresh install.

Qualzz avatar Dec 02 '22 20:12 Qualzz

@lstein See https://github.com/invoke-ai/InvokeAI/issues/1657 same issue

psychedelicious avatar Dec 02 '22 20:12 psychedelicious

Thank you for the report. It appears that the work we recently did to support the Hugging Face concepts library has introduced an incompatibility with some of the models that we could previously load. This also includes VoxelArt. I will work on a fix for this. Unfortunately this bug happens even if there are no embeddings to load!

Cc'ing @damian0815 on this for any insights.

lstein avatar Dec 02 '22 21:12 lstein

Right now the workaround for this problem is to edit the file ~/invokeai/configs/stable-diffusion/v1-inference.yaml and change the line num_vectors_per_token:8 to num_vectors_per_token:1 This is under the personalization_config stanza.

lstein avatar Dec 02 '22 21:12 lstein

I have made a pull request that will correct this.

lstein avatar Dec 02 '22 21:12 lstein

Loading papercut-1.0 from C:\Users***\AppData\Roaming\InvokeAI\models\ldm\stable-diffusion-v1\PaperCut_v1.ckpt

Pasaelpasa avatar Dec 05 '22 21:12 Pasaelpasa