Compatibility Issue with MMCV, PyTorch, and CUDA in Google Colab Object Detection Model
faizan628 opened this issue · 2 comments
Thanks for your error report and we appreciate it a lot.
Checklist
- I have searched related issues but cannot get the expected help.
- I have read the FAQ documentation but cannot get the expected help.
- The bug has not been fixed in the latest version and previous versions
Describe the bug
I am encountering a compatibility issue between MMCV, PyTorch, and the CUDA GPU environment while training a model for object detection using Google Colab. The same code was working perfectly fine last year, but now it fails. The dataset is confirmed to be correct, as I used it successfully for training in the past. However, the model training fails now.
Reproduction
from google.colab import drive
drive.mount('/content/drive')
!cp -r '/content/drive/MyDrive/Table_detection_paper/' '/content/'
Model configurations
MODELS_CONFIG = {
'faster_rcnn_r50_fpn_1x': {
'config_file': 'configs/pascal_voc/faster-rcnn_r50_fpn_1x_voc0712.py'
},
'cascade_rcnn_r50_fpn_1x': {
'config_file': 'configs/cascade_rcnn_r50_fpn_1x.py',
},
'retinanet_r50_fpn_1x': {
'config_file': 'configs/retinanet_r50_fpn_1x.py',
}
}
mmdetection root directory
root_dir = '/content/finance_research'
Pick the model you want to use
Select a model in MODELS_CONFIG.
selected_model = 'faster_rcnn_r50_fpn_1x' # 'faster_rcnn_r50_fpn_1x' # cascade_rcnn_r50_fpn_1x
Total training epochs.
total_epochs = 12
Name of the config file.
config_file = MODELS_CONFIG[selected_model]['config_file']
import os
from os.path import exists, join, basename, splitext
%cd /content
project_name = os.path.abspath(splitext(basename(root_dir))[0])
%cd {project_name}
mmdetection_dir = os.path.join(project_name, "mmdetection")
!pip install torch==2.0.0 torchvision==0.15.1 torchaudio==2.0.1 --index-url https://download.pytorch.org/whl/cu118
!pip install -U openmim
!mim install mmcv-full -f https://download.openmmlab.com/mmcv/dist/cu118/
!pip3 install openmim
!mim install mmengine
!git clone --branch v3.2.0 https://github.com/open-mmlab/mmdetection.git
%cd mmdetection
!pip install -v -e .
%cd {mmdetection_dir}
!python tools/train.py {config_fname}
A placeholder for the command.
- Did you make any modifications on the code or config? Did you understand what you have modified?
- What dataset did you use?
Environment
Google Colab
PyTorch version: 2.0.0
Torchvision version: 0.15.1
CUDA version: cu118
MMCV version: 1.7.2 (incompatible)
MMDetection version: 3.2.0
Error traceback
/usr/local/lib/python3.10/dist-packages/mmcv/init.py:20: UserWarning: On January 1, 2023, MMCV will release v2.0.0, in which it will remove components related to the training process and add a data transformation module. In addition, it will rename the package names mmcv to mmcv-lite and mmcv-full to mmcv.
Traceback (most recent call last):
File "/content/finance_research/mmdetection/tools/train.py", line 10, in
from mmdet.utils import setup_cache_size_limit_of_dynamo
File "/content/finance_research/mmdetection/mmdet/init.py", line 17, in
and mmcv_version < digit_version(mmcv_maximum_version)),
AssertionError: MMCV==1.7.2 is used but incompatible. Please install mmcv>=2.0.0rc4, <2.2.0.
A placeholder for trackback.
Bug fix
If you have already identified the reason, you can provide the information here. If you are willing to create a PR to fix it, please also leave a comment here and that would be much appreciated!
Hi 王宇东,
希望你一切顺利。你能否帮我解决我遇到的问题?我非常感激你的支持。
如果方便的话,我们能否安排一次通话,以便更好地理解和讨论这个问题?
此致,
法伊赞·西迪奇
you can pip mmcv>=2.0.0