tensorflow/models · error · ValueError

Unexpected inputs type to {self.__class__}.

Error message

Unexpected inputs type to {self.__class__}.

What it means

Error "Unexpected inputs type to {self.__class__}." thrown in tensorflow/models.

Source

Thrown at official/projects/perceiver/modeling/models/pretrainer.py:132

    encoder_inputs = copy.copy(self.encoder.inputs)
    inputs = dict(encoder_inputs)

    if self._decoder is not None:
      inputs.update(copy.copy(self._decoder.inputs))

    self.masked_lm = customized_masked_lm or layers.MaskedLM(
        embedding_table=self.encoder.get_embedding_table(),
        activation=mlm_activation,
        initializer=mlm_initializer,
        name='cls/predictions')
    masked_lm_positions = tf_keras.layers.Input(
        shape=(None,), name='masked_lm_positions', dtype=tf.int32)

    if isinstance(inputs, dict):
      inputs['masked_lm_positions'] = masked_lm_positions
    else:
      raise ValueError(f'Unexpected inputs type to {self.__class__}.')
    self.inputs = inputs

  def call(self, inputs):  # pytype: disable=signature-mismatch  # overriding-parameter-count-checks
    """Return perceiver pretrainer model output tensors in a dict.

    Accepts inputs as dictionary of tensors.
    Args:
      inputs:
        A `Dict[str, tf_keras.Input]` with `input_word_ids`, `input_mask`, and
        `input_type_ids`. The shapes are all `(None)` with dtype `tf.int32`.
        If `masked_lm_positions` is included, it will run masked language
        modeling layer to return sequence of logits.

    Returns:
      `Dict[str, tf.Tensor]` with `sequence_output` and optionally
      `mlm_logits`.
    """
    if not isinstance(inputs, dict):

View on GitHub (pinned to e006f5f0d5)

When it happens

Trigger: Thrown at official/projects/perceiver/modeling/models/pretrainer.py:132 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/97be765081920763. Report an issue: GitHub.