unilm LayoutXLM模型中,词汇表中添加了特殊标记,

t1rydlwq  于 2个月前  发布在  其他
关注(0)|答案(1)|浏览(43)

描述

我正在使用的是LayoutXLM模型。我尝试使用问答对来微调这个模型。当我使用"microsoft/layoutlmv2-base-uncased"时,模型和数据都没有问题。但是当我切换到"microsoft/layoutxlm-base"时,出现了"Special tokens have been added in the vocabulary, make sure the associated word embeddings are fine-tuned or trained"的警告。一旦我开始进行分词,就在这个点上得到了"ValueError: Id not recognized"错误。如果我将"add_special_tokens=False"作为参数添加到这里 encoding = tokenizer( questions, words, boxes, max_length=max_length, padding="max_length", truncation=True, # add_special_tokens=False )
,我得到了"ValueError: 250005 is not in list"错误的提示。

z31licg0

z31licg01#

当我使用 "tokenizer = LayoutXLMTokenizer.from_pretrained(model_checkpoint_xml)" 而不是 "tokenizer = AutoTokenizer.from_pretrained(model_checkpoint_xml)" 时,我没有看到上面的错误。然而现在我无法得到 sequence_ids,因为它提示 "ValueError: sequence_ids() is not available when using Python-based tokenizers"。当我使用 LayoutMv2Tokenizer 时,它会给我 sequence_ids。不知道我在这里错过了什么。

相关问题