Open laurahgdrn opened 7 months ago
The workaround is to compile and install mmcv from source, or as a temporary solution, try installing mmcv-lite
, and the colab example code should work fine.
The reason for the error is as follows: the error message here is _ext.cpython-310-x86_64-linux-gnu.so: undefined symbol: _ZN2at4_ops10zero
, which is usually caused by a discrepancy between the version of CUDA that's currently running and the version of MMCV that's being compiled.
As you can see from the message above, colab's CUDA version is 12.2, and the mmcv you installed is !pip install mmcv==2.1.0 -f https://download.openmmlab.com/mmcv/dist/cu121/torch2.1/index.html
, cu121 does not match colab's cuda version.
Prerequisite
Environment
I am trying to install mmaction2 in my Google Colab environment by following the official google Colab tutorial (https://colab.research.google.com/github/open-mmlab/mmaction2/blob/master/demo/mmaction2_tutorial.ipynb#scrollTo=No_zZAFpWC-a)
This is my Google Colab environment:
nvcc: NVIDIA (R) Cuda compiler driver Copyright (c) 2005-2023 NVIDIA Corporation Built on Tue_Aug_15_22:02:13_PDT_2023 Cuda compilation tools, release 12.2, V12.2.140 Build cuda_12.2.r12.2/compiler.33191640_0 gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0 Copyright (C) 2021 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
In the tutorial, PyTorch and torch vision use CUDA 11.8:
%pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
and then installing MMEngine:
and mmcv is installed like this:
!mim install "mmcv==2.0.0"
However, then I get compatibility issues with the CUDA version of the Google Colab (12.1). Then, I tried to install the latest PyTorch version for CUDA 12.1 and the newest mmcv version (as described on the website):!pip install mmcv==2.1.0 -f https://download.openmmlab.com/mmcv/dist/cu121/torch2.1/index.html
mmaction2 is installed like this:Reproduces the problem - code sample
https://colab.research.google.com/github/open-mmlab/mmaction2/blob/master/demo/mmaction2_tutorial.ipynb#scrollTo=No_zZAFpWC-a
Reproduces the problem - command or script
Reproduces the problem - error message
Additional information
I have tried different versions of mmcv and mmcv-full, different PyTorch versions, but nothing seems to work, e.g.:
from the official mmcv documentation (https://mmcv.readthedocs.io/en/v1.7.0/get_started/installation.html):
!pip install mmcv==2.1.0 -f https://download.openmmlab.com/mmcv/dist/cu121/torch2.1/index.html
Nightly CUDA builds (from https://github.com/pytorch/pytorch/issues/91122):
pip3 install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu121