扒开老师双腿猛进入白浆小说,熟女人妻私密按摩内射,成人A片激情免费视频,亚洲欧洲AV无码区玉蒲区

當(dāng)前位置: > 投稿>正文

transformer 翻譯,transformer是什么意思,transformer中文翻譯,transformer發(fā)音、用法及例句

2025-09-04 投稿

transformer 翻譯,transformer是什么意思,transformer中文翻譯,transformer發(fā)音、用法及例句

?transformer

transformer發(fā)音

英:[tr?ns?f?:m?(r)]  美:[tr?ns?f?rm?]

英:  美:

transformer中文意思翻譯

n. 變壓器

transformer詞形變化

動詞過去分詞: transformed | 動詞第三人稱單數(shù): transforms | 形容詞: transformable | 動詞現(xiàn)在分詞: transforming | 動詞過去式: transformed |

transformer常見例句

1 、With rich transformer design experience.───具有豐富變壓器設(shè)計經(jīng)驗。

2 、To get there, all you have to do is transform.─── 只要變形你就能回到真實世界

3 、A transformer supplying auxiliaries of a power station.───向電站的輔助設(shè)備供電的變壓器。

4 、With a gentle twist, a button can define, unite, and transform.───只要溫柔地搓一搓,一個鈕扣就能自我定義,團(tuán)結(jié)一體,或者改頭換面。

5 、Yeah, thank you. And do you have a transformer for shaver? My husband's doesn't work without that.───好的,謝謝。另外,你們有用于剃須刀的變壓器嗎?我丈夫的壞了。

6 、A little paint will soon transform this old car .───只要噴上一點油漆就會馬上使這部舊車變個模樣。

7 、Certain granular solids transform into highly mobile slurries.───一定數(shù)量的粒狀固體就可以變成非常易流動的泥漿。

8 、The thermometer of main transformer is damaged. Loco19.We changed it.───19號的點接式溫度計壞。已經(jīng)更換。

9 、Can you transform this five-yuan note into five one-yuan notes?───你能把這五元錢換成五個一元的嗎?

10 、And the age of the transformers is over.─── 變形金剛的時代已經(jīng)結(jié)束了

11 、The substation equipped with a transformer of 500 KVA is at the south of the plant.───在工程的南邊有一座裝有五百千伏安變電器的變電站。

12 、And that, too, has transformed the landscape.─── 這一因素對情勢的轉(zhuǎn)變也有影響

13 、Comparison of two grounding methods for 330 kV transformer neutral point.───中性點直接接地330kV變壓器中性點兩種接地方式比較。

14 、Today we will transform animal into water goblet.───今天我們來學(xué)習(xí)把動物變成高腳杯。

15 、This is a transformer, and this is a gobot.─── 這是變形金剛 這是百變雄師

16 、How can an acorn transform itself into an oak tree?───一個橡子怎樣能把它自己轉(zhuǎn)變成一棵櫟樹?

17 、Bachelor degree or with more transformer design experience.───大學(xué)本科學(xué)歷或具有較多變壓器設(shè)計經(jīng)驗的人員。

18 、DJL offers ballast and transformer for both fixture and portable lamp use.───在美國擁有成熟完善的銷售網(wǎng)絡(luò)并設(shè)有銷售中心及倉庫。

19 、Only transformer coupling can contribute to the voltage gain of an amplifier by virtue of a stepup turns ratio.───只有放大器耦合方能通過開壓匝數(shù)比提高變壓器電壓增益。

20 、In order to transform them, we must first unite with them.───為了改造,先要團(tuán)結(jié)。

21 、A current is induced in the secondary of the transformer.───二級變壓器產(chǎn)生電流。

22 、Keep away from the transformer.───不要靠近那個變壓器。

23 、A variac and transformer, at far right, supply high voltage for the modulator.───為調(diào)制器提供高電壓的一臺自耦變壓器和一臺變壓器在右邊遠(yuǎn)處。

24 、The Clean Data transformer operates on specified data columns of the source table that your step accesses.───Clean Data轉(zhuǎn)換器操作源表中步驟所訪問的特定數(shù)據(jù)列。

25 、A guard spots Nina leaving the transformer room, and she shoots him.───一個警衛(wèi)在尼娜離開配電室時發(fā)現(xiàn)了她,尼娜射殺了他。

26 、Single DC welding transformer thyistor panel with water saver system.───單相直流焊機(jī)用變壓器可控硅柜,帶有節(jié)水系統(tǒng)

27 、A linear differential transformer has three coils.───一個直線差動變壓器有三個線圈。

28 、Why Do They Fail To Transform?───為什么他們會變革失敗?

29 、Professional Produce:Different Types Of Ballast Transformer And Lights.───專業(yè)生產(chǎn)照明電器類產(chǎn)品:電子、電感或變壓器、燈具等。

30 、Its moving iron core transformer structure is most widely used.───動鐵芯式變壓器結(jié)構(gòu),應(yīng)用最廣。

31 、The transformer simply plugs into a mains socket.───變壓器只是簡單**在電源**座中。

32 、The transformer isolates the transistors with regard to d-c bias voltage.───變壓器可在兩個晶體管之間隔離直流偏壓。

33 、A little paint will soon transform the old house.───刷一點油漆很快就會使這所舊房子大為改觀。

34 、A Fourier transform does this, but with waves.───傅立葉變化就是這樣,但是它是按照波的情況。

35 、New to create a new transformer service.───以創(chuàng)建新的轉(zhuǎn)換器服務(wù)。

36 、Company's transformer business will benefit from the UHV.───公司變壓器業(yè)務(wù)將受益于特高壓。

37 、In an ideal amplifier, the final stage tube acts as a signal source and the output transformer acts as a load.───在一個理想放大器,最后階段管作為信號源和輸出變壓器的負(fù)載。

38 、Draw the Transformer Substation and Concentrate the Monitiring System in the.───儀器儀表。電氣化鐵道牽引變電所集中監(jiān)控系統(tǒng)。

39 、Obvious effect on degraded insulating oil treatment, field transformer oil treatment when machine electrified.───處理劣化變質(zhì)的絕緣油效果明顯,可現(xiàn)場帶電處理各種牌號的變壓器油。

40 、For general insulation and protection for appliance, wire harness, transformer, lead wire of motors, etc.───一般應(yīng)用于電器、線束、變壓器、馬達(dá)引線等絕緣和保護(hù)。

41 、Did you check the transformer?───你檢查了變壓器沒有?

42 、You were transformed, and transformations can be reversed.─── 你是被轉(zhuǎn)化為死亡騎士的 既是轉(zhuǎn)化 就也能逆轉(zhuǎn)

43 、Present Situation of Transformer Trade and Its Trend.───變壓器行業(yè)現(xiàn)狀與發(fā)展動向。

44 、The transformer winding should be impregnated with insulation paint and baked.───變壓器繞組要用絕緣漆浸透并烘干。

45 、Dongfeng Pointing to a Million Transform of Commercial Vehicle Co.───東風(fēng)劍指百萬商用車公司轉(zhuǎn)型。

46 、To alter in form or nature; transform.───在性質(zhì)或形式上的改變;變形

47 、The sun transform the gild cupola into dazzling point of light.───太陽將這些鍍金的圓屋頂變成了閃耀的光點。

48 、Application of PLC and Frequency Transformer to TV Studio Technology.───PLC以及變頻器在電視演播工藝中的應(yīng)用。

49 、A minimum of 3 years relevant design experiences in Lan transformer field.───3年以上網(wǎng)絡(luò)變壓器開發(fā)經(jīng)驗,能獨立開發(fā)新產(chǎn)品優(yōu)先。

50 、If the filament transformer has a center tap, don't use it.───如果變壓器燈絲繞組有抽頭,請不要使用它。

51 、Any pin type of transformer and relay can adjust exactly.───任何不同的變壓器或繼電器的焊錫引腳可以被精確的調(diào)整設(shè)定。

52 、A little paint will transform this old car.───噴點漆就能讓這輛舊車變個模樣。

53 、This apparentlysimple function of the transformer makes it as vital to modern industry as the gear train.───變壓器的這種顯而易見的基本功能使其與齒輪裝置一樣,對現(xiàn)代工業(yè)至關(guān)重要。

54 、Discussion on the Economic Operation of the Main Transformer in Dongqing Co.───東輕公司主變壓器經(jīng)濟(jì)運行探討。

55 、And then when I transformed, I didn't know where I was.─── 但是當(dāng)我變形完 我就不知道自己在哪里了

56 、A loud bang. An electric power transformer exploded. No light until dawn.───大聲轟隆。壞電變壓器。沒有光直到黎明。

57 、Let's go to transform the mud to PEM system.───去將本段泥漿轉(zhuǎn)化成PEM泥漿體系。

58 、But then that applause is transforming into bigger applause, and then that bigger applause is transforming into standing ovation.─── 后來掌聲越來越大 如同雷鳴一般 再后來觀眾們越來越激動 他們紛紛起立鼓掌

59 、There is 220 kilovolt transformer substation inside the county 2, ..───縣內(nèi)有220千伏變電站二座,...

60 、A transformer provides no power of its own.───變壓器本身不產(chǎn)生電力。

61 、Insulation on transformer cover and partition.───可用于電壓器的覆蓋和隔層不導(dǎo)電用途。

62 、Cursed to transform into a beast at night.───夜幕降臨變身為野獸的詛咒。

63 、So an EI-frame transformer is always better than a toroidal transformer?───因此,一依愛框架變壓器總比一環(huán)形變壓器?

64 、He is a transformer of human flesh; a creator of monsters.───他能改造人類的形狀,他是魔鬼的制造者。

65 、There is messtin in transformer.───變壓器里有飯盒。

66 、To make or transform into a single unit.───使變成一個單位

67 、There was an error while deleting the color transform.───在刪除該顏色傳輸時有一個錯誤。

68 、His words and actions must transform our lives.───他說的話和他的行為必定改變我們的生活。

69 、He bound to you, and you transformed.─── 他附在你身上 然后你就變身了

70 、The transformer is more expensive than the toy train.───變形金剛比玩具火車貴得多。

71 、But this would hardly “transform” Sudan.───但是這樣做很難”改變”蘇丹。

72 、NINGBO TIANYUAN POWER TRANSFORMER CO., LTD.───寧波天元電力變壓器有限公司。

73 、Company main products: Voltage stabilizer , high low pressure transformer , reactance implement.───公司主要產(chǎn)品:穩(wěn)壓器、高低壓變壓器、電抗器。

74 、You are about to have a very transformative experience.─── 你就要經(jīng)歷一場顛覆性的體驗

75 、To transform a metal into a mineral by oxidation.───使礦化通過氧化使金屬轉(zhuǎn)化為一種無機(jī)物

76 、The damaged windings of(the transformer)should be rewound.───壞了的(變壓器)線圈應(yīng)當(dāng)重繞。

77 、He knew that he could not transform society by one bugle blast.───他知道,改造社會不能一蹴而就。

78 、The copper and iron lost of transformer, motor and generator cause temperature rise.───變壓器馬達(dá)及發(fā)電機(jī)等的銅損、鐵損增加而過溫。

79 、AC source is a better alternative to isolation transformer + variac.───交流源可以更好的代替變隔離壓器+調(diào)壓器。

80 、With cigar lighter device and transformer of any car.───可配置汽車點煙器及變壓器。

81 、So we are all capable of transforming our world.─── 所以我們所有人都能改變我們的世界

82 、This provides reference to transformer DC resistance test.───為變壓器直流電阻試驗提供借鑒。

83 、The tinning process of dry type current transformer is Electroplate Technology.───傳統(tǒng)干式電流互感器的鍍錫工藝是采用槽鍍鍍錫技術(shù)。

84 、Design and Analysis of Pulse Transformer in Forward Converter.───單端正激式脈沖變壓器的分析與設(shè)計。

85 、Open tender for purchasing power transformer.───公開招標(biāo)購買電力運輸設(shè)備。

86 、Under certain conditions we can transform the bad into the good.───在一定條件下,我們能把壞事變成好事。

87 、Click Browse to locate the transform you want to use.───單擊“瀏覽”以查找您要使用的轉(zhuǎn)換。

88 、Professional Produce: Different Types Of Ballast Transformer And Lights.───專業(yè)生產(chǎn)照明電器類產(chǎn)品:電子、感或變壓器、具等。

89 、The process by which the transformer is enabled to draw the requisite amount of power is as follows.───使變壓器能夠從電源輸入必要數(shù)量的功率的過程如下。

90 、The damaged windings of the transformer should be rewound.───壞了的變壓器線圈應(yīng)當(dāng)重繞。

為什么說Transformer的注意力機(jī)制是相對廉價的注意力機(jī)制相對更對于RNN系列及CNN系列算法有何優(yōu)勢

 基于注意力機(jī)制的構(gòu)造與基于RNN的不同,基于RNN的是在時間步上串聯(lián)(在每個time step只能輸入一個token),而基于注意力機(jī)制的是類似于桶狀結(jié)構(gòu)(一起將數(shù)據(jù)輸入到模型中去)

為什么說Transformer的注意力機(jī)制是相對廉價的注意力機(jī)制相對更對于RNN系列及CNN系列算法有何優(yōu)勢

QA形式對自然語言處理中注意力機(jī)制(Attention)進(jìn)行總結(jié),并對Transformer進(jìn)行深入解析。

二、Transformer(Attention Is All You Need)詳解

1、Transformer的整體架構(gòu)是怎樣的?由哪些部分組成?

2、Transformer Encoder 與 Transformer Decoder 有哪些不同?

3、Encoder-Decoder attention 與self-attention mechanism有哪些不同?

4、multi-head self-attention mechanism具體的計算過程是怎樣的?

5、Transformer在GPT和Bert等詞向量預(yù)訓(xùn)練模型中具體是怎么應(yīng)用的?有什么變化?

一、Attention機(jī)制剖析

1、為什么要引入Attention機(jī)制?

根據(jù)通用近似定理,前饋網(wǎng)絡(luò)和循環(huán)網(wǎng)絡(luò)都有很強的能力。但為什么還要引入注意力機(jī)制呢?

計算能力的限制:當(dāng)要記住很多“信息“,模型就要變得更復(fù)雜,然而目前計算能力依然是限制神經(jīng)網(wǎng)絡(luò)發(fā)展的瓶頸。

優(yōu)化算法的限制:雖然局部連接、權(quán)重共享以及pooling等優(yōu)化操作可以讓神經(jīng)網(wǎng)絡(luò)變得簡單一些,有效緩解模型復(fù)雜度和表達(dá)能力之間的矛盾;但是,如循環(huán)神經(jīng)網(wǎng)絡(luò)中的長距離以來問題,信息“記憶”能力并不高。

可以借助人腦處理信息過載的方式,例如Attention機(jī)制可以提高神經(jīng)網(wǎng)絡(luò)處理信息的能力。

2、Attention機(jī)制有哪些?(怎么分類?)

當(dāng)用神經(jīng)網(wǎng)絡(luò)來處理大量的輸入信息時,也可以借鑒人腦的注意力機(jī)制,只 選擇一些關(guān)鍵的信息輸入進(jìn)行處理,來提高神經(jīng)網(wǎng)絡(luò)的效率。按照認(rèn)知神經(jīng)學(xué)中的注意力,可以總體上分為兩類:

聚焦式(focus)注意力:自上而下的有意識的注意力,主動注意——是指有預(yù)定目的、依賴任務(wù)的、主動有意識地聚焦于某一對象的注意力;

顯著性(saliency-based)注意力:自下而上的有意識的注意力,被動注意——基于顯著性的注意力是由外界刺激驅(qū)動的注意,不需要主動干預(yù),也和任務(wù)無關(guān);可以將max-pooling和門控(gating)機(jī)制來近似地看作是自下而上的基于顯著性的注意力機(jī)制。

在人工神經(jīng)網(wǎng)絡(luò)中,注意力機(jī)制一般就特指聚焦式注意力。

3、Attention機(jī)制的計算流程是怎樣的?

Attention機(jī)制的實質(zhì):尋址(addressing)

Attention機(jī)制的實質(zhì)其實就是一個尋址(addressing)的過程,如上圖所示:給定一個和任務(wù)相關(guān)的查詢Query向量 q,通過計算與Key的注意力分布并附加在Value上,從而計算Attention Value,這個過程實際上是Attention機(jī)制緩解神經(jīng)網(wǎng)絡(luò)模型復(fù)雜度的體現(xiàn):不需要將所有的N個輸入信息都輸入到神經(jīng)網(wǎng)絡(luò)進(jìn)行計算,只需要從X中選擇一些和任務(wù)相關(guān)的信息輸入給神經(jīng)網(wǎng)絡(luò)。

注意力機(jī)制可以分為三步:一是信息輸入;二是計算注意力分布α;三是根據(jù)注意力分布α 來計算輸入信息的加權(quán)平均。

step1-信息輸入:用X = [x1, · · · , xN ]表示N 個輸入信息;

step2-注意力分布計算:令Key=Value=X,則可以給出注意力分布

我們將  稱之為注意力分布(概率分布),  為注意力打分機(jī)制,有幾種打分機(jī)制:

step3-信息加權(quán)平均:注意力分布  可以解釋為在上下文查詢q時,第i個信息受關(guān)注的程度,采用一種“軟性”的信息選擇機(jī)制對輸入信息X進(jìn)行編碼為:

這種編碼方式為軟性注意力機(jī)制(soft Attention),軟性注意力機(jī)制有兩種:普通模式(Key=Value=X)和鍵值對模式(Key!=Value)。

軟性注意力機(jī)制(soft Attention)

4、Attention機(jī)制的變種有哪些?

與普通的Attention機(jī)制(上圖左)相比,Attention機(jī)制有哪些變種呢?

變種1-硬性注意力:之前提到的注意力是軟性注意力,其選擇的信息是所有輸入信息在注意力 分布下的期望。還有一種注意力是只關(guān)注到某一個位置上的信息,叫做硬性注意力(hard attention)。硬性注意力有兩種實現(xiàn)方式:(1)一種是選取最高概率的輸入信息;(2)另一種硬性注意力可以通過在注意力分布式上隨機(jī)采樣的方式實現(xiàn)。硬性注意力模型的缺點:

硬性注意力的一個缺點是基于最大采樣或隨機(jī)采樣的方式來選擇信息。因此最終的損失函數(shù)與注意力分布之間的函數(shù)關(guān)系不可導(dǎo),因此無法使用在反向傳播算法進(jìn)行訓(xùn)練。為了使用反向傳播算法,一般使用軟性注意力來代替硬性注意力。硬性注意力需要通過強化學(xué)習(xí)來進(jìn)行訓(xùn)練。——《神經(jīng)網(wǎng)絡(luò)與深度學(xué)習(xí)》

變種2-鍵值對注意力:即上圖右邊的鍵值對模式,此時Key!=Value,注意力函數(shù)變?yōu)椋?/p>

變種3-多頭注意力:多頭注意力(multi-head attention)是利用多個查詢Q = [q1, · · · , qM],來平行地計算從輸入信息中選取多個信息。每個注意力關(guān)注輸入信息的不同部分,然后再進(jìn)行拼接:

5、一種強大的Attention機(jī)制:為什么自注意力模型(self-Attention model)在長距離序列中如此強大?

(1)卷積或循環(huán)神經(jīng)網(wǎng)絡(luò)難道不能處理長距離序列嗎?

當(dāng)使用神經(jīng)網(wǎng)絡(luò)來處理一個變長的向量序列時,我們通??梢允褂镁矸e網(wǎng)絡(luò)或循環(huán)網(wǎng)絡(luò)進(jìn)行編碼來得到一個相同長度的輸出向量序列,如圖所示:

基于卷積網(wǎng)絡(luò)和循環(huán)網(wǎng)絡(luò)的變長序列編碼

從上圖可以看出,無論卷積還是循環(huán)神經(jīng)網(wǎng)絡(luò)其實都是對變長序列的一種“局部編碼”:卷積神經(jīng)網(wǎng)絡(luò)顯然是基于N-gram的局部編碼;而對于循環(huán)神經(jīng)網(wǎng)絡(luò),由于梯度消失等問題也只能建立短距離依賴。

(2)要解決這種短距離依賴的“局部編碼”問題,從而對輸入序列建立長距離依賴關(guān)系,有哪些辦法呢?

如果要建立輸入序列之間的長距離依賴關(guān)系,可以使用以下兩種方法:一 種方法是增加網(wǎng)絡(luò)的層數(shù),通過一個深層網(wǎng)絡(luò)來獲取遠(yuǎn)距離的信息交互,另一種方法是使用全連接網(wǎng)絡(luò)。 ——《神經(jīng)網(wǎng)絡(luò)與深度學(xué)習(xí)》全連接模型和自注意力模型:實線表示為可學(xué)習(xí)的權(quán)重,虛線表示動態(tài)生成的權(quán)重。

由上圖可以看出,全連接網(wǎng)絡(luò)雖然是一種非常直接的建模遠(yuǎn)距離依賴的模型, 但是無法處理變長的輸入序列。不同的輸入長度,其連接權(quán)重的大小也是不同的。

這時我們就可以利用注意力機(jī)制來“動態(tài)”地生成不同連接的權(quán)重,這就是自注意力模型(self-attention model)。由于自注意力模型的權(quán)重是動態(tài)生成的,因此可以處理變長的信息序列。

總體來說,為什么自注意力模型(self-Attention model)如此強大:利用注意力機(jī)制來“動態(tài)”地生成不同連接的權(quán)重,從而處理變長的信息序列。

(3)自注意力模型(self-Attention model)具體的計算流程是怎樣的呢?

同樣,給出信息輸入:用X = [x1, · · · , xN ]表示N 個輸入信息;通過線性變換得到為查詢向量序列,鍵向量序列和值向量序列:

上面的公式可以看出,self-Attention中的Q是對自身(self)輸入的變換,而在傳統(tǒng)的Attention中,Q來自于外部。

self-Attention計算過程剖解(來自《細(xì)講 | Attention Is All You Need 》)

注意力計算公式為:

自注意力模型(self-Attention model)中,通常使用縮放點積來作為注意力打分函數(shù),輸出向量序列可以寫為:

二、Transformer(Attention Is All You Need)詳解

從Transformer這篇論文的題目可以看出,Transformer的核心就是Attention,這也就是為什么本文會在剖析玩Attention機(jī)制之后會引出Transformer,如果對上面的Attention機(jī)制特別是自注意力模型(self-Attention model)理解后,Transformer就很容易理解了。

1、Transformer的整體架構(gòu)是怎樣的?由哪些部分組成?

Transformer模型架構(gòu)

Transformer其實這就是一個Seq2Seq模型,左邊一個encoder把輸入讀進(jìn)去,右邊一個decoder得到輸出:

Seq2Seq模型

Transformer=Transformer Encoder+Transformer Decoder

(1)Transformer Encoder(N=6層,每層包括2個sub-layers):

Transformer Encoder

sub-layer-1:multi-head self-attention mechanism,用來進(jìn)行self-attention。

sub-layer-2:Position-wise Feed-forward Networks,簡單的全連接網(wǎng)絡(luò),對每個position的向量分別進(jìn)行相同的操作,包括兩個線性變換和一個ReLU激活輸出(輸入輸出層的維度都為512,中間層為2048):

每個sub-layer都使用了殘差網(wǎng)絡(luò): 

(2)Transformer Decoder(N=6層,每層包括3個sub-layers):

Transformer Decoder

sub-layer-1:Masked multi-head self-attention mechanism,用來進(jìn)行self-attention,與Encoder不同:由于是序列生成過程,所以在時刻 i 的時候,大于 i 的時刻都沒有結(jié)果,只有小于 i 的時刻有結(jié)果,因此需要做Mask。

sub-layer-2:Position-wise Feed-forward Networks,同Encoder。

sub-layer-3:Encoder-Decoder attention計算。

2、Transformer Encoder 與 Transformer Decoder 有哪些不同?

(1)multi-head self-attention mechanism不同,Encoder中不需要使用Masked,而Decoder中需要使用Masked;

(2)Decoder中多了一層Encoder-Decoder attention,這與 self-attention mechanism不同。

3、Encoder-Decoder attention 與self-attention mechanism有哪些不同?

它們都是用了 multi-head計算,不過Encoder-Decoder attention采用傳統(tǒng)的attention機(jī)制,其中的Query是self-attention mechanism已經(jīng)計算出的上一時間i處的編碼值,Key和Value都是Encoder的輸出,這與self-attention mechanism不同。代碼中具體體現(xiàn):

## Multihead Attention ( self-attention)

self.dec = multihead_attention(queries=self.dec,

  keys=self.dec,

  num_units=hp.hidden_units,

  num_heads=hp.num_heads,

  dropout_rate=hp.dropout_rate,

  is_training=is_training,

  causality=True,

  scope="self_attention")

## Multihead Attention ( Encoder-Decoder attention)

self.dec = multihead_attention(queries=self.dec,

  keys=self.enc,

  num_units=hp.hidden_units,

  num_heads=hp.num_heads,

  dropout_rate=hp.dropout_rate,

  is_training=is_training,

  causality=False,

  scope="vanilla_attention")

4、multi-head self-attention mechanism具體的計算過程是怎樣的?

multi-head self-attention mechanism計算過程

Transformer中的Attention機(jī)制由Scaled Dot-Product Attention和Multi-Head Attention組成,上圖給出了整體流程。下面具體介紹各個環(huán)節(jié):

Expand:實際上是經(jīng)過線性變換,生成Q、K、V三個向量;

Split heads: 進(jìn)行分頭操作,在原文中將原來每個位置512維度分成8個head,每個head維度變?yōu)?4;

Self Attention:對每個head進(jìn)行Self Attention,具體過程和第一部分介紹的一致;

Concat heads:對進(jìn)行完Self Attention每個head進(jìn)行拼接;

上述過程公式為:

5、Transformer在GPT和Bert等詞向量預(yù)訓(xùn)練模型中具體是怎么應(yīng)用的?有什么變化?

GPT中訓(xùn)練的是單向語言模型,其實就是直接應(yīng)用Transformer Decoder;

Bert中訓(xùn)練的是雙向語言模型,應(yīng)用了Transformer Encoder部分,不過在Encoder基礎(chǔ)上還做了Masked操作;

BERT Transformer 使用雙向self-attention,而GPT Transformer 使用受限制的self-attention,其中每個token只能處理其左側(cè)的上下文。雙向 Transformer 通常被稱為“Transformer encoder”,而左側(cè)上下文被稱為“Transformer decoder”,decoder是不能獲要預(yù)測的信息的。

本站其他內(nèi)容推薦

版權(quán)聲明: 本站僅提供信息存儲空間服務(wù),旨在傳遞更多信息,不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任,不代表本網(wǎng)贊同其觀點和對其真實性負(fù)責(zé)。如因作品內(nèi)容、版權(quán)和其它問題需要同本網(wǎng)聯(lián)系的,請發(fā)送郵件至 舉報,一經(jīng)查實,本站將立刻刪除。