ControlNet icon indicating copy to clipboard operation
ControlNet copied to clipboard

Error when running python gradio_canny2image.py

Open samperrow opened this issue 2 years ago • 0 comments

I have download all of the models/annotators and put them in their proper folders, but when I try to run python gradio_canny2image.py I get the error below:

(control) me@me-MBP ControlNet % python gradio_canny2image.py logging improved. No module 'xformers'. Proceeding without it. ControlLDM: Running in eps-prediction mode DiffusionWrapper has 859.52 M params. making attention of type 'vanilla' with 512 in_channels Working with z of shape (1, 4, 32, 32) = 4096 dimensions. making attention of type 'vanilla' with 512 in_channels Loaded model config from [./models/cldm_v15.yaml] Traceback (most recent call last): File "gradio_canny2image.py", line 21, in <module> model.load_state_dict(load_state_dict('./models/control_sd15_canny.pth', location='cuda')) File "/~/Desktop/repos/personal/ControlNet/cldm/model.py", line 18, in load_state_dict state_dict = get_state_dict(torch.load(ckpt_path, map_location=torch.device(location))) File "/~/anaconda3/envs/control/lib/python3.8/site-packages/torch/serialization.py", line 712, in load return _load(opened_zipfile, map_location, pickle_module, **pickle_load_args) File "/~/anaconda3/envs/control/lib/python3.8/site-packages/torch/serialization.py", line 1049, in _load result = unpickler.load() File "/~/anaconda3/envs/control/lib/python3.8/site-packages/torch/serialization.py", line 1019, in persistent_load load_tensor(dtype, nbytes, key, _maybe_decode_ascii(location)) File "/~/anaconda3/envs/control/lib/python3.8/site-packages/torch/serialization.py", line 1001, in load_tensor wrap_storage=restore_location(storage, location), File "/~/anaconda3/envs/control/lib/python3.8/site-packages/torch/serialization.py", line 973, in restore_location return default_restore_location(storage, str(map_location)) File "/~/anaconda3/envs/control/lib/python3.8/site-packages/torch/serialization.py", line 175, in default_restore_location result = fn(storage, location) File "/~/anaconda3/envs/control/lib/python3.8/site-packages/torch/serialization.py", line 152, in _cuda_deserialize device = validate_cuda_device(location) File "/~/anaconda3/envs/control/lib/python3.8/site-packages/torch/serialization.py", line 136, in validate_cuda_device raise RuntimeError('Attempting to deserialize object on a CUDA ' RuntimeError: Attempting to deserialize object on a CUDA device but torch.cuda.is_available() is False. If you are running on a CPU-only machine, please use torch.load with map_location=torch.device('cpu') to map your storages to the CPU.

samperrow avatar Mar 25 '23 23:03 samperrow