code: def assert_models_equal(model, model2):
      # check that model weights are the same
      keys = set(model.state_dict().keys())
      keys2 = set(model2.state_dict().keys())
  
      assert keys == keys2
  
      for key in keys:
          assert torch.equal(
              model.state_dict()[key], model2.state_dict()[key]
          )
  
      # check that vocabularies are the same
      vocab = model.vocab
      vocab2 = model2.vocab
  
      assert vocab._token_to_index == vocab2._token_to_index
      assert vocab._index_to_token == vocab2._index_to_token
  
imports: import copy
  import os
  import tempfile
  import tarfile
  import pytest
  import torch
  from allennlp.version import _MAJOR, _MINOR
  from allennlp.commands.train import train_model
  from allennlp.common import Params
  from allennlp.common.meta import Meta
  from allennlp.common.checks import ConfigurationError
  from allennlp.common.testing import AllenNlpTestCase
  from allennlp.data.dataset_readers import DatasetReader
  from allennlp.models.archival import archive_model, load_archive, CONFIG_NAME, _check_version_compatibility
label_desc: Use image node_id 1 for calling a global function with example usage: assert_models_equal(model, model2) without return types