docstr: " Test makes sure that the second instance created from the same configuration AND checkpoint 
  has the same weights. 
docstr_tok: ["``","Test","makes","sure","that","the","second","instance","created","from","the","same","configuration","AND","checkpoint","has","the","same","weights","."]
code: def test_save_restore_from_nemo_file(self, asr_model):
      """ " Test makes sure that the second instance created from the same configuration AND checkpoint
      has the same weights."""
  
      with tempfile.NamedTemporaryFile() as fp:
          filename = fp.name
  
          # Save model (with random artifact).
          with tempfile.NamedTemporaryFile() as artifact:
              asr_model.register_artifact(
                  config_path="abc", src=artifact.name
              )
              asr_model.save_to(save_path=filename)
  
          # Restore the model.
          asr_model2 = EncDecCTCModel.restore_from(
              restore_path=filename
          )
  
          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)
  
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 2 for calling the TestFileIO obj's underlying member method code with example usage: obj.test_save_restore_from_nemo_file(asr_model) without return types