ultralytics v8.4.139

v8.4.139

v8.4.139 - Reduce validation dataloader memory with prefetch 2 per worker (#26057)

Changed 10
  • Validation workers now prefetch 2 batches instead of 4 to reduce validation memory usage
  • Muon/MuSGD optimizer updates are now grouped by column count and flattened according to memory layout to avoid unnecessary tensor copies
  • Documentation now warns that quantize=16 can cast a retained PyTorch model in place and a later FP32 call may use FP16-rounded weights
  • Model statistics for FLOPs and parameter reporting were synchronized with the current profiler for YOLO26, YOLO11, YOLO12, YOLOv8, YOLOv5u, and other documented models
  • Batch-normalization fusion now uses PyTorch's official fusion utilities
  • Temporary module aliases are now thread-safe and restore modified attributes correctly
Fixed 3
  • EMA attributes such as class names, class counts, strides, and class weights are now copied from the unwrapped model to fix missing or stale metadata in distributed training or torch.compile
  • Semantic segmentation dataset detection now recognizes a default masks/ directory as PNG-mask semantic segmentation when no masks_dir entry is specified
  • SAM positional embeddings now avoid nondeterministic cumulative-sum operations
Removed 1
  • Standalone Muon optimizer and related dead code have been removed

From ultralytics

🌟 Summary

v8.4.139 improves training efficiency and reliability—especially by reducing validation memory usage—while refreshing model statistics, dataset handling, optimizer performance, and documentation. 🚀

📊 Key Changes
  • Lower validation dataloader memory usage by @glenn-jocher:

    • Validation workers now prefetch 2 batches instead of 4.
    • Training loaders continue using a prefetch factor of 4.
    • This reduces queued validation data and shared-memory usage without slowing validation startup. 💾
  • Faster Muon/MuSGD optimizer updates:

    • Updates are now grouped by column count and flattened according to their memory layout.
    • This avoids unnecessary tensor copies for channels-last convolution weights and preserves fused parameter updates.
    • The standalone Muon optimizer and related dead code were removed; MuSGD remains available. ⚡
  • More reliable EMA checkpoints:

    • EMA attributes such as class names, class counts, strides, and class weights are now copied from the unwrapped model.
    • This fixes missing or stale metadata when using distributed training or torch.compile.
    • EMA is initialized after class weights are calculated, improving checkpoint consistency. ✅
  • Correct semantic segmentation dataset detection:

    • A default masks/ directory is now recognized as PNG-mask semantic segmentation when no masks_dir entry is specified.
    • Prevents incorrect class counts and phantom background classes in affected datasets. 🎯
  • Improved FP16 behavior documentation:

    • Documentation now clearly warns that quantize=16 can cast a retained PyTorch model in place.
    • A later FP32 call on the same model object may therefore use FP16-rounded weights.
    • This clarification applies to prediction and validation, including shared model objects. ⚠️
  • Refreshed FLOPs and parameter reporting:

    • Published model statistics were synchronized with the current profiler.
    • Updated values cover YOLO26, YOLO11, YOLO12, YOLOv8, YOLOv5u, and other documented models.
    • Accuracy and speed benchmark values were not changed. 📊
  • More robust and maintainable internals:

    • Batch-normalization fusion now uses PyTorch’s official fusion utilities.
    • SAM positional embeddings avoid nondeterministic cumulative-sum operations.
    • Temporary module aliases are now thread-safe and restore modified attributes correctly.
    • NumPy-to-tensor conversion can share CPU memory and perform a single device transfer.
    • ONNX export opset selection was simplified and made more compatible with current runtimes.
  • Expanded task visibility and documentation:

    • Depth estimation is now listed consistently across the README, package description, docstrings, tutorials, and task detection messages.
    • Documentation validation now requires Zensical 0.0.58 or newer.
    • Several model benchmark tables and page frontmatter entries were corrected. 📚
🎯 Purpose & Impact
  • Users training with limited system or shared memory should see fewer validation-memory spikes, particularly with many dataloader workers or large images. 🧠
  • Training performance may improve for the default CUDA channels-last path because Muon updates avoid repeated copies and retain fused optimizer operations.
  • Distributed and compiled training runs should produce more complete and dependable checkpoints through improved EMA metadata handling.
  • Semantic segmentation workflows using a conventional root-level masks/ folder now behave as documented, avoiding incorrect output channels and class definitions.
  • FP16 users should be aware that prediction or validation may modify a PyTorch model object in place; keeping separate model instances is recommended when switching between FP16 and FP32.
  • Benchmark comparisons are more trustworthy because FLOPs and parameter counts now reflect current profiler behavior, although these corrected statistics may differ from earlier documentation.
  • Depth estimation is easier to discover for new users, while existing model APIs and task support remain compatible. 🌊
What's Changed

Full Changelog: https://github.com/ultralytics/ultralytics/compare/v8.4.138...v8.4.139

View original

Upgraded? How did it go?

Discussion