InvalidArgumentError when passing finetuned model's checkpoint to pipeline

Hi everyone, I am having an issue when running this code on colab:

model_checkpoint = "/content/marian-finetuned-kde4-en-to-fr"
translator = pipeline("translation", model=model_checkpoint,)

I get this error:

InvalidArgumentError                      Traceback (most recent call last)

<ipython-input-61-0228496e37cb> in <module>
      3 # Replace this with your own checkpoint
      4 model_checkpoint = "/content/marian-finetuned-kde4-en-to-fr"
----> 5 translator = pipeline("translation", model=model_checkpoint,)
      6 # print(f"original language: {en_enc[100]}")
      7 # print(f"original translation: {fr_enc[100]}")

10 frames

/usr/local/lib/python3.7/dist-packages/transformers/models/marian/ in call(self, input_ids, inputs_embeds, attention_mask, head_mask, output_attentions, output_hidden_states, return_dict, training)
    786         if inputs_embeds is None:
--> 787             inputs_embeds = self.embed_tokens(input_ids) * self.embed_scale
    789         embed_pos = self.embed_positions(input_shape)

InvalidArgumentError: Exception encountered when calling layer "encoder" (type TFMarianEncoder).

cannot compute Mul as input #1(zero-based) was expected to be a half tensor but is a float tensor [Op:Mul]

Call arguments received:
  • input_ids=tf.Tensor(shape=(3, 5), dtype=int32)
  • inputs_embeds=None
  • attention_mask=tf.Tensor(shape=(3, 5), dtype=bool)
  • head_mask=None
  • output_attentions=False
  • output_hidden_states=False
  • return_dict=True
  • training=False

can someone help me please?

Check your data types for the model. It looks like some parts are in half precision and some are not