Stability-AI/generative-models

NameError: name 'xformers' is not defined

hpandeycodeit opened this issue · 1 comments

I am trying to run scripts/sampling/simple_video_sample.py but getting the below error:


  File "/opt/homebrew/lib/python3.12/site-packages/torch/nn/modules/module.py", line 1562, in _call_impl
    return forward_call(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/generative-models/sgm/modules/diffusionmodules/model.py", line 263, in forward
    h_ = self.attention(h_)
         ^^^^^^^^^^^^^^^^^^
  File "~/generative-models/sgm/modules/diffusionmodules/model.py", line 249, in attention
    out = xformers.ops.memory_efficient_attention(
          ^^^^^^^^
NameError: name 'xformers' is not defined

The only change I did to the script it changed the device from CUDA to CPU and I am trying to run it on M1.

Any idea why is this happening?

I guess xformers was not loaded, xformers is checked here:
image