viiika / Meissonic

We're back! Implementations of Meissonic developed by Community~If you feel it is helpful, plz consider giving a star❤️
https://viiika.github.io/Meissonic/
Apache License 2.0
259 stars 10 forks source link

TypeError: tuple indices must be integers or slices, not tuple #3

Closed nitinmukesh closed 1 month ago

nitinmukesh commented 1 month ago

Getting this error. Didn't modified any code/value in code.

(venv) C:\aitools\Meissonic>python inference.py
C:\aitools\Meissonic\venv\lib\site-packages\transformers\models\clip\modeling_clip.py:491: UserWarning: 1Torch was not compiled with flash attention. (Triggered internally at C:\actions-runner\_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\transformers\cuda\sdp_utils.cpp:555.)
  attn_output = torch.nn.functional.scaled_dot_product_attention(
  0%|                                                                                          | 0/48 [00:00<?, ?it/s]
Traceback (most recent call last):
  File "C:\aitools\Meissonic\inference.py", line 54, in <module>
    image = pipe(prompt=prompt,negative_prompt=negative_prompts,height=resolution,width=resolution,guidance_scale=CFG,num_inference_steps=steps).images[0]
  File "C:\aitools\Meissonic\venv\lib\site-packages\torch\utils\_contextlib.py", line 116, in decorate_context
    return func(*args, **kwargs)
  File "C:\aitools\Meissonic\src\pipeline.py", line 314, in __call__
    model_output = self.transformer(
  File "C:\aitools\Meissonic\venv\lib\site-packages\torch\nn\modules\module.py", line 1553, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
  File "C:\aitools\Meissonic\venv\lib\site-packages\torch\nn\modules\module.py", line 1562, in _call_impl
    return forward_call(*args, **kwargs)
  File "C:\aitools\Meissonic\src\transformer.py", line 1141, in forward
    encoder_hidden_states, hidden_states = block(
  File "C:\aitools\Meissonic\venv\lib\site-packages\torch\nn\modules\module.py", line 1553, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
  File "C:\aitools\Meissonic\venv\lib\site-packages\torch\nn\modules\module.py", line 1562, in _call_impl
    return forward_call(*args, **kwargs)
  File "C:\aitools\Meissonic\src\transformer.py", line 501, in forward
    attn_output, context_attn_output = self.attn(
  File "C:\aitools\Meissonic\venv\lib\site-packages\torch\nn\modules\module.py", line 1553, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
  File "C:\aitools\Meissonic\venv\lib\site-packages\torch\nn\modules\module.py", line 1562, in _call_impl
    return forward_call(*args, **kwargs)
  File "C:\aitools\Meissonic\venv\lib\site-packages\diffusers\models\attention_processor.py", line 490, in forward
    return self.processor(
  File "C:\aitools\Meissonic\venv\lib\site-packages\diffusers\models\attention_processor.py", line 1846, in __call__
    query, key = apply_rope(query, key, image_rotary_emb)
  File "C:\aitools\Meissonic\venv\lib\site-packages\diffusers\models\attention_processor.py", line 1702, in apply_rope
    xq_out = freqs_cis[..., 0] * xq_[..., 0] + freqs_cis[..., 1] * xq_[..., 1]
TypeError: tuple indices must be integers or slices, not tuple

pip list

(venv) C:\aitools\Meissonic>pip list Package Version ------------------- ------------ accelerate 1.0.1 aiohappyeyeballs 2.4.3 aiohttp 3.10.10 aiosignal 1.3.1 async-timeout 4.0.3 attrs 24.2.0 certifi 2024.8.30 charset-normalizer 3.4.0 colorama 0.4.6 diffusers 0.30.3 filelock 3.16.1 frozenlist 1.4.1 fsspec 2024.9.0 huggingface-hub 0.25.2 idna 3.10 importlib_metadata 8.5.0 Jinja2 3.1.4 lightning-utilities 0.11.7 MarkupSafe 3.0.1 mpmath 1.3.0 multidict 6.1.0 networkx 3.4.1 numpy 2.1.2 packaging 24.1 pillow 10.4.0 pip 22.2.1 propcache 0.2.0 psutil 6.0.0 pytorch-lightning 2.4.0 PyYAML 6.0.2 regex 2024.9.11 requests 2.32.3 safetensors 0.4.5 setuptools 63.2.0 sympy 1.13.3 tokenizers 0.20.1 torch 2.4.1+cu124 torchmetrics 1.4.3 torchvision 0.19.1+cu124 tqdm 4.66.5 transformers 4.45.2 typing_extensions 4.12.2 urllib3 2.2.3 yarl 1.15.2 zipp 3.20.2 [notice] A new release of pip available: 22.2.1 -> 24.2 [notice] To update, run: python.exe -m pip install --upgrade pip
Quasimondo commented 1 month ago

I pulled the latest version, but I am still seeing the same error. Is this related to the version of diffusers? - I got 0.30.3, and not the one directly pulled from their repository as you suggest in the readme.

nitinmukesh commented 1 month ago

@Quasimondo

See if this helps https://www.youtube.com/watch?v=PlmifElhr6M

Quasimondo commented 1 month ago

Ok I just pulled the latest diffusers directly from their repository and installed it as said in the readme and that fixes it - which is diffusers-0.31.0.dev0 - looks like you have some bleeding edge stuff in there...