Closed Jess0-0 closed 3 years ago
Hey @Jess0-0,
You can load TF checkpoints into PT and vice-versa via:
XLMRoberta.from_pretrained(...., from_tf=True)
or
TFXLMRoberta.from_pretrained(...., from_pt=True)
.
Since XLMRobertaForSequenceClassification
is just an alias of RobertaForSequenceClassification
there should be no problem in doing
TFRobertaForSequenceClassification.from_pretrained("<your/path/to/saved/xlm/roberta/pytorch/dir>", from_pt=True)
Hi,
Thanks for this awesome framework! I have trained and saved an XLMRoberta model in PyTorch and I'm wondering if there is any way I can load the model into TFRobertaForSequenceClassification class. Or if there are ways to convert the checkpoint to TensorFlow checkpoints so that it can be load by TF2.
I came across this file https://github.com/huggingface/transformers/blob/master/src/transformers/convert_pytorch_checkpoint_to_tf2.py and I'm wondering if there are any docs or instructions to use the script.
Thanks!