yasenh / libtorch-yolov5

A LibTorch inference implementation of the yolov5
MIT License
372 stars 114 forks source link

RuntimeError: Could not run 'prepacked::conv2d_clamp_run' with arguments from the 'CUDA' backend. #62

Open JerryAuas opened 1 year ago

JerryAuas commented 1 year ago

I use the cuda-10.2 torch-1.9.0 when i use it, i got this error. I try to do something, but i cant solved this error, hopefull you can give me some help @yasenh. Thx!

JerryAuas commented 1 year ago

cuda is available Class: [ person, bicycle, car, motorcycle, airplane, bus, train, truck, boat, traffic light, fire hydrant, stop sign, parking meter, bench, bird, cat, dog, horse, sheep, cow, elephant, bear, zebra, giraffe, backpack, umbrella, handbag, tie, suitcase, frisbee, skis, snowboard, sports ball, kite, baseball bat, baseball glove, skateboard, surfboard, tennis racket, bottle, wine glass, cup, fork, knife, spoon, bowl, banana, apple, sandwich, orange, broccoli, carrot, hot dog, pizza, donut, cake, chair, couch, potted plant, bed, dining table, toilet, tv, laptop, mouse, remote, keyboard, cell phone, microwave, oven, toaster, sink, refrigerator, book, clock, vase, scissors, teddy bear, hair drier, toothbrush, ] Run once on empty image ----------New Frame---------- pre-process takes : 1898 ms terminate called after throwing an instance of 'std::runtime_error' what(): The following operation failed in the TorchScript interpreter. Traceback of TorchScript, serialized code (most recent call last): File "code/torch/models/yolo/___torch_mangle_1108.py", line 16, in forward _7 = torch.slice(_6, 3, 1, 9223372036854775807, 2) input = torch.cat([_1, _3, _5, _7], 1) _8 = ops.prepacked.conv2d_clamp_run(input, CONSTANTS.c0)


    input0 = torch.mul(_8, torch.sigmoid(_8))
    _9 = ops.prepacked.conv2d_clamp_run(input0, CONSTANTS.c1)

Traceback of TorchScript, original code (most recent call last):
            %weight, %bias, %stride, %padding, %dilation, %groups,
            %output_min_max, %output_min_max)
        %r = prepacked::conv2d_clamp_run(%input, %packed_weight_bias)
             ~~~~~~~~~ <--- HERE
        return (%r) 
RuntimeError: Could not run 'prepacked::conv2d_clamp_run' with arguments from the 'CUDA' backend. This could be because the operator doesn't exist for this backend, or was omitted during the selective/custom build process (if using custom build). If you are a Facebook employee using PyTorch on mobile, please visit https://fburl.com/ptmfixes for possible resolutions. 'prepacked::conv2d_clamp_run' is only available for these backends: [CPU, BackendSelect, Named, AutogradOther, AutogradCPU, AutogradCUDA, AutogradXLA, Tracer, Autocast, Batched, VmapMode].

CPU: registered at ../aten/src/ATen/native/xnnpack/RegisterOpContextClass.cpp:84 [kernel]
BackendSelect: fallthrough registered at ../aten/src/ATen/core/BackendSelectFallbackKernel.cpp:3 [backend fallback]
Named: registered at ../aten/src/ATen/core/NamedRegistrations.cpp:7 [backend fallback]
AutogradOther: fallthrough registered at ../aten/src/ATen/core/VariableFallbackKernel.cpp:35 [backend fallback]
AutogradCPU: fallthrough registered at ../aten/src/ATen/core/VariableFallbackKernel.cpp:39 [backend fallback]
AutogradCUDA: fallthrough registered at ../aten/src/ATen/core/VariableFallbackKernel.cpp:43 [backend fallback]
AutogradXLA: fallthrough registered at ../aten/src/ATen/core/VariableFallbackKernel.cpp:47 [backend fallback]
Tracer: fallthrough registered at ../torch/csrc/jit/frontend/tracer.cpp:999 [backend fallback]
Autocast: fallthrough registered at ../aten/src/ATen/autocast_mode.cpp:250 [backend fallback]
Batched: registered at ../aten/src/ATen/BatchingRegistrations.cpp:1016 [backend fallback]
VmapMode: fallthrough registered at ../aten/src/ATen/VmapModeRegistrations.cpp:33 [backend fallback]

This is the terminal log.
wujunyi1412 commented 11 months ago

I have the same issue, and do not solve it. 江苏老乡