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

ImportError: Cannot import 'detrex._C', therefore 'MultiScaleDeformableAttention' is not available. #98

Closed
Sjyhne opened this issue Oct 12, 2022 · 6 comments

Comments

@Sjyhne
Copy link

Sjyhne commented Oct 12, 2022

Hello!

I'm following the installation guide, but facing issues when trying to run models with MultiScaleDeformableAttention. As the title states, I'm receiving the following error:

ImportError: Cannot import 'detrex._C', therefore 'MultiScaleDeformableAttention' is not available.

Relevant packages from conda list:

detectron2 0.6 dev_0
detrex 0.1.0 dev_0
pytorch 1.10.1 py3.7_cuda10.2_cudnn7.6.5_0 pytorch
pytorch-mutex 1.0 cuda pytorch
torchaudio 0.10.1 py37_cu102 pytorch
torchvision 0.11.2 py37_cu102 pytorch

  1. Clean conda environment with python version 3.7
  2. Install pytorch according to the PyTorch installation guides.
  3. Clone detrex
  4. Init and update submodules
  5. python -m pip install -e detectron2
  6. pip install -e .

However when running:

python tools/train_net.py --config-file projects/dino/configs/dino_r50_4scale_12ep.py

I get the error above.

Is there any known solutions for this issue?

@rentainhe
Copy link
Collaborator

@Sjyhne Hello! Please make sure you have CUDA runtime, you can check it by print CUDA_HOME to see if it's None, If None, you can set it by export CUDA_HOME=/path/to/cuda-11.3/ (just an example) and rebuild detrex again

@rentainhe
Copy link
Collaborator

Hello!

I'm following the installation guide, but facing issues when trying to run models with MultiScaleDeformableAttention. As the title states, I'm receiving the following error:

ImportError: Cannot import 'detrex._C', therefore 'MultiScaleDeformableAttention' is not available.

Relevant packages from conda list:

detectron2 0.6 dev_0 detrex 0.1.0 dev_0 pytorch 1.10.1 py3.7_cuda10.2_cudnn7.6.5_0 pytorch pytorch-mutex 1.0 cuda pytorch torchaudio 0.10.1 py37_cu102 pytorch torchvision 0.11.2 py37_cu102 pytorch

  1. Clean conda environment with python version 3.7
  2. Install pytorch according to the PyTorch installation guides.
  3. Clone detrex
  4. Init and update submodules
  5. python -m pip install -e detectron2
  6. pip install -e .

However when running:

python tools/train_net.py --config-file projects/dino/configs/dino_r50_4scale_12ep.py

I get the error above.

Is there any known solutions for this issue?

You can also follow this issue to see if it can help you to fix the installation problem. #85 (comment)

@Sjyhne
Copy link
Author

Sjyhne commented Oct 12, 2022

Yeah, thanks! This might be my issue. However, I am not able to access the CUDA_HOME, as cuda is not installed locally on the server I'm training on. Are there any other possible solutions to the issue? Circumventing the CUDA_HOME?

@rentainhe
Copy link
Collaborator

rentainhe commented Oct 12, 2022

Yeah, thanks! This might be my issue. However, I am not able to access the CUDA_HOME, as cuda is not installed locally on the server I'm training on. Are there any other possible solutions to the issue? Circumventing the CUDA_HOME?

I'm not sure if you're using slrum for training~, maybe you can install CUDA Runtime locally and successfully build detrex in your local environment and using this environment on the server, or build detrex directly on the server

@rentainhe
Copy link
Collaborator

rentainhe commented Oct 12, 2022

Yeah, thanks! This might be my issue. However, I am not able to access the CUDA_HOME, as cuda is not installed locally on the server I'm training on. Are there any other possible solutions to the issue? Circumventing the CUDA_HOME?

Maybe you can try to build detrex on that server~, find the right cuda path and then export CUDA_HOME=/path/to/cuda

@rentainhe
Copy link
Collaborator

As there is no more activity, I am closing the issue~ Feel free to reopen it if necessary. Or you can leave a new issue if you meet some other problems.

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