Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tensor size mismatch error during inference #87

Open
hardikdava opened this issue Mar 26, 2025 · 15 comments
Open

Tensor size mismatch error during inference #87

hardikdava opened this issue Mar 26, 2025 · 15 comments

Comments

@hardikdava
Copy link

Great work!, I am trying to run ACE++ for subject mode. I have used diffuser based pipeline version. I am getting following error. I have tried inputs as of same size but still getting same error. Any lead would be super helpful.

Thank you in advance.

0%|          | 0/28 [00:00<?, ?it/s]
0%|          | 0/28 [00:00<?, ?it/s]
Traceback (most recent call last):
File "/root/.pyenv/versions/3.11.10/lib/python3.11/site-packages/cog/server/worker.py", line 352, in _predict
result = predict(**payload)
^^^^^^^^^^^^^^^^^^
File "/root/.pyenv/versions/3.11.10/lib/python3.11/site-packages/torch/utils/_contextlib.py", line 116, in decorate_context
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/src/predictor.py", line 124, in predict
image = self.pipe(
^^^^^^^^^^
File "/root/.pyenv/versions/3.11.10/lib/python3.11/site-packages/torch/utils/_contextlib.py", line 116, in decorate_context
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/src/ace_plus_diffusers.py", line 105, in __call__
image = self.pipe(
^^^^^^^^^^
File "/root/.pyenv/versions/3.11.10/lib/python3.11/site-packages/torch/utils/_contextlib.py", line 116, in decorate_context
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/root/.pyenv/versions/3.11.10/lib/python3.11/site-packages/diffusers/pipelines/flux/pipeline_flux_fill.py", line 916, in __call__
noise_pred = self.transformer(
^^^^^^^^^^^^^^^^^
File "/root/.pyenv/versions/3.11.10/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1739, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/.pyenv/versions/3.11.10/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1750, in _call_impl
return forward_call(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/.pyenv/versions/3.11.10/lib/python3.11/site-packages/diffusers/models/transformers/transformer_flux.py", line 463, in forward
hidden_states = self.x_embedder(hidden_states)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/.pyenv/versions/3.11.10/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1739, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/.pyenv/versions/3.11.10/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1750, in _call_impl
return forward_call(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/.pyenv/versions/3.11.10/lib/python3.11/site-packages/torch/nn/modules/linear.py", line 125, in forward
return F.linear(input, self.weight, self.bias)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: mat1 and mat2 shapes cannot be multiplied (5504x384 and 64x3072)
@yaosheng216
Copy link
Contributor

https://github.com/ali-vilab/ACE_plus/blob/main/inference/ace_plus_diffusers.py
@hardikdava You can refer of this code to used diffuser.

@hardikdava
Copy link
Author

@yaosheng216 thanks for the reply. I have used the same code and am getting the above mentioned error.

@yaosheng216
Copy link
Contributor

@yaosheng216 thanks for the reply. I have used the same code and am getting the above mentioned error.
@hardikdava Can you provide more error information.

@hardikdava
Copy link
Author

@yaosheng216 I have used this script as starting point and used these images as an input. I have used default parameters only. I have not changed code in anyway. Actually, I am trying to deploy it on replicate. I have attached full stacktrace in the description itself.

@yaosheng216
Copy link
Contributor

yaosheng216 commented Mar 27, 2025

Image @hardikdava Used this script, you can invoke of screenshot's function, parameters of reference_image, edit_image, edit_mask, prompt, task and seed values set refer of this link: https://huggingface.co/spaces/scepter-studio/ACE-Plus. Another, this diffuser script is used FFT model.

@hardikdava
Copy link
Author

@yaosheng216 Is it possible that transformers module used in diffuser workflow uses original transformer module? Doesn't it need to be replaced with modified transformer?

@yaosheng216
Copy link
Contributor

@hardikdava Recommend you can try to upgrade diffusers and transformers to latest version.

@hardikdava
Copy link
Author

@yaosheng216 I have used latest version of both package.

Image

@yaosheng216
Copy link
Contributor

@hardikdava Both of package version is no problem, can you provide more runtime information, this will helps me find the problem.

@yaosheng216
Copy link
Contributor

@hardikdava comfyui_subject_lora16.safetensors is a LoRA model, this diffusers script need to used FFT model, that has same function with subject LoRA model, model url: https://huggingface.co/ali-vilab/ACE_Plus/blob/main/ace_plus_fft.safetensors

@hardikdava
Copy link
Author

@yaosheng216 so which lora should I use for subject reconstruction problem but with diffuser pipeline?

@songyiren725
Copy link

Use the Flux-Fill-dev rather than Flux-dev

@songyiren725
Copy link

songyiren725 commented Mar 28, 2025 via email

@hardikdava
Copy link
Author

@songyiren725 Not working. Still getting same error.

@yaosheng216
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants