huggingface / huggingface/diffusers
[SD3 ControlNet] bug in pipeline 'controlnet_pooled_projections'
- Ngôn ngữ chính
- Python
- Star
- 34.5k
- Fork
- 7.3k
- Merge trung bình
- 3 ngày 3 giờ
- Pull request đã merge (30 ngày)
- 91
Mô tả
### Describe the bug
Hi,
I think I found an issue that causes a misalignment between training and inference in SD3 ControlNet.
https://github.com/huggingface/diffusers/blob/a3e8d3f7deed140f57a28d82dd0b5d965bd0fb09/src/diffusers/pipelines/controlnet_sd3/pipeline_stable_diffusion_3_controlnet.py#L977
I think the if-else block starting there is not correct. It should be
```python
if controlnet_pooled_projections is None and pooled_prompt_embeds is None:
controlnet_pooled_projections = torch.zeros_like(pooled_prompt_embeds)
elif controlnet_pooled_projections is None:
controlnet_pooled_projections = pooled_prompt_embeds
```
Given that in training, the pooled_prompt_embeds are fed to the model:
https://github.com/huggingface/diffusers/blob/a3e8d3f7deed140f57a28d82dd0b5d965bd0fb09/examples/controlnet/train_controlnet_sd3.py#L1293
Additionally, I am wondering if this line:
https://github.com/huggingface/diffusers/blob/a3e8d3f7deed140f57a28d82dd0b5d965bd0fb09/examples/controlnet/train_controlnet_sd3.py#L1287
Should be aligned with this line:
https://github.com/huggingface/diffusers/blob/a3e8d3f7deed140f57a28d82dd0b5d965bd0fb09/examples/controlnet/train_controlnet_sd3.py#L1257
This seems to be the more sensible approach, but will probably not make much difference since the ControlNet can also learn the shift. It might speed up convergence *slightly*.
Best,
Tobias
### Reproduction
Train an SD3 ControlNet and during log_validation it will be executed.
### Logs
_No response_
### System Info
diffusers==0.30.3
### Who can help?
@yiyixuxu @sayakpaul
Hướng dẫn đóng góp
Hướng nghiên cứu
Bắt đầu với khối if-else quanh dòng 977 trong src/diffusers/pipelines/controlnet_sd3/pipeline_stable_diffusion_3_controlnet.py, sau đó so sánh với phần xử lý pooled prompt quanh các dòng 1287 và 1293 trong examples/controlnet/train_controlnet_sd3.py. Chạy đường dẫn log_validation đã nêu sau khi huấn luyện và xác minh rằng quá trình huấn luyện và suy luận sử dụng các pooled projections được căn chỉnh, đồng thời đưa ra quyết định đã được giải quyết về shift ở dòng 1257.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- python, pytorch
- Lĩnh vực
- machine-learning
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 45/100