System Info
transformers version: 4.36.2
- Platform: Windows-10-10.0.22621-SP0
- Python version: 3.8.18
- Huggingface_hub version: 0.20.2
- Safetensors version: 0.4.1
- Accelerate version: not installed
- Accelerate config: not found
- PyTorch version (GPU?): 2.1.2+cpu (False)
- Tensorflow version (GPU?): not installed (NA)
- Flax version (CPU?/GPU?/TPU?): not installed (NA)
- Jax version: not installed
- JaxLib version: not installed
- Using GPU in script?:
- Using distributed or parallel set-up in script?:
Who can help?
@ArthurZucker @younesbelkada
Information
Tasks
Reproduction
Run the example code for XLMRobertaXLForMaskedLM verbatim in python: https://huggingface.co/docs/transformers/model_doc/xlm-roberta-xl#transformers.XLMRobertaXLForMaskedLM.forward.example
Example code pasted here for convenience:
from transformers import AutoTokenizer, XLMRobertaXLForMaskedLM
import torch
tokenizer = AutoTokenizer.from_pretrained("xlm-roberta-xlarge")
model = XLMRobertaXLForMaskedLM.from_pretrained("xlm-roberta-xlarge")
inputs = tokenizer("The capital of France is <mask>.", return_tensors="pt")
with torch.no_grad():
logits = model(**inputs).logits
# retrieve index of <mask>
mask_token_index = (inputs.input_ids == tokenizer.mask_token_id)[0].nonzero(
as_tuple=True
)[0]
predicted_token_id = logits[0, mask_token_index].argmax(axis=-1)
labels = tokenizer("The capital of France is Paris.", return_tensors="pt")["input_ids"]
# mask labels of non-<mask> tokens
labels = torch.where(inputs.input_ids == tokenizer.mask_token_id, labels, -100)
outputs = model(**inputs, labels=labels)
This results in:
OSError: xlm-roberta-xlarge is not a local folder and is not a valid model identifier listed on 'https://huggingface.co/models'
If this is a private repository, make sure to pass a token having permission to this repo either by logging in with `huggingface-cli login` or by passing `token=<your_token>`
Expected behavior
This should find and run the model. However, it does not. Replacing the model string from "xlm-roberta-xlarge" to "facebook/xlm-roberta-xl" fixes the problem.
System Info
transformersversion: 4.36.2Who can help?
@ArthurZucker @younesbelkada
Information
Tasks
examplesfolder (such as GLUE/SQuAD, ...)Reproduction
Run the example code for
XLMRobertaXLForMaskedLMverbatim in python: https://huggingface.co/docs/transformers/model_doc/xlm-roberta-xl#transformers.XLMRobertaXLForMaskedLM.forward.exampleExample code pasted here for convenience:
This results in:
Expected behavior
This should find and run the model. However, it does not. Replacing the model string from
"xlm-roberta-xlarge"to"facebook/xlm-roberta-xl"fixes the problem.