JCruan519 / VM-UNet

(ARXIV24) This is the official code repository for "VM-UNet: Vision Mamba UNet for Medical Image Segmentation".
Apache License 2.0
399 stars 13 forks source link

method 'selective_scan_fn' is not found #1

Open chankeh opened 5 months ago

chankeh commented 5 months ago

the log as follows : File "D:\ProgramData\Anaconda3\envs\torchseg\Lib\site-packages\torch\nn\modules\module.py", line 1527, in _call_impl return forward_call(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Administrator\Desktop\VM-UNet\models\vmunet\vmamba.py", line 464, in forward y1, y2, y3, y4 = self.forward_core(x) ^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Administrator\Desktop\VM-UNet\models\vmunet\vmamba.py", line 379, in forward_corev0 self.selective_scan = selective_scan_fn ^^^^^^^^^^^^^^^^^ NameError: name 'selective_scan_fn' is not defined

excucse me , can you provide the exact pretrained model ?

JCruan519 commented 5 months ago

@chankeh Hello, did you correctly install causal_conv1d==1.0.0 and mamba_ssm==1.0.1? Perhaps you can try installing with .whl files. [link: https://pan.baidu.com/s/1Uza8g1pkVcbXG1F-2tB0xQ?pwd=p3h9] Additionally, for the pre-training weights of ImageNet-1k, you can find them in the following link: https://github.com/MzeroMiko/VMamba

chankeh commented 5 months ago

@JCruan519 hi,thank u for ur reply , i'm using the windows platform,i tried to use the online install method and the offline whl to install ,but it didn't work , and the error shows as follows ,it seems that there are some problems in building process ...

Looking in indexes: https://pypi.mirrors.ustc.edu.cn/simple Collecting causal_conv1d==1.0.0 Using cached https://mirrors.bfsu.edu.cn/pypi/web/packages/f8/33/f43df821036ad5dd64a4697f37459c28855e5a387dfdae10c8b1d6053b32/causal_conv1d-1.0.0.tar.gz (6.4 kB) Preparing metadata (setup.py) ... done Requirement already satisfied: torch in d:\programdata\anaconda3\envs\vmunet\lib\site-packages (from causal_conv1d==1.0.0) (1.13.0+cu117) Requirement already satisfied: packaging in d:\programdata\anaconda3\envs\vmunet\lib\site-packages (from causal_conv1d==1.0.0) (23.2) Collecting ninja (from causal_conv1d==1.0.0) Using cached https://mirrors.bfsu.edu.cn/pypi/web/packages/b6/2f/a3bc50fa63fc4fe9348e15b53dc8c87febfd4e0c660fcf250c4b19a3aa3b/ninja-1.11.1.1-py2.py3-none-win_amd64.whl (312 kB) Requirement already satisfied: typing-extensions in d:\programdata\anaconda3\envs\vmunet\lib\site-packages (from torch->causal_conv1d==1.0.0) (4.9.0) Building wheels for collected packages: causal_conv1d Building wheel for causal_conv1d (setup.py) ... error error: subprocess-exited-with-error

× python setup.py bdist_wheel did not run successfully. │ exit code: 1 ╰─> [8 lines of output]

  torch.__version__  = 1.13.0+cu117

  running bdist_wheel
  Guessing wheel URL:  https://github.com/Dao-AILab/causal-conv1d/releases/download/v1.0.0/causal_conv1d-1.0.0+cu118torch1.13cxx11abiFALSE-cp38-cp38-win_amd64.whl
  error: <urlopen error [WinError 10060] 由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。>
  [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for causal_conv1d Running setup.py clean for causal_conv1d Failed to build causal_conv1d ERROR: Could not build wheels for causal_conv1d, which is required to install pyproject.toml-based projects

JCruan519 commented 5 months ago

@chankeh Hello, it seems that there is no .whl based on the Windows platform in the release of causal-conv1d [link: https://github.com/Dao-AILab/causal-conv1d/releases]. I suggest switching to the Linux platform to try this project.

cherhabilk426 commented 4 months ago

Hello, how to install causal_conv1d==1.0.0 and mamba_ssm==1.0.1? in windows10?

wangwxr commented 4 months ago

日志如下:文件“D:\ProgramData\Anaconda3\envs\torchseg\Lib\site-packages\torch\nn\modules\module.py”,第 1527 行,_call_impl返回 forward_call(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 文件“C:\Users\Administrator\Desktop\VM-UNet\models\vmunet\vmamba.py”,第 464 行,向前 y1、y2、y3、y4 = self.forward_core(x) ^^^^^^^^^^^^^^^^^^^^文件“C:\Users\Administrator\Desktop\VM-UNet\models\vmunet\vmamba.py”,第 379 行,forward_corev0 self.selective_scan = selective_scan_fn ^^^^^^^^^^^^^^^^^ NameError:未定义名称“selective_scan_fn”

请问我,你能提供确切的预训练模型吗?

您好,请问这个问题解决了吗?我也有这个问题,在ss2d模块的 def forward_corev0(self, x: torch.Tensor): self.selective_scan = selective_scan_fn 行报错。可能是因为代码中不包含这个函数。

JCruan519 commented 4 months ago

@cherhabilk426

Hello, currently the causal_conv1d and mamba_ssm libraries do not support the Windows platform. We recommend using the Linux platform, or staying updated on the following repositories: https://github.com/Dao-AILab/causal-conv1d/releases https://github.com/state-spaces/mamba/releases

JCruan519 commented 4 months ago

@kkkka149

Hello, have you correctly installed causal_conv1d and mamba_ssm?

If not, please follow these steps for installation:

  1. Choose a device with a Linux platform.
  2. Ensure your CUDA version is 11.8 or above, which can be checked by entering the command nvcc -V.
  3. Follow the installation steps in README.md to configure the environment.
wangwxr commented 4 months ago

thank you ,but i don't have a Linux device.Thank you, even so.

------------------ 原始邮件 ------------------ 发件人: "JCruan519/VM-UNet" @.>; 发送时间: 2024年3月2日(星期六) 上午10:51 @.>; 抄送: "Ghost @.**@.>; 主题: Re: [JCruan519/VM-UNet] method 'selective_scan_fn' is not found (Issue #1)

@kkkka149

Hello, have you correctly installed causal_conv1d and mamba_ssm?

If not, please follow these steps for installation:

Choose a device with a Linux platform.

Ensure your CUDA version is 11.8 or above, which can be checked by entering the command nvcc -V.

Follow the installation steps in README.md to configure the environment.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

tantian616 commented 4 months ago

@kkkka149

Hello, have you correctly installed causal_conv1d and mamba_ssm?

If not, please follow these steps for installation:

1. Choose a device with a Linux platform.

2. Ensure your CUDA version is 11.8 or above, which can be checked by entering the command nvcc -V.

3. Follow the installation steps in README.md to configure the environment.

你好,我也遇到了上述问题,但是我想我应该正确的安装了causal_conv1d==1.0.0 and mamba_ssm==1.0.1

屏幕截图 2024-03-03 154740 屏幕截图 2024-03-03 154625
CosmoWood commented 3 months ago

@kkkka149 Hello, have you correctly installed causal_conv1d and mamba_ssm? If not, please follow these steps for installation:

1. Choose a device with a Linux platform.

2. Ensure your CUDA version is 11.8 or above, which can be checked by entering the command nvcc -V.

3. Follow the installation steps in README.md to configure the environment.

你好,我也遇到了上述问题,但是我想我应该正确的安装了causal_conv1d==1.0.0 and mamba_ssm==1.0.1 屏幕截图 2024-03-03 154740 屏幕截图 2024-03-03 154625

Same as you.I installed and can be seen but sill 'NameError: name 'selective_scan_fn' is not defined '

mistletoe111 commented 3 months ago

i have met the same problem.i believe that the fun is not defined

ajie220209 commented 2 months ago

微信截图_20240506013354 I've made mamba work, but when I run the code I still get a NameError: name 'selective_scan_fn' is not defined The specific error report is as follows: Traceback (most recent call last): File "/home/cwj/cwj_projects/vm-unet/train.py", line 189, in main(config) File "/home/cwj/cwj_projects/vm-unet/train.py", line 86, in main cal_params_flops(model, 256, logger) File "/home/cwj/cwj_projects/vm-unet/utils.py", line 452, in cal_params_flops flops, params = profile(model, inputs=(input,)) File "/home/cwj/.conda/envs/cwj_py/lib/python3.10/site-packages/thop/profile.py", line 212, in profile model(inputs) File "/home/cwj/.conda/envs/cwj_py/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1511, in _wrapped_call_impl return self._call_impl(args, kwargs) File "/home/cwj/.conda/envs/cwj_py/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1520, in _call_impl return forward_call(*args, *kwargs) File "/home/cwj/cwj_projects/vm-unet/models/vmunet/vmunet.py", line 30, in forward logits = self.vmunet(x) File "/home/cwj/.conda/envs/cwj_py/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1511, in _wrapped_call_impl return self._call_impl(args, kwargs) File "/home/cwj/.conda/envs/cwj_py/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1520, in _call_impl return forward_call(*args, kwargs) File "/home/cwj/cwj_projects/vm-unet/models/vmunet/vmamba.py", line 760, in forward x, skip_list = self.forward_features(x) File "/home/cwj/cwj_projects/vm-unet/models/vmunet/vmamba.py", line 731, in forward_features x = layer(x) File "/home/cwj/.conda/envs/cwj_py/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1511, in _wrapped_call_impl return self._call_impl(*args, *kwargs) File "/home/cwj/.conda/envs/cwj_py/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1520, in _call_impl return forward_call(args, kwargs) File "/home/cwj/cwj_projects/vm-unet/models/vmunet/vmamba.py", line 554, in forward x = blk(x) File "/home/cwj/.conda/envs/cwj_py/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1511, in _wrapped_call_impl return self._call_impl(*args, kwargs) File "/home/cwj/.conda/envs/cwj_py/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1520, in _call_impl return forward_call(*args, *kwargs) File "/home/cwj/cwj_projects/vm-unet/models/vmunet/vmamba.py", line 492, in forward x = input + self.drop_path(self.self_attention(self.ln_1(input))) File "/home/cwj/.conda/envs/cwj_py/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1511, in _wrapped_call_impl return self._call_impl(args, kwargs) File "/home/cwj/.conda/envs/cwj_py/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1520, in _call_impl return forward_call(*args, **kwargs) File "/home/cwj/cwj_projects/vm-unet/models/vmunet/vmamba.py", line 464, in forward y1, y2, y3, y4 = self.forward_core(x) File "/home/cwj/cwj_projects/vm-unet/models/vmunet/vmamba.py", line 379, in forward_corev0 self.selective_scan = selective_scan_fn NameError: name 'selective_scan_fn' is not defined

mistletoe111 commented 2 months ago

我之前看到的博客时换掉那个包 用他们的包而不是pip过来的 这样就可以了 希望能帮到你

ajie220209 commented 2 months ago

能分享一下这个包或者博客链接嘛

mistletoe111 commented 2 months ago

明天发你  今天太晚了真得去睡了  你也早点休息😭

---Original--- From: @.> Date: Wed, May 8, 2024 00:37 AM To: @.>; Cc: @.**@.>; Subject: Re: [JCruan519/VM-UNet] method 'selective_scan_fn' is not found(Issue #1)

能分享一下这个包或者博客链接嘛

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

ajie220209 commented 2 months ago

好,晚安bro

wangwxr commented 2 months ago

能分享一下这个包或者博客链接嘛

你好 可以发一下吗

mistletoe111 commented 2 months ago

Hello, currently the causal_conv1d and mamba_ssm libraries do not support the Windows platform. We recommend using the Linux platform, or staying updated on the following repositories: https://github.com/Dao-AILab/causal-conv1d/releases https://github.com/state-spaces/mamba/releases

this

ajie220209 commented 2 months ago

您好,目前 causal_conv1d 和 mamba_ssm 库不支持 Windows 平台。我们建议使用 Linux 平台,或随时更新以下存储库: https://github.com/Dao-AILab/causal-conv1d/releases https://github.com/state-spaces/mamba/releases

I transferred the project to the remote server (linx system), it seems that it can't run, is it because of this reason? But if I use the wsl system, I can run the project, which makes me wonder.

Chang688 commented 1 month ago

您好?请问您解决这个问题了吗?如果解决的话可以告诉我下吗 ?

Chang688 commented 1 month ago

@tantian616 您好?请问您解决这个问题了吗?如果解决的话可以告诉我下吗 ?

Chang688 commented 1 month ago

@ajie220209 您好?请问您解决这个问题了吗?如果解决的话可以告诉我下吗 ?

ajie220209 commented 1 month ago

@ajie220209 您好?请问您解决这个问题了吗?如果解决的话可以告诉我下吗 ?

I guess so, but it's still using linx, I'm using wsl

ifyouarelihua commented 2 weeks ago

@kkkka149 您好,您是否正确安装了 causal_conv1d 和 mamba_ssm? 如果没有,请按照以下步骤进行安装:

1. Choose a device with a Linux platform.

2. Ensure your CUDA version is 11.8 or above, which can be checked by entering the command nvcc -V.

3. Follow the installation steps in README.md to configure the environment.

你好,我也遇到了上述问题,但是我想我应该正确的安装了causal_conv1d==1.0.0 and mamba_ssm==1.0.1 屏幕截图 2024-03-03 154740 屏幕截图 2024-03-03 154625

Hello, I think I have installed these two installation packages, but selective_scan still reports an error.If you have managed to solve this problem, please let me know how, thanks!