huggingface / transformers

🤗 Transformers: State-of-the-art Machine Learning for Pytorch, TensorFlow, and JAX.
https://huggingface.co/transformers
Apache License 2.0
135.1k stars 27.03k forks source link

TFXLMRoberta impossible to load base and large model with pretrained weight ? #3436

Closed Shiro-LK closed 4 years ago

Shiro-LK commented 4 years ago

🐛 Bug

Information

Model I am using (Bert, XLNet ...): XLMRoberta Language I am using the model on (English, Chinese ...):

The problem arises when using:

The tasks I am working on is: my own task or dataset: (give details below)

To reproduce

launch the command : model = TFXLMRobertaForSequenceClassification.from_pretrained(pretrained_model_name_or_path="xlm-roberta-large" ) Steps to reproduce the behavior:

  1. from transformers import*
  2. launch the command above
  3. error :

TypeError: stat: path should be string, bytes, os.PathLike or integer, not NoneType

Expected behavior

model should be load.

Environment info

duyongan commented 4 years ago

maybe u can use from_pt=True TFXLMRobertaForSequenceClassification.from_pretrained(pretrained_model_name_or_path="xlm-roberta-large", _frompt=True)

Shiro-LK commented 4 years ago

Hi, thanks for your answer. I got exactly the same message with "from_pt=True"

Shiro-LK commented 4 years ago

I am suspecting that the file does not exist. I succeed to load with TFXLMRoberta doing that :

m = XLMRobertaForSequenceClassification.from_pretrained("xlm-roberta-base", num_labels=1)
m.save_pretrained("./")
del m
model = TFXLMRobertaForSequenceClassification.from_pretrained("./", , num_labels=1, from_pt=True)
LysandreJik commented 4 years ago

Hello, indeed there is no official XLM-R checkpoint. You can use @jplu's checkpoint from the modelhub:

m = TFXLMRobertaForSequenceClassification.from_pretrained("jplu/tf-xlm-roberta-base", num_labels=1)
stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.