Similar to #1405, but I'm seeing this issue in the nightly builds.
What I did:
I download two nightly wheels from https://download.pytorch.org/whl/nightly/cu100/torch_nightly.html, and installed them with:
pip install torch-1.4.0.dev20191017+cu100-cp37-cp37m-linux_x86_64.whl torchvision-0.5.0.dev20191017+cu100-cp37-cp37m-linux_x86_64.whl
Then, I recompile detectron2; Running a simple detectron2 evaluation raises this error:
python tools/train_net.py --config-file configs/LVIS-InstanceSegmentation/mask_rcnn_R_101_FPN_1x.yaml --num-gpus 2 --eval-only DATALOADER.NUM_WORKERS 1 MODEL.WEIGHTS ~/data/D2models/LVIS-InstanceSegmentation/mask_rcnn_R_101_FPN_1x/144219035/model_final_824ab5.pkl
an example stack trace:
Traceback (most recent call last):
File "tools/train_net.py", line 162, in <module>
args=(args,),
File "/private/home/yuxinwu/detectron2/detectron2/engine/launch.py", line 52, in launch
main_func(*args)
File "tools/train_net.py", line 133, in main
res = Trainer.test(cfg, model)
File "/private/home/yuxinwu/detectron2/detectron2/engine/defaults.py", line 413, in test
results_i = inference_on_dataset(model, data_loader, evaluator)
File "/private/home/yuxinwu/detectron2/detectron2/evaluation/evaluator.py", line 118, in inference_on_dataset
outputs = model(inputs)
File "/private/home/yuxinwu/miniconda3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 541, in __call__
result = self.forward(*input, **kwargs)
File "/private/home/yuxinwu/detectron2/detectron2/modeling/meta_arch/rcnn.py", line 66, in forward
return self.inference(batched_inputs)
File "/private/home/yuxinwu/detectron2/detectron2/modeling/meta_arch/rcnn.py", line 119, in inference
proposals, _ = self.proposal_generator(images, features, None)
File "/private/home/yuxinwu/miniconda3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 541, in __call__
result = self.forward(*input, **kwargs)
File "/private/home/yuxinwu/detectron2/detectron2/modeling/proposal_generator/rpn.py", line 179, in forward
self.training,
File "/private/home/yuxinwu/detectron2/detectron2/modeling/proposal_generator/rpn_outputs.py", line 136, in find_top_rpn_proposals
keep = batched_nms(boxes.tensor, scores_per_img, lvl, nms_thresh)
File "/private/home/yuxinwu/detectron2/detectron2/layers/nms.py", line 17, in batched_nms
return box_ops.batched_nms(boxes, scores, idxs, iou_threshold)
File "/private/home/yuxinwu/miniconda3/lib/python3.7/site-packages/torchvision/ops/boxes.py", line 70, in batched_nms
keep = nms(boxes_for_nms, scores, iou_threshold)
File "/private/home/yuxinwu/miniconda3/lib/python3.7/site-packages/torchvision/ops/boxes.py", line 31, in nms
return torch.ops.torchvision.nms(boxes, scores, iou_threshold)
File "/private/home/yuxinwu/miniconda3/lib/python3.7/site-packages/torch/_ops.py", line 61, in __getattr__
op = torch._C._jit_get_operation(qualified_op_name)
RuntimeError: No such operator torchvision::nms
another stack trace: https://github.com/facebookresearch/detectron2/issues/94#issue-507812638
Thanks for the detailed report!
I think the issue is that since https://github.com/pytorch/vision/pull/1467 we now build torchvision nightlies against PyTorch 1.3, and not PyTorch master.
The reason why I changed it to PyTorch 1.3 was because I was planning on cutting a new release of torchvision in the next few days, so it should be cut against PyTorch 1.3 and we needed to test that CI is working with PyTorch 1.3
But I think there is no need that the nightlies to be built based on PyTorch 1.3
building from source, torchvision latest master, pytorch from tag v1.3.0, see every test in test_ops.py fail with the similar error... Here is the tail of the log, the rest is similar
```======================================================================
Traceback (most recent call last):
File "test_ops.py", line 249, in test_roi_pool_gradient_cuda
y = layer(x, rois)
File "/home/tangorn/src/pytorch/build/install/lib64/python3.6/site-packages/torch/nn/modules/module.py", line 541, in __call__
result = self.forward(input, *kwargs)
File "/home/tangorn/src/pytorch/build/install/lib64/python3.6/site-packages/torchvision-0.5.0a0+97b53f9-py3.6-linux-x86_64.egg/torchvision/ops/roi_pool.py", line 49, in forward
return roi_pool(input, rois, self.output_size, self.spatial_scale)
File "/home/tangorn/src/pytorch/build/install/lib64/python3.6/site-packages/torchvision-0.5.0a0+97b53f9-py3.6-linux-x86_64.egg/torchvision/ops/roi_pool.py", line 34, in roi_pool
output, _ = torch.ops.torchvision.roi_pool(input, rois, spatial_scale,
File "/home/tangorn/src/pytorch/build/install/lib64/python3.6/site-packages/torch/_ops.py", line 61, in __getattr__
op = torch._C._jit_get_operation(qualified_op_name)
RuntimeError: No such operator torchvision::roi_pool
Ran 36 tests in 0.999s
FAILED (errors=36)
```
might be not related to the original issue, I am pretty new to pytorch, could have messed up something in my installation.
Hi @tangorn
I think there was a problem with your compilation of torchvision.
Can you do a clean install (removing all previously installed version of torchvision that you had), doing
python setup.py clean
python setup.py install
and report back? This should fix your issues
Also, @tangorn another option is to use PyTorch nightly and torchvision nightly, as we provide pre-built binaries for both.
did full clean rebuild of both pytorch and vision. Same issue. Other tests like test_transforms etc run fine. test_models fails only for models that use nms op. I have a feeling that the ops somehow do not register properly. Working from binary is not an attractive option for me as i am planning to add a few ops of my own...
rolling back to your 0.4.0 branch fixed it.
@tangorn can you paste the build logs from TorchVision? I'm fairly confident that there has been a compilation issue somewhere, just need to find out where, and I'd love to get this fixed with master.
Here you go:
torchvision-0.5.0-build.log
using python3 setup.py install, the beginning got cut due to excessive warnings, let me know if you need it too
@tangorn thanks for the log.
One more question: did you use the same PyTorch install to both compile torchvision and to run it?
If you could go to the torchvision folder, and do
torch.ops.load_library('_C.so')
and print the error message, it will be very helpful as well.
There is probably an incompatibility between the PyTorch version used to compile torchvision and the one you are using during runtime
OSError: /home/tangorn/src/torchvision-my/_C.so: cannot open shared object file: No such file or directory
which is understandable as
tangorn@linux-429s:~/src/torchvision-my> locate _C.so
/home/tangorn/src/torchvision-my/build/lib.linux-x86_64-3.6/torchvision/_C.so
tangorn@linux-429s:~/src/torchvision-my>
it is built but not installed in the pytorch tree. But even copying it there by hand does not seem to work:
tangorn@linux-429s:~/src/torchvision-my> echo $LD_LIBRARY_PATH
/home/tangorn/src/pytorch/build/install/lib:/usr/local/cuda-10.0/lib64
tangorn@linux-429s:~/src/torchvision-my> /home/tangorn/src/pytorch/build/install/bin/python3 test.py
Traceback (most recent call last):
File "test.py", line 3, in <module>
torch.ops.load_library('_C.so')
File "/home/tangorn/src/pytorch/build/install/lib64/python3.6/site-packages/torch/_ops.py", line 106, in load_library
ctypes.CDLL(path)
File "/usr/lib64/python3.6/ctypes/__init__.py", line 348, in __init__
self._handle = _dlopen(self._name, mode)
OSError: /home/tangorn/src/torchvision-my/_C.so: cannot open shared object file: No such file or directory
tangorn@linux-429s:~/src/torchvision-my>
incompatibility I doubt as i run the test right after running setup.py install and i did not touch the pytorch since the clean rebuild yesterday
@tangorn thanks for trying this out. The second error message still doesn't give us the info I was looking for, can you pass the full path to the _C.so lib?
recreated the whole setup on my home box from scratch. Same result: 0.4.0 works, 0.5.0 does not. The only path I can find _C.so is in the build directory:
/home/tangorn/src/torchvision-my/build/lib.linux-x86_64-3.6/torchvision/_C.so
after running the test with 0.4.0 i can also see one in cache:
/home/tangorn/.cache/Python-Eggs/torchvision-0.4.0a0+d31eafa-py3.6-linux-x86_64.egg-tmp/torchvision/_C.so
@tangorn sorry, I meant to pass the full path to _C.so to torch.ops.load_library
there is no error if i do it:
tangorn@umbar:~/src/vision> /home/tangorn/src/pytorch/build/install/bin/python3
Python 3.6.5 (default, Mar 31 2018, 19:45:04) [GCC] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> torch.ops.load_library('/home/tangorn/src/vision/build/lib.linux-x86_64-3.6/torchvision/_C.so')
>>>
@tangorn so your torchvision install might be picking the wrong _C.so file.
I'd recommend removing the try: in https://github.com/pytorch/vision/blob/13b35ffaa5167f3713ea7a53c43395d90b3a7cbc/torchvision/extension.py#L15-L19
so that you can further debug the issue. It's probably related to the fact that in your setup https://github.com/pytorch/vision/blob/13b35ffaa5167f3713ea7a53c43395d90b3a7cbc/torchvision/extension.py#L10-L11 is not picking the right library
hmm, i did the above and added print statements to print lib_dir and path, then did setup.py clean, setup.py install, saved the whole log, and did not see the printouts. As if extension.py was never ran.
oh, see it, it's runtime stuff
so the lib_dir looks right, and the _C.so is there, but line 11 of extension.py fails
File "/usr/lib64/python3.6/imp.py", line 297, in find_module
raise ImportError(_ERR_MSG.format(name), name=name)
ImportError: No module named '_C'
@tangorn can you try running the same code but on an interpreter, to see if it finds the module?
So something like
lib_dir = 'path_to_your_libdir'
_, path, _ = imp.find_module("_C", [lib_dir])
The imp package is deprecated in newer versions of Python, but it's kept there for compatibility with Python2. I'm trying to understand why it's not picking the right lib for you. I think your system might be encapsulating the python code separately from the .so lib that is exported?
same error in interpreter
I have no other ideas then, this seems like a problem with your Python install then?
maybe. the difference with 0.4.0 that I see is that it has also _C.cpython-36m-x86_64-linux-gnu.so and _C.py refers to it rather than _C.so
oh, and the same code in interpreter fails for 0.4.0 the same way it does for 0.5.0
I did a quick google search and the closest I found was https://github.com/tensorflow/tensorflow/issues/8107, which pointed to a compilation error, but that's not the case in here. I'm running out of ideas for now, and as I cant reproduce the error it's very hard to try to find a solution without more details
I'm on torch 1.3.0 and building torchvision from master, and I am also getting the errors on running test_ops.py :
======================================================================
ERROR: test_roi_pool_gradient_cpu (test_ops.RoIPoolTester)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/pfr/code/repos/other/vision/test/test_ops.py", line 122, in test_roi_pool_gradient_cpu
y = layer(x, rois)
File "/Users/pfr/.conda/envs/gct/lib/python3.7/site-packages/torch/nn/modules/module.py", line 541, in __call__
result = self.forward(*input, **kwargs)
File "/Users/pfr/.conda/envs/gct/lib/python3.7/site-packages/torchvision-0.5.0a0+13b35ff-py3.7-macosx-10.9-x86_64.egg/torchvision/ops/roi_pool.py", line 49, in forward
return roi_pool(input, rois, self.output_size, self.spatial_scale)
File "/Users/pfr/.conda/envs/gct/lib/python3.7/site-packages/torchvision-0.5.0a0+13b35ff-py3.7-macosx-10.9-x86_64.egg/torchvision/ops/roi_pool.py", line 34, in roi_pool
output, _ = torch.ops.torchvision.roi_pool(input, rois, spatial_scale,
File "/Users/pfr/.conda/envs/gct/lib/python3.7/site-packages/torch/_ops.py", line 61, in __getattr__
op = torch._C._jit_get_operation(qualified_op_name)
RuntimeError: No such operator torchvision::roi_pool
Removing the try block in extension.py gives me the same error ImportError: No module named '_C'.
I was wondering if was an issue related to the library being a zipped egg file (related to https://github.com/pytorch/pytorch/issues/20781 ?), so I unzipped it, and then I'm not getting the ImportError anymore, but still getting the initial error No such operator torchvision::roi_pool.
Not sure if it helps, but this is what my unzipped egg looks like:
โโโ torchvision-0.5.0a0+13b35ff-py3.7-macosx-10.9-x86_64.egg
โย ย โโโ EGG-INFO
โย ย โย ย โโโ PKG-INFO
โย ย โย ย โโโ SOURCES.txt
โย ย โย ย โโโ dependency_links.txt
โย ย โย ย โโโ native_libs.txt
โย ย โย ย โโโ requires.txt
โย ย โย ย โโโ top_level.txt
โย ย โย ย โโโ zip-safe
โย ย โโโ torchvision
โย ย โโโ _C.cpython-37m-darwin.so
โย ย โโโ _C.py
โย ย โโโ _C.so
โย ย โโโ _C_tests.cpython-37m-darwin.so
โย ย โโโ _C_tests.py
โย ย โโโ _C_tests.so
โย ย โโโ __init__.py
โย ย โโโ __pycache__
โย ย โย ย โโโ _C.cpython-37.pyc
โย ย โย ย โโโ _C_tests.cpython-37.pyc
โย ย โย ย โโโ __init__.cpython-37.pyc
โย ย โย ย โโโ extension.cpython-37.pyc
โย ย โย ย โโโ utils.cpython-37.pyc
โย ย โย ย โโโ version.cpython-37.pyc
โย ย โโโ _custom_ops.cpython-37m-darwin.so
โย ย โโโ datasets
โย ย โย ย โโโ __init__.py
โย ย โย ย โโโ __pycache__
โย ย โย ย โย ย โโโ __init__.cpython-37.pyc
โย ย โย ย โย ย โโโ caltech.cpython-37.pyc
โย ย โย ย โย ย โโโ celeba.cpython-37.pyc
โย ย โย ย โย ย โโโ cifar.cpython-37.pyc
โย ย โย ย โย ย โโโ cityscapes.cpython-37.pyc
โย ย โย ย โย ย โโโ coco.cpython-37.pyc
โย ย โย ย โย ย โโโ fakedata.cpython-37.pyc
โย ย โย ย โย ย โโโ flickr.cpython-37.pyc
โย ย โย ย โย ย โโโ folder.cpython-37.pyc
โย ย โย ย โย ย โโโ hmdb51.cpython-37.pyc
โย ย โย ย โย ย โโโ imagenet.cpython-37.pyc
โย ย โย ย โย ย โโโ kinetics.cpython-37.pyc
โย ย โย ย โย ย โโโ lsun.cpython-37.pyc
โย ย โย ย โย ย โโโ mnist.cpython-37.pyc
โย ย โย ย โย ย โโโ omniglot.cpython-37.pyc
โย ย โย ย โย ย โโโ phototour.cpython-37.pyc
โย ย โย ย โย ย โโโ sbd.cpython-37.pyc
โย ย โย ย โย ย โโโ sbu.cpython-37.pyc
โย ย โย ย โย ย โโโ semeion.cpython-37.pyc
โย ย โย ย โย ย โโโ stl10.cpython-37.pyc
โย ย โย ย โย ย โโโ svhn.cpython-37.pyc
โย ย โย ย โย ย โโโ ucf101.cpython-37.pyc
โย ย โย ย โย ย โโโ usps.cpython-37.pyc
โย ย โย ย โย ย โโโ utils.cpython-37.pyc
โย ย โย ย โย ย โโโ video_utils.cpython-37.pyc
โย ย โย ย โย ย โโโ vision.cpython-37.pyc
โย ย โย ย โย ย โโโ voc.cpython-37.pyc
โย ย โย ย โโโ caltech.py
โย ย โย ย โโโ celeba.py
โย ย โย ย โโโ cifar.py
โย ย โย ย โโโ cityscapes.py
โย ย โย ย โโโ coco.py
โย ย โย ย โโโ fakedata.py
โย ย โย ย โโโ flickr.py
โย ย โย ย โโโ folder.py
โย ย โย ย โโโ hmdb51.py
โย ย โย ย โโโ imagenet.py
โย ย โย ย โโโ kinetics.py
โย ย โย ย โโโ lsun.py
โย ย โย ย โโโ mnist.py
โย ย โย ย โโโ omniglot.py
โย ย โย ย โโโ phototour.py
โย ย โย ย โโโ samplers
โย ย โย ย โย ย โโโ __init__.py
โย ย โย ย โย ย โโโ __pycache__
โย ย โย ย โย ย โย ย โโโ __init__.cpython-37.pyc
โย ย โย ย โย ย โย ย โโโ clip_sampler.cpython-37.pyc
โย ย โย ย โย ย โโโ clip_sampler.py
โย ย โย ย โโโ sbd.py
โย ย โย ย โโโ sbu.py
โย ย โย ย โโโ semeion.py
โย ย โย ย โโโ stl10.py
โย ย โย ย โโโ svhn.py
โย ย โย ย โโโ ucf101.py
โย ย โย ย โโโ usps.py
โย ย โย ย โโโ utils.py
โย ย โย ย โโโ video_utils.py
โย ย โย ย โโโ vision.py
โย ย โย ย โโโ voc.py
โย ย โโโ extension.py
โย ย โโโ io
โย ย โย ย โโโ __init__.py
โย ย โย ย โโโ __pycache__
โย ย โย ย โย ย โโโ __init__.cpython-37.pyc
โย ย โย ย โย ย โโโ _video_opt.cpython-37.pyc
โย ย โย ย โย ย โโโ video.cpython-37.pyc
โย ย โย ย โโโ _video_opt.py
โย ย โย ย โโโ video.py
โย ย โโโ models
โย ย โย ย โโโ __init__.py
โย ย โย ย โโโ __pycache__
โย ย โย ย โย ย โโโ __init__.cpython-37.pyc
โย ย โย ย โย ย โโโ _utils.cpython-37.pyc
โย ย โย ย โย ย โโโ alexnet.cpython-37.pyc
โย ย โย ย โย ย โโโ densenet.cpython-37.pyc
โย ย โย ย โย ย โโโ googlenet.cpython-37.pyc
โย ย โย ย โย ย โโโ inception.cpython-37.pyc
โย ย โย ย โย ย โโโ mnasnet.cpython-37.pyc
โย ย โย ย โย ย โโโ mobilenet.cpython-37.pyc
โย ย โย ย โย ย โโโ resnet.cpython-37.pyc
โย ย โย ย โย ย โโโ shufflenetv2.cpython-37.pyc
โย ย โย ย โย ย โโโ squeezenet.cpython-37.pyc
โย ย โย ย โย ย โโโ utils.cpython-37.pyc
โย ย โย ย โย ย โโโ vgg.cpython-37.pyc
โย ย โย ย โโโ _utils.py
โย ย โย ย โโโ alexnet.py
โย ย โย ย โโโ densenet.py
โย ย โย ย โโโ detection
โย ย โย ย โย ย โโโ __init__.py
โย ย โย ย โย ย โโโ __pycache__
โย ย โย ย โย ย โย ย โโโ __init__.cpython-37.pyc
โย ย โย ย โย ย โย ย โโโ _utils.cpython-37.pyc
โย ย โย ย โย ย โย ย โโโ backbone_utils.cpython-37.pyc
โย ย โย ย โย ย โย ย โโโ faster_rcnn.cpython-37.pyc
โย ย โย ย โย ย โย ย โโโ generalized_rcnn.cpython-37.pyc
โย ย โย ย โย ย โย ย โโโ image_list.cpython-37.pyc
โย ย โย ย โย ย โย ย โโโ keypoint_rcnn.cpython-37.pyc
โย ย โย ย โย ย โย ย โโโ mask_rcnn.cpython-37.pyc
โย ย โย ย โย ย โย ย โโโ roi_heads.cpython-37.pyc
โย ย โย ย โย ย โย ย โโโ rpn.cpython-37.pyc
โย ย โย ย โย ย โย ย โโโ transform.cpython-37.pyc
โย ย โย ย โย ย โโโ _utils.py
โย ย โย ย โย ย โโโ backbone_utils.py
โย ย โย ย โย ย โโโ faster_rcnn.py
โย ย โย ย โย ย โโโ generalized_rcnn.py
โย ย โย ย โย ย โโโ image_list.py
โย ย โย ย โย ย โโโ keypoint_rcnn.py
โย ย โย ย โย ย โโโ mask_rcnn.py
โย ย โย ย โย ย โโโ roi_heads.py
โย ย โย ย โย ย โโโ rpn.py
โย ย โย ย โย ย โโโ transform.py
โย ย โย ย โโโ googlenet.py
โย ย โย ย โโโ inception.py
โย ย โย ย โโโ mnasnet.py
โย ย โย ย โโโ mobilenet.py
โย ย โย ย โโโ quantization
โย ย โย ย โย ย โโโ __init__.py
โย ย โย ย โย ย โโโ __pycache__
โย ย โย ย โย ย โย ย โโโ __init__.cpython-37.pyc
โย ย โย ย โย ย โย ย โโโ mobilenet.cpython-37.pyc
โย ย โย ย โย ย โย ย โโโ resnet.cpython-37.pyc
โย ย โย ย โย ย โย ย โโโ utils.cpython-37.pyc
โย ย โย ย โย ย โโโ mobilenet.py
โย ย โย ย โย ย โโโ resnet.py
โย ย โย ย โย ย โโโ utils.py
โย ย โย ย โโโ resnet.py
โย ย โย ย โโโ segmentation
โย ย โย ย โย ย โโโ __init__.py
โย ย โย ย โย ย โโโ __pycache__
โย ย โย ย โย ย โย ย โโโ __init__.cpython-37.pyc
โย ย โย ย โย ย โย ย โโโ _utils.cpython-37.pyc
โย ย โย ย โย ย โย ย โโโ deeplabv3.cpython-37.pyc
โย ย โย ย โย ย โย ย โโโ fcn.cpython-37.pyc
โย ย โย ย โย ย โย ย โโโ segmentation.cpython-37.pyc
โย ย โย ย โย ย โโโ _utils.py
โย ย โย ย โย ย โโโ deeplabv3.py
โย ย โย ย โย ย โโโ fcn.py
โย ย โย ย โย ย โโโ segmentation.py
โย ย โย ย โโโ shufflenetv2.py
โย ย โย ย โโโ squeezenet.py
โย ย โย ย โโโ utils.py
โย ย โย ย โโโ vgg.py
โย ย โย ย โโโ video
โย ย โย ย โโโ __init__.py
โย ย โย ย โโโ __pycache__
โย ย โย ย โย ย โโโ __init__.cpython-37.pyc
โย ย โย ย โย ย โโโ resnet.cpython-37.pyc
โย ย โย ย โโโ resnet.py
โย ย โโโ ops
โย ย โย ย โโโ __init__.py
โย ย โย ย โโโ __pycache__
โย ย โย ย โย ย โโโ __init__.cpython-37.pyc
โย ย โย ย โย ย โโโ _custom_ops.cpython-37.pyc
โย ย โย ย โย ย โโโ _register_onnx_ops.cpython-37.pyc
โย ย โย ย โย ย โโโ _utils.cpython-37.pyc
โย ย โย ย โย ย โโโ boxes.cpython-37.pyc
โย ย โย ย โย ย โโโ feature_pyramid_network.cpython-37.pyc
โย ย โย ย โย ย โโโ misc.cpython-37.pyc
โย ย โย ย โย ย โโโ poolers.cpython-37.pyc
โย ย โย ย โย ย โโโ ps_roi_align.cpython-37.pyc
โย ย โย ย โย ย โโโ ps_roi_pool.cpython-37.pyc
โย ย โย ย โย ย โโโ roi_align.cpython-37.pyc
โย ย โย ย โย ย โโโ roi_pool.cpython-37.pyc
โย ย โย ย โโโ _custom_ops.py
โย ย โย ย โโโ _register_onnx_ops.py
โย ย โย ย โโโ _utils.py
โย ย โย ย โโโ boxes.py
โย ย โย ย โโโ feature_pyramid_network.py
โย ย โย ย โโโ misc.py
โย ย โย ย โโโ poolers.py
โย ย โย ย โโโ ps_roi_align.py
โย ย โย ย โโโ ps_roi_pool.py
โย ย โย ย โโโ roi_align.py
โย ย โย ย โโโ roi_pool.py
โย ย โโโ transforms
โย ย โย ย โโโ __init__.py
โย ย โย ย โโโ __pycache__
โย ย โย ย โย ย โโโ __init__.cpython-37.pyc
โย ย โย ย โย ย โโโ _functional_video.cpython-37.pyc
โย ย โย ย โย ย โโโ _transforms_video.cpython-37.pyc
โย ย โย ย โย ย โโโ functional.cpython-37.pyc
โย ย โย ย โย ย โโโ functional_tensor.cpython-37.pyc
โย ย โย ย โย ย โโโ transforms.cpython-37.pyc
โย ย โย ย โโโ _functional_video.py
โย ย โย ย โโโ _transforms_video.py
โย ย โย ย โโโ functional.py
โย ย โย ย โโโ functional_tensor.py
โย ย โย ย โโโ transforms.py
โย ย โโโ utils.py
โย ย โโโ version.py
I don't have a deep understanding of the workings of the imports and builds here, so I'm not sure what is the easiest way to diagnose the issue, and what other info it would be useful to share.
Ok, I could reproduce the problem thanks to @pedrofreire snippet.
It seems to be due to installing the package with python setup.py install, while I've always used python setup.py build develop in order to be able to modify the library without reinstalling it.
I'm looking into a fix
@tangorn this should be fixed in master, let me know if you still face the same issue.
Note that once you install torchvision with python setup.py install, you'll need to change directories afterwards, or else you'll have the same issue.
Looks like it is past the _register_extensions() (removing try does not lead to error any more) and fails in the _check_cuda_version() of extension.py now:
tangorn@linux-429s:~/src/torchvision-my> /home/tangorn/src/pytorch/build/install/bin/python3 test/test_ops.py
Traceback (most recent call last):
File "test/test_ops.py", line 5, in <module>
from torchvision import ops
File "/home/tangorn/src/pytorch/build/install/lib64/python3.6/site-packages/torchvision-0.5.0a0+ca57148-py3.6-linux-x86_64.egg/torchvision/__init__.py", line 10, in <module>
from .extension import _HAS_OPS
File "/home/tangorn/src/pytorch/build/install/lib64/python3.6/site-packages/torchvision-0.5.0a0+ca57148-py3.6-linux-x86_64.egg/torchvision/extension.py", line 50, in <module>
_check_cuda_version()
File "/home/tangorn/src/pytorch/build/install/lib64/python3.6/site-packages/torchvision-0.5.0a0+ca57148-py3.6-linux-x86_64.egg/torchvision/extension.py", line 29, in _check_cuda_version
_version = torch.ops.torchvision._cuda_version()
File "/home/tangorn/src/pytorch/build/install/lib64/python3.6/site-packages/torch/_ops.py", line 61, in __getattr__
op = torch._C._jit_get_operation(qualified_op_name)
RuntimeError: No such operator torchvision::_cuda_version
@tangorn can you make sure you do a clean build? I think this is due to a binary from 0.4.0 being picked
tried it, did not work. on the other hand if i do setup.py build develop it works just fine, so you are probably right, i just did not clean out something, maybe cache...
@fmassa Should we expect torchvision::nms to work on pytorch-nightly built from source?
There's an issue with it.
E/AndroidRuntime: FATAL EXCEPTION: main
Process: org.pytorch.helloworld, PID: 23024
java.lang.RuntimeException: Unable to start activity ComponentInfo{org.pytorch.helloworld/org.pytorch.helloworld.MainActivity}: com.facebook.jni.CppException:
Unknown builtin op: torchvision::nms.
Could not find any similar ops to torchvision::nms. This op may not exist or may not be currently supported in TorchScript.
Note: I use pytorch_android_torchvision-1.4.0-SNAPSHOT.aar library
@zetyquickly hi,
This operator should work on pytorch-nightly. Maybe the issue is that you are trying to run on a mobile, and the mobile export hasn't registered those operators?
@dreiss is there a way of letting 3rd-party extensions to be linked against a mobile build of pytorch?
Not right now (for OSS builds). We'll look into it, but it is much easier to get a small app size if you're able to bring all of the code into a single library.
Most helpful comment
Ok, I could reproduce the problem thanks to @pedrofreire snippet.
It seems to be due to installing the package with
python setup.py install, while I've always usedpython setup.py build developin order to be able to modify the library without reinstalling it.I'm looking into a fix