pharmapsychotic / clip-interrogator

Image to prompt with BLIP and CLIP

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The size of tensor a (64) must match the size of tensor b (4096) at non-singleton dimension 0

adventseo opened this issue · comments

After I get The size of tensor a (64) must match the size of tensor b (4096) at non-singleton dimension 0, I then get out of memory error if I rerun on Colab. It was working flawlessly until I interrupted a job, but I don't know why that would matter since I have re-run it on multiple computers.
Screenshot

Assuming this is the same cause of the The size of tensor a (8) must match the size of tensor b (64) at non-singleton dimension 0 error I've seen on my environment, I resolved this error by downgrading to Transformers 4.26.1

Upgrading to Transformers>=4.27 causes this error with that matmul line in BLIP, so it must be incompatible.

!pip install torch
!pip install torchvision
!pip install transformers==4.15.0
!pip install open_clip_torch
!pip install clip-interrogator==0.5.0

Fixed the issue for me, thanks everyone, especially @bradley-pearson6597 for the solution