code: def run_forward(
      ds_config, seq_len, atol=1e-2, verbose=False, test_bsz=None
  ):
      set_seed(123)
      bert_encoder, ds_encoder = create_models(ds_config)
  
      bsz = ds_config.batch_size if test_bsz is None else test_bsz
  
      # prepare test data
      kwargs = kwargs_fp16 if ds_config.fp16 else kwargs_fp32
      hidden_states = torch.randn(
          bsz, seq_len, ds_config.hidden_size, **kwargs
      )
      input_mask = torch.randn(bsz, 1, 1, seq_len, **kwargs)
  
      # run baseline
      base_results = bert_encoder(
          hidden_states,
          input_mask,
          output_all_encoded_layers=False,
          checkpoint_activations=False,
      )
  
      # run ds
      ds_results = ds_encoder(
          hidden_states,
          input_mask,
          output_all_encoded_layers=False,
          checkpoint_activations=False,
      )
  
      # check forward evaluation
      check_equal(base_results, ds_results, atol=atol, verbose=verbose)
  
imports: import math
  import numpy
  import torch
  import pytest
  import random
  import copy
  from torch import nn
  from unit.modelingpreln import BertEncoder
  from unit.modeling import BertLayerNorm, BertConfig, BertEncoder
  from deepspeed import DeepSpeedTransformerLayer, DeepSpeedTransformerConfig
label_desc: Use image node_id 5 for calling a global function with example usage: run_forward(ds_config, seq_len, atol, verbose, test_bsz) without return types