Thanks a lot, I finally found the problem.
Yes, the problem is in my input: the vocab_size of the model (Bert (base)) is 30522, and my tokenizer is not Bertokenizer. It is another tokenizer built with the same architecture (the same tokenization algorithm as Bert, only the vocabulary is different (not english…)), but the problem is that when building the new tokenizer (from the old: Bert tokenizer), I set my vocab_size to 50000 (so the model crashes when encountring tokens ids > 30522, in my tokenized dataset…)
I think I will build another tokenizer (from RoBERTa, having approximately this vocab_size of 50000, but also having another tokenization algorithm: BBPE, not WordPiece as Bert base), and I will replace Bert base with RoBERTa for the rest…
Thank you very much once more (in fact, it is clear that the model will crash, but I built my tokenizer a while ago, and lost sight of it…).