code: def test_save_model_level_pt_ckpt(self, asr_model):
      with tempfile.TemporaryDirectory() as ckpt_dir:
          nemo_file = os.path.join(ckpt_dir, "asr.nemo")
          asr_model.save_to(nemo_file)
  
          # Save model level PT checkpoint
          asr_model.extract_state_dict_from(nemo_file, ckpt_dir)
          ckpt_path = os.path.join(ckpt_dir, "model_weights.ckpt")
  
          assert os.path.exists(ckpt_path)
  
          # Restore the model.
          asr_model2 = EncDecCTCModel.restore_from(
              restore_path=nemo_file
          )
  
          assert len(asr_model.decoder.vocabulary) == len(
              asr_model2.decoder.vocabulary
          )
          assert asr_model.num_weights == asr_model2.num_weights
  
          # Change weights values
          asr_model2.encoder.encoder[0].mconv[0].conv.weight.data += 1.0
  
          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 not np.array_equal(w1, w2)
  
          # Restore from checkpoint
          asr_model2.load_state_dict(torch.load(ckpt_path))
  
          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 5 for calling the TestFileIO obj's underlying member method code with example usage: obj.test_save_model_level_pt_ckpt(asr_model) without return types