pypi ultralytics 8.3.228
v8.3.228 - `ultralytics 8.3.228` Fix CLIP token truncation (#22650)

12 hours ago

🌟 Summary

CLIP/MobileCLIP tokenization is now safer by default with a new truncate option, preventing crashes on long prompts, alongside improved progress-bar readability, better docs search/chat UX, augmentation docs enhancements, and more reliable ARM CI. 🚀

📊 Key Changes

  • CLIP/MobileCLIP safety upgrade (priority)

    • Added truncate: bool = True to CLIP.tokenize and MobileCLIPTS.tokenize to handle overlength text gracefully.
    • Preserves compatibility while allowing strict mode via truncate=False for debugging or exact validation.
    • Details: see PR “Fix CLIP token truncation” by @h13-0 (PR #22650).
  • Progress bar readability

    • tqdm rate formatting now switches to seconds-per-iteration for slow loops (e.g., 1.5s/it instead of 0.0it/s). Thanks @fcakyon (PR #22660).
  • Docs chat/search experience

    • Introduced native Ultralytics Chat widget with theme sync, keyboard shortcut (Cmd/Ctrl + K), and a header search button. Thanks @glenn-jocher (PRs #22639, #22648, #22652).
  • Data augmentation docs polish

    • Added augmentations argument for custom Albumentations pipelines to the macro table (PR #22615).
    • Fixed HSV saturation doc typo (hsv_s, not hsv_h) for accuracy (PR #22645).
  • CI reliability

    • Self-hosted Raspberry Pi runners cleaned before builds to reduce flakiness (PR #22654).

🎯 Purpose & Impact

  • More robust text models ✨

    • Avoids RuntimeError on lengthy prompts by truncating safely by default.
    • Enables strict mode (truncate=False) for developers who need exact-length checks or debugging.
    • Small, backward-compatible API enhancement improving stability in CLIP/MobileCLIP workflows.
  • Clearer training feedback 📈

    • Easier-to-read tqdm output for slow iterations helps users understand performance and progress, especially on large models or slower hardware.
  • Better docs experience 🔎

    • Faster, unified Ultralytics Chat + Search in the docs with consistent theming and a simple keyboard shortcut improves discoverability and support.
  • More flexible augmentations 🧪

    • Documented augmentations unlocks custom Albumentations transforms via Python API, enabling advanced experimentation across detect/segment/pose/obb tasks.
  • Improved contributor reliability 🧹

    • Cleaner ARM CI environments reduce flaky tests and speed up feedback loops—benefiting ongoing development.

Example usage (strict vs safe tokenization):

from ultralytics.nn.text_model import CLIP, MobileCLIPTS

clip_model = CLIP(size="ViT-B/32", device="cpu")
safe_tokens = clip_model.tokenize("a very long caption ...", truncate=True)   # default, avoids errors
strict_tokens = clip_model.tokenize("a very long caption ...", truncate=False)  # may raise if too long

mobileclip = MobileCLIPTS(device="cpu")
tokens = mobileclip.tokenize(["caption 1", "caption 2"])  # safely truncated by default

What's Changed

Full Changelog: v8.3.227...v8.3.228

Don't miss a new ultralytics release

NewReleases is sending notifications on new releases.