hustvl / Vim

Vision Mamba: Efficient Visual Representation Learning with Bidirectional State Space Model
Apache License 2.0
2.55k stars 159 forks source link

zope-interface>=5 #50

Open ZJier opened 3 months ago

ZJier commented 3 months ago

When I run "python setup.py install" in the mamba-1p1p1 folder, I get the following error: Processing dependencies for mamba-ssm==1.1.1 Searching for zope-interface>=5 Reading https://pypi.org/simple/zope-interface/ No local packages or working download links found for zope-interface>=5 error: Could not find suitable distribution for Requirement.parse('zope-interface>=5')

However, I have installed zope-interface==5 or zope-interface==6.2 and it still gives the same error. What is the reason for this? How can I fix it?

IamShubhamGupto commented 3 months ago

I faced the same issue with v1.1.0 I fixed it by manually cloning the latest release https://github.com/state-spaces/mamba/tree/v1.2.0 and running python3 setup.py install. it works

ZJier commented 3 months ago

I faced the same issue with v1.1.0 I fixed it by manually cloning the latest release https://github.com/state-spaces/mamba/tree/v1.2.0 and running python3 setup.py install. it works

Thank you so much, you are my savior 🫑! I have successfully installed v1.2.0!πŸ™Œ

However, when I tested the code (Test Code), there was a headache. Error: causal_conv1d_fwd(): incompatible function arguments. The following argument types are supported ... .

In fact, I have downloaded its whl and successfully installed it, version causal_conv1d-1.2.0.post2+cu118torch2.1cxx11abiFALSE-cp310-cp310-linux_x86_64.whl. Obviously, it's not working properly.

Have you encountered such a problem? Or are you also installing this version of causal_conv1d? I was a little tempted to back off because I could use the lower version of mamba, but I really wanted to try Vim 😡.

Test Code: import torch from mamba_ssm import Mamba batch, length, dim = 2, 64, 16 x = torch.randn(batch, length, dim).to("cuda") model = Mamba(

This module uses roughly 3 expand d_model^2 parameters

d_model=dim, # Model dimension d_model
d_state=16,  # SSM state expansion factor
d_conv=4,    # Local convolution width
expand=2,    # Block expansion factor

).to("cuda") y = model(x) assert y.shape == x.shape

IamShubhamGupto commented 3 months ago

Hey @ZJier

I tried the same code and had the same issue. I am running this code on Nvidia AGX Xavier and by default mamba_ssm and causal-conv1d did not support my GPU.

I just added support using these PRs and it works now. I would recommend you do the same for your GPU. After the edits, you need to reinstall mamba_ssm and causal-conv1d

Reference causal-conv1d PR - https://github.com/Dao-AILab/causal-conv1d/pull/20 mamba PR - https://github.com/state-spaces/mamba/pull/262 Nvidia CUDA compatibility - https://developer.nvidia.com/cuda-gpus

i hope this helps

ZJier commented 3 months ago

Hey @ZJier

I tried the same code and had the same issue. I am running this code on Nvidia AGX Xavier and by default mamba_ssm and causal-conv1d did not support my GPU.

I just added support using these PRs and it works now. I would recommend you do the same for your GPU. After the edits, you need to reinstall mamba_ssm and causal-conv1d

Reference causal-conv1d PR - Dao-AILab/causal-conv1d#20 mamba PR - state-spaces/mamba#262 Nvidia CUDA compatibility - https://developer.nvidia.com/cuda-gpus

i hope this helps

Thank you so much for answering all my questions.😺😺😺

I'm using a laptop, which seems to be a little different from the embedded system solution.πŸ€ͺ

I followed up on this error and found that the part parameters passed into the causal_conv1d_fwd() function seemed to be missing, preventing me from running the test code correctly.πŸ€”

I think the problem may still be related to the mamba and causal-conv1d library installation, although both versions are correct.

I have built a lot of new virtual environments, and I'm already using an older version of the mamba library, not vision mamba, which works fine.

I read the vision mamba paper, and I found that the transformer encoder in vision transformer is directly replaced with the state model in mamba (not vision mamba), and it has the prototype of vision mamba. This solution seemed to solve my problem from another Angle.

Thank you very much for your help again. Good luck to you 🫑!

Exception has occurred: TypeError causal_conv1d_fwd(): incompatible function arguments. The following argument types are supported:

  1. (arg0: torch.Tensor, arg1: torch.Tensor, arg2: Optional[torch.Tensor], arg3: Optional[torch.Tensor], arg4: Optional[torch.Tensor], arg5: Optional[torch.Tensor], arg6: bool) -> torch.Tensor