Convertion of tensorflow gpt2 sequence classification to tflite

Hello,

I am trying to convert a fine tuned gpt2 sequence classification model to a tflite model. and i am getting the below issue.

TypeError: Exception encountered when calling layer ‘tfgpt2_for_sequence_classification’ (type TFGPT2ForSequenceClassification).

in user code:

    File "C:\Users\myvenv\Lib\site-packages\transformers\modeling_tf_utils.py", line 1164, in run_call_with_unpacked_inputs  *
        return func(self, **unpacked_inputs)
    File "C:\myvenv\Lib\site-packages\transformers\models\gpt2\modeling_tf_gpt2.py", line 1202, in call  *
        sequence_lengths = tf.where(sequence_lengths >= 0, sequence_lengths, input_ids.shape[-1] - 1)

    TypeError: unsupported operand type(s) for -: 'NoneType' and 'int'


Call arguments received by layer 'tfgpt2_for_sequence_classification' (type TFGPT2ForSequenceClassification):
  • input_ids={'input_ids': 'tf.Tensor(shape=(None, None), dtype=int32)', 'attention_mask': 'tf.Tensor(shape=(None, None), dtype=int32)'}
  • past_key_values=None
  • attention_mask=None
  • token_type_ids=None
  • position_ids=None
  • head_mask=None
  • inputs_embeds=None
  • use_cache=None
  • output_attentions=None
  • output_hidden_states=None
  • return_dict=None
  • labels=None
  • training=False

Please help me to solve this issue.

Thank you