How do I install Captum on Google Colab from a custom branch in a fork?

I’ve tried cloning and running this along with all the other tricks I could find online with no luck:

#git clone https://github.com/pytorch/captum.git
#cd captum
#pip install -e .

git clone https://github.com/UserName/captum
cd captum
git checkout custom-branch
pip install -e .

If I use the above code, I can import captum but can’t import any submodules.

Any suggestions?

Are you able to build captum from master and import submodules?
If so, I guess your custom branch might be broken.

I just tested installing the latest release of Captum and it seems to have worked:

!git clone https://github.com/pytorch/captum 

%cd captum

!git checkout "v0.2.0"

!pip3 install -e .

import sys
sys.path.append('/content/captum')

%cd ..

Testing the imports:

import captum

from captum.attr import (
    GradientShap,
    DeepLift,
    DeepLiftShap,
    IntegratedGradients,
    LayerConductance,
    NeuronConductance,
    NoiseTunnel,
)

from captum import custom_module # This fails

The master branch seems to install correctly as well, but my custom branch still does not. I haven’t changed anything on my custom branch relating to the submodule organization or setup.py, so I don’t understand why I can’t import the one submodule?

Edit: The import in the custom module’s __init__.py were changed from relative to absolute, and that looks like it might be the cause.