Hello Iacle.
I suspect your issue is around WordPiece Tokenization but I can’t tell for sure with the info you posted.
Take a look at
Fine-tuning with custom datasets — transformers 4.5.0.dev0 documentation 10
In particular pay attention to when it talks about WordPiece Tokenization and the code in
def encode_tags(tags, encodings): …