pytorch T5中的“< extra_idx>tokens”是什么意思?

kyks70gy  于 5个月前  发布在  其他
关注(0)|答案(1)|浏览(121)

我使用HuggingFace Transformers的mT5模型来执行一些条件生成并将其应用于文本分类。
我注意到,无论T5模型生成什么(在它被充分训练之前),它通常都会生成类似<extra_id0><extra_id1>的特殊标记。这些标记也不包含在T5Tokenizer.special_tokens中,我想知道它们的意思。
我看了T5的HuggingFace页面,似乎这些是传销培训期间使用的特殊令牌?这是正确的吗?
奇怪的是,我在原始论文或网上的任何地方都找不到关于这些标记的任何细节。有人知道这些标记的含义吗?谢谢。

qyswt5oh

qyswt5oh1#

<extra_id_0>和<extra_id_1>标记是T5标记器的extra_ids词汇表的一部分,用作标记标记,用于屏蔽模型需要预测的输入部分。这些标记从词汇表的末尾到开头进行索引。您可以指定标记器中使用的屏蔽标记的数量。

extra_ids (:obj:`int`, `optional`, defaults to 100):
        Add a number of extra ids added to the end of the vocabulary for use as sentinels. These tokens are
        accessible as "<extra_id_{%d}>" where "{%d}" is a number between 0 and extra_ids-1. Extra tokens are
        indexed from the end of the vocabulary up to beginning ("<extra_id_0>" is the last token in the vocabulary
        like in T5 preprocessing see `here
        <https://github.com/google-research/text-to-text-transfer-transformer/blob/9fd7b14a769417be33bc6c850f9598764913c833/t5/data/preprocessors.py#L2117>`__).

字符串
在输出中,和之间的文本<extra_id0><extra_id1>表示第一个掩码的输出,依此类推。重要的是要注意,T5可能不是掩码语言建模任务的最佳选择,如本文here中所讨论的。您也可以访问Stackoverflow上的this页面以了解类似的问题。

相关问题