pypi ultralytics 8.3.240
v8.3.240 - `ultralytics 8.3.240` SAM3 Apple MPS tensor `repeat()` fixes (#22968)

6 hours ago

🌟 Summary

ultralytics 8.3.240 is a stability-focused release that makes SAM 2/3 video segmentation more reliable (especially on Apple Silicon), tightens GPU memory usage, and polishes exports and documentation for smoother day‑to‑day workflows. 🚀


📊 Key Changes

  • 🔧 SAM3 on Apple Silicon (MPS) now runs reliably

    • Fixes a bug in SAM rotary encoding on Apple MPS by avoiding repeat() on complex tensors.
    • Uses torch.view_as_real() / torch.view_as_complex() for an MPS-safe path while keeping existing behavior on CUDA/CPU.
  • 🧠 SAM2/SAM3 video memory usage is now bounded

    • Adds _prune_non_cond_memory() in SAM2 video predictors to periodically clear “non-conditioning” frame outputs.
    • Pruning is driven by model settings (num_maskmem, memory_temporal_stride_for_eval) and runs automatically during video inference.
  • 🎥 SAM3 semantic video tracking is faster and cleaner

    • Unmatched objects are now removed, not “suppressed but still tracked”.
    • Increases default track keep-alive windows (init_trk_keep_alive and max_trk_keep_alive to 30) while decreasing keep-alive when masks are empty.
    • Fixes result label naming to align with the number of boxes instead of masks for more consistent IDs.
  • 📦 ONNX export environments are more complete

    • Adds onnxslim>=0.1.80 to the export extra in pyproject.toml, so pip install ultralytics[export] pulls in onnxslim automatically.
  • 📥 Clearer setup for SAM 3 model weights

  • 💬 Docs chat widget is now easier to extend

    • Stores the UltralyticsChat instance in a variable (const ultralyticsChat = ...) so future scripts can programmatically control the widget.
  • 🖼️ Cleaner docs for color previews & Markdown-heavy pages

    • docs/build_reference.py now preserves Markdown structures (tables, admonitions, code blocks, headings, lists) instead of collapsing lines.
    • Reorders the Colors class docstring so the Markdown table reads cleanly, with “Attributes” and “Examples” sections following it.
  • 🔁 Branding & integration docs refresh for Comet

    • Updates the Comet integration guide to use “Comet” (formerly “Comet ML”) throughout, including headings, alt text, and FAQ sections.
    • Keeps references to “Comet ML” only where helpful for context or search.

🎯 Purpose & Impact

  • 🍎 Better Apple Silicon experience

    • SAM3 users on M1/M2/M3 Macs running with MPS should see fewer runtime errors and more stable segmentation inference with no config changes needed.
  • 🧹 More stable long video runs

    • Automatic pruning of non-essential SAM2/SAM3 video memory reduces VRAM growth over long videos, helping prevent out‑of‑memory crashes and making multi-video processing safer.
  • 🎯 More predictable tracking behavior

    • Removing unmatched objects instead of silently suppressing them simplifies mental models for users: if an object stops being matched, it is actually removed, not half-alive in the background.
    • Longer but better-managed keep-alive windows help tracking remain robust during brief occlusions without bloating state indefinitely.
  • 🛠️ Smoother export and deployment workflows

    • Including onnxslim in the export extras reduces “missing dependency” surprises for users who export to ONNX and then run post‑processing or optimization.
  • 📚 Easier SAM 3 onboarding

    • Clear, accurate instructions for requesting and downloading sam3.pt from Hugging Face mean fewer setup issues and less guesswork for new SAM 3 users.
  • 📘 More maintainable and readable documentation

    • Preserved Markdown structure avoids broken tables, squashed code blocks, and messy formatting in the API/reference docs.
    • Comet branding updates and a controllable docs chat widget make the docs feel more polished and easier to evolve over time.

What's Changed

New Contributors

Full Changelog: v8.3.239...v8.3.240

Don't miss a new ultralytics release

NewReleases is sending notifications on new releases.