tensorflow/models · error · ValueError

Unknown `output` value "%s". `output` can be either "logits"

Error message

Unknown `output` value "%s". `output` can be either "logits" or "predictions"

What it means

Error "Unknown `output` value "%s". `output` can be either "logits" or "predictions"" thrown in tensorflow/models.

Source

Thrown at official/nlp/modeling/models/bert_token_classifier.py:87

    else:
      sequence_output = outputs['sequence_output']
    sequence_output = tf_keras.layers.Dropout(rate=dropout_rate)(
        sequence_output)

    classifier = tf_keras.layers.Dense(
        num_classes,
        activation=None,
        kernel_initializer=initializer,
        name='predictions/transform/logits')
    logits = classifier(sequence_output)
    if output == 'logits':
      output_tensors = {'logits': logits}
    elif output == 'predictions':
      output_tensors = {
          'predictions': tf_keras.layers.Activation(tf.nn.log_softmax)(logits)
      }
    else:
      raise ValueError(
          ('Unknown `output` value "%s". `output` can be either "logits" or '
           '"predictions"') % output)

    if output_encoder_outputs:
      output_tensors['encoder_outputs'] = sequence_output

    # b/164516224
    # Once we've created the network using the Functional API, we call
    # super().__init__ as though we were invoking the Functional API Model
    # constructor, resulting in this object having all the properties of a model
    # created using the Functional API. Once super().__init__ is called, we
    # can assign attributes to `self` - note that all `self` assignments are
    # below this line.
    super(BertTokenClassifier, self).__init__(
        inputs=inputs, outputs=output_tensors, **kwargs)

    self._network = network
    config_dict = {

View on GitHub (pinned to e006f5f0d5)

When it happens

Trigger: Thrown at official/nlp/modeling/models/bert_token_classifier.py:87 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of tensorflow/models@e006f5f0d5 (2026-08-24). Data as JSON: /api/errors/9b0c345f6731a25c. Report an issue: GitHub.