code: def _build_bert(
      num_classes,
      maxlen,
      max_features,
      features,
      loss_func="categorical_crossentropy",
      activation="softmax",
      metrics=["accuracy"],
      verbose=1,
      preproc=None,
  ):
      if preproc is None:
          raise ValueError("preproc is missing")
      lang = preproc.lang
      if lang is None:
          raise ValueError("lang is missing")
      config_path = os.path.join(
          tpp.get_bert_path(lang=lang), "bert_config.json"
      )
      checkpoint_path = os.path.join(
          tpp.get_bert_path(lang=lang), "bert_model.ckpt"
      )
      check_keras_bert()
      model = keras_bert.load_trained_model_from_checkpoint(
          config_path,
          checkpoint_path,
          training=True,
          trainable=True,
          seq_len=maxlen,
      )
      inputs = model.inputs[:2]
      dense = model.get_layer("NSP-Dense").output
      outputs = keras.layers.Dense(
          units=num_classes, activation=activation
      )(dense)
      model = keras.Model(inputs, outputs)
      model.compile(
          loss=loss_func, optimizer=U.DEFAULT_OPT, metrics=metrics
      )
      return model
  
file_path: ktrain/ktrain/text/models.py
imports: from ..None import utils
  from ..imports import *
  from .None import preprocessor
label_desc: Use image node_id 7 for calling a global function with example usage: _build_bert(num_classes, maxlen, max_features, features, loss_func, activation, metrics, verbose, preproc) and returns: model