def create_cpc_model(model, num_choices, is_training, softmax_mask):
  """Creates a classification model.

  Args:
    model: the BERT model from modeling.py
    num_choices: number of negatives samples + 1
    is_training: training mode (bool)
    softmax_mask: which options to ignore

  Returns:
    tuple of (loss, per_example_loss, logits, probabilities) for model
  """

  output_layer = model.get_pooled_output()

  hidden_size = output_layer.shape[-1].value

  with tf.variable_scope("cpc_loss"):

    softmax_weights = tf.get_variable(
        "softmax_weights", [hidden_size, 8],
        initializer=tf.truncated_normal_initializer(stddev=0.02))

    softmax_weights = tf.reshape(softmax_weights[:, 4], [hidden_size, 1])

    with tf.variable_scope("loss"):
      if is_training:
        # I.e., 0.1 dropout
        output_layer = tf.nn.dropout(output_layer, keep_prob=0.9)

      matmul_out = tf.matmul(output_layer, softmax_weights)

      logits = tf.reshape(matmul_out, (-1, num_choices))  # , 8))

      negs = tf.reshape(tf.constant([-99999.] * num_choices), [-1, num_choices])
      softmax_mask = tf.reshape(softmax_mask, [-1, num_choices])
      logits = tf.where(softmax_mask, logits, negs)
      probabilities = tf.nn.softmax(logits, axis=-1)

  return (logits, probabilities)
Creates a classification model.

  Args:
    model: the BERT model from modeling.py
    num_choices: number of negatives samples + 1
    is_training: training mode (bool)
    softmax_mask: which options to ignore

  Returns:
    tuple of (loss, per_example_loss, logits, probabilities) for model
  
language/conpono/evals/coherence_eval.py