Skip to content

Conversation

glenn-jocher
Copy link
Member

@glenn-jocher glenn-jocher commented Aug 21, 2022

Signed-off-by: Glenn Jocher [email protected]

🛠️ PR Summary

Made with ❤️ by Ultralytics Actions

🌟 Summary

Improvement in EMA update mechanism within the YOLOv5 model utility functions.

📊 Key Changes

  • Removed the @smart_inference_mode() decorator from the EMA update function.
  • Modified the assert statement in EMA update to ensure the data types of the model and EMA weights are both in FP32 after detaching the model state dict.

🎯 Purpose & Impact

  • 🛠️ The removal of @smart_inference_mode() likely aims to improve code simplicity and reduce potential issues with context management that might have occurred.
  • 🧐 Adjusting the assertion for FP32 consistency helps to enforce that EMA updates are processed in a standard floating-point format, ensuring compatibility and consistency in calculations.
  • ✅ These changes can lead to a more robust EMA update process, potentially improving the model's performance and reliability for the end-users.

Note: EMA stands for Exponential Moving Average, which is a technique to update model weights to stabilize training. FP32 refers to 32-bit floating-point data type.

Signed-off-by: Glenn Jocher <[email protected]>
@glenn-jocher glenn-jocher self-assigned this Aug 21, 2022
@glenn-jocher glenn-jocher merged commit 27fb6fd into master Aug 21, 2022
@glenn-jocher glenn-jocher deleted the glenn-jocher-patch-1 branch August 21, 2022 01:22
ctjanuhowski pushed a commit to ctjanuhowski/yolov5 that referenced this pull request Sep 8, 2022
* zero-mAP fix 3

Signed-off-by: Glenn Jocher <[email protected]>

* Update torch_utils.py

Signed-off-by: Glenn Jocher <[email protected]>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update torch_utils.py

Signed-off-by: Glenn Jocher <[email protected]>

Signed-off-by: Glenn Jocher <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant