terrypei / efficientvmamba Goto Github PK
View Code? Open in Web Editor NEWCode Implementation of EfficientVMamba
Code Implementation of EfficientVMamba
Why does it prompt No module named 'selective_scan_vmamba_pt202 when I correctly installed selective_scan
Hi,If i want to change the selctive_scan way,that mean i need change this file? just change this file is ok? Thx
https://github.com/TerryPei/EfficientVMamba/blob/main/selective_scan/selective_scan/selective_scan_interface.py
Hi, I'm trying to use your code as a backbone and load the pre-training weights, but have found some issues.
I have not modified anything in efficientVMamba.py and the environment is configured correctly. I refer to your loading method in detection/test_ckpt.py
and the code is as follows when I load it:
# image_encoder = Backbone_EfficientVSSM( pretrained='checkpoints/efficient_vmamba_tiny.ckpt' )
# image_encoder = Backbone_EfficientVSSM( pretrained='checkpoints/efficient_vmamba_small.ckpt' )
image_encoder = Backbone_EfficientVSSM( pretrained='checkpoints/efficient_vmamba_base.ckpt' )
And to verify that it was loaded correctly, I changed just one line of code in Class Backbone_EfficientVSSM in efficientVMamba.py as follows:
# incompatibleKeys = self.load_state_dict(new_state_dict, strict=False) #your before
incompatibleKeys = self.load_state_dict(new_state_dict, strict=True) # changed by me
But I found the following error reported:
Successfully loaded checkpoint from checkpoints/efficient_vmamba_base.ckpt
Failed loading checkpoint from checkpoints/efficient_vmamba_base.ckpt: Error(s) in loading state_dict for Backbone_EfficientVSSM:
Missing key(s) in state_dict: "layers.0.blocks.0.norm2.weight", "layers.0.blocks.0.norm2.bias", "layers.0.blocks.0.mlp.fc1.weight", "layers.0.blocks.0.mlp.fc1.bias", "layers.0.blocks.0.mlp.fc2.weight", "layers.0.blocks.0.mlp.fc2.bias", "layers.0.blocks.1.norm2.weight", "layers.0.blocks.1.norm2.bias", "layers.0.blocks.1.mlp.fc1.weight", "layers.0.blocks.1.mlp.fc1.bias", "layers.0.blocks.1.mlp.fc2.weight", "layers.0.blocks.1.mlp.fc2.bias", "layers.0.downsample.1.weight", "layers.0.downsample.1.bias", "layers.0.downsample.3.weight", "layers.0.downsample.3.bias", "layers.1.blocks.0.norm2.weight", "layers.1.blocks.0.norm2.bias", "layers.1.blocks.0.mlp.fc1.weight", "layers.1.blocks.0.mlp.fc1.bias", "layers.1.blocks.0.mlp.fc2.weight", "layers.1.blocks.0.mlp.fc2.bias", "layers.1.blocks.1.norm2.weight", "layers.1.blocks.1.norm2.bias", "layers.1.blocks.1.mlp.fc1.weight", "layers.1.blocks.1.mlp.fc1.bias", "layers.1.blocks.1.mlp.fc2.weight", "layers.1.blocks.1.mlp.fc2.bias", "layers.1.downsample.1.weight", "layers.1.downsample.1.bias", "layers.1.downsample.3.weight", "layers.1.downsample.3.bias", "layers.2.11.1.weight", "layers.2.11.1.bias", "layers.2.11.3.weight", "layers.2.11.3.bias", "outnorm0.weight", "outnorm0.bias", "outnorm1.weight", "outnorm1.bias", "outnorm2.weight", "outnorm2.bias", "outnorm3.weight", "outnorm3.bias".
Unexpected key(s) in state_dict: "classifier.norm.weight", "classifier.norm.bias", "classifier.head.weight", "classifier.head.bias", "layers.0.downsample.reduction.weight", "layers.0.downsample.norm.weight", "layers.0.downsample.norm.bias", "layers.1.downsample.reduction.weight", "layers.1.downsample.norm.weight", "layers.1.downsample.norm.bias", "layers.2.11.reduction.weight", "layers.2.11.norm.weight", "layers.2.11.norm.bias".
The similar problem occurs when loading the other two weights. May I ask if there is a mismatch between the currently uploaded weights and the model code? Or am I missing something? Looking forward to your reply, thanks!
Thank you for your work. What about the inference speed of EfficientVmamba?
Hi,
Thank you for sharing your great work!
I would like to know how to calculate the computation of vision mamba, could you also provide the code or instructions for calculating the FLOPs in the table?
Thanks!
Tony
Thanks for your great work !!
And I wonder where this data VMamba-T 2.4(param) 0.9(gflops) 72.1(top@1)
comes from?
Did you train VMamba-T on your own Dim=[48, 96, 192, 384] Stage=[2, 2, 4, 2]
to get this version?
No offense, just curious :)
Maybe I missed some paragraphs that talks about this.
Thank you for your interesting work.
I have one issue when running the model in the: EfficientVMamba/classification/lib/models/init.py
from . import vmamba_mobile
ImportError: cannot import name 'vmamba_mobile' from partially initialized module 'lib.models'
Could you update this code? Thank you so much!
Hello, thank you very much for your work, I am very interested in your work, but I have a problem in this step --"cd selective_scan && pip install . && pytest" , I would like to ask you how to solve it.
The following is a detailed error report.
`
Building wheel for selective-scan (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [64 lines of output]
torch.__version__ = 2.0.1+cu118
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-cpython-310
creating build/lib.linux-x86_64-cpython-310/selective_scan
copying selective_scan/selective_scan_interface.py -> build/lib.linux-x86_64-cpython-310/selective_scan
copying selective_scan/__init__.py -> build/lib.linux-x86_64-cpython-310/selective_scan
running build_ext
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "/mnt/d/AIPRO/EfficientVMamba-main/selective_scan/setup.py", line 108, in <module>
setup(
File "/home/yjl/anaconda3/envs/Cell_SAM/lib/python3.10/site-packages/setuptools/__init__.py", line 103, in setup
return distutils.core.setup(**attrs)
File "/home/yjl/anaconda3/envs/Cell_SAM/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 185, in setup
return run_commands(dist)
File "/home/yjl/anaconda3/envs/Cell_SAM/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
dist.run_commands()
File "/home/yjl/anaconda3/envs/Cell_SAM/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
self.run_command(cmd)
File "/home/yjl/anaconda3/envs/Cell_SAM/lib/python3.10/site-packages/setuptools/dist.py", line 989, in run_command
super().run_command(command)
File "/home/yjl/anaconda3/envs/Cell_SAM/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
cmd_obj.run()
File "/home/yjl/anaconda3/envs/Cell_SAM/lib/python3.10/site-packages/wheel/bdist_wheel.py", line 364, in run
self.run_command("build")
File "/home/yjl/anaconda3/envs/Cell_SAM/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
self.distribution.run_command(command)
File "/home/yjl/anaconda3/envs/Cell_SAM/lib/python3.10/site-packages/setuptools/dist.py", line 989, in run_command
super().run_command(command)
File "/home/yjl/anaconda3/envs/Cell_SAM/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
cmd_obj.run()
File "/home/yjl/anaconda3/envs/Cell_SAM/lib/python3.10/site-packages/setuptools/_distutils/command/build.py", line 131, in run
self.run_command(cmd_name)
File "/home/yjl/anaconda3/envs/Cell_SAM/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
self.distribution.run_command(command)
File "/home/yjl/anaconda3/envs/Cell_SAM/lib/python3.10/site-packages/setuptools/dist.py", line 989, in run_command
super().run_command(command)
File "/home/yjl/anaconda3/envs/Cell_SAM/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
cmd_obj.run()
File "/home/yjl/anaconda3/envs/Cell_SAM/lib/python3.10/site-packages/setuptools/command/build_ext.py", line 88, in run
_build_ext.run(self)
File "/home/yjl/anaconda3/envs/Cell_SAM/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 345, in run
self.build_extensions()
File "/home/yjl/anaconda3/envs/Cell_SAM/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 485, in build_extensions
compiler_name, compiler_version = self._check_abi()
File "/home/yjl/anaconda3/envs/Cell_SAM/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 869, in _check_abi
_, version = get_compiler_abi_compatibility_and_version(compiler)
File "/home/yjl/anaconda3/envs/Cell_SAM/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 337, in get_compiler_abi_compatibility_and_version
if not check_compiler_ok_for_platform(compiler):
File "/home/yjl/anaconda3/envs/Cell_SAM/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 291, in check_compiler_ok_for_platform
which = subprocess.check_output(['which', compiler], stderr=subprocess.STDOUT)
File "/home/yjl/anaconda3/envs/Cell_SAM/lib/python3.10/subprocess.py", line 421, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File "/home/yjl/anaconda3/envs/Cell_SAM/lib/python3.10/subprocess.py", line 526, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['which', 'g++']' returned non-zero exit status 1.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for selective-scan
Running setup.py clean for selective-scan
Failed to build selective-scan
ERROR: Could not build wheels for selective-scan, which is required to install pyproject.toml-based projects
`
It seems that your 4 directional scans do not have the backward directions. Why?
When will the code be released
Have you used the vim-b pre-trained model, and if you have used it, can it be made public, thank you!
Failed to build selective-scan
ERROR: Could not build wheels for selective-scan, which is required to install pyproject.toml-based projects
Hi! Thank you for release the code!
I found that in vmamba_efficient.py you have import ''from lib.models.operations import InvertedResidual'' but i cannot find where is the file operations place in the code. Did i miss something ?
Failed to build selective-scan
ERROR: Could not build wheels for selective-scan, which is required to install pyproject.toml-based projects
(mamba)
Why does it prompt No module named 'selective_scan_vmamba_pt202 when I correctly installed selective_scan
Hello!
Thank you for the amazing work.
I am assuming BiAttn
computes the self-attention, if so, I don't quite understand the reason for the conv_branch
, why isn't attention computed just for the hidden states only x_ssm
only?
Thank you!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.