ultralytics 8.1.15 add Python 3.12 compatibility (#8210)

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
Co-authored-by: Johnny <johnnynuca14@gmail.com>
Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
This commit is contained in:
Glenn Jocher 2024-02-17 20:49:34 +01:00 committed by GitHub
parent e38c7a3022
commit fbed8499da
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 47 additions and 40 deletions

View file

@ -81,7 +81,7 @@ from ultralytics.utils import (
get_default_args,
yaml_save,
)
from ultralytics.utils.checks import check_imgsz, check_is_path_safe, check_requirements, check_version
from ultralytics.utils.checks import PYTHON_VERSION, check_imgsz, check_is_path_safe, check_requirements, check_version
from ultralytics.utils.downloads import attempt_download_asset, get_github_assets
from ultralytics.utils.files import file_size, spaces_in_path
from ultralytics.utils.ops import Profile
@ -609,10 +609,8 @@ class Exporter:
ct_model = cto.palettize_weights(ct_model, config=config)
if self.args.nms and self.model.task == "detect":
if mlmodel:
import platform
# coremltools<=6.2 NMS export requires Python<3.11
check_version(platform.python_version(), "<3.11", name="Python ", hard=True)
check_version(PYTHON_VERSION, "<3.11", name="Python ", hard=True)
weights_dir = None
else:
ct_model.save(str(f)) # save otherwise weights_dir does not exist