dgenerate-ultralytics-headless 8.4.8__py3-none-any.whl → 8.4.9__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dgenerate-ultralytics-headless
3
- Version: 8.4.8
3
+ Version: 8.4.9
4
4
  Summary: Automatically built Ultralytics package with python-opencv-headless dependency instead of python-opencv
5
5
  Author-email: Glenn Jocher <glenn.jocher@ultralytics.com>, Jing Qiu <jing.qiu@ultralytics.com>
6
6
  Maintainer-email: Ultralytics <hello@ultralytics.com>
@@ -39,8 +39,8 @@ Requires-Dist: pillow>=7.1.2
39
39
  Requires-Dist: pyyaml>=5.3.1
40
40
  Requires-Dist: requests>=2.23.0
41
41
  Requires-Dist: scipy>=1.4.1
42
- Requires-Dist: torch<2.10,>=1.8.0
43
- Requires-Dist: torch!=2.4.0,<2.10,>=1.8.0; sys_platform == "win32"
42
+ Requires-Dist: torch>=1.8.0
43
+ Requires-Dist: torch!=2.4.0,>=1.8.0; sys_platform == "win32"
44
44
  Requires-Dist: torchvision>=0.9.0
45
45
  Requires-Dist: psutil>=5.8.0
46
46
  Requires-Dist: polars>=0.20.0
@@ -1,14 +1,14 @@
1
- dgenerate_ultralytics_headless-8.4.8.dist-info/licenses/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
1
+ dgenerate_ultralytics_headless-8.4.9.dist-info/licenses/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
2
2
  tests/__init__.py,sha256=hfUXxYLJB3846OCzWV94ZKEZsi8vq9Pqrdd2mMgjjck,804
3
3
  tests/conftest.py,sha256=rlKyDuOC_3ptXrWS8Q19bNEGOupUmYXHj3nB6o1GBGY,2318
4
4
  tests/test_cli.py,sha256=-OrAcZlcJ07UPagjSOlR8qXP5gNFHaTYcW3paOTURAE,5725
5
- tests/test_cuda.py,sha256=2TBe-ZkecMOGPWLdHcbsAjH3m9c5SQJ2KeyICgS0aeo,8426
5
+ tests/test_cuda.py,sha256=V0dPXBinxDOlFA4NDlD2HuYM41KBhLAdt06adEDeP20,8440
6
6
  tests/test_engine.py,sha256=ufSn3X4kL_Lpn2O25jKAfw_9QwHTMRjP9shDdpgBqnY,5740
7
7
  tests/test_exports.py,sha256=pZZJBN2uM5QdQMjnjIC-xZkKPOBbnnX8b5d5q90otl4,15651
8
8
  tests/test_integrations.py,sha256=FjvTGjXm3bvYHK3_obgObhC5SzHCTzw4aOJV9Hh08jQ,6220
9
9
  tests/test_python.py,sha256=BTyRn29boDKu4n0v1_5D3_7wvADs077NU9RFdTZktHo,30774
10
10
  tests/test_solutions.py,sha256=1tRlM72YciE42Nk9v83gsXOD5RSx9GSWVsKGhH7-HxE,14122
11
- ultralytics/__init__.py,sha256=jfmOTtuFV9ofd_zpWZoaGtHeh3SmmK1zHx1iu3QnbI4,1300
11
+ ultralytics/__init__.py,sha256=QNUx0fvpKV5GANkIcj2VFs06MxGldr-UqD2L3aJngao,1300
12
12
  ultralytics/py.typed,sha256=la67KBlbjXN-_-DfGNcdOcjYumVpKG_Tkw-8n5dnGB4,8
13
13
  ultralytics/assets/bus.jpg,sha256=wCAZxJecGR63Od3ZRERe9Aja1Weayrb9Ug751DS_vGM,137419
14
14
  ultralytics/assets/zidane.jpg,sha256=Ftc4aeMmen1O0A3o6GCDO9FlfBslLpTAw0gnetx7bts,50427
@@ -120,7 +120,7 @@ ultralytics/cfg/trackers/botsort.yaml,sha256=tRxC-qT4Wz0mLn5x7ZEwrqgGKrmTDVY7gMg
120
120
  ultralytics/cfg/trackers/bytetrack.yaml,sha256=7LS1ObP5u7BUFcmeY6L2m3bRuPUktnpJspFKd_ElVWc,908
121
121
  ultralytics/data/__init__.py,sha256=ToR8zl0JhBHy42ZvV7zIwO_F3lbi5oNlGQNPK3dlddU,644
122
122
  ultralytics/data/annotator.py,sha256=iu1En-LzlR4RyR3ocftthnAog_peQHV9ForPRo_QcX8,2985
123
- ultralytics/data/augment.py,sha256=XR52_BEmwFOrdMxEVRypm_kz6ROkTBgVped05R2xZWs,128566
123
+ ultralytics/data/augment.py,sha256=z11SV8ikxHN59_ebvX_45dXH7iX1f8RG1MtANfdFK5E,128562
124
124
  ultralytics/data/base.py,sha256=pMs8yJOmAFPXdgfLCDtUemSvkPNDzxReP-fWzkNtonc,19723
125
125
  ultralytics/data/build.py,sha256=s-tkSZPf3OfQyfXPXB9XxdW_gIcU6Xy_u21ekSgTnRo,17205
126
126
  ultralytics/data/converter.py,sha256=4SwrEKzsdKK3YcoCcEhu0_UmFyaUuQEVPIWENFxlAC4,34520
@@ -134,7 +134,7 @@ ultralytics/data/scripts/get_coco.sh,sha256=UuJpJeo3qQpTHVINeOpmP0NYmg8PhEFE3A8J
134
134
  ultralytics/data/scripts/get_coco128.sh,sha256=qmRQl_hOKrsdHrTrnyQuFIH01oDz3lfaz138OgGfLt8,650
135
135
  ultralytics/data/scripts/get_imagenet.sh,sha256=hr42H16bM47iT27rgS7MpEo-GeOZAYUQXgr0B2cwn48,1705
136
136
  ultralytics/engine/__init__.py,sha256=lm6MckFYCPTbqIoX7w0s_daxdjNeBeKW6DXppv1-QUM,70
137
- ultralytics/engine/exporter.py,sha256=y76PH93ULLplU8YvKh2reDJ9QWXjCkQRlusD6p9-NPg,73566
137
+ ultralytics/engine/exporter.py,sha256=FUG4OyzjSNWlMu__q81YLCM1ZtIObWynsbZgIEtN_FA,73168
138
138
  ultralytics/engine/model.py,sha256=euDHUy7J5vVBvS_d-KbGZd_0BP5bF6Y3cTQ7VXtwZ4k,53210
139
139
  ultralytics/engine/predictor.py,sha256=x3xzVlfj92HgLdxPvoKFKpyzp1wSsNVCahpbO5sse80,23102
140
140
  ultralytics/engine/results.py,sha256=Lg-Ke8TU6qaxu0wQtOH26unORj4FRYxd8RL0VxV74Zw,68333
@@ -198,7 +198,7 @@ ultralytics/models/yolo/classify/train.py,sha256=xPlpioQFPeH32Frhy9ZbbGV_wcpn9hP
198
198
  ultralytics/models/yolo/classify/val.py,sha256=akH2P3nff4oiZtV2toKB3Z9HIbsVcwsb1uvDwhamszw,10503
199
199
  ultralytics/models/yolo/detect/__init__.py,sha256=GIRsLYR-kT4JJx7lh4ZZAFGBZj0aebokuU0A7JbjDVA,257
200
200
  ultralytics/models/yolo/detect/predict.py,sha256=2nxlMyw_zVKq1aeJFRTgb4EGL2vOFq4pLT9tArHBfF8,5385
201
- ultralytics/models/yolo/detect/train.py,sha256=N6Sdjnue9-bpnBMP5KGwsH9BFgjL23N9kDaHiXTBj9c,10757
201
+ ultralytics/models/yolo/detect/train.py,sha256=9JwTYi6M33cGhmAmdl099Bjrjb7woqu7fJSJgoivubk,10736
202
202
  ultralytics/models/yolo/detect/val.py,sha256=54AOR6r3istE0pILJ1v4xzPdv7UcvtTEZ6E5OGj3Jgc,22818
203
203
  ultralytics/models/yolo/obb/__init__.py,sha256=tQmpG8wVHsajWkZdmD6cjGohJ4ki64iSXQT8JY_dydo,221
204
204
  ultralytics/models/yolo/obb/predict.py,sha256=I7hWDr1zuy2WuwGom9uzXqomfr7qVMWb7iRl18xdTYw,2577
@@ -221,7 +221,7 @@ ultralytics/models/yolo/yoloe/train.py,sha256=q7K1fiqKrpbjfrrd3F3FiVMPtQAVuVzQin
221
221
  ultralytics/models/yolo/yoloe/train_seg.py,sha256=rV2Jnbuh6vvBMaupaZK_aRXBMevO0XhN2VUR43ZwlIY,5285
222
222
  ultralytics/models/yolo/yoloe/val.py,sha256=utUFWeFKRFWZrPr1y3A8ztbTwdoWMYqzlwBN7CQ0tCA,9418
223
223
  ultralytics/nn/__init__.py,sha256=538LZPUKKvc3JCMgiQ4VLGqRN2ZAaVLFcQbeNNHFkEA,545
224
- ultralytics/nn/autobackend.py,sha256=c3FzMw-0h5wEoxg0-n7rMWrIcR6C1WTNjF1AUpW07rM,45079
224
+ ultralytics/nn/autobackend.py,sha256=gqFej3DueyHWQ6Fy3HuUIVGGy8_iYkKkvklapmzLKH0,44939
225
225
  ultralytics/nn/tasks.py,sha256=xclS6E6OIBDurrDscTVmVafvmd8JOIiagIT4iEGwD4M,72588
226
226
  ultralytics/nn/text_model.py,sha256=c--WzxjFEDb7p95u3YGcSsJLjj91zFNqXshij8Evrwg,15291
227
227
  ultralytics/nn/modules/__init__.py,sha256=9KyQBxpomp5uJJ1PvMGuOFs2pR3NpqZcFHJlM6Q56c0,3322
@@ -267,9 +267,9 @@ ultralytics/utils/__init__.py,sha256=XLEK_pvptzNWhJaO8x0MWghREIyEDei0LOGnUnmU1Kg
267
267
  ultralytics/utils/autobatch.py,sha256=jiE4m_--H9UkXFDm_FqzcZk_hSTCGpS72XdVEKgZwAo,5114
268
268
  ultralytics/utils/autodevice.py,sha256=rXlPuo-iX-vZ4BabmMGEGh9Uxpau4R7Zlt1KCo9Xfyc,8892
269
269
  ultralytics/utils/benchmarks.py,sha256=y3aZ05qQhS2C3WI-iPeByOfmcaLLfXabsEufvXIv8lI,31819
270
- ultralytics/utils/checks.py,sha256=NWc0J-Nk4qHSVEXFDWfJkI7IjTNHFXajKjsSodDroBk,39411
270
+ ultralytics/utils/checks.py,sha256=_jGD-bdHafqcnrGmZOKiSwiKEL-DtyWsj21shdQxEeg,40198
271
271
  ultralytics/utils/cpu.py,sha256=OksKOlX93AsbSsFuoYvLXRXgpkOibrZSwQyW6lipt4Q,3493
272
- ultralytics/utils/dist.py,sha256=sktf2a_uh-vLg6piQyiuRJ5JcMggFYmhS8Wepnb88WM,4220
272
+ ultralytics/utils/dist.py,sha256=GpdZLU3VQomg_dbHNMbzIgat-Y409plwcZJN5nF3YrU,4447
273
273
  ultralytics/utils/downloads.py,sha256=TWXkYwR5hEpVMWL6fbjdywDmZe02WhyL_8YuLVce-uM,23069
274
274
  ultralytics/utils/errors.py,sha256=dUZcTWpbJJHqEuWHM6IbeoJJ4TzA_yHBP8E7tEEpBVs,1388
275
275
  ultralytics/utils/events.py,sha256=6vqs_iSxoXIhQ804sOjApNZmXwNW9FUFtjaHPY8ta10,4665
@@ -284,7 +284,7 @@ ultralytics/utils/ops.py,sha256=4xqb7kwrAWm8c_zxOWP5JoXozgsA1Slk2s4XFwmEZCs,2608
284
284
  ultralytics/utils/patches.py,sha256=yXkznJNo3M74gvvzWmHoZYbWFu-KnO3KK4usbmey8H0,8521
285
285
  ultralytics/utils/plotting.py,sha256=_iXs4gs8tzMSgiKxCriD4un-MJkOsC3lGSy0wn7qZGk,48433
286
286
  ultralytics/utils/tal.py,sha256=9BSRgsYj0Llq7r5vOzkXDKUjfoTZsxiH92U09c6DtoU,24540
287
- ultralytics/utils/torch_utils.py,sha256=W6OX8p3fI44gF0TUdPTLV5NZlTE03YdwDbcZXy_e05k,40279
287
+ ultralytics/utils/torch_utils.py,sha256=H0ykzePdr55qPndFS9VVQCFH-fovbpK_uVBz4ooLvM8,40331
288
288
  ultralytics/utils/tqdm.py,sha256=f2W608Qpvgu6tFi28qylaZpcRv3IX8wTGY_8lgicaqY,16343
289
289
  ultralytics/utils/triton.py,sha256=BQu3CD3OlT76d1OtmnX5slQU37VC1kzRvEtfI2saIQA,5211
290
290
  ultralytics/utils/tuner.py,sha256=nRMmnyp0B0gVJzAXcpCxQUnwXjVp0WNiSJwxyR2xvQM,7303
@@ -304,8 +304,8 @@ ultralytics/utils/export/__init__.py,sha256=Cfh-PwVfTF_lwPp-Ss4wiX4z8Sm1XRPklsqd
304
304
  ultralytics/utils/export/engine.py,sha256=QoXPqnmQn6W5TOUAygOtCG63R9ExDG4-Df6X6W-_Mzo,10470
305
305
  ultralytics/utils/export/imx.py,sha256=VnMDO7c8ezBs91UDoLg9rR0oY8Uc7FujKpbdGxrzV18,13744
306
306
  ultralytics/utils/export/tensorflow.py,sha256=xHEcEM3_VeYctyqkJCpgkqcNie1M8xLqcFKr6uANEEQ,9951
307
- dgenerate_ultralytics_headless-8.4.8.dist-info/METADATA,sha256=L2XFEFB-0AoqDdGUp11R4vVL-fjDOCuk02BqvFYu6qY,40081
308
- dgenerate_ultralytics_headless-8.4.8.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
309
- dgenerate_ultralytics_headless-8.4.8.dist-info/entry_points.txt,sha256=YM_wiKyTe9yRrsEfqvYolNO5ngwfoL4-NwgKzc8_7sI,93
310
- dgenerate_ultralytics_headless-8.4.8.dist-info/top_level.txt,sha256=XP49TwiMw4QGsvTLSYiJhz1xF_k7ev5mQ8jJXaXi45Q,12
311
- dgenerate_ultralytics_headless-8.4.8.dist-info/RECORD,,
307
+ dgenerate_ultralytics_headless-8.4.9.dist-info/METADATA,sha256=kAJE1cZEObznKjZJn5IN5Ua_F_j2CMdnT60gjk_238Q,40069
308
+ dgenerate_ultralytics_headless-8.4.9.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
309
+ dgenerate_ultralytics_headless-8.4.9.dist-info/entry_points.txt,sha256=YM_wiKyTe9yRrsEfqvYolNO5ngwfoL4-NwgKzc8_7sI,93
310
+ dgenerate_ultralytics_headless-8.4.9.dist-info/top_level.txt,sha256=XP49TwiMw4QGsvTLSYiJhz1xF_k7ev5mQ8jJXaXi45Q,12
311
+ dgenerate_ultralytics_headless-8.4.9.dist-info/RECORD,,
tests/test_cuda.py CHANGED
@@ -120,7 +120,7 @@ def test_train():
120
120
  device = tuple(DEVICES) if len(DEVICES) > 1 else DEVICES[0]
121
121
  # NVIDIA Jetson only has one GPU and therefore skipping checks
122
122
  if not IS_JETSON:
123
- results = YOLO(MODEL).train(data="coco8.yaml", imgsz=64, epochs=1, device=device, batch=15)
123
+ results = YOLO(MODEL).train(data="coco8.yaml", imgsz=64, epochs=1, device=device, batch=15, compile=True)
124
124
  results = YOLO(MODEL).train(data="coco128.yaml", imgsz=64, epochs=1, device=device, batch=15, val=False)
125
125
  visible = eval(os.environ["CUDA_VISIBLE_DEVICES"])
126
126
  assert visible == device, f"Passed GPUs '{device}', but used GPUs '{visible}'"
ultralytics/__init__.py CHANGED
@@ -1,6 +1,6 @@
1
1
  # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
2
2
 
3
- __version__ = "8.4.8"
3
+ __version__ = "8.4.9"
4
4
 
5
5
  import importlib
6
6
  import os
@@ -1745,7 +1745,7 @@ class CopyPaste(BaseMixTransform):
1745
1745
  instances.convert_bbox(format="xyxy")
1746
1746
  instances.denormalize(w, h)
1747
1747
 
1748
- im_new = np.zeros(im.shape, np.uint8)
1748
+ im_new = np.zeros(im.shape[:2], np.uint8)
1749
1749
  instances2 = labels2.pop("instances", None)
1750
1750
  if instances2 is None:
1751
1751
  instances2 = deepcopy(instances)
@@ -1758,7 +1758,7 @@ class CopyPaste(BaseMixTransform):
1758
1758
  for j in indexes[: round(self.p * n)]:
1759
1759
  cls = np.concatenate((cls, labels2.get("cls", cls)[[j]]), axis=0)
1760
1760
  instances = Instances.concatenate((instances, instances2[[j]]), axis=0)
1761
- cv2.drawContours(im_new, instances2.segments[[j]].astype(np.int32), -1, (1, 1, 1), cv2.FILLED)
1761
+ cv2.drawContours(im_new, instances2.segments[[j]].astype(np.int32), -1, 1, cv2.FILLED)
1762
1762
 
1763
1763
  result = labels2.get("img", cv2.flip(im, 1)) # augment segments
1764
1764
  if result.ndim == 2: # cv2.flip would eliminate the last dimension for grayscale images
@@ -87,7 +87,6 @@ from ultralytics.utils import (
87
87
  IS_COLAB,
88
88
  IS_DEBIAN_BOOKWORM,
89
89
  IS_DEBIAN_TRIXIE,
90
- IS_DOCKER,
91
90
  IS_JETSON,
92
91
  IS_RASPBERRYPI,
93
92
  IS_UBUNTU,
@@ -108,6 +107,7 @@ from ultralytics.utils.checks import (
108
107
  IS_PYTHON_3_10,
109
108
  IS_PYTHON_MINIMUM_3_9,
110
109
  check_apt_requirements,
110
+ check_executorch_requirements,
111
111
  check_imgsz,
112
112
  check_requirements,
113
113
  check_version,
@@ -1197,16 +1197,9 @@ class Exporter:
1197
1197
  following Ultralytics conventions.
1198
1198
  """
1199
1199
  LOGGER.info(f"\n{prefix} starting export with ExecuTorch...")
1200
- assert TORCH_2_9, f"ExecuTorch export requires torch>=2.9.0 but torch=={TORCH_VERSION} is installed"
1200
+ assert TORCH_2_9, f"ExecuTorch requires torch>=2.9.0 but torch=={TORCH_VERSION} is installed"
1201
1201
 
1202
- # BUG executorch build on arm64 Docker requires packaging>=22.0 https://github.com/pypa/setuptools/issues/4483
1203
- if LINUX and ARM64 and IS_DOCKER:
1204
- check_requirements("packaging>=22.0")
1205
-
1206
- check_requirements("ruamel.yaml<0.19.0")
1207
- check_requirements("executorch==1.0.1", "flatbuffers")
1208
- # Pin numpy to avoid coremltools errors with numpy>=2.4.0, must be separate
1209
- check_requirements("numpy<=2.3.5")
1202
+ check_executorch_requirements()
1210
1203
 
1211
1204
  from executorch.backends.xnnpack.partition.xnnpack_partitioner import XnnpackPartitioner
1212
1205
  from executorch.exir import to_edge_transform_and_lower
@@ -73,7 +73,7 @@ class DetectionTrainer(BaseTrainer):
73
73
  Returns:
74
74
  (Dataset): YOLO dataset object configured for the specified mode.
75
75
  """
76
- gs = max(int(unwrap_model(self.model).stride.max() if self.model else 0), 32)
76
+ gs = max(int(unwrap_model(self.model).stride.max()), 32)
77
77
  return build_yolo_dataset(self.args, img_path, batch, self.data, mode=mode, rect=mode == "val", stride=gs)
78
78
 
79
79
  def get_dataloader(self, dataset_path: str, batch_size: int = 16, rank: int = 0, mode: str = "train"):
@@ -16,8 +16,24 @@ import torch
16
16
  import torch.nn as nn
17
17
  from PIL import Image
18
18
 
19
- from ultralytics.utils import ARM64, IS_JETSON, LINUX, LOGGER, PYTHON_VERSION, ROOT, YAML, is_jetson
20
- from ultralytics.utils.checks import check_requirements, check_suffix, check_version, check_yaml, is_rockchip
19
+ from ultralytics.utils import (
20
+ ARM64,
21
+ IS_JETSON,
22
+ LINUX,
23
+ LOGGER,
24
+ PYTHON_VERSION,
25
+ ROOT,
26
+ YAML,
27
+ is_jetson,
28
+ )
29
+ from ultralytics.utils.checks import (
30
+ check_executorch_requirements,
31
+ check_requirements,
32
+ check_suffix,
33
+ check_version,
34
+ check_yaml,
35
+ is_rockchip,
36
+ )
21
37
  from ultralytics.utils.downloads import attempt_download_asset, is_url
22
38
  from ultralytics.utils.nms import non_max_suppression
23
39
 
@@ -616,9 +632,9 @@ class AutoBackend(nn.Module):
616
632
  # ExecuTorch
617
633
  elif pte:
618
634
  LOGGER.info(f"Loading {w} for ExecuTorch inference...")
619
- # TorchAO release compatibility table bug https://github.com/pytorch/ao/issues/2919
620
- check_requirements("setuptools<71.0.0") # Setuptools bug: https://github.com/pypa/setuptools/issues/4483
621
- check_requirements(("executorch==1.0.1", "flatbuffers"))
635
+
636
+ check_executorch_requirements()
637
+
622
638
  from executorch.runtime import Runtime
623
639
 
624
640
  w = Path(w)
@@ -29,6 +29,7 @@ from ultralytics.utils import (
29
29
  AUTOINSTALL,
30
30
  GIT,
31
31
  IS_COLAB,
32
+ IS_DOCKER,
32
33
  IS_JETSON,
33
34
  IS_KAGGLE,
34
35
  IS_PIP_PACKAGE,
@@ -495,6 +496,17 @@ def check_requirements(requirements=ROOT.parent / "requirements.txt", exclude=()
495
496
  return True
496
497
 
497
498
 
499
+ def check_executorch_requirements():
500
+ """Check and install ExecuTorch requirements including platform-specific dependencies."""
501
+ # BUG executorch build on arm64 Docker requires packaging>=22.0 https://github.com/pypa/setuptools/issues/4483
502
+ if LINUX and ARM64 and IS_DOCKER:
503
+ check_requirements("packaging>=22.0")
504
+
505
+ check_requirements("executorch", cmds=f"torch=={TORCH_VERSION.split('+')[0]}")
506
+ # Pin numpy to avoid coremltools errors with numpy>=2.4.0, must be separate
507
+ check_requirements("numpy<=2.3.5")
508
+
509
+
498
510
  def check_torchvision():
499
511
  """Check the installed versions of PyTorch and Torchvision to ensure they're compatible.
500
512
 
@@ -546,7 +558,7 @@ def check_suffix(file="yolo26n.pt", suffix=".pt", msg=""):
546
558
  assert f".{s}" in suffix, f"{msg}{f} acceptable suffix is {suffix}, not .{s}"
547
559
 
548
560
 
549
- def check_yolov5u_filename(file: str, verbose: bool = True):
561
+ def check_yolov5u_filename(file: str, verbose: bool = True) -> str:
550
562
  """Replace legacy YOLOv5 filenames with updated YOLOv5u filenames.
551
563
 
552
564
  Args:
@@ -573,7 +585,7 @@ def check_yolov5u_filename(file: str, verbose: bool = True):
573
585
  return file
574
586
 
575
587
 
576
- def check_model_file_from_stem(model="yolo11n"):
588
+ def check_model_file_from_stem(model: str = "yolo11n") -> str | Path:
577
589
  """Return a model filename from a valid model stem.
578
590
 
579
591
  Args:
@@ -619,6 +631,9 @@ def check_file(file, suffix="", download=True, download_dir=".", hard=True):
619
631
  # Use URI path for unique directory structure: ul://user/project/model -> user/project/model/filename.pt
620
632
  uri_path = file[5:] # Remove "ul://"
621
633
  local_file = Path(download_dir) / uri_path / url2file(url)
634
+ # Always re-download NDJSON datasets (cheap, ensures fresh data after updates)
635
+ if local_file.suffix == ".ndjson":
636
+ local_file.unlink(missing_ok=True)
622
637
  if local_file.exists():
623
638
  LOGGER.info(f"Found {clean_url(url)} locally at {local_file}")
624
639
  else:
@@ -660,7 +675,7 @@ def check_yaml(file, suffix=(".yaml", ".yml"), hard=True):
660
675
  return check_file(file, suffix, hard=hard)
661
676
 
662
677
 
663
- def check_is_path_safe(basedir, path):
678
+ def check_is_path_safe(basedir: Path | str, path: Path | str) -> bool:
664
679
  """Check if the resolved path is under the intended directory to prevent path traversal.
665
680
 
666
681
  Args:
ultralytics/utils/dist.py CHANGED
@@ -1,13 +1,19 @@
1
1
  # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
2
2
 
3
+ from __future__ import annotations
4
+
3
5
  import os
4
6
  import shutil
5
7
  import sys
6
8
  import tempfile
9
+ from typing import TYPE_CHECKING
7
10
 
8
11
  from . import USER_CONFIG_DIR
9
12
  from .torch_utils import TORCH_1_9
10
13
 
14
+ if TYPE_CHECKING:
15
+ from ultralytics.engine.trainer import BaseTrainer
16
+
11
17
 
12
18
  def find_free_network_port() -> int:
13
19
  """Find a free port on localhost.
@@ -25,7 +31,7 @@ def find_free_network_port() -> int:
25
31
  return s.getsockname()[1] # port
26
32
 
27
33
 
28
- def generate_ddp_file(trainer):
34
+ def generate_ddp_file(trainer: BaseTrainer) -> str:
29
35
  """Generate a DDP (Distributed Data Parallel) file for multi-GPU training.
30
36
 
31
37
  This function creates a temporary Python file that enables distributed training across multiple GPUs. The file
@@ -75,7 +81,7 @@ if __name__ == "__main__":
75
81
  return file.name
76
82
 
77
83
 
78
- def generate_ddp_command(trainer):
84
+ def generate_ddp_command(trainer: BaseTrainer) -> tuple[list[str], str]:
79
85
  """Generate command for distributed training.
80
86
 
81
87
  Args:
@@ -105,7 +111,7 @@ def generate_ddp_command(trainer):
105
111
  return cmd, file
106
112
 
107
113
 
108
- def ddp_cleanup(trainer, file):
114
+ def ddp_cleanup(trainer: BaseTrainer, file: str) -> None:
109
115
  """Delete temporary file if created during distributed data parallel (DDP) training.
110
116
 
111
117
  This function checks if the provided file contains the trainer's ID in its name, indicating it was created as a
@@ -46,6 +46,7 @@ TORCH_2_1 = check_version(TORCH_VERSION, "2.1.0")
46
46
  TORCH_2_4 = check_version(TORCH_VERSION, "2.4.0")
47
47
  TORCH_2_8 = check_version(TORCH_VERSION, "2.8.0")
48
48
  TORCH_2_9 = check_version(TORCH_VERSION, "2.9.0")
49
+ TORCH_2_10 = check_version(TORCH_VERSION, "2.10.0")
49
50
  TORCHVISION_0_10 = check_version(TORCHVISION_VERSION, "0.10.0")
50
51
  TORCHVISION_0_11 = check_version(TORCHVISION_VERSION, "0.11.0")
51
52
  TORCHVISION_0_13 = check_version(TORCHVISION_VERSION, "0.13.0")