-
-
Notifications
You must be signed in to change notification settings - Fork 16.3k
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: The following operation failed in the TorchScript interpreter. #5070
Comments
👋 Hello @andreiionutdamian, thank you for your interest in YOLOv5 🚀! Please visit our ⭐️ Tutorials to get started, where you can find quickstart guides for simple tasks like Custom Data Training all the way to advanced concepts like Hyperparameter Evolution. If this is a 🐛 Bug Report, please provide screenshots and minimum viable code to reproduce your issue, otherwise we can not help you. If this is a custom training ❓ Question, please provide as much information as possible, including dataset images, training logs, screenshots, and a public link to online W&B logging if available. For business inquiries or professional support requests please visit https://ultralytics.com or email Glenn Jocher at [email protected]. RequirementsPython>=3.6.0 with all requirements.txt installed including PyTorch>=1.7. To get started: $ git clone https://github.com/ultralytics/yolov5
$ cd yolov5
$ pip install -r requirements.txt EnvironmentsYOLOv5 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):
StatusIf this badge is green, all YOLOv5 GitHub Actions Continuous Integration (CI) tests are currently passing. CI tests verify correct operation of YOLOv5 training (train.py), validation (val.py), inference (detect.py) and export (export.py) on MacOS, Windows, and Ubuntu every 24 hours and on every commit. |
@andreiionutdamian I don't have torchscript inference experience, so I'm not sure, but CUDNN_STATUS_INTERNAL_ERROR may be due to a lack of resources, i.e. CUDA memory, RAM, vcpus. |
|
@andreiionutdamian hmm. Is the error is reproducible with a small inference load, i.e. --img 640 --batch 1? I know this is a bit tangent to your issue, but could you submit a PR updating detect.py with torchscript inference (bug and all)? This might help a lot of people (like me) who've never used torchscript models understand the usage and might allow for more community debugging. |
@glenn-jocher I certainly tested multiple scenarios including the following:
|
@andreiionutdamian yeah I'm sure there's a bug somewhere. If you submit a PR to update detect.py then it's much more likely future users will find and fix that bug. Since currently there's no support for torchscript inference in the repo there's technically no action for us to take. |
@glenn-jocher I followed your sugestion and created the PR # #5109 |
Well, looks like all you need to do is:
where If you dont respect the first one the graph ops will fail (being fixed on specific inputs). IF you dont respect the second some strange CUDA voodoo is happening and you get |
@andreiionutdamian item 2 is normally handled by this line in detect.py, though in the case of pytorch models this is mainly to improve profiling results since the first GPU run is always slower than subsequent runs. Lines 132 to 133 in fc36064
Does this mean that torchscript inference should work in master as long as the input shape is correct? |
@glenn-jocher Mostly yes, I created a PR with minor modifications including |
Hi, I am using current repo in order to make a simple test with
export
in torch script then try to load the torch-script file in a separate python script.I am using:
the command I am running is
python export.py --weights yolov5l.pt --include torchscript --device 0
then in the test script all I do is:
At this point I get the below error:
The text was updated successfully, but these errors were encountered: