以下为 10 个例子:
正如我们所期望的那样,这种方式在直觉上是可行的。而在数学上,它究竟是怎么运作的呢?我们的目标是预测10个不同的数字(每个数字为一类)0,1,2,3,4,5,6,7,8,9注意:在船和房子的例子中,我们的目标是预测两个物体,而现在我们要预测10个。与船和房子的例子不同,在这里我们不是要预测实际的图片,而是要试图预测描述图片的向量。通过计算向量和每一个类别的权重矩阵的乘积,我们可以获得胶囊对于每一个类的预测结果。注意我们有32个胶囊层,并且每个胶囊层有36个胶囊。这意味着我们总共有1152个胶囊。cap_1*weight_for_0=prediction cap_1*weight_for_1=prediction cap_1*weight_for_2=prediction cap_1*...cap_1*weight_for_9=prediction cap_2*weight_for_0=prediction cap_2*weight_for_1=prediction cap_2*weight_for_2=prediction cap_2*...cap_2*weight_for_9=prediction...cap_1152*weight_for_0=prediction cap_1152*weight_for_1=prediction cap_1152*weight_for_2=prediction cap_1152*...cap_1152*weight_for_9=prediction经过计算,最终你将得到一个含有11520个预测值的列表。每个权重实际上是一个16x8的矩阵,所以每个预测都是胶囊向量同这个权重矩阵的乘积。正如你看到的那样,我们的预测结果是一个16维的向量。维度16是从何而来呢?这是一个任意的选择,就像我们最初使用8个胶囊一样。
coffee tarot card--ar 9:16Golden virgo logo illustration,celestial card,Virgo,tarot style illustration--ar 9:16the sun tarot black and white sketch--ar 5:7back of tarot card,white,elegant,clean lines,fantasy art,black and white,simple,line drawing--ar 5:7zodiac cards batch,magic frame with esoteric patterns and mystic symbols,sun and moon sorcery,vector--ar 1:2--stylize 750simple flat vector illustration of the woman sun,major arcana card,in the style of Marc Davis,isolated on a starry sky background--ar 7:12--stylize 250minimalistic tarot with a horse ornament cartoon simple vectorial--ar 2:3Generate exact text"Capricorn"in a font that reflects the ambitious,grounded,and fantastical qualities associated with the Capricorn zodiac sign,suitable for a Dark Fantasy-style Tarot card image with a transparent background.--ar 9:16--stylize 250The tarot card back features an ornate,symmetrical frame with a central,mandala-like motif,surrounded by earthy,folk-inspired elements and celestial symbols,all in a palette of deep blues,purples,and metallic gold,inviting deep introspection and connection to the cosmos.--chaos 4--ar 7:12--stylize 3502D view of a vector gold and black detailed artistically decorated playing card with scifi patterns.The card artistically depicts a vector gold and black glowing crystal sphere with a space snake dragon leviathan floating away from it in a spiral motion towards the screen.There are also scifi cathedral spaceships flying away from the crystal sphere.There are also 7 sphere shaped aliens with angel wings and arms praying around the crystal sphere.--ar 1024:1769--style raw
在我的图片中,我只有10个,但这是上下文长度,所以这个数字可以是2,000,4,000等等。这些都是非常长的行,我们所做的是我们获取这些文档,将它们打包成行,并用这些特殊的文本结束token来分隔它们,基本上告诉transformer新的文档从哪里开始。在这里,我有一些文档的例子,然后我将它们拉长成这个输入。现在,我们将所有这些数字都输入到transformer中。让我只关注一个特定的单元格,但在这个图中的每一个单元格都会发生同样的事情。所以,让我们看看绿色的单元格。绿色的单元格将查看其前面的所有token,这里是所有的黄色token。我们将整个上下文输入到transformer神经网络中。transformer将尝试预测序列中的下一个token,在这个例子中是红色的。现在,说到transformer,很抱歉我没有太多时间去深入详细介绍这个神经网络架构,但对我们的目的来说,它只是一大堆神经网络的东西,通常有上百亿个参数,或者类似的东西。当然,当他们调整这些参数时,每一个单元格的预测分布都会有些许不同。例如,如果我们的词汇表大小是50,257个token,那么我们就会有这么多的数字,因为我们需要为接下来的事情指定概率分布,这样我们基本上就有了可能接下来的任何事情的概率。现在,在这个特定的例子中,对于这个具体的单元格,接下来会是513(即上图的红色块)。所以我们可以使用这个作为监督源来更新我们的transformer权重。所以,我们基本上在每一个单元格上都并行地应用这个。我们不断地交换批次,试图让transformer正确预测序列中接下来的token是什么。