kohya-ss / kohya-ss/sd-scripts

Error when extracting LoRA from checkpoint (macOS)

Open
#669 5 comments 1 reaction 0 assignees View on GitHub
Dominant language
Python
Stars
7.2k
Forks
1.2k
Avg merge
11m
Merged PRs (30d)
2

Description

Apologies if this has already been answered, I had a look around and although there were some related issues I couldn't find anything that solved my specific problem.

I am running kohya gui on macOS, attempting to extract lora from a checkpoint and am recieving the following error after a few seconds of running:

`RuntimeError: Error(s) in loading state_dict for AutoencoderKL:
Missing key(s) in state_dict:
"encoder.mid_block.attentions.0.to_q.weight",
"encoder.mid_block.attentions.0.to_q.bias",
"encoder.mid_block.attentions.0.to_k.weight",
"encoder.mid_block.attentions.0.to_k.bias",
"encoder.mid_block.attentions.0.to_v.weight",
"encoder.mid_block.attentions.0.to_v.bias",
"decoder.mid_block.attentions.0.to_q.weight",
"decoder.mid_block.attentions.0.to_q.bias",
"decoder.mid_block.attentions.0.to_k.weight",
"decoder.mid_block.attentions.0.to_k.bias",
"decoder.mid_block.attentions.0.to_v.weight",
"decoder.mid_block.attentions.0.to_v.bias".
Unexpected key(s) in state_dict:
"encoder.mid_block.attentions.0.to_to_q.weight",
"encoder.mid_block.attentions.0.to_to_q.bias",
"encoder.mid_block.attentions.0.to_to_k.weight",
"encoder.mid_block.attentions.0.to_to_k.bias",
"encoder.mid_block.attentions.0.to_to_v.weight",
"encoder.mid_block.attentions.0.to_to_v.bias",
"decoder.mid_block.attentions.0.to_to_q.weight",
"decoder.mid_block.attentions.0.to_to_q.bias",
"decoder.mid_block.attentions.0.to_to_k.weight",
"decoder.mid_block.attentions.0.to_to_k.bias",
"decoder.mid_block.attentions.0.to_to_v.weight",
"decoder.mid_block.attentions.0.to_to_v.bias". `

Can anyone offer a solution? Many thanks in advance.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing LoRA extraction from a checkpoint on macOS and inspect the reported AutoencoderKL state_dict mismatch, especially the missing and unexpected attention keys. Done means extraction completes without the listed missing or unexpected keys.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.