Open SharmaNatasha opened 11 months ago
cd Semantic-SAM
git clone https://github.com/facebookresearch/Mask2Former.git
cd Mask2Former/mask2former/modeling/pixel_decoder/ops
sh make.sh
it should work~
Thank you @zlin-monarch I have tried this earlier and tried again after you suggested.. but when import semantic sam from semantic_sam import prepare_image, plot_multi_results, build_semantic_sam, SemanticSAMPredictor I get no module found for it.
Here is the code i am running
!pip install torch torchvision !git clone https://github.com/UX-Decoder/Semantic-SAM !pip install -r requirements.txt
!pip install 'git+https://github.com/MaureenZOU/detectron2-xyz.git' %cd "/content/Semantic-SAM" !git clone https://github.com/facebookresearch/Mask2Former %cd "Mask2Former/mask2former/modeling/pixel_decoder/ops" !sh make.sh
from semantic_sam import prepare_image, plot_multi_results, build_semantic_sam, SemanticSAMPredictor original_image, input_image = prepare_image(image_pth='/content/Semantic-SAM/examples/4.png')
Hi, may I check what is ur workpath
when running import semantic sam
?
U can use pwd
to check it.
It should be on Semantic-SAM
directory, or else u can come back to Semantic-SAM by cd ~/Semantic-SAM
after doing the installation
Please find below attached screenshot. after installing mask2former when I change the directory to semantic sam, i get no error for multiscaledeformable
Okay. I tried on colab and met the same error It is due to that the library path related to cuda might have been hard-coded during compilation, and has been written into the 'so' file, which seems to be the root of the problem or need sudo permission.
This problem can be prevented when we run it on the server and configure CUDA manually. Related link: csdn: ModuleNotFoundError: No module named ‘Multiscaledeformableattention‘
cd Semantic-SAM git clone https://github.com/facebookresearch/Mask2Former.git cd Mask2Former/mask2former/modeling/pixel_decoder/ops sh make.sh
it should work~
For anyone else with this issue (not in colab) this comment worked for me.
I am trying to run Semantic SAM on google colab and seeing below issue even after compiling CUDA operators cd ./models/ops sh ./make.sh
ModuleNotFoundError Traceback (most recent call last) /content/Semantic-SAM/semantic_sam/body/encoder/ops/functions/ms_deform_attn_func.py in
21 try:
---> 22 import MultiScaleDeformableAttention as MSDA
23 except ModuleNotFoundError as e:
ModuleNotFoundError: No module named 'MultiScaleDeformableAttention'
During handling of the above exception, another exception occurred:
ModuleNotFoundError Traceback (most recent call last) 13 frames /content/Semantic-SAM/semantic_sam/body/encoder/ops/functions/ms_deform_attn_func.py in
27 "\t
sh make.sh
\n" 28 ) ---> 29 raise ModuleNotFoundError(info_string) 30 31ModuleNotFoundError:
Please compile MultiScaleDeformableAttention CUDA op with the following commands:
cd mask2former/modeling/pixel_decoder/ops
sh make.sh