MzeroMiko / VMamba

VMamba: Visual State Space Models,code is based on mamba
MIT License
2.17k stars 136 forks source link

Expected u.is_cuda to be true,but got false #106

Open woshio opened 7 months ago

woshio commented 7 months ago

Hello author,I am a beginner in deep learning and recently read vmamba's paper. I tried to add vmamba's basic module VSSBlock to other models. The result showed that Expected u.iscuda to be true, but got false. Why is that? I have imported the VSSblock model into cuda. I don't know why it can't load, or can you tell me how to reference VSSblock to other models smoothly?Hope to get your answer, thank you.

woshio commented 7 months ago

I have solved this problem, but there is another problem, the library I downloaded does not have the two packages causal_conv1d_cuda and selective_scan_cuda, could you please provide the latest causal_conv1d.whl and mamba_ssm.whl files?

MzeroMiko commented 7 months ago

Actually you do not have to install those two packages if you just want to use the model. You can use selectve_scan_cuda_oflex to skip that.

woshio commented 7 months ago

Hello author, sorry to bother you again. After my observation, I found that the reason for this issue is that I am missing the selective_scan_cuda library. The torch version I installed is 1.13.0, with cuda=11.7. Causal_conv1d=1.0.0, mamba_ssm=1.0.1. How to install the selective_scan_cuda package?

MzeroMiko commented 7 months ago

CPU is not supported by the package selective_scan_cuda_oflex or mamba_ssm, so make sure you are using GPU.

To install selective_scan_cuda_oflex, you can cd into that directory and pip install ..

To install mamba_ssm, you can refer to mamba.

You can choose to install one of mamba_ssm or selective_scan_cuda_oflex, both works fine, with only speed difference.

woshio commented 7 months ago

CPU is not supported by the package selective_scan_cuda_oflex or mamba_ssm, so make sure you are using GPU.

To install selective_scan_cuda_oflex, you can cd into that directory and pip install ..

To install mamba_ssm, you can refer to mamba.

You can choose to install one of mamba_ssm or selective_scan_cuda_oflex, both works fine, with only speed difference. I have installed mamba_ssm, but the above error is still reported. I can't find the directory 'selective_scan_cuda_oflex', which directory do I want to go to?

MzeroMiko commented 7 months ago

are you talking about the error below?

The result showed that Expected u.iscuda to be true, but got false. 

It seems like because you have not put the model in cuda.

woshio commented 7 months ago

are you talking about the error below?

The result showed that Expected u.iscuda to be true, but got false. 

It seems like because you have not put the model in cuda. yes,I have imported the model to cuda, The error occurred in 'mamba_ssm/ops/selective_scan_interface.py', which contains a line of code 'import selective_scan_cuda', but I can't find the library 'selective_scan_cuda'

zjc24 commented 7 months ago

Hello author,I am a beginner in deep learning and recently read vmamba's paper. I tried to add vmamba's basic module VSSBlock to other models. The result showed that Expected u.iscuda to be true, but got false. Why is that? I have imported the VSSblock model into cuda. I don't know why it can't load, or can you tell me how to reference VSSblock to other models smoothly?Hope to get your answer, thank you.

Hello, I encountered the same issue as you did. Could you please share how you resolved it? Thank you very much!

woshio commented 7 months ago

Hello author,I am a beginner in deep learning and recently read vmamba's paper. I tried to add vmamba's basic module VSSBlock to other models. The result showed that Expected u.iscuda to be true, but got false. Why is that? I have imported the VSSblock model into cuda. I don't know why it can't load, or can you tell me how to reference VSSblock to other models smoothly?Hope to get your answer, thank you.

Hello, I encountered the same issue as you did. Could you please share how you resolved it? Thank you very much!

Sorry, I didn't solve this problem. Do you have qq or wechat? We can communicate on wechat.

YuanXuhua commented 7 months ago

I have solved this problem, but there is another problem, the library I downloaded does not have the two packages causal_conv1d_cuda and selective_scan_cuda, could you please provide the latest causal_conv1d.whl and mamba_ssm.whl files?

你好,想请问原问题如何解决的,我目前也遇到了同样的问题。

kpyon-w commented 7 months ago

如果测试模型的话,记得把模型放入cudamodel = mamba().cuda(), 同时,作为测试的tensor也要放入cuda:x = x.cuda(),就可以了

xinxin102299 commented 5 months ago

RuntimeError: Expected u.is_cuda() to be true, but got false. (Could this error message be improved? If so, please report an enhancement request to PyTorch.) 你好,想请问原问题如何解决的,我目前也遇到了同样的问题

woshio commented 5 months ago

RuntimeError: Expected u.is_cuda() to be true, but got false. (Could this error message be improved? If so, please report an enhancement request to PyTorch.) 你好,想请问原问题如何解决的,我目前也遇到了同样的问题

你DeBug一下,是模型和数据不在一个设备上

Luchen-077 commented 1 month ago

RuntimeError: Expected u.is_cuda() to be true, but got false. (Could this error message be improved? If so, please report an enhancement request to PyTorch.) 你好,想请问原问题如何解决的,我目前也遇到了同样的问题

你DeBug一下,是模型和数据不在一个设备上

你好,我目前遇到同样的问题,能说详细些如何做吗?或者是否有相关教程的链接