MzeroMiko / VMamba

VMamba: Visual State Space Models,code is based on mamba

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

关于运行速度

chenzean opened this issue · comments

作者,你好,
我想问一下关于mamba中使用mamba-ssm库中的SS2D运行速度超级慢(快一分钟了也没有迭代一个)。是否可以采用作者你的代码进行加速呢?

此外,想问一下作者关于csms6s.py中存在三个函数即SelectiveScanOflex和SelectiveScanCore以及SelectiveScanMamba。我想问一下作者这三者之间有什么区别?似乎我无法查看selective_scan_cuda这种函数。

when ss2d is extremely slow, it is often the case that your environment has something wrong. selective_scan_oflex is slightly faster only in our cases (i.e. SS2D).

SelectiveScanCore is a simplified version of SelectiveScanMamba, which delete some features from SelectiveScanMamba.

SelectiveScanOflex supports input float16 and output float32, it is faster compared to input float32 and output float32, and also almost as stable as the latter does. While input float16 and output float16 often leads to NaN in many cases.

作者,您说:when ss2d is extremely slow, it is often the case that your environment has something wrong.想问一下要如何查看自己的环境是否出现问题。因为它可以run SS2D所以不知道如何去查看错误。(使用作者你写的文件结合我自己的任务只需要运行2个小时,而使用官方实现的则是很长很长时间)
此外,我想问一下如果我想修改扫描路径,而且想提高运行速度是不是要修改csm_triton.py这个文件。
谢谢作者的回复!!!

  1. it is weird. Can you install mamba_ssm from source (not from pip or prebuilt wheels)?
  2. yes. If you want to change the scan path, you can simply change the csms6s.py.

好滴,谢谢作者的回复
关于第一个问题:我等会去试试。
关于第二个问题但是我想保持您写的代码运行速度也是只需要修改csms6s.py就可以了嘛?因为我在使用您写的代码的时候我选择v05版本,里面好像是使用CrossTriton和CrossMergeTrtion。

作者,你好,
我去尝试了重新安装,发现还是运行速度很慢。但是运行您写的就很快。最终还是选择您写的代码。我们在将来的工作中引用您的工作。
此外,关于您在最新的vmamba.py中写了
image
想问一下作者在论文中提到V9版本是哪一个呢?
感谢作者的回复!!!

  1. Cuda version is the fastest version, but I am not good at writing cuda code: I can write it to be right, but I can not write it to be efficient. So I choose Triton, a package for parallel-programing beginners.
  2. V9 is actually the version combined with v05 and 'ln2d', which is corresponding to the config classification/configs/vssm/vmambav2_tiny_224.yaml

好滴,感谢作者的回复

  1. 关于作者您写的代码和官方实现的版本,我这这边进行对比,发现,您写的代码在我的任务中只需要更小的显存,更快的速度。(刚刚测试了一下v01-v05均快于官方的代码,而且版本)。
  2. 好滴,我这就去看看
  3. 关于扫描路径的问题,我想使用一下的方式进行扫描。
    image
    我先尝试自己写一写,如果有问题的话,可以再和作者联系

最后,非常感谢作者的指导,在将来的工作中会引用您的工作。

作者,你好,
我想问一下在VSSBlock中的use_checkpoint是否不影响训练和测试?

作者,你好,我还有一个问题。
在SS2D中d_state的设置,我看配置文件中设置为了1。
想问一下作者,这个参数的设置需要考虑哪些因素呢?

  1. Sorry, I did not try use_checkpoint.

  2. d_state is set to 1 mainly because we want a higher speed. You can refer to the table below for more infomation:

image

好滴,我明白了。非常感谢作者的回复。