ViT-Adapter icon indicating copy to clipboard operation
ViT-Adapter copied to clipboard

About error 'EncoderDecoderMask2Former is not in the models registry'

Open Jinshan99 opened this issue 3 years ago • 13 comments

Hello, when I run model_VitAdapter = init_segmentor(config_file_VitAdapter , checkpoint_file_VitAdapter, device='cuda:0'), it says this error, how to solve it~~ Thank you very much~~!

Jinshan99 avatar Aug 02 '22 02:08 Jinshan99

Hello, when I run model_VitAdapter = init_segmentor(config_file_VitAdapter , checkpoint_file_VitAdapter, device='cuda:0'), it says this error, how to solve it~~ Thank you very much~~!

Hi! When you use EncoderDecoderMask2Former, you need to import package "mmseg_custom" and import EncoderDecoderMask2Former somewhere. Like file ViT-Adapter/segmentation/mmseg_custom/models/segmentors/__init__.py.

duanduanduanyuchen avatar Aug 02 '22 02:08 duanduanduanyuchen

Hi, after !python mmseg_custom/models/segmentors/init.py I get

Traceback (most recent call last): File "mmseg_custom/models/segmentors/init.py", line 2, in from .encoder_decoder_mask2former import EncoderDecoderMask2Former ImportError: attempted relative import with no known parent package What should I change~~ Thank you!!

Jinshan99 avatar Aug 02 '22 03:08 Jinshan99

Hi, after !python mmseg_custom/models/segmentors/init.py I get

Traceback (most recent call last): File "mmseg_custom/models/segmentors/init.py", line 2, in from .encoder_decoder_mask2former import EncoderDecoderMask2Former ImportError: attempted relative import with no known parent package What should I change~~ Thank you!!

You do not need to actually run the init file, just import mmseg_custom in your script and add your current work dir to your environment variable PYTHONPATH.

duanduanduanyuchen avatar Aug 02 '22 03:08 duanduanduanyuchen

when I type import mmseg_custom, there is ModuleNotFoundError: No module named 'mmdet' caused by ----> 3 from mmdet.utils import util_mixins

Jinshan99 avatar Aug 02 '22 03:08 Jinshan99

when I type import mmseg_custom, there is ModuleNotFoundError: No module named 'mmdet' caused by ----> 3 from mmdet.utils import util_mixins

I think this error means you need to install "mmdet" first. You can follow the instructions in the Usage in here.

duanduanduanyuchen avatar Aug 02 '22 03:08 duanduanduanyuchen

I cannot install mmdet as your code to get the error of ERROR: Command errored out with exit status 1: command: /home/jinshan/anaconda3/bin/python /home/jinshan/anaconda3/lib/python3.8/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-81klhbox/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'cython>=0.27.3' oldest-supported-numpy 'setuptools>=43.0.0' wheel cwd: None

I tried !pip install openmim !mim install mmdet==2.22.0 but still got the error ERROR: Command errored out with exit status 1: command: /home/jinshan/anaconda3/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-download-arfq_jcg/mmdet/setup.py'"'"'; file='"'"'/tmp/pip-download-arfq_jcg/mmdet/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-zyqum7yy cwd: /tmp/pip-download-arfq_jcg/mmdet/ Complete output (2 lines): Error: mkl-service + Intel(R) MKL: MKL_THREADING_LAYER=INTEL is incompatible with libgomp.so.1 library. Try to import numpy first or set the threading layer accordingly. Set MKL_SERVICE_FORCE_INTEL to force it.

Have you met the same problem and how have you solved~ Thank you very very much

Jinshan99 avatar Aug 02 '22 03:08 Jinshan99

Oh I found it could work on python 3.7, I am using the 3.8.. I will try it later~~ Thank you

Jinshan99 avatar Aug 02 '22 03:08 Jinshan99

Hi, I have more errors when I use python 3.7.. I cannot implement it, could you give me the code for training the model with the config and pth? Thank you!!!!

Jinshan99 avatar Aug 02 '22 22:08 Jinshan99

Hi, I have more errors when I use python 3.7.. I cannot implement it, could you give me the code for training the model with the config and pth? Thank you!!!!

Hi! This code repo is the official implementation of ViT-Adapter. You can follow the guidelines in the README file to train/evaluate a model you like.

If you want to train Mask2Former-BeiT-Adapter, you should prepare an appropriate python environment. (Follow the instructions here. ) After that, you should also prepare some necessary files:

  1. Download the ade20k data to the directory ViT-Adapter/segmentation/data/;
  2. Download the pre-trained weight of BEiT-Large (here) to the directory ViT-Adapter/segmentation/pretrained/;

Your working dir should be ViT-Adapter/segmentation/. Then run sh dist_train.sh configs/ade20k/mask2former_beit_adapter_large_640_160k_ade20k_ss.py 8 for an 8-GPUs training, or run python train.py configs/ade20k/mask2former_beit_adapter_large_640_160k_ade20k_ss.py for a single-GPU training.

duanduanduanyuchen avatar Aug 03 '22 02:08 duanduanduanyuchen

Hi, I got the error "EncoderDecoder: 'BEiTAdapter is not in the models registry'" and I imported the mmseg_custom got error:/ViT-Adapter/segmentation/mmseg_custom/models/backbones/beit_adapter.py in 8 import torch.nn.functional as F 9 from mmseg.models.builder import BACKBONES ---> 10 from ops.modules import MSDeformAttn 11 from timm.models.layers import DropPath, trunc_normal_ 12 from torch.nn.init import normal_

ModuleNotFoundError: No module named 'ops.modules'

Jinshan99 avatar Aug 11 '22 06:08 Jinshan99

Hi, I got the error "EncoderDecoder: 'BEiTAdapter is not in the models registry'" and I imported the mmseg_custom got error:/ViT-Adapter/segmentation/mmseg_custom/models/backbones/beit_adapter.py in 8 import torch.nn.functional as F 9 from mmseg.models.builder import BACKBONES ---> 10 from ops.modules import MSDeformAttn 11 from timm.models.layers import DropPath, trunc_normal_ 12 from torch.nn.init import normal_

ModuleNotFoundError: No module named 'ops.modules'

Hi, you need to compile the ops module first. You can follow the last two lines of instructions in the usage. First, compile the module in the detection folder and create a soft link to ops in the segmentation folder.

duanduanduanyuchen avatar Aug 11 '22 08:08 duanduanduanyuchen

Hi, I followed the last two lines and get error: Traceback (most recent call last): File "setup.py", line 70, in ext_modules=get_extensions(), File "setup.py", line 43, in get_extensions raise NotImplementedError('Cuda is not availabel') NotImplementedError: Cuda is not availabel from the command line sh make.sh which the error comes from if torch.cuda.is_available() and CUDA_HOME is not None:...else..... I tried shows the torch.cuda.is_available() is True but CUDA_HOME is None, so what could I do to solve it~~~ Thank you

Jinshan99 avatar Aug 11 '22 18:08 Jinshan99

Hi, I followed the last two lines and get error: Traceback (most recent call last): File "setup.py", line 70, in ext_modules=get_extensions(), File "setup.py", line 43, in get_extensions raise NotImplementedError('Cuda is not availabel') NotImplementedError: Cuda is not availabel from the command line sh make.sh which the error comes from if torch.cuda.is_available() and CUDA_HOME is not None:...else..... I tried shows the torch.cuda.is_available() is True but CUDA_HOME is None, so what could I do to solve it~~~ Thank you

I think you can add the path to CUDA to your environment variables and try the 'sh' command again.

duanduanduanyuchen avatar Aug 16 '22 07:08 duanduanduanyuchen