lllyasviel / lllyasviel/ControlNet

AssertionError: Torch not compiled with CUDA enabled (MacOS M1 32GB, using segmantation preprocesser)

Open
#327 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
34.1k
Forks
3k
PR merge metrics
No merged PRs in 30d

Description

Only in segmantation preprocesser did I encounter this issue, is this wierd?
I've tried the commandline args settings mentioned in #64 (the exact line I have in my web-user.sh is: export COMMANDLINE_ARGS="--skip-torch-cuda-test --no-half --upcast-sampling --no-half-vae --no-half-controlnet --use-cpu interrogate --api") and I launch SD with webui.sh) , but it didn't work on my M1 machine.

The detailed error message is as follows:
Traceback (most recent call last):
File "/Volumes/Workplaces&Data/StableDiffusionWebUI/stable-diffusion-webui/venv/lib/python3.10/site-packages/gradio/routes.py", line 394, in run_predict
output = await app.get_blocks().process_api(
File "/Volumes/Workplaces&Data/StableDiffusionWebUI/stable-diffusion-webui/venv/lib/python3.10/site-packages/gradio/blocks.py", line 1075, in process_api
result = await self.call_function(
File "/Volumes/Workplaces&Data/StableDiffusionWebUI/stable-diffusion-webui/venv/lib/python3.10/site-packages/gradio/blocks.py", line 884, in call_function
prediction = await anyio.to_thread.run_sync(
File "/Volumes/Workplaces&Data/StableDiffusionWebUI/stable-diffusion-webui/venv/lib/python3.10/site-packages/anyio/to_thread.py", line 31, in run_sync
return await get_asynclib().run_sync_in_worker_thread(
File "/Volumes/Workplaces&Data/StableDiffusionWebUI/stable-diffusion-webui/venv/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 937, in run_sync_in_worker_thread
return await future
File "/Volumes/Workplaces&Data/StableDiffusionWebUI/stable-diffusion-webui/venv/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 867, in run
result = context.run(func, *args)
File "/Volumes/Workplaces&Data/StableDiffusionWebUI/stable-diffusion-webui/extensions/sd-webui-controlnet/scripts/controlnet.py", line 455, in run_annotator
result, is_image = preprocessor(img, res=pres, thr_a=pthr_a, thr_b=pthr_b)
File "/Volumes/Workplaces&Data/StableDiffusionWebUI/stable-diffusion-webui/extensions/sd-webui-controlnet/scripts/processor.py", line 157, in uniformer
result = model_uniformer(img)
File "/Volumes/Workplaces&Data/StableDiffusionWebUI/stable-diffusion-webui/extensions/sd-webui-controlnet/annotator/uniformer/__init__.py", line 33, in apply_uniformer
model = init_segmentor(config_file, modelpath)
File "/Volumes/Workplaces&Data/StableDiffusionWebUI/stable-diffusion-webui/extensions/sd-webui-controlnet/annotator/uniformer/inference.py", line 43, in init_segmentor
model.to(device)
File "/Volumes/Workplaces&Data/StableDiffusionWebUI/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 989, in to
return self._apply(convert)
File "/Volumes/Workplaces&Data/StableDiffusionWebUI/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 641, in _apply
module._apply(fn)
File "/Volumes/Workplaces&Data/StableDiffusionWebUI/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 641, in _apply
module._apply(fn)
File "/Volumes/Workplaces&Data/StableDiffusionWebUI/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 641, in _apply
module._apply(fn)
File "/Volumes/Workplaces&Data/StableDiffusionWebUI/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 664, in _apply
param_applied = fn(param)
File "/Volumes/Workplaces&Data/StableDiffusionWebUI/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/nn/modules/module.py", line 987, in convert
return t.to(device, dtype if t.is_floating_point() or t.is_complex() else None, non_blocking)
File "/Volumes/Workplaces&Data/StableDiffusionWebUI/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/cuda/__init__.py", line 221, in _lazy_init
raise AssertionError("Torch not compiled with CUDA enabled")
AssertionError: Torch not compiled with CUDA enabled

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in extensions/sd-webui-controlnet/scripts/processor.py at uniformer, then follow annotator/uniformer/__init__.py and inference.py where init_segmentor calls model.to(device). Reproduce the segmentation preprocessor path on the reported M1 setup and verify it completes without the CUDA assertion shown in the traceback.

Written by the indexing model from the issue text.

Assessment

Tech stack
macos, python, pytorch
Domain
computer-vision, machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.