Skip to content

v2.0.21 - Remove leaked profiling buffers from all modules (#137)

Choose a tag to compare

@github-actions github-actions released this 26 Jul 12:57
· 36 commits to main since this release
36429ee

🌟 Summary

🧹 THOP 2.0.21 makes model profiling side-effect-free while improving release reliability, documentation accuracy, and development workflows.

📊 Key Changes

  • Fixed leaked profiling buffers by @raimbekovm:

    • profile() now removes temporary hooks and total_ops/total_params buffers from every module it touches.
    • Prevents profiling metadata from remaining in state_dict() or spreading through shared PyTorch modules.
    • FLOPs and parameter results remain unchanged.
  • Strengthened PyPI publishing reliability:

    • Queues release workflows to avoid overlapping publish runs.
    • Retries failed PyPI uploads, including transient Sigstore, Rekor, and network failures.
    • Supports recovery of partially completed releases and safely reuses existing tags.
    • Allows SBOM uploads to replace incomplete files.
  • Modernized CI/CD actions:

    • Updated GitHub Actions checkout, Python setup, and Slack integrations.
    • Replaced direct setup-uv usage with the shared Ultralytics action for more consistent behavior.
  • Improved notifications and contributor workflows:

    • Slack release messages are shorter, clearer, and include clickable release, run, and PR links.
    • Replaced the third-party CLA action with the shared Ultralytics CLA workflow.
    • Added AGENTS.md guidance for AI coding agents, with CLAUDE.md linked to it.
  • Updated documentation and code quality:

    • Corrected benchmark outputs and README links.
    • Standardized PyTorch imports and logging practices for Ruff 0.16.0 compatibility.
    • Updated the version to 2.0.21.

🎯 Purpose & Impact

  • ✅ More trustworthy profiling: Users can profile a model without unintentionally modifying its saved state or affecting models created later in the same process.
  • 🧠 Safer repeated profiling: This is especially important for complex models with shared activation modules or custom containers.
  • 🚀 More dependable releases: Queuing and retry behavior reduce failed PyPI releases caused by temporary infrastructure or network issues.
  • 🔄 Better recovery: Maintainers can resume incomplete releases without manually recreating tags or release metadata.
  • 📚 Clearer documentation: Correct benchmark values and contribution links make THOP easier to understand and use.
  • 🛠️ No expected API disruption: The release preserves profiling results and existing functionality while improving cleanup, automation, and maintainability.

What's Changed

New Contributors

Full Changelog: v2.0.20...v2.0.21