Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I have a bug. NameError: name 'selective_scan_cuda_oflex' is not defined,Can you help me solve it? #9

Closed
ljbddy opened this issue Apr 21, 2024 · 5 comments

Comments

@ljbddy
Copy link

ljbddy commented Apr 21, 2024

#!/bin/bash

python /home/ubuntu20/Desktop/MambaCD1/MambaCD/script/train_MambaBCD.py
--dataset 'LEVIR-CD+'
--batch_size 16
--crop_size 256
--max_iters 320000
--model_type MambaBCD_Small
--model_param_path '/home/ubuntu20/Desktop/MambaCD1/MambaCD/changedetection/saved_models'
--train_dataset_path '/home/ubuntu20/Desktop/train'
--train_data_list_path '/home/ubuntu20/Desktop/train/train.txt'
--test_dataset_path '/home/ubuntu20/Desktop/train'
--test_data_list_path '/home/ubuntu20/Desktop/train/train.txt'
--cfg '/home/ubuntu20/Desktop/MambaCD1/MambaCD/changedetection/configs/vssm1/vssm_small_224.yaml'
--pretrained_weight_path '/home/ubuntu20/Desktop/MambaCD1/MambaCD/pretrained_weight/vssm_small_0229_ckpt_epoch_222.pth'

This is my main file

(mamba) ubuntu20@ubuntu20-System-Product-Name:/Desktop/MambaCD1/MambaCD/changedetection$ sh main.sh
=> merge config from /home/ubuntu20/Desktop/MambaCD1/MambaCD/changedetection/configs/vssm1/vssm_small_224.yaml
Successfully load ckpt /home/ubuntu20/Desktop/MambaCD1/MambaCD/pretrained_weight/vssm_small_0229_ckpt_epoch_222.pth
_IncompatibleKeys(missing_keys=['outnorm0.weight', 'outnorm0.bias', 'outnorm1.weight', 'outnorm1.bias', 'outnorm2.weight', 'outnorm2.bias', 'outnorm3.weight', 'outnorm3.bias'], unexpected_keys=['classifier.norm.weight', 'classifier.norm.bias', 'classifier.head.weight', 'classifier.head.bias'])
0%| | 0/20000 [00:16<?, ?it/s]
Traceback (most recent call last):
File "/home/ubuntu20/Desktop/MambaCD1/MambaCD/changedetection/script/train_MambaBCD.py", line 207, in
main()
File "/home/ubuntu20/Desktop/MambaCD1/MambaCD/changedetection/script/train_MambaBCD.py", line 203, in main
trainer.training()
File "/home/ubuntu20/Desktop/MambaCD1/MambaCD/changedetection/script/train_MambaBCD.py", line 104, in training
output_1 = self.deep_model(pre_change_imgs, post_change_imgs)
File "/media/ubuntu20/EXOS_1/anaconda3/envs/mamba/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
return forward_call(*input, **kwargs)
File "/home/ubuntu20/Desktop/MambaCD1/MambaCD/changedetection/models/MambaBCD.py", line 67, in forward
pre_features = self.encoder(pre_data)
File "/media/ubuntu20/EXOS_1/anaconda3/envs/mamba/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
return forward_call(*input, **kwargs)
File "/home/ubuntu20/Desktop/MambaCD1/MambaCD/changedetection/models/Mamba_backbone.py", line 50, in forward
o, x = layer_forward(layer, x) # (B, H, W, C)
File "/home/ubuntu20/Desktop/MambaCD1/MambaCD/changedetection/models/Mamba_backbone.py", line 43, in layer_forward
x = l.blocks(x)
File "/media/ubuntu20/EXOS_1/anaconda3/envs/mamba/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
return forward_call(*input, **kwargs)
File "/media/ubuntu20/EXOS_1/anaconda3/envs/mamba/lib/python3.8/site-packages/torch/nn/modules/container.py", line 139, in forward
input = module(input)
File "/media/ubuntu20/EXOS_1/anaconda3/envs/mamba/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
return forward_call(*input, **kwargs)
File "/home/ubuntu20/Desktop/MambaCD1/MambaCD/classification/models/vmamba.py", line 1360, in forward
return self._forward(input)
File "/home/ubuntu20/Desktop/MambaCD1/MambaCD/classification/models/vmamba.py", line 1348, in _forward
x = input + self.drop_path(self.op(self.norm(input)))
File "/media/ubuntu20/EXOS_1/anaconda3/envs/mamba/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
return forward_call(*input, **kwargs)
File "/home/ubuntu20/Desktop/MambaCD1/MambaCD/classification/models/vmamba.py", line 1147, in forwardv2
y = self.forward_core(x)
File "/home/ubuntu20/Desktop/MambaCD1/MambaCD/classification/models/vmamba.py", line 1124, in forward_corev2
return cross_selective_scan(
File "/home/ubuntu20/Desktop/MambaCD1/MambaCD/classification/models/vmamba.py", line 406, in cross_selective_scan
ys: torch.Tensor = selective_scan(
File "/home/ubuntu20/Desktop/MambaCD1/MambaCD/classification/models/vmamba.py", line 372, in selective_scan
return SelectiveScan.apply(u, delta, A, B, C, D, delta_bias, delta_softplus, nrows, backnrows, ssoflex)
File "/media/ubuntu20/EXOS_1/anaconda3/envs/mamba/lib/python3.8/site-packages/torch/cuda/amp/autocast_mode.py", line 110, in decorate_fwd
return fwd(*args, **kwargs)
File "/home/ubuntu20/Desktop/MambaCD1/MambaCD/classification/models/vmamba.py", line 299, in forward
out, x, *rest = selective_scan_cuda_oflex.fwd(u, delta, A, B, C, D, delta_bias, delta_softplus, 1, oflex)
NameError: name 'selective_scan_cuda_oflex' is not defined
(mamba) ubuntu20@ubuntu20-System-Product-Name:
/Desktop/MambaCD1/MambaCD/changedetection$

@ljbddy
Copy link
Author

ljbddy commented Apr 21, 2024

I can not find selective_scan_cuda_oflex,selective_scan_cuda and selective_scan_cuda_core function definition

@ChenHongruixuan
Copy link
Owner

Hi,

Thank you so much for your interest to our work. This error seems caused by the VMamba. You can go to the issue under VMamba repo to see what works for you. I have listed some related issues for you, hopefully it will solve your problem.

Best,

@ChenHongruixuan
Copy link
Owner

Hi,

May I ask if you have solved issue? @ljbddy

Best,

@ljbddy
Copy link
Author

ljbddy commented Apr 25, 2024

@ChenHongruixuan yes I reinstalled cuda11.8 and the corresponding pytorch version and ran pip install correctly.

@ChenHongruixuan
Copy link
Owner

Great! Glad to hear that :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants