jackroos / VL-BERT

Code for ICLR 2020 paper "VL-BERT: Pre-training of Generic Visual-Linguistic Representations".
MIT License
735 stars 110 forks source link

Why cannot import name 'C_ROIPooling' from 'common.lib.roi_pooling' #59

Closed wenhao7841 closed 3 years ago

wenhao7841 commented 3 years ago

I meet this problem: ImportError: cannot import name 'C_ROIPooling' from 'common.lib.roi_pooling' (/home/wenhao/project/VL-BERT-master/pretrain/../common/lib/roi_pooling/init.py) And I don't know how to solve.plz.

haozidede commented 3 years ago

compile with command: ./scripts/init.sh

jackroos commented 3 years ago

compile with command: ./scripts/init.sh

@haozidede Thanks for your kind reply. @WorthHouse You need to run the ./scripts/init.sh to compile the operators.

betterze commented 3 years ago

In code, common/lib/roi_pooling/roi_align.py, it does

from . import C_ROIPooling

it outputs error

ImportError: libtorch_cpu.so: cannot open shared object file: No such file or directory

I try to run the following code again,

./scripts/init.sh

it outputs

running build_ext
building 'C_ROIPooling' extension
Emitting ninja build file /cs/labs/danix/wuzongze/Gan_Manipulation/VL-BERT/common/lib/roi_pooling/build/temp.linux-x86_64-3.7/build.ninja...
Compiling objects...
Allowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N)
ninja: no work to do.
x86_64-linux-gnu-g++ -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,relro -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 /cs/labs/danix/wuzongze/Gan_Manipulation/VL-BERT/common/lib/roi_pooling/build/temp.linux-x86_64-3.7/cs/labs/danix/wuzongze/Gan_Manipulation/VL-BERT/common/lib/roi_pooling/vision.o /cs/labs/danix/wuzongze/Gan_Manipulation/VL-BERT/common/lib/roi_pooling/build/temp.linux-x86_64-3.7/cs/labs/danix/wuzongze/Gan_Manipulation/VL-BERT/common/lib/roi_pooling/cpu/ROIAlign_cpu.o -L/cs/labs/danix/wuzongze/pythonV/venv3.7/lib/python3.7/site-packages/torch/lib -lc10 -ltorch -ltorch_cpu -ltorch_python -o build/lib.linux-x86_64-3.7/C_ROIPooling.cpython-37m-x86_64-linux-gnu.so
copying build/lib.linux-x86_64-3.7/C_ROIPooling.cpython-37m-x86_64-linux-gnu.so -> 

It seems my installation is correct. Could you @huangyz0918 @jackroos tell me why this error happen?

Thank you in advance.

xinli2008 commented 2 years ago

have you soloved this problem? @betterze

betterze commented 2 years ago

@shaoniana1997 Unfortunately, I could not solve it.