code: def bert_model(features, labels, mode, params):
      """
      Return an instance of BertModel and one can take its different outputs to
      perform specific tasks.
      """
      import tensorflow as tf
  
      input_ids = features["input_ids"]
      if "input_mask" in features:
          input_mask = features["input_mask"]
      else:
          input_mask = None
      if "token_type_ids" in features:
          token_type_ids = features["token_type_ids"]
      else:
          token_type_ids = None
      bert_config = modeling.BertConfig.from_json_file(
          params["bert_config_file"]
      )
      model = modeling.BertModel(
          config=bert_config,
          is_training=(mode == tf.estimator.ModeKeys.TRAIN),
          input_ids=input_ids,
          input_mask=input_mask,
          token_type_ids=token_type_ids,
          use_one_hot_embeddings=params["use_one_hot_embeddings"],
      )
      tvars = tf.trainable_variables()
      if params["init_checkpoint"]:
          (
              assignment_map,
              initialized_variable_names,
          ) = modeling.get_assignment_map_from_checkpoint(
              tvars, params["init_checkpoint"]
          )
          tf.train.init_from_checkpoint(
              params["init_checkpoint"], assignment_map
          )
      return model
  
file_path: BigDL/python/orca/src/bigdl/orca/tfpark/text/estimator/bert_base.py
imports: from bigdl.orca.tfpark.estimator import *
  from bert import modeling
  from bigdl.dllib.utils.log4Error import *
label_desc: Use image node_id 1 for calling a global function with example usage: bert_model(features, labels, mode, params) and returns: model