You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
Cell In[6], line 2
1 model_path = "/slickformer/data/models/2023_02_18_00_38_07_4cls_rn152_pr512_px1024_1440min_maskrcnn_scripting_cpu_model.pt"
----> 2 scripted_model = torch.jit.load(model_path)
File ~/mambaforge/envs/slickformer/lib/python3.9/site-packages/torch/jit/_serialization.py:162, in load(f, map_location, _extra_files, _restore_shapes)
160 cu = torch._C.CompilationUnit()
161 if isinstance(f, (str, pathlib.Path)):
--> 162 cpp_module = torch._C.import_ir_module(cu, str(f), map_location, _extra_files, _restore_shapes) # type: ignore[call-arg]
163 else:
164 cpp_module = torch._C.import_ir_module_from_buffer(
165 cu, f.read(), map_location, _extra_files, _restore_shapes
166 ) # type: ignore[call-arg]
RuntimeError:
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.
:
File "code/__torch__/torchvision/ops/boxes.py", line 148
_61 = __torch__.torchvision.extension._assert_has_ops
_62 = _61()
_63 = ops.torchvision.nms(boxes, scores, iou_threshold)
~~~~~~~~~~~~~~~~~~~ <--- HERE
return _63
'nms' is being compiled since it was called from '_batched_nms_vanilla'
File "/root/work/.ice-env/lib/python3.9/site-packages/torchvision/ops/boxes.py", line 102
for class_id in torch.unique(idxs):
curr_indices = torch.where(idxs == class_id)[0]
curr_keep_indices = nms(boxes[curr_indices], scores[curr_indices], iou_threshold)
~~~ <--- HERE
keep_mask[curr_indices[curr_keep_indices]] = True
keep_indices = torch.where(keep_mask)[0]
Serialized File "code/__torch__/torchvision/ops/boxes.py", line 77
_28 = torch.index(boxes, _27)
_29 = annotate(List[Optional[Tensor]], [curr_indices])
curr_keep_indices = __torch__.torchvision.ops.boxes.nms(_28, torch.index(scores, _29), iou_threshold, )
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ <--- HERE
_30 = annotate(List[Optional[Tensor]], [curr_keep_indices])
_31 = torch.index(curr_indices, _30)
'_batched_nms_vanilla' is being compiled since it was called from 'batched_nms'
Serialized File "code/__torch__/torchvision/ops/boxes.py", line 35
idxs: Tensor,
iou_threshold: float) -> Tensor:
_9 = __torch__.torchvision.ops.boxes._batched_nms_vanilla
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ <--- HERE
_10 = __torch__.torchvision.ops.boxes._batched_nms_coordinate_trick
if torch.gt(torch.numel(boxes), 4000):
'batched_nms' is being compiled since it was called from 'RegionProposalNetwork.filter_proposals'
Serialized File "code/__torch__/torchvision/models/detection/rpn.py", line 72
_11 = __torch__.torchvision.ops.boxes.clip_boxes_to_image
_12 = __torch__.torchvision.ops.boxes.remove_small_boxes
_13 = __torch__.torchvision.ops.boxes.batched_nms
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ <--- HERE
num_images = (torch.size(proposals))[0]
device = ops.prim.device(proposals)
'RegionProposalNetwork.filter_proposals' is being compiled since it was called from 'RegionProposalNetwork.forward'
File "/root/work/.ice-env/lib/python3.9/site-packages/torchvision/models/detection/rpn.py", line 356
proposals = self.box_coder.decode(pred_bbox_deltas.detach(), anchors)
proposals = proposals.view(num_images, -1, 4)
boxes, scores = self.filter_proposals(proposals, objectness, images.image_sizes, num_anchors_per_level)
~~~~~~~~~~~~~~~~~~~~~ <--- HERE
losses = {}
Serialized File "code/__torch__/torchvision/models/detection/rpn.py", line 43
proposals0 = torch.view(proposals, [num_images, -1, 4])
image_sizes = images.image_sizes
_8 = (self).filter_proposals(proposals0, objectness0, image_sizes, num_anchors_per_level, )
~~~~~~~~~~~~~~~~~~~~~ <--- HERE
boxes, scores, = _8
losses = annotate(Dict[str, Tensor], {})
So I tried to switch fully to conda-forge channel without mixing the pytorch channel in once I saw that pytorchhad updated to 2.0 for conda forge. But I still get the same error above with this environment
That's because pytorch 2.0 is very fresh, and we haven't rebuilt all pytorch-derivative packages yet for it. The older torchvision packages didn't yet correctly pin the pytorch they're compiled against at runtime, so now you get an environment "resolution" that's only seemingly legal.
Solution to issue cannot be found in the documentation.
Issue
See conda-forge/pytorch-cpu-feedstock#165
I had a working conda environment that now breaks when I import torchvision due to the following error
So I tried to switch fully to conda-forge channel without mixing the pytorch channel in once I saw that pytorchhad updated to 2.0 for conda forge. But I still get the same error above with this environment
Installed packages
The text was updated successfully, but these errors were encountered: