lllyasviel / lllyasviel/ControlNet
Question about `sd_locked` in ControlNet 1.0 and 1.1
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 34.1k
- Forks
- 3k
- PR merge metrics
- No merged PRs in 30d
Description
In the paper, it is said that the parameters of Stable Diffusion(SD) are locked when training ControlNet. However, when I looked into the released ControlNet 1.0 checkpoints, I found that the weights of SD UNet decoder are different from SD1.5 (`v1-5-pruned.ckpt`). I notice that there's an option [`sd_locked`](https://github.com/lllyasviel/ControlNet/blob/main/docs/train.md#sd_locked) that enables training SD UNet decoder. So does this mean that ControlNet 1.0 are trained with `sd_locked=False`?
Furthermore, different from ControlNet 1.0 checkpoints, the ControlNet 1.1 checkpoints don't contain SD weights and need to be used along with `v1-5-pruned.ckpt`, does this mean that ControlNet 1.1 are trained with `sd_locked=True`?
Here is the script I used to compare two checkpoints:
```python
import torch
ckpt = torch.load('./ckpts/v1-5-pruned.ckpt', map_location='cpu')['state_dict']
ckpt2 = torch.load('./ckpts/control_sd15_canny.pth', map_location='cpu')
notclose = []
maxdiff = 0.
for k, v in ckpt.items():
if k.startswith('model') and k in ckpt2:
if not torch.allclose(ckpt2[k], ckpt[k]):
notclose.append(k)
maxdiff = max(maxdiff, torch.max(torch.abs(ckpt2[k] - ckpt[k])).item())
print('notclose:')
print('\n'.join(notclose))
print(f'maxdiff: {maxdiff}')
```
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with docs/train.md, especially the sd_locked option, then review the checkpoint comparison script and the referenced ControlNet 1.0 and 1.1 checkpoints. Done means documenting whether each checkpoint series used sd_locked and explaining the presence or absence of Stable Diffusion weights.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, pytorch
- Domain
- documentation, machine-learning
- Issue type
- Documentation
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100