neural-backed-decision-trees icon indicating copy to clipboard operation
neural-backed-decision-trees copied to clipboard

error when use 'nbdt-hierarchy'

Open zhuyi3625 opened this issue 4 years ago • 4 comments

when run command 'nbdt-hierarchy' in ubuntu 18.04 nbdt-hierarchy --checkpoint=wrn28_10_cifar10 --dataset=CIFAR10 nbdt-hierarchy --vis-sublabels --vis-zoom=1.25 --dataset=CIFAR10 --arch=wrn28_10_cifar10 Here is ModuleNotFoundError: No module named 'nbdt.thirdparty', I wonder what happened

zhuyi3625 avatar Mar 13 '21 02:03 zhuyi3625

Is your system default python3? I just tried pip install nbdt (installing nbdt-0.0.4) and nbdt-hierarchy --help works for me on Ubuntu 18.04. However, I ran this from within a conda environment with a python3 default.

alvinwan avatar Mar 14 '21 06:03 alvinwan

Is your system default python3? I just tried pip install nbdt (installing nbdt-0.0.4) and nbdt-hierarchy --help works for me on Ubuntu 18.04. However, I ran this from within a conda environment with a python3 default.

Traceback (most recent call last): File "/data/anaconda3/bin/nbdt-hierarchy", line 7, in exec(compile(f.read(), file, 'exec')) File "/data/M808/zhuyi/NBDTNemaTest/nbdt/bin/nbdt-hierarchy", line 5, in from nbdt.thirdparty.wn import maybe_install_wordnet ModuleNotFoundError: No module named 'nbdt.thirdparty'

It's the full error tips

zhuyi3625 avatar Mar 15 '21 06:03 zhuyi3625

Thanks for your traceback, but same question -- is your environment using python2 or python3? I was able to setup the repository inside a conda environment with python3 successfully, using the below:

conda create -n nbdt python=3.7
git clone [email protected]:alvinwan/neural-backed-decision-trees.git  # or use https to clone
cd neural-backed-decision-trees
python setup.py develop
nbdt-hierarchy --help

alvinwan avatar Mar 16 '21 01:03 alvinwan

Thanks for your traceback, but same question -- is your environment using python2 or python3? I was able to setup the repository inside a conda environment with python3 successfully, using the below:

conda create -n nbdt python=3.7
git clone [email protected]:alvinwan/neural-backed-decision-trees.git  # or use https to clone
cd neural-backed-decision-trees
python setup.py develop
nbdt-hierarchy --help

Pre-use is python3.8,torch 1.8 and torchvision 0.9, I changed it to python3.7,torch1.6,and torchvision 0.7, now it works!

But there still an unexpected question, using command nbdt-wnids --dataset=CIFAR10, error tips, Traceback (most recent call last): File "/data/anaconda3/envs/nbdt/bin/nbdt-wnids", line 7, in exec(compile(f.read(), file, 'exec')) File "/data/M808/zhuyi/NBDTNemaTest/nbdt/bin/nbdt-wnids", line 49, in print('keys',data.custom.keys) AttributeError: module 'nbdt.data.custom' has no attribute 'keys'

there is no attribute 'keys' in custom.py

zhuyi3625 avatar Mar 16 '21 10:03 zhuyi3625