MzeroMiko / VMamba

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

I do not have selective_scan_cuda_oflex but have selective_scan_cuda_core. What should I do? #216

Open AliasChenYi opened 4 weeks ago

AliasChenYi commented 4 weeks ago

I do not have selective_scan_cuda_oflex but have selective_scan_cuda_core. What should I do? image image

MzeroMiko commented 3 weeks ago

Have you tried install the selective_scan in folder kernel/selective_scan ?

AliasChenYi commented 3 weeks ago

Yes,and pip install .

---Original--- From: "Liu @.> Date: Tue, Jun 4, 2024 20:04 PM To: @.>; Cc: @.**@.>; Subject: Re: [MzeroMiko/VMamba] I do not have selective_scan_cuda_oflex buthave selective_scan_cuda_core. What should I do? (Issue #216)

Have you tried install the selective_scan in folder kernel/selective_scan ?

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

MzeroMiko commented 3 weeks ago

Can you show me the output you got?

AliasChenYi commented 3 weeks ago

Have you tried install the selective_scan in folder kernel/selective_scan ? Yes,First,I enter into kernel/selective_scan,Second, I execute pip install . Finally return success, and last but not least return the missing package

AliasChenYi commented 3 weeks ago

你能告诉我你得到的输出吗?

My last output forgot to save the screenshot, but I remember it returned successful. image

MzeroMiko commented 3 weeks ago

ok. try excuting this line:

python -c "import torch; import selective_scan_cuda_oflex; print(123)"

MzeroMiko commented 3 weeks ago

wait, the version is "selective-scan 0.0.2" not 0.01.

AliasChenYi commented 3 weeks ago

ok. try excuting this line:

python -c "import torch; import selective_scan_cuda_oflex; print(123)" please look this. image

AliasChenYi commented 3 weeks ago

wait, the version is "selective-scan 0.0.2" not 0.01.

ok. try excuting this line:

python -c "import torch; import selective_scan_cuda_oflex; print(123)" Ah,how can i upgrade.

MzeroMiko commented 3 weeks ago

Have you tried install the selective_scan in folder kernel/selective_scan ? Yes,First,I enter into kernel/selective_scan,Second, I execute pip install . Finally return success, and last but not least return the missing package

Do this again and show me what happens.

AliasChenYi commented 3 weeks ago

您是否尝试过在文件夹 kernel/selective_scan 中安装selective_scan?是的,首先,我进入内核/selective_scan,其次,我执行pip install。最后返回成功,最后但并非最不重要的一点是返回丢失的包

再做一次,告诉我会发生什么。 Ok, I'll do it right now. Please wait for me.

AliasChenYi commented 3 weeks ago

您是否尝试过在文件夹 kernel/selective_scan 中安装selective_scan?是的,首先,我进入内核/selective_scan,其次,我执行pip install。最后返回成功,最后但并非最不重要的一点是返回丢失的包

再做一次,告诉我会发生什么。 please see. image

aifeixingdelv commented 3 weeks ago

I also meet the same problem.

AliasChenYi commented 3 weeks ago

I also meet the same problem.

Have you solved it yet

aifeixingdelv commented 3 weeks ago

I feel the install step in the readme may have some problem. After “pip install .”, the environment has the "selective-scan" package , not selective_scan_cuda_oflex or selective_scan_cuda_core

MzeroMiko commented 3 weeks ago

I see. Since we've update our code greatly in last several months, only change the model file is not working anymore. You may need to update the whole package.

MzeroMiko commented 3 weeks ago

I feel the install step in the readme may have some problem. After “pip install .”, the environment has the "selective-scan" package , not selective_scan_cuda_oflex or selective_scan_cuda_core

ok. try excuting this line: python -c "import torch; import selective_scan_cuda_oflex; print(123)"

AliasChenYi commented 3 weeks ago

I see. Since we've update our code greatly in last several months, only change the model file is not working anymore. You may need to update the whole package. Maybe I can change this to 0.0.2??? image

aifeixingdelv commented 3 weeks ago

I feel the install step in the readme may have some problem. After “pip install .”, the environment has the "selective-scan" package , not selective_scan_cuda_oflex or selective_scan_cuda_core

ok. try excuting this line: python -c "import torch; import selective_scan_cuda_oflex; print(123)"

Thank you for your reply, but it shows that it cannot be imported selective_scan_cuda_oflex

AliasChenYi commented 3 weeks ago

明白了。由于我们在过去几个月中对代码进行了大量更新,因此仅更改模型文件不再起作用。您可能需要更新整个程序包。

Thank you for your help. I downloaded the update on May 18th

aifeixingdelv commented 3 weeks ago

I feel the install step in the readme may have some problem. After “pip install .”, the environment has the "selective-scan" package , not selective_scan_cuda_oflex or selective_scan_cuda_core

ok. try excuting this line: python -c "import torch; import selective_scan_cuda_oflex; print(123)"

I want to know if in the author’s environment, the showed package is selective-scan-0.x.x or selective_scan_cuda_oflex... Because I find “import selective_scan_cuda_core” in the code, not "import selective-scan"

AliasChenYi commented 3 weeks ago

image I upgread 0.0.2 and try excuting this line: python -c "import torch; import selective_scan_cuda_oflex; print(123)",still shows that it cannot be imported selective_scan_cuda_oflex.

aifeixingdelv commented 3 weeks ago

image I upgread 0.0.2 and try excuting this line: python -c "import torch; import selective_scan_cuda_oflex; print(123)",still shows that it cannot be imported selective_scan_cuda_oflex.

I solved it

aifeixingdelv commented 3 weeks ago

In tne readme, “pip install -r requirements.txt cd kernels/selective_scan && pip install ." should be changed to “pip install -r requirements.txt cd kernels/selective_scan && python setup.py build && python setup.py install"

After that, you can import selective_scan_cuda_oflex sucessfully

AliasChenYi commented 3 weeks ago

图像我更新了 0.0.2 并尝试执行此行:python -c “import torch;进口selective_scan_cuda_oflex;print(123)“,仍然显示无法导入selective_scan_cuda_oflex。

我解决了 oh, you're amazing. What did you try? Can you share? It's been bothering me for 15 days.

AliasChenYi commented 3 weeks ago

@MzeroMiko @AliasChenYi In tne readme, “pip install -r requirements.txt cd kernels/selective_scan && pip install ." should be changed to “pip install -r requirements.txt cd kernels/selective_scan && python setup.py build && python setup.py install"

After that, you can import selective_scan_cuda_oflex sucessfully

In tne readme, “pip install -r requirements.txt cd kernels/selective_scan && pip install ." should be changed to “pip install -r requirements.txt cd kernels/selective_scan && python setup.py build && python setup.py install"

After that, you can import selective_scan_cuda_oflex sucessfully

Does the version need to be changed to 0.0.2

aifeixingdelv commented 3 weeks ago

@MzeroMiko @AliasChenYi In tne readme, “pip install -r requirements.txt cd kernels/selective_scan && pip install ." should be changed to “pip install -r requirements.txt cd kernels/selective_scan && python setup.py build && python setup.py install" After that, you can import selective_scan_cuda_oflex sucessfully

In tne readme, “pip install -r requirements.txt cd kernels/selective_scan && pip install ." should be changed to “pip install -r requirements.txt cd kernels/selective_scan && python setup.py build && python setup.py install" After that, you can import selective_scan_cuda_oflex sucessfully

Does the version need to be changed to 0.0.2

I don't change

AliasChenYi commented 3 weeks ago

@MzeroMiko @AliasChenYi In tne readme, “pip install -r requirements.txt cd kernels/selective_scan && pip install ." should be changed to “pip install -r requirements.txt cd kernels/selective_scan && python setup.py build && python setup.py install" After that, you can import selective_scan_cuda_oflex sucessfully

In tne readme, “pip install -r requirements.txt cd kernels/selective_scan && pip install ." should be changed to “pip install -r requirements.txt cd kernels/selective_scan && python setup.py build && python setup.py install" After that, you can import selective_scan_cuda_oflex sucessfully

Does the version need to be changed to 0.0.2

I don't change

Thank you very much. I'll try it now

MzeroMiko commented 3 weeks ago

"pip install ." is ok. "python setup.py install" is ok too. but the later will throw a warning.

aifeixingdelv commented 3 weeks ago

"pip install ." is ok. "python setup.py install" is ok too. but the later will throw a warning.

oh, I find the same... Sorry

AliasChenYi commented 3 weeks ago

“pip install .”是可以的。“python setup.py install”也可以。但后者会发出警告。

哦,我发现一样......不好意思 I tried, but it didn't work out

AliasChenYi commented 3 weeks ago

I'm very sad.

aifeixingdelv commented 3 weeks ago

I want to know why selective_scan_cuda_oflex can import successfully, selective_scan_cuda_core can’t However,in csms6s.py,SelectiveScanCore class use selective_scan_cuda_core

MzeroMiko commented 3 weeks ago

I want to know why selective_scan_cuda_oflex can import successfully, selective_scan_cuda_core can’t However,in csms6s.py,SelectiveScanCore class use selective_scan_cuda_core

As selective_scan_core is not used now, and will not be used anymore in the future, I disable it in setup.py to raise the compiling speed.

You can re-enable it by change MODES = ["oflex"] in line 40 in setup.py to MODES = ["oflex", "core"]

aifeixingdelv commented 3 weeks ago

I get it. I find my problem. In the vmamba.py 485: v2=partial(self.forward_corev2, force_fp32=(not self.disable_force32), SelectiveScan=SelectiveScanCore) should be changed to v2=partial(self.forward_corev2, force_fp32=(not self.disable_force32), SelectiveScan=SelectiveScanOflex) because SelectiveScanCore has been droped is it right? @MzeroMiko Thank you very much

MzeroMiko commented 3 weeks ago

Yes, you are right.

AliasChenYi commented 3 weeks ago

I have also solved, thank you so much!!! ❥(^_-)

LQchen1 commented 3 weeks ago

I get it. I find my problem. In the vmamba.py 485: v2=partial(self.forward_corev2, force_fp32=(not self.disable_force32), SelectiveScan=SelectiveScanCore) should be changed to v2=partial(self.forward_corev2, force_fp32=(not self.disable_force32), SelectiveScan=SelectiveScanOflex) because SelectiveScanCore has been droped is it right? @MzeroMiko Thank you very much

image

Sorry, I don't quite understand why I need to replace it, I configured the environment on my PC today and ran the model of vmambav2_tiny_224.yaml configuration file, SelectiveScan=SelectiveScanCore works fine on my PC. And on github, the source code is still SelectiveScan=SelectiveScanCore

aifeixingdelv commented 3 weeks ago

Like the author said, maybe in the latest selective-scan version, the SelectScanCore has been dropped considering the inference speed. So running it in your own pc, maybe install the old version selective-scan or mamba-ssm library?

LQchen1 commented 3 weeks ago

@aifeixingdelv
image Curiously, I saw the author's code in setup.py, which only contains "oflex", but with the configuration file set to "vmambav2_tiny_224.yaml", The command v2=partial(self.forward_corev2, force_fp32=(not self.disable_force32), SelectiveScan=SelectiveScanCore), I downloaded the source code this afternoon and set up the environment, and successfully run it, I do not seem to find the problem here, normally according to the author's words, my program can not be executed successfully.

aifeixingdelv commented 3 weeks ago

https://github.com/MzeroMiko/VMamba/blob/32b2cbe07cf5e3c1234beffc549ab1c1e1080082/classification/configs/vssm/vmambav2_tiny_224.yaml#L1-L17 In the vmambav2_tiny_224.yaml, SSM_FORWARDTYPE is "v05_noz" https://github.com/MzeroMiko/VMamba/blob/32b2cbe07cf5e3c1234beffc549ab1c1e1080082/classification/models/vmamba.py#L455-L478 In the code, the v05_noz SSM_FORWARDTYPE will use SelectiveScanOflex. So, it's normal to run it successfully? do you get it?

LQchen1 commented 3 weeks ago

https://github.com/MzeroMiko/VMamba/blob/32b2cbe07cf5e3c1234beffc549ab1c1e1080082/classification/configs/vssm/vmambav2_tiny_224.yaml#L1-L17

In the vmambav2_tiny_224.yaml, SSM_FORWARDTYPE is "v05_noz" https://github.com/MzeroMiko/VMamba/blob/32b2cbe07cf5e3c1234beffc549ab1c1e1080082/classification/models/vmamba.py#L455-L478

In the code, the v05_noz SSM_FORWARDTYPE will use SelectiveScanOflex. So, it's normal to run it successfully? do you get it?

Ok, thank you very much, I didn't look at the parameters of the code, I thought V2= "V2"

MzeroMiko commented 3 weeks ago

I get it. I find my problem. In the vmamba.py 485: v2=partial(self.forward_corev2, force_fp32=(not self.disable_force32), SelectiveScan=SelectiveScanCore) should be changed to v2=partial(self.forward_corev2, force_fp32=(not self.disable_force32), SelectiveScan=SelectiveScanOflex) because SelectiveScanCore has been droped is it right? @MzeroMiko Thank you very much

image

Sorry, I don't quite understand why I need to replace it, I configured the environment on my PC today and ran the model of vmambav2_tiny_224.yaml configuration file, SelectiveScan=SelectiveScanCore works fine on my PC. And on github, the source code is still SelectiveScan=SelectiveScanCore

You do not have to replace it, as we finally use forwardtype v05 rather than v2.

MzeroMiko commented 3 weeks ago

Like the author said, maybe in the latest selective-scan version, the SelectScanCore has been dropped considering the inference speed. So running it in your own pc, maybe install the old version selective-scan or mamba-ssm library?

The SelectScanCore has no relation with inference speed, but compiling speed (i.e. the time spend when running pip install .). The more functions you compile, the more time you should spend.