docstr: " Test makes sure that the second instance created from the same configuration AND checkpoint
  has the same weights.
  
  Args:
      tmpdir: fixture providing a temporary directory unique to the test invocation.
docstr_tok: ["``","Test","makes","sure","that","the","second","instance","created","from","the","same","configuration","AND","checkpoint","has","the","same","weights",".","Args",":","tmpdir",":","fixture","providing","a","temporary","directory","unique","to","the","test","invocation","."]
code: def test_save_restore_from_nemo_file_with_override(
      self, asr_model, tmpdir
  ):
      """ " Test makes sure that the second instance created from the same configuration AND checkpoint
      has the same weights.
  
      Args:
          tmpdir: fixture providing a temporary directory unique to the test invocation.
      """
      # Name of the archive in tmp folder.
      filename = os.path.join(tmpdir, "eff.nemo")
  
      # Get path where the command is executed - the artifacts will be "retrieved" there.
      # (original .nemo behavior)
      cwd = os.getcwd()
  
      with tempfile.NamedTemporaryFile(mode="a+") as conf_fp:
          # Create a "random artifact".
          with tempfile.NamedTemporaryFile(
              mode="w", delete=False
          ) as artifact:
              artifact.write("magic content 42")
          # Remember the filename of the artifact.
          _, artifact_filename = os.path.split(artifact.name)
          # Add artifact to model.
          asr_model.register_artifact(
              config_path="abc", src=artifact.name
          )
          # Save model (with "random artifact").
          asr_model.save_to(save_path=filename)
  
          # Modify config slightly
          cfg = asr_model.cfg
          cfg.encoder.activation = "swish"
          yaml_cfg = OmegaConf.to_yaml(cfg)
          conf_fp.write(yaml_cfg)
          conf_fp.seek(0)
  
          # Restore the model.
          asr_model2 = EncDecCTCModel.restore_from(
              restore_path=filename, override_config_path=conf_fp.name
          )
  
          assert len(asr_model.decoder.vocabulary) == len(
              asr_model2.decoder.vocabulary
          )
          assert asr_model.num_weights == asr_model2.num_weights
  
          w1 = (
              asr_model.encoder.encoder[0]
              .mconv[0]
              .conv.weight.data.detach()
              .cpu()
              .numpy()
          )
          w2 = (
              asr_model2.encoder.encoder[0]
              .mconv[0]
              .conv.weight.data.detach()
              .cpu()
              .numpy()
          )
  
          assert np.array_equal(w1, w2)
  
          assert asr_model2.cfg.encoder.activation == "swish"
  
file_path: NeMo/tests/core/test_fileio.py
imports: import os
  import tempfile
  import numpy
  import pytest
  import torch
  from omegaconf import DictConfig, OmegaConf
  from nemo.collections.asr.models import EncDecCTCModel
label_desc: Use image node_id 4 for calling the TestFileIO obj's underlying member method code with example usage: obj.test_save_restore_from_nemo_file_with_override(asr_model, tmpdir) without return types