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/longformer/longformer_encoder.py:205

        'attention_window': attention_window,
        'global_attention_size': global_attention_size,
        'pad_token_id': pad_token_id,
    }
    self.inputs = dict(
        input_word_ids=tf_keras.Input(shape=(None,), dtype=tf.int32),
        input_mask=tf_keras.Input(shape=(None,), dtype=tf.int32),
        input_type_ids=tf_keras.Input(shape=(None,), dtype=tf.int32))

  def call(self, inputs):
    word_embeddings = None
    if isinstance(inputs, dict):
      word_ids = inputs.get('input_word_ids')  # input_ids
      mask = inputs.get('input_mask')  # attention_mask
      type_ids = inputs.get('input_type_ids')  # token_type_ids
      word_embeddings = inputs.get('input_word_embeddings',
                                   None)  # input_embeds
    else:
      raise ValueError(f'Unexpected inputs type to {self.__class__}.')

    (
        padding_len,
        word_ids,
        mask,
        type_ids,
        word_embeddings,
    ) = self._pad_to_window_size(
        word_ids=word_ids,
        mask=mask,
        type_ids=type_ids,
        word_embeddings=word_embeddings,
        pad_token_id=self._pad_token_id)

    if word_embeddings is None:
      word_embeddings = self._embedding_layer(word_ids)
    # absolute position embeddings.
    position_embeddings = self._position_embedding_layer(word_embeddings)

View on GitHub (pinned to e006f5f0d5)

When it happens

Trigger: Thrown at official/projects/longformer/longformer_encoder.py:205 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/912bc37b7b165b01. Report an issue: GitHub.