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

Run in colab seems that there's a ModuleNotFoundError related to the MultiScaleDeformableAttention module. #234

Open
henry7213 opened this issue Mar 15, 2024 · 0 comments

Comments

@henry7213
Copy link

henry7213 commented Mar 15, 2024

I modified the original Install detectron2 program as follows, because the original demo output:
ERROR: Could not find a version that satisfies the requirement detectron2 (from versions: none)
ERROR: No matching distribution found for detectron2**

!python -m pip install pyyaml==5.1
import sys, os, distutils.core
!git clone 'https://github.com/facebookresearch/detectron2'
dist = distutils.core.run_setup("./detectron2/setup.py")
!python -m pip install {' '.join([f"'{x}'" for x in dist.install_requires])}
sys.path.insert(0, os.path.abspath('./detectron2'))
!python -m pip install 'git+https://github.com/facebookresearch/detectron2.git'

When I run the following:

%cd /content/Mask2Former
import detectron2
from detectron2.utils.logger import setup_logger
setup_logger()
setup_logger(name="mask2former")

import numpy as np
import cv2
import torch
from google.colab.patches import cv2_imshow

from detectron2 import model_zoo
from detectron2.engine import DefaultPredictor
from detectron2.config import get_cfg
from detectron2.utils.visualizer import Visualizer, ColorMode
from detectron2.data import MetadataCatalog
from detectron2.projects.deeplab import add_deeplab_config
coco_metadata = MetadataCatalog.get("coco_2017_val_panoptic")

from mask2former import add_maskformer2_config

The error message I received is:
/content/Mask2Former

ModuleNotFoundError Traceback (most recent call last)
/content/Mask2Former/mask2former/modeling/pixel_decoder/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)
in <cell line: 26>()
24
25 # import Mask2Former project
---> 26 from mask2former import add_maskformer2_config

/content/Mask2Former/mask2former/init.py in
1 # Copyright (c) Facebook, Inc. and its affiliates.
2 from . import data # register all new datasets
----> 3 from . import modeling
4
5 # config

/content/Mask2Former/mask2former/modeling/init.py in
2 from .backbone.swin import D2SwinTransformer
3 from .pixel_decoder.fpn import BasePixelDecoder
----> 4 from .pixel_decoder.msdeformattn import MSDeformAttnPixelDecoder
5 from .meta_arch.mask_former_head import MaskFormerHead
6 from .meta_arch.per_pixel_baseline import PerPixelBaselineHead, PerPixelBaselinePlusHead

/content/Mask2Former/mask2former/modeling/pixel_decoder/msdeformattn.py in
17 from ..transformer_decoder.position_encoding import PositionEmbeddingSine
18 from ..transformer_decoder.transformer import _get_clones, _get_activation_fn
---> 19 from .ops.modules import MSDeformAttn
20
21

/content/Mask2Former/mask2former/modeling/pixel_decoder/ops/modules/init.py in
10 # Modified by Bowen Cheng from https://github.com/fundamentalvision/Deformable-DETR
11
---> 12 from .ms_deform_attn import MSDeformAttn

/content/Mask2Former/mask2former/modeling/pixel_decoder/ops/modules/ms_deform_attn.py in
22 from torch.nn.init import xavier_uniform_, constant_
23
---> 24 from ..functions import MSDeformAttnFunction
25 from ..functions.ms_deform_attn_func import ms_deform_attn_core_pytorch
26

/content/Mask2Former/mask2former/modeling/pixel_decoder/ops/functions/init.py in
10 # Modified by Bowen Cheng from https://github.com/fundamentalvision/Deformable-DETR
11
---> 12 from .ms_deform_attn_func import MSDeformAttnFunction
13

/content/Mask2Former/mask2former/modeling/pixel_decoder/ops/functions/ms_deform_attn_func.py in
27 "\tsh make.sh\n"
28 )
---> 29 raise ModuleNotFoundError(info_string)
30
31

and after running the previous step I have restart your runtime prior
Colab prompts to use:

shell
Copy code
%cd /content/Mask2Former/mask2former/modeling/pixel_decoder/ops
!sh make.sh
I've also tried it but the problem persists.

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

1 participant