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

Can't reproduce colab getting started example #3166

Closed
aiziesche opened this issue Jun 21, 2021 · 12 comments
Closed

Can't reproduce colab getting started example #3166

aiziesche opened this issue Jun 21, 2021 · 12 comments

Comments

@aiziesche
Copy link

aiziesche commented Jun 21, 2021

Instructions To Reproduce the 🐛 Bug:

  1. Tried to run the colab getting started on the detectron2 default GitHub repository, but it's not reproducing.

  2. What exact command you run:
    Exact steps being followed on the getting colab getting started

  3. please simplify the steps as much as possible so they do not require additional resources to
    Default dataset used in the colab getting started

Environment:

Colab is now using Pytorch 1.9 and installation is not working as suggested in the notebook, besides commenting on the assert condition of PyTorch 1.8. version is still producing error while

from detectron2 import _C

ImportError: /usr/local/lib/python3.7/dist-packages/detectron2/_C.cpython-37m-x86_64-linux-gnu.so: undefined symbol: _ZNK2at6Tensor7is_cudaEv

. @ppwwyyxx any hints or recommendations would be very helpful.

Kind Regards,

@vidya-hspl
Copy link

Same for me too. Tried to upgrade torchvision and pytorch but it did not work.

@AnnetGeorge
Copy link

I got the the tutorial to work by downgrading the PyTorch version to 1.8. first before importing it. (Ran the following line before anything else in the tutorial):

!pip install torch==1.8.0 torchvision==0.9.0 torchaudio==0.8.0

Then when installing Detectron, instead of installing the Detectron version in the original tutorial, I used the version compatible with PyTorch 1.8 and CUDA 10.2:

! pip install detectron2==0.4 -f https://dl.fbaipublicfiles.com/detectron2/wheels/cu102/torch1.8/index.html

Hope this helps!

@FabianGermany
Copy link

@AnnetGeorge AnnetGeorge
Thank you so much!

@GrantorShadow
Copy link

Please run this before anything else
!pip install torch==1.8.0+cu101 torchvision==0.9.0+cu101 -f https://download.pytorch.org/whl/torch_stable.html

Hope this helps

@andrew-healey
Copy link

andrew-healey commented Jun 22, 2021

This worked for me (Colab supports CUDA 11.1):
!pip install torch==1.8.0 torchvision==0.9.0 torchtext==0.9.0 -f https://download.pytorch.org/whl/cu111/torch_stable.html -q
!pip install detectron2 -f https://dl.fbaipublicfiles.com/detectron2/wheels/cu111/torch1.8/index.html

But still, it takes a very long time to run in Colab (much longer than when pytorch 1.8 was the default). Is there any plan for Detectron to support Pytorch 1.9 soon? That would let us avoid this whole problem of reinstalling Pytorch.

@hqm
Copy link

hqm commented Jun 23, 2021

This blog post contained instructions that worked for me

https://www.sproutworkshop.com/2021/05/how-to-install-detectron2/

I substituted in these two pip installs in the tutorial colab notebook and removed the assertion check for pytorch 1.8

!pip3 install --pre torch torchvision torchaudio -f https://download.pytorch.org/whl/nightly/cu111/torch_nightly.html
!pip install 'git+/~https://github.com/facebookresearch/detectron2.git'

@ppwwyyxx
Copy link
Contributor

release for pytorch1.9 is tracked in #3158. Before that is available, the best workaround is to manually reinstall pytorch1.8 as suggested above.

@hqm
Copy link

hqm commented Jun 24, 2021

note: downgrading to pytorch 1.8 did not work for me in the Google Colab notebook tutorial, still got some CUDA error
when trying to run the balloon training example.

The solution I pasted above with the pre-release pytorch did work in the Colab tutorial training example.

@ppwwyyxx
Copy link
Contributor

@hqm it should work if you use pytorch1.8+ cuda 10.1. The pytorch bug only exists for pytorch 1.8.x & cuda>=11

@hqm
Copy link

hqm commented Jun 24, 2021 via email

@vidya-hspl
Copy link

Yes @hqm - your solution worked for me in the colab notebook. The other approaches did not work out for me either.

@ppwwyyxx
Copy link
Contributor

The official colab tutorial has now been updated and tested with the workaround to use pytorch1.8.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants