haofeixu/aanet

Run in Google colab

Jack47746 opened this issue · 4 comments

Has anyone run it on google colab? The installation environment keeps failing.
image
Running build. sh file
image

I managed to run AANet+ prediction on Google Colab

  • The main thing is NOT to use environment.yml, as it breaks something in the Google Colab environment
  • In addition, you need to patch the deform_conv code

Here is a working example. First you need to make sure that your instance has a GPU

import torch

assert torch.cuda.is_available()

Then run

%%shell
git clone https://github.com/haofeixu/aanet.git
cd aanet
mkdir -p pretrained
gdown --id 1m0z8e2Ndau_eFR3BETffzjkNXhJNHAiS --output pretrained/aanet+_kitti15-2075aea1.pth

pip install ninja  # Optional

cd nets/deform_conv

# https://github.com/pytorch/pytorch/issues/28472#issuecomment-545425721
sed -i -- 's/AT_CHECK/TORCH_CHECK/g' src/deform_conv_cuda.cpp
sed -i -- 's/.data</.data_ptr</g' src/deform_conv_cuda_kernel.cu

sh build.sh

cd ../..
sh scripts/aanet+_predict.sh

I managed to run AANet+ prediction on Google Colab

* The main thing is NOT to use environment.yml, as it breaks something in the Google Colab environment

* In addition, you need to patch the deform_conv code

Here is a working example. First you need to make sure that your instance has a GPU

import torch

assert torch.cuda.is_available()

Then run

%%shell
git clone https://github.com/haofeixu/aanet.git
cd aanet
mkdir -p pretrained
gdown --id 1m0z8e2Ndau_eFR3BETffzjkNXhJNHAiS --output pretrained/aanet+_kitti15-2075aea1.pth

pip install ninja  # Optional

cd nets/deform_conv

# https://github.com/pytorch/pytorch/issues/28472#issuecomment-545425721
sed -i -- 's/AT_CHECK/TORCH_CHECK/g' src/deform_conv_cuda.cpp
sed -i -- 's/.data</.data_ptr</g' src/deform_conv_cuda_kernel.cu

sh build.sh

cd ../..
sh scripts/aanet+_predict.sh

When I use
‘’%%shell
bash aanet+_predict.sh‘’ in colab
appear problem ‘’python3: can't open file 'predict.py': [Errno 2] No such file or directory‘’
how can solve look forward to your reply

I assumed that all the code would be inserted into one cell with %%shell magick to preserve the working directory inside the cell. Have you done so?
Apparently you are running the script from the wrong folder. You should cd in the aanet/ folder.

Hi all, sorry for the late response.

If this issue is still relavant to you, I would suggest to try our new GMStereo model: https://haofeixu.github.io/unimatch/ & https://github.com/autonomousvision/unimatch. No CUDA op is required. A Colab demo is also provided to try our model in your browser. Hope it helps, thanks.