I've been following this PyTorch tutorial to fine-tune a Mask R-CNN model with my own dataset. On paper, it seems straightforward, but in practice, I've run into several issues with torch and torchvision.
Firstly, when I run my code, it seems that some modules are not being recognized. I've tried different recent versions of torch and even cloned the torch repository directly from GitHub. Despite this, I get an error like:
---> 16 if torch._running_with_deploy():
AttributeError: module 'torch' has no attribute '_running_with_deploy'
Secondly, I also cloned the torchvision repository from GitHub, hoping it would fix my issues. However, I still encounter errors, such as:
ImportError: cannot import name '_meta_registrations' from 'torchvision' (C:\Users\anaconda33\lib\site-packages\torchvision\__init__.py)
I've spent quite some time looking for solutions online, but nothing seems to really solve my issues. I'm at a bit of a loss and would really appreciate some help.
If anyone has faced these problems before or has advice on how to solve them, I'm all ears.
Thanks in advance!
What I've tried so far to resolve these issues:
- Switched between multiple versions of
torchandtorchvisionto see if compatibility was the issue. - Cloned both the
torchandtorchvisionrepositories directly from GitHub, thinking the latest code might solve the problem. - Checked my environment variables and paths to make sure Python was looking in the right places.
I managed run the tutorial by installing the nightly build of
pytorch(a note at the beginning of the tutorial mentions that >=0.16 or nightly is required). Here's the commands that I used:The second
pipcommand installspytorch's nightly version and it was generated from https://pytorch.org/. There you can specify for what operating system,pytorchbuild, package manager, you want to generate the install command.