Helsinki-NLP/opus-mt-en-fr missing tf_model.h5 file

Hi there,

I have been following the tensorflow track of the HF course and got an http 404 error when running the below:

from transformers import TFAutoModelForSeq2SeqLM

model = TFAutoModelForSeq2SeqLM.from_pretrained(model_checkpoint)

error message:

404 Client Error: Not Found for url:

I went to the model card and could not find the tf_model.h5 file. Is there something that I am missing or does the model only work for Torch?


@julien-c please assist, thank you

Hello :wave:
You need to set from_pt = True when loading.

from transformers import TFAutoModelForSeq2SeqLM

model_checkpoint = "Helsinki-NLP/opus-mt-en-fr"

model = TFAutoModelForSeq2SeqLM.from_pretrained(model_checkpoint, from_pt = True)

Downloading: 100%

1.26k/1.26k [00:00<00:00, 34.4kB/s]

Downloading: 100%

287M/287M [00:07<00:00, 37.4MB/s]

All PyTorch model weights were used when initializing TFMarianMTModel. All the weights of TFMarianMTModel were initialized from the PyTorch model. If your task is similar to the task the model of the checkpoint was trained on, you can already use TFMarianMTModel for predictions without further training.

that worked, thank you, much appreciated.