code: def test_save_load(self):
      (
          config,
          inputs_dict,
      ) = self.model_tester.prepare_config_and_inputs_for_common()
  
      def check_save_load(out1, out2):
          # make sure we don't have nans
          out_2 = out2.cpu().numpy()
          out_2[np.isnan(out_2)] = 0
  
          out_1 = out1.cpu().numpy()
          out_1[np.isnan(out_1)] = 0
          max_diff = np.amax(np.abs(out_1 - out_2))
          self.assertLessEqual(max_diff, 1e-5)
  
      for model_class in self.all_model_classes:
          model = model_class(config)
          model.to(torch_device)
          model.eval()
          with torch.no_grad():
              set_seed(0)
              first = model(
                  **self._prepare_for_class(inputs_dict, model_class)
              )[0]
  
          with tempfile.TemporaryDirectory() as tmpdirname:
              model.save_pretrained(tmpdirname)
  
              # the config file (and the generation config file, if it can generate) should be saved
              self.assertTrue(
                  os.path.exists(os.path.join(tmpdirname, CONFIG_NAME))
              )
              self.assertEqual(
                  model.can_generate(),
                  os.path.exists(
                      os.path.join(tmpdirname, GENERATION_CONFIG_NAME)
                  ),
              )
  
              model = model_class.from_pretrained(tmpdirname)
              model.to(torch_device)
              with torch.no_grad():
                  set_seed(0)
                  second = model(
                      **self._prepare_for_class(
                          inputs_dict, model_class
                      )
                  )[0]
  
          if isinstance(first, tuple) and isinstance(second, tuple):
              for tensor1, tensor2 in zip(first, second):
                  check_save_load(tensor1, tensor2)
          else:
              check_save_load(first, second)
  
imports: import copy
  import os
  import tempfile
  import unittest
  from typing import Dict, List, Tuple
  import numpy
  from transformers import PretrainedConfig, VitsConfig
  from transformers.testing_utils import is_flaky, is_torch_available, require_torch, require_torch_multi_gpu, slow, torch_device
  from transformers.trainer_utils import set_seed
  from ...test_configuration_common import ConfigTester
  from ...test_modeling_common import ModelTesterMixin, global_rng, ids_tensor, random_attention_mask
  from ...test_pipeline_mixin import PipelineTesterMixin
label_desc: Use image node_id 10 for calling the VitsModelTest obj's underlying member method code with example usage: obj.test_save_load() without return types