What going on?
PyTorch 2.4.0 was released for general availability earlier this week. Ultralytics has observed some odd behavior, specifically on Windows with this new PyTorch version.
Conditions for issue
- Windows computers
- Using
torch==2.4.0
- Using
device="cpu"
or not having any CUDA devices available for inference using Ultralytics YOLO
What’s not impacted
As far as our testing has found, Windows computers using torch==2.4.0
, running inference for Ultralytics models on CUDA appears to work normally. Linux and MacOS machines running inference on the CPU when using torch==2.4.0
do not appear to be impacted.
How can I tell?
Here’s an example of the defective output when this issue occurs:
0: 640x640 37 persons, 1 bicycle, 2 cars, 3 motorcycles, 62 airplanes, 5 boats, 62 traffic lights, 16 fire hydrants, 76
parking meters, 10 birds, 3 cats, 1 cow, 2 zebras, 2 sports balls, 1 skateboard, 2 bottles, 2 wine glasss, 2 cups, 3 knifes, 8 spoons, 391.0ms
You should force device="cuda"
or downgrade your version of torch
(and torchvision
as they have to match) to prevent this issue until we’re able to find and fix the problem.