lllyasviel / ControlNet

Let us control diffusion models!
Apache License 2.0
30.52k stars 2.74k forks source link

RuntimeError: Failed to import transformers.models.t5.modeling_t5 because of the following error (look up to see its traceback): Failed to import transformers.onnx.config because of the following error (look up to see its traceback): DLL load failed while importing _imaging: The specified module could not be found. #716

Closed jiajiao272727 closed 1 month ago

jiajiao272727 commented 1 month ago

I am trying to train ControlNet following https://github.com/lllyasviel/ControlNet/blob/main/docs/train.md, but stuck in step 3 with this error. May I ask does anyone knows how to solve it? Thank you so much!

`(control) PS D:\experiment\ControlNet> python tool_add_control_sd21.py ./models/v2-1_512-ema-pruned.ckpt ./models/control_sd21_ini.ckpt Traceback (most recent call last): File "C:\Users.conda\envs\control\lib\site-packages\transformers\utils\import_utils.py", line 1130, in _get_module return importlib.import_module("." + module_name, self.name) File "C:\Users.conda\envs\control\lib\importlib__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1030, in _gcd_import File "", line 1007, in _find_and_load File "", line 986, in _find_and_load_unlocked File "", line 680, in _load_unlocked File "", line 850, in exec_module File "", line 228, in _call_with_frames_removed File "C:\Users.conda\envs\control\lib\site-packages\transformers\onnx\config.py", line 36, in from PIL import Image File "C:\Users.conda\envs\control\lib\site-packages\PIL\Image.py", line 114, in from . import _imaging as core ImportError: DLL load failed while importing _imaging: The specified module could not be found.

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "C:\Users.conda\envs\control\lib\site-packages\transformers\utils\import_utils.py", line 1130, in _get_module return importlib.import_module("." + module_name, self.name) File "C:\Users.conda\envs\control\lib\importlib__init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1030, in _gcd_import File "", line 1007, in _find_and_load File "", line 986, in _find_and_load_unlocked File "", line 680, in _load_unlocked File "", line 850, in exec_module File "", line 228, in _call_with_frames_removed File "C:\Users.conda\envs\control\lib\site-packages\transformers\models\t5\modeling_t5.py", line 50, in from .configuration_t5 import T5Config File "C:\Users.conda\envs\control\lib\site-packages\transformers\models\t5\configuration_t5.py", line 19, in from ...onnx import OnnxSeq2SeqConfigWithPast File "", line 1055, in _handle_fromlist File "C:\Users.conda\envs\control\lib\site-packages\transformers\utils\import_utils.py", line 1120, in getattr__ module = self._get_module(self._class_to_module[name]) File "C:\Users.conda\envs\control\lib\site-packages\transformers\utils\import_utils.py", line 1132, in _get_module raise RuntimeError( RuntimeError: Failed to import transformers.onnx.config because of the following error (look up to see its traceback): DLL load failed while importing _imaging: The specified module could not be found.

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "D:\experiment\ControlNet\tool_add_control_sd21.py", line 14, in from share import * File "D:\experiment\ControlNet\share.py", line 2, in from cldm.hack import disable_verbosity, enable_sliced_attention File "D:\experiment\ControlNet\cldm\hack.py", line 4, in import ldm.modules.encoders.modules File "D:\experiment\ControlNet\ldm\modules\encoders\modules.py", line 5, in from transformers import T5Tokenizer, T5EncoderModel, CLIPTokenizer, CLIPTextModel File "", line 1055, in _handle_fromlist File "C:\Users.conda\envs\control\lib\site-packages\transformers\utils\import_utils.py", line 1121, in getattr value = getattr(module, name) File "C:\Users.conda\envs\control\lib\site-packages\transformers\utils\import_utils.py", line 1120, in getattr module = self._get_module(self._class_to_module[name]) File "C:\Users.conda\envs\control\lib\site-packages\transformers\utils\import_utils.py", line 1132, in _get_module raise RuntimeError( RuntimeError: Failed to import transformers.models.t5.modeling_t5 because of the following error (look up to see its traceback): Failed to import transformers.onnx.config because of the following error (look up to see its traceback): DLL load failed while importing _imaging: The specified module could not be found.`

jiajiao272727 commented 1 month ago

conda update Pillow