code: def test_from_pretrained_dynamic_model_local(self):
      try:
          AutoConfig.register("custom", CustomConfig)
          AutoModel.register(CustomConfig, CustomModel)
  
          config = CustomConfig(hidden_size=32)
          model = CustomModel(config)
  
          with tempfile.TemporaryDirectory() as tmp_dir:
              model.save_pretrained(tmp_dir)
  
              new_model = AutoModel.from_pretrained(
                  tmp_dir, trust_remote_code=True
              )
              for p1, p2 in zip(
                  model.parameters(), new_model.parameters()
              ):
                  self.assertTrue(torch.equal(p1, p2))
  
      finally:
          if "custom" in CONFIG_MAPPING._extra_content:
              del CONFIG_MAPPING._extra_content["custom"]
          if CustomConfig in MODEL_MAPPING._extra_content:
              del MODEL_MAPPING._extra_content[CustomConfig]
  
imports: import copy
  import sys
  import tempfile
  import unittest
  from collections import OrderedDict
  from pathlib import Path
  import pytest
  from transformers import BertConfig, GPT2Model, is_torch_available
  from transformers.models.auto.configuration_auto import CONFIG_MAPPING
  from transformers.testing_utils import DUMMY_UNKNOWN_IDENTIFIER, SMALL_MODEL_IDENTIFIER, RequestCounter, require_scatter, require_torch, slow
  from ..bert.test_modeling_bert import BertModelTester
  from test_module.custom_configuration import CustomConfig
label_desc: Use image node_id 14 for calling the AutoModelTest obj's underlying member method code with example usage: obj.test_from_pretrained_dynamic_model_local() without return types