hustvl / Vim

Vision Mamba: Efficient Visual Representation Learning with Bidirectional State Space Model
Apache License 2.0
2.55k stars 159 forks source link

Problem about pip install -e mamba-1p1p1 #63

Closed Huangmr0719 closed 2 months ago

Huangmr0719 commented 2 months ago

Great work! But I met the following problems when pip install -e mamba-1p1p1 and pip install -e causal_conv1d>=1.1.0

error You need C++17 to compile PyTorch

My environment is as follows: torch==2.1.2 torchvision==0.16.2 torchaudio==2.1.2. Cuda==11.8 gcc==6.1.0 python==3.9

This problem still occurs after I update gcc to the latest version, I want to know if anyone has the same problem as me.

Huangmr0719 commented 2 months ago

Problem solved, I updated both gcc and g++ versions to 11.4 and chose to install causal_conv1d-1.1.3.post1 from source.I also provide my test code as follows

import torch
from models_mamba import VisionMamba
from timm.models.vision_transformer import VisionTransformer, _cfg

ngpu = 1
device = torch.device("cuda:0" if (torch.cuda.is_available() and ngpu > 0) else "cpu")

model = VisionMamba(
        patch_size=16, stride=8, embed_dim=384, depth=24, rms_norm=True, residual_in_fp32=True, fused_add_norm=True, 
        final_pool_type='mean', if_abs_pos_embed=True, if_rope=False, if_rope_residual=False, 
        bimamba_type="v2", if_cls_token=True, if_devide_out=True, use_middle_cls_token=True).to(device)
out = model(x)

print(out.shape)
print(out)

By the way, it looks like it only supports running on GPUs