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

Missing diffusers #16

Closed ruapotato closed 1 month ago

ruapotato commented 1 month ago

OS: Debian 12 Install steps:

david@davidmain:~/myProjects/AI/BIN$ cd Meissonic
david@davidmain:~/myProjects/AI/BIN$ python3 -m venv pyenv
david@davidmain:~/myProjects/AI/BIN/Meissonic$ source ./pyenv/bin/activate
(pyenv) david@davidmain:~/myProjects/AI/BIN/Meissonic$ pip install -r requirements.txt

Issue:

(pyenv) david@davidmain:~/myProjects/AI/BIN/Meissonic$ python app.py
Traceback (most recent call last):
  File "/matrix/david/main_home_folder/myProjects/AI/BIN/Meissonic/app.py", line 7, in <module>
    from src.transformer import Transformer2DModel
  File "/matrix/david/main_home_folder/myProjects/AI/BIN/Meissonic/src/transformer.py", line 23, in <module>
    from diffusers.configuration_utils import ConfigMixin, register_to_config
ruapotato commented 1 month ago

Installing diffusers via pip ends with this:

(pyenv) david@davidmain:~/myProjects/AI/BIN/Meissonic$ python inference.py --prompt "Fish eating a cat" 
  0%|                                                                                                                                                                                       | 0/64 [00:01<?, ?it/s]
Traceback (most recent call last):
  File "/matrix/david/main_home_folder/myProjects/AI/BIN/Meissonic/inference.py", line 50, in <module>
    images = pipe(
             ^^^^^
  File "/matrix/david/main_home_folder/myProjects/AI/BIN/Meissonic/pyenv/lib/python3.11/site-packages/torch/utils/_contextlib.py", line 116, in decorate_context
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/matrix/david/main_home_folder/myProjects/AI/BIN/Meissonic/src/pipeline.py", line 314, in __call__
    model_output = self.transformer(
                   ^^^^^^^^^^^^^^^^^
  File "/matrix/david/main_home_folder/myProjects/AI/BIN/Meissonic/pyenv/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1736, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/matrix/david/main_home_folder/myProjects/AI/BIN/Meissonic/pyenv/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1747, in _call_impl
    return forward_call(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/matrix/david/main_home_folder/myProjects/AI/BIN/Meissonic/src/transformer.py", line 1141, in forward
    encoder_hidden_states, hidden_states = block(
                                           ^^^^^^
  File "/matrix/david/main_home_folder/myProjects/AI/BIN/Meissonic/pyenv/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1736, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/matrix/david/main_home_folder/myProjects/AI/BIN/Meissonic/pyenv/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1747, in _call_impl
    return forward_call(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/matrix/david/main_home_folder/myProjects/AI/BIN/Meissonic/src/transformer.py", line 501, in forward
    attn_output, context_attn_output = self.attn(
                                       ^^^^^^^^^^
  File "/matrix/david/main_home_folder/myProjects/AI/BIN/Meissonic/pyenv/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1736, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/matrix/david/main_home_folder/myProjects/AI/BIN/Meissonic/pyenv/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1747, in _call_impl
    return forward_call(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/matrix/david/main_home_folder/myProjects/AI/BIN/Meissonic/pyenv/lib/python3.11/site-packages/diffusers/models/attention_processor.py", line 490, in forward
    return self.processor(
           ^^^^^^^^^^^^^^^
  File "/matrix/david/main_home_folder/myProjects/AI/BIN/Meissonic/pyenv/lib/python3.11/site-packages/diffusers/models/attention_processor.py", line 1846, in __call__
    query, key = apply_rope(query, key, image_rotary_emb)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/matrix/david/main_home_folder/myProjects/AI/BIN/Meissonic/pyenv/lib/python3.11/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

Do we need a particular version of diffusers?

viiika commented 1 month ago

The diffusers package from pip is outdated. You need to install diffusers via

git clone https://github.com/huggingface/diffusers.git
cd diffusers
pip install -e .

Thank you for your attention. Our README has been incorrectly updated.

ruapotato commented 1 month ago

Yep that did it thank you!