ziplab / LITv2

[NeurIPS 2022 Spotlight] This is the official PyTorch implementation of "Fast Vision Transformers with HiLo Attention"
Apache License 2.0
241 stars 14 forks source link

Problem with DCN module #9

Closed sanjana-prabhu closed 1 year ago

sanjana-prabhu commented 1 year ago

Hi,

I am getting this error when I try to train the LITv2 Module on Google Colab. AttributeError: module 'DCN' has no attribute 'deform_conv2d_forward'. How to solve this?

HubHop commented 1 year ago

Hi @sanjana-prabhu, have you successfully installed deformable convolution in your environment? e.g.

cd classification/mm_modules/DCN
# Build Deformable Convolution
python setup.py build install
sanjana-prabhu commented 1 year ago

Hi, I have installed it from segmentation/mm_modules/DCN

HubHop commented 1 year ago

Can you please provide the details of your Python virtual environment?

sanjana-prabhu commented 1 year ago

Here it is.

HubHop commented 1 year ago

Thanks for sharing your environment.

Actually, it is quite difficult to debug since the shared env has many irrelavant packages. However, I just created a new Python env with conda,

conda create -n lit python=3.9 -y

conda activate lit

# install pytorch
pip install torch==1.12.1+cu113 torchvision==0.13.1+cu113 torchaudio==0.12.1 --extra-index-url https://download.pytorch.org/whl/cu113

pip install timm
pip install ninja
pip install tensorboard
pip install prettytable
pip install opencv-python==4.4.0.46 termcolor==1.1.0 yacs==0.1.8

# install NVIDIA apex
git clone https://github.com/NVIDIA/apex
cd apex
pip install -v --disable-pip-version-check --no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext" ./
cd ../
rm -rf apex/

# install deformable convolution
cd segmentation/mm_modules/DCN
python setup.py build install

# install mmcv
pip install mmcv-full==1.6.1

# now we can run the segmentation code
bash tools/dist_train.sh configs/litv2/litv2_s_fpn_r50_512x512_80k_ade20k.py 1  --options model.pretrained=litv2_s.pth

Based on the new created env, I can run the segmentation code without any issues. If possible, please also let me know your detailed errors/logs when using this repo to train your model.

sanjana-prabhu commented 1 year ago

Thanks!