docstr: Test to ensure that the exp manager adds the EMA callback, and we save an additional EMA checkpoint.
code: def test_exp_manager_ema_weights(self, tmpdir):
      """Test to ensure that the exp manager adds the EMA callback, and we save an additional EMA checkpoint."""
      tmp_path = tmpdir / "exp_manager_test"
      model = ExampleModel()
      trainer = Trainer(
          max_epochs=1,
          enable_checkpointing=False,
          logger=False,
          accelerator="gpu",
          devices=1,
      )
      exp_manager(
          trainer,
          {
              "ema": {
                  "enable": True,
                  "validate_original_weights": True,
              },
              "explicit_log_dir": str(tmp_path),
              "checkpoint_callback_params": {
                  "filename": f"{{epoch}}-{{step}}"
              },
          },
      )
      assert any(
          isinstance(callback, EMA) for callback in trainer.callbacks
      )
      trainer.fit(model)
      ema_weights = extract_ema_weights(model, trainer)
  
      assert os.path.exists(
          tmp_path / "checkpoints/epoch=0-step=8.ckpt"
      )
      ema_path = tmp_path / "checkpoints/epoch=0-step=8-EMA.ckpt"
      assert os.path.exists(ema_path)
  
      duplicate_model = ExampleModel.load_from_checkpoint(str(ema_path))
      for saved_weight, ema_weight in zip(
          duplicate_model.state_dict().values(), ema_weights
      ):
          assert torch.allclose(saved_weight.cpu(), ema_weight.cpu())
  
imports: import os.path
  from typing import Any, Dict, Union
  import pytest
  import pytorch_lightning
  import torch
  from omegaconf import DictConfig, OmegaConf
  from pytorch_lightning import Callback, Trainer
  from pytorch_lightning.utilities.exceptions import MisconfigurationException
  from pytorch_lightning.utilities.types import STEP_OUTPUT
  from nemo.collections.common.callbacks import EMA
  from nemo.collections.common.callbacks.ema import EMAOptimizer
  from nemo.core import ModelPT
  from nemo.utils.exp_manager import exp_manager
label_desc: Use image node_id 3 for calling the TestEMAConfig obj's underlying member method code with example usage: obj.test_exp_manager_ema_weights(tmpdir) without return types