fast-stable-diffusion: Google Collab Pro: WARNING[XFORMERS]: xFormers can't load C++/CUDA extensions

When running Start Stable-Diffusion module:

WARNING[XFORMERS]: xFormers can’t load C++/CUDA extensions. xFormers was built for: PyTorch 2.0.1+cu118 with CUDA 1108 (you have 2.1.0+cu118) Python 3.10.11 (you have 3.10.12) Please reinstall xformers (see https://github.com/facebookresearch/xformers#installing-xformers) Memory-efficient attention, SwiGLU, sparse and more won’t be available. Set XFORMERS_MORE_DETAILS=1 for more details

After model loads and attempting a new task:

*** Error completing request *** Arguments: (‘task(z56ngcsuo73sy3x)’, ‘(Color photograph) of (very beautiful) woman, elean0r_n0texist, wearing (bodycon little black dress)1.1, at a (movie premiere red carpet). candid, (full color), face detail, intricate high detail, dramatic, skin pores, cinematic lighting, detailed, (vibrant, photo realistic, dramatic, sharp focus) ((film grain, skin details, high detailed skin texture, 8k hdr, dslr))’, ‘’, [‘Schizo Negative’], 30, ‘Euler a’, 1, 1, 7, 768, 512, False, 0.7, 2, ‘Latent’, 0, 0, 0, ‘Use same checkpoint’, ‘Use same sampler’, ‘’, ‘’, [], <gradio.routes.Request object at 0x7d29ac5d7eb0>, 0, False, ‘’, 0.8, -1, False, -1, 0, 0, 0, False, False, ‘positive’, ‘comma’, 0, False, False, ‘’, 1, ‘’, [], 0, ‘’, [], 0, ‘’, [], True, False, False, False, 0, False) {} Traceback (most recent call last): File “/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/call_queue.py”, line 57, in f res = list(func(*args, **kwargs)) File “/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/call_queue.py”, line 36, in f res = func(*args, **kwargs) File “/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/txt2img.py”, line 55, in txt2img processed = processing.process_images(p) File “/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/processing.py”, line 732, in process_images res = process_images_inner(p) File “/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/processing.py”, line 867, in process_images_inner samples_ddim = p.sample(conditioning=p.c, unconditional_conditioning=p.uc, seeds=p.seeds, subseeds=p.subseeds, subseed_strength=p.subseed_strength, prompts=p.prompts) File “/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/processing.py”, line 1140, in sample samples = self.sampler.sample(self, x, conditioning, unconditional_conditioning, image_conditioning=self.txt2img_image_conditioning(x)) File “/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/sd_samplers_kdiffusion.py”, line 235, in sample samples = self.launch_sampling(steps, lambda: self.func(self.model_wrap_cfg, x, extra_args=self.sampler_extra_args, disable=False, callback=self.callback_state, **extra_params_kwargs)) File “/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/sd_samplers_common.py”, line 261, in launch_sampling return func() File “/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/sd_samplers_kdiffusion.py”, line 235, in <lambda> samples = self.launch_sampling(steps, lambda: self.func(self.model_wrap_cfg, x, extra_args=self.sampler_extra_args, disable=False, callback=self.callback_state, **extra_params_kwargs)) File “/usr/local/lib/python3.10/dist-packages/torch/utils/_contextlib.py”, line 115, in decorate_context return func(*args, **kwargs) File “/content/gdrive/MyDrive/sd/stablediffusion/src/k-diffusion/k_diffusion/sampling.py”, line 145, in sample_euler_ancestral denoised = model(x, sigmas[i] * s_in, **extra_args) File “/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py”, line 1518, in _wrapped_call_impl return self._call_impl(*args, **kwargs) File “/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py”, line 1527, in _call_impl return forward_call(*args, **kwargs) File “/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/sd_samplers_cfg_denoiser.py”, line 188, in forward x_out[a:b] = self.inner_model(x_in[a:b], sigma_in[a:b], cond=make_condition_dict(c_crossattn, image_cond_in[a:b])) File “/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py”, line 1518, in _wrapped_call_impl return self._call_impl(*args, **kwargs) File “/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py”, line 1527, in _call_impl return forward_call(*args, **kwargs) File “/content/gdrive/MyDrive/sd/stablediffusion/src/k-diffusion/k_diffusion/external.py”, line 112, in forward eps = self.get_eps(input * c_in, self.sigma_to_t(sigma), **kwargs) File “/content/gdrive/MyDrive/sd/stablediffusion/src/k-diffusion/k_diffusion/external.py”, line 138, in get_eps return self.inner_model.apply_model(*args, **kwargs) File “/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/sd_hijack_utils.py”, line 17, in <lambda> setattr(resolved_obj, func_path[-1], lambda *args, **kwargs: self(*args, **kwargs)) File “/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/sd_hijack_utils.py”, line 26, in call return self.__sub_func(self.__orig_func, *args, **kwargs) File “/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/sd_hijack_unet.py”, line 48, in apply_model return orig_func(self, x_noisy.to(devices.dtype_unet), t.to(devices.dtype_unet), cond, **kwargs).float() File “/content/gdrive/MyDrive/sd/stablediffusion/ldm/models/diffusion/ddpm.py”, line 858, in apply_model x_recon = self.model(x_noisy, t, **cond) File “/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py”, line 1518, in _wrapped_call_impl return self._call_impl(*args, **kwargs) File “/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py”, line 1527, in _call_impl return forward_call(*args, **kwargs) File “/content/gdrive/MyDrive/sd/stablediffusion/ldm/models/diffusion/ddpm.py”, line 1329, in forward out = self.diffusion_model(x, t, context=cc) File “/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py”, line 1518, in _wrapped_call_impl return self._call_impl(*args, **kwargs) File “/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py”, line 1527, in _call_impl return forward_call(*args, **kwargs) File “/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/sd_unet.py”, line 91, in UNetModel_forward return ldm.modules.diffusionmodules.openaimodel.copy_of_UNetModel_forward_for_webui(self, x, timesteps, context, *args, **kwargs) File “/content/gdrive/MyDrive/sd/stablediffusion/ldm/modules/diffusionmodules/openaimodel.py”, line 776, in forward h = module(h, emb, context) File “/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py”, line 1518, in _wrapped_call_impl return self._call_impl(*args, **kwargs) File “/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py”, line 1527, in _call_impl return forward_call(*args, **kwargs) File “/content/gdrive/MyDrive/sd/stablediffusion/ldm/modules/diffusionmodules/openaimodel.py”, line 84, in forward x = layer(x, context) File “/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py”, line 1518, in _wrapped_call_impl return self._call_impl(*args, **kwargs) File “/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py”, line 1527, in _call_impl return forward_call(*args, **kwargs) File “/content/gdrive/MyDrive/sd/stablediffusion/ldm/modules/attention.py”, line 334, in forward x = block(x, context=context[i]) File “/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py”, line 1518, in _wrapped_call_impl return self._call_impl(*args, **kwargs) File “/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py”, line 1527, in _call_impl return forward_call(*args, **kwargs) File “/content/gdrive/MyDrive/sd/stablediffusion/ldm/modules/attention.py”, line 269, in forward return checkpoint(self._forward, (x, context), self.parameters(), self.checkpoint) File “/content/gdrive/MyDrive/sd/stablediffusion/ldm/modules/diffusionmodules/util.py”, line 114, in checkpoint return CheckpointFunction.apply(func, len(inputs), *args) File “/usr/local/lib/python3.10/dist-packages/torch/autograd/function.py”, line 539, in apply return super().apply(*args, **kwargs) # type: ignore[misc] File “/content/gdrive/MyDrive/sd/stablediffusion/ldm/modules/diffusionmodules/util.py”, line 129, in forward output_tensors = ctx.run_function(*ctx.input_tensors) File “/content/gdrive/MyDrive/sd/stablediffusion/ldm/modules/attention.py”, line 272, in _forward x = self.attn1(self.norm1(x), context=context if self.disable_self_attn else None) + x File “/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py”, line 1518, in _wrapped_call_impl return self._call_impl(*args, **kwargs) File “/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py”, line 1527, in _call_impl return forward_call(*args, **kwargs) File “/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/sd_hijack_optimizations.py”, line 496, in xformers_attention_forward out = xformers.ops.memory_efficient_attention(q, k, v, attn_bias=None, op=get_xformers_flash_attention_op(q, k, v)) File “/usr/local/lib/python3.10/dist-packages/xformers/ops/fmha/init.py”, line 192, in memory_efficient_attention return _memory_efficient_attention( File “/usr/local/lib/python3.10/dist-packages/xformers/ops/fmha/init.py”, line 290, in _memory_efficient_attention return _memory_efficient_attention_forward( File “/usr/local/lib/python3.10/dist-packages/xformers/ops/fmha/init.py”, line 306, in _memory_efficient_attention_forward op = _dispatch_fw(inp) File “/usr/local/lib/python3.10/dist-packages/xformers/ops/fmha/dispatch.py”, line 94, in _dispatch_fw return _run_priority_list( File “/usr/local/lib/python3.10/dist-packages/xformers/ops/fmha/dispatch.py”, line 69, in _run_priority_list raise NotImplementedError(msg) NotImplementedError: No operator found for memory_efficient_attention_forward with inputs: query : shape=(1, 6144, 8, 40) (torch.float16) key : shape=(1, 6144, 8, 40) (torch.float16) value : shape=(1, 6144, 8, 40) (torch.float16) attn_bias : <class ‘NoneType’> p : 0.0 flshattF is not supported because: xFormers wasn’t build with CUDA support Operator wasn’t built - see python -m xformers.info for more info tritonflashattF is not supported because: xFormers wasn’t build with CUDA support Operator wasn’t built - see python -m xformers.info for more info triton is not available requires A100 GPU cutlassF is not supported because: xFormers wasn’t build with CUDA support Operator wasn’t built - see python -m xformers.info for more info smallkF is not supported because: xFormers wasn’t build with CUDA support dtype=torch.float16 (supported: {torch.float32}) max(query.shape[-1] != value.shape[-1]) > 32 Operator wasn’t built - see python -m xformers.info for more info unsupported embed per head: 40


About this issue

  • Original URL
  • State: closed
  • Created 8 months ago
  • Reactions: 3
  • Comments: 64 (9 by maintainers)

Most upvoted comments

Try this at the beginning of the file.

!pip install lmdb
!pip install torch==2.0.1+cu118 torchvision==0.15.2+cu118 torchaudio==2.0.2 torchtext==0.15.2+cpu torchdata==0.6.1 --index-url https://download.pytorch.org/whl/cu118

image

Here’s the key part:

WARNING[XFORMERS]: xFormers can’t load C++/CUDA extensions. xFormers was built for: PyTorch 2.0.1+cu118 with CUDA 1108 (you have 2.1.0+cu118) Python 3.10.11 (you have 3.10.12)

There’s an incompatibility with Python/PyTorch and xFormers. Perhaps someone can give us a temporary fix, If not, we’ll just have to wait. I suspect everyone is getting this exact error.

same here.

use the latest notebook, no need to run any additional code

Just had the same problem, working fine an hour ago now broken!

Seeing this same message as well.

Same here!

Same. something is broken. I’ve tried installing xformers==0.0.20 but so many other packages fail to install.

try again

Try this at the beginning of the file.

!pip install lmdb
!pip install torch==2.0.1+cu118 torchvision==0.15.2+cu118 torchaudio==2.0.2 torchtext==0.15.2+cpu torchdata==0.6.1 --index-url https://download.pytorch.org/whl/cu118

image

Not working for me, this error apears

ARNING[XFORMERS]: xFormers can’t load C++/CUDA extensions. xFormers was built for: PyTorch 2.1.0+cu121 with CUDA 1201 (you have 2.1.0+cu118) Python 3.10.13 (you have 3.10.12)

use the latest notebook

I still get this error.

WARNING[XFORMERS]: xFormers can’t load C++/CUDA extensions. xFormers was built for: PyTorch 2.1.0+cu121 with CUDA 1201 (you have 2.1.0+cu118) Python 3.10.13 (you have 3.10.12) Please reinstall xformers (see https://github.com/facebookresearch/xformers#installing-xformers) Memory-efficient attention, SwiGLU, sparse and more won’t be available. Set XFORMERS_MORE_DETAILS=1 for more details

According to the WARNING, update the install version that add at the beginning of the file.

!pip install lmdb
!pip install torch==2.1.0+cu121 torchvision==0.16.0+cu121 torchaudio==2.1.0 torchtext==0.16.0+cpu torchdata==0.7.0 --index-url https://download.pytorch.org/whl/cu121

image I was got the WARNING too, but now I’m using normally, by try to update that. image

Try this at the beginning of the file.

!pip install lmdb
!pip install torch==2.0.1+cu118 torchvision==0.15.2+cu118 torchaudio==2.0.2 torchtext==0.15.2+cpu torchdata==0.6.1 --index-url https://download.pytorch.org/whl/cu118

image

worked for me, thanks. quick question, is this safe to run before running the rest of the notebook? or is it advised to run this after all requirements have already been installed/updated? @paradoxtown

Yes, it is safe since it just installs some libraries with compatible versions and there is no conflict. Theoretically, you are correct. It would be better to run it after installing all other requirements to cover these incompatible version. But it didn’t work.

Same here!

Solved

Also got the “no module ‘xformers’. Processing without…” message, but can also generate images.

replaced xformers with SDP, almost the same performance

try again

Worked now. Thanks so much 😃

I do get “no module ‘xformers’. Processing without…” but the thing still launches and I seem to be able to generate images as always.

Thanks again Ben!

use the latest notebook

Guys, has anyone been able to solve the problem?

Try this at the beginning of the file.

!pip install lmdb
!pip install torch==2.0.1+cu118 torchvision==0.15.2+cu118 torchaudio==2.0.2 torchtext==0.15.2+cpu torchdata==0.6.1 --index-url https://download.pytorch.org/whl/cu118

image

thanks bro it works for me!

Commenting to say I’m getting this error too. Was generating fine, stopped for an hour, booted it back up and now I’m getting this xformers error. Colab Pro user.