code: def _compare_models(
      model_1: torch.nn.Module, model_2: torch.nn.Module
  ) -> bool:
      # For a full explanation of this 8-bit workaround, see https://github.com/ludwig-ai/ludwig/pull/3606
  
      # TODO: Uncomment "filter_for_weight_format()" method definition and enable its usage once GPU tests are set up.
      # def filter_for_weight_format(i):
      #     """Remove bitsandbytes metadata keys added on state dict creation.
      #
      #     8-bit quantized models that have been put on gpu will have a set of `weight_format` keys in their state dict.
      #     These contain strings that are used to reshape quantized tensors, however these have no impact until the state
      #     dict is loaded into a model. These keys were causing `torch.equal` to raise an exception, so we skip them in
      #     the evaluation.
      #     """
      #     return "weight_format" not in i[0]
  
      # model_1_filtered_state_dict = filter(filter_for_weight_format, model_1.state_dict().items())
      # model_2_filtered_state_dict = filter(filter_for_weight_format, model_2.state_dict().items())
  
      # Source: https://discuss.pytorch.org/t/check-if-models-have-same-weights/4351/6
  
      if model_1.__class__.__name__ != model_2.__class__.__name__:
          return False
  
      if (
          hasattr(model_1, "model")
          and hasattr(model_2, "model")
          and not _compare_models(
              model_1=model_1.model, model_2=model_2.model
          )
      ):
          return False
  
      for key_item_1, key_item_2 in zip(
          model_1.state_dict().items(), model_2.state_dict().items()
      ):
          if not torch.equal(key_item_1[1], key_item_2[1]):
              return False
  
      return True
  
imports: from __future__ import annotations
  import copy
  import json
  import os
  import pathlib
  from typing import Any
  import numpy
  import pandas
  import pytest
  import torch
  import ludwig.error
  from ludwig.api import LudwigModel
  from ludwig.constants import ADAPTER, BACKEND, BASE_MODEL, BATCH_SIZE, COMBINER, EPOCHS, GENERATION, INPUT_FEATURES, MERGE_ADAPTER_INTO_BASE_MODEL, MODEL_ECD, MODEL_LLM, MODEL_TYPE, OUTPUT_FEATURES, POSTPROCESSOR, PREPROCESSING, PRETRAINED_ADAPTER_WEIGHTS, PROGRESSBAR, PROMPT, QUANTIZATION, TARGET_MODULES, TRAINER, TYPE
  from ludwig.models.llm import LLM
  from ludwig.schema.model_types.base import ModelConfig
  from ludwig.utils.fs_utils import list_file_names_in_directory
  from ludwig.utils.types import DataFrame
  from tests.integration_tests.utils import category_feature, generate_data, text_feature
label_desc: Use image node_id 23 for calling a global function with example usage: _compare_models(model_1, model_2) and returns: True, False, False, False