Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RuntimeError: CUDA error: an illegal memory access was encountered #44

Closed
sdimantsd opened this issue Jan 31, 2021 · 5 comments
Closed

Comments

@sdimantsd
Copy link

sdimantsd commented Jan 31, 2021

Hi,
I trained my own dataset using yolact edge trainer.
When I try to eval I get this error:

python3 eval.py --use_fp16_tensorrt --trained_model=./weights/yolact_nets_shuk_resnet101_im320_9_130000.pth --images=/home/ws/images/imgs_in/:/home/ws/imgs_out --top_k=20 --score_threshold=0.3
Config not specified. Parsed yolact_nets_shuk_resnet101_im320_config from the file name.

[01/31 09:54:40 yolact.eval]: Loading model...
[01/31 09:54:50 yolact.eval]: Model loaded.
[01/31 09:54:50 yolact.eval]: Converting to TensorRT...
[01/31 09:54:50 yolact.eval]: Converting backbone to TensorRT...
[01/31 09:55:35 yolact.eval]: Converting protonet to TensorRT...
[01/31 09:55:41 yolact.eval]: Converting FPN to TensorRT...
Warning: Encountered known unsupported method torch.zeros
[01/31 09:55:51 yolact.eval]: Converting PredictionModule to TensorRT...
[01/31 09:56:02 yolact.eval]: Converted to TensorRT.

WARNING [01/31 09:56:03 yolact.layers.detect]: Encountered IndexError as mentioned in https://github.com/haotian-liu/yolact_edge/issues/27. Flattening predictions to avoid error, please verify the outputs. If there are any problems you met related to this, please report an issue.
/home/ws/images/imgs_in/13.jpg -> /home/ws/imgs_out/13.png
Traceback (most recent call last):
  File "eval.py", line 1246, in <module>
    evaluate(net, dataset)
  File "eval.py", line 887, in evaluate
    evalimages(net, inp, out)
  File "eval.py", line 619, in evalimages
    evalimage(net, path, out_path)
  File "eval.py", line 594, in evalimage
    preds = net(batch, extras=extras)["pred_outs"]
  File "/home/ws/.local/lib/python3.6/site-packages/torch/nn/modules/module.py", line 722, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/home/ws/DL/yolact_edge/yolact.py", line 1879, in forward
    outs_wrapper["pred_outs"] = self.detect(pred_outs, extras=extras)
  File "/home/ws/DL/yolact_edge/layers/functions/detection.py", line 77, in __call__
    decoded_boxes = decode(loc_data[batch_idx], prior_data)
RuntimeError: The following operation failed in the TorchScript interpreter.
Traceback of TorchScript (most recent call last):
  File "/home/ws/DL/yolact_edge/layers/box_utils.py", line 264, in decode
        boxes = torch.cat((
            priors[:, :2] + loc[:, :2] * variances[0] * priors[:, 2:],
            priors[:, 2:] * torch.exp(loc[:, 2:] * variances[1])), 1)
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ <--- HERE
        boxes[:, :2] -= boxes[:, 2:] / 2
        boxes[:, 2:] += boxes[:, :2]
RuntimeError: CUDA error: an illegal memory access was encountered

If I use --disable_tensorrt, it's works without any error.

@haotian-liu
Copy link
Collaborator

It seems that for some of the models, the TensorRT conversion will cause some of the issues. Investigating the issue as in #38 and #42.

@sdimantsd
Copy link
Author

Oh OK.
Thanks :-)

@haotian-liu
Copy link
Collaborator

Hi I am currently closing this issue, and merge the discussion related to TensorRT conversion issue after training on a custom dataset to this issue #47 as it is quite hard for me to track so many open issues. Hope you understand, thanks.

@haotian-liu
Copy link
Collaborator

haotian-liu commented Feb 7, 2021

I somehow figured out that the cause and applied the fix, details of the solution are explained in #47. Please take a look to see if the issue can be resolved.
If the issue persists, please reply directly to #47 (this will be the main thread to deal with related issues for now) with experiment configurations (details also explain there). Thanks.

@sdimantsd
Copy link
Author

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants