From d1d32df9738e742945a52d52076680d3cbd884d8 Mon Sep 17 00:00:00 2001
From: Mashiro <57566630+HAOCHENYE@users.noreply.github.com>
Date: Fri, 28 Oct 2022 19:58:43 +0800
Subject: [PATCH] Change strict_load of EMAHook to False by default (#642)

* [Fix] resume std and mean

* refine docstring

Co-authored-by: Zaida Zhou <58739961+zhouzaida@users.noreply.github.com>
---
 mmengine/hooks/ema_hook.py | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/mmengine/hooks/ema_hook.py b/mmengine/hooks/ema_hook.py
index cb8764d5..bad7d8f8 100644
--- a/mmengine/hooks/ema_hook.py
+++ b/mmengine/hooks/ema_hook.py
@@ -27,11 +27,12 @@ class EMAHook(Hook):
             Defaults to 'ExponentialMovingAverage'.
         strict_load (bool): Whether to strictly enforce that the keys of
             ``state_dict`` in checkpoint match the keys returned by
-            ``self.module.state_dict``. Defaults to True.
+            ``self.module.state_dict``. Defaults to False.
+            Changed in v0.3.0.
         begin_iter (int): The number of iteration to enable ``EMAHook``.
             Defaults to 0.
-        begin_epoch (int): The number of epoch to enable ``EMAHook``. Defaults
-            to 0.
+        begin_epoch (int): The number of epoch to enable ``EMAHook``.
+            Defaults to 0.
         **kwargs: Keyword arguments passed to subclasses of
             :obj:`BaseAveragedModel`
     """
@@ -40,7 +41,7 @@ class EMAHook(Hook):
 
     def __init__(self,
                  ema_type: str = 'ExponentialMovingAverage',
-                 strict_load: bool = True,
+                 strict_load: bool = False,
                  begin_iter: int = 0,
                  begin_epoch: int = 0,
                  **kwargs):
-- 
GitLab