-
Notifications
You must be signed in to change notification settings - Fork 537
Description
🐛 AttributeError: module 'captum' has no attribute 'attr'
When importing captum with just import captum
, the package is missing modules like attr. Running dir(captum)
shows that the other modules, like attr
are missing. However, if a statement like from captum.attr._utils.input_layer_wrapper import ModelInputWrapper
is included after import captum
, the captum package then has the missing modules. Again, verified by running a dir(captum)
. Is this expected behavior?
To Reproduce
Steps to reproduce the behavior:
- Run the code below:
import captum
print(dir(captum))
print("---------------")
from captum.attr._utils.input_layer_wrapper import ModelInputWrapper
print(dir(captum))
exit()
- The above should get an output of the following:
['__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__', '__version__']
---------------
['__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__', '__version__', '_utils', 'attr', 'log']
Expected behavior
I assume all modules should be available after import captum
. If this behavior is not expected, please close and disregard.
Environment
I installed captum using the suggested conda method. See details below. After noticing this issue in an environment I was developing in with many other packages, I made a new, clean environment that only contained captum and any dependencies conda installed. Same issue.
- Captum / PyTorch Version (e.g., 1.0 / 0.4.0): 0.3.1
- OS (e.g., Linux): Ubuntu 18.04.4 LTS
- How you installed Captum / PyTorch (
conda
,pip
, source): conda - command:
conda install captum -c pytorch
- Python version: 3.6.13