ultralytics 8.2.86 Windows torch==2.4.0 patch (#15942)
Signed-off-by: UltralyticsAssistant <web@ultralytics.com> Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
This commit is contained in:
parent
0f105f4ea2
commit
62408aeab8
6 changed files with 23 additions and 2 deletions
2
.github/workflows/ci.yaml
vendored
2
.github/workflows/ci.yaml
vendored
|
|
@ -156,7 +156,7 @@ jobs:
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, macos-14]
|
os: [ubuntu-latest, macos-14, windows-latest]
|
||||||
python-version: ["3.11"]
|
python-version: ["3.11"]
|
||||||
torch: [latest]
|
torch: [latest]
|
||||||
include:
|
include:
|
||||||
|
|
|
||||||
|
|
@ -71,6 +71,7 @@ dependencies = [
|
||||||
"pyyaml>=5.3.1",
|
"pyyaml>=5.3.1",
|
||||||
"requests>=2.23.0",
|
"requests>=2.23.0",
|
||||||
"scipy>=1.4.1",
|
"scipy>=1.4.1",
|
||||||
|
"torch>=1.8.0,<2.4.0; sys_platform == 'win32'", # Windows CPU errors https://github.com/ultralytics/ultralytics/issues/15049
|
||||||
"torch>=1.8.0",
|
"torch>=1.8.0",
|
||||||
"torchvision>=0.9.0",
|
"torchvision>=0.9.0",
|
||||||
"tqdm>=4.64.0", # progress bars
|
"tqdm>=4.64.0", # progress bars
|
||||||
|
|
|
||||||
|
|
@ -252,6 +252,8 @@ def test_labels_and_crops():
|
||||||
for r in results:
|
for r in results:
|
||||||
im_name = Path(r.path).stem
|
im_name = Path(r.path).stem
|
||||||
cls_idxs = r.boxes.cls.int().tolist()
|
cls_idxs = r.boxes.cls.int().tolist()
|
||||||
|
# Check correct detections
|
||||||
|
assert cls_idxs == ([0, 0, 5, 0, 7] if r.path.endswith("bus.jpg") else [0, 0]) # bus.jpg and zidane.jpg classes
|
||||||
# Check label path
|
# Check label path
|
||||||
labels = save_path / f"labels/{im_name}.txt"
|
labels = save_path / f"labels/{im_name}.txt"
|
||||||
assert labels.exists()
|
assert labels.exists()
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
# Ultralytics YOLO 🚀, AGPL-3.0 license
|
# Ultralytics YOLO 🚀, AGPL-3.0 license
|
||||||
|
|
||||||
__version__ = "8.2.85"
|
__version__ = "8.2.86"
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,11 +29,13 @@ from ultralytics.utils import (
|
||||||
IS_PIP_PACKAGE,
|
IS_PIP_PACKAGE,
|
||||||
LINUX,
|
LINUX,
|
||||||
LOGGER,
|
LOGGER,
|
||||||
|
MACOS,
|
||||||
ONLINE,
|
ONLINE,
|
||||||
PYTHON_VERSION,
|
PYTHON_VERSION,
|
||||||
ROOT,
|
ROOT,
|
||||||
TORCHVISION_VERSION,
|
TORCHVISION_VERSION,
|
||||||
USER_CONFIG_DIR,
|
USER_CONFIG_DIR,
|
||||||
|
WINDOWS,
|
||||||
Retry,
|
Retry,
|
||||||
SimpleNamespace,
|
SimpleNamespace,
|
||||||
ThreadingLocked,
|
ThreadingLocked,
|
||||||
|
|
@ -224,6 +226,14 @@ def check_version(
|
||||||
if not required: # if required is '' or None
|
if not required: # if required is '' or None
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
if "sys_platform" in required: # i.e. required='<2.4.0,>=1.8.0; sys_platform == "win32"'
|
||||||
|
if (
|
||||||
|
(WINDOWS and "win32" not in required)
|
||||||
|
or (LINUX and "linux" not in required)
|
||||||
|
or (MACOS and "macos" not in required and "darwin" not in required)
|
||||||
|
):
|
||||||
|
return True
|
||||||
|
|
||||||
op = ""
|
op = ""
|
||||||
version = ""
|
version = ""
|
||||||
result = True
|
result = True
|
||||||
|
|
@ -422,6 +432,7 @@ def check_torchvision():
|
||||||
"""
|
"""
|
||||||
# Compatibility table
|
# Compatibility table
|
||||||
compatibility_table = {
|
compatibility_table = {
|
||||||
|
"2.4": ["0.19"],
|
||||||
"2.3": ["0.18"],
|
"2.3": ["0.18"],
|
||||||
"2.2": ["0.17"],
|
"2.2": ["0.17"],
|
||||||
"2.1": ["0.16"],
|
"2.1": ["0.16"],
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
# Ultralytics YOLO 🚀, AGPL-3.0 license
|
# Ultralytics YOLO 🚀, AGPL-3.0 license
|
||||||
|
|
||||||
import contextlib
|
import contextlib
|
||||||
import gc
|
import gc
|
||||||
import math
|
import math
|
||||||
|
|
@ -24,6 +25,7 @@ from ultralytics.utils import (
|
||||||
NUM_THREADS,
|
NUM_THREADS,
|
||||||
PYTHON_VERSION,
|
PYTHON_VERSION,
|
||||||
TORCHVISION_VERSION,
|
TORCHVISION_VERSION,
|
||||||
|
WINDOWS,
|
||||||
__version__,
|
__version__,
|
||||||
colorstr,
|
colorstr,
|
||||||
)
|
)
|
||||||
|
|
@ -42,6 +44,11 @@ TORCHVISION_0_10 = check_version(TORCHVISION_VERSION, "0.10.0")
|
||||||
TORCHVISION_0_11 = check_version(TORCHVISION_VERSION, "0.11.0")
|
TORCHVISION_0_11 = check_version(TORCHVISION_VERSION, "0.11.0")
|
||||||
TORCHVISION_0_13 = check_version(TORCHVISION_VERSION, "0.13.0")
|
TORCHVISION_0_13 = check_version(TORCHVISION_VERSION, "0.13.0")
|
||||||
TORCHVISION_0_18 = check_version(TORCHVISION_VERSION, "0.18.0")
|
TORCHVISION_0_18 = check_version(TORCHVISION_VERSION, "0.18.0")
|
||||||
|
if WINDOWS and torch.__version__[:3] == "2.4": # reject all versions of 2.4 on Windows
|
||||||
|
LOGGER.warning(
|
||||||
|
"WARNING ⚠️ Known issue with torch>=2.4.0 on Windows with CPU, recommend downgrading to torch<=2.3.1 to resolve "
|
||||||
|
"https://github.com/ultralytics/ultralytics/issues/15049"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@contextmanager
|
@contextmanager
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue