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/layers/mobile_bert_layers.py:472

    Args:
      embedding_table: The embedding table from encoder network.
      activation: The activation, if any, for the dense layer.
      initializer: The initializer for the dense layer. Defaults to a Glorot
        uniform initializer.
      output: The output style for this layer. Can be either `logits` or
        `predictions`.
      output_weights_use_proj: Use projection instead of concating extra output
        weights, this may reduce the MLM task accuracy but will reduce the model
        params as well.
      **kwargs: keyword arguments.
    """
    super().__init__(**kwargs)
    self.embedding_table = embedding_table
    self.activation = activation
    self.initializer = tf_keras.initializers.get(initializer)

    if output not in ('predictions', 'logits'):
      raise ValueError(
          ('Unknown `output` value "%s". `output` can be either "logits" or '
           '"predictions"') % output)
    self._output_type = output
    self._output_weights_use_proj = output_weights_use_proj

  def build(self, input_shape):
    self._vocab_size, embedding_width = self.embedding_table.shape
    hidden_size = input_shape[-1]
    self.dense = tf_keras.layers.Dense(
        hidden_size,
        activation=self.activation,
        kernel_initializer=tf_utils.clone_initializer(self.initializer),
        name='transform/dense')

    if hidden_size > embedding_width:
      if self._output_weights_use_proj:
        self.extra_output_weights = self.add_weight(
            'output_weights_proj',

View on GitHub (pinned to e006f5f0d5)

When it happens

Trigger: Thrown at official/nlp/modeling/layers/mobile_bert_layers.py:472 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/13c3ad3effd4c482. Report an issue: GitHub.