code: def test_loading_from_pretrained_weights(params_dict):
      pretrained_module = AutoModel.from_pretrained(
          "bert-base-cased"
      ).encoder
  
      required_kwargs = [
          "num_hidden_layers2",
          "hidden_size2",
          "combined_hidden_size",
          "intermediate_size2",
          "num_attention_heads2",
          "combined_num_attention_heads",
          "attention_dropout2",
          "hidden_dropout2",
          "biattention_id1",
          "biattention_id2",
          "fixed_layer1",
          "fixed_layer2",
      ]
      kwargs = {key: params_dict[key] for key in required_kwargs}
  
      module = BiModalEncoder.from_pretrained_module(
          "bert-base-cased", **kwargs
      )
      assert_allclose(
          module.layers1[0].intermediate.dense.weight.data,
          pretrained_module.layer[0].intermediate.dense.weight.data,
      )
  
file_path: allennlp/tests/modules/transformer/bimodal_encoder_test.py
imports: import torch
  from torch.testing import assert_allclose
  from transformers import AutoModel
  import pytest
  from allennlp.common import Params
  from allennlp.modules.transformer import BiModalEncoder
label_desc: Use image node_id 6 for calling a global function with example usage: test_loading_from_pretrained_weights(params_dict) without return types