Closed sikfeng closed 3 years ago
Can reproduce, working on a fix right now.
So, DataCollatorForWholeWordMask
has a few deisgn flaws (it only works for BERT for instance) and fixing it is not directly doable (basically what it tries to do should be done at the tokenization level). I will adapt the run_mlm_wwm
example to stop using it and we will probably deprecate it afterward.
For your specific problem however, there is a fix, which is to remove the return_tensors='pt'
from the tokenzier call.
This solves my problem, thanks!
Environment info
transformers
version: 3.5.0Who can help
@sgugger
Information
Model I am using (Bert, XLNet ...): Bert
The problem arises when using:
The tasks I am working on is:
To reproduce
Steps to reproduce the behavior:
This is the code I am running
It gives me the following error
But if instead I use
data_collator = DataCollatorForLanguageModeling(tokenizer=tokenizer, mlm=True, mlm_probability=0.15)
like thisI do not get any errors
Expected behavior
It should just perform whole word masking and not have errors.