dgenerate-ultralytics-headless 8.3.226__py3-none-any.whl → 8.3.228__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.3.226
3
+ Version: 8.3.228
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>
@@ -80,7 +80,7 @@ Requires-Dist: ipython; extra == "extra"
80
80
  Requires-Dist: albumentations>=1.4.6; extra == "extra"
81
81
  Requires-Dist: faster-coco-eval>=1.6.7; extra == "extra"
82
82
  Provides-Extra: typing
83
- Requires-Dist: scipy-stubs; extra == "typing"
83
+ Requires-Dist: scipy-stubs>=1.14.1.4; python_version >= "3.10" and extra == "typing"
84
84
  Requires-Dist: types-pillow; extra == "typing"
85
85
  Requires-Dist: types-psutil; extra == "typing"
86
86
  Requires-Dist: types-pyyaml; extra == "typing"
@@ -1,4 +1,4 @@
1
- dgenerate_ultralytics_headless-8.3.226.dist-info/licenses/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
1
+ dgenerate_ultralytics_headless-8.3.228.dist-info/licenses/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
2
2
  tests/__init__.py,sha256=bCox_hLdGRFYGLb2kd722VdNP2zEXNYNuLLYtqZSrbw,804
3
3
  tests/conftest.py,sha256=mOy9lGpNp7lk1hHl6_pVE0f9cU-72gnkoSm4TO-CNZU,2318
4
4
  tests/test_cli.py,sha256=GhIFHi-_WIJpDgoGNRi0DnjbfwP1wHbklBMnkCM-P_4,5464
@@ -8,7 +8,7 @@ tests/test_exports.py,sha256=OMLio2uUhyqo8D8qB5xUwmk7Po2rMeAACRc8WYoxbj4,13147
8
8
  tests/test_integrations.py,sha256=6QgSh9n0J04RdUYz08VeVOnKmf4S5MDEQ0chzS7jo_c,6220
9
9
  tests/test_python.py,sha256=jhnN-Oie3euE3kfHzUqvnadkWOsQyvFmdmEcse9Rsto,29253
10
10
  tests/test_solutions.py,sha256=j_PZZ5tMR1Y5ararY-OTXZr1hYJ7vEVr8H3w4O1tbQs,14153
11
- ultralytics/__init__.py,sha256=WY251vQ-GY1axMzoZx1zfHfVdJaGRKuXmkcDb_Sc6es,1302
11
+ ultralytics/__init__.py,sha256=3a_Min7fPzhcqS0xB9RqedP5HwOYBqFtntprkA3lxyM,1302
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
@@ -123,7 +123,7 @@ ultralytics/data/scripts/get_coco.sh,sha256=UuJpJeo3qQpTHVINeOpmP0NYmg8PhEFE3A8J
123
123
  ultralytics/data/scripts/get_coco128.sh,sha256=qmRQl_hOKrsdHrTrnyQuFIH01oDz3lfaz138OgGfLt8,650
124
124
  ultralytics/data/scripts/get_imagenet.sh,sha256=hr42H16bM47iT27rgS7MpEo-GeOZAYUQXgr0B2cwn48,1705
125
125
  ultralytics/engine/__init__.py,sha256=lm6MckFYCPTbqIoX7w0s_daxdjNeBeKW6DXppv1-QUM,70
126
- ultralytics/engine/exporter.py,sha256=hqcZ0CZId8HrqHdvkXeiyP0Y6KtvLszcOomt07UPKIg,67856
126
+ ultralytics/engine/exporter.py,sha256=rZYCIURAikr76uK6BlZHX7RKdWsc_THHTs8ub28U47k,68005
127
127
  ultralytics/engine/model.py,sha256=s-exI_DPWaMkyba8oK6_UP0VUz0MT_52B7--r6wYf84,53186
128
128
  ultralytics/engine/predictor.py,sha256=eu0sVo3PTt4zKH6SntzdO1E8cgFj9PFOJrfQO6VNqCE,22698
129
129
  ultralytics/engine/results.py,sha256=j8MLEM4sgo1EDVTjkmLIag2MqfZbEBUMuzPJfYr7tWE,70906
@@ -200,7 +200,7 @@ ultralytics/models/yolo/yoloe/val.py,sha256=utUFWeFKRFWZrPr1y3A8ztbTwdoWMYqzlwBN
200
200
  ultralytics/nn/__init__.py,sha256=538LZPUKKvc3JCMgiQ4VLGqRN2ZAaVLFcQbeNNHFkEA,545
201
201
  ultralytics/nn/autobackend.py,sha256=OBlE1R4ZGBF4JBMqb-ImLgaBZebap0m02qV_uJWiQTA,42673
202
202
  ultralytics/nn/tasks.py,sha256=dkfIujXeSaR8FmLYyrhl5Pj2U1h22JMEOkv9T3pIIwc,70367
203
- ultralytics/nn/text_model.py,sha256=e-x_Kdkbc1-HE813KrGZO2PT-wLcV9Cl-kKDrezBSoI,15160
203
+ ultralytics/nn/text_model.py,sha256=Nz7MJlIL4flNpOnwhS3qqINb_NfANSIOw4ex49yTFt0,16051
204
204
  ultralytics/nn/modules/__init__.py,sha256=5Sg_28MDfKwdu14Ty_WCaiIXZyjBSQ-xCNCwnoz_w-w,3198
205
205
  ultralytics/nn/modules/activation.py,sha256=J6n-CJKFK0YbhwcRDqm9zEJM9pSAEycj5quQss_3x6E,2219
206
206
  ultralytics/nn/modules/block.py,sha256=-Suv96Oo0LM1sqHHKudt5lL5YIcWLkxwrYVBgIAkmTs,69876
@@ -251,7 +251,7 @@ ultralytics/utils/events.py,sha256=6vqs_iSxoXIhQ804sOjApNZmXwNW9FUFtjaHPY8ta10,4
251
251
  ultralytics/utils/files.py,sha256=Zw3pQEe1vz7oGBIb1c_umaVGJDvWn0z5zcPTFYcAF94,8125
252
252
  ultralytics/utils/git.py,sha256=O12SgwSh1JHizR0H_pOAyMY_qRpSe5I4cc5nAoEQ-zE,5489
253
253
  ultralytics/utils/instance.py,sha256=11mhefvTI9ftMqSirXuiViAi0Fxlo6v84qvNxfRNUoE,18862
254
- ultralytics/utils/logger.py,sha256=kXiTowpfg4_SbH6eSlS4NqOvKN8zFJ19c50xU5prj8s,15090
254
+ ultralytics/utils/logger.py,sha256=gq38VIMcdOZHI-rKDO0F7Z-RiFebpkcVhoNr-5W2U4o,15633
255
255
  ultralytics/utils/loss.py,sha256=R1uC00IlXVHFWc8I8ngjtfRfuUj_sT_Zw59OlYKwmFY,39781
256
256
  ultralytics/utils/metrics.py,sha256=MTV8gHtMEKWr8XKskRjk6_oS7QyD5myhRQ39eM9yfLo,68547
257
257
  ultralytics/utils/nms.py,sha256=zv1rOzMF6WU8Kdk41VzNf1H1EMt_vZHcbDFbg3mnN2o,14248
@@ -260,7 +260,7 @@ ultralytics/utils/patches.py,sha256=6WDGUokiND76iDbLeul_6Ny-bvvFcy6Bms5f9MkxhfQ,
260
260
  ultralytics/utils/plotting.py,sha256=FoGnXc52IvsVtlDvS8Ffee-SszwpepAvrYrusTn21Fs,48283
261
261
  ultralytics/utils/tal.py,sha256=w7oi6fp0NmL6hHh-yvCCX1cBuuB4JuX7w1wiR4_SMZs,20678
262
262
  ultralytics/utils/torch_utils.py,sha256=o6KMukW6g-mUYrVMPHb5qkcGbQIk8aMMnVrOrsJoL1Q,40220
263
- ultralytics/utils/tqdm.py,sha256=lYZNsunfjUX1WlCh0_bMu9OglK614dUtLO-7Db_uWIw,16029
263
+ ultralytics/utils/tqdm.py,sha256=sYKcXJDKCgOcMp7KBAB9cmCiJxk9tvoeoto6M8QRW24,16393
264
264
  ultralytics/utils/triton.py,sha256=2wZil1PfvOpaBymTzzP8Da6Aam-2MTLumO3uBmTE5FY,5406
265
265
  ultralytics/utils/tuner.py,sha256=rN8gFWnQOJFtrGlFcvOo0Eah9dEVFx0nFkpTGrlewZA,6861
266
266
  ultralytics/utils/callbacks/__init__.py,sha256=hzL63Rce6VkZhP4Lcim9LKjadixaQG86nKqPhk7IkS0,242
@@ -279,8 +279,8 @@ ultralytics/utils/export/__init__.py,sha256=Cfh-PwVfTF_lwPp-Ss4wiX4z8Sm1XRPklsqd
279
279
  ultralytics/utils/export/engine.py,sha256=23-lC6dNsmz5vprSJzaN7UGNXrFlVedNcqhlOH_IXes,9956
280
280
  ultralytics/utils/export/imx.py,sha256=9UPA4CwTPADzvJx9dOsh_8fQ-LMeqG7eI9EYIn5ojkc,11621
281
281
  ultralytics/utils/export/tensorflow.py,sha256=PyAp0_rXSUcXiqV2RY0H9b_-oFaZ7hZBiSM42X53t0Q,9374
282
- dgenerate_ultralytics_headless-8.3.226.dist-info/METADATA,sha256=MRE6VknAO-0hUfZ4ZIZflU_5E188hGc7BNl_LMPRyAo,38772
283
- dgenerate_ultralytics_headless-8.3.226.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
284
- dgenerate_ultralytics_headless-8.3.226.dist-info/entry_points.txt,sha256=YM_wiKyTe9yRrsEfqvYolNO5ngwfoL4-NwgKzc8_7sI,93
285
- dgenerate_ultralytics_headless-8.3.226.dist-info/top_level.txt,sha256=XP49TwiMw4QGsvTLSYiJhz1xF_k7ev5mQ8jJXaXi45Q,12
286
- dgenerate_ultralytics_headless-8.3.226.dist-info/RECORD,,
282
+ dgenerate_ultralytics_headless-8.3.228.dist-info/METADATA,sha256=MAIGSG3LP-IBAsjkbuN_Mce_h_5_X9-YjMNUG-LNEqI,38811
283
+ dgenerate_ultralytics_headless-8.3.228.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
284
+ dgenerate_ultralytics_headless-8.3.228.dist-info/entry_points.txt,sha256=YM_wiKyTe9yRrsEfqvYolNO5ngwfoL4-NwgKzc8_7sI,93
285
+ dgenerate_ultralytics_headless-8.3.228.dist-info/top_level.txt,sha256=XP49TwiMw4QGsvTLSYiJhz1xF_k7ev5mQ8jJXaXi45Q,12
286
+ dgenerate_ultralytics_headless-8.3.228.dist-info/RECORD,,
ultralytics/__init__.py CHANGED
@@ -1,6 +1,6 @@
1
1
  # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
2
2
 
3
- __version__ = "8.3.226"
3
+ __version__ = "8.3.228"
4
4
 
5
5
  import importlib
6
6
  import os
@@ -627,7 +627,7 @@ class Exporter:
627
627
  @try_export
628
628
  def export_onnx(self, prefix=colorstr("ONNX:")):
629
629
  """Export YOLO model to ONNX format."""
630
- requirements = ["onnx>=1.12.0"]
630
+ requirements = ["onnx>=1.12.0,<=1.19.1"]
631
631
  if self.args.simplify:
632
632
  requirements += ["onnxslim>=0.1.71", "onnxruntime" + ("-gpu" if torch.cuda.is_available() else "")]
633
633
  check_requirements(requirements)
@@ -995,7 +995,7 @@ class Exporter:
995
995
  "sng4onnx>=1.0.1", # required by 'onnx2tf' package
996
996
  "onnx_graphsurgeon>=0.3.26", # required by 'onnx2tf' package
997
997
  "ai-edge-litert>=1.2.0" + (",<1.4.0" if MACOS else ""), # required by 'onnx2tf' package
998
- "onnx>=1.12.0",
998
+ "onnx>=1.12.0,<=1.19.1",
999
999
  "onnx2tf>=1.26.3",
1000
1000
  "onnxslim>=0.1.71",
1001
1001
  "onnxruntime-gpu" if cuda else "onnxruntime",
@@ -1112,14 +1112,15 @@ class Exporter:
1112
1112
  assert LINUX, f"export only supported on Linux. See {help_url}"
1113
1113
  if subprocess.run(cmd, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, shell=True).returncode != 0:
1114
1114
  LOGGER.info(f"\n{prefix} export requires Edge TPU compiler. Attempting install from {help_url}")
1115
+ sudo = "sudo " if is_sudo_available() else ""
1115
1116
  for c in (
1116
- "curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -",
1117
- 'echo "deb https://packages.cloud.google.com/apt coral-edgetpu-stable main" | '
1118
- "sudo tee /etc/apt/sources.list.d/coral-edgetpu.list",
1119
- "sudo apt-get update",
1120
- "sudo apt-get install edgetpu-compiler",
1117
+ f"{sudo}mkdir -p /etc/apt/keyrings",
1118
+ f"curl -fsSL https://packages.cloud.google.com/apt/doc/apt-key.gpg | {sudo}gpg --dearmor -o /etc/apt/keyrings/google.gpg",
1119
+ f'echo "deb [signed-by=/etc/apt/keyrings/google.gpg] https://packages.cloud.google.com/apt coral-edgetpu-stable main" | {sudo}tee /etc/apt/sources.list.d/coral-edgetpu.list',
1120
+ f"{sudo}apt-get update",
1121
+ f"{sudo}apt-get install -y edgetpu-compiler",
1121
1122
  ):
1122
- subprocess.run(c if is_sudo_available() else c.replace("sudo ", ""), shell=True, check=True)
1123
+ subprocess.run(c, shell=True, check=True)
1123
1124
 
1124
1125
  ver = subprocess.run(cmd, shell=True, capture_output=True, check=True).stdout.decode().rsplit(maxsplit=1)[-1]
1125
1126
  LOGGER.info(f"\n{prefix} starting export with Edge TPU compiler {ver}...")
@@ -89,11 +89,13 @@ class CLIP(TextModel):
89
89
  self.device = device
90
90
  self.eval()
91
91
 
92
- def tokenize(self, texts: str | list[str]) -> torch.Tensor:
92
+ def tokenize(self, texts: str | list[str], truncate: bool = True) -> torch.Tensor:
93
93
  """Convert input texts to CLIP tokens.
94
94
 
95
95
  Args:
96
96
  texts (str | list[str]): Input text or list of texts to tokenize.
97
+ truncate (bool, optional): Whether to trim texts that exceed CLIP's context length. Defaults to True to
98
+ avoid RuntimeError from overly long inputs while still allowing explicit opt-out.
97
99
 
98
100
  Returns:
99
101
  (torch.Tensor): Tokenized text tensor with shape (batch_size, context_length) ready for model processing.
@@ -102,8 +104,10 @@ class CLIP(TextModel):
102
104
  >>> model = CLIP("ViT-B/32", device="cpu")
103
105
  >>> tokens = model.tokenize("a photo of a cat")
104
106
  >>> print(tokens.shape) # torch.Size([1, 77])
107
+ >>> strict_tokens = model.tokenize("a photo of a cat", truncate=False) # Enforce strict length checks
108
+ >>> print(strict_tokens.shape) # Same shape/content as tokens since prompt less than 77 tokens
105
109
  """
106
- return clip.tokenize(texts).to(self.device)
110
+ return clip.tokenize(texts, truncate=truncate).to(self.device)
107
111
 
108
112
  @smart_inference_mode()
109
113
  def encode_text(self, texts: torch.Tensor, dtype: torch.dtype = torch.float32) -> torch.Tensor:
@@ -308,11 +312,13 @@ class MobileCLIPTS(TextModel):
308
312
  self.tokenizer = clip.clip.tokenize
309
313
  self.device = device
310
314
 
311
- def tokenize(self, texts: list[str]) -> torch.Tensor:
315
+ def tokenize(self, texts: list[str], truncate: bool = True) -> torch.Tensor:
312
316
  """Convert input texts to MobileCLIP tokens.
313
317
 
314
318
  Args:
315
319
  texts (list[str]): List of text strings to tokenize.
320
+ truncate (bool, optional): Whether to trim texts that exceed the tokenizer context length. Defaults to True,
321
+ matching CLIP's behavior to prevent runtime failures on long captions.
316
322
 
317
323
  Returns:
318
324
  (torch.Tensor): Tokenized text inputs with shape (batch_size, sequence_length).
@@ -320,8 +326,11 @@ class MobileCLIPTS(TextModel):
320
326
  Examples:
321
327
  >>> model = MobileCLIPTS("cpu")
322
328
  >>> tokens = model.tokenize(["a photo of a cat", "a photo of a dog"])
329
+ >>> strict_tokens = model.tokenize(
330
+ ... ["a very long caption"], truncate=False
331
+ ... ) # RuntimeError if exceeds 77-token
323
332
  """
324
- return self.tokenizer(texts).to(self.device)
333
+ return self.tokenizer(texts, truncate=truncate).to(self.device)
325
334
 
326
335
  @smart_inference_mode()
327
336
  def encode_text(self, texts: torch.Tensor, dtype: torch.dtype = torch.float32) -> torch.Tensor:
@@ -201,14 +201,17 @@ class ConsoleLogger:
201
201
  __slots__ = ("callback", "original")
202
202
 
203
203
  def __init__(self, original, callback):
204
+ """Initialize a stream wrapper that redirects writes to a callback while preserving the original."""
204
205
  self.original = original
205
206
  self.callback = callback
206
207
 
207
208
  def write(self, text):
209
+ """Forward text to the wrapped original stream, preserving default stdout/stderr semantics."""
208
210
  self.original.write(text)
209
211
  self.callback(text)
210
212
 
211
213
  def flush(self):
214
+ """Flush the wrapped stream to propagate buffered output promptly during console capture."""
212
215
  self.original.flush()
213
216
 
214
217
  class _LogHandler(logging.Handler):
@@ -217,10 +220,12 @@ class ConsoleLogger:
217
220
  __slots__ = ("callback",)
218
221
 
219
222
  def __init__(self, callback):
223
+ """Initialize a lightweight logging.Handler that forwards log records to the provided callback."""
220
224
  super().__init__()
221
225
  self.callback = callback
222
226
 
223
227
  def emit(self, record):
228
+ """Format and forward LogRecord messages to the capture callback for unified log streaming."""
224
229
  self.callback(self.format(record) + "\n")
225
230
 
226
231
 
ultralytics/utils/tqdm.py CHANGED
@@ -159,9 +159,17 @@ class TQDM:
159
159
  self._display()
160
160
 
161
161
  def _format_rate(self, rate: float) -> str:
162
- """Format rate with units."""
162
+ """Format rate with units, switching between it/s and s/it for readability."""
163
163
  if rate <= 0:
164
164
  return ""
165
+
166
+ inv_rate = 1 / rate if rate else None
167
+
168
+ # Use s/it format when inv_rate > 1 (i.e., rate < 1 it/s) for better readability
169
+ if inv_rate and inv_rate > 1:
170
+ return f"{inv_rate:.1f}s/B" if self.is_bytes else f"{inv_rate:.1f}s/{self.unit}"
171
+
172
+ # Use it/s format for fast iterations
165
173
  fallback = f"{rate:.1f}B/s" if self.is_bytes else f"{rate:.1f}{self.unit}/s"
166
174
  return next((f"{rate / t:.1f}{u}" for t, u in self.scales if rate >= t), fallback)
167
175