Stability-AI / generative-models

Generative Models by Stability AI

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

module 'xformers' has no attribute 'ops'

TeKett opened this issue · comments

For now im running in python 3.10.9 since thats what the community has been running in the past and iv had no reason to update, and it could break things.

XFormers is saying that it cant load because im not on 3.10.11. But that it Processing without and Falling back to native attention. This is not a problem in Pytorch = 2.0. It did also say that it could not load because i was on the CPU version of torch, so i installed the CUDA version of torch.

Everything works until i hit sample, whatever that is (should it not say generate?). When i do i get this error

C:\SDVideo\generative-models\venv\lib\site-packages\torch\nn\functional.py:5476: UserWarning: 1Torch was not compiled with flash attention. (Triggered internally at ..\aten\src\ATen\native\transformers\cuda\sdp_utils.cpp:263.)
  attn_output = scaled_dot_product_attention(q, k, v, attn_mask, dropout_p, is_causal)
2024-03-17 01:33:20.458 Uncaught app exception
Traceback (most recent call last):
  File "C:\SDVideo\generative-models\venv\lib\site-packages\streamlit\runtime\scriptrunner\script_runner.py", line 542, in _run_script
    exec(code, module.__dict__)
  File "C:\SDVideo\generative-models\video_sampling.py", line 174, in <module>
    out = do_sample(
  File "C:\SDVideo\generative-models\scripts\demo\streamlit_helpers.py", line 520, in do_sample
    c, uc = model.conditioner.get_unconditional_conditioning(
  File "C:\SDVideo\generative-models\sgm\modules\encoders\modules.py", line 179, in get_unconditional_conditioning
    c = self(batch_c, force_cond_zero_embeddings)
  File "C:\SDVideo\generative-models\venv\lib\site-packages\torch\nn\modules\module.py", line 1511, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
  File "C:\SDVideo\generative-models\venv\lib\site-packages\torch\nn\modules\module.py", line 1520, in _call_impl
    return forward_call(*args, **kwargs)
  File "C:\SDVideo\generative-models\sgm\modules\encoders\modules.py", line 132, in forward
    emb_out = embedder(batch[embedder.input_key])
  File "C:\SDVideo\generative-models\venv\lib\site-packages\torch\nn\modules\module.py", line 1511, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
  File "C:\SDVideo\generative-models\venv\lib\site-packages\torch\nn\modules\module.py", line 1520, in _call_impl
    return forward_call(*args, **kwargs)
  File "C:\SDVideo\generative-models\sgm\modules\encoders\modules.py", line 1012, in forward
    out = self.encoder.encode(vid[n * n_samples : (n + 1) * n_samples])
  File "C:\SDVideo\generative-models\sgm\models\autoencoder.py", line 472, in encode
    z = self.encoder(x)
  File "C:\SDVideo\generative-models\venv\lib\site-packages\torch\nn\modules\module.py", line 1511, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
  File "C:\SDVideo\generative-models\venv\lib\site-packages\torch\nn\modules\module.py", line 1520, in _call_impl
    return forward_call(*args, **kwargs)
  File "C:\SDVideo\generative-models\sgm\modules\diffusionmodules\model.py", line 594, in forward
    h = self.mid.attn_1(h)
  File "C:\SDVideo\generative-models\venv\lib\site-packages\torch\nn\modules\module.py", line 1511, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
  File "C:\SDVideo\generative-models\venv\lib\site-packages\torch\nn\modules\module.py", line 1520, in _call_impl
    return forward_call(*args, **kwargs)
  File "C:\SDVideo\generative-models\sgm\modules\diffusionmodules\model.py", line 263, in forward
    h_ = self.attention(h_)
  File "C:\SDVideo\generative-models\sgm\modules\diffusionmodules\model.py", line 249, in attention
    out = xformers.ops.memory_efficient_attention(
AttributeError: module 'xformers' has no attribute 'ops'

Do i have to update to 2.10.11? Can i in an easy way use multiple versions of python? I know A1111 allows to pick the python version, but the other AI projects don't do that, and iv had a literal hell trying to swap python version before.

Did you ever figure this out? Having the same problem on Python 3.10.11.

Having the same problem here on Python 3.10.13. Are you able to solve it?

Looking back on this i realize this was a repo for all models, unlike how its on huggingface, strange choice but ok. But nope, and its not tempting enough for me to try. I only got this issue on SDV. I just wanted to check it out, but its not worth trying to solve when its only img2vid.