code: def _build_bigru(
      num_classes,
      maxlen,
      max_features,
      features,
      loss_func="categorical_crossentropy",
      activation="softmax",
      metrics=["accuracy"],
      verbose=1,
      tokenizer=None,
      preproc=None,
  ):
      if tokenizer is None:
          raise ValueError("bigru requires valid Tokenizer object")
      if preproc is None:
          raise ValueError("bigru requires valid preproc")
      if not hasattr(preproc, "lang") or preproc.lang is None:
          lang = "en"
      else:
          lang = preproc.lang
      wv_url = (
          "https://dl.fbaipublicfiles.com/fasttext/vectors-crawl/cc.%s.300.vec.gz"
          % (lang.split("-")[0])
      )
      if verbose:
          print("word vectors will be loaded from: %s" % (wv_url))
  
      # setup pre-trained word embeddings
      embed_size = 300
      U.vprint("processing pretrained word vectors...", verbose=verbose)
      embeddings_index = tpp.load_wv(
          wv_path_or_url=wv_url, verbose=verbose
      )
      word_index = tokenizer.word_index
      # nb_words = min(max_features, len(word_index))
      nb_words = max_features
      embedding_matrix = np.zeros((nb_words, embed_size))
      for word, i in word_index.items():
          if i >= max_features:
              continue
          embedding_vector = embeddings_index.get(word)
          if embedding_vector is not None:
              embedding_matrix[i] = embedding_vector
  
      # define model
      inp = keras.layers.Input(shape=(maxlen,))
      x = keras.layers.Embedding(
          max_features, embed_size, weights=[embedding_matrix]
      )(inp)
      x = keras.layers.SpatialDropout1D(0.2)(x)
      x = keras.layers.Bidirectional(
          keras.layers.GRU(80, return_sequences=True)
      )(x)
      avg_pool = keras.layers.GlobalAveragePooling1D()(x)
      max_pool = keras.layers.GlobalMaxPool1D()(x)
      conc = keras.layers.concatenate([avg_pool, max_pool])
      outp = keras.layers.Dense(num_classes, activation=activation)(
          conc
      )
      model = keras.Model(inputs=inp, outputs=outp)
      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 12 for calling a global function with example usage: _build_bigru(num_classes, maxlen, max_features, features, loss_func, activation, metrics, verbose, tokenizer, preproc) and returns: model