code: def create_models(ds_config):
      bert_config = BertConfig(
          vocab_size_or_config_json_file=119547,
          hidden_size=ds_config.hidden_size,
          num_hidden_layers=ds_config.num_hidden_layers,
          num_attention_heads=ds_config.heads,
          intermediate_size=ds_config.intermediate_size,
          hidden_act="gelu",
          hidden_dropout_prob=ds_config.hidden_dropout_ratio,
          attention_probs_dropout_prob=ds_config.attn_dropout_ratio,
          max_position_embeddings=512,
          type_vocab_size=2,
          initializer_range=ds_config.initializer_range,
      )
  
      weights = []
      biases = []
  
      for i in range(4):
          weights.append(
              nn.Parameter(
                  torch.Tensor(
                      ds_config.hidden_size, ds_config.hidden_size
                  )
              )
          )
          weights[i].data.normal_(
              mean=0.0, std=ds_config.initializer_range
          )
  
      weights.append(nn.Parameter(torch.Tensor(ds_config.hidden_size)))
      weights[4].data.fill_(1.0)
      weights.append(
          nn.Parameter(
              torch.Tensor(
                  ds_config.intermediate_size, ds_config.hidden_size
              )
          )
      )
      weights[5].data.normal_(mean=0.0, std=ds_config.initializer_range)
      weights.append(
          nn.Parameter(
              torch.Tensor(
                  ds_config.hidden_size, ds_config.intermediate_size
              )
          )
      )
      weights[6].data.normal_(mean=0.0, std=ds_config.initializer_range)
      weights.append(nn.Parameter(torch.Tensor(ds_config.hidden_size)))
      weights[7].data.fill_(1.0)
  
      biases.append(nn.Parameter(torch.Tensor(ds_config.hidden_size)))
      biases[0].data.zero_()
      for i in range(4):
          biases.append(
              nn.Parameter(torch.Tensor(ds_config.hidden_size))
          )
          biases[i + 1].data.zero_()
      biases.append(
          nn.Parameter(torch.Tensor(ds_config.intermediate_size))
      )
      biases[5].data.zero_()
      biases.append(nn.Parameter(torch.Tensor(ds_config.hidden_size)))
      biases[6].data.zero_()
      biases.append(nn.Parameter(torch.Tensor(ds_config.hidden_size)))
      biases[7].data.zero_()
  
      if ds_config.pre_layer_norm:
          bert_encoder = BertEncoderPreln(bert_config, weights, biases)
      else:
          bert_encoder = BertEncoderPostln(bert_config, weights, biases)
      ds_encoder = DSEncoder(ds_config, weights, biases)
  
      if ds_config.fp16:
          bert_encoder.half()
          ds_encoder.half()
  
      bert_encoder.to(get_accelerator().device_name())
      ds_encoder.to(get_accelerator().device_name())
  
      return bert_encoder, ds_encoder
  
imports: import numpy
  import torch
  import pytest
  import random
  import copy
  import os
  from torch import nn
  from deepspeed import DeepSpeedTransformerLayer, DeepSpeedTransformerConfig
  from deepspeed.accelerator import get_accelerator
  from unit.modeling import BertConfig, BertLayerNorm, BertEncoder
  from unit.modelingpreln import BertEncoder
  from unit.common import DistributedTest, is_rocm_pytorch
label_desc: Use image node_id 3 for calling a global function with example usage: create_models(ds_config) and returns: bert_encoder,  ds_encoder