lllyasviel / ControlNet

Let us control diffusion models!
Apache License 2.0
28.94k stars 2.61k forks source link

erorr "cond_stage_model.transformer.text_model.embeddings.position_ids" #675

Open kimahana12312 opened 2 months ago

kimahana12312 commented 2 months ago

RuntimeError: Error(s) in loading state_dict for ControlLDM: Unexpected key(s) in state_dict: "cond_stage_model.transformer.text_model.embeddings.position_ids".

how can i fix it?

little-capricor commented 1 month ago

👋嗨,您好!我也遇到相同的问题,已经成功解决。如果您使用的是Apple芯片的计算机,下面的方法可能有用:

错误原因:安装错误版本的transformers库

conda activate control

conda install pip=24.0 numpy=1.23.1 pytorch=1.13.1 scikit-image=0.18.2 -y

pip install torchvision==0.14.1 gradio==3.38.0 albumentations==1.3.0 opencv-contrib-python==4.9.0.80 imageio==2.9.0 imageio-ffmpeg==0.4.2 pytorch-lightning==1.5.0 omegaconf==2.1.1 test-tube==0.7.5 streamlit==1.12.1 einops==0.3.0 transformers==4.24.0 webdataset==0.2.5 kornia==0.6 open_clip_torch==2.0.2 invisible-watermark==0.1.5 streamlit-drawable-canvas==0.8.0 torchmetrics==0.6.0 timm==0.6.12 addict==2.4.0 yapf==0.32.0 prettytable==3.6.0 safetensors==0.2.7 basicsr==1.4.2 tesseract==0.1.3



## 验证平台
- 操作系统:macOS 14.4.1 (23E224)
- 处理器:Apple M1 Pro
kimahana12312 commented 1 month ago

👋안녕하세요! 나도 같은 문제가 발생하여 성공적으로 해결했습니다. Apple 칩이 장착된 컴퓨터를 사용하는 경우 다음 방법이 유용할 수 있습니다.

오류 원인: 잘못된 버전의 변환기 라이브러리 설치

* 다음 명령을 사용하여 지정된 버전의 변환기 라이브러리를 다시 설치하십시오.
pip install transformers==4.24.0
* [선택사항] 공식적으로 제공되는 Environment.yaml의 일부 라이브러리는 Apple 칩과 호환되지 않습니다. 안전을 유지하려면 다음 명령을 사용하여 conda에서 가상 환경과 종속 라이브러리를 재구성하십시오.
conda create -n control python=3.9 -y

conda activate control

conda install pip=24.0 numpy=1.23.1 pytorch=1.13.1 scikit-image=0.18.2 -y

pip install torchvision==0.14.1 gradio==3.38.0 albumentations==1.3.0 opencv-contrib-python==4.9.0.80 imageio==2.9.0 imageio-ffmpeg==0.4.2 pytorch-lightning==1.5.0 omegaconf==2.1.1 test-tube==0.7.5 streamlit==1.12.1 einops==0.3.0 transformers==4.24.0 webdataset==0.2.5 kornia==0.6 open_clip_torch==2.0.2 invisible-watermark==0.1.5 streamlit-drawable-canvas==0.8.0 torchmetrics==0.6.0 timm==0.6.12 addict==2.4.0 yapf==0.32.0 prettytable==3.6.0 safetensors==0.2.7 basicsr==1.4.2 tesseract==0.1.3

검증 플랫폼

* 운영 체제: macOS 14.4.1(23E224)

* 프로세서: Apple M1 Pro

Thank you, the problem has been resolved!