hustvl / Vim

[ICML 2024] Vision Mamba: Efficient Visual Representation Learning with Bidirectional State Space Model
Apache License 2.0
2.56k stars 160 forks source link

can't find the bi-directional mamba #11

Closed pengzhangzhi closed 5 months ago

pengzhangzhi commented 5 months ago

Hi there, your vim is impressive! I had a great read of the paper and the code! I am trying to follow the bi-directional mamba but can't find where the code is. I looked https://github.com/hustvl/Vim/blob/main/vim/models_mamba.py

eclipse0922 commented 5 months ago

I am not the author of the paper. But as far as I understood. They seem to have fixed the mamba_ssm/mamba_simplecode for bidirectional mamba.

 # bidirectional
assert bimamba_type == "v2"
  if self.use_fast_path and inference_params is None:  # Doesn't support outputting the states
            if self.bimamba_type == "v2":
                A_b = -torch.exp(self.A_b_log.float())

https://github.com/hustvl/Vim/blob/main/mamba/mamba_ssm/modules/mamba_simple.py

The original Mamba implementation does not have the variable and associated code above. https://github.com/state-spaces/mamba/blob/main/mamba_ssm/modules/mamba_simple.py

pengzhangzhi commented 5 months ago

oh yeah! thanks!

87831743Sakura commented 3 months ago

The code indeed contains the implementation of the bidirectional Mamba module. However, why have I never executed these lines of code during debugging?

87831743Sakura commented 3 months ago

The link https://github.com/hustvl/Vim/blob/main/mamba/mamba_ssm/modules/mamba_simple.py is also broken.

arelkeselbri commented 2 months ago

Try https://github.com/hustvl/Vim/blob/main/mamba-1p1p1/mamba_ssm/modules/mamba_simple.py