lllyasviel / lllyasviel/ControlNet

Continuing training of a ControlNet

Open
#590 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
34.1k
Forks
3k
PR merge metrics
No merged PRs in 30d

Description

Following [the tutorial](https://github.com/lllyasviel/ControlNet/blob/main/docs/train.md#step-3---what-sd-model-do-you-want-to-control) I can successfully download SD, add ControlNet, and train it.

Now, I want to continue training the [OpenPose model](https://huggingface.co/lllyasviel/sd-controlnet-openpose) using a different pose estimation tool. I downloaded the `bin` file from here https://huggingface.co/lllyasviel/sd-controlnet-openpose/tree/main and did not add ControlNet (since it should be there), but then when I try the following:

```py
model = create_model('./models/cldm_v15.yaml').cpu()
model.load_state_dict(load_state_dict('diffusion_pytorch_model.bin', location='cpu'))
```

I get this error (truncated because longer than 65K characters, full [here](https://pastebin.com/4kvEcxFH))

```log
Missing key(s) in state_dict: "betas", "alphas_cumprod", "alphas_cumprod_prev", "sqrt_alphas_cumprod", "sqrt_one_minus_alphas_cumprod", "log_one_minus_alphas_cumprod", "sqrt_recip_alphas_cumprod", "sqrt_recipm1_alphas_cumprod", "posterior_variance", "posterior_log_variance_clipped", "posterior_mean_coef1", "posterior_mean_coef2", "logvar", "model.diffusion_model.time_embed.0.weight", "model.diffusion_model.time_embed.0.bias", "model.diffusion_model.time_embed.2.weight", "model.diffusion_model.time_embed.2.bias",
Unexpected key(s) in state_dict: "conv_in.weight", "conv_in.bias", "time_embedding.linear_1.weight", "time_embedding.linear_1.bias", "time_embedding.linear_2.weight", "time_embedding.linear_2.bias", "controlnet_cond_embedding.conv_in.weight", "controlnet_cond_embedding.conv_in.bias", "controlnet_cond_embedding.blocks.0.weight", "controlnet_cond_embedding.blocks.0.bias", "controlnet_cond_embedding.blocks.1.weight", "controlnet_cond_embedding.blocks.1.bias", "controlnet_cond_embedding.blocks.2.weight", "controlnet_cond_embedding.blocks.2.bias", "controlnet_cond_embedding.blocks.3.weight", "controlnet_cond_embedding.blocks.3.bias", "controlnet_cond_embedding.blocks.4.weight", "controlnet_cond_embedding.blocks.4.bias", "controlnet_cond_embedding.blocks.5.weight", "controlnet_cond_embedding.blocks.5.bias", "controlnet_cond_embedding.conv_out.weight", "controlnet_cond_embedding.conv_out.bias", "down_blocks.0.attentions.0.norm.weight", "down_blocks.0.attentions.0.norm.bias", "down_blocks.0.attentions.0.proj_in.weight", "down_blocks.0.attentions.0.proj_in.bias", "down_blocks.0.attentions.0.transformer_blocks.0.attn1.to_q.weight", "down_blocks.0.attentions.0.transformer_blocks.0.attn1.to_k.weight",
```

How should I correctly load the OpenPose model for continuing training?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with docs/train.md at the Step 3 section, then inspect models/cldm_v15.yaml and the create_model and load_state_dict entry points shown in the report. Compare the expected keys with diffusion_pytorch_model.bin and use the full traceback if needed. Done means the OpenPose checkpoint loads successfully and can be used for continued training.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.