class_docstr: Hook executed to save the exponential moving average of the base_model parameters
  and run the meters on this ema_model.
class_docstr_tok: ["Hook","executed","to","save","the","exponential","moving","average","of","the","base_model","parameters","and","run","the","meters","on","this","ema_model","."]
docstr: Update ema model weights
docstr_tok: ["Update","ema","model","weights"]
code: def on_update(self, task: "tasks.ClassyTask") -> None:
      """
      Update ema model weights
      """
      if task.iteration % self.update_iter != 0:
          return
  
      if task.where < self.warmup:
          # Overwrite model weights.
          task.ema_model.set(task.base_model)
      else:
          assert (
              task.ema_model.decay >= 0 and task.ema_model.decay <= 1
          ), f"Decay is {task.ema_model.decay}"
          task.ema_model.update(task.base_model)
  
file_path: vissl/vissl/hooks/ema_hooks.py
imports: import torch
  from classy_vision import tasks
  from classy_vision.generic.distributed_util import is_primary
  from classy_vision.hooks.classy_hook import ClassyHook
  from vissl.hooks.log_hooks import LogLossMetricsCheckpointHook
label_desc: Use image node_id 4 for calling the EmaHook obj's underlying member method code with example usage: obj.on_update(task) without return types