`ultralytics 8.2.8` fix `os.sched_setaffinity()` AttributeError (#11232)

Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
pull/9307/head v8.2.8
Andreas Moldskred 7 months ago committed by GitHub
parent 2f9a604387
commit 28cb2f2213
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      ultralytics/__init__.py
  2. 5
      ultralytics/data/build.py

@ -1,6 +1,6 @@
# Ultralytics YOLO 🚀, AGPL-3.0 license # Ultralytics YOLO 🚀, AGPL-3.0 license
__version__ = "8.2.7" __version__ = "8.2.8"
from ultralytics.data.explorer.explorer import Explorer from ultralytics.data.explorer.explorer import Explorer
from ultralytics.models import RTDETR, SAM, YOLO, YOLOWorld from ultralytics.models import RTDETR, SAM, YOLO, YOLOWorld

@ -20,7 +20,7 @@ from ultralytics.data.loaders import (
autocast_list, autocast_list,
) )
from ultralytics.data.utils import IMG_FORMATS, VID_FORMATS from ultralytics.data.utils import IMG_FORMATS, VID_FORMATS
from ultralytics.utils import NUM_THREADS, RANK, colorstr from ultralytics.utils import LINUX, NUM_THREADS, RANK, colorstr
from ultralytics.utils.checks import check_file from ultralytics.utils.checks import check_file
from .dataset import GroundingDataset, YOLODataset, YOLOMultiModalDataset from .dataset import GroundingDataset, YOLODataset, YOLOMultiModalDataset
@ -81,7 +81,8 @@ def seed_worker(worker_id): # noqa
worker_seed = torch.initial_seed() % 2**32 worker_seed = torch.initial_seed() % 2**32
np.random.seed(worker_seed) np.random.seed(worker_seed)
random.seed(worker_seed) random.seed(worker_seed)
os.sched_setaffinity(0, range(NUM_THREADS)) # fix https://github.com/ultralytics/ultralytics/pull/11195 if LINUX and hasattr(os, "sched_setaffinity"): # unsupported on macOS and Windows
os.sched_setaffinity(0, range(NUM_THREADS)) # fix https://github.com/ultralytics/ultralytics/pull/11195
def build_yolo_dataset(cfg, img_path, batch, data, mode="train", rect=False, stride=32, multi_modal=False): def build_yolo_dataset(cfg, img_path, batch, data, mode="train", rect=False, stride=32, multi_modal=False):

Loading…
Cancel
Save