megvii-research / FSCE

Apache License 2.0
274 stars 47 forks source link

ImportError: cannot import name '_C' from 'fsdet' #39

Open a07913838438 opened 2 years ago

a07913838438 commented 2 years ago

Thanks for your great projects and Thanks for share the code of your great work! I have done all the installations shown on README but still, I get his error message whenever I try to do the train_net.py: Importerror: cannot import name '_C' from 'fsdet' can you give me any advice?thanks very much.

alphacyp commented 2 years ago

Maybe the versions of pytorch and fsdet do not match the author's.

zongdaoming commented 2 years ago

My environment is set as follows

python -m pip install detectron2==0.2.1 -f \ https://dl.fbaipublicfiles.com/detectron2/wheels/cu92/torch1.5/index.html conda install pytorch==1.5.1 torchvision==0.6.1 cudatoolkit=9.2 -c pytorch

And this setting work! Wish to help you. @a07913838438

Jacobi93 commented 2 years ago

i am faced with the same problem and i could not fix it by changing different versions of packages. is there any other reason why someone may get this problem? Thanks.

ell-hol commented 2 years ago

@zongdaoming which python version are you using tho ?

lotuser1 commented 2 years ago

我现在用的是torch1.5.1 cuda10.1。还是不能导入_c,和楼主一样的问题,但是我ubuntu是20.04版本,下载不了cuda9.2,你用的是哪个版本的ubuntu?

lotuser1 commented 2 years ago

我把 from fsdet import _C 改成 from fsdet.config.default import _C,就没有这个错误了,但是在运行train_net时出现了AttributeError: roi_align_forward,定位到 output = _C.roi_align_forward( input, roi, spatial_scale, output_size[0], output_size[1], sampling_ratio, aligned )这行代码,_C中没有这个roi-align_forward方法,所以是不是第一个地方就改错了呢?有人解决_C这个问题了?求助

lotuser1 commented 2 years ago

自己回复自己吧 最后把报错那句话里面的fsdet全部改成detectron2 就好了,实际我已经用pip命令安装过detectron2包,具体我也不知道为什么改掉就好了

kike-0304 commented 2 years ago

自己回复自己吧 最后把报错那句话里面的fsdet全部改成detectron2 就好了,实际我已经用pip命令安装过detectron2包,具体我也不知道为什么改掉就好了

请问您的detector的版本对应的cuda和torch版本是多少,我把fsdet改为detectot2后也会出现no attribute 'roi_align_forward'。

xyqqqfs commented 2 years ago

cuda11.1+torch1.9.0+detetron2 v0.2.1,把所有出错的from fsdet.config.default import _C改成from detectron2.config.default import _C就能跑了

lotuser1 commented 2 years ago

自己回复自己吧 最后把报错那句话里面的fsdet全部改成detectron2 就好了,实际我已经用pip命令安装过detectron2包,具体我也不知道为什么改掉就好了

请问您的detector的版本对应的cuda和torch版本是多少,我把fsdet改为detectot2后也会出现no attribute 'roi_align_forward torch 1.5.0 +cuda 10.1+detectron2 0.2.1

lotuser1 commented 2 years ago

请问你怎么装的detectron2 v0.2.1,我换了一台机子环境是cuda11.1+torch1.8,但是我忘了怎么装detectron2的包了,在detectron2的tutorial里看到的v0.2.1 不支持这个环境,不知道该怎么办了

xyqqqfs commented 2 years ago

请问你怎么装的detectron2 v0.2.1,我换了一台机子环境是cuda11.1+torch1.8,但是我忘了怎么装detectron2的包了,在detectron2的tutorial里看到的v0.2.1 不支持这个环境,不知道该怎么办了

https://blog.csdn.net/qq_35030874/article/details/116915874 按这篇博文下的,高版本的detectron2会报别的错

lotuser1 commented 2 years ago

这个博客写的是在win下面编译,你也用的win系统吗

xyqqqfs commented 2 years ago

这个博客写的是在win下面编译,你也用的win系统吗

我用的ubuntu20.04,差不多的

lotuser1 commented 2 years ago

我也是ubuntu20,在执行sudo python setup.py build develop 编译这一步卡住了,会报nvcc fatal:Unsupported gpu architecture 'compute_86' error:command '/usr/bin/nvcc' failed with exit status 1,你有遇到过吗?我在1080ti都没遇到过 在3070才遇到