title
stringclasses
312 values
author
stringclasses
138 values
date
stringclasses
263 values
local
stringclasses
312 values
tags
stringclasses
196 values
URL
stringclasses
312 values
chunk
stringlengths
7
30.6k
embedding
sequencelengths
768
768
Leveraging Pre-trained Language Model Checkpoints for Encoder-Decoder Models
patrickvonplaten
November 09, 2020
warm-starting-encoder-decoder
guide, nlp
https://huggingface.co/blog/warm-starting-encoder-decoder
Summarization (CNN/Dailymail, BBC XSum, Gigaword) Finally, the encoder-decoder models were evaluated on the arguably most challenging sequence-to-sequence task - summarization. The authors picked three summarization datasets with different characteristics for evaluation: Gigaword (headline generation), BBC XSum (extreme summarization), and CNN/Dailymayl (abstractive summarization). The Gigaword dataset contains sentence-level abstractive summarizations, requiring the model to learn sentence-level understanding, abstraction, and eventually paraphrasing. A typical data sample in Gigaword, such as \"venezuelan president hugo chavez said thursday he has ordered a probe into a suspected coup plot allegedly involving active and retired military officers .\", would have a corresponding headline as its label, e.g.: \"chavez orders probe into suspected coup plot\". The BBC XSum dataset consists of much longer article-like text inputs with the labels being mostly single sentence summarizations. This dataset requires the model not only to learn document-level inference but also a high level of abstractive paraphrasing. Some data samples of the BBC XSUM datasets are shown here. For the CNN/Dailmail dataset, documents, which are of similar length than those in the BBC XSum dataset, have to be summarized to bullet-point story highlights. The labels therefore often consist of multiple sentences. Besides document-level understanding, the CNN/Dailymail dataset requires models to be good at copying the most salient information. Some examples can be viewed here. The models are evaluated using the Rouge metric, whereas the Rouge-2 scores are shown below. Alright, let\'s take a look at the results. |Model |CNN/Dailymail (Rouge-2) |BBC XSum (Rouge-2) |Gigaword (Rouge-2) |---------------------- |------------------------- |-------------------- |-------------------- |Rnd2Rnd | 14.00 | 10.23 | 18.71 |Rnd2BERT | 15.55 | 11.52 | 18.91 |BERT2Rnd | 17.76 | 15.83 | 19.26 |Rnd2GPT2 | 8.81 | 8.77 | 18.39 |BERT2BERT | 17.84 | 15.24 | 19.68 |BERTShare | 18.10 | 16.12 | 19.81 |RoBERTaShare | 18.95 | 17.50 | 19.70 |BERT2GPT2 | 4.96 | 8.37 | 18.23 |RoBERTa2GPT2 | 14.72 | 5.20 | 19.21 |--- | --- | --- | --- |RoBERTaShare (large) | 18.91 | 18.79 | 19.78 We observe again that warm-starting the encoder-part gives a significant improvement over models with randomly-initialized encoders, which is especially visible for document-level abstraction tasks, i.e. CNN/Dailymail and BBC XSum. This shows that tasks requiring a high level of abstraction benefit more from a pre-trained encoder part than those requiring only sentence-level abstraction. Except for Gigaword GPT2-based encoder-decoder models seem to be unfit for summarization. Furthermore, the shared encoder-decoder models are the best performing models for summarization. RoBERTaShare and BERTShare are the best performing models on all datasets whereas the margin is especially significant on the BBC XSum dataset on which RoBERTaShare (large) outperforms BERT2BERT and BERT2Rnd by ca. 3 Rouge-2 points and Rnd2Rnd by more than 8 Rouge-2 points. As brought forward by the authors, \"this is probably because the BBC summary sentences follow a distribution that is similar to that of the sentences in the document, whereas this is not necessarily the case for the Gigaword headlines and the CNN/DailyMail bullet-point highlights\". Intuitively this means that in BBC XSum, the input sentences processed by the encoder are very similar in structure to the single sentence summary processed by the decoder, i.e. same length, similar choice of words, similar syntax.
[ -0.023908961564302444, -0.00043923480552621186, 0.017407981678843498, 0.0033589466474950314, 0.03634347766637802, 0.020244259387254715, -0.022365670651197433, 0.010334574617445469, -0.04762182757258415, 0.02357218787074089, -0.03561897948384285, 0.021969368681311607, -0.01046714186668396, 0.00033900811104103923, 0.01893334835767746, -0.005408258643001318, -0.006796777714043856, 0.043993495404720306, 0.012188446708023548, 0.0024747352581471205, -0.016529526561498642, -0.00698369974270463, -0.02161240763962269, -0.07560544461011887, -0.014484068378806114, -0.014511634595692158, 0.02261197566986084, -0.03639733046293259, -0.0048393323086202145, 0.005597276613116264, -0.08411547541618347, -0.05588657036423683, -0.011044204235076904, 0.004726124461740255, -0.06905516237020493, -0.024129675701260567, -0.125855952501297, 0.05699186027050018, 0.02231830544769764, -0.032574452459812164, 0.010938644409179688, -0.029134035110473633, -0.09197796136140823, 0.07485290616750717, -0.050161369144916534, 0.031625911593437195, -0.06351793557405472, 0.010061711072921753, -0.05598433315753937, 0.018376324325799942, -0.04003018140792847, 0.11635159701108932, -0.056717026978731155, -0.03821137547492981, 0.021919580176472664, 0.024413881823420525, 0.024075575172901154, -0.08364065736532211, 0.036522120237350464, 0.01693166047334671, 0.02753886952996254, -0.027656864374876022, 0.025756431743502617, -0.020123567432165146, -0.013457770459353924, 0.006191853899508715, -0.021314283832907677, 0.09556704759597778, -0.055319346487522125, -0.02542906068265438, -0.025274861603975296, -0.019351551309227943, -0.0021759713999927044, 0.013546900823712349, 0.005380664486438036, -0.07770205289125443, 0.0387246236205101, -0.03219973295927048, -0.01736714318394661, -0.007805841509252787, -0.041984058916568756, 0.05017174407839775, 0.06231623515486717, 0.027331562712788582, 0.029530255123972893, 0.03680163621902466, 0.026565400883555412, -0.023817798122763634, -0.02819509617984295, 0.05595731362700462, -0.06803356856107712, -0.11937594413757324, 0.053161561489105225, 0.07829423248767853, -0.007573492359369993, -0.05052822083234787, -0.029442647472023964, 0.02648434042930603, -0.0014985761372372508, -0.06273006647825241, -0.02419111505150795, -0.052628908306360245, 0.09762558341026306, -0.08685071766376495, -0.0694098174571991, -0.030559584498405457, -0.09104904532432556, -0.048316456377506256, -0.026574380695819855, 0.02652808465063572, 0.03846590965986252, 0.029277049005031586, -0.037256572395563126, -0.02268647961318493, -0.04242537543177605, -0.050739798694849014, 0.03657418116927147, -0.017626754939556122, 0.02169906720519066, -0.004426085855811834, -0.05688152089715004, 0.07141340523958206, 0.01879577711224556, -0.011880343779921532, 0.03454304113984108, -0.01873486116528511, -0.0663149356842041, -0.041447874158620834, 0.010301065631210804, 0.05206075310707092, 0.03986036777496338, 0.07412207871675491, 0.06661335378885269, 0.02761572040617466, -0.00487305223941803, -0.06089494004845619, -0.04202008247375488, -0.027002178132534027, -0.005597831681370735, 0.024877356365323067, -0.012473886832594872, 0.059510014951229095, 0.022584808990359306, -0.0026045693084597588, 0.030284395441412926, 0.0032040157821029425, -0.03167922794818878, 0.017233341932296753, 0.045055072754621506, -0.007313689682632685, -0.026047522202134132, 0.05018717795610428, -0.05675983801484108, -0.061997026205062866, 0.08948615938425064, 0.030215518549084663, 0.02852519042789936, -0.054874029010534286, -0.06109514459967613, -0.0002285942027810961, 0.0644257515668869, 0.030741790309548378, 0.0034194216132164, -0.008347226306796074, -0.050918396562337875, -0.03709881007671356, 0.027810582891106606, -0.005670954938977957, -0.026172174140810966, -0.030533406883478165, -0.0664260983467102, 0.0228133387863636, 0.07582759112119675, 0.019653623923659325, -0.0530044361948967, 0.022523239254951477, 0.02037697844207287, -0.024319298565387726, -0.0034101144410669804, -0.014818194322288036, -0.06705106049776077, -0.0472646988928318, 0.03631889820098877, -0.06488095223903656, 0.04192864149808884, -0.07153675705194473, 0.05056421086192131, -0.011500532738864422, -0.026032384485006332, 0.028633439913392067, -0.05752383917570114, 0.04939430579543114, 0.027592869475483894, 0.013320398516952991, 0.011571990326046944, -0.08186370879411697, 0.030369365587830544, 0.08325816690921783, 0.05125866457819939, 0.07121749222278595, 0.017529914155602455, 0.07244058698415756, 0.07399270683526993, -0.06412939727306366, -0.047996122390031815, 0.005382393952459097, -0.013412879779934883, -0.025721995159983635, -0.032222166657447815, 0.06124523654580116, 0.042516130954027176, -0.10325819253921509, 0.021417848765850067, -0.05961008369922638, -0.02885955385863781, -0.03924150764942169, 0.016151167452335358, 0.09303966909646988, 0.020532038062810898, -0.027010006830096245, 0.09531020373106003, -0.07460536062717438, -0.02670571208000183, 0.0614788793027401, -0.0283446554094553, 0.005429924465715885, 0.0472237765789032, 0.04902166500687599, 0.01121941301971674, -0.009309368208050728, -0.00340970023535192, 0.03658570349216461, 0.05942206457257271, 0.016360973939299583, 0.06166832521557808, 0.028124351054430008, -0.02357015758752823, 0.029596520587801933, 0.011071186512708664, -0.07023271173238754, 0.09718072414398193, 0.048380475491285324, 0.005011164583265781, 0.01452002301812172, -0.01899612322449684, -0.03250596299767494, 0.08874951303005219, -0.025263814255595207, -0.04094429314136505, 0.0065153660252690315, -0.024912388995289803, 0.09480167180299759, 0.00119779200758785, -0.0626092329621315, -0.031930554658174515, 0.04671674966812134, 0.050272416323423386, -0.02231508679687977, -0.028444210067391396, 0.006366785150021315, -0.00897287018597126, -0.01702433079481125, 0.00325201079249382, -0.05493520200252533, 0.0007372003747150302, 0.01172612514346838, 0.01727442815899849, -0.0436183363199234, 0.003904961980879307, -0.030356165021657944, -0.01908663474023342, 0.022413114085793495, 0.02679547108709812, 0.07222462445497513, 0.02976253628730774, 0.01563395746052265, 0.039310622960329056, -0.013892161659896374, -0.04957021027803421, -0.04247942939400673, -0.011437250301241875, 0.0112448176369071, 0.016906309872865677, -0.0033538280986249447, 0.05022347345948219, -0.04535222798585892, -0.011275364086031914, -0.015648270025849342, -0.06666718423366547, 0.02885204739868641, -0.0009111531544476748, 0.03856031969189644, -0.010190943256020546, 0.024579769000411034, 0.02655799128115177, -0.034439101815223694, -0.017669379711151123, 0.015715548768639565, -0.011372721754014492, 0.015170501545071602, -0.03950314596295357, 0.006005433853715658, -0.01699160784482956, -0.021547697484493256, 0.03007896989583969, 0.009715968742966652, 0.03129095211625099, 0.03440423682332039, -0.07954354584217072, 0.01885991357266903, 0.02869611419737339, -0.04827668517827988, -0.041307225823402405, 0.0030383609700948, 0.06732653081417084, 0.018745476379990578, -0.03852667286992073, -0.005130089353770018, -0.013360092416405678, 0.005672299303114414, -0.052889999002218246, -0.035286303609609604, 0.05246761813759804, 0.008104590699076653, -0.021253105252981186, -0.04431304335594177, 0.018245985731482506, 0.05422408506274223, 0.009226115420460701, -0.002182880649343133, 0.008313359692692757, -0.04697517305612564, -0.024600924924016, 0.010436775162816048, 0.07757209986448288, 0.009551315568387508, -0.008521264418959618, -0.006668871268630028, -0.0029627885669469833, -0.004497423768043518, 0.0062355040572583675, 0.012353119440376759, 0.007036146707832813, 0.03377172723412514, -0.010687693022191525, -0.004532961640506983, -0.001997031969949603, 0.05412451922893524, 0.03540074825286865, -0.017999332398176193, 0.0208287350833416, -0.017081936821341515, 0.02965887449681759, 0.005237144883722067, 0.031504906713962555, -0.03809124976396561, -0.009429645724594593, -0.0670955553650856, -0.028144214302301407, 0.017997298389673233, 0.011441105045378208, 0.050044793635606766, -0.024317380040884018, -0.004558376036584377, 0.04536633566021919, -0.04119163751602173, -0.0065186466090381145, -0.028278226032853127, -0.01732553541660309, 0.051766879856586456, -0.014679617248475552, 0.013190901838243008, -0.002766513032838702, 0.08791998773813248, 0.006340486463159323, -0.029622459784150124, 0.020700132474303246, 0.061069369316101074, -0.01051403395831585, 0.024938441812992096, -0.007214282639324665, -0.0025281356647610664, -0.04261521250009537, -0.0005249307723715901, -0.006712112110108137, -0.06105835735797882, 0.023173008114099503, 0.030978750437498093, -0.005537061020731926, -0.02185511402785778, -0.04230423644185066, -0.02200956456363201, 0.014319646172225475, 0.01078106090426445, 0.03218894079327583, -0.04493618384003639, 0.04773023724555969, 0.03114621341228485, 0.013424321077764034, -0.015341500751674175, 0.025596167892217636, 0.009263413026928902, 0.0010510600404813886, -0.04886055365204811, 0.03728823363780975, 0.03338894993066788, 0.05818617716431618, -0.010798499919474125, -0.036047209054231644, -0.031133277341723442, 0.003313136287033558, -0.016013624146580696, -0.03742986172437668, -0.021766135469079018, -0.04418480768799782, 0.023553017526865005, -0.0260360948741436, -0.014782529324293137, -0.020742889493703842, -0.018288038671016693, 0.0123973423615098, 0.005073870997875929, 0.04103848710656166, 0.003646095748990774, -0.004554383922368288, -0.024693142622709274, -0.024166570976376534, -0.01788177341222763, -0.00227468553930521, -0.014290635474026203, 0.0028958208858966827, 0.020686667412519455, 0.0020724867936223745, -0.022246118634939194, -0.005204197950661182, 0.011189043521881104, -0.009027461521327496, -0.012319053523242474, -0.02046983689069748, 0.017054062336683273, -0.03995838016271591, -0.01830952614545822, 0.014881673268973827, -0.02376461587846279, -0.04145348072052002, 0.03124743327498436, 0.01920473948121071, -0.03514588996767998, -0.01511930488049984, -0.006443798542022705, 0.03339608386158943, -0.032578952610492706, 0.025814546272158623, -0.036261141300201416, 0.004818478133529425, 0.005801089107990265, -0.01074355561286211, -0.018894365057349205, -0.0030217820312827826, 0.032050032168626785, -0.04422752559185028, 0.022370312362909317, 0.0244379173964262, 0.003550173481926322, 0.021253837272524834, 0.039678726345300674, -0.013958713971078396, -0.01483288686722517, -0.02134147845208645, -0.026027966290712357, -0.02178981527686119, 0.04893292114138603, 0.019106777384877205, -0.003606373444199562, -0.04478062689304352, -0.016403263434767723, 0.030987339094281197, 0.034430328756570816, -0.045382414013147354, 0.023700475692749023, 0.013303284533321857, -0.00016145552217494696, 0.012097947299480438, -0.02490360103547573, -0.0547017976641655, 0.06672420352697372, 0.01803017035126686, 0.041879020631313324, -0.04086356982588768, -0.09510388225317001, 0.009601782076060772, 0.000791576225310564, 0.08414949476718903, -0.018361009657382965, 0.033390842378139496, 0.05270938202738762, -0.012395905330777168, 0.013465450145304203, 0.012543980032205582, 0.016479982063174248, -0.01814296282827854, -0.047348808497190475, -0.017186734825372696, 0.028130896389484406, 0.054499249905347824, 0.007895032875239849, -0.0017082045087590814, -0.0104946568608284, 0.012498222291469574, 0.02932569570839405, 0.020362472161650658, -0.010501643642783165, -0.024652302265167236, -0.006626507267355919, -0.031435076147317886, -0.04273679479956627, 0.05195776745676994, -0.03207610175013542, -0.058199867606163025, 0.016803083941340446, -0.024708891287446022, -0.021259184926748276, 0.010028376244008541, -0.017003173008561134, -0.041679661720991135, 0.0358649343252182, -0.007747217081487179, 0.024799615144729614, -0.0317084938287735, 0.011314946226775646, 0.010212920606136322, 0.03451818972826004, -0.017578378319740295, -0.002637287834659219, 0.0014326517703011632, -0.04570583254098892, 0.04452811926603317, 0.011496772058308125, 0.03530798852443695, 0.017561769112944603, -0.0424424447119236, 0.027464229613542557, 0.0018137600272893906, 0.00707242451608181, 0.023038480430841446, 0.016102809458971024, -0.01466459408402443, 0.04941451922059059, 0.00893346406519413, -0.007916807197034359, 0.015998441725969315, 0.014227035455405712, -0.02933921478688717, 0.09299946576356888, 0.037110283970832825, -0.010933304205536842, 0.061864711344242096, -0.03540719673037529, 0.015157179906964302, 0.02541181817650795, -0.025959834456443787, -0.04456011578440666, -0.003339880844578147, -0.014423573389649391, 0.05250893533229828, -0.00322265038266778, 0.04170773923397064, 0.043703604489564896, -0.016924506053328514, -0.038323815912008286, 0.026864618062973022, 0.01162545382976532, -0.024533798918128014, 0.033242449164390564, -0.014568665064871311, -0.02166658639907837, 0.005628040060400963, 0.010309948585927486, 0.022859884425997734, 0.01732391119003296, -0.023276180028915405, -0.01184169203042984, 0.007696860935539007, 0.04591507464647293, -0.0015192311257123947, 0.06382451206445694, 0.04114317148923874, -0.025508275255560875, -0.004079505801200867, -0.013334528543055058, 0.04607740417122841, -0.013389498926699162, 0.006989291403442621, -0.001320150913670659, 0.04508347809314728, 0.003463967237621546, -0.00418743584305048, 0.048378460109233856, -0.03033376857638359, -0.015406382270157337, -0.06152929738163948, -0.019816504791378975, 0.030941836535930634, 0.05358489602804184, 0.01950860023498535, -0.02602200396358967, 0.029388736933469772, -0.002778145018965006, 0.08085379749536514, 0.036944348365068436, -0.019104013219475746, -0.0027031220961362123, 0.04909871146082878, -0.01299341768026352, -0.013240988366305828, 0.0357653945684433, 0.029300296679139137, -0.010730338282883167, -0.007740739732980728, 0.03480740636587143, 0.026792114600539207, 0.017245249822735786, -0.02828300930559635, 0.015734601765871048, -0.03919762372970581, 0.010668889619410038, 0.007030785549432039, 0.0034041295293718576, 0.03186098486185074, -0.029277265071868896, -0.004952585324645042, 0.001967941876500845, -0.04072650521993637, 0.04710949957370758, 0.002515992149710655, 0.007602892816066742, -0.030217623338103294, -0.029736541211605072, 0.0042715854942798615, 0.041810087859630585, -0.03843654692173004, -0.031055575236678123, -0.058017317205667496, 0.0008673952543176711, -0.01939980685710907, 0.040147557854652405, -0.0070321266539394855, 0.011271587572991848, -0.005956947337836027, 0.0014714226126670837, -0.002626018598675728, 0.025438502430915833, -0.044233232736587524, -0.0041406238451600075, 0.0666421502828598, -0.026943998411297798, -0.007275753654539585, -0.002647192683070898, 0.015619239769876003, 0.019687628373503685, 0.0007956614135764539, 0.014497136697173119, -0.038475506007671356, -0.03640056401491165, -0.005708558950573206, -0.009378061629831791, 0.016034843400120735, -0.015138760209083557, 0.02241557464003563, 0.034401487559080124, 0.01063685305416584, -0.006068329326808453, 0.017970722168684006, 0.00917854905128479, 0.0007861214107833803, 0.02882482297718525, -0.02263067476451397, 0.02483021840453148, -0.03619922325015068, -0.03334139287471771, 0.009780778549611568, -0.0058083669282495975, -0.053179413080215454, 0.005156995728611946, 0.03474041074514389, 0.008804289624094963, -0.013240024447441101, 0.031118830665946007, 0.013088387437164783, -0.01644109934568405, 0.03356201574206352, -0.015448318794369698, -0.013403737917542458, 0.08851674199104309, -0.012781651690602303, 0.024730179458856583, -0.050209179520606995, 0.03853270784020424, -0.021977439522743225, -0.06925000995397568, -0.0493411161005497, 0.03785869851708412, 0.000862920074723661, -0.027617160230875015, -0.015902291983366013, 0.00948033481836319, -0.006591454613953829, -0.031142180785536766, -0.04108014702796936, 0.01842053048312664, 0.054663486778736115, -0.04739289730787277, 0.04964541271328926, -0.0340091697871685, 0.00047908996930345893, -0.01544264517724514, -0.03881458193063736, 0.03811574727296829, 0.03099638596177101, 0.01653863675892353, -0.0389924980700016, 0.007101487368345261, -0.002595719415694475, 0.0099943857640028, -0.030556663870811462, -0.01456652581691742, 0.055906906723976135, 0.011899211443960667, -0.03744273632764816, -0.033167991787195206, -0.012434261851012707, 0.028419876471161842, 0.016477186232805252, 0.0528273768723011, -0.00881251972168684, 0.0073912013322114944, -0.006310705095529556, -0.029830241575837135, 0.033685993403196335, 0.00033837216324172914, 0.029928913339972496, -0.004153304733335972, 0.009483092464506626, 0.05428126081824303, 0.03208696097135544, 0.040734417736530304, 0.0008478967356495559, 0.034506212919950485, -0.004441503901034594, 0.015055514872074127, 0.03295408561825752, -0.014489438384771347, -0.030817611142992973, -0.009524987079203129, 0.05799473077058792, -0.005660580936819315, -0.0070471810176968575, -0.01504797674715519, 0.012588482350111008, 0.06715594977140427, -0.012018939480185509, 0.018096590414643288, 0.006446696352213621, 0.06261057406663895, 0.044346004724502563, 0.044359881430864334, 0.039861295372247696, -0.012813468463718891 ]
Leveraging Pre-trained Language Model Checkpoints for Encoder-Decoder Models
patrickvonplaten
November 09, 2020
warm-starting-encoder-decoder
guide, nlp
https://huggingface.co/blog/warm-starting-encoder-decoder
Encoder-Decoder Weight Sharing In Raffel et al. (2020), the authors show that a randomly-initialized encoder-decoder model that shares the encoder\'s weights with the decoder, and therefore reduces the memory footprint by half, performs only slightly worse than its \"non-shared\" version. Sharing the encoder\'s weights with the decoder means that all layers of the decoder that are found at the same position in the encoder share the same weight parameters, i.e. the same node in the network\'s computation graph.\ E.g. the query, key, and value projection matrices of the self-attention layer in the third encoder block, defined as \(\mathbf{W}^{\text{self-attn}, 3}{\text{Enc}, k}\), \(\mathbf{W}^{\text{self-attn}, 3}{\text{Enc}, v}\), \(\mathbf{W}^{\text{self-attn}, 3}{\text{Enc}, q}\) are identical to the respective query, key, and value projections matrices of the self-attention layer in the third decoder block \({}^2\): $$ \mathbf{W}^{\text{self-attn}, 3}{k} = \mathbf{W}^{\text{self-attn}, 3}{\text{enc}, k} \equiv \mathbf{W}^{\text{self-attn}, 3}{\text{dec}, k}, $$ $$ \mathbf{W}^{\text{self-attn}, 3}{q} = \mathbf{W}^{\text{self-attn}, 3}{\text{enc}, q} \equiv \mathbf{W}^{\text{self-attn}, 3}{\text{dec}, q}, $$ $$ \mathbf{W}^{\text{self-attn}, 3}{v} = \mathbf{W}^{\text{self-attn}, 3}{\text{enc}, v} \equiv \mathbf{W}^{\text{self-attn}, 3}{\text{dec}, v}, $$ As a result, the key projection weights \(\mathbf{W}^{\text{self-attn}, 3}{k}, \mathbf{W}^{\text{self-attn}, 3}{v}, \mathbf{W}^{\text{self-attn}, 3}{q}\) are updated twice for each backward propagation pass - once when the gradient is backpropagated through the third decoder block and once when the gradient is backprapageted thourgh the third encoder block. In the same way, we can warm-start an encoder-decoder model by sharing the encoder weights with the decoder. Being able to share the weights between the encoder and decoder requires the decoder architecture (excluding the cross-attention weights) to be identical to the encoder architecture. Therefore, encoder-decoder weight sharing is only relevant if the encoder-decoder model is warm-started from a single encoder-only pre-trained checkpoint. Great! That was the theory about warm-starting encoder-decoder models. Let\'s now look at some results. ------------------------------------------------------------------------ \({}^1\) Without loss of generality, we exclude the normalization layers to not clutter the equations and illustrations. \({}^2\) For more detail on how self-attention layers function, please refer to this section of the transformer-based encoder-decoder model blog post for the encoder-part (and this section for the decoder part respectively).
[ 0.01819232665002346, 0.041349295526742935, 0.014214920811355114, 0.030981361865997314, 0.011008497327566147, 0.020971564576029778, -0.05253695324063301, -0.048615626990795135, -0.0840652734041214, -0.07737183570861816, -0.03940041363239288, -0.01683860272169113, -0.0055651287548244, 0.02973523549735546, -0.056212231516838074, -0.030522314831614494, 0.06706131249666214, -0.036507900804281235, 0.04735945537686348, -0.015482877381145954, 0.03649907559156418, -0.0746486708521843, 0.08502434939146042, -0.06688030809164047, 0.0004845483344979584, -0.014024347066879272, -0.04544626921415329, -0.06505557894706726, -0.0193583145737648, 0.011977201327681541, -0.06644882261753082, 0.022106751799583435, 0.0754348412156105, -0.03420248627662659, 0.009908044710755348, -0.013326361775398254, -0.1219547837972641, 0.06979735940694809, 0.015772124752402306, -0.01934814266860485, -0.0003287530562374741, -0.04968264326453209, -0.0689648911356926, 0.02755802683532238, -0.032531995326280594, -0.019580060616135597, -0.11162305623292923, 0.08589629828929901, -0.04019049555063248, -0.017440004274249077, -0.022790612652897835, -0.003763731801882386, -0.0484025664627552, 0.06326547265052795, -0.018102943897247314, -0.01589985005557537, 0.0398377850651741, -0.08836094290018082, 0.05967479571700096, 0.0111157838255167, 0.058056414127349854, -0.03143947944045067, 0.003932479303330183, 0.06731989234685898, -0.016149258241057396, 0.047970108687877655, 0.00191586185246706, 0.0022321378346532583, 0.012746459804475307, 0.011272194795310497, -0.01612485945224762, -0.0296037457883358, -0.049349550157785416, -0.033210400491952896, -0.014965428039431572, -0.011170393787324429, 0.012937288731336594, -0.02051069773733616, 0.07639210671186447, 0.007099378388375044, 0.008970892988145351, 0.08620186895132065, -0.011056946590542793, 0.03568250685930252, 0.04156559333205223, -0.0018557145958766341, 0.013766089454293251, -0.051451291888952255, -0.07658635079860687, 0.06905453652143478, -0.09542116522789001, -0.106698177754879, 0.0276888869702816, -0.0073050931096076965, 0.06101752817630768, -0.02128022350370884, -0.006326940376311541, 0.037259433418512344, -0.019344571977853775, -0.012535876594483852, -0.024172749370336533, -0.05330805480480194, 0.07182919234037399, -0.06571067124605179, 0.00008885556599125266, 0.04274049028754234, -0.020445581525564194, -0.1043512150645256, -0.03774171695113182, 0.04907282814383507, 0.033951375633478165, 0.10188622027635574, -0.07390100508928299, -0.030574293807148933, -0.057873066514730453, 0.009954106993973255, -0.02143014594912529, -0.04990597441792488, 0.013741382397711277, 0.027034729719161987, -0.017961109057068825, 0.10090862959623337, 0.009982408955693245, -0.031219063326716423, 0.014506060630083084, 0.01677234284579754, 0.000998184084892273, -0.014803754165768623, 0.0037173074670135975, 0.013727014884352684, 0.05256650596857071, 0.029381556436419487, 0.053189266473054886, -0.036037903279066086, -0.008959971368312836, -0.05247959867119789, -0.045034002512693405, 0.022409645840525627, -0.04098890349268913, -0.008775277994573116, -0.1595262736082077, 0.025986285880208015, 0.0521760918200016, 0.01001523807644844, -0.002388646360486746, 0.05323578789830208, -0.05748375877737999, 0.049195680767297745, 0.08065780997276306, 0.007218834478408098, -0.045701853930950165, 0.018732339143753052, -0.005210659932345152, -0.0641171932220459, -0.011704892851412296, 0.02275998331606388, -0.03824188560247421, -0.036436401307582855, -0.049415264278650284, 0.06495001912117004, 0.014773158356547356, -0.04862382635474205, -0.017520328983664513, 0.010320584289729595, -0.033054936677217484, -0.02250620350241661, -0.018670978024601936, 0.03251010552048683, 0.014025327749550343, 0.041117917746305466, -0.02926970273256302, -0.029642567038536072, 0.07124092429876328, -0.026010798290371895, -0.07399942725896835, 0.039533838629722595, -0.038387469947338104, 0.10948671400547028, -0.007853076793253422, -0.00879940390586853, -0.027099864557385445, -0.03762191906571388, -0.0017693322151899338, -0.010929211042821407, -0.01997336745262146, -0.041929151862859726, 0.05211469531059265, -0.05807676538825035, -0.05785013735294342, 0.020737702026963234, -0.06995733827352524, -0.04348613694310188, 0.001912845065817237, -0.006038759369403124, 0.02986975759267807, -0.03188342601060867, -0.03584171086549759, 0.07431618869304657, 0.06790474057197571, 0.02093118615448475, 0.089260034263134, -0.008097469806671143, 0.03588149696588516, 0.012786012142896652, -0.06488295644521713, -0.00402562553063035, 0.03028595633804798, -0.08791499584913254, 0.01636645197868347, -0.01107708178460598, 0.021734511479735374, -0.05138983950018883, -0.08216322958469391, -0.040533363819122314, 0.04135561361908913, -0.043183255940675735, 0.00985586829483509, 0.03381386399269104, -0.019954264163970947, 0.0004474133893381804, 0.15459266304969788, 0.03561240807175636, -0.03932061791419983, 0.05029832944273949, -0.0200627651065588, 0.06284791976213455, -0.0011238245060667396, -0.06523779779672623, 0.05445149168372154, -0.044581178575754166, -0.0011524382280185819, -0.04314299672842026, 0.0041373842395842075, 0.03741731867194176, -0.00799306109547615, 0.021883860230445862, -0.045891325920820236, 0.020367400720715523, 0.029781894758343697, -0.09275704622268677, 0.011880760081112385, 0.0560409352183342, 0.013919983990490437, -0.03371620550751686, -0.07640750706195831, 0.037262212485075, 0.06488628685474396, -0.045830585062503815, -0.06507311016321182, 0.0026437246706336737, -0.04028337448835373, 0.059719767421483994, 0.02164194919168949, -0.06328239291906357, 0.023557811975479126, 0.03709947317838669, -0.0073523614555597305, -0.037219710648059845, 0.009136735461652279, -0.005732595454901457, 0.0005202339380048215, 0.04186226800084114, -0.03292156010866165, -0.019771793857216835, -0.011888433247804642, -0.025779757648706436, -0.015323975123465061, -0.0066107637248933315, 0.031496938318014145, 0.020073553547263145, 0.0625244677066803, -0.02919880300760269, 0.01965736411511898, 0.03334793820977211, 0.010625741444528103, 0.022702505812048912, 0.02252816967666149, -0.07427069544792175, -0.014207717031240463, 0.002046172507107258, -0.01874789036810398, -0.0029206443578004837, 0.0212694238871336, -0.006771259941160679, -0.028367893770337105, 0.018294019624590874, -0.012114319019019604, -0.007289635483175516, 0.00047722490853630006, 0.010489079169929028, 0.020184310153126717, 0.04262101277709007, 0.0109285619109869, 0.01722291111946106, -0.01962173357605934, 0.0028368132188916206, -0.012525682337582111, -0.014927670359611511, -0.0050973230972886086, 0.013711207546293736, -0.019311675801873207, 0.034140970557928085, 0.0049231634475290775, 0.0076453895308077335, -0.05576150119304657, -0.007991328835487366, 0.03228817507624626, 0.06644783169031143, -0.09023857861757278, -0.012455152347683907, 0.028100861236453056, 0.019403595477342606, -0.04259127750992775, -0.011718115769326687, 0.015573450364172459, -0.026574280112981796, -0.011503205634653568, 0.019627045840024948, 0.04857231676578522, -0.02037678472697735, 0.01013833750039339, 0.00864957831799984, -0.00836408045142889, -0.0008666821522638202, -0.014603430405259132, 0.03454997017979622, 0.05642087757587433, 0.019072631374001503, 0.03719182312488556, -0.0022274418734014034, -0.004737259354442358, 0.00495118135586381, -0.04785822704434395, -0.016201328486204147, 0.030352436006069183, 0.03225013241171837, 0.004927125293761492, -0.020624497905373573, -0.05555161088705063, -0.040380608290433884, 0.02615649625658989, -0.03473380208015442, -0.05010156333446503, 0.022830065339803696, 0.013945279642939568, -0.019382914528250694, 0.0285353884100914, 0.05184968560934067, 0.00044447483378462493, -0.01236591674387455, 0.05611257627606392, 0.003264248836785555, 0.050673071295022964, 0.02448004111647606, 0.06523121148347855, -0.004801822826266289, 0.04921087995171547, -0.04087391868233681, 0.03534991666674614, -0.014064677990972996, 0.027777638286352158, 0.012338151223957539, 0.010249626822769642, -0.030831672251224518, -0.026328647509217262, 0.01956806890666485, -0.0006140460609458387, 0.019025176763534546, -0.017769910395145416, 0.004489155951887369, 0.008318423293530941, 0.008267511613667011, -0.04100653529167175, 0.024970725178718567, 0.014358851127326488, 0.007659837603569031, -0.0027001015841960907, 0.04875662550330162, -0.013057652860879898, -0.02102566324174404, 0.02545713447034359, 0.00442757410928607, -0.006226117257028818, 0.06343738734722137, -0.02146102674305439, -0.01741524413228035, 0.08238425850868225, 0.010938978753983974, 0.010015218518674374, 0.021464064717292786, -0.025498483330011368, 0.001563802594318986, -0.029388222843408585, 0.006750037893652916, -0.03342652693390846, 0.006063268985599279, 0.023502551019191742, 0.026932690292596817, 0.007948043756186962, -0.056312285363674164, 0.011603896506130695, 0.010308259166777134, 0.009759602136909962, 0.019971033558249474, 0.041904743760824203, 0.04441643878817558, 0.03597639501094818, 0.007299329619854689, 0.02132008597254753, -0.03410739824175835, 0.0031166530679911375, 0.0009415750973857939, 0.01145369652658701, 0.050397928804159164, -0.025764286518096924, -0.014457841403782368, -0.0048974500969052315, -0.029243996366858482, -0.004571008495986462, -0.024832140654325485, -0.00776406517252326, 0.014219695702195168, 0.07392259687185287, 0.010719980113208294, -0.013796558603644371, -0.049685295671224594, -0.004431845620274544, 0.0034614712931215763, 0.012684798799455166, 0.017513398081064224, 0.04596857726573944, -0.013959975913167, 0.012565406039357185, 0.004484531003981829, -0.014368569478392601, -0.02888142503798008, -0.04006006568670273, -0.024393606930971146, -0.057241588830947876, 0.0190768800675869, 0.04043722525238991, -0.0687452107667923, -0.007799208629876375, 0.03411945700645447, -0.05556828901171684, 0.04120774567127228, 0.018530113622546196, -0.07375456392765045, -0.004315848927944899, 0.048786528408527374, 0.022693239152431488, -0.03874756768345833, 0.03773827478289604, 0.020184708759188652, -0.029016830027103424, 0.020644063130021095, -0.03072873316705227, -0.02610100619494915, 0.04637330770492554, 0.010075335390865803, -0.039142537862062454, 0.02355588600039482, 0.013606534339487553, -0.06382958590984344, -0.0021034718956798315, 0.03306625038385391, 0.02034568227827549, 0.02908851020038128, -0.03756245970726013, -0.027326397597789764, -0.021758873015642166, 0.007819115184247494, -0.01813245192170143, 0.01488962396979332, -0.015332574024796486, -0.0036202899646013975, 0.048960570245981216, 0.02708856575191021, 0.008866308256983757, 0.008688989095389843, 0.009491447359323502, 0.004693568218499422, -0.00012629988486878574, 0.00038042382220737636, -0.05041779950261116, 0.02054610289633274, 0.0422937348484993, 0.012287481687963009, -0.022671258077025414, 0.0011413679458200932, -0.002809607656672597, -0.007522941567003727, 0.012510796077549458, 0.0020582368597388268, 0.031761616468429565, 0.07079639285802841, 0.025882409885525703, -0.023552054539322853, 0.01413852907717228, -0.023215098306536674, 0.03379976004362106, 0.031217267736792564, 0.024266108870506287, 0.001857310184277594, 0.034911565482616425, 0.007641938515007496, 0.007391962222754955, -0.01764833740890026, 0.022343041375279427, 0.02907423861324787, -0.022680601105093956, -0.010831834748387337, -0.019056269899010658, -0.03461989760398865, -0.008083852007985115, -0.03382626175880432, -0.01855074055492878, -0.02843586355447769, 0.016844449564814568, -0.009507902897894382, -0.017403870820999146, -0.012641385197639465, 0.00992503296583891, -0.034813039004802704, -0.051005251705646515, 0.04233293980360031, 0.04926234483718872, 0.04638342931866646, -0.011813274584710598, -0.008911127224564552, -0.010726872831583023, 0.014254054985940456, 0.022008134052157402, 0.002754819579422474, -0.029032208025455475, 0.01340528018772602, 0.014550132676959038, 0.0003531634574756026, 0.04061400890350342, -0.012242738157510757, 0.02485271356999874, 0.03399648889899254, -0.004779797978699207, -0.008085284382104874, -0.0051213703118264675, 0.03533877059817314, -0.01095842756330967, -0.004801101982593536, -0.004509957041591406, -0.03684235364198685, -0.002374354749917984, 0.04501474276185036, -0.06158900260925293, 0.05093900114297867, 0.04215952381491661, -0.044830095022916794, 0.04633381962776184, -0.026518911123275757, 0.05465284734964371, -0.004455655347555876, 0.012628507800400257, -0.0164249986410141, 0.02523251622915268, -0.032875966280698776, 0.017772221937775612, -0.04245724529027939, 0.031883563846349716, 0.011777300387620926, 0.008932366967201233, -0.06366129964590073, 0.005113210063427687, 0.016379663720726967, -0.044004928320646286, 0.036882635205984116, 0.02451477386057377, -0.0300122257322073, 0.021353930234909058, -0.004046927206218243, 0.03129639849066734, 0.007995502091944218, -0.026429785415530205, 0.030440686270594597, -0.014570826664566994, 0.05678626894950867, 0.05994287505745888, 0.06053554266691208, 0.013843158259987831, 0.01879420131444931, 0.018308501690626144, -0.006635712459683418, 0.045420579612255096, 0.0022688366007059813, 0.0014414775650948286, 0.0003148133400827646, 0.05820190906524658, 0.02634960412979126, -0.00610711332410574, -0.003467071568593383, 0.013675394468009472, 0.006127204280346632, 0.0160296019166708, -0.006305595859885216, -0.004840635694563389, 0.07436460256576538, -0.03926923871040344, -0.015727030113339424, 0.0658227875828743, -0.022189049050211906, 0.019414735957980156, 0.037366773933172226, -0.0013013762654736638, 0.0237598717212677, 0.009327208623290062, 0.05684233829379082, 0.00011722909403033555, 0.01429024338722229, 0.002457826631143689, -0.011415923945605755, -0.013412189669907093, 0.020006829872727394, 0.033742982894182205, 0.030482295900583267, 0.010981176048517227, -0.028601687401533127, 0.010432285256683826, -0.0006886639166623354, -0.0033468371257185936, 0.0008702445193193853, 0.019464796409010887, 0.01377127319574356, 0.014938532374799252, 0.028826270252466202, -0.015486261807382107, 0.032392557710409164, 0.037439703941345215, 0.021753370761871338, -0.025011828169226646, 0.02776685170829296, -0.01768616773188114, 0.038712598383426666, -0.021088162437081337, 0.023680809885263443, 0.011754738166928291, 0.006017081439495087, 0.02431083843111992, 0.03077504225075245, -0.04027177020907402, -0.037607356905937195, -0.024780966341495514, 0.039649397134780884, -0.01896064169704914, 0.05528799444437027, -0.005307965446263552, -0.03811882436275482, 0.059095598757267, -0.028101347386837006, 0.00064096535788849, 0.003932807594537735, -0.018186254426836967, -0.001957904314622283, -0.0046287719160318375, -0.033540353178977966, -0.026651810854673386, -0.020366637036204338, 0.03139299154281616, -0.007570277899503708, 0.00744938850402832, -0.010298354551196098, 0.03614649921655655, 0.019472625106573105, -0.007008977234363556, -0.003706861985847354, -0.03706633672118187, -0.02679326944053173, -0.030740924179553986, -0.010584232397377491, -0.028155144304037094, -0.002170402556657791, -0.03550909459590912, 0.0076424493454396725, 0.004611090756952763, -0.01913180947303772, -0.030332230031490326, 0.012177239172160625, 0.04528540372848511, -0.04448532685637474, -0.0057926964946091175, 0.0037669441662728786, 0.06659772247076035, -0.029599282890558243, 0.0092052286490798, 0.005252650938928127, -0.01102533657103777, 0.05751741677522659, -0.04826247692108154, 0.012894867919385433, 0.007719099521636963, 0.00255855661816895, 0.024736754596233368, -0.021871259436011314, -0.024390164762735367, 0.036768194288015366, 0.0043524038046598434, 0.03763828054070473, -0.042831432074308395, 0.02532278373837471, -0.01869545876979828, 0.03697291389107704, -0.06548268347978592, 0.03719097375869751, 0.05327003076672554, -0.00922632310539484, 0.022816909477114677, 0.0031358948908746243, -0.0128440847620368, -0.05222272500395775, 0.006820027716457844, 0.019245782867074013, 0.043327197432518005, 0.005786020774394274, 0.004392281640321016, -0.02611951157450676, -0.014366816729307175, -0.01787170208990574, 0.005123713053762913, -0.021878961473703384, 0.03673412278294563, 0.006239869631826878, -0.022088758647441864, -0.04767565801739693, -0.010161743499338627, -0.01889481581747532, -0.006813725922256708, 0.054034098982810974, -0.04954538494348526, 0.018139606341719627, 0.016057748347520828, -0.022754408419132233, -0.03929508849978447, -0.030763357877731323, 0.015168754383921623, 0.00694087240844965, 0.01215984858572483, -0.013279501348733902, 0.04873071238398552, -0.00006302491965470836, -0.029386458918452263, 0.020664159208536148, 0.003968927543610334, 0.0010686268797144294, -0.000005298788892105222, 0.034138839691877365, -0.014090929180383682, -0.060314830392599106, 0.0012720206286758184, 0.020763307809829712, -0.010132984258234501, 0.035619061440229416, -0.0034102429635822773, -0.0048326109535992146, -0.02027834951877594, 0.009209796786308289, -0.01187145709991455, 0.0798339694738388, 0.036470234394073486, 0.026166677474975586, 0.017475230619311333, 0.033191800117492676 ]
Leveraging Pre-trained Language Model Checkpoints for Encoder-Decoder Models
patrickvonplaten
November 09, 2020
warm-starting-encoder-decoder
guide, nlp
https://huggingface.co/blog/warm-starting-encoder-decoder
Warm-starting the Encoder-Decoder Model This section explains how an Encoder-Decoder model can be warm-started using the bert-base-cased checkpoint. Let\'s start by importing the EncoderDecoderModel. For more detailed information about the EncoderDecoderModel class, the reader is advised to take a look at the documentation. python from transformers import EncoderDecoderModel In contrast to other model classes in 🤗Transformers, the EncoderDecoderModel class has two methods to load pre-trained weights, namely: 1. the \"standard\" .from_pretrained(...) method is derived from the general PretrainedModel.from_pretrained(...) method and thus corresponds exactly to the the one of other model classes. The function expects a single model identifier, e.g. .from_pretrained("google/bert2bert_L-24_wmt_de_en") and will load a single .pt checkpoint file into the EncoderDecoderModel class. 2. a special .from_encoder_decoder_pretrained(...) method, which can be used to warm-start an encoder-decoder model from two model identifiers - one for the encoder and one for the decoder. The first model identifier is thereby used to load the encoder, via AutoModel.from_pretrained(...) (see doc here) and the second model identifier is used to load the decoder via AutoModelForCausalLM (see doc here. Alright, let\'s warm-start our BERT2BERT model. As mentioned earlier we will warm-start both the encoder and decoder with the "bert-base-cased" checkpoint. python bert2bert = EncoderDecoderModel.from_encoder_decoder_pretrained("bert-base-uncased", "bert-base-uncased") python OUTPUT: ------- """Some weights of the model checkpoint at bert-base-uncased were not used when initializing BertLMHeadModel: ['cls.seq_relationship.weight', 'cls.seq_relationship.bias'] - This IS expected if you are initializing BertLMHeadModel from the checkpoint of a model trained on another task or with another architecture (e.g. initializing a BertForSequenceClassification model from a BertForPretraining model). - This IS NOT expected if you are initializing BertLMHeadModel from the checkpoint of a model that you expect to be exactly identical (initializing a BertForSequenceClassification model from a BertForSequenceClassification model). Some weights of BertLMHeadModel were not initialized from the model checkpoint at bert-base-uncased and are newly initialized: ['bert.encoder.layer.0.crossattention.self.query.weight', 'bert.encoder.layer.0.crossattention.self.query.bias', 'bert.encoder.layer.0.crossattention.self.key.weight', 'bert.encoder.layer.0.crossattention.self.key.bias', 'bert.encoder.layer.0.crossattention.self.value.weight', 'bert.encoder.layer.0.crossattention.self.value.bias', 'bert.encoder.layer.0.crossattention.output.dense.weight', 'bert.encoder.layer.0.crossattention.output.dense.bias', 'bert.encoder.layer.0.crossattention.output.LayerNorm.weight', 'bert.encoder.layer.0.crossattention.output.LayerNorm.bias', 'bert.encoder.layer.1.crossattention.self.query.weight', 'bert.encoder.layer.1.crossattention.self.query.bias', 'bert.encoder.layer.1.crossattention.self.key.weight', 'bert.encoder.layer.1.crossattention.self.key.bias', 'bert.encoder.layer.1.crossattention.self.value.weight', 'bert.encoder.layer.1.crossattention.self.value.bias', 'bert.encoder.layer.1.crossattention.output.dense.weight', 'bert.encoder.layer.1.crossattention.output.dense.bias', 'bert.encoder.layer.1.crossattention.output.LayerNorm.weight', 'bert.encoder.layer.1.crossattention.output.LayerNorm.bias', 'bert.encoder.layer.2.crossattention.self.query.weight', 'bert.encoder.layer.2.crossattention.self.query.bias', 'bert.encoder.layer.2.crossattention.self.key.weight', 'bert.encoder.layer.2.crossattention.self.key.bias', 'bert.encoder.layer.2.crossattention.self.value.weight', 'bert.encoder.layer.2.crossattention.self.value.bias', 'bert.encoder.layer.2.crossattention.output.dense.weight', 'bert.encoder.layer.2.crossattention.output.dense.bias', 'bert.encoder.layer.2.crossattention.output.LayerNorm.weight', 'bert.encoder.layer.2.crossattention.output.LayerNorm.bias', 'bert.encoder.layer.3.crossattention.self.query.weight', 'bert.encoder.layer.3.crossattention.self.query.bias', 'bert.encoder.layer.3.crossattention.self.key.weight', 'bert.encoder.layer.3.crossattention.self.key.bias', 'bert.encoder.layer.3.crossattention.self.value.weight', 'bert.encoder.layer.3.crossattention.self.value.bias', 'bert.encoder.layer.3.crossattention.output.dense.weight', 'bert.encoder.layer.3.crossattention.output.dense.bias', 'bert.encoder.layer.3.crossattention.output.LayerNorm.weight', 'bert.encoder.layer.3.crossattention.output.LayerNorm.bias', 'bert.encoder.layer.4.crossattention.self.query.weight', 'bert.encoder.layer.4.crossattention.self.query.bias', 'bert.encoder.layer.4.crossattention.self.key.weight', 'bert.encoder.layer.4.crossattention.self.key.bias', 'bert.encoder.layer.4.crossattention.self.value.weight', 'bert.encoder.layer.4.crossattention.self.value.bias', 'bert.encoder.layer.4.crossattention.output.dense.weight', 'bert.encoder.layer.4.crossattention.output.dense.bias', 'bert.encoder.layer.4.crossattention.output.LayerNorm.weight', 'bert.encoder.layer.4.crossattention.output.LayerNorm.bias', 'bert.encoder.layer.5.crossattention.self.query.weight', 'bert.encoder.layer.5.crossattention.self.query.bias', 'bert.encoder.layer.5.crossattention.self.key.weight', 'bert.encoder.layer.5.crossattention.self.key.bias', 'bert.encoder.layer.5.crossattention.self.value.weight', 'bert.encoder.layer.5.crossattention.self.value.bias', 'bert.encoder.layer.5.crossattention.output.dense.weight', 'bert.encoder.layer.5.crossattention.output.dense.bias', 'bert.encoder.layer.5.crossattention.output.LayerNorm.weight', 'bert.encoder.layer.5.crossattention.output.LayerNorm.bias', 'bert.encoder.layer.6.crossattention.self.query.weight', 'bert.encoder.layer.6.crossattention.self.query.bias', 'bert.encoder.layer.6.crossattention.self.key.weight', 'bert.encoder.layer.6.crossattention.self.key.bias', 'bert.encoder.layer.6.crossattention.self.value.weight', 'bert.encoder.layer.6.crossattention.self.value.bias', 'bert.encoder.layer.6.crossattention.output.dense.weight', 'bert.encoder.layer.6.crossattention.output.dense.bias', 'bert.encoder.layer.6.crossattention.output.LayerNorm.weight', 'bert.encoder.layer.6.crossattention.output.LayerNorm.bias', 'bert.encoder.layer.7.crossattention.self.query.weight', 'bert.encoder.layer.7.crossattention.self.query.bias', 'bert.encoder.layer.7.crossattention.self.key.weight', 'bert.encoder.layer.7.crossattention.self.key.bias', 'bert.encoder.layer.7.crossattention.self.value.weight', 'bert.encoder.layer.7.crossattention.self.value.bias', 'bert.encoder.layer.7.crossattention.output.dense.weight', 'bert.encoder.layer.7.crossattention.output.dense.bias', 'bert.encoder.layer.7.crossattention.output.LayerNorm.weight', 'bert.encoder.layer.7.crossattention.output.LayerNorm.bias', 'bert.encoder.layer.8.crossattention.self.query.weight', 'bert.encoder.layer.8.crossattention.self.query.bias', 'bert.encoder.layer.8.crossattention.self.key.weight', 'bert.encoder.layer.8.crossattention.self.key.bias', 'bert.encoder.layer.8.crossattention.self.value.weight', 'bert.encoder.layer.8.crossattention.self.value.bias', 'bert.encoder.layer.8.crossattention.output.dense.weight', 'bert.encoder.layer.8.crossattention.output.dense.bias', 'bert.encoder.layer.8.crossattention.output.LayerNorm.weight', 'bert.encoder.layer.8.crossattention.output.LayerNorm.bias', 'bert.encoder.layer.9.crossattention.self.query.weight', 'bert.encoder.layer.9.crossattention.self.query.bias', 'bert.encoder.layer.9.crossattention.self.key.weight', 'bert.encoder.layer.9.crossattention.self.key.bias', 'bert.encoder.layer.9.crossattention.self.value.weight', 'bert.encoder.layer.9.crossattention.self.value.bias', 'bert.encoder.layer.9.crossattention.output.dense.weight', 'bert.encoder.layer.9.crossattention.output.dense.bias', 'bert.encoder.layer.9.crossattention.output.LayerNorm.weight', 'bert.encoder.layer.9.crossattention.output.LayerNorm.bias', 'bert.encoder.layer.10.crossattention.self.query.weight', 'bert.encoder.layer.10.crossattention.self.query.bias', 'bert.encoder.layer.10.crossattention.self.key.weight', 'bert.encoder.layer.10.crossattention.self.key.bias', 'bert.encoder.layer.10.crossattention.self.value.weight', 'bert.encoder.layer.10.crossattention.self.value.bias', 'bert.encoder.layer.10.crossattention.output.dense.weight', 'bert.encoder.layer.10.crossattention.output.dense.bias', 'bert.encoder.layer.10.crossattention.output.LayerNorm.weight', 'bert.encoder.layer.10.crossattention.output.LayerNorm.bias', 'bert.encoder.layer.11.crossattention.self.query.weight', 'bert.encoder.layer.11.crossattention.self.query.bias', 'bert.encoder.layer.11.crossattention.self.key.weight', 'bert.encoder.layer.11.crossattention.self.key.bias', 'bert.encoder.layer.11.crossattention.self.value.weight', 'bert.encoder.layer.11.crossattention.self.value.bias', 'bert.encoder.layer.11.crossattention.output.dense.weight', 'bert.encoder.layer.11.crossattention.output.dense.bias', 'bert.encoder.layer.11.crossattention.output.LayerNorm.weight', 'bert.encoder.layer.11.crossattention.output.LayerNorm.bias']""" You should probably TRAIN this model on a down-stream task to be able to use it for predictions and inference.""" For once, we should take a good look at the warning here. We can see that two weights corresponding to a "cls" layer were not used. This should not be a problem because we don\'t need BERT\'s CLS layer for sequence-to-sequence tasks. Also, we notice that a lot of weights are \"newly\" or randomly initialized. When taking a closer look these weights all correspond to the cross-attention layer, which is exactly what we would expect after having read the theory above. Let\'s take a closer look at the model. python bert2bert python OUTPUT: ------- EncoderDecoderModel( (encoder): BertModel( (embeddings): BertEmbeddings( (word_embeddings): Embedding(30522, 768, padding_idx=0) (position_embeddings): Embedding(512, 768) (token_type_embeddings): Embedding(2, 768) (LayerNorm): LayerNorm((768,), eps=1e-12, elementwise_affine=True) (dropout): Dropout(p=0.1, inplace=False) ) (encoder): BertEncoder( (layer): ModuleList( (0): BertLayer( (attention): BertAttention( (self): BertSelfAttention( (query): Linear(in_features=768, out_features=768, bias=True) (key): Linear(in_features=768, out_features=768, bias=True) (value): Linear(in_features=768, out_features=768, bias=True) (dropout): Dropout(p=0.1, inplace=False) ) (output): BertSelfOutput( (dense): Linear(in_features=768, out_features=768, bias=True) (LayerNorm): LayerNorm((768,), eps=1e-12, elementwise_affine=True) (dropout): Dropout(p=0.1, inplace=False) ) ) (intermediate): BertIntermediate( (dense): Linear(in_features=768, out_features=3072, bias=True) ) (output): BertOutput( (dense): Linear(in_features=3072, out_features=768, bias=True) (LayerNorm): LayerNorm((768,), eps=1e-12, elementwise_affine=True) (dropout): Dropout(p=0.1, inplace=False) ) ), ... , (11): BertLayer( (attention): BertAttention( (self): BertSelfAttention( (query): Linear(in_features=768, out_features=768, bias=True) (key): Linear(in_features=768, out_features=768, bias=True) (value): Linear(in_features=768, out_features=768, bias=True) (dropout): Dropout(p=0.1, inplace=False) ) (output): BertSelfOutput( (dense): Linear(in_features=768, out_features=768, bias=True) (LayerNorm): LayerNorm((768,), eps=1e-12, elementwise_affine=True) (dropout): Dropout(p=0.1, inplace=False) ) ) (intermediate): BertIntermediate( (dense): Linear(in_features=768, out_features=3072, bias=True) ) (output): BertOutput( (dense): Linear(in_features=3072, out_features=768, bias=True) (LayerNorm): LayerNorm((768,), eps=1e-12, elementwise_affine=True) (dropout): Dropout(p=0.1, inplace=False) ) ) ) ) (pooler): BertPooler( (dense): Linear(in_features=768, out_features=768, bias=True) (activation): Tanh() ) ) (decoder): BertLMHeadModel( (bert): BertModel( (embeddings): BertEmbeddings( (word_embeddings): Embedding(30522, 768, padding_idx=0) (position_embeddings): Embedding(512, 768) (token_type_embeddings): Embedding(2, 768) (LayerNorm): LayerNorm((768,), eps=1e-12, elementwise_affine=True) (dropout): Dropout(p=0.1, inplace=False) ) (encoder): BertEncoder( (layer): ModuleList( (0): BertLayer( (attention): BertAttention( (self): BertSelfAttention( (query): Linear(in_features=768, out_features=768, bias=True) (key): Linear(in_features=768, out_features=768, bias=True) (value): Linear(in_features=768, out_features=768, bias=True) (dropout): Dropout(p=0.1, inplace=False) ) (output): BertSelfOutput( (dense): Linear(in_features=768, out_features=768, bias=True) (LayerNorm): LayerNorm((768,), eps=1e-12, elementwise_affine=True) (dropout): Dropout(p=0.1, inplace=False) ) ) (crossattention): BertAttention( (self): BertSelfAttention( (query): Linear(in_features=768, out_features=768, bias=True) (key): Linear(in_features=768, out_features=768, bias=True) (value): Linear(in_features=768, out_features=768, bias=True) (dropout): Dropout(p=0.1, inplace=False) ) (output): BertSelfOutput( (dense): Linear(in_features=768, out_features=768, bias=True) (LayerNorm): LayerNorm((768,), eps=1e-12, elementwise_affine=True) (dropout): Dropout(p=0.1, inplace=False) ) ) (intermediate): BertIntermediate( (dense): Linear(in_features=768, out_features=3072, bias=True) ) (output): BertOutput( (dense): Linear(in_features=3072, out_features=768, bias=True) (LayerNorm): LayerNorm((768,), eps=1e-12, elementwise_affine=True) (dropout): Dropout(p=0.1, inplace=False) ) ), ..., (11): BertLayer( (attention): BertAttention( (self): BertSelfAttention( (query): Linear(in_features=768, out_features=768, bias=True) (key): Linear(in_features=768, out_features=768, bias=True) (value): Linear(in_features=768, out_features=768, bias=True) (dropout): Dropout(p=0.1, inplace=False) ) (output): BertSelfOutput( (dense): Linear(in_features=768, out_features=768, bias=True) (LayerNorm): LayerNorm((768,), eps=1e-12, elementwise_affine=True) (dropout): Dropout(p=0.1, inplace=False) ) ) (crossattention): BertAttention( (self): BertSelfAttention( (query): Linear(in_features=768, out_features=768, bias=True) (key): Linear(in_features=768, out_features=768, bias=True) (value): Linear(in_features=768, out_features=768, bias=True) (dropout): Dropout(p=0.1, inplace=False) ) (output): BertSelfOutput( (dense): Linear(in_features=768, out_features=768, bias=True) (LayerNorm): LayerNorm((768,), eps=1e-12, elementwise_affine=True) (dropout): Dropout(p=0.1, inplace=False) ) ) (intermediate): BertIntermediate( (dense): Linear(in_features=768, out_features=3072, bias=True) ) (output): BertOutput( (dense): Linear(in_features=3072, out_features=768, bias=True) (LayerNorm): LayerNorm((768,), eps=1e-12, elementwise_affine=True) (dropout): Dropout(p=0.1, inplace=False) ) ) ) ) ) (cls): BertOnlyMLMHead( (predictions): BertLMPredictionHead( (transform): BertPredictionHeadTransform( (dense): Linear(in_features=768, out_features=768, bias=True) (LayerNorm): LayerNorm((768,), eps=1e-12, elementwise_affine=True) ) (decoder): Linear(in_features=768, out_features=30522, bias=True) ) ) ) ) We see that bert2bert.encoder is an instance of BertModel and that bert2bert.decoder one of BertLMHeadModel. However, both instances are now combined into a single torch.nn.Module and can thus be saved as a single .pt checkpoint file. Let\'s try it out using the standard .save_pretrained(...) method. python bert2bert.save_pretrained("bert2bert") Similarly, the model can be reloaded using the standard .from_pretrained(...) method. python bert2bert = EncoderDecoderModel.from_pretrained("bert2bert") Awesome. Let\'s also checkpoint the config. python bert2bert.config python OUTPUT: ------- EncoderDecoderConfig { "_name_or_path": "bert2bert", "architectures": [ "EncoderDecoderModel" ], "decoder": { "_name_or_path": "bert-base-uncased", "add_cross_attention": true, "architectures": [ "BertForMaskedLM" ], "attention_probs_dropout_prob": 0.1, "bad_words_ids": null, "bos_token_id": null, "chunk_size_feed_forward": 0, "decoder_start_token_id": null, "do_sample": false, "early_stopping": false, "eos_token_id": null, "finetuning_task": null, "gradient_checkpointing": false, "hidden_act": "gelu", "hidden_dropout_prob": 0.1, "hidden_size": 768, "id2label": { "0": "LABEL_0", "1": "LABEL_1" }, "initializer_range": 0.02, "intermediate_size": 3072, "is_decoder": true, "is_encoder_decoder": false, "label2id": { "LABEL_0": 0, "LABEL_1": 1 }, "layer_norm_eps": 1e-12, "length_penalty": 1.0, "max_length": 20, "max_position_embeddings": 512, "min_length": 0, "model_type": "bert", "no_repeat_ngram_size": 0, "num_attention_heads": 12, "num_beams": 1, "num_hidden_layers": 12, "num_return_sequences": 1, "output_attentions": false, "output_hidden_states": false, "pad_token_id": 0, "prefix": null, "pruned_heads": {}, "repetition_penalty": 1.0, "return_dict": false, "sep_token_id": null, "task_specific_params": null, "temperature": 1.0, "tie_encoder_decoder": false, "tie_word_embeddings": true, "tokenizer_class": null, "top_k": 50, "top_p": 1.0, "torchscript": false, "type_vocab_size": 2, "use_bfloat16": false, "use_cache": true, "vocab_size": 30522, "xla_device": null }, "encoder": { "_name_or_path": "bert-base-uncased", "add_cross_attention": false, "architectures": [ "BertForMaskedLM" ], "attention_probs_dropout_prob": 0.1, "bad_words_ids": null, "bos_token_id": null, "chunk_size_feed_forward": 0, "decoder_start_token_id": null, "do_sample": false, "early_stopping": false, "eos_token_id": null, "finetuning_task": null, "gradient_checkpointing": false, "hidden_act": "gelu", "hidden_dropout_prob": 0.1, "hidden_size": 768, "id2label": { "0": "LABEL_0", "1": "LABEL_1" }, "initializer_range": 0.02, "intermediate_size": 3072, "is_decoder": false, "is_encoder_decoder": false, "label2id": { "LABEL_0": 0, "LABEL_1": 1 }, "layer_norm_eps": 1e-12, "length_penalty": 1.0, "max_length": 20, "max_position_embeddings": 512, "min_length": 0, "model_type": "bert", "no_repeat_ngram_size": 0, "num_attention_heads": 12, "num_beams": 1, "num_hidden_layers": 12, "num_return_sequences": 1, "output_attentions": false, "output_hidden_states": false, "pad_token_id": 0, "prefix": null, "pruned_heads": {}, "repetition_penalty": 1.0, "return_dict": false, "sep_token_id": null, "task_specific_params": null, "temperature": 1.0, "tie_encoder_decoder": false, "tie_word_embeddings": true, "tokenizer_class": null, "top_k": 50, "top_p": 1.0, "torchscript": false, "type_vocab_size": 2, "use_bfloat16": false, "use_cache": true, "vocab_size": 30522, "xla_device": null }, "is_encoder_decoder": true, "model_type": "encoder_decoder" } The config is similarly composed of an encoder config and a decoder config both of which are instances of BertConfig in our case. However, the overall config is of type EncoderDecoderConfig and is therefore saved as a single .json file. In conclusion, one should remember that once an EncoderDecoderModel object is instantiated, it provides the same functionality as any other Encoder-Decoder model in 🤗Transformers, e.g. BART, T5, ProphetNet, ... The only difference is that an EncoderDecoderModel provides the additional from_encoder_decoder_pretrained(...) function allowing the model class to be warm-started from any two encoder and decoder checkpoints. On a side-note, if one would want to create a shared encoder-decoder model, the parameter tie_encoder_decoder=True can additionally be passed as follows: python shared_bert2bert = EncoderDecoderModel.from_encoder_decoder_pretrained("bert-base-cased", "bert-base-cased", tie_encoder_decoder=True) As a comparison, we can see that the tied model has much fewer parameters as expected. python print(f"\n\nNum Params. Shared: {shared_bert2bert.num_parameters()}, Non-Shared: {bert2bert.num_parameters()}") python OUTPUT: ------- Num Params. Shared: 137298244, Non-Shared: 247363386 In this notebook, we will however train a non-shared Bert2Bert model, so we continue with bert2bert and not shared_bert2bert. python # free memory del shared_bert2bert We have warm-started a bert2bert model, but we have not defined all the relevant parameters used for beam search decoding yet. Let\'s start by setting the special tokens. bert-base-cased does not have a decoder_start_token_id or eos_token_id, so we will use its cls_token_id and sep_token_id respectively. Also, we should define a pad_token_id on the config and make sure the correct vocab_size is set. python bert2bert.config.decoder_start_token_id = tokenizer.cls_token_id bert2bert.config.eos_token_id = tokenizer.sep_token_id bert2bert.config.pad_token_id = tokenizer.pad_token_id bert2bert.config.vocab_size = bert2bert.config.encoder.vocab_size Next, let\'s define all parameters related to beam search decoding. Since bart-large-cnn yields good results on CNN/Dailymail, we will just copy its beam search decoding parameters. For more details on what each of these parameters does, please take a look at this blog post or the docs. python bert2bert.config.max_length = 142 bert2bert.config.min_length = 56 bert2bert.config.no_repeat_ngram_size = 3 bert2bert.config.early_stopping = True bert2bert.config.length_penalty = 2.0 bert2bert.config.num_beams = 4 Alright, let\'s now start fine-tuning the warm-started BERT2BERT model.
[ -0.041425671428442, 0.003272591158747673, 0.013727160170674324, 0.011834478937089443, 0.02029724046587944, 0.07276074588298798, 0.0047094556502997875, 0.02291085198521614, -0.013854168355464935, -0.06830295920372009, -0.08052417635917664, 0.08075731992721558, -0.035173460841178894, 0.051467765122652054, 0.0055897957645356655, -0.05102936923503876, 0.04830325394868851, -0.05805310234427452, -0.017588069662451744, -0.0028332655783742666, 0.023814383894205093, -0.08012647926807404, 0.012477735988795757, 0.021049128845334053, 0.05466565489768982, -0.06826157867908478, 0.02098800614476204, 0.04144694656133652, -0.04603516310453415, 0.04624691978096962, -0.053917840123176575, 0.0023939895909279585, 0.0538075752556324, -0.0587703138589859, 0.031871870160102844, 0.06106581166386604, -0.08088687807321548, 0.03479474410414696, 0.05425434932112694, -0.0567726232111454, -0.022293295711278915, 0.01838851161301136, -0.030709533020853996, -0.006591955665498972, -0.013595592230558395, -0.05507177114486694, -0.14050084352493286, 0.05334585905075073, 0.010913258418440819, -0.051971785724163055, -0.06690158694982529, 0.02954206056892872, 0.0028825108893215656, 0.0512244813144207, 0.003304603509604931, 0.013483580201864243, -0.022207358852028847, -0.05244093015789986, 0.07231004536151886, -0.020780490711331367, 0.03363415226340294, 0.01734081469476223, -0.01931362971663475, 0.01977776549756527, 0.03569057583808899, 0.06954777985811234, -0.058216895908117294, 0.0016327329212799668, 0.003406346309930086, -0.021254854276776314, -0.05114226043224335, -0.06341996788978577, -0.00910074170678854, 0.005172216333448887, 0.014512506313621998, -0.04029529541730881, 0.016499781981110573, 0.0028351496439427137, 0.022160425782203674, 0.025650369003415108, -0.029655955731868744, 0.03987682983279228, -0.05544278398156166, 0.007425536401569843, 0.0735785961151123, -0.017130296677350998, 0.017359048128128052, -0.053989145904779434, -0.017301741987466812, 0.05755125731229782, -0.03200593963265419, -0.1146823838353157, 0.013235270977020264, -0.02918917126953602, 0.04913194477558136, -0.033417943865060806, 0.005073796026408672, 0.046958886086940765, 0.030102193355560303, -0.01001394260674715, -0.010050695389509201, -0.08736719191074371, 0.03959844261407852, -0.01918131858110428, -0.03838448226451874, -0.018533436581492424, -0.01776811294257641, -0.08742240071296692, -0.04064295440912247, -0.017105557024478912, 0.01864609867334366, -0.060408394783735275, -0.05274515971541405, 0.03569568693637848, -0.07644906640052795, -0.00053271499928087, 0.02289222739636898, -0.05060359090566635, 0.003989701624959707, 0.05003740265965462, -0.04320003092288971, 0.07151812314987183, 0.04416975378990173, -0.07691171020269394, 0.012766965664923191, 0.07878758758306503, -0.01201748475432396, 0.02723483368754387, 0.0681205540895462, 0.042372483760118484, 0.09774690121412277, 0.02974327653646469, 0.07686524838209152, -0.0016055969754233956, 0.021958734840154648, -0.005319717340171337, -0.016589192673563957, -0.05988925322890282, -0.008753234520554543, 0.0009079491719603539, -0.10361181944608688, 0.07477110624313354, 0.007711632177233696, -0.03535281866788864, 0.04959270358085632, 0.037228502333164215, -0.10847793519496918, 0.08767130970954895, 0.03327164798974991, 0.09068475663661957, -0.05127716064453125, 0.04744000732898712, -0.027495624497532845, -0.04972595348954201, 0.022221239283680916, 0.07689353078603745, -0.055742889642715454, -0.03253592550754547, -0.047116946429014206, -0.027583815157413483, 0.04031451791524887, 0.021106014028191566, -0.042771801352500916, 0.02313344180583954, 0.02776603028178215, -0.08992543816566467, -0.0274029653519392, -0.021440602838993073, 0.023955078795552254, 0.050181612372398376, -0.0010815091663971543, -0.009149567224085331, 0.10791803896427155, 0.02953226864337921, 0.00987162347882986, 0.06991101056337357, 0.0237534511834383, 0.06635099649429321, -0.013521199114620686, -0.0268105361610651, -0.047821663320064545, 0.03482137992978096, -0.031509723514318466, 0.0443173423409462, 0.05015770345926285, -0.018970852717757225, -0.005113248713314533, -0.08199144154787064, -0.06997466832399368, 0.07496269792318344, -0.02478702925145626, 0.035651933401823044, 0.0581657811999321, -0.024777911603450775, 0.002414303831756115, -0.05703519284725189, -0.04255305603146553, 0.07050784677267075, -0.004367096349596977, 0.021346716210246086, 0.11144060641527176, 0.002962220925837755, 0.07260993868112564, -0.00508771650493145, -0.02231471613049507, 0.032282836735248566, 0.03504785895347595, -0.09068478643894196, 0.09968110173940659, 0.01914672739803791, 0.05367054045200348, -0.06369544565677643, -0.01467528659850359, -0.08746576309204102, 0.05743461847305298, -0.05411071702837944, -0.015953538939356804, -0.06791003048419952, 0.022772179916501045, 0.007344030309468508, 0.13887736201286316, -0.057535964995622635, 0.016474278643727303, -0.031106051057577133, -0.04852248728275299, 0.03522389382123947, 0.03948907181620598, -0.013063661754131317, 0.10893792659044266, -0.07552771270275116, -0.048827238380908966, -0.035714153200387955, -0.020196005702018738, 0.03550071269273758, -0.030315322801470757, -0.01107438188046217, 0.002029548166319728, -0.009894490242004395, 0.010276802815496922, -0.0724538043141365, 0.02463502623140812, -0.00551499892026186, 0.011691199615597725, 0.009146470576524734, -0.04796579107642174, 0.03617214038968086, 0.023699123412370682, -0.03038768097758293, -0.03758317232131958, -0.0124998539686203, -0.03295078128576279, -0.0055931853130459785, -0.0215590912848711, -0.07768013328313828, 0.013982796110212803, 0.04472632706165314, -0.0329522006213665, 0.002271386096253991, -0.011990094557404518, 0.020618144422769547, 0.017558813095092773, -0.034300390630960464, -0.042524438351392746, -0.03172135353088379, -0.03698784485459328, -0.024871766567230225, -0.02384807914495468, 0.020241722464561462, 0.03004358895123005, 0.026265127584338188, 0.020511029288172722, -0.047632765024900436, 0.015355924144387245, 0.026859167963266373, 0.035683773458004, 0.03350134193897247, 0.01454960834234953, -0.017930515110492706, -0.03656620532274246, -0.0368029847741127, 0.009929953143000603, -0.03425629436969757, 0.014266966842114925, 0.00953366607427597, -0.01615857146680355, 0.016233207657933235, -0.006588063668459654, -0.02886819653213024, 0.004108664579689503, 0.05828854814171791, 0.021924614906311035, 0.02796241082251072, -0.00687036756426096, 0.018025098368525505, 0.010967874899506569, 0.04382633417844772, 0.008358526974916458, -0.02846420928835869, 0.014846104197204113, 0.006900586653500795, -0.007278133183717728, 0.01556455623358488, 0.021441802382469177, -0.021546896547079086, -0.05174099653959274, 0.0262017622590065, 0.01784921996295452, 0.04195336624979973, -0.09353945404291153, 0.003704771865159273, 0.016866469755768776, -0.013086779974400997, 0.01100731547921896, -0.041351404041051865, 0.052266474813222885, -0.01319647952914238, -0.027637463063001633, 0.009413708932697773, -0.004168285988271236, -0.014161890372633934, 0.007322595454752445, 0.02643825300037861, -0.0305339302867651, -0.027056749910116196, -0.041309136897325516, 0.02548794634640217, 0.0004994863411411643, -0.014420218765735626, -0.0003988748649135232, -0.003269426990300417, -0.0024388395249843597, 0.013973944820463657, -0.0019984496757388115, 0.02433517388999462, 0.01466414425522089, 0.01585635170340538, 0.006049187853932381, -0.0131029998883605, -0.012773462571203709, -0.0271055418998003, -0.0022897846065461636, 0.01954888366162777, -0.017673522233963013, -0.0058453381061553955, 0.025223582983016968, 0.0366596058011055, 0.044856343418359756, 0.007730616722255945, -0.02163207158446312, 0.033970363438129425, 0.009269659407436848, 0.016482584178447723, 0.015042277984321117, -0.015471133403480053, -0.005757309962064028, -0.028586765751242638, 0.002732521155849099, 0.0064897434785962105, -0.025057347491383553, 0.000751946063246578, 0.007030193228274584, 0.004945199470967054, -0.014642869122326374, 0.005670209415256977, 0.011734841391444206, 0.0446634404361248, 0.015715107321739197, -0.014608199708163738, -0.040326278656721115, 0.008343792520463467, -0.012975236400961876, -0.03958854824304581, -0.03132438659667969, 0.02159283310174942, 0.017475126311182976, 0.03274381533265114, 0.006080303806811571, 0.019852587953209877, -0.027118796482682228, -0.013034692965447903, 0.028649473562836647, 0.015145629644393921, -0.002668155124410987, 0.023656990379095078, -0.01424627099186182, -0.04226171597838402, 0.06369207054376602, -0.017373299226164818, 0.01116087194532156, 0.009177838452160358, -0.053533509373664856, -0.046418849378824234, -0.020804939791560173, 0.02738281525671482, 0.006834612227976322, -0.00584312854334712, 0.04987073317170143, -0.006211977917701006, -0.00787317007780075, -0.012720618396997452, 0.006869909819215536, 0.017706405371427536, -0.009882813319563866, -0.006932857912033796, 0.0023698515724390745, 0.02474612183868885, 0.009081779979169369, 0.022795943543314934, 0.004384113475680351, -0.021909072995185852, -0.046906258910894394, 0.015020258724689484, -0.006328278686851263, 0.006979449652135372, -0.026241784915328026, -0.04344001039862633, 0.03520655259490013, -0.04839678481221199, 0.003745157038792968, 0.009445302188396454, 0.004045078065246344, 0.009772524237632751, 0.023935340344905853, 0.05299018323421478, 0.0039853304624557495, -0.05067427083849907, 0.0004251047212164849, 0.02043473906815052, -0.034706998616456985, 0.02274613454937935, 0.02484784461557865, -0.005877677816897631, 0.0011114113731309772, -0.017753735184669495, 0.0559881329536438, 0.0199187733232975, 0.010954570025205612, -0.025406602770090103, -0.07612992823123932, -0.008780090138316154, 0.04004061594605446, -0.031415365636348724, 0.005341461859643459, 0.0032511891331523657, -0.001784517546184361, 0.02114836499094963, 0.037459440529346466, -0.044214677065610886, 0.0036746107507497072, 0.013074224814772606, 0.049286045134067535, -0.03570130094885826, 0.05154424160718918, 0.002527093980461359, -0.014172069728374481, -0.01562276016920805, -0.022096019238233566, 0.013827158138155937, 0.036577265709638596, 0.028267309069633484, -0.040106359869241714, 0.0028889370150864124, 0.0401572659611702, -0.01909080147743225, -0.0036602518521249294, 0.03586604446172714, 0.05468455329537392, 0.038185760378837585, -0.004046862479299307, -0.011879338882863522, -0.03152848035097122, 0.009545291773974895, 0.0020258217118680477, 0.004612703341990709, -0.022601189091801643, -0.053064264357089996, -0.008507185615599155, 0.030382327735424042, -0.02798522263765335, -0.03028927929699421, 0.014794920571148396, -0.041510242968797684, 0.005216361954808235, 0.01613546535372734, 0.009112697094678879, -0.008732487447559834, 0.006981294602155685, 0.0028185879345983267, -0.009694909676909447, -0.003023881232365966, -0.004875710234045982, 0.00018752433243207633, -0.036200717091560364, 0.009612410329282284, 0.029383694753050804, 0.03467395156621933, 0.029219873249530792, 0.010704850777983665, 0.001832201611250639, 0.0012321227695792913, 0.0578920878469944, 0.006059448700398207, -0.039324164390563965, -0.023961003869771957, -0.0019960396457463503, 0.012476501055061817, -0.026954585686326027, -0.010011192411184311, 0.013407137244939804, 0.054901476949453354, -0.0025005515199154615, -0.03775646165013313, 0.021426795050501823, -0.06665713340044022, -0.030104821547865868, -0.05116695538163185, 0.030413556843996048, -0.049284085631370544, 0.004565323702991009, -0.003336044028401375, 0.005869187880307436, 0.02517770044505596, 0.03317514806985855, 0.0029177935793995857, -0.010916067287325859, 0.03956720978021622, 0.0871671810746193, 0.025404248386621475, -0.01028914749622345, -0.007913580164313316, -0.053302451968193054, -0.0109929284080863, -0.013761462643742561, -0.05787559598684311, 0.033003732562065125, 0.01393570564687252, -0.004791165702044964, 0.03512084484100342, 0.05545862391591072, -0.003018429735675454, 0.018764624372124672, 0.036838628351688385, -0.04959273338317871, -0.027806144207715988, -0.013486916199326515, 0.01607917807996273, -0.009056833572685719, -0.030420560389757156, -0.0008540333365090191, -0.02413916401565075, 0.005312020890414715, 0.028460806235671043, -0.04672275483608246, 0.03768438473343849, 0.04214891046285629, -0.022067872807383537, 0.05086342617869377, 0.02173563465476036, 0.04347836598753929, 0.025758974254131317, 0.016815438866615295, -0.005407149903476238, 0.041242532432079315, -0.001991112483665347, 0.011793907731771469, 0.00668653380125761, 0.020677858963608742, 0.03781546652317047, 0.029179131612181664, -0.06481906026601791, 0.044105108827352524, 0.031608257442712784, -0.03530304133892059, 0.016107741743326187, 0.002357306657359004, -0.03617701679468155, 0.009687861427664757, 0.01034807600080967, 0.02138599194586277, 0.02142464928328991, -0.007403537165373564, 0.004363481421023607, 0.049540817737579346, -0.004261658061295748, 0.03844194859266281, 0.05818682163953781, -0.036108601838350296, 0.028401756659150124, 0.04847007989883423, 0.0005550782661885023, 0.008040938526391983, 0.008883979171514511, -0.010633680038154125, -0.026282789185643196, 0.07690348476171494, 0.04393140599131584, 0.020642636343836784, 0.03523837402462959, -0.009568152017891407, 0.012676655314862728, -0.03088640607893467, 0.0017188034253194928, 0.019111325964331627, 0.003413462545722723, -0.023492401465773582, -0.017024513334035873, 0.04235127195715904, -0.008128621615469456, 0.03831187263131142, 0.06254568696022034, 0.01125011034309864, -0.044573407620191574, 0.07763852179050446, 0.035964276641607285, 0.022929076105356216, 0.030181845650076866, 0.017225399613380432, 0.021154409274458885, -0.0325247086584568, 0.04613427445292473, 0.009450474753975868, 0.02966785803437233, 0.04541795328259468, 0.00021726437262259424, 0.025780266150832176, -0.015541084110736847, -0.04374362900853157, 0.03119119256734848, 0.00746542913839221, -0.03825629875063896, -0.023930536583065987, 0.04973957687616348, -0.050594355911016464, 0.015698883682489395, -0.00025483459467068315, -0.019858088344335556, 0.007920541800558567, 0.010781044140458107, 0.014420224353671074, 0.02320389449596405, 0.004299449268728495, -0.050128571689128876, -0.005296754650771618, 0.01731528528034687, 0.007074886932969093, 0.01690128818154335, -0.02546045184135437, -0.018097862601280212, -0.04223909601569176, -0.03306807950139046, -0.03320690989494324, 0.05499151721596718, -0.02473161369562149, -0.005608135834336281, 0.03338347747921944, 0.0007504143286496401, 0.020601438358426094, 0.016188623383641243, -0.0021033494267612696, -0.0126683060079813, -0.0075021651573479176, -0.029554829001426697, -0.03306623548269272, -0.051307085901498795, 0.039648305624723434, -0.07320224493741989, -0.0029071555472910404, -0.01744830794632435, 0.046512193977832794, 0.0486421100795269, 0.029616251587867737, -0.005559913814067841, -0.03944659233093262, -0.022559238597750664, -0.016282835975289345, -0.03246797248721123, 0.023735133931040764, 0.015424576587975025, -0.02380073443055153, 0.016554122790694237, -0.022427700459957123, -0.017791898921132088, -0.0166469719260931, 0.0007303646416403353, 0.03095211461186409, -0.04641302675008774, -0.019527629017829895, -0.007825333625078201, 0.0555662102997303, -0.022202232852578163, 0.026326315477490425, 0.05313592404127121, -0.00846359133720398, 0.02648480050265789, -0.036165498197078705, -0.0032360299956053495, -0.01484187226742506, 0.010104474611580372, -0.013266532681882381, -0.027279986068606377, -0.036342769861221313, 0.02925853244960308, -0.00747343897819519, 0.018190832808613777, -0.008524660021066666, -0.01269256230443716, -0.04946143925189972, -0.0013625110732391477, -0.004111879039555788, 0.055881667882204056, 0.013003543950617313, 0.010490831919014454, 0.03104652650654316, 0.02746438980102539, -0.021661799401044846, -0.020561404526233673, -0.021683793514966965, -0.004245078191161156, 0.012891803868114948, 0.006684050429612398, -0.05648411810398102, 0.021517260000109673, -0.020995954051613808, 0.021372249349951744, -0.02291199006140232, -0.0222027450799942, 0.005205395165830851, -0.04520125314593315, -0.04746663197875023, -0.00965888611972332, 0.007513038348406553, 0.021266045048832893, 0.017530933022499084, -0.002361579332500696, -0.059245962649583817, 0.003045836463570595, 0.011880530044436455, -0.0524098239839077, -0.030884921550750732, -0.03824698179960251, 0.0035242056474089622, 0.05225745588541031, 0.02418816089630127, 0.025332177057862282, -0.000786264892667532, -0.013865453191101551, 0.023446206003427505, 0.016904067248106003, -0.024268275126814842, -0.019745633006095886, -0.006515173241496086, 0.054033875465393066, -0.02397802658379078, -0.023845138028264046, 0.02155301347374916, 0.04070937633514404, -0.019074684008955956, 0.027458904311060905, 0.0024262939114123583, -0.014094985090196133, -0.006459794472903013, 0.011996183544397354, -0.0068056765012443066, 0.06374926120042801, 0.027437511831521988, 0.006121623795479536, -0.007847010158002377, 0.03886444494128227 ]
How we sped up transformer inference 100x for 🤗 API customers
Narsil
January 18, 2021
accelerated-inference
analysis, nlp
https://huggingface.co/blog/accelerated-inference
# How we sped up transformer inference 100x for 🤗 API customers 🤗 Transformers has become the default library for data scientists all around the world to explore state of the art NLP models and build new NLP features. With over 5,000 pre-trained and fine-tuned models available, in over 250 languages, it is a rich playground, easily accessible whichever framework you are working in. While experimenting with models in 🤗 Transformers is easy, deploying these large models into production with maximum performance, and managing them into an architecture that scales with usage is a hard engineering challenge for any Machine Learning Engineer. This 100x performance gain and built-in scalability is why subscribers of our hosted Accelerated Inference API chose to build their NLP features on top of it. To get to the last 10x of performance boost, the optimizations need to be low-level, specific to the model, and to the target hardware. This post shares some of our approaches squeezing every drop of compute juice for our customers. 🍋
[ 0.011168673634529114, 0.03220678120851517, 0.06083355471491814, 0.021392233669757843, -0.023469289764761925, 0.024581193923950195, 0.07238124310970306, 0.09053348004817963, 0.025998719036579132, 0.04091605544090271, -0.04113706573843956, 0.07827272266149521, 0.014924677088856697, 0.05067727342247963, 0.06519489735364914, -0.07067612558603287, 0.012940683402121067, -0.06033322587609291, -0.0053492095321416855, 0.007304797414690256, 0.059133753180503845, -0.115908183157444, 0.08337301015853882, -0.008264394477009773, -0.017605941742658615, -0.014345136471092701, 0.004206804558634758, -0.03058304637670517, -0.018089784309267998, 0.008953780867159367, -0.09148286283016205, -0.012441610917448997, -0.03141230717301369, -0.035086728632450104, -0.02683350443840027, 0.007493081968277693, -0.12767024338245392, 0.005158160347491503, 0.018753550946712494, -0.01979176513850689, 0.012346174567937851, -0.024638887494802475, -0.0706712007522583, 0.029141157865524292, 0.030111683532595634, -0.021825823932886124, -0.14923787117004395, 0.046882156282663345, -0.052337951958179474, -0.0470329150557518, -0.06033855304121971, 0.06091180071234703, -0.05098099634051323, -0.006961573380976915, 0.021349281072616577, 0.0674629956483841, 0.008671881631016731, -0.0783611387014389, -0.02410368248820305, 0.03931042179465294, 0.02203826978802681, -0.01795930415391922, 0.039310965687036514, 0.001254442147910595, 0.0504261776804924, -0.006147934123873711, -0.030123978853225708, 0.03870398923754692, -0.028376761823892593, -0.02954648993909359, 0.02795274183154106, -0.046689752489328384, -0.011116977781057358, -0.011390739120543003, -0.008728518150746822, -0.017116762697696686, 0.036547187715768814, 0.03311196342110634, 0.09076759219169617, 0.02026982232928276, -0.04839862883090973, 0.0020416739862412214, 0.03677792474627495, 0.03550265356898308, 0.044013071805238724, 0.053996164351701736, 0.06809273362159729, -0.056992944329977036, -0.02840210683643818, 0.04777771979570389, 0.057183925062417984, -0.14569221436977386, -0.018833855167031288, -0.014116652309894562, 0.01166268065571785, 0.030090508982539177, 0.06351877003908157, 0.029821082949638367, -0.021839279681444168, -0.03135409951210022, 0.008092621341347694, -0.022650348022580147, -0.0032964395359158516, -0.04218507185578346, -0.013815099373459816, 0.02926618419587612, -0.0027831040788441896, -0.10620609670877457, -0.021209409460425377, 0.05205247923731804, -0.015596922487020493, -0.01932779885828495, -0.04776092618703842, 0.07226163148880005, -0.05540196970105171, 0.02509920671582222, 0.02746433950960636, 0.030699392780661583, -0.010321298614144325, -0.01989021524786949, 0.007567128166556358, 0.05161929503083229, 0.02882138080894947, 0.04675910621881485, -0.02217935584485531, 0.07652400434017181, 0.0035445827525109053, 0.03483991324901581, 0.02296028472483158, -0.028977269306778908, 0.05395285412669182, -0.08536668121814728, 0.00895788986235857, -0.0028558969497680664, 0.0030964964535087347, -0.05328363552689552, 0.0007416011649183929, -0.0483502633869648, 0.0002694182039704174, -0.001426734495908022, -0.05818317085504532, -0.019483448937535286, 0.013564085587859154, -0.06581194698810577, 0.07082078605890274, 0.03227107599377632, -0.0754147544503212, 0.04504126310348511, 0.024183077737689018, 0.02229510247707367, -0.09236056357622147, 0.0998227596282959, -0.06288410723209381, -0.05306572839617729, 0.06748920679092407, 0.05354531854391098, 0.005577342119067907, -0.05403142422437668, -0.07951958477497101, -0.057499710470438004, -0.02284792624413967, -0.06521149724721909, 0.016327952966094017, -0.013968594372272491, -0.003385289339348674, -0.026863083243370056, -0.0016433955170214176, 0.011712804436683655, 0.034531522542238235, 0.06941752880811691, -0.01854395680129528, -0.03293983265757561, 0.01764662005007267, -0.0005742923822253942, -0.02414553053677082, 0.02024179883301258, 0.019097695127129555, 0.04853673651814461, 0.04025841876864433, -0.0034778774715960026, -0.057787783443927765, 0.08965357393026352, -0.0027622468769550323, 0.08067287504673004, 0.0773470476269722, -0.06652292609214783, 0.07525347918272018, -0.017363291233778, -0.017328284680843353, -0.010324900969862938, -0.02988489158451557, -0.004533011466264725, 0.09639423340559006, 0.019837645813822746, 0.039617981761693954, -0.05713224038481712, -0.03980635851621628, 0.0967191681265831, 0.05425025895237923, 0.036849495023489, 0.03196435421705246, 0.0026802641805261374, 0.05892917886376381, -0.027683449909090996, 0.024965284392237663, -0.03801976516842842, -0.016804523766040802, -0.04847368225455284, 0.03493661433458328, -0.0025566513650119305, 0.020378146320581436, -0.1319754719734192, -0.04028322920203209, -0.06129591166973114, -0.01972149685025215, -0.07278823852539062, -0.0037253177724778652, 0.03249949961900711, 0.0214870385825634, -0.05940293148159981, 0.17237377166748047, -0.03701931983232498, -0.016800951212644577, -0.029439367353916168, -0.017038486897945404, -0.001250517787411809, 0.08114413172006607, -0.03267011046409607, 0.039666060358285904, -0.015858981758356094, -0.020072368904948235, -0.06729777157306671, -0.06682159751653671, -0.030192211270332336, 0.010285187512636185, -0.02956470102071762, -0.0069586182944476604, -0.0018343966221436858, -0.012773968279361725, -0.028090959414839745, 0.030564725399017334, 0.04168635979294777, -0.00100216013379395, 0.05445713922381401, 0.0497664250433445, 0.039374880492687225, 0.0640520229935646, -0.0008528285543434322, 0.023007048293948174, 0.007042801473289728, -0.051200103014707565, 0.016596719622612, 0.010089286603033543, -0.05561678111553192, 0.051932159811258316, 0.06071460619568825, -0.03033910132944584, -0.005298718344420195, -0.02841552346944809, 0.052738212049007416, 0.017969505861401558, 0.0035992106422781944, -0.01959255523979664, -0.02774391882121563, 0.013605447486042976, -0.038346972316503525, -0.027576055377721786, 0.03589127957820892, -0.008564305491745472, -0.053532298654317856, 0.011384799145162106, -0.04622310772538185, 0.04389486089348793, 0.010729347355663776, 0.026043197140097618, 0.02106727845966816, 0.05030442774295807, -0.029476482421159744, -0.004248538054525852, -0.046592120081186295, 0.006264742463827133, -0.039672091603279114, 0.000508188852109015, 0.04375503584742546, -0.010652400553226471, -0.019504135474562645, 0.0024468202609568834, -0.02169838175177574, -0.019552957266569138, -0.007932589389383793, 0.014229162596166134, 0.001654311316087842, 0.0015942726749926805, -0.05871148034930229, -0.03191729635000229, -0.01875130832195282, -0.009924790821969509, -0.04913555085659027, -0.00927360262721777, -0.008057579398155212, -0.00978841818869114, -0.024375762790441513, -0.004466047510504723, 0.023315154016017914, -0.0017443230608478189, 0.0312562994658947, 0.0004390576796140522, 0.026712605729699135, -0.09185992181301117, -0.02912784367799759, -0.04589781537652016, -0.004847443662583828, -0.0030996135901659727, -0.02795204147696495, 0.034054674208164215, 0.003358893794938922, -0.0037750585470348597, 0.008582723326981068, -0.010939807631075382, 0.020011117681860924, 0.031375277787446976, -0.0002721233759075403, -0.012534716166555882, -0.013609006069600582, -0.014247509650886059, 0.025495227426290512, 0.03566008806228638, 0.03966632857918739, -0.0016021569026634097, 0.010914262384176254, -0.015058167278766632, 0.006411668378859758, 0.021804220974445343, 0.016099968925118446, 0.03106459602713585, 0.009759239852428436, 0.025539515540003777, 0.008488573133945465, -0.0417853444814682, -0.019062025472521782, -0.027551397681236267, 0.04872773960232735, 0.007264110259711742, -0.008438060991466045, -0.004525013267993927, 0.016390951350331306, 0.020068703219294548, 0.03178391233086586, 0.019170640036463737, -0.02926364541053772, 0.015126466751098633, -0.020592449232935905, 0.047809358686208725, -0.009266524575650692, 0.03959166258573532, 0.008688886649906635, 0.003918919246643782, -0.05327186360955238, -0.04369132220745087, -0.017370708286762238, 0.0028274161741137505, 0.009279109537601471, 0.026587707921862602, -0.012536200694739819, -0.012922924943268299, -0.017762083560228348, 0.017909139394760132, 0.012411031872034073, -0.020819202065467834, 0.030554335564374924, 0.007218101527541876, 0.0009236203623004258, -0.053462423384189606, 0.0360819473862648, 0.03074667602777481, 0.01363340113312006, 0.0036974442191421986, 0.020106593146920204, 0.0004058368504047394, 0.03763442859053612, 0.013765621930360794, -0.001795283518731594, -0.037820298224687576, 0.03582536801695824, -0.010720646940171719, -0.035889849066734314, 0.058944784104824066, 0.02857428416609764, -0.0463869534432888, -0.04182761535048485, -0.058672722429037094, -0.022706203162670135, 0.021823760122060776, 0.010541840456426144, -0.013764296658337116, -0.057472579181194305, 0.011620612815022469, 0.01605680212378502, 0.016971729695796967, 0.0034995500463992357, 0.0011909166350960732, -0.0027649435214698315, 0.010966905392706394, 0.008936460129916668, 0.03284529596567154, 0.03465393930673599, 0.017529109492897987, -0.03818533197045326, 0.04214717075228691, -0.05202905833721161, -0.02162102237343788, 0.00028746892348863184, -0.05577103793621063, -0.016290541738271713, -0.006819499656558037, -0.014433390460908413, 0.03307453542947769, 0.008804935030639172, 0.028050536289811134, 0.00397119764238596, 0.002373888622969389, -0.00033415984944440424, 0.035976629704236984, 0.047515466809272766, 0.012755469419062138, 0.029157277196645737, -0.02289780229330063, 0.02953426167368889, -0.005400016438215971, 0.033771224319934845, -0.002338704653084278, 0.0014940878609195352, 0.03569384291768074, -0.006322917062789202, 0.005561043042689562, 0.029725445434451103, -0.04392391815781593, -0.007342343218624592, -0.0022608055733144283, 0.01121519971638918, 0.04993870109319687, 0.02585531957447529, 0.018951909616589546, 0.00797414593398571, -0.03690555319190025, -0.02646869421005249, -0.014010093174874783, 0.022779887542128563, 0.019096942618489265, 0.033990830183029175, -0.0035661961883306503, 0.0016380191082134843, 0.004332070238888264, -0.02012638747692108, -0.011415783315896988, -0.018783971667289734, -0.05979687348008156, 0.012699187733232975, 0.02096942439675331, 0.009640514850616455, -0.016183994710445404, -0.003396655898541212, 0.05371958762407303, 0.007591297384351492, -0.014001510106027126, 0.01433493196964264, 0.05364873632788658, 0.02375229261815548, -0.014736400917172432, 0.017803283408284187, -0.04359494522213936, 0.002482891781255603, 0.032613907009363174, -0.00524889538064599, -0.03318742662668228, -0.023329278454184532, -0.020924990996718407, 0.009434969164431095, -0.0254676416516304, 0.006445528008043766, 0.0025839535519480705, -0.008136151358485222, -0.007720841094851494, 0.03340119868516922, 0.036331430077552795, -0.010870943777263165, 0.01763073354959488, -0.020726000890135765, -0.03153502196073532, -0.04654914513230324, -0.015994125977158546, 0.03259680047631264, -0.0059076822362840176, 0.006796232424676418, 0.04860623553395271, 0.07744050025939941, 0.02115454711019993, 0.01056932844221592, -0.005478298757225275, -0.03735562786459923, 0.026518771424889565, -0.03291057050228119, -0.0077194818295538425, -0.06937845051288605, 0.041033245623111725, 0.04131070524454117, -0.02304035797715187, -0.029985705390572548, 0.020857801660895348, 0.02797537110745907, -0.0032213700469583273, -0.0471155159175396, 0.06294425576925278, -0.02110804058611393, 0.01907956413924694, -0.030057109892368317, 0.009896687231957912, -0.02019035443663597, 0.02827339619398117, -0.0018264100654050708, 0.006867686286568642, -0.010755005292594433, -0.018817823380231857, -0.03328302502632141, -0.008684157393872738, 0.040480613708496094, 0.014245428144931793, 0.039923667907714844, -0.039499957114458084, -0.02594585344195366, -0.026276838034391403, -0.006392685696482658, 0.026633433997631073, -0.05277256295084953, 0.0014029607409611344, -0.01329885609447956, -0.004830331541597843, 0.0011491846526041627, -0.004065168555825949, 0.013450882397592068, -0.0023994180373847485, 0.047350119799375534, 0.013623740524053574, -0.0014853747561573982, -0.04775024205446243, 0.04741736128926277, 0.058889057487249374, -0.031922418624162674, -0.043024856597185135, -0.03261735662817955, -0.02434050850570202, 0.003464671317487955, -0.0376119390130043, 0.0340149961411953, 0.036039289087057114, -0.013086413033306599, -0.007255047559738159, -0.0035462062805891037, -0.0125469034537673, 0.0031366816256195307, 0.012354917824268341, 0.004765769001096487, 0.0036878702230751514, 0.006631077732890844, 0.01005635131150484, -0.03678164631128311, 0.0008715977892279625, 0.012011353857815266, 0.029679862782359123, -0.03365274518728256, 0.042714476585388184, 0.02454295940697193, -0.01737876608967781, 0.021079203113913536, 0.029019426554441452, -0.05053948238492012, 0.013734591193497181, 0.03810318186879158, -0.040389515459537506, 0.025176068767905235, 0.02240130305290222, 0.006064462009817362, -0.010914675891399384, -0.0072454302571713924, 0.02031596377491951, 0.08333179354667664, 0.029760286211967468, 0.018002117052674294, 0.03244834020733833, 0.03973027318716049, 0.05662045255303383, -0.009622263722121716, 0.017988210543990135, 0.019276197999715805, 0.026782935485243797, -0.04059648513793945, 0.03561800345778465, 0.023318713530898094, -0.007579632569104433, -0.010596305131912231, 0.004452619235962629, 0.015139506198465824, -0.0354522280395031, -0.0025998996570706367, 0.03214912861585617, 0.0009804819710552692, 0.015269765630364418, -0.039274055510759354, 0.04696306586265564, 0.029073813930153847, 0.038531187921762466, 0.015457198955118656, 0.017936479300260544, 0.047138918191194534, 0.011716155335307121, 0.03700236603617668, 0.014417576603591442, 0.015216746367514133, -0.040963366627693176, 0.039966244250535965, 0.005255298689007759, 0.04490949213504791, -0.01299023162573576, -0.0013233940117061138, -0.005234468262642622, -0.049767233431339264, -0.02270379662513733, 0.014196543022990227, -0.015645550563931465, 0.02226250059902668, -0.034053459763526917, 0.013374336063861847, -0.060892704874277115, -0.006575882900506258, -0.0026438371278345585, -0.006964948959648609, -0.020899100229144096, -0.014455386437475681, -0.01052218209952116, 0.02501683495938778, 0.021563200280070305, -0.050133880227804184, -0.009975501336157322, -0.02168949320912361, 0.029858702793717384, 0.004615675657987595, -0.008501364849507809, 0.0018051792867481709, -0.021890731528401375, 0.003985937684774399, -0.004176298622041941, 0.043655503541231155, -0.0342324897646904, -0.021553754806518555, 0.03640242666006088, 0.006108214613050222, 0.03484682738780975, 0.025901200249791145, 0.017771041020751, 0.0060577490366995335, -0.05067269504070282, -0.0030576239805668592, -0.002515999134629965, -0.02165101282298565, 0.0068430220708251, -0.010792386718094349, -0.010146388784050941, -0.01634606532752514, -0.005166629794985056, 0.03681925684213638, 0.06422347575426102, -0.07710763812065125, -0.024664390832185745, 0.04101044312119484, 0.0028187884017825127, 0.022799430415034294, 0.03438440337777138, 0.0027587173972278833, -0.00790063850581646, -0.02062835730612278, 0.00038763132761232555, -0.004197949543595314, 0.024044327437877655, 0.01712721399962902, 0.053826309740543365, -0.053844232112169266, -0.03602924942970276, -0.02883707359433174, 0.036312490701675415, 0.014740132726728916, 0.04526105150580406, 0.0336437001824379, 0.02751144766807556, 0.004087699111551046, -0.041724883019924164, -0.040556538850069046, -0.04349164292216301, 0.0052337562665343285, -0.027829134836792946, -0.031231893226504326, -0.04638156294822693, 0.03174798935651779, -0.016582876443862915, 0.019745294004678726, -0.03719136118888855, -0.03158808872103691, -0.07916626334190369, -0.019313383847475052, -0.011895016767084599, -0.011620743200182915, 0.05678335577249527, 0.007452214602380991, 0.03550206497311592, 0.012468318454921246, -0.004233188461512327, -0.01063032727688551, -0.005913462955504656, 0.026232711970806122, 0.040381431579589844, -0.02827468328177929, -0.002463035983964801, -0.03401778265833855, 0.0064896484836936, -0.007301465142518282, -0.05840149149298668, 0.04529816657304764, -0.0024642988573759794, 0.013492219150066376, -0.04013705253601074, 0.026380740106105804, 0.05460231378674507, -0.03573151305317879, 0.041483644396066666, -0.0051223160699009895, 0.021381380036473274, -0.014096667990088463, -0.016157116740942, -0.043086711317300797, -0.013641295954585075, 0.01318767387419939, -0.025760451331734657, 0.005489330738782883, -0.0007463120855391026, 0.02898111566901207, 0.028466498479247093, 0.002738197101280093, 0.008640775457024574, -0.001695171114988625, -0.06282675266265869, -0.03666703775525093, -0.04986279830336571, 0.049356989562511444, -0.008821777999401093, -0.020359020680189133, 0.04505489394068718, -0.010697617195546627, 0.004876887891441584, 0.021757028996944427, 0.018054619431495667, -0.000506128475535661, 0.016642270609736443, 0.027539772912859917, -0.02721693553030491, 0.02943388745188713, 0.08412283658981323, -0.019530270248651505, -0.00958020705729723, -0.04920225590467453 ]
How we sped up transformer inference 100x for 🤗 API customers
Narsil
January 18, 2021
accelerated-inference
analysis, nlp
https://huggingface.co/blog/accelerated-inference
Compilation FTW: the hard to get 10x Now this is where it gets really tricky. In order to get the best possible performance we will need to modify the model and compile it targeting the specific hardware for inference. The choice of hardware itself will depend on both the model (size in memory) and the demand profile (request batching). Even when serving predictions from the same model, some API customers may benefit more from Accelerated CPU inference, and others from Accelerated GPU inference, each with different optimization techniques and libraries applied. Once the compute platform has been selected for the use case, we can go to work. Here are some CPU-specific techniques that can be applied with a static graph: - Optimizing the graph (Removing unused flow) - Fusing layers (with specific CPU instructions) - Quantizing the operations Using out-of-box functions from open source libraries (e.g. 🤗 Transformers with ONNX Runtime) won’t produce the best results, or could result in a significant loss of accuracy, particularly during quantization. There is no silver bullet, and the best path is different for each model architecture. But diving deep into the Transformers code and ONNX Runtime documentation, the stars can be aligned to achieve another 10x speedup.
[ 0.07391588389873505, -0.0235319584608078, 0.02730841375887394, 0.05469229072332382, 0.023372523486614227, 0.011129611171782017, 0.0861273854970932, 0.08926374465227127, -0.00966915674507618, -0.0078240055590868, -0.023943262174725533, -0.021820958703756332, -0.042883358895778656, 0.0011910282773897052, 0.06157870218157768, -0.07309839129447937, 0.054843802005052567, -0.03479413688182831, 0.018064945936203003, 0.041150983422994614, 0.046564050018787384, -0.047163624316453934, 0.08244632184505463, 0.01178184524178505, -0.05297547206282616, -0.038569070398807526, 0.007180429995059967, -0.051604244858026505, -0.03214513137936592, 0.0189453586935997, -0.0813247561454773, 0.03452996537089348, -0.022466758266091347, -0.02830475941300392, 0.007731769699603319, -0.005216259974986315, -0.09783568233251572, 0.046002380549907684, 0.06693005561828613, -0.016200806945562363, 0.04530259966850281, -0.014489659108221531, -0.06693506240844727, 0.04943146929144859, 0.07629407942295074, 0.03386285901069641, -0.055998336523771286, -0.01337727252393961, -0.031148778274655342, -0.0038416599854826927, -0.025040218606591225, 0.02223108522593975, -0.003615885740146041, 0.009240323677659035, 0.05886636674404144, 0.07522985339164734, -0.05309225618839264, -0.022739943116903305, -0.05777226388454437, 0.022783396765589714, 0.07563509047031403, 0.003051384352147579, 0.017809735611081123, 0.020300038158893585, 0.02813687175512314, -0.06557949632406235, -0.04376569390296936, -0.021075207740068436, -0.07499637454748154, -0.02373656816780567, -0.0034411316737532616, -0.018442068248987198, 0.06347222626209259, 0.011256578378379345, -0.019017664715647697, 0.01388159766793251, -0.0017723962664604187, 0.06741131842136383, 0.09221239387989044, 0.03897344321012497, -0.03075224719941616, 0.003300861921161413, 0.037553612142801285, 0.029820196330547333, 0.013239451684057713, 0.022287949919700623, 0.03106013312935829, -0.04997803270816803, -0.11763360351324081, 0.06059439107775688, -0.007866555824875832, -0.09395888447761536, -0.025720931589603424, 0.016281258314847946, -0.04490147531032562, 0.03078804351389408, 0.020974857732653618, 0.036969199776649475, 0.0530252568423748, -0.030023055151104927, 0.042161572724580765, -0.014862673357129097, -0.012108649127185345, -0.05431201308965683, -0.020549235865473747, 0.09235257655382156, -0.03667586296796799, -0.05578505992889404, -0.02939867414534092, 0.03724532574415207, -0.05660317838191986, 0.05785359442234039, 0.0205845944583416, 0.031284723430871964, -0.0877290591597557, 0.008040199987590313, 0.010507273487746716, -0.022753270342946053, -0.007119160145521164, 0.011657909490168095, 0.03586239740252495, 0.14451821148395538, 0.053218163549900055, -0.04670347273349762, -0.011475815437734127, 0.08770493417978287, 0.07300131767988205, 0.0022308628540486097, 0.01822366751730442, -0.04184447601437569, 0.02070651948451996, -0.002583855064585805, 0.03325639292597771, -0.05286787450313568, 0.07431457191705704, -0.06360187381505966, 0.021977543830871582, -0.0015997752780094743, -0.031392816454172134, -0.01621202751994133, -0.08748441189527512, -0.033705778419971466, 0.01953396201133728, -0.018670082092285156, 0.037065550684928894, 0.010022531263530254, -0.009618381038308144, -0.03720942512154579, 0.019759271293878555, 0.0008829499711282551, -0.020085107535123825, 0.07164523005485535, -0.08463410288095474, -0.06927311420440674, -0.01651282049715519, 0.06154114007949829, 0.030237415805459023, -0.04312930256128311, -0.06719888001680374, -0.04428693652153015, -0.07030722498893738, -0.05968722701072693, 0.008774511516094208, -0.016512829810380936, -0.022367851808667183, -0.009748215787112713, 0.05307714268565178, -0.02134142629802227, -0.0029599603731185198, 0.03204626590013504, 0.042337652295827866, -0.019560368731617928, 0.03512587770819664, -0.048093948513269424, -0.02305140718817711, -0.008544359356164932, 0.05596606060862541, 0.05180417746305466, -0.0100637748837471, -0.005883075296878815, -0.019657321274280548, 0.04277652129530907, 0.020111462101340294, -0.012629597447812557, 0.0041118464432656765, -0.10352829843759537, 0.0534653402864933, -0.10476742684841156, -0.06799119710922241, 0.029884185642004013, -0.04867744818329811, -0.010251494124531746, 0.11720830202102661, 0.005362153053283691, -0.024511098861694336, -0.025927238166332245, -0.07973452657461166, 0.12785206735134125, 0.02244401164352894, 0.0021130582317709923, 0.04595501720905304, 0.02177642472088337, 0.028158603236079216, 0.026438333094120026, -0.05542726814746857, 0.001015744637697935, -0.03125262260437012, -0.07752110809087753, -0.0017812529113143682, 0.04149450361728668, 0.008789757266640663, -0.1436331868171692, 0.020166128873825073, -0.060279570519924164, -0.027735931798815727, 0.000384926563128829, -0.03407913073897362, 0.0038079351652413607, -0.007392325904220343, -0.06389743834733963, 0.15525087714195251, -0.018660927191376686, -0.021529579535126686, -0.04058805853128433, -0.05089087039232254, 0.0007942898664623499, 0.019052540883421898, 0.0011706975055858493, -0.010439391247928143, -0.07199948281049728, -0.019418148323893547, -0.05273527652025223, -0.022909371182322502, 0.026680784299969673, -0.0034493796993047, -0.03482622280716896, -0.007634567096829414, 0.07087906450033188, 0.034867219626903534, -0.08250651508569717, 0.003125930903479457, 0.0026853771414607763, -0.011499235406517982, -0.004728858359158039, 0.040142934769392014, -0.01034851185977459, 0.0907682552933693, -0.004953290335834026, 0.022375216707587242, -0.062428511679172516, -0.011450971476733685, 0.02723282016813755, 0.013233480043709278, -0.09269704669713974, 0.012980024330317974, 0.0367824025452137, 0.017215313389897346, 0.00014521123375743628, -0.04685157164931297, 0.012177808210253716, 0.04357403889298439, 0.0041778599843382835, 0.014334352687001228, -0.04113588482141495, 0.014443657360970974, -0.06488567590713501, -0.003233879804611206, -0.014403712935745716, 0.01746406778693199, -0.012688812799751759, -0.008218524046242237, -0.07033853232860565, 0.005733654368668795, -0.037096668034791946, 0.03741023689508438, 0.014116271398961544, 0.019373659044504166, -0.008968557231128216, -0.015224471688270569, -0.04783167690038681, -0.004918248858302832, 0.0015597583260387182, 0.04994514212012291, -0.012255288660526276, -0.025988204404711723, 0.01995534636080265, 0.03956615552306175, -0.029151292517781258, -0.03757067024707794, 0.027597716078162193, -0.01233412604779005, 0.03305891901254654, 0.018691720440983772, -0.04660143703222275, -0.002097922144457698, 0.01911684311926365, 0.01638343371450901, -0.006803327240049839, -0.025572819635272026, -0.010721223428845406, -0.009193025529384613, 0.0161481574177742, 0.004958825185894966, 0.018413584679365158, -0.028660304844379425, 0.014326169155538082, -0.03733711317181587, 0.029638877138495445, -0.09244995564222336, -0.013934343121945858, -0.02599523402750492, 0.016879087314009666, -0.03558247536420822, -0.04379747807979584, 0.023197388276457787, 0.03801043704152107, 0.015735335648059845, 0.02632153406739235, 0.020420465618371964, 0.01686917059123516, -0.030029192566871643, 0.0037069059908390045, 0.030829118564724922, 0.010068091563880444, 0.02661728300154209, 0.025682179257273674, 0.03072221949696541, 0.011436392553150654, -0.016962522640824318, 0.013354901224374771, 0.014528430998325348, -0.007759404368698597, 0.017870474606752396, -0.00028380710864439607, 0.0014739817706868052, 0.02312350645661354, 0.017349308356642723, -0.00473875692114234, -0.05592687427997589, -0.02049224264919758, 0.01610994152724743, 0.024157075211405754, -0.003261205740272999, -0.030841749161481857, -0.01776125468313694, -0.017761047929525375, 0.002117922529578209, 0.03373256325721741, -0.002344486303627491, -0.03283774107694626, 0.013892464339733124, 0.01588922180235386, 0.007942330092191696, 0.0372188426554203, 0.061321523040533066, -0.0014291800325736403, 0.027643276378512383, -0.04541713744401932, -0.07497584074735641, 0.0004713798698503524, 0.03971323370933533, 0.012215809896588326, 0.00512594822794199, -0.0095602348446846, -0.00347506464459002, -0.005128534510731697, 0.055825117975473404, -0.04131684452295303, -0.07823889702558517, 0.017487002536654472, 0.04487486183643341, 0.028647685423493385, -0.007072823587805033, 0.032144688069820404, 0.006511019542813301, -0.00013133072934579104, -0.02095806412398815, 0.015101575292646885, 0.001443218789063394, 0.04709838330745697, -0.005510645918548107, 0.005562721285969019, -0.017269231379032135, 0.04044300690293312, -0.02904699370265007, -0.022274022921919823, 0.040282782167196274, 0.03745514899492264, -0.006065055262297392, -0.03639166057109833, -0.03507126867771149, -0.033192228525877, 0.009873523376882076, 0.009553984738886356, 0.005942134186625481, -0.021450545638799667, -0.022496994584798813, 0.006951433606445789, -0.005829709116369486, -0.00299615366384387, 0.03422502055764198, 0.004358445759862661, 0.00801227055490017, -0.031653184443712234, 0.055486373603343964, 0.05175859481096268, -0.015861041843891144, 0.008129546418786049, 0.008593173697590828, -0.03946216404438019, -0.014246351085603237, 0.004603826906532049, -0.00034049467649310827, 0.007693988736718893, -0.002508365549147129, -0.007169303018599749, 0.001981334062293172, 0.019905367866158485, 0.013858594931662083, -0.026170426979660988, 0.008856479078531265, -0.009502645581960678, 0.006871828809380531, -0.0010418036254122853, -0.018066683784127235, 0.04357830807566643, -0.0028512547723948956, 0.01580391824245453, -0.0012705475091934204, 0.01093557570129633, -0.013019178993999958, -0.02961016818881035, 0.06148324906826019, 0.009912104345858097, -0.013105873018503189, 0.04947607219219208, 0.004693853668868542, 0.010580812580883503, -0.00856664776802063, 0.035764437168836594, 0.05199388042092323, -0.00850607454776764, 0.02838381938636303, 0.004391906782984734, -0.01777403987944126, -0.002222862094640732, -0.013976461254060268, -0.024901174008846283, -0.003025876125320792, 0.0017619594000279903, 0.03600968420505524, -0.01099622342735529, 0.014953426085412502, 0.027269752696156502, -0.009035661816596985, -0.00550962146371603, -0.023120755329728127, 0.043522678315639496, 0.032934971153736115, -0.0019321240251883864, -0.036252185702323914, 0.006528282538056374, 0.0196672473102808, 0.03453580662608147, -0.0298188216984272, -0.006844410207122564, 0.019822783768177032, 0.03167140856385231, -0.01329256035387516, -0.007560983300209045, -0.010187813080847263, -0.00866791419684887, 0.01993001438677311, 0.010771751403808594, 0.02610791102051735, -0.05997582525014877, -0.01841588132083416, -0.01556957233697176, -0.027623411267995834, 0.014845222234725952, -0.012047304771840572, -0.013997378759086132, 0.003806923283264041, 0.021691616624593735, 0.0340440534055233, 0.00023512115876656026, 0.02782520093023777, 0.03107842057943344, -0.0323902890086174, -0.019460948184132576, 0.015828847885131836, 0.03794553130865097, -0.0026505838613957167, 0.03919040411710739, 0.024880843237042427, 0.07462867349386215, 0.021388737484812737, 0.0259125716984272, 0.033962029963731766, -0.014817018061876297, 0.03854569420218468, -0.012828173115849495, 0.047875598073005676, -0.04338083416223526, 0.01413767971098423, -0.019870847463607788, 0.02024080790579319, -0.04119304567575455, 0.03605888783931732, 0.030994443222880363, 0.008512352593243122, -0.021770359948277473, 0.03738610818982124, 0.03243786096572876, -0.01641116850078106, 0.009433675557374954, 0.05082181096076965, -0.03190937638282776, -0.012326586060225964, -0.02184051088988781, -0.031278274953365326, 0.0316852405667305, 0.02514956146478653, -0.04549224302172661, -0.0603894479572773, 0.05669894069433212, 0.0035599626135081053, 0.030440619215369225, -0.030559999868273735, 0.00726481806486845, -0.004893498960882425, -0.008900409564375877, -0.00308345933444798, -0.0223101619631052, 0.0032485928386449814, -0.0046912976540625095, -0.003255763789638877, 0.009385812096297741, -0.006653656251728535, -0.0075478460639715195, -0.04560108482837677, 0.045167405158281326, 0.08290107548236847, -0.03460121899843216, 0.009567049331963062, 0.0037410305812954903, 0.06366867572069168, -0.018823156133294106, -0.04561967775225639, -0.009997712448239326, -0.054233618080616, -0.013021616265177727, -0.03494894132018089, 0.018423808738589287, -0.001493989140726626, -0.06163111329078674, -0.036158349364995956, -0.009186126291751862, 0.027602899819612503, -0.033038217574357986, 0.023063359782099724, -0.05345708131790161, -0.006263377144932747, -0.02454768307507038, 0.0071347299963235855, -0.020911065861582756, 0.031900905072689056, 0.01987926848232746, -0.019432706758379936, -0.027126826345920563, 0.002954573603346944, 0.02554919943213463, -0.043945252895355225, 0.023632263764739037, 0.005166368559002876, -0.037435028702020645, 0.015238468535244465, 0.01696442812681198, 0.035427115857601166, -0.0024219632614403963, -0.00021595887665171176, 0.0224821325391531, -0.04047047346830368, -0.0012856048997491598, -0.011486583389341831, 0.10220618546009064, 0.015320704318583012, 0.02719549462199211, -0.021874941885471344, 0.03972010686993599, 0.027853600680828094, -0.013420592993497849, 0.037057723850011826, -0.00965048000216484, 0.04137451946735382, 0.010891511105000973, 0.017757870256900787, 0.002179869217798114, -0.00292719597928226, -0.0024890133645385504, 0.002190951956436038, -0.006093429867178202, -0.046509142965078354, -0.007983610965311527, 0.024992896243929863, 0.006296930834650993, 0.007737259846180677, -0.03351472690701485, 0.08455115556716919, 0.00008322590292664245, -0.005789218936115503, -0.010951030999422073, 0.023279478773474693, 0.03187954053282738, 0.03238588944077492, 0.009647718630731106, 0.020587023347616196, 0.003363718744367361, -0.04710792005062103, 0.03864460438489914, -0.008722214959561825, 0.030926227569580078, 0.0006343947607092559, 0.014563477598130703, 0.0067433323711156845, 0.015058872289955616, 0.01850641518831253, 0.019467439502477646, -0.005246036220341921, 0.02843436226248741, 0.017923248931765556, -0.029466141015291214, -0.11441588401794434, 0.0022122215013951063, -0.030944976955652237, -0.05307716876268387, -0.04706675186753273, 0.0377902016043663, -0.0035071189049631357, 0.01685400865972042, 0.004034911282360554, -0.03295759856700897, 0.015178005211055279, -0.010687734931707382, 0.03599395975470543, 0.008046620525419712, -0.002149041509255767, 0.01473154779523611, -0.01687801443040371, 0.0128630381077528, -0.003941410221159458, 0.027001112699508667, -0.01114374678581953, -0.0023337965831160545, 0.04645851254463196, -0.01365893054753542, 0.022930512204766273, 0.028397658839821815, -0.01606844924390316, 0.004106674809008837, -0.09631824493408203, -0.005384135991334915, 0.00909497495740652, -0.045507729053497314, 0.02912336401641369, 0.022425470873713493, 0.017100075259804726, -0.015230247750878334, 0.008451218716800213, 0.035961441695690155, 0.02061331830918789, -0.03402047976851463, -0.048481084406375885, -0.01862758956849575, -0.023778118193149567, 0.004282418172806501, 0.03474096208810806, -0.017668914049863815, 0.008798052556812763, 0.01751452311873436, -0.022591322660446167, 0.01570623181760311, -0.010184704326093197, 0.010672727599740028, 0.013696550391614437, -0.03032403625547886, -0.06273531168699265, -0.03775925934314728, 0.01608593948185444, 0.022982090711593628, 0.04022008553147316, 0.028603730723261833, 0.015279353596270084, 0.025568177923560143, -0.003343021497130394, -0.022245416417717934, -0.034963153302669525, 0.05551698058843613, -0.028018858283758163, -0.02858542837202549, -0.010068107396364212, 0.0477362684905529, -0.016117814928293228, 0.021643800660967827, -0.009988777339458466, -0.01935889758169651, -0.04786166548728943, -0.009050958789885044, -0.0006877632113173604, -0.021999485790729523, 0.022323643788695335, 0.04360026493668556, 0.02182561345398426, 0.027513355016708374, -0.02186567336320877, -0.0034247571602463722, 0.01786988414824009, 0.07081805914640427, 0.01627405732870102, -0.013059640303254128, -0.01777781918644905, -0.005856829695403576, -0.008131742477416992, 0.00870298407971859, -0.05179774388670921, -0.013185813091695309, -0.002716991351917386, 0.0014660261804237962, -0.01148549560457468, 0.028146302327513695, 0.044128019362688065, -0.003143263515084982, 0.029931968078017235, -0.015012047253549099, -0.006696136202663183, 0.03663571923971176, -0.01786448247730732, -0.06308188289403915, -0.03300921991467476, -0.009998273104429245, 0.005246346816420555, 0.014405238442122936, 0.014148199930787086, 0.058160435408353806, 0.040563493967056274, 0.019378038123250008, 0.014726629480719566, -0.0035793050192296505, 0.006080516614019871, 0.0041272290982306, -0.01898820325732231, 0.08516737818717957, -0.021940680220723152, -0.041261013597249985, 0.02608862705528736, 0.007488162722438574, -0.029637601226568222, 0.02779611572623253, 0.0038082029204815626, 0.033889517188072205, 0.024389544501900673, 0.003754383185878396, -0.03744221478700638, 0.02185826748609543, 0.04355316236615181, -0.002050444483757019, -0.018593378365039825, -0.04599088430404663 ]
How we sped up transformer inference 100x for 🤗 API customers
Narsil
January 18, 2021
accelerated-inference
analysis, nlp
https://huggingface.co/blog/accelerated-inference
Unfair advantage The Transformer architecture was a decisive inflection point for Machine Learning performance, starting with NLP, and over the last 3 years the rate of improvement in Natural Language Understanding and Generation has been steep and accelerating. Another metric which accelerated accordingly, is the average size of the models, from the 110M parameters of BERT to the now 175Bn of GPT-3. This trend has introduced daunting challenges for Machine Learning Engineers when deploying the latest models into production. While 100x speedup is a high bar to reach, that’s what it takes to serve predictions with acceptable latency in real-time consumer applications. To reach that bar, as Machine Learning Engineers at Hugging Face we certainly have an unfair advantage sitting in the same (virtual) offices as the 🤗 Transformers and 🤗 Tokenizers maintainers 😬. We are also extremely lucky for the rich partnerships we have developed through open source collaborations with hardware and cloud vendors like Intel, NVIDIA, Qualcomm, Amazon and Microsoft that enable us to tune our models x infrastructure with the latest hardware optimizations techniques. If you want to feel the speed on our infrastructure, start a free trial and we’ll get in touch. If you want to benefit from our experience optimizing inference on your own infrastructure participate in our 🤗 Expert Acceleration Program.
[ 0.015472334809601307, -0.007779801730066538, 0.05271877348423004, 0.0030768674332648516, -0.047982268035411835, 0.06684533506631851, 0.03106493130326271, 0.08325818181037903, -0.011661168187856674, -0.037853240966796875, -0.055554378777742386, 0.03287907689809799, -0.01531948335468769, 0.0632978305220604, 0.012409955263137817, -0.03431610390543938, -0.00047284335596486926, -0.010791786946356297, 0.004249877296388149, 0.029782846570014954, 0.021191738545894623, -0.06660070270299911, 0.09288089722394943, 0.014687995426356792, -0.0008299308829009533, -0.05394419655203819, -0.0104252640157938, -0.043904393911361694, 0.028896911069750786, 0.0514078214764595, -0.04225405305624008, -0.02866627648472786, -0.021768717095255852, -0.019742025062441826, -0.00008286778029287234, -0.010219738818705082, -0.1429997831583023, 0.008817264810204506, 0.007023938000202179, 0.020356083288788795, 0.06322137266397476, -0.026602957397699356, -0.07827295362949371, 0.019845817238092422, -0.03076294995844364, -0.0048810928128659725, -0.09063485264778137, 0.023535078391432762, -0.05085969343781471, -0.035175859928131104, -0.058866776525974274, 0.04736240580677986, -0.06919591873884201, 0.006160474382340908, 0.043721754103899, 0.008885093964636326, 0.031230615451931953, -0.05822296813130379, 0.04339200630784035, -0.004712881986051798, 0.09641118347644806, -0.012218250893056393, 0.0637134537100792, -0.035095538944005966, 0.03369789943099022, -0.02534305676817894, -0.004115382209420204, -0.044711340218782425, -0.006599749438464642, -0.03507881984114647, 0.010996941477060318, -0.056899335235357285, -0.07182598859071732, -0.03318352624773979, -0.019968396052718163, -0.05274658650159836, -0.030152922496199608, 0.027389394119381905, 0.09627143293619156, 0.035366885364055634, -0.04567863419651985, -0.006407586392015219, 0.00892446655780077, 0.018620094284415245, 0.02717585489153862, 0.020079828798770905, 0.024934442713856697, -0.06099751219153404, -0.08075576275587082, 0.07432688772678375, 0.000361332087777555, -0.093536376953125, 0.0493185818195343, -0.009892575442790985, 0.015387063845992088, -0.011003195308148861, 0.030711472034454346, 0.002966964617371559, 0.010849637910723686, 0.029194300994277, -0.01093758549541235, -0.04642198979854584, -0.0020710385870188475, -0.06566102802753448, -0.011765239760279655, 0.011750628240406513, -0.031594567000865936, -0.1042083278298378, -0.008014537394046783, 0.06564074754714966, -0.02612568810582161, -0.01100117526948452, 0.007292014081031084, 0.06188293173909187, -0.10206487029790878, -0.006656975951045752, 0.024973005056381226, 0.01414831168949604, 0.06471437960863113, -0.0034020980820059776, 0.04721470922231674, 0.07044587284326553, -0.026852205395698547, 0.0025123225059360266, -0.0075628310441970825, 0.05416408181190491, 0.03286335989832878, -0.011479225009679794, -0.02400137484073639, -0.039911989122629166, 0.004401496611535549, -0.06399090588092804, -0.024794625118374825, 0.012985742650926113, 0.05135149136185646, 0.011457790620625019, 0.05326510965824127, -0.06310281157493591, -0.025448469445109367, -0.06600776314735413, -0.04697597771883011, 0.03025280125439167, 0.029221078380942345, -0.03625154122710228, 0.0171295665204525, -0.028502678498625755, -0.13318824768066406, 0.09230920672416687, 0.03251112625002861, -0.018030256032943726, -0.08258544653654099, 0.06743848323822021, -0.08392289280891418, -0.051803167909383774, 0.048312943428754807, 0.10357824712991714, -0.01735682599246502, -0.04403248056769371, -0.07313353568315506, -0.0316690169274807, -0.08306513726711273, -0.08080344647169113, -0.05411257594823837, -0.0023174455855041742, -0.007418842986226082, 0.0019472476560622454, 0.01063113659620285, 0.0009152126731351018, -0.03602110967040062, 0.07493743300437927, 0.019485635682940483, -0.008974901400506496, 0.0689159408211708, -0.0616171658039093, -0.0033354228362441063, 0.06462313234806061, -0.019751332700252533, 0.04926053434610367, -0.0021978369913995266, -0.03878382593393326, -0.04762310907244682, 0.10584975779056549, 0.033132608979940414, 0.10721906274557114, 0.08581175655126572, -0.08401010185480118, 0.005241102539002895, 0.007769869174808264, -0.03369184955954552, -0.01394663192331791, -0.06870345771312714, 0.00471958052366972, 0.05801526457071304, -0.032168883830308914, -0.015151776373386383, -0.007789643481373787, -0.01804099604487419, 0.11625465750694275, 0.027153078466653824, 0.022417031228542328, 0.04136327654123306, -0.02098790928721428, -0.002547428011894226, -0.01576177217066288, -0.04152929410338402, -0.01761334389448166, -0.017139533534646034, -0.03885456547141075, -0.02480192296206951, 0.044936154037714005, -0.013692505657672882, -0.0900471955537796, 0.007435210049152374, -0.020356042310595512, -0.0530804879963398, -0.05693547800183296, 0.017227033153176308, -0.034603264182806015, 0.006651658099144697, -0.00516855763271451, 0.1330116093158722, -0.0595044307410717, 0.028362827375531197, -0.02819371223449707, 0.024867422878742218, -0.025005275383591652, 0.04608163982629776, 0.010964542627334595, 0.04505058005452156, -0.03715445473790169, -0.039928678423166275, -0.06641162931919098, -0.03705456480383873, 0.025437096133828163, -0.027217328548431396, -0.02044556848704815, 0.022114282473921776, 0.029727645218372345, 0.056839145720005035, 0.0035322594922035933, -0.032974131405353546, 0.02434191294014454, -0.0003465752524789423, 0.0807875394821167, 0.03657608851790428, 0.010376982390880585, 0.013073254376649857, 0.013762430287897587, -0.058319564908742905, 0.028797265142202377, -0.061593156307935715, 0.11152155697345734, -0.019732750952243805, -0.021012507379055023, -0.015431482344865799, 0.051553189754486084, 0.011679417453706264, 0.006269984878599644, -0.05462450161576271, 0.04766439273953438, -0.009129952639341354, -0.033470332622528076, -0.03203922137618065, -0.010529015213251114, -0.008032672107219696, -0.02641443721950054, -0.002559088170528412, 0.004812701139599085, 0.009002100676298141, -0.018920762464404106, 0.039412736892700195, -0.06662208586931229, 0.06729990243911743, -0.0025439022574573755, 0.008163921535015106, 0.010341159999370575, 0.024732325226068497, -0.015130288898944855, -0.013027077540755272, -0.03366539627313614, 0.01904093474149704, -0.04145849496126175, 0.020264917984604836, 0.015095451846718788, -0.009408802725374699, 0.016067516058683395, 0.01765855774283409, -0.0254925899207592, -0.025827843695878983, -0.005481939297169447, -0.005089337471872568, 0.01967085711658001, -0.028142014518380165, -0.0637439638376236, -0.037073176354169846, 0.04373232275247574, 0.00970499124377966, -0.018998626619577408, 0.0020377826876938343, -0.010391226038336754, -0.03415680304169655, -0.008766704238951206, 0.015865806490182877, 0.02552695758640766, -0.0025043573696166277, -0.0030132841784507036, 0.013211608864367008, 0.026786480098962784, -0.08756383508443832, -0.0023576137609779835, -0.006306248251348734, -0.0021985170897096395, -0.021637288853526115, -0.017034796997904778, 0.035905200988054276, 0.024186866357922554, -0.028856268152594566, 0.017815258353948593, 0.03420605883002281, 0.0166605357080698, -0.020560186356306076, -0.017368394881486893, -0.022871701046824455, -0.020118219777941704, 0.0034305709414184093, -0.015501169487833977, 0.04823245853185654, 0.004442177247256041, 0.001886035199277103, -0.0017936653457581997, 0.01551845669746399, -0.04744924604892731, -0.006753777619451284, 0.021982647478580475, -0.004606613889336586, -0.02534613385796547, 0.02906220033764839, -0.009685044176876545, -0.03293008729815483, -0.03962970897555351, 0.00267281336709857, 0.03034282475709915, -0.0002670002286322415, 0.00105576915666461, -0.016055021435022354, -0.003821574617177248, 0.03674269840121269, 0.04012642055749893, 0.03475517779588699, -0.0045225489884614944, 0.013539795763790607, 0.039827559143304825, 0.024465326219797134, -0.005304901394993067, -0.03667431324720383, -0.006881667301058769, 0.05387244373559952, -0.016411127522587776, -0.026394367218017578, -0.012814008630812168, 0.018742267042398453, 0.04844699427485466, 0.03774906322360039, 0.014013177715241909, -0.001295263646170497, -0.020872492343187332, 0.0025535349268466234, 0.006223496049642563, -0.04649392142891884, 0.02121954970061779, -0.0203312449157238, -0.009553327225148678, -0.04712037369608879, 0.019159575924277306, 0.003088947618380189, -0.01855291798710823, -0.020680377259850502, 0.004117163829505444, 0.008043892681598663, 0.052043382078409195, -0.011426841840147972, -0.005271638743579388, -0.004352728836238384, 0.013867243193089962, 0.019902486354112625, -0.021522169932723045, 0.009086051024496555, -0.02195025607943535, -0.011275002732872963, -0.02153158374130726, -0.06590528786182404, 0.0025568148121237755, 0.0009105056524276733, -0.011422653682529926, 0.025968443602323532, -0.02756383828818798, 0.023257283493876457, 0.05504240095615387, 0.01798664778470993, -0.0510917603969574, 0.009917836636304855, -0.04332118481397629, -0.010627774521708488, 0.03476548194885254, -0.0008017573854885995, 0.03550945967435837, -0.023352576419711113, 0.0004610834876075387, 0.012431755661964417, -0.05248979851603508, -0.013177567161619663, -0.03852643817663193, -0.006510477047413588, 0.034936971962451935, -0.019548801705241203, -0.017545118927955627, 0.027180436998605728, 0.007912065833806992, 0.011619366705417633, 0.017271840944886208, -0.0023861131630837917, -0.024695131927728653, 0.040920428931713104, 0.045622505247592926, 0.00006346245208987966, -0.0025858415756374598, -0.01671348139643669, 0.020455138757824898, -0.0065291691571474075, 0.0051638660952448845, -0.01795279234647751, -0.02072730101644993, 0.05138031393289566, 0.003096734406426549, 0.0171818807721138, 0.044251520186662674, -0.008931325748562813, -0.02658061683177948, -0.015352018177509308, 0.011465545743703842, 0.07428773492574692, 0.009333801455795765, 0.018023911863565445, 0.03959175944328308, -0.036171313375234604, -0.00674669723957777, -0.034477874636650085, -0.016829153522849083, 0.08877342939376831, 0.04540635645389557, 0.011278179474174976, -0.028796184808015823, 0.0023237818386405706, 0.015286409296095371, 0.007519086357206106, 0.03130174055695534, -0.04774609953165054, 0.044229358434677124, 0.020910365507006645, -0.020130274817347527, -0.010818197391927242, 0.050325069576501846, 0.0765572041273117, -0.011940281838178635, -0.023160545155405998, 0.002312989206984639, 0.015964945778250694, 0.0004813777923118323, -0.011325398460030556, 0.019265051931142807, -0.02688770368695259, -0.005941502749919891, 0.06217178329825401, -0.000010079339517687913, -0.0005616371636278927, -0.0416584238409996, -0.002128755208104849, -0.0066389599815011024, -0.002548513701185584, 0.010105420835316181, -0.006815876346081495, -0.010991842485964298, -0.005288975313305855, 0.04795054346323013, 0.03311949968338013, 0.012324213981628418, 0.0015972916735336185, 0.002842122223228216, -0.043093010783195496, -0.033593859523534775, 0.015452034771442413, 0.019308773800730705, 0.03119221329689026, 0.009993396699428558, 0.08671753108501434, 0.08758707344532013, 0.009690020233392715, -0.0030428320169448853, 0.0009960583411157131, -0.022451162338256836, 0.017736131325364113, -0.05752458795905113, 0.024979237467050552, -0.04890553280711174, 0.028284071013331413, 0.015815163031220436, -0.010837964713573456, -0.011535875499248505, 0.04597112536430359, 0.021577293053269386, 0.015216905623674393, -0.023524126037955284, 0.02811468578875065, -0.003063055919483304, 0.019370241090655327, -0.022645186632871628, 0.017319878563284874, -0.01614973694086075, 0.015040160156786442, 0.02271358296275139, -0.007140146102756262, -0.01002543419599533, -0.02282891422510147, -0.03265546262264252, -0.005283920094370842, 0.06706580519676208, 0.02207379974424839, 0.0420597679913044, -0.023484712466597557, -0.02596910670399666, -0.0029836304020136595, -0.017072802409529686, 0.0472189337015152, -0.046837080270051956, 0.0073088109493255615, -0.0265219546854496, -0.028871525079011917, -0.03063288703560829, 0.02811315841972828, -0.012921741232275963, 0.032441843301057816, 0.04603986442089081, 0.023991340771317482, -0.005776034668087959, -0.012697668746113777, 0.01095543336123228, 0.028078513219952583, -0.031948357820510864, 0.0033859102986752987, -0.025380505248904228, -0.028541624546051025, -0.012513893656432629, -0.021470390260219574, 0.031551338732242584, -0.005898192059248686, -0.008193248882889748, -0.02365281991660595, 0.0054197488352656364, 0.0042937095277011395, 0.025008568540215492, -0.0211999099701643, 0.01698315143585205, 0.030840056017041206, -0.01169711071997881, 0.010313430801033974, -0.003402764443308115, 0.016616832464933395, 0.027931174263358116, 0.002046894980594516, -0.06253322213888168, 0.029332034289836884, 0.034218281507492065, -0.04283064231276512, 0.039068907499313354, 0.015461917035281658, -0.010173909366130829, 0.021998416632413864, 0.007138875313103199, 0.010129459202289581, 0.023880241438746452, 0.03436822071671486, 0.040555231273174286, -0.033211350440979004, 0.011249789036810398, 0.016984108835458755, 0.06741835176944733, 0.008073593489825726, -0.014311273582279682, 0.03831041231751442, 0.034463994204998016, 0.06306453049182892, -0.045393481850624084, 0.02057129144668579, 0.01601419411599636, 0.04916473850607872, 0.013860548846423626, 0.03385663405060768, -0.006339337211102247, -0.018854014575481415, -0.014549708925187588, -0.02746327966451645, -0.021524086594581604, 0.009562311694025993, -0.007935827597975731, -0.01962346024811268, -0.033979497849941254, 0.06124662235379219, -0.03768698498606682, 0.023576481267809868, 0.019978590309619904, 0.009256069548428059, 0.006091119255870581, 0.035876769572496414, 0.02034289948642254, 0.03363167494535446, 0.03756636753678322, 0.03593740612268448, 0.010602472350001335, -0.01200379803776741, 0.046656906604766846, 0.00609618192538619, 0.01782107539474964, -0.013527818955481052, -0.02399088628590107, -0.0029896090272814035, -0.019301248714327812, 0.020584402605891228, 0.008598837070167065, -0.017990952357649803, -0.007061137817800045, 0.012645966373383999, 0.0192708820104599, -0.04923228919506073, 0.01176142692565918, -0.01573152281343937, 0.009998940862715244, 0.01480356976389885, 0.06561107188463211, -0.013529273681342602, 0.05257270485162735, 0.026578491553664207, -0.032956812530756, 0.017590073868632317, -0.0518098920583725, 0.0343228243291378, 0.030832935124635696, -0.00041484349640086293, -0.039679430425167084, 0.014027422294020653, 0.0016726076137274504, -0.014730921946465969, 0.021301748231053352, 0.01024596393108368, 0.024168826639652252, 0.06434275209903717, 0.02239389903843403, 0.04026487469673157, 0.0322093591094017, 0.010520474053919315, -0.014141159132122993, -0.03597906231880188, -0.000823254173155874, 0.011348003521561623, -0.008524666540324688, 0.008530916646122932, -0.0599915087223053, -0.003642825875431299, -0.015060234814882278, 0.019985677674412727, 0.011263139545917511, 0.05034514144062996, -0.05679892748594284, -0.02902958169579506, -0.0017927250592038035, 0.018520034849643707, 0.006683326326310635, 0.0432138629257679, 0.026357661932706833, -0.010612956248223782, -0.014146395958960056, -0.004796803928911686, -0.026378363370895386, 0.0043675596825778484, 0.02112470380961895, 0.040829263627529144, -0.005931785795837641, -0.04576209560036659, -0.03890298679471016, 0.035872723907232285, 0.03717082738876343, 0.06947440654039383, 0.04559746012091637, 0.013882816769182682, -0.017412949353456497, -0.03455343469977379, 0.005561570171266794, -0.041114117950201035, 0.02756248228251934, -0.03937896713614464, -0.013697503134608269, 0.029350250959396362, 0.006389076821506023, -0.01168842799961567, 0.030648985877633095, -0.04963146895170212, -0.020947718992829323, -0.05369441583752632, -0.0022029667161405087, 0.0132230743765831, 0.006149151362478733, 0.05266033113002777, -0.016692854464054108, 0.009662416763603687, 0.026744237169623375, -0.041768964380025864, 0.0015321247046813369, -0.0008662724867463112, -0.02985953912138939, 0.08537627011537552, -0.023289255797863007, 0.004649563692510128, -0.033047787845134735, -0.022558704018592834, 0.05538620427250862, -0.05515183135867119, 0.0538707971572876, 0.04440300911664963, 0.004823913332074881, 0.004653865937143564, 0.022793790325522423, -0.012147822417318821, -0.07407905906438828, 0.03533705696463585, -0.04540334641933441, 0.010566547513008118, 0.014182284474372864, -0.017709916457533836, -0.05106373503804207, 0.028294095769524574, -0.016719935461878777, 0.014463374391198158, 0.06201053783297539, -0.016555778682231903, 0.011670118197798729, 0.015955235809087753, -0.021355485543608665, 0.006896619684994221, -0.021284254267811775, -0.03322518244385719, 0.00041564967250451446, -0.01915719360113144, 0.03389152139425278, 0.02833436243236065, -0.0648220032453537, 0.03878827765583992, -0.042898029088974, 0.010402175597846508, 0.001406231545843184, -0.0355905257165432, -0.015640929341316223, 0.013856634497642517, -0.006128187291324139, -0.008169702254235744, 0.038788508623838425, 0.0655861347913742, -0.016871275380253792, 0.0012040951987728477, 0.004828562028706074 ]
How we sped up transformer inference 100x for 🤗 API customers
Narsil
January 18, 2021
accelerated-inference
analysis, nlp
https://huggingface.co/blog/accelerated-inference
Getting to the first 10x speedup The first leg of the optimization journey is the most accessible, all about using the best combination of techniques offered by the Hugging Face libraries, independent of the target hardware. We use the most efficient methods built into Hugging Face model pipelines to reduce the amount of computation during each forward pass. These methods are specific to the architecture of the model and the target task, for instance for a text-generation task on a GPT architecture, we reduce the dimensionality of the attention matrices computation by focusing on the new attention of the last token in each pass: -| Naive version | Optimized version | -|:---------------------------------------------------------------------------------------------------------:|:-------------------------------------------------------------------------------------------------------:| -||| Tokenization is often a bottleneck for efficiency during inference. We use the most efficient methods from the 🤗 Tokenizers library, leveraging the Rust implementation of the model tokenizer in combination with smart caching to get up to 10x speedup for the overall latency. Leveraging the latest features of the Hugging Face libraries, we achieve a reliable 10x speed up compared to an out-of-box deployment for a given model/hardware pair. As new releases of Transformers and Tokenizers typically ship every month, our API customers do not need to constantly adapt to new optimization opportunities, their models just keep running faster.
[ 0.038498856127262115, 0.02363203652203083, 0.027861500158905983, -0.009859924204647541, 0.014890177175402641, 0.02346152625977993, 0.06548500061035156, 0.08860360831022263, -0.01731870509684086, -0.010029800236225128, -0.07008763402700424, 0.028272058814764023, -0.02252618782222271, 0.04513569548726082, -0.0129997618496418, -0.03678466007113457, 0.05372585356235504, -0.03639945015311241, 0.0016909129917621613, 0.04481368511915207, 0.050220899283885956, -0.0485244058072567, 0.09990794211626053, -0.007248975336551666, -0.026538746431469917, -0.06264756619930267, -0.018780089914798737, -0.021486293524503708, -0.008191808126866817, 0.020046114921569824, -0.11257380992174149, -0.016697973012924194, 0.01439221203327179, -0.02367009036242962, 0.03606247156858444, -0.020301969721913338, -0.15770812332630157, 0.0018821744015440345, 0.07951472699642181, -0.007684912066906691, 0.017621217295527458, -0.03676816076040268, -0.08686680346727371, 0.058285243809223175, -0.01313169114291668, -0.0032292965333908796, -0.15373735129833221, 0.03275245800614357, -0.04719071835279465, -0.055427003651857376, -0.0618688203394413, 0.055589526891708374, -0.025752287358045578, -0.003433801233768463, -0.018602514639496803, 0.050026409327983856, -0.046953339129686356, -0.06883790343999863, -0.035062409937381744, 0.05467883124947548, 0.043597642332315445, 0.02188887447118759, 0.03603777289390564, 0.05836739018559456, 0.04651983454823494, 0.019782619550824165, -0.028867309913039207, 0.0009495301055721939, -0.05452787131071091, -0.027178069576621056, 0.053633902221918106, -0.027293933555483818, 0.023061664775013924, 0.01750725321471691, 0.0035987168084830046, -0.011393709108233452, -0.009842820465564728, -0.021693618968129158, 0.06177210435271263, 0.005067762918770313, -0.010281885042786598, 0.009956980124115944, 0.038993995636701584, 0.024795832112431526, 0.06302081048488617, 0.07232004404067993, 0.03816385194659233, -0.0465647354722023, -0.114641472697258, 0.08009986579418182, -0.02257727086544037, -0.10303837805986404, -0.006965129170566797, 0.01262661349028349, 0.015020214952528477, 0.006140127778053284, -0.011022035032510757, 0.008732629008591175, 0.05549588054418564, -0.01687636785209179, 0.021845243871212006, -0.09910335391759872, -0.009175313636660576, -0.05699342489242554, -0.02826985903084278, 0.057893045246601105, -0.055807631462812424, -0.11562706530094147, -0.013865577057003975, 0.029462331905961037, -0.02145918644964695, 0.06950008124113083, 0.04096822068095207, 0.027991216629743576, -0.057459037750959396, 0.037343140691518784, -0.018018264323472977, 0.014741186052560806, -0.00790055189281702, 0.03567493334412575, 0.014201556332409382, 0.12050279229879379, 0.033794108778238297, -0.04494243487715721, -0.012641149573028088, 0.0823712944984436, 0.031870853155851364, 0.023204892873764038, 0.031145667657256126, -0.026985885575413704, 0.014629261568188667, -0.01850126124918461, 0.025885362178087234, 0.012213394977152348, 0.04684955254197121, -0.06867311894893646, 0.018144719302654266, -0.04896743595600128, -0.005284986924380064, -0.018709326162934303, -0.04349280521273613, 0.013395102694630623, 0.05775124579668045, -0.0641787126660347, 0.07355573773384094, -0.0074224877171218395, -0.08103997260332108, 0.041534289717674255, 0.030709516257047653, -0.0054008085280656815, -0.028713786974549294, 0.004261501599103212, -0.055218372493982315, -0.023361166939139366, -0.03449833765625954, 0.05338694155216217, -0.02221786603331566, -0.06091191992163658, -0.06140967831015587, -0.04467840492725372, -0.044539038091897964, -0.03028307668864727, -0.0368335023522377, -0.03031136840581894, 0.025315329432487488, 0.00012997601879760623, 0.035327229648828506, 0.05576563626527786, 0.005507364869117737, -0.009278759360313416, 0.024591218680143356, 0.01983938179910183, 0.06498837471008301, -0.07443027198314667, -0.02901921607553959, 0.03273387253284454, 0.022669998928904533, 0.06472769379615784, -0.0532529316842556, 0.015362470410764217, -0.04190666228532791, 0.08124485611915588, 0.02351589873433113, 0.06474921107292175, 0.050080444663763046, -0.12129325419664383, 0.02282141149044037, 0.045194730162620544, -0.04183966666460037, -0.011895520612597466, -0.01801808550953865, 0.009243755601346493, 0.06861410290002823, -0.020130936056375504, 0.01219969056546688, -0.020448198541998863, -0.040151648223400116, 0.1086762398481369, 0.002503342228010297, 0.030275089666247368, 0.03545917570590973, 0.029680591076612473, 0.018309365957975388, -0.018602190539240837, -0.01359045971184969, -0.033257123082876205, 0.018715115264058113, -0.057216987013816833, 0.010815880261361599, 0.054885055869817734, -0.022502519190311432, -0.13861750066280365, -0.02264120802283287, -0.016454951837658882, -0.02514168806374073, -0.03522246330976486, 0.003703200491145253, 0.012212127447128296, 0.008531337603926659, -0.05591621622443199, 0.18800677359104156, -0.05369601398706436, -0.01812947914004326, -0.006535218562930822, -0.025428999215364456, 0.011032314039766788, 0.04055425152182579, 0.004015018697828054, 0.05468296632170677, -0.051274001598358154, -0.027964288368821144, -0.1178743839263916, -0.05787926912307739, 0.0180446095764637, 0.011306916363537312, -0.051489971578121185, 0.020748859271407127, 0.044083498418331146, 0.0027789059095084667, -0.019638771191239357, -0.05127940699458122, -0.05653805285692215, 0.05558152124285698, 0.024249298498034477, 0.027249252423644066, 0.005364608485251665, 0.035337042063474655, -0.023707149550318718, -0.05198172107338905, -0.02040092833340168, -0.04789688438177109, 0.04692208766937256, -0.02334863319993019, -0.06164485588669777, 0.05508548021316528, 0.023115428164601326, -0.0010820698225870728, -0.007719047367572784, -0.030071424320340157, 0.06692212074995041, 0.0074123661033809185, -0.0029805833473801613, -0.033201664686203, -0.03473450616002083, -0.013926343061029911, -0.01892358623445034, -0.00573335587978363, 0.007089247461408377, 0.011572306044399738, 0.011288520880043507, 0.02882004901766777, -0.003180778818204999, 0.03481919690966606, 0.01114915031939745, 0.007665988057851791, -0.003397382562980056, 0.030346209183335304, -0.028907187283039093, -0.026669606566429138, -0.007643693592399359, 0.02608264610171318, -0.02822587639093399, 0.03474607318639755, 0.012711610645055771, 0.010332822799682617, -0.014220516197383404, 0.010705006308853626, -0.05311943590641022, -0.03970005363225937, 0.03166519105434418, 0.03135048225522041, -0.002349275629967451, -0.0037690361496061087, -0.01538746990263462, -0.02325558476150036, 0.011371105909347534, 0.0018706147093325853, -0.018307749181985855, -0.022501220926642418, 0.00690793851390481, -0.04071640223264694, -0.012414625845849514, -0.030007272958755493, 0.01089002937078476, -0.013670433312654495, 0.019708814099431038, 0.0029883382376283407, 0.02358265593647957, -0.10189252346754074, -0.03768036141991615, -0.027647245675325394, 0.0009924484184011817, -0.0167213324457407, -0.04951072111725807, 0.04450439289212227, 0.014878982678055763, -0.019826354458928108, 0.005421656649559736, 0.022862503305077553, 0.026136955246329308, -0.010158777236938477, -0.015565845184028149, -0.024723771959543228, -0.025446094572544098, 0.03165537863969803, -0.006848898250609636, 0.010043400339782238, 0.03696216270327568, 0.00011561562132555991, -0.011292844079434872, 0.04080253094434738, -0.04650921747088432, 0.01523217000067234, -0.017666205763816833, 0.010787801817059517, -0.020691681653261185, 0.0405057817697525, -0.014802467077970505, -0.012658597901463509, 0.00008552326471544802, 0.010948550887405872, 0.015775462612509727, -0.009921936318278313, 0.009239736944437027, -0.018790706992149353, -0.004545931704342365, -0.005465071182698011, 0.009527371264994144, 0.015707600861787796, -0.021028492599725723, 0.040642526000738144, 0.01812106743454933, 0.01991628296673298, 0.003038883674889803, 0.03705891966819763, -0.019817057996988297, 0.05655631050467491, -0.06076725199818611, -0.025717612355947495, -0.023654727265238762, 0.022532746195793152, 0.001664336770772934, 0.006470699328929186, -0.0004949475987814367, -0.015531914308667183, 0.002201114548370242, 0.022055014967918396, -0.00416372437030077, -0.06330326944589615, 0.02576465718448162, 0.005973068531602621, -0.0026786993257701397, -0.02284489944577217, 0.023038355633616447, -0.0047554331831634045, -0.00609249621629715, 0.006135142873972654, 0.0190181415528059, -0.012282142415642738, 0.029451962560415268, -0.01654067449271679, 0.005532116163522005, -0.017439329996705055, 0.01601303741335869, -0.03588321805000305, -0.023838894441723824, 0.048985958099365234, 0.01788150519132614, -0.022326089441776276, -0.010917078703641891, -0.031483542174100876, 0.021142613142728806, 0.012773258611559868, -0.01332646980881691, 0.057822227478027344, -0.028950795531272888, -0.003609586274251342, 0.03812926635146141, 0.013828742317855358, -0.04458093270659447, 0.018003463745117188, -0.057724691927433014, 0.004610374104231596, -0.01680499128997326, 0.024777431041002274, 0.048028867691755295, 0.00472533842548728, 0.021973568946123123, 0.034825585782527924, -0.02827642671763897, 0.0002603087341412902, -0.011225758120417595, -0.046897392719984055, -0.0020253737457096577, -0.023978568613529205, -0.034129220992326736, 0.054560113698244095, 0.011023280210793018, -0.0198679082095623, 0.0075070057064294815, -0.003512941999360919, -0.0203776303678751, 0.03940246254205704, 0.04258099943399429, -0.00572389829903841, 0.013906256295740604, -0.016517728567123413, 0.011995679698884487, -0.028815975412726402, 0.03554379567503929, -0.020831923931837082, 0.011544924229383469, 0.0657474622130394, -0.028338899835944176, 0.0030332247260957956, 0.0007444673683494329, 0.025771217420697212, -0.031414683908224106, -0.035790279507637024, 0.019936135038733482, 0.06333725154399872, -0.028380012139678, 0.008790367282927036, 0.002322911284863949, -0.04759764298796654, -0.004433794412761927, -0.0007377571891993284, -0.044921960681676865, -0.010643083602190018, -0.011250002309679985, 0.032042816281318665, -0.05736919492483139, -0.019947072491049767, 0.03926818445324898, -0.028873896226286888, -0.008850428275763988, -0.03859115391969681, 0.0244998037815094, 0.01895011216402054, -0.03274521231651306, -0.06551016867160797, 0.01478579267859459, 0.06627942621707916, -0.042406901717185974, -0.03002181462943554, -0.030788375064730644, 0.02256084606051445, 0.012105487287044525, -0.0005158129497431219, 0.0008644500630907714, -0.02224290743470192, 0.005399657413363457, 0.0018130677053704858, -0.005823386833071709, -0.005125375930219889, -0.045459650456905365, 0.002715286100283265, -0.019771577790379524, 0.0005942233256064355, 0.022896485403180122, -0.015886208042502403, -0.0283062681555748, 0.019897429272532463, 0.010811571963131428, 0.05021689087152481, -0.011961573734879494, 0.011588367633521557, 0.04082861542701721, -0.04046300798654556, 0.0069001950323581696, 0.046038512140512466, 0.0185895673930645, 0.03213988244533539, 0.03042742796242237, 0.04633466154336929, 0.0780724585056305, -0.02387841045856476, 0.043831974267959595, 0.025935471057891846, -0.012159054167568684, 0.04103551059961319, -0.049849919974803925, -0.009977104142308235, -0.04397686943411827, -0.007894398644566536, 0.02200913056731224, 0.018944304436445236, -0.011312847025692463, 0.013643632642924786, 0.012711571529507637, -0.007709391415119171, -0.006755299400538206, 0.05250824987888336, 0.01818745769560337, 0.00022923342476133257, 0.0002421810058876872, 0.04357011988759041, -0.01673201657831669, 0.010191698558628559, -0.010715441778302193, -0.005672108381986618, -0.0091097978875041, 0.030198032036423683, -0.013323839753866196, -0.03492511808872223, 0.0547017827630043, 0.008224394172430038, 0.05339735001325607, -0.0050202892161905766, -0.007823382504284382, -0.023314280435442924, -0.01856522634625435, 0.0066324155777692795, -0.00944625586271286, -0.001319826696999371, -0.01659969799220562, -0.011691330932080746, 0.04287923872470856, 0.005174304824322462, 0.0210626982152462, -0.005232343450188637, 0.047376636415719986, 0.03995306044816971, -0.008383706212043762, 0.01598406583070755, 0.034227170050144196, 0.03863475099205971, -0.006712612695991993, 0.0012622893555089831, -0.0035518165677785873, -0.04383866488933563, -0.0015882696025073528, -0.058046359568834305, 0.03405950590968132, 0.04621332511305809, -0.018554477021098137, -0.015709586441516876, 0.02440737374126911, 0.024924932047724724, 0.0026745270006358624, -0.004666830878704786, -0.008375488221645355, -0.017819616943597794, -0.013808446936309338, 0.03322318196296692, -0.004885737784206867, 0.00722989346832037, -0.007611943408846855, 0.01606147363781929, -0.06390423327684402, 0.021066267043352127, 0.025346651673316956, -0.02943846955895424, 0.050181206315755844, -0.00436735711991787, -0.04111219942569733, 0.016323162242770195, 0.055972225964069366, 0.007810481358319521, 0.019743381068110466, -0.01146597322076559, 0.03417162969708443, -0.06955330073833466, -0.004707950167357922, 0.01599249802529812, 0.10515806078910828, 0.0016565340338274837, 0.04500298202037811, 0.03777197748422623, 0.051813580095767975, 0.0361240990459919, 0.003441855078563094, 0.06528474390506744, -0.008421196602284908, 0.03283453732728958, 0.017995711416006088, 0.060960397124290466, 0.009992473758757114, -0.02692883461713791, 0.021586237475275993, -0.0042658643797039986, 0.011273320764303207, -0.022415412589907646, 0.011883589439094067, 0.004025483503937721, -0.008658619597554207, 0.037478551268577576, -0.0384506918489933, 0.04417017847299576, 0.024875709787011147, 0.020808855071663857, -0.020068660378456116, 0.008734863251447678, 0.03585406392812729, 0.03391319885849953, 0.02575444057583809, 0.020040033385157585, 0.021305998787283897, -0.015648340806365013, 0.06831546872854233, 0.014879373833537102, 0.03257249295711517, 0.0040784357115626335, 0.003388295415788889, 0.02419067546725273, -0.04281557723879814, -0.004888071212917566, 0.017846371978521347, -0.030941421166062355, 0.009353228844702244, 0.010532703250646591, -0.010869166813790798, -0.06303728371858597, 0.030083132907748222, -0.018162278458476067, -0.0058751218020915985, -0.027981918305158615, 0.010381286963820457, 0.007012779358774424, 0.03803667798638344, -0.007155091967433691, -0.01650952734053135, 0.04140087217092514, 0.010553455911576748, 0.02688147872686386, 0.013480426743626595, -0.02930859476327896, -0.022459201514720917, 0.017411720007658005, 0.01312105543911457, -0.022819247096776962, 0.011329065077006817, -0.005785539746284485, 0.0007387037039734423, 0.021048156544566154, -0.009579943493008614, -0.005981340538710356, 0.03109319694340229, 0.021741922944784164, 0.011324143968522549, -0.05965978652238846, -0.004275463987141848, 0.027311665937304497, -0.020573990419507027, 0.017643027007579803, -0.03509066253900528, -0.020259030163288116, -0.018638037145137787, 0.05618176609277725, 0.026904894039034843, 0.021648121997714043, -0.06272133439779282, -0.024047238752245903, -0.028453024104237556, -0.033248502761125565, -0.0012188383843749762, 0.03249196335673332, 0.0005786969559267163, -0.0060143680311739445, 0.008074603974819183, -0.004340103827416897, -0.0157253947108984, 0.01056542620062828, 0.022807447239756584, 0.07423710823059082, -0.02916102670133114, -0.043191131204366684, -0.015530770644545555, 0.052720531821250916, 0.009035546332597733, 0.03059479594230652, 0.03544321283698082, -0.007235870696604252, 0.0006019850843586028, -0.05506507307291031, 0.01606697030365467, -0.02312738262116909, -0.008188656531274319, -0.015743086114525795, 0.00012017639528494328, 0.015412821434438229, 0.004957052879035473, 0.01737275905907154, 0.015808938071131706, -0.029203394427895546, 0.019680047407746315, -0.03369961306452751, -0.0012301838723942637, 0.004350465722382069, -0.007193821016699076, 0.06112196668982506, 0.020226897671818733, 0.0005187442293390632, 0.04953587427735329, -0.042459145188331604, -0.006181570701301098, -0.010960901156067848, 0.03851933032274246, 0.043050117790699005, -0.013411694206297398, -0.008072621189057827, -0.030343227088451385, -0.012557025998830795, 0.04473328962922096, -0.03619133308529854, 0.04610689729452133, 0.016170818358659744, -0.004403750412166119, -0.025133080780506134, 0.005808690562844276, 0.03328727185726166, -0.025535816326737404, 0.01601521298289299, -0.027946460992097855, -0.01774788089096546, 0.02019346132874489, 0.02610968053340912, -0.05396972969174385, -0.011918308213353157, 0.02521495521068573, 0.021372050046920776, 0.0272818710654974, 0.01958748884499073, 0.0315685048699379, 0.009918294847011566, 0.004063964821398258, 0.017314407974481583, 0.012195364572107792, -0.030959637835621834, -0.036182958632707596, -0.028185054659843445, 0.05063218995928764, -0.01527817826718092, -0.051134735345840454, 0.017505422234535217, 0.03172136843204498, -0.025820409879088402, -0.009504850022494793, -0.018721414729952812, 0.0024378125090152025, -0.011113996617496014, 0.03169300779700279, -0.02675836905837059, 0.022691523656249046, 0.04028741642832756, -0.025008736178278923, -0.022299254313111305, -0.02711438573896885 ]
Fit More and Train Faster With ZeRO via DeepSpeed and FairScale
stas
January 19, 2021
zero-deepspeed-fairscale
guide
https://huggingface.co/blog/zero-deepspeed-fairscale
# Fit More and Train Faster With ZeRO via DeepSpeed and FairScale
[ 0.028305239975452423, -0.03839748352766037, 0.10471930354833603, 0.05221700668334961, 0.058908611536026, 0.05165145546197891, 0.028269004076719284, 0.021028131246566772, -0.0561811700463295, -0.08654867112636566, -0.02300075627863407, 0.030136536806821823, -0.024229269474744797, 0.019656771793961525, 0.04265490919351578, -0.02858215756714344, 0.015296363271772861, -0.027981342747807503, 0.015290878713130951, 0.03181261196732521, -0.061466656625270844, -0.07035718113183975, 0.05681783705949783, -0.016853027045726776, 0.018634114414453506, 0.04565873742103577, 0.01610206626355648, 0.02009367197751999, -0.0558636412024498, 0.012923771515488625, -0.023071274161338806, -0.002286872360855341, 0.0057809678837656975, -0.060299377888441086, -0.056476082652807236, -0.03961186856031418, -0.01896943524479866, 0.034075137227773666, -0.027463706210255623, -0.045045848935842514, -0.062134791165590286, 0.011445045471191406, -0.045520223677158356, 0.0633358359336853, -0.008270910009741783, -0.019623026251792908, -0.1580498367547989, 0.02966204471886158, -0.005434470251202583, -0.01742989383637905, -0.0003445883048698306, 0.06121724843978882, -0.049881622195243835, 0.04376966506242752, 0.039713259786367416, 0.00796449650079012, -0.03007444180548191, -0.03872566670179367, -0.010956978425383568, -0.03553052246570587, 0.0610961988568306, -0.006546622607856989, 0.013603374361991882, -0.012581558898091316, -0.00914060976356268, -0.0020045165438205004, -0.03923415765166283, -0.022060126066207886, -0.034007251262664795, -0.030445802956819534, 0.019939783960580826, -0.06422502547502518, 0.019233038648962975, -0.014217769727110863, 0.024233870208263397, -0.03484789654612541, -0.0829935222864151, 0.017559880390763283, 0.11485523730516434, 0.11421447992324829, -0.009742842987179756, 0.027353176847100258, 0.06749054789543152, 0.09024784713983536, -0.02863733284175396, 0.033619046211242676, 0.050816163420677185, 0.004274933598935604, -0.009893006645143032, 0.10074616223573685, 0.021195800974965096, -0.08270914852619171, 0.028659163042902946, 0.03823631629347801, 0.045841284096241, -0.040210574865341187, 0.012192180380225182, 0.04797393083572388, 0.04509924352169037, -0.01020908448845148, -0.03240232542157173, -0.04748270660638809, -0.0037810904905200005, -0.0598134845495224, -0.031657420098781586, 0.03360854461789131, -0.03586402162909508, -0.10873729735612869, 0.014920791611075401, 0.04926883801817894, -0.08451885730028152, 0.022087810561060905, -0.014730035327374935, -0.0009173025609925389, -0.01812058500945568, 0.059345174580812454, -0.00710510928183794, -0.04665720462799072, 0.0023111109621822834, 0.013546193018555641, -0.014371889643371105, 0.12453126162290573, 0.08747845143079758, 0.027051854878664017, -0.003098640590906143, 0.06320295482873917, 0.019306685775518417, 0.03272543102502823, -0.04135652258992195, 0.00968167744576931, -0.00780881242826581, -0.005494095850735903, -0.0022085781674832106, 0.009379517287015915, 0.0019542064983397722, -0.06663693487644196, -0.0186007060110569, 0.015819163993000984, 0.04188236966729164, 0.059590402990579605, 0.017297882586717606, 0.0293626319617033, 0.034653015434741974, 0.06039271131157875, 0.03985350579023361, -0.03291763737797737, -0.04483974725008011, 0.028139449656009674, -0.027740728110074997, -0.010979306884109974, -0.01706533692777157, 0.12296116352081299, -0.03645792976021767, -0.12369617074728012, 0.028691932559013367, 0.06730733066797256, -0.04245927929878235, -0.07204078137874603, 0.009001529775559902, 0.012927497737109661, -0.05617397278547287, -0.039427801966667175, 0.020888127386569977, -0.04623892903327942, 0.05097361281514168, -0.017723284661769867, 0.0033560805022716522, -0.005859034601598978, -0.007668543606996536, -0.03750857338309288, -0.011628497391939163, -0.0013499441556632519, 0.06921649724245071, 0.007142236921936274, -0.045215439051389694, 0.039317481219768524, 0.011681188829243183, 0.10326161235570908, -0.05680440366268158, 0.023253383114933968, -0.03219585493206978, 0.0445103794336319, 0.012191776186227798, 0.073882095515728, 0.042860377579927444, -0.0887715220451355, 0.0092589370906353, 0.026565248146653175, 0.0019788979552686214, 0.08330259472131729, -0.1182480975985527, -0.0034318086691200733, 0.10628977417945862, -0.041154541075229645, 0.006409710738807917, -0.06588820368051529, -0.022621363401412964, 0.08021052181720734, 0.0034670063760131598, 0.09443847090005875, 0.003159211715683341, -0.011500398628413677, 0.026944801211357117, -0.01609628275036812, -0.046042464673519135, 0.09155292063951492, 0.04656302556395531, 0.02462175488471985, 0.015769870951771736, -0.013388083316385746, -0.028148474171757698, -0.1303989142179489, 0.031123707070946693, -0.068300262093544, 0.010908096097409725, 0.006538587622344494, 0.008232451975345612, 0.004651282448321581, -0.0036565049085766077, -0.056120265275239944, 0.09419086575508118, 0.020032934844493866, -0.03195646405220032, 0.05318739637732506, 0.019818661734461784, 0.024745004251599312, 0.07569639384746552, -0.012481193989515305, -0.010017398744821548, -0.10165051370859146, -0.008268268778920174, -0.018469521775841713, -0.01500765886157751, 0.08228611201047897, 0.041526272892951965, 0.0235814917832613, 0.012702541425824165, -0.025312360376119614, 0.05409495159983635, -0.08202025294303894, -0.03308877348899841, -0.0010222700657323003, 0.00686359079554677, 0.03823334351181984, -0.020156122744083405, -0.006808985956013203, 0.07327943295240402, 0.058950360864400864, -0.050514258444309235, -0.042949527502059937, 0.009034775197505951, 0.03780331462621689, 0.03421881049871445, -0.07348337024450302, 0.03294702246785164, 0.00259405467659235, 0.010894129984080791, -0.022993037477135658, -0.03018033504486084, 0.03734324499964714, 0.03252129629254341, -0.02034076862037182, -0.002010202268138528, -0.014903671108186245, 0.017554398626089096, -0.025664856657385826, -0.03758889436721802, -0.017627494409680367, 0.012697122991085052, 0.0353628508746624, 0.00509035587310791, -0.02131236158311367, 0.013620075769722462, -0.013852539472281933, 0.016705293208360672, -0.014037871733307838, 0.04536638781428337, -0.03165231645107269, -0.015996666625142097, -0.03990368917584419, -0.006155332084745169, 0.0034617420751601458, 0.048377107828855515, 0.02954082563519478, 0.04144652560353279, -0.006601311266422272, 0.036354873329401016, -0.016988981515169144, -0.00933242030441761, 0.006909737829118967, 0.019790664315223694, -0.0028551151044666767, 0.008220468647778034, 0.022957315668463707, 0.01907394826412201, -0.019208915531635284, -0.0055412547662854195, -0.031099746003746986, 0.007775529287755489, -0.053426727652549744, 0.019570203498005867, 0.019589150324463844, -0.015930134803056717, -0.0020129696931689978, -0.03146851062774658, 0.037502042949199677, -0.03851014003157616, -0.00963884312659502, -0.1290779411792755, 0.00426606647670269, 0.012330078519880772, 0.020179547369480133, -0.031010353937745094, -0.003552468726411462, 0.01231152843683958, -0.039995528757572174, -0.03255137801170349, -0.006636976730078459, 0.008707001805305481, 0.030794106423854828, 0.02578766830265522, -0.01328268088400364, -0.049571406096220016, 0.022846156731247902, 0.002803246723487973, 0.017117612063884735, -0.005813251715153456, 0.023936258628964424, -0.02758421003818512, 0.04210883751511574, 0.00855265837162733, 0.0055135139264166355, -0.01145760715007782, 0.07917603105306625, 0.055774010717868805, 0.04269764572381973, -0.0006678894278593361, -0.008211983367800713, -0.01903483457863331, 0.05219026654958725, -0.03700853884220123, 0.026010146364569664, -0.009972590021789074, -0.012505642138421535, 0.018031006678938866, -0.0018447036854922771, -0.028534822165966034, -0.010305463336408138, 0.013244666159152985, -0.001857058610767126, 0.03084065020084381, 0.006350252777338028, -0.010098216123878956, -0.012085898779332638, -0.004614828620105982, 0.023686513304710388, 0.06335028260946274, -0.029592597857117653, -0.02643115073442459, -0.014963101595640182, 0.024781614542007446, 0.0758250281214714, 0.012126068584620953, 0.0011277524754405022, -0.03033418208360672, 0.037076182663440704, 0.07456309348344803, -0.019577736034989357, -0.047964539378881454, -0.009749784134328365, 0.00926248636096716, -0.0008956462843343616, -0.07552383095026016, 0.014047030359506607, 0.009809878654778004, -0.006280684377998114, -0.0211506150662899, -0.012516963295638561, -0.036428388208150864, -0.014592742547392845, -0.022517086938023567, 0.03083961270749569, -0.01647111587226391, 0.017346099019050598, 0.014449470676481724, -0.020390130579471588, 0.03326132893562317, -0.014559161849319935, -0.03512045368552208, -0.0004282331501599401, -0.017809567973017693, -0.019047968089580536, 0.019139287993311882, -0.00387741276063025, 0.013148623518645763, -0.013280133716762066, -0.0011663609184324741, 0.04311109706759453, 0.022920453920960426, -0.06819616258144379, 0.011022438295185566, 0.020130446180701256, -0.002236628904938698, 0.014604706317186356, 0.06340741366147995, 0.006026156712323427, -0.010343295522034168, -0.0097097372636199, 0.018629584461450577, -0.012718637473881245, -0.0026083551347255707, -0.006745082791894674, -0.004630920477211475, 0.03808889165520668, -0.000196803332073614, -0.03116457350552082, -0.02261981926858425, 0.035153456032276154, 0.07605121284723282, -0.0019022218184545636, -0.03792257606983185, -0.008616621606051922, 0.004033928271383047, -0.02168116718530655, -0.04613839089870453, -0.04311978071928024, 0.0049440604634583, 0.02458680048584938, -0.016631396487355232, 0.026042921468615532, 0.014903903938829899, -0.04230007529258728, 0.001706306473352015, -0.003526855492964387, 0.04419510439038277, 0.010487218387424946, 0.0031370320357382298, -0.01969962753355503, -0.006430780980736017, -0.039423372596502304, 0.025155022740364075, -0.019805878400802612, 0.03176593407988548, 0.0035118083469569683, -0.013659113086760044, 0.02500252053141594, -0.03610234335064888, -0.059910375624895096, -0.016936086118221283, 0.06820855289697647, 0.03348761051893234, 0.02822585590183735, 0.04469599202275276, 0.014960876666009426, -0.017096808180212975, 0.01404198631644249, -0.012111763469874859, 0.01980983465909958, 0.03549659252166748, -0.05193736031651497, -0.059129539877176285, 0.011106864549219608, 0.03296893835067749, 0.003396236803382635, 0.002727316226810217, 0.0007687560864724219, -0.01714712753891945, -0.01099979504942894, -0.013427354395389557, -0.012041646055877209, -0.053111255168914795, 0.011264903470873833, 0.030380306765437126, -0.005365894641727209, 0.01162474974989891, -0.056160006672143936, -0.031701430678367615, -0.015052887611091137, -0.008781622163951397, -0.04167531430721283, 0.005328220780938864, -0.03618813678622246, -0.0037673937622457743, 0.018870355561375618, 0.02317708171904087, 0.0282700564712286, -0.019260279834270477, 0.03180202841758728, 0.005282408557832241, 0.021950816735625267, 0.03277454152703285, 0.01840231567621231, -0.04907270148396492, 0.003458574414253235, 0.03484402224421501, 0.014440463855862617, 0.017086654901504517, 0.022403167560696602, 0.02834431827068329, -0.007173612713813782, 0.0012077648425474763, -0.008525138720870018, 0.0049204216338694096, 0.006315830163657665, 0.0268713366240263, -0.0034540214110165834, -0.028622668236494064, -0.0035464733373373747, 0.029767613857984543, -0.010105009190738201, -0.010917163453996181, -0.003715663682669401, -0.003201286541298032, 0.043569277971982956, 0.003765147179365158, -0.026766397058963776, 0.01435269694775343, -0.035412270575761795, 0.02478947676718235, -0.02065829373896122, -0.01387301366776228, -0.05448934808373451, -0.04221143200993538, -0.018950287252664566, -0.03273395821452141, 0.04801942780613899, -0.005070669576525688, -0.014748359099030495, 0.023485789075493813, -0.021661974489688873, -0.04561483860015869, -0.001647866447456181, -0.0018119356827810407, -0.028870604932308197, -0.014740565791726112, 0.037611812353134155, 0.03104979917407036, 0.054080549627542496, -0.002905036322772503, 0.016460925340652466, -0.0023884675465524197, 0.03229044750332832, 0.05386646091938019, 0.006117652170360088, -0.026186253875494003, 0.07436510175466537, 0.04176591336727142, -0.030636005103588104, -0.03200291097164154, -0.04566517844796181, -0.022851118817925453, -0.036913949996232986, -0.05366349220275879, 0.0032361475750803947, -0.0007970954175107181, 0.00408051535487175, 0.038896843791007996, -0.02042982168495655, 0.04276125505566597, -0.009371363557875156, -0.018424345180392265, 0.012712612748146057, -0.019822463393211365, 0.00873552542179823, -0.006544884294271469, -0.013816560618579388, -0.01586291193962097, -0.035085223615169525, 0.04153969883918762, -0.009344968013465405, 0.030862437561154366, 0.053524211049079895, -0.012946555390954018, 0.0878957062959671, -0.0017715212889015675, -0.024648137390613556, 0.006074284669011831, -0.017925851047039032, -0.004767161328345537, 0.03814634680747986, 0.04732983931899071, -0.003122473368421197, -0.01807459443807602, 0.0199811439961195, 0.03837474435567856, 0.030589904636144638, 0.021676864475011826, 0.02030465193092823, 0.020804239436984062, 0.015839137136936188, 0.0034584575332701206, -0.011112070642411709, -0.025044014677405357, 0.024830151349306107, 0.028374042361974716, 0.002022774191573262, 0.019002335146069527, 0.05914482846856117, 0.022181063890457153, 0.005111020989716053, 0.011290973983705044, -0.012394634075462818, -0.021508488804101944, 0.018608376383781433, 0.035841844975948334, -0.05474448949098587, -0.0003876703849527985, -0.040571603924036026, 0.046778224408626556, 0.0009180320193991065, 0.015887079760432243, -0.03539693355560303, -0.00906568206846714, 0.03583092615008354, 0.04556245356798172, -0.004334897268563509, 0.0489952526986599, -0.008196628652513027, -0.017449259757995605, 0.04032856598496437, -0.002499754773452878, -0.02532077766954899, 0.009789909236133099, -0.025621619075536728, 0.015323562547564507, -0.02406342141330242, 0.0012178722536191344, -0.01812468096613884, 0.044920992106199265, 0.009613409638404846, 0.025889098644256592, 0.012389552779495716, -0.04245447367429733, -0.033137936145067215, -0.015878304839134216, 0.02429801970720291, -0.012519314885139465, -0.003121959278360009, -0.053036656230688095, 0.00892581045627594, -0.008457577787339687, 0.029953651130199432, 0.00931989960372448, 0.023947762325406075, 0.02205098234117031, 0.03839812055230141, -0.010728063993155956, -0.016491563990712166, -0.016671186313033104, -0.008207999169826508, 0.004091936629265547, 0.005755423568189144, -0.030770251527428627, -0.023499926552176476, 0.010272040031850338, -0.01292103435844183, -0.000046714234485989437, -0.008707565255463123, 0.023788932710886, 0.024644453078508377, -0.04786703735589981, 0.010104618035256863, -0.0203313659876585, -0.03243067488074303, 0.02761613205075264, -0.029012542217969894, -0.03975919634103775, -0.01705395244061947, -0.023899253457784653, 0.026371432468295097, 0.025624863803386688, -0.010107778012752533, -0.05131683126091957, -0.015276738442480564, -0.05953874811530113, 0.001316916779614985, 0.01832539588212967, 0.03719427064061165, -0.041050344705581665, 0.011892341077327728, 0.05122048035264015, -0.012142551131546497, -0.02892789989709854, 0.037886686623096466, -0.0076443227007985115, -0.012074178084731102, -0.022731995210051537, -0.04222859814763069, 0.026964081451296806, -0.004999454133212566, -0.019331173971295357, 0.02517841011285782, 0.01972825825214386, -0.028741076588630676, -0.0834963396191597, 0.01880348101258278, -0.0048123616725206375, 0.02814601920545101, -0.009827789850533009, -0.0174968633800745, -0.00946891214698553, -0.048299986869096756, -0.018428537994623184, 0.0017992693465203047, -0.029930442571640015, -0.014147055335342884, -0.008235384710133076, 0.032324451953172684, -0.02636564150452614, 0.013583214953541756, 0.04010792821645737, 0.03818785771727562, 0.03471694514155388, -0.02909001149237156, -0.0007976278429850936, -0.013664085417985916, -0.011418526992201805, 0.01636441797018051, 0.03112337738275528, -0.005681261420249939, -0.004801077768206596, 0.009440057910978794, 0.0642019659280777, -0.043545566499233246, -0.04734223335981369, -0.036393798887729645, 0.0416845940053463, -0.008109533227980137, -0.0465412363409996, 0.00017621474398765713, -0.012763445265591145, -0.0004797254514414817, 0.07657137513160706, 0.0014842431992292404, -0.03944331407546997, 0.00932288821786642, 0.02125384472310543, -0.02632778137922287, 0.011657347902655602, -0.02134784683585167, 0.019981207326054573, 0.018471242859959602, 0.012689447030425072, -0.001896117813885212, 0.013248282484710217, -0.0009259096696041524, 0.02348756045103073, -0.006831454113125801, -0.021938644349575043, -0.030884861946105957, 0.015306483022868633, -0.03070124052464962, -0.007761373650282621, -0.05961945652961731, 0.011194217950105667, 0.035387422889471054, 0.01747814565896988, -0.016840219497680664, 0.024246951565146446, 0.028938010334968567, 0.007416460197418928, 0.03295203670859337, 0.0002897000522352755, 0.03195970878005028, 0.0535622239112854, -0.007531969342380762, -0.019521165639162064, -0.012029243633151054 ]
Fit More and Train Faster With ZeRO via DeepSpeed and FairScale
stas
January 19, 2021
zero-deepspeed-fairscale
guide
https://huggingface.co/blog/zero-deepspeed-fairscale
A guest blog post by Hugging Face fellow Stas Bekman As recent Machine Learning models have been growing much faster than the amount of GPU memory added to newly released cards, many users are unable to train or even just load some of those huge models onto their hardware. While there is an ongoing effort to distill some of those huge models to be of a more manageable size -- that effort isn't producing models small enough soon enough. In the fall of 2019 Samyam Rajbhandari, Jeff Rasley, Olatunji Ruwase and Yuxiong He published a paper: ZeRO: Memory Optimizations Toward Training Trillion Parameter Models, which contains a plethora of ingenious new ideas on how one could make their hardware do much more than what it was thought possible before. A short time later DeepSpeed has been released and it gave to the world the open source implementation of most of the ideas in that paper (a few ideas are still in works) and in parallel a team from Facebook released FairScale which also implemented some of the core ideas from the ZeRO paper. If you use the Hugging Face Trainer, as of transformers v4.2.0 you have the experimental support for DeepSpeed's and FairScale's ZeRO features. The new --sharded_ddp and --deepspeed command line Trainer arguments provide FairScale and DeepSpeed integration respectively. Here is the full documentation. This blog post will describe how you can benefit from ZeRO regardless of whether you own just a single GPU or a whole stack of them. # Huge Speedups with Multi-GPU Setups Let's do a small finetuning with translation task experiment, using a t5-large model and the finetune_trainer.py script which you can find under examples/seq2seq in the transformers GitHub repo. We have 2x 24GB (Titan RTX) GPUs to test with. This is just a proof of concept benchmarks so surely things can be improved further, so we will benchmark on a small sample of 2000 items for training and 500 items for evalulation to perform the comparisons. Evaluation does by default a beam search of size 4, so it's slower than training with the same number of samples, that's why 4x less eval items were used in these tests. Here are the key command line arguments of our baseline: export BS=16 python -m torch.distributed.launch --nproc_per_node=2 ./finetune_trainer.py \ --model_name_or_path t5-large --n_train 2000 --n_val 500 \ --per_device_eval_batch_size $BS --per_device_train_batch_size $BS \ --task translation_en_to_ro [...] We are just using the DistributedDataParallel (DDP) and nothing else to boost the performance for the baseline. I was able to fit a batch size (BS) of 16 before hitting Out of Memory (OOM) error. Note, that for simplicity and to make it easier to understand, I have only shown the command line arguments important for this demonstration. You will find the complete command line at this post. Next, we are going to re-run the benchmark every time adding one of the following: 1. --fp16 2. --sharded_ddp (fairscale) 3. --sharded_ddp --fp16 (fairscale) 4. --deepspeed without cpu offloading 5. --deepspeed with cpu offloading Since the key optimization here is that each technique deploys GPU RAM more efficiently, we will try to continually increase the batch size and expect the training and evaluation to complete faster (while keeping the metrics steady or even improving some, but we won't focus on these here). Remember that training and evaluation stages are very different from each other, because during training model weights are being modified, gradients are being calculated, and optimizer states are stored. During evaluation, none of these happen, but in this particular task of translation the model will try to search for the best hypothesis, so it actually has to do multiple runs before it's satisfied. That's why it's not fast, especially when a model is large. Let's look at the results of these six test runs: | Method | max BS | train time | eval time | |---------------------------|--------|-------------|-------------| | baseline | 16 | 30.9458 | 56.3310 | | fp16 | 20 | 21.4943 | 53.4675 | | sharded_ddp | 30 | 25.9085 | 47.5589 | | sharded_ddp+fp16 | 30 | 17.3838 | 45.6593 | | deepspeed w/o cpu offload | 40 | 10.4007 | 34.9289 | | deepspeed w/ cpu offload | 50 | 20.9706 | 32.1409 | It's easy to see that both FairScale and DeepSpeed provide great improvements over the baseline, in the total train and evaluation time, but also in the batch size. DeepSpeed implements more magic as of this writing and seems to be the short term winner, but Fairscale is easier to deploy. For DeepSpeed you need to write a simple configuration file and change your command line's launcher, with Fairscale you only need to add the --sharded_ddp command line argument, so you may want to try it first as it's the most low-hanging fruit. Following the 80:20 rule, I have only spent a few hours on these benchmarks and I haven't tried to squeeze every MB and second by refining the command line arguments and configuration, since it's pretty obvious from the simple table what you'd want to try next. When you will face a real project that will be running for hours and perhaps days, definitely spend more time to make sure you use the most optimal hyper-parameters to get your job done faster and at a minimal cost. If you would like to experiment with this benchmark yourself or want to know more details about the hardware and software used to run it, please, refer to this post. # Fitting A Huge Model Onto One GPU While Fairscale gives us a boost only with multiple GPUs, DeepSpeed has a gift even for those of us with a single GPU. Let's try the impossible - let's train t5-3b on a 24GB RTX-3090 card. First let's try to finetune the huge t5-3b using the normal single GPU setup: export BS=1 CUDA_VISIBLE_DEVICES=0 ./finetune_trainer.py \ --model_name_or_path t5-3b --n_train 60 --n_val 10 \ --per_device_eval_batch_size $BS --per_device_train_batch_size $BS \ --task translation_en_to_ro --fp16 [...] No cookie, even with BS=1 we get: RuntimeError: CUDA out of memory. Tried to allocate 64.00 MiB (GPU 0; 23.70 GiB total capacity; 21.37 GiB already allocated; 45.69 MiB free; 22.05 GiB reserved in total by PyTorch) Note, as earlier I'm showing only the important parts and the full command line arguments can be found here. Now update your transformers to v4.2.0 or higher, then install DeepSpeed: pip install deepspeed and let's try again, this time adding DeepSpeed to the command line: export BS=20 CUDA_VISIBLE_DEVICES=0 deepspeed --num_gpus=1 ./finetune_trainer.py \ --model_name_or_path t5-3b --n_train 60 --n_val 10 \ --per_device_eval_batch_size $BS --per_device_train_batch_size $BS \ --task translation_en_to_ro --fp16 --deepspeed ds_config_1gpu.json [...] et voila! We get a batch size of 20 trained just fine. I could probably push it even further. The program failed with OOM at BS=30. Here are the relevant results: 2021-01-12 19:06:31 | INFO | __main__ | train_n_objs = 60 2021-01-12 19:06:31 | INFO | __main__ | train_runtime = 8.8511 2021-01-12 19:06:35 | INFO | __main__ | val_n_objs = 10 2021-01-12 19:06:35 | INFO | __main__ | val_runtime = 3.5329 We can't compare these to the baseline, since the baseline won't even start and immediately failed with OOM. Simply amazing! I used only a tiny sample since I was primarily interested in being able to train and evaluate with this huge model that normally won't fit onto a 24GB GPU. If you would like to experiment with this benchmark yourself or want to know more details about the hardware and software used to run it, please, refer to this post. # The Magic Behind ZeRO Since transformers only integrated these fabulous solutions and wasn't part of their invention I will share the resources where you can discover all the details for yourself. But here are a few quick insights that may help understand how ZeRO manages these amazing feats. The key feature of ZeRO is adding distributed data storage to the quite familiar concept of data parallel training. The computation on each GPU is exactly the same as data parallel training, but the parameter, gradients and optimizer states are stored in a distributed/partitioned fashion across all the GPUs and fetched only when needed. The following diagram, coming from this blog post illustrates how this works: ZeRO's ingenious approach is to partition the params, gradients and optimizer states equally across all GPUs and give each GPU just a single partition (also referred to as a shard). This leads to zero overlap in data storage between GPUs. At runtime each GPU builds up each layer's data on the fly by asking participating GPUs to send the information it's lacking. This idea could be difficult to grasp, and you will find my attempt at an explanation here. As of this writing FairScale and DeepSpeed only perform Partitioning (Sharding) for the optimizer states and gradients. Model parameters sharding is supposedly coming soon in DeepSpeed and FairScale. The other powerful feature is ZeRO-Offload (paper). This feature offloads some of the processing and memory needs to the host's CPU, thus allowing more to be fit onto the GPU. You saw its dramatic impact in the success at running t5-3b on a 24GB GPU. One other problem that a lot of people complain about on pytorch forums is GPU memory fragmentation. One often gets an OOM error that may look like this: RuntimeError: CUDA out of memory. Tried to allocate 1.48 GiB (GPU 0; 23.65 GiB total capacity; 16.22 GiB already allocated; 111.12 MiB free; 22.52 GiB reserved in total by PyTorch) The program wants to allocate ~1.5GB and the GPU still has some 6-7GBs of unused memory, but it reports to have only ~100MB of contiguous free memory and it fails with the OOM error. This happens as chunks of different size get allocated and de-allocated again and again, and over time holes get created leading to memory fragmentation, where there is a lot of unused memory but no contiguous chunks of the desired size. In the example above the program could probably allocate 100MB of contiguous memory, but clearly it can't get 1.5GB in a single chunk. DeepSpeed attacks this problem by managing GPU memory by itself and ensuring that long term memory allocations don't mix with short-term ones and thus there is much less fragmentation. While the paper doesn't go into details, the source code is available, so it's possible to see how DeepSpeed accomplishes that. As ZeRO stands for Zero Redundancy Optimizer, it's easy to see that it lives up to its name. # The Future Besides the anticipated upcoming support for model params sharding in DeepSpeed, it already released new features that we haven't explored yet. These include DeepSpeed Sparse Attention and 1-bit Adam, which are supposed to decrease memory usage and dramatically reduce inter-GPU communication overhead, which should lead to an even faster training and support even bigger models. I trust we are going to see new gifts from the FairScale team as well. I think they are working on ZeRO stage 3 as well. Even more exciting, ZeRO is being integrated into pytorch. # Deployment If you found the results shared in this blog post enticing, please proceed here for details on how to use DeepSpeed and FairScale with the transformers Trainer. You can, of course, modify your own trainer to integrate DeepSpeed and FairScale, based on each project's instructions or you can "cheat" and see how we did it in the transformers Trainer. If you go for the latter, to find your way around grep the source code for deepspeed and/or sharded_ddp. The good news is that ZeRO requires no model modification. The only required modifications are in the training code. # Issues If you encounter any issues with the integration part of either of these projects please open an Issue in transformers. But if you have problems with DeepSpeed and FairScale installation, configuration and deployment - you need to ask the experts in their domains, therefore, please, use DeepSpeed Issue or FairScale Issue instead. # Resources While you don't really need to understand how any of these projects work and you can just deploy them via the transformers Trainer, should you want to figure out the whys and hows please refer to the following resources. * FairScale GitHub * DeepSpeed GitHub * Paper: ZeRO: Memory Optimizations Toward Training Trillion Parameter Models. The paper is very interesting, but it's very terse. * Here is a good video discussion of the paper with visuals * Paper: ZeRO-Offload: Democratizing Billion-Scale Model Training. Just published - this one goes into the details of ZeRO Offload feature. * DeepSpeed configuration and tutorials * In addition to the paper, I highly recommend to read the following detailed blog posts with diagrams: - DeepSpeed: Extreme-scale model training for everyone - ZeRO & DeepSpeed: New system optimizations enable training models with over 100 billion parameters - Turing-NLG: A 17-billion-parameter language model by Microsoft * DeepSpeed examples on GitHub # Gratitude We were quite astonished at the amazing level of support we received from the FairScale and DeepSpeed developer teams while working on integrating those projects into transformers. In particular I'd like to thank: * Benjamin Lefaudeux @blefaudeux * Mandeep Baines @msbaines from the FairScale team and: * Jeff Rasley @jeffra * Olatunji Ruwase @tjruwase * Samyam Rajbhandari @samyam from the DeepSpeed team for your generous and caring support and prompt resolution of the issues we have encountered. And HuggingFace for providing access to hardware the benchmarks were run on. Sylvain Gugger @sgugger and Stas Bekman @stas00 worked on the integration of these projects.
[ 0.03948094695806503, -0.02679992839694023, 0.0009490462834946811, 0.05087392032146454, 0.003981353715062141, 0.020355060696601868, 0.032237328588962555, 0.06172289326786995, 0.01853974163532257, -0.01891758292913437, -0.012640384025871754, 0.05784663185477257, -0.01670035533607006, 0.06491803377866745, 0.0330641008913517, -0.07233889400959015, -0.011584524996578693, -0.02303045429289341, -0.05515610799193382, 0.03124355711042881, 0.029417026787996292, -0.0570809431374073, 0.07743142545223236, 0.01650105230510235, -0.026603152975440025, -0.017160028219223022, 0.06767898052930832, 0.01576485112309456, 0.016698090359568596, 0.021733667701482773, -0.1341635137796402, -0.022748710587620735, -0.01842353492975235, -0.03582101687788963, 0.00035840104101225734, -0.02983553148806095, -0.08835519850254059, 0.08492062985897064, 0.032563384622335434, -0.002628543647006154, 0.01858602464199066, 0.02211698144674301, -0.099466472864151, -0.002331862458959222, -0.012031231075525284, -0.004687306936830282, -0.014190076850354671, 0.04485902562737465, -0.05525883287191391, -0.013619448989629745, -0.029575439170002937, 0.04572035372257233, -0.008781264536082745, 0.0018792004557326436, 0.045076701790094376, 0.0027787957806140184, -0.03515877202153206, -0.02800147235393524, -0.0015793271595612168, 0.03146319463849068, 0.026094812899827957, -0.005843171384185553, 0.002396009163931012, 0.021267330273985863, 0.008647036738693714, -0.030961403623223305, -0.02295968309044838, 0.004371890798211098, -0.04593648016452789, -0.046904321759939194, 0.05594649910926819, -0.015749679878354073, -0.013560543768107891, -0.01612841710448265, -0.02848801016807556, -0.0029694221448153257, -0.01589486375451088, -0.01295996643602848, 0.1134045198559761, 0.07335392385721207, -0.018497800454497337, 0.03487873449921608, 0.016492782160639763, 0.038075100630521774, 0.0019333193777129054, 0.03144101798534393, 0.023312855511903763, -0.052518460899591446, -0.08545878529548645, 0.07556401938199997, -0.030532410368323326, -0.05972351133823395, 0.029380882158875465, -0.0036379341036081314, 0.005028912331908941, -0.004621412139385939, -0.041513919830322266, 0.04174619913101196, 0.03697323799133301, -0.006680100690573454, 0.00370348384603858, -0.10995163023471832, -0.002880239626392722, -0.096195749938488, -0.028911354020237923, 0.060726530849933624, -0.0371263325214386, -0.08499200642108917, 0.008127257227897644, 0.04609989374876022, 0.0037533072754740715, 0.012438044883310795, -0.06047072634100914, 0.04465911537408829, -0.06091247871518135, 0.046419382095336914, -0.019235076382756233, 0.0027865362353622913, -0.005875535309314728, -0.002611699281260371, 0.010438884608447552, 0.09867853671312332, 0.04621366783976555, -0.08169861137866974, -0.017738761380314827, 0.11133695393800735, 0.02052420750260353, 0.018852319568395615, 0.0008304528892040253, -0.013133608736097813, -0.017832264304161072, -0.044101256877183914, 0.029767343774437904, -0.017844099551439285, 0.02151726931333542, -0.01702211983501911, 0.02414068952202797, -0.003955450374633074, -0.020772550255060196, 0.056852299720048904, -0.006911809090524912, 0.025177469477057457, 0.06740374118089676, -0.03195667266845703, 0.04577197879552841, -0.020461225882172585, -0.09885988384485245, 0.03270818665623665, -0.03708197548985481, -0.040071599185466766, -0.09914194792509079, 0.12600214779376984, -0.025077274069190025, -0.0695105642080307, 0.056106630712747574, 0.06891431659460068, -0.10126098245382309, -0.03221053630113602, -0.06878376752138138, -0.007780241314321756, -0.08120962232351303, -0.02125847525894642, -0.04270760715007782, -0.03337167575955391, -0.0052583361975848675, 0.026159213855862617, -0.005089469254016876, 0.06197988986968994, 0.010520923882722855, 0.0023344524670392275, -0.011973082087934017, 0.023169955238699913, 0.05773886665701866, -0.03456268087029457, -0.006885869428515434, 0.023086393252015114, 0.00936057884246111, 0.03049185499548912, -0.005827569402754307, -0.02897319756448269, -0.07608262449502945, 0.044348765164613724, 0.013061835430562496, 0.10508301854133606, 0.07153713703155518, -0.07885582000017166, 0.04276685789227486, 0.02715994045138359, -0.029767043888568878, -0.005934663582593203, -0.05948677659034729, 0.039480503648519516, 0.07558124512434006, -0.015198650769889355, 0.02724033035337925, -0.016469810158014297, -0.03744248300790787, 0.09872332215309143, 0.028925321996212006, 0.05037621781229973, 0.005679938476532698, 0.01310674101114273, 0.0386679545044899, -0.024082256481051445, 0.002547407289966941, -0.010851801373064518, -0.0562252439558506, -0.012449223548173904, -0.0160023532807827, 0.005091553088277578, 0.05241145193576813, -0.2039414942264557, 0.018659450113773346, -0.010881061665713787, -0.033088263124227524, -0.012624729424715042, 0.01631162501871586, 0.00818579364567995, -0.001273979782126844, -0.009931002743542194, 0.12940287590026855, -0.015376320108771324, -0.04576539993286133, -0.034660451114177704, 0.008443607948720455, 0.030984681099653244, 0.0342588797211647, 0.03682635352015495, -0.0042180209420621395, -0.09341767430305481, -0.011161944828927517, -0.04304402694106102, -0.10825808346271515, 0.06692814081907272, 0.011044731363654137, -0.015717584639787674, 0.00832192413508892, -0.02615528553724289, 0.009061017073690891, -0.007817490957677364, -0.06954873353242874, 0.05222364887595177, 0.04974127188324928, 0.03147050365805626, -0.029760684818029404, -0.02772875316441059, 0.039781466126441956, 0.06934460252523422, -0.0143775325268507, -0.06511716544628143, -0.05590079724788666, 0.05291606858372688, 0.003404017770662904, -0.08402678370475769, -0.0039817169308662415, 0.010860329493880272, -0.00195916835218668, -0.006865083239972591, -0.045638810843229294, 0.04981263726949692, -0.004479698371142149, 0.046472109854221344, -0.026396408677101135, 0.016615575179457664, 0.022236021235585213, -0.042731188237667084, -0.0410400927066803, -0.015132357366383076, -0.0071829394437372684, -0.010284742340445518, 0.02022307924926281, -0.013448736630380154, 0.016074366867542267, 0.004231300670653582, -0.005495346151292324, 0.025275344029068947, 0.014998500235378742, -0.03052305430173874, -0.018518492579460144, -0.026327237486839294, -0.02162911370396614, -0.011483397334814072, 0.007964828051626682, -0.008377877064049244, -0.02264687418937683, 0.05089728534221649, 0.01610037498176098, -0.013718776404857635, -0.030570972710847855, 0.0011536640813574195, 0.04485083371400833, 0.0039738756604492664, 0.005155978724360466, -0.02894606627523899, -0.013703837990760803, 0.02469034120440483, 0.0017404586542397738, -0.0645977109670639, 0.020580457523465157, -0.004096973221749067, -0.0097584780305624, 0.0015054126270115376, -0.015938345342874527, 0.002588108880445361, -0.02253207564353943, -0.011709592305123806, -0.02231747657060623, -0.001515460666269064, -0.08032219111919403, 0.016794148832559586, -0.02041490003466606, -0.024473335593938828, -0.030140725895762444, -0.022272465750575066, 0.029653875157237053, -0.023691169917583466, -0.011522822082042694, 0.022300798445940018, -0.0029098400846123695, 0.019074246287345886, -0.011034010909497738, -0.009224344976246357, -0.011996793560683727, 0.015295756049454212, 0.008260324597358704, -0.0136322733014822, 0.03808114305138588, 0.003474536817520857, -0.027885466814041138, -0.011092757806181908, 0.0005716803716495633, 0.0032810072880238295, -0.03164379298686981, 0.03381730616092682, 0.06087940186262131, 0.021121753379702568, 0.025338023900985718, -0.006589735858142376, 0.002730799140408635, -0.022824259474873543, -0.03469971939921379, 0.017881853505969048, -0.02155776135623455, -0.035213664174079895, -0.012132030911743641, -0.014975893311202526, -0.047232210636138916, 0.016141291707754135, 0.04294746741652489, -0.033217236399650574, 0.04297947138547897, 0.010617757216095924, 0.01221099216490984, 0.0006766233127564192, -0.011756113730370998, -0.02528861165046692, 0.03838491067290306, -0.027715152129530907, -0.018214797601103783, 0.028478972613811493, 0.017449315637350082, 0.03166840225458145, -0.011887706816196442, 0.039948657155036926, -0.014282623305916786, 0.02887086383998394, 0.007629578001797199, -0.03409455716609955, -0.06706587970256805, 0.018200842663645744, 0.01835419051349163, 0.005270701367408037, -0.02919181063771248, 0.02461548149585724, 0.019099343568086624, -0.06677898019552231, -0.05623474344611168, 0.01914951205253601, -0.07341203838586807, 0.024046236649155617, -0.006926293484866619, 0.00799251627177, -0.012611309997737408, -0.004172800574451685, 0.016665292903780937, -0.03666920214891434, 0.015174305997788906, 0.03890008479356766, -0.03919629007577896, -0.033009760081768036, -0.046156786382198334, 0.0022344456519931555, 0.011237791739404202, 0.003188558155670762, 0.011093649081885815, -0.023138465359807014, 0.034845273941755295, 0.02666153758764267, 0.028236063197255135, -0.048926942050457, 0.008319933898746967, 0.01024557463824749, 0.00874064676463604, -0.05507783964276314, 0.04979303851723671, 0.03425586223602295, -0.005399532150477171, 0.021513037383556366, 0.029342949390411377, -0.025051236152648926, 0.009635517373681068, -0.036688823252916336, -0.01951984502375126, 0.018533557653427124, -0.029253048822283745, -0.03932681679725647, -0.023794768378138542, 0.03982827067375183, 0.0037638391368091106, -0.0006850548670627177, -0.036129046231508255, -0.03388802707195282, 0.0312892347574234, 0.011857393197715282, 0.004440561402589083, 0.02560049667954445, 0.0029543391428887844, 0.029116349294781685, -0.044844694435596466, 0.013247448951005936, 0.019942481070756912, -0.027900569140911102, 0.03976140543818474, -0.023216037079691887, 0.008737768977880478, 0.022778088226914406, -0.015224723145365715, -0.029742520302534103, -0.02286600135266781, -0.02247060276567936, 0.028441790491342545, 0.02467731572687626, 0.01932242326438427, 0.014851127751171589, -0.0664563700556755, -0.030594434589147568, -0.031744539737701416, -0.005104405339807272, 0.0013205058639869094, 0.027210038155317307, 0.018185758963227272, -0.0035638862755149603, 0.04731206223368645, 0.009683881886303425, 0.02594153583049774, 0.02981429174542427, -0.052848365157842636, 0.0001923757663462311, 0.0238803643733263, -0.0354941189289093, -0.07371992617845535, 0.02456696517765522, 0.09694807231426239, -0.00019738271657843143, -0.03172052279114723, 0.011421279981732368, 0.017641130834817886, -0.005522020626813173, -0.03188428655266762, 0.009182835929095745, -0.022571129724383354, -0.010198607109487057, -0.0003331317566335201, 0.031207915395498276, 0.017469270154833794, -0.035887278616428375, -0.01434445008635521, 0.007869557477533817, -0.007010030094534159, -0.013812251389026642, -0.020141784101724625, -0.025111276656389236, 0.036063119769096375, 0.03850848972797394, 0.06245284527540207, -0.007476661819964647, -0.020226730033755302, 0.033415537327528, 0.0015679012285545468, 0.017613381147384644, 0.004064785782247782, -0.026737604290246964, 0.0036204480566084385, 0.07056456804275513, 0.04464664310216904, 0.11526672542095184, -0.02133772149682045, 0.009517533704638481, 0.015147324651479721, -0.005268558859825134, 0.028987573459744453, -0.02734254114329815, 0.012668098323047161, -0.022597242146730423, 0.034560807049274445, 0.0156283900141716, -0.0113633768633008, 0.03172697499394417, 0.01785854436457157, 0.021719740703701973, -0.05132810026407242, 0.009954984299838543, 0.01504986360669136, 0.019910195842385292, -0.02883320301771164, -0.019303876906633377, 0.04256070405244827, -0.05911554768681526, 0.013339274562895298, -0.006729444023221731, -0.034250713884830475, -0.02436302974820137, -0.021104326471686363, 0.016216425225138664, -0.020261991769075394, 0.05262455716729164, 0.005564439110457897, -0.001382114365696907, -0.047204144299030304, -0.015451925806701183, -0.01331312581896782, -0.04117070510983467, -0.0601339228451252, -0.05846303701400757, -0.002650307957082987, 0.011009734123945236, 0.017630118876695633, 0.0429893359541893, 0.017207255586981773, 0.03400629013776779, 0.009993964806199074, 0.032157860696315765, 0.05358687415719032, -0.029678091406822205, 0.013586080633103848, 0.0556965172290802, 0.045491766184568405, -0.009627935476601124, 0.003598834155127406, -0.037448495626449585, -0.02556522563099861, -0.005395132582634687, -0.04814028739929199, 0.04596924036741257, 0.00896559376269579, -0.004901156295090914, 0.016182806342840195, -0.021917058154940605, 0.042311787605285645, 0.014729944989085197, -0.010583358816802502, 0.04239432513713837, -0.018186181783676147, 0.0031436551362276077, 0.008663264103233814, -0.002030415227636695, 0.02335788868367672, 0.019129421561956406, 0.01901533082127571, -0.0531209371984005, 0.015488097444176674, 0.016804520040750504, -0.023404844105243683, 0.026739345863461494, 0.00650182506069541, -0.027584174647927284, 0.015373832546174526, 0.005564983002841473, 0.00681963749229908, 0.015792004764080048, 0.024172315374016762, -0.003258434822782874, -0.0225354190915823, 0.0030462529975920916, 0.03170397877693176, 0.041474226862192154, 0.006334403995424509, 0.014148717746138573, 0.04266425594687462, 0.038908232003450394, 0.028624124825000763, -0.024069827049970627, 0.01899569295346737, 0.026934586465358734, 0.05791381374001503, -0.03285842761397362, 0.0258156880736351, 0.029916912317276, 0.005093055311590433, 0.029209930449724197, 0.03256099671125412, -0.031652603298425674, -0.04203815758228302, -0.007260356564074755, 0.0678517147898674, -0.024466026574373245, -0.022532492876052856, -0.014444537460803986, 0.07455486804246902, 0.02046080492436886, 0.019444841891527176, -0.009171745739877224, 0.02134161815047264, 0.022433560341596603, 0.03219333291053772, 0.005741111468523741, 0.049572598189115524, -0.009724431671202183, -0.008238007314503193, 0.020537475124001503, 0.02958521991968155, 0.023429881781339645, -0.0014739675680175424, 0.011750031262636185, 0.0008710737456567585, -0.0374196395277977, -0.006179743446409702, 0.03862365335226059, 0.0006594305159524083, 0.05135369300842285, 0.010204869322478771, -0.013619150035083294, 0.00041680477443151176, 0.041249971836805344, -0.03387271240353584, -0.01687406748533249, -0.016519537195563316, 0.012658050283789635, -0.006858719978481531, 0.02819039300084114, -0.0011255592107772827, 0.022158831357955933, 0.03239409253001213, -0.004975528921931982, 0.02329074777662754, 0.04513559490442276, -0.027375442907214165, -0.01312763150781393, -0.00470350356772542, -0.03592539206147194, 0.003045617137104273, 0.027596483007073402, -0.02615734376013279, 0.005690029822289944, 0.04062240198254585, 0.019258493557572365, 0.009832266718149185, -0.0025513884611427784, 0.042968858033418655, 0.015102413482964039, -0.06182856485247612, 0.04912674054503441, 0.02883675880730152, -0.05592992901802063, 0.059501197189092636, -0.02114010602235794, -0.03863934427499771, -0.03136220574378967, 0.029991211369633675, 0.008494286797940731, 0.04335213452577591, -0.007143232971429825, -0.04020342603325844, -0.00016146499547176063, -0.03299691528081894, -0.007894338108599186, 0.03846488147974014, -0.0015493512619286776, -0.009690479375422001, 0.012673900462687016, 0.015025421045720577, -0.004669188987463713, -0.032502658665180206, -0.00034346821485087276, 0.019282007589936256, 0.01267419196665287, 0.009427038952708244, -0.041694942861795425, 0.01920536532998085, 0.01799585483968258, 0.02129056490957737, 0.051266495138406754, -0.03427065908908844, 0.010893123224377632, 0.007516948971897364, 0.02428331784904003, -0.008085445500910282, 0.008255642838776112, -0.04324712976813316, -0.008698707446455956, 0.015282287262380123, 0.025144051760435104, -0.007378605660051107, 0.018316783010959625, -0.0159909725189209, -0.006839406210929155, -0.045188527554273605, -0.004758760333061218, 0.020626192912459373, 0.0018586673540994525, 0.04218443110585213, 0.06125237047672272, 0.01557081937789917, 0.02262028306722641, -0.03153754025697708, 0.008126144297420979, -0.06519393622875214, 0.026806548237800598, 0.05656754970550537, -0.0046601686626672745, 0.0023434769827872515, -0.04562510922551155, 0.014260795898735523, 0.03153865784406662, -0.04735233634710312, -0.03354861959815025, 0.016901124268770218, 0.008534476161003113, -0.042457833886146545, 0.021371277049183846, 0.021387094631791115, -0.006619293242692947, 0.09299757331609726, -0.04473206400871277, -0.0018398771062493324, 0.021165627986192703, 0.006580264773219824, -0.08003617078065872, 0.01436055637896061, -0.024569306522607803, 0.023933181539177895, 0.001276737661100924, -0.003693538950756192, -0.006668872199952602, 0.011659721843898296, 0.017734406515955925, 0.011837666854262352, -0.009722409769892693, -0.002850924152880907, -0.006918841041624546, 0.02813679352402687, 0.027956845238804817, -0.026412442326545715, -0.01951250247657299, 0.010970480740070343, 0.025192152708768845, 0.0017296533333137631, -0.026456385850906372, -0.020760443061590195, 0.007055203430354595, 0.008049575611948967, 0.03349972143769264, -0.03796478733420372, 0.014194630086421967, 0.05500897765159607, -0.04664316400885582, -0.06691699475049973, -0.01937737874686718 ]
Faster TensorFlow models in Hugging Face Transformers
jplu
January 26, 2021
tf-serving
guide, nlp
https://huggingface.co/blog/tf-serving
How to create a SavedModel? SavedModel is the format expected by TensorFlow Serving. Since Transformers v4.2.0, creating a SavedModel has three additional features: 1. The sequence length can be modified freely between runs. 2. All model inputs are available for inference. 3. hidden states or attention are now grouped into a single output when returning them with output_hidden_states=True or output_attentions=True. Below, you can find the inputs and outputs representations of a TFBertForSequenceClassification saved as a TensorFlow SavedModel: The given SavedModel SignatureDef contains the following input(s): inputs['attention_mask'] tensor_info: dtype: DT_INT32 shape: (-1, -1) name: serving_default_attention_mask:0 inputs['input_ids'] tensor_info: dtype: DT_INT32 shape: (-1, -1) name: serving_default_input_ids:0 inputs['token_type_ids'] tensor_info: dtype: DT_INT32 shape: (-1, -1) name: serving_default_token_type_ids:0 The given SavedModel SignatureDef contains the following output(s): outputs['attentions'] tensor_info: dtype: DT_FLOAT shape: (12, -1, 12, -1, -1) name: StatefulPartitionedCall:0 outputs['logits'] tensor_info: dtype: DT_FLOAT shape: (-1, 2) name: StatefulPartitionedCall:1 Method name is: tensorflow/serving/predict To directly pass inputs_embeds (the token embeddings) instead of input_ids (the token IDs) as input, we need to subclass the model to have a new serving signature. The following snippet of code shows how to do so: python from transformers import TFBertForSequenceClassification import tensorflow as tf # Creation of a subclass in order to define a new serving signature class MyOwnModel(TFBertForSequenceClassification): # Decorate the serving method with the new input_signature # an input_signature represents the name, the data type and the shape of an expected input @tf.function(input_signature=[{ "inputs_embeds": tf.TensorSpec((None, None, 768), tf.float32, name="inputs_embeds"), "attention_mask": tf.TensorSpec((None, None), tf.int32, name="attention_mask"), "token_type_ids": tf.TensorSpec((None, None), tf.int32, name="token_type_ids"), }]) def serving(self, inputs): # call the model to process the inputs output = self.call(inputs) # return the formated output return self.serving_output(output) # Instantiate the model with the new serving method model = MyOwnModel.from_pretrained("bert-base-cased") # save it with saved_model=True in order to have a SavedModel version along with the h5 weights. model.save_pretrained("my_model", saved_model=True) The serving method has to be overridden by the new input_signature argument of the tf.function decorator. See the official documentation to know more about the input_signature argument. The serving method is used to define how will behave a SavedModel when deployed with TensorFlow Serving. Now the SavedModel looks like as expected, see the new inputs_embeds input: The given SavedModel SignatureDef contains the following input(s): inputs['attention_mask'] tensor_info: dtype: DT_INT32 shape: (-1, -1) name: serving_default_attention_mask:0 inputs['inputs_embeds'] tensor_info: dtype: DT_FLOAT shape: (-1, -1, 768) name: serving_default_inputs_embeds:0 inputs['token_type_ids'] tensor_info: dtype: DT_INT32 shape: (-1, -1) name: serving_default_token_type_ids:0 The given SavedModel SignatureDef contains the following output(s): outputs['attentions'] tensor_info: dtype: DT_FLOAT shape: (12, -1, 12, -1, -1) name: StatefulPartitionedCall:0 outputs['logits'] tensor_info: dtype: DT_FLOAT shape: (-1, 2) name: StatefulPartitionedCall:1 Method name is: tensorflow/serving/predict
[ -0.041339874267578125, -0.049804799258708954, 0.032409630715847015, -0.03409972041845322, 0.022476837038993835, 0.05720452219247818, 0.05594126880168915, 0.023000216111540794, -0.06624890118837357, 0.02380390278995037, -0.03659125044941902, 0.046761758625507355, 0.00038255579420365393, 0.03724838048219681, -0.04342617467045784, -0.0008942236308939755, 0.0618860125541687, -0.023943064734339714, -0.021739887073636055, 0.003961433190852404, -0.009037349373102188, -0.049439720809459686, -0.027912283316254616, -0.0364052839577198, 0.0009781335247680545, -0.040441419929265976, 0.03232540190219879, -0.002789716236293316, -0.00930419284850359, 0.04894457757472992, -0.07192440330982208, 0.011674176901578903, -0.0074938442558050156, -0.005017537157982588, -0.03684449568390846, 0.0032104921992868185, -0.12925560772418976, 0.031902991235256195, 0.030190380290150642, -0.03401976451277733, 0.0030607650987803936, 0.00961284339427948, -0.05553235486149788, 0.05624895542860031, 0.03428148105740547, -0.04805010184645653, -0.17759670317173004, 0.011490419507026672, -0.010306286625564098, -0.04437532648444176, -0.030288448557257652, 0.0036020062398165464, -0.019210686907172203, 0.05942175164818764, -0.010251075960695744, 0.03281073272228241, -0.019885661080479622, 0.005939923692494631, -0.03362346068024635, 0.05647023022174835, -0.0008542611612938344, 0.017348114401102066, 0.0540887825191021, 0.0627204179763794, 0.03900608792901039, -0.035597726702690125, 0.011866024695336819, 0.013511231169104576, -0.024363292381167412, -0.06098245829343796, -0.046238791197538376, -0.033541321754455566, 0.02866397053003311, 0.00487974938005209, -0.0022985273972153664, -0.07530339062213898, 0.013027387671172619, 0.0351162850856781, 0.08594270050525665, 0.078204445540905, 0.018822884187102318, 0.008497507311403751, 0.04999604821205139, 0.016272613778710365, 0.011113259941339493, -0.018632208928465843, 0.01822194643318653, -0.10984224081039429, 0.0020480554085224867, 0.07552178204059601, -0.020685598254203796, -0.0951041579246521, -0.01762722060084343, 0.012450375594198704, 0.03283502906560898, -0.016825173050165176, 0.035098422318696976, -0.029635021463036537, -0.02709108404815197, -0.02278999052941799, 0.0254204124212265, -0.03412356600165367, -0.05513470619916916, -0.018885061144828796, 0.005771638825535774, -0.04399000108242035, -0.0011998089030385017, -0.0721810907125473, 0.021373314782977104, -0.050652164965867996, -0.001182655105367303, -0.05455608665943146, -0.04194856807589531, 0.07681028544902802, -0.09301403164863586, 0.07680140435695648, -0.041806355118751526, -0.03757164627313614, -0.020332876592874527, 0.03745761141180992, 0.0077523523941636086, 0.08964354544878006, 0.0370170958340168, -0.059026025235652924, -0.018301047384738922, 0.06777476519346237, 0.007214908022433519, 0.045164503157138824, 0.059307362884283066, -0.011471494100987911, 0.02003975585103035, 0.02562594600021839, 0.031212937086820602, 0.007244240026921034, -0.023188352584838867, -0.0717252790927887, 0.003949341829866171, -0.052831366658210754, 0.0175566915422678, 0.016771024093031883, -0.012409307062625885, 0.06295575946569443, -0.016144566237926483, -0.043955329805612564, 0.0659477487206459, -0.03986020386219025, -0.010957839898765087, 0.03330615535378456, 0.08161352574825287, 0.005448185373097658, -0.04566511884331703, -0.004483315162360668, 0.029005512595176697, -0.03926519677042961, -0.000026952468033414334, 0.01641853153705597, -0.009840894490480423, 0.04094913229346275, -0.06912045925855637, -0.02544664405286312, 0.061568379402160645, -0.007007945794612169, -0.0033021927811205387, 0.03804413229227066, 0.04935465753078461, -0.02652735263109207, -0.01592826098203659, 0.014734208583831787, 0.07174009829759598, 0.01424475945532322, -0.03055836446583271, 0.0008105359156616032, 0.05845113843679428, 0.05612180009484291, 0.0303668063133955, 0.04655085876584053, 0.04587644338607788, 0.04630972445011139, 0.04398974031209946, -0.09310542047023773, -0.02737187035381794, 0.03247779980301857, -0.07094471156597137, 0.04901306331157684, 0.10118300467729568, -0.07993053644895554, 0.010646792128682137, -0.04562390595674515, -0.03161577135324478, 0.06203571707010269, -0.01762077584862709, 0.009534403681755066, 0.05549172684550285, -0.02853025682270527, 0.024262724444270134, -0.030655691400170326, -0.08494672924280167, 0.045456066727638245, 0.03555754944682121, 0.06690645217895508, 0.02894134819507599, 0.030086008831858635, -0.07755114883184433, -0.054910652339458466, 0.02872317098081112, 0.015244429931044579, 0.012963410466909409, -0.11839218437671661, 0.0406818613409996, -0.017715537920594215, 0.02730931155383587, -0.06026751920580864, 0.05131031200289726, -0.10428796708583832, 0.03156382590532303, -0.05422114208340645, -0.07928749173879623, -0.04190950095653534, -0.01768261380493641, -0.053681664168834686, 0.15474694967269897, 0.01337280124425888, -0.04109450802206993, -0.03597421571612358, -0.08505529165267944, 0.02637026458978653, -0.0004401425248943269, 0.04836668074131012, 0.0972885861992836, -0.07971861213445663, -0.024393446743488312, -0.050495248287916183, -0.019331639632582664, 0.027089813724160194, 0.049890872091054916, -0.03782402724027634, -0.020844656974077225, 0.07092677801847458, -0.003212584415450692, -0.053284917026758194, 0.02243158593773842, 0.013792809098958969, 0.04429979994893074, -0.0028315787203609943, -0.012556375004351139, 0.02916097827255726, 0.07476997375488281, -0.012328814715147018, -0.0013072226429358125, -0.021880215033888817, -0.07987911254167557, 0.04289477318525314, 0.044020991772413254, -0.07290804386138916, 0.06709413230419159, 0.00942504033446312, -0.019334524869918823, 0.011530363000929356, -0.013828306458890438, 0.03710541874170303, 0.00799484271556139, 0.0325106643140316, -0.04040801152586937, -0.037568576633930206, -0.02161788009107113, -0.03579726070165634, -0.0073508042842149734, -0.006392411421984434, 0.020283857360482216, 0.022007999941706657, -0.0013373657129704952, -0.020418766885995865, -0.015408285893499851, 0.01233577448874712, 0.0104972580447793, 0.013127493672072887, 0.038137856870889664, -0.024151114746928215, -0.02245071902871132, 0.00024730004952289164, -0.013853304088115692, 0.004642903804779053, 0.024035897105932236, 0.03870115429162979, -0.016451526433229446, 0.04133738577365875, 0.012948712334036827, -0.03344790264964104, -0.00479806587100029, 0.009716084226965904, 0.010398437269032001, 0.06740636378526688, 0.017620790749788284, -0.01099426206201315, -0.04685332253575325, 0.07448449730873108, -0.03228117898106575, -0.019845977425575256, -0.02601766400039196, -0.024232733994722366, -0.03787242993712425, 0.025074616074562073, 0.034347306936979294, -0.020977485924959183, -0.00944468379020691, 0.05323248729109764, 0.0031371591612696648, 0.002494930988177657, -0.09415370225906372, -0.04709014669060707, 0.00025864355848170817, 0.00524450046941638, 0.01263612974435091, 0.02062568999826908, 0.020278900861740112, 0.04293528571724892, -0.04095353186130524, 0.012293059378862381, -0.016474328935146332, 0.007276930846273899, 0.006327087990939617, 0.0663498267531395, -0.028700314462184906, 0.02922072447836399, -0.014881187118589878, 0.018529724329710007, 0.030402231961488724, 0.01754406839609146, -0.034140899777412415, 0.03773435205221176, 0.009383580647408962, -0.013359220698475838, -0.00671002920717001, 0.009723097085952759, 0.05025145784020424, 0.025457248091697693, -0.011146404780447483, -0.01928326115012169, -0.03556074947118759, -0.019208252429962158, -0.01937291771173477, 0.022724488750100136, -0.01630876399576664, 0.01231602393090725, 0.012592279352247715, 0.004913960117846727, 0.029248671606183052, -0.03558127209544182, -0.011959773488342762, -0.01703285239636898, -0.012608961202204227, -0.022280709818005562, -0.007295450195670128, -0.003257324220612645, 0.04300359636545181, 0.00826677493751049, 0.015371501445770264, -0.029920464381575584, -0.01619519665837288, -0.01742950640618801, -0.018736526370048523, 0.030735934153199196, 0.01798337884247303, 0.03099922463297844, 0.02111857943236828, 0.008495958521962166, 0.006993170361965895, 0.007202710025012493, -0.043875813484191895, -0.021889561787247658, -0.029991595074534416, -0.0038737624417990446, -0.05113758519291878, 0.07504747807979584, 0.025629019364714622, 0.0048751248978078365, -0.011403854005038738, 0.05401237681508064, -0.04289742186665535, 0.029980484396219254, -0.000736703397706151, 0.013817774131894112, -0.02844000980257988, 0.0377638004720211, -0.02086116559803486, -0.029776835814118385, 0.09833365678787231, 0.007857642136514187, -0.013977119699120522, -0.04435446485877037, -0.010578008368611336, 0.018637599423527718, 0.007364905439317226, 0.00547343585640192, -0.0036601098254323006, 0.020906006917357445, -0.007306106388568878, 0.005492884200066328, -0.009063107892870903, -0.044122885912656784, 0.024558262899518013, 0.0033925315365195274, -0.020472247153520584, 0.028579290956258774, 0.015131413005292416, 0.006694402080029249, -0.020578332245349884, 0.015081027522683144, 0.03713488206267357, -0.05337691307067871, 0.016447247937321663, 0.01974461041390896, 0.002906296867877245, -0.02759735658764839, -0.008654482662677765, -0.028044912964105606, 0.003679098794236779, -0.06392737478017807, -0.025727376341819763, 0.01122662890702486, 0.009270912036299706, -0.057534657418727875, 0.03829425573348999, 0.08027587085962296, -0.017995700240135193, -0.03897164389491081, -0.013916004449129105, 0.022023670375347137, -0.0028216480277478695, -0.005591487977653742, 0.024152832105755806, -0.024685554206371307, 0.017161931842565536, 0.01100347749888897, 0.01515884604305029, -0.000346646411344409, 0.010556140914559364, -0.001769944210536778, -0.04011688381433487, 0.007990502752363682, 0.04856765270233154, 0.03507331758737564, -0.012963320128619671, 0.02585253119468689, -0.018711242824792862, 0.017375366762280464, 0.033625319600105286, -0.014148413203656673, -0.022905856370925903, -0.009640811011195183, 0.0180278941988945, -0.048194512724876404, 0.03810432180762291, 0.006462244316935539, -0.01951257325708866, 0.01375381089746952, 0.01582641713321209, 0.01340754609555006, 0.03260783106088638, 0.04274548217654228, -0.04672950133681297, -0.08055146038532257, 0.012053104117512703, 0.01201007328927517, -0.00941288098692894, -0.04231783747673035, 0.026004595682024956, 0.024872519075870514, -0.05153965577483177, -0.0000210733778658323, 0.009921779856085777, 0.05630726367235184, 0.0506308488547802, 0.0195497814565897, -0.0021211435087025166, -0.10131533443927765, 0.02545478753745556, 0.004217488691210747, -0.0524844229221344, -0.02816946804523468, 0.05469324812293053, -0.015611250884830952, 0.005925992503762245, 0.05386406555771828, 0.07164964079856873, 0.039860621094703674, -0.0433775931596756, 0.026455797255039215, -0.0015354558127000928, -0.0074099283665418625, 0.009427535347640514, -0.006078704260289669, -0.014693927951157093, 0.008037399500608444, 0.019240740686655045, 0.0730624794960022, 0.02345145307481289, 0.03668781369924545, 0.0020296890288591385, -0.009442274458706379, 0.02787109650671482, -0.016766346991062164, -0.006013219710439444, -0.00821197871118784, -0.014552753418684006, -0.009858600795269012, -0.03663560375571251, 0.018992463126778603, 0.05971462279558182, 0.07159418612718582, -0.00722693745046854, 0.009548950009047985, 0.022411972284317017, 0.007087843492627144, 0.005708630662411451, 0.0026783461216837168, 0.05122935771942139, -0.051456645131111145, 0.022316956892609596, -0.0043686251156032085, 0.017079738900065422, 0.027339963242411613, -0.011972571723163128, -0.02258790284395218, -0.03110002912580967, -0.016220778226852417, 0.013400055468082428, 0.03658989444375038, -0.03921321779489517, 0.007693800609558821, -0.01351122185587883, -0.02532043866813183, 0.0010306118056178093, -0.031214028596878052, 0.009239506907761097, 0.0433540903031826, -0.0250552985817194, 0.019789164885878563, 0.02004825323820114, 0.009253875352442265, -0.01292447280138731, 0.00793229416012764, 0.002167743630707264, -0.013060345314443111, -0.015832524746656418, 0.001490865251980722, 0.047332897782325745, -0.030911210924386978, -0.04789511486887932, -0.01994120329618454, -0.05601634085178375, 0.031911224126815796, -0.05289144068956375, 0.001316405483521521, 0.0809263214468956, -0.03889542445540428, -0.013111433014273643, -0.0023569322656840086, 0.0070545971393585205, -0.004089603200554848, 0.03210529312491417, -0.004441690631210804, 0.0037200460210442543, -0.03801487013697624, 0.03466787934303284, 0.010908086784183979, 0.013304176740348339, -0.010201743803918362, 0.001481125713326037, -0.014468000270426273, -0.022592129185795784, 0.004956064745783806, 0.008649643510580063, 0.06237856671214104, 0.012088651768863201, -0.04102490097284317, 0.027804920449852943, 0.023665854707360268, 0.0032545423600822687, 0.029043233022093773, 0.005684720817953348, 0.02491418458521366, -0.02097133733332157, 0.0025895857252180576, 0.01751735992729664, 0.05108368396759033, -0.037007179111242294, 0.08024878054857254, 0.005693740211427212, 0.019155194982886314, -0.009080128744244576, 0.03879653289914131, 0.005299767479300499, 0.001455375924706459, 0.0707891657948494, 0.03180234506726265, -0.035952359437942505, 0.02269994094967842, 0.022112131118774414, -0.026917746290564537, -0.00688933627679944, 0.005215844139456749, -0.04889547452330589, -0.000480534799862653, 0.028857681900262833, -0.012032901868224144, 0.02510092966258526, 0.01701449602842331, 0.05066671222448349, 0.05096917971968651, -0.01082694623619318, -0.027224043384194374, 0.04852977395057678, 0.07391040027141571, 0.024652943015098572, 0.015782451257109642, -0.006323134992271662, -0.012279610149562359, -0.027975032106041908, 0.02839687280356884, -0.00341863208450377, -0.0069893887266516685, 0.00044581678230315447, -0.0015830273041501641, 0.02451145276427269, -0.011638632975518703, -0.04882444068789482, -0.01405637152493, 0.028475461527705193, 0.04508399963378906, -0.022285666316747665, 0.029110712930560112, -0.03553372994065285, 0.00032329009263776243, -0.0039069633930921555, -0.002459738403558731, -0.06622003018856049, -0.016737882047891617, -0.024162182584404945, 0.04843838885426521, -0.011625772342085838, -0.04889568313956261, -0.007914581336081028, -0.0009495900594629347, 0.008149615488946438, -0.009945275261998177, -0.0007496633916161954, 0.023745685815811157, -0.025740714743733406, 0.025711718946695328, -0.020266300067305565, 0.026302313432097435, -0.0012175645679235458, 0.011152368038892746, 0.01858746074140072, 0.038439858704805374, 0.00835004448890686, 0.04945700243115425, 0.03145492449402809, 0.025594446808099747, -0.0022826427593827248, -0.006599677726626396, -0.03374655544757843, -0.00894701573997736, -0.0025175740011036396, -0.01259409636259079, -0.020416315644979477, -0.007821902632713318, 0.0567108578979969, 0.014921904541552067, 0.05526144802570343, -0.011410905979573727, -0.01715945266187191, -0.002791471779346466, -0.047304823994636536, 0.014408566989004612, 0.03506582975387573, -0.013130138628184795, 0.013997147791087627, 0.007355571258813143, 0.010568411089479923, -0.025960292667150497, -0.007509436458349228, 0.019463922828435898, 0.018805906176567078, -0.04107574746012688, 0.01040801964700222, -0.037773434072732925, 0.05516417697072029, 0.03498854860663414, 0.011408896185457706, 0.016905395314097404, 0.004262255039066076, -0.004514312371611595, -0.020788894966244698, 0.00011579050624277443, -0.04958022013306618, -0.03871150314807892, -0.031842585653066635, -0.05359092727303505, -0.03597356751561165, -0.0008686923538334668, -0.008515791967511177, 0.029360922053456306, -0.043710727244615555, -0.03829285874962807, -0.02078097313642502, -0.00465801078826189, -0.0038082865066826344, 0.003793432144448161, 0.04134748503565788, 0.008704502135515213, 0.006885163020342588, -0.0028088747058063745, -0.056521300226449966, -0.04088464379310608, 0.022123361006379128, 0.023164864629507065, 0.021925410255789757, -0.016775351017713547, -0.0037284824065864086, 0.016399718821048737, 0.018808802589774132, -0.010506313294172287, -0.03195183724164963, -0.008294956758618355, -0.009110803715884686, -0.030481083318591118, -0.027155283838510513, -0.02093205600976944, 0.0165196992456913, 0.04560249671339989, 0.010014700703322887, 0.011916999705135822, 0.01907988078892231, -0.013997511938214302, 0.039627768099308014, -0.018282150849699974, -0.007081140298396349, 0.0033362493850290775, -0.008880999870598316, -0.028476305305957794, 0.005529364105314016, 0.024806329980492592, 0.013705015182495117, 0.008725009858608246, 0.050113555043935776, 0.007233497686684132, -0.014738681726157665, -0.024646051228046417, -0.0005415274063125253, 0.03231139853596687, -0.034152012318372726, -0.02527712471783161, 0.005287385545670986, 0.030089927837252617, -0.05501091480255127, 0.021422771736979485, 0.0293844286352396, 0.032284773886203766, -0.019117891788482666, -0.036993663758039474, -0.009762786328792572, 0.019888082519173622, 0.012157737277448177, -0.020490048453211784, -0.03721437230706215, 0.011992093175649643 ]
Faster TensorFlow models in Hugging Face Transformers
jplu
January 26, 2021
tf-serving
guide, nlp
https://huggingface.co/blog/tf-serving
Step 1 Create a SavedModel. To create a SavedModel, the Transformers library lets you load a PyTorch model called nateraw/bert-base-uncased-imdb trained on the IMDB dataset and convert it to a TensorFlow Keras model for you: python from transformers import TFBertForSequenceClassification model = TFBertForSequenceClassification.from_pretrained("nateraw/bert-base-uncased-imdb", from_pt=True) # the saved_model parameter is a flag to create a SavedModel version of the model in same time than the h5 weights model.save_pretrained("my_model", saved_model=True)
[ -0.02728656306862831, -0.02615240588784218, -0.04580051079392433, -0.01679580844938755, 0.010448095388710499, 0.07295159250497818, 0.06312064081430435, 0.009810728952288628, -0.0005341575015336275, -0.0004835269064642489, -0.08127646893262863, 0.052658434957265854, -0.00016483900253660977, 0.057287026196718216, 0.019141439348459244, -0.058577634394168854, 0.09538857638835907, -0.03582899272441864, 0.01638275571167469, 0.015622072853147984, -0.009636316448450089, -0.044265586882829666, 0.022243782877922058, 0.020666655153036118, -0.0029159074183553457, -0.0197156835347414, 0.05105483904480934, 0.05321007966995239, -0.016264084726572037, 0.023139026015996933, -0.048505764454603195, -0.05418796092271805, 0.03667706623673439, -0.047593846917152405, -0.017957355827093124, 0.04434346780180931, -0.06492697447538376, 0.06429305672645569, 0.04446865990757942, -0.05038323253393173, -0.037081748247146606, 0.05110105499625206, -0.034754954278469086, 0.04630332812666893, -0.03604734316468239, -0.051138050854206085, -0.11068659275770187, 0.039775311946868896, 0.027243949472904205, -0.03253500163555145, -0.060846030712127686, 0.02009022794663906, -0.0016885497607290745, 0.05338440462946892, 0.03021480143070221, 0.07739446312189102, 0.011159827932715416, -0.07628332823514938, 0.016301292926073074, 0.07731010019779205, 0.049877751618623734, 0.040739208459854126, -0.013187715783715248, 0.010486447252333164, 0.06738762557506561, 0.03173168748617172, 0.008989638648927212, -0.0058096060529351234, -0.021169275045394897, 0.02564406581223011, -0.013065985403954983, -0.07112554460763931, -0.013060557655990124, -0.022979868575930595, 0.006530327722430229, -0.04609226435422897, 0.0015075493138283491, 0.02640734799206257, 0.03427455574274063, 0.026981856673955917, 0.006363982800394297, 0.004088415764272213, -0.0026967048179358244, 0.053121376782655716, 0.034397754818201065, 0.009602015838027, 0.04638165235519409, -0.06834641098976135, -0.03152753412723541, 0.07747899740934372, -0.048390861600637436, -0.06041966751217842, -0.019033480435609818, -0.04365325719118118, 0.018445724621415138, -0.04949644207954407, -0.06455262750387192, 0.007610016502439976, -0.02167305164039135, -0.004460278898477554, 0.019265202805399895, -0.12671665847301483, 0.03492247313261032, -0.058759260922670364, -0.01735050603747368, -0.02361193858087063, -0.01573280617594719, -0.06836746633052826, -0.045208174735307693, -0.04866057261824608, -0.008717012591660023, -0.0013818140141665936, -0.02387526072561741, 0.07738035917282104, -0.07412232458591461, 0.03161953389644623, 0.05565102398395538, -0.025199905037879944, -0.025392472743988037, 0.05966167151927948, -0.017184920608997345, 0.07006919384002686, 0.03547794371843338, -0.0044093262404203415, 0.024915846064686775, 0.0746576189994812, -0.0006448689964599907, 0.01849338226020336, 0.010225814767181873, 0.05777043476700783, 0.04214965179562569, 0.0018361969850957394, 0.06793713569641113, -0.01618918590247631, -0.038565997034311295, -0.035195402801036835, -0.06552683562040329, -0.05425543338060379, -0.028332959860563278, -0.029118163511157036, 0.0074457572773098946, 0.0987783670425415, -0.020907703787088394, 0.014128095470368862, 0.019091332331299782, -0.0003145868831779808, 0.004970211070030928, 0.11817234754562378, 0.05141352862119675, 0.030035508796572685, -0.10775385797023773, 0.04430883005261421, -0.03246932104229927, -0.05472287908196449, -0.023286109790205956, 0.05042833834886551, -0.024819739162921906, -0.024515526369214058, -0.004871863406151533, -0.018621714785695076, 0.07539278268814087, -0.020815759897232056, -0.03261461481451988, -0.03290664032101631, 0.0364159494638443, -0.0914573147892952, -0.009144703857600689, -0.04825228452682495, 0.032054223120212555, -0.04237229377031326, -0.003199351951479912, -0.02359202317893505, 0.09945458918809891, -0.013409585691988468, -0.028821608051657677, 0.04902159050107002, 0.028755519539117813, 0.03158680349588394, 0.0081268809735775, -0.06887993961572647, -0.034222107380628586, 0.08485338091850281, -0.022587161511182785, 0.02201893925666809, 0.05691812187433243, -0.053161270916461945, 0.032608821988105774, -0.03807065635919571, -0.07278826087713242, 0.08957633376121521, -0.03801579400897026, -0.00950924213975668, 0.050965648144483566, -0.04298173636198044, 0.0395004041492939, -0.04594725742936134, -0.06084001064300537, 0.10126993805170059, 0.01785953901708126, 0.05262279137969017, 0.028217852115631104, -0.017731137573719025, 0.004051074385643005, -0.06497722119092941, 0.013654488138854504, -0.046038176864385605, -0.03699764236807823, -0.09397147595882416, 0.03469068557024002, -0.018173614516854286, 0.019208475947380066, -0.06942234933376312, 0.07776720076799393, -0.17069284617900848, 0.013667521066963673, -0.08433019369840622, -0.0942009910941124, -0.022813070565462112, -0.024140840396285057, 0.024254372343420982, 0.13875707983970642, 0.02397000417113304, -0.008419811725616455, -0.04165266454219818, -0.035395488142967224, 0.05228595435619354, -0.020579904317855835, 0.033730003982782364, 0.097601018846035, -0.07512784749269485, -0.04390297457575798, -0.045929744839668274, -0.013177656568586826, 0.052058860659599304, -0.0238373763859272, -0.025914043188095093, -0.014430053532123566, -0.007905244827270508, -0.017286036163568497, -0.01607200875878334, 0.0465787835419178, 0.00895578134804964, -0.014834281988441944, 0.0023433861788362265, -0.013667436316609383, 0.03709769621491432, 0.0603865310549736, 0.007111307233572006, -0.008800425566732883, -0.044730596244335175, -0.0632486417889595, 0.0088111637160182, 0.011216795071959496, -0.06422505527734756, -0.016506608575582504, 0.05029798299074173, -0.017836976796388626, 0.0007016159943304956, -0.018190408125519753, 0.027760716155171394, 0.012155815027654171, 0.0032237113919109106, -0.024335753172636032, -0.024233028292655945, -0.04219476878643036, -0.015314516611397266, -0.02341848611831665, -0.002700761193409562, 0.015962284058332443, 0.023304825648665428, 0.014772288501262665, -0.060685064643621445, 0.022889072075486183, 0.026881765574216843, 0.027910280972719193, 0.05930176377296448, 0.014716495759785175, -0.002214588224887848, -0.033295921981334686, -0.0406523123383522, 0.0011246310314163566, -0.025675704702734947, 0.008794543333351612, 0.023968640714883804, 0.018291115760803223, -0.005173049867153168, 0.0071023148484528065, -0.052988678216934204, 0.05191059410572052, 0.03562323376536369, 0.027686797082424164, 0.05817469581961632, -0.015800807625055313, -0.009438768960535526, 0.011145367287099361, 0.013439285568892956, -0.025915872305631638, -0.01988125406205654, 0.0034125102683901787, -0.017501428723335266, -0.016389155760407448, 0.023290174081921577, 0.017175162211060524, 0.01241570245474577, -0.015800030902028084, 0.049683649092912674, 0.018864281475543976, 0.005718608852475882, -0.09217587858438492, -0.006476337090134621, 0.021809717640280724, -0.002431902103126049, 0.013137013651430607, -0.021929234266281128, 0.04356399551033974, 0.02256663888692856, -0.038109973073005676, 0.05999285355210304, 0.00406967056915164, 0.001775945071130991, 0.035489827394485474, 0.02215476892888546, -0.006688987370580435, -0.042586084455251694, -0.019045133143663406, 0.002760745119303465, 0.02939685992896557, 0.05022100731730461, -0.03493352606892586, 0.006271627731621265, 0.015421449206769466, 0.03188653290271759, -0.0170274768024683, -0.034381039440631866, 0.016679955646395683, 0.04477936029434204, -0.0020824929233640432, -0.010440449230372906, 0.01328460406512022, -0.05161237716674805, -0.010975439101457596, 0.004064491484314203, -0.019853690639138222, -0.012711216695606709, -0.03652083873748779, 0.06565510481595993, 0.0313657745718956, 0.015061469748616219, -0.033059004694223404, 0.004073359537869692, -0.03002612479031086, -0.009289431385695934, 0.026708869263529778, -0.013473630882799625, 0.00161056499928236, 0.012006214819848537, 0.021909790113568306, -0.06486299633979797, -0.00324858701787889, -0.005683868192136288, 0.009833591990172863, 0.07013539224863052, -0.007289387285709381, 0.013797955587506294, 0.04997802525758743, 0.010102644562721252, 0.019509432837367058, -0.009662175551056862, -0.035411812365055084, 0.005585005972534418, -0.009724787436425686, -0.05968674644827843, -0.0034456709399819374, 0.05116146802902222, 0.03441326320171356, 0.04919274523854256, -0.01318349875509739, 0.03679608553647995, -0.01848173886537552, -0.005700662266463041, 0.026929372921586037, 0.009969966486096382, -0.00710285734385252, 0.026277294382452965, -0.014907483011484146, -0.01163641456514597, 0.02716791070997715, 0.021824277937412262, -0.0022987034171819687, -0.056928567588329315, -0.029504787176847458, -0.01400079857558012, 0.0074829519726336, 0.003534020157530904, 0.007467241492122412, -0.024076344445347786, 0.02735578641295433, 0.0040364633314311504, 0.009089922532439232, -0.0012749432353302836, 0.0064589097164571285, 0.05370423197746277, -0.05431210994720459, -0.01673925295472145, 0.033861879259347916, 0.016374725848436356, -0.004948906134814024, 0.02177358791232109, 0.0330672562122345, 0.006519173737615347, -0.024194033816456795, -0.008691270835697651, 0.014982509426772594, 0.0024027025792747736, -0.009607472456991673, -0.026920128613710403, 0.01366219948977232, -0.04737795144319534, -0.031224891543388367, 0.010176545940339565, -0.008674774318933487, 0.0018960144370794296, 0.029482442885637283, 0.03596197068691254, -0.020274648442864418, -0.04785547032952309, -0.056434132158756256, 0.046871885657310486, -0.027455026283860207, 0.05424962565302849, 0.02874746546149254, -0.04769260808825493, -0.009025610983371735, -0.02261686883866787, 0.0385526567697525, -0.0008913902565836906, 0.0044027711264789104, -0.03222724795341492, -0.038942787796258926, 0.0021663194056600332, 0.008332439698278904, 0.014013341628015041, 0.014233705587685108, -0.018135571852326393, 0.010230707004666328, -0.0008606291958130896, 0.012627904303371906, -0.0011963307624682784, 0.007196659687906504, -0.011536196805536747, 0.045293938368558884, -0.03031894378364086, 0.03773661330342293, -0.007785553112626076, -0.04037808999419212, 0.027018984779715538, -0.016043540090322495, 0.040350690484046936, 0.016032008454203606, 0.033316321671009064, -0.028207726776599884, -0.022570913657546043, 0.055220358073711395, 0.03135969117283821, 0.0001881054777186364, 0.009365524165332317, 0.030159829184412956, 0.024021929129958153, 0.011107129044830799, -0.01176073681563139, -0.034369826316833496, 0.025386562570929527, 0.025396866723895073, 0.008349638432264328, 0.0019473120337352157, -0.0517507828772068, 0.02075478434562683, 0.009766957722604275, -0.033534206449985504, -0.03215036168694496, 0.012168684042990208, -0.03453009948134422, 0.013742633163928986, 0.053944122046232224, 0.03384746238589287, 0.015488386154174805, -0.007863282226026058, 0.024669911712408066, 0.0016654100036248565, -0.006642913445830345, 0.01586359366774559, 0.030026134103536606, -0.020807424560189247, 0.03682515397667885, 0.016045933589339256, 0.044092703610658646, -0.0021342297550290823, 0.034962136298418045, 0.014535405673086643, -0.014661062508821487, 0.04571004584431648, -0.02676190249621868, -0.02342521771788597, -0.007921088486909866, -0.0012002489529550076, -0.008779402822256088, -0.02254680171608925, -0.022049056366086006, 0.027704184874892235, 0.06967359036207199, -0.027864353731274605, -0.03440483286976814, 0.04832947254180908, -0.046068765223026276, -0.03298453241586685, -0.008253972977399826, 0.02418440580368042, -0.02882028929889202, 0.01959860324859619, 0.016779614612460136, 0.021277721971273422, 0.019639598205685616, -0.012224188074469566, 0.015194889158010483, -0.007398925255984068, 0.03278906270861626, 0.037529073655605316, 0.037323348224163055, 0.009669814258813858, -0.030032401904463768, -0.006841652095317841, 0.014984916895627975, 0.0007019757176749408, -0.037019431591033936, 0.021018074825406075, 0.012546163983643055, -0.00592265697196126, 0.02052134834229946, 0.027932345867156982, 0.0018835666123777628, -0.003865103470161557, 0.03683662787079811, 0.0005558250704780221, -0.01633872091770172, 0.007754079066216946, -0.0048079704865813255, 0.009594925679266453, -0.060004230588674545, -0.008681660518050194, -0.024196632206439972, -0.010006697848439217, 0.011818555183708668, -0.02011485956609249, 0.05154884606599808, 0.0804150328040123, -0.03021893836557865, 0.06036851555109024, -0.009304609149694443, 0.029513925313949585, 0.04320916533470154, -0.041331902146339417, 0.006300136912614107, 0.007031604647636414, -0.001926936092786491, 0.06409045308828354, 0.014399690553545952, -0.015784211456775665, 0.020959870889782906, 0.01729128696024418, -0.03318540379405022, -0.02787778154015541, 0.023133622482419014, -0.00173023936804384, 0.018766433000564575, 0.0014461298706009984, -0.053896136581897736, 0.025187285616993904, -0.009041376411914825, -0.010004936717450619, 0.06202353909611702, -0.012215455062687397, 0.0064051151275634766, 0.0035021165385842323, -0.0010408867383375764, 0.016261130571365356, 0.013643769547343254, -0.055485084652900696, 0.033635396510362625, 0.023839320987462997, 0.010257906280457973, 0.02787226065993309, 0.0024717848282307386, -0.009325441904366016, 0.010416485369205475, 0.04324019327759743, -0.0049024042673408985, 0.05549925938248634, 0.044488921761512756, -0.020758530125021935, 0.008550482802093029, -0.02043396793305874, -0.007182636763900518, -0.017149707302451134, 0.01750902645289898, 0.01822040043771267, 0.0025006094947457314, 0.02418159693479538, -0.003993489779531956, 0.07417343556880951, 0.02609015256166458, 0.019737830385565758, -0.0019746627658605576, 0.04172628000378609, 0.04538879171013832, 0.023587441071867943, -0.027181733399629593, 0.012567494995892048, -0.004720429424196482, -0.0034371879883110523, 0.030404966324567795, -0.00357837718911469, 0.006675548851490021, 0.002688345266506076, 0.009271268732845783, 0.043357282876968384, 0.024135803803801537, -0.03683491423726082, 0.014270267449319363, -0.022727856412529945, -0.0343746691942215, 0.001049224054440856, 0.018085051327943802, -0.04181279242038727, 0.02574300952255726, -0.0013425707584246993, -0.01065041683614254, -0.041823990643024445, -0.0009019318385981023, -0.048670392483472824, 0.024585340172052383, -0.021624431014060974, -0.028746765106916428, 0.0045678699389100075, 0.027859125286340714, 0.028040021657943726, 0.024510011076927185, -0.007912509143352509, -0.010215478017926216, -0.013425604440271854, -0.029706863686442375, -0.03868615999817848, 0.008351185359060764, -0.008251689374446869, -0.03328429162502289, -0.006657923571765423, 0.024038536474108696, 0.015796631574630737, 0.029248960316181183, -0.025205114856362343, 0.02274133823812008, 0.010538642294704914, 0.022451352328062057, 0.008504270575940609, -0.027128916233778, 0.03188428655266762, -0.020795881748199463, 0.009066863916814327, 0.03892290219664574, 0.024234168231487274, 0.04288432374596596, -0.002661713631823659, -0.012430839240550995, -0.0957154631614685, 0.025810515508055687, -0.006450854707509279, -0.038800034672021866, 0.04887032136321068, 0.009850860573351383, 0.024852754548192024, 0.014339650049805641, -0.024190133437514305, -0.030702734366059303, -0.011845117434859276, -0.006741154007613659, 0.028804434463381767, -0.05713488161563873, -0.03111138939857483, -0.033399950712919235, 0.046235717833042145, -0.006283826194703579, -0.043222080916166306, 0.06016622111201286, -0.03778280317783356, -0.020160751417279243, -0.03701614961028099, 0.03393414616584778, -0.02403625287115574, 0.022278225049376488, -0.028558755293488503, -0.05601391941308975, -0.046545106917619705, 0.023979036137461662, -0.03989509865641594, -0.027830781415104866, -0.07681320607662201, -0.02510012313723564, -0.03301975503563881, 0.02040782757103443, -0.03053334169089794, 0.02215159498155117, 0.03200196474790573, 0.06528914719820023, -0.0055856904946267605, 0.02913370169699192, -0.05565745010972023, -0.02196032553911209, -0.0013222156558185816, 0.038495756685733795, 0.017655860632658005, 0.0009744330891408026, -0.00048183719627559185, -0.007213215343654156, -0.020767582580447197, -0.004902406595647335, -0.0691843256354332, -0.01068675983697176, 0.02350257895886898, -0.018360672518610954, -0.022913863882422447, -0.0226068627089262, 0.012780812568962574, 0.03512817621231079, 0.007240663282573223, -0.004545746371150017, -0.028282249346375465, -0.03470517694950104, 0.03210016340017319, -0.03192787244915962, 0.012726935558021069, -0.03498481214046478, 0.0008714388823136687, -0.005520232021808624, -0.01468799076974392, 0.020077254623174667, 0.0434420108795166, 0.022588729858398438, 0.03863189369440079, 0.040852561593055725, 0.012328182347118855, -0.009688233025372028, -0.020875073969364166, 0.06287650763988495, -0.026229312643408775, -0.023711523041129112, 0.07065674662590027, 0.026437908411026, -0.02966100536286831, -0.028990942984819412, -0.008444217033684254, 0.03205016627907753, 0.007604194805026054, -0.02239578403532505, -0.001387939089909196, 0.04025282338261604, 0.03459291160106659, -0.03176557272672653, 0.004136733710765839, 0.0039637465961277485 ]
Faster TensorFlow models in Hugging Face Transformers
jplu
January 26, 2021
tf-serving
guide, nlp
https://huggingface.co/blog/tf-serving
Step 2 Create a Docker container with the SavedModel and run it. First, pull the TensorFlow Serving Docker image for CPU (for GPU replace serving by serving:latest-gpu): docker pull tensorflow/serving Next, run a serving image as a daemon named serving_base: docker run -d --name serving_base tensorflow/serving copy the newly created SavedModel into the serving_base container's models folder: docker cp my_model/saved_model serving_base:/models/bert commit the container that serves the model by changing MODEL_NAME to match the model's name (here bert), the name (bert) corresponds to the name we want to give to our SavedModel: docker commit --change "ENV MODEL_NAME bert" serving_base my_bert_model and kill the serving_base image ran as a daemon because we don't need it anymore: docker kill serving_base Finally, Run the image to serve our SavedModel as a daemon and we map the ports 8501 (REST API), and 8500 (gRPC API) in the container to the host and we name the the container bert. docker run -d -p 8501:8501 -p 8500:8500 --name bert my_bert_model
[ 0.0012698413338512182, -0.047128062695264816, -0.02394547127187252, -0.01164995413273573, 0.019336888566613197, 0.08499730378389359, 0.02399793639779091, 0.023667730391025543, -0.07010738551616669, -0.03479163721203804, -0.0753205418586731, 0.0353904590010643, 0.0010284911841154099, 0.09435723721981049, 0.01785116456449032, -0.02333531156182289, 0.07419844716787338, -0.041805289685726166, -0.01292443834245205, 0.01433584000915289, -0.023771576583385468, -0.05703392252326012, -0.010799342766404152, 0.004982789512723684, -0.017083343118429184, -0.053302936255931854, -0.021928852424025536, 0.07150508463382721, -0.027780629694461823, 0.033380359411239624, -0.022945275530219078, -0.01761089451611042, 0.004859750624746084, -0.010023373179137707, 0.030214618891477585, -0.004541927017271519, -0.06953291594982147, 0.015594610013067722, 0.020152756944298744, -0.04178198426961899, -0.04377328231930733, 0.024235021322965622, -0.014324486255645752, 0.07166701555252075, 0.05055494233965874, -0.0030354103073477745, -0.10264110565185547, 0.027918996289372444, 0.03914425149559975, -0.05051267892122269, -0.07271777093410492, -0.005480538122355938, 0.006168009713292122, 0.020639851689338684, -0.018771443516016006, 0.10820990800857544, 0.015711365267634392, -0.028591416776180267, -0.014779696241021156, 0.012013587169349194, 0.03977033123373985, 0.0671493336558342, 0.019076703116297722, 0.04624250903725624, -0.0002748756087385118, -0.01004449836909771, -0.04192112386226654, -0.05157240852713585, -0.01119011826813221, -0.06217353045940399, -0.00590980751439929, 0.008944154717028141, -0.041176460683345795, -0.04188542440533638, 0.062423888593912125, -0.042108405381441116, 0.019730933010578156, 0.01962091587483883, 0.04986684396862984, 0.08608240634202957, -0.03315736725926399, -0.03156847134232521, 0.022995218634605408, 0.02013525180518627, 0.09322285652160645, -0.012505671009421349, -0.003647733712568879, -0.06179192289710045, -0.00866513792425394, 0.09433599561452866, 0.022224916145205498, -0.07068110257387161, 0.018856756389141083, 0.014983797445893288, 0.07445398718118668, -0.008561146445572376, -0.0070692673325538635, -0.01531403698027134, 0.016888845711946487, 0.03837568312883377, -0.008730470202863216, -0.005461425520479679, -0.05175749212503433, 0.004616845864802599, -0.010746774263679981, 0.0031259648967534304, 0.022403927519917488, -0.11738372594118118, -0.04118345305323601, -0.08102120459079742, 0.05725831165909767, -0.029535086825489998, -0.01409357599914074, 0.07756984233856201, -0.08665767312049866, 0.0316445529460907, 0.011960298754274845, -0.06694615632295609, 0.01896470971405506, 0.021216372027993202, 0.051502030342817307, 0.11671271920204163, 0.05622072145342827, -0.08440791070461273, 0.022646496072411537, 0.030277544632554054, 0.008848301135003567, 0.0016767478082329035, 0.008716189302504063, -0.0034598077181726694, 0.05143871530890465, 0.013976761139929295, 0.0729881227016449, 0.04369612783193588, 0.011385498568415642, 0.02148636430501938, 0.0010233052307739854, -0.04329242184758186, 0.019034016877412796, -0.004176951013505459, 0.014036542735993862, 0.012433876283466816, -0.029718605801463127, 0.04846426844596863, 0.06249101087450981, 0.008559365756809711, -0.007907579652965069, -0.017657415941357613, 0.04803645610809326, 0.007335026748478413, -0.10894615948200226, 0.05343687906861305, 0.0004624664143193513, -0.04179505258798599, 0.014471098780632019, 0.09698379784822464, -0.011838436126708984, 0.0548376701772213, -0.09627947956323624, 0.009526497684419155, 0.00729728676378727, -0.03732461854815483, -0.08145498484373093, -0.00440609036013484, 0.02864752523601055, -0.00721884286031127, -0.028401991352438927, -0.016379810869693756, 0.03539993613958359, -0.04373886063694954, -0.023998545482754707, -0.0011037555523216724, 0.0516708567738533, 0.06164347752928734, 0.06806156784296036, 0.025664424523711205, 0.10543510317802429, -0.007949797436594963, 0.039978448301553726, -0.06954468786716461, -0.071904756128788, 0.08873140066862106, -0.013652698136866093, 0.040680013597011566, 0.03543747961521149, -0.0880717784166336, -0.017580244690179825, -0.06004011258482933, -0.021030614152550697, 0.014389337040483952, -0.013307187706232071, -0.0035726858768612146, 0.06767293065786362, 0.016818087548017502, -0.013866040855646133, -0.028044871985912323, -0.08834899216890335, 0.028486456722021103, 0.033483222126960754, 0.07073256373405457, -0.02006787434220314, -0.007777449209243059, -0.05921493098139763, -0.07960909605026245, -0.014995270408689976, 0.03464962914586067, -0.007525886408984661, -0.1352766752243042, 0.024406341835856438, 0.054752983152866364, -0.0036428580060601234, -0.05880564823746681, 0.04188353195786476, -0.0884196013212204, 0.025864917784929276, -0.07779986411333084, -0.051289934664964676, -0.021170426160097122, -0.03827865421772003, -0.03218245878815651, 0.14218635857105255, -0.018005697056651115, -0.03371279314160347, 0.005237641278654337, -0.021666139364242554, 0.057358138263225555, 0.038186077028512955, 0.07594247907400131, 0.09472505748271942, -0.028192397207021713, -0.05222902446985245, -0.024583997204899788, -0.05248996987938881, 0.0529060997068882, 0.04760447144508362, 0.015090398490428925, 0.03522577881813049, 0.058973126113414764, 0.006018216256052256, -0.04229400306940079, 0.040252331644296646, -0.028595775365829468, 0.0016948407283052802, 0.02436200901865959, 0.0020298331510275602, 0.02253859117627144, 0.028521792963147163, -0.03190973028540611, -0.023600822314620018, -0.09340415149927139, -0.06025751307606697, -0.05018623545765877, -0.025353549048304558, -0.0312991626560688, 0.067726731300354, -0.008199000731110573, -0.04445503279566765, 0.0192144513130188, -0.021525317803025246, 0.051370877772569656, -0.009938601404428482, -0.0070801787078380585, -0.043299078941345215, -0.026701059192419052, -0.027768896892666817, -0.015478145331144333, -0.015985330566763878, -0.020128317177295685, 0.02141173556447029, 0.009837760590016842, 0.0002508128818590194, -0.011921491473913193, 0.023657724261283875, -0.001038331538438797, 0.02677382342517376, 0.044103674590587616, -0.006195579189807177, -0.03104819916188717, 0.03944375738501549, 0.005147714167833328, 0.016009483486413956, -0.038507357239723206, 0.0468766912817955, 0.05603354051709175, -0.01850767247378826, -0.012981703504920006, 0.010115893557667732, -0.043117668479681015, -0.0021308003924787045, -0.0003336648805998266, 0.029980741441249847, 0.023569529876112938, 0.023956920951604843, -0.003391281235963106, -0.0040176245383918285, -0.0021128871012479067, -0.005417088512331247, -0.030347129330039024, -0.03410937637090683, 0.004325186368077993, -0.031115243211388588, 0.01419242937117815, 0.0120382746681571, 0.012019531801342964, -0.029348980635404587, 0.0405266210436821, 0.000820452522020787, -0.027412723749876022, -0.08544409275054932, -0.03520690277218819, -0.023966219276189804, 0.038982048630714417, 0.017984943464398384, 0.023173263296484947, 0.04476190730929375, 0.013123736716806889, -0.028418423607945442, 0.04419423267245293, -0.011190860532224178, 0.014897731132805347, 0.036119867116212845, 0.02032439596951008, -0.015696344897150993, -0.007808241993188858, 0.02696668729186058, 0.009390360675752163, -0.003292456967756152, -0.003911993000656366, -0.053708843886852264, -0.019918009638786316, 0.03859258443117142, 0.0064736632630229, -0.0011932029156014323, -0.02143394947052002, -0.021054428070783615, 0.02850118838250637, 0.007371435407549143, -0.02045571245253086, -0.03761274740099907, 0.00331998523324728, -0.020048875361680984, -0.021076975390315056, -0.014634296298027039, -0.020218711346387863, -0.018140610307455063, 0.007357234135270119, 0.04781433939933777, -0.014815045520663261, -0.002448349492624402, 0.019648797810077667, 0.010692786425352097, 0.01773221045732498, 0.009991987608373165, 0.003669122466817498, 0.015269650146365166, 0.04903256520628929, 0.014482823200523853, -0.018245214596390724, -0.012165448628365993, -0.0298319011926651, -0.022652721032500267, 0.06046617776155472, 0.002937668701633811, 0.01958398148417473, 0.004991102963685989, 0.03405839204788208, 0.024744102731347084, -0.015925416722893715, -0.009760678745806217, -0.06510629504919052, 0.032548852264881134, -0.03128065541386604, -0.022624177858233452, 0.03235887736082077, 0.00483523216098547, 0.001814030110836029, -0.009391577914357185, 0.07811303436756134, -0.03373692184686661, 0.012500557117164135, -0.006619514897465706, 0.01833457499742508, 0.018845710903406143, 0.01154187973588705, -0.0421922393143177, -0.03869667649269104, 0.05559700354933739, 0.006909011863172054, 0.00917487870901823, -0.023943180218338966, -0.0044446117244660854, 0.0018843273865059018, -0.03192777931690216, -0.014665821567177773, 0.003401379333809018, -0.010253352113068104, 0.01970653608441353, 0.033458411693573, -0.0063470350578427315, -0.041433826088905334, -0.004766247700899839, -0.005672071594744921, -0.03681167960166931, -0.010345195420086384, 0.021662438288331032, 0.042006202042102814, -0.008044925518333912, 0.03147328644990921, 0.0031597597990185022, -0.021370327100157738, 0.010080862790346146, 0.01703641749918461, 0.028197044506669044, -0.011139382608234882, -0.002699135569855571, -0.0012234682217240334, 0.016998598352074623, -0.009599149227142334, 0.005231590010225773, 0.005680394824594259, 0.020649593323469162, -0.027033928781747818, 0.03165264055132866, 0.08207227289676666, 0.02006222866475582, -0.016840491443872452, 0.03066435270011425, 0.019660532474517822, 0.0010879924520850182, 0.02667023055255413, -0.002265413524582982, -0.00259065767750144, -0.006002071313560009, 0.02032255008816719, 0.0534600093960762, -0.010755280032753944, -0.02404344268143177, -0.011160620488226414, -0.04016805812716484, 0.020203538239002228, 0.05731819570064545, -0.029850244522094727, 0.00970296747982502, -0.028743747621774673, -0.023510059341788292, 0.006459415890276432, 0.016673658043146133, 0.016185184940695763, -0.01633024401962757, 0.04165320470929146, 0.028528861701488495, -0.07138162851333618, 0.022457562386989594, 0.057175926864147186, -0.029461868107318878, 0.028153762221336365, -0.005401658825576305, 0.040544357150793076, -0.00523934094235301, 0.0238201767206192, -0.02550567127764225, 0.00999638345092535, 0.05483371391892433, 0.022297902032732964, 0.030230432748794556, -0.021740689873695374, 0.0027713123708963394, 0.07367252558469772, -0.03767876327037811, -0.042018964886665344, -0.025754831731319427, 0.030220545828342438, -0.03647245839238167, 0.033187735825777054, 0.008400213904678822, -0.08839122951030731, 0.011772592552006245, 0.017398636788129807, -0.08200521767139435, -0.02949398010969162, 0.03842978551983833, -0.03906985744833946, 0.02476479671895504, 0.05197498947381973, 0.019132014364004135, 0.04034997150301933, -0.0463908389210701, 0.01331395749002695, -0.015097099356353283, 0.008388610556721687, -0.018480679020285606, -0.02511901967227459, -0.032584141939878464, 0.033057231456041336, 0.05109773203730583, 0.028861965984106064, 0.0014157949481159449, 0.034296296536922455, -0.036307863891124725, 0.019334325566887856, 0.030904047191143036, -0.0024655538145452738, 0.009841583669185638, -0.019141122698783875, -0.010789223946630955, 0.006477098446339369, 0.012670058757066727, -0.010485073551535606, 0.03752059116959572, 0.09293315559625626, -0.029866572469472885, -0.026790300384163857, 0.05831645801663399, 0.016450950875878334, 0.030722619965672493, -0.01795917935669422, 0.06187650188803673, 0.014085042290389538, -0.02285107411444187, -0.01662447676062584, 0.0006766857695765793, 0.022050296887755394, -0.030713343992829323, -0.0010786220664158463, 0.008282613940536976, 0.002534047234803438, 0.0190551970154047, 0.048367876559495926, -0.02556779235601425, -0.046206437051296234, -0.024380508810281754, -0.05978278070688248, 0.005523712374269962, -0.02437455765902996, 0.026935070753097534, 0.01257976982742548, -0.03622780367732048, 0.014022620394825935, 0.03449311479926109, -0.00878477655351162, 0.010783413425087929, 0.02139081433415413, 0.03433346375823021, -0.04748789593577385, 0.05902732163667679, 0.031063983216881752, 0.026327263563871384, -0.01870536617934704, -0.027975786477327347, -0.051895175129175186, -0.06318807601928711, 0.007073518354445696, -0.044717345386743546, 0.024305962026119232, 0.07412385195493698, 0.037657685577869415, 0.010419761762022972, -0.0025564783718436956, -0.006259229499846697, -0.015128007158637047, 0.03398032486438751, -0.033834103494882584, 0.021303268149495125, -0.0063303071074187756, 0.03511011600494385, 0.0063397204503417015, 0.03324700891971588, 0.007217263802886009, 0.011127219535410404, -0.009020838886499405, -0.039744071662425995, 0.03993288427591324, 0.014205081388354301, -0.0023040648084133863, -0.000008028329830267467, -0.05018547922372818, -0.03466036915779114, 0.037060271948575974, -0.03600790351629257, 0.023098649457097054, 0.0017959855031222105, 0.030950287356972694, 0.024312099441885948, 0.01942410320043564, 0.025897100567817688, 0.00028900481993332505, -0.03888361155986786, 0.06641196459531784, -0.020637525245547295, 0.023880410939455032, 0.014019095338881016, 0.03623419627547264, -0.0009355525835417211, -0.028139052912592888, 0.07065106928348541, 0.009411065839231014, 0.020576143637299538, -0.0015845905290916562, -0.005999325308948755, -0.024326225742697716, 0.00030332585447467864, -0.023567765951156616, -0.002977880882099271, 0.006106352433562279, 0.01503254659473896, -0.012482170015573502, 0.02438167855143547, -0.009926974773406982, 0.04013291001319885, 0.06530939042568207, -0.019229549914598465, -0.0478021614253521, 0.01173991709947586, 0.034706197679042816, 0.0005789475981146097, 0.022437114268541336, 0.018239431083202362, 0.01928519457578659, -0.032984327524900436, 0.033048760145902634, -0.02576877363026142, 0.0012266125995665789, 0.009532015770673752, -0.011554175987839699, 0.023724054917693138, -0.04761122539639473, -0.058267246931791306, -0.0007240039994940162, 0.006610942538827658, 0.02095124125480652, -0.02663152664899826, 0.02143098972737789, -0.038941435515880585, -0.004438650794327259, -0.008322852663695812, -0.03760609030723572, -0.013605568557977676, -0.013170730322599411, -0.01336008682847023, -0.006288860458880663, 0.004283182322978973, -0.04854758083820343, -0.033046822994947433, 0.02012510597705841, 0.018656674772500992, 0.004953496158123016, -0.030452944338321686, -0.012817488051950932, -0.01688130758702755, 0.024751786142587662, -0.008467108942568302, 0.019111979752779007, 0.027008719742298126, 0.014498327858746052, 0.031881183385849, 0.061584241688251495, 0.014333054423332214, 0.02974061109125614, -0.02390463277697563, 0.026031823828816414, 0.014283320866525173, -0.021824045106768608, -0.03589553013443947, -0.03472018241882324, -0.011122187599539757, -0.027086766436696053, -0.0337151400744915, -0.02158372476696968, 0.06861815601587296, 0.016240062192082405, 0.006313237361609936, -0.024814492091536522, -0.01367836445569992, 0.01805376634001732, 0.016448305919766426, -0.039679065346717834, 0.043714579194784164, 0.01397278718650341, 0.045749690383672714, 0.048298709094524384, 0.007296723313629627, -0.009753118269145489, -0.00006634129385929555, -0.022640548646450043, -0.006162515841424465, -0.0025365527253597975, -0.03747367486357689, 0.011708476580679417, 0.03631875663995743, 0.027474625036120415, 0.034356746822595596, 0.013553565368056297, -0.011933157220482826, -0.024858571588993073, 0.0015390818007290363, 0.007506591733545065, -0.0506361648440361, 0.011569755151867867, -0.03757327422499657, -0.042073048651218414, -0.01924917846918106, -0.02911096252501011, -0.018574614077806473, 0.03445357456803322, -0.0646556094288826, -0.027405567467212677, -0.02438879758119583, -0.02329341135919094, -0.04446565359830856, 0.003470070194453001, 0.05165182054042816, 0.04606198891997337, 0.0010613894555717707, -0.009858038276433945, -0.04122181609272957, -0.0035101198591291904, -0.02302471548318863, 0.039353013038635254, 0.04053337499499321, 0.011786436662077904, -0.04804248735308647, 0.014909233897924423, 0.007789464667439461, 0.01454958412796259, -0.03155360370874405, -0.005505482200533152, 0.017647812142968178, 0.007993148639798164, -0.043577879667282104, 0.011937723495066166, -0.003537573153153062, -0.018758799880743027, 0.026124494150280952, -0.03986036404967308, -0.008394323289394379, -0.002988940803334117, 0.023450545966625214, -0.033729709684848785, -0.009780725464224815, -0.036912139505147934, -0.02799861505627632, 0.006880955770611763, 0.011503965593874454, -0.03578333556652069, -0.039623044431209564, -0.022908460348844528, 0.04525802284479141, -0.018788360059261322, -0.023287901654839516, -0.004817612934857607, -0.022496802732348442, 0.021382134407758713, -0.03135164454579353, -0.05230719596147537, 0.006386606954038143, 0.0021189635153859854, -0.013129678554832935, 0.027097901329398155, 0.049445804208517075, -0.006385611370205879, -0.005333921406418085, -0.04016471281647682, -0.011697590351104736, 0.009875180199742317, 0.01276212278753519, -0.03505060821771622, -0.0018538295989856124, 0.028121326118707657 ]
Faster TensorFlow models in Hugging Face Transformers
jplu
January 26, 2021
tf-serving
guide, nlp
https://huggingface.co/blog/tf-serving
Step 3 Query the model through the REST API: python from transformers import BertTokenizerFast, BertConfig import requests import json import numpy as np sentence = "I love the new TensorFlow update in transformers." # Load the corresponding tokenizer of our SavedModel tokenizer = BertTokenizerFast.from_pretrained("nateraw/bert-base-uncased-imdb") # Load the model config of our SavedModel config = BertConfig.from_pretrained("nateraw/bert-base-uncased-imdb") # Tokenize the sentence batch = tokenizer(sentence) # Convert the batch into a proper dict batch = dict(batch) # Put the example into a list of size 1, that corresponds to the batch size batch = [batch] # The REST API needs a JSON that contains the key instances to declare the examples to process input_data = {"instances": batch} # Query the REST API, the path corresponds to http://host:port/model_version/models_root_folder/model_name:method r = requests.post("http://localhost:8501/v1/models/bert:predict", data=json.dumps(input_data)) # Parse the JSON result. The results are contained in a list with a root key called "predictions" # and as there is only one example, takes the first element of the list result = json.loads(r.text)["predictions"][0] # The returned results are probabilities, that can be positive or negative hence we take their absolute value abs_scores = np.abs(result) # Take the argmax that correspond to the index of the max probability. label_id = np.argmax(abs_scores) # Print the proper LABEL with its index print(config.id2label[label_id]) This should return POSITIVE. It is also possible to pass by the gRPC (google Remote Procedure Call) API to get the same result: python from transformers import BertTokenizerFast, BertConfig import numpy as np import tensorflow as tf from tensorflow_serving.apis import predict_pb2 from tensorflow_serving.apis import prediction_service_pb2_grpc import grpc sentence = "I love the new TensorFlow update in transformers." tokenizer = BertTokenizerFast.from_pretrained("nateraw/bert-base-uncased-imdb") config = BertConfig.from_pretrained("nateraw/bert-base-uncased-imdb") # Tokenize the sentence but this time with TensorFlow tensors as output already batch sized to 1. Ex: # { # 'input_ids': <tf.Tensor: shape=(1, 3), dtype=int32, numpy=array([[ 101, 19082, 102]])>, # 'token_type_ids': <tf.Tensor: shape=(1, 3), dtype=int32, numpy=array([[0, 0, 0]])>, # 'attention_mask': <tf.Tensor: shape=(1, 3), dtype=int32, numpy=array([[1, 1, 1]])> # } batch = tokenizer(sentence, return_tensors="tf") # Create a channel that will be connected to the gRPC port of the container channel = grpc.insecure_channel("localhost:8500") # Create a stub made for prediction. This stub will be used to send the gRPC request to the TF Server. stub = prediction_service_pb2_grpc.PredictionServiceStub(channel) # Create a gRPC request made for prediction request = predict_pb2.PredictRequest() # Set the name of the model, for this use case it is bert request.model_spec.name = "bert" # Set which signature is used to format the gRPC query, here the default one request.model_spec.signature_name = "serving_default" # Set the input_ids input from the input_ids given by the tokenizer # tf.make_tensor_proto turns a TensorFlow tensor into a Protobuf tensor request.inputs["input_ids"].CopyFrom(tf.make_tensor_proto(batch["input_ids"])) # Same with attention mask request.inputs["attention_mask"].CopyFrom(tf.make_tensor_proto(batch["attention_mask"])) # Same with token type ids request.inputs["token_type_ids"].CopyFrom(tf.make_tensor_proto(batch["token_type_ids"])) # Send the gRPC request to the TF Server result = stub.Predict(request) # The output is a protobuf where the only one output is a list of probabilities # assigned to the key logits. As the probabilities as in float, the list is # converted into a numpy array of floats with .float_val output = result.outputs["logits"].float_val # Print the proper LABEL with its index print(config.id2label[np.argmax(np.abs(output))])
[ 0.015848666429519653, -0.027195101603865623, 0.0334119088947773, 0.006331696640700102, 0.018423806875944138, 0.10964703559875488, 0.06264230608940125, 0.06319662928581238, -0.028030171990394592, -0.0028877139557152987, -0.06255758553743362, 0.07286159694194794, 0.000009927895007422194, 0.051966343075037, 0.005624583922326565, 0.003412088844925165, 0.041320156306028366, -0.04210194945335388, 0.03348877653479576, 0.007464972790330648, 0.002238459652289748, -0.05166633427143097, 0.0028797315899282694, 0.005531533621251583, 0.06471539288759232, -0.051150958985090256, -0.004400739446282387, 0.04966869205236435, -0.08605712652206421, -0.0021846331655979156, -0.10299887508153915, 0.026672204956412315, 0.02004474215209484, -0.042585890740156174, 0.0031809501815587282, 0.038649629801511765, -0.05886304751038551, 0.045522499829530716, 0.02444501407444477, -0.03022449091076851, -0.01881389133632183, 0.05144167318940163, -0.020935287699103355, 0.029782583937048912, 0.03771552816033363, -0.041341930627822876, -0.16498978435993195, 0.07395739108324051, -0.002215891843661666, -0.07135270535945892, -0.06425723433494568, 0.04780401661992073, -0.014904530718922615, 0.023574568331241608, -0.01082129217684269, 0.016929704695940018, 0.022211454808712006, -0.09243250638246536, -0.004130622837692499, 0.026674406602978706, 0.010169495828449726, 0.05693960562348366, 0.0033419111277908087, 0.0014250277308747172, 0.00921748299151659, 0.00873672217130661, -0.0006067915819585323, 0.022247618064284325, -0.011855938471853733, -0.01392816100269556, -0.009778589941561222, -0.03041764535009861, -0.056152842938899994, -0.01853186823427677, 0.017276624217629433, -0.03834560886025429, -0.009466900490224361, 0.035322751849889755, 0.013821487314999104, 0.061614032834768295, -0.02054225467145443, -0.04701023921370506, 0.013863126747310162, -0.007489130366593599, 0.09326057136058807, 0.018029725179076195, 0.0932328924536705, -0.07510553300380707, -0.01741126924753189, 0.04817376658320427, 0.03347664698958397, -0.08764424920082092, -0.005954070016741753, -0.04136722907423973, 0.016467303037643433, -0.05227526277303696, 0.022655751556158066, -0.007093380205333233, -0.05235814303159714, -0.030367830768227577, 0.008464598096907139, -0.04049244523048401, -0.02699979767203331, 0.016212794929742813, -0.046357013285160065, 0.016414277255535126, 0.00882046576589346, -0.12128762900829315, -0.007792310789227486, -0.03183073177933693, 0.007395556662231684, -0.01902649737894535, -0.04132508859038353, 0.0795559287071228, -0.06767387688159943, 0.0039049265906214714, 0.004761237185448408, -0.06873176991939545, 0.0016941225621849298, -0.009107127785682678, -0.00027847729506902397, 0.08953845500946045, 0.02686944231390953, -0.05074089765548706, 0.0006167670362628996, 0.05774358659982681, 0.007219995371997356, 0.013177532702684402, 0.014739526435732841, 0.03487848490476608, 0.06001518666744232, 0.001856106799095869, 0.09974730759859085, 0.014057429507374763, -0.006599237211048603, 0.037959739565849304, -0.06337901204824448, -0.061480894684791565, -0.02090493030846119, -0.023228613659739494, 0.01857657916843891, 0.04758739471435547, -0.059747859835624695, 0.01243229303508997, 0.07183581590652466, 0.00886510405689478, -0.04071642830967903, 0.021565375849604607, -0.004909262992441654, 0.02015521004796028, -0.11005964130163193, 0.045746635645627975, 0.018715186044573784, -0.03502582758665085, -0.02264293096959591, 0.05669577047228813, 0.010476442985236645, 0.009867527522146702, -0.09687289595603943, -0.019066041335463524, 0.018000178039073944, 0.007142995018512011, -0.03841682896018028, -0.023550331592559814, 0.0049852607771754265, -0.014644049108028412, 0.038886237889528275, -0.04258657619357109, -0.0025905908551067114, 0.06601198762655258, -0.006893747951835394, -0.014605563133955002, 0.06546585261821747, 0.004263186827301979, -0.0005489176837727427, 0.03467918559908867, 0.06671277433633804, -0.03360418975353241, 0.00007336267299251631, -0.07605111598968506, -0.04142268747091293, 0.04710882157087326, -0.000534599123056978, 0.04117004945874214, 0.061141081154346466, -0.07226064801216125, 0.03376238793134689, -0.010524448938667774, 0.02796921506524086, 0.06110803410410881, -0.021478667855262756, -0.018204322084784508, 0.08502503484487534, 0.010622900910675526, -0.006404798943549395, -0.05900375917553902, -0.02802330255508423, -0.0036280183121562004, -0.01682768017053604, -0.0318191722035408, 0.07913091033697128, -0.01770729012787342, 0.002707627834752202, -0.06051475182175636, -0.02347923256456852, -0.0129821402952075, -0.04339192062616348, -0.09109122306108475, -0.00487014465034008, 0.08543474227190018, -0.022226866334676743, -0.10150622576475143, 0.049635931849479675, -0.07226802408695221, -0.0683290883898735, -0.035020891577005386, -0.08465710282325745, 0.026011357083916664, 0.012952374294400215, -0.0056899297051131725, 0.18172326683998108, -0.03817873075604439, 0.024161789566278458, -0.07622062414884567, -0.008374226279556751, 0.042558327317237854, 0.003123384201899171, 0.07410861551761627, 0.06734044849872589, -0.027356833219528198, -0.10363532602787018, -0.02160589024424553, -0.019576380029320717, 0.027885286137461662, -0.03746643289923668, 0.017554529011249542, -0.026389753445982933, 0.01189297717064619, -0.011795319616794586, -0.018918393179774284, 0.005653391592204571, 0.018825259059667587, -0.0018509079236537218, 0.07426965981721878, 0.046166904270648956, 0.010308695025742054, 0.04399028792977333, -0.02573872171342373, 0.020232567563652992, -0.04192906245589256, -0.10905271023511887, 0.02690563164651394, -0.00615085382014513, -0.03293123468756676, 0.030757742002606392, 0.018009742721915245, 0.004647804889827967, 0.04417043179273605, 0.022176468744874, 0.06934230029582977, 0.01938352920114994, -0.011081503704190254, 0.00032881731749512255, -0.07747451215982437, -0.014049642719328403, -0.031025774776935577, -0.0035479299258440733, -0.03605629876255989, 0.015822796151041985, 0.0031349461060017347, 0.022048188373446465, -0.013237846083939075, 0.04811220243573189, 0.02130044810473919, 0.043637800961732864, 0.07293859869241714, 0.002645587781444192, 0.041027531027793884, 0.014101553708314896, -0.023303264752030373, 0.006828974466770887, -0.0869184136390686, 0.05315537378191948, 0.038791537284851074, -0.004007459618151188, 0.006682132836431265, -0.013441534712910652, -0.048375893384218216, 0.012341172434389591, 0.03487047553062439, 0.017829502001404762, 0.06719127297401428, 0.020769331604242325, -0.02881910279393196, -0.041597455739974976, 0.02029084414243698, 0.01105433702468872, -0.005002295598387718, -0.04620114341378212, -0.021901968866586685, -0.033039964735507965, -0.013650230132043362, -0.019275372847914696, -0.008511969819664955, -0.04461907595396042, 0.030319303274154663, 0.02566060796380043, 0.017261773347854614, -0.09039907157421112, -0.016852667555212975, 0.010068968869745731, -0.041545093059539795, 0.0009910025401040912, -0.0052805389277637005, 0.06647644191980362, 0.03617948666214943, -0.051254186779260635, 0.01818167231976986, -0.007538942154496908, 0.005494168493896723, -0.008921682834625244, 0.022096741944551468, -0.001024703262373805, 0.009072701446712017, 0.026137761771678925, -0.027082566171884537, 0.009734717197716236, 0.013398926705121994, -0.013960343785583973, 0.01240262296050787, 0.005411359015852213, -0.0029520951211452484, -0.007129657082259655, 0.019721558317542076, -0.028412749990820885, 0.03274179995059967, 0.01043587364256382, -0.03231516480445862, 0.00538554135710001, -0.03568875044584274, -0.0015903435414656997, 0.01485228817909956, -0.016895147040486336, 0.017970453947782516, -0.0063483924604952335, 0.02993122860789299, 0.01327035203576088, 0.02764575183391571, -0.020007727667689323, -0.010579491965472698, 0.00355912814848125, -0.01818566396832466, 0.028406217694282532, 0.012391357682645321, 0.03157356381416321, 0.01986612007021904, 0.013765918090939522, -0.03291052579879761, -0.0773555338382721, 0.03604508191347122, 0.0026150611229240894, 0.03289593756198883, 0.010629551485180855, -0.002068550791591406, -0.016415879130363464, -0.011203344911336899, 0.01846323162317276, -0.0319206640124321, -0.0012699952349066734, -0.029905887320637703, 0.0028218578081578016, -0.017689086496829987, -0.013887077569961548, 0.041843339800834656, 0.041237641125917435, 0.030735217034816742, -0.005255477502942085, 0.008865836076438427, -0.028160443529486656, 0.03872544318437576, 0.016445806249976158, 0.006283746100962162, 0.018492260947823524, 0.01809132657945156, -0.0144844064489007, -0.0322287492454052, 0.04655415564775467, 0.022933723405003548, -0.04108285531401634, -0.017056062817573547, -0.07417257130146027, -0.00689495075494051, -0.011562586762011051, -0.009355154819786549, 0.03191820904612541, -0.012833938002586365, 0.004521588794887066, 0.017485084012150764, -0.00345326098613441, -0.004983278922736645, 0.006012137979269028, 0.011672211810946465, -0.061797067523002625, 0.024083204567432404, 0.02703085169196129, 0.029511431232094765, -0.013938973657786846, 0.029392387717962265, 0.023675350472331047, -0.003493651980534196, -0.014230596832931042, 0.04362255707383156, 0.01879747025668621, 0.015818769112229347, -0.02416924573481083, -0.008476442657411098, 0.004999740049242973, -0.05674427002668381, -0.022597873583436012, 0.0276517141610384, 0.013128641061484814, -0.036170292645692825, 0.00655303755775094, 0.040644917637109756, -0.005830373149365187, -0.03906993195414543, -0.015477841719985008, 0.032098572701215744, -0.02950214222073555, 0.008202942088246346, 0.016878344118595123, -0.008034509606659412, -0.002128337509930134, 0.008432948030531406, 0.028208622708916664, 0.06556405127048492, -0.028455378487706184, -0.0344051755964756, -0.006588707212358713, 0.0013682537246495485, 0.020106205716729164, -0.011183764785528183, 0.010169368237257004, -0.0056729731149971485, -0.003387297736480832, -0.02474808134138584, 0.01588248647749424, 0.010977007448673248, 0.0005245203501544893, 0.012534784153103828, 0.017892515286803246, -0.04745154082775116, -0.0022140061482787132, 0.04098818823695183, -0.04109644517302513, -0.021710453554987907, -0.00022855412680655718, 0.026569224894046783, 0.022115148603916168, 0.0191939827054739, -0.03936552628874779, -0.03242242708802223, 0.049914874136447906, 0.007702018599957228, -0.006015466991811991, -0.004837018437683582, 0.0029546795412898064, 0.03265939652919769, 0.011452131904661655, -0.03167460113763809, -0.015790414065122604, 0.023585692048072815, -0.002025717869400978, -0.021746722981333733, -0.0032372246496379375, -0.08039224147796631, 0.017164230346679688, 0.046869371086359024, -0.011045469902455807, 0.001044376869685948, 0.044473301619291306, -0.019367245957255363, -0.015555011108517647, 0.09212487190961838, 0.03933042660355568, 0.02108258381485939, -0.044744979590177536, 0.02579883113503456, -0.013550616800785065, -0.06049458310008049, -0.02325589768588543, -0.005551488604396582, -0.03038165345788002, 0.04073772206902504, 0.033620256930589676, 0.06205093860626221, -0.014136004261672497, 0.011029421351850033, -0.03837016597390175, -0.01825861446559429, 0.0018571262480691075, -0.03158576041460037, 0.019641052931547165, -0.027742763981223106, -0.019268855452537537, 0.04655492305755615, -0.007215327117592096, -0.011404088698327541, 0.036688659340143204, 0.058878034353256226, -0.006845752242952585, -0.017418671399354935, 0.06203924119472504, -0.009773232974112034, 0.0033689141273498535, -0.028679482638835907, 0.010627434588968754, -0.01625356636941433, 0.032144974917173386, 0.01863287389278412, -0.023413602262735367, 0.046469416469335556, -0.0010674550430849195, 0.008317803032696247, -0.0069135441444814205, 0.00155920151155442, 0.0432005450129509, 0.029942922294139862, 0.008215426467359066, -0.03483590856194496, -0.036076657474040985, 0.009019280783832073, 0.04242303594946861, -0.0470372810959816, 0.04908875375986099, 0.017021477222442627, 0.008416377007961273, 0.02565968781709671, 0.0006370284245349467, -0.017921170219779015, -0.0063008195720613, -0.012106865644454956, 0.011718379333615303, -0.025912482291460037, 0.038839586079120636, 0.023030823096632957, 0.02629498392343521, -0.05471343919634819, -0.0022567405831068754, -0.00612175976857543, -0.011139707639813423, 0.016077639535069466, -0.0023485226556658745, 0.03391844034194946, 0.0775102749466896, -0.003316708141937852, 0.028640761971473694, 0.0018892133375629783, -0.029169809073209763, 0.04200340434908867, 0.0019278215477243066, -0.022454753518104553, -0.011784691363573074, 0.011923504993319511, 0.03350080922245979, 0.030509088188409805, -0.029977519065141678, 0.07789505273103714, 0.031586091965436935, -0.04752274975180626, -0.013481628149747849, 0.07892457395792007, -0.015864809975028038, 0.049862079322338104, 0.011113665997982025, -0.02032039873301983, -0.04803171753883362, -0.01390875969082117, -0.0008471761830151081, -0.002512700855731964, 0.0283148605376482, -0.002074669348075986, 0.018847355619072914, 0.0011120811104774475, 0.013855856843292713, 0.03451726958155632, -0.06987576931715012, 0.04076208546757698, -0.004529702011495829, 0.07055161148309708, 0.04363645985722542, 0.0402844175696373, 0.012066375464200974, -0.013322326354682446, 0.018514558672904968, 0.0028743890579789877, 0.023006010800600052, 0.011629484593868256, 0.001818690448999405, 0.015394637361168861, -0.016969751566648483, -0.024678222835063934, 0.01697497069835663, -0.020563555881381035, 0.03251442313194275, -0.020496204495429993, 0.030627906322479248, -0.004743896424770355, 0.019637104123830795, 0.029635336250066757, 0.03411981835961342, -0.04589112475514412, 0.039064906537532806, 0.03837859630584717, 0.03932931646704674, -0.0005374515312723815, -0.015339349396526814, 0.03136029094457626, -0.05305402725934982, 0.023928819224238396, -0.03061416931450367, 0.047000035643577576, -0.0027776749338954687, -0.025561949238181114, 0.010423327796161175, -0.05333903804421425, -0.014391367323696613, 0.05265338346362114, 0.013558297418057919, 0.01712341606616974, 0.020734146237373352, 0.033525459468364716, -0.052845921367406845, 0.015768494457006454, -0.01067486684769392, -0.023339606821537018, -0.02023777924478054, -0.01197713240981102, -0.008615382015705109, 0.024726448580622673, 0.0072062378749251366, -0.03188201040029526, 0.012062503024935722, 0.03680900111794472, 0.028871310874819756, 0.017590494826436043, -0.038423698395490646, 0.022680940106511116, -0.01808297261595726, -0.032751064747571945, -0.013925653882324696, 0.004349849186837673, -0.010502496734261513, -0.01032068021595478, 0.010221876204013824, 0.011828889138996601, 0.01102557685226202, 0.051118556410074234, -0.005636830814182758, 0.03348102793097496, -0.010454903356730938, 0.019091974943876266, -0.029525090008974075, -0.030896008014678955, 0.010643181391060352, -0.049649856984615326, -0.03297044336795807, -0.02915276773273945, 0.02385691925883293, 0.026517726480960846, 0.06089794635772705, -0.035492394119501114, -0.02498987689614296, 0.028714703395962715, 0.015061672776937485, -0.04457040876150131, 0.027677860110998154, 0.020419925451278687, 0.024244120344519615, 0.020247332751750946, 0.04022713378071785, -0.014140184968709946, -0.014391637407243252, -0.04031633213162422, 0.028510253876447678, 0.0021374733187258244, -0.03863872215151787, -0.013607173226773739, 0.045585695654153824, 0.02049436792731285, -0.008664915338158607, 0.029505429789423943, -0.054634224623441696, -0.01219553779810667, -0.02203095704317093, 0.01596440002322197, -0.05613357946276665, -0.013421277515590191, -0.029771653935313225, -0.02827361598610878, -0.05144498124718666, -0.004809301812201738, -0.03953087702393532, 0.02346286177635193, -0.04941045492887497, -0.009998137131333351, -0.024110695347189903, 0.019359245896339417, -0.0276043601334095, -0.02648625522851944, 0.07612691819667816, 0.03351340442895889, 0.042572058737277985, 0.002583779627457261, -0.0438779816031456, -0.017174040898680687, -0.04149298742413521, 0.037601858377456665, 0.005300633609294891, 0.024067433550953865, -0.008554301224648952, -0.01093608234077692, 0.037278179079294205, 0.01853678934276104, -0.04570457339286804, -0.007019741926342249, 0.052901577204465866, -0.017091520130634308, -0.05202643573284149, 0.02298552542924881, 0.027258029207587242, 0.0025088409893214703, 0.02305394783616066, -0.00844737607985735, 0.014016754925251007, -0.008854804560542107, -0.004455018322914839, -0.05578245595097542, -0.016701266169548035, -0.04170330986380577, -0.03227651119232178, 0.005506153218448162, 0.012156509794294834, 0.01983761042356491, -0.010631365701556206, 0.003621747251600027, 0.0007070325664244592, 0.019453762099146843, -0.017865536734461784, -0.03490539267659187, -0.011860347352921963, 0.04106338322162628, -0.028492989018559456, -0.005548310931771994, 0.03384837135672569, -0.0011464249109849334, -0.05044584348797798, 0.014965149573981762, -0.0007103424286469817, 0.02487211674451828, 0.003555784234777093, -0.0065764738246798515, -0.010090526193380356, 0.054259948432445526, 0.014335415326058865, -0.021591216325759888, 0.02419346757233143, 0.009134817868471146 ]
Faster TensorFlow models in Hugging Face Transformers
jplu
January 26, 2021
tf-serving
guide, nlp
https://huggingface.co/blog/tf-serving
TensorFlow Serving The previous section demonstrates that the brand new Bert model got a dramatic increase in computational performance in the last version of Transformers. In this section, we will show you step-by-step how to deploy a Bert model with TensorFlow Serving to benefit from the increase in computational performance in a production environment.
[ -0.0012596345040947199, -0.02858278900384903, 0.04809366911649704, 0.011932364664971828, -0.01408408023416996, 0.0728207603096962, -0.002000301843509078, 0.049082476645708084, -0.027613652870059013, -0.054117340594530106, -0.056171663105487823, 0.02950395457446575, -0.06115312874317169, 0.07585547119379044, 0.010727758519351482, -0.01952502876520157, 0.0644034817814827, -0.06539113819599152, -0.002411121968179941, -0.007265162654221058, -0.0014458214864134789, -0.08075287938117981, 0.08540665358304977, 0.00422491692006588, 0.00848016981035471, -0.012793897651135921, 0.02409306913614273, 0.01863813027739525, -0.048572998493909836, 0.006779741961508989, -0.0620170459151268, 0.004500601440668106, 0.05097490921616554, 0.01743447221815586, -0.08573408424854279, 0.008114762604236603, -0.08267121762037277, 0.06322287023067474, 0.006386492867022753, -0.06790114939212799, -0.013625700026750565, 0.013335698284208775, -0.055683914572000504, 0.09848323464393616, -0.0029985932633280754, -0.0092851547524333, -0.09624457359313965, 0.05228378251194954, 0.024783501401543617, -0.03840392082929611, -0.0801822766661644, 0.05160234868526459, -0.020916538313031197, -0.0018824556609615684, -0.007786121219396591, 0.05933342128992081, 0.005615596193820238, -0.0019818723667412996, 0.02275928482413292, 0.02760561741888523, 0.0313054621219635, -0.03411697968840599, 0.003380677429959178, 0.0030614330898970366, -0.03404979035258293, -0.011211216449737549, -0.010080210864543915, -0.05114540830254555, -0.04905812814831734, 0.018634088337421417, -0.009533988311886787, -0.021219223737716675, -0.025937777012586594, -0.03407800570130348, -0.0038938885554671288, -0.0007041710196062922, 0.016318555921316147, 0.02704470604658127, 0.01908799819648266, 0.03854270651936531, 0.0003771855845116079, 0.02188212424516678, -0.001542511978186667, 0.018627384677529335, 0.020827312022447586, 0.07045856863260269, 0.07377903908491135, -0.06911598891019821, -0.08664081245660782, 0.03799377381801605, 0.05946596711874008, -0.09458678215742111, -0.02501680888235569, -0.020112257450819016, 0.07598792016506195, -0.006153855472803116, 0.0006735778879374266, 0.0008717969758436084, -0.060053568333387375, -0.044725093990564346, -0.02058080956339836, -0.07310371845960617, 0.0015266832197085023, -0.014391463249921799, -0.05709897354245186, 0.0022397576831281185, 0.020206153392791748, -0.15565696358680725, 0.004238237161189318, -0.0070184990763664246, 0.03633454442024231, -0.03578335419297218, -0.028671657666563988, 0.02932605892419815, -0.09355068951845169, 0.02935308963060379, -0.00041251792572438717, -0.02407226711511612, 0.027544185519218445, 0.06030140444636345, 0.053344544023275375, 0.0850750282406807, 0.05206715315580368, -0.021924352273344994, -0.013350840657949448, 0.040639594197273254, -0.018576161935925484, 0.029957769438624382, 0.04928276315331459, -0.02684018947184086, 0.08049939572811127, -0.041817471385002136, 0.08540622889995575, 0.05042822286486626, 0.047951895743608475, -0.00879413541406393, -0.020799534395337105, -0.08953801542520523, -0.020216213539242744, -0.0222191009670496, -0.03099052608013153, 0.09278629720211029, 0.026317600160837173, -0.005295392591506243, 0.05443551763892174, -0.05998547002673149, -0.09090631455183029, 0.04945666342973709, 0.048625648021698, 0.004109018016606569, -0.09243115782737732, 0.007488598581403494, -0.06985260546207428, -0.02503911592066288, 0.06780422478914261, 0.08310547471046448, -0.004983821883797646, -0.05071044713258743, -0.06975509226322174, 0.0011961398413404822, 0.019071834161877632, -0.017557375133037567, -0.05028892681002617, -0.005555335432291031, 0.015456568449735641, -0.040930576622486115, 0.01344174612313509, -0.00010440340702189133, 0.07308456301689148, 0.03871459886431694, -0.03936775028705597, 0.036451924592256546, 0.044485341757535934, 0.023646613582968712, 0.05387435108423233, 0.04991759732365608, 0.05422186478972435, 0.07263407856225967, 0.03194793686270714, -0.06610111147165298, -0.03194645792245865, 0.08384492248296738, 0.009499088861048222, 0.02593839354813099, 0.04086089879274368, -0.08081528544425964, 0.010350809432566166, -0.07822539657354355, 0.022642895579338074, 0.005922388285398483, -0.00861627422273159, -0.011520477943122387, 0.07572592049837112, -0.0325993113219738, -0.009623106569051743, 0.028910372406244278, -0.06353361159563065, 0.09459692984819412, 0.03323069214820862, 0.014545043930411339, 0.0509336031973362, -0.0001718049607006833, -0.008453677408397198, -0.013115099631249905, 0.01999340020120144, 0.015858151018619537, 0.026522895321249962, -0.038981836289167404, -0.00516558438539505, 0.017927274107933044, 0.009795194491744041, -0.14034265279769897, -0.008255556225776672, -0.08416033536195755, -0.029658053070306778, -0.07933197170495987, -0.059026118367910385, 0.03406308963894844, -0.03973591700196266, -0.02844214253127575, 0.14305737614631653, -0.04851779341697693, -0.01817646250128746, -0.022706586867570877, -0.022509191185235977, -0.01669451780617237, 0.047558996826410294, 0.029282324016094208, 0.09955030679702759, -0.027727313339710236, -0.08220263570547104, -0.03726452589035034, -0.007344389334321022, 0.025876149535179138, 0.013627440668642521, 0.032165348529815674, -0.018688231706619263, 0.00007537904457421973, 0.02508416213095188, -0.04616213217377663, -0.01973394863307476, 0.034227777272462845, 0.032357361167669296, 0.10253703594207764, -0.005259140860289335, 0.017470406368374825, 0.038254112005233765, -0.0013229495380073786, 0.06587367504835129, -0.055046286433935165, -0.07992859184741974, 0.007829868234694004, 0.025525370612740517, -0.07363258302211761, 0.021099884063005447, 0.022265680134296417, 0.014896721579134464, -0.01273578405380249, -0.03028947487473488, 0.03675209358334541, 0.03034336119890213, 0.000637074641417712, -0.057218797504901886, -0.035671133548021317, -0.011396562680602074, -0.028039682656526566, -0.03601891174912453, -0.04995531961321831, 0.011277093552052975, -0.012849587015807629, -0.010190276429057121, -0.05810246244072914, 0.006939768325537443, -0.01922016404569149, 0.06366684287786484, 0.02071264572441578, 0.03239677473902702, -0.02396545559167862, -0.03484426811337471, -0.0420135036110878, -0.015112048014998436, -0.02782381884753704, 0.07373140007257462, 0.026215888559818268, -0.0399651937186718, -0.0017535098595544696, 0.013838553801178932, -0.027689427137374878, 0.001246489817276597, -0.029974056407809258, -0.019023800268769264, 0.030026931315660477, -0.014598825015127659, -0.016426291316747665, 0.010572914034128189, 0.023646358400583267, 0.0013564167311415076, -0.013860993087291718, -0.0008020715322345495, -0.003074954729527235, -0.025286467745900154, 0.011101726442575455, -0.004295761231333017, -0.004442407283931971, -0.02188141830265522, 0.006292854435741901, 0.004537003114819527, -0.009220002219080925, -0.08588731288909912, -0.035328831523656845, 0.012111270800232887, -0.010795526206493378, 0.016582662239670753, -0.018160225823521614, 0.048058029264211655, -0.016159767284989357, -0.04890363663434982, 0.011279977858066559, -0.0003326710721012205, -0.003848338034003973, 0.01691567897796631, 0.016810545697808266, -0.036252059042453766, -0.00597078911960125, -0.0018691327422857285, -0.004931505303829908, 0.028718121349811554, 0.020261157304048538, -0.020890114828944206, 0.022911272943019867, 0.008146758191287518, -0.03903888538479805, -0.005825144704431295, 0.034573715180158615, 0.0007397101144306362, 0.01150719914585352, 0.03403016924858093, 0.0013911809073761106, -0.015764564275741577, -0.03825762867927551, 0.014839015901088715, 0.006985788233578205, -0.016368931159377098, 0.0332026481628418, 0.0002177880087401718, 0.02363094687461853, 0.05512131005525589, 0.006872239056974649, 0.017609789967536926, -0.007475326769053936, -0.005211847834289074, -0.022429287433624268, -0.01252810563892126, 0.00009822916763368994, 0.02864830382168293, 0.002919680206105113, 0.051164060831069946, -0.02372647635638714, -0.014992823824286461, -0.01933477818965912, -0.020595543086528778, 0.04161885753273964, 0.028176741674542427, -0.001953493570908904, 0.01576072722673416, -0.00647713104262948, 0.024916527792811394, 0.006291231606155634, -0.004525837954133749, 0.005186958704143763, 0.03343721851706505, 0.0039038031827658415, -0.04179069399833679, 0.03207799792289734, 0.030313406139612198, 0.012349109165370464, 0.011943579651415348, 0.003981350921094418, -0.03059622086584568, 0.04014002904295921, 0.01298479549586773, 0.008007676340639591, -0.009700413793325424, 0.03482344374060631, -0.0032978204544633627, -0.019261201843619347, 0.10427248477935791, 0.010737571865320206, -0.01822315715253353, -0.04106122627854347, -0.0076604499481618404, -0.020538419485092163, 0.014897452667355537, 0.013752702623605728, -0.00829575676470995, 0.0033558926079422235, 0.005900277756154537, 0.008246973156929016, -0.0014914856292307377, -0.04472862929105759, -0.006211634259670973, 0.0181045550853014, 0.004762718454003334, -0.005813379306346178, 0.031902432441711426, 0.013159232214093208, -0.04699547216296196, 0.005005250684916973, -0.015184680931270123, -0.03547464683651924, -0.007677378132939339, 0.017445284873247147, -0.010731487534940243, 0.02957441657781601, 0.019918004050850868, -0.00562536483630538, 0.030293695628643036, -0.0010997422505170107, 0.027776939794421196, 0.02272682450711727, -0.001976446947082877, -0.00884849950671196, 0.024092918261885643, 0.029453013092279434, -0.006734245922416449, -0.024791346862912178, -0.04159459099173546, 0.03852326050400734, -0.0034126725513488054, 0.0165428314357996, 0.022550877183675766, 0.00926106795668602, 0.013817892409861088, 0.02466178685426712, 0.011604604311287403, 0.043516431003808975, -0.021008320152759552, -0.00350752635858953, -0.028822053223848343, 0.00695243664085865, 0.04792172834277153, 0.009600517340004444, 0.010323130525648594, -0.021305106580257416, -0.008167178370058537, 0.04099569469690323, -0.009325536899268627, -0.014328214339911938, -0.03584432229399681, 0.0449669249355793, 0.01350848376750946, -0.05837877467274666, 0.04403947666287422, 0.024327827617526054, -0.03673038259148598, -0.0028964977245777845, -0.0029899717774242163, 0.021360429003834724, 0.048151805996894836, 0.010003529489040375, -0.04900890961289406, 0.006390704773366451, 0.04294069483876228, 0.0026162639260292053, -0.0208588857203722, 0.009405999444425106, 0.03742791712284088, 0.021240146830677986, 0.0030452886130660772, 0.009266773238778114, -0.03173740208148956, -0.00012063417671015486, 0.04071939364075661, 0.010982041247189045, 0.026124104857444763, -0.06194121018052101, -0.0032043468672782183, 0.0028947906102985144, -0.0516175851225853, 0.012061879970133305, 0.011184128001332283, -0.013225603848695755, -0.002245357958599925, 0.07320267707109451, 0.054793521761894226, 0.03947065398097038, 0.015489495359361172, 0.00891914777457714, 0.019065087661147118, 0.00221658730879426, -0.06523203104734421, -0.003792734583839774, -0.0027541841845959425, 0.011872784234583378, 0.06159243732690811, 0.07285167276859283, -0.03258519619703293, -0.018929490819573402, 0.01294087152928114, -0.00961319264024496, -0.015960052609443665, -0.03059457242488861, 0.006172172259539366, -0.02057652920484543, -0.002327410038560629, -0.003651400562375784, -0.03217465430498123, 0.030370110645890236, 0.015262102708220482, 0.049086377024650574, -0.027857786044478416, -0.03426717594265938, 0.03307657316327095, -0.011562584899365902, 0.032993413507938385, -0.046317290514707565, 0.036144837737083435, -0.007502262014895678, 0.025453438982367516, 0.012820794247090816, 0.016324957832694054, 0.0026591827627271414, -0.020545486360788345, -0.013127961196005344, -0.011563573032617569, 0.04682198166847229, 0.044915638864040375, 0.024604272097349167, 0.003424996044486761, -0.016445044428110123, -0.0263151116669178, -0.018806343898177147, -0.04930201917886734, -0.054208457469940186, 0.0037697169464081526, -0.00796101801097393, -0.04734594002366066, 0.03395939618349075, 0.02006351202726364, -0.007259441539645195, 0.0029383699875324965, 0.06628645956516266, 0.0028069945983588696, -0.016218356788158417, 0.0049439687281847, 0.030042150989174843, 0.05525603145360947, -0.04827088117599487, -0.008276697248220444, -0.08261951804161072, -0.058486223220825195, 0.008953606709837914, -0.042546793818473816, 0.028934400528669357, 0.07800187915563583, 0.004267135169357061, 0.01964453235268593, 0.03083600290119648, 0.013292236253619194, -0.005560500547289848, -0.004827389493584633, -0.0004913245793431997, 0.00849324930459261, 0.025109507143497467, 0.03462570905685425, 0.02760198339819908, 0.018252912908792496, 0.028218932449817657, -0.008695170283317566, 0.0006922112661413848, 0.021137412637472153, 0.014051931910216808, -0.03274533897638321, 0.030040109530091286, 0.025479648262262344, -0.0309401024132967, 0.01027720607817173, 0.01638144627213478, -0.024922756478190422, 0.016246216371655464, 0.011950056068599224, 0.014934275299310684, 0.008403390645980835, -0.0006756838993169367, 0.012590236961841583, 0.040068164467811584, 0.01754455454647541, 0.06661613285541534, 0.006579773500561714, 0.06757736206054688, 0.025570599362254143, -0.0018160404870286584, 0.016555393114686012, -0.02164098434150219, 0.05416764318943024, -0.010405238717794418, 0.007695911917835474, 0.05687692016363144, 0.009188881143927574, -0.03364482894539833, -0.018742667511105537, -0.0316457599401474, -0.038035932928323746, -0.010083302855491638, 0.0340045727789402, -0.024927714839577675, -0.006895049475133419, -0.009220539592206478, 0.04210422560572624, 0.023337729275226593, 0.06018448993563652, -0.01435268297791481, 0.0170366782695055, -0.012313365004956722, 0.016914892941713333, 0.0038298137951642275, -0.013705816119909286, 0.014387445524334908, -0.03336844965815544, 0.025857489556074142, 0.01728767342865467, 0.04365287721157074, -0.0086439223960042, -0.012205440551042557, 0.0231466181576252, -0.044836532324552536, -0.008158905431628227, 0.028294550254940987, 0.000025306135285063647, -0.009570648893713951, -0.0042838603258132935, 0.043012186884880066, -0.033265624195337296, 0.04812505841255188, -0.01775381527841091, -0.01715809479355812, -0.010882260277867317, -0.016884177923202515, -0.014789339154958725, 0.03239963576197624, 0.015532932244241238, -0.025695916265249252, -0.008944736793637276, -0.00969387125223875, 0.002093469025567174, 0.023595303297042847, -0.04176948592066765, -0.011825487948954105, -0.024743055924773216, -0.01644033193588257, -0.037472452968358994, 0.00916566327214241, 0.001256575807929039, 0.006038181483745575, 0.04228619858622551, 0.031469255685806274, -0.02647467516362667, 0.027544116601347923, -0.0025820692535489798, 0.04124250262975693, -0.049813609570264816, 0.0058142258785665035, -0.010059208609163761, -0.06705095618963242, 0.004982216749340296, -0.043910108506679535, -0.004806641489267349, 0.009844262152910233, 0.027664119377732277, 0.017306959256529808, 0.07623478770256042, -0.021130163222551346, -0.005522951018065214, 0.006362486630678177, -0.006158377043902874, -0.058558233082294464, 0.03858764097094536, 0.04902137070894241, 0.05503624677658081, 0.020985940471291542, 0.027711911126971245, -0.031584642827510834, 0.009473517537117004, 0.042026810348033905, 0.039728548377752304, -0.020240439102053642, -0.045942530035972595, -0.013906057924032211, 0.05841178447008133, -0.00012505269842222333, 0.0037002761382609606, 0.026545697823166847, -0.023782290518283844, -0.027017204090952873, -0.04554184526205063, 0.022504610940814018, -0.02422378771007061, -0.01960712857544422, -0.032388053834438324, -0.031450431793928146, -0.010864034295082092, 0.017055876553058624, 0.003358143614605069, 0.04237357899546623, -0.04970822110772133, 0.02355191297829151, -0.03464330732822418, -0.01567409187555313, -0.009641333483159542, -0.02244739793241024, 0.07767019420862198, 0.05705699697136879, -0.008518185466527939, -0.022721845656633377, -0.038322195410728455, -0.03883626312017441, -0.015309846960008144, 0.036497268825769424, 0.014688348397612572, 0.014419515617191792, -0.019211743026971817, -0.000736426969524473, -0.02202696166932583, -0.005273425951600075, -0.046345025300979614, 0.016593890264630318, -0.014911487698554993, -0.019533248618245125, -0.03442312031984329, -0.013760079629719257, 0.016699813306331635, -0.07255882024765015, 0.024957122281193733, -0.0066607180051505566, -0.015737319365143776, -0.02619301527738571, -0.0317082479596138, -0.044325802475214005, -0.03897944092750549, 0.0014497782103717327, -0.04208265244960785, 0.06963556259870529, 0.011380298994481564, -0.011669810861349106, 0.01576419547200203, -0.015598686411976814, 0.04998566582798958, -0.017069803550839424, -0.06471751630306244, -0.02225465513765812, -0.005171873141080141, 0.025640496984124184, -0.01836489327251911, -0.057062044739723206, 0.001410427619703114, 0.00007429203105857596, 0.015464636497199535, 0.014757493510842323, 0.03297438472509384, 0.012284492142498493, -0.008488397113978863, 0.020152287557721138, -0.02148149348795414, 0.0018819423858076334, 0.01374557800590992, -0.01506239827722311, 0.011426093988120556, 0.001649559591896832 ]
Faster TensorFlow models in Hugging Face Transformers
jplu
January 26, 2021
tf-serving
guide, nlp
https://huggingface.co/blog/tf-serving
How to install TensorFlow Serving? There are three ways to install and use TensorFlow Serving: - through a Docker container, - through an apt package, - or using pip. To make things easier and compliant with all the existing OS, we will use Docker in this tutorial.
[ 0.0583602674305439, -0.046596709638834, 0.06119744852185249, 0.06297047436237335, 0.03258979693055153, 0.03681809455156326, -0.0018724618712440133, 0.03748368099331856, -0.05062173306941986, -0.03705926984548569, -0.07894399017095566, 0.03208212926983833, -0.012887496501207352, 0.08032350987195969, 0.008014933206140995, -0.015696896240115166, 0.09813346713781357, -0.03011002391576767, 0.008723228238523006, 0.013501588255167007, -0.00785570777952671, -0.009754960425198078, -0.015683477744460106, -0.00452079763635993, -0.03844725713133812, -0.045766111463308334, 0.010242492891848087, 0.0714656338095665, -0.01766073890030384, 0.021895194426178932, -0.05228786915540695, 0.01990409940481186, -0.018192719668149948, -0.058909881860017776, 0.024930447340011597, 0.0019410649547353387, -0.07695876806974411, 0.06236380338668823, 0.07417802512645721, -0.025907175615429878, -0.00004045609966851771, -0.0015659172786399722, -0.07486990839242935, 0.09116362780332565, -0.03366062417626381, -0.01566682755947113, -0.12657280266284943, 0.0654764324426651, 0.007975169457495213, 0.004789954051375389, -0.07473199814558029, 0.06698163598775864, 0.005431734956800938, -0.05356232076883316, 0.03429092839360237, 0.04146715998649597, -0.001040400704368949, 0.024173352867364883, -0.008741541765630245, 0.029720177873969078, 0.07948926091194153, 0.04150167852640152, 0.022059502080082893, 0.03186749294400215, -0.049027714878320694, -0.029811397194862366, -0.05098715052008629, -0.021773895248770714, -0.0023090841714292765, -0.07452233880758286, 0.028619881719350815, -0.003250541165471077, -0.01244137529283762, -0.025174619629979134, 0.07287543267011642, -0.07153476029634476, 0.02011372521519661, 0.039880141615867615, 0.019555658102035522, 0.03222108259797096, -0.0350818857550621, 0.0030457552056759596, 0.034075018018484116, 0.03987611457705498, 0.030630962923169136, 0.0055773695930838585, -0.016720669344067574, 0.004274279810488224, -0.03144266456365585, 0.08281047642230988, 0.0925765410065651, -0.06124952808022499, -0.007326263003051281, -0.010952161625027657, 0.050394024699926376, -0.05262298509478569, -0.0010809045052155852, -0.011272354982793331, -0.0016663630958646536, -0.014663281850516796, -0.014384266920387745, -0.04795238375663757, -0.006289397366344929, -0.02092456817626953, 0.012891434133052826, 0.02489384077489376, 0.01131841354072094, -0.06512417644262314, -0.0452236570417881, -0.08200099319219589, 0.037919290363788605, -0.010917175561189651, -0.016395090147852898, 0.06475202739238739, -0.11959847062826157, 0.08208679407835007, -0.00861923024058342, -0.046868469566106796, 0.0009291023598052561, 0.026556000113487244, 0.0478053092956543, 0.10479288548231125, 0.06322286278009415, -0.008633354678750038, -0.0037626964040100574, 0.06251545995473862, 0.0011496945517137647, 0.0006026699556969106, 0.031395524740219116, -0.04904607683420181, 0.05775221437215805, 0.011326830834150314, 0.06173200160264969, 0.01747920736670494, 0.030614512041211128, -0.018329080194234848, 0.016818812116980553, -0.04507674649357796, 0.011587957851588726, -0.016668004915118217, -0.008701261132955551, 0.09362754970788956, -0.005647249985486269, 0.10063549131155014, 0.0466780848801136, -0.02959817461669445, -0.058361902832984924, -0.0006813037325628102, 0.04320128634572029, 0.011577761732041836, -0.032276034355163574, 0.06986063718795776, -0.011423486284911633, 0.00005430543387774378, 0.04014222323894501, 0.06537485867738724, 0.0023492604959756136, 0.002819026354700327, -0.06802214682102203, -0.030274583026766777, 0.03517136350274086, -0.07188031077384949, -0.0805373266339302, -0.006408373825252056, 0.04878082871437073, -0.0468347892165184, 0.0025759288109838963, -0.00237801275216043, 0.048895739018917084, -0.011037378571927547, -0.026012299582362175, -0.034404098987579346, 0.007193943951278925, 0.03198188543319702, 0.1269100159406662, -0.01321016252040863, 0.0780869796872139, 0.05736790597438812, 0.02399241179227829, -0.08907714486122131, -0.02038624882698059, 0.05988311395049095, -0.01635485142469406, 0.014159728772938251, 0.02767535112798214, -0.0554758682847023, 0.010222574695944786, -0.03733731061220169, 0.1009688526391983, 0.009289166890084743, -0.024213824421167374, -0.04446294158697128, 0.019413400441408157, 0.019672993570566177, 0.003867248073220253, 0.026054803282022476, -0.0764734297990799, 0.06519050151109695, 0.02538769692182541, 0.05110374838113785, 0.004880206193774939, -0.019855760037899017, -0.06594814360141754, -0.02879059500992298, -0.019241221249103546, 0.06982555985450745, 0.0005283151986077428, -0.11940202862024307, 0.008954796008765697, 0.04031204432249069, -0.011791270226240158, -0.1213187649846077, 0.024306122213602066, -0.05975647643208504, 0.022867601364850998, -0.01006381120532751, -0.05324803665280342, 0.011411769315600395, -0.052357498556375504, -0.03789364919066429, 0.17496314644813538, -0.03316986933350563, -0.001114771468564868, -0.0043753692880272865, -0.07536104321479797, 0.015398374758660793, 0.0733899474143982, 0.014330029487609863, 0.07490745931863785, -0.037314411252737045, -0.02068689651787281, -0.07084361463785172, -0.004569040611386299, 0.08641837537288666, 0.05756198614835739, 0.023886200040578842, 0.0013310352806001902, 0.01208867784589529, 0.04083980619907379, -0.008725764229893684, 0.04242846369743347, -0.032849136739969254, -0.030984019860625267, 0.0024958308786153793, 0.006440442521125078, -0.021939193829894066, 0.03900483250617981, -0.020240824669599533, 0.0136267626658082, -0.09516967087984085, -0.028941137716174126, -0.01932946778833866, 0.012331773526966572, -0.02033871039748192, 0.035524386912584305, -0.004019006621092558, 0.005961854010820389, -0.015579319559037685, -0.025808636099100113, 0.06693645566701889, 0.037484798580408096, -0.0018429443007335067, -0.028550678864121437, -0.050665464252233505, -0.019021863117814064, -0.007799421437084675, -0.024277539923787117, -0.04072768986225128, 0.009442788548767567, -0.005540240090340376, 0.003416503546759486, -0.0335114412009716, -0.005606045480817556, 0.003959253430366516, 0.015245463699102402, 0.0006012743688188493, 0.008454855531454086, -0.02454138919711113, -0.004088536370545626, -0.046069130301475525, 0.016481654718518257, -0.0057563167065382, 0.0728965774178505, 0.0418204627931118, -0.04141680523753166, -0.0024473099038004875, 0.01128147728741169, -0.031545963138341904, -0.033413853496313095, 0.012811417691409588, -0.02959822304546833, 0.05004383251070976, 0.026361804455518723, -0.01564866304397583, -0.018664689734578133, 0.004264086484909058, -0.006049592979252338, 0.01586095429956913, -0.012962475419044495, 0.010854811407625675, -0.024439282715320587, -0.007345451973378658, 0.006249092053622007, -0.022023148834705353, -0.03276001662015915, 0.03232738375663757, -0.008254682645201683, -0.03264540061354637, -0.09080369770526886, -0.040409401059150696, -0.021482108160853386, 0.05049259215593338, -0.0014778851764276624, -0.009970528073608875, 0.06694682687520981, 0.0003592735738493502, -0.007416316773742437, -0.013922367244958878, -0.010521880351006985, 0.02404821664094925, 0.02803027257323265, 0.01522983331233263, -0.017565056681632996, -0.007083773612976074, 0.0459040142595768, 0.016176166012883186, 0.04152373969554901, -0.005188100039958954, -0.056168071925640106, 0.032986558973789215, 0.03724018111824989, 0.0011805128306150436, -0.008921942673623562, 0.020674878731369972, 0.020364245399832726, 0.0507812537252903, 0.010281969793140888, -0.025651291012763977, -0.034275688230991364, -0.027353735640645027, -0.026211801916360855, -0.0054624248296022415, -0.07142611593008041, 0.014164759777486324, -0.007236205507069826, -0.014108366332948208, 0.04017425701022148, -0.02254924364387989, -0.01647757552564144, -0.018895262852311134, 0.020390892401337624, -0.06093643978238106, -0.02993158809840679, -0.007083669770509005, 0.0014856272609904408, 0.032855354249477386, -0.0012313253246247768, -0.013041461817920208, -0.016002381220459938, -0.002765589626505971, 0.010430310852825642, 0.009086523205041885, 0.019142158329486847, -0.003585315542295575, 0.012970361858606339, 0.060436610132455826, 0.022720204666256905, 0.004046112298965454, -0.029553407803177834, -0.027761708945035934, 0.03053746372461319, -0.035036034882068634, -0.04399946331977844, 0.037724945694208145, 0.005897935945540667, 0.0056959595531225204, 0.01738905720412731, 0.03295212611556053, -0.0008898577652871609, 0.047686588019132614, -0.00624130479991436, 0.013673991896212101, 0.0012665746035054326, -0.002655518939718604, -0.014260808005928993, -0.014540102332830429, 0.09075254946947098, 0.03045961819589138, -0.012504774145781994, -0.035758040845394135, -0.0024155331775546074, 0.00007437739259330556, -0.0000590040726820007, -0.018859094008803368, -0.00895888265222311, -0.0074874344281852245, 0.02543255314230919, 0.025780117139220238, -0.00014203447790350765, -0.04116416722536087, 0.05767744407057762, 0.00028036642470397055, -0.020070703700184822, -0.018121248111128807, 0.008452922105789185, 0.04815737530589104, -0.01882055029273033, 0.019970323890447617, 0.010025112889707088, -0.037186939269304276, 0.025243356823921204, -0.001168424030765891, -0.012006237171590328, -0.012930020689964294, 0.0033093781676143408, 0.015458126552402973, -0.009663823060691357, -0.0006316422950476408, 0.020581457763910294, -0.017730215564370155, 0.016221927478909492, -0.047757912427186966, 0.010712769813835621, 0.05566544830799103, -0.02422398328781128, -0.04660966619849205, -0.0035277502611279488, 0.05188250169157982, 0.032416097819805145, 0.01618289202451706, -0.012468031607568264, -0.02010641060769558, -0.010208703577518463, 0.00976477563381195, 0.05372151732444763, -0.00592326233163476, -0.005056701600551605, 0.03378411382436752, -0.03857433423399925, -0.0027551043312996626, 0.045423686504364014, 0.00663868198171258, 0.013165279291570187, -0.05477575585246086, -0.011543497443199158, 0.052037883549928665, -0.0030535240657627583, -0.017352566123008728, -0.028949201107025146, 0.026745514944195747, 0.03989413380622864, -0.06881384551525116, 0.0410289503633976, 0.05415349081158638, -0.04924951121211052, 0.032725490629673004, -0.014506631530821323, 0.03527924790978432, 0.03391311690211296, 0.022655518725514412, -0.022270862013101578, 0.005855175666511059, 0.019979845732450485, 0.020353136584162712, -0.00541801517829299, -0.009338916279375553, -0.0022565380204468966, 0.050375085324048996, -0.026409564539790154, -0.039393793791532516, -0.0024483611341565847, -0.010102863423526287, -0.0037986948154866695, 0.0024119128938764334, 0.026811890304088593, -0.1007678210735321, -0.030505016446113586, -0.01086238119751215, -0.06159123778343201, 0.02803860232234001, 0.021048953756690025, -0.024180518463253975, 0.014931788668036461, 0.03568369522690773, 0.04240773245692253, 0.020024990662932396, -0.02538352645933628, -0.010857608169317245, -0.01918986067175865, -0.023898737505078316, -0.025374844670295715, -0.011059525422751904, -0.017355531454086304, 0.010579409077763557, 0.06466786563396454, 0.02309904433786869, 0.0029463726095855236, 0.029016047716140747, 0.002355091506615281, 0.02145947329699993, 0.036591384559869766, -0.017979636788368225, 0.03863753750920296, -0.005755595862865448, 0.005052847787737846, 0.00510791502892971, 0.013558633625507355, -0.02111137844622135, 0.015219655819237232, 0.050419554114341736, -0.021235188469290733, -0.03379803150892258, 0.04979337379336357, 0.010413788259029388, 0.02391105890274048, -0.006485162302851677, 0.07288334518671036, -0.0264387596398592, 0.02756940759718418, -0.006335927173495293, -0.00752819050103426, -0.016135191544890404, -0.052512940019369125, -0.027041465044021606, -0.02630218118429184, 0.008694631047546864, 0.011256763711571693, 0.02601013146340847, -0.0035189283080399036, -0.0056728171184659, -0.013981087133288383, -0.035265859216451645, -0.01200683694332838, -0.04680309817194939, -0.0011803380912169814, -0.006922597531229258, -0.06689052283763885, 0.033342331647872925, 0.051650356501340866, -0.020507238805294037, 0.01336837187409401, 0.01483745314180851, 0.017216261476278305, 0.002344497013837099, 0.03295544907450676, 0.025060312822461128, 0.03443978726863861, -0.023275500163435936, -0.04075762256979942, -0.05028970539569855, -0.05542419105768204, -0.011284631676971912, -0.006512310355901718, 0.004309517331421375, 0.09342628717422485, 0.04617888852953911, 0.03828999772667885, -0.004125917796045542, 0.021805165335536003, 0.004394877701997757, 0.01644570380449295, -0.05333152040839195, 0.025807539001107216, -0.016639288514852524, 0.05477260425686836, 0.0285349003970623, -0.00002874513484130148, 0.009536572732031345, -0.0002140359574696049, 0.014468679204583168, 0.007880281656980515, -0.01912294328212738, -0.013454318977892399, -0.027125900611281395, 0.01954594999551773, -0.0455472394824028, -0.03956333175301552, 0.004632233642041683, -0.005528194829821587, 0.04293970763683319, 0.003444923320785165, 0.05127812176942825, 0.00473454175516963, 0.007843291386961937, -0.018140515312552452, 0.009541521780192852, -0.04195402190089226, 0.07456989586353302, -0.02740531973540783, 0.018104877322912216, 0.0029055201448500156, 0.01009036973118782, -0.018828706815838814, 0.014384739100933075, 0.0688517838716507, 0.02665587328374386, 0.0406411737203598, 0.02906891144812107, -0.030017957091331482, -0.04262625426054001, -0.02253398299217224, -0.015808001160621643, -0.037415891885757446, 0.014081803150475025, 0.013746408745646477, 0.0009868000634014606, 0.008300427347421646, -0.030090071260929108, 0.04788878187537193, 0.031144745647907257, 0.04716140404343605, -0.014573722146451473, -0.010450228117406368, 0.030926991254091263, 0.022388434037566185, 0.00932363048195839, 0.017635053023695946, 0.0028906799852848053, -0.003714220831170678, 0.030764294788241386, 0.020315131172537804, 0.03376730903983116, -0.03233622759580612, 0.026005636900663376, -0.012821617536246777, -0.006495992187410593, -0.031141063198447227, -0.015542536973953247, 0.013733318075537682, -0.046258699148893356, -0.024489400908350945, 0.026549289003014565, -0.05933525785803795, 0.016119815409183502, -0.041359152644872665, -0.0004334696859586984, 0.011611023917794228, -0.018812719732522964, -0.023580439388751984, 0.003659789450466633, 0.03196273744106293, -0.027959441766142845, -0.01618235372006893, -0.0029117579106241465, 0.008155733346939087, -0.02762087993323803, -0.05781330540776253, -0.02660699374973774, -0.03778042644262314, 0.02050967700779438, -0.025646116584539413, -0.010286889038980007, 0.005912797059863806, -0.012549031525850296, 0.0363481342792511, 0.040588922798633575, -0.01046944223344326, -0.013053478673100471, 0.014800162985920906, 0.022132685407996178, -0.031847912818193436, 0.01948137953877449, -0.01847001537680626, -0.030461132526397705, -0.027966776862740517, -0.024488648399710655, 0.00600662175565958, -0.03806694597005844, 0.020721549168229103, -0.010210450738668442, 0.015106095932424068, 0.007950466126203537, -0.029443735256791115, 0.039876993745565414, -0.01993267983198166, -0.05068285018205643, 0.06351763755083084, 0.013250613585114479, 0.036634381860494614, 0.03534988313913345, 0.040058694779872894, 0.0017030001617968082, 0.02277466095983982, 0.032017868012189865, -0.028563138097524643, 0.004434408154338598, -0.04341058060526848, -0.004515964537858963, 0.026733482256531715, 0.013012494891881943, 0.05193598195910454, -0.018249981105327606, 0.0287119559943676, -0.026359520852565765, -0.015339079312980175, 0.014838139526546001, -0.05596690997481346, -0.016389397904276848, -0.05963006615638733, -0.03813173621892929, -0.03462957963347435, -0.031443141400814056, 0.004592245444655418, 0.013691689819097519, -0.04117364436388016, 0.003722971770912409, -0.01964692771434784, -0.007088754326105118, -0.019074371084570885, -0.03321695327758789, 0.04731906205415726, 0.0407455712556839, -0.02251862920820713, 0.0014332483988255262, -0.024465356022119522, 0.003077674424275756, 0.0033008831087499857, 0.06077294051647186, 0.0196701493114233, 0.02320156991481781, -0.023841099813580513, 0.01362871378660202, 0.02112111821770668, -0.020832689478993416, -0.03799061104655266, 0.011937816627323627, -0.0135665163397789, -0.022349003702402115, -0.03173113241791725, 0.0009678204078227282, 0.01497138012200594, -0.0006324138958007097, 0.025132639333605766, -0.0022520218044519424, -0.0056355539709329605, 0.03590711951255798, -0.011739701963961124, -0.03122526966035366, -0.010104808956384659, -0.011514706537127495, -0.027563560754060745, -0.005300944671034813, -0.00968723464757204, 0.0029685513582080603, -0.014063887298107147, -0.027366934344172478, -0.00918523222208023, -0.02253222092986107, -0.04423762857913971, -0.025103919208049774, -0.014750654809176922, 0.05315842106938362, -0.013735436834394932, -0.06160283088684082, -0.017674587666988373, -0.002788589568808675, -0.03628964722156525, 0.03312672674655914, 0.009356293827295303, -0.004712400026619434, -0.012269824743270874, -0.0037269804161041975, -0.01190637145191431, 0.03801916539669037, 0.009628677740693092, 0.023661673069000244, -0.031326763331890106, 0.02153746224939823 ]
Faster TensorFlow models in Hugging Face Transformers
jplu
January 26, 2021
tf-serving
guide, nlp
https://huggingface.co/blog/tf-serving
What is TensorFlow Serving? TensorFlow Serving belongs to the set of tools provided by TensorFlow Extended (TFX) that makes the task of deploying a model to a server easier than ever. TensorFlow Serving provides two APIs, one that can be called upon using HTTP requests and another one using gRPC to run inference on the server.
[ 0.05717441067099571, -0.06397224217653275, 0.05285915359854698, 0.025914253666996956, 0.019907275214791298, 0.09923747181892395, -0.027813198044896126, 0.060031186789274216, -0.030384143814444542, -0.0003010203072335571, -0.11653484404087067, -0.022817164659500122, -0.009615432471036911, 0.08340408653020859, -0.03372260928153992, 0.0172596238553524, 0.07305009663105011, -0.07260413467884064, 0.03495323657989502, -0.00020302156917750835, -0.01237465813755989, -0.014085561968386173, -0.0027775876224040985, -0.018766755238175392, -0.05536908283829689, 0.008698591031134129, -0.05777192860841751, 0.021465836092829704, -0.023405149579048157, 0.03896503522992134, -0.05246806889772415, 0.03266678377985954, -0.04168865084648132, -0.08235910534858704, -0.011236107908189297, -0.03926903381943703, -0.0994638204574585, 0.04293769598007202, 0.013141565956175327, -0.03972891345620155, 0.001869240659289062, -0.012819411233067513, -0.10588149726390839, 0.050665125250816345, -0.0009217911865562201, -0.026757825165987015, -0.12386706471443176, 0.07390386611223221, 0.014356001280248165, -0.0048952773213386536, -0.07490479201078415, 0.08153805136680603, 0.008127477951347828, -0.007448908872902393, 0.05132944509387016, 0.06742606312036514, -0.006797916255891323, 0.0036645059008151293, 0.004819996654987335, 0.031335778534412384, 0.059747472405433655, 0.05501949042081833, 0.029291244223713875, 0.02283490262925625, -0.04587861895561218, -0.050547800958156586, 0.007441951893270016, -0.0204521082341671, 0.023357979953289032, -0.030806928873062134, -0.018692610785365105, 0.059017959982156754, -0.032143909484148026, -0.007645626086741686, 0.06626050919294357, -0.051077425479888916, -0.031313568353652954, -0.013899292796850204, 0.013601121492683887, 0.020236540585756302, -0.0428600050508976, 0.013248938135802746, 0.06230531260371208, -0.021357374265789986, -0.0011784166563302279, 0.034100260585546494, 0.004757115617394447, -0.032795075327157974, -0.021229514852166176, 0.04507240653038025, 0.09899507462978363, -0.07374447584152222, -0.0005471815238706768, -0.032298680394887924, 0.03181098774075508, -0.023935211822390556, 0.050166528671979904, -0.03799610584974289, 0.013068199157714844, -0.044692616909742355, -0.03082178719341755, -0.04339740052819252, -0.05796707794070244, -0.0041054668836295605, -0.004865421913564205, 0.009102747775614262, 0.026398619636893272, -0.09038761258125305, -0.049321744590997696, -0.05020493268966675, 0.014988086186349392, -0.04178861156105995, -0.0573139525949955, 0.04021259397268295, -0.08051099628210068, 0.060087259858846664, -0.023185312747955322, -0.0567428320646286, -0.013191035017371178, 0.02825673297047615, 0.08080786466598511, 0.11262790858745575, 0.049174822866916656, -0.013199316337704659, 0.010593636892735958, 0.06066061556339264, 0.04268064722418785, -0.0373973473906517, 0.06322287768125534, -0.043245282024145126, -0.000726785627193749, 0.0348280631005764, 0.010118587873876095, 0.056604400277137756, 0.041299909353256226, -0.02320791780948639, 0.004263841547071934, -0.09987861663103104, 0.0027302380185574293, -0.02123788371682167, -0.01695403642952442, 0.03376367315649986, -0.010321217589080334, 0.027636686339974403, 0.052020713686943054, -0.028458813205361366, -0.024021966382861137, -0.03560079634189606, 0.08333228528499603, -0.015221714042127132, -0.08041445165872574, 0.04747553914785385, -0.028164682909846306, 0.017971785739064217, 0.058163974434137344, 0.05691216513514519, 0.028097037225961685, -0.03523870185017586, -0.05811482295393944, 0.005448462907224894, -0.012911614961922169, -0.05981452390551567, -0.07947982847690582, 0.006159653887152672, 0.052542224526405334, 0.011943687684834003, -0.006466273684054613, -0.018569212406873703, 0.05396148934960365, -0.006546334363520145, -0.09195525199174881, -0.029531067237257957, 0.01738498918712139, 0.03526713326573372, 0.1298193335533142, 0.025788700208067894, 0.0588061660528183, 0.031179100275039673, 0.055277269333601, -0.06048358231782913, -0.027253389358520508, 0.05999267101287842, -0.00892352219671011, -0.009853314608335495, 0.01640413887798786, -0.04375670850276947, 0.02329603023827076, -0.028967050835490227, 0.06928100436925888, 0.0343477800488472, -0.055610112845897675, -0.008696594275534153, 0.004475761204957962, -0.019255969673395157, -0.003857953241094947, -0.027870967984199524, -0.08855325728654861, 0.020469339564442635, -0.012371004559099674, 0.0638270452618599, 0.06752540171146393, 0.023176118731498718, -0.07625043392181396, -0.06316717714071274, -0.011016867123544216, 0.03460146114230156, 0.033875297755002975, -0.1019073948264122, 0.012659361585974693, 0.022184209898114204, -0.012782108969986439, -0.07318011671304703, -0.0018660083878785372, -0.04347170144319534, 0.01526064332574606, -0.016530901193618774, -0.05617992579936981, -0.02587692067027092, -0.04052213951945305, -0.059372350573539734, 0.17681622505187988, -0.07005314528942108, -0.0061164735816419125, -0.03289906680583954, -0.06663425266742706, 0.0031092411372810602, 0.05748031288385391, 0.028490841388702393, 0.09983551502227783, -0.04297793656587601, -0.031755656003952026, -0.03713933378458023, -0.03726739436388016, 0.03250287100672722, 0.02663879096508026, 0.003644675249233842, 0.0252052154392004, 0.040936533361673355, 0.03880224749445915, -0.026293952018022537, 0.038538578897714615, 0.015658076852560043, 0.0061464556492865086, 0.004820206668227911, 0.00616528932005167, -0.027097871527075768, 0.06216614693403244, -0.059064511209726334, 0.015128054656088352, -0.10349908471107483, -0.013283559121191502, -0.032874174416065216, 0.04411429539322853, -0.026064656674861908, 0.027057131752371788, -0.01080204825848341, 0.033559564501047134, -0.011560819111764431, -0.01548540685325861, 0.05350223183631897, 0.04986327141523361, -0.023043038323521614, -0.010402114130556583, -0.03999295085668564, 0.004763957113027573, -0.012886286713182926, 0.014817389659583569, -0.016254374757409096, 0.014085255563259125, -0.01029218826442957, 0.02742861770093441, -0.04409331828355789, 0.0007230159244500101, -0.01012200303375721, 0.020383980125188828, 0.02302657812833786, -0.0050199441611766815, -0.010769878514111042, -0.042412906885147095, -0.05407513678073883, 0.005533548537641764, 0.0074563538655638695, 0.09067949652671814, 0.0480349026620388, -0.054760195314884186, -0.027739282697439194, 0.03596629202365875, -0.011905655264854431, -0.02536574751138687, 0.00414635706692934, -0.0204402394592762, 0.021364830434322357, 0.0336124412715435, 0.021187620237469673, -0.005149798933416605, -0.007805891800671816, -0.021615441888570786, -0.03164849057793617, -0.025371180847287178, -0.01523378025740385, -0.018772747367620468, 0.004111281130462885, -0.03218312934041023, -0.009405454620718956, -0.01604374870657921, 0.04991737753152847, -0.009914830327033997, -0.013395123183727264, -0.08512882888317108, -0.028547456488013268, 0.0016933400183916092, 0.030001668259501457, -0.008609632030129433, 0.013902770355343819, 0.03518259525299072, 0.010236856527626514, -0.008866782300174236, -0.0060925534926354885, 0.006073158700019121, -0.010539570823311806, 0.014505052007734776, -0.011112202890217304, -0.020419789478182793, 0.0007648948230780661, 0.024052344262599945, 0.016213471069931984, 0.06709810346364975, 0.017349863424897194, -0.042021263390779495, 0.009569421410560608, 0.03193361312150955, -0.006447847466915846, -0.016719596460461617, 0.015780551359057426, 0.0050156996585428715, 0.007198035251349211, -0.034636348485946655, -0.03571690618991852, -0.036765530705451965, -0.01972474716603756, -0.049486130475997925, 0.005736509338021278, -0.0302745271474123, 0.02035505324602127, 0.021913204342126846, -0.013888147659599781, 0.050118058919906616, -0.035731241106987, 0.006860989611595869, 0.00035209933412261307, 0.016616573557257652, -0.04149165377020836, -0.004852150101214647, -0.0015880237333476543, 0.03560197353363037, 0.009171990677714348, 0.032535187900066376, -0.02115289866924286, -0.0012983919586986303, -0.01973995752632618, -0.011509289965033531, 0.02752894163131714, 0.03340546414256096, -0.0024013957008719444, 0.0038698401767760515, 0.025884833186864853, 0.025841645896434784, 0.00047123420517891645, -0.03808474540710449, -0.040193237364292145, 0.027879079803824425, -0.024991188198328018, -0.040833182632923126, 0.02456808276474476, 0.0300123430788517, 0.009155875071883202, -0.009926893748342991, 0.022753603756427765, 0.006193715613335371, 0.06303231418132782, 0.006016004364937544, 0.015919705852866173, 0.010469549335539341, 0.0024267062544822693, 0.006212824024260044, -0.016907162964344025, 0.09349516779184341, 0.01360581535845995, -0.026368141174316406, -0.016910700127482414, -0.00977508258074522, 0.013460206799209118, 0.01704455353319645, -0.015741243958473206, -0.016772041097283363, 0.013753325678408146, 0.013849535025656223, 0.029960697516798973, 0.0036356367636471987, -0.03347077965736389, 0.04656637832522392, 0.015304508619010448, -0.0030579690355807543, 0.024368273094296455, 0.025366324931383133, 0.0712280198931694, 0.0022110510617494583, -0.007329627871513367, 0.001381824491545558, -0.028960179537534714, 0.02883998118340969, -0.01625346764922142, -0.002172882203012705, -0.008912737481296062, 0.002486330457031727, -0.007593568880110979, 0.046487726271152496, -0.008360239677131176, 0.04027840122580528, -0.010146921500563622, 0.009671174921095371, -0.01690201833844185, 0.029823370277881622, 0.0636790320277214, -0.032696373760700226, -0.014712360687553883, 0.02822103537619114, 0.056828029453754425, -0.012532642111182213, 0.012717602774500847, -0.004001202527433634, -0.0017769333207979798, -0.01418759860098362, 0.02064456418156624, 0.008351150900125504, -0.013831498101353645, -0.014122823253273964, 0.024752318859100342, -0.03237144649028778, 0.027530137449502945, 0.033834949135780334, 0.023013688623905182, 0.022623036056756973, -0.015164180658757687, -0.012477636337280273, 0.037076517939567566, 0.022254910320043564, -0.006059715524315834, -0.011845981702208519, 0.023549959063529968, 0.0050459071062505245, -0.05861218273639679, 0.03707290440797806, 0.06313050538301468, -0.08050579577684402, 0.011971858330070972, 0.014242163859307766, 0.024326324462890625, 0.025300538167357445, 0.030955268070101738, -0.01584383100271225, -0.0006500747986137867, 0.05034104362130165, 0.02845802903175354, 0.01286104042083025, -0.0029074582271277905, 0.006687495391815901, 0.02368655614554882, -0.02164589986205101, -0.031115397810935974, -0.014073829166591167, -0.009812681935727596, 0.0012715373886749148, 0.013067011721432209, 0.008195891976356506, -0.08097456395626068, -0.02557225339114666, 0.009011647664010525, -0.03593134507536888, 0.03474786505103111, 0.0139284273609519, -0.004210230428725481, 0.013279278762638569, 0.05619051307439804, 0.02559025213122368, 0.037862490862607956, -0.06611726433038712, 0.014323705807328224, 0.006762098986655474, -0.015244072303175926, -0.01831534504890442, -0.03353123739361763, -0.00361361145041883, 0.01575138047337532, 0.07012462615966797, 0.038934867829084396, -0.015871642157435417, 0.05278698727488518, 0.00736604817211628, 0.035384513437747955, 0.004826802760362625, 0.013939806260168552, 0.029825475066900253, -0.00993166584521532, -0.0183425210416317, 0.0031582494266331196, -0.016927460208535194, -0.02838204801082611, 0.0011905691353604198, 0.04336177185177803, -0.012837445363402367, 0.004103441722691059, 0.039008088409900665, -0.0014734602300450206, 0.01234661228954792, -0.022720038890838623, 0.06315600872039795, -0.00135277328081429, 0.011110187508165836, -0.025679295882582664, -0.014117478393018246, -0.0077031259424984455, -0.037116628140211105, -0.026180684566497803, 0.0042853690683841705, -0.018524546176195145, 0.00573065085336566, 0.030377216637134552, -0.014003253541886806, 0.0025934719014912844, 0.0014156090328469872, -0.053734563291072845, -0.008866453543305397, -0.06864846497774124, -0.003842342644929886, -0.02628997340798378, -0.034520480781793594, 0.03564348444342613, 0.048425085842609406, -0.0004895648453384638, 0.02392769791185856, 0.006679168436676264, 0.015340561978518963, 0.05217822268605232, 0.004427045118063688, 0.03172425553202629, 0.04858800396323204, -0.051403459161520004, -0.05088658630847931, -0.0479564294219017, -0.06781132519245148, -0.006483652163296938, -0.0046548848040401936, 0.01883845031261444, 0.08714810013771057, 0.008255742490291595, 0.059211522340774536, 0.03380947932600975, 0.016433976590633392, -0.005520217586308718, 0.046080078929662704, -0.037010762840509415, -0.008880688808858395, -0.027687467634677887, 0.053458888083696365, 0.038174696266651154, 0.025094570592045784, -0.004734664224088192, 0.008984620682895184, 0.010116524994373322, 0.01969328708946705, -0.02004753239452839, -0.012738985940814018, 0.001432460849173367, 0.03762403875589371, -0.00505398353561759, -0.02941831573843956, -0.0022280076518654823, -0.0056581017561256886, 0.016216568648815155, 0.0067094312980771065, 0.04104147478938103, 0.014253003522753716, 0.010195176117122173, -0.009386658668518066, 0.017428206279873848, -0.03207554295659065, 0.0857778787612915, 0.0032569931354373693, 0.03394758328795433, 0.030206486582756042, 0.0455598346889019, 0.010748705826699734, -0.04338406026363373, 0.08147582411766052, 0.03486494719982147, 0.012344160117208958, 0.02499832771718502, -0.02106902189552784, -0.044504836201667786, -0.010176796466112137, -0.018055466935038567, -0.009995898231863976, -0.03536287695169449, 0.03291147202253342, 0.011017810553312302, 0.03076017275452614, 0.0022772543597966433, 0.03464536368846893, 0.01362201664596796, 0.019941944628953934, -0.024993374943733215, 0.011647387407720089, 0.05115305259823799, 0.04076478257775307, 0.011919551528990269, 0.009714491665363312, -0.007936765439808369, -0.007922831922769547, 0.018295640125870705, 0.023177262395620346, 0.008177278563380241, -0.031654756516218185, 0.011673788540065289, 0.0022426003124564886, -0.04058777168393135, -0.036116719245910645, 0.0014929879689589143, 0.005298429634422064, -0.012378586456179619, 0.02208460494875908, -0.003982706926763058, -0.043279848992824554, 0.04182552173733711, -0.005857046693563461, 0.007260472979396582, -0.0037913562264293432, -0.01210220716893673, -0.020889241248369217, -0.008708154782652855, 0.03655175119638443, -0.031834620982408524, -0.04214029014110565, -0.0335095189511776, -0.017798956483602524, -0.008587795309722424, -0.0440446175634861, 0.0010374583071097732, -0.010251871310174465, 0.021820934489369392, -0.015226180665194988, 0.003871666267514229, 0.015509779565036297, 0.029980091378092766, 0.03401464223861694, 0.06321997940540314, 0.010550780221819878, -0.002648755209520459, 0.015254398807883263, 0.027765555307269096, 0.004481152631342411, 0.018124623224139214, -0.039713095873594284, -0.042867448180913925, -0.00963756162673235, -0.021306995302438736, 0.04672786220908165, -0.04012226685881615, 0.02858770079910755, -0.014961707405745983, 0.026512615382671356, -0.03171681612730026, -0.006305504124611616, 0.005769583396613598, -0.03771064057946205, -0.03673509135842323, 0.026543457061052322, 0.019876234233379364, 0.02739891968667507, 0.05687878653407097, 0.044191908091306686, -0.009529042057693005, -0.00027724113897420466, 0.027055758982896805, 0.012974988669157028, -0.0011644548503682017, -0.034835465252399445, 0.0021330625750124454, 0.021551767364144325, 0.024527063593268394, 0.043686140328645706, -0.03355829417705536, 0.020022395998239517, -0.04762927442789078, -0.006886031944304705, -0.006525971461087465, -0.049528781324625015, -0.008982794359326363, -0.046581950038671494, -0.0443074069917202, -0.07250212877988815, -0.003347569378092885, 0.02350972406566143, 0.024858936667442322, -0.029406219720840454, 0.03288011997938156, -0.02176862210035324, -0.0025085872039198875, -0.025168435648083687, -0.0263360682874918, 0.023697182536125183, 0.022335799410939217, -0.02585369162261486, -0.0029493668116629124, -0.031958021223545074, -0.013893899507820606, 0.005724761169403791, 0.027029069140553474, 0.03990356624126434, -0.011881482787430286, 0.005552890710532665, 0.012878147885203362, 0.014072275720536709, -0.020078297704458237, -0.026169434189796448, 0.015898821875452995, 0.019859302788972855, -0.017828484997153282, -0.030802609398961067, 0.0016202423721551895, 0.04035300761461258, -0.04307606816291809, 0.008036088198423386, -0.021566014736890793, 0.031733136624097824, -0.018750537186861038, -0.04730268567800522, -0.03181697428226471, 0.005968279670923948, -0.030299585312604904, -0.05479424074292183, 0.01037971954792738, 0.013495545834302902, 0.024759376421570778, -0.014413969591259956, 0.0031998041085898876, 0.02209301106631756, -0.03839736059308052, -0.026198752224445343, -0.0036399466916918755, -0.043286725878715515, 0.021814459934830666, -0.004687743727117777, -0.03440738841891289, -0.02122044563293457, -0.022277139127254486, -0.020021777600049973, 0.025207394734025, 0.01843211241066456, 0.00747273862361908, 0.015219085849821568, 0.011867628432810307, -0.008110533468425274, 0.044452108442783356, 0.0250458512455225, -0.011933996342122555, -0.03301938250660896, 0.03068539686501026 ]
Faster TensorFlow models in Hugging Face Transformers
jplu
January 26, 2021
tf-serving
guide, nlp
https://huggingface.co/blog/tf-serving
What is a SavedModel? A SavedModel contains a standalone TensorFlow model, including its weights and its architecture. It does not require the original source of the model to be run, which makes it useful for sharing or deploying with any backend that supports reading a SavedModel such as Java, Go, C++ or JavaScript among others. The internal structure of a SavedModel is represented as such: savedmodel /assets -> here the needed assets by the model (if any) /variables -> here the model checkpoints that contains the weights saved_model.pb -> protobuf file representing the model graph
[ -0.02543627843260765, -0.03317559137940407, 0.0032216692343354225, 0.013226507231593132, 0.08200183510780334, 0.042480334639549255, 0.009752091020345688, -0.001442275824956596, -0.05513112619519234, -0.02243373543024063, -0.0350293330848217, 0.03278453275561333, -0.015227760188281536, -0.013447746634483337, 0.01180245727300644, -0.04635307565331459, 0.04051120579242706, -0.0488118976354599, 0.03899526968598366, 0.014140195213258266, -0.007939844392240047, -0.07024498283863068, 0.008325413800776005, -0.06704393029212952, -0.04714708775281906, -0.05031351000070572, 0.010434363037347794, -0.014112826436758041, -0.05076463147997856, 0.015581979416310787, -0.10060406476259232, 0.018791820853948593, -0.01755751483142376, -0.0666707307100296, -0.002798739355057478, 0.017667731270194054, -0.09782624244689941, 0.06895924359560013, -0.011654150672256947, -0.08045001327991486, -0.017405029386281967, 0.03780103847384453, -0.06376846879720688, 0.07238543033599854, 0.04981774836778641, -0.06232457607984543, -0.13724836707115173, 0.013915439136326313, -0.008801662363111973, -0.04989999160170555, -0.07894591987133026, -0.017188990488648415, -0.02186231128871441, 0.04613514617085457, -0.024340087547898293, 0.06747991591691971, -0.011501537635922432, 0.024281378835439682, 0.028978420421481133, 0.03316832706332207, 0.06659642606973648, 0.06301316618919373, 0.03758709505200386, 0.030944811180233955, 0.03527423366904259, -0.027872126549482346, 0.041419051587581635, -0.023050624877214432, 0.0047027901746332645, -0.04743235185742378, -0.029287198558449745, -0.008564833551645279, -0.020516211166977882, 0.0007534773903898895, -0.022293828427791595, 0.00199364242143929, -0.03919050469994545, 0.04506353288888931, 0.05039472132921219, 0.016766441985964775, 0.015608692541718483, 0.027385475113987923, 0.021566884592175484, 0.007471597753465176, 0.042686887085437775, -0.026542440056800842, 0.02733142115175724, -0.08575437217950821, -0.00970468670129776, 0.07744903862476349, -0.0058095152489840984, -0.1027972400188446, -0.004754338413476944, 0.02032538503408432, 0.08162273466587067, -0.015122732147574425, 0.010150976479053497, -0.027828803285956383, -0.044500116258859634, 0.013137523084878922, -0.016451135277748108, -0.050130490213632584, -0.043731939047575, -0.022674918174743652, -0.035051167011260986, -0.002931278431788087, -0.00839733425527811, -0.06485851854085922, -0.020883657038211823, -0.03494657203555107, -0.01674550026655197, -0.06847658008337021, -0.02569500170648098, 0.03207672759890556, -0.03902709111571312, 0.06270315498113632, -0.032714154571294785, -0.024050051346421242, 0.0499332919716835, 0.05931294336915016, 0.020574605092406273, 0.08980520069599152, 0.06723915040493011, -0.021005649119615555, 0.05428579822182655, 0.09327864646911621, 0.042072247713804245, 0.00560700474306941, 0.011821271851658821, -0.04745746776461601, 0.034588564187288284, 0.06999281048774719, 0.012154352851212025, 0.00399442482739687, -0.024889137595891953, -0.05455658584833145, 0.01182304136455059, -0.020663848146796227, 0.02169993333518505, 0.006091675721108913, -0.05729692429304123, 0.04531526938080788, -0.023947983980178833, 0.007181419525295496, 0.025946980342268944, -0.05629323795437813, 0.02183450199663639, 0.01080042589455843, 0.04063400626182556, -0.0028545837849378586, -0.0734705999493599, 0.007595605216920376, 0.029639581218361855, -0.0734100416302681, -0.0026327732484787703, 0.05503464862704277, 0.005158016458153725, -0.004804761148989201, -0.0641402155160904, -0.014786635525524616, 0.03801116347312927, 0.0021725636906921864, -0.017194868996739388, 0.0006330817705020308, 0.036527931690216064, 0.004710485693067312, -0.00686334865167737, -0.013400007970631123, 0.047579579055309296, -0.023941868916153908, -0.0001766543136909604, -0.08494507521390915, 0.11929406225681305, 0.011066598817706108, 0.0313074067234993, 0.08391115069389343, 0.044036246836185455, 0.05291390419006348, 0.060109954327344894, -0.05257294327020645, -0.061649419367313385, 0.005964532028883696, -0.014444106258451939, 0.016423529013991356, 0.05594271421432495, -0.061134591698646545, -0.009459268301725388, -0.05186770483851433, -0.04040725529193878, 0.02910454012453556, -0.05441746488213539, -0.013123754411935806, 0.008815309032797813, -0.004057308193296194, 0.025517776608467102, -0.09257418662309647, -0.033717647194862366, 0.08177459985017776, 0.07167696952819824, 0.013262975960969925, 0.058959346264600754, 0.008234640583395958, -0.06521430611610413, -0.06737746298313141, -0.019917933270335197, 0.06123588979244232, 0.06905283778905869, -0.09597132354974747, 0.05575833097100258, -0.04750582575798035, -0.02928178571164608, -0.043334487825632095, 0.06420259177684784, -0.14036835730075836, 0.021763797849416733, -0.04757080599665642, -0.07055395096540451, -0.022333640605211258, -0.015957627445459366, -0.029630616307258606, 0.16986721754074097, -0.017712412402033806, -0.03731906786561012, 0.0025603927206248045, -0.07958680391311646, 0.018950629979372025, -0.007435252424329519, 0.020376263186335564, 0.09634653478860855, -0.055816520005464554, -0.003974629566073418, -0.06402047723531723, -0.0052558658644557, 0.0722149983048439, 0.07402627170085907, 0.012962707318365574, 0.004844168666750193, 0.06174246594309807, 0.050912994891405106, -0.04725458845496178, 0.04545037820935249, -0.014807573519647121, 0.030635584145784378, 0.009175275452435017, 0.023712310940027237, -0.00449523888528347, 0.04289647564291954, -0.002824840834364295, -0.08434338122606277, -0.003289096290245652, -0.030527858063578606, -0.03006073087453842, 0.033995065838098526, -0.020801516249775887, 0.05583830550312996, 0.037170037627220154, -0.020689697936177254, -0.015714148059487343, -0.006753618363291025, 0.03884308412671089, -0.0035195520613342524, 0.004482777323573828, -0.04898689314723015, -0.03906244784593582, -0.016287637874484062, -0.03498009964823723, 0.028994174674153328, -0.023367485031485558, 0.01771252602338791, 0.022418662905693054, 0.03616729751229286, -0.05557751655578613, -0.03948241472244263, -0.006689030677080154, 0.033101972192525864, 0.0012273099273443222, -0.0012341408291831613, -0.029521826654672623, -0.024516373872756958, -0.018970491364598274, -0.0015636613825336099, -0.02101321332156658, 0.05189996212720871, 0.04124029725790024, 0.021386174485087395, 0.005328429397195578, 0.040094390511512756, 0.005059167742729187, 0.009703432209789753, 0.03733109310269356, 0.01867908425629139, 0.053900670260190964, -0.011062697507441044, 0.0212944857776165, -0.01779829151928425, 0.017526302486658096, -0.036260936409235, -0.013590778224170208, 0.006203672848641872, 0.009246593341231346, -0.025722844526171684, 0.008745369501411915, 0.054387323558330536, -0.03773161768913269, -0.010193721391260624, 0.07656146585941315, -0.003080732887610793, 0.013152061030268669, -0.10679449886083603, -0.016039099544286728, 0.024281470105051994, 0.01134469360113144, -0.0025510466657578945, 0.019082700833678246, 0.00853358581662178, 0.04516797885298729, -0.02704426646232605, 0.03059779480099678, 0.031099354848265648, -0.021140383556485176, 0.041616905480623245, 0.041006263345479965, -0.0400107316672802, 0.027430584654211998, -0.006903339177370071, 0.027624784037470818, 0.020269080996513367, 0.0006919893785379827, -0.055717017501592636, 0.027838269248604774, 0.0028665829449892044, 0.009730298072099686, -0.03817087039351463, 0.027716826647520065, 0.030419107526540756, 0.02072221413254738, -0.032078780233860016, -0.04776017367839813, -0.033443741500377655, -0.04001263529062271, -0.040840327739715576, 0.003599481889978051, -0.01623828336596489, 0.0028659729287028313, -0.009790526703000069, 0.030429694801568985, 0.05664489045739174, -0.03446361422538757, -0.007607069797813892, 0.013819080777466297, 0.016006359830498695, -0.00567286554723978, -0.029009440913796425, 0.008115610107779503, 0.017442908138036728, 0.043229684233665466, 0.018532859161496162, -0.011519012041389942, -0.020923787727952003, -0.042208705097436905, -0.018093299120664597, 0.05455406755208969, 0.013466328382492065, 0.00898698903620243, 0.018677305430173874, -0.009171457961201668, 0.004433844238519669, 0.004352873656898737, -0.06587762385606766, -0.04353884607553482, 0.0016803588951006532, -0.025971267372369766, -0.05058956891298294, 0.045577190816402435, 0.035552144050598145, 0.04525241255760193, -0.04233938455581665, 0.05039665475487709, -0.02218659408390522, 0.05229919031262398, 0.009439699351787567, 0.02155894786119461, -0.03957288712263107, 0.030411941930651665, -0.0027436083182692528, -0.014742644503712654, 0.09377150237560272, 0.03149361163377762, 0.014147507026791573, -0.01887819543480873, 0.0021468601189553738, 0.012054447084665298, -0.03398465737700462, -0.00583497853949666, 0.02579207718372345, 0.012336187064647675, 0.0057982951402664185, 0.05854189395904541, 0.01862955279648304, -0.04782560467720032, 0.05967428907752037, -0.009100459516048431, -0.016535233706235886, 0.013760675676167011, 0.025238998234272003, 0.01995270699262619, -0.021292541176080704, 0.017789842560887337, 0.04634484276175499, -0.04790134355425835, 0.005100421141833067, 0.014592300169169903, 0.02362027019262314, 0.012538540177047253, -0.030566006898880005, -0.0190473273396492, 0.009672743268311024, -0.06074477359652519, -0.026820238679647446, 0.018147334456443787, 0.0452512763440609, -0.02716834843158722, 0.028540948405861855, 0.06870700418949127, -0.012244530953466892, -0.003696095198392868, -0.021237410604953766, 0.04155528545379639, 0.0034086103551089764, 0.008435172028839588, -0.011260676197707653, -0.02137334644794464, -0.012359519489109516, 0.0020298827439546585, 0.015272961929440498, -0.03383514657616615, -0.0013874275609850883, 0.0006891061784699559, -0.05299030989408493, 0.006762259639799595, 0.033284857869148254, 0.016990000382065773, 0.004761305171996355, -0.005500985309481621, -0.007452945690602064, 0.00044165077270008624, 0.012628622353076935, -0.0698927491903305, 0.0028510878328233957, 0.01847393438220024, 0.054721295833587646, -0.033798713237047195, 0.07528381794691086, 0.006115202326327562, -0.035328492522239685, 0.04131671041250229, -0.0020255977287888527, 0.012155632488429546, 0.04312630742788315, 0.022610491141676903, -0.04987893998622894, -0.051639966666698456, -0.0003597940958570689, 0.008494865149259567, 0.011525141075253487, -0.03252764418721199, 0.022142643108963966, 0.05529060587286949, -0.03679642826318741, -0.010751191526651382, 0.0031250074971467257, 0.04012853652238846, -0.006715935654938221, 0.006232420913875103, 0.011041991412639618, -0.07150733470916748, -0.0002052394556812942, 0.01992306485772133, -0.0037403113674372435, -0.020603854209184647, 0.028714844956994057, -0.03021237999200821, 0.028052175417542458, 0.06666675209999084, 0.03251051902770996, 0.03574557229876518, 0.0004320316365920007, 0.023871146142482758, -0.02085980214178562, 0.009567704051733017, 0.006985792890191078, -0.008929328992962837, -0.013864262960851192, 0.018653573468327522, 0.006626250222325325, 0.04850166663527489, 0.010738451033830643, 0.03367682546377182, 0.014768978580832481, 0.0022141982335597277, 0.03996157646179199, -0.009506430476903915, -0.0005222811014391482, -0.001397296437062323, 0.004124600440263748, 0.024841202422976494, 0.0032506356947124004, -0.013413097709417343, 0.06924798339605331, 0.058834467083215714, -0.026566991582512856, 0.011344188824295998, -0.0061984434723854065, 0.0011140423594042659, -0.006290600635111332, -0.0013255883241072297, 0.0533919520676136, -0.00014221017772797495, 0.01053689792752266, -0.0131600983440876, 0.005261977668851614, 0.00942989718168974, -0.0015470938524231315, -0.026923157274723053, -0.027148541063070297, -0.002424247097223997, 0.009375353343784809, 0.01743096299469471, -0.002050141803920269, -0.002591643948107958, -0.018961746245622635, 0.003142350120469928, 0.03040073625743389, -0.03945246338844299, 0.008016214706003666, 0.03922988846898079, -0.02260672114789486, -0.03139910474419594, 0.031933724880218506, 0.013484076596796513, 0.016246799379587173, -0.02509918436408043, 0.040104616433382034, -0.02451532892882824, -0.0030236379243433475, -0.007632492110133171, 0.04982008412480354, -0.019583720713853836, -0.06564685702323914, -0.013585003092885017, -0.09565356373786926, 0.048938967287540436, -0.07864177227020264, 0.004944291897118092, 0.05833246931433678, -0.022475309669971466, 0.004323181696236134, 0.007994864135980606, 0.0018100872403010726, -0.015116265043616295, 0.011908672749996185, -0.011761548928916454, 0.0033682463690638542, -0.026048917323350906, 0.021674511954188347, 0.009872001595795155, -0.0005062901764176786, 0.0033733448944985867, 0.023324787616729736, -0.020237432792782784, -0.015677189454436302, 0.03984835743904114, -0.02899809554219246, 0.028867630288004875, 0.01480669155716896, -0.05459737405180931, 0.015801463276147842, -0.004903138615190983, -0.014334808103740215, 0.04321896284818649, -0.009398161433637142, 0.03402680903673172, 0.0027794719208031893, 0.023425504565238953, 0.028333088383078575, 0.0662897527217865, -0.03160860389471054, 0.08482084423303604, -0.018198631703853607, 0.034297265112400055, 0.039868518710136414, 0.030754417181015015, 0.013235436752438545, -0.013493985868990421, 0.09624495357275009, 0.03324093297123909, 0.013771194964647293, 0.026983752846717834, -0.013980631716549397, -0.018908314406871796, 0.004547744989395142, -0.001075340318493545, -0.022492045536637306, 0.027107400819659233, -0.01199342217296362, -0.0020463804248720407, 0.03629583120346069, 0.008768799714744091, 0.027496417984366417, 0.019278211519122124, -0.01497510727494955, -0.023503568023443222, 0.030120739713311195, 0.044703949242830276, 0.002563904272392392, 0.007154098246246576, 0.02590135671198368, -0.01956898346543312, 0.0073134140111505985, 0.030566753819584846, 0.006796929985284805, 0.018296461552381516, 0.015227220952510834, -0.0038719037547707558, 0.05544036254286766, -0.0024466810282319784, -0.016590863466262817, 0.005502814427018166, 0.01213845144957304, 0.019877009093761444, -0.011812441051006317, 0.018306614831089973, -0.01552940160036087, -0.008259180933237076, -0.006802108604460955, -0.024693986400961876, -0.02570713311433792, -0.03171586990356445, -0.023391535505652428, 0.0219994205981493, 0.00983894057571888, -0.02049996890127659, -0.02895251102745533, -0.009313671849668026, -0.004825889598578215, 0.012038139626383781, -0.0008154198294505477, -0.0005120750283822417, -0.011577085591852665, 0.028376495465636253, -0.00931119080632925, 0.023653365671634674, 0.01320877019315958, 0.0010223601711913943, 0.03685295954346657, 0.03687012195587158, -0.025029076263308525, 0.042972635477781296, 0.008968052454292774, -0.0011837236816063523, 0.006897113285958767, -0.041048359125852585, -0.025799881666898727, -0.017915960401296616, -0.02285717986524105, -0.0073524401523172855, -0.02005946636199951, -0.030183376744389534, 0.03437618911266327, 0.04525751248002052, 0.019907129928469658, -0.0028652723412960768, -0.008610525168478489, 0.012122690677642822, -0.05676594749093056, -0.00484232883900404, 0.036376651376485825, -0.004891618154942989, -0.007744685746729374, 0.01564992219209671, -0.0007531818700954318, 0.00784510001540184, -0.049048151820898056, -0.0192448440939188, 0.025059552863240242, -0.01360049843788147, 0.021364659070968628, -0.005967763718217611, 0.054882120341062546, 0.031196843832731247, 0.012365183793008327, 0.03385475277900696, -0.0009893575916066766, -0.04910322278738022, -0.03034539520740509, 0.002990412525832653, -0.029550665989518166, -0.004404677078127861, -0.002942133229225874, -0.06337815523147583, -0.029952717944979668, -0.0091002332046628, 0.014736060984432697, -0.006762531585991383, -0.023991435766220093, -0.037940092384815216, -0.0085991732776165, 0.00702610844746232, -0.049562446773052216, 0.022720541805028915, 0.008203335106372833, 0.024316521361470222, -0.0058054737746715546, 0.00793326087296009, -0.008998921141028404, -0.04158087447285652, -0.004261230584233999, 0.036212991923093796, 0.03431292995810509, -0.015543369576334953, -0.009563840925693512, 0.014332445338368416, 0.037687934935092926, -0.004488490521907806, -0.03528158739209175, -0.028571804985404015, 0.005249365698546171, -0.009788832627236843, -0.04807234928011894, -0.03326847031712532, 0.014977484941482544, -0.020156491547822952, 0.016476372256875038, 0.0054068416357040405, -0.030429081991314888, 0.0031505057122558355, -0.0009653863380663097, -0.02415127120912075, -0.014906899072229862, -0.007360410876572132, 0.0040451595559716225, 0.013351436704397202, 0.017254645004868507, -0.011760148219764233, -0.003298484953120351, -0.014807338826358318, 0.04409366846084595, -0.0002677271841093898, 0.015364266000688076, -0.017264211550354958, -0.052495647221803665, 0.0028268438763916492, -0.06034402176737785, -0.03509980067610741, 0.00005477592276292853, 0.011650209315121174, -0.015261382795870304, 0.016672125086188316, 0.04412616044282913, 0.05921417102217674, -0.014587056823074818, -0.013318274170160294, -0.032700084149837494, 0.0749322772026062, 0.021558081731200218, -0.020982814952731133, -0.03238212317228317, 0.04104997217655182 ]
Faster TensorFlow models in Hugging Face Transformers
jplu
January 26, 2021
tf-serving
guide, nlp
https://huggingface.co/blog/tf-serving
Conclusion Thanks to the last updates applied on the TensorFlow models in transformers, one can now easily deploy its models in production using TensorFlow Serving. One of the next steps we are thinking about is to directly integrate the preprocessing part inside the SavedModel to make things even easier.
[ 0.018908649682998657, -0.03662814572453499, 0.053782351315021515, 0.07105191797018051, 0.03429247811436653, 0.05819721892476082, 0.03263435885310173, 0.03173565864562988, -0.012339428067207336, -0.007765003480017185, -0.09228026866912842, 0.014870909973978996, -0.04233827069401741, 0.08903753757476807, 0.0008008265867829323, -0.03403664380311966, 0.019172485917806625, -0.04344533383846283, 0.022781826555728912, 0.019469652324914932, -0.014744730666279793, -0.06569021940231323, 0.007482471410185099, 0.002982162404805422, -0.03759113699197769, -0.03526270389556885, 0.04669647291302681, 0.022614292800426483, -0.03084409050643444, 0.0363357849419117, -0.07748812437057495, 0.01746932603418827, -0.01884310320019722, 0.009865766391158104, -0.04999377205967903, 0.01691666804254055, -0.07428935915231705, 0.038641851395368576, 0.0070576234720647335, -0.07240777462720871, 0.004590299446135759, 0.0388953760266304, -0.08596163988113403, 0.07658584415912628, 0.012174537405371666, -0.057909123599529266, -0.13884347677230835, 0.06143704056739807, 0.019772274419665337, -0.020658744499087334, -0.07234964519739151, 0.04604989290237427, 0.005537989549338818, -0.013552898541092873, 0.006196834146976471, 0.0745495855808258, 0.005314446985721588, -0.010150338523089886, -0.007590536028146744, 0.02622848190367222, 0.012630664743483067, 0.046424660831689835, 0.023980574682354927, 0.02076893486082554, -0.03382134065032005, -0.03560012951493263, 0.02438620664179325, -0.009753972291946411, -0.0047100866213440895, -0.01724925823509693, 0.0006921298918314278, -0.028103459626436234, 0.021846380084753036, -0.0706954374909401, -0.010273335501551628, -0.01831052638590336, -0.012054749764502048, 0.049573864787817, 0.04332272708415985, 0.031611982733011246, 0.020397290587425232, -0.021918172016739845, 0.03844017907977104, 0.016698310151696205, 0.06416530907154083, 0.020259326323866844, 0.07240533083677292, -0.04497123137116432, -0.022143743932247162, 0.04739097133278847, 0.08348554372787476, -0.07172329723834991, -0.04178783670067787, 0.004741438664495945, 0.09103584289550781, 0.019868744537234306, 0.0072747268714010715, -0.0028973552398383617, -0.04224096238613129, -0.020819418132305145, -0.012937872670590878, -0.030853021889925003, -0.05746962130069733, -0.01112302578985691, 0.0017634450923651457, -0.04110565781593323, 0.0180390402674675, -0.13923555612564087, 0.01731284335255623, -0.0068260906264185905, 0.02113860473036766, -0.053027715533971786, 0.004807761404663324, 0.0447886660695076, -0.08118299394845963, 0.04245993122458458, -0.008024889975786209, -0.08579885959625244, 0.016069022938609123, 0.07784412056207657, 0.08799976855516434, 0.1168954074382782, 0.007505913730710745, 0.03645073249936104, -0.01825520768761635, 0.026682529598474503, -0.009759935550391674, 0.0015556359430775046, 0.02972434274852276, -0.06668520718812943, 0.015598675236105919, 0.005872832145541906, 0.040517743676900864, 0.008943629451096058, 0.04759176820516586, -0.07730384171009064, 0.01853341981768608, -0.06110302358865738, -0.0062101902440190315, -0.03591962903738022, -0.0607091560959816, 0.09920638054609299, 0.00020582936122082174, 0.02555324323475361, 0.050588179379701614, -0.08102896809577942, -0.04227490723133087, 0.05281607434153557, 0.04593067243695259, 0.028248591348528862, -0.028218651190400124, 0.02832484431564808, -0.03337731957435608, -0.035471826791763306, 0.030391346663236618, 0.06297937035560608, -0.03538677468895912, 0.014427293092012405, -0.08141859620809555, -0.021903544664382935, 0.011381902731955051, -0.01867877133190632, -0.0065756128169596195, -0.016664616763591766, 0.04378608241677284, -0.05668671429157257, -0.001721794600598514, -0.03591018542647362, 0.10421404242515564, 0.0058885798789560795, -0.03302868828177452, -0.01111549511551857, 0.051813628524541855, -0.002333061071112752, 0.056938715279102325, 0.05949673429131508, 0.057557616382837296, 0.08360718190670013, 0.06719976663589478, -0.04217643663287163, -0.03297743201255798, 0.060628701001405716, -0.010171507485210896, 0.030433187261223793, 0.037137627601623535, -0.06355130672454834, 0.030016791075468063, -0.05803612992167473, -0.0015403734287247062, 0.025597725063562393, -0.03633549064397812, 0.019971055909991264, 0.04095736891031265, -0.02050548419356346, 0.029822900891304016, 0.022517865523695946, -0.07423292845487595, 0.08807546645402908, -0.026095617562532425, 0.04462360963225365, 0.060369912534952164, -0.00259230169467628, -0.08249446749687195, -0.06213326007127762, -0.002774057211354375, 0.03759722411632538, 0.022151939570903778, -0.06266376376152039, 0.0019395392155274749, 0.01852966845035553, 0.01635352335870266, -0.10917243361473083, 0.014928110875189304, -0.067153699696064, 0.0014839355135336518, -0.04788520187139511, -0.10124168545007706, 0.018801013007760048, -0.0760449469089508, -0.06362304091453552, 0.1832975149154663, -0.023055866360664368, 0.003624308155849576, -0.029340635985136032, -0.04400559887290001, 0.016334088519215584, 0.06380286812782288, 0.017002979293465614, 0.062191687524318695, -0.02929433435201645, -0.039497628808021545, -0.05532325431704521, -0.043101150542497635, 0.05788516625761986, 0.047634322196245193, 0.04084128886461258, -0.0529434010386467, -0.0046260543167591095, 0.01580096408724785, -0.02672327682375908, 0.04420170560479164, 0.025857385247945786, 0.00501291174441576, 0.0564938560128212, 0.018231429159641266, 0.015501255169510841, 0.06701257079839706, -0.028880998492240906, 0.012115983292460442, -0.10797238349914551, -0.05893312394618988, -0.0128121143206954, 0.0049482774920761585, -0.07669252157211304, 0.06060171499848366, -0.004370018839836121, -0.0020171033684164286, 0.006377363111823797, -0.04257700592279434, 0.0554230660200119, 0.025990411639213562, -0.025137024000287056, -0.03842313215136528, -0.07321638613939285, -0.005888594780117273, -0.015269341878592968, -0.014899054542183876, -0.05717691034078598, 0.028393354266881943, -0.03893347457051277, -0.006612282712012529, -0.05715199187397957, 0.002074618823826313, -0.01876087486743927, 0.024148443713784218, 0.013949049636721611, 0.0007406104705296457, -0.009493933990597725, -0.004570106044411659, -0.03341883048415184, -0.0037090482655912638, -0.03442089632153511, 0.05884098634123802, 0.03521276265382767, -0.03281567618250847, 0.008954758755862713, 0.013455623760819435, -0.017049580812454224, -0.00629164045676589, -0.0020489320158958435, 0.013598218560218811, 0.021055573597550392, 0.01444171741604805, -0.01697584055364132, -0.036726854741573334, 0.003822578815743327, -0.00828008446842432, -0.04128511995077133, 0.002141608390957117, 0.010042833164334297, -0.05419519543647766, 0.014519935473799706, 0.033922892063856125, -0.013043482787907124, -0.03509125858545303, 0.019167009741067886, 0.01756780408322811, -0.019788658246397972, -0.09464238584041595, -0.05396798253059387, 0.005517379846423864, 0.022320019081234932, -0.017723973840475082, -0.01613948866724968, 0.0030455095693469048, 0.0199524387717247, -0.0344681590795517, 0.02586250938475132, 0.0099938390776515, 0.012080693617463112, 0.012694328092038631, 0.029649225994944572, -0.04509321600198746, -0.014743085950613022, 0.029691556468605995, 0.016873518005013466, 0.04763450473546982, 0.031128453090786934, -0.042130421847105026, 0.030554695054888725, 0.008090311661362648, -0.02577163279056549, 0.001796851516701281, 0.03902280703186989, 0.03222179412841797, 0.01282988116145134, 0.0020204205065965652, -0.02434164471924305, -0.03317807987332344, -0.054837264120578766, -0.009633855894207954, -0.0014160712016746402, -0.015995150431990623, 0.014951594173908234, -0.024653159081935883, 0.00130004296079278, 0.0375438891351223, -0.0036847565788775682, 0.006476137787103653, -0.0016217852244153619, -0.013968251645565033, -0.028929200023412704, -0.0009792527416720986, -0.003986193332821131, 0.019306473433971405, 0.032744694501161575, 0.0419958122074604, -0.019744236022233963, -0.022726161405444145, -0.025637652724981308, 0.0142791997641325, 0.037874191999435425, 0.029403487220406532, -0.014832517132163048, 0.01168315950781107, 0.02448277175426483, 0.037550244480371475, 0.010580405592918396, -0.033958908170461655, -0.008866299875080585, 0.025516074150800705, -0.007245546206831932, -0.0399155430495739, 0.08142942935228348, 0.0262303464114666, 0.009506402537226677, 0.0037877988070249557, 0.04693767800927162, -0.019177069887518883, 0.058900680392980576, 0.006438504438847303, 0.007522991392761469, -0.003142282832413912, 0.055042166262865067, 0.02823430486023426, -0.029769528657197952, 0.06930192559957504, 0.028770534321665764, -0.0189217459410429, -0.0449499674141407, 0.02116801030933857, -0.005619748495519161, -0.004892338998615742, 0.006371676456183195, 0.015657685697078705, 0.022268954664468765, -0.0002008322480833158, 0.009544736705720425, 0.004684932064265013, -0.054306235164403915, 0.020039889961481094, 0.004095937125384808, -0.007391806226223707, -0.0018769255839288235, 0.017984958365559578, 0.006651863921433687, -0.016271518543362617, -0.0010169455781579018, -0.010388613678514957, -0.053222376853227615, -0.0034803494345396757, 0.020275482907891273, -0.015600631944835186, 0.0297553688287735, 0.03232848644256592, -0.01055970974266529, 0.008661774918437004, -0.012033795937895775, 0.020772304385900497, 0.007864401675760746, 0.007837995886802673, -0.06574443727731705, 0.008316435851156712, 0.029816700145602226, -0.022018294781446457, -0.01363841537386179, -0.037842605262994766, 0.05382663011550903, -0.016281787306070328, -0.009604640305042267, -0.006426885258406401, -0.007250399328768253, -0.019269516691565514, 0.009805967099964619, -0.004427941981703043, 0.02993215247988701, -0.024225594475865364, 0.010588777251541615, -0.03257294371724129, 0.010148377157747746, 0.03382987901568413, 0.022750841453671455, 0.006321553140878677, 0.005110894329845905, 0.006594033446162939, 0.05169113352894783, -0.01831824891269207, -0.020466627553105354, -0.03213665261864662, 0.024608494713902473, 0.014482628554105759, -0.05785667151212692, 0.048322830349206924, 0.015198579989373684, -0.03562682121992111, -0.0006504241027869284, -0.017958950251340866, 0.016912683844566345, 0.05006568878889084, 0.032085075974464417, -0.0401875339448452, -0.0039071738719940186, 0.03899240121245384, 0.006952397990971804, -0.014363757334649563, -0.01355519238859415, 0.039655640721321106, 0.0302816703915596, -0.011938533745706081, 0.004181564319878817, -0.028028324246406555, 0.02413495071232319, 0.02044454775750637, 0.005051523447036743, 0.018238816410303116, -0.08864125609397888, -0.015883848071098328, 0.006542747840285301, -0.030114231631159782, 0.0024408528115600348, 0.04012145847082138, -0.014797225594520569, 0.0310377050191164, 0.055950891226530075, 0.04624218866229057, 0.03665049746632576, -0.010995473712682724, -0.006891725119203329, 0.027302337810397148, 0.0033746107947081327, -0.04150180146098137, -0.003634068416431546, -0.022906826809048653, 0.0138419009745121, 0.05265951156616211, 0.06778624653816223, -0.03708798810839653, 0.01053267065435648, 0.004462031181901693, 0.0030798204243183136, 0.009577061049640179, -0.019362345337867737, -0.0012466040207073092, -0.007835580967366695, 0.0017587572801858187, 0.013043813407421112, -0.020435910671949387, 0.015138727612793446, 0.01592978648841381, 0.07129600644111633, -0.018901275470852852, -0.009028137661516666, 0.013760611414909363, -0.002670685760676861, 0.03124609775841236, -0.0010223467834293842, 0.04453172907233238, -0.019360637292265892, 0.03772763907909393, 0.035128381103277206, -0.003645324846729636, 0.013956891372799873, -0.024886829778552055, -0.030370209366083145, -0.036449134349823, 0.0006901547312736511, 0.020079219713807106, 0.04598177969455719, 0.008956537581980228, -0.02357090637087822, -0.018636038526892662, -0.013774070888757706, 0.02130834199488163, -0.034110214561223984, 0.016305554658174515, 0.014887727797031403, -0.048844799399375916, 0.013747704215347767, -0.0023984992876648903, -0.014472165144979954, 0.04149683192372322, 0.017416270449757576, 0.013336467556655407, -0.009026127867400646, -0.0028424153570085764, 0.033906325697898865, 0.05235270410776138, -0.06635601073503494, -0.02781509794294834, -0.07237672805786133, -0.06844185292720795, 0.012508350424468517, -0.027900613844394684, 0.029601020738482475, 0.05662737041711807, 0.00905864778906107, 0.00944544281810522, 0.035747554153203964, 0.0042396411299705505, 0.00830420944839716, 0.028553521260619164, -0.017431631684303284, 0.014192184433341026, -0.00453689880669117, 0.06198090314865112, 0.025606995448470116, -0.003553268499672413, 0.00036425047437660396, 0.001519472454674542, 0.024067075923085213, -0.019631698727607727, 0.0015689965803176165, 0.016767416149377823, 0.007916457951068878, 0.0027164181228727102, -0.03981896862387657, -0.01356386300176382, 0.004108791705220938, 0.0043410649523139, 0.04389449581503868, 0.005847933702170849, 0.030190667137503624, 0.01158195547759533, -0.00890316441655159, 0.005081257317215204, 0.017209241166710854, -0.02185082621872425, 0.057221539318561554, -0.02612718939781189, 0.07005731761455536, 0.03137090057134628, 0.022124947980046272, -0.0007306797779165208, -0.020541474223136902, 0.05411413311958313, 0.014382801949977875, 0.0036086756736040115, 0.03756028041243553, 0.016720285639166832, -0.037441108375787735, -0.02378172241151333, -0.004025960341095924, -0.03746303543448448, -0.01851155236363411, 0.012697028927505016, -0.01574062369763851, 0.017032666131854057, -0.01591871678829193, 0.062434788793325424, 0.027082743123173714, 0.020750515162944794, -0.030381809920072556, 0.04047746583819389, 0.05502668768167496, 0.050572313368320465, 0.04340764135122299, 0.0005968566401861608, -0.002194940112531185, 0.0007907894323579967, 0.023361362516880035, 0.0031209958251565695, 0.05107288807630539, -0.03947552666068077, 0.022816168144345284, 0.022784095257520676, -0.02387383207678795, -0.025409240275621414, 0.013034655712544918, 0.01315460354089737, -0.016655636951327324, -0.019710544496774673, 0.04943795129656792, -0.03968804329633713, 0.034387893974781036, -0.024510996416211128, -0.000024924353056121618, -0.055235810577869415, -0.03477957099676132, -0.01098987553268671, 0.015902331098914146, 0.03729090839624405, -0.042570874094963074, -0.027810515835881233, -0.01491097267717123, 0.0069163283333182335, 0.02657439187169075, -0.009037467651069164, -0.0011569488560780883, -0.02296772040426731, -0.01572256162762642, -0.019409814849495888, -0.004246057942509651, 0.01764756441116333, 0.010549839586019516, 0.03593422472476959, 0.032513681799173355, 0.011540577746927738, 0.015879610553383827, 0.036138903349637985, 0.025807827711105347, -0.04923771321773529, 0.008799818344414234, -0.043281834572553635, -0.06556583195924759, -0.027409860864281654, -0.037436775863170624, 0.0018847428727895021, -0.01721987873315811, 0.0024574638810008764, 0.026241501793265343, 0.029859250411391258, -0.04580902308225632, -0.0037451707758009434, 0.019225329160690308, 0.013095316477119923, -0.008234514854848385, 0.035334981977939606, 0.008641241118311882, 0.026138970628380775, 0.04116536304354668, 0.05626123398542404, -0.014362488873302937, -0.0008780811913311481, 0.010951847769320011, 0.03501296415925026, -0.009346411563456059, -0.01411896850913763, 0.01280550193041563, 0.07142043858766556, 0.012565640732645988, 0.034738827496767044, 0.0038607846945524216, 0.01496496144682169, -0.04191926121711731, -0.06062103435397148, 0.015772437676787376, -0.046170227229595184, -0.007658364716917276, -0.014814086258411407, -0.05676107481122017, -0.029395239427685738, 0.003162926994264126, 0.0031458435114473104, -0.006604785565286875, -0.03471744805574417, 0.01590043492615223, -0.01796216331422329, 0.004500483628362417, -0.027163034304976463, -0.02604050002992153, 0.050325680524110794, 0.0658901110291481, -0.022811634466052055, -0.012767955660820007, -0.02186671830713749, -0.017030594870448112, -0.011850835755467415, 0.04382913559675217, -0.0005848489236086607, 0.005867868196219206, -0.009764053858816624, 0.0005407588323578238, 0.013947084546089172, -0.03345416113734245, -0.04816048964858055, 0.004847261589020491, 0.009941674768924713, -0.03316828981041908, -0.02784147299826145, -0.0196191668510437, 0.026049353182315826, -0.03222956508398056, 0.016356220468878746, -0.003437155857682228, -0.005897879134863615, -0.0006669306894764304, -0.03194601088762283, -0.008183054625988007, -0.0013571636518463492, -0.02524236962199211, -0.0083856750279665, 0.013821695931255817, 0.020214470103383064, -0.012713229283690453, -0.00323508377186954, -0.03687614947557449, 0.04850136488676071, -0.008084016852080822, -0.036249663680791855, -0.02220558375120163, -0.014775436371564865, 0.017624331638216972, -0.010960294865071774, -0.07312729209661484, -0.026349056512117386, 0.010875215753912926, -0.03720007836818695, 0.02351713553071022, 0.0030622980557382107, 0.005745867267251015, 0.0009094048291444778, -0.010991024784743786, -0.01194509956985712, 0.014260041527450085, 0.015566392801702023, -0.02593015320599079, -0.028477290645241737, -0.00246418546885252 ]
Faster TensorFlow models in Hugging Face Transformers
jplu
January 26, 2021
tf-serving
guide, nlp
https://huggingface.co/blog/tf-serving
How to deploy and use a SavedModel? Let’s see step by step how to deploy and use a BERT model for sentiment classification.
[ -0.01718834787607193, -0.040187690407037735, 0.04366781562566757, 0.0037513538263738155, 0.1382477730512619, 0.10354996472597122, 0.04372076690196991, 0.05561595410108566, -0.02391759306192398, -0.07305683195590973, -0.08238852769136429, 0.05276186764240265, -0.008521121926605701, 0.05966762453317642, 0.0032433185260742903, -0.0177219919860363, 0.05524987727403641, 0.0018100879387930036, 0.03226112946867943, -0.029627952724695206, -0.05907037481665611, -0.08329952508211136, 0.055597420781850815, -0.023081030696630478, 0.05136622488498688, -0.051737070083618164, 0.07239765673875809, 0.0343976691365242, -0.06160685420036316, 0.033913131803274155, -0.07564257830381393, 0.032721854746341705, 0.0052753109484910965, 0.003009445732459426, -0.04869876056909561, 0.05856061354279518, -0.10730253159999847, 0.07491158694028854, -0.02775077521800995, -0.046444639563560486, -0.032228946685791016, -0.037723176181316376, -0.030329333618283272, 0.0654408410191536, -0.001515664393082261, -0.055537257343530655, -0.1985742598772049, 0.07723153382539749, -0.00037680487730540335, -0.04073126241564751, -0.0832376703619957, 0.046375442296266556, -0.023572808131575584, 0.0022305860184133053, -0.025481704622507095, 0.014869444072246552, -0.004238835070282221, -0.0764884203672409, 0.00494500482454896, 0.00680291885510087, 0.026255864650011063, -0.010532896965742111, -0.006283321417868137, 0.015002268366515636, 0.04473636671900749, 0.03685044124722481, -0.024736741557717323, -0.015383852645754814, -0.05531209334731102, -0.019255446270108223, -0.0028107925318181515, -0.023304956033825874, 0.0103869354352355, -0.017424246296286583, 0.021231189370155334, -0.028683096170425415, 0.0158635713160038, 0.02931659296154976, 0.060226380825042725, 0.0854855552315712, 0.024457678198814392, -0.026963146403431892, 0.03078708052635193, 0.059976059943437576, 0.03728896751999855, 0.020985431969165802, 0.08816143125295639, -0.04110777750611305, -0.053618062287569046, 0.028114520013332367, -0.01786675490438938, -0.12407422810792923, -0.012331652455031872, 0.0004223140422254801, 0.09667658805847168, -0.023983236402273178, -0.005684755742549896, -0.0024656206369400024, -0.00268461462110281, 0.019899796694517136, 0.019720744341611862, -0.01098476443439722, 0.02924102358520031, -0.022842060774564743, -0.011659055948257446, -0.004745354410260916, 0.029641833156347275, -0.080525703728199, -0.027791447937488556, 0.013775966130197048, -0.0015853648073971272, -0.04065585136413574, 0.0023653663229197264, 0.022324474528431892, -0.06757010519504547, 0.02717461809515953, 0.05680720508098602, -0.021214136853814125, 0.06176118925213814, 0.046139489859342575, 0.007402981165796518, 0.11343109607696533, 0.0159735307097435, 0.008729089051485062, 0.0023022813256829977, 0.05507073551416397, 0.010857293382287025, 0.01209359709173441, -0.029469437897205353, 0.0009954870911315084, 0.044083237648010254, 0.006382123567163944, 0.02417704276740551, -0.010564196854829788, -0.024524040520191193, -0.04051753133535385, -0.0197824165225029, -0.0725083276629448, 0.02372998185455799, 0.01724494993686676, -0.041432976722717285, 0.0888187438249588, -0.023909464478492737, 0.055154893547296524, 0.04950515180826187, -0.025914549827575684, -0.0515478141605854, 0.060690395534038544, -0.017139343544840813, 0.015614029951393604, -0.09239959716796875, 0.00466828141361475, -0.01187667716294527, -0.0678718164563179, 0.002835159422829747, 0.05822265148162842, -0.03520900383591652, 0.004946151282638311, -0.030536631122231483, 0.02590196020901203, 0.011588413268327713, 0.0250875074416399, -0.038580138236284256, 0.0018671599682420492, 0.03529169782996178, -0.03902005776762962, 0.00029831446590833366, -0.008618836291134357, 0.029629399999976158, -0.053260982036590576, 0.00048499921103939414, -0.02926609292626381, 0.10940063744783401, -0.009136644192039967, -0.001268410705961287, 0.054553303867578506, 0.059175871312618256, 0.05108971893787384, -0.016473615542054176, -0.02659337781369686, -0.042928241193294525, 0.07094496488571167, -0.0078984210267663, -0.012044727802276611, 0.034556690603494644, -0.04983925446867943, 0.04727175459265709, -0.0466131716966629, 0.00559612549841404, 0.029944462701678276, -0.04434908926486969, -0.038293734192848206, 0.06341306865215302, -0.018669717013835907, 0.025281323119997978, -0.03981469199061394, -0.021622005850076675, 0.141180619597435, 0.05197138339281082, 0.033572517335414886, 0.0451662577688694, 0.030605636537075043, 0.033567164093256, -0.024130407720804214, -0.015175651758909225, 0.033724501729011536, 0.019774174317717552, -0.01799844205379486, 0.028294192627072334, -0.009789661504328251, -0.017565084621310234, -0.11291959881782532, 0.03141890838742256, -0.12027986347675323, -0.020863009616732597, -0.05041022598743439, -0.01247077714651823, 0.024683186784386635, 0.0085585443302989, -0.03606944903731346, 0.1787136346101761, -0.02054348960518837, -0.009393448010087013, -0.003352045314386487, -0.03329319506883621, 0.04407864063978195, 0.06983917206525803, 0.04758850112557411, 0.1304006576538086, -0.06027567386627197, -0.03466258943080902, -0.026007888838648796, 0.032938145101070404, 0.06419298052787781, 0.0014985445886850357, 0.03603518381714821, -0.0025564644020050764, -0.028627779334783554, 0.011602599173784256, -0.026149511337280273, 0.026877688243985176, -0.00792485848069191, 0.012089472264051437, 0.07300136983394623, -0.039384618401527405, -0.007653567474335432, 0.03981664404273033, 0.023370323702692986, -0.06812150776386261, -0.002166539430618286, -0.04825325310230255, 0.027815967798233032, 0.0033527191262692213, -0.04830187186598778, 0.04838971421122551, 0.028408434242010117, -0.003534406889230013, -0.014245168305933475, -0.02298647351562977, 0.01892353594303131, 0.001844362122938037, -0.038338519632816315, -0.004024375230073929, -0.0485096350312233, 0.021102892234921455, -0.042451485991477966, -0.023156067356467247, -0.015452057123184204, 0.008010782301425934, 0.028757477179169655, 0.007768937852233648, -0.019348550587892532, 0.033235814422369, 0.005653523374348879, 0.019765516743063927, 0.025023827329277992, 0.025081686675548553, -0.011130372993648052, -0.03337438404560089, -0.016284968703985214, -0.02274695597589016, -0.06118118762969971, 0.026782339438796043, 0.005804548040032387, 0.03343762457370758, -0.025135891512036324, 0.010599854402244091, -0.04807434231042862, 0.008333444595336914, 0.034785691648721695, 0.014989400282502174, 0.04163946956396103, -0.023057524114847183, -0.009496597573161125, 0.01576799526810646, 0.0070665753446519375, 0.005038370378315449, 0.0355822890996933, 0.0005903667770326138, 0.030373262241482735, 0.0019278964027762413, 0.03545602783560753, -0.021464096382260323, -0.03113020956516266, -0.03152439370751381, 0.05086242035031319, 0.04241364076733589, -0.006757152266800404, -0.12318101525306702, -0.049720264971256256, 0.046181291341781616, 0.013561339117586613, 0.008008723147213459, -0.04249890148639679, 0.07459631562232971, -0.02842521108686924, -0.0398239903151989, 0.009190715849399567, 0.030794242396950722, 0.020124979317188263, 0.022837592288851738, 0.013628814369440079, -0.005495650228112936, -0.02083514630794525, -0.02871561609208584, 0.0029169574845582247, 0.02584364451467991, 0.03435297682881355, -0.06074732914566994, 0.05153927206993103, 0.012983775697648525, -0.03605998679995537, -0.02190217934548855, 0.03296292573213577, 0.016992008313536644, 0.0326102189719677, 0.01583382487297058, -0.03993303328752518, 0.001493623829446733, -0.021854659542441368, -0.04510112479329109, 0.00905214250087738, -0.030359754338860512, 0.005205125082284212, -0.013556699268519878, 0.04999266937375069, 0.03596366196870804, 0.024643218144774437, -0.009581036865711212, 0.0049654822796583176, -0.008214222267270088, -0.00931506883352995, -0.020296385511755943, 0.0029355280566960573, 0.005357123911380768, 0.036049146205186844, 0.04132987558841705, -0.017303545027971268, -0.03189224377274513, -0.044082146137952805, -0.026847856119275093, 0.04378778487443924, -0.008415036834776402, -0.00023289718956220895, 0.025175228714942932, 0.008360467851161957, 0.015972571447491646, 0.0019265234004706144, -0.038252923637628555, 0.007303172722458839, 0.016613027080893517, -0.03890423849225044, -0.0321187824010849, 0.04032018780708313, 0.020428704097867012, 0.026002174243330956, -0.019071269780397415, 0.015409089624881744, -0.003027611877769232, 0.052935607731342316, 0.004435745067894459, 0.01857205480337143, -0.02133854851126671, 0.046345435082912445, 0.005363532342016697, -0.031960561871528625, 0.06260256469249725, 0.019650664180517197, -0.011013410054147243, -0.02492133155465126, -0.016209205612540245, -0.025482740253210068, 0.003002867102622986, -0.007063351571559906, 0.005533712916076183, 0.008567520417273045, 0.01799674518406391, 0.05273052304983139, 0.009865392930805683, -0.05026983469724655, -0.007396702188998461, -0.00837482325732708, -0.010935192927718163, 0.004054131451994181, 0.046536635607481, -0.029216326773166656, -0.004504306707531214, 0.01665395125746727, 0.020681196823716164, -0.0053001027554273605, -0.03155113011598587, 0.014841635711491108, 0.03766410052776337, 0.045865803956985474, -0.031807560473680496, -0.03533828258514404, 0.007467726711183786, -0.02266937680542469, 0.0010867490200325847, 0.007758074440062046, 0.009234086610376835, -0.022923365235328674, 0.009640131145715714, 0.015102599747478962, -0.018698450177907944, -0.03402792662382126, -0.047047507017850876, 0.03871769830584526, -0.010261140763759613, 0.021097583696246147, 0.0061410260386765, -0.0111309252679348, -0.0021958909928798676, -0.024690181016921997, 0.029331758618354797, 0.03359631448984146, -0.016122588887810707, -0.005461056251078844, -0.010152480565011501, -0.023891549557447433, 0.03967559337615967, 0.0027260049246251583, 0.016933850944042206, 0.008363280445337296, -0.00019754702225327492, 0.04988396167755127, 0.016209250316023827, -0.042017120867967606, -0.005463691893965006, -0.010686159133911133, 0.020585864782333374, -0.029172096401453018, 0.04580637440085411, -0.024360138922929764, -0.04874974861741066, -0.007573539856821299, -0.018315967172384262, 0.03390484303236008, 0.02635166049003601, 0.007635816931724548, -0.040889427065849304, -0.01167268306016922, 0.02264265902340412, -0.014576880261301994, -0.0042778984643518925, 0.019567035138607025, -0.0005104136653244495, 0.05866806581616402, 0.0032748256344348192, -0.005215619225054979, -0.03325321525335312, 0.02439037151634693, 0.007454351056367159, -0.007317018695175648, 0.009011529386043549, -0.06005484610795975, 0.012532534077763557, 0.030664782971143723, -0.021447453647851944, -0.01977689005434513, 0.053425904363393784, -0.02617926150560379, 0.02084154449403286, 0.048731785267591476, 0.02400517836213112, 0.015811502933502197, -0.0018356781220063567, 0.0381687730550766, -0.047540877014398575, 0.013889226131141186, -0.03224807605147362, 0.0057217772118747234, -0.022162213921546936, 0.007973902858793736, 0.05704978108406067, 0.027416178956627846, -0.010202387347817421, 0.038381461054086685, -0.03293628990650177, 0.01773538440465927, 0.012040266767144203, -0.020877355709671974, -0.030018476769328117, -0.0030735977925360203, 0.01873224787414074, 0.000913836236577481, -0.01420472003519535, -0.0007079846691340208, 0.013038981705904007, 0.04131504148244858, -0.01114306878298521, 0.015243609435856342, 0.01580084301531315, -0.02342107705771923, -0.0034711870830506086, -0.06674551218748093, 0.01642417535185814, -0.030322609469294548, -0.027242399752140045, 0.011138889007270336, -0.019056515768170357, 0.009390315972268581, 0.0026874386239796877, -0.051614366471767426, -0.03630160912871361, 0.029843738302588463, 0.003967304714024067, 0.047693267464637756, -0.0056776064448058605, -0.0008858993533067405, -0.051263581961393356, 0.05172044783830643, 0.00035266115446574986, -0.030374985188245773, 0.01612023636698723, 0.03015630878508091, -0.023083575069904327, 0.02070493996143341, 0.01642041839659214, -0.017249105498194695, 0.0031355724204331636, 0.04842982813715935, -0.002578216837719083, -0.022861743345856667, -0.05679621174931526, 0.036827925592660904, 0.02890564315021038, -0.017847338691353798, -0.004164338577538729, -0.042537935078144073, -0.03903956338763237, 0.007899579592049122, -0.06697843223810196, 0.016655120998620987, 0.08162200450897217, -0.005795137491077185, 0.007369853090494871, 0.003059529233723879, -0.004870485048741102, 0.008330474607646465, -0.004802996292710304, -0.003977023996412754, 0.028076907619833946, 0.04915996268391609, 0.03287461772561073, 0.01920856349170208, 0.003969810903072357, 0.019521569833159447, 0.0043900818563997746, -0.051525600254535675, 0.0121348537504673, 0.06169682368636131, -0.014583325944840908, 0.019099028781056404, 0.0025047981180250645, -0.024034997448325157, 0.01350108440965414, 0.044089965522289276, 0.026180261746048927, 0.04808877035975456, -0.029561622068285942, 0.004108669236302376, 0.004383069463074207, 0.0006709430599585176, 0.03232479840517044, 0.05100748687982559, -0.020168539136648178, 0.03979819640517235, 0.009028841741383076, 0.025518406182527542, -0.0003865125763695687, 0.014684717170894146, -0.018901308998465538, 0.022950472310185432, 0.08548189699649811, 0.014978714287281036, -0.008605717681348324, 0.036656953394412994, 0.009512611664831638, -0.0034142581280320883, -0.044960059225559235, -0.0005270960973575711, -0.04905083030462265, 0.02803010120987892, 0.017915859818458557, -0.025575630366802216, 0.02600628137588501, -0.02196604199707508, 0.02533307485282421, 0.012318842113018036, 0.029601335525512695, -0.03313792124390602, 0.007779829669743776, 0.030157797038555145, 0.03285834938287735, 0.012321298941969872, 0.016511544585227966, -0.017408190295100212, -0.008700456470251083, 0.061617374420166016, -0.004773281514644623, 0.01841573789715767, -0.001267654006369412, -0.019826307892799377, 0.03924386203289032, -0.005590681917965412, -0.011570289731025696, -0.022133134305477142, 0.035284772515296936, -0.019407667219638824, -0.0317126102745533, 0.023054424673318863, -0.02375318482518196, -0.0024543104227632284, -0.02232445776462555, 0.007339285220950842, -0.02274198643863201, -0.033191170543432236, -0.00778117123991251, 0.04146653786301613, 0.010903249494731426, -0.002380801597610116, -0.011771631427109241, 0.02171139605343342, -0.014206258580088615, 0.04441843554377556, -0.029414812102913857, -0.015624192543327808, -0.037423521280288696, -0.02999788522720337, -0.02028299681842327, 0.0148988738656044, -0.009394684806466103, -0.00949015747755766, 0.002631762530654669, 0.026039814576506615, -0.009884020313620567, 0.025860751047730446, 0.015962379053235054, 0.011690793558955193, -0.013502072542905807, -0.01619799993932247, -0.030378473922610283, -0.03602460026741028, -0.0339367501437664, -0.05357048660516739, -0.014849728904664516, -0.00570296635851264, 0.01510994415730238, 0.019073909148573875, 0.036251407116651535, -0.01620418019592762, -0.011012380011379719, -0.010749311186373234, 0.00035568082239478827, -0.01186216901987791, 0.02564173750579357, 0.017576375976204872, -0.010217424482107162, 0.0064702085219323635, 0.0065872520208358765, -0.02204289846122265, -0.035519398748874664, 0.009030911140143871, 0.007639968767762184, -0.0030418948736041784, -0.010225482285022736, -0.015131731517612934, 0.052756212651729584, -0.0025548741687089205, -0.0013740191934630275, 0.054024871438741684, 0.0017611519433557987, -0.003678327426314354, -0.053727954626083374, 0.02136639691889286, -0.02047841064631939, -0.005203943233937025, -0.029913529753684998, -0.05728156864643097, -0.025661321356892586, -0.012545864097774029, -0.009156416170299053, 0.018236996605992317, -0.062268346548080444, -0.02657593972980976, -0.024772226810455322, 0.01390516385436058, -0.050470564514398575, 0.019051512703299522, 0.07961594313383102, 0.037172578275203705, 0.020710259675979614, -0.00019012103439308703, -0.017351442947983742, -0.009491832926869392, -0.010063711553812027, 0.018525807186961174, 0.049234259873628616, 0.04011619836091995, -0.032546356320381165, -0.01709049753844738, -0.0007639802061021328, -0.019717084243893623, -0.038863249123096466, -0.006399983074516058, 0.019286157563328743, -0.0402979776263237, -0.041244447231292725, -0.02341364324092865, 0.021961338818073273, -0.011632634326815605, 0.041675880551338196, -0.0032638085540384054, -0.012105387635529041, -0.022264452651143074, -0.009778955951333046, -0.07151766121387482, 0.01487942598760128, -0.018678514286875725, -0.03304438292980194, 0.05489722639322281, 0.010188758373260498, -0.013137537986040115, -0.027358535677194595, -0.06009277328848839, 0.015375599265098572, 0.0035537867806851864, -0.005071076098829508, -0.03252466768026352, -0.005608315113931894, 0.017011096701025963, -0.028479062020778656, -0.05339015647768974, 0.011187202297151089, 0.018121816217899323, -0.031966131180524826, -0.012795292772352695, -0.0011159004643559456, 0.02744712121784687, 0.0029453763272613287, 0.0041879648342728615, 0.007636068854480982, 0.04296092689037323, 0.013324311934411526, -0.03757954761385918, 0.004380596801638603, 0.010053192265331745 ]
Faster TensorFlow models in Hugging Face Transformers
jplu
January 26, 2021
tf-serving
guide, nlp
https://huggingface.co/blog/tf-serving
# Faster TensorFlow models in Hugging Face Transformers In the last few months, the Hugging Face team has been working hard on improving Transformers’ TensorFlow models to make them more robust and faster. The recent improvements are mainly focused on two aspects: 1. Computational performance: BERT, RoBERTa, ELECTRA and MPNet have been improved in order to have a much faster computation time. This gain of computational performance is noticeable for all the computational aspects: graph/eager mode, TF Serving and for CPU/GPU/TPU devices. 2. TensorFlow Serving: each of these TensorFlow model can be deployed with TensorFlow Serving to benefit of this gain of computational performance for inference.
[ 0.022393805906176567, -0.0568457692861557, 0.04240230843424797, 0.009374299086630344, -0.04667419195175171, 0.07617680728435516, -0.0082596680149436, 0.04193142428994179, -0.059928759932518005, -0.011230647563934326, -0.032803021371364594, 0.05641544982790947, -0.05416566878557205, 0.06391754746437073, 0.018847135826945305, -0.05681458115577698, 0.020599521696567535, -0.009877386502921581, 0.0005360295181162655, 0.007122156210243702, 0.0341954343020916, -0.1065417230129242, 0.08854919672012329, -0.005637660622596741, -0.036643825471401215, -0.05399923399090767, -0.010934574529528618, -0.02199784852564335, 0.02398975007236004, 0.04135948792099953, -0.11105181276798248, 0.0008126714383251965, 0.032536525279283524, 0.03179219737648964, -0.023065173998475075, 0.00048758392222225666, -0.1187729462981224, 0.0492989607155323, -0.004625025205314159, -0.022478880360722542, 0.06974582374095917, -0.043674666434526443, -0.06272108852863312, 0.0407588891685009, 0.022989442571997643, 0.009835399687290192, -0.09053844213485718, 0.05138585716485977, 0.021265365183353424, -0.03519390895962715, -0.04945894330739975, 0.07842670381069183, -0.006875856779515743, 0.02752269059419632, 0.03253293037414551, 0.015436933375895023, -0.02982475236058235, -0.015243018977344036, 0.021590929478406906, 0.012042009271681309, 0.01568680629134178, 0.014604052528738976, 0.03388141095638275, 0.027589034289121628, -0.009634101763367653, 0.0039043978322297335, -0.043202485889196396, -0.044997189193964005, -0.03610638529062271, 0.01498281117528677, 0.02058393508195877, -0.015616427175700665, -0.015463430434465408, -0.04790332540869713, -0.00550335505977273, 0.01394634135067463, 0.01727130264043808, 0.013468512333929539, 0.05625353381037712, 0.03309188410639763, -0.021704543381929398, -0.016846535727381706, 0.049493156373500824, 0.025995150208473206, 0.0611221008002758, 0.0679585188627243, 0.04531893879175186, -0.0713987648487091, -0.08016475290060043, 0.06267920136451721, 0.028188372030854225, -0.08052440732717514, -0.023107659071683884, -0.02238156460225582, 0.050618696957826614, 0.03406983241438866, 0.021948926150798798, -0.029854977503418922, -0.03943338990211487, -0.09241393953561783, 0.012823641300201416, -0.10205770283937454, -0.01885020174086094, -0.05363307148218155, -0.051913805305957794, -0.004545275121927261, -0.053435638546943665, -0.13765855133533478, 0.019265275448560715, 0.024182191118597984, 0.01792171411216259, -0.00823084358125925, -0.009721370413899422, 0.03879950940608978, -0.08740377426147461, 0.045754171907901764, -0.024642037227749825, -0.059356678277254105, -0.03486914560198784, 0.05466832220554352, 0.032381970435380936, 0.1059279814362526, 0.055889882147312164, 0.002525654621422291, -0.0009041039738804102, 0.11464569717645645, 0.020846420899033546, -0.00390362530015409, 0.0862703025341034, 0.00435912748798728, 0.04529867321252823, -0.06688258796930313, 0.0570017471909523, 0.04867050051689148, 0.056217506527900696, -0.08859673887491226, 0.03169170767068863, -0.03520405665040016, -0.026262719184160233, -0.018312951549887657, -0.04354130104184151, 0.047602519392967224, 0.05347806587815285, -0.04702017456293106, 0.05163523182272911, -0.0602295882999897, -0.13031691312789917, 0.05188152194023132, 0.07550951838493347, -0.032929688692092896, -0.11168503016233444, 0.003082693088799715, -0.06413204222917557, -0.04522952809929848, 0.05596443638205528, 0.0725049078464508, -0.0005012151086702943, -0.06610811501741409, -0.038532111793756485, -0.02488439530134201, -0.05328642204403877, -0.0507286973297596, -0.05666647478938103, -0.019681980833411217, 0.045681148767471313, -0.03026699461042881, 0.034398529678583145, 0.009748343378305435, 0.055945247411727905, 0.05547209829092026, -0.01580660231411457, 0.022403767332434654, 0.06926488876342773, -0.015798520296812057, 0.013970894739031792, 0.07894810289144516, 0.023969773203134537, 0.05541500821709633, 0.013188835233449936, -0.05727351829409599, -0.018584268167614937, 0.09352429956197739, -0.012382644228637218, 0.044440463185310364, 0.05075698345899582, -0.05040255934000015, 0.0031447166111320257, -0.046821657568216324, 0.03085390478372574, 0.016905952244997025, -0.014628825709223747, 0.025770580396056175, 0.08580660074949265, -0.013843235559761524, 0.004191362299025059, 0.017335990443825722, -0.03352268785238266, 0.06996043026447296, 0.01587938331067562, -0.001245661173015833, 0.048435792326927185, -0.03190506622195244, -0.0107523612678051, 0.0017259764717891812, -0.0021125837229192257, -0.03876052796840668, 0.008505101315677166, -0.04482395946979523, -0.004459238611161709, 0.04785739257931709, 0.018248561769723892, -0.11190623790025711, -0.013228957541286945, -0.013923545368015766, 0.006478568539023399, -0.06015774607658386, -0.0034719654358923435, 0.004715664777904749, -0.031073344871401787, -0.033209677785634995, 0.12946486473083496, -0.01645997166633606, -0.01844809390604496, -0.019811561331152916, -0.042262762784957886, -0.004712285008281469, 0.050336066633462906, 0.04692231863737106, 0.07790777087211609, -0.025307100266218185, -0.02806246094405651, -0.07606946676969528, -0.004685526248067617, 0.005891155917197466, -0.0015007378533482552, -0.010184623301029205, -0.00040910125244408846, 0.0040605622343719006, 0.03188294172286987, -0.0187113918364048, -0.031297799199819565, -0.00265307305380702, 0.022528458386659622, 0.0765460953116417, 0.031418994069099426, 0.015134367160499096, 0.04955621436238289, -0.011698112823069096, 0.034831635653972626, -0.041169654577970505, -0.0802764743566513, 0.04358072206377983, 0.03728931024670601, -0.0561690628528595, 0.031189877539873123, 0.02585756778717041, 0.020242242142558098, 0.0025665313005447388, -0.014021744951605797, 0.06385893374681473, 0.02238132432103157, -0.009943550452589989, -0.056932851672172546, -0.015534021891653538, -0.01897425949573517, -0.03842554986476898, -0.028560711070895195, -0.005793455988168716, 0.012599864974617958, -0.009973237290978432, 0.009257888421416283, -0.0766628086566925, 0.02250690571963787, -0.01633637771010399, 0.0588376559317112, 0.018946591764688492, 0.049801986664533615, -0.017042867839336395, -0.03702250495553017, -0.04234671592712402, -0.011251783929765224, -0.015633778646588326, 0.03765583410859108, 0.02196711115539074, -0.059694595634937286, -0.011497404426336288, 0.005059501621872187, -0.03362377732992172, -0.030906373634934425, -0.01450059749186039, 0.012264233082532883, 0.012589904479682446, -0.05191442370414734, -0.05080506578087807, -0.023607783019542694, 0.036632560193538666, -0.012319354340434074, 0.01298033632338047, -0.019304901361465454, 0.028405670076608658, -0.034563951194286346, -0.0018808888271450996, 0.01077679730951786, 0.02272060513496399, -0.005659074056893587, 0.007264625281095505, -0.0043451422825455666, 0.014223899692296982, -0.07602306455373764, -0.04652043431997299, -0.00871945358812809, 0.0096200592815876, -0.017282499000430107, -0.027963174507021904, 0.026171034201979637, 0.005021898541599512, -0.010614045895636082, 0.025276008993387222, 0.0032851004507392645, 0.007334600668400526, -0.0018998762825503945, 0.004535682965070009, -0.03820054605603218, 0.0014830370200797915, 0.0014013734180480242, 0.005401282105594873, 0.02987845428287983, 0.03882009536027908, -0.013424014672636986, 0.03867980092763901, -0.0073216939345002174, -0.023821299895644188, -0.003246227279305458, 0.009596574120223522, -0.005629152059555054, -0.02810421586036682, 0.024692190811038017, -0.04336079955101013, -0.0322783999145031, -0.027389705181121826, -0.00405815988779068, 0.008634256199002266, -0.009671979583799839, 0.015824031084775925, -0.0011221339227631688, 0.01440129242837429, 0.046824418008327484, 0.017436765134334564, 0.02323869988322258, -0.014380745589733124, 0.011141079477965832, 0.001755452947691083, -0.01753145642578602, 0.0017883580876514316, 0.005145445000380278, 0.015666591003537178, 0.03523422032594681, -0.023807475343346596, -0.029198676347732544, -0.01059421245008707, 0.02779306285083294, 0.011473334394395351, 0.005015707109123468, 0.03277578949928284, -0.021568214520812035, 0.016827944666147232, 0.01357335690408945, -0.007905076257884502, -0.037920113652944565, 0.007368673104792833, -0.005060749594122171, -0.0026556362863630056, -0.04782736673951149, 0.03473003953695297, 0.021852990612387657, 0.011276216246187687, 0.03361714258790016, 0.003110856283456087, -0.022496236488223076, 0.013326515443623066, -0.01312088780105114, -0.0014989724149927497, -0.036486782133579254, 0.021094294264912605, 0.006406895350664854, 0.011214930564165115, 0.06393225491046906, -0.016670988872647285, -0.0387275293469429, -0.07329107075929642, -0.02208734303712845, -0.018267622217535973, 0.04420032724738121, -0.002905310597270727, 0.020873138681054115, -0.04845345392823219, 0.012213459238409996, 0.024828853085637093, -0.025026222690939903, -0.037090614438056946, -0.0003110010293312371, -0.024568449705839157, 0.013788742013275623, -0.008617761544883251, 0.03296900913119316, 0.05493034049868584, -0.024169964715838432, -0.012148960493505001, -0.02347288653254509, -0.021275481209158897, 0.018702806904911995, 0.0176302008330822, -0.012446125037968159, 0.013323145918548107, 0.005808031652122736, 0.00025165011174976826, 0.019966011866927147, 0.006688334979116917, 0.012100514024496078, 0.010058419778943062, 0.0005287925596348941, -0.02160465531051159, 0.04165690392255783, 0.031954575330019, -0.02810078114271164, -0.019626203924417496, 0.00002464259523549117, 0.02896304242312908, -0.002903738059103489, 0.04487971216440201, 0.012140880338847637, 0.041318852454423904, 0.05472378432750702, 0.038477543741464615, 0.020236367359757423, 0.05129279941320419, -0.015546754002571106, 0.018596403300762177, -0.05679274722933769, -0.000938856101129204, 0.03511583432555199, 0.005306770093739033, 0.037700355052948, -0.017032988369464874, -0.03445117175579071, -0.0070382594130933285, -0.004731934983283281, 0.0075990320183336735, -0.029246512800455093, 0.056431058794260025, 0.025174612179398537, -0.04225173220038414, 0.020767608657479286, 0.024061335250735283, -0.043723978102207184, 0.004307818599045277, -0.020310990512371063, 0.03807420656085014, 0.058059994131326675, 0.0033709686249494553, -0.03268321603536606, 0.04766899347305298, 0.04831020534038544, -0.0008294394938275218, -0.014193052425980568, 0.02272563986480236, 0.014142942614853382, 0.028634199872612953, 0.031159162521362305, 0.018553655594587326, -0.04192030429840088, -0.007434268482029438, 0.04658038541674614, 0.023958221077919006, -0.012773719616234303, -0.07827898859977722, 0.005935452878475189, 0.0020963805727660656, -0.02137771062552929, 0.011880348436534405, 0.008330062963068485, -0.004162762779742479, -0.005690376274287701, 0.07491576671600342, 0.05478270724415779, -0.001797763747163117, 0.0049782926216721535, 0.015036546625196934, -0.006641435902565718, 0.002426894847303629, -0.01255924254655838, -0.019506040960550308, 0.016053084284067154, 0.02359921857714653, 0.03849033638834953, 0.0842602327466011, -0.022180957719683647, -0.02672392874956131, 0.01671399176120758, -0.0059343138709664345, -0.015906834974884987, -0.021746758371591568, 0.017655976116657257, -0.022337717935442924, -0.010483060032129288, 0.008033315651118755, -0.05258016660809517, 0.004311755765229464, 0.03033926524221897, 0.04123830422759056, -0.0311990138143301, -0.012371348217129707, 0.030481677502393723, -0.011426197364926338, 0.006045487709343433, -0.025736544281244278, 0.030625753104686737, -0.031205758452415466, 0.05441708490252495, 0.010606789961457253, 0.040860749781131744, -0.010813030414283276, -0.019776519387960434, -0.0176120363175869, -0.0012351933401077986, 0.031390100717544556, 0.015397299081087112, 0.030181903392076492, -0.05306297168135643, -0.017111357301473618, -0.038492921739816666, -0.051422763615846634, -0.0060083274729549885, -0.0554504469037056, -0.010492735542356968, -0.006242998875677586, -0.052431363612413406, 0.007608037907630205, 0.004170695319771767, -0.004268632270395756, -0.006223562639206648, 0.04370204359292984, 0.032331377267837524, -0.00254253507591784, -0.007671000435948372, 0.014633579179644585, 0.09200812131166458, -0.023892909288406372, -0.025738127529621124, -0.026506859809160233, -0.03665363788604736, -0.034083541482686996, -0.04404045268893242, 0.02264218032360077, 0.07354572415351868, -0.021093472838401794, 0.0054400162771344185, 0.03383743390440941, 0.027593178674578667, 0.0074939909391105175, 0.030666416510939598, 0.012240434065461159, 0.012923449277877808, -0.0013426325749605894, 0.01114659383893013, 0.026249904185533524, 0.01861869916319847, 0.014195512048900127, 0.001986699178814888, -0.0004969707224518061, 0.019447969272732735, 0.022263213992118835, -0.03658568486571312, 0.04122700169682503, 0.03557250648736954, -0.06782301515340805, 0.004488267935812473, 0.014904790557920933, -0.009162542410194874, 0.009428993798792362, 0.023483792319893837, 0.013449172489345074, -0.03185976296663284, 0.022697271779179573, 0.02642081119120121, 0.05708775296807289, 0.025065520778298378, 0.004329229239374399, 0.023390905931591988, 0.04865076392889023, 0.058350756764411926, 0.015986302867531776, 0.028788326308131218, -0.04143006354570389, 0.032589979469776154, 0.008893853053450584, 0.015881698578596115, 0.02224598079919815, -0.009038803167641163, -0.039510421454906464, -0.009673229418694973, -0.043779294937849045, -0.013349666260182858, -0.023926129564642906, 0.02373136579990387, -0.02409789152443409, 0.019379502162337303, -0.020456654950976372, 0.03638589754700661, 0.03515081852674484, 0.06958477944135666, -0.02442942000925541, 0.029838714748620987, 0.013567164540290833, 0.03604663535952568, 0.01999906450510025, -0.015695855021476746, -0.0027348727453500032, -0.02198350615799427, 0.009857065044343472, 0.039805468171834946, 0.018168088048696518, -0.015968315303325653, 0.02315503917634487, -0.015560121275484562, -0.03794548287987709, -0.020896675065159798, 0.004449828993529081, 0.0029462126549333334, 0.012408649548888206, 0.009316465817391872, 0.03779125213623047, -0.040295928716659546, 0.039075374603271484, -0.017698019742965698, -0.018476242199540138, -0.018098223954439163, 0.020733239129185677, 0.017095373943448067, 0.025221101939678192, 0.011526891961693764, -0.03308316320180893, 0.019125282764434814, -0.029321834444999695, 0.01570623740553856, 0.02787134051322937, -0.029119452461600304, -0.014859743416309357, -0.011915743350982666, -0.02117766998708248, -0.016060661524534225, 0.010857912711799145, -0.024372471496462822, -0.009961972013115883, 0.03870585933327675, 0.026487860828638077, 0.001071325852535665, 0.004236828535795212, -0.026430558413267136, 0.01776823401451111, -0.06938989460468292, 0.026745565235614777, 0.023078853264451027, -0.02908332087099552, 0.024644434452056885, -0.02930416353046894, -0.01521099079400301, -0.006081631872802973, 0.03560637682676315, 0.032409992069005966, 0.05003508925437927, -0.03624395653605461, -0.026519283652305603, 0.0013703348813578486, -0.017046526074409485, -0.009254669770598412, 0.030233334749937057, 0.020495079457759857, -0.00011583202285692096, 0.0010372543474659324, 0.009918136522173882, -0.013180752284824848, -0.01962619461119175, 0.024112578481435776, 0.07860608398914337, -0.04304781183600426, -0.0571950301527977, -0.0036213884595781565, 0.03742087259888649, 0.023151548579335213, 0.025162657722830772, 0.017836440354585648, -0.03271542116999626, -0.019752491265535355, -0.06381319463253021, 0.0020518566016107798, -0.020561236888170242, -0.0235051978379488, -0.00813543051481247, -0.036374885588884354, -0.021203506737947464, -0.010719179175794125, -0.013475016690790653, 0.048500724136829376, -0.025303663685917854, 0.04699146747589111, -0.05436241999268532, 0.007414958905428648, 0.004365506116300821, -0.00566817494109273, 0.05219130963087082, 0.04212450608611107, -0.01448746956884861, -0.020256362855434418, -0.016160018742084503, -0.048172738403081894, -0.018901856616139412, 0.02262727916240692, 0.015530481934547424, -0.01523610670119524, 0.019150804728269577, -0.0378105565905571, -0.06702132523059845, 0.03348119184374809, -0.047936830669641495, 0.010650678537786007, -0.023494791239500046, 0.011618671007454395, -0.02937261573970318, -0.029238861054182053, 0.045834753662347794, -0.06294114887714386, 0.03604615107178688, 0.01124579831957817, -0.015958428382873535, -0.013371600769460201, 0.010566252283751965, -0.04745512455701828, -0.00874260626733303, -0.018279310315847397, 0.021899234503507614, 0.053700316697359085, 0.003887507366016507, 0.04858947917819023, 0.014275181107223034, 0.00891683716326952, 0.03391817957162857, -0.004146104212850332, -0.07474350929260254, -0.03302661329507828, -0.030235564336180687, 0.016087200492620468, -0.012053703889250755, -0.06159042939543724, 0.02609238214790821, 0.016722990199923515, 0.0022693828213959932, 0.006751690059900284, -0.0027447405736893415, 0.01889026165008545, 0.01019732840359211, -0.00344719341956079, -0.02372700534760952, -0.0018893153173848987, 0.03470120579004288, -0.00785905309021473, 0.0026026167906820774, -0.00817268155515194 ]
Faster TensorFlow models in Hugging Face Transformers
jplu
January 26, 2021
tf-serving
guide, nlp
https://huggingface.co/blog/tf-serving
Computational Performance To demonstrate the computational performance improvements, we have done a thorough benchmark where we compare BERT's performance with TensorFlow Serving of v4.2.0 to the official implementation from Google. The benchmark has been run on a GPU V100 using a sequence length of 128 (times are in millisecond): | Batch size | Google implementation | v4.2.0 implementation | Relative difference Google/v4.2.0 implem | |:----------:|:---------------------:|:---------------------:|:----------------------------------------:| | 1 | 6.7 | 6.26 | 6.79% | | 2 | 9.4 | 8.68 | 7.96% | | 4 | 14.4 | 13.1 | 9.45% | | 8 | 24 | 21.5 | 10.99% | | 16 | 46.6 | 42.3 | 9.67% | | 32 | 83.9 | 80.4 | 4.26% | | 64 | 171.5 | 156 | 9.47% | | 128 | 338.5 | 309 | 9.11% | The current implementation of Bert in v4.2.0 is faster than the Google implementation by up to ~10%. Apart from that it is also twice as fast as the implementations in the 4.1.1 release.
[ -0.023488573729991913, 0.046574585139751434, 0.05118728429079056, 0.031007787212729454, -0.04449979588389397, 0.04916299507021904, 0.016483163461089134, 0.026086049154400826, -0.0354662649333477, -0.07991660386323929, -0.053442444652318954, 0.023795336484909058, -0.0339946374297142, 0.0546656996011734, -0.011033148504793644, -0.0005305461236275733, 0.06760330498218536, -0.06382130086421967, 0.012863313779234886, -0.057949140667915344, -0.018584731966257095, -0.025679204612970352, 0.10995590686798096, 0.0026521964464336634, 0.018124805763363838, -0.030195770785212517, -0.025625845417380333, 0.032195720821619034, -0.04245353862643242, 0.031709954142570496, -0.13368000090122223, -0.024157583713531494, 0.04811862111091614, 0.01056405995041132, -0.04737718030810356, -0.04114067927002907, -0.0631013959646225, 0.08619517832994461, 0.012364151887595654, 0.00860827136784792, -0.013340320438146591, -0.0253229271620512, -0.039558377116918564, 0.09336766600608826, -0.056359246373176575, 0.06511697918176651, -0.10352898389101028, 0.06041310727596283, -0.0070539843291044235, -0.021804483607411385, -0.11474364995956421, 0.037409983575344086, -0.012927437201142311, 0.020385218784213066, -0.008608357049524784, 0.027213940396904945, 0.042681414633989334, -0.004901707172393799, 0.03708607330918312, -0.0047051142901182175, 0.07006531208753586, -0.012571604922413826, 0.01144551020115614, 0.029453976079821587, 0.025990815833210945, 0.016267383471131325, -0.002569486852735281, 0.017648041248321533, -0.05468157306313515, 0.04139794036746025, 0.018059244379401207, -0.05731924995779991, 0.003741591004654765, 0.002382848644629121, -0.015546281822025776, -0.01104846503585577, 0.03697359561920166, 0.016397029161453247, 0.06265636533498764, 0.036583662033081055, -0.012192968279123306, 0.02139662206172943, 0.01013176329433918, 0.04136035218834877, 0.017383787781000137, 0.055963534861803055, 0.06891806423664093, -0.08731477707624435, -0.0581427663564682, 0.058708637952804565, 0.004329323302954435, -0.09407346695661545, -0.004800153896212578, -0.01935761794447899, 0.03672847896814346, -0.03445566073060036, -0.013972662389278412, -0.00662541389465332, -0.05567333102226257, -0.05262014642357826, 0.01013349648565054, -0.10690050572156906, 0.03121519833803177, -0.0010388463269919157, -0.07555580884218216, 0.005918839015066624, -0.05134522169828415, -0.12499213963747025, -0.0018066281918436289, 0.0024209003895521164, 0.008135977201163769, 0.021922064945101738, -0.012196837924420834, 0.032529786229133606, -0.11226595938205719, 0.03220837190747261, -0.054340437054634094, 0.014263344928622246, 0.0022513852454721928, 0.07039989531040192, 0.0018875047098845243, 0.07447633892297745, 0.07424059510231018, -0.035427603870630264, 0.0011541966814547777, 0.046940770000219345, 0.03417785465717316, 0.04011452943086624, 0.042027316987514496, -0.019035587087273598, 0.07544498145580292, -0.01702495850622654, 0.10485171526670456, -0.007120986003428698, -0.0109876012429595, -0.014849849976599216, -0.04973069578409195, -0.08838111162185669, -0.02223481610417366, -0.021697893738746643, -0.06134669482707977, 0.04691997170448303, -0.004301066044718027, 0.02414686791598797, 0.07012118399143219, -0.03815845772624016, -0.08090554922819138, 0.03891637921333313, 0.009491668082773685, -0.0643668845295906, -0.12343047559261322, 0.04708966985344887, -0.08042749017477036, -0.03640095144510269, 0.03447766974568367, 0.06637956202030182, 0.007024993654340506, -0.032595936208963394, -0.11780572682619095, -0.009860198944807053, -0.020697420462965965, 0.014217289164662361, -0.04053086042404175, -0.06799198687076569, 0.0005265438230708241, -0.04133943095803261, 0.05807808041572571, 0.009118370711803436, -0.005419787485152483, 0.04505099356174469, -0.002575407736003399, 0.03889092430472374, 0.07871948927640915, 0.0239948108792305, 0.016602898016572, 0.06355961412191391, 0.057793572545051575, 0.0458352193236351, 0.03364619240164757, -0.09659797698259354, -0.023106180131435394, 0.05096152052283287, 0.04132900387048721, 0.04672946780920029, 0.0026313867419958115, -0.0957718938589096, 0.017130590975284576, -0.061394013464450836, 0.026796644553542137, -0.005960152484476566, -0.0006694027106277645, -0.04837948828935623, 0.059208739548921585, -0.04184068366885185, -0.03254210576415062, -0.00048263586359098554, -0.041152872145175934, 0.05950520560145378, 0.036815330386161804, 0.013099108822643757, 0.023977741599082947, 0.022745797410607338, 0.029507333412766457, -0.030602240934967995, 0.007002346217632294, -0.03497937694191933, 0.024249911308288574, -0.04987557232379913, 0.009527657181024551, 0.016202623024582863, 0.007517841644585133, -0.11298022419214249, 0.0021495281253010035, -0.07084503769874573, -0.0190974660217762, -0.03034420870244503, 0.024020936340093613, 0.018083099275827408, 0.05549788475036621, -0.0731390118598938, 0.13481257855892181, -0.07216833531856537, -0.03367023169994354, 0.015696847811341286, -0.06267870962619781, 0.013667854480445385, 0.023376937955617905, 0.03636690601706505, 0.10172004997730255, -0.043321218341588974, -0.06878849864006042, -0.0615374930202961, 0.027901863679289818, 0.04124455899000168, 0.0026461766101419926, 0.0009823631262406707, 0.015909941866993904, 0.02452831156551838, 0.03540423884987831, -0.014894623309373856, -0.06707435101270676, 0.05151538550853729, 0.051731906831264496, 0.059554412961006165, -0.03619798272848129, -0.009317510761320591, 0.028981609269976616, 0.006087848916649818, 0.019742781296372414, -0.044801414012908936, -0.03865956515073776, 0.0063333106227219105, -0.0008467319421470165, -0.04075915366411209, 0.054652243852615356, 0.07095401734113693, -0.015713300555944443, -0.026920899748802185, -0.030277669429779053, 0.04359617456793785, 0.016079863533377647, -0.019041290506720543, -0.02944091707468033, -0.02368377521634102, 0.020621728152036667, -0.032358210533857346, -0.02262887917459011, -0.024340277537703514, -0.006437251344323158, 0.024253536015748978, 0.0024392500054091215, -0.010866902768611908, 0.03262524679303169, 0.020879000425338745, 0.06371866911649704, 0.03376081958413124, 0.030748385936021805, -0.04105041176080704, -0.04028252139687538, -0.03664961829781532, 0.005313030909746885, -0.028664901852607727, 0.04848238825798035, 0.013131177052855492, -0.020973987877368927, 0.0030267969705164433, 0.02457205019891262, -0.012864449061453342, -0.023974819108843803, -0.011920707300305367, -0.012690335512161255, 0.027356909587979317, -0.014288734644651413, -0.02699287422001362, -0.004165366291999817, 0.02282521314918995, 0.00006570681580342352, -0.019274143502116203, -0.010552356019616127, 0.009126516059041023, -0.025295305997133255, 0.00441556703299284, -0.02490631490945816, -0.011096560396254063, -0.031199337914586067, 0.021757537499070168, 0.004320325329899788, 0.0351642481982708, -0.10046964883804321, -0.014021073468029499, -0.0015848169568926096, 0.0034750518389046192, -0.021856971085071564, -0.01684817299246788, 0.046229831874370575, 0.002101338002830744, -0.015121962875127792, 0.018926767632365227, 0.024505987763404846, 0.010252787731587887, -0.002564375288784504, 0.003067287150770426, -0.004448479041457176, -0.012965381145477295, 0.007005809806287289, 0.008308402262628078, 0.02064325101673603, 0.023003622889518738, -0.031620919704437256, -0.0034529021941125393, -0.01585179567337036, -0.02072732150554657, -0.0037883224431425333, 0.01940077356994152, 0.007218087092041969, -0.00014998919505160302, 0.05902281776070595, -0.03113650158047676, -0.054938219487667084, -0.04929502680897713, 0.02752947248518467, -0.005578176584094763, -0.01864726096391678, -0.010773329064249992, -0.021901095286011696, 0.014080950058996677, 0.03413185477256775, 0.02513740584254265, 0.02650243043899536, 0.004684837069362402, 0.010071499273180962, -0.0005705099320039153, -0.0040515512228012085, 0.015616095624864101, 0.028857870027422905, 0.039328258484601974, 0.03858884051442146, -0.043878231197595596, -0.007087609264999628, 0.0019231813494116068, -0.026162097230553627, 0.030077973380684853, 0.010559151880443096, 0.007870083674788475, -0.042444415390491486, -0.004444839432835579, 0.025013893842697144, -0.01730402186512947, -0.019743183627724648, 0.021749410778284073, 0.025783585384488106, 0.016492649912834167, -0.04313310608267784, 0.015599540434777737, 0.016779784113168716, 0.010330206714570522, -0.014506373554468155, 0.033943284302949905, 0.005635855253785849, 0.01854836940765381, 0.0017885133856907487, 0.004633273929357529, -0.02457400970160961, 0.006871878169476986, 0.009563704021275043, 0.0176774263381958, 0.08077273517847061, 0.03922755643725395, -0.010082135908305645, -0.01573115773499012, -0.05660806968808174, -0.016247443854808807, 0.017879923805594444, 0.021155668422579765, -0.025208855047822, -0.0035476000048220158, 0.017231620848178864, -0.008493688888847828, 0.0037960284389555454, -0.039103273302316666, -0.036320604383945465, -0.0005873834015801549, 0.01162539143115282, 0.0005310130654834211, 0.03432513773441315, 0.014480584301054478, -0.026185063645243645, 0.017845338210463524, 0.0077644232660532, -0.029556434601545334, 0.011911246925592422, 0.021110178902745247, 0.0013186547439545393, 0.02546827681362629, -0.00947343185544014, 0.006691938731819391, 0.026563839986920357, 0.01733083464205265, 0.0015591405099257827, 0.003663274459540844, 0.03328439220786095, -0.005271092522889376, 0.04347236827015877, 0.06135525181889534, -0.013862041756510735, -0.03138479217886925, -0.03145702928304672, 0.01193977426737547, -0.016242828220129013, 0.02781718596816063, 0.02271581068634987, 0.030370816588401794, 0.05344352871179581, 0.02746896632015705, 0.015622411854565144, 0.04377974942326546, 0.022327007725834846, -0.0038370403926819563, -0.048956602811813354, -0.01306996587663889, 0.03523898124694824, -0.007888135500252247, 0.02951657772064209, -0.000797063170466572, -0.02737461030483246, 0.01525959838181734, -0.0064499774016439915, -0.06198115274310112, -0.021660147234797478, 0.017815755680203438, -0.001879267510958016, -0.05901818722486496, 0.053610678762197495, 0.03005056641995907, -0.02402031049132347, 0.018154334276914597, -0.042195096611976624, 0.039735861122608185, 0.05350416526198387, -0.047778863459825516, -0.042135871946811676, 0.04555244371294975, 0.022780252620577812, 0.005833116825670004, -0.018170226365327835, 0.023692183196544647, 0.024022169411182404, 0.020590906962752342, -0.03132781386375427, -0.008063026703894138, -0.040608081966638565, 0.007315567694604397, 0.003835026640444994, 0.008468438871204853, 0.0074953134171664715, -0.043045204132795334, 0.02284439280629158, -0.012594635598361492, 0.005659750197082758, 0.0049769021570682526, -0.001851521199569106, -0.016808921471238136, 0.020699268206954002, 0.0353618822991848, 0.03405175730586052, 0.03644605726003647, 0.031476881355047226, -0.0053443387150764465, 0.01247518602758646, -0.010031800717115402, -0.020569875836372375, -0.008248253725469112, 0.008886842057108879, 0.02038903348147869, 0.06648679077625275, 0.09434289485216141, -0.011184493079781532, -0.006766911130398512, -0.007394736632704735, 0.007269956171512604, 0.026730557903647423, -0.05559370294213295, 0.013002551160752773, -0.029283462092280388, -0.024856602773070335, 0.02491568773984909, -0.013250029645860195, -0.011209449730813503, 0.007782674860209227, 0.018067099153995514, -0.0322137251496315, -0.015894712880253792, 0.04864822328090668, 0.026165734976530075, 0.035971444100141525, -0.07163377851247787, 0.028856346383690834, -0.0347762331366539, 0.01706511899828911, 0.015135804191231728, -0.00792554672807455, -0.011233270168304443, -0.024276960641145706, -0.019638007506728172, -0.01041661761701107, 0.05233672633767128, 0.05062127485871315, 0.046763043850660324, -0.000811993726529181, -0.030235162004828453, -0.055099967867136, -0.011302875354886055, -0.013987231999635696, -0.02560136280953884, -0.0015211147256195545, 0.005954410880804062, -0.04896730184555054, 0.026656104251742363, 0.041674625128507614, 0.0003855493268929422, -0.0011416561901569366, 0.06992234289646149, 0.005902433302253485, -0.020217448472976685, 0.04457826167345047, 0.02898380532860756, 0.05563192442059517, -0.0018003334989771247, -0.023180635645985603, -0.021663151681423187, -0.004121309146285057, 0.005067110992968082, -0.025442220270633698, 0.004761521238833666, 0.0799829438328743, -0.03621092438697815, 0.01719907484948635, 0.020479222759604454, 0.05048888176679611, -0.0023262028116732836, 0.005877537187188864, 0.003072213614359498, 0.015419242903590202, 0.008690161630511284, 0.02887420728802681, -0.0012931415112689137, 0.019598042592406273, 0.059928592294454575, 0.003338790964335203, -0.03845915198326111, 0.007644748780876398, 0.005712073761969805, -0.029997657984495163, 0.019567912444472313, 0.024973450228571892, -0.04014923796057701, -0.003088550642132759, 0.03685241937637329, -0.02024490013718605, 0.009772049263119698, 0.0052654435858130455, 0.002313781762495637, -0.012710068374872208, 0.005066649988293648, -0.01342578511685133, 0.06065404787659645, 0.004357129335403442, 0.05943339690566063, 0.024047913029789925, 0.0541222020983696, 0.018271341919898987, -0.018256714567542076, -0.022251570597290993, -0.018186401575803757, 0.04906785488128662, -0.020475899800658226, 0.0032508615404367447, 0.03873267397284508, -0.001093144528567791, -0.006075724959373474, -0.031934648752212524, -0.00564128952100873, -0.04997583106160164, -0.06086592748761177, 0.01038358174264431, -0.025550099089741707, 0.036742936819791794, -0.025847040116786957, 0.025053905323147774, 0.030573727563023567, 0.07218281924724579, -0.02596091851592064, 0.02515585720539093, 0.004756562411785126, 0.02359340339899063, -0.009223434142768383, 0.005400137975811958, -0.002101553836837411, -0.028100643306970596, 0.04466583952307701, 0.04428832605481148, 0.027870621532201767, 0.0073399292305111885, -0.02519657462835312, 0.013087454251945019, -0.003076653927564621, -0.009680893272161484, 0.02303384058177471, -0.003757124301046133, 0.03156403824687004, -0.002236753236502409, 0.008085385896265507, -0.03194388747215271, 0.03177771717309952, -0.015251698903739452, -0.007450771983712912, 0.0496039092540741, -0.002707705134525895, -0.0022342039737850428, 0.0007179139065556228, 0.008911032229661942, -0.025689207017421722, -0.014767305925488472, -0.002707336563616991, -0.017037030309438705, 0.0379926972091198, -0.03938253968954086, -0.015176255255937576, -0.00805997010320425, 0.020317159593105316, -0.044534314423799515, -0.0062037366442382336, -0.020401734858751297, -0.009231220930814743, 0.038441747426986694, 0.025262074545025826, -0.014185491017997265, 0.004575161729007959, 0.0036383068654686213, 0.018893584609031677, -0.03297937661409378, 0.010608785785734653, -0.01980164274573326, -0.039875566959381104, 0.051135867834091187, -0.019916588440537453, -0.03003794513642788, 0.0023253420367836952, 0.03210686519742012, -0.005549262277781963, 0.042937107384204865, -0.00673434603959322, -0.014659738168120384, 0.0075674839317798615, -0.04612471163272858, -0.053245626389980316, 0.004589030519127846, 0.05758843570947647, 0.016728872433304787, -0.001877377973869443, -0.01548748929053545, -0.03353343904018402, -0.0147098982706666, 0.013439025729894638, 0.022830670699477196, -0.03427841141819954, -0.02846255525946617, -0.027293631806969643, 0.027434973046183586, -0.0006917802384123206, 0.01503090001642704, 0.04974903538823128, -0.04160372540354729, -0.01539124920964241, -0.05026043578982353, 0.02622959204018116, -0.019681261852383614, -0.01887170597910881, -0.01755536161363125, -0.020818332210183144, -0.04558365419507027, 0.004372958093881607, -0.01585860550403595, 0.037761520594358444, -0.06078735738992691, 0.027033314108848572, 0.000661107013002038, -0.01263729389756918, -0.04581136256456375, -0.028045112267136574, 0.062218137085437775, 0.042334262281656265, 0.014829403720796108, -0.02453625202178955, -0.0196220800280571, -0.010371500626206398, -0.021132269874215126, 0.0011434027692303061, -0.005494468845427036, 0.033597346395254135, -0.009824655950069427, -0.03415926545858383, -0.01731381192803383, -0.007887294515967369, -0.01293234247714281, 0.01606922037899494, 0.011218416504561901, 0.024049093946814537, -0.02500772476196289, -0.007698608096688986, 0.01642450876533985, -0.02503194287419319, 0.05506379157304764, 0.010055321268737316, 0.005027950741350651, -0.005832677241414785, -0.01881701499223709, -0.04411986097693443, -0.04163048043847084, 0.04249623790383339, -0.0004600743413902819, 0.060795363038778305, 0.00454633729532361, 0.0070919799618422985, 0.028604844585061073, -0.0024125222116708755, 0.022634238004684448, -0.010191589593887329, -0.06962395459413528, -0.0173902940005064, 0.01816844753921032, 0.022417733445763588, -0.05229218304157257, -0.03386646509170532, 0.04582026228308678, -0.012789510190486908, 0.03852205350995064, 0.01391229685395956, 0.022484956309199333, 0.02037556655704975, -0.013563886284828186, 0.01400249358266592, -0.011548344045877457, 0.014911512844264507, 0.005081955809146166, 0.028816496953368187, 0.020630070939660072, 0.030499298125505447 ]
Hugging Face on PyTorch / XLA TPUs
jysohn23
February 9, 2021
pytorch-xla
open-source-collab
https://huggingface.co/blog/pytorch-xla
Get Started with PyTorch / XLA on TPUs See the “Running on TPUs” section under the Hugging Face examples to get started. For a more detailed description of our APIs, check out our API_GUIDE, and for performance best practices, take a look at our TROUBLESHOOTING guide. For generic PyTorch / XLA examples, run the following Colab Notebooks we offer with free Cloud TPU access. To run directly on GCP, please see our tutorials labeled “PyTorch” on our documentation site. Have any other questions or issues? Please open an issue or question at https://github.com/huggingface/transformers/issues or directly at https://github.com/pytorch/xla/issues.
[ 0.03690662607550621, -0.04398801177740097, 0.05496204271912575, 0.01936378888785839, 0.04789505526423454, 0.042863838374614716, 0.03138558194041252, 0.062322989106178284, -0.006610705982893705, -0.04583655670285225, -0.04661346226930618, 0.09450660645961761, -0.02807609736919403, 0.06540926545858383, 0.05932876467704773, -0.030411027371883392, 0.05151292681694031, 0.0031103536020964384, -0.021545855328440666, 0.059037432074546814, 0.02615332417190075, -0.02402428165078163, 0.014976982027292252, 0.020149657502770424, -0.03867080807685852, -0.11273326724767685, -0.024931026622653008, 0.03849766403436661, -0.009175427258014679, 0.014518216252326965, -0.07804029434919357, 0.013535717502236366, 0.03297235444188118, -0.018495135009288788, 0.024438418447971344, 0.057009998708963394, -0.07258584350347519, 0.025199690833687782, 0.06700126826763153, -0.007247813977301121, 0.031188802793622017, -0.005940264090895653, -0.09800560772418976, 0.05164342001080513, -0.0007805072818882763, -0.023891255259513855, -0.19275453686714172, 0.0942385271191597, -0.05687204375863075, 0.019500775262713432, -0.04001545533537865, 0.046847183257341385, 0.02748071774840355, -0.03693004325032234, 0.03294681757688522, 0.07911170274019241, -0.052879076451063156, -0.08536509424448013, 0.0071497512981295586, -0.01147502101957798, 0.045493025332689285, 0.023732107132673264, -0.022807857021689415, 0.048580728471279144, 0.009860008955001831, -0.009704897180199623, -0.0009145097574219108, -0.0029883678071200848, -0.07436700165271759, -0.03212069720029831, -0.012614068575203419, 0.021661264821887016, 0.00726174283772707, 0.005088117439299822, -0.014189507812261581, -0.04616837203502655, -0.03910992294549942, -0.013068778440356255, 0.08078263700008392, 0.07242972403764725, 0.0031864785123616457, 0.017828885465860367, 0.02650575339794159, 0.04183370620012283, 0.035461731255054474, 0.03413878008723259, 0.031003976240754128, -0.029730573296546936, -0.03840308636426926, 0.06303718686103821, -0.008830352686345577, -0.13227295875549316, 0.03379012271761894, 0.01098219770938158, 0.020888060331344604, -0.026037467643618584, -0.010930322110652924, 0.022079061716794968, -0.0011465767165645957, -0.05674199014902115, -0.02282227948307991, -0.04977823793888092, -0.00006682454113615677, -0.04032815247774124, -0.05172323063015938, 0.009217049926519394, -0.011190659366548061, -0.07608740031719208, 0.00842582993209362, -0.013993410393595695, -0.00990969967097044, -0.00569008756428957, -0.005684561561793089, 0.06107638031244278, -0.04471574351191521, 0.006371335592120886, 0.015149824321269989, 0.007435724604874849, 0.008557373657822609, 0.015399130061268806, -0.0031029051169753075, 0.1352025270462036, -0.009778887033462524, -0.03718121722340584, 0.03360966965556145, 0.10584994405508041, -0.016607053577899933, -0.0148118631914258, 0.011325916275382042, -0.0447026751935482, 0.03749776631593704, -0.06740042567253113, 0.06584259122610092, -0.043957434594631195, 0.027853284031152725, -0.04455248638987541, 0.02123568393290043, -0.06193467974662781, -0.007637064903974533, -0.009080011397600174, 0.006233925465494394, 0.12050695717334747, 0.019985876977443695, 0.016660824418067932, 0.036062974482774734, -0.018120506778359413, -0.0917946919798851, 0.10297080874443054, -0.029253395274281502, -0.019770199432969093, -0.07915110886096954, 0.07004974782466888, -0.05758651718497276, 0.0006981619517318904, 0.027554770931601524, 0.031218571588397026, -0.011488709598779678, -0.06555482000112534, -0.08459984511137009, -0.04634023457765579, 0.0034185273107141256, 0.011497014202177525, -0.07910733669996262, 0.01950960047543049, 0.029285939410328865, 0.04112052917480469, 0.07567808777093887, -0.02301575057208538, 0.0003554935392457992, -0.04291166365146637, -0.005271256901323795, -0.026982201263308525, 0.036299753934144974, 0.027204036712646484, -0.02713528461754322, 0.035779669880867004, 0.04332026466727257, 0.04645713046193123, 0.0015433041844516993, -0.034000687301158905, -0.04048808664083481, 0.0930577740073204, -0.05731552094221115, 0.05216004326939583, -0.010009964928030968, -0.038170404732227325, 0.04742063954472542, -0.0074810730293393135, -0.006552059669047594, 0.021105362102389336, -0.05680732801556587, -0.03568199276924133, 0.04242871329188347, -0.00878211110830307, 0.03773888945579529, -0.03574739396572113, -0.036953628063201904, 0.07721725851297379, -0.04051733762025833, 0.040376100689172745, 0.022560136392712593, 0.015611980110406876, 0.02081354707479477, -0.05975416675209999, -0.02332662232220173, 0.002955622971057892, 0.07541811466217041, -0.06723477691411972, 0.03015798330307007, -0.0012228303821757436, -0.00869574025273323, -0.11597783118486404, 0.03359804302453995, -0.040825821459293365, -0.003974076360464096, -0.06063205748796463, -0.022400155663490295, -0.012228300794959068, 0.05968553200364113, -0.014832050539553165, 0.1663685292005539, -0.052602216601371765, 0.0126098757609725, -0.008704624138772488, -0.03598320111632347, 0.027697058394551277, 0.056475527584552765, 0.046530019491910934, 0.06914140284061432, -0.09339767694473267, -0.02238013967871666, -0.08761471509933472, -0.05199401453137398, 0.06262469291687012, -0.01774873584508896, -0.0501626580953598, 0.00514709297567606, -0.016867177560925484, 0.03948654606938362, -0.031230272725224495, -0.014432314783334732, 0.017913252115249634, -0.050191059708595276, -0.0007720899302512407, -0.02606566622853279, -0.06374038010835648, 0.026651209220290184, 0.08181751519441605, -0.022533467039465904, -0.004628094844520092, -0.08993684500455856, 0.05402112007141113, 0.013696998357772827, -0.010591012425720692, 0.023831656202673912, 0.04864523932337761, -0.027229979634284973, 0.001742398482747376, -0.01832265593111515, 0.04926498979330063, 0.00585938012227416, -0.01287364773452282, -0.031228819862008095, -0.036535754799842834, -0.017680590972304344, -0.024472113698720932, -0.01906382292509079, 0.010145570151507854, 0.007769016083329916, -0.006552382837980986, 0.024999506771564484, -0.047500092536211014, 0.022342901676893234, 0.0019950687419623137, 0.009160833433270454, 0.021941525861620903, 0.03390488773584366, -0.005365850403904915, -0.04415411129593849, -0.03733978420495987, 0.02809363417327404, -0.021242322400212288, 0.06747137010097504, 0.02402203530073166, -0.0029402305372059345, -0.0024929125793278217, 0.01727195642888546, -0.038065336644649506, -0.046264443546533585, -0.008673081174492836, -0.02522391825914383, 0.03400903567671776, -0.02426920272409916, -0.040541354566812515, -0.01516176387667656, 0.011813947930932045, -0.0015977153088897467, -0.012975811026990414, -0.015939082950353622, 0.03003602661192417, -0.04010990634560585, -0.015310515649616718, 0.00746894022449851, -0.021520279347896576, -0.014723519794642925, 0.009630940854549408, 0.025361236184835434, 0.0037743253633379936, -0.10421863198280334, -0.030349204316735268, -0.030679645016789436, 0.0247506070882082, -0.036269523203372955, -0.05202111974358559, 0.02582585997879505, 0.005938514601439238, -0.019851837307214737, 0.028112145140767097, 0.011204114183783531, 0.013000388629734516, 0.007520782295614481, -0.015390570275485516, -0.015078358352184296, -0.0007664950098842382, 0.012038644403219223, 0.0190565325319767, 0.059781357645988464, 0.008383299224078655, -0.04452221468091011, 0.05765347555279732, 0.01956230215728283, -0.009542515501379967, 0.02399604581296444, 0.039557091891765594, 0.01492568664252758, 0.021796073764562607, 0.03246614336967468, -0.044221699237823486, 0.0047269235365092754, -0.004813420586287975, -0.010230671614408493, 0.024998268112540245, -0.01545736938714981, -0.012818146497011185, -0.02345084398984909, -0.013192067854106426, 0.0180986225605011, 0.050977692008018494, 0.007861314341425896, 0.01933218166232109, 0.02656381018459797, -0.027860021218657494, 0.01132715493440628, 0.011043931357562542, -0.009461844339966774, -0.014427466318011284, 0.020961863920092583, -0.006776105146855116, -0.05120876058936119, 0.01579922065138817, 0.010870234109461308, 0.03328201174736023, 0.01459475513547659, 0.002038543811067939, 0.005871168337762356, 0.0497303381562233, 0.030398443341255188, 0.0045543755404651165, -0.05855206772685051, 0.02198668383061886, -0.02277000993490219, -0.0036407464649528265, -0.0003614809247665107, 0.053521186113357544, 0.03247470408678055, 0.018467817455530167, -0.04414532706141472, 0.0017015299526974559, -0.03261512517929077, 0.031723182648420334, -0.00812738947570324, 0.0074759433045983315, -0.009726027958095074, 0.015879137441515923, -0.0313669815659523, -0.025243621319532394, 0.056841667741537094, 0.002885113237425685, -0.03642657399177551, -0.02637062408030033, -0.03954436630010605, -0.027000708505511284, 0.01692991331219673, 0.009606427513062954, 0.01871870830655098, -0.01997942291200161, 0.006015180144459009, 0.0685955286026001, 0.027301577851176262, -0.018852118402719498, 0.01616990752518177, -0.03130591660737991, -0.01876368559896946, -0.006417518015950918, 0.004705293569713831, 0.025705691426992416, 0.024593571200966835, 0.029126394540071487, -0.0010347352363169193, -0.0421435721218586, -0.0014229053631424904, 0.02214227057993412, 0.00675744516775012, 0.011882273480296135, -0.0006302139372564852, -0.03537135198712349, 0.035995617508888245, -0.004130371380597353, 0.0245183315128088, -0.0026828621048480272, 0.0010349206859245896, -0.015140271745622158, 0.021432803943753242, 0.02701672539114952, 0.015479191206395626, -0.04674403741955757, -0.033613771200180054, 0.023739775642752647, -0.02561667002737522, 0.036187611520290375, -0.027283713221549988, -0.03374346345663071, -0.014670394361019135, 0.010057952255010605, 0.026976097375154495, 0.03268544375896454, -0.002849079668521881, 0.008760199882090092, -0.03438793122768402, -0.03984753042459488, 0.017043815925717354, 0.006367836147546768, -0.01423435378819704, -0.0031024410855025053, -0.022679945454001427, 0.0027336813509464264, -0.02056805044412613, -0.04280077666044235, -0.01303937565535307, -0.003003799356520176, 0.03432244434952736, -0.04892667382955551, 0.05124897509813309, 0.02326500229537487, -0.05920269340276718, 0.01707272231578827, -0.04770077392458916, -0.0066949655301868916, 0.03551453724503517, -0.01035404484719038, -0.04686873033642769, 0.050739798694849014, 0.037970494478940964, 0.011259786784648895, 0.03694017976522446, 0.036424461752176285, 0.015930958092212677, 0.05895955488085747, -0.04130760580301285, -0.0016522527439519763, -0.01618681661784649, -0.0010038194013759494, 0.04124355688691139, 0.024768715724349022, -0.008647406473755836, -0.05896681547164917, -0.0004796615394297987, -0.0044333902187645435, -0.06112648546695709, -0.010932979173958302, 0.023257030174136162, -0.040734972804784775, -0.015630794689059258, 0.04169956594705582, 0.03348918259143829, -0.002460394985973835, 0.03772754222154617, 0.05941779911518097, -0.009512691758573055, 0.0062557426281273365, 0.05640625208616257, -0.0456329770386219, 0.0155677180737257, 0.01995977945625782, 0.040355581790208817, 0.032962068915367126, 0.01568850316107273, 0.03372777998447418, -0.025233158841729164, -0.044426530599594116, -0.019428672268986702, -0.008070886135101318, 0.009068210609257221, -0.026002736762166023, -0.024818681180477142, 0.016404425725340843, -0.002382224425673485, -0.005985321942716837, -0.00804908387362957, 0.06671807914972305, -0.03356489911675453, 0.0030288437847048044, 0.055878352373838425, 0.03669194504618645, -0.006408974062651396, -0.01528843306005001, 0.029699506238102913, -0.03808681666851044, 0.008265472017228603, 0.012709371745586395, 0.028354037553071976, -0.022702474147081375, -0.004312210250645876, -0.022979965433478355, -0.03610134869813919, 0.03490592539310455, 0.04351768642663956, 0.0285467691719532, -0.017544787377119064, 0.008805390447378159, 0.006801318842917681, -0.001970730721950531, 0.030698087066411972, -0.018417611718177795, 0.0034835198894143105, 0.0035587772727012634, -0.008708463981747627, 0.01704520545899868, 0.04176342487335205, 0.014049824327230453, -0.021854765713214874, 0.02641291916370392, 0.05470404028892517, 0.016130799427628517, -0.03225083276629448, 0.020785680040717125, 0.015647849068045616, -0.015780968591570854, -0.018208056688308716, -0.008923113346099854, -0.009770131669938564, 0.02071857452392578, -0.002099300269037485, 0.04822960123419762, 0.07834803313016891, -0.020122256129980087, 0.018192339688539505, -0.016076941043138504, 0.03264693543314934, -0.011315840296447277, -0.020848551765084267, -0.038908202201128006, 0.017068324610590935, -0.02088119275867939, 0.019145220518112183, 0.007677076850086451, 0.01962362974882126, 0.03992316126823425, -0.003077769186347723, -0.07028406858444214, 0.032972052693367004, 0.03234118968248367, -0.026822548359632492, 0.014555356465280056, -0.006505026947706938, 0.0013133359607309103, 0.004122015554457903, 0.02575819194316864, 0.0341864638030529, 0.037310682237148285, -0.009776399470865726, -0.018036823719739914, -0.016452232375741005, -0.03450692445039749, 0.006335610058158636, 0.04651547968387604, -0.018280303105711937, 0.027303125709295273, 0.030715875327587128, 0.044849202036857605, 0.026702504605054855, 0.020416436716914177, -0.006638364866375923, 0.007192152086645365, 0.09434325248003006, 0.0001472100557293743, 0.04323304444551468, 0.0162374097853899, -0.022264208644628525, -0.02173710986971855, -0.03343299776315689, -0.0379784032702446, 0.0010906370589509606, 0.004133839160203934, 0.02432837337255478, -0.004983355291187763, -0.03222665190696716, -0.014462028630077839, 0.03353387489914894, 0.050081267952919006, 0.026402411982417107, -0.009858888573944569, 0.02678671106696129, 0.016453735530376434, 0.012547179125249386, -0.0009969010716304183, -0.0065336525440216064, 0.001760547049343586, 0.045379072427749634, 0.06519760191440582, 0.008572948165237904, 0.047338176518678665, -0.009151901118457317, 0.01814740151166916, 0.004184393677860498, -0.007087679114192724, -0.05181490257382393, -0.010217506438493729, -0.016667082905769348, -0.003716065315529704, 0.005778652615845203, 0.01657603494822979, -0.03799249604344368, -0.023986544460058212, -0.007002627942711115, 0.0145695386454463, -0.013971359468996525, -0.010657429695129395, -0.008339371532201767, 0.04312276095151901, -0.0022768753115087748, -0.022222695872187614, 0.00956551730632782, 0.010752430185675621, 0.02360616810619831, 0.016485095024108887, -0.03063376061618328, -0.028421292081475258, -0.012221679091453552, -0.005915349815040827, -0.015341625548899174, 0.00483274832367897, -0.015545165166258812, -0.014305106364190578, 0.021852385252714157, 0.04146483913064003, -0.012785463593900204, 0.0379859022796154, 0.051842957735061646, 0.007184369955211878, -0.029210885986685753, 0.04256444051861763, -0.010444548912346363, -0.023419683799147606, 0.00014622237358707935, -0.03787004202604294, 0.015446783043444157, -0.02236330322921276, 0.0084591219201684, 0.010743113234639168, 0.023213984444737434, -0.030546579509973526, -0.05600188672542572, -0.02839706465601921, 0.008874038234353065, -0.011931373737752438, 0.026702340692281723, 0.0199664905667305, -0.01667681336402893, 0.010089598596096039, -0.020263072103261948, 0.03068915568292141, 0.027570363134145737, 0.002929812530055642, 0.03072061389684677, -0.019512692466378212, -0.028730317950248718, -0.025619860738515854, 0.020659608766436577, 0.022058798000216484, 0.015487496741116047, 0.017349932342767715, -0.02661215327680111, -0.0006814515218138695, -0.029906418174505234, -0.006068339571356773, -0.05469200015068054, -0.02109350450336933, -0.03414680436253548, -0.07145482301712036, -0.004739923402667046, -0.010911889374256134, 0.006963691674172878, 0.019544420763850212, -0.042133353650569916, -0.01883689872920513, -0.029935261234641075, -0.014046934433281422, 0.002831327496096492, -0.020616251975297928, 0.04271065816283226, 0.0495777353644371, 0.021382899954915047, -0.0005180673906579614, -0.020037628710269928, 0.029835231602191925, 0.01894986815750599, -0.030409909784793854, 0.05156999081373215, 0.013439726084470749, -0.007581633981317282, -0.06993181258440018, 0.004932735115289688, 0.042906999588012695, -0.022143762558698654, 0.029865508899092674, 0.0009796579834073782, -0.0014122818829491735, -0.06768888235092163, -0.012157873250544071, 0.03832775726914406, 0.03460434824228287, 0.06081198528409004, -0.01712631620466709, -0.017259864136576653, 0.022369205951690674, -0.025458240881562233, -0.058681342750787735, 0.002744751749560237, -0.0024683119263499975, -0.005408013705164194, 0.01271461695432663, -0.011250144802033901, 0.01300028245896101, -0.00705053610727191, -0.017902052029967308, 0.0009945606580004096, 0.004024500027298927, -0.03847288712859154, -0.0026650310028344393, -0.014399307779967785, 0.028848130255937576, -0.010865024290978909, -0.0198387298732996, 0.05060562863945961, 0.007953560911118984, -0.01729576848447323, -0.008043868467211723, -0.01962517574429512, 0.017453083768486977, 0.0034716054797172546, 0.014582199975848198, -0.018946196883916855, 0.07500587403774261, 0.02543257735669613, -0.034614916890859604, -0.021112799644470215, 0.0050556473433971405 ]
Hugging Face on PyTorch / XLA TPUs
jysohn23
February 9, 2021
pytorch-xla
open-source-collab
https://huggingface.co/blog/pytorch-xla
XLA Device Step Computation In a typical XLA:TPU training scenario we’re training on multiple TPU cores in parallel (a single Cloud TPU device includes 8 TPU cores). So we need to ensure that all the gradients are exchanged between the data parallel replicas by consolidating the gradients and taking an optimizer step. For this we provide the xm.optimizer_step(optimizer) which does the gradient consolidation and step-taking. In the Hugging Face trainer, we correspondingly update the train step to use the PyTorch / XLA APIs: python class Trainer: … def train(self, *args, **kwargs): ... if is_torch_tpu_available(): xm.optimizer_step(self.optimizer)
[ -0.010204894468188286, -0.0014646209310740232, 0.0016974059399217367, 0.006845247000455856, 0.029823092743754387, 0.03152228891849518, -0.013809166848659515, -0.0009478452266193926, 0.021730320528149605, -0.06616361439228058, -0.019934793934226036, 0.03126230090856552, -0.011932200752198696, 0.06004460155963898, 0.02990802191197872, -0.07327179610729218, 0.02880481630563736, -0.03602118417620659, -0.025025377050042152, 0.0756438747048378, 0.033438004553318024, -0.008496160618960857, 0.04408768191933632, 0.006067388691008091, -0.027240360155701637, -0.07761727273464203, -0.012040207162499428, 0.012565949000418186, 0.07000339031219482, 0.04424947127699852, -0.054653916507959366, 0.0030136064160615206, 0.015493477694690228, -0.04291684180498123, 0.07450196146965027, 0.037079013884067535, -0.04115829989314079, 0.032416630536317825, 0.056782033294439316, -0.016014255583286285, 0.031071089208126068, -0.02861911803483963, -0.09477853029966354, 0.027522552758455276, 0.009074154309928417, -0.011874093674123287, -0.06850738078355789, 0.01308257132768631, -0.020674221217632294, 0.02540481835603714, -0.07303845882415771, 0.025556953623890877, -0.011446414515376091, -0.021359441801905632, 0.05453646928071976, 0.04950098693370819, -0.07267706096172333, -0.030461210757493973, 0.013607358559966087, 0.03700682520866394, -0.012194842100143433, 0.027840517461299896, 0.00863627903163433, 0.06865247339010239, 0.032943807542324066, -0.016697470098733902, 0.06193549931049347, -0.020468100905418396, -0.11331518739461899, -0.07465120404958725, 0.04414832219481468, 0.02858561836183071, 0.05956115573644638, 0.0625569224357605, -0.025609804317355156, -0.06204886734485626, -0.045203473418951035, -0.003937238361686468, 0.053973644971847534, 0.04414041340351105, 0.036151278764009476, 0.010902225971221924, -0.049501460045576096, 0.040578823536634445, 0.04151425138115883, 0.04843084141612053, 0.00638072332367301, -0.042739465832710266, -0.008579629473388195, 0.026241285726428032, -0.01777557097375393, -0.10122069716453552, 0.045698534697294235, 0.0003231712616980076, 0.02579532563686371, 0.010482176207005978, -0.02918296307325363, -0.020571090281009674, -0.006809345446527004, -0.020793922245502472, 0.014247138053178787, -0.09977802634239197, -0.012018024921417236, -0.05087737739086151, -0.07125113904476166, 0.02523910626769066, -0.012251660227775574, -0.07111755013465881, -0.034717313945293427, 0.008633570745587349, -0.007889270782470703, 0.0018010138301178813, -0.025841625407338142, 0.07380140572786331, 0.0047165388241410255, -0.0011646164348348975, 0.018271969631314278, 0.021807800978422165, -0.005434781312942505, -0.013874820433557034, 0.0030769763980060816, 0.1137571781873703, 0.07564007490873337, -0.024026889353990555, 0.00289228861220181, 0.08310648053884506, -0.005647000391036272, -0.07631298899650574, 0.05053631216287613, -0.03777109459042549, -0.04639231786131859, -0.016446540132164955, 0.09301895648241043, -0.05924700200557709, 0.05582643672823906, -0.07079076766967773, 0.030117755755782127, 0.009954312816262245, -0.009603380225598812, 0.037878796458244324, -0.03541794791817665, 0.09634684026241302, 0.0602799616754055, -0.0020762658677995205, -0.04514415189623833, -0.02020787075161934, -0.07077814638614655, 0.09576164931058884, 0.01614939607679844, 0.016371306031942368, -0.06932416558265686, 0.06159503012895584, -0.09519881010055542, -0.05218636989593506, 0.038333602249622345, 0.04122352972626686, 0.0056099481880664825, -0.07932853698730469, -0.10941852629184723, -0.05648677796125412, -0.021853916347026825, 0.028224602341651917, -0.038633473217487335, 0.010128793306648731, 0.01669366843998432, 0.07982601970434189, 0.08158952742815018, 0.03854537755250931, 0.02427401952445507, 0.021133044734597206, -0.007537137717008591, -0.009492715820670128, -0.002165819751098752, 0.011018224060535431, -0.015913432464003563, 0.024371052160859108, 0.009372499771416187, 0.02318115532398224, -0.05313197523355484, -0.020870091393589973, -0.04533810913562775, 0.05091526359319687, -0.06910089403390884, 0.035321492701768875, -0.020858298987150192, -0.044143881648778915, 0.08211641758680344, -0.03885712847113609, -0.039202820509672165, 0.07944874465465546, -0.05599804222583771, -0.005032362416386604, 0.0346091166138649, -0.07119254767894745, 0.03719821199774742, -0.038678646087646484, -0.05207729712128639, 0.03627142310142517, -0.04336721822619438, -0.03388321399688721, 0.06802786141633987, -0.011471656151115894, 0.02261057123541832, -0.004690659698098898, -0.0026015162002295256, 0.015958372503519058, 0.018824372440576553, -0.04990493506193161, 0.044928789138793945, 0.05180909484624863, -0.009552571922540665, -0.0822213664650917, -0.04772772639989853, -0.07915116846561432, -0.037895068526268005, -0.006990382447838783, -0.016017068177461624, 0.05623598024249077, 0.013646725565195084, -0.046616725623607635, 0.15766052901744843, -0.08898087590932846, 0.009201367385685444, 0.026136526837944984, -0.007875633426010609, 0.013533024117350578, 0.028498400002717972, 0.06009876728057861, 0.005736073479056358, -0.07119004428386688, -0.04653194919228554, -0.12122237682342529, -0.09273823350667953, 0.028674911707639694, 0.049606531858444214, -0.012113767676055431, -0.0033873950596898794, -0.006066524889320135, 0.06889400631189346, -0.028480419889092445, -0.03361894562840462, 0.07530733942985535, -0.008774872869253159, 0.003880529897287488, 0.04890726879239082, -0.048532940447330475, 0.032728686928749084, 0.055423803627491, -0.09065575897693634, 0.009082060307264328, -0.03121698834002018, 0.03830096498131752, 0.016895953565835953, -0.018785493448376656, 0.01273923646658659, -0.0012347303563728929, -0.017421478405594826, -0.017616955563426018, -0.015986504033207893, 0.04335268214344978, -0.014418225735425949, -0.024533886462450027, -0.020064232870936394, -0.02422538958489895, 0.015692174434661865, -0.03800958767533302, 0.04776468873023987, -0.020934591069817543, 0.014089275151491165, -0.008636007085442543, 0.028466057032346725, -0.05803591385483742, 0.0015947404317557812, -0.05151433125138283, 0.04802348092198372, -0.030163411051034927, 0.043529435992240906, 0.012594270519912243, 0.0001597143564140424, -0.04580601304769516, 0.0009436852415092289, -0.009378897957503796, 0.018432268872857094, -0.005677375476807356, -0.005347952712327242, -0.0016728299669921398, 0.0289622712880373, -0.01875770092010498, 0.010746799409389496, -0.008865095674991608, 0.007529075723141432, 0.036243099719285965, -0.03708373010158539, -0.02729606442153454, -0.008567479439079762, 0.01846717856824398, -0.0030877680983394384, -0.03035465069115162, -0.022413594648241997, 0.02220040187239647, -0.05308344215154648, -0.048215389251708984, 0.02257809229195118, -0.054265063256025314, -0.02939673699438572, 0.002883455716073513, 0.03677968680858612, 0.0033039634581655264, -0.0739436000585556, 0.005550796166062355, -0.004530280362814665, -0.01487777940928936, -0.026766913011670113, -0.02351832576096058, -0.005091487430036068, 0.017853980883955956, -0.02771957591176033, 0.00372679834254086, 0.023172453045845032, 0.0025803938042372465, 0.010488314554095268, -0.02692202478647232, -0.02671627327799797, -0.020952438935637474, 0.017545929178595543, -0.042821116745471954, 0.025343483313918114, -0.009429315105080605, -0.006523565389215946, 0.027739224955439568, 0.0246918685734272, -0.03503449261188507, -0.002980058314278722, -0.01650269143283367, 0.02662104368209839, -0.019162433221936226, 0.009119885973632336, -0.06363876909017563, -0.016653992235660553, -0.02886725775897503, -0.06759908050298691, -0.03243621066212654, -0.012944109737873077, -0.020026758313179016, 0.016574956476688385, 0.013502494432032108, 0.031486883759498596, 0.034496504813432693, 0.04861349239945412, 0.024442052468657494, 0.03532707691192627, -0.04267602041363716, 0.026140514761209488, -0.0032203514128923416, 0.014520669355988503, -0.02658369392156601, 0.016406988725066185, -0.0034118820913136005, -0.016822142526507378, -0.008201826363801956, -0.0028245297726243734, 0.011911390349268913, 0.015483316965401173, -0.000035913806641474366, -0.03925885632634163, 0.04164556786417961, 0.04589024558663368, 0.024224085733294487, -0.03873704373836517, -0.02757325954735279, -0.01064145378768444, -0.0063784061931073666, 0.010794761590659618, 0.03147358447313309, 0.02451081946492195, -0.010835518129169941, -0.025269828736782074, 0.041819799691438675, -0.035967208445072174, 0.04292820766568184, 0.0043874806724488735, 0.009954212233424187, -0.059491224586963654, 0.021197400987148285, -0.028211304917931557, -0.02218019589781761, 0.014484326355159283, -0.004162312019616365, -0.04505382478237152, 0.00969046913087368, -0.05032207444310188, -0.003125996794551611, 0.05945257097482681, 0.010601745918393135, 0.021359320729970932, -0.01216226164251566, 0.046571627259254456, 0.06820713728666306, -0.0005585624603554606, -0.032021988183259964, 0.009379249066114426, -0.025990396738052368, -0.021572476252913475, -0.006893882527947426, 0.0009954941924661398, 0.023627279326319695, 0.017965085804462433, 0.015606679953634739, -0.008835784159600735, -0.05225573480129242, -0.0013936740579083562, 0.0020786388777196407, -0.016281750053167343, 0.0037892567925155163, 0.035590946674346924, -0.016987524926662445, 0.0444645881652832, 0.031341612339019775, 0.011364934965968132, -0.013837180100381374, 0.01046392135322094, -0.004590072203427553, 0.0506817065179348, -0.006547436583787203, -0.00368544296361506, -0.020669233053922653, 0.009985942393541336, 0.051810383796691895, -0.07473024725914001, 0.02862733043730259, 0.007329852785915136, -0.001803201506845653, -0.00035391224082559347, 0.01535838097333908, 0.0021195735316723585, 0.0016816797433421016, 0.015313166193664074, -0.03406338393688202, -0.043351657688617706, -0.032245222479104996, 0.02383045293390751, -0.009015639312565327, -0.0503532849252224, -0.01317481230944395, -0.021999357268214226, 0.035547204315662384, -0.029625605791807175, -0.04420440271496773, -0.039624109864234924, 0.022676808759570122, 0.016984963789582253, -0.045107774436473846, 0.05248204991221428, 0.016865277662873268, -0.07705248892307281, -0.00023359961051028222, -0.08142713457345963, 0.0325201116502285, 0.03596145287156105, 0.014680950902402401, -0.07014148682355881, 0.022049328312277794, 0.05704861879348755, 0.004864471964538097, 0.016312891617417336, 0.011718831025063992, 0.014858363196253777, 0.04912916198372841, 0.01674046739935875, 0.012013309635221958, -0.008214262314140797, -0.02994038164615631, 0.05492669716477394, -0.019182920455932617, -0.03548852726817131, -0.041704870760440826, -0.0022311049979180098, -0.003985327668488026, -0.05332804098725319, -0.008714556694030762, -0.0008723947103135288, -0.05254117399454117, 0.029265880584716797, 0.020867247134447098, 0.011728927493095398, -0.006900864653289318, 0.03621455654501915, 0.041282523423433304, -0.007711796090006828, -0.005817567463964224, 0.05223887413740158, -0.031846579164266586, 0.022667504847049713, 0.03833938017487526, -0.00556898070499301, 0.01890426315367222, 0.0072658793069422245, 0.007991793565452099, -0.027376264333724976, -0.011659572832286358, -0.054019734263420105, -0.0034154991153627634, -0.011876009404659271, -0.02120991237461567, -0.0368209071457386, 0.05789094418287277, -0.008160587400197983, 0.007142304442822933, -0.008356488309800625, 0.03306194767355919, -0.017316298559308052, -0.026414969936013222, -0.019429659470915794, 0.026175174862146378, -0.02265242487192154, 0.009874066337943077, -0.001260630670003593, -0.019654041156172752, -0.01977250725030899, -0.03209879621863365, 0.02525252290070057, 0.0031814039684832096, 0.018420619890093803, 0.017444316297769547, -0.020591668784618378, 0.033901624381542206, -0.0004941608640365303, 0.012397266924381256, -0.006351531948894262, 0.037852007895708084, 0.03517434746026993, -0.016513044014573097, -0.004493017215281725, -0.04863268509507179, 0.02464984729886055, -0.005156562197953463, 0.02196364477276802, -0.006026689428836107, 0.01773526892066002, 0.03601406514644623, -0.010965916328132153, 0.02445443533360958, 0.05672422796487808, 0.03296273574233055, -0.009208637289702892, 0.015208980068564415, 0.034205611795186996, -0.04316696524620056, -0.03291232883930206, -0.007260328624397516, -0.015213890932500362, 0.021906530484557152, 0.011810521595180035, 0.06775855273008347, 0.052880123257637024, -0.018192648887634277, 0.0180372167378664, 0.0006144472281448543, 0.01805213838815689, -0.021360818296670914, -0.04016068950295448, -0.018316704779863358, 0.028578845784068108, 0.05170796439051628, 0.021973013877868652, -0.011372986249625683, 0.009958755224943161, 0.016089465469121933, -0.01123274490237236, -0.07769560813903809, 0.004629876930266619, -0.019077511504292488, -0.006284165196120739, -0.0006255964981392026, -0.008524054661393166, -0.007239114493131638, 0.0365864597260952, -0.0008146059699356556, 0.025980090722441673, 0.027199136093258858, -0.013506162911653519, -0.00426546111702919, -0.0722246989607811, -0.023007245734333992, 0.015149779617786407, 0.061432626098394394, -0.012950818985700607, 0.006476016249507666, 0.014073772355914116, 0.03471821919083595, 0.039341751486063004, 0.02050081640481949, 0.016468079760670662, 0.010844758711755276, 0.08332499861717224, -0.002614611992612481, 0.008352520875632763, 0.0607345812022686, 0.012294379062950611, -0.026383258402347565, -0.0019079211633652449, -0.033530980348587036, 0.012978366576135159, 0.01766531728208065, 0.032213836908340454, -0.019663196057081223, 0.008543591946363449, -0.009292091242969036, 0.03767085447907448, 0.04620565474033356, 0.031133143231272697, -0.0032792272977530956, -0.017776766791939735, 0.013408987782895565, 0.011302362196147442, 0.038480889052152634, 0.010963800363242626, -0.023359574377536774, 0.043710269033908844, 0.03773001581430435, 0.01158474013209343, 0.038128919899463654, 0.042699795216321945, 0.028474142774939537, 0.003382536582648754, -0.019051898270845413, -0.032024629414081573, 0.03539174050092697, -0.03490886837244034, -0.0044137160293757915, 0.032709430903196335, -0.018813105300068855, -0.020295647904276848, -0.009493528865277767, -0.027140311896800995, 0.008472339250147343, 0.008748764172196388, 0.0005954382941126823, 0.006943646818399429, 0.042835868895053864, -0.0010185408173128963, -0.040791600942611694, 0.031872332096099854, -0.036858923733234406, 0.046242475509643555, 0.029583770781755447, -0.030715076252818108, 0.014107516035437584, 0.004335876554250717, 0.04181399568915367, 0.03105100616812706, 0.059625133872032166, 0.015985187143087387, 0.024429477751255035, 0.0404244065284729, 0.009172326885163784, 0.0043332804925739765, 0.040178969502449036, 0.018188029527664185, 0.03982633352279663, -0.025301937013864517, 0.0037639399524778128, 0.009459329769015312, -0.047227922827005386, 0.04378727823495865, -0.03542542830109596, 0.023826507851481438, 0.023823512718081474, 0.02309402823448181, 0.008538748137652874, -0.0037364878226071596, -0.027566729113459587, -0.021483920514583588, -0.045322928577661514, -0.0007306635961867869, 0.023010361939668655, 0.009531538933515549, 0.04080924764275551, -0.02652805671095848, 0.020062491297721863, -0.00015796745719853789, 0.0157203059643507, 0.009789316914975643, -0.022505657747387886, 0.029316077008843422, -0.057931818068027496, 0.0012485311599448323, 0.030248187482357025, 0.03556495159864426, -0.02672511711716652, -0.02861868217587471, 0.01567392610013485, -0.03993993252515793, 0.008525459095835686, -0.04658951237797737, -0.00993671640753746, -0.016276342794299126, -0.014836049638688564, 0.001655813306570053, -0.04222517088055611, 0.04235202446579933, 0.006945028435438871, -0.019542356953024864, 0.01852281764149666, -0.0025125350803136826, 0.005104586016386747, -0.018089525401592255, 0.0002638138539623469, -0.002728134160861373, -0.029900163412094116, 0.04251641035079956, 0.02929297462105751, -0.0011995293898507953, 0.050979193300008774, -0.007730555720627308, -0.0014704713830724359, -0.03466353937983513, 0.002610543742775917, 0.023334499448537827, 0.009684602729976177, 0.007981846109032631, -0.07037598639726639, -0.017751682549715042, 0.06534628570079803, -0.00641718739643693, 0.006817316636443138, -0.007083903532475233, 0.001412863377481699, -0.06818375736474991, -0.009629284963011742, 0.053941890597343445, 0.02520112879574299, 0.06571516394615173, -0.01234513334929943, 0.006542291026562452, 0.04228471219539642, -0.027733469381928444, -0.028815794736146927, -0.04985373467206955, 0.038344934582710266, 0.0005912025808356702, 0.03757653012871742, -0.024615708738565445, 0.03617518022656441, -0.0011619144352152944, -0.01862812228500843, 0.015610978938639164, -0.015109734609723091, -0.0013511577853932977, -0.005739128682762384, -0.011937226168811321, 0.06817326694726944, -0.013823372311890125, -0.05861377343535423, 0.013728032819926739, 0.03130274638533592, 0.0005631359526887536, 0.012720298953354359, -0.019206881523132324, 0.011033443734049797, 0.027006667107343674, -0.021320991218090057, 0.013625843450427055, 0.03636763244867325, 0.02761313132941723, -0.010213250294327736, -0.03595103323459625, -0.020709969103336334 ]
Hugging Face on PyTorch / XLA TPUs
jysohn23
February 9, 2021
pytorch-xla
open-source-collab
https://huggingface.co/blog/pytorch-xla
Trace, Compile, Execute, and Repeat From a user’s point of view, a typical training regimen for a model running on PyTorch / XLA involves running a forward pass, backward pass, and optimizer step. From the PyTorch / XLA library point of view, things look a little different. While a user runs their forward and backward passes, an intermediate representation (IR) graph is traced on the fly. The IR graph leading to each root/output tensor can be inspected as following: python >>> import torch >>> import torch_xla >>> import torch_xla.core.xla_model as xm >>> t = torch.tensor(1, device=xm.xla_device()) >>> s = t*t >>> print(torch_xla._XLAC._get_xla_tensors_text([s])) IR { %0 = s64[] prim::Constant(), value=1 %1 = s64[] prim::Constant(), value=0 %2 = s64[] xla::as_strided_view_update(%1, %0), size=(), stride=(), storage_offset=0 %3 = s64[] aten::as_strided(%2), size=(), stride=(), storage_offset=0 %4 = s64[] aten::mul(%3, %3), ROOT=0 } This live graph is accumulated while the forward and backward passes are run on the user's program, and once xm.mark_step() is called (indirectly by pl.MpDeviceLoader), the graph of live tensors is cut. This truncation marks the completion of one step and subsequently we lower the IR graph into XLA Higher Level Operations (HLO), which is the IR language for XLA. This HLO graph then gets compiled into a TPU binary and subsequently executed on the TPU devices. However, this compilation step can be costly, typically taking longer than a single step, so if we were to compile the user’s program every single step, overhead would be high. To avoid this, we have caches that store compiled TPU binaries keyed by their HLO graphs’ unique hash identifiers. So once this TPU binary cache has been populated on the first step, subsequent steps will typically not have to re-compile new TPU binaries; instead, they can simply look up the necessary binaries from the cache. Since TPU compilations are typically much slower than the step execution time, this means that if the graph keeps changing in shape, we’ll have cache misses and compile too frequently. To minimize compilation costs, we recommend keeping tensor shapes static whenever possible. Hugging Face library’s shapes are already static for the most part with input tokens being padded appropriately, so throughout training the cache should be consistently hit. This can be checked using the debugging tools that PyTorch / XLA provides. In the example below, you can see that compilation only happened 5 times (CompileTime) whereas execution happened during each of 1220 steps (ExecuteTime): python >>> import torch_xla.debug.metrics as met >>> print(met.metrics_report()) Metric: CompileTime TotalSamples: 5 Accumulator: 28s920ms153.731us ValueRate: 092ms152.037us / second Rate: 0.0165028 / second Percentiles: 1%=428ms053.505us; 5%=428ms053.505us; 10%=428ms053.505us; 20%=03s640ms888.060us; 50%=03s650ms126.150us; 80%=11s110ms545.595us; 90%=11s110ms545.595us; 95%=11s110ms545.595us; 99%=11s110ms545.595us Metric: DeviceLockWait TotalSamples: 1281 Accumulator: 38s195ms476.007us ValueRate: 151ms051.277us / second Rate: 4.54374 / second Percentiles: 1%=002.895us; 5%=002.989us; 10%=003.094us; 20%=003.243us; 50%=003.654us; 80%=038ms978.659us; 90%=192ms495.718us; 95%=208ms893.403us; 99%=221ms394.520us Metric: ExecuteTime TotalSamples: 1220 Accumulator: 04m22s555ms668.071us ValueRate: 923ms872.877us / second Rate: 4.33049 / second Percentiles: 1%=045ms041.018us; 5%=213ms379.757us; 10%=215ms434.912us; 20%=217ms036.764us; 50%=219ms206.894us; 80%=222ms335.146us; 90%=227ms592.924us; 95%=231ms814.500us; 99%=239ms691.472us Counter: CachedCompile Value: 1215 Counter: CreateCompileHandles Value: 5 ...
[ 0.029653780162334442, 0.008496749214828014, -0.02363550290465355, -0.009700898081064224, 0.050133638083934784, -0.014001366682350636, 0.041402775794267654, -0.042976003140211105, -0.05402868241071701, 0.021970229223370552, -0.05444050952792168, 0.03790755942463875, -0.021573809906840324, 0.015745533630251884, 0.02911747805774212, -0.03922049328684807, 0.09591763466596603, -0.04478767514228821, 0.0060075875371694565, 0.08588681370019913, 0.037666305899620056, -0.03974748030304909, 0.04050154611468315, 0.04974497854709625, -0.044391073286533356, -0.05771826580166817, -0.01781606115400791, -0.03330326825380325, -0.07979628443717957, 0.0076902927830815315, -0.09472087770700455, -0.029346728697419167, 0.04450673609972, -0.06884407997131348, -0.017088407650589943, 0.02092623896896839, -0.04984341561794281, 0.02832699380815029, 0.04691066965460777, -0.018654918298125267, 0.03331019729375839, 0.03293726220726967, -0.04171639680862427, 0.088487908244133, 0.026643721386790276, 0.012047460302710533, -0.13281947374343872, 0.030676553025841713, -0.0049645728431642056, 0.008292384445667267, -0.12896846234798431, 0.038351137191057205, -0.027962220832705498, -0.0070430813357234, 0.0006397144752554595, 0.0848907008767128, 0.03256658837199211, 0.0075872838497161865, -0.023096580058336258, 0.04117955267429352, 0.021694365888834, 0.07480514049530029, 0.03305253013968468, 0.05168568342924118, -0.007987077347934246, -0.03517964854836464, 0.06661977618932724, 0.04235123470425606, -0.09624344110488892, -0.04852978140115738, -0.03927794471383095, 0.038347382098436356, -0.004049788694828749, 0.02238398604094982, -0.02952827513217926, -0.03473586589097977, -0.014771553687751293, -0.015696043148636818, 0.03678189218044281, 0.04478878155350685, 0.039547149091959, 0.03760001063346863, 0.0040790182538330555, 0.025376347824931145, 0.002797367749735713, 0.005408524069935083, 0.039124228060245514, -0.01987105794250965, -0.005454624071717262, -0.016862332820892334, -0.04593466967344284, -0.11542092263698578, 0.029119500890374184, 0.03506702929735184, -0.050717148929834366, 0.0041071511805057526, -0.05844228342175484, 0.018432874232530594, 0.00769838597625494, -0.02924508973956108, -0.004459267947822809, -0.08186402171850204, 0.02935289405286312, -0.027616772800683975, -0.06958253681659698, 0.08337230980396271, -0.02535875514149666, -0.06547687202692032, -0.039889685809612274, -0.03941506892442703, -0.07617657631635666, 0.03786352649331093, -0.029962334781885147, 0.03847811371088028, -0.030611440539360046, -0.08615560829639435, -0.03016827628016472, 0.02194966748356819, -0.026524433866143227, -0.03761986270546913, 0.014582773670554161, 0.08694949001073837, 0.06856897473335266, 0.03520222753286362, -0.005027260631322861, 0.10031352937221527, 0.006040163803845644, 0.009726110845804214, 0.006012550555169582, -0.09768779575824738, 0.003310589352622628, 0.00023048573348205537, 0.0734570100903511, 0.003049168735742569, 0.026715639978647232, -0.06581712514162064, 0.04030541703104973, -0.01182499248534441, -0.013973294757306576, -0.03160008043050766, -0.03771677985787392, 0.06432576477527618, 0.06313434988260269, 0.008924777619540691, -0.017841409891843796, -0.02813592180609703, -0.06034823879599571, 0.06059033051133156, 0.03289443999528885, 0.01595359854400158, -0.04705783352255821, 0.048575256019830704, -0.005891054403036833, -0.025415396317839622, 0.004180774558335543, 0.053004175424575806, -0.018182527273893356, -0.030164144933223724, -0.11175858974456787, -0.0017353540752083063, -0.006737270392477512, 0.025144562125205994, 0.01204142440110445, -0.0001435097074136138, -0.021737515926361084, 0.07172121107578278, 0.03371612727642059, 0.02633766271173954, 0.028444305062294006, -0.002135752234607935, 0.0008914305362850428, 0.000973050482571125, 0.06664519011974335, 0.022782741114497185, -0.02073240652680397, 0.06830798834562302, -0.011956242844462395, 0.05879637226462364, -0.02488079108297825, -0.026121089234948158, -0.05093732848763466, 0.05418514087796211, -0.08791285008192062, 0.06844685226678848, 0.000713253568392247, -0.05394560098648071, 0.048649001866579056, -0.08116745948791504, -0.00811647530645132, 0.050978392362594604, -0.04209344834089279, -0.009087544865906239, 0.04768185690045357, -0.12724138796329498, -0.005646707024425268, -0.09308148920536041, -0.0030408778693526983, 0.0629519671201706, -0.021977588534355164, -0.00599842332303524, 0.03297357261180878, 0.024373158812522888, -0.01610194891691208, -0.029300175607204437, 0.012327350676059723, 0.03287830203771591, 0.04071167856454849, -0.036978378891944885, 0.03862078860402107, 0.012002039700746536, -0.0063149165362119675, -0.07570590823888779, 0.03957746922969818, -0.055934324860572815, 0.002034243894740939, 0.00927003938704729, -0.007887066341936588, 0.03762113302946091, -0.016420505940914154, -0.01977340504527092, 0.14939506351947784, -0.11207608133554459, -0.03625793009996414, 0.019855890423059464, -0.06838734447956085, -0.020767411217093468, 0.026085088029503822, -0.0066281757317483425, 0.01588318683207035, -0.08247952163219452, 0.00819475669413805, -0.12183120846748352, -0.016056722030043602, 0.08253626525402069, 0.017991771921515465, -0.05768866091966629, -0.04262806847691536, 0.03928577899932861, 0.0367584154009819, -0.06455663591623306, 0.03844829276204109, 0.0236384067684412, -0.015131025575101376, -0.02586766704916954, 0.004544524941593409, -0.08317609876394272, -0.0020204251632094383, 0.013824800960719585, -0.07599532604217529, 0.010131177492439747, -0.048962268978357315, 0.04839085415005684, -0.0052729202434420586, -0.0337056927382946, 0.027235349640250206, 0.05275769531726837, -0.025245387107133865, -0.030348993837833405, 0.0051732175052165985, 0.08372902125120163, 0.016976963728666306, -0.006058035418391228, -0.06599889695644379, -0.048307985067367554, -0.010950254276394844, -0.01320881862193346, 0.01747817173600197, -0.025991888716816902, 0.0013831317191943526, 0.01471023540943861, 0.007333122659474611, 0.006295803468674421, -0.036713939160108566, -0.019036302343010902, 0.028265196830034256, 0.01565740443766117, 0.03163328021764755, -0.01036815345287323, -0.02777273952960968, -0.03940855711698532, -0.005368164740502834, 0.004968523047864437, 0.015881162136793137, 0.03144153207540512, -0.025696013122797012, 0.02571887895464897, 0.008749989792704582, 0.002428494393825531, -0.03973871469497681, 0.06307853758335114, -0.011953465640544891, 0.043136775493621826, -0.007599793840199709, -0.05866902694106102, 0.019609849900007248, 0.050488609820604324, -0.016786158084869385, -0.006940298248082399, 0.03688010200858116, 0.008134677074849606, -0.07086414098739624, -0.006705772131681442, -0.0608992800116539, -0.03362530469894409, -0.017875490710139275, 0.018441028892993927, 0.014336548745632172, 0.020451810210943222, -0.09165800362825394, 0.014960473403334618, 0.018252981826663017, -0.026634838432073593, -0.01155620627105236, -0.05087241530418396, -0.025101982057094574, 0.011883361265063286, -0.007038641721010208, 0.029112888500094414, 0.03869812935590744, -0.0081104701384902, -0.0060974545776844025, 0.0033472224604338408, -0.038976557552814484, -0.0007491718279197812, 0.03289255499839783, 0.009793163277208805, 0.045976102352142334, -0.017698859795928, 0.041776251047849655, 0.01722227782011032, 0.03839809074997902, -0.007134350016713142, -0.03944322466850281, 0.023450037464499474, 0.010354439727962017, -0.007832903414964676, -0.0069467853754758835, -0.009061671793460846, -0.03624839335680008, 0.005064697470515966, -0.011673890985548496, -0.0027380853425711393, -0.014261211268603802, 0.004584267269819975, 0.00930855330079794, -0.012001784518361092, -0.029523614794015884, 0.0014376927865669131, 0.013863741420209408, 0.029105333611369133, 0.029724301770329475, 0.013469201512634754, 0.03297071158885956, 0.002252355217933655, 0.0026242872700095177, -0.06840036064386368, 0.02210228517651558, -0.031390704214572906, -0.0559823140501976, -0.0076393671333789825, 0.013248494826257229, 0.03305258974432945, 0.0041059572249650955, -0.04010822996497154, 0.003385094692930579, 0.018757598474621773, 0.04182497784495354, 0.020193923264741898, -0.03630189970135689, 0.024328751489520073, 0.004622213076800108, 0.013632633723318577, 0.024609779939055443, 0.010996295139193535, 0.04170317202806473, 0.001093346974812448, -0.033289585262537, 0.02233223244547844, -0.03308911249041557, 0.02336730994284153, -0.013932147063314915, 0.008346430025994778, -0.021345965564250946, 0.021163687109947205, -0.031150737777352333, 0.003393538063392043, 0.05909222364425659, 0.022301191464066505, -0.008497502654790878, -0.028007108718156815, -0.026301449164748192, -0.019479412585496902, 0.026350202038884163, -0.01089890580624342, 0.02003660798072815, -0.043466273695230484, 0.02995293401181698, 0.008141124621033669, 0.03465313836932182, -0.02736358344554901, 0.029368063434958458, 0.011360355652868748, -0.03333320841193199, -0.04709649458527565, 0.019017323851585388, 0.018801990896463394, 0.03593645244836807, 0.016836823895573616, 0.012227969244122505, -0.0961083397269249, 0.028465010225772858, 0.020702684298157692, -0.02060624770820141, 0.008250159211456776, -0.03944028168916702, 0.009671680629253387, 0.03771944344043732, 0.01067890040576458, -0.037038058042526245, 0.026289422065019608, 0.04365161061286926, 0.020014146342873573, 0.03224608302116394, 0.0232032909989357, 0.01197502389550209, -0.01815119944512844, 0.02031582221388817, 0.014631045050919056, -0.05581393465399742, 0.051075275987386703, -0.013328617438673973, -0.04068433493375778, 0.013572736643254757, -0.03309304639697075, -0.01410329807549715, 0.024326208978891373, -0.0000323278181895148, -0.06167032569646835, -0.009265049360692501, 0.008965810760855675, 0.03476039320230484, -0.002130554523319006, -0.021740475669503212, 0.009462440386414528, 0.020127661526203156, 0.003337521804496646, 0.018118426203727722, -0.047779425978660583, -0.03356388211250305, 0.03520309180021286, -0.011282519437372684, -0.031113049015402794, 0.013106702826917171, 0.015142243355512619, -0.05360915884375572, -0.004341615363955498, -0.03898920863866806, 0.00822549220174551, 0.06188805028796196, -0.009628450497984886, -0.04555410146713257, 0.02376520074903965, 0.021765045821666718, 0.025586534291505814, 0.025090014562010765, -0.033307500183582306, 0.036751486361026764, 0.05439282953739166, -0.014257553964853287, 0.01507700514048338, -0.02674521692097187, -0.009302918799221516, 0.024613158777356148, -0.00006378089165082201, -0.018304387107491493, -0.07425835728645325, 0.009135142900049686, -0.008282667025923729, -0.06265158206224442, -0.0013242407003417611, 0.013467839919030666, -0.043459203094244, 0.05077981948852539, -0.015434149652719498, -0.015182478353381157, -0.01936311647295952, 0.028657957911491394, 0.0670483335852623, 0.042528633028268814, 0.03720913827419281, 0.0551525242626667, -0.005868372041732073, 0.008642226457595825, 0.006347354035824537, 0.006660572253167629, -0.011666969396173954, 0.015289061702787876, 0.01761777326464653, 0.015658482909202576, -0.01350331399589777, -0.022045178338885307, -0.0001624976866878569, 0.02387799322605133, 0.03692984953522682, -0.032816678285598755, 0.017067119479179382, -0.010425333864986897, -0.0050711375661194324, 0.018012505024671555, -0.0022758040577173233, 0.014570733532309532, -0.05445592850446701, 0.03057139925658703, 0.02788218855857849, 0.02864403836429119, 0.007573498412966728, 0.015286831185221672, -0.031001616269350052, 0.01401403546333313, -0.011212971061468124, -0.00759373651817441, 0.010022848844528198, 0.03654620796442032, -0.02270684950053692, -0.027669552713632584, 0.026275858283042908, 0.012738358229398727, 0.008695551194250584, -0.03069114312529564, 0.0121249845251441, 0.019072193652391434, 0.02656644955277443, 0.020809752866625786, -0.008137269876897335, -0.011349541135132313, 0.03758440911769867, 0.028956713154911995, 0.042424336075782776, 0.04351073130965233, 0.04258183389902115, -0.03987681493163109, 0.004455924034118652, 0.04519641771912575, 0.026463966816663742, -0.03429762274026871, 0.04738975316286087, -0.008384721353650093, -0.002158364048227668, -0.054449696093797684, 0.024984989315271378, -0.01243529561907053, 0.02237868681550026, 0.001666043302975595, 0.02136100083589554, 0.06366000324487686, -0.036723364144563675, 0.005540785845369101, -0.004036413971334696, 0.010615598410367966, -0.03000635839998722, -0.028919784352183342, -0.04806344956159592, 0.0062110344879329205, 0.03305273875594139, 0.02423947863280773, 0.04074732959270477, 0.021748412400484085, 0.02859201468527317, 0.034676097333431244, -0.04864267259836197, 0.004934322088956833, 0.0056715114042162895, -0.009250328876078129, 0.018296990543603897, 0.00589828472584486, -0.0008124177693389356, 0.007222503889352083, 0.0022645369172096252, 0.001858866075053811, 0.0036003198474645615, 0.0058599370531737804, 0.042555343359708786, 0.007499341387301683, -0.026843251660466194, -0.030566900968551636, 0.08316195756196976, -0.023010551929473877, 0.031008737161755562, 0.007929892279207706, 0.03207755833864212, 0.03354163095355034, 0.0024827199522405863, -0.0027093596290796995, 0.01655169017612934, 0.07218413800001144, -0.012134193442761898, -0.00745841208845377, 0.032543499022722244, -0.02720155194401741, 0.010028369724750519, -0.01987561769783497, -0.024227973073720932, 0.00417346553876996, 0.033266592770814896, 0.02781631611287594, -0.004741893149912357, -0.006671758368611336, -0.012289250269532204, 0.05942239984869957, 0.04816817864775658, 0.0004240242706146091, 0.021982669830322266, -0.007257796358317137, 0.021210316568613052, 0.025911061093211174, -0.033922526985406876, 0.02129693329334259, -0.00680198147892952, 0.053404681384563446, 0.03720784932374954, -0.00485264090821147, 0.010138173587620258, 0.02359735034406185, 0.03303007781505585, 0.017277473583817482, -0.005209940951317549, -0.024948405101895332, 0.004425726365298033, 0.021743251010775566, -0.0374971404671669, 0.016750745475292206, 0.004841276910156012, -0.030599486082792282, 0.005954049993306398, 0.025630280375480652, -0.013437001965939999, -0.022740058600902557, 0.005129628349095583, -0.019793352112174034, 0.046124015003442764, 0.03586018830537796, -0.06431788206100464, -0.021633330732584, -0.016566019505262375, -0.007886175066232681, -0.006343892775475979, 0.010928144678473473, 0.004711753688752651, 0.008639724925160408, 0.031176745891571045, -0.012488411739468575, 0.0047759502194821835, -0.005365527700632811, 0.00976340752094984, 0.01987588219344616, -0.030160611495375633, -0.024213016033172607, 0.03469959273934364, -0.007955082692205906, -0.0017274863785132766, -0.0276277307420969, 0.006907354108989239, -0.0207238607108593, -0.055985014885663986, 0.0743810161948204, 0.022691600024700165, 0.01111587043851614, 0.004091773182153702, 0.017329340800642967, 0.015787148848176003, -0.0005916827940382063, -0.03543116897344589, -0.031790841370821, -0.03664354234933853, 0.03569722920656204, 0.020657530054450035, -0.015066992491483688, 0.055262643843889236, 0.03517289087176323, 0.04407313093543053, -0.050153620541095734, 0.03027445077896118, 0.005122113972902298, -0.01757325604557991, 0.011501387692987919, -0.03595510125160217, -0.016282588243484497, -0.00980689562857151, 0.05140788108110428, -0.013971153646707535, 0.022231657058000565, 0.04040656238794327, -0.0053291404619812965, 0.0007670779596082866, -0.00044712115777656436, 0.02620517835021019, -0.039760444313287735, -0.010948462411761284, -0.022038498893380165, -0.03056943789124489, 0.037729449570178986, 0.013083253055810928, -0.008170019835233688, -0.0016811150126159191, -0.045184798538684845, 0.0013964399695396423, 0.016126712784171104, 0.013750067912042141, -0.02884833700954914, -0.04852408170700073, 0.029535768553614616, 0.02494535595178604, -0.015896808356046677, 0.02510521560907364, -0.05255291238427162, -0.011906115338206291, -0.03769449144601822, 0.030408445745706558, 0.0745539590716362, -0.0028146912809461355, -0.0005426641437225044, -0.013930127024650574, 0.005047834478318691, 0.03421078249812126, -0.013642697595059872, 0.007310095708817244, -0.003614085027948022, 0.015471396036446095, -0.05694897100329399, 0.029587706550955772, 0.03014111891388893, 0.030073706060647964, 0.0289154052734375, -0.006668406538665295, -0.009699823334813118, 0.01472986489534378, -0.03579539805650711, -0.05019856616854668, -0.020152006298303604, 0.003159672487527132, -0.015273361466825008, 0.020840313285589218, -0.011300969868898392, 0.055439211428165436, 0.024409450590610504, -0.014141199178993702, -0.0028815672267228365, 0.011599953286349773, -0.011859078891575336, -0.06238052621483803, -0.022496849298477173, 0.045900873839855194, -0.009788386523723602, -0.04509679973125458, -0.011637055315077305, 0.00591199891641736, 0.032218992710113525, 0.0032100139651447535, 0.007508430629968643, 0.037957482039928436, 0.027755865827202797, 0.010222695767879486, -0.0002381529484409839, 0.06055957078933716, 0.04020143672823906, -0.01560215838253498, -0.014268819242715836, -0.006038295570760965 ]
Hugging Face on PyTorch / XLA TPUs
jysohn23
February 9, 2021
pytorch-xla
open-source-collab
https://huggingface.co/blog/pytorch-xla
Train Your Transformer on Cloud TPUs To configure your VM and Cloud TPUs, please follow “Set up a Compute Engine instance” and “Launch a Cloud TPU resource” (pytorch-1.7 version as of writing) sections. Once you have your VM and Cloud TPU created, using them is as simple as SSHing to your GCE VM and running the following commands to get bert-large-uncased training kicked off (batch size is for v3-8 device, may OOM on v2-8): bash conda activate torch-xla-1.7 export TPU_IP_ADDRESS="ENTER_YOUR_TPU_IP_ADDRESS" # ex. 10.0.0.2 export XRT_TPU_CONFIG="tpu_worker;0;$TPU_IP_ADDRESS:8470" git clone -b v4.2.2 https://github.com/huggingface/transformers.git cd transformers && pip install . pip install datasets==1.2.1 python examples/xla_spawn.py \ --num_cores 8 \ examples/language-modeling/run_mlm.py \ --dataset_name wikitext \ --dataset_config_name wikitext-103-raw-v1 \ --max_seq_length 512 \ --pad_to_max_length \ --logging_dir ./tensorboard-metrics \ --cache_dir ./cache_dir \ --do_train \ --do_eval \ --overwrite_output_dir \ --output_dir language-modeling \ --overwrite_cache \ --tpu_metrics_debug \ --model_name_or_path bert-large-uncased \ --num_train_epochs 3 \ --per_device_train_batch_size 8 \ --per_device_eval_batch_size 8 \ --save_steps 500000 The above should complete training in roughly less than 200 minutes with an eval perplexity of ~3.25.
[ -0.01744772121310234, 0.0020097990054637194, 0.01615910977125168, 0.03819332644343376, 0.00989883579313755, 0.037591494619846344, 0.029583368450403214, 0.08151878416538239, 0.013032741844654083, -0.02470705471932888, -0.06885971128940582, 0.07188834249973297, -0.013400676660239697, 0.05167745426297188, 0.02279052510857582, -0.07986388355493546, 0.0049161165952682495, -0.017550526186823845, -0.06352075934410095, 0.013308649882674217, 0.009504245594143867, -0.03146149218082428, 0.05526035279035568, 0.04317966103553772, -0.015342852100729942, -0.07594972103834152, -0.025272201746702194, 0.0799388661980629, 0.000012988478374609258, 0.008969496004283428, -0.054145991802215576, 0.02224562130868435, 0.016640041023492813, -0.036035940051078796, -0.015741555020213127, 0.05888895317912102, -0.04501355066895485, 0.04358238726854324, 0.02557799033820629, -0.026705866679549217, 0.020906558260321617, -0.02694956585764885, -0.05809715762734413, 0.07413690537214279, 0.029672039672732353, -0.014864770695567131, -0.12096885591745377, 0.058589786291122437, -0.022076332941651344, -0.010435397736728191, -0.027547050267457962, 0.05650118738412857, 0.0064177969470620155, -0.06000616401433945, 0.0730849951505661, 0.06469845771789551, -0.04101043567061424, -0.0842340737581253, 0.03738662973046303, -0.013820073567330837, 0.008767358958721161, 0.024739224463701248, -0.011435803025960922, 0.04949064925312996, 0.006588883697986603, -0.030652767047286034, 0.013900459744036198, -0.00045772225712426007, -0.05038365721702576, -0.02478134259581566, -0.026082394644618034, -0.006220117211341858, 0.03914641961455345, -0.005388044286519289, -0.042968738824129105, -0.023468339815735817, 0.00880960188806057, 0.0466274693608284, 0.08312065899372101, 0.1421651393175125, -0.01942664012312889, 0.025512484833598137, -0.024515079334378242, -0.013792580924928188, 0.05736726149916649, 0.0033531147055327892, 0.026149673387408257, -0.02598201483488083, -0.034782394766807556, 0.09196200966835022, 0.012727966532111168, -0.08635058254003525, 0.012018959037959576, 0.0024013156071305275, 0.005283467937260866, -0.011227622628211975, -0.01466266717761755, -0.02054198645055294, -0.01852552220225334, -0.04012035205960274, 0.012247382663190365, -0.03847143426537514, 0.02600444108247757, -0.0021744598634541035, -0.06407233327627182, 0.00942571833729744, -0.002045715693384409, -0.1000107154250145, 0.028277775272727013, -0.01907932385802269, 0.010896491818130016, -0.012689139693975449, -0.027889827266335487, 0.06679365038871765, -0.07817517966032028, 0.012622451409697533, 0.028726326301693916, -0.03225102648139, 0.04794573038816452, -0.015124884434044361, -0.023770993575453758, 0.09075138717889786, 0.02432079426944256, -0.05011702701449394, 0.013052767142653465, 0.05514611303806305, -0.06329835206270218, -0.021497398614883423, 0.0633731260895729, -0.03553442656993866, 0.07069120556116104, -0.03118283674120903, 0.1388518065214157, -0.05877012014389038, 0.026322420686483383, 0.014817614108324051, 0.030407816171646118, -0.06912554800510406, 0.00024619788746349514, -0.03783788904547691, 0.0009475342812947929, 0.12080806493759155, 0.004563333932310343, 0.02335607446730137, -0.001679216860793531, 0.01557644922286272, -0.07791945338249207, 0.07101832330226898, -0.0254018846899271, 0.026356078684329987, -0.09391652047634125, 0.05790917947888374, -0.05064447969198227, 0.013612854294478893, 0.04573160409927368, 0.0427270382642746, -0.01038201991468668, -0.03543415293097496, -0.08567598462104797, -0.03914175555109978, -0.01678863726556301, 0.009079624898731709, -0.07349391281604767, 0.011088468134403229, -0.004915399942547083, -0.03081408329308033, 0.07436257600784302, -0.027183184400200844, 0.02646777778863907, 0.00031157562625594437, 0.0029921617824584246, -0.027110574766993523, 0.05180700868368149, 0.029521439224481583, -0.004797689616680145, 0.023042943328619003, 0.03497748449444771, 0.041942842304706573, -0.027793962508440018, -0.09582222253084183, -0.03867347911000252, 0.07521947473287582, -0.0527908094227314, 0.06947873532772064, -0.02414410002529621, -0.028138332068920135, 0.032541897147893906, -0.038361918181180954, -0.01454473752528429, 0.09103820472955704, -0.007828564383089542, -0.03385017439723015, 0.025116750970482826, 0.018809635192155838, 0.03985973820090294, 0.007654781453311443, -0.03078867308795452, 0.06359866261482239, 0.007393196690827608, 0.0382193848490715, 0.01511656865477562, -0.0004530108126346022, -0.008314063772559166, -0.04039366915822029, -0.060411643236875534, 0.035465650260448456, 0.0069723292253911495, -0.08145057410001755, 0.03324884921312332, 0.009031212888658047, 0.001234559342265129, -0.14718495309352875, 0.01942181959748268, -0.06546935439109802, -0.03887626528739929, -0.10545175522565842, -0.02273375168442726, -0.043007247149944305, 0.07214796543121338, -0.02002723142504692, 0.1432950645685196, 0.0007591310422867537, 0.0074674510397017, 0.012464725412428379, -0.037660565227270126, -0.012460705824196339, -0.005331597290933132, 0.031589608639478683, 0.09146019071340561, -0.09234089404344559, -0.07048890739679337, -0.13507817685604095, -0.048362042754888535, 0.020172372460365295, -0.013621506281197071, -0.0500221848487854, 0.025027265772223473, -0.03785383701324463, 0.020337387919425964, -0.05465855449438095, -0.027946650981903076, 0.004424090497195721, -0.01060077641159296, 0.00822805892676115, -0.008442318066954613, -0.022915586829185486, 0.04944490268826485, 0.03538241609930992, -0.02270670235157013, -0.02145037241280079, -0.07790973037481308, 0.03333916515111923, -0.04510131850838661, -0.015266919508576393, 0.05319343879818916, 0.003661414375528693, -0.025998704135417938, -0.006569250021129847, -0.03660566732287407, 0.0670260488986969, 0.0022972833830863237, 0.022058090195059776, -0.03145022317767143, -0.025526318699121475, -0.008829524740576744, -0.010389397852122784, 0.029282232746481895, 0.0102601433172822, 0.03418103605508804, -0.020238954573869705, 0.016880828887224197, -0.04680414870381355, 0.01819302700459957, -0.007019451353698969, 0.01645783521234989, 0.041969120502471924, 0.006638803984969854, -0.0018478172132745385, -0.034095827490091324, -0.027944693341851234, 0.018008476123213768, -0.05052822455763817, 0.038235269486904144, 0.016505850479006767, -0.020335817709565163, 0.02555999346077442, 0.021969253197312355, -0.05939202383160591, -0.01021084375679493, -0.015555502846837044, -0.022529782727360725, 0.020461464300751686, -0.005303604528307915, 0.012255375273525715, 0.019531507045030594, 0.019393546506762505, -0.003162024775519967, -0.021121863275766373, 0.0019702319987118244, 0.02639247104525566, -0.021910378709435463, 0.0063389199785888195, -0.012740845791995525, -0.029629677534103394, -0.03840486705303192, -0.027765076607465744, 0.018345724791288376, 0.014560268260538578, -0.08615254610776901, -0.001809474197216332, -0.03538565710186958, 0.02672647126019001, -0.018669508397579193, -0.014334448613226414, 0.05751996487379074, 0.01735568977892399, -0.008358177728950977, 0.03870748355984688, 0.014269204810261726, 0.014183991588652134, -0.003568599931895733, -0.02008284628391266, 0.0067491657100617886, -0.003605905221775174, 0.02209431119263172, -0.014523624442517757, 0.015858612954616547, 0.003245727391913533, -0.03623992204666138, 0.015556138940155506, 0.024159468710422516, 0.012718896381556988, 0.04088650643825531, 0.03795449808239937, -0.0017948343884199858, 0.017483139410614967, 0.0282120443880558, -0.04906463250517845, -0.005179763305932283, -0.03519725427031517, 0.004870289005339146, -0.001898627495393157, -0.02051963098347187, -0.021129047498106956, 0.006619129795581102, 0.021790722385048866, 0.043812185525894165, 0.04809769243001938, -0.006283680908381939, -0.0021882960572838783, 0.030388889834284782, -0.026240170001983643, 0.060119450092315674, -0.0014040634268894792, 0.013711167499423027, -0.015490049496293068, -0.002986204344779253, 0.019921796396374702, -0.03418302908539772, 0.01574643701314926, -0.014883243478834629, 0.005090642254799604, -0.0008303401409648359, 0.015137625858187675, 0.007084026001393795, 0.030320538207888603, -0.0026624472811818123, -0.029951946809887886, -0.04785582423210144, 0.03364703431725502, -0.01386980339884758, -0.0028361063450574875, 0.026790201663970947, 0.04291364178061485, 0.01794002205133438, 0.026376208290457726, -0.012135263532400131, 0.01597457565367222, -0.014348884113132954, 0.020591648295521736, -0.0035097089130431414, 0.010663764551281929, -0.021910039708018303, -0.005772048141807318, -0.03556974604725838, -0.04931192472577095, 0.06029043719172478, 0.01298182737082243, -0.053884342312812805, 0.015104609541594982, -0.052142415195703506, -0.025023235008120537, 0.03638369217514992, 0.02357998676598072, 0.023206451907753944, -0.039075106382369995, -0.0052314880304038525, 0.05202823504805565, 0.0109662264585495, -0.01955624669790268, 0.03200070932507515, 0.007356937043368816, -0.025734515860676765, -0.019644126296043396, 0.02190018817782402, 0.025270184502005577, -0.015565159730613232, 0.02601320669054985, -0.005979994311928749, -0.07548101246356964, 0.005679402034729719, 0.018979711458086967, 0.02425416372716427, 0.008488995023071766, -0.01919652707874775, -0.032123785465955734, -0.0067249322310090065, 0.011894364841282368, 0.01125246100127697, -0.02002028375864029, -0.02463815174996853, -0.03297519311308861, -0.007881798781454563, 0.06439006328582764, 0.01614566147327423, -0.025177938863635063, -0.009076864458620548, 0.021088948473334312, -0.025041891261935234, 0.03384200111031532, -0.01542934775352478, -0.03195883333683014, -0.002993527799844742, 0.02294268272817135, 0.03640148043632507, 0.05434948205947876, -0.014222441241145134, -0.028993792831897736, -0.03877534344792366, -0.03821665421128273, 0.046321943402290344, 0.007873039692640305, -0.05188082531094551, 0.005060005467385054, 0.019241053611040115, 0.00021416648814920336, -0.0034259483218193054, -0.008665725588798523, -0.02751118130981922, 0.02461998723447323, 0.03097255527973175, -0.06820530444383621, 0.03528132662177086, 0.01758122257888317, -0.051829785108566284, 0.004531487822532654, -0.03061174415051937, 0.025561239570379257, 0.053780730813741684, -0.015228131785988808, -0.05771632492542267, 0.0073769534938037395, 0.009269201196730137, 0.02068624086678028, 0.007457280065864325, 0.06285297125577927, 0.023437269032001495, 0.058296412229537964, -0.028147967532277107, -0.010135186836123466, -0.019955070689320564, 0.008257152512669563, 0.05179541930556297, 0.031259920448064804, 0.013761642388999462, -0.0452292375266552, -0.03333057463169098, 0.0020830356515944004, -0.026931961998343468, -0.018615515902638435, 0.009745100513100624, -0.03906034305691719, 0.002918980084359646, 0.03745877370238304, 0.010830049403011799, 0.0071167428977787495, 0.026128802448511124, 0.04855829104781151, 0.0074723768047988415, -0.0027366431895643473, 0.0004615566285792738, -0.027428297325968742, -0.02193831279873848, 0.014899153262376785, 0.06889785826206207, 0.015206505544483662, -0.00036244632792659104, 0.05909684672951698, -0.0075482893735170364, -0.028296997770667076, 0.011331281624734402, -0.0004809004021808505, 0.015195257030427456, -0.026294361799955368, -0.01179532241076231, 0.01475197821855545, 0.005109141115099192, 0.02818363346159458, 0.005100472364574671, 0.06932104378938675, -0.0474688820540905, -0.022017188370227814, 0.0859459638595581, -0.004596810322254896, 0.012951148673892021, 0.030833106487989426, -0.003862622659653425, -0.00754584139212966, -0.012093420140445232, 0.0404081866145134, 0.03735163435339928, 0.0019174163462594151, 0.02673334814608097, -0.03275979682803154, -0.013829384930431843, 0.024399297311902046, 0.027359718456864357, 0.009605376981198788, -0.0380014143884182, 0.011200318112969398, -0.005336772184818983, -0.010027920827269554, 0.005060010123997927, -0.02216101624071598, 0.03881343826651573, 0.012578335590660572, 0.000028486765586421825, 0.009641911834478378, 0.025807298719882965, 0.00649562431499362, 0.0031329181510955095, 0.03389863669872284, 0.046525146812200546, 0.020360300317406654, 0.0028689131140708923, 0.006411902606487274, 0.0040851617231965065, -0.026344696059823036, -0.02485882118344307, -0.007592090405523777, -0.018313376232981682, 0.022368554025888443, -0.03600756824016571, 0.031833529472351074, 0.08838870376348495, -0.014149783179163933, 0.0007214348297566175, -0.01171401608735323, 0.014389827847480774, 0.016092386096715927, -0.024598902091383934, -0.010538148693740368, 0.03279862552881241, -0.013659807853400707, 0.01674790494143963, 0.018833162263035774, 0.0014138787519186735, 0.02992907166481018, -0.013732902705669403, -0.07157085835933685, 0.05024866387248039, 0.029232844710350037, -0.02347499690949917, 0.030859624966979027, -0.03108304552733898, -0.013437135145068169, -0.03412887081503868, 0.001055880798958242, 0.031371764838695526, 0.01485238503664732, -0.011053168214857578, -0.03412396088242531, -0.005895497277379036, -0.013737314380705357, 0.008460304699838161, 0.027938127517700195, -0.03341267630457878, 0.04097968339920044, -0.0022931359708309174, 0.05077473074197769, 0.037139322608709335, -0.006505482830107212, -0.05785534530878067, 0.007185607682913542, 0.05695386230945587, -0.0018677167827263474, 0.022856377065181732, 0.051774732768535614, 0.015456297434866428, -0.0038842845242470503, -0.03216405585408211, -0.0414135679602623, -0.008425557054579258, -0.025356195867061615, -0.0027931244112551212, -0.02476651407778263, 0.005160503555089235, 0.00902969017624855, 0.02700893208384514, 0.0796726793050766, 0.04163525253534317, -0.02833271026611328, 0.05523565784096718, 0.0053570144809782505, 0.005117746535688639, 0.03741411119699478, -0.014155026525259018, 0.01842537708580494, 0.024673765525221825, 0.033083319664001465, 0.006886674091219902, 0.05018870159983635, 0.018278613686561584, 0.0028345866594463587, 0.01704958826303482, -0.02252115122973919, -0.07049329578876495, 0.01198344212025404, -0.01030338928103447, 0.00854132603853941, 0.008153151720762253, 0.04888521879911423, -0.020795878022909164, 0.03180380165576935, -0.023823680356144905, 0.00019317773694638163, -0.002836399246007204, 0.000732565822545439, -0.047593921422958374, 0.05218364670872688, -0.0009296637144871056, -0.04627895727753639, 0.010168393142521381, -0.024893617257475853, 0.019646715372800827, 0.026023248210549355, -0.020292147994041443, -0.025333264842629433, -0.010890193283557892, -0.0020001945085823536, -0.009317250922322273, 0.03529029339551926, -0.02601027674973011, 0.010010359808802605, 0.040157150477170944, 0.009380919858813286, 0.013460737653076649, 0.052182428538799286, 0.02514101006090641, 0.035070616751909256, -0.011863276362419128, 0.03913535550236702, -0.0010057362960651517, -0.05018489435315132, -0.020374562591314316, -0.05786816030740738, -0.0036598052829504013, -0.002712887478992343, 0.026749929413199425, -0.016096655279397964, 0.05712364986538887, 0.01232218649238348, -0.05198163166642189, -0.01040126197040081, 0.005964894313365221, -0.039246391505002975, 0.03718467429280281, -0.008496539667248726, -0.010612957179546356, 0.026984943076968193, -0.007315587252378464, 0.007732049562036991, 0.010710706003010273, -0.0028652558103203773, 0.039721179753541946, -0.03630218282341957, -0.019571736454963684, -0.0059249307960271835, 0.014181182719767094, 0.013863673433661461, 0.012823281809687614, 0.007637397851794958, -0.010662230663001537, -0.013648716732859612, -0.022989366203546524, 0.0018311806488782167, -0.05727582424879074, -0.03385000675916672, -0.057971566915512085, -0.06813176721334457, -0.010104884393513203, -0.009902827441692352, -0.011280874721705914, 0.03380410745739937, -0.05606349930167198, 0.004083435051143169, -0.041312120854854584, -0.007118667475879192, 0.021987412124872208, -0.009089792147278786, 0.05761948972940445, 0.04860628396272659, 0.011125611141324043, -0.00032598033430986106, -0.03346680477261543, 0.016544805839657784, 0.0006748412852175534, 0.011188351549208164, 0.0009425010066479445, 0.0530804842710495, -0.02227819710969925, -0.04334600642323494, -0.01012162584811449, 0.05892128869891167, -0.0014984292211011052, 0.04830367863178253, 0.006008330266922712, 0.00635520787909627, -0.06131884455680847, 0.01891750656068325, 0.025470955297350883, -0.002592929871752858, 0.053926799446344376, -0.02591332420706749, 0.0009874746901914477, 0.05092223733663559, 0.0016388188814744353, -0.04867368936538696, -0.00009425294410903007, -0.007458298467099667, -0.034228794276714325, 0.02535391040146351, -0.017332149669528008, 0.020312845706939697, -0.018905112519860268, -0.04718415439128876, 0.006080698221921921, 0.007490679621696472, -0.06466852128505707, -0.004008742980659008, -0.020968817174434662, 0.042903922498226166, -0.01725059561431408, -0.030558058992028236, 0.032295987010002136, -0.0039944336749613285, -0.03315712884068489, 0.002696787705644965, 0.01400398276746273, 0.015745116397738457, 0.00368686206638813, -0.022082380950450897, -0.028002649545669556, 0.016677886247634888, 0.020459217950701714, -0.00020235960255376995, 0.007063770201057196, 0.012008151970803738 ]
Hugging Face on PyTorch / XLA TPUs
jysohn23
February 9, 2021
pytorch-xla
open-source-collab
https://huggingface.co/blog/pytorch-xla
XLA:TPU Device Type PyTorch / XLA adds a new xla device type to PyTorch. This device type works just like other PyTorch device types. For example, here's how to create and print an XLA tensor: python import torch import torch_xla import torch_xla.core.xla_model as xm t = torch.randn(2, 2, device=xm.xla_device()) print(t.device) print(t) This code should look familiar. PyTorch / XLA uses the same interface as regular PyTorch with a few additions. Importing torch_xla initializes PyTorch / XLA, and xm.xla_device() returns the current XLA device. This may be a CPU, GPU, or TPU depending on your environment, but for this blog post we’ll focus primarily on TPU. The Trainer module leverages a TrainingArguments dataclass in order to define the training specifics. It handles multiple arguments, from batch sizes, learning rate, gradient accumulation and others, to the devices used. Based on the above, in TrainingArguments._setup_devices() when using XLA:TPU devices, we simply return the TPU device to be used by the Trainer: python @dataclass class TrainingArguments: ... @cached_property @torch_required def _setup_devices(self) -> Tuple["torch.device", int]: ... elif is_torch_tpu_available(): device = xm.xla_device() n_gpu = 0 ... return device, n_gpu
[ 0.032312288880348206, 0.014748637564480305, -0.01754145883023739, -0.012427805922925472, 0.06696207076311111, 0.014042963273823261, -0.04858514294028282, 0.021243751049041748, 0.0019525245297700167, -0.02537764608860016, -0.024082917720079422, 0.06707809120416641, 0.008187908679246902, 0.028769072145223618, 0.025692149996757507, -0.040700092911720276, 0.005924344528466463, -0.037248749285936356, -0.060953203588724136, 0.0889105498790741, 0.006161040160804987, -0.024121318012475967, 0.025668980553746223, -0.01634255051612854, -0.04648330435156822, -0.07753060013055801, 0.013559257611632347, 0.006094128359109163, -0.03162645548582077, -0.015501505695283413, -0.08217980712652206, 0.007170435041189194, 0.01799890398979187, -0.06999184191226959, 0.0767967477440834, 0.03369009122252464, -0.049480486661195755, 0.045296184718608856, 0.04288449138402939, -0.01250729151070118, 0.04012428596615791, -0.0316593237221241, -0.07152330875396729, 0.05567135661840439, 0.012493019923567772, -0.040964964777231216, -0.11910679936408997, 0.014084680937230587, -0.025075161829590797, 0.0558057464659214, -0.044424284249544144, -0.006116751115769148, -0.06739529222249985, -0.008035758510231972, 0.042882807552814484, 0.05600415915250778, -0.058586493134498596, -0.038258958607912064, 0.0449787899851799, -0.0198343675583601, 0.021417886018753052, 0.07846936583518982, 0.0412510521709919, 0.05059076100587845, 0.04743316024541855, -0.04202582687139511, 0.04980616644024849, -0.015250671654939651, -0.0673021450638771, -0.06541047245264053, -0.04733315110206604, 0.02782517857849598, 0.039380598813295364, -0.01917719468474388, -0.004324907436966896, -0.06718873232603073, -0.035855259746313095, 0.014285008423030376, 0.06671251356601715, 0.08011928200721741, 0.021029114723205566, 0.04553229361772537, 0.003787083551287651, 0.03759124502539635, 0.011166144162416458, 0.009092658758163452, -0.00790078192949295, -0.03242048993706703, 0.029899917542934418, 0.030667925253510475, 0.0072301519103348255, -0.08907166868448257, 0.07963819801807404, -0.004631474148482084, 0.016568971797823906, -0.04356149584054947, -0.0350140817463398, -0.00225202739238739, 0.00931027252227068, -0.039638452231884, -0.014344865456223488, -0.09077753126621246, 0.07153701782226562, -0.044847749173641205, -0.06763333827257156, 0.05680270120501518, -0.02904239296913147, -0.05548401176929474, -0.03192931413650513, 0.0018832572968676686, -0.049745187163352966, -0.01700291782617569, -0.01039870921522379, 0.09232077747583389, 0.002785335062071681, -0.03434285521507263, 0.023774653673171997, 0.04555128514766693, -0.016327597200870514, -0.018396958708763123, -0.028481507673859596, 0.07184892147779465, 0.031338803470134735, -0.009619628079235554, 0.04429187998175621, 0.10621532797813416, 0.019577784463763237, 0.020483875647187233, 0.048933736979961395, -0.04418058320879936, 0.04822444170713425, -0.015137768350541592, 0.09032895416021347, -0.00812343880534172, 0.044868603348731995, -0.03479473665356636, 0.005730838980525732, -0.015976959839463234, -0.022493107244372368, 0.026815926656126976, -0.038073960691690445, 0.06878680735826492, 0.03691788390278816, 0.02325276844203472, -0.05644925683736801, -0.038844965398311615, 0.01692446693778038, 0.062041107565164566, 0.016468718647956848, -0.0224705021828413, -0.09609376639127731, 0.05720558390021324, -0.052715055644512177, -0.014256522059440613, 0.05450516939163208, 0.004171060863882303, -0.007393977139145136, -0.010189363732933998, -0.11732512712478638, -0.07375410944223404, -0.012866532430052757, -0.023513495922088623, -0.006809793878346682, 0.04182852804660797, -0.0022903145290911198, 0.0680638998746872, 0.07869501411914825, 0.016378434374928474, 0.045097433030605316, -0.0030531289521604776, -0.030810415744781494, -0.06420543789863586, 0.020787455141544342, 0.07115686684846878, -0.0055342125706374645, 0.03313017636537552, -0.0216900035738945, -0.02186911553144455, -0.038512714207172394, -0.034498002380132675, -0.02108839899301529, 0.03551008179783821, -0.1162404865026474, 0.036619871854782104, 0.006898217834532261, -0.049727898091077805, 0.04634891822934151, -0.06058000028133392, -0.01231030561029911, 0.027843141928315163, -0.04013938084244728, -0.07308773696422577, -0.015212763100862503, -0.04624755680561066, 0.09533946216106415, -0.059149131178855896, -0.07494758069515228, 0.06020225211977959, -0.05847777798771858, -0.004024857189506292, 0.06651734560728073, -0.042145270854234695, -0.061367373913526535, -0.02344382554292679, -0.005919600836932659, -0.012910151854157448, 0.0322280153632164, -0.01204772386699915, 0.040068794041872025, 0.007051920983940363, 0.018813496455550194, -0.10754681378602982, 0.017827127128839493, -0.10295495390892029, 0.011820307932794094, 0.022531984373927116, 0.02220037393271923, 0.0017113799694925547, 0.02265818603336811, -0.05475759878754616, 0.12821350991725922, -0.08837121725082397, 0.004725275561213493, 0.0036446331068873405, -0.01823594607412815, 0.0707373321056366, 0.011183523572981358, 0.03534916415810585, 0.0224150363355875, -0.12577350437641144, -0.019621489569544792, -0.08133198320865631, -0.05426371470093727, 0.04933709278702736, 0.06889638304710388, -0.03879711404442787, 0.0008003492257557809, 0.018145481124520302, 0.055503927171230316, -0.07202049344778061, 0.00439276872202754, 0.07071974128484726, -0.06619575619697571, 0.0183566864579916, -0.018659280613064766, -0.038928136229515076, 0.05796206369996071, 0.08093076199293137, -0.027994412928819656, 0.01490199938416481, -0.09503595530986786, 0.01565995253622532, 0.06231572479009628, -0.02345464937388897, 0.014824754558503628, 0.05105547979474068, -0.04238060116767883, -0.04427561163902283, 0.015334410592913628, 0.07147950679063797, -0.03537318855524063, -0.007738043554127216, -0.029473496600985527, -0.0324174202978611, -0.022007064893841743, -0.04111061617732048, 0.009725982323288918, 0.010857717134058475, 0.01053205318748951, 0.010917559266090393, 0.026314005255699158, -0.037815310060977936, -0.011409787461161613, -0.039763301610946655, 0.01654689759016037, 0.005905600264668465, 0.021459655836224556, 0.004508893471211195, -0.03588879108428955, -0.026686199009418488, 0.004961119964718819, 0.0009222402004525065, 0.046636320650577545, 0.013282646425068378, -0.009313100017607212, -0.012326172553002834, 0.05272964388132095, -0.018646901473402977, -0.06210210546851158, 0.006495999172329903, -0.054305918514728546, 0.038145095109939575, -0.04399446025490761, -0.02630297839641571, -0.003924029879271984, 0.025905996561050415, 0.014672604389488697, 0.007435543462634087, 0.03016871213912964, -0.01628614403307438, -0.024378325790166855, -0.023486196994781494, 0.009891814552247524, -0.0029371795244514942, -0.034798771142959595, 0.008374827913939953, 0.03938803821802139, 0.02415301837027073, -0.09031375497579575, -0.007914010435342789, 0.0016889463877305388, 0.0009370006737299263, -0.018137427046895027, -0.015765683725476265, -0.00005722731657442637, 0.02296553924679756, -0.002876332262530923, 0.016195865347981453, 0.003003600984811783, 0.009847184643149376, 0.03193320333957672, -0.008650214411318302, -0.034754764288663864, 0.03736937791109085, 0.01892257109284401, -0.006087142508476973, 0.040513377636671066, 0.0030219105537980795, -0.04265027865767479, 0.026432909071445465, 0.005493259523063898, 0.00043500802712514997, -0.011938169598579407, 0.041180986911058426, 0.016060665249824524, 0.02463320642709732, -0.01349380612373352, -0.03484451770782471, 0.009819073602557182, -0.014631115831434727, -0.03322901576757431, -0.023376140743494034, -0.012712706811726093, -0.023417623713612556, 0.03206328675150871, -0.0187790859490633, 0.0001408450334565714, 0.02899276092648506, 0.0029213472735136747, 0.029138246551156044, 0.024362705647945404, -0.04901009052991867, -0.023235471919178963, 0.025325223803520203, -0.007281850557774305, -0.009062902070581913, -0.0011149507481604815, -0.01937924697995186, -0.016362734138965607, 0.0026718711014837027, 0.004769636318087578, 0.005861916579306126, -0.002297857776284218, -0.0034056920558214188, -0.004958592355251312, 0.0393504723906517, 0.010772204026579857, -0.011188634671270847, -0.06397923082113266, 0.01957874745130539, 0.01581907644867897, 0.0034740965347737074, -0.06621985137462616, 0.034607917070388794, 0.014365153387188911, -0.01670112833380699, -0.021928489208221436, 0.01656358689069748, -0.03795991837978363, 0.0500553734600544, -0.008335430175065994, 0.017900440841913223, -0.008032388985157013, 0.008113573305308819, -0.046018317341804504, -0.009400875307619572, 0.02058340422809124, -0.01603584736585617, -0.03031196817755699, 0.003922255709767342, -0.004583749920129776, -0.0005019993404857814, 0.02619851939380169, 0.007351813372224569, 0.024277903139591217, -0.014109916053712368, 0.030051423236727715, 0.04495791345834732, -0.004174449015408754, -0.01398556586354971, 0.012206238694489002, 0.034567561000585556, -0.042032815515995026, -0.010772456414997578, -0.00898320134729147, 0.018163561820983887, 0.040854766964912415, 0.011021467857062817, 0.006833153776824474, -0.06994155049324036, -0.019526392221450806, 0.03190279379487038, 0.016673387959599495, -0.01341933198273182, -0.020969267934560776, -0.036632176488637924, 0.02009284682571888, 0.005686171352863312, 0.0016537210904061794, -0.016700735315680504, -0.014606058597564697, 0.013841363601386547, 0.037579044699668884, 0.011287677101790905, 0.02896498329937458, -0.018105994910001755, 0.033479269593954086, 0.018374454230070114, -0.05395718663930893, 0.032463837414979935, -0.016556674614548683, -0.03470579534769058, 0.0050887162797153, -0.009606769308447838, 0.02775682881474495, 0.02999928966164589, 0.02187683805823326, -0.04156707599759102, -0.021456271409988403, 0.003078666515648365, -0.006546617019921541, 0.044321488589048386, -0.045246586203575134, 0.0000683778416714631, -0.01954592764377594, 0.029150668531656265, 0.013897808268666267, -0.039894044399261475, -0.030765574425458908, 0.019485866650938988, 0.01099554542452097, -0.036658938974142075, 0.07876989245414734, -0.003433105070143938, -0.07516855001449585, 0.03711167722940445, -0.05021260306239128, 0.0016914083389565349, 0.05685032904148102, 0.006767367012798786, -0.026475349441170692, -0.024269768968224525, 0.01813679374754429, 0.04772338271141052, 0.033669039607048035, 0.020880846306681633, 0.010884684510529041, 0.04878164455294609, 0.011188551783561707, 0.007577124517410994, -0.003325046505779028, -0.018664179369807243, 0.06434039771556854, 0.00519969267770648, -0.029626047238707542, -0.07094205915927887, 0.00002181977470172569, 0.027855953201651573, -0.028651505708694458, -0.01867499016225338, -0.01097536738961935, -0.07444871962070465, 0.00790089089423418, 0.01803862676024437, 0.02573866955935955, 0.009519183076918125, -0.01624990627169609, 0.010425415821373463, 0.02749396488070488, 0.012662680819630623, 0.0555744506418705, -0.02084212377667427, 0.02052994631230831, 0.015213288366794586, 0.027706632390618324, 0.025418676435947418, 0.042506277561187744, -0.00020069655147381127, -0.0032097885850816965, 0.0009332463960163295, -0.012227130122482777, -0.017943067476153374, 0.020937077701091766, -0.0026306433137506247, -0.055267006158828735, 0.04038482904434204, 0.022418227046728134, 0.005397976841777563, 0.016395296901464462, 0.056108903139829636, 0.0036017068196088076, -0.02962307073175907, 0.0021928988862782717, 0.03522712364792824, -0.01738576404750347, -0.012287713587284088, -0.01739688217639923, 0.00961802713572979, -0.004408800043165684, -0.02298680879175663, 0.03297853469848633, -0.006522854790091515, 0.0013819991145282984, -0.02278490550816059, -0.02848356030881405, 0.02426849864423275, -0.004477376583963633, 0.007243058178573847, 0.019540218636393547, 0.04377303272485733, 0.01803409866988659, 0.0037741358391940594, 0.023050891235470772, -0.0225980244576931, -0.0008833385072648525, 0.01159705687314272, 0.006515826564282179, 0.024590250104665756, 0.052321165800094604, 0.00982535071671009, -0.00911723729223013, -0.011448346078395844, 0.052219945937395096, -0.002166431164368987, -0.027644529938697815, 0.037119362503290176, 0.0044913929887115955, -0.018461881205439568, -0.059667348861694336, 0.023982679471373558, -0.00004503643503994681, 0.01426798664033413, 0.01172004546970129, 0.015944143757224083, 0.05477171763777733, -0.012649808079004288, 0.014386684633791447, -0.0336633138358593, 0.004916759207844734, -0.02021137997508049, -0.03012554906308651, -0.015324573963880539, 0.027191566303372383, -0.016459114849567413, 0.02400386705994606, 0.010935207828879356, 0.014327740296721458, 0.03681866452097893, 0.007997583597898483, -0.050168052315711975, -0.00980018824338913, 0.02221941016614437, -0.018980540335178375, 0.018255535513162613, -0.006917458958923817, -0.01217865664511919, 0.028463106602430344, 0.005639555398374796, 0.026079462841153145, 0.04226559400558472, -0.024492094293236732, -0.0008214616682380438, -0.051744215190410614, -0.03603485971689224, -0.006246698088943958, 0.06111116334795952, -0.03723575547337532, 0.0416889525949955, 0.018549121916294098, 0.04364103078842163, 0.041323550045490265, -0.012010271660983562, -0.045927807688713074, 0.068430095911026, 0.11260906606912613, -0.013482577167451382, 0.014985729940235615, 0.038428548723459244, 0.006803861819207668, -0.005322231911122799, -0.027878537774086, -0.026324870064854622, -0.005878371652215719, 0.052998363971710205, 0.028510110452771187, -0.018964264541864395, -0.01056646928191185, -0.014680011197924614, 0.015492409467697144, 0.02278604358434677, 0.01502906996756792, -0.019120486453175545, 0.036313362419605255, -0.030089423060417175, 0.022720184177160263, -0.0082100136205554, -0.012752724811434746, -0.02403705008327961, 0.03656604886054993, 0.0016112381126731634, 0.03304404392838478, 0.01597057469189167, 0.03661107271909714, 0.02782476507127285, 0.02368178777396679, 0.0032958134543150663, -0.07726863771677017, 0.003292514942586422, 0.013757559470832348, 0.000427870312705636, -0.016500305384397507, -0.020198391750454903, -0.03515759855508804, -0.0065586925484240055, 0.005174422636628151, -0.023333536460995674, 0.02949587069451809, -0.0036018688697367907, 0.0074036624282598495, 0.07165005058050156, 0.018125338479876518, -0.010427268221974373, 0.0036961224395781755, -0.011299521662294865, 0.012294656597077847, 0.025485189631581306, -0.0014935272047296166, 0.0148485591635108, -0.0023898582439869642, 0.032077256590127945, 0.01842777617275715, 0.05248134583234787, -0.0006508222431875765, 0.03001604788005352, 0.026186084374785423, 0.007452973630279303, 0.014580514281988144, 0.04137258604168892, 0.0085477065294981, 0.03669712692499161, 0.009386011399328709, 0.025005945935845375, -0.03465848043560982, -0.04347515106201172, 0.0280650332570076, -0.012264151126146317, 0.002725909696891904, -0.0008108438341878355, 0.032796766608953476, 0.01450133416801691, 0.019540628418326378, -0.015528538264334202, -0.05460141971707344, -0.006296733859926462, -0.04264191910624504, -0.012705841101706028, 0.02498364821076393, 0.05216042697429657, -0.01855141669511795, 0.022361192852258682, -0.011344396509230137, 0.017379438504576683, -0.00448302086442709, 0.005288407672196627, 0.035695880651474, -0.015001541003584862, -0.0025079406332224607, 0.009498693980276585, 0.023249471560120583, -0.033703893423080444, -0.002652934519574046, 0.027417059987783432, -0.0014827525010332465, 0.004140733741223812, 0.031845416873693466, -0.013213171623647213, -0.06183093041181564, 0.00511811813339591, -0.005531415808945894, -0.06046418845653534, 0.002689861226826906, 0.0041449060663580894, -0.015328370034694672, 0.0126938596367836, -0.023802729323506355, 0.010287860408425331, 0.00366147980093956, -0.0031145145185291767, 0.035581789910793304, -0.02189549431204796, 0.04865555092692375, 0.06126944348216057, -0.008634747937321663, 0.015551785938441753, -0.03430088981986046, 0.01379341259598732, -0.009695894084870815, -0.0013580085942521691, 0.03217291831970215, -0.02411733940243721, -0.0020092162303626537, -0.06810461729764938, -0.00555094238370657, 0.047206830233335495, 0.021611399948596954, -0.005662623327225447, -0.047168076038360596, 0.015320252627134323, -0.0851769745349884, -0.0009581351187080145, 0.0507546067237854, 0.017594778910279274, 0.046717189252376556, -0.0028373426757752895, 0.008508609607815742, 0.016021061688661575, -0.02545187436044216, -0.06981650739908218, -0.01774553954601288, -0.004036795347929001, -0.01776563748717308, -0.003640370909124613, -0.023270433768630028, 0.0421728752553463, -0.007592757232487202, -0.01646663248538971, 0.0007643493008799851, 0.025912916287779808, -0.020040085539221764, -0.03905152156949043, -0.030943118035793304, 0.06335272639989853, -0.013614781200885773, -0.00871383585035801, -0.04105596989393234, -0.008557764813303947, 0.005707613192498684, 0.028436891734600067, -0.011067037470638752, 0.03951847553253174, 0.04686983302235603, -0.009882219135761261, 0.00039657193701714277, 0.07661367952823639, 0.020862892270088196, -0.0016592259053140879, 0.0007101591327227652, 0.00045430564205162227 ]
Hugging Face on PyTorch / XLA TPUs
jysohn23
February 9, 2021
pytorch-xla
open-source-collab
https://huggingface.co/blog/pytorch-xla
PyTorch / XLA Library PyTorch / XLA is a Python package that uses the XLA linear algebra compiler to connect the PyTorch deep learning framework with XLA devices, which includes CPU, GPU, and Cloud TPUs. Part of the following content is also available in our API_GUIDE.md.
[ 0.05342312902212143, 0.00452516321092844, 0.059019338339567184, 0.011571034789085388, 0.05749106407165527, -0.016123292967677116, -0.01663241721689701, 0.007920457981526852, 0.025746848434209824, -0.006023145280778408, -0.07193038612604141, 0.03766915574669838, -0.0061038644053041935, 0.041363414376974106, 0.05718700960278511, -0.035315319895744324, 0.051295001059770584, 0.0037674910854548216, -0.024600781500339508, 0.07978750765323639, 0.04526602476835251, -0.03818294405937195, 0.03516410291194916, 0.02691083960235119, -0.023259973153471947, -0.03970734030008316, -0.03566673770546913, 0.02045770175755024, -0.013146030716598034, 0.021885111927986145, -0.07467849552631378, 0.028193648904561996, 0.014348356053233147, -0.07474108785390854, 0.018840253353118896, 0.028037890791893005, -0.034280456602573395, 0.07784795761108398, 0.029398301616311073, -0.007009344641119242, 0.04578350856900215, 0.01571403257548809, -0.10895851999521255, 0.016987688839435577, -0.018790706992149353, -0.009095320478081703, -0.13512492179870605, 0.07641661912202835, -0.04853900149464607, 0.03550023213028908, -0.0795130655169487, 0.0122657036408782, -0.04668264463543892, 0.030784398317337036, 0.06938539445400238, 0.09067738801240921, -0.0709361657500267, -0.06592315435409546, 0.04262961819767952, 0.006062416359782219, 0.05021989718079567, 0.04491559416055679, -0.00667603500187397, 0.021086037158966064, 0.012421121820807457, -0.04997850954532623, 0.0064874207600951195, -0.014221864752471447, -0.0787111446261406, -0.07334882020950317, -0.021751530468463898, 0.0670422911643982, 0.003665404859930277, -0.029553258791565895, 0.0011155109386891127, -0.0860394537448883, -0.05957316979765892, -0.021719083189964294, 0.09281225502490997, 0.04774680361151695, 0.02176927775144577, 0.0932716578245163, 0.014902441762387753, 0.033906348049640656, 0.06180146336555481, 0.007083960343152285, 0.00069331971462816, -0.04914267733693123, -0.00231416174210608, 0.016120443120598793, -0.031428106129169464, -0.10824783891439438, 0.04707062244415283, 0.03427251800894737, -0.007472761441022158, -0.011872024275362492, -0.05316724628210068, 0.027008771896362305, -0.01629498414695263, -0.06244723126292229, -0.00817143451422453, -0.08268469572067261, 0.022046485915780067, -0.07130096107721329, -0.05099159851670265, 0.08855734020471573, 0.015558083541691303, -0.014095209538936615, -0.0439603365957737, -0.03202228620648384, -0.014149297960102558, 0.05167463794350624, -0.027119692414999008, 0.042437899857759476, 0.01950191892683506, -0.002053010044619441, -0.01347315963357687, 0.041285667568445206, -0.01818704418838024, -0.0033763793762773275, -0.04189229756593704, 0.11355331540107727, 0.02770361490547657, -0.0012678832281380892, 0.04487552493810654, 0.11549356579780579, 0.008481096476316452, -0.05753467604517937, 0.05851982533931732, -0.04925237223505974, 0.03938770294189453, -0.02022092230618, 0.07080423086881638, 0.005599236581474543, 0.04980961233377457, -0.048132091760635376, 0.00106517830863595, -0.025362715125083923, -0.01126024965196848, 0.046692222356796265, -0.048353880643844604, 0.057667326182127, 0.04853867366909981, 0.02435288019478321, -0.056576699018478394, 0.01267906092107296, 0.002934426534920931, 0.06553922593593597, 0.02298320084810257, -0.007722513284534216, -0.06360243260860443, 0.04112614318728447, -0.09384860098361969, -0.024511635303497314, -0.005030560772866011, -0.0011919449316337705, 0.001275532296858728, -0.05938019976019859, -0.12516693770885468, -0.035088952630758286, -0.0028358197305351496, -0.018908048048615456, -0.05823372304439545, -0.005460631567984819, -0.009017552249133587, 0.03463619202375412, 0.07638475298881531, -0.0304602961987257, 0.02670508809387684, -0.020386042073369026, -0.01977679692208767, -0.08192184567451477, 0.003548703156411648, 0.04341651871800423, -0.009693974629044533, 0.00649613980203867, 0.04071686789393425, 0.0009246437111869454, -0.016338618472218513, 0.004681143444031477, -0.02743382565677166, 0.024164918810129166, -0.06131482496857643, -0.004579752683639526, -0.028220269829034805, -0.028675485402345657, 0.046553127467632294, -0.05430535227060318, 0.043658990412950516, 0.033943790942430496, -0.04485160857439041, -0.05317864939570427, 0.004282274283468723, 0.025622235611081123, 0.06403839588165283, -0.03721925616264343, -0.05955754965543747, 0.05634523183107376, -0.026602843776345253, 0.006911867298185825, -0.006546924822032452, -0.039292048662900925, -0.007182131987065077, -0.03527474403381348, 0.043485015630722046, 0.02056647650897503, 0.02524438500404358, -0.022081855684518814, 0.0025013252161443233, 0.002284176182001829, 0.038111429661512375, -0.08026845753192902, 0.03322587534785271, -0.0663812980055809, 0.007245188113301992, 0.030801309272646904, -0.04353561997413635, 0.021575385704636574, 0.05444851890206337, -0.017112571746110916, 0.1635567992925644, -0.09518062323331833, 0.004085737280547619, -0.023100949823856354, -0.06002822890877724, 0.08115820586681366, 0.07364128530025482, -0.01574983447790146, -0.0005875407950952649, -0.07214970141649246, 0.01143984030932188, -0.05828211084008217, -0.046259041875600815, 0.07139071822166443, 0.018858877941966057, -0.06751805543899536, -0.030519764870405197, 0.044376879930496216, 0.057710401713848114, -0.05647702142596245, 0.03732776641845703, 0.05481032654643059, -0.10171032696962357, 0.008033432997763157, 0.025495627894997597, -0.043744903057813644, 0.03571105748414993, -0.015156351029872894, 0.0074349017813801765, 0.048870477825403214, -0.006872191093862057, -0.036731552332639694, 0.043434105813503265, 0.03122403845191002, -0.003591702086851001, 0.11149661988019943, -0.022442378103733063, -0.028893569484353065, 0.03235532343387604, 0.05658983066678047, -0.01297395583242178, -0.02268161065876484, -0.011531677097082138, -0.05379066243767738, -0.00894931424409151, -0.010523123666644096, 0.03804992139339447, -0.00937622133642435, -0.0061472211964428425, -0.0005496807279996574, 0.06043305620551109, -0.04116075113415718, -0.02147503010928631, -0.017185388132929802, 0.014567919075489044, 0.021722517907619476, 0.020286928862333298, -0.02191552147269249, -0.053499992936849594, -0.04552103206515312, 0.012002779170870781, -0.005821532569825649, 0.0735483169555664, 0.019248319789767265, -0.02866879291832447, 0.019844625145196915, 0.04105430841445923, 0.00943036749958992, -0.03393707424402237, -0.01952885091304779, -0.0625373125076294, 0.04122287034988403, -0.011030525900423527, -0.018118778243660927, -0.0034295632503926754, 0.0070284390822052956, 0.0033446333836764097, 0.02698945626616478, -0.02816372737288475, 0.007626286242157221, -0.019568108022212982, -0.024775037541985512, 0.010797211900353432, -0.013064056634902954, -0.02177971787750721, 0.024134228006005287, 0.016392163932323456, 0.0018454043893143535, -0.08808644860982895, 0.011051847599446774, -0.02225101739168167, 0.008423454128205776, -0.019739987328648567, -0.027780888602137566, -0.002302610781043768, 0.04233085364103317, 0.009240688756108284, 0.03973611444234848, 0.02518407814204693, -0.0061903768219053745, 0.0382576547563076, -0.008268292993307114, 0.003758808132261038, 0.011078340001404285, -0.00819198414683342, 0.0069483621045947075, 0.05192270874977112, 0.0018171656411141157, -0.01595260016620159, 0.027906479313969612, 0.004986979998648167, -0.009664816781878471, -0.024335548281669617, 0.030041342601180077, 0.037211205810308456, 0.024992691352963448, -0.00576021196320653, -0.027922499924898148, -0.023093681782484055, -0.015952609479427338, -0.012788332998752594, -0.04108039289712906, -0.03991954028606415, -0.02657618559896946, -0.0021846324671059847, -0.044874824583530426, 0.026228200644254684, 0.014714459888637066, 0.009799887426197529, 0.01384046208113432, 0.03779070824384689, -0.045261163264513016, 0.0037468012887984514, -0.01766955293715, -0.013278991915285587, 0.00618376350030303, -0.028639860451221466, -0.024190852418541908, -0.028117932379245758, -0.008451221510767937, 0.019454875960946083, -0.001119542052038014, -0.0036476526875048876, -0.027539154514670372, -0.03002975881099701, 0.043706998229026794, 0.04997044801712036, 0.017187677323818207, -0.04659568518400192, -0.0022035762667655945, 0.01614789105951786, -0.020724715664982796, -0.03615270555019379, -0.012112310156226158, 0.04385492950677872, -0.02409757487475872, -0.020314570516347885, 0.03931761533021927, -0.03446262702345848, 0.01266067661345005, 0.014099788852036, 0.010083308443427086, -0.02593061327934265, 0.0021704183891415596, -0.04430881887674332, -0.0026055769994854927, 0.01658521220088005, -0.010199310258030891, -0.009339961223304272, -0.029528087005019188, -0.0024200319312512875, -0.029550960287451744, 0.009662672877311707, 0.022737763822078705, -0.0021977045107632875, -0.024920055642724037, 0.022403012961149216, 0.0491081066429615, 0.013495353981852531, -0.03434189036488533, 0.024166999384760857, -0.010769467800855637, -0.02617523819208145, 0.009612150490283966, -0.004121728241443634, 0.02556854486465454, 0.035602398216724396, 0.020870337262749672, -0.004910589661449194, -0.04686756804585457, -0.03678154572844505, -0.019430898129940033, 0.0021951363887637854, -0.028391337022185326, 0.00014136642857920378, 0.011699371971189976, 0.028360459953546524, 0.017006253823637962, 0.0226272139698267, -0.005964386276900768, 0.028022300451993942, 0.031028883531689644, 0.035270024091005325, -0.009887016378343105, 0.01697797328233719, -0.04830794781446457, 0.04096991941332817, 0.023748457431793213, -0.05259654298424721, 0.025190042331814766, 0.005510365590453148, -0.0306912399828434, -0.0196844395250082, -0.013672883622348309, 0.04855910316109657, -0.005739479325711727, -0.004890465643256903, -0.024110376834869385, -0.039850205183029175, 0.027737220749258995, 0.02150905691087246, -0.0036447225138545036, -0.018160106614232063, -0.01631707325577736, -0.01901002787053585, 0.018167836591601372, -0.0060272845439612865, -0.050761327147483826, -0.039519231766462326, 0.00440633250400424, 0.045999519526958466, -0.03535730764269829, 0.03599114343523979, 0.012544209137558937, -0.04951237142086029, 0.007808313239365816, -0.0719117820262909, 0.004773268010467291, 0.028318967670202255, 0.009028416126966476, -0.027403730899095535, 0.0303923562169075, 0.03517993912100792, 0.049169495701789856, 0.04180493950843811, 0.06518743187189102, 0.029821140691637993, 0.06300023943185806, 0.017907127737998962, -0.04442395642399788, 0.005861553829163313, -0.027433471754193306, 0.03478263318538666, 0.002081458456814289, 0.008141699247062206, -0.06881999224424362, -0.01257567573338747, 0.017918281257152557, -0.05817670002579689, 0.018884601071476936, 0.0010698111727833748, -0.08116743713617325, -0.0017107694875448942, 0.0336734764277935, -0.02200194261968136, -0.02974090725183487, -0.024189898744225502, 0.0336388535797596, 0.007819605991244316, -0.006057205609977245, 0.060395024716854095, -0.003615538589656353, 0.0014997449470683932, 0.046466581523418427, -0.012964419089257717, 0.03266509994864464, -0.013747679069638252, 0.041700996458530426, -0.004595642909407616, -0.036278657615184784, -0.03034832328557968, -0.009175723418593407, 0.016045808792114258, -0.013987562619149685, -0.0650809183716774, 0.027343278750777245, 0.032424941658973694, -0.03021962195634842, 0.00021567549265455455, 0.013998758047819138, 0.009841268882155418, -0.005035138688981533, 0.05882451683282852, -0.002382599748671055, -0.006934712175279856, -0.028045475482940674, 0.031151369214057922, 0.0043228804133832455, 0.006366691552102566, 0.011985048651695251, 0.027917468920350075, -0.0038908501155674458, -0.020427202805876732, -0.018084527924656868, -0.03077903389930725, 0.014025568030774593, -0.0019375854171812534, -0.01958518475294113, 0.008235746063292027, 0.015406358055770397, 0.03771412372589111, -0.00679954094812274, 0.0178234726190567, -0.027034934610128403, -0.009280129335820675, 0.01610592007637024, 0.011363054625689983, 0.021439343690872192, 0.07424463331699371, 0.028285499662160873, -0.00005198453800403513, -0.017039261758327484, 0.06731711328029633, 0.013189894147217274, -0.027994738891720772, 0.037589360028505325, 0.021273568272590637, -0.020213285461068153, -0.04284556210041046, 0.003947382792830467, -0.02475930005311966, 0.020167842507362366, 0.010703000240027905, 0.019250553101301193, 0.0419633723795414, -0.007998957298696041, 0.019031886011362076, -0.05606717988848686, 0.032190077006816864, -0.04466355964541435, -0.027925068512558937, -0.03656391799449921, 0.008336801081895828, -0.011349676176905632, 0.0492674745619297, -0.011940321885049343, 0.023777848109602928, 0.014404112473130226, -0.003584573743864894, -0.03996307775378227, 0.00663333386182785, 0.026815319433808327, -0.02168985828757286, 0.022593865171074867, 0.004935295786708593, 0.0012218946358188987, 0.03240285813808441, 0.019026635214686394, 0.021781673654913902, 0.044817496091127396, -0.02005322463810444, 0.001559488009661436, -0.011075708083808422, -0.02439352124929428, -0.019169064238667488, 0.051937591284513474, -0.015848612412810326, 0.0613313652575016, -0.008822215721011162, 0.06407936662435532, 0.02427126094698906, 0.0057089789770543575, -0.012486391700804234, 0.043769970536231995, 0.09430404007434845, -0.006473979447036982, 0.03206910192966461, 0.007219312246888876, -0.03951543569564819, 0.01685306429862976, -0.03418722376227379, -0.033234428614377975, -0.010028611868619919, 0.020484263077378273, 0.054131437093019485, 0.019131578505039215, -0.009478314779698849, -0.04007534682750702, 0.05629843845963478, 0.016285108402371407, 0.02155810222029686, 0.006222330965101719, 0.01138833723962307, -0.007416814099997282, 0.0006638345075771213, 0.0050989980809390545, 0.02419067546725273, -0.01997029222548008, 0.022097768262028694, 0.04281558096408844, 0.020271390676498413, 0.04212189465761185, 0.025326233357191086, 0.02610912173986435, -0.005584589205682278, 0.008209630846977234, -0.031696535646915436, 0.003885845886543393, -0.012117614038288593, -0.02907819114625454, -0.0008872597827576101, -0.009767025709152222, -0.04960581287741661, -0.010996924713253975, -0.0008760240161791444, -0.029794400557875633, -0.014318976551294327, -0.02742142044007778, 0.02772442065179348, 0.029255757108330727, 0.01224394328892231, 0.02089814469218254, -0.0015992276603356004, 0.004791949409991503, 0.020256144925951958, 0.0059821875765919685, -0.011302256025373936, 0.003997140564024448, -0.012721201404929161, 0.05126667767763138, -0.006186539772897959, 0.006583520211279392, -0.0015799393877387047, -0.0098746782168746, 0.008676892146468163, 0.035568542778491974, -0.027443457394838333, -0.0019496134482324123, 0.0115375816822052, 0.05140295997262001, -0.043149158358573914, -0.0025221300311386585, -0.025614460930228233, -0.062213245779275894, 0.03570138290524483, 0.020846150815486908, 0.009832149371504784, -0.006690492853522301, 0.012616238556802273, 0.023889338597655296, 0.010754596441984177, -0.03886188939213753, -0.04954085126519203, -0.024722695350646973, 0.005581919569522142, -0.022350512444972992, -0.006936799734830856, 0.030697811394929886, 0.0006384985754266381, -0.00041172816418111324, -0.023994645103812218, 0.03404518589377403, -0.019700275734066963, -0.003293519839644432, 0.01735195890069008, 0.0015737470239400864, -0.014476791955530643, 0.014888850040733814, 0.028176316991448402, -0.0030162562616169453, -0.0036727208644151688, 0.015746667981147766, 0.012888331897556782, 0.01735781878232956, 0.004559110384434462, -0.00612304825335741, -0.05180303007364273, -0.005844562314450741, -0.02221238799393177, -0.059205371886491776, 0.013730436563491821, 0.02656164951622486, 0.019261350855231285, 0.014951054938137531, -0.05306478217244148, 0.03328986093401909, -0.017150050029158592, -0.0181623212993145, 0.024231618270277977, -0.047564614564180374, 0.01885119080543518, 0.03448054939508438, 0.0028607798740267754, -0.03064337745308876, -0.02616281434893608, 0.037412453442811966, 0.014376244507730007, -0.0038140122778713703, 0.041071753948926926, -0.015295874327421188, 0.008273925632238388, -0.04213428497314453, 0.019653750583529472, 0.0343392938375473, -0.0071852486580610275, -0.004851923789829016, -0.05649298056960106, 0.02695484645664692, -0.06916528940200806, 0.03247784078121185, 0.04703948646783829, 0.008622689172625542, 0.05957799777388573, 0.005857290234416723, -0.006685954052954912, 0.005553354974836111, -0.0878768116235733, -0.03432257100939751, -0.0064045884646475315, 0.0020769021939486265, -0.032223913818597794, 0.008850338868796825, -0.00008708018867764622, 0.03621058166027069, 0.008310763165354729, 0.006721272133290768, -0.005317285656929016, 0.0018915185937657952, -0.013839364051818848, -0.04957978427410126, -0.01841646619141102, 0.04451172426342964, -0.03221078962087631, -0.007778916973620653, -0.0006624636007472873, 0.0007634594803676009, 0.008574403822422028, 0.028916070237755775, -0.02395005151629448, 0.030464988201856613, 0.03766477853059769, 0.032499756664037704, -0.0064192949794232845, 0.08319242298603058, 0.030507562682032585, -0.016124757006764412, -0.0039174361154437065, -0.009780063293874264 ]
Hugging Face on PyTorch / XLA TPUs
jysohn23
February 9, 2021
pytorch-xla
open-source-collab
https://huggingface.co/blog/pytorch-xla
PyTorch / XLA Input Pipeline There are two main parts to running a PyTorch / XLA model: (1) tracing and executing your model’s graph lazily (refer to below “PyTorch / XLA Library” section for a more in-depth explanation) and (2) feeding your model. Without any optimization, the tracing/execution of your model and input feeding would be executed serially, leaving chunks of time during which your host CPU and your TPU accelerators would be idle, respectively. To avoid this, we provide an API, which pipelines the two and thus is able to overlap the tracing of step n+1 while step n is still executing. python import torch_xla.distributed.parallel_loader as pl ... dataloader = pl.MpDeviceLoader(dataloader, device)
[ 0.06225384399294853, 0.016122646629810333, 0.05320604518055916, 0.025270674377679825, 0.034796133637428284, 0.014051133766770363, -0.006299826316535473, -0.0029108100570738316, -0.006879123393446207, -0.03135962039232254, -0.04474759101867676, 0.08232811093330383, 0.012429899536073208, 0.06280206888914108, 0.04525100439786911, -0.015417780727148056, 0.10250112414360046, -0.049102894961833954, -0.011534779332578182, 0.07212547212839127, 0.047968655824661255, -0.056052062660455704, 0.03274201974272728, 0.059744663536548615, -0.05630498751997948, -0.0887809470295906, -0.03549128770828247, 0.0054197367280721664, 0.003659687703475356, 0.010005110874772072, -0.08868589252233505, -0.00554311228916049, 0.05669254809617996, -0.049999091774225235, 0.0004664180742111057, 0.03564564511179924, -0.09896376729011536, 0.04369460791349411, 0.06993857771158218, -0.03354538232088089, 0.00015982615877874196, 0.02295040152966976, -0.08696813136339188, 0.04570380598306656, 0.05347854271531105, -0.03712562844157219, -0.15784931182861328, 0.04058770462870598, -0.03237549960613251, 0.006492972373962402, -0.08110737055540085, 0.05564049631357193, -0.023575954139232635, 0.0027020422276109457, 0.006492082495242357, 0.06007477641105652, -0.01096788328140974, -0.04152821749448776, -0.003689718898385763, 0.022734088823199272, 0.06743918359279633, 0.053560514003038406, -0.006651930045336485, 0.03992448374629021, 0.04607066139578819, -0.04515964165329933, 0.0434231236577034, -0.003975303843617439, -0.10175026953220367, -0.07056529819965363, -0.012854605913162231, 0.05299285426735878, 0.005104015115648508, -0.022933537140488625, -0.013445232063531876, -0.08008566498756409, -0.016853606328368187, 0.030126575380563736, 0.07135020196437836, 0.07706401497125626, 0.048374272882938385, 0.046669695526361465, 0.016789032146334648, 0.07518690079450607, 0.05820315331220627, 0.010373400524258614, 0.042823243886232376, -0.008518200367689133, 0.011768151074647903, 0.027562949806451797, -0.002502436749637127, -0.11180533468723297, 0.018670784309506416, -0.022484352812170982, 0.009259380400180817, -0.005335775204002857, -0.02274925261735916, 0.03660924732685089, -0.0029507095459848642, -0.025008538737893105, 0.015487833879888058, -0.1192852258682251, 0.009360087104141712, 0.011673271656036377, -0.04877869039773941, 0.06038813292980194, -0.021962584927678108, -0.04773212969303131, -0.03942510858178139, -0.0020450286101549864, -0.03201648220419884, 0.04466025531291962, -0.0511326864361763, 0.04999149963259697, -0.02342122606933117, -0.052060820162296295, -0.015492618083953857, 0.020843224599957466, -0.017035163938999176, -0.004178446251899004, -0.010604137554764748, 0.09465055167675018, 0.06508013606071472, 0.041008301079273224, 0.00836440920829773, 0.08159097284078598, 0.03820778802037239, -0.0334806852042675, 0.017902862280607224, -0.06264454126358032, 0.049740269780159, -0.0011170636862516403, 0.08137670904397964, 0.03300859406590462, 0.050351377576589584, -0.07104215770959854, 0.03151416406035423, -0.0033348628785461187, -0.012233741581439972, -0.028340371325612068, -0.043828658759593964, 0.08037956058979034, 0.05449458956718445, 0.011467533186078072, 0.003764260793104768, -0.025358470156788826, -0.07001620531082153, 0.08348972350358963, 0.018534278497099876, 0.014846117235720158, -0.09060671925544739, 0.06747346371412277, -0.07932133972644806, -0.024539027363061905, 0.011110837571322918, 0.02702442929148674, -0.012274229899048805, -0.040661461651325226, -0.11160405725240707, -0.013666680082678795, 0.025188341736793518, 0.026560897007584572, 0.031560298055410385, -0.025540951639413834, 0.010961211286485195, 0.07300761342048645, 0.08251376450061798, -0.017657648772001266, 0.019330177456140518, -0.030581185594201088, -0.026788949966430664, 0.030445899814367294, 0.022923961281776428, 0.013128682039678097, -0.00693123834207654, 0.03140915185213089, 0.03302834928035736, 0.008019501343369484, -0.026856079697608948, -0.043157607316970825, -0.0319141186773777, 0.0885918065905571, -0.08667928725481033, 0.08688244968652725, 0.009852510876953602, -0.050709210336208344, 0.022608185186982155, -0.04969854652881622, -0.06759289652109146, 0.02714693546295166, -0.02512546442449093, -0.010545510798692703, 0.03190804272890091, -0.07636856287717819, 0.043679121881723404, -0.03961903601884842, -0.06520944088697433, 0.02723602019250393, -0.04093377664685249, 0.006968804635107517, 0.05090298503637314, 0.03282415494322777, -0.04440022259950638, -0.06288253515958786, -0.010939138010144234, -0.018065402284264565, 0.0717526525259018, -0.06852073222398758, 0.07225042581558228, 0.0001353845582343638, -0.051980867981910706, -0.0947527289390564, 0.0001739501894917339, -0.04417773708701134, -0.020938027650117874, -0.008887598291039467, 0.0063082631677389145, 0.003406682750210166, 0.014804694801568985, -0.014587532728910446, 0.15668217837810516, -0.0943371057510376, 0.02355230413377285, 0.0256833266466856, -0.06549926102161407, 0.014363005757331848, 0.06017154082655907, 0.018767302855849266, 0.028711535036563873, -0.08018450438976288, -0.00647750124335289, -0.06337697803974152, -0.02749052457511425, 0.07432550936937332, 0.006519674323499203, -0.06067447364330292, -0.053444311022758484, 0.028694013133645058, 0.04410894587635994, -0.035262271761894226, 0.022624263539910316, 0.01769319362938404, -0.0663294792175293, -0.004254952073097229, -0.014448517002165318, -0.06919296085834503, 0.028896715492010117, 0.025503620505332947, -0.01968318223953247, 0.0008684240165166557, -0.049518030136823654, 0.021552762016654015, -0.003859499469399452, -0.021152438595891, 0.03549450635910034, 0.03187747672200203, -0.01873168721795082, -0.03021487407386303, 0.01441862341016531, 0.06242506206035614, 0.009325833059847355, -0.025170693174004555, -0.040486790239810944, -0.04413656145334244, -0.023973694071173668, -0.01758488267660141, 0.026601839810609818, 0.0013607003493234515, -0.00221269391477108, -0.014731976203620434, 0.020119719207286835, -0.03634192422032356, 0.006689186207950115, -0.040809616446495056, 0.042191069573163986, 0.009100217372179031, 0.0372416153550148, 0.003752652555704117, -0.03587175905704498, -0.03304029628634453, 0.004480388946831226, -0.006788976024836302, 0.04716784507036209, 0.013898949138820171, -0.014499831013381481, 0.009588670916855335, 0.018902476876974106, -0.011190242134034634, -0.03516892343759537, 0.008805394172668457, -0.027771195396780968, 0.013446374796330929, -0.03589743375778198, -0.05480947345495224, -0.00712071917951107, 0.014237250201404095, 0.00041350536048412323, -0.025871142745018005, 0.0051008849404752254, -0.033289190381765366, -0.06237287074327469, -0.025940289720892906, -0.009663519449532032, -0.02118229679763317, -0.035634852945804596, -0.0068172886967659, 0.04492552578449249, 0.0010464057559147477, -0.10192739963531494, -0.014195093885064125, -0.01634763553738594, -0.0074651059694588184, 0.015962881967425346, -0.038562215864658356, 0.011662301607429981, 0.03665212541818619, 0.009004508145153522, 0.01622817851603031, 0.001324069919064641, 0.017169315367937088, -0.010656663216650486, 0.0024660874623805285, -0.01064737793058157, -0.021472744643688202, 0.04745989665389061, 0.0008502615382894874, 0.030075769871473312, -0.002209932077676058, -0.00403562979772687, 0.04768598824739456, 0.03359553590416908, -0.015066040679812431, -0.01111077331006527, 0.023031825199723244, 0.02310384064912796, 0.013841076754033566, -0.0007149041630327702, -0.03199649602174759, -0.06449846923351288, -0.039679836481809616, -0.018402880057692528, 0.0019097577314823866, -0.0022833039984107018, -0.021812936291098595, 0.030983559787273407, -0.024027861654758453, 0.014303804375231266, 0.030956218019127846, 0.04344022274017334, 0.0036164838820695877, 0.015879105776548386, -0.030259374529123306, 0.019806010648608208, 0.01567544788122177, -0.0013448214158415794, -0.027590623125433922, 0.03674667701125145, -0.0217689611017704, -0.008962852880358696, -0.008515466935932636, 0.011767721734941006, 0.019208522513508797, 0.005026132799685001, 0.003331799991428852, -0.011636613868176937, 0.045869894325733185, 0.06382667273283005, 0.04013613983988762, -0.027643384411931038, -0.01013113185763359, 0.011895625852048397, -0.0053040641359984875, -0.005228089168667793, 0.03345008194446564, 0.04800604283809662, 0.02247418649494648, -0.024987442418932915, 0.020921656861901283, -0.040633462369441986, 0.02201707847416401, -0.0015542253386229277, 0.006661590654402971, -0.028846008703112602, 0.033292416483163834, -0.025658346712589264, -0.023705096915364265, 0.01886148937046528, -0.0003929397207684815, -0.02812345139682293, -0.03695591911673546, -0.010240600444376469, -0.038444869220256805, 0.017756452783942223, 0.021137310191988945, 0.004966340027749538, -0.02895297482609749, 0.026375893503427505, 0.060526445508003235, 0.0028465043287724257, -0.01187322661280632, 0.029131893068552017, -0.043466340750455856, -0.02989049442112446, -0.022868916392326355, 0.002880051964893937, 0.021848050877451897, 0.025947902351617813, -0.010244081728160381, 0.012098892591893673, -0.053311530500650406, -0.0033872707281261683, 0.02211255580186844, -0.008631630800664425, 0.012885038740932941, -0.013157001696527004, -0.007515573408454657, 0.04561913013458252, 0.01436410192400217, -0.001716822269372642, 0.006988275330513716, 0.018712809309363365, 0.010585334151983261, 0.03228151053190231, 0.03781554102897644, 0.013834008947014809, -0.04063304886221886, 0.013577648438513279, 0.010561772622168064, -0.0701804906129837, 0.06445343792438507, -0.033200979232788086, -0.03485814109444618, 0.014862488955259323, 0.00390798831358552, 0.017302177846431732, 0.019858133047819138, 0.023639626801013947, -0.027659371495246887, -0.00312206638045609, 0.012907850556075573, -0.00007745851326035336, 0.0020321013871580362, -0.02759850211441517, -0.0010621321853250265, 0.007571336813271046, -0.0018050450598821044, 0.01868828386068344, -0.030437316745519638, -0.006562656722962856, 0.01639963500201702, -0.011546357534825802, -0.06495074927806854, 0.06072789803147316, 0.023486312478780746, -0.07026717066764832, 0.024225277826189995, -0.07258214801549911, -0.006007668096572161, 0.054043013602495193, 0.015194638632237911, -0.023699546232819557, 0.04119662195444107, 0.05448639392852783, 0.019093435257673264, 0.030098257586359978, 0.008642635308206081, 0.027431707829236984, 0.055443160235881805, -0.002515139291062951, -0.011925923638045788, -0.013362699188292027, 0.009553423151373863, 0.05878804624080658, -0.026634352281689644, -0.052544064819812775, -0.037279073148965836, -0.008967985399067402, -0.016124501824378967, -0.06762350350618362, -0.00673172390088439, 0.028814978897571564, -0.06106937676668167, 0.024774836376309395, 0.022735001519322395, 0.016353780403733253, -0.011278001591563225, 0.024798637256026268, 0.05137450620532036, 0.01571696437895298, 0.01135354395955801, 0.04360179603099823, -0.02386929839849472, -0.0035473552998155355, 0.01240641437470913, 0.003929893486201763, -0.0057141282595694065, 0.005359527189284563, 0.019746851176023483, -0.005078544374555349, -0.017567353323101997, -0.04609917476773262, -0.0011537095997482538, 0.011273536831140518, 0.01225186511874199, -0.050242893397808075, 0.016470681875944138, -0.01641119457781315, 0.025634080171585083, 0.028824569657444954, 0.04821830615401268, -0.011348615400493145, -0.031050365418195724, 0.01943681761622429, 0.013017877005040646, 0.015684910118579865, -0.03413861617445946, 0.025366056710481644, -0.001797214848920703, 0.01965729333460331, -0.000659641926176846, -0.0017041116952896118, 0.0244675874710083, 0.022905422374606133, -0.010595589876174927, -0.022256361320614815, 0.04268284887075424, 0.03556995466351509, 0.03890630975365639, -0.009070329368114471, 0.012366720475256443, -0.01150377094745636, 0.012297259643673897, 0.01358005777001381, -0.009998862631618977, -0.0011546065798029304, 0.007401152979582548, 0.0020154512021690607, 0.022162938490509987, 0.04239339753985405, -0.003852519439533353, -0.01641172356903553, 0.011823895387351513, 0.04833171144127846, 0.014555628411471844, -0.0530986413359642, 0.03436914086341858, 0.018107367679476738, -0.02694493532180786, -0.03703692555427551, -0.0003429843345656991, -0.0112851457670331, 0.04274837672710419, -0.00002502298775652889, 0.01569981314241886, 0.06707993149757385, -0.024558182805776596, 0.004130544140934944, -0.026604890823364258, 0.04143719747662544, -0.02748633734881878, -0.01962861604988575, -0.045619383454322815, 0.012850433588027954, 0.025805501267313957, 0.03612086921930313, 0.014323596842586994, 0.0390004888176918, 0.01827317848801613, 0.00785105861723423, -0.05645677447319031, -0.008530144579708576, 0.004828763660043478, 0.005607877857983112, 0.031811125576496124, -0.015326006338000298, -0.02372782863676548, 0.0004513888561632484, 0.00849370751529932, 0.027290554717183113, 0.020499298349022865, -0.03569415584206581, 0.0002727168321143836, -0.02020379714667797, -0.027974456548690796, 0.0023883143439888954, 0.0661921575665474, -0.020139804109930992, 0.04474566876888275, 0.03313203901052475, 0.03647441044449806, 0.014014915563166142, -0.0022081718780100346, -0.009904859587550163, 0.021551981568336487, 0.07455400377511978, 0.006499623414129019, 0.028931910172104836, 0.015210593119263649, -0.0254378542304039, -0.010595357976853848, -0.00017372836009599268, -0.05619144067168236, 0.01279909536242485, 0.006264504045248032, 0.028251484036445618, -0.019934289157390594, -0.004516142420470715, -0.03644324466586113, 0.029642648994922638, 0.019869551062583923, 0.030146406963467598, 0.009007277898490429, -0.001177303260192275, 0.02406826615333557, 0.004456097725778818, -0.0024377484805881977, 0.01809866726398468, 0.0009184886584989727, 0.04489680379629135, 0.05347389355301857, 0.01598598249256611, 0.030408665537834167, -0.00006002997906762175, 0.012810048647224903, 0.032874904572963715, -0.004100119229406118, -0.05360610783100128, -0.025798121467232704, 0.027482343837618828, -0.024199698120355606, 0.012114128097891808, 0.009539383463561535, -0.0370987132191658, -0.014238966628909111, -0.010895594023168087, -0.013943609781563282, -0.017079569399356842, -0.0021118149161338806, -0.019776739180088043, 0.025679493322968483, 0.017734840512275696, -0.02329988218843937, -0.0032372260466217995, -0.006775080692023039, -0.0060886200517416, 0.01521453820168972, -0.020877251401543617, -0.02411005273461342, -0.018841519951820374, 0.03207891061902046, 0.005754177924245596, 0.021271418780088425, -0.0012904158793389797, -0.004137129057198763, 0.03861226513981819, -0.0064749522134661674, -0.01269415020942688, 0.05213633179664612, 0.022203272208571434, 0.008329850621521473, -0.0018946712370961905, 0.0284122284501791, -0.026051735505461693, -0.048373863101005554, 0.048437584191560745, 0.01877014897763729, 0.0026681232266128063, -0.004524746909737587, 0.02760251611471176, 0.0330374650657177, 0.004418935161083937, -0.0371403731405735, -0.039223745465278625, -0.00871353317052126, 0.0050725555047392845, -0.0201702993363142, 0.004580950830131769, 0.028217358514666557, 0.013832086697220802, 0.00833764299750328, -0.035661470144987106, 0.015752840787172318, 0.01981358975172043, 0.004844799637794495, 0.02395847626030445, -0.019547563046216965, -0.013340863399207592, -0.020947910845279694, 0.012227497063577175, -0.01021925825625658, 0.024800125509500504, 0.026175979524850845, -0.0007056425674818456, -0.03772849217057228, -0.03443480283021927, 0.0060224044136703014, -0.032618723809719086, -0.0004908210830762982, -0.015774007886648178, -0.05103783681988716, 0.025965016335248947, -0.0005260815960355103, -0.03581548109650612, -0.0032773877028375864, -0.028797317296266556, 0.007593764457851648, -0.023170212283730507, 0.004026825539767742, -0.00685815280303359, -0.05653894692659378, 0.0425855852663517, 0.034529346972703934, -0.031206144019961357, 0.021024975925683975, -0.05569809675216675, 0.018833640962839127, -0.025316111743450165, 0.019184615463018417, 0.047594357281923294, -0.01224654819816351, -0.006951256655156612, -0.017092125490307808, 0.024353692308068275, 0.05129624158143997, -0.03135460615158081, 0.0012277686037123203, 0.03351637348532677, 0.00013892145943827927, -0.06333129853010178, -0.026168780401349068, 0.061878751963377, 0.029192760586738586, 0.0501861646771431, -0.007327714469283819, -0.029049115255475044, 0.009181699715554714, -0.02456076070666313, -0.046620018780231476, -0.006520357448607683, -0.007623149082064629, -0.03470404073596001, 0.010066438466310501, -0.002240701112896204, 0.02989516593515873, -0.007711198180913925, -0.038906536996364594, 0.015699127689003944, 0.010363795794546604, -0.02943122200667858, -0.06552146375179291, -0.055522672832012177, 0.05992385372519493, -0.009448095224797726, -0.058684565126895905, 0.01033269613981247, 0.020154142752289772, 0.020337656140327454, 0.020069140940904617, 0.0016514838207513094, 0.02947225421667099, 0.02994491346180439, 0.01884797401726246, -0.02446669340133667, 0.05704536288976669, 0.020603686571121216, -0.035297103226184845, -0.024199817329645157, -0.005328112747520208 ]
Hugging Face on PyTorch / XLA TPUs
jysohn23
February 9, 2021
pytorch-xla
open-source-collab
https://huggingface.co/blog/pytorch-xla
Training Your Favorite Transformers on Cloud TPUs using PyTorch / XLA The PyTorch-TPU project originated as a collaborative effort between the Facebook PyTorch and Google TPU teams and officially launched at the 2019 PyTorch Developer Conference 2019. Since then, we’ve worked with the Hugging Face team to bring first-class support to training on Cloud TPUs using PyTorch / XLA. This new integration enables PyTorch users to run and scale up their models on Cloud TPUs while maintaining the exact same Hugging Face trainers interface. This blog post provides an overview of changes made in the Hugging Face library, what the PyTorch / XLA library does, an example to get you started training your favorite transformers on Cloud TPUs, and some performance benchmarks. If you can’t wait to get started with TPUs, please skip ahead to the “Train Your Transformer on Cloud TPUs” section - we handle all the PyTorch / XLA mechanics for you within the Trainer module!
[ 0.02200029231607914, -0.03599458560347557, 0.04060833901166916, 0.03482046350836754, 0.009354828856885433, 0.03150664642453194, 0.015025852248072624, 0.09074418246746063, -0.0019247812451794744, -0.03140505030751228, -0.06110740080475807, 0.06693684309720993, -0.048481252044439316, 0.0713656097650528, 0.05444299057126045, -0.08844064176082611, 0.01661873050034046, 0.004145392682403326, -0.041925061494112015, 0.06587877869606018, 0.009268497116863728, -0.03749772161245346, 0.02338237315416336, -0.00195038050878793, -0.038454052060842514, -0.09084542840719223, -0.005523372441530228, 0.037144776433706284, 0.03769616037607193, -0.007910330779850483, -0.05716865137219429, 0.006806681863963604, 0.01749972254037857, -0.034469518810510635, -0.004494452383369207, 0.07888329029083252, -0.05118286982178688, 0.02295983023941517, 0.05154106020927429, -0.014762715436518192, 0.04773272946476936, -0.03630613908171654, -0.1321495622396469, 0.009817342273890972, 0.018825849518179893, -0.02028821036219597, -0.1503732055425644, 0.05998542904853821, -0.05866420269012451, -0.006757515016943216, -0.06482288986444473, 0.043760400265455246, 0.008690759539604187, -0.021451352164149284, 0.04530031234025955, 0.08553619682788849, -0.04213950037956238, -0.0685415044426918, -0.00039655843283981085, 0.0052032810635864735, 0.02962745539844036, 0.034212466329336166, 0.04064907878637314, 0.0311744287610054, -0.00825433898717165, -0.020452383905649185, 0.013484240509569645, 0.0034954403527081013, -0.05935010313987732, -0.057708851993083954, 0.007814138196408749, 0.029776092618703842, 0.023562638089060783, 0.013805104419589043, 0.012056836858391762, -0.031161505728960037, -0.024408333003520966, -0.00003669275247375481, 0.10156608372926712, 0.06400109082460403, 0.0005834385519847274, 0.05070073902606964, 0.009959247894585133, -0.004188592080026865, 0.02112705633044243, 0.01637905463576317, 0.03304346278309822, -0.05553587153553963, -0.025151856243610382, 0.04687560349702835, -0.018194708973169327, -0.11623946577310562, 0.05058735981583595, 0.004473450127989054, 0.042649414390325546, 0.014610865153372288, -0.04251987859606743, 0.010388667695224285, 0.0012923239264637232, -0.09729646891355515, -0.016069859266281128, -0.06266093999147415, -0.02246028743684292, -0.05856927111744881, -0.030497394502162933, 0.03650026023387909, -0.03233497589826584, -0.10964080691337585, 0.022115666419267654, -0.02737884782254696, -0.02194352075457573, -0.016422191634774208, 0.013601839542388916, 0.06754641979932785, -0.015206622891128063, 0.00835036113858223, 0.005027336534112692, 0.001521361875347793, 0.010961201041936874, -0.03418998420238495, -0.0031667889561504126, 0.1474395990371704, 0.013780626468360424, -0.04492205008864403, 0.004768995102494955, 0.12128553539514542, -0.04849371314048767, -0.001334257423877716, 0.03758862614631653, -0.025071101263165474, 0.04271283373236656, -0.05447597801685333, 0.0933060571551323, -0.07383152097463608, 0.07174516469240189, -0.013255111873149872, 0.00879286602139473, -0.07790634781122208, -0.002912442898377776, 0.001993946498259902, -0.021449986845254898, 0.12057343870401382, 0.018549958243966103, -0.011844221502542496, -0.025903543457388878, -0.019293272867798805, -0.08612801134586334, 0.08898919075727463, 0.009904921054840088, -0.007352003362029791, -0.07147667557001114, 0.052042730152606964, -0.08764546364545822, -0.02710592932999134, 0.03798864409327507, 0.032437197864055634, 0.0039664520882070065, -0.0888955220580101, -0.05835850164294243, -0.0771050825715065, -0.03244935721158981, -0.00007791423558956012, -0.08386320620775223, 0.017450327053666115, 0.0020163441076874733, 0.043988317251205444, 0.03584422171115875, -0.015963023528456688, 0.023935865610837936, -0.03502630814909935, 0.00243399222381413, -0.01159572135657072, 0.010945514775812626, 0.031260740011930466, -0.03083609603345394, 0.0387193039059639, 0.004902645479887724, 0.044230688363313675, -0.019161442294716835, -0.029850054532289505, -0.03911290317773819, 0.07878676801919937, -0.012757133692502975, 0.050864554941654205, -0.023248489946126938, -0.020978497341275215, 0.0662611573934555, -0.012370004318654537, 0.012372097931802273, 0.03742004930973053, -0.05591318756341934, -0.0432293564081192, 0.019501356407999992, -0.011830623261630535, 0.05447874590754509, 0.00014635514526162297, -0.0495389960706234, 0.044053394347429276, -0.040395818650722504, 0.014872324652969837, 0.036824531853199005, -0.017909562215209007, 0.0026971306651830673, -0.031018387526273727, 0.010576639324426651, 0.0017641057493165135, 0.05053550377488136, -0.036513183265924454, 0.004953020252287388, 0.007808287627995014, 0.02001364715397358, -0.09514328092336655, 0.0073793260380625725, -0.003993209917098284, -0.0376342236995697, -0.04873863235116005, -0.03075285628437996, -0.016696294769644737, 0.01862526871263981, 0.001270586857572198, 0.1468323916196823, -0.038230713456869125, 0.0168764628469944, 0.004142759367823601, -0.025479447096586227, -0.013071311637759209, 0.03253137692809105, 0.024218715727329254, 0.0700603649020195, -0.1005680039525032, -0.02520824410021305, -0.11150680482387543, -0.07712508738040924, 0.031527675688266754, -0.0022076410241425037, -0.04714464768767357, 0.029620299115777016, -0.03336011990904808, 0.040428485721349716, -0.04849962517619133, -0.05112919583916664, 0.02983180060982704, -0.04086535423994064, 0.029107149690389633, 0.008205940015614033, -0.02331611141562462, 0.04809989407658577, 0.06346321105957031, -0.012282471172511578, 0.03197188675403595, -0.11427938938140869, 0.05415228381752968, -0.001623280462808907, -0.011493061669170856, 0.04474000632762909, 0.01901985891163349, -0.019290905445814133, -0.0035459708888083696, -0.016808105632662773, 0.036353714764118195, -0.0005470867035910487, -0.011911981739103794, -0.029724208638072014, -0.009858370758593082, -0.00552005460485816, -0.04754337668418884, 0.000349756475770846, 0.0045182122848927975, -0.0077987900003790855, -0.016672726720571518, 0.027479926124215126, -0.062266260385513306, 0.01679348200559616, -0.02100049890577793, 0.000859174644574523, 0.01754491589963436, 0.04264441877603531, -0.012065892107784748, -0.045882511883974075, -0.049667540937662125, 0.012780025601387024, -0.002346477471292019, 0.06683012843132019, 0.012029827572405338, -0.03028436005115509, -0.00024311621382366866, 0.029155895113945007, -0.02470739185810089, -0.04786990210413933, -0.012267247773706913, -0.03303636237978935, 0.03475014120340347, 0.004417112562805414, 0.010823996737599373, -0.012872605584561825, 0.033895350992679596, 0.0035708784125745296, -0.009654073975980282, -0.020013477653265, 0.053083181381225586, -0.02838018350303173, -0.03727877140045166, 0.0013466476229950786, -0.01757665164768696, -0.010273734107613564, -0.025476837530732155, 0.019997255876660347, 0.0077757518738508224, -0.08585187047719955, -0.010650531388819218, -0.03420328348875046, 0.0071499948389828205, -0.03597648814320564, -0.04544142633676529, 0.01627218909561634, -0.006512312684208155, -0.01712447591125965, 0.07816765457391739, 0.03095662221312523, -0.00038065307307988405, -0.019073644652962685, -0.013164314441382885, -0.029086582362651825, 0.0015624425141140819, 0.02314472198486328, 0.016543028876185417, 0.059154585003852844, 0.023030854761600494, -0.0619017630815506, 0.04890410602092743, 0.024607453495264053, -0.014541657641530037, 0.03049204871058464, 0.029997214674949646, 0.03756695240736008, 0.005080342758446932, 0.0275109950453043, -0.044387515634298325, 0.0023588177282363176, -0.010750307701528072, -0.018470151349902153, 0.02716231346130371, -0.026887325569987297, -0.0007430155528709292, -0.006033242214471102, -0.017823558300733566, 0.021717773750424385, 0.039846260100603104, 0.008787481114268303, 0.006462410092353821, 0.027096103876829147, -0.02397998608648777, 0.0461052730679512, 0.003507887478917837, -0.033409591764211655, -0.0075454190373420715, 0.001886735437437892, 0.011233855970203876, -0.030287139117717743, 0.0021923789754509926, 0.006479417905211449, 0.026594825088977814, -0.02563929744064808, -0.0021790354512631893, -0.01401763316243887, 0.0319514125585556, 0.014890844002366066, -0.012153265066444874, -0.03489270433783531, 0.025868672877550125, 0.008794785477221012, 0.005856605246663094, 0.006405323278158903, 0.034320879727602005, 0.02517213299870491, 0.010057825595140457, -0.016667760908603668, -0.0046569895930588245, -0.018506331369280815, 0.04786045849323273, -0.016473812982439995, -0.0013955733738839626, -0.02021913044154644, -0.001254442147910595, -0.00021662063954863697, -0.03617041930556297, 0.05788625404238701, 0.00935340952128172, -0.04484948888421059, -0.004044594708830118, -0.026747100055217743, -0.006015255581587553, 0.05046158283948898, 0.04475324600934982, 0.04903129115700722, -0.045055877417325974, 0.02497672103345394, 0.0454486608505249, 0.051139671355485916, -0.04231586307287216, -0.004716845229268074, -0.009492773562669754, -0.027253244072198868, -0.023673374205827713, -0.004521336406469345, 0.0543370246887207, -0.00898923072963953, 0.0014103252906352282, 0.006214964669197798, -0.046007875353097916, -0.0054143755696713924, 0.021662861108779907, 0.008605889044702053, 0.007073120679706335, 0.019427737221121788, -0.0366269014775753, 0.025413310155272484, 0.020770836621522903, 0.02020135521888733, 0.008302170783281326, 0.004476036410778761, 0.0019140316871926188, 0.03098997287452221, 0.04193437844514847, 0.022455556318163872, -0.029042217880487442, -0.016587451100349426, 0.030176319181919098, -0.008891006000339985, 0.04211711883544922, -0.002862802939489484, -0.023889336735010147, -0.007907235063612461, 0.0012100681196898222, 0.013984323479235172, 0.03381337970495224, 0.014781054109334946, -0.006589579861611128, -0.036747317761182785, -0.036458246409893036, 0.021995654329657555, 0.012459777295589447, -0.015836495906114578, -0.0024799301754683256, -0.013964605517685413, 0.019136106595396996, -0.021478498354554176, -0.02523219771683216, -0.03138437867164612, 0.02872733771800995, 0.0496395118534565, -0.03459325060248375, 0.02372627519071102, 0.016246503219008446, -0.051473796367645264, 0.004670374561101198, -0.03632066398859024, 0.006763082928955555, 0.036000050604343414, -0.02944851480424404, -0.06199696660041809, 0.020973125472664833, 0.036471523344516754, 0.023334402590990067, -0.00723238242790103, 0.03412117436528206, 0.009243829175829887, 0.06398019194602966, -0.006517373025417328, -0.0050034299492836, -0.020019935443997383, -0.03227159380912781, 0.03733650967478752, 0.021692056208848953, -0.01029487419873476, -0.05265507102012634, 0.0020829339046031237, -0.010969771072268486, -0.04253460094332695, -0.01856931671500206, -0.00043304095743224025, -0.02583170309662819, -0.02704261988401413, 0.026413777843117714, -0.0032975487411022186, 0.001026859157718718, 0.037007562816143036, 0.04875882342457771, -0.02971283532679081, -0.008488616906106472, 0.027100740000605583, -0.03992824628949165, 0.01891298033297062, 0.03884686529636383, 0.056329064071178436, 0.03277421370148659, 0.017594756558537483, 0.010827349498867989, -0.03262053057551384, -0.05014226958155632, -0.04450661689043045, 0.007686638738960028, 0.023988304659724236, -0.03138187155127525, -0.030123885720968246, 0.01598544605076313, 0.004960878752171993, -0.01038634404540062, -0.004289252683520317, 0.03797825053334236, -0.035191722214221954, 0.0052243731915950775, 0.06026593595743179, 0.035540543496608734, -0.0066420454531908035, 0.008082043379545212, 0.006836704444140196, -0.040404193103313446, 0.011074919253587723, 0.029665978625416756, 0.05084143579006195, -0.006549190729856491, -0.003394124563783407, -0.020551597699522972, -0.03586924821138382, 0.033003177493810654, 0.011655576527118683, -0.025347739458084106, -0.025668295100331306, 0.0067687863484025, 0.010456333868205547, -0.009799184277653694, 0.028410570695996284, -0.050205789506435394, 0.015791909769177437, 0.020540200173854828, 0.01256575994193554, -0.02675086073577404, 0.018329642713069916, 0.04331514984369278, 0.00987259205430746, 0.023868249729275703, 0.04787788540124893, 0.02595294639468193, -0.010119810700416565, 0.04016659036278725, 0.021963773295283318, -0.03887017071247101, -0.0526861697435379, -0.0007425568765029311, -0.038398969918489456, 0.02078416384756565, -0.016426729038357735, 0.04442015662789345, 0.07878953218460083, -0.015797358006238937, 0.01457253284752369, -0.05070275440812111, 0.03402614966034889, -0.0009604580118320882, -0.03512954339385033, -0.05584804341197014, 0.009383629076182842, -0.0028270287439227104, 0.018547140061855316, -0.00041131346370093524, 0.023938624188303947, 0.025929881259799004, 0.007482682354748249, -0.06673336774110794, 0.03820985183119774, 0.0336277037858963, -0.01163177564740181, 0.007043639663606882, 0.00015354802599176764, 0.013024006970226765, 0.0006042681634426117, 0.002335436875000596, 0.022654781118035316, 0.01068377960473299, -0.009878498502075672, 0.014841626398265362, -0.04956468567252159, -0.051387399435043335, 0.001990662422031164, 0.050393227487802505, 0.0034050731919705868, 0.018832949921488762, 0.017221804708242416, 0.059626635164022446, 0.024098988622426987, 0.0210551917552948, -0.0000986100421869196, 0.03241771459579468, 0.08080161362886429, -0.01444263756275177, 0.04660440981388092, 0.029113175347447395, -0.006232662592083216, -0.0042810156010091305, 0.0002728025719989091, -0.038583822548389435, 0.0074462322518229485, -0.00416596420109272, 0.003090399084612727, -0.01657310500741005, -0.043085068464279175, 0.022889848798513412, 0.042357005178928375, 0.03886140510439873, 0.028614897280931473, -0.017467105761170387, 0.048134658485651016, 0.022063804790377617, 0.021752752363681793, 0.05284479260444641, 0.023679764941334724, 0.005131968762725592, 0.0380338691174984, 0.05007569491863251, 0.004580176901072264, 0.05976225808262825, -0.007251892238855362, 0.026189977303147316, -0.00314137595705688, -0.012640816159546375, -0.05725197494029999, -0.010752505622804165, -0.06936336308717728, 0.014316922053694725, 0.017350032925605774, -0.0028471872210502625, -0.03397118300199509, -0.006617867387831211, 0.009127938188612461, 0.009771419689059258, -0.010004112496972084, 0.0020436225458979607, -0.003102125134319067, 0.04992125928401947, -0.010125801898539066, -0.012980086728930473, 0.024622643366456032, -0.023213110864162445, 0.03979823738336563, 0.013883104547858238, -0.00929493922740221, -0.0013325042091310024, -0.008657951839268208, 0.022518251091241837, -0.0021441252902150154, 0.03386261686682701, 0.013241801410913467, -0.02094799466431141, 0.026618683710694313, 0.03921759873628616, -0.0007036263705231249, 0.03504130616784096, 0.047777678817510605, 0.014691321179270744, -0.061105549335479736, 0.021140335127711296, 0.0018269028514623642, -0.0402553528547287, 0.013099607080221176, -0.04006500914692879, 0.023037279024720192, -0.00588452210649848, 0.0038831490091979504, -0.010837712325155735, 0.036519378423690796, -0.009311627596616745, -0.05337223410606384, -0.015637045726180077, 0.0056010023690760136, -0.003884466364979744, 0.022609608247876167, 0.029891133308410645, -0.03390979394316673, 0.009983175434172153, -0.007753817830234766, 0.048868078738451004, 0.012917201034724712, -0.00378388911485672, 0.06648601591587067, -0.029123475775122643, -0.010293642058968544, 0.013885211199522018, 0.03244130685925484, 0.00761097576469183, 0.02209845744073391, -0.006280126981437206, -0.014300079084932804, -0.010405132547020912, -0.013080483302474022, -0.011949562467634678, -0.03816116973757744, -0.026668554171919823, -0.016393527388572693, -0.05918927863240242, -0.01197146251797676, 0.026171792298555374, -0.0027453533839434385, 0.02413545362651348, -0.05634359270334244, 0.01921306923031807, -0.03503740578889847, -0.00572248874232173, 0.005181841552257538, 0.0019116755574941635, 0.04024988412857056, 0.041030753403902054, 0.020714718848466873, -0.021473659202456474, -0.009082566015422344, 0.008951363153755665, -0.01800534687936306, -0.0017728512175381184, 0.05127972364425659, 0.01672189310193062, 0.012456078082323074, -0.08318866044282913, -0.028331022709608078, 0.05315301939845085, -0.029735667631030083, 0.0356982946395874, -0.018730590119957924, 0.00912912841886282, -0.07395283132791519, -0.00016186924767680466, 0.051739320158958435, 0.013336141593754292, 0.04148729145526886, -0.019162915647029877, -0.014258114621043205, 0.034830380231142044, -0.03725405037403107, -0.02754465863108635, 0.017091205343604088, 0.002288487274199724, -0.007693402003496885, 0.011960811913013458, -0.011264365166425705, 0.029321689158678055, -0.012839527800679207, -0.018665125593543053, 0.005168729927390814, -0.0007740175351500511, -0.03936123475432396, -0.012408219277858734, -0.00901120901107788, 0.028506748378276825, 0.012713305652141571, -0.025390515103936195, 0.03218414634466171, 0.006165959872305393, -0.035536911338567734, -0.00021619259496219456, -0.01606125198304653, 0.005377375055104494, 0.02600850723683834, 0.015620472840964794, -0.018271062523126602, 0.055672504007816315, 0.016859550029039383, -0.038855891674757004, -0.0047129979357123375, -0.005417000502347946 ]
Hugging Face on PyTorch / XLA TPUs
jysohn23
February 9, 2021
pytorch-xla
open-source-collab
https://huggingface.co/blog/pytorch-xla
Performance Benchmarking The following table shows the performance of training bert-large-uncased on a v3-8 Cloud TPU system (containing 4 TPU v3 chips) running PyTorch / XLA. The dataset used for all benchmarking measurements is the WikiText103 dataset, and we use the run_mlm.py script provided in Hugging Face examples. To ensure that the workloads are not host-CPU-bound, we use the n1-standard-96 CPU configuration for these tests, but you may be able to use smaller configurations as well without impacting performance. | Name | Dataset | Hardware | Global Batch Size | Precision | Training Time (mins) | |--------------------|-------------|---------------------------|-------------------|-----------|----------------------| | bert-large-uncased | WikiText103 | 4 TPUv3 chips (i.e. v3-8) | 64 | FP32 | 178.4 | | bert-large-uncased | WikiText103 | 4 TPUv3 chips (i.e. v3-8) | 128 | BF16 | 106.4 |
[ -0.035345107316970825, 0.011655363254249096, -0.010981375351548195, 0.017009181901812553, -0.036879610270261765, 0.040825966745615005, -0.01465697307139635, 0.05900841951370239, -0.057534582912921906, -0.0495605431497097, -0.012565904296934605, 0.04350418969988823, -0.01921381987631321, -0.007918029092252254, 0.015866795554757118, -0.03414052352309227, 0.04671584069728851, 0.03687360882759094, -0.02807099185883999, -0.009226998314261436, 0.018473360687494278, -0.04396352171897888, 0.09919752925634384, 0.011117640882730484, 0.008052006363868713, -0.024233998730778694, 0.013906547799706459, -0.018568579107522964, -0.02794155292212963, -0.020653432235121727, -0.09934387356042862, 0.017613355070352554, 0.04539238661527634, -0.03916303068399429, 0.02122335135936737, -0.0031986564863473177, -0.02533159963786602, 0.12233342975378036, 0.009256628341972828, -0.004404531326144934, 0.02144578844308853, -0.01098158024251461, -0.04014058783650398, 0.07614968717098236, 0.022095831111073494, 0.001154236844740808, -0.061833906918764114, 0.049425557255744934, -0.01973341777920723, 0.010105879977345467, -0.07952538132667542, 0.03641211614012718, 0.015959490090608597, -0.006805695127695799, 0.08834100514650345, 0.07141411304473877, -0.0033881128765642643, -0.09057484567165375, 0.027455441653728485, 0.008113567717373371, 0.01782795786857605, -0.023890063166618347, -0.0028621163219213486, -0.008058399893343449, 0.02539227530360222, -0.012377417646348476, 0.003992769401520491, 0.026321953162550926, -0.05007181689143181, -0.002918558195233345, -0.01098026242107153, 0.01746109127998352, 0.014483547769486904, -0.01537336315959692, -0.030660293996334076, -0.015167973935604095, 0.013814829289913177, -0.012099380604922771, 0.04067721962928772, 0.028566090390086174, -0.02123436890542507, 0.022380508482456207, -0.03794930502772331, 0.0625249445438385, 0.015942763537168503, 0.01883433572947979, 0.038555897772312164, -0.05736787989735603, -0.0523107647895813, 0.051290929317474365, -0.006282845977693796, -0.019909614697098732, 0.05527190491557121, 0.01307173166424036, -0.02113242819905281, -0.015030956827104092, -0.06199045851826668, -0.009526261128485203, -0.02998996153473854, -0.024009214714169502, 0.03679897263646126, -0.08240038901567459, 0.014320885762572289, -0.02804349735379219, -0.04863522946834564, 0.06526032090187073, -0.05035429447889328, -0.0987469032406807, -0.011923523619771004, 0.01000135950744152, -0.031025446951389313, -0.03439783677458763, -0.015755265951156616, 0.07953541725873947, -0.06484522670507431, 0.018109126016497612, -0.010763229802250862, -0.001909075421281159, 0.024647070094943047, -0.008113785646855831, -0.02245156094431877, 0.08850543946027756, 0.03484614938497543, -0.10250595957040787, 0.007673303131014109, 0.05974625423550606, -0.0007779431762173772, 0.017134247347712517, 0.1079556792974472, -0.014409370720386505, 0.06790349632501602, 0.002310271840542555, 0.09437689185142517, 0.0006070723757147789, 0.023965418338775635, 0.020143819972872734, -0.01838468573987484, -0.03288155049085617, -0.02462952211499214, -0.01548691838979721, -0.027576876804232597, 0.08527890592813492, -0.005180434789508581, -0.0013129324652254581, 0.007808101363480091, -0.00845398847013712, -0.0630633607506752, 0.05922042578458786, -0.023460157215595245, -0.028770918026566505, -0.14127610623836517, 0.05226374417543411, -0.0410999096930027, 0.031287215650081635, 0.06573432683944702, 0.07982216030359268, 0.0014746322995051742, -0.09562211483716965, -0.10307657718658447, -0.03413127735257149, -0.053797367960214615, 0.03490964323282242, -0.012108469381928444, -0.024999072775244713, 0.0517665334045887, -0.013106941245496273, 0.055508263409137726, -0.013370227999985218, -0.058233171701431274, 0.038961853832006454, -0.02335911989212036, -0.013848676346242428, 0.06982386857271194, 0.013970460742712021, 0.006775180343538523, 0.005733630619943142, 0.017277268692851067, 0.021210625767707825, -0.033609677106142044, -0.05694079026579857, -0.040787022560834885, 0.03514306619763374, 0.01320382859557867, 0.06684102863073349, -0.015500577166676521, -0.056645333766937256, 0.061095401644706726, -0.03666313737630844, -0.041326239705085754, 0.07764412462711334, -0.0064086937345564365, -0.044680893421173096, 0.08320768922567368, -0.044071462005376816, 0.03092285804450512, 0.008145494386553764, 0.025538122281432152, 0.05655725672841072, 0.031454261392354965, -0.04032023623585701, 0.023549320176243782, 0.02644902653992176, 0.016402550041675568, -0.05312478914856911, -0.06474084407091141, -0.02132989466190338, -0.002999336924403906, -0.0671500414609909, -0.004802822135388851, 0.009117662906646729, 0.0005064161377958953, -0.14099116623401642, -0.026896627619862556, -0.04584278166294098, -0.02521270513534546, -0.10106781870126724, -0.025272421538829803, -0.008191809989511967, 0.0898435041308403, -0.007948477752506733, 0.15358813107013702, -0.020385034382343292, -0.00010228665632894263, -0.022174416109919548, -0.05588459223508835, 0.01573524810373783, -0.013124815188348293, 0.055382490158081055, 0.06325756758451462, -0.08619444072246552, -0.044862307608127594, -0.11858160048723221, -0.02667507715523243, 0.07642899453639984, -0.06061137095093727, -0.08951085805892944, 0.0447135828435421, 0.010099394246935844, 0.015476588159799576, -0.07186877727508545, -0.06256426125764847, 0.022531455382704735, 0.007412903476506472, 0.07177627086639404, 0.009505252353847027, -0.01815502531826496, -0.0065221963450312614, -0.005439233500510454, -0.034252557903528214, 0.008264400064945221, -0.10977230221033096, 0.031499143689870834, -0.023091131821274757, -0.0070676254108548164, 0.036552462726831436, 0.035687435418367386, -0.04886457696557045, -0.01071023941040039, -0.061714887619018555, 0.03888703137636185, -0.0068117352202534676, 0.013698970898985863, -0.06656071543693542, -0.011232379823923111, 0.020142463967204094, -0.033620256930589676, -0.0015471943188458681, -0.025680003687739372, 0.03603707626461983, -0.008644846267998219, 0.009363939985632896, -0.0540165938436985, 0.011616433039307594, -0.011901084333658218, 0.03800460696220398, 0.04929864779114723, 0.03180821239948273, -0.05454991012811661, -0.05759499594569206, -0.012185284867882729, 0.013139916583895683, -0.029365837574005127, 0.06857838481664658, -0.005949040409177542, -0.020873047411441803, 0.028416333720088005, 0.017006976529955864, -0.03861183673143387, 0.011827726848423481, -0.027659114450216293, -0.0011346390238031745, 0.06403128802776337, -0.0012327064760029316, -0.034042347222566605, 0.04517402872443199, 0.018906431272625923, -0.02458321675658226, -0.005854200571775436, -0.013088153675198555, 0.000380695826606825, -0.028644826263189316, 0.0130200469866395, -0.055149734020233154, -0.014118313789367676, -0.0061429571360349655, 0.004156487062573433, 0.008533021435141563, 0.03477931395173073, -0.0747491791844368, 0.04965401813387871, 0.0006988969398662448, 0.056319333612918854, -0.020685400813817978, -0.003576478222385049, 0.04348992928862572, 0.012276304885745049, 0.010048133321106434, 0.07654240727424622, 0.03465484082698822, -0.011042025871574879, 0.022573357447981834, -0.014460365287959576, 0.00520076509565115, 0.014924157410860062, 0.009883497841656208, -0.024265890941023827, 0.0357024110853672, -0.001695769838988781, -0.007480834145098925, -0.017760444432497025, 0.015218401327729225, 0.032948970794677734, -0.01587531901896, 0.06477846205234528, 0.006974403280764818, -0.005394136533141136, 0.050370316952466965, -0.04251895472407341, 0.00537860207259655, -0.05818973109126091, -0.020158277824521065, 0.013122745789587498, -0.026600314304232597, -0.023428456857800484, -0.023899339139461517, 0.03265881538391113, 0.01448142435401678, 0.04557101055979729, 0.030032703652977943, 0.01452353224158287, 0.023804059252142906, -0.008144867606461048, 0.05553706735372543, 0.02301499992609024, -0.0072453683242201805, -0.016284512355923653, -0.0026501237880438566, -0.02216573990881443, -0.019389387220144272, 0.0013792527606710792, -0.02916790544986725, 0.030848195776343346, -0.0017715163994580507, -0.03138803318142891, -0.0031260508112609386, 0.019548097625374794, -0.0019418218871578574, -0.03610854968428612, -0.036036569625139236, 0.015742994844913483, 0.00813548918813467, -0.006867558695375919, -0.022463977336883545, 0.008043618872761726, 0.021351955831050873, -0.0016106045804917812, -0.03875180333852768, 0.001675802981480956, 0.00873122364282608, 0.009290678426623344, -0.016230354085564613, 0.006265193689614534, -0.03439047932624817, 0.015234558843076229, -0.01904965564608574, -0.019500313326716423, 0.058920711278915405, 0.03873025253415108, -0.05101139470934868, 0.014931298792362213, -0.06614459306001663, -0.015274209901690483, 0.02244696393609047, 0.03243912383913994, 0.02176424115896225, -0.03054032102227211, 0.007639051415026188, 0.04136665165424347, 0.010660920292139053, -0.001644302741624415, -0.019673822447657585, 0.020283838734030724, -0.005714982748031616, -0.030970579013228416, 0.050292566418647766, 0.035341739654541016, -0.062188614159822464, 0.0419197641313076, 0.028320569545030594, -0.031190454959869385, 0.00946279987692833, -0.02691350132226944, -0.019457463175058365, 0.05237037315964699, -0.020868463441729546, -0.030555283650755882, 0.005776271224021912, -0.004023449961096048, 0.0034088236279785633, -0.015085138380527496, 0.014861621893942356, -0.015173327177762985, 0.05338422954082489, 0.051919303834438324, 0.015214175917208195, -0.009412684477865696, -0.0015578627353534102, 0.03411538153886795, -0.015810109674930573, 0.043011534959077835, 0.0015572468983009458, -0.0018103902693837881, 0.01937631145119667, 0.009596317075192928, 0.0026656545232981443, 0.016087206080555916, 0.014703962020576, -0.04546395316720009, -0.049277786165475845, -0.012899274937808514, 0.028726106509566307, 0.043042249977588654, -0.012527406215667725, -0.0027568982914090157, -0.0027123335748910904, -0.016610199585556984, 0.0002574832469690591, -0.04723886772990227, 0.02219974994659424, 0.02889234386384487, 0.00353115308098495, -0.02502387948334217, 0.051463864743709564, 0.009172795340418816, -0.03761871159076691, -0.030567670240998268, -0.040522560477256775, 0.016049323603510857, 0.02580471709370613, 0.01991012878715992, -0.0439550057053566, -0.012993854470551014, 0.06072908639907837, 0.0015851623611524701, 0.002822066657245159, 0.028218088671565056, 0.012515051290392876, 0.07820743322372437, -0.0023637041449546814, -0.0017959031974896789, 0.0010016534943133593, -0.028158484026789665, 0.017776204273104668, 0.0031138826161623, 0.016610154882073402, -0.016638776287436485, 0.005804144777357578, -0.011528448201715946, 0.018144071102142334, -0.03537428751587868, -0.021364901214838028, -0.026104504242539406, 0.003550467314198613, 0.025042874738574028, -0.010658792220056057, -0.02164795808494091, 0.026932770386338234, 0.02695797197520733, -0.013246028684079647, -0.03837191313505173, 0.022207168862223625, -0.027060341089963913, 0.013437624089419842, 0.03709910437464714, 0.02342066913843155, 0.056399110704660416, -0.004226941615343094, 0.029666155576705933, -0.014643260277807713, -0.002872323850169778, 0.029378574341535568, -0.019092030823230743, 0.02937338873744011, 0.001620679278858006, -0.002058538608253002, 0.04435049369931221, 0.020659450441598892, -0.010971651412546635, -0.015936410054564476, 0.05290188267827034, -0.013521190732717514, -0.01804882287979126, 0.057723160833120346, 0.00761060556396842, -0.017083721235394478, 0.005361863877624273, 0.010734467767179012, -0.05983218550682068, -0.04326973110437393, 0.042271122336387634, -0.008735498413443565, -0.003459501313045621, 0.016269482672214508, -0.027917280793190002, -0.025062978267669678, 0.045793309807777405, 0.057244736701250076, -0.005907880607992411, -0.020962277427315712, 0.012473740614950657, -0.03227072209119797, -0.016384867951273918, -0.016964422538876534, -0.02656361646950245, 0.02971556968986988, -0.02604886330664158, 0.020548228174448013, 0.022751441225409508, 0.0010833017295226455, 0.014276698231697083, -0.021117031574249268, 0.03738223388791084, 0.02062048949301243, 0.0024752311874181032, 0.020256085321307182, 0.006149645894765854, 0.011616077274084091, -0.041460070759058, -0.037427354604005814, 0.019897336140275, -0.028899122029542923, 0.016361363232135773, -0.048818740993738174, 0.04268340766429901, 0.0962660163640976, 0.019363589584827423, -0.0030927665065973997, -0.019526809453964233, -0.014946263283491135, 0.005842755548655987, -0.030126269906759262, -0.04946678504347801, -0.0018379944376647472, -0.022714395076036453, 0.00903894379734993, 0.016243068501353264, 0.0020204507745802402, 0.059714172035455704, -0.0147340577095747, -0.04620067775249481, 0.05112256109714508, 0.03232002630829811, -0.042313624173402786, 0.04536493122577667, -0.015204536728560925, -0.011792181059718132, -0.002032250864431262, -0.0017362624639645219, -0.0194346122443676, 0.012305891141295433, -0.015145274810492992, 0.0014810145366936922, -0.02293696440756321, 0.030040718615055084, -0.01728026568889618, 0.035787537693977356, -0.005478051956743002, 0.013181901536881924, 0.007501126267015934, 0.044913399964571, 0.04977196827530861, -0.0014200408477336168, -0.03190118074417114, -0.014129824936389923, 0.051724646240472794, -0.01978733204305172, 0.031939439475536346, 0.04330142214894295, -0.028572512790560722, 0.0028436623979359865, -0.029312700033187866, -0.039169393479824066, -0.004998570308089256, -0.03312553092837334, -0.009211618453264236, -0.02403279021382332, 0.0019743817392736673, -0.006520885042846203, 0.015820197761058807, 0.005330683197826147, 0.046103913336992264, -0.004642391111701727, 0.05149710178375244, -0.0163783747702837, -0.002909956034272909, -0.008865277282893658, -0.0034940880723297596, 0.02436929941177368, -0.019624140113592148, 0.04523875191807747, 0.02539331279695034, 0.057143568992614746, 0.028170270845294, -0.019321640953421593, 0.020527644082903862, -0.06012067571282387, -0.0351300947368145, 0.034188106656074524, -0.019244717434048653, 0.031663697212934494, -0.013084682635962963, 0.02325565740466118, -0.007220937870442867, -0.0032218126580119133, 0.00014522744459100068, -0.035989709198474884, 0.0252602007240057, 0.024151377379894257, -0.0017870118608698249, 0.042028043419122696, -0.0013375503476709127, -0.056668199598789215, 0.03248821198940277, -0.017734389752149582, 0.0017418748466297984, 0.05200904607772827, -0.03825901821255684, -0.0035791974514722824, 0.034169428050518036, 0.02645980566740036, -0.03900463134050369, 0.058964818716049194, 0.014844585210084915, -0.010576982982456684, 0.021324397996068, 0.011493685655295849, -0.023399872705340385, 0.003982039634138346, 0.012440074235200882, 0.009650209918618202, -0.018842173740267754, 0.017631877213716507, -0.014695311896502972, -0.05310558155179024, 0.020027311518788338, -0.00719723105430603, -0.006747645325958729, -0.0034606996923685074, 0.06184643879532814, 0.02065754495561123, 0.05735957995057106, 0.01983542926609516, -0.024425722658634186, -0.01967344991862774, 0.005228647496551275, -0.04701114818453789, 0.04608730226755142, 0.03496762737631798, -0.004736344795674086, -0.005276184529066086, -0.045680370181798935, 0.029477419331669807, -0.022923016920685768, 0.027929464355111122, 0.034735970199108124, -0.022822508588433266, -0.03366539627313614, -0.027364348992705345, 0.0002678500022739172, 0.030722863972187042, 0.01083661150187254, 0.01356437150388956, -0.022586258128285408, -0.008267801254987717, -0.01901637762784958, -0.00792710017412901, -0.035358112305402756, -0.03833235055208206, -0.008086980320513248, -0.01325941551476717, -0.01581423357129097, 0.014122317545115948, -0.027037985622882843, 0.0369420126080513, -0.03724110871553421, 0.0018273750320076942, 0.00178184499964118, -0.005629210267215967, 0.007448708172887564, -0.007714283652603626, 0.04895741492509842, 0.053017426282167435, 0.014885771088302135, 0.0015991623513400555, -0.030670076608657837, 0.014276332221925259, -0.01796213537454605, 0.009709827601909637, 0.03584874048829079, 0.05330097675323486, -0.024523571133613586, -0.040440887212753296, -0.0025881140027195215, 0.056067537516355515, -0.018133031204342842, 0.010649725794792175, 0.030359825119376183, 0.013278363272547722, -0.04060545191168785, 0.006517972331494093, 0.07835853844881058, -0.01519534271210432, 0.07734068483114243, 0.011474316008388996, 0.007889430969953537, 0.03175950050354004, -0.008821511641144753, -0.0733228251338005, -0.02652912400662899, 0.018055392429232597, -0.007210589945316315, 0.0526900477707386, -0.0306219682097435, 0.05605827271938324, 0.01399398036301136, -0.015499267727136612, -0.007647635880857706, 0.006295295897871256, -0.04977210611104965, -0.0017337350873276591, -0.014220221899449825, 0.020097825676202774, -0.01053330022841692, -0.013916503638029099, 0.05897750332951546, 0.0034251492470502853, 0.029803553596138954, -0.011630282737314701, -0.01784396730363369, -0.017957858741283417, 0.004675794392824173, -0.020593347027897835, -0.04473045468330383, -0.014749188907444477, 0.027393309399485588, 0.022309789434075356, 0.022180134430527687, 0.022930555045604706 ]
Hugging Face on PyTorch / XLA TPUs
jysohn23
February 9, 2021
pytorch-xla
open-source-collab
https://huggingface.co/blog/pytorch-xla
PyTorch / XLA Tensors are Lazy Using XLA tensors and devices requires changing only a few lines of code. However, even though XLA tensors act a lot like CPU and CUDA tensors, their internals are different. CPU and CUDA tensors launch operations immediately or eagerly. XLA tensors, on the other hand, are lazy. They record operations in a graph until the results are needed. Deferring execution like this lets XLA optimize it. A graph of multiple separate operations might be fused into a single optimized operation. Lazy execution is generally invisible to the caller. PyTorch / XLA automatically constructs the graphs, sends them to XLA devices, and synchronizes when copying data between an XLA device and the CPU. Inserting a barrier when taking an optimizer step explicitly synchronizes the CPU and the XLA device. This means that when you call model(input) forward pass, calculate your loss loss.backward(), and take an optimization step xm.optimizer_step(optimizer), the graph of all operations is being built in the background. Only when you either explicitly evaluate the tensor (ex. Printing the tensor or moving it to a CPU device) or mark a step (this will be done by the MpDeviceLoader everytime you iterate through it), does the full step get executed.
[ 0.04149140790104866, 0.00729152699932456, 0.032243747264146805, 0.015169627964496613, -0.008354744873940945, -0.029656672850251198, 0.01311985868960619, -0.004698788747191429, -0.005189518444240093, -0.009357594884932041, 0.017839187756180763, 0.07571660727262497, 0.012339569628238678, 0.05906037986278534, 0.006187073420733213, -0.0018588374368846416, 0.10020851343870163, -0.07180187106132507, 0.029258999973535538, 0.0751524344086647, 0.09092430025339127, -0.020329348742961884, 0.033542562276124954, 0.005630851723253727, -0.06445800513029099, -0.06737983226776123, -0.019863180816173553, 0.006522280164062977, -0.02968927100300789, 0.019757671281695366, -0.04656609892845154, 0.004335729405283928, 0.05570510774850845, -0.035604242235422134, 0.0016965983668342233, 0.011649214662611485, -0.05503344535827637, 0.06333687901496887, 0.06962594389915466, -0.04524710401892662, 0.034689053893089294, 0.0071032121777534485, -0.09542001783847809, 0.036207400262355804, 0.009909161366522312, -0.009928946383297443, -0.11400076746940613, 0.013939226977527142, -0.025013338774442673, 0.03000151365995407, -0.1199321448802948, 0.003829361405223608, -0.024330999702215195, 0.011803061701357365, -0.011855742894113064, 0.06184009835124016, -0.041285883635282516, 0.013276836834847927, -0.002141381148248911, -0.011115269735455513, 0.0499037504196167, 0.06499655544757843, -0.004123828839510679, 0.050513338297605515, 0.015024673193693161, -0.03837503492832184, 0.03045128658413887, 0.014632008038461208, -0.050693050026893616, -0.08906518667936325, -0.007960958406329155, -0.0074902866035699844, 0.02663658931851387, 0.0243927501142025, -0.0010939283529296517, -0.05645035207271576, -0.034374769777059555, -0.017396235838532448, 0.07832177728414536, 0.03065519779920578, 0.02718489244580269, 0.057778991758823395, 0.02868494763970375, 0.05541804060339928, 0.016542017459869385, -0.004999126307666302, 0.03093845769762993, -0.02450806275010109, -0.018840914592146873, 0.022760624065995216, 0.003219044767320156, -0.10732446610927582, 0.04022310674190521, 0.009457523934543133, -0.011148182675242424, 0.009477222338318825, -0.005579487420618534, 0.04390719160437584, -0.026863565668463707, -0.0006073223776184022, -0.0031980827916413546, -0.11018595099449158, 0.016382813453674316, 0.015249752439558506, -0.05045977979898453, 0.035420745611190796, -0.043446026742458344, -0.058983106166124344, -0.014913615770637989, 0.029327161610126495, -0.05540153384208679, 0.06735711544752121, -0.037154391407966614, -0.005285242572426796, -0.0717446506023407, -0.06143009662628174, -0.008125346153974533, -0.00042582032619975507, -0.0444183349609375, -0.027738280594348907, -0.001386432908475399, 0.10768913477659225, 0.07957802712917328, 0.03321538120508194, 0.02999059297144413, 0.07140380889177322, 0.022755848243832588, -0.018106764182448387, 0.070774145424366, -0.08775483071804047, 0.04379672929644585, 0.026111789047718048, 0.07614833116531372, 0.012313168495893478, 0.06837064027786255, -0.0613182932138443, 0.019026216119527817, -0.004193803295493126, -0.02215573377907276, -0.09037093818187714, -0.10581233352422714, 0.018060937523841858, 0.07531698048114777, -0.032369464635849, 0.004985864274203777, -0.05101154372096062, -0.026697559282183647, 0.028644315898418427, 0.028167912736535072, -0.006715976167470217, -0.11723700910806656, -0.012261941097676754, -0.06164168938994408, -0.02803567610681057, 0.013730501756072044, -0.0074524530209600925, -0.026553859934210777, -0.047491442412137985, -0.07535377144813538, -0.027079952880740166, -0.019465157762169838, 0.04408729821443558, -0.0035368860699236393, -0.02915160544216633, 0.026594005525112152, 0.05624843016266823, 0.09855465590953827, -0.04422583803534508, 0.03025788441300392, 0.03114800900220871, -0.0036237549502402544, -0.02479451149702072, 0.017397288233041763, 0.0030244875233620405, 0.015224436298012733, 0.07772582024335861, -0.027979552745819092, 0.03325679525732994, -0.0012762494152411819, 0.012073337100446224, -0.03373308479785919, 0.012751263566315174, -0.07428133487701416, 0.08064937591552734, 0.011754784733057022, -0.0008809510036371648, 0.029726732522249222, -0.08776567876338959, -0.026890266686677933, 0.05398117005825043, -0.0803416520357132, 0.02673063986003399, 0.05203050747513771, -0.09295704960823059, 0.023673253133893013, -0.08315914869308472, -0.06665173918008804, 0.05763661861419678, -0.026844125241041183, -0.042100608348846436, 0.043862249702215195, -0.012437131255865097, -0.06514697521924973, -0.0420328788459301, 0.008563912473618984, -0.008592603728175163, 0.02900083176791668, -0.05959022045135498, 0.03244180232286453, 0.01366471592336893, -0.016852375119924545, -0.0711376741528511, 0.021918173879384995, -0.06580153107643127, 0.0006424001767300069, -0.008402969688177109, 0.028770852833986282, -0.0006950021488592029, -0.012674323283135891, 0.0037765561137348413, 0.12175681442022324, -0.11265841126441956, 0.016705267131328583, 0.02161962166428566, -0.012801057659089565, 0.03703407570719719, 0.02749248407781124, 0.018621040508151054, 0.002399408258497715, -0.04948513209819794, -0.007031288463622332, -0.10127611458301544, -0.017174897715449333, 0.09277856349945068, 0.011676815338432789, -0.06165825575590134, -0.06440941989421844, 0.0750575065612793, 0.06586369127035141, -0.05188332498073578, 0.015699263662099838, 0.06278068572282791, -0.0661868304014206, 0.014208738692104816, -0.01676737703382969, -0.05154694244265556, 0.04281878098845482, -0.009142990224063396, -0.06449944525957108, -0.005204983055591583, -0.05505172163248062, -0.0006717557553201914, 0.0282664243131876, -0.023161577060818672, 0.016107287257909775, 0.05215679854154587, -0.0006159735494293272, -0.039611730724573135, -0.015194782055914402, 0.032609641551971436, 0.007582898251712322, -0.01644725725054741, -0.053169135004282, -0.04285996034741402, 0.003495085285976529, -0.012453935109078884, 0.01809839904308319, -0.0044214618392288685, 0.007641240954399109, 0.012891339138150215, 0.019877731800079346, -0.06479203701019287, 0.009549313224852085, -0.0534018911421299, 0.006727169267833233, 0.023585781455039978, 0.018226031213998795, -0.0218949094414711, -0.02883874997496605, -0.0018885276513174176, 0.023610834032297134, 0.029383940622210503, 0.04756079986691475, 0.011275975964963436, -0.026087049394845963, 0.01359452772885561, 0.03198752552270889, 0.04630579799413681, -0.043187256902456284, 0.013791082426905632, -0.009558161720633507, 0.014229772612452507, -0.02710765413939953, -0.05891037359833717, -0.006218456197530031, 0.04171159863471985, -0.03250271826982498, -0.02536189556121826, 0.027451924979686737, 0.03285301476716995, -0.06367938220500946, -0.003558795666322112, -0.013972774147987366, -0.039210058748722076, -0.04169437289237976, -0.004590591881424189, 0.012819626368582249, 0.0044618104584515095, -0.08763598650693893, 0.012923136353492737, 0.008621863089501858, -0.006206458900123835, -0.027000712230801582, -0.016241122037172318, -0.02270582877099514, 0.04390021413564682, 0.03848893195390701, 0.009119332768023014, 0.024259967729449272, -0.01643909327685833, -0.019905315712094307, -0.0016795609844848514, -0.008283968083560467, 0.017474377527832985, 0.0417606420814991, 0.006344989873468876, 0.027765480801463127, 0.003139659995213151, 0.035069968551397324, 0.03467307612299919, -0.016923783347010612, -0.009502850472927094, -0.039890043437480927, 0.04589986056089401, -0.0009354644571430981, 0.037327058613300323, 0.008070255629718304, -0.03101758286356926, -0.051715198904275894, -0.03947872668504715, -0.01037931814789772, -0.021013207733631134, -0.01268706563860178, 0.0012877866392955184, 0.01456332765519619, -0.02522370219230652, 0.04044792801141739, 0.04815024510025978, 0.015246679075062275, 0.010764703154563904, 0.009565180167555809, -0.03043890930712223, 0.026816831901669502, 0.0019305044552311301, 0.011473827995359898, -0.036283478140830994, 0.029381925240159035, -0.019562166184186935, -0.01946479082107544, 0.0007764092297293246, 0.00820369366556406, 0.01236253883689642, -0.0003312690823804587, -0.04514540359377861, -0.01858643628656864, 0.02873978577554226, 0.0466708242893219, 0.023651186376810074, -0.03809548541903496, -0.010036014020442963, 0.0056057218462228775, 0.02260460890829563, -0.010313604958355427, 0.010063395835459232, 0.07040227949619293, -0.005915618035942316, -0.02836933359503746, 0.01181286945939064, -0.04858962073922157, 0.00751580111682415, 0.046454306691884995, 0.003851409303024411, 0.016368569806218147, 0.004874041769653559, -0.015143496915698051, -0.020021952688694, 0.03086230531334877, -0.017362277954816818, -0.01458022277802229, -0.06436274200677872, 0.007422077935189009, -0.020762015134096146, 0.004784550052136183, 0.006187219172716141, -0.004534733481705189, -0.04950603097677231, 0.02900458313524723, 0.052284207195043564, 0.021052706986665726, -0.016474509611725807, 0.006873385515064001, -0.03241809457540512, -0.0487687774002552, -0.024371976032853127, -0.009627687744796276, 0.029083866626024246, 0.030935632064938545, -0.0016984130488708615, -0.0010240761330351233, -0.062263138592243195, 0.009377616457641125, 0.01956167444586754, 0.01112471241503954, 0.019995152950286865, -0.012943515554070473, -0.01841314323246479, 0.03480438515543938, 0.024704748764634132, -0.03126084804534912, 0.01962670125067234, 0.01289953663945198, 0.023999128490686417, 0.06668024510145187, 0.019269490614533424, 0.0284359622746706, -0.025616861879825592, 0.05002528801560402, 0.007231429684907198, -0.03139927610754967, 0.03365422785282135, 0.011245723813772202, -0.007055381312966347, 0.006226546596735716, -0.007772546727210283, -0.012695756740868092, -0.008571166545152664, 0.01596781238913536, -0.006561061833053827, -0.04825311526656151, -0.018381157889962196, 0.007569677662104368, -0.009619738906621933, -0.05976073816418648, 0.0061622243374586105, -0.011171852238476276, 0.027944359928369522, 0.001532903639599681, -0.05787098407745361, -0.014840491116046906, 0.03260352090001106, 0.006977412384003401, -0.056072529405355453, 0.031421761959791183, 0.04007218778133392, -0.06361186504364014, 0.03902479261159897, -0.06162780150771141, 0.03876745328307152, 0.051483154296875, 0.008422321639955044, -0.04610130563378334, 0.07334128767251968, 0.04300342872738838, 0.04351083189249039, 0.045398909598588943, -0.007701606024056673, 0.020865533500909805, 0.06790050864219666, 0.02460915967822075, -0.001416111714206636, -0.026392964646220207, -0.02957388013601303, 0.03828023001551628, -0.022621197625994682, -0.03824647516012192, -0.047258760780096054, 0.03152906894683838, -0.0039092544466257095, -0.0345766618847847, 0.00005026591679779813, 0.0059656803496181965, -0.059252575039863586, 0.0410553440451622, 0.0025520387571305037, -0.022455604746937752, 0.000430582178523764, 0.02232290431857109, 0.03502998873591423, 0.03163214772939682, 0.018230542540550232, 0.0707501620054245, -0.02262755297124386, -0.005245838314294815, -0.0016851347172632813, 0.014166012406349182, 0.031552333384752274, 0.031725507229566574, 0.031198890879750252, 0.017297029495239258, -0.00019687834719661623, -0.013086576014757156, -0.03657727316021919, 0.013731502927839756, -0.004887997172772884, -0.020634567365050316, 0.015903152525424957, -0.017080560326576233, -0.014841057360172272, 0.04588491842150688, 0.025888759642839432, 0.007575417403131723, -0.023812437430024147, 0.041807662695646286, 0.022857388481497765, -0.018866008147597313, -0.030266672372817993, 0.016068503260612488, -0.01980646327137947, 0.026781609281897545, 0.0034575110767036676, 0.022418232634663582, 0.018296437337994576, 0.03058529645204544, -0.023559127002954483, -0.06277837604284286, 0.054417211562395096, 0.004733474925160408, 0.03525044396519661, 0.02209259383380413, 0.0178268700838089, -0.02387434057891369, 0.009129572659730911, 0.006100005935877562, -0.014624291099607944, -0.007121139205992222, 0.00019705072918441147, 0.02158307284116745, 0.018433157354593277, 0.04044868424534798, 0.030712205916643143, -0.029622701928019524, -0.018176496028900146, 0.034706562757492065, 0.03339938446879387, 0.020778892561793327, 0.0029412941075861454, 0.030277196317911148, -0.0324283093214035, -0.053705886006355286, 0.015765970572829247, -0.05718895047903061, 0.06724126636981964, 0.019258569926023483, 0.0401742123067379, 0.05486901104450226, -0.053422052413225174, 0.0033557736314833164, -0.01221957802772522, -0.004276872146874666, -0.025429505854845047, -0.0209110826253891, -0.028395770117640495, 0.026401320472359657, -0.01666504330933094, -0.0018664736999198794, 0.0020221800077706575, 0.006979797035455704, -0.004207496996968985, 0.012172473594546318, -0.044878289103507996, 0.012803258374333382, -0.00174515915568918, -0.030376534909009933, 0.022112201899290085, 0.01262101624161005, -0.011149155907332897, 0.010512476786971092, 0.020879054442048073, -0.009791187010705471, 0.0009483682224527001, -0.04366172105073929, 0.02847762405872345, -0.000604592205490917, -0.029412152245640755, -0.03172849491238594, 0.07187476754188538, -0.008622294291853905, 0.05277691036462784, 0.0076141636818647385, 0.054390259087085724, 0.04392574355006218, 0.008168659172952175, -0.029006659984588623, 0.018915841355919838, 0.05471103638410568, -0.00011091570922872052, 0.008225464262068272, 0.029816053807735443, -0.024236219003796577, 0.01059772353619337, -0.02396608516573906, -0.026337476447224617, 0.02655760757625103, 0.02053745649755001, 0.049159158021211624, -0.0018920263973996043, 0.015152939595282078, -0.01781034842133522, 0.023436235263943672, 0.013740377500653267, 0.024580756202340126, 0.01456408854573965, 0.0048454636707901955, 0.02475450560450554, -0.0018788996385410428, 0.011397499591112137, 0.010454627685248852, -0.03126941993832588, 0.016083398833870888, 0.04108172282576561, 0.03595012053847313, 0.01729041524231434, -0.006530932616442442, 0.0008413470350205898, 0.0273167472332716, 0.014002782292664051, -0.04644645377993584, 0.015427952632308006, 0.03905647620558739, -0.024585483595728874, 0.012795320712029934, 0.011371721513569355, -0.025372305884957314, 0.016376962885260582, 0.013983139768242836, -0.01753953844308853, -0.003597334725782275, 0.0025106051471084356, -0.005588161293417215, 0.0353219248354435, 0.004835921805351973, -0.025252507999539375, -0.030561868101358414, -0.025633543729782104, 0.020803755149245262, 0.0004050467396155, -0.008674203418195248, 0.003508942434564233, 0.03261614590883255, 0.002092810580506921, 0.015301945619285107, 0.03742523491382599, 0.0033286854159086943, 0.0014293406857177615, 0.07790551334619522, 0.018024982884526253, 0.0041448506526649, 0.019041236490011215, -0.032402291893959045, 0.014329246245324612, -0.025511398911476135, 0.006957206409424543, -0.012107150629162788, -0.03870048001408577, 0.05336211249232292, 0.018304144963622093, -0.0011046442668884993, 0.012691084295511246, 0.05734185874462128, 0.012774495407938957, -0.032527681440114975, -0.04653703048825264, -0.03298547863960266, -0.04188976064324379, 0.010192401707172394, -0.0035781520418822765, 0.005056388676166534, 0.03427313640713692, -0.003784573869779706, 0.00788241159170866, -0.04095424711704254, 0.0005506161833181977, 0.015955977141857147, 0.007232020143419504, 0.036331143230199814, -0.0393916554749012, -0.012129507027566433, -0.03326244279742241, 0.0504404716193676, -0.0026268933434039354, 0.053301479667425156, 0.02912287227809429, -0.014878816902637482, -0.004025429021567106, -0.025633417069911957, 0.0052418471314013, -0.010913730598986149, 0.00011620433360803872, -0.012904008850455284, -0.035502709448337555, 0.01138283684849739, 0.00015324119885917753, 0.008838879875838757, 0.024545880034565926, -0.01727113127708435, 0.02110743150115013, -0.011912650428712368, 0.0034371367655694485, -0.016044367104768753, -0.07525951415300369, 0.04363960400223732, 0.029859131202101707, -0.000017724687495501712, 0.020866017788648605, -0.035887084901332855, 0.011036303825676441, -0.053256694227457047, -0.008886166848242283, 0.05794119834899902, -0.0451098270714283, 0.02888740971684456, 0.019827432930469513, -0.027105601504445076, 0.02161976881325245, 0.0095659289509058, 0.014987992122769356, -0.03397299721837044, -0.020915627479553223, -0.06047816202044487, -0.01772443763911724, 0.045234665274620056, 0.03210190311074257, 0.0393652506172657, 0.013550413772463799, -0.011189949698746204, 0.0035664746537804604, -0.04285891354084015, -0.03581599146127701, -0.04403437674045563, 0.032887574285268784, -0.03916046768426895, 0.039642199873924255, 0.02723139151930809, 0.04379776865243912, -0.008469450287520885, 0.0020711561664938927, -0.004925810266286135, 0.01003355160355568, -0.013077797368168831, -0.06463227421045303, -0.0430421307682991, 0.0077569265849888325, -0.006911526434123516, -0.058045245707035065, -0.020420802757143974, 0.02585940808057785, 0.02203024923801422, 0.023797351866960526, -0.018103839829564095, 0.03691078722476959, 0.029016779735684395, 0.04611770436167717, -0.008784551173448563, 0.019707923755049706, 0.040270790457725525, -0.013301598839461803, 0.005739040207117796, -0.021240724250674248 ]
Hugging Face on PyTorch / XLA TPUs
jysohn23
February 9, 2021
pytorch-xla
open-source-collab
https://huggingface.co/blog/pytorch-xla
Checkpoint Writing and Loading When a tensor is checkpointed from a XLA device and then loaded back from the checkpoint, it will be loaded back to the original device. Before checkpointing tensors in your model, you want to ensure that all of your tensors are on CPU devices instead of XLA devices. This way, when you load back the tensors, you’ll load them through CPU devices and then have the opportunity to place them on whatever XLA devices you desire. We provide the xm.save() API for this, which already takes care of only writing to storage location from only one process on each host (or one globally if using a shared file system across hosts). python class PreTrainedModel(nn.Module, ModuleUtilsMixin, GenerationMixin): … def save_pretrained(self, save_directory): ... if getattr(self.config, "xla_device", False): import torch_xla.core.xla_model as xm if xm.is_master_ordinal(): # Save configuration file model_to_save.config.save_pretrained(save_directory) # xm.save takes care of saving only from master xm.save(state_dict, output_model_file) python class Trainer: … def train(self, *args, **kwargs): ... if is_torch_tpu_available(): xm.rendezvous("saving_optimizer_states") xm.save(self.optimizer.state_dict(), os.path.join(output_dir, "optimizer.pt")) xm.save(self.lr_scheduler.state_dict(), os.path.join(output_dir, "scheduler.pt"))
[ -0.02207786776125431, 0.008275766856968403, -0.05514899268746376, 0.026787910610437393, 0.06320475786924362, -0.02959519438445568, 0.03068585880100727, -0.045811932533979416, -0.027356276288628578, -0.078615203499794, -0.028626689687371254, 0.07343799620866776, 0.0041862716898322105, 0.039795149117708206, -0.011397290043532848, -0.027979746460914612, 0.08389191329479218, -0.058694612234830856, -0.05045267939567566, 0.015323224477469921, 0.07382167130708694, -0.026517609134316444, 0.02652580477297306, 0.03452365845441818, -0.019640251994132996, -0.07295499742031097, -0.053079623728990555, 0.03458723798394203, 0.00465761823579669, -0.009432806633412838, -0.042813319712877274, 0.010953324846923351, 0.0266307033598423, -0.0031770295463502407, 0.053226158022880554, 0.04049893468618393, -0.027011508122086525, 0.04225190728902817, 0.027609625831246376, -0.028438758105039597, -0.021225979551672935, 0.010070797987282276, -0.07593582570552826, 0.04834363982081413, 0.02652440406382084, -0.05096905305981636, -0.09851044416427612, 0.017048224806785583, -0.009300928562879562, 0.02530345320701599, -0.09984531253576279, 0.015072379261255264, -0.001888879924081266, 0.010105605237185955, -0.021849406883120537, 0.09495595097541809, -0.0712609738111496, -0.02711707353591919, 0.0029735395219177008, 0.019599679857492447, 0.018080854788422585, 0.09990399330854416, -0.016020510345697403, 0.07036561518907547, 0.047104235738515854, -0.007282443810254335, 0.04839823395013809, -0.009792417287826538, -0.06595240533351898, -0.08658764511346817, -0.04206903651356697, 0.04606087878346443, 0.031030884012579918, 0.0041641965508461, 0.01630163937807083, -0.03506137430667877, -0.02666332945227623, -0.07170254737138748, 0.02139926142990589, 0.03171560540795326, 0.00998676661401987, 0.05201609805226326, -0.03576485440135002, 0.021259235218167305, 0.07380283623933792, -0.03057682514190674, 0.0345236137509346, -0.0651673674583435, 0.038004085421562195, 0.004155910108238459, -0.0101700434461236, -0.08087819069623947, 0.03483979031443596, 0.00693994015455246, 0.026662316173315048, -0.005549294408410788, 0.009631184861063957, 0.02753974311053753, 0.001258159289136529, 0.0018818360986188054, 0.02133302390575409, -0.09773126244544983, -0.013891023583710194, -0.03105742111802101, -0.07913927733898163, -0.0055974917486310005, -0.014263899065554142, -0.051886700093746185, -0.015140497125685215, -0.016194311901926994, -0.056303974241018295, -0.020492078736424446, -0.06110130622982979, 0.019016209989786148, -0.02987188659608364, -0.06603497266769409, 0.0412602499127388, -0.03408759459853172, 0.002351873554289341, 0.006175254005938768, 0.028567694127559662, 0.12106442451477051, 0.07581308484077454, -0.0274061169475317, 0.005725918337702751, 0.08729210495948792, 0.017430918291211128, -0.027775375172495842, 0.054614514112472534, -0.029377775266766548, 0.013379924930632114, -0.0030055989045649767, 0.04347526654601097, -0.017560239881277084, 0.08038562536239624, -0.038552187383174896, 0.012234627269208431, 0.0365167111158371, 0.0019477196037769318, -0.0024411811027675867, -0.07361044734716415, 0.06428815424442291, 0.027226636186242104, -0.0002905140572693199, -0.002379339188337326, -0.060643307864665985, -0.05323939770460129, 0.11676660180091858, 0.04034806787967682, 0.008308587595820427, -0.06318466365337372, 0.05362619087100029, -0.07035130262374878, -0.06376200914382935, -0.016623646020889282, 0.01135129015892744, -0.03260226175189018, 0.022774899378418922, -0.10804146528244019, -0.04595859348773956, -0.032109782099723816, 0.011383346281945705, -0.053447168320417404, -0.03458712249994278, 0.02021615393459797, 0.015902021899819374, 0.034333664923906326, -0.022494005039334297, 0.058278053998947144, 0.016674650833010674, 0.018935788422822952, -0.015547306276857853, 0.05175945535302162, 0.021880295127630234, -0.018201343715190887, 0.050444960594177246, 0.016893314197659492, 0.03456703945994377, -0.04713897779583931, -0.016320711001753807, -0.0464760847389698, -0.006995278410613537, -0.10641755908727646, 0.05954989790916443, 0.020912814885377884, -0.01619572378695011, 0.04826671630144119, -0.09273772686719894, -0.05029112473130226, 0.06551510840654373, -0.046407293528318405, 0.029613051563501358, 0.007262085098773241, -0.06138525903224945, 0.04853333160281181, -0.04666772857308388, -0.055358316749334335, 0.05675649270415306, -0.03336575999855995, -0.024459902197122574, 0.045931242406368256, -0.007587034720927477, -0.027913056313991547, -0.027435677126049995, 0.006589910015463829, 0.013122513890266418, -0.0041220178827643394, -0.12807923555374146, 0.03226497769355774, 0.0429585836827755, -0.009276743046939373, -0.039137598127126694, 0.014204232022166252, -0.05194297060370445, -0.020279673859477043, 0.00821183156222105, -0.045195322483778, 0.009859250858426094, 0.006800245027989149, -0.04898276552557945, 0.14597155153751373, -0.05812502279877663, 0.03562324866652489, 0.033723361790180206, -0.0077423760667443275, 0.0648658499121666, -0.02327822707593441, 0.03886044770479202, 0.018034107983112335, -0.13105514645576477, -0.051518555730581284, -0.09239335358142853, -0.05062367022037506, 0.10322632640600204, 0.05698559805750847, 0.03971650451421738, -0.009247619658708572, 0.06340683251619339, 0.04707775637507439, -0.028647614642977715, -0.015345980413258076, 0.039796132594347, -0.04266667738556862, 0.00806577317416668, 0.00004184295903542079, -0.018930502235889435, 0.02717580460011959, 0.02197437174618244, -0.10783622413873672, -0.009625830687582493, -0.06840488314628601, -0.012554783374071121, 0.03460828959941864, -0.008560153655707836, 0.05668012052774429, 0.02174275368452072, -0.03375276178121567, -0.0338737890124321, -0.00446971645578742, 0.053316280245780945, -0.003185455221682787, -0.03691527247428894, -0.023960089311003685, -0.04296422004699707, 0.004778713919222355, -0.042475879192352295, 0.04667375236749649, -0.03666065260767937, 0.0384112186729908, -0.03586309030652046, 0.04148238152265549, -0.051677413284778595, -0.01591736637055874, -0.02679896540939808, 0.023688752204179764, 0.0356430783867836, -0.011502943001687527, 0.015472226776182652, -0.022112257778644562, 0.005289445165544748, 0.01165800727903843, -0.03891943395137787, 0.018011467531323433, -0.007670880760997534, -0.02737453766167164, -0.008204428479075432, 0.03542403504252434, 0.00607449421659112, -0.023965448141098022, 0.0351794995367527, -0.013684608042240143, 0.017272276803851128, -0.019680850207805634, -0.02984308823943138, -0.03561275079846382, 0.04922843351960182, 0.008059528656303883, 0.005685457959771156, 0.020741891115903854, -0.010479260236024857, -0.06086080148816109, -0.00020020022930111736, 0.018595147877931595, -0.018888290971517563, -0.029002664610743523, -0.00018068485951516777, 0.014630686491727829, -0.011377486400306225, -0.08008494228124619, -0.02402874268591404, 0.0010074867168441415, 0.03150230646133423, -0.01610487885773182, -0.021770017221570015, -0.0016870271647349, -0.0008510932675562799, -0.01147150807082653, 0.043443262577056885, 0.0182463601231575, 0.006290813442319632, 0.03165870159864426, -0.0009103132761083543, -0.011525340378284454, 0.019781600683927536, 0.04463038221001625, 0.007326771505177021, 0.045969463884830475, -0.017596453428268433, -0.027473969385027885, 0.012377457693219185, -0.021759921684861183, -0.005641845986247063, -0.012057991698384285, 0.028942672535777092, -0.001402513007633388, 0.053282104432582855, -0.019470462575554848, -0.049426693469285965, -0.07789678126573563, -0.027317067608237267, -0.04513276740908623, -0.048673365265131, -0.009491069242358208, -0.03057682514190674, -0.0016668643802404404, 0.02003541775047779, 0.028804047033190727, 0.024171601980924606, 0.022817587479948997, 0.044196177273988724, 0.033449675887823105, -0.00910911150276661, -0.015674283728003502, 0.028748221695423126, 0.037560973316431046, -0.037146005779504776, -0.0022363511379808187, -0.01695799082517624, -0.021272404119372368, -0.03985605016350746, 0.032166723161935806, 0.006669646129012108, -0.014523416757583618, -0.018671073019504547, 0.0016425121575593948, 0.033657900989055634, 0.05240963399410248, -0.004319358617067337, -0.028774138540029526, -0.009509528987109661, 0.003948229365050793, -0.03306547924876213, -0.02935672178864479, 0.05193597078323364, 0.014597787521779537, -0.01210018526762724, -0.03548143059015274, 0.03245225548744202, -0.05410989373922348, 0.044594839215278625, 0.032747481018304825, 0.004321083892136812, -0.07394902408123016, 0.029456397518515587, -0.023722201585769653, -0.014972126111388206, 0.03881850093603134, -0.0010962036903947592, -0.0033777649514377117, -0.0005800226936116815, -0.059940941631793976, -0.002710759174078703, 0.0014163288287818432, -0.0018751992611214519, 0.017194904386997223, 0.02571709081530571, 0.028492340818047523, 0.030942488461732864, 0.03563850000500679, -0.0025310160126537085, 0.0192511398345232, -0.02283802069723606, -0.005105894058942795, -0.0365721769630909, -0.011873685754835606, 0.019782546907663345, 0.004965213127434254, 0.023735184222459793, -0.020835135132074356, -0.02209506370127201, 0.006141641177237034, 0.01618548110127449, 0.018002068623900414, -0.012578001245856285, 0.022250628098845482, -0.00987798348069191, 0.006665426772087812, -0.011477678082883358, -0.04268771409988403, 0.013768489472568035, 0.04112539067864418, -0.017194630578160286, 0.045228682458400726, -0.0061645801179111, -0.0016179159283638, -0.01775888167321682, 0.04825103282928467, 0.03403560444712639, -0.05746385455131531, 0.04209888353943825, 0.011071845889091492, -0.038350317627191544, 0.0013288101181387901, 0.0018654491286724806, 0.023599427193403244, -0.02752986177802086, -0.0036061604041606188, -0.023139772936701775, -0.08346167206764221, -0.002484103199094534, 0.0592394657433033, 0.044680990278720856, -0.02181822806596756, -0.03474394604563713, -0.030579127371311188, 0.012668576091527939, 0.036894794553518295, -0.029359694570302963, -0.025032589212059975, 0.005495615769177675, 0.01637774519622326, -0.07201983779668808, 0.049304019659757614, 0.027015479281544685, -0.03989489749073982, 0.046597063541412354, -0.03176170960068703, 0.015534289181232452, 0.05952964350581169, 0.058208804577589035, -0.06157999113202095, 0.006405767984688282, 0.04182190075516701, 0.030457131564617157, 0.023563822731375694, -0.027411801740527153, 0.04619581624865532, 0.04262780770659447, -0.011168836615979671, 0.007310075685381889, 0.0011870501330122352, 0.014322209171950817, 0.05313147231936455, -0.012276091612875462, -0.031009959056973457, -0.07990552484989166, 0.011520634405314922, 0.03398223966360092, -0.012511561624705791, 0.0019260288681834936, 0.025940043851733208, -0.053879279643297195, 0.037926822900772095, 0.003186240792274475, -0.010298452340066433, -0.003273656591773033, 0.01969410479068756, -0.006453176029026508, 0.035140372812747955, -0.009674224071204662, 0.0525793619453907, -0.029876254498958588, -0.019616367295384407, 0.030599433928728104, 0.03792142495512962, 0.01985122822225094, 0.0002604252949822694, 0.005940198432654142, 0.013381555676460266, 0.019134633243083954, 0.040497440844774246, 0.007772005163133144, 0.04487660899758339, -0.011873471550643444, -0.022117363288998604, 0.0424087829887867, 0.013671530410647392, -0.003559584729373455, 0.013310322538018227, 0.035623397678136826, -0.0009901770390570164, -0.022578366100788116, -0.010691906325519085, 0.004904657602310181, -0.02248620055615902, -0.01364766713231802, -0.008266380056738853, 0.004857642576098442, 0.019511139020323753, 0.00907192938029766, 0.009631280787289143, 0.0067185331135988235, 0.04132828488945961, 0.027261052280664444, -0.0686512216925621, 0.04933807626366615, 0.025211384519934654, 0.021090904250741005, 0.01722354255616665, 0.0011787593830376863, -0.00721493735909462, -0.01580827310681343, 0.024122733622789383, -0.03472606837749481, 0.010643517598509789, -0.002329945797100663, 0.022587474435567856, 0.007534766104072332, 0.03508292883634567, 0.04565262794494629, 0.0052331723272800446, 0.0043176524341106415, 0.026725968345999718, -0.02037668786942959, -0.02226007729768753, -0.008040076121687889, 0.0357135534286499, -0.03556601330637932, -0.019119251519441605, 0.014200116507709026, -0.029621275141835213, 0.07244817912578583, -0.009574485011398792, 0.053267285227775574, 0.03394583612680435, -0.013959742151200771, 0.042819589376449585, -0.0011862691026180983, 0.007928493432700634, -0.009609160013496876, -0.03398875147104263, -0.03467347472906113, 0.009111394174396992, 0.026696201413869858, -0.005368620622903109, -0.02941158413887024, 0.02006525732576847, 0.014366371557116508, 0.009145361371338367, -0.05659577250480652, -0.015994101762771606, -0.01435816939920187, -0.01731940172612667, 0.009925676509737968, -0.0009890964720398188, -0.010004664771258831, 0.017329713329672813, 0.0013611922040581703, 0.03601932153105736, -0.001861589727923274, -0.0037637436762452126, 0.03677564114332199, -0.00901447981595993, -0.020579207688570023, -0.013814608566462994, 0.03476426377892494, -0.043603572994470596, 0.04032324627041817, -0.0014277129666879773, 0.01672849990427494, 0.006186188198626041, 0.018062973394989967, 0.007727424614131451, -0.029785102233290672, 0.06132527440786362, -0.018214235082268715, -0.0011206867638975382, 0.05926395207643509, 0.0015036666300147772, 0.015163104981184006, 0.018226291984319687, -0.03726402297616005, 0.033883705735206604, 0.021351490169763565, 0.014001457020640373, -0.009110669605433941, -0.019191676750779152, -0.017780007794499397, 0.0495486781001091, 0.03751709312200546, -0.005339929834008217, -0.02782760001718998, 0.005046861246228218, -0.03561869636178017, 0.0066961138509213924, 0.008542327210307121, 0.01323611382395029, 0.016390418633818626, 0.011588269844651222, 0.05386632680892944, 0.005252345930784941, 0.031540270894765854, 0.06451500207185745, 0.02645258419215679, 0.033585745841264725, -0.006818410474807024, -0.04541252180933952, 0.02656724490225315, 0.009132062084972858, 0.0102210259065032, -0.018923992291092873, 0.005988914519548416, -0.006618736311793327, 0.001485871383920312, -0.033094026148319244, 0.002273566322401166, 0.013904302380979061, 0.004343733191490173, -0.0033014335203915834, 0.03479896858334541, 0.04928448423743248, -0.04549248516559601, 0.0009686310077086091, -0.015036097727715969, 0.019141074270009995, 0.012667755596339703, 0.010052928701043129, -0.005796925630420446, -0.008039568550884724, 0.016394933685660362, -0.002377593657001853, 0.06451878696680069, -0.009550940245389938, 0.03156657889485359, 0.03438938781619072, 0.020412735641002655, 0.00617022393271327, 0.05526615306735039, 0.011061454191803932, 0.019001927226781845, 0.012286407873034477, -0.011540709994733334, -0.034968260675668716, -0.06846261769533157, 0.06213126331567764, -0.014874962158501148, -0.0011540886480361223, 0.00682690367102623, 0.04605395346879959, 0.008628054521977901, -0.012710943818092346, -0.0013473302824422717, -0.0392034575343132, -0.04158581420779228, 0.02887488156557083, -0.02641313523054123, 0.01162039302289486, 0.0052333553321659565, -0.002560713794082403, 0.005550154484808445, -0.002229155506938696, -0.013401662930846214, 0.011224339716136456, -0.02437804825603962, 0.030090704560279846, -0.03971331939101219, 0.03614693507552147, -0.0012423034058883786, 0.08520126342773438, 0.009868448600172997, 0.013399594463407993, 0.014025971293449402, -0.031802136451005936, -0.007877352647483349, -0.003303824458271265, 0.021843180060386658, -0.0025010474491864443, 0.012169879861176014, 0.01977001130580902, -0.04677516222000122, -0.014875245280563831, -0.009642940014600754, -0.022798869758844376, 0.027455797418951988, -0.009594431146979332, 0.011227711103856564, -0.02834714762866497, -0.00418486725538969, 0.005896281450986862, -0.05781089887022972, 0.02490198239684105, 0.04760462045669556, 0.017544109374284744, 0.08008813858032227, -0.039246588945388794, -0.007115980144590139, -0.014296283014118671, 0.00714436499401927, 0.04103164002299309, 0.0027919812127947807, 0.001622576266527176, -0.01837075687944889, 0.014410407282412052, -0.002898898208513856, -0.011443660594522953, -0.008370304480195045, -0.042462822049856186, 0.00814647227525711, -0.07599098980426788, -0.016231276094913483, 0.045153193175792694, 0.040471650660037994, 0.02945161983370781, -0.02207009680569172, 0.0036454598885029554, 0.018968235701322556, 0.016607489436864853, -0.05083572492003441, -0.0208276454359293, -0.008538898080587387, -0.021281486377120018, 0.004204565193504095, 0.009041552431881428, 0.045118749141693115, -0.03556431829929352, -0.04050711169838905, 0.0029399613849818707, -0.0016956526087597013, 0.01803840510547161, -0.012659757398068905, -0.024880386888980865, 0.036528632044792175, -0.005583342630416155, -0.07467371970415115, -0.009268018417060375, 0.0169147290289402, 0.006240394432097673, 0.028352344408631325, -0.008906981907784939, 0.027603542432188988, 0.03907923400402069, -0.017658745869994164, 0.03262593597173691, 0.05887509509921074, 0.02383371628820896, -0.030554093420505524, 0.004137234762310982, 0.005550716537982225 ]
Hugging Face on PyTorch / XLA TPUs
jysohn23
February 9, 2021
pytorch-xla
open-source-collab
https://huggingface.co/blog/pytorch-xla
# Hugging Face on PyTorch / XLA TPUs: Faster and cheaper training
[ 0.03173718973994255, -0.035425249487161636, 0.060337621718645096, 0.02025974728167057, 0.010061180219054222, 0.013731824234127998, 0.004059068392962217, 0.06895124912261963, -0.03237397223711014, -0.03608843684196472, -0.0623895488679409, 0.08934740722179413, -0.042571090161800385, 0.061496131122112274, 0.04150331765413284, -0.06404419243335724, 0.029294943436980247, -0.008706538006663322, -0.0049185301177203655, 0.07710050046443939, -0.019793661311268806, -0.024805955588817596, 0.09643565863370895, 0.007161912973970175, -0.048565927892923355, -0.06409529596567154, -0.010845369659364223, -0.015604240819811821, 0.00975169986486435, -0.0016230428591370583, -0.0738561600446701, -0.003416897961869836, 0.031231602653861046, -0.006227264180779457, 0.010303355753421783, 0.03903393819928169, -0.07279493659734726, 0.0708346962928772, 0.06393750011920929, -0.0029452021699398756, 0.029045913368463516, -0.04341311380267143, -0.0696498304605484, 0.0480002835392952, -0.014163990505039692, -0.050104133784770966, -0.21233583986759186, 0.1117623895406723, -0.06297894567251205, -0.011289441958069801, -0.07172652333974838, 0.030280880630016327, -0.016500726342201233, 0.005023974925279617, 0.005021531134843826, 0.045440346002578735, -0.041722435504198074, -0.05486828088760376, -0.0160142183303833, -0.022297022864222527, 0.062040381133556366, 0.02141052670776844, 0.00573284225538373, 0.06330233067274094, -0.016129454597830772, 0.0252071563154459, 0.007629322819411755, -0.02945753186941147, -0.1015438586473465, -0.035945236682891846, 0.022235604003071785, 0.040531523525714874, -0.03897774964570999, 0.017490455880761147, 0.053329020738601685, -0.08111085742712021, -0.04580451548099518, -0.061541277915239334, 0.09451783448457718, 0.0976814553141594, 0.009866198524832726, 0.007851190865039825, 0.04097427800297737, 0.060540154576301575, 0.05160130560398102, 0.07256294041872025, -0.006782122887670994, -0.03826881945133209, -0.022336924448609352, 0.06803322583436966, -0.04192367196083069, -0.06984010338783264, 0.024687258526682854, 0.015709953382611275, 0.039027389138936996, 0.024917257949709892, -0.036204468458890915, 0.012313534505665302, 0.0063954927027225494, -0.06288134306669235, 0.01658913493156433, -0.08455684036016464, 0.04429633915424347, -0.06932701915502548, -0.05151400715112686, 0.0545705184340477, -0.0305644404143095, -0.10148246586322784, -0.00025090883718803525, -0.002780964830890298, -0.043219950050115585, 0.009000591933727264, 0.01796661503612995, 0.021945016458630562, -0.060161348432302475, 0.0026569822803139687, -0.009568248875439167, -0.013563417829573154, 0.0014737214660272002, 0.0171843059360981, -0.021860849112272263, 0.119987852871418, 0.01615142822265625, -0.01853339932858944, 0.033344969153404236, 0.08935288339853287, 0.0042908089235424995, 0.019790273159742355, 0.02636544778943062, -0.017993707209825516, 0.029648037627339363, -0.043584879487752914, 0.05467880144715309, -0.03164200484752655, 0.05190862715244293, -0.025187324732542038, 0.006932966411113739, 0.0015861168503761292, -0.00964202731847763, -0.023070812225341797, -0.05379596725106239, 0.1049455851316452, 0.04096125438809395, 0.012576189823448658, -0.028496423736214638, -0.06258457899093628, -0.08576913923025131, 0.0810108408331871, 0.015353918075561523, -0.03543994203209877, -0.06837841868400574, 0.01515363622456789, -0.07446478307247162, -0.059800099581480026, 0.054987832903862, 0.058569565415382385, 0.00646138284355402, -0.07971470057964325, -0.05063287541270256, -0.05064570903778076, 0.005750609561800957, -0.004327729344367981, -0.02915731631219387, -0.03540308400988579, 0.04104353487491608, 0.03556131571531296, 0.03471683710813522, -0.000021263673261273652, -0.011544482782483101, -0.04129992052912712, 0.015049456618726254, -0.006023190915584564, 0.028218865394592285, 0.020075922831892967, -0.04986927658319473, 0.03740670159459114, 0.026932574808597565, 0.0663684830069542, -0.05640338361263275, 0.0030763396061956882, -0.03442344814538956, 0.024413136765360832, -0.05574924871325493, 0.060139261186122894, -0.0005515470402315259, -0.08035148680210114, 0.04713255912065506, 0.024463148787617683, 0.029964609071612358, 0.04328355938196182, -0.05425267294049263, -0.023130256682634354, 0.05348014831542969, -0.033847592771053314, 0.04630924016237259, -0.046235088258981705, -0.05801253020763397, 0.09559037536382675, -0.02683156169950962, 0.02971419133245945, -0.025636503472924232, -0.023577455431222916, -0.008717582561075687, -0.01726340502500534, 0.013072427362203598, 0.021131690591573715, 0.045222166925668716, -0.01113871019333601, 0.03682319074869156, 0.013906331732869148, 0.02103237807750702, -0.10755573958158493, 0.031175261363387108, -0.04731271043419838, -0.033344462513923645, 0.003975771367549896, -0.011798686347901821, 0.014954793266952038, 0.02428918518126011, -0.0033286360558122396, 0.14007575809955597, -0.04480767995119095, -0.006125815212726593, 0.010488000698387623, -0.02662510983645916, 0.03656262159347534, 0.06444565206766129, -0.010702730156481266, 0.048228636384010315, -0.12117123603820801, -0.05021889880299568, -0.11182292550802231, -0.05888194963335991, 0.07795008271932602, 0.03858412429690361, -0.0434880405664444, -0.01753418520092964, -0.014623257331550121, 0.06580450385808945, -0.03488323837518692, -0.02800293266773224, -0.0075133442878723145, -0.002768311183899641, 0.04345611482858658, -0.034697484225034714, -0.04979932680726051, 0.017620747908949852, 0.05121713504195213, -0.04929332807660103, 0.040500856935977936, -0.07885865867137909, 0.039978474378585815, 0.011593803763389587, -0.016940360888838768, 0.03109307773411274, 0.01320501696318388, -0.01265675574541092, -0.00892677716910839, -0.007247389759868383, 0.03633195906877518, 0.02397639863193035, 0.001132128993049264, -0.026228761300444603, -0.021873071789741516, -0.019514650106430054, -0.035251688212156296, -0.007804310880601406, 0.009680996648967266, -0.009934931993484497, 0.0003519112360663712, 0.053044211119413376, -0.023126395419239998, 0.032727066427469254, 0.00029930099844932556, 0.008916652761399746, 0.009843132458627224, 0.04433802142739296, -0.008843062445521355, -0.05482759699225426, -0.03533313795924187, 0.0040256427600979805, 0.00406631687656045, 0.055839262902736664, 0.0009130201651714742, -0.005864284001290798, 0.010952815413475037, 0.03111724928021431, -0.02374548651278019, -0.023067833855748177, -0.0026967478916049004, -0.001300895237363875, 0.03909248486161232, -0.013909011147916317, -0.020258255302906036, -0.001984988572075963, 0.0007576481439173222, 0.0012813290813937783, -0.010256827808916569, 0.00455619627609849, 0.010171782225370407, -0.019581308588385582, -0.026501696556806564, -0.032146062701940536, -0.014508437365293503, -0.015416163019835949, -0.002829700941219926, 0.027968518435955048, 0.017636114731431007, -0.11035609990358353, -0.034085553139448166, -0.010331074707210064, 0.003396767657250166, -0.02511507086455822, -0.03593316674232483, 0.013689245097339153, -0.010188463144004345, -0.004278765060007572, 0.006706285290420055, 0.02190510742366314, 0.04256005957722664, -0.003515457035973668, -0.0028578105848282576, -0.0243058018386364, -0.0022609559819102287, 0.01820399798452854, 0.01621287316083908, 0.04918341711163521, 0.025297071784734726, -0.048763591796159744, 0.06542372703552246, 0.006631229538470507, -0.004574586637318134, 0.013382594101130962, 0.034173112362623215, 0.022565200924873352, 0.017957249656319618, 0.03459513932466507, -0.03746533766388893, -0.014614605344831944, 0.005053679924458265, -0.015711255371570587, 0.018772000446915627, -0.017633244395256042, -0.0018515577539801598, 0.00312794023193419, -0.005995954852551222, 0.04008211940526962, 0.019184788689017296, 0.012765612453222275, 0.008773988112807274, 0.031260814517736435, -0.031301625072956085, -0.01624326966702938, -0.005892372690141201, -0.03251950442790985, -0.006589176598936319, 0.05871780589222908, -0.03887150064110756, -0.015721414238214493, -0.014946866780519485, 0.03318357095122337, 0.03669920936226845, 0.023755980655550957, 0.015230588614940643, -0.03236757218837738, 0.04533277079463005, 0.03818945959210396, -0.022157417610287666, -0.06511364132165909, 0.04289695620536804, 0.0011644152691587806, -0.044835712760686874, -0.0511021763086319, 0.04952114447951317, 0.009806224144995213, -0.02640499174594879, -0.01862500049173832, 0.019941741600632668, -0.008267099037766457, -0.016878237947821617, -0.05445205420255661, 0.0119774816557765, -0.013310539536178112, 0.04568014666438103, -0.014926576986908913, -0.0162751954048872, 0.06386295706033707, -0.03266643360257149, -0.029195211827754974, -0.024471690878272057, -0.013351584784686565, -0.02996990643441677, 0.034075815230607986, 0.02055407129228115, 0.022524772211909294, -0.04710201546549797, 0.03691248223185539, 0.09287042170763016, 0.0006612249417230487, -0.013086232356727123, 0.019318636506795883, -0.017506608739495277, -0.0192431528121233, 0.0014631588710471988, 0.018086552619934082, 0.016975942999124527, 0.009302192367613316, 0.002544038463383913, 0.015169775113463402, -0.04752400889992714, -0.014742706902325153, 0.00630086800083518, -0.02517120912671089, 0.00567963533103466, -0.0037375069223344326, -0.011892403475940228, 0.023627355694770813, 0.017297357320785522, 0.02707097679376602, 0.025075746700167656, 0.017483096569776535, -0.005949801299721003, 0.03737005963921547, 0.01295902393758297, -0.009198912419378757, -0.01856224238872528, -0.033519234508275986, 0.024716872721910477, -0.044769082218408585, 0.03287190571427345, -0.018573211506009102, -0.035069115459918976, 0.029315246269106865, -0.004646922927349806, 0.035803601145744324, 0.028309855610132217, -0.0034967493265867233, -0.01975896954536438, -0.043482791632413864, -0.03445902466773987, 0.02642991580069065, -0.008915359154343605, 0.016646644100546837, -0.020664846524596214, -0.015158327296376228, 0.021207474172115326, -0.023372163996100426, -0.06533392518758774, -0.03670661523938179, 0.021661464124917984, 0.044152818620204926, -0.01945183426141739, 0.030715519562363625, 0.018434349447488785, -0.07507015764713287, 0.02733723074197769, -0.032092902809381485, 0.028775839135050774, 0.05279858037829399, -0.011677165515720844, -0.034445326775312424, 0.05368280038237572, 0.06179671734571457, 0.03654325753450394, -0.0068654767237603664, 0.02600710093975067, -0.0017347418470308185, 0.04318144917488098, -0.011347997933626175, -0.010430905967950821, -0.01558288186788559, -0.007436535786837339, 0.05103149637579918, -0.009601730853319168, -0.00557462265715003, -0.05238209664821625, 0.022006861865520477, -0.010070889256894588, -0.03331064060330391, 0.01093512587249279, 0.013775628991425037, -0.028862392529845238, 0.01343811396509409, -0.005637620110064745, 0.006931901443749666, -0.01994013413786888, 0.01237056590616703, 0.03227381035685539, -0.005765784066170454, 0.019050762057304382, 0.04268084838986397, -0.013656008057296276, -0.0026005140971392393, 0.03713296726346016, 0.008180988021194935, 0.026064662262797356, 0.012697183527052402, 0.02033638395369053, 0.008710324764251709, -0.023432614281773567, -0.03401429206132889, -0.011722574941813946, 0.022820129990577698, 0.0016941598150879145, -0.04501761123538017, -0.015037463046610355, 0.004350324627012014, -0.00706909503787756, -0.006926960311830044, 0.016050027683377266, -0.023465262725949287, -0.032128091901540756, 0.01126200519502163, 0.016385896131396294, -0.021749410778284073, -0.00924108736217022, 0.015425855293869972, -0.030512016266584396, 0.006707209162414074, 0.03209161013364792, 0.021057764068245888, -0.023861508816480637, 0.0014373337617143989, -0.009899605996906757, -0.04323321580886841, 0.03339305892586708, -0.0008058551466092467, -0.00512784393504262, -0.02367350086569786, -0.001192207564599812, -0.018607081845402718, -0.027643850073218346, 0.04252907633781433, -0.048043638467788696, -0.005929615814238787, -0.0002166255726478994, 0.008185391314327717, 0.055569592863321304, 0.02406449243426323, 0.01954580843448639, 0.009907597675919533, 0.02687106467783451, 0.05261315405368805, 0.039911504834890366, -0.037669043987989426, 0.046290479600429535, -0.00453103007748723, -0.006322510540485382, -0.021593833342194557, -0.00840817578136921, -0.03850850835442543, 0.012855139560997486, -0.013339627534151077, 0.007163644302636385, 0.0689365416765213, 0.02876773290336132, 0.020204972475767136, -0.031375452876091, 0.025115232914686203, -0.0056659323163330555, 0.0029306940268725157, -0.013739822432398796, 0.02410952001810074, -0.013032791204750538, 0.02427120879292488, -0.02637130580842495, 0.009209339506924152, -0.0005336027243174613, 0.011335814371705055, -0.0467580184340477, 0.030404280871152878, 0.03979960083961487, 0.004041180480271578, 0.05879678577184677, -0.015300095081329346, 0.0005576444673351943, 0.02219032309949398, 0.025557367131114006, 0.012892190366983414, 0.010312137193977833, -0.019665345549583435, 0.036116231232881546, -0.03849951922893524, -0.047597192227840424, 0.014226670376956463, 0.07501374930143356, -0.010224556550383568, 0.0323619619011879, -0.0006288972217589617, 0.0233811866492033, 0.00866489764302969, 0.017748406156897545, -0.04583794251084328, 0.02270251326262951, 0.06817681342363358, 0.004131413996219635, 0.046189986169338226, 0.046066734939813614, -0.0007612232002429664, -0.020086804404854774, -0.01602841354906559, -0.006102854385972023, -0.005882710218429565, 0.033198948949575424, 0.027804933488368988, -0.016732029616832733, 0.00167349842377007, -0.04144435375928879, 0.05227737873792648, 0.03445608168840408, 0.034567538648843765, -0.04322592541575432, 0.015364602208137512, 0.002601547632366419, 0.038886357098817825, 0.02706260234117508, 0.017441188916563988, -0.004942173603922129, 0.05166637897491455, 0.034383948892354965, 0.006111435126513243, 0.04286792129278183, -0.010999447666108608, 0.009218975901603699, 0.026677610352635384, -0.025397207587957382, -0.038457680493593216, -0.006800040602684021, -0.020146282389760017, -0.00351069588214159, 0.01715051755309105, -0.012569933198392391, -0.01484710443764925, -0.009415012784302235, -0.01597566530108452, 0.02781895361840725, -0.0199138056486845, 0.003985023591667414, -0.0064963530749082565, 0.04395188018679619, -0.005362099502235651, -0.012627885676920414, 0.03174673765897751, -0.01683899760246277, 0.06114834174513817, 0.02388898655772209, -0.018140004947781563, -0.00957201886922121, 0.011167873628437519, 0.00011439077934483066, -0.00013456314627546817, 0.010964841581881046, -0.020106913521885872, 0.0027106301859021187, 0.03926703706383705, 0.010255479253828526, 0.004999694414436817, 0.02572687156498432, 0.03393758088350296, -0.00446282560005784, -0.040180809795856476, 0.01359750796109438, 0.009379038587212563, -0.025961201637983322, 0.026740998029708862, -0.041337333619594574, 0.005559319164603949, 0.012026305310428143, 0.04823847860097885, 0.03732357919216156, 0.026499252766370773, -0.025593286380171776, -0.048236265778541565, -0.003953763283789158, -0.017984256148338318, -0.013851587660610676, 0.017875757068395615, 0.037320785224437714, -0.03467486798763275, -0.0005310771521180868, 0.009011182002723217, 0.026011215522885323, 0.0076401070691645145, -0.006806373130530119, 0.03822830691933632, -0.025159627199172974, -0.027928246185183525, 0.005328896921128035, 0.039996709674596786, -0.003798307152464986, 0.004037884529680014, 0.0016933005535975099, -0.01903737150132656, -0.022786131128668785, -0.05662316083908081, 0.0025503807701170444, -0.03818409517407417, -0.0003940529131796211, -0.01656058058142662, -0.06134500354528427, 0.011476160027086735, -0.013722200877964497, -0.006939660292118788, 0.010307359509170055, -0.05199471488595009, 0.0062468694522976875, 0.0014294448774307966, 0.02604644186794758, -0.011467207223176956, -0.004474946763366461, 0.035896312445402145, 0.02172045223414898, 0.02002665400505066, 0.013008750975131989, -0.011030430905520916, 0.010480727069079876, 0.008906128816306591, -0.029713453724980354, 0.046056441962718964, 0.001722933491691947, -0.008636431768536568, -0.06091765686869621, -0.012446755543351173, 0.03705134615302086, -0.03062807209789753, -0.01266881637275219, -0.009518648497760296, 0.015170153230428696, -0.06364958733320236, -0.016838112846016884, 0.041906196624040604, 0.01034545712172985, 0.05605841428041458, 0.024474436417222023, -0.05111382529139519, 0.014159462414681911, 0.014124774374067783, -0.030261879786849022, 0.011367966420948505, 0.002678581513464451, 0.009370210580527782, 0.02408348210155964, 0.007328354753553867, 0.044444501399993896, 0.001233959454111755, -0.01167741697281599, 0.0030754883773624897, 0.00219707190990448, -0.04126426577568054, -0.015238527208566666, -0.0014129423070698977, 0.0038527052383869886, -0.0019291319185867906, -0.04537664353847504, 0.020884232595562935, 0.0037305387668311596, 0.007509331218898296, -0.0040656207129359245, -0.056848179548978806, 0.036901529878377914, 0.02033470943570137, 0.0376778207719326, 0.0008394955657422543, 0.06216347590088844, 0.015726016834378242, -0.009983636438846588, 0.0012908378848806024, 0.030179867520928383 ]
Retrieval Augmented Generation with Huggingface Transformers and Ray
amogkam
February 10, 2021
ray-rag
open-source-collab, nlp
https://huggingface.co/blog/ray-rag
A guest blog post by Amog Kamsetty from the Anyscale team Huggingface Transformers recently added the Retrieval Augmented Generation (RAG) model, a new NLP architecture that leverages external documents (like Wikipedia) to augment its knowledge and achieve state of the art results on knowledge-intensive tasks. In this blog post, we introduce the integration of Ray, a library for building scalable applications, into the RAG contextual document retrieval mechanism. This speeds up retrieval calls by 2x and improves the scalability of RAG distributed fine-tuning.
[ 0.016339730471372604, -0.005169233772903681, 0.0412820428609848, -0.0407458133995533, -0.004438361618667841, -0.04038814455270767, 0.032021135091781616, -0.00034184337710030377, 0.02665744535624981, -0.01217904593795538, -0.13028116524219513, 0.07442153245210648, -0.009204022586345673, 0.12289701402187347, 0.038325536996126175, 0.03401316702365875, -0.019398238509893417, -0.03657733276486397, -0.03164543956518173, -0.01385010126978159, 0.005332204047590494, -0.04675249010324478, -0.0077405464835464954, 0.012478646822273731, 0.04709766060113907, -0.09468696266412735, -0.015145581215620041, -0.027574339881539345, 0.055008579045534134, -0.0007315950351767242, -0.042033422738313675, -0.02052534930408001, -0.04101857542991638, -0.038130514323711395, 0.005120634566992521, 0.048344533890485764, -0.08888953179121017, 0.03778700530529022, -0.0694342777132988, -0.07658272981643677, 0.08142994344234467, 0.014733832329511642, -0.04978962242603302, 0.0614711157977581, 0.06829117983579636, -0.02170053869485855, -0.042278219014406204, -0.030047930777072906, -0.01583925634622574, -0.006270513404160738, -0.07597829401493073, 0.033844005316495895, -0.03835361823439598, -0.007140282541513443, 0.014681020751595497, 0.05739092454314232, 0.00720053818076849, -0.0807725042104721, 0.02319759875535965, 0.052301306277513504, -0.043894123286008835, -0.0434219092130661, 0.0009857792174443603, 0.00486241839826107, -0.010983392596244812, 0.014644600450992584, -0.03928357735276222, -0.028786437585949898, -0.07319556921720505, 0.030967695638537407, 0.06365673243999481, 0.005112560000270605, -0.04905115067958832, -0.019698629155755043, -0.013932948932051659, 0.028924422338604927, 0.0231470987200737, 0.020917480811476707, 0.025206176564097404, 0.011804431676864624, -0.05797891318798065, -0.0024016599636524916, 0.07778917998075485, 0.018689604476094246, 0.08298496901988983, 0.0011045511346310377, 0.013838264159858227, -0.06773101538419724, -0.10715541988611221, 0.00986443366855383, -0.005655943416059017, -0.13358893990516663, -0.017795685678720474, 0.021894728764891624, 0.07471302151679993, -0.026705265045166016, 0.0002481492410879582, 0.010388360358774662, 0.0014134550001472235, 0.01109925378113985, -0.06198584660887718, -0.040803730487823486, 0.02058916911482811, -0.05572518706321716, -0.08738413453102112, 0.07029787451028824, -0.04170764982700348, -0.062085434794425964, -0.02982047013938427, 0.06985825300216675, -0.025726594030857086, 0.06275677680969238, -0.030770037323236465, 0.06156288832426071, -0.02323569357395172, -0.02207300253212452, 0.009137608110904694, 0.004845962859690189, 0.030628981068730354, -0.02820739895105362, -0.01284612063318491, 0.0365590900182724, 0.06881032884120941, 0.07260609418153763, 0.04613819718360901, 0.053312238305807114, 0.007235638331621885, -0.01893603801727295, -0.044591568410396576, 0.03777950257062912, 0.011762062087655067, -0.03599599748849869, 0.062480438500642776, 0.042558178305625916, -0.04860805347561836, 0.0191060658544302, 0.020988166332244873, -0.023295756429433823, -0.01410778146237135, 0.008813276886940002, 0.013068223372101784, -0.01390715129673481, -0.03919016197323799, -0.11818024516105652, 0.04404387250542641, 0.00029922337853349745, -0.030987517908215523, 0.023318149149417877, -0.02392178401350975, -0.02897528186440468, -0.008920585736632347, 0.052857402712106705, 0.02112996205687523, 0.007500936277210712, -0.0012175390729680657, 0.05106378719210625, 0.01728641800582409, -0.0031128127593547106, 0.05128327012062073, 0.0023512865882366896, 0.0012254645116627216, 0.01683971844613552, -0.04418836161494255, 0.0008568130433559418, -0.024897141382098198, -0.012593306601047516, -0.01812690496444702, 0.06744243204593658, 0.012476202100515366, -0.05082467570900917, 0.0354035459458828, 0.0011763753136619925, -0.024367913603782654, -0.053899265825748444, -0.028663070872426033, 0.039536312222480774, 0.009057428687810898, -0.020981410518288612, 0.02138042077422142, -0.0410379059612751, -0.08646026998758316, 0.05511867254972458, 0.011877305805683136, 0.059263598173856735, 0.010639297775924206, -0.01822737045586109, 0.09036117792129517, 0.001397581654600799, 0.009631170891225338, -0.02077309414744377, -0.08244127035140991, -0.010226522572338581, 0.03588299825787544, 0.0033087723422795534, 0.0077354093082249165, 0.009202230721712112, -0.03575938940048218, 0.12467709928750992, 0.08532761037349701, 0.004329032730311155, 0.04813358932733536, -0.0006077926373109221, 0.06393100321292877, -0.05208844318985939, 0.01965741254389286, -0.11455943435430527, 0.024784132838249207, -0.016123028472065926, -0.03290209546685219, 0.07473355531692505, -0.03382384404540062, -0.08928900212049484, -0.03581610694527626, -0.09662092477083206, 0.012256922200322151, -0.03464600071310997, -0.031155332922935486, 0.00414467416703701, -0.002062119310721755, 0.010717184282839298, 0.11040688306093216, -0.03464452549815178, -0.016996260732412338, -0.052384473383426666, 0.06879917532205582, 0.09615601599216461, 0.03887123242020607, 0.028128376230597496, 0.012446744367480278, -0.07227334380149841, 0.03992424160242081, -0.027635063976049423, -0.08020330220460892, -0.025739561766386032, -0.050513140857219696, -0.025810319930315018, 0.022540828213095665, -0.017809240147471428, -0.005328144878149033, -0.0032184706069529057, -0.042958855628967285, 0.053586192429065704, 0.005220080725848675, 0.017084967344999313, 0.11434976756572723, -0.024323394522070885, 0.04301030933856964, 0.07134820520877838, -0.045255184173583984, -0.046171702444553375, -0.05909697711467743, 0.0776309072971344, -0.023440135642886162, -0.0149312075227499, 0.020542768761515617, 0.06117905676364899, 0.0026783719658851624, -0.027393251657485962, -0.015867238864302635, 0.052807945758104324, -0.023374663665890694, 0.02957281284034252, -0.05034954845905304, -0.010683462023735046, -0.0005217661382630467, -0.028564903885126114, -0.0403059646487236, 0.02399287186563015, 0.03269190713763237, -0.03218875452876091, 0.015582919120788574, -0.03751734644174576, 0.04218533635139465, 0.018858760595321655, 0.0036439376417547464, 0.019047943875193596, 0.013563185930252075, -0.021054202690720558, -0.011595090851187706, -0.031029509380459785, -0.052161604166030884, -0.052088674157857895, 0.062115203589200974, 0.051471415907144547, 0.021346604451537132, -0.004343005828559399, -0.014436568133533001, -0.018333833664655685, -0.022559575736522675, -0.009120352566242218, -0.005160212051123381, 0.015809033066034317, -0.020123831927776337, -0.003399293404072523, -0.009069886058568954, 0.003582750679925084, 0.024232760071754456, 0.00419675512239337, -0.017660116776823997, -0.01570514589548111, -0.05794224515557289, -0.04116976261138916, -0.009009649977087975, 0.003381273942068219, -0.00045563626918010414, -0.03294346481561661, -0.0038551134057343006, 0.003945097327232361, -0.05696442350745201, -0.04161670804023743, -0.04311761632561684, 0.03143932670354843, -0.00008828358841128647, -0.030528124421834946, 0.008273539133369923, 0.02211948111653328, -0.012061595916748047, -0.03576761484146118, -0.02882329188287258, -0.012932313606142998, 0.02889241650700569, -0.019183119758963585, -0.023903241381049156, -0.07459966838359833, -0.010533508844673634, -0.023557111620903015, 0.005914414767175913, -0.022435741499066353, 0.008268988691270351, -0.014162612147629261, -0.03092324733734131, 0.008647813461720943, 0.007812468335032463, -0.006735683418810368, -0.014483214356005192, -0.053715676069259644, 0.015746958553791046, -0.05092306062579155, 0.03794942423701286, -0.042384788393974304, 0.02353641204535961, 0.048953503370285034, -0.027951469644904137, -0.035177845507860184, 0.02892756462097168, 0.0003638234338723123, 0.005402932874858379, 0.029030142351984978, 0.020314082503318787, 0.0012462146114557981, 0.011644557118415833, 0.0016708187758922577, 0.012609463185071945, -0.024784885346889496, 0.005205904133617878, 0.00577772269025445, 0.018726514652371407, -0.03221159055829048, -0.053377505391836166, -0.009623252786695957, 0.009365529753267765, 0.07346366345882416, -0.03898037225008011, 0.015100512653589249, 0.009216506034135818, -0.05727125331759453, -0.008366386406123638, 0.038741450756788254, -0.00039058513357304037, 0.0013772794045507908, 0.0063906703144311905, -0.02561021037399769, 0.03988813981413841, 0.06538967043161392, -0.015163336880505085, -0.03555747866630554, -0.026762977242469788, 0.03475295007228851, -0.022011522203683853, 0.007810497190803289, 0.009805326350033283, 0.006245343014597893, -0.02599036879837513, -0.0020459273364394903, 0.0024889486376196146, -0.028863387182354927, 0.023293981328606606, 0.002976375399157405, -0.060457997024059296, -0.02905009128153324, -0.047134969383478165, -0.0074926260858774185, 0.0015324816340580583, -0.026812905445694923, 0.022742416709661484, -0.055547118186950684, 0.001368630793876946, 0.051239460706710815, 0.01610165648162365, -0.022246185690164566, -0.029884809628129005, 0.016399510204792023, -0.01235191524028778, 0.011932358145713806, 0.0031100453343242407, 0.02940189838409424, -0.025281643494963646, -0.013508324511349201, 0.029767103493213654, -0.04818418249487877, -0.028373749926686287, 0.013125569559633732, 0.007485318463295698, 0.040856245905160904, -0.019250402227044106, -0.04202078655362129, 0.04172488674521446, 0.03624633699655533, -0.03931098431348801, 0.008769701234996319, -0.028471026569604874, 0.02415863424539566, 0.010808020830154419, -0.03976375609636307, 0.03172994777560234, 0.04477321356534958, -0.03800363838672638, 0.0022539645433425903, 0.03984725847840309, 0.00221384153701365, 0.019610151648521423, 0.0038398487959057093, -0.017614243552088737, -0.028899190947413445, 0.019733140245079994, -0.01784534752368927, -0.0216296948492527, 0.002205696189776063, 0.0046586524695158005, -0.00676201656460762, 0.06350865215063095, 0.014588613063097, -0.030113082379102707, 0.00005195658377488144, -0.0008435680065304041, -0.0031203837133944035, -0.012042514979839325, -0.01633022539317608, 0.03712037205696106, 0.01835992932319641, 0.00601504510268569, -0.019428592175245285, -0.0050803013145923615, -0.021464459598064423, 0.02130584605038166, 0.015874285250902176, -0.05478888377547264, -0.00405893474817276, 0.005009276792407036, 0.00550359720364213, -0.013519171625375748, 0.023936333134770393, 0.014812035486102104, -0.009267205372452736, 0.032144539058208466, 0.03333272784948349, 0.014370900578796864, 0.023527493700385094, -0.029639294371008873, -0.0036578483413904905, -0.07123667001724243, 0.00024230472627095878, -0.0033757907804101706, 0.024052757769823074, 0.002319175051525235, 0.01922929473221302, 0.024118345230817795, 0.010014263913035393, -0.020292166620492935, 0.03744075074791908, 0.011773397214710712, 0.022709833458065987, -0.06618671864271164, 0.08244949579238892, 0.0901186615228653, -0.009530891664326191, -0.007327172439545393, 0.00908671971410513, 0.003965410403907299, 0.005807233974337578, 0.014382543042302132, -0.008530442602932453, 0.0601421520113945, 0.019108252599835396, 0.028297344222664833, 0.03396786004304886, -0.012483124621212482, 0.0014260680181905627, 0.022079763934016228, 0.012929099611938, -0.013937217183411121, -0.0012890311190858483, -0.0018293734174221754, -0.021375378593802452, -0.03301198035478592, 0.010541066527366638, 0.02087368071079254, 0.012765313498675823, 0.008815494365990162, 0.03867119923233986, -0.0211768951267004, -0.02622758224606514, 0.019961494952440262, -0.04961428791284561, -0.0171770378947258, 0.0032699676230549812, 0.008774219080805779, 0.03573201596736908, -0.04121619090437889, -0.036208949983119965, 0.012933221645653248, -0.02711429074406624, 0.004629834089428186, -0.01474248431622982, -0.020999303087592125, 0.050055645406246185, -0.04074018821120262, -0.0029292204417288303, -0.04886622726917267, 0.00811786763370037, 0.025969374924898148, -0.00435673538595438, 0.01766873151063919, -0.045918770134449005, 0.017045069485902786, 0.010152740404009819, -0.024877309799194336, -0.020977530628442764, 0.025448886677622795, -0.03612891212105751, -0.01285912748426199, 0.02203189767897129, -0.009959684684872627, 0.0018993336707353592, -0.032537929713726044, 0.04143737256526947, 0.051609959453344345, -0.0371064729988575, 0.08948414027690887, 0.01193048432469368, -0.009354586713016033, -0.008924978785216808, -0.019412962719798088, 0.06827160716056824, 0.023609647527337074, 0.04325220361351967, 0.023731471970677376, 0.004549452103674412, 0.025145821273326874, -0.02025057002902031, -0.03842921555042267, 0.015391888096928596, 0.0020808742847293615, 0.03707325458526611, 0.03126849606633186, -0.005752906668931246, -0.006109562702476978, 0.03887657821178436, 0.008785841055214405, -0.03716905415058136, -0.016836194321513176, 0.0035800011828541756, -0.013121179305016994, 0.0037176122423261404, 0.04269816353917122, -0.028691250830888748, -0.016223657876253128, 0.043866708874702454, -0.04619144648313522, 0.035326555371284485, -0.004818490240722895, -0.006467889063060284, 0.0022892700508236885, 0.023566029965877533, 0.03516305983066559, 0.0275968499481678, 0.06530553847551346, 0.000258121348451823, 0.0020188256166875362, 0.017303835600614548, 0.04503215476870537, -0.05386839807033539, 0.03348173573613167, 0.03489619493484497, 0.06689025461673737, -0.000002489371809133445, 0.03519228473305702, 0.02844829298555851, -0.02219841443002224, 0.05471808835864067, 0.012797948904335499, -0.01672406494617462, 0.01160851214081049, -0.02060265839099884, 0.05642784386873245, 0.01975160464644432, -0.02675732411444187, 0.0023730923421680927, 0.04370703548192978, 0.011365428566932678, 0.039521295577287674, 0.02161768078804016, 0.020479286089539528, 0.012246993370354176, -0.00032375467708334327, 0.019661108031868935, 0.0421915240585804, -0.02750970795750618, 0.003932590130716562, 0.03937053680419922, 0.001147740869782865, 0.016985345631837845, -0.01001330092549324, -0.026070408523082733, 0.020863059908151627, -0.03968115895986557, 0.04080711305141449, -0.040800247341394424, 0.00780223123729229, -0.006100468337535858, 0.034797195345163345, 0.006615908350795507, -0.0034214158076792955, 0.020890137180685997, 0.009081018157303333, -0.019105123355984688, 0.0037805784959346056, -0.029731031507253647, 0.013029806315898895, 0.007408900652080774, 0.0013711859937757254, -0.016457263380289078, 0.033252473920583725, -0.002034406876191497, 0.02119004912674427, 0.069289930164814, -0.03200910985469818, -0.011971109546720982, -0.026533903554081917, 0.00754437455907464, 0.01640923134982586, 0.018240051344037056, -0.017594123259186745, -0.009222596883773804, -0.03484212979674339, -0.017606431618332863, -0.00748827401548624, 0.02706783451139927, -0.027622714638710022, 0.031360410153865814, -0.04991515353322029, 0.005788472015410662, 0.0007921630749478936, -0.03591912239789963, -0.01173264067620039, -0.0030041830614209175, -0.0409814715385437, -0.017777511849999428, 0.004835541360080242, 0.02502041682600975, 0.05830417200922966, -0.038869161158800125, 0.00041015533497557044, 0.005521129351109266, -0.010007145814597607, 0.010430924594402313, 0.04707712307572365, 0.018493225798010826, -0.039985962212085724, -0.013947805389761925, -0.008153768256306648, 0.0009226273978129029, 0.006878004875034094, -0.004019858781248331, 0.036379460245370865, -0.01663113571703434, -0.03692087158560753, -0.02474948577582836, -0.02525406889617443, 0.03720879554748535, 0.0027673880103975534, 0.07342801988124847, -0.001713898149318993, 0.04380228742957115, 0.03504985570907593, -0.028495118021965027, 0.06512274593114853, 0.019453736022114754, -0.0015043671010062099, -0.005650904029607773, -0.031338535249233246, -0.011304985731840134, -0.007228063885122538, 0.08738799393177032, -0.0031644555274397135, 0.05800989642739296, -0.01785227842628956, -0.011422757990658283, -0.06551530957221985, 0.004557145293802023, 0.06955689191818237, 0.011972553096711636, 0.012942244298756123, 0.006487269885838032, -0.004783788695931435, 0.014586305245757103, -0.021461302414536476, 0.05829109996557236, 0.055638134479522705, -0.010032456368207932, -0.0164964497089386, -0.05630584806203842, -0.018494784832000732, -0.004191509913653135, -0.0868007093667984, 0.028074627742171288, 0.022748099640011787, 0.011158863082528114, -0.006388166453689337, 0.03188442438840866, 0.0565326102077961, -0.002260028151795268, 0.05505366995930672, -0.03635959327220917, 0.004210325423628092, 0.0035571670159697533, -0.006313329096883535, -0.05127187445759773, 0.052746567875146866, 0.005582990124821663, -0.013575968332588673, 0.03037535399198532, -0.03766961768269539, 0.024984177201986313, -0.04793030396103859, 0.0044326940551400185, 0.004016460385173559, -0.0044294847175478935, -0.037158217281103134, 0.033642154186964035, 0.011491473764181137, -0.01799769699573517, -0.0007155158673413098, -0.0009901818120852113, -0.0061818878166377544, 0.011808848939836025, -0.06301794201135635, 0.05622323974967003, -0.009961255826056004, 0.00014402932720258832, 0.020590586587786674, 0.034915558993816376, 0.012109652161598206, 0.04453877732157707, 0.03217953443527222, -0.018512818962335587, -0.009974032640457153, -0.04726942256093025 ]
Retrieval Augmented Generation with Huggingface Transformers and Ray
amogkam
February 10, 2021
ray-rag
open-source-collab, nlp
https://huggingface.co/blog/ray-rag
# Retrieval Augmented Generation with Huggingface Transformers and Ray
[ -0.00573814008384943, -0.011619886383414268, 0.06047309190034866, -0.05958516150712967, -0.007295471150428057, 0.0049964748322963715, 0.014762823469936848, -0.008442972786724567, -0.008801029995083809, -0.049891676753759384, -0.08936797827482224, 0.047879938036203384, -0.004559834022074938, 0.08345704525709152, 0.014436225406825542, 0.02141443081200123, -0.018086140975356102, -0.033197853714227676, -0.0005557896802201867, 0.021373886615037918, -0.04274185746908188, -0.0438692532479763, 0.055429957807064056, -0.030971698462963104, 0.07009848952293396, -0.11793908476829529, 0.007050670217722654, 0.011198906227946281, -0.005542295519262552, 0.04279159754514694, -0.08653204143047333, -0.02317366562783718, 0.010474937036633492, -0.06062294542789459, -0.024808570742607117, 0.029003586620092392, -0.14445696771144867, 0.027320025488734245, -0.007259626407176256, -0.0657302588224411, 0.016966575756669044, 0.003715310012921691, -0.002926080022007227, -0.008242004550993443, 0.038045357912778854, -0.031472861766815186, -0.21350432932376862, 0.057299740612506866, -0.03975708410143852, 0.006170796696096659, -0.049664467573165894, 0.02801595814526081, -0.049835313111543655, 0.003735955338925123, 0.013176077045500278, 0.022472882643342018, -0.030047591775655746, -0.06923253834247589, 0.025602227076888084, 0.025643806904554367, 0.006332817487418652, 0.019266482442617416, 0.020259754732251167, 0.059150710701942444, -0.0207831971347332, -0.008083092048764229, 0.014440017752349377, -0.015742160379886627, -0.07190875709056854, 0.02309967204928398, 0.05991488695144653, 0.005199425388127565, -0.04544275999069214, -0.04761047661304474, 0.0059035723097622395, 0.016112832352519035, -0.005823673214763403, 0.06707838177680969, 0.043877746909856796, 0.058037929236888885, 0.022831860929727554, -0.026902256533503532, 0.10493336617946625, 0.06827892363071442, 0.039410702884197235, 0.051973145455121994, 0.02120119147002697, -0.02792927622795105, -0.0753990188241005, 0.049056217074394226, -0.033812567591667175, -0.14529889822006226, -0.0217575803399086, 0.048710379749536514, 0.08979666978120804, -0.03655512258410454, 0.007865333929657936, -0.018671076744794846, 0.050101280212402344, 0.030208894982933998, -0.08552902191877365, -0.01566372439265251, 0.02260386385023594, -0.041702061891555786, -0.09224020689725876, 0.0035093394108116627, -0.03669027239084244, -0.09404060244560242, -0.0004988146247342229, 0.022982502356171608, -0.004235990811139345, -0.016355231404304504, 0.060994233936071396, 0.0801597610116005, -0.07625696063041687, 0.010182679630815983, 0.019080424681305885, -0.030599603429436684, 0.01422314252704382, -0.0071568540297448635, 0.002109391149133444, 0.0806880071759224, 0.05600383132696152, 0.034501008689403534, 0.05207508057355881, 0.07582905143499374, 0.009125737473368645, -0.009459112770855427, -0.006916118785738945, 0.03612913563847542, -0.008859028108417988, -0.014156526885926723, 0.025821145623922348, 0.02260102517902851, -0.023393014445900917, -0.04410967975854874, 0.024270404130220413, -0.0761234387755394, -0.0015139607712626457, -0.04345386102795601, -0.023922372609376907, -0.011442399583756924, 0.03268308565020561, -0.026085354387760162, 0.02026333659887314, -0.08014398068189621, -0.07636716216802597, 0.09902344644069672, -0.02365356683731079, 0.006857436150312424, -0.030091162770986557, 0.06670138239860535, -0.040131304413080215, -0.022855596616864204, -0.06983169913291931, 0.06675966829061508, 0.003087465651333332, -0.0005753983277827501, -0.015277954749763012, 0.016973085701465607, -0.0021453043445944786, 0.03772934898734093, -0.05215855687856674, 0.04661218822002411, 0.027007589116692543, -0.01605546474456787, -0.055969033390283585, 0.03680868446826935, 0.02031426504254341, -0.03477487713098526, 0.021113723516464233, -0.034693703055381775, -0.03857482224702835, -0.03314933553338051, -0.03804481774568558, 0.032745324075222015, 0.060945652425289154, 0.009154007770121098, -0.010067292489111423, -0.033357080072164536, -0.04571884870529175, -0.009575337171554565, 0.001946409698575735, 0.021272240206599236, 0.05838511139154434, -0.03478473052382469, 0.02444438450038433, 0.023303911089897156, 0.048282887786626816, 0.04697542265057564, -0.05043124780058861, -0.07373197376728058, 0.00758323585614562, -0.043087515980005264, -0.0026488793082535267, -0.05571690574288368, -0.03994142264127731, 0.1294662058353424, 0.05695134401321411, 0.05969841405749321, 0.008588756434619427, -0.008859491907060146, 0.045925986021757126, -0.04886992648243904, -0.011604038067162037, -0.0592324323952198, 0.04027913138270378, -0.007199784740805626, -0.030183512717485428, 0.07066860049962997, -0.0015921209705993533, -0.10082969814538956, 0.033772747963666916, -0.11841550469398499, -0.010149387642741203, -0.01672382466495037, -0.03899329900741577, -0.04669155180454254, -0.02931199036538601, 0.005659068003296852, 0.13800279796123505, 0.008186053484678268, -0.00349234975874424, -0.029474491253495216, -0.0011351120192557573, 0.09689781069755554, 0.05538375675678253, 0.038805488497018814, 0.04043995589017868, -0.0937466248869896, 0.019531548023223877, -0.022898254916071892, -0.056704308837652206, 0.01699824631214142, -0.012215297669172287, 0.00008987922046799213, 0.0691317543387413, -0.012980123981833458, 0.026037337258458138, 0.005048389546573162, -0.01556900329887867, -0.010482097044587135, 0.014783481135964394, 0.04455658793449402, 0.006528482772409916, -0.0031075100414454937, 0.04468967393040657, 0.03641236573457718, -0.06384724378585815, -0.05401654914021492, -0.028872540220618248, 0.060967449098825455, -0.041462939232587814, -0.038763366639614105, 0.08844766020774841, 0.042370449751615524, -0.022516870871186256, -0.04276395961642265, -0.027406683191657066, 0.03785998746752739, 0.006102557294070721, -0.010967650450766087, -0.036444250494241714, -0.037800099700689316, -0.022022750228643417, -0.0447690412402153, -0.004879620857536793, 0.035600628703832626, 0.009575380012392998, 0.050283282995224, 0.026314470916986465, -0.024519361555576324, 0.042217180132865906, 0.003984398674219847, -0.000890352122951299, 0.013551846146583557, 0.06360273063182831, -0.019790474325418472, -0.00644375616684556, 0.0007420315523631871, -0.001735230442136526, 0.005120450630784035, 0.04295596480369568, 0.05564068630337715, 0.02342946268618107, -0.010265285149216652, 0.02390027791261673, -0.001510300557129085, -0.014948748983442783, 0.015584936365485191, 0.022198908030986786, 0.03053531050682068, -0.00149144500028342, 0.001530883484520018, 0.014523372054100037, 0.017066940665245056, 0.005503571592271328, 0.0007375701679848135, -0.01097321417182684, 0.003987698350101709, -0.029271604493260384, -0.006929666735231876, -0.0156891830265522, 0.02803824655711651, -0.03199247643351555, -0.005134248174726963, 0.030175676569342613, 0.02385214902460575, -0.10453617572784424, -0.07528609782457352, 0.0020967433229088783, 0.04496186971664429, -0.002475148532539606, -0.03721502795815468, 0.003783602500334382, -0.018970703706145287, -0.0005428955191746354, -0.014600557275116444, -0.010263878852128983, -0.009894604794681072, 0.0383925624191761, 0.00030738336499780416, 0.0003151448327116668, -0.04085922986268997, -0.023229584097862244, -0.019586533308029175, 0.031071646139025688, -0.009551585651934147, -0.01919020712375641, 0.008043832145631313, -0.004076644778251648, 0.004923953674733639, 0.0021798680536448956, -0.017198294401168823, 0.022202709689736366, 0.00424360204488039, 0.029849262908101082, -0.05221393331885338, 0.019635310396552086, 0.0067370133474469185, -0.004764105658978224, 0.025678345933556557, -0.033353015780448914, -0.00477958656847477, 0.01489818561822176, -0.021117795258760452, 0.048367418348789215, 0.005989682860672474, 0.026198655366897583, 0.006058044265955687, -0.006543328519910574, -0.010572350583970547, 0.002322765998542309, -0.056373246014118195, -0.013006257824599743, 0.057542379945516586, 0.02276693657040596, -0.05804067477583885, -0.046196840703487396, -0.010408098809421062, -0.016970273107290268, 0.050889573991298676, 0.015935018658638, 0.010136989876627922, 0.011022621765732765, 0.010444872081279755, 0.023358777165412903, 0.005581509787589312, -0.07130348682403564, -0.011370223946869373, 0.002430747030302882, -0.01255867537111044, -0.01846584491431713, 0.06566936522722244, 0.00031309749465435743, 0.03841628506779671, 0.011958028189837933, 0.06409849971532822, -0.0013486603274941444, -0.011790076270699501, -0.004796059802174568, 0.024434322491288185, -0.010192789137363434, 0.03608306497335434, -0.00017345877131447196, -0.050460174679756165, 0.05555117502808571, -0.02916046604514122, -0.04828929901123047, -0.024686941877007484, -0.06106061115860939, -0.018846837803721428, -0.00742370868101716, -0.0323551669716835, -0.00030918981065042317, -0.01250737439841032, 0.027557143941521645, 0.043842341750860214, -0.005077437497675419, -0.04089437797665596, 0.001300441101193428, -0.0029739076271653175, -0.026461662724614143, 0.013803414069116116, 0.029626918956637383, -0.009177600033581257, -0.027991948649287224, 0.01918802782893181, 0.021153897047042847, -0.04079434648156166, -0.017147529870271683, -0.0012973162811249495, 0.018940649926662445, 0.030082127079367638, -0.03553878888487816, -0.024178141728043556, 0.026761682704091072, 0.016143398359417915, 0.008191893808543682, -0.038469649851322174, -0.02027318812906742, 0.023098157718777657, 0.028952721506357193, 0.005908567924052477, -0.011760410852730274, -0.0080184955149889, -0.022401630878448486, 0.03333790600299835, -0.01621919684112072, 0.04545358195900917, -0.01392766460776329, 0.027835050597786903, -0.018912794068455696, -0.03163367137312889, 0.017576029524207115, 0.019536899402737617, -0.04401164874434471, 0.005255729425698519, -0.007549511734396219, -0.015290570445358753, 0.06160309165716171, 0.004421875812113285, 0.014297278597950935, 0.0022888670209795237, 0.0033139842562377453, -0.004869516938924789, -0.003210714552551508, -0.04927434027194977, -0.00691556790843606, -0.00523024657741189, 0.005032429471611977, -0.01735050603747368, 0.023175664246082306, -0.0051773060113191605, -0.02285131998360157, 0.0004963544779457152, -0.01791374757885933, 0.010938790626823902, 0.02280530333518982, -0.037714019417762756, -0.048942822962999344, 0.028913995251059532, 0.025296660140156746, 0.01608411595225334, 0.01606677658855915, 0.016281038522720337, 0.011136830784380436, 0.01517237164080143, 0.017199575901031494, -0.004993599373847246, -0.08130118995904922, 0.024019431322813034, 0.02034536749124527, 0.02036246657371521, 0.018894338980317116, -0.06549286842346191, 0.04264198616147041, 0.012635228224098682, -0.008807620964944363, -0.0019406318897381425, 0.03408611938357353, -0.019521690905094147, -0.06177978217601776, 0.05938369035720825, 0.06298724561929703, -0.014912002719938755, 0.014223257079720497, 0.006402142345905304, -0.012625799514353275, 0.03603508695960045, 0.027369122952222824, -0.0010383650660514832, 0.0520964190363884, 0.020944872871041298, 0.041613977402448654, 0.03737679496407509, -0.002481426578015089, -0.0008155801333487034, 0.012650195509195328, -0.014514682814478874, 0.011127782054245472, -0.030229421332478523, 0.005872748326510191, -0.01729673519730568, -0.008885601535439491, -0.02299560233950615, -0.013472596183419228, -0.012103712186217308, 0.043863557279109955, 0.03893507272005081, -0.013969392515718937, -0.016438189893960953, 0.020257271826267242, -0.017161788418889046, 0.017397252842783928, 0.01967182755470276, 0.010676922276616096, -0.005927492398768663, -0.0012634756276383996, -0.014327122829854488, -0.02388118766248226, -0.037485040724277496, 0.0005530628841370344, -0.02814299426972866, -0.01994691789150238, -0.013659067451953888, -0.014391597360372543, 0.0312399510294199, -0.030289020389318466, 0.010948188602924347, 0.021131306886672974, -0.006532216444611549, 0.044772353023290634, -0.026608804240822792, 0.044313374906778336, 0.02235165238380432, -0.0245208740234375, 0.016183800995349884, 0.02721433900296688, -0.014731663279235363, 0.0060654859989881516, 0.03528454899787903, 0.00041483319364488125, 0.03063581883907318, -0.022505957633256912, 0.05419504642486572, 0.03823196515440941, -0.008603399619460106, 0.06928031146526337, -0.00562960235401988, -0.008059624582529068, -0.006456183735281229, -0.027393847703933716, 0.030078157782554626, 0.07358326762914658, 0.02987765707075596, -0.008434277027845383, 0.008742593228816986, 0.006260243710130453, -0.00751452287659049, -0.0198590736836195, -0.002480283146724105, 0.006709258072078228, 0.018915874883532524, 0.0034816237166523933, -0.017781563103199005, -0.015553900972008705, 0.034474436193704605, 0.016340725123882294, -0.044020138680934906, -0.027195628732442856, -0.002465496538206935, -0.02541842870414257, 0.039000604301691055, 0.015202104113996029, 0.0019925220403820276, -0.003814036725088954, 0.03877231106162071, -0.013633509166538715, 0.06306163966655731, 0.0031123682856559753, 0.005406621843576431, -0.018595779314637184, -0.021963268518447876, 0.012150191701948643, 0.0626019835472107, 0.014730985276401043, 0.0345933735370636, 0.011076006107032299, 0.0076010278426110744, 0.03548085317015648, -0.010060654953122139, 0.021891571581363678, 0.011787623167037964, 0.06922641396522522, -0.004029704257845879, 0.04406183212995529, 0.037185169756412506, 0.008433076553046703, 0.02103998139500618, 0.0018568619852885604, -0.009163657203316689, 0.01672963984310627, -0.014017220586538315, 0.031731005758047104, -0.012249978259205818, 0.02002735249698162, 0.0021866445895284414, 0.047393783926963806, 0.007331492844969034, 0.051384154707193375, -0.027113474905490875, 0.05464760586619377, 0.014344646595418453, 0.030620938166975975, 0.019194552674889565, 0.03020414151251316, 0.027772272005677223, -0.0014081955887377262, 0.06410150229930878, 0.002880259184166789, 0.01840255595743656, 0.012236303649842739, -0.006515665911138058, 0.030506810173392296, 0.0038220055866986513, -0.02658969908952713, -0.022383973002433777, -0.0019210060127079487, -0.03386683017015457, 0.013189314864575863, 0.021192340180277824, -0.01909203827381134, -0.00974950660020113, 0.0058344281278550625, 0.00009955319546861574, -0.019496342167258263, 0.003479504492133856, -0.014982440508902073, 0.04037683829665184, -0.01058440562337637, 0.0024428474716842175, 0.06298281997442245, -0.012157903984189034, 0.03951137512922287, 0.02832023613154888, -0.040134891867637634, -0.014760946854948997, -0.033700130879879, 0.011369910091161728, 0.005967379081994295, -0.00045569331268779933, -0.00714355381205678, -0.008747384883463383, -0.03428330272436142, 0.02673092484474182, -0.008030464872717857, 0.029476948082447052, -0.0003412140940781683, 0.015356030315160751, -0.042150791734457016, 0.0008707671076990664, -0.04369261488318443, 0.017779914662241936, -0.034727759659290314, -0.04301055893301964, -0.01145106554031372, -0.0011028321459889412, 0.009120762348175049, 0.04274855926632881, 0.029926352202892303, -0.0652361512184143, -0.020611697807908058, -0.014720452018082142, -0.021709270775318146, 0.02438560128211975, 0.03833791986107826, 0.00006052094613551162, -0.011946444399654865, 0.0019411687972024083, 0.014950092881917953, 0.022691722959280014, -0.018576838076114655, 0.01055790577083826, 0.022994553670287132, -0.02882925048470497, -0.044675763696432114, 0.012438838370144367, 0.043022867292165756, 0.023565489798784256, 0.012361323460936546, 0.048689186573028564, 0.026193048804998398, 0.005520704202353954, -0.029638972133398056, 0.014880508184432983, -0.001962862676009536, 0.04552045837044716, -0.01188331563025713, -0.014145380817353725, -0.012071920558810234, -0.05667265132069588, -0.03314509987831116, 0.04081454128026962, -0.04135015606880188, 0.038212716579437256, -0.0022508588153868914, -0.00995924323797226, -0.05540936067700386, 0.04047504812479019, 0.0843791589140892, 0.014834788627922535, 0.02662593685090542, -0.014966062270104885, -0.005336323287338018, 0.009465137496590614, 0.014270586892962456, 0.025751598179340363, 0.035238850861787796, -0.021231088787317276, -0.018665121868252754, -0.04108786955475807, 0.002410729182884097, -0.027576448395848274, -0.07109645754098892, 0.03219634294509888, -0.006364841479808092, -0.021678965538740158, -0.019669700413942337, 0.019521469250321388, 0.040049050003290176, -0.009172245860099792, 0.05119984596967697, -0.01925603300333023, -0.028967157006263733, -0.001610221341252327, 0.032093774527311325, -0.05083084851503372, 0.048187095671892166, -0.008355727419257164, 0.028811195865273476, 0.04001934826374054, 0.01012116577476263, 0.014697588980197906, -0.018508130684494972, -0.019277423620224, -0.017604639753699303, -0.0020815234165638685, -0.05913056060671806, -0.006894614547491074, 0.001217799843288958, -0.00024360601673834026, -0.027852226048707962, -0.06066426262259483, 0.015337157063186169, -0.004501985386013985, -0.03216857090592384, -0.005463133566081524, -0.010934820398688316, 0.01188295241445303, 0.03178805857896805, 0.03242339938879013, -0.0034551883582025766, 0.028917592018842697, 0.01128455065190792, -0.0053459657356143, -0.004773658234626055, -0.03867906704545021 ]
Retrieval Augmented Generation with Huggingface Transformers and Ray
amogkam
February 10, 2021
ray-rag
open-source-collab, nlp
https://huggingface.co/blog/ray-rag
What’s next? Using RAG with Huggingface transformers and the Ray retrieval implementation for faster distributed fine-tuning, you can leverage RAG for retrieval-based generation on your own knowledge-intensive tasks. Also, hyperparameter tuning is another aspect of transformer fine tuning and can have huge impacts on accuracy. For scalable and easy hyperparameter tuning, check out the Ray Tune library. By using Ray Tune’s integration with PyTorch Lightning, or the built-in integration with Huggingface transformers, you can run experiments to find the perfect hyperparameters for your RAG model. And lastly, stay tuned for a potential Tensorflow implementation of RAG on Huggingface! If you plan to try RAG+Ray integration out, please feel free to share your experiences on the Ray Discourse or join the Ray community Slack for further discussion -- we’d love to hear from you! > Also published at https://medium.com/distributed-computing-with-ray/retrieval-augmented-generation-with-huggingface-transformers-and-ray-b09b56161b1e
[ 0.042962465435266495, -0.021800197660923004, 0.032987020909786224, -0.026996687054634094, -0.01928558759391308, 0.005975091364234686, 0.06655795872211456, -0.009545058012008667, -0.017669497057795525, -0.05452582240104675, -0.13355712592601776, 0.06436841934919357, -0.022642426192760468, 0.1406169831752777, 0.010854982770979404, -0.004086970817297697, 0.01048994343727827, -0.054226528853178024, -0.03817380964756012, 0.03927456960082054, 0.007354869972914457, -0.06025993824005127, -0.029241813346743584, 0.018054988235235214, 0.000381920748623088, -0.08585957437753677, -0.006521226838231087, 0.02376723662018776, 0.052864640951156616, 0.00011114225344499573, -0.08539340645074844, -0.019669264554977417, -0.03986283391714096, -0.06392835080623627, -0.048709891736507416, 0.041066598147153854, -0.08658069372177124, 0.04299388825893402, -0.030004821717739105, -0.0843874141573906, 0.05167629197239876, -0.02444414235651493, -0.037922438234090805, 0.0651640072464943, 0.08333691209554672, -0.0004558386281132698, -0.08549612760543823, 0.017417965456843376, -0.008075704798102379, -0.02447373792529106, -0.06566797941923141, 0.05662216991186142, -0.039225563406944275, -0.025089500471949577, 0.019051792100071907, 0.05404381826519966, 0.005540336482226849, -0.03527098894119263, 0.007033948786556721, 0.05318211019039154, -0.005396346095949411, -0.025330593809485435, 0.014671928249299526, 0.03153394162654877, -0.017857205122709274, 0.006249693222343922, -0.041442569345235825, -0.022283481433987617, -0.07986833900213242, -0.02174222283065319, 0.050852298736572266, -0.026376180350780487, -0.010906388983130455, -0.0351375937461853, -0.01511095929890871, 0.023287072777748108, -0.010298429057002068, 0.019155975431203842, 0.03884224593639374, 0.05168133229017258, -0.043283410370349884, -0.04980703443288803, 0.07835885137319565, 0.016249941661953926, 0.07009280472993851, -0.001989520387724042, -0.0018352019833400846, -0.011808017268776894, -0.07289915531873703, 0.04100450873374939, -0.03362414985895157, -0.14363084733486176, -0.027933258563280106, 0.020097801461815834, 0.05863986164331436, -0.03912340849637985, -0.03626733645796776, -0.013594557531177998, -0.025892097502946854, 0.005125776864588261, -0.04750685393810272, -0.03760179877281189, 0.04037391394376755, -0.05747797712683678, -0.05967902019619942, 0.04184788092970848, -0.004179271403700113, -0.091364786028862, -0.021513570100069046, 0.060735177248716354, -0.023210659623146057, 0.06272360682487488, -0.019608650356531143, 0.08643177151679993, -0.06139592453837395, -0.022593989968299866, 0.01858648657798767, 0.006317686289548874, -0.00502102030441165, -0.013045853935182095, -0.007213688921183348, 0.06957340985536575, 0.07537040114402771, 0.050796594470739365, -0.024577287957072258, 0.06242908909916878, -0.01892581582069397, -0.0024121247697621584, 0.016044002026319504, 0.019612450152635574, 0.034193482249975204, -0.05376166105270386, 0.014426450245082378, 0.007335288915783167, -0.055244702845811844, -0.06735546886920929, 0.026181038469076157, -0.029291482642292976, -0.01917467638850212, 0.027274781838059425, -0.02580196037888527, -0.0071542770601809025, -0.012239960953593254, -0.08841081708669662, 0.026645947247743607, -0.05713643133640289, -0.04695374518632889, 0.07167751342058182, 0.0004148996085859835, 0.007772590033710003, -0.014999931678175926, 0.10508962720632553, -0.04095460847020149, 0.03412812948226929, -0.02910526655614376, 0.07012467831373215, 0.008482182398438454, -0.010467378422617912, 0.030219154432415962, 0.04509223997592926, -0.022056113928556442, 0.028096869587898254, -0.07370602339506149, 0.005041766446083784, 0.008310829289257526, -0.0022136089392006397, -0.01756512001156807, 0.05477446690201759, -0.008181643672287464, -0.03795507922768593, 0.03463860973715782, 0.007971247658133507, 0.019749099388718605, -0.052989766001701355, -0.029751531779766083, 0.03988243266940117, 0.037547238171100616, 0.051786359399557114, -0.014895790256559849, -0.04444846883416176, -0.05646327883005142, 0.05833057314157486, 0.028182150796055794, 0.0814167708158493, 0.02595134638249874, -0.0047285775654017925, 0.018115075305104256, -0.026729052886366844, 0.05064118281006813, 0.01885974407196045, -0.03192737698554993, -0.032205965369939804, 0.04906974732875824, -0.04012736678123474, 0.035218220204114914, -0.03459158539772034, -0.034855667501688004, 0.1019105538725853, 0.05254604294896126, 0.035752009600400925, 0.008239943534135818, -0.005013279616832733, 0.034797992557287216, -0.03502742573618889, -0.02677355520427227, -0.053387440741062164, 0.07265108823776245, -0.031096607446670532, -0.04261639714241028, 0.05850685015320778, 0.011661871336400509, -0.16438311338424683, -0.04538198560476303, -0.10538481175899506, 0.005578117910772562, -0.008312144316732883, -0.07694511115550995, -0.042707331478595734, -0.037206195294857025, 0.004201861098408699, 0.12544862926006317, -0.06607896834611893, 0.01295739971101284, 0.013127370737493038, 0.03578076511621475, 0.07888183742761612, 0.05579590052366257, 0.0391848087310791, 0.039365414530038834, -0.0687360167503357, 0.0184438768774271, -0.02135750837624073, -0.10948415100574493, 0.04958231747150421, -0.03336915746331215, -0.0459195114672184, -0.005902946460992098, -0.06115719676017761, 0.02907004952430725, 0.015191600657999516, -0.013033343479037285, 0.022987904027104378, -0.0000898322687135078, 0.0738540068268776, -0.0024373068008571863, -0.04500435292720795, 0.07902611792087555, 0.061708755791187286, -0.050589174032211304, -0.04459594935178757, -0.08537853509187698, 0.04876837879419327, -0.016357017681002617, -0.046380266547203064, 0.0274251289665699, 0.04188743233680725, -0.01099449023604393, 0.007193032652139664, -0.03684563562273979, 0.05016550049185753, 0.004351189825683832, -0.008406832814216614, -0.025138501077890396, -0.011656426824629307, 0.0018493656534701586, -0.01578873209655285, -0.015458590351045132, 0.03451134264469147, 0.016065169125795364, -0.015345895662903786, 0.006397163029760122, -0.0230322927236557, 0.04274900257587433, -0.002309743082150817, 0.014431263320147991, 0.03892526030540466, 0.06461125612258911, -0.021550249308347702, -0.00042189244413748384, 0.000054188079957384616, -0.005907425656914711, -0.016282476484775543, 0.07854075729846954, 0.04343719780445099, 0.013306164182722569, -0.01064373180270195, -0.012219416908919811, -0.01002836786210537, -0.005101446993649006, -0.015782130882143974, 0.002058838726952672, 0.021011725068092346, -0.024882102385163307, -0.01252586767077446, -0.012788058258593082, 0.0063318125903606415, 0.023119231685996056, -0.015333637595176697, -0.018969938158988953, 0.000009546897672407795, -0.048861514776945114, -0.032521430402994156, 0.004428890999406576, -0.015342471189796925, -0.016543904319405556, -0.027822600677609444, -0.0007013105205260217, 0.02249733917415142, -0.08317960053682327, -0.015859710052609444, -0.028049703687429428, 0.059550125151872635, -0.0018451916985213757, -0.006590270437300205, 0.007453472353518009, -0.01139577105641365, -0.011377379298210144, -0.022495459765195847, -0.03109295479953289, -0.0035448845010250807, 0.015325711108744144, 0.009024257771670818, 0.013544772751629353, -0.05529560148715973, 0.03682493045926094, -0.03221061825752258, -0.0035800794139504433, -0.019345363602042198, -0.0006753139314241707, 0.03771204501390457, -0.011290254071354866, 0.006129177287220955, -0.000514873128850013, -0.019856052473187447, 0.033359844237565994, -0.011750503443181515, 0.014234558679163456, -0.014543681405484676, 0.01779661327600479, -0.046573176980018616, 0.013630321249365807, 0.03588712960481644, -0.004122312180697918, -0.03689228370785713, -0.010788298211991787, -0.00367560307495296, 0.029416639357805252, 0.028305385261774063, 0.015114573761820793, -0.018351655453443527, 0.011602661572396755, -0.018759993836283684, 0.01017587911337614, -0.013367223553359509, -0.011060794815421104, 0.0167155209928751, 0.027886273339390755, -0.018016798421740532, -0.013927475549280643, -0.012633598409593105, 0.0005753127043135464, 0.05194898322224617, -0.023907389491796494, -0.010702147148549557, 0.010064246132969856, 0.0021367676090449095, 0.0440819151699543, 0.05248331278562546, -0.054421938955783844, 0.02135007455945015, 0.021211622282862663, 0.005655043758451939, 0.019938359037041664, 0.04135093837976456, -0.0005690706893801689, -0.05142519995570183, -0.03490852564573288, 0.020291157066822052, -0.02345435880124569, 0.039607446640729904, 0.016327397897839546, 0.009732812643051147, -0.006077407859265804, 0.005350846331566572, -0.02375248447060585, -0.015610482543706894, 0.02764630876481533, 0.02417253516614437, -0.0577712282538414, -0.05041080340743065, -0.039385635405778885, -0.014243504032492638, 0.04488837718963623, -0.01593225821852684, 0.038222260773181915, -0.06350307911634445, 0.030736589804291725, 0.03568258136510849, 0.019287994131445885, -0.05110646411776543, -0.0016735155368223786, -0.015138654969632626, -0.02279137261211872, 0.040731217712163925, 0.026256343349814415, 0.021910900250077248, 0.015049741603434086, 0.009835879318416119, -0.011308367364108562, -0.06652592122554779, 0.007645441684871912, 0.017213091254234314, 0.030912227928638458, 0.045428961515426636, -0.013398472219705582, -0.020882776007056236, 0.01734563335776329, 0.010742618702352047, -0.0003498003352433443, -0.03185117989778519, -0.02676057629287243, 0.014605572447180748, 0.03387591242790222, -0.006969662848860025, 0.005767052993178368, 0.0233511533588171, -0.04532015696167946, 0.030912909656763077, 0.017666544765233994, 0.01463332213461399, 0.0002874518686439842, -0.00026870943838730454, 0.014668081887066364, -0.024392342194914818, 0.03566160798072815, -0.01004822552204132, -0.03443717584013939, -0.006781152915209532, -0.03535842150449753, -0.03980220481753349, 0.03184084594249725, 0.028288207948207855, -0.028149858117103577, 0.021381830796599388, 0.001974689308553934, 0.00564300874248147, -0.011571520008146763, -0.011967715807259083, 0.00907138828188181, 0.0075356243178248405, -0.017191220074892044, -0.03219815716147423, 0.028471002355217934, 0.005056069698184729, -0.008195918053388596, 0.01570272445678711, -0.04438355937600136, -0.0023984769359230995, 0.02192440815269947, -0.02176874503493309, -0.034365665167570114, 0.027004824951291084, 0.018737560138106346, -0.0013881572522222996, 0.027697637677192688, 0.02262166514992714, 0.02148550935089588, 0.023921959102153778, 0.018389323726296425, 0.013904652558267117, -0.08506038784980774, 0.012616310268640518, 0.029343748465180397, 0.018174652010202408, 0.01203426718711853, -0.008342759683728218, 0.021017439663410187, -0.016907453536987305, -0.011576852761209011, 0.038224298506975174, 0.020327601581811905, -0.011310587637126446, -0.04965473338961601, 0.06023698300123215, 0.08215182274580002, -0.01022135466337204, 0.00774378189817071, 0.01850845105946064, 0.01735827326774597, 0.011000696569681168, 0.005837356671690941, 0.0027837769594043493, 0.040465325117111206, 0.011486925184726715, 0.05984360724687576, 0.01858888752758503, 0.007580630015581846, 0.014071259647607803, 0.056176573038101196, -0.018835052847862244, -0.004223085939884186, 0.006286706309765577, 0.011760336346924305, -0.0028754177037626505, -0.024757541716098785, 0.013073100708425045, -0.011399893090128899, 0.0019326331093907356, 0.02494220994412899, 0.01130995899438858, -0.03644934296607971, -0.03875133395195007, 0.02300247922539711, -0.03969716653227806, 0.018593396991491318, 0.006288242992013693, 0.009292454458773136, -0.017651448026299477, 0.009948743507266045, -0.03230120241641998, 0.0045066531747579575, -0.037433791905641556, 0.016048602759838104, -0.025385312736034393, -0.03453977033495903, 0.024709362536668777, 0.01729360781610012, 0.039635732769966125, -0.03753112256526947, 0.005984576418995857, 0.02694508247077465, -0.018464867025613785, 0.014758212491869926, -0.018976962193846703, 0.02003771997988224, -0.002087170723825693, -0.044905561953783035, 0.040048398077487946, 0.04545120894908905, -0.011114315129816532, -0.01778540201485157, 0.02250184677541256, -0.00563775235787034, 0.0007865807274356484, -0.012357928790152073, 0.06913363933563232, 0.053380727767944336, -0.04273078218102455, 0.04632143676280975, -0.021398058161139488, -0.017189202830195427, -0.02102043479681015, -0.03398143872618675, 0.05326936021447182, 0.05479913204908371, 0.01377561129629612, 0.000655126350466162, -0.03176348656415939, 0.05659870058298111, 0.010580767877399921, -0.05339442566037178, 0.008518745191395283, -0.0030684289522469044, 0.009392031468451023, 0.005932961590588093, -0.017397766932845116, 0.019359201192855835, 0.03776177391409874, 0.021015726029872894, -0.04846041649580002, 0.019122716039419174, 0.001860021147876978, -0.03651292622089386, 0.0069594853557646275, 0.013637148775160313, -0.018805943429470062, -0.024910898879170418, 0.024542035534977913, -0.026148254051804543, 0.03726784139871597, 0.008302822709083557, -0.0012745384592562914, -0.0037222877144813538, 0.009491363540291786, 0.015790605917572975, 0.04315505921840668, 0.06714612990617752, 0.020592622458934784, 0.02977117896080017, 0.020191626623272896, 0.05982032045722008, -0.036055125296115875, 0.042070548981428146, -0.011717420071363449, 0.08279635012149811, 0.013814148493111134, 0.053016092628240585, 0.0640219897031784, 0.014143360778689384, 0.030593395233154297, 0.034579887986183167, -0.02968718856573105, 0.010201624594628811, -0.008871838450431824, 0.06888541579246521, 0.010950389318168163, -0.019364694133400917, 0.007397986017167568, 0.052762582898139954, 0.027420135214924812, 0.03153354302048683, -0.0020332264248281717, 0.04143583029508591, 0.03131474182009697, 0.028237752616405487, 0.014724931679666042, 0.05063469707965851, 0.022146832197904587, 0.0045446595177054405, 0.023854006081819534, -0.004243176430463791, 0.0323721207678318, 0.0015800967812538147, 0.017426330596208572, 0.019665027037262917, -0.023945005610585213, -0.0061417268589138985, -0.022664925083518028, -0.018065446987748146, 0.0169836338609457, 0.026602614670991898, 0.037619415670633316, -0.031425438821315765, 0.015685850754380226, -0.015993909910321236, -0.0007889713742770255, -0.022406810894608498, -0.028222857043147087, 0.006894714664667845, 0.04801199212670326, -0.028004806488752365, -0.05306481197476387, 0.002118093194440007, -0.023216910660266876, 0.018908850848674774, 0.040658481419086456, -0.037414465099573135, -0.04118512198328972, -0.031490739434957504, 0.025639547035098076, 0.03403821215033531, 0.020825766026973724, -0.0030760657973587513, -0.038311976939439774, -0.022973323240876198, 0.017047835513949394, -0.010313725098967552, 0.006373623851686716, -0.022118283435702324, 0.01788470335304737, -0.041535407304763794, 0.024601643905043602, -0.005392536520957947, -0.03142886981368065, 0.0019553019665181637, -0.005497739650309086, -0.03522241860628128, -0.022652186453342438, 0.012335894629359245, -0.015152184292674065, 0.053379520773887634, -0.037626806646585464, -0.00619084807112813, 0.012417319230735302, -0.008160775527358055, -0.0013276011450216174, 0.024079542607069016, -0.0010449299588799477, -0.03618563711643219, -0.013625478371977806, 0.012935721315443516, 0.026345858350396156, -0.01496808510273695, -0.018591418862342834, 0.03620621934533119, -0.0289127416908741, -0.041672952473163605, -0.01752611994743347, -0.003779477206990123, 0.05249975249171257, -0.0024107699282467365, 0.06201699748635292, 0.012549380771815777, 0.004498145543038845, -0.002718214178457856, 0.027762984856963158, 0.020501691848039627, 0.019642889499664307, -0.003799240570515394, -0.03176318109035492, -0.0031550207640975714, -0.019738761708140373, -0.039539553225040436, 0.0473940335214138, -0.02512381225824356, 0.020215056836605072, -0.016088878735899925, -0.007454209960997105, -0.04275422915816307, 0.008947431109845638, 0.0911804810166359, 0.03357147052884102, 0.006469420623034239, -0.008286897093057632, -0.0018414441728964448, -0.001442934270016849, -0.0070817009545862675, 0.05198580399155617, 0.04625198245048523, 0.0009552532574161887, -0.015088853426277637, -0.046724945306777954, -0.01662791520357132, -0.0010605707066133618, -0.06477314233779907, 0.028141498565673828, 0.007533356547355652, -0.013790486380457878, 0.002775305649265647, 0.0025412237737327814, 0.03531297668814659, 0.01471233181655407, 0.06512667238712311, -0.040880121290683746, -0.004669304005801678, -0.000974936003331095, -0.007958329282701015, -0.021732589229941368, 0.06392177939414978, -0.009799805469810963, -0.0314311608672142, 0.049353454262018204, -0.004267577547580004, 0.003021607641130686, -0.04205988720059395, -0.02408408932387829, -0.00233522430062294, -0.039788372814655304, -0.054586444050073624, -0.017281387001276016, 0.04438019171357155, 0.022383036091923714, 0.0036310453433543444, -0.03392907232046127, 0.01587948203086853, 0.008696465753018856, -0.05239664763212204, 0.04982572793960571, -0.02411014400422573, -0.011464066803455353, 0.009325451217591763, 0.03685078024864197, 0.0009945138590410352, 0.02985476329922676, -0.005259281024336815, -0.012365062721073627, -0.010783936828374863, -0.04166082665324211 ]
Retrieval Augmented Generation with Huggingface Transformers and Ray
amogkam
February 10, 2021
ray-rag
open-source-collab, nlp
https://huggingface.co/blog/ray-rag
How do I use it? Huggingface provides a PyTorch Lightning based fine tuning script, and we extended it to add the Ray retrieval implementation as an option. To try it out, first install the necessary requirements bash pip install ray pip install transformers pip install -r transformers/examples/research_projects/rag/requirements.txt Then, you can specify your data paths and other configurations and run finetune-rag-ray.sh! bash # Sample script to finetune RAG using Ray for distributed retrieval. # Add parent directory to python path to access lightning_base.py export PYTHONPATH="../":"${PYTHONPATH}" # Start a single-node Ray cluster. ray start --head # A sample finetuning run, you need to specify data_dir, output_dir and model_name_or_path # run ./examples/rag/finetune_rag_ray.sh --help to see all the possible options python examples/rag/finetune_rag.py \ --data_dir $DATA_DIR \ --output_dir $OUTPUT_DIR \ --model_name_or_path $MODEL_NAME_OR_PATH \ --model_type rag_sequence \ --fp16 \ --gpus 8 \ --profile \ --do_train \ --do_predict \ --n_val -1 \ --train_batch_size 8 \ --eval_batch_size 1 \ --max_source_length 128 \ --max_target_length 25 \ --val_max_target_length 25 \ --test_max_target_length 25 \ --label_smoothing 0.1 \ --dropout 0.1 \ --attention_dropout 0.1 \ --weight_decay 0.001 \ --adam_epsilon 1e-08 \ --max_grad_norm 0.1 \ --lr_scheduler polynomial \ --learning_rate 3e-05 \ --num_train_epochs 100 \ --warmup_steps 500 \ --gradient_accumulation_steps 1 \ --distributed_retriever ray \ --num_retrieval_workers 4 # Stop the Ray cluster. ray stop
[ 0.023967985063791275, 0.004163197707384825, -0.006904639769345522, 0.009072351269423962, 0.0480329655110836, 0.010152241215109825, 0.04950295388698578, 0.005094753112643957, -0.023228829726576805, -0.05069083720445633, -0.12172701954841614, 0.08059044182300568, -0.014656687155365944, 0.07838061451911926, -0.015250698663294315, 0.019802620634436607, 0.014730479568243027, -0.027843458577990532, -0.09257811307907104, 0.04127120599150658, 0.037310026586055756, -0.0429244302213192, -0.040995627641677856, 0.0651683658361435, -0.04992755502462387, -0.07563920319080353, -0.023977890610694885, 0.07923574000597, 0.03334364667534828, 0.0329933762550354, -0.06176689639687538, -0.014779508113861084, -0.04126862436532974, -0.054192595183849335, -0.02340640127658844, 0.04019952192902565, -0.053219571709632874, 0.052950259298086166, -0.023742981255054474, -0.07700985670089722, 0.08207924664020538, -0.06398236006498337, -0.04501583054661751, 0.027529634535312653, 0.08514806628227234, -0.00991090852767229, -0.10780622065067291, 0.03756359964609146, -0.05269971117377281, -0.002126921433955431, -0.06990377604961395, 0.05955646187067032, -0.018600735813379288, -0.06319574266672134, 0.0541067011654377, 0.03659916669130325, -0.03829062357544899, -0.009798908606171608, 0.014604412950575352, 0.06795602291822433, -0.05254388228058815, -0.03084713965654373, -0.025046456605196, 0.04492897540330887, -0.014664102345705032, 0.010160019621253014, -0.06662483513355255, 0.0008221608004532754, -0.05689958855509758, -0.07301413267850876, 0.031010771170258522, 0.01540983747690916, -0.031725093722343445, -0.04568194970488548, -0.06564654409885406, -0.00784918200224638, -0.025342298671603203, 0.012522483244538307, 0.036292314529418945, 0.0713147521018982, -0.04801294580101967, -0.0029077227227389812, -0.0006875806138850749, 0.03676796332001686, 0.01917775347828865, 0.016507789492607117, 0.007668295409530401, 0.0044934009201824665, -0.055246151983737946, -0.007215842604637146, -0.05489597097039223, -0.08447815477848053, 0.021585484966635704, 0.05925650894641876, 0.041222792118787766, -0.018536940217018127, -0.01737571507692337, 0.026877932250499725, -0.01931704953312874, 0.004072173032909632, -0.021033454686403275, -0.03427465632557869, 0.036111947149038315, -0.029171952977776527, -0.04060617834329605, 0.06283889710903168, -0.045770008116960526, -0.030270932242274284, -0.03305204585194588, 0.04944965988397598, -0.008137313649058342, 0.030825769528746605, -0.08017953485250473, 0.06691678613424301, -0.040681395679712296, -0.031088626012206078, 0.054929256439208984, 0.027340779080986977, -0.013252457603812218, -0.011956428177654743, 0.003262975485995412, 0.06959906965494156, 0.0980122908949852, 0.04905633255839348, -0.009514893405139446, 0.07374557107686996, -0.041938792914152145, -0.0010515183676034212, 0.03965011611580849, 0.029218921437859535, 0.02404714934527874, -0.03919583931565285, 0.04403671622276306, 0.016773942857980728, -0.047549352049827576, -0.029127173125743866, -0.00554556492716074, -0.018098225817084312, 0.005325213074684143, 0.06048296391963959, -0.026242109015583992, 0.04944136366248131, -0.026406507939100266, -0.07181074470281601, 0.015705669298768044, -0.04687926173210144, -0.01484187226742506, 0.06452468037605286, -0.0006887794588692486, 0.02775806374847889, -0.06271309405565262, 0.10981503129005432, 0.007674850523471832, 0.01680113933980465, -0.029647760093212128, 0.06436463445425034, -0.016282688826322556, -0.0005311811692081392, 0.018695257604122162, -0.008398674428462982, -0.03870508074760437, 0.032556552439928055, -0.09400328993797302, 0.004872648511081934, 0.012421971186995506, -0.022180287167429924, 0.021309737116098404, 0.004290267359465361, 0.03206740319728851, -0.037401631474494934, 0.020472854375839233, 0.014346474781632423, 0.04753989726305008, -0.04597732797265053, -0.009879625402390957, 0.008032683283090591, 0.012493749149143696, 0.01515491958707571, -0.05379927158355713, -0.011501485481858253, -0.007309214677661657, -0.001008847146295011, 0.03448227047920227, 0.04949801787734032, 0.018542751669883728, -0.06785029917955399, -0.0041547915898263454, -0.047809064388275146, 0.031857430934906006, 0.02990507148206234, -0.018858840689063072, -0.034344080835580826, 0.10504834353923798, -0.03499070182442665, 0.034122154116630554, -0.08368214964866638, -0.03722313046455383, 0.08621654659509659, 0.05051682889461517, 0.0038523024413734674, 0.01489869225770235, -0.0003534555435180664, 0.042837418615818024, -0.03409392759203911, -0.04663127660751343, 0.02757028490304947, 0.03342454880475998, -0.07333161681890488, -0.023164628073573112, 0.0829053595662117, 0.030198121443390846, -0.15140798687934875, 0.013794089667499065, -0.09243157505989075, 0.02745131403207779, -0.00464193569496274, -0.10802756994962692, 0.019015299156308174, -0.010201041586697102, 0.04408355802297592, 0.10901755094528198, 0.009015117771923542, 0.023510484024882317, 0.000640286598354578, -0.014514187350869179, 0.04586013779044151, 0.08804827183485031, 0.02578923851251602, 0.04613577201962471, -0.08393595367670059, 0.03245069459080696, -0.014087832532823086, -0.13436627388000488, 0.11331209540367126, -0.014313624240458012, -0.06661438941955566, 0.06586580723524094, -0.04705137014389038, -0.0149671770632267, 0.018059931695461273, 0.0030974093824625015, -0.0025541256181895733, -0.028872866183519363, 0.05717545002698898, 0.0050490559078752995, -0.03403768315911293, 0.029497744515538216, 0.022904517129063606, -0.028026407584547997, 0.01956772245466709, -0.0737074688076973, 0.03555735945701599, -0.007597246672958136, 0.0004053713637404144, 0.007424484007060528, 0.06692232936620712, -0.023783111944794655, -0.002750121057033539, -0.04086824133992195, 0.04788479954004288, -0.0031793960370123386, 0.012402074411511421, -0.032298747450113297, -0.004625166300684214, -0.013997088186442852, -0.019055556505918503, 0.02464829944074154, 0.012488534674048424, 0.03211310878396034, 0.0056183477863669395, 0.01182687096297741, 0.048085570335388184, 0.007024219725281, 0.0015350095927715302, -0.014734753407537937, 0.05765463411808014, 0.014341915026307106, -0.05267041549086571, -0.05291658267378807, 0.0018959264270961285, -0.010102393105626106, -0.035912830382585526, 0.05105844512581825, 0.03419141098856926, 0.031924597918987274, 0.00597293209284544, 0.008665158413350582, -0.026511961594223976, -0.02299506589770317, -0.007353135384619236, -0.0023941004183143377, 0.02118479460477829, 0.032491400837898254, -0.014229362830519676, -0.006834663450717926, 0.02701568230986595, 0.006930139847099781, 0.0015578960301354527, -0.00998267438262701, 0.0008670218521729112, -0.024887975305318832, -0.02977263554930687, 0.015479503199458122, -0.029920725151896477, -0.03501351177692413, -0.015017230063676834, 0.02111748978495598, 0.011854594573378563, -0.07653863728046417, -0.00007022076169960201, -0.028177756816148758, 0.04151155427098274, -0.007305529434233904, -0.004887619987130165, 0.010434885509312153, -0.005597860552370548, 0.02769204042851925, -0.012382129207253456, -0.05372591316699982, -0.00859494972974062, 0.024019552394747734, 0.002802165923640132, 0.021457310765981674, -0.046091314405202866, 0.044821739196777344, -0.02319619245827198, -0.008126160129904747, 0.011960338801145554, -0.012174684554338455, 0.03180480748414993, -0.005820802412927151, 0.008128278888761997, -0.019567927345633507, 0.001107959309592843, 0.05842876434326172, -0.00954726617783308, 0.002966610249131918, -0.05225387588143349, 0.018006933853030205, -0.041945770382881165, -0.013338079676032066, 0.02693655528128147, 0.002860692096874118, -0.033774301409721375, 0.019738510251045227, -0.007725027855485678, 0.009940678253769875, 0.027376454323530197, 0.0009587238309904933, -0.039374519139528275, 0.02148289978504181, -0.015948226675391197, 0.023480532690882683, -0.02229277975857258, -0.05896083265542984, -0.007239742204546928, 0.004370902199298143, 0.019296519458293915, -0.017121396958827972, 0.007682440336793661, -0.03597163036465645, 0.07409343868494034, -0.02506950870156288, 0.00991544034332037, 0.025035642087459564, 0.03305991366505623, 0.07334380596876144, 0.03670220449566841, -0.07365361601114273, 0.010713960975408554, -0.009147538803517818, -0.03406236320734024, 0.05680437013506889, 0.0007641082047484815, -0.01435023546218872, -0.0637456551194191, -0.040896426886320114, -0.005763434339314699, -0.00024041798315010965, 0.03877783939242363, 0.0408017560839653, 0.009897951036691666, -0.02510635182261467, 0.003302905475720763, -0.05359518527984619, -0.009654158726334572, 0.032850876450538635, 0.0319061279296875, -0.03725600615143776, -0.037456098943948746, -0.019256526604294777, -0.05396740511059761, 0.02997072972357273, -0.012901196256279945, 0.031255919486284256, -0.07716560363769531, 0.047182317823171616, 0.013680079020559788, 0.016961675137281418, -0.029324522241950035, 0.03144361823797226, -0.014315388165414333, -0.059987202286720276, 0.008787400089204311, 0.03956015408039093, -0.007459214888513088, 0.007629643194377422, -0.019052354618906975, -0.042128678411245346, -0.03744085505604744, 0.0071107507683336735, 0.008497158996760845, 0.02429918199777603, 0.007878558710217476, -0.004388213623315096, -0.03160388395190239, -0.0014928164891898632, 0.014910445548593998, 0.001517453812994063, -0.025632882490754128, -0.003549586981534958, 0.01460915058851242, 0.04205553978681564, 0.03513732925057411, 0.022950978949666023, -0.00006478175782831386, -0.02273799106478691, 0.04683896526694298, -0.005360955372452736, 0.009907599538564682, 0.005246048793196678, -0.041235774755477905, 0.02045746147632599, -0.0035198295954614878, 0.041383177042007446, -0.01590624451637268, 0.0006269118166528642, -0.023444943130016327, -0.05562816932797432, -0.020017540082335472, 0.06960565596818924, 0.03596387803554535, -0.005389634985476732, -0.023434335365891457, -0.014405573718249798, 0.006626813672482967, 0.0027254829183220863, -0.0012510409578680992, 0.009494244121015072, -0.026821861043572426, 0.0034090832341462374, -0.030715851113200188, 0.023286089301109314, 0.016213255003094673, 0.012892535887658596, 0.03269738331437111, -0.02264552377164364, -0.006576409097760916, 0.02880355343222618, -0.012456798925995827, -0.0065146926790475845, -0.014647956937551498, 0.028558295220136642, 0.02043130435049534, -0.002339616883546114, 0.023241009563207626, 0.02655966579914093, 0.03210430219769478, 0.005623082164674997, -0.011399105191230774, -0.06281667947769165, 0.030234789475798607, 0.028802994638681412, 0.013901177793741226, -0.022779254242777824, -0.026449080556631088, -0.008212635293602943, 0.028977325186133385, -0.007400827016681433, 0.01091847289353609, -0.002095727948471904, -0.013308681547641754, -0.049203962087631226, 0.05642366409301758, 0.0636013075709343, -0.009137772023677826, 0.007444689050316811, 0.03878110274672508, -0.0031390883959829807, -0.022182127460837364, 0.014351455494761467, 0.002237947890534997, 0.027311118319630623, 0.02822980470955372, 0.033716801553964615, 0.0081454087048769, 0.03847561776638031, 0.019531190395355225, 0.033219221979379654, -0.015200977213680744, 0.03701182082295418, -0.005859225522726774, 0.0032951037865132093, -0.014480624347925186, -0.0360158309340477, 0.03671486675739288, 0.003941738046705723, -0.0025823337491601706, 0.028991879895329475, 0.002856978913769126, -0.014383384957909584, -0.05708609148859978, 0.03030068427324295, -0.045986954122781754, -0.000019102390069747344, 0.003427662421017885, 0.005617850460112095, -0.019410403445363045, -0.0007926539983600378, -0.01742776855826378, 0.019508400931954384, -0.028560129925608635, 0.007992652244865894, -0.023014597594738007, -0.04106026515364647, 0.01243805792182684, 0.025942733511328697, 0.01994633860886097, -0.06894635409116745, -0.012298285029828548, 0.03400168567895889, 0.01779109612107277, 0.003964518662542105, -0.021609056740999222, 0.04242492467164993, 0.004481791518628597, -0.029624249786138535, 0.04561527073383331, 0.019867131486535072, -0.0017887175781652331, -0.011529902927577496, 0.0025528473779559135, -0.011012020520865917, 0.0018211833667010069, -0.05484010651707649, 0.045626603066921234, 0.04706303030252457, -0.03866356611251831, 0.05422258377075195, -0.02279604598879814, -0.035688649863004684, -0.015903020277619362, -0.01435591746121645, 0.04445018246769905, 0.06575359404087067, 0.02861141413450241, -0.0007151361205615103, -0.0013854563003405929, 0.04960836097598076, -0.0068961624056100845, -0.04830115661025047, -0.012742314487695694, -0.018775511533021927, -0.011312785558402538, 0.009684947319328785, 0.015984809026122093, 0.03689293935894966, 0.041423678398132324, 0.03724941611289978, -0.06194731220602989, 0.018797216936945915, 0.029648471623659134, -0.023102033883333206, 0.028681112453341484, 0.00039456909871660173, -0.024031443521380424, -0.012664595618844032, 0.00008013463957468048, -0.020184608176350594, 0.002917565405368805, 0.00027988236979581416, -0.0019542330410331488, -0.0024904196616262197, 0.0002562782319728285, 0.05202031508088112, 0.03752616047859192, 0.03697100281715393, 0.0001538773940410465, 0.024871643632650375, 0.028389500454068184, 0.00984736904501915, -0.023419171571731567, 0.03373311832547188, 0.0044309040531516075, 0.0821966677904129, 0.022323384881019592, 0.03959760442376137, 0.04689349979162216, 0.024953555315732956, 0.029785126447677612, 0.01946178264915943, -0.06382352113723755, 0.009129196405410767, -0.008977261371910572, 0.05574450641870499, -0.019866986200213432, -0.010581699199974537, 0.0008538349065929651, 0.033286161720752716, 0.046912722289562225, 0.031008364632725716, -0.029451115056872368, 0.02735372819006443, -0.01556942705065012, 0.031642764806747437, 0.014821698889136314, 0.06340041011571884, 0.0009358317474834621, -0.005415038205683231, 0.050298940390348434, 0.011810877360403538, 0.05533884838223457, -0.011641635559499264, 0.007797488011419773, 0.02422589249908924, -0.047416724264621735, 0.024951038882136345, -0.02015024982392788, 0.0073206862434744835, 0.018387939780950546, -0.027331072837114334, 0.006666511297225952, -0.015180712565779686, -0.011295662261545658, -0.04321404546499252, 0.03238270431756973, -0.004723623860627413, -0.026351431384682655, 0.03310627490282059, 0.04390344023704529, -0.05592228099703789, -0.03506049886345863, 0.009056602604687214, 0.0046991086564958096, 0.03046710416674614, 0.016888055950403214, -0.007831506431102753, -0.024193665012717247, -0.02360421046614647, 0.005303485784679651, 0.02995440363883972, 0.06257732212543488, 0.011507300660014153, -0.02936691977083683, -0.060596223920583725, 0.004002953879535198, -0.010484609752893448, -0.003716482548043132, -0.033341456204652786, 0.003276185132563114, -0.028351880609989166, 0.005529325921088457, -0.03431764990091324, -0.04054362699389458, 0.0033972193486988544, 0.02829945832490921, 0.015437756665050983, -0.015512502752244473, -0.011208085343241692, -0.005105022806674242, 0.05098089948296547, -0.020163873210549355, -0.020216919481754303, 0.006352989934384823, 0.006361861247569323, -0.05528018996119499, 0.03692586347460747, -0.020673861727118492, -0.04939468950033188, -0.014903837814927101, -0.009511187672615051, 0.02029780112206936, -0.011417745612561703, -0.04061059281229973, 0.005810683127492666, 0.01095865573734045, 0.002818012610077858, -0.02756325900554657, 0.008429144509136677, 0.05180860310792923, 0.011280462145805359, 0.03645535185933113, 0.022264467552304268, 0.027221444994211197, 0.016804225742816925, 0.006033679004758596, 0.02049260586500168, 0.035369303077459335, 0.00492526451125741, -0.01893794909119606, -0.008047280833125114, -0.0034176360350102186, -0.017824919894337654, 0.04333633929491043, -0.012442216277122498, 0.006688270252197981, -0.0172815453261137, -0.03874552994966507, -0.0315326489508152, -0.013875803910195827, 0.06423838436603546, 0.04111679643392563, 0.012861497700214386, -0.024794384837150574, -0.005061848554760218, 0.020718008279800415, -0.028947291895747185, 0.009265867061913013, 0.03340941295027733, 0.030479438602924347, -0.01989995874464512, -0.06304999440908432, 0.0016247285529971123, 0.012684288434684277, -0.056484404951334, -0.005420404952019453, 0.026349065825343132, -0.0021074421238154173, 0.001816449803300202, 0.027346234768629074, 0.038965482264757156, 0.025590308010578156, 0.07811655849218369, -0.0055351173505187035, -0.02132817544043064, -0.01067805290222168, 0.012721921317279339, -0.04076540097594261, 0.043766386806964874, -0.03115442767739296, -0.031116724014282227, 0.024792222306132317, -0.026249518617987633, 0.0008846397395245731, -0.06127704679965973, -0.01002058107405901, -0.025474773719906807, -0.05529369041323662, -0.026254018768668175, -0.03637973964214325, 0.012615353800356388, 0.002295064041391015, 0.015966329723596573, -0.03351529687643051, -0.007654981687664986, 0.002343930769711733, -0.05958341434597969, 0.04477008804678917, -0.014417929574847221, -0.02683958224952221, 0.03009769320487976, 0.04038126394152641, 0.001186400419101119, 0.026198437437415123, -0.008763734251260757, -0.03017060086131096, -0.0031669549643993378, -0.01707777939736843 ]
Retrieval Augmented Generation with Huggingface Transformers and Ray
amogkam
February 10, 2021
ray-rag
open-source-collab, nlp
https://huggingface.co/blog/ray-rag
What is Retrieval Augmented Generation (RAG)? An overview of RAG. The model retrieves contextual documents from an external dataset as part of its execution. These contextual documents are used in conjunction with the original input to produce an output. The GIF is taken from Facebook's original blog post. Recently, Huggingface partnered with Facebook AI to introduce the RAG model as part of its Transformers library. RAG acts just like any other seq2seq model. However, RAG has an intermediate component that retrieves contextual documents from an external knowledge base (like a Wikipedia text corpus). These documents are then used in conjunction with the input sequence and passed into the underlying seq2seq generator. This information retrieval step allows RAG to make use of multiple sources of knowledge -- those that are baked into the model parameters and the information that is contained in the contextual passages, allowing it to outperform other state-of-the-art models in tasks like question answering. You can try it for yourself using this demo provided by Huggingface!
[ 0.028651805594563484, -0.013659611344337463, 0.048465795814991, -0.018582643941044807, 0.01656944490969181, 0.020170794799923897, 0.000008972178875410464, -0.00992391537874937, -0.05933385714888573, 0.003842900274321437, -0.1363196074962616, 0.04674588888883591, -0.022668443620204926, 0.06543534994125366, -0.022248979657888412, -0.005123351234942675, -0.025675782933831215, -0.05513332039117813, -0.016494978219270706, 0.007300743367522955, 0.005815271288156509, -0.03212396800518036, -0.06196613609790802, 0.02102612890303135, 0.06250067800283432, -0.06843540072441101, 0.02440487965941429, -0.040606122463941574, 0.04475904256105423, 0.012949607335031033, -0.1052546352148056, 0.0098815793171525, -0.010068090632557869, -0.026932206004858017, 0.015348391607403755, 0.03657505288720131, -0.1326727569103241, 0.028079576790332794, -0.026754532009363174, -0.07875486463308334, 0.04855594038963318, 0.010891443118453026, -0.0024624764919281006, 0.056629955768585205, 0.00883442908525467, -0.002729708096012473, -0.08855815976858139, -0.007878481410443783, -0.03211449459195137, -0.02675631083548069, -0.07855930179357529, 0.09376628696918488, -0.04162667319178581, -0.009105526842176914, 0.028977641835808754, 0.056118614971637726, 0.04367753118276596, -0.042112741619348526, 0.04079241305589676, 0.07718390971422195, -0.015996018424630165, -0.014423650689423084, 0.007960958406329155, 0.023998405784368515, 0.0034689896274358034, -0.02680910751223564, -0.027661481872200966, -0.03317664936184883, -0.07826642692089081, 0.030452346429228783, 0.025577262043952942, 0.027906641364097595, -0.0450357049703598, 0.01184504572302103, 0.015321462415158749, 0.022293495014309883, 0.026725580915808678, 0.05482645705342293, -0.020124046131968498, -0.003824434010311961, -0.022062145173549652, 0.003398137167096138, 0.09879140555858612, -0.008567409589886665, 0.047493379563093185, -0.0037395991384983063, -0.002901374362409115, -0.04351240023970604, -0.0741158202290535, 0.03228455036878586, -0.03659636527299881, -0.12742842733860016, -0.05154018476605415, -0.035923875868320465, 0.02449028007686138, -0.043038174510002136, 0.013223781250417233, 0.0005536744720302522, 0.01159515231847763, 0.013028369285166264, -0.10109134763479233, -0.04384871944785118, 0.0350605845451355, -0.08934982866048813, -0.0654626414179802, 0.01110940519720316, -0.034033019095659256, -0.02698455937206745, -0.034748755395412445, 0.027942650020122528, 0.009363328106701374, 0.017605992034077644, -0.013657807372510433, 0.07355467230081558, -0.05931297317147255, 0.014534445479512215, -0.009051990695297718, 0.0028513374272733927, -0.004725041799247265, 0.017825746908783913, -0.04309193789958954, 0.018806830048561096, 0.05225025862455368, 0.06832357496023178, 0.07205213606357574, 0.07667391002178192, 0.010923674330115318, -0.07187329232692719, -0.0777982547879219, 0.04694000631570816, 0.029301293194293976, 0.025244204327464104, -0.006602514069527388, 0.10803744941949844, -0.058923929929733276, -0.03508672118186951, 0.02372792921960354, -0.06988029181957245, 0.050317566841840744, 0.02498837746679783, 0.016484379768371582, -0.05169899761676788, -0.025534290820360184, -0.11143083870410919, 0.010173884220421314, -0.049036119133234024, -0.04990815743803978, 0.0001484622189309448, 0.004221737384796143, 0.0009312612237408757, -0.03521771356463432, -0.010847199708223343, -0.01575886271893978, -0.028427228331565857, -0.010199920274317265, 0.040040358901023865, 0.012751816771924496, 0.020820604637265205, 0.06185958907008171, 0.010441352613270283, 0.0164900254458189, 0.07659406214952469, -0.07352504879236221, 0.06278274208307266, 0.018998149782419205, -0.006007038522511721, -0.01797628588974476, 0.08934439718723297, 0.0067520746961236, -0.062288444489240646, 0.03199243173003197, -0.015666628256440163, -0.010031950660049915, -0.04176388680934906, 0.003179400460794568, 0.08283193409442902, -0.02578151971101761, -0.04355267807841301, 0.05356082692742348, -0.03507757559418678, -0.06720415502786636, 0.06007267162203789, 0.004977624397724867, 0.03919967636466026, 0.009823935106396675, -0.023144066333770752, 0.057257432490587234, 0.00994897074997425, 0.019396303221583366, 0.00723353773355484, -0.0770765021443367, -0.06634730100631714, 0.013212136924266815, -0.031710222363471985, -0.014902650378644466, -0.021806683391332626, -0.03946443274617195, 0.09302255511283875, 0.08917456865310669, 0.015957344323396683, 0.046478889882564545, -0.014106704853475094, 0.04023472219705582, -0.03222951292991638, -0.0032788494136184454, -0.07369695603847504, 0.03964177519083023, -0.041801951825618744, 0.029863787814974785, 0.05478822812438011, 0.0068824258632957935, -0.046308260411024094, -0.017893314361572266, -0.1009422168135643, 0.008271010592579842, 0.002233747858554125, 0.006602135486900806, -0.025181831791996956, -0.03890720382332802, 0.00472595077008009, 0.11082036793231964, -0.03984686732292175, 0.016962828114628792, -0.06397730112075806, 0.056857261806726456, 0.0555497370660305, 0.009725766256451607, 0.05688004195690155, 0.018691346049308777, -0.07452516257762909, 0.04150194674730301, 0.004976616241037846, -0.07435059547424316, -0.05509529635310173, -0.033965468406677246, -0.04359128698706627, 0.07045312225818634, 0.013557237572968006, 0.02357456088066101, -0.006522197276353836, -0.010455958545207977, 0.061719972640275955, 0.007166306022554636, 0.003131638979539275, 0.0699254497885704, -0.039768826216459274, 0.045111194252967834, 0.03602416813373566, -0.053108956664800644, -0.058068595826625824, -0.055919334292411804, 0.051006145775318146, -0.022578349336981773, 0.0048533654771745205, -0.0409933440387249, 0.0568041168153286, 0.02256038598716259, -0.009233834221959114, 0.002042992040514946, 0.018570277839899063, -0.013715910725295544, -0.00901824701577425, -0.05517861992120743, -0.027131646871566772, -0.007156121078878641, -0.038208555430173874, -0.013103809207677841, 0.02253575436770916, -0.00034352540387772024, 0.01714201271533966, 0.043495211750268936, -0.057900551706552505, 0.039386212825775146, 0.02310843952000141, 0.014060720801353455, 0.006399575620889664, 0.021947277709841728, 0.020851347595453262, -0.01805245690047741, -0.04730949178338051, -0.01889015920460224, -0.02034604549407959, 0.056370239704847336, 0.04414631798863411, 0.03587581589818001, -0.0008347007678821683, 0.016562916338443756, 0.00838536024093628, -0.023485369980335236, 0.0075983344577252865, 0.027639420703053474, 0.05085359141230583, -0.04717501997947693, 0.020359205082058907, 0.00762925436720252, 0.01450805738568306, 0.046558402478694916, -0.016831379383802414, -0.022855302318930626, -0.011393322609364986, -0.04484692960977554, 0.005523001775145531, -0.021363791078329086, 0.053524378687143326, 0.007516227662563324, 0.007544980384409428, -0.01548126433044672, 0.0014219942968338728, -0.07061310112476349, -0.027044225484132767, -0.011189015582203865, -0.01790875382721424, 0.00788632221519947, -0.04598671570420265, 0.042662132531404495, 0.016024088487029076, -0.024973189458251, -0.03147641569375992, -0.01491667702794075, -0.031981341540813446, 0.005696312990039587, 0.000054319563787430525, -0.021854398772120476, -0.039593204855918884, -0.00013453818974085152, 0.0011390121653676033, 0.006569752935320139, -0.02706095576286316, -0.016123130917549133, -0.017747588455677032, -0.008770613931119442, 0.006670716218650341, 0.004673049319535494, -0.02549302950501442, -0.028958402574062347, -0.03989904373884201, -0.005061938893049955, -0.052801817655563354, 0.058728866279125214, -0.058128539472818375, 0.012935623526573181, 0.030971519649028778, -0.016371052712202072, -0.029144423082470894, 0.015776662155985832, 0.024409238249063492, 0.026511017233133316, 0.020672770217061043, 0.03218016028404236, -0.023941662162542343, -0.007161654531955719, 0.01642436906695366, 0.007213786710053682, -0.012251878157258034, 0.0010164501145482063, 0.018710093572735786, -0.029557501897215843, -0.03722302243113518, -0.06103132665157318, 0.01726314052939415, -0.01273373793810606, 0.06242482364177704, -0.04547808691859245, 0.005295628681778908, 0.053499359637498856, -0.019644999876618385, -0.010095441713929176, 0.0076593137346208096, -0.017488621175289154, -0.04489172250032425, 0.00795369129627943, -0.019956352189183235, 0.0033409337047487497, 0.07233195751905441, 0.006448646541684866, -0.03517015278339386, 0.00018165315850637853, 0.034447021782398224, -0.029534807428717613, 0.0044632586650550365, 0.033183854073286057, 0.020169071853160858, -0.04105770215392113, -0.02767825871706009, -0.03096913918852806, -0.013943754136562347, 0.05536216124892235, 0.009895116090774536, -0.049644820392131805, -0.031031597405672073, -0.03693061321973801, 0.028364289551973343, 0.01922416314482689, -0.0372849777340889, 0.03551914915442467, -0.033914051949977875, 0.032438065856695175, 0.020008543506264687, 0.01824941299855709, -0.018612947314977646, -0.004570789635181427, 0.026821380481123924, -0.024245547130703926, 0.008794227614998817, -0.04085621237754822, 0.02317655459046364, 0.0037030354142189026, -0.012240794487297535, 0.032643333077430725, -0.06415718793869019, -0.02133006602525711, -0.009534315206110477, 0.0059355031698942184, 0.029763130471110344, -0.01827399805188179, -0.03848126158118248, 0.03606667369604111, 0.014050355181097984, -0.02529582753777504, 0.000041227860492654145, 0.02415710873901844, 0.04106391221284866, 0.019030142575502396, -0.012917570769786835, 0.021456528455018997, -0.013370146043598652, -0.0077394358813762665, -0.020314740017056465, 0.037547022104263306, 0.023462291806936264, 0.03409000113606453, 0.017080025747418404, -0.001974712824448943, -0.042230937629938126, 0.0033621490001678467, -0.023070065304636955, -0.011081232689321041, 0.026771053671836853, 0.030638666823506355, -0.015291528776288033, 0.023804359138011932, 0.02445005625486374, 0.0028540128841996193, 0.03100551851093769, 0.011922144331037998, 0.013010714203119278, 0.030591530725359917, -0.03406664729118347, 0.034185171127319336, -0.010527418926358223, -0.005684347357600927, 0.012777239084243774, -0.028849268332123756, 0.0049480656161904335, -0.005679634865373373, 0.009900723583996296, -0.02712182141840458, -0.021931935101747513, -0.009604557417333126, 0.017537852749228477, -0.039260778576135635, 0.028499988839030266, 0.007941381074488163, 0.00010019488399848342, 0.055851664394140244, 0.04125915840268135, -0.006763039156794548, 0.009160161018371582, -0.00007739107240922749, -0.01862853579223156, -0.05042654648423195, 0.013073796406388283, -0.028571223840117455, 0.02088494412600994, 0.0005582590820267797, -0.006857260130345821, 0.040253620594739914, 0.02183050476014614, -0.03593490645289421, 0.01828364096581936, 0.028741518035531044, 0.011562244966626167, -0.041437551379203796, 0.08779036998748779, 0.11000099033117294, 0.010465489700436592, -0.00637685414403677, 0.022810010239481926, -0.0371941402554512, 0.009301233105361462, 0.016769303008913994, -0.019237006083130836, 0.06765367090702057, -0.03161256015300751, 0.03815220296382904, 0.05224873125553131, -0.02477123774588108, 0.007972284220159054, 0.05159861594438553, -0.0032519919332116842, -0.0011653131805360317, -0.023139135912060738, -0.016961444169282913, 0.008208656683564186, -0.024570170789957047, 0.009955523535609245, -0.0030170329846441746, -0.017991874366998672, 0.03361878916621208, 0.03078068606555462, -0.020797308534383774, -0.02439400553703308, 0.03034782223403454, -0.04518534988164902, -0.05985644832253456, 0.002159976167604327, 0.023989738896489143, 0.03099682182073593, -0.02734808810055256, -0.05547104775905609, -0.031117118895053864, -0.018301228061318398, -0.015053804032504559, -0.04367854446172714, -0.012069215066730976, 0.01584452949464321, -0.03824933245778084, 0.03140662610530853, -0.05057135224342346, -0.00808691419661045, 0.026938410475850105, -0.003955817315727472, 0.024252599105238914, -0.05321893468499184, 0.023418918251991272, 0.020841358229517937, -0.017185457050800323, -0.00963008776307106, -0.00017550411575939506, -0.02496482990682125, 0.030726781114935875, -0.004002297297120094, -0.01618754118680954, 0.021708501502871513, -0.014114619232714176, 0.03020617738366127, 0.052472569048404694, -0.03435705974698067, 0.061547502875328064, 0.010776551440358162, -0.030387450009584427, 0.01051296480000019, -0.014868086203932762, 0.06794657558202744, 0.02806715853512287, 0.024389637634158134, 0.018014637753367424, 0.020989863201975822, 0.042134884744882584, -0.010271469131112099, -0.011228522285819054, 0.0038447491824626923, -0.00567212700843811, 0.05805642530322075, 0.024218518286943436, 0.003031884552910924, -0.024296900257468224, 0.0549025759100914, -0.019861189648509026, -0.05146312713623047, -0.019575251266360283, 0.015459779649972916, -0.025649147108197212, 0.015768665820360184, 0.03080667555332184, 0.028025247156620026, 0.00910310260951519, 0.07420206069946289, -0.025271186605095863, 0.028976520523428917, 0.026539430022239685, 0.0021978719159960747, -0.00007650043698959053, 0.016356127336621284, 0.010122758336365223, 0.061165645718574524, 0.039726175367832184, 0.04352530092000961, 0.012592646293342113, 0.025709189474582672, 0.03621729835867882, -0.030525745823979378, 0.06017543748021126, 0.034415192902088165, 0.08297286182641983, -0.0024936723057180643, 0.045998845249414444, -0.008538329973816872, -0.03663339838385582, 0.017388518899679184, 0.029074225574731827, -0.019387001171708107, 0.02954239584505558, 0.011684015393257141, 0.03418473154306412, 0.035923417657613754, 0.030886253342032433, -0.003212614916265011, 0.04486517235636711, -0.002892877208068967, 0.01328298356384039, 0.027818743139505386, 0.030479470267891884, 0.00009775275975698605, 0.029944272711873055, 0.03794921562075615, 0.024186184629797935, -0.04520301893353462, 0.005426701623946428, -0.0009888597996905446, -0.00425150990486145, 0.0004812743572983891, 0.04360629618167877, -0.032934676855802536, -0.009893001057207584, -0.02705308236181736, 0.010062573477625847, -0.02142934873700142, -0.009404348209500313, -0.022801944985985756, 0.014826059341430664, 0.006840502843260765, 0.007772762328386307, 0.007436052430421114, -0.0031803457532078028, -0.018093237653374672, 0.001429599360562861, -0.01813478022813797, -0.007131543010473251, -0.0014962047571316361, 0.012717189267277718, -0.04672270640730858, 0.04955581948161125, -0.010368404909968376, 0.015141068026423454, 0.02317352034151554, -0.027359507977962494, 0.008089535869657993, -0.04611840471625328, 0.02475576288998127, 0.028657929971814156, 0.012598083354532719, 0.003915771376341581, -0.0242061335593462, -0.03074786439538002, 0.03291894868016243, -0.019905539229512215, 0.011316720396280289, -0.032835934311151505, 0.030159423127770424, -0.025008711963891983, -0.005057796370238066, 0.01045649591833353, -0.0011509559117257595, -0.0006590152042917907, -0.019431298598647118, 0.016981907188892365, -0.03309537470340729, 0.026377255097031593, 0.04882379248738289, 0.02542073465883732, -0.026603693142533302, 0.027039624750614166, -0.009745260700583458, -0.030471382662653923, 0.039345718920230865, 0.04747409373521805, 0.025446124374866486, -0.01578821800649166, 0.00031650796881876886, -0.008693689480423927, -0.0034729023464024067, -0.011358357965946198, 0.015045234933495522, 0.06799983978271484, -0.026382790878415108, -0.048372309654951096, -0.0015090410597622395, -0.00435875728726387, 0.017978409305214882, 0.03310529887676239, 0.058206286281347275, -0.0090946638956666, 0.012731455266475677, 0.019315559417009354, -0.014291287399828434, 0.04866746813058853, 0.044164422899484634, -0.019891606643795967, -0.026809899136424065, -0.0645194724202156, -0.02851233445107937, -0.03343948721885681, 0.07241512835025787, -0.007428374607115984, 0.06044939532876015, 0.02063327468931675, -0.008675454184412956, -0.04770570248365402, 0.03654596954584122, 0.04729364812374115, -0.008927224203944206, -0.029491735622286797, -0.009748152457177639, 0.007613363675773144, 0.015333662740886211, -0.029915334656834602, 0.05949534475803375, 0.02986004762351513, -0.02938014268875122, -0.013315962627530098, -0.04918908327817917, -0.017876526340842247, 0.0008574427338317037, -0.08073761314153671, 0.029218602925539017, 0.021701492369174957, -0.023899957537651062, 0.014503953978419304, 0.023262659087777138, 0.037031497806310654, -0.023832596838474274, 0.02174222655594349, -0.026123857125639915, -0.014497777447104454, -0.019614024087786674, 0.02360755391418934, -0.03923555091023445, 0.03764691203832626, -0.004756781738251448, 0.007878709584474564, 0.03786388784646988, -0.0382586307823658, -0.013996992260217667, -0.07186064124107361, 0.035391587764024734, -0.027348633855581284, 0.01595589891076088, -0.007174799684435129, 0.006833354476839304, 0.030885465443134308, 0.020393386483192444, -0.0048860423266887665, -0.005307113751769066, 0.006015102379024029, 0.001976645551621914, -0.0632532611489296, 0.0037242609541863203, 0.012037287466228008, 0.007987475953996181, 0.02910500392317772, 0.03934602439403534, 0.003250374924391508, 0.04617162048816681, -0.009127488359808922, -0.016604451462626457, -0.04738994687795639, -0.0338604710996151 ]
Retrieval Augmented Generation with Huggingface Transformers and Ray
amogkam
February 10, 2021
ray-rag
open-source-collab, nlp
https://huggingface.co/blog/ray-rag
Ray for Document Retrieval Document retrieval with the torch.distributed implementation The main drawback of the torch.distributed implementation for document retrieval was that it latched onto the same process group used for training and only the rank 0 training worker loaded the index into memory. As a result, this implementation had some limitations: 1. Synchronization bottleneck: The rank 0 worker had to receive the inputs from all workers, perform the index query, and then send the results back to the other workers. This limited performance with multiple training workers. 2. PyTorch specific: The document retrieval process group had to latch onto the existing process group used for training, meaning that PyTorch had to be used for training as well. Document retrieval with the Ray implementation To overcome these limitations, we introduced a novel implementation of distributed retrieval based on Ray. With Ray’s stateful actor abstractions, multiple processes that are separate from the training processes are used to load the index and handle the retrieval queries. With multiple Ray actors, retrieval is no longer a bottleneck and PyTorch is no longer a requirement for RAG. And as you can see below, using the Ray based implementation leads to better retrieval performance for multi-GPU fine-tuning. The following results show the seconds per retrieval call and we can see that as we increase the number of GPUs that we train on, using Ray has comparatively better performance than torch.distributed. Also, if we increase the number of Ray processes that perform retrieval, we also get better performance with more training workers since a single retrieval process is no longer a bottleneck. 2 GPU 3 GPU 4 GPU torch.distributed 2.12 sec/retrieval 2.62 sec/retrieve 3.438 sec/retrieve Ray 2 retrieval processes 1.49 sec/retrieve 1.539 sec/retrieve 2.029 sec/retrieve Ray 4 retrieval processes 1.145 sec/retrieve 1.484 sec/retrieve 1.66 sec/retrieve A performance comparison of different retrieval implementations. For each document retrieval implementation, we run 500 training steps with a per-GPU batch size of 8, and measure the time it takes to retrieve the contextual documents for each batch on the rank 0 training worker. As the results show, using multiple retrieval processes improves performance, especially as we scale training to multiple GPUs.
[ -0.002674661809578538, 0.05178271234035492, -0.01204091776162386, -0.027998238801956177, -0.0390380322933197, -0.010123465210199356, 0.00047917317715473473, -0.021965276449918747, 0.03747088834643364, -0.08067456632852554, -0.07897797226905823, 0.10422605276107788, -0.012637992389500141, 0.08940675109624863, 0.01138940081000328, 0.0347578264772892, 0.05632656812667847, -0.08272863179445267, -0.08388791978359222, -0.04714609310030937, 0.05448981374502182, -0.003249333007261157, -0.0007850546389818192, 0.03798125684261322, -0.02915511094033718, -0.06411918252706528, -0.05175725743174553, 0.024386631324887276, -0.009504863061010838, -0.0024109315127134323, -0.09720955044031143, -0.03088819421827793, 0.015363539569079876, -0.010151061229407787, -0.01620841585099697, -0.008488825522363186, -0.08006235957145691, 0.0956597775220871, 0.03641297668218613, -0.08085180819034576, 0.051601842045784, -0.036573655903339386, -0.0757966861128807, 0.0380871407687664, 0.013467595912516117, 0.027201630175113678, -0.07524402439594269, 0.011446164920926094, 0.012810807675123215, 0.01886959746479988, -0.13651470839977264, -0.0350022166967392, -0.032940227538347244, 0.018591735512018204, -0.01570248045027256, 0.048373036086559296, -0.03960507735610008, -0.01971484161913395, -0.006153144408017397, 0.051576584577560425, -0.03336003050208092, -0.020428191870450974, 0.023352202028036118, 0.09692839533090591, -0.03428581357002258, 0.031334638595581055, 0.00821221899241209, -0.04546058923006058, -0.019115785136818886, -0.04141102358698845, 0.08641625940799713, 0.04336077719926834, -0.04298580437898636, -0.002807399956509471, -0.022565951570868492, -0.005667885299772024, 0.03608746826648712, -0.029347049072384834, 0.03439367562532425, 0.038715142756700516, -0.012186199426651001, 0.04027664288878441, -0.011333510279655457, 0.02441607601940632, 0.06036411598324776, 0.02294227108359337, 0.009548504836857319, -0.03970928117632866, -0.02610238641500473, 0.014094879850745201, -0.04985518753528595, -0.07257985323667526, 0.02348778396844864, 0.0374457985162735, 0.04545637220144272, -0.01116097904741764, -0.030705919489264488, 0.008843159303069115, -0.020984753966331482, 0.05003414675593376, -0.04619256407022476, -0.079427070915699, 0.08500032126903534, 0.02489909715950489, -0.05383696407079697, 0.07432530075311661, -0.07884683459997177, -0.04218675196170807, -0.0401160903275013, 0.046826303005218506, -0.05051135644316673, 0.03900875896215439, -0.056294430047273636, 0.0012221781071275473, -0.04308859258890152, -0.06137418746948242, 0.021803345531225204, 0.03545275330543518, 0.01555246114730835, -0.03188644349575043, -0.034387122839689255, 0.08337129652500153, 0.08972664922475815, 0.026063594967126846, -0.07136588543653488, 0.067833811044693, 0.020147114992141724, 0.006827494595199823, -0.02902272157371044, 0.03043348342180252, 0.06982765346765518, 0.002923388732597232, 0.02864323928952217, 0.028524503111839294, -0.0987849161028862, -0.022861754521727562, -0.01105363667011261, -0.002049216767773032, -0.03574540093541145, 0.0024446093011647463, -0.0656965896487236, -0.030878961086273193, 0.01758548989892006, -0.024415260180830956, -0.007905476726591587, -0.04079023748636246, -0.014876028522849083, 0.02946227602660656, -0.0297747403383255, -0.051007576286792755, -0.09915966540575027, 0.06675780564546585, 0.024110333994030952, -0.01805015653371811, -0.06423445045948029, 0.07276304811239243, 0.02757897786796093, -0.024892158806324005, -0.01519638579338789, 0.0037643760442733765, -0.06803062558174133, 0.00927348155528307, -0.024662641808390617, 0.05577557161450386, -0.028895849362015724, 0.02350720390677452, 0.02845052443444729, 0.027691809460520744, -0.019375644624233246, -0.01269126683473587, -0.06506559997797012, 0.07158075273036957, 0.021915147081017494, -0.03779950737953186, -0.025196418166160583, 0.02534966729581356, -0.013681785203516483, 0.03537023067474365, 0.020596027374267578, -0.04509797319769859, 0.012250417843461037, -0.04706351086497307, -0.0516352616250515, 0.047157563269138336, -0.028093092143535614, -0.06339709460735321, 0.052085310220718384, -0.03952882066369057, 0.016579682007431984, 0.013890914618968964, -0.06437106430530548, -0.05174662545323372, 0.01401393674314022, -0.07049895077943802, -0.013303984887897968, -0.028830338269472122, -0.0389573909342289, 0.0785844475030899, -0.007500891573727131, -0.016793547198176384, 0.04239489138126373, -0.0028307978063821793, 0.009436589665710926, -0.029339564964175224, -0.005820123478770256, -0.022721046581864357, 0.030153166502714157, 0.0055764541029930115, -0.03726164624094963, 0.06356238573789597, -0.027392709627747536, -0.10568549484014511, -0.02973032183945179, -0.08383442461490631, 0.016875989735126495, 0.05162566527724266, -0.020273806527256966, 0.020985987037420273, 0.043444715440273285, 0.020823735743761063, 0.1697666049003601, -0.0702974945306778, 0.02498449571430683, 0.028287652879953384, -0.04482412338256836, 0.09748274832963943, 0.019071271643042564, 0.01763296127319336, 0.06152734532952309, -0.08256582915782928, -0.001282379264011979, -0.02932007797062397, -0.05486135557293892, 0.06833908706903458, 0.029549119994044304, 0.0013170266756787896, -0.01861344464123249, 0.010337475687265396, 0.008476694114506245, -0.04994756728410721, -0.006040199659764767, 0.020638974383473396, 0.00420277938246727, 0.020057089626789093, 0.013265189714729786, -0.028741242364048958, 0.041907042264938354, 0.031194718554615974, -0.03801407292485237, -0.06517397612333298, -0.0883149579167366, 0.033922191709280014, -0.0826052650809288, -0.0730995461344719, 0.10319700092077255, 0.009674331173300743, -0.03591712564229965, -0.0688357949256897, 0.02053212933242321, 0.0068123964592814445, -0.0008594633545726538, 0.024870362132787704, -0.04087415337562561, -0.040815114974975586, 0.012601150199770927, -0.03800642490386963, 0.013374006375670433, -0.006912146229296923, 0.03943442553281784, 0.003616664092987776, 0.03578367084264755, 0.009995616972446442, 0.035128217190504074, 0.0007961089722812176, -0.015722502022981644, 0.05844385549426079, 0.017682405188679695, -0.048055291175842285, 0.0006941237370483577, -0.01844419352710247, -0.008109078742563725, -0.039915040135383606, 0.022014625370502472, 0.005506245885044336, 0.013843348249793053, -0.008673292584717274, 0.003045957302674651, 0.017140237614512444, -0.02671116031706333, 0.00709917675703764, 0.0031278294045478106, 0.025077037513256073, -0.01118222065269947, -0.010445226915180683, 0.011817827820777893, 0.024911995977163315, -0.011258936487138271, -0.0030062173027545214, -0.00988319143652916, -0.020895978435873985, -0.058638110756874084, -0.02173834852874279, 0.0022557100746780634, -0.008446072228252888, -0.042922113090753555, -0.030695023015141487, 0.03199417516589165, 0.044699039310216904, -0.06709477305412292, -0.00953270960599184, -0.016871700063347816, 0.054901283234357834, 0.0057340445928275585, -0.010294988751411438, -0.014501518569886684, -0.04495442658662796, 0.012376680038869381, -0.03448805585503578, -0.004593575373291969, -0.01813107542693615, 0.019594164565205574, -0.016680605709552765, 0.020066728815436363, 0.003429834032431245, 0.032850246876478195, -0.010826550424098969, 0.010021873749792576, -0.016927050426602364, 0.03712701052427292, 0.013670998625457287, -0.01750250533223152, -0.01511071715503931, -0.039189696311950684, -0.01146866288036108, 0.010833028703927994, -0.029071513563394547, 0.018964221701025963, -0.018320288509130478, -0.03241562843322754, -0.02415623515844345, 0.005542176775634289, 0.008627381175756454, 0.01878778636455536, -0.03328404948115349, 0.024041391909122467, -0.010585242882370949, 0.016338419169187546, 0.05284795165061951, 0.013186170719563961, -0.012979185208678246, 0.014126688241958618, -0.054230835288763046, 0.024598510935902596, 0.008182546123862267, -0.012978355400264263, 0.023732375353574753, 0.07030143588781357, -0.014860562980175018, -0.0056644706055521965, -0.01261515635997057, -0.03491940721869469, 0.04751939699053764, -0.013254661113023758, -0.03316521644592285, -0.014600547961890697, -0.019534967839717865, 0.015450166538357735, 0.02253563702106476, -0.03936195746064186, 0.010981963016092777, 0.03983075171709061, -0.020954076200723648, 0.02010933682322502, 0.027684476226568222, 0.02268964797258377, -0.031614433974027634, -0.043504517525434494, 0.0085334163159132, -0.02669583261013031, 0.021787550300359726, 0.03403863310813904, 0.007351566106081009, -0.0348488874733448, 0.03519602119922638, 0.024805163964629173, -0.035968344658613205, 0.017799485474824905, 0.009706377051770687, -0.009647165425121784, -0.015908464789390564, -0.03805280104279518, -0.06097131222486496, 0.03811391815543175, -0.02979911118745804, 0.0260654017329216, -0.0356590561568737, 0.021514205262064934, -0.00005641777170239948, -0.03319763392210007, -0.0598946176469326, 0.03498364984989166, 0.04121319577097893, -0.031968843191862106, 0.012873902916908264, 0.037197332829236984, 0.023733966052532196, 0.03525422513484955, 0.0519874207675457, 0.007982603274285793, -0.03241235762834549, 0.005879961885511875, 0.05065516382455826, 0.012903924100100994, 0.005939343478530645, -0.04373164847493172, 0.01492359396070242, 0.005317035596817732, 0.042417973279953, -0.03807287663221359, 0.015310746617615223, 0.05829461291432381, 0.04579993337392807, 0.05051774904131889, 0.026683209463953972, 0.003007953753694892, 0.037956126034259796, -0.0731622725725174, 0.025135716423392296, -0.040596701204776764, 0.05886349827051163, 0.012767891399562359, -0.007259093225002289, -0.016526903957128525, -0.001055377651937306, 0.048486221581697464, -0.04077228158712387, 0.05735832825303078, -0.043507374823093414, -0.04808913171291351, -0.00015571436961181462, 0.015180432237684727, 0.021074987947940826, -0.009115449152886868, -0.05747254937887192, -0.008454724214971066, 0.02693963423371315, 0.020105428993701935, -0.03378109633922577, -0.019285203889012337, -0.01936234161257744, -0.021530672907829285, -0.009454636834561825, 0.014041043817996979, 0.009350203908979893, -0.007914707995951176, 0.01133132353425026, -0.05704718828201294, 0.054173797369003296, 0.04594222828745842, -0.01966964453458786, -0.02665206603705883, 0.04882737994194031, 0.04468770697712898, -0.0022470999974757433, 0.004506948869675398, 0.002628909656777978, 0.019984634593129158, 0.03498834744095802, -0.03137402981519699, -0.02254214882850647, -0.06069667637348175, -0.011715466156601906, 0.020878909155726433, -0.003024173667654395, -0.0014622753951698542, -0.026531506329774857, 0.035203710198402405, 0.026621676981449127, -0.02203122153878212, 0.018618423491716385, -0.009065144695341587, -0.016915250569581985, 0.019259313121438026, 0.017152540385723114, 0.04694600775837898, 0.00017637357814237475, 0.020432382822036743, 0.03460292890667915, -0.01809077337384224, 0.03354242816567421, 0.0038590978365391493, -0.029699694365262985, 0.025498542934656143, 0.015023323707282543, 0.032471586018800735, 0.008629337884485722, 0.023973481729626656, 0.02688751555979252, 0.02845199592411518, -0.006790710147470236, 0.04787689819931984, -0.04307853430509567, 0.006316084414720535, -0.018707893788814545, -0.022856172174215317, 0.050668906420469284, -0.0022157696075737476, 0.022053714841604233, 0.02845441922545433, 0.03236514329910278, -0.011219635605812073, -0.03138274326920509, -0.01563349924981594, -0.010423447005450726, -0.01356571540236473, -0.0041464511305093765, -0.0009607755346223712, -0.003939417656511068, 0.006632018834352493, -0.0007105760741978884, -0.044766198843717575, 0.0009536572033539414, 0.03102247416973114, -0.006959064863622189, -0.050977714359760284, 0.025199390947818756, -0.0017713902052491903, 0.029395906254649162, -0.07095123082399368, -0.0069522373378276825, 0.012153244577348232, 0.0372038297355175, 0.008988295681774616, -0.040158096700906754, 0.028016505762934685, 0.0015290009323507547, 0.009729967452585697, 0.02701880969107151, 0.039201706647872925, -0.015692438930273056, -0.02274766005575657, 0.026447497308254242, 0.0012479920405894518, -0.003886675927788019, 0.013802599161863327, 0.05129985883831978, 0.02600477822124958, 0.009297123178839684, 0.04381543770432472, 0.02638307586312294, 0.02618081495165825, 0.02439962513744831, -0.013725193217396736, 0.02664957381784916, 0.013472833670675755, 0.019642816856503487, 0.0008605203474871814, 0.012840171344578266, 0.04051543027162552, -0.001673314138315618, -0.011566453613340855, -0.024729711934924126, 0.011338270269334316, -0.003487608628347516, 0.02431250922381878, 0.008885511197149754, 0.020715393126010895, 0.04693809151649475, 0.033137012273073196, -0.07508138567209244, -0.012434435077011585, -0.028334226459264755, -0.022477036342024803, -0.005403421353548765, 0.008051983080804348, -0.026079043745994568, -0.03265933692455292, 0.01785089448094368, -0.009046277031302452, 0.004644072148948908, -0.015119743533432484, -0.009357149712741375, -0.03099721483886242, 0.03223884478211403, 0.009562293998897076, 0.04192107170820236, 0.031339842826128006, 0.05697474256157875, 0.0030103784520179033, 0.042003847658634186, 0.03207085281610489, -0.03407204523682594, 0.038712795823812485, 0.019738271832466125, 0.03213540092110634, -0.04746013134717941, 0.022121621295809746, 0.04935184866189957, 0.031686656177043915, 0.013856177218258381, 0.01289102341979742, 0.0027980394661426544, 0.010359258390963078, -0.005433103535324335, 0.012728510424494743, 0.0023766031954437494, -0.008281639777123928, 0.0274016372859478, 0.030561458319425583, 0.039368581026792526, 0.05314185842871666, -0.022095734253525734, 0.05217369645833969, -0.024021996185183525, 0.04270751401782036, 0.02587578259408474, 0.03286261111497879, 0.00516368355602026, 0.006793537642806768, 0.016546040773391724, 0.031055692583322525, 0.03281540796160698, -0.00032714148983359337, 0.0015791361220180988, 0.04467600956559181, 0.013390233740210533, 0.007580847013741732, -0.033211883157491684, 0.04637853801250458, 0.02476426772773266, 0.026271594688296318, -0.005385474301874638, -0.013567596673965454, 0.03821298107504845, -0.019230112433433533, -0.0004560205852612853, 0.022101111710071564, -0.01399315893650055, 0.007854023016989231, 0.03724202886223793, -0.02124817483127117, -0.002198615809902549, -0.006518159992992878, -0.0026808958500623703, -0.0002814875333569944, 0.028932375833392143, -0.03173450753092766, 0.007921820506453514, -0.007350556086748838, 0.023771090433001518, 0.022211994975805283, 0.05614819750189781, -0.009015161544084549, 0.024936076253652573, -0.0005342893418855965, -0.0050791241228580475, -0.022716457024216652, 0.014247236773371696, -0.0193718820810318, -0.012782442383468151, -0.019496280699968338, 0.020589090883731842, -0.05492180585861206, -0.07220432907342911, 0.03703613206744194, 0.03648015856742859, -0.036299411207437515, -0.018718834966421127, 0.06589362025260925, -0.00948625709861517, 0.02765793725848198, -0.005336375907063484, -0.027277009561657906, -0.010118328034877777, -0.0340186208486557, -0.033248502761125565, 0.018096955493092537, 0.008629176765680313, -0.04024900496006012, -0.025542911142110825, 0.008424249477684498, 0.007549274247139692, -0.0026408671401441097, -0.03065183199942112, 0.036889880895614624, -0.03063245676457882, 0.012133375741541386, -0.02589368261396885, -0.006038702093064785, 0.03630618005990982, 0.008843624033033848, 0.0099510932341218, -0.03119313344359398, 0.024091020226478577, -0.00594400754198432, -0.03452378883957863, 0.03957689553499222, 0.01807338185608387, 0.019000915810465813, -0.015825489535927773, -0.029301123693585396, 0.0189288929104805, 0.0066269636154174805, 0.04358591511845589, -0.05638682842254639, 0.03856556490063667, 0.03148900717496872, 0.0006300821551121771, -0.03445359319448471, -0.031706057488918304, 0.05377203971147537, 0.027549615129828453, 0.008821672759950161, -0.02812724933028221, -0.03401601314544678, 0.027983926236629486, -0.07170474529266357, 0.0387326180934906, 0.028364481404423714, -0.021934358403086662, -0.023029759526252747, -0.050675638020038605, -0.03538717329502106, 0.013865441083908081, -0.012938528321683407, -0.006064672954380512, -0.008629446849226952, 0.022849444299936295, 0.0004903629305772483, 0.035588543862104416, 0.036377161741256714, 0.01603418029844761, 0.043767862021923065, -0.0251908078789711, 0.009843673557043076, 0.035547930747270584, -0.008202171884477139, -0.022636618465185165, 0.057937491685152054, 0.0297775287181139, -0.01812092773616314, 0.06668887287378311, -0.03690264746546745, 0.035479918122291565, -0.02923068031668663, -0.0008276355220004916, -0.014174466952681541, -0.061229124665260315, -0.0328369140625, -0.021191060543060303, 0.024231094866991043, 0.007313521578907967, -0.011165057308971882, -0.028744906187057495, 0.03500955551862717, -0.023430295288562775, -0.025876235216856003, 0.06415685266256332, -0.0016613580519333482, 0.021702488884329796, 0.025769736617803574, 0.07972756773233414, 0.0011391355656087399, 0.017028100788593292, -0.02512240968644619, -0.0002842957037501037, 0.006576881278306246, -0.042439237236976624 ]
Retrieval Augmented Generation with Huggingface Transformers and Ray
amogkam
February 10, 2021
ray-rag
open-source-collab, nlp
https://huggingface.co/blog/ray-rag
Scaling up fine-tuning This retrieval of contextual documents is crucial for RAG's state-of-the-art results but introduces an extra layer of complexity. When scaling up the training process via a data-parallel training routine, a naive implementation of the document lookup can become a bottleneck for training. Further, the document index used in the retrieval component is often quite large, making it infeasible for each training worker to load its own replicated copy of the index. The previous implementation of RAG fine-tuning leveraged the torch.distributed communication package for the document retrieval portion. However, this implementation sometimes proved to be inflexible and limited in scalability. Instead, a framework-agnostic and a more flexible implementation for ad-hoc concurrent programming is required. Ray fits the bill perfectly. Ray is a simple, yet powerful Python library for general-purpose distributed and parallel programming. Using Ray for distributed document retrieval, we achieved a 2x speedup per retrieval call compared to torch.distributed, and overall better fine-tuning scalability.
[ 0.010506183840334415, 0.05619686469435692, -0.01021262351423502, 0.005181330721825361, -0.003583250567317009, -0.0034404618199914694, 0.012532182969152927, -0.03339327871799469, 0.03055720590054989, -0.045666445046663284, -0.08660875260829926, 0.09931450337171555, -0.017705820500850677, 0.09672653675079346, 0.006297099404036999, 0.03989643603563309, 0.028139783069491386, -0.07210134714841843, -0.07472555339336395, -0.006446472834795713, 0.021335775032639503, 0.008501495234668255, -0.04342028498649597, 0.0777067095041275, -0.03052770532667637, -0.04055016115307808, -0.026026783511042595, 0.02065364643931389, 0.017887365072965622, -0.02789742313325405, -0.06654522567987442, -0.004916347097605467, -0.01279823575168848, -0.02085859142243862, -0.009135644882917404, 0.014670899137854576, -0.013664155267179012, 0.0647241473197937, -0.055895961821079254, -0.08199971169233322, 0.05447593703866005, -0.0358242429792881, -0.06550341099500656, 0.05250966176390648, 0.03158862516283989, 0.01566743105649948, -0.014439789578318596, -0.030536292120814323, 0.0007054884335957468, 0.023652605712413788, -0.10972652584314346, -0.007900871336460114, 0.008212188258767128, -0.02759915590286255, -0.009418719448149204, 0.041415221989154816, -0.05755290389060974, -0.018866615369915962, -0.03523370996117592, 0.08423513919115067, -0.055126387625932693, -0.032368697226047516, 0.01451059989631176, 0.05313817411661148, -0.05773838981986046, 0.039475217461586, -0.03378025069832802, -0.006011267192661762, -0.02723454125225544, -0.04885190725326538, 0.06186142936348915, 0.0015484510222449899, -0.062161628156900406, 0.00982704572379589, -0.013820620253682137, -0.013143341988325119, -0.006423302460461855, -0.029291745275259018, 0.02433396503329277, 0.04860011488199234, -0.050874896347522736, 0.045676276087760925, 0.05450960621237755, -0.02285783551633358, 0.08116855472326279, 0.0355805829167366, -0.025506161153316498, -0.0355171263217926, -0.028246531262993813, -0.04412631690502167, -0.012330987490713596, -0.09224394708871841, -0.027291933074593544, 0.0071855164133012295, 0.03652821481227875, -0.025663768872618675, -0.03163854032754898, 0.018316714093089104, 0.012239296920597553, 0.04026661813259125, -0.037565987557172775, -0.06056797876954079, 0.1223311796784401, -0.003036098787561059, -0.07814808934926987, 0.11978685110807419, -0.06220068037509918, -0.06588155031204224, -0.0662238672375679, 0.08592373132705688, -0.0273274052888155, 0.08983311802148819, -0.11568040400743484, -0.014934034086763859, -0.033066269010305405, -0.05488576367497444, 0.0618065744638443, 0.05414389818906784, 0.0009317491203546524, -0.07421469688415527, -0.03570077568292618, 0.04608449339866638, 0.09824927896261215, 0.04744869843125343, -0.016909237951040268, 0.024814967066049576, -0.033941395580768585, 0.05855316296219826, 0.01842234469950199, 0.023763183504343033, 0.060383059084415436, -0.003155703656375408, 0.05798046663403511, 0.013516511768102646, -0.09514832496643066, -0.0054091522470116615, -0.007581543643027544, 0.04372450336813927, -0.038184043020009995, 0.02261686511337757, -0.03910692781209946, -0.027597514912486076, -0.025895176455378532, -0.020830782130360603, -0.001885546138510108, 0.058993905782699585, -0.005146340932697058, 0.04489835724234581, 0.000158271097461693, -0.06509166955947876, -0.007315708324313164, 0.09679978340864182, -0.002325655659660697, 0.030609095469117165, -0.014326177537441254, 0.08932153135538101, 0.08985981345176697, -0.010525280609726906, -0.0016883335774764419, 0.034190583974123, -0.04200392961502075, 0.02499477006494999, -0.060322172939777374, 0.01598588563501835, -0.04636777564883232, 0.013054978102445602, -0.00674921739846468, 0.005532111972570419, -0.02127491682767868, 0.024633552879095078, -0.030037032440304756, 0.07127759605646133, 0.042255889624357224, -0.015461538918316364, -0.07273318618535995, 0.024071579799056053, 0.0029495004564523697, 0.0515596978366375, -0.027176862582564354, -0.027649912983179092, -0.010477536357939243, 0.01872476562857628, -0.012815477326512337, 0.054468248039484024, -0.05644490197300911, -0.021675003692507744, 0.04878281429409981, -0.026800328865647316, -0.002439210657030344, 0.008557924069464207, -0.09960631281137466, -0.027025025337934494, 0.04205285385251045, -0.054579246789216995, 0.020091967657208443, -0.04509829357266426, -0.04087623581290245, 0.05435594171285629, 0.03691130131483078, 0.01288237888365984, 0.02874033898115158, -0.022131843492388725, 0.03707471489906311, -0.03326963260769844, 0.020425105467438698, -0.0592418909072876, -0.02213723212480545, -0.02937750145792961, 0.00524542573839426, 0.06558222323656082, -0.011362534016370773, -0.12650880217552185, -0.033114802092313766, -0.08383405208587646, -0.010789833031594753, 0.06189846619963646, -0.024269158020615578, 0.05783989652991295, -0.011478832922875881, 0.0263774823397398, 0.1426301747560501, -0.08172354102134705, -0.005119196604937315, 0.02134050987660885, -0.023416049778461456, 0.13455115258693695, 0.04345539212226868, -0.00012047780910506845, 0.06627345830202103, -0.07540832459926605, 0.03950919583439827, 0.007543213665485382, -0.04881660267710686, 0.04304683208465576, -0.004157657269388437, 0.01603327877819538, 0.02179986983537674, -0.01882682740688324, 0.025973664596676826, -0.04762241244316101, -0.015789862722158432, 0.026153812184929848, -0.034790366888046265, 0.012321523390710354, 0.021805226802825928, -0.050166334956884384, 0.039370376616716385, -0.02472960762679577, -0.022715948522090912, -0.060368724167346954, -0.041103869676589966, 0.01873912662267685, -0.04769830033183098, -0.03153261914849281, 0.04222947731614113, 0.028156675398349762, -0.001905504846945405, -0.04610610753297806, 0.01815294288098812, 0.0006222061347216368, 0.010388907045125961, 0.03629925474524498, -0.01416945643723011, -0.015902867540717125, 0.010619623586535454, -0.023836392909288406, 0.05143187195062637, 0.017696304246783257, 0.04141531512141228, -0.00934907142072916, -0.030902929604053497, -0.009206539951264858, 0.044069062918424606, -0.014860393479466438, -0.009397255256772041, 0.029449086636304855, -0.0005156733095645905, -0.03303715959191322, -0.01785769872367382, -0.0300303865224123, -0.024893948808312416, -0.032243188470602036, 0.01744174398481846, 0.005281980615109205, 0.020848730579018593, -0.011753085069358349, -0.0061689200811088085, 0.029524914920330048, -0.024587152525782585, -0.00983844231814146, 0.0010934144956991076, 0.004812189377844334, 0.00579277565702796, 0.017917528748512268, 0.006776777096092701, -0.0023684711195528507, -0.008238209411501884, 0.008643797598779202, -0.00856568943709135, -0.041512034833431244, -0.0018845360027626157, -0.046083610504865646, -0.016472620889544487, -0.013271303847432137, -0.034438494592905045, -0.044950857758522034, -0.004424504470080137, 0.01721298322081566, -0.0547112300992012, 0.004633578006178141, -0.02810184843838215, 0.04137251526117325, -0.01976216956973076, -0.015682872384786606, 0.019729195162653923, -0.01729545183479786, -0.01227870024740696, -0.0475228913128376, -0.029136743396520615, 0.0012385044246912003, 0.03982154279947281, -0.009478235617280006, 0.046950213611125946, -0.03177863731980324, 0.018022501841187477, -0.033543284982442856, 0.008500366471707821, 0.0024498170241713524, 0.03928341343998909, 0.008614175021648407, -0.026822742074728012, 0.014555569738149643, -0.03273457661271095, -0.00828360766172409, -0.01405144203454256, -0.02600683644413948, -0.021245077252388, -0.038907911628484726, -0.014645963907241821, -0.0449385792016983, -0.0061178128235042095, 0.00395358307287097, 0.028885845094919205, -0.047775451093912125, 0.05024052411317825, 0.007656041998416185, -0.014848694205284119, 0.03839947283267975, 0.0014102120185270905, -0.007990807294845581, 0.06540829688310623, -0.05240346118807793, 0.018409831449389458, -0.011526845395565033, -0.035331908613443375, 0.005870099179446697, 0.07848528772592545, -0.049356307834386826, -0.016106892377138138, -0.007863670587539673, -0.02058175951242447, 0.03963612765073776, -0.03026074357330799, -0.01860257238149643, -0.02694786712527275, -0.03234396129846573, 0.036402612924575806, 0.03297366574406624, -0.05522042140364647, 0.03016345016658306, 0.018851038068532944, -0.016380449756979942, 0.010020344518125057, 0.035817332565784454, 0.013150980696082115, -0.04585067927837372, -0.04484274238348007, 0.02040719799697399, -0.031385637819767, 0.024967122822999954, 0.04934363067150116, 0.0045547643676400185, -0.018397539854049683, -0.0074894726276397705, 0.029651081189513206, 0.0013151359744369984, 0.01441827043890953, 0.016911787912249565, -0.03555792570114136, -0.0434233583509922, -0.03315958380699158, -0.05184679850935936, 0.04361479729413986, -0.028730854392051697, 0.012485731393098831, -0.06316625326871872, 0.003906903322786093, 0.011259893886744976, -0.025446729734539986, -0.024006273597478867, 0.030882276594638824, 0.020917709916830063, -0.01094384491443634, 0.010143782012164593, 0.050519902259111404, 0.05330049619078636, -0.006062932778149843, -0.009486831724643707, -0.01461889035999775, -0.04119400307536125, -0.014363438822329044, 0.017104463651776314, 0.01307178009301424, 0.006262974813580513, -0.03383200243115425, -0.0008284302311949432, 0.00021540015586651862, 0.012034192681312561, -0.05179709568619728, -0.004467644263058901, 0.028796013444662094, 0.04248196631669998, 0.024323372170329094, -0.03519974648952484, -0.008693110197782516, 0.04310066998004913, -0.04141755774617195, 0.008968953043222427, -0.01621989905834198, -0.000073840310506057, 0.02109418995678425, -0.015652457252144814, -0.017556948587298393, -0.03394231200218201, 0.043606460094451904, -0.06423869729042053, 0.03488226979970932, -0.0166114903986454, -0.05191565677523613, -0.04210783913731575, 0.021068133413791656, -0.014805308543145657, -0.010677577927708626, -0.033792365342378616, -0.0004789924423675984, 0.0035679638385772705, -0.0011497499654069543, -0.017700055614113808, 0.011293841525912285, 0.013622641563415527, -0.008873287588357925, -0.0069709960371255875, 0.018811199814081192, -0.01109308935701847, 0.0012413270305842161, 0.024067450314760208, -0.03882060572504997, 0.0016555871115997434, -0.008402722887694836, -0.025774255394935608, -0.002445004414767027, 0.026014110073447227, 0.021279284730553627, -0.025563117116689682, -0.00798829086124897, 0.02537817321717739, 0.037493858486413956, 0.04033977910876274, -0.019862085580825806, -0.02856934443116188, -0.07703780382871628, -0.00801523681730032, 0.023274820297956467, -0.018423015251755714, 0.026555370539426804, 0.019300246611237526, 0.017208440229296684, 0.006208009086549282, -0.018660390749573708, 0.05757278576493263, -0.011402075178921223, -0.016973648220300674, -0.006573646795004606, 0.03386471047997475, 0.02198803424835205, 0.014331973157823086, -0.01029178872704506, 0.03705428168177605, 0.01876128278672695, -0.004111532587558031, -0.023322811350226402, -0.0012654989259317517, 0.025884129106998444, -0.013861657120287418, 0.035332582890987396, -0.021481765434145927, -0.00039694024599157274, 0.01419384777545929, 0.03278680145740509, -0.026180662214756012, 0.04526833817362785, -0.0027935472317039967, 0.021268678829073906, -0.02292129211127758, -0.08151078969240189, 0.014448218047618866, 0.0183078832924366, -0.007900876924395561, 0.02054082602262497, -0.014304437674582005, -0.012546522542834282, -0.05278977379202843, -0.020341651514172554, -0.03622223064303398, 0.013577407225966454, -0.029687991365790367, -0.00467685516923666, 0.013833591714501381, 0.02102111279964447, -0.03098861128091812, -0.013782977126538754, -0.008356146514415741, 0.05058365315198898, -0.01794883795082569, -0.022167706862092018, 0.030240006744861603, -0.03305624797940254, 0.0005387351848185062, -0.07270282506942749, 0.009866739623248577, 0.03675888478755951, 0.02732919715344906, -0.0004056898469571024, -0.008112200535833836, 0.02437790483236313, 0.02173468843102455, 0.009493778459727764, 0.03441577032208443, 0.04283624514937401, -0.009921201504766941, -0.01942998170852661, 0.05181526020169258, 0.018864408135414124, -0.03164518624544144, 0.003544816980138421, 0.08038406074047089, 0.04261006787419319, -0.026176920160651207, 0.03220038861036301, 0.0007769790827296674, 0.023449689149856567, 0.00354240951128304, 0.0024246186949312687, 0.031802814453840256, 0.0048395488411188126, 0.03388820216059685, 0.02750330977141857, -0.02435019426047802, 0.051495518535375595, -0.0034470311366021633, -0.023081058636307716, -0.03980991989374161, -0.006579467095434666, 0.004281444940716028, 0.0006940711755305529, 0.005959686823189259, 0.0206280667334795, 0.03249715268611908, 0.029016271233558655, -0.04325299710035324, 0.008246790617704391, 0.0031224722042679787, -0.02908187545835972, 0.02147677354514599, 0.07235387712717056, -0.020058389753103256, -0.04842943698167801, -0.013075126335024834, -0.032238323241472244, 0.0027013823855668306, -0.015225348994135857, -0.020690085366368294, 0.002467236714437604, 0.010612727142870426, 0.0018504762556403875, 0.011551672592759132, 0.061312977224588394, 0.019114462658762932, 0.0005402772221714258, 0.0004174227942712605, 0.041874419897794724, -0.04096154123544693, 0.014222336933016777, 0.03256681561470032, 0.04570643603801727, 0.009261555038392544, 0.032701924443244934, 0.041555680334568024, 0.035082362592220306, 0.03736835718154907, -0.0010125386761501431, -0.0007736387779004872, 0.029897714033722878, -0.004225814715027809, 0.051089584827423096, -0.004371559713035822, -0.022386692464351654, 0.004226820543408394, 0.04248013347387314, 0.06097438558936119, 0.025186827406287193, -0.019992567598819733, 0.04372698441147804, -0.01591246947646141, 0.0325426384806633, 0.017013730481266975, 0.06340388208627701, 0.015880318358540535, 0.01668650098145008, 0.007232777774333954, 0.034590426832437515, 0.04294930770993233, -0.01099992822855711, 0.024028843268752098, 0.015865428373217583, -0.016073891893029213, 0.012394125573337078, 0.00069670588709414, -0.01333868969231844, 0.026851749047636986, 0.03158266469836235, -0.008635844103991985, -0.030960652977228165, 0.003975571598857641, -0.030729904770851135, -0.002829203847795725, 0.008583109825849533, -0.02820380963385105, 0.016790227964520454, 0.031823255121707916, -0.02956756390631199, -0.02315276488661766, -0.03212851658463478, 0.007476836908608675, 0.019765229895710945, 0.05142457038164139, -0.018621360883116722, 0.0036224755458533764, -0.053336478769779205, 0.022984251379966736, 0.010582556948065758, 0.03166178986430168, 0.017519405111670494, 0.008427858352661133, -0.031780656427145004, -0.006662948988378048, -0.013502398505806923, -0.005474860314279795, -0.01868717558681965, 0.011953574605286121, -0.030285844579339027, 0.028330739587545395, -0.010730617679655552, -0.08335662633180618, 0.0300053171813488, 0.06384722888469696, -0.017422908917069435, -0.006931865122169256, 0.04556771367788315, -0.03268088400363922, 0.04394801706075668, 0.015934307128190994, -0.03540969267487526, 0.007649980019778013, 0.004981286358088255, -0.02009810507297516, 0.050031229853630066, 0.013156816363334656, -0.028471315279603004, -0.010576978325843811, -0.003744770772755146, 0.002699066186323762, 0.01903340220451355, -0.025976456701755524, 0.043332379311323166, -0.025682633742690086, 0.01833200454711914, -0.03388917073607445, -0.019449714571237564, 0.04955444112420082, 0.003294793888926506, 0.022786255925893784, -0.010440412908792496, 0.03240659460425377, 0.020077252760529518, -0.042429327964782715, 0.043249987065792084, 0.01971183717250824, -0.009265574626624584, -0.0188494510948658, -0.017509762197732925, 0.012233034707605839, -0.01054413802921772, 0.048492856323719025, -0.040667641907930374, 0.042342208325862885, -0.0039052218198776245, -0.008258753456175327, -0.06042115390300751, -0.0018371343612670898, 0.07292243093252182, 0.014966048300266266, 0.009875234216451645, 0.03398148715496063, 0.0048944358713924885, -0.009154007770121098, -0.06337258219718933, 0.05520361289381981, 0.009959552437067032, -0.007859058678150177, -0.024277256801724434, -0.0650448426604271, -0.015383606776595116, 0.005603626370429993, -0.024848805740475655, -0.010322286747395992, -0.007486235816031694, 0.037070076912641525, -0.021014364436268806, 0.05476795509457588, 0.05522231385111809, 0.020998792722821236, 0.04984251782298088, -0.012850837782025337, 0.023843633010983467, 0.0069956667721271515, -0.06158263608813286, -0.020229114219546318, 0.09120874851942062, 0.020850611850619316, -0.044395435601472855, 0.026104234158992767, -0.031208358705043793, 0.03452282398939133, -0.038258880376815796, 0.0010884085204452276, -0.01098841242492199, -0.036597851663827896, -0.03923363611102104, 0.013441196642816067, 0.0299396850168705, 0.00048369355499744415, 0.0004512700834311545, 0.007872575893998146, 0.04264898970723152, 0.029149506241083145, -0.027371972799301147, 0.0508895143866539, 0.008155383169651031, 0.01565132662653923, 0.004938873928040266, 0.0382685549557209, 0.008942436426877975, 0.04162328317761421, 0.003910875413566828, -0.016319382935762405, 0.014571938663721085, -0.011501485481858253 ]
Simple considerations for simple people building fancy neural networks
VictorSanh
February 25, 2021
simple-considerations
guide
https://huggingface.co/blog/simple-considerations
3. 🦸‍♀️ Don’t be afraid to look under the hood of these 5-liners templates Next, you can start building your model based on the insights and understanding you acquired previously. As mentioned earlier, implementing neural networks can quickly become quite tricky: there are many moving parts that work together (the optimizer, the model, the input processing pipeline, etc.), and many small things can go wrong when implementing these parts and connecting them to each other. The challenge lies in the fact that you can make these mistakes, train a model without it ever crashing, and still get a decent performance… Yet, it is a good habit when you think you have finished implementing to overfit a small batch of examples (16 for instance). If your implementation is (nearly) correct, your model will be able to overfit and remember these examples by displaying a 0-loss (make sure you remove any form of regularization such as weight decay). If not, it is highly possible that you did something wrong in your implementation. In some rare cases, it means that your model is not expressive enough or lacks capacity. Again, start with a small-scale model (fewer layers for instance): you are looking to debug your model so you want a quick feedback loop, not a high performance. > Pro-tip: in my experience working with pre-trained language models, freezing the embeddings modules to their pre-trained values doesn’t affect much the fine-tuning task performance while considerably speeding up the training. Some common errors include: * Wrong indexing… (these are really the worst 😅). Make sure you are gathering tensors along the correct dimensions for instance… * You forgot to call model.eval() in evaluation mode (in PyTorch) or model.zero\_grad() to clean the gradients * Something went wrong in the pre-processing of the inputs * The loss got wrong arguments (for instance passing probabilities when it expects logits) * Initialization doesn’t break the symmetry (usually happens when you initialize a whole matrix with a single constant value) * Some parameters are never called during the forward pass (and thus receive no gradients) * The learning rate is taking funky values like 0 all the time * Your inputs are being truncated in a suboptimal way > Pro-tip: when you work with language, have a serious look at the outputs of the tokenizers. I can’t count the number of lost hours I spent trying to reproduce results (and sometimes my own old results) because something went wrong with the tokenization.🤦‍♂️ Another useful tool is deep-diving into the training dynamic and plot (in Tensorboard for instance) the evolution of multiple scalars through training. At the bare minimum, you should look at the dynamic of your loss(es), the parameters, and their gradients. As the loss decreases, you also want to look at the model’s predictions: either by evaluating on your development set or, my personal favorite, print a couple of model outputs. For instance, if you are training a machine translation model, it is quite satisfying to see the generations become more and more convincing through the training. You want to be more specifically careful about overfitting: your training loss continues to decreases while your evaluation loss is aiming at the stars.💫
[ 0.07786710560321808, -0.04497819393873215, 0.016930291429162025, 0.008556468412280083, 0.05836230888962746, 0.07235110551118851, 0.04488672316074371, 0.024268217384815216, -0.03750986605882645, -0.05822479724884033, -0.01714782416820526, 0.029402971267700195, 0.018651805818080902, 0.02700905129313469, -0.0028667745646089315, -0.0360737107694149, 0.10957272350788116, -0.01312648132443428, -0.008911007083952427, 0.04375987499952316, 0.02506297640502453, -0.023969100788235664, 0.052535273134708405, 0.012642106972634792, 0.006560284178704023, -0.10958105325698853, -0.006664034444838762, 0.042454928159713745, -0.049093592911958694, 0.0045228018425405025, -0.10602567344903946, -0.05635838955640793, -0.029982488602399826, -0.030855627730488777, -0.014078942127525806, 0.02039852738380432, -0.07045865803956985, 0.08414711058139801, 0.07309242337942123, -0.03035281039774418, 0.007089803460985422, 0.01708974875509739, -0.07731422781944275, 0.09251751750707626, 0.002572831232100725, -0.037489186972379684, -0.17891184985637665, 0.042934074997901917, -0.006538813933730125, -0.07860644161701202, -0.07159914076328278, 0.030242513865232468, -0.051785506308078766, 0.00010808908700710163, -0.03721153363585472, -0.009920111857354641, 0.04046507552266121, -0.02220499888062477, -0.005538399331271648, -0.011154265142977238, 0.06963306665420532, 0.05521171912550926, 0.0036447886377573013, -0.006801662966609001, 0.031378038227558136, 0.020140735432505608, 0.008900982327759266, 0.050059881061315536, -0.09552115201950073, -0.005606539081782103, -0.00996197760105133, -0.04037391021847725, -0.03133086487650871, -0.026190103963017464, -0.004846347961574793, -0.06959090381860733, 0.03460120037198067, -0.022915972396731377, 0.02811260148882866, 0.03736415132880211, 0.009165599010884762, 0.03067019209265709, 0.03672100603580475, 0.0644766166806221, 0.050265777856111526, 0.007535143755376339, 0.02912217378616333, 0.017433295026421547, -0.012051161378622055, 0.06840358674526215, -0.02417697198688984, -0.12617896497249603, 0.030296437442302704, 0.023977534845471382, -0.004960137419402599, -0.04838249087333679, -0.015220645815134048, 0.03387899324297905, 0.012344594113528728, -0.057479605078697205, -0.009360144846141338, -0.06722670793533325, 0.027561916038393974, -0.0208662711083889, -0.05359943211078644, 0.015884576365351677, -0.0026194157544523478, -0.07522481679916382, -0.051566075533628464, 0.0014441446401178837, -0.10363301634788513, 0.028184793889522552, -0.0035084709525108337, 0.041159626096487045, -0.12079412490129471, -0.008973329328000546, -0.009987814351916313, 0.03895010054111481, -0.00325290416367352, -0.009423200972378254, 0.018003184348344803, 0.08662175387144089, 0.06113475561141968, 0.023594118654727936, -0.006107669789344072, 0.07410703599452972, 0.03936171531677246, 0.030528105795383453, 0.0010986565612256527, -0.0490228645503521, -0.013140418566763401, -0.0026362191420048475, 0.015371672809123993, -0.004468146711587906, -0.004347679670900106, -0.08593668788671494, 0.01727249100804329, -0.03283130005002022, -0.017922932282090187, -0.03634863346815109, -0.07295314222574234, 0.05386480316519737, -0.01215615589171648, 0.05621287599205971, 0.05429781600832939, -0.04952535778284073, -0.04454672709107399, 0.04214172065258026, 0.024344101548194885, 0.010900161229074001, -0.040491290390491486, 0.05836804583668709, -0.013831562362611294, -0.04276692867279053, -0.021117564290761948, 0.07050666958093643, -0.05537237599492073, -0.014092795550823212, -0.03911782428622246, 0.025653116405010223, 0.037697285413742065, 0.020327311009168625, -0.036926742643117905, 0.019888032227754593, 0.058097608387470245, -0.042102161794900894, 0.05128081142902374, 0.014417792670428753, 0.01097728032618761, 0.0677117258310318, -0.001905621262267232, -0.013820945285260677, 0.06966366618871689, -0.03800913318991661, -0.04273714870214462, 0.0447622612118721, -0.01251774001866579, 0.01498027890920639, -0.0001222071296069771, 0.01001178938895464, -0.06227215752005577, 0.0748966857790947, -0.05545849725604057, 0.06487222760915756, 0.05093654990196228, -0.08952463418245316, -0.025977227836847305, -0.007319778203964233, -0.045548826456069946, 0.07365014404058456, -0.06696616113185883, 0.04182670637965202, 0.05702526867389679, -0.06619530916213989, 0.036232296377420425, -0.09856950491666794, -0.028924670070409775, 0.1442922055721283, 0.0033251759596168995, 0.03487258404493332, 0.054837364703416824, 0.012131709605455399, 0.02287960611283779, -0.01955825835466385, 0.01120694074779749, -0.029735663905739784, 0.013435282744467258, -0.04673090949654579, 0.019425302743911743, 0.004926262889057398, 0.008040172979235649, -0.09021669626235962, 0.04065564647316933, -0.084987573325634, 0.0011833658209070563, -0.03292010352015495, 0.0014475166099146008, 0.026407642289996147, -0.0007476406753994524, -0.008645965717732906, 0.18160048127174377, -0.07227657735347748, -0.01881903037428856, 0.02271973341703415, -0.05181291326880455, 0.03661515936255455, 0.05926397442817688, 0.028104864060878754, 0.05870766192674637, -0.08955574780702591, -0.007532360963523388, -0.09092307835817337, -0.006925024092197418, 0.09791134297847748, -0.013958461582660675, 0.0063680242747068405, -0.019683999940752983, -0.0064683337695896626, -0.002354574389755726, -0.039154838770627975, -0.010737131349742413, 0.009040367789566517, -0.01874292828142643, 0.028907781466841698, -0.057784419506788254, -0.015127819031476974, 0.06912073493003845, -0.009975191205739975, -0.022527964785695076, -0.02382015250623226, -0.04962856322526932, 0.0535179078578949, -0.00846024975180626, -0.025676390156149864, -0.013242253102362156, 0.013522432185709476, -0.0017149829072877765, 0.0012677786871790886, -0.014558279886841774, 0.018319236114621162, 0.025844093412160873, -0.01344018429517746, -0.0398629792034626, -0.02339845895767212, 0.011079233139753342, -0.051132094115018845, -0.01821027882397175, -0.00879713799804449, 0.028082897886633873, 0.007739185355603695, 0.021918725222349167, -0.007033529691398144, 0.04201218858361244, 0.023831624537706375, -0.00005944678923697211, 0.004412521608173847, 0.004733835346996784, -0.03524868190288544, -0.029320327565073967, -0.035291898995637894, -0.01939922198653221, -0.010904769413173199, 0.03545499965548515, 0.025055356323719025, 0.019358783960342407, -0.01547519862651825, -0.02133527398109436, 0.00005494583092513494, -0.039729464799165726, 0.03168409690260887, -0.019612440839409828, 0.05620282515883446, -0.04081329330801964, -0.05382677912712097, 0.010549059137701988, 0.015696844086050987, 0.0012442730367183685, -0.006394603289663792, 0.025227198377251625, -0.007817708887159824, -0.03262608125805855, -0.004018039908260107, 0.008906547911465168, -0.01312977820634842, -0.03288866952061653, 0.01976092904806137, 0.03477320820093155, 0.024174215272068977, -0.11631953716278076, -0.003986855037510395, 0.03010500967502594, 0.0038184686563909054, -0.0036844671703875065, -0.015327314846217632, 0.01720406673848629, -0.0065363612957298756, -0.027329692617058754, -0.007088577840477228, -0.011801114305853844, 0.009060099720954895, -0.02632506750524044, 0.02701418660581112, -0.021475479006767273, 0.015793168917298317, -0.008161678910255432, -0.002359948353841901, 0.03211499750614166, 0.03957752883434296, -0.02827383391559124, 0.07834886759519577, -0.028610942885279655, 0.01496044360101223, -0.05874302238225937, 0.03292009234428406, 0.020026229321956635, 0.057553984224796295, -0.029278598725795746, -0.020376957952976227, -0.0443105511367321, -0.002330984454602003, -0.04538341611623764, 0.01498795859515667, -0.015250415541231632, -0.0006606608512811363, -0.007383914198726416, 0.0015396194066852331, 0.007302497047930956, 0.036213185638189316, -0.009364425204694271, 0.013463746756315231, 0.005711560137569904, 0.011840393766760826, 0.02554178424179554, -0.002203692914918065, 0.02759821154177189, -0.017660442739725113, 0.042310137301683426, -0.05104125291109085, -0.019526727497577667, -0.03164614364504814, 0.003333351342007518, 0.042045027017593384, -0.021527715027332306, -0.0031561509240418673, -0.003498660633340478, 0.029995424672961235, 0.04859137535095215, -0.01463623158633709, -0.034533578902482986, 0.06806068867444992, 0.023804131895303726, -0.026504436507821083, -0.004979144781827927, 0.037743452936410904, 0.04739171266555786, 0.0009133326821029186, 0.0017027909634634852, 0.050949595868587494, -0.015459305606782436, 0.021425629034638405, 0.017839284613728523, 0.0030062927398830652, 0.015670213848352432, 0.0020703282207250595, -0.014096549712121487, 0.010887164622545242, 0.08072055131196976, 0.040977977216243744, -0.031070273369550705, -0.054194118827581406, -0.026681482791900635, -0.006008535623550415, -0.013011764734983444, 0.04015475511550903, 0.02860841527581215, -0.030220991000533104, 0.013954469002783298, 0.057431697845458984, 0.03488751873373985, -0.0005811253795400262, 0.027627436444163322, -0.029773904010653496, -0.02620801143348217, -0.0015655634924769402, -0.008432285860180855, 0.006423130631446838, 0.021098604425787926, 0.016313087195158005, 0.051036734133958817, -0.05036495625972748, -0.005699754226952791, -0.0007562722894363105, 0.0031481818296015263, 0.026729710400104523, -0.06240415200591087, -0.005012548062950373, 0.022492609918117523, -0.0007676917011849582, -0.011922450736165047, -0.01761399395763874, 0.001237913966178894, -0.0011302183847874403, 0.05693371966481209, 0.007884017191827297, -0.034148793667554855, 0.002727863844484091, -0.015528550371527672, 0.011095603927969933, -0.026630956679582596, 0.04062822833657265, -0.013907170854508877, -0.035449787974357605, 0.04131418466567993, -0.02999337762594223, 0.04089901223778725, 0.008255371823906898, 0.010822439566254616, 0.003718855557963252, -0.013799458742141724, 0.002805112162604928, 0.011485427618026733, -0.011032170616090298, -0.003945498261600733, 0.009990615770220757, 0.00838381052017212, 0.03359350934624672, 0.001878981594927609, -0.044350866228342056, 0.0012657296610996127, 0.0035216400865465403, 0.004157930612564087, -0.04296798259019852, 0.03168386593461037, 0.009942008182406425, -0.037473417818546295, 0.0012255354085937142, -0.024717889726161957, 0.03262922540307045, 0.043434321880340576, 0.007677564863115549, -0.0009765229769982398, 0.015611830167472363, 0.010993671603500843, -0.05252891778945923, 0.014006423763930798, 0.008616654202342033, 0.024256493896245956, 0.03311360627412796, -0.01830103248357773, -0.014586180448532104, -0.045018889009952545, 0.028729306533932686, 0.00543397618457675, -0.021473055705428123, -0.005196420010179281, -0.031199928373098373, -0.004559721797704697, -0.01383347250521183, -0.008003311231732368, -0.019983679056167603, -0.008389260619878769, -0.05149809271097183, 0.026391351595520973, -0.004763537086546421, 0.014577221125364304, -0.011763954535126686, -0.027042590081691742, 0.03229209780693054, 0.002347096335142851, -0.015411067754030228, 0.06212238222360611, 0.003462462453171611, -0.009384092874825, 0.01021258533000946, 0.017770785838365555, 0.025901125743985176, 0.024602407589554787, 0.015354352071881294, 0.0027867332100868225, -0.013964377343654633, 0.0249309279024601, -0.024661960080266, 0.02625555917620659, 0.026893584057688713, -0.01767805777490139, 0.019030854105949402, -0.026751838624477386, -0.01869121938943863, 0.00986737571656704, 0.02739051543176174, -0.0037649443838745356, -0.01636277697980404, 0.03382069617509842, 0.015670297667384148, -0.01297945249825716, -0.04232165217399597, 0.047673702239990234, -0.03182022646069527, 0.0324103906750679, 0.02200869284570217, 0.011224617250263691, 0.004716109950095415, 0.012562022544443607, 0.0026252332609146833, -0.051208559423685074, 0.04094916954636574, 0.02606339007616043, 0.028993867337703705, 0.004127829801291227, -0.024109452962875366, -0.042326703667640686, 0.005187910981476307, 0.014439612627029419, -0.05045907944440842, -0.04332821071147919, 0.018497291952371597, -0.03224625810980797, 0.022138629108667374, 0.029589790850877762, 0.016147933900356293, 0.005250750109553337, 0.027394330129027367, 0.010825718753039837, -0.018622398376464844, -0.022138839587569237, 0.006345582660287619, 0.008115696720778942, -0.03151095286011696, -0.03144705295562744, 0.007686027325689793, -0.02016960270702839, 0.02696741372346878, -0.023471882566809654, 0.05158616602420807, 0.05087723955512047, -0.03909945487976074, -0.013700921088457108, 0.02127319574356079, 0.027903934940695763, 0.013093288987874985, -0.01327461563050747, 0.013944529928267002, 0.024678349494934082, 0.04878677800297737, 0.020686807110905647, 0.0038073353935033083, 0.020390423014760017, 0.01219265442341566, 0.01865067146718502, -0.07561655342578888, 0.006675557233393192, 0.017538275569677353, -0.005734325852245092, -0.002613611286506057, 0.0256099421530962, -0.02651563473045826, -0.007568775676190853, 0.03340122103691101, 0.05284774675965309, 0.031199809163808823, 0.010998079553246498, 0.033171720802783966, 0.01640857197344303, -0.000010726989785325713, -0.033847421407699585, 0.061510734260082245, -0.043601471930742264, 0.01119726151227951, 0.0277593731880188, 0.016404351219534874, 0.0050967237912118435, 0.012125843204557896, 0.005711677949875593, 0.009595061652362347, 0.06897443532943726, 0.017077047377824783, 0.011064776219427586, 0.03670979663729668, -0.014855762012302876, -0.009343805722892284, -0.041635721921920776, -0.025415359064936638, -0.02396034076809883, 0.02283632382750511, 0.02971448376774788, -0.026756342500448227, -0.00446284469217062, -0.011646383441984653, 0.020217740908265114, 0.03263341262936592, 0.027028273791074753, 0.026299940422177315, 0.044789500534534454, 0.05746610462665558, 0.038797251880168915, -0.00295245717279613, 0.07313347607851028, 0.024044586345553398, -0.0023829517886042595, 0.041066721081733704, 0.004819059278815985, 0.006523797754198313, 0.009232569485902786, -0.0073028611950576305, 0.029256155714392662, -0.02054034359753132, 0.019741591066122055, 0.025068292394280434, 0.026008086279034615, -0.026617418974637985, -0.02519076131284237, 0.002768064383417368, -0.043321266770362854, -0.023437343537807465, -0.020942600443959236, 0.000889191054739058, -0.014047477394342422, -0.0007911929860711098, -0.037187911570072174, 0.07187022268772125, 0.0003492340038064867, -0.054614435881376266, -0.010119598358869553, -0.0011996872490271926, 0.029154088348150253, 0.009146236814558506, -0.0015056350966915488, -0.018363451585173607, -0.029618918895721436, 0.0022372612729668617, -0.009344648569822311, 0.009960982017219067, -0.025218699127435684, -0.029039619490504265, 0.03021094761788845, -0.001085919444449246, -0.031454771757125854, 0.02913788892328739, 0.013812465593218803, -0.010576868429780006, -0.010731212794780731, 0.01990318112075329, -0.013153291307389736, -0.016567358747124672, 0.025737322866916656, -0.02383177913725376, -0.03342819958925247, -0.0031278447713702917, 0.013677558861672878, -0.002493853447958827, 0.015838108956813812, -0.05742567405104637, -0.07206055521965027, -0.009939308278262615, -0.032594628632068634, 0.006492301821708679, -0.00787130557000637, 0.026062628254294395, -0.024205170571804047, 0.030653443187475204, -0.011320391669869423, -0.04441225901246071, -0.015651581808924675, -0.011366321705281734, 0.024076692759990692, -0.029752418398857117, -0.009378827176988125, -0.044245049357414246, 0.07245559245347977, 0.03833445534110069, 0.017284169793128967, 0.057899489998817444, 0.014860683120787144, -0.006940238643437624, -0.05603502690792084, 0.015903910622000694, -0.029583919793367386, 0.03452778607606888, -0.023253746330738068, -0.027886375784873962, -0.011925509199500084, 0.0005533620715141296, 0.008292090147733688, -0.009589378722012043, -0.04989628866314888, -0.007990957237780094, -0.026204338297247887, -0.005232919938862324, -0.0041069029830396175, 0.006277298554778099, 0.0521201565861702, 0.05223074182868004, -0.020172517746686935, 0.02869812399148941, -0.034009452909231186, 0.022622639313340187, 0.0064362697303295135, -0.011341567151248455, 0.03299379348754883, -0.005175217054784298, -0.006594739854335785, 0.023791436105966568, 0.02171841450035572, 0.003966740798205137, -0.006672914605587721, 0.0002860354143194854, 0.036295708268880844, 0.014741606079041958, -0.01996971108019352, -0.0288850087672472, 0.018032634630799294, 0.014924672432243824, 0.04203291982412338, -0.03260394185781479, -0.009599871002137661, -0.02948221005499363, 0.022657115012407303, -0.06667884439229965, 0.008973751217126846, -0.008894434198737144, -0.016458703204989433, 0.03276117518544197, 0.0351458378136158, 0.035047393292188644, 0.03259018063545227, -0.05117412656545639, 0.013975429348647594, 0.027247069403529167, -0.03097066469490528, -0.026482732966542244, 0.005627903621643782, 0.043150026351213455, -0.014469936490058899, -0.030466878786683083, 0.014337795786559582, 0.05332465469837189, -0.000840948719996959, -0.018837960436940193, 0.020648512989282608, 0.03896727040410042, 0.0334080345928669, 0.01130575779825449, -0.01698092184960842, 0.05856497958302498, 0.03536999598145485, -0.043859224766492844, -0.017342206090688705, 0.025621963664889336 ]
Simple considerations for simple people building fancy neural networks
VictorSanh
February 25, 2021
simple-considerations
guide
https://huggingface.co/blog/simple-considerations
1. 🙈 Start by putting machine learning aside It might sound counter-intuitive but the very first step of building a neural network is to put aside machine learning and simply focus on your data. Look at the examples, their labels, the diversity of the vocabulary if you are working with text, their length distribution, etc. You should dive into the data to get a first sense of the raw product you are working with and focus on extracting general patterns that a model might be able to catch. Hopefully, by looking at a few hundred examples, you will be able to identify high-level patterns. A few standard questions you can ask yourself: * Are the labels balanced? * Are there gold-labels that you do not agree with? * How were the data obtained? What are the possible sources of noise in this process? * Are there any preprocessing steps that seem natural (tokenization, URL or hashtag removing, etc.)? * How diverse are the examples? * What rule-based algorithm would perform decently on this problem? It is important to get a high-level feeling (qualitative) of your dataset along with a fine-grained analysis (quantitative). If you are working with a public dataset, someone else might have already dived into the data and reported their analysis (it is quite common in Kaggle competition for instance) so you should absolutely have a look at these!
[ 0.07467281818389893, -0.03854096680879593, 0.041335687041282654, -0.013138407841324806, 0.09617670625448227, 0.0783572643995285, 0.01711384393274784, 0.057641834020614624, -0.03840452805161476, -0.0578777901828289, -0.0766330286860466, 0.09183180332183838, -0.023329054936766624, 0.05201801285147667, 0.03447209671139717, -0.03898201882839203, 0.08832905441522598, 0.0073508284986019135, 0.06626040488481522, 0.01303782220929861, -0.03964441269636154, -0.026240509003400803, 0.049481168389320374, -0.01218255516141653, 0.024927377700805664, -0.0844016820192337, 0.028038693591952324, 0.01161949336528778, -0.003761883592233062, 0.02267197147011757, -0.0922362431883812, 0.007918279618024826, -0.015082241035997868, -0.03276854008436203, -0.013880454935133457, 0.022207990288734436, -0.06765305995941162, 0.05610964447259903, 0.04341230168938637, -0.047961484640836716, -0.035427432507276535, 0.018223652616143227, -0.08776579052209854, 0.08260417729616165, -0.02289227768778801, -0.04058520868420601, -0.21570764482021332, 0.08684787154197693, -0.014839502051472664, -0.022535167634487152, -0.035629790276288986, 0.07317980378866196, -0.06476675719022751, 0.02261275053024292, -0.03649077191948891, 0.025832729414105415, 0.03465685620903969, -0.05574909597635269, -0.004925629124045372, 0.01808980107307434, 0.07398916780948639, -0.0029288262594491243, 0.007231894414871931, 0.024570556357502937, 0.018394920974969864, -0.004472160246223211, 0.015310725197196007, 0.04513484239578247, -0.10405949503183365, 0.03167174756526947, 0.039142265915870667, -0.05268719419836998, -0.024228036403656006, -0.033404573798179626, 0.01292931567877531, -0.045204710215330124, 0.06976395845413208, 0.002329058712348342, 0.00002641423634486273, 0.029758362099528313, -0.03554166480898857, 0.06195749342441559, 0.05502841994166374, 0.04341740161180496, 0.06354901194572449, -0.0018181274645030499, -0.006787593942135572, 0.04508359357714653, -0.020968174561858177, 0.09643474221229553, -0.016517704352736473, -0.08857168257236481, 0.024274596944451332, 0.030620884150266647, -0.010768156498670578, -0.06875931471586227, 0.005268843378871679, 0.002191852778196335, -0.002317449077963829, -0.04247237741947174, -0.001965389819815755, -0.042142946273088455, 0.026570487767457962, -0.042904794216156006, -0.02669956162571907, 0.0385727696120739, 0.002464885823428631, -0.028463713824748993, -0.055381014943122864, -0.015454094856977463, -0.07124438136816025, 0.01480861660093069, -0.0008023593109101057, 0.06736719608306885, -0.08220867067575455, 0.03793396055698395, -0.0019313086522743106, -0.02402246557176113, 0.024359747767448425, 0.014925605617463589, -0.01000981219112873, 0.0708681270480156, 0.029611235484480858, 0.011830138973891735, -0.017461853101849556, 0.04059023782610893, 0.027788570150732994, 0.021980883553624153, -0.0023221576120704412, -0.004282139241695404, -0.030584465712308884, -0.03448283299803734, -0.029025666415691376, -0.016118450090289116, 0.04947870224714279, -0.05808598920702934, -0.01432013139128685, -0.012026023119688034, 0.010619170032441616, 0.009284185245633125, -0.042005475610494614, 0.05401794612407684, 0.006647378206253052, 0.04168921709060669, 0.06746959686279297, -0.048466287553310394, -0.0005203039036132395, -0.01118241436779499, -0.022046059370040894, 0.038153357803821564, -0.06582173705101013, 0.04530308395624161, -0.012200898490846157, -0.05816902592778206, -0.0009312562760896981, 0.06164120137691498, 0.005345850717276335, -0.01859435625374317, -0.010874762199819088, 0.0050526889972388744, 0.03442756086587906, -0.02308390848338604, -0.021950142458081245, 0.05607076361775398, 0.038530562072992325, -0.08475002646446228, 0.060433145612478256, 0.05468864366412163, -0.02578829787671566, 0.08320268243551254, 0.018793007358908653, -0.002815056825056672, 0.06515278667211533, -0.022721722722053528, -0.026055607944726944, -0.015221728011965752, -0.000795298139564693, 0.03185166418552399, -0.01374504528939724, 0.03640920668840408, -0.02009538933634758, 0.016604064032435417, -0.028293635696172714, 0.03438670188188553, 0.030835220590233803, -0.07271872460842133, -0.018945280462503433, -0.03118954412639141, -0.02961607277393341, 0.04011540859937668, -0.04384046792984009, -0.018893791362643242, 0.0720198005437851, -0.031031779944896698, 0.016311965882778168, -0.061563294380903244, -0.01851625181734562, 0.14930251240730286, -0.00258646416477859, 0.09843325614929199, 0.05422506481409073, -0.029168907552957535, 0.033860985189676285, -0.06371437758207321, -0.0091371089220047, -0.03968832641839981, 0.021090028807520866, -0.04478735849261284, 0.04218760132789612, -0.029304485768079758, -0.03002338483929634, -0.11175701767206192, 0.06059492379426956, -0.09908542037010193, -0.0015899731079116464, 0.005754675716161728, 0.025942962616682053, 0.041826631873846054, 0.0180475153028965, -0.03384966403245926, 0.17853613197803497, -0.06603638082742691, -0.0153342979028821, 0.07818203419446945, -0.02757016010582447, 0.04294402152299881, 0.07038848847150803, 0.0660286545753479, 0.11193451285362244, -0.06045195087790489, -0.023764340206980705, -0.05318119004368782, 0.054668985307216644, 0.06893258541822433, -0.04023795574903488, -0.008656967431306839, 0.043552935123443604, 0.008075638674199581, 0.02364310249686241, -0.03854728862643242, 0.004771502688527107, -0.028443166986107826, -0.02425079606473446, 0.006248769350349903, -0.04528220370411873, -0.02562376670539379, 0.09822025895118713, -0.03009478561580181, 0.00030164411873556674, -0.013728829100728035, -0.04323311150074005, 0.05184796079993248, 0.004729763139039278, 0.012156592682003975, -0.0018273310270160437, -0.022488759830594063, 0.012824771925807, -0.020552849397063255, -0.015042615123093128, 0.020624592900276184, 0.017144566401839256, -0.04253283515572548, -0.0016276559326797724, -0.03636311739683151, -0.006597578059881926, -0.037853628396987915, -0.002520757494494319, -0.009091760031878948, 0.02493450604379177, 0.010276890359818935, -0.0024520638398826122, -0.01388599630445242, 0.0366712361574173, 0.017461713403463364, -0.0069813490845263, -0.02870352752506733, 0.014254904352128506, -0.020794637501239777, -0.018406271934509277, -0.03433353826403618, -0.017004266381263733, -0.02286398410797119, 0.02385534718632698, 0.04238025099039078, 0.04849441349506378, -0.05333893001079559, -0.008303065784275532, 0.030801638960838318, -0.034787293523550034, 0.033370696008205414, -0.049140654504299164, 0.04087583348155022, -0.049902837723493576, -0.029161794111132622, 0.011601688340306282, -0.017984502017498016, 0.0018401478882879019, 0.019545283168554306, -0.015397331677377224, -0.010302839800715446, -0.008677908219397068, 0.0195412989705801, -0.005892463494092226, -0.03378641605377197, -0.05814337730407715, 0.04346960783004761, 0.04716149717569351, 0.022112039849162102, -0.12341596186161041, 0.0013031690614297986, 0.007297556847333908, 0.012469394132494926, 0.022388475015759468, -0.011886362917721272, 0.02861289493739605, -0.001967896008864045, -0.019877314567565918, -0.0071068089455366135, -0.02112060971558094, 0.01709890551865101, 0.006419139914214611, 0.01901600882411003, -0.0007045858656056225, 0.015973763540387154, 0.0002382116363150999, -0.0004036658792756498, 0.021797195076942444, 0.033285245299339294, -0.039534565061330795, 0.06641373783349991, -0.005379560869187117, 0.04837585613131523, -0.04525236412882805, 0.02873353660106659, 0.0361831970512867, 0.05575619637966156, 0.004114510491490364, -0.012185484170913696, -0.024617591872811317, 0.0085122250020504, -0.04728002846240997, 0.014204167760908604, -0.017592111602425575, 0.00133206183090806, 0.006986031774431467, 0.011316447518765926, 0.02143826149404049, 0.03448112681508064, -0.018632380291819572, 0.024360382929444313, 0.01105660293251276, 0.0013850262621417642, 0.016942303627729416, 0.019043846055865288, -0.012969980016350746, -0.01287094596773386, 0.02650773897767067, -0.06872812658548355, -0.019424965605139732, 0.010449351742863655, 0.037239108234643936, 0.025836214423179626, -0.005974492523819208, 0.009051471017301083, 0.003054639557376504, 0.013192055746912956, 0.048732858151197433, -0.024089250713586807, -0.0274609737098217, 0.042138416320085526, 0.020087355747818947, -0.06204313784837723, -0.03238818049430847, 0.04199783504009247, 0.04065145179629326, 0.04179710894823074, 0.017024200409650803, 0.042216259986162186, 0.0037322144489735365, 0.01889951527118683, 0.0065187425352633, 0.008640621788799763, -0.026539795100688934, 0.029855703935027122, -0.02857937105000019, -0.0000882242457009852, 0.11034107953310013, 0.027278468012809753, -0.0178157240152359, -0.046407800167798996, -0.04359225928783417, -0.048470258712768555, 0.018720442429184914, 0.0015247776173055172, 0.01730508543550968, -0.04607526585459709, -0.01181450579315424, 0.033129651099443436, 0.04456622898578644, -0.01577139087021351, 0.02100232057273388, -0.007628379389643669, 0.010719000361859798, -0.01421042438596487, 0.03133189678192139, -0.014147981069982052, -0.007702728267759085, 0.004269846715033054, 0.03823962062597275, -0.04262609779834747, -0.010503895580768585, -0.010729184374213219, 0.01494148001074791, 0.019786249846220016, -0.011700315400958061, -0.027792276814579964, 0.03539888933300972, -0.01646309904754162, -0.0012922034366056323, 0.003188161412253976, 0.008151744492352009, 0.00437096506357193, 0.018201839178800583, -0.0032943887636065483, -0.05696216598153114, -0.02534404583275318, -0.008536278270184994, -0.009193195961415768, 0.006581016816198826, 0.019397906959056854, -0.026652146130800247, -0.04156213998794556, 0.03674890473484993, -0.041686106473207474, 0.05781005695462227, 0.008695499040186405, -0.005041130352765322, -0.022979069501161575, -0.018673136830329895, -0.0022730552591383457, -0.005217349622398615, 0.007022445555776358, 0.012633837759494781, 0.018633490428328514, -0.0037000468000769615, 0.03368602693080902, -0.012192899361252785, -0.04597943276166916, 0.004705778788775206, 0.007038175128400326, 0.027968477457761765, -0.009575129486620426, 0.017464227974414825, -0.006779247894883156, -0.0502782016992569, -0.007238760590553284, 0.0027240877971053123, 0.0010141207603737712, -0.004023980814963579, 0.0011169967474415898, -0.03763141855597496, 0.0173801239579916, -0.003773507894948125, -0.06792472302913666, 0.025328094139695168, 0.004605610854923725, 0.006898404099047184, 0.032192885875701904, -0.005042335484176874, -0.03844757378101349, 0.006639475468546152, 0.02170044183731079, -0.0004525744298007339, -0.022446556016802788, -0.0036748212296515703, -0.020655469968914986, 0.0009971910621970892, 0.000945614418014884, -0.010528694838285446, -0.0004407373198773712, 0.033270999789237976, -0.043577685952186584, 0.024619195610284805, 0.02394079975783825, 0.0024283176753669977, 0.02030278742313385, -0.025806255638599396, 0.030088869854807854, -0.037697453051805496, -0.004239566158503294, 0.007791339419782162, 0.019753575325012207, -0.0028118907939642668, 0.019736655056476593, 0.02075478620827198, 0.0304383747279644, 0.002053640317171812, 0.029436372220516205, 0.016530880704522133, -0.017389092594385147, 0.05818416178226471, -0.04604893550276756, 0.013470848090946674, 0.006035718601197004, 0.013599478639662266, -0.009249069727957249, -0.029970038682222366, -0.03567453846335411, 0.004943649750202894, 0.03200702369213104, -0.02374127320945263, -0.012850496917963028, 0.05101584643125534, 0.02860245853662491, -0.018051685765385628, -0.01989693194627762, 0.024285797029733658, -0.019868699833750725, -0.012223335914313793, 0.013008175417780876, -0.0007706155302003026, -0.028587257489562035, -0.01646217331290245, -0.005021985154598951, -0.05384714901447296, 0.03118107281625271, 0.010692954994738102, 0.04257267341017723, 0.012084512040019035, -0.02950061485171318, -0.024035779759287834, -0.0026030996814370155, 0.03772198408842087, -0.023364925757050514, -0.03298669308423996, 0.028963357210159302, 0.003566538682207465, 0.017686890438199043, 0.004498485941439867, -0.021731173619627953, 0.009381633251905441, 0.03360699117183685, 0.005030633416026831, -0.03141312673687935, -0.01151224598288536, 0.030895084142684937, 0.034745823591947556, -0.01768597960472107, -0.017688406631350517, 0.0021897454280406237, -0.02803606167435646, 0.015602215193212032, -0.0267962496727705, 0.007191390730440617, 0.06405647099018097, -0.013888562098145485, -0.002517279703170061, 0.015290475450456142, 0.03969558700919151, -0.019965725019574165, -0.01241607591509819, -0.00040439728763885796, 0.027006926015019417, 0.04850037768483162, -0.004254452418535948, -0.002049575559794903, 0.009812952019274235, 0.004613093100488186, 0.0027318180073052645, -0.08413221687078476, 0.021921761333942413, 0.00031444369233213365, -0.03215422108769417, -0.008213506080210209, 0.002736544469371438, -0.03876010328531265, 0.013445197604596615, 0.01658841408789158, 0.057960156351327896, 0.03029274381697178, 0.001466446788981557, 0.04679187387228012, -0.029532907530665398, -0.03231325373053551, 0.003484396729618311, 0.05277640372514725, -0.05673771724104881, 0.043326228857040405, -0.008576069958508015, 0.018258022144436836, 0.034442514181137085, -0.008252985775470734, 0.01331986766308546, 0.022784052416682243, 0.048610370606184006, 0.0027108569629490376, 0.02767101302742958, 0.01817256398499012, -0.020342720672488213, -0.033039454370737076, -0.05176473781466484, 0.012465872801840305, -0.0110759437084198, 0.028386421501636505, -0.0063164373859763145, -0.03424903750419617, -0.01091561559587717, -0.011823092587292194, 0.02660232037305832, 0.01892840676009655, -0.004257589112967253, -0.007615331094712019, 0.04578487575054169, 0.06952130049467087, 0.007894447073340416, 0.0012957982253283262, 0.0449206568300724, 0.029942644760012627, -0.008984196931123734, 0.03758266195654869, 0.021132634952664375, 0.01695745624601841, 0.000013636499716085382, -0.03019370697438717, 0.022042175754904747, -0.013079660013318062, 0.025975150987505913, 0.001271604560315609, 0.011701710522174835, -0.027641523629426956, -0.028706209734082222, 0.015144283883273602, -0.028259921818971634, 0.004434229340404272, -0.035730838775634766, 0.002339123748242855, -0.016331689432263374, -0.012359301559627056, -0.02275083027780056, 0.04276159778237343, -0.037538398057222366, -0.04385165497660637, -0.00812299083918333, -0.03631570190191269, -0.006797153968364, 0.009300081990659237, -0.03951779380440712, -0.05616584047675133, -0.021450543776154518, 0.0013338307617232203, -0.033052410930395126, -0.03081316314637661, -0.012786028906702995, -0.04637430980801582, 0.023103561252355576, 0.01119114737957716, -0.041667237877845764, 0.022048376500606537, 0.025300048291683197, 0.005726139061152935, 0.0009761195979081094, 0.036352552473545074, -0.02935461886227131, -0.010029089637100697, -0.026998445391654968, 0.013251285068690777, -0.02368197590112686, -0.02314976043999195, -0.002140181139111519, 0.024009620770812035, 0.015558145940303802, -0.02846122533082962, -0.05251435935497284, 0.009808425791561604, -0.021366925910115242, -0.0028497041203081608, 0.017997846007347107, 0.02120358683168888, 0.013918308541178703, 0.03173496574163437, 0.005353701766580343, -0.014689009636640549, -0.02802245505154133, 0.03904728218913078, -0.007437107618898153, -0.028787264600396156, -0.06090693920850754, -0.020351195707917213, 0.028536276891827583, 0.021656600758433342, 0.013828109949827194, 0.04111858829855919, 0.025383761152625084, 0.003723765956237912, -0.0707383081316948, 0.05476285144686699, -0.02485947124660015, 0.029928797855973244, -0.0457068532705307, -0.059371963143348694, -0.015431647188961506, 0.035915762186050415, 0.009530799463391304, 0.021716302260756493, -0.07093000411987305, -0.019523877650499344, -0.04108197242021561, 0.014088182710111141, -0.027621939778327942, -0.0044786459766328335, 0.03684680908918381, 0.00856065470725298, -0.019038837403059006, 0.01375624444335699, -0.021671993657946587, 0.036059800535440445, 0.00787319429218769, 0.025141172111034393, 0.020386267453432083, 0.019851546734571457, -0.008131496608257294, 0.00478547066450119, 0.00975055992603302, -0.013648750260472298, -0.009597794152796268, 0.00958364736288786, 0.03975383937358856, -0.020559340715408325, -0.00765316653996706, 0.003358115442097187, 0.02358223684132099, 0.011948760598897934, 0.0359441339969635, -0.028649186715483665, -0.008130849339067936, 0.01426286343485117, 0.03316191956400871, -0.02513101138174534, -0.019270509481430054, 0.007341884076595306, -0.00406165374442935, 0.0056881047785282135, 0.025520604103803635, 0.004976870026439428, 0.007606504950672388, -0.03715726360678673, -0.008263640105724335, 0.043576039373874664, -0.04209963604807854, -0.044727858155965805, -0.0017509229946881533, 0.020347842946648598, -0.030755603685975075, -0.02986777387559414, 0.028732139617204666, 0.028391804546117783, -0.021207215264439583, 0.00924247968941927, -0.015476788394153118, 0.01324596256017685, 0.013774286024272442, 0.015988651663064957, -0.030676815658807755, 0.0824199989438057, 0.035512525588274, -0.01763954758644104, 0.008817952126264572, 0.0091796163469553 ]
Simple considerations for simple people building fancy neural networks
VictorSanh
February 25, 2021
simple-considerations
guide
https://huggingface.co/blog/simple-considerations
2. 📚 Continue as if you just started machine learning Once you have a deep and broad understanding of your data, I always recommend to put yourself in the shoes of your old self when you just started machine learning and were watching introduction classes from Andrew Ng on Coursera. Start as simple as possible to get a sense of the difficulty of your task and how well standard baselines would perform. For instance, if you work with text, standard baselines for binary text classification can include a logistic regression trained on top of word2vec or fastText embeddings. With the current tools, running these baselines is as easy (if not more) as running BERT which can arguably be considered one of the standard tools for many natural language processing problems. If other baselines are available, run (or implement) some of them. It will help you get even more familiar with the data. As developers, it easy to feel good when building something fancy but it is sometimes hard to rationally justify it if it beats easy baselines by only a few points, so it is central to make sure you have reasonable points of comparisons: * How would a random predictor perform (especially in classification problems)? Dataset can be unbalanced… * What would the loss look like for a random predictor? * What is (are) the best metric(s) to measure progress on my task? * What are the limits of this metric? If it’s perfect, what can I conclude? What can’t I conclude? * What is missing in “simple approaches” to reach a perfect score? * Are there architectures in my neural network toolbox that would be good to model the inductive bias of the data?
[ 0.08093465119600296, -0.036366019397974014, -0.001315759844146669, -0.004250951576977968, 0.06013394147157669, 0.0294357780367136, 0.023324521258473396, 0.056802619248628616, -0.0647393986582756, -0.07605064660310745, -0.04150163754820824, 0.07908879965543747, -0.0002163025928894058, 0.016188986599445343, 0.052914850413799286, -0.019961105659604073, 0.05026426538825035, -0.06026674807071686, 0.02513730712234974, 0.005801041144877672, -0.03082389384508133, -0.019492892548441887, 0.012696761637926102, 0.01338628027588129, 0.03490377590060234, -0.04915289208292961, 0.01010681688785553, 0.004096094518899918, -0.06905493140220642, -0.005127307493239641, -0.12055374681949615, -0.01952519454061985, 0.01114136166870594, -0.03590063750743866, -0.018480472266674042, 0.040172599256038666, -0.021598270162940025, 0.05558215081691742, 0.05911043658852577, -0.022877788171172142, -0.024105623364448547, 0.012693466618657112, -0.0739237442612648, 0.04910879209637642, -0.0025089718401432037, -0.04262993857264519, -0.21752892434597015, 0.024556348100304604, 0.012548396363854408, -0.058664169162511826, -0.02804386056959629, 0.09617598354816437, -0.03207848221063614, 0.03529839962720871, 0.002798231318593025, -0.008997106924653053, 0.05670952796936035, -0.035938359797000885, -0.030572539195418358, 0.03770963475108147, 0.07179725915193558, 0.025667166337370872, 0.01153754536062479, -0.00397299462929368, -0.02199220284819603, -0.028811300173401833, 0.015829041600227356, 0.02938755415380001, -0.10721807181835175, 0.032745324075222015, 0.04331330582499504, -0.06495905667543411, -0.03187786415219307, -0.04358816519379616, 0.0030756357591599226, -0.08775852620601654, 0.03389305621385574, 0.0024953156244009733, -0.007237771991640329, -0.007810433395206928, -0.011985492892563343, 0.00828168448060751, 0.04711345583200455, 0.05481966584920883, 0.03570345789194107, -0.003631782718002796, 0.03514372929930687, -0.003397975815460086, -0.021456170827150345, 0.09383291751146317, -0.019982555881142616, -0.10574731230735779, 0.040993571281433105, 0.046299610286951065, 0.008426491171121597, -0.06411650031805038, -0.008477694354951382, -0.023712782189249992, -0.032857414335012436, -0.04700364172458649, -0.03247402608394623, -0.03992177173495293, 0.039309192448854446, -0.07728216797113419, -0.0344512015581131, 0.0022938598413020372, -0.010432985611259937, -0.07313492149114609, -0.054646726697683334, -0.02575051039457321, -0.07575105130672455, -0.00898334663361311, -0.031206578016281128, 0.06819930672645569, -0.06947867572307587, 0.038495298475027084, 0.05904938653111458, -0.006625248584896326, 0.024973265826702118, 0.021103059872984886, 0.008755265735089779, 0.028581010177731514, 0.03636939078569412, 0.016816118732094765, -0.01919761672616005, 0.056105006486177444, 0.020658152177929878, 0.024988574907183647, 0.030796123668551445, -0.038564857095479965, 0.0343603752553463, -0.03474310040473938, 0.01408644299954176, -0.0002825298870448023, 0.002008291659876704, 0.006276611238718033, -0.00420668488368392, -0.037645190954208374, 0.033822208642959595, -0.016665620729327202, -0.02574273943901062, 0.043671805411577225, 0.004900593776255846, 0.04039926454424858, 0.07303520292043686, 0.0030139279551804066, -0.06117470934987068, -0.0038637712132185698, -0.048109088093042374, 0.07849246263504028, -0.04216553643345833, 0.05186702683568001, -0.09499672055244446, -0.10625562816858292, 0.03289917856454849, 0.06315140426158905, -0.028914958238601685, 0.004264212679117918, -0.0030957572162151337, -0.0006279272492974997, 0.028279714286327362, 0.0029020891524851322, -0.03988105058670044, -0.005911931395530701, 0.08653682470321655, -0.07658413797616959, 0.02663888782262802, 0.006084212567657232, -0.01219698041677475, 0.06737168878316879, 0.01791418343782425, -0.022806955501437187, 0.06329318881034851, -0.05099080130457878, -0.025127246975898743, 0.04387155920267105, -0.02685701847076416, 0.05390123650431633, -0.021446211263537407, -0.009711671620607376, -0.08420475572347641, 0.0691223293542862, 0.001833941088989377, 0.01922115869820118, 0.0439920648932457, -0.05264776200056076, -0.0032295850105583668, -0.01257157139480114, -0.012993239797651768, 0.03404426947236061, -0.050284866243600845, 0.010164187289774418, 0.08156131207942963, -0.01558486558496952, 0.03159356489777565, -0.049942415207624435, -0.012666205875575542, 0.14840205013751984, 0.01870758645236492, 0.05344059318304062, 0.05300930142402649, 0.011786588467657566, 0.06510564684867859, -0.05081547424197197, -0.00004868941687163897, 0.015972264111042023, 0.020729774609208107, -0.041946519166231155, 0.02059995010495186, 0.013313398696482182, -0.012105435132980347, -0.08003225922584534, -0.028234241530299187, -0.09531410783529282, -0.029722081497311592, -0.01808636635541916, 0.01805342733860016, 0.046406880021095276, 0.0460844561457634, -0.03667466714978218, 0.15831977128982544, -0.08837760239839554, 0.009385917335748672, 0.07831385731697083, -0.015126658603549004, -0.006995667237788439, 0.09149722754955292, 0.011371413245797157, 0.1184791624546051, -0.08166611194610596, -0.03545118495821953, -0.044883307069540024, 0.028632763773202896, 0.047930117696523666, -0.026343923062086105, 0.013936681672930717, 0.003575733629986644, -0.016231784597039223, -0.015644220635294914, -0.010217247530817986, -0.015409203246235847, -0.025942601263523102, 0.01086308155208826, -0.006706560030579567, -0.05156295746564865, -0.02311699092388153, 0.08827085793018341, -0.022702036425471306, -0.04759107157588005, 0.0013576170895248652, -0.030325505882501602, 0.060054961591959, -0.003465278772637248, -0.024669073522090912, -0.03729632869362831, 0.02426093816757202, 0.012297691777348518, 0.0011674098204821348, -0.025581829249858856, 0.013571293093264103, 0.00040589948184788227, -0.032382674515247345, 0.021610138937830925, -0.010100031271576881, 0.021475354209542274, -0.03905171528458595, -0.04006316512823105, -0.011490989476442337, 0.01943683810532093, -0.005403868388384581, 0.009605529718101025, -0.02176705189049244, 0.06782996654510498, 0.0100759482011199, -0.0069901770912110806, -0.02326284348964691, 0.043699804693460464, -0.029140634462237358, -0.020648235455155373, -0.035384297370910645, -0.00907745212316513, -0.0015016127144917846, 0.05802137404680252, 0.03607041388750076, 0.024056771770119667, -0.0241806972771883, 0.0016885591903701425, 0.011800645850598812, -0.03351033106446266, -0.00541618000715971, 0.0026260074228048325, 0.05137079581618309, -0.05782841891050339, -0.0301740150898695, -0.0007516987971030176, 0.003819696605205536, 0.019189324229955673, -0.006015195976942778, 0.03135921061038971, 0.0011428500292822719, 0.01359462458640337, 0.03300943970680237, -0.0004713618545792997, -0.0460783988237381, -0.018539974465966225, 0.0365029014647007, 0.038025740534067154, 0.01963113620877266, -0.11423016339540482, -0.027445107698440552, 0.0033130869269371033, 0.03746945038437843, 0.0067815519869327545, -0.022865287959575653, 0.055549219250679016, 0.006515067536383867, -0.0348234586417675, -0.025204861536622047, -0.021176422014832497, -0.00554235465824604, -0.020392239093780518, 0.031299881637096405, -0.01967368647456169, 0.03771531209349632, 0.008033460937440395, -0.023409660905599594, 0.004566367249935865, 0.042571667581796646, -0.021562110632658005, 0.06108783930540085, -0.017552688717842102, 0.04031447321176529, -0.04345327615737915, 0.0459275096654892, 0.02254175953567028, 0.07588525116443634, -0.011306753382086754, -0.010279104113578796, -0.0023908913135528564, 0.031952351331710815, -0.06650710105895996, 0.022669008001685143, -0.019725682213902473, -0.01473208237439394, 0.045283254235982895, 0.039590951055288315, 0.040338896214962006, 0.03576396405696869, 0.007664669305086136, 0.017081070691347122, -0.010975888930261135, 0.00208444707095623, 0.00988778006285429, -0.028708375990390778, 0.027017742395401, -0.027301035821437836, -0.005041946657001972, -0.06707103550434113, -0.028814561665058136, -0.020183254033327103, -0.0027336839120835066, 0.060304444283246994, 0.0048330118879675865, -0.0167001411318779, 0.025884589180350304, 0.03032441809773445, 0.01554255373775959, -0.010555258952081203, -0.020282432436943054, 0.027711359784007072, 0.03626800328493118, -0.03533021733164787, -0.015560195781290531, -0.0027082914020866156, 0.009216670878231525, 0.011603258550167084, 0.0001539372024126351, 0.004742084536701441, 0.03765340521931648, 0.022505467757582664, 0.027289317920804024, 0.009268618188798428, 0.005206179339438677, -0.008999460376799107, -0.0033921946305781603, -0.015500023029744625, 0.10603176057338715, 0.021670443937182426, -0.04066488519310951, -0.03176436945796013, -0.04914011433720589, -0.034311775118112564, 0.005945773329585791, 0.012950379401445389, 0.017392344772815704, -0.03554393723607063, 0.03432861715555191, 0.04969897121191025, 0.053732939064502716, 0.00740980077534914, 0.013850228860974312, -0.01898486167192459, -0.012627809308469296, -0.005407863296568394, 0.042309653013944626, 0.008493026718497276, 0.014702239073812962, 0.001794277923181653, 0.04680029675364494, -0.021786808967590332, 0.02750856801867485, -0.03442241623997688, 0.013125711120665073, 0.03150186315178871, -0.03106686845421791, -0.02166968584060669, 0.01444842480123043, -0.030739419162273407, 0.018247414380311966, -0.00820264220237732, 0.011283456347882748, 0.0016995090991258621, 0.0021647342946380377, 0.01136503554880619, -0.046686477959156036, -0.02758106403052807, -0.00733781885355711, 0.012005489319562912, -0.012758947908878326, -0.006742917932569981, -0.018986014649271965, 0.005848851054906845, 0.023734482005238533, -0.03936102241277695, 0.026783142238855362, 0.032427605241537094, 0.016774941235780716, -0.010487936437129974, 0.00289478269405663, -0.03284691274166107, 0.03249802440404892, -0.006772464606910944, -0.012708291411399841, 0.009034138172864914, 0.008568053133785725, 0.015142624266445637, 0.0004894514568150043, -0.04276999458670616, -0.004674884025007486, 0.004315244033932686, 0.03399717062711716, -0.04934912919998169, 0.0012701331870630383, 0.016663677990436554, -0.046079982072114944, -0.005936554633080959, -0.022948620840907097, 0.003496977500617504, 0.013604815118014812, -0.009529388509690762, -0.010336095467209816, -0.004717748612165451, -0.0015666740946471691, -0.07492595165967941, -0.0159099493175745, 0.012576252222061157, 0.01403303723782301, 0.008022931404411793, -0.028121519833803177, -0.01915423944592476, -0.003058843780308962, 0.014615369029343128, 0.022298339754343033, -0.005451233591884375, -0.013057665899395943, -0.0006596882012672722, 0.016126086935400963, -0.006097362842410803, 0.006862911395728588, -0.010196983814239502, 0.008532164618372917, -0.06389501690864563, 0.04052741453051567, 0.025899354368448257, -0.005318528041243553, 0.01769980788230896, -0.028457405045628548, 0.01917121186852455, -0.026939909905195236, -0.025080343708395958, -0.0025413946714252234, -0.002148668747395277, -0.027584536001086235, 0.03781060129404068, 0.06478064507246017, 0.032034020870923996, 0.0372035950422287, 0.03213442116975784, -0.004000183194875717, -0.008794375695288181, 0.034970514476299286, -0.023554369807243347, -0.004634808748960495, -0.0327836275100708, 0.0538756437599659, -0.00473978603258729, -0.03383031487464905, -0.022061802446842194, 0.011918612755835056, 0.022805964574217796, -0.004966089967638254, -0.033298294991254807, 0.04464290291070938, -0.0029705511406064034, -0.045780785381793976, -0.032899849116802216, 0.041612494736909866, -0.03449536859989166, 0.00224674423225224, 0.013931660912930965, 0.01621241867542267, -0.010343230329453945, 0.0012537800939753652, -0.01593816466629505, -0.03900446370244026, 0.07170485705137253, 0.02406545728445053, 0.040021345019340515, -0.007251828908920288, -0.007669624872505665, -0.028067387640476227, 0.004638351034373045, 0.03254600986838341, -0.022962260991334915, -0.026942996308207512, 0.03545241430401802, -0.005306077189743519, -0.016259707510471344, 0.028924157842993736, 0.00034097256138920784, 0.024741822853684425, 0.0382581502199173, -0.008114832453429699, -0.04182358458638191, -0.04721368849277496, 0.018626248463988304, 0.01509618479758501, 0.0019199142698198557, -0.054368600249290466, -0.00252508744597435, -0.04821998253464699, -0.006613220553845167, -0.025115281343460083, 0.011425812728703022, 0.057139310985803604, 0.006102428305894136, 0.006465980317443609, 0.0014510907931253314, 0.03309410437941551, 0.025486472994089127, 0.031885869801044464, -0.005234298296272755, 0.03082934394478798, 0.037314340472221375, 0.023920385167002678, 0.014617136679589748, 0.011959763243794441, 0.007890054024755955, 0.03604436665773392, -0.09405553340911865, 0.02170095033943653, 0.01650204323232174, -0.033451445400714874, -0.012069592252373695, 0.023793598636984825, -0.017676418647170067, -0.0026640859432518482, -0.010983739979565144, 0.03710860759019852, 0.011480518616735935, 0.007458793930709362, 0.03745373338460922, 0.04170718416571617, -0.022330181673169136, -0.010628066956996918, 0.03888126462697983, -0.02569521591067314, 0.016658365726470947, 0.020708663389086723, -0.02700211852788925, 0.04478737339377403, -0.004122111480683088, 0.010610747151076794, -0.013184965588152409, 0.06609854847192764, 0.003949967212975025, 0.023577334359288216, 0.08659981191158295, -0.0066762021742761135, -0.008568091318011284, -0.037194687873125076, 0.010624383576214314, 0.02031763270497322, 0.0499136708676815, 0.037063438445329666, -0.022093655541539192, 0.025476140901446342, -0.033087313175201416, 0.04419922083616257, 0.06153976544737816, 0.010081066749989986, -0.02111358568072319, 0.033787503838539124, 0.04824453964829445, 0.04117660969495773, -0.006552450358867645, 0.038404688239097595, 0.008911552838981152, -0.023336874321103096, 0.039441872388124466, 0.015497835353016853, 0.040768105536699295, -0.0033931212965399027, -0.02339192107319832, -0.009372090920805931, -0.00831423606723547, 0.01963469758629799, -0.012840437702834606, -0.008618127554655075, -0.024039750918745995, -0.0038810507394373417, -0.008312845602631569, -0.03646461293101311, 0.009628008119761944, -0.012398234568536282, 0.008228050544857979, 0.018780650570988655, -0.005905880127102137, -0.0005642480682581663, 0.053724098950624466, 0.02617832086980343, -0.04077252000570297, -0.02383427508175373, 0.001658225548453629, 0.012487447820603848, -0.01791257970035076, -0.0004618660605046898, -0.04061306267976761, -0.04342328757047653, 0.0006688876310363412, -0.02830326557159424, 0.007689336314797401, -0.031878355890512466, -0.05515908822417259, 0.026274118572473526, -0.00374563573859632, -0.012946910224854946, 0.007354926783591509, 0.010946258902549744, 0.022451309487223625, -0.009482918307185173, 0.008727386593818665, -0.033683981746435165, -0.04310913383960724, 0.010409081354737282, -0.03502444922924042, -0.0020271828398108482, -0.016941174864768982, 0.0005129618220962584, 0.033746421337127686, 0.03779599815607071, -0.012497417628765106, -0.004433511756360531, 0.008229812607169151, 0.0037461768370121717, -0.005731485318392515, 0.009446653537452221, 0.015890488401055336, -0.03469929099082947, 0.01830257661640644, -0.008547787554562092, -0.02048684097826481, -0.007633954752236605, 0.033994633704423904, 0.005205379333347082, -0.0012441426515579224, -0.010711045004427433, 0.0014772843569517136, 0.052033644169569016, 0.012581839226186275, 0.015884608030319214, 0.031416766345500946, 0.022062452509999275, 0.0036817193031311035, -0.03946985304355621, 0.033992599695920944, 0.003988896496593952, 0.014663303270936012, -0.04146825894713402, -0.030279021710157394, -0.019418392330408096, -0.00753425620496273, -0.007974750362336636, -0.0033288735430687666, -0.06362640112638474, -0.026522621512413025, -0.024994943290948868, -0.005848752800375223, -0.05445317178964615, -0.005062336102128029, 0.03937908634543419, -0.00733528146520257, -0.023033499717712402, 0.023399148136377335, 0.005111856386065483, 0.04509593918919563, -0.009967119432985783, 0.01967754028737545, 0.022411581128835678, -0.014699431136250496, -0.027236182242631912, 0.020191432908177376, -0.012844689190387726, -0.001103078480809927, -0.027960335835814476, -0.011029531247913837, 0.045207470655441284, 0.013565776869654655, -0.05211421474814415, -0.015098021365702152, -0.0008091150666587055, 0.003624234814196825, 0.03094729594886303, -0.01564623974263668, -0.052845604717731476, 0.01532735489308834, 0.0025871535763144493, -0.025256862863898277, -0.015460911206901073, 0.023312972858548164, -0.005912278778851032, 0.03407331928610802, 0.04733404517173767, 0.004515782929956913, 0.05823739245533943, -0.0576314739882946, 0.004509823862463236, 0.031165771186351776, -0.027736984193325043, -0.038687463849782944, -0.0010127961868420243, 0.04973100498318672, -0.021905891597270966, -0.02200629934668541, 0.07357710599899292, 0.01368892565369606, -0.009324630722403526, 0.007101514842361212, -0.016267700120806694, 0.05038004368543625, -0.012049730867147446, 0.006406165659427643, 0.0020640594884753227, 0.05665839836001396, 0.031890541315078735, -0.008776948787271976, -0.02530720643699169, -0.01198001578450203 ]
Simple considerations for simple people building fancy neural networks
VictorSanh
February 25, 2021
simple-considerations
guide
https://huggingface.co/blog/simple-considerations
4. 👀 Tune but don’t tune blindly Once you have everything up and running, you might want to tune your hyperparameters to find the best configuration for your setup. I generally stick with a random grid search as it turns out to be fairly effective in practice. > Some people report successes using fancy hyperparameter tuning methods such as Bayesian optimization but in my experience, random over a reasonably manually defined grid search is still a tough-to-beat baseline. Most importantly, there is no point of launching 1000 runs with different hyperparameters (or architecture tweaks like activation functions): compare a couple of runs with different hyperparameters to get an idea of which hyperparameters have the highest impact but in general, it is delusional to expect to get your biggest jumps of performance by simply tuning a few values. For instance, if your best performing model is trained with a learning rate of 4e2, there is probably something more fundamental happening inside your neural network and you want to identify and understand this behavior so that you can re-use this knowledge outside of your current specific context. On average, experts use fewer resources to find better solutions. To conclude, a piece of general advice that has helped me become better at building neural networks is to favor (as most as possible) a deep understanding of each component of your neural network instead of blindly (not to say magically) tweak the architecture. Keep it simple and avoid small tweaks that you can’t reasonably justify even after trying really hard. Obviously, there is the right balance to find between a “trial-and-error” and an “analysis approach” but a lot of these intuitions feel more natural as you accumulate practical experience. You too are training your internal model. 🤯 A few related pointers to complete your reading: * Reproducibility (in ML) as a vehicle for engineering best practices from Joel Grus * Checklist for debugging neural networks from Cecelia Shao * How to unit test machine learning code from Chase Roberts * A recipe for Training Neural Networks from Andrej Karpathy
[ 0.10048435628414154, -0.03141854703426361, 0.0131698502227664, 0.07714048773050308, 0.030105534940958023, 0.04619406536221504, 0.04513281211256981, 0.02270526811480522, -0.05967068299651146, -0.03552534431219101, -0.04902785271406174, 0.07292090356349945, -0.005102354101836681, -0.010595019906759262, 0.016364093869924545, -0.04365625977516174, 0.08266063034534454, -0.023484304547309875, 0.030240755528211594, 0.0307282917201519, 0.04696787893772125, -0.004350502509623766, 0.028527455404400826, -0.008949609473347664, -0.0028378479182720184, -0.07810717076063156, -0.013997138477861881, 0.0017274980200454593, -0.016761258244514465, 0.008348768576979637, -0.12829603254795074, -0.010685193352401257, -0.03751910850405693, -0.02305722050368786, -0.03497761860489845, 0.035426244139671326, -0.08008839190006256, 0.02782413177192211, 0.02072046883404255, -0.04664233699440956, -0.05404435098171234, -0.041279420256614685, -0.07032753527164459, 0.07579145580530167, 0.023014545440673828, 0.000017685213606455363, -0.15109743177890778, 0.03546977415680885, -0.039731357246637344, -0.058416467159986496, -0.02615191787481308, 0.0468740314245224, 0.014765914529561996, -0.006190963089466095, -0.03503430262207985, -0.02366560883820057, 0.07991156727075577, -0.025247402489185333, -0.009824191220104694, 0.0027137373108416796, 0.08395052701234818, 0.014015674591064453, 0.018021347001194954, 0.03461847081780434, 0.060060709714889526, -0.019030245020985603, 0.007124428637325764, 0.040746141225099564, -0.09614239633083344, -0.0028693831991404295, -0.012459293007850647, -0.05948644503951073, 0.020134110003709793, -0.05132614076137543, -0.011612609960138798, -0.06962954998016357, 0.004891369491815567, -0.00892789289355278, 0.030630115419626236, 0.03524482250213623, 0.0038084080442786217, 0.008489688858389854, 0.024309026077389717, 0.05781710147857666, 0.024646025151014328, 0.013412280939519405, 0.014127057045698166, 0.02381090447306633, 0.0032296201679855585, 0.06583516299724579, -0.0003597470640670508, -0.12407980859279633, 0.0336265005171299, 0.031323377043008804, -0.024839188903570175, -0.06039988994598389, 0.013438035733997822, -0.05989868566393852, -0.006464608944952488, 0.013967483304440975, -0.014880889095366001, -0.055181849747896194, 0.045274026691913605, -0.043791476637125015, -0.06862732023000717, 0.04306866601109505, 0.048853423446416855, -0.10005437582731247, -0.05579162389039993, 0.04794981703162193, -0.0985499694943428, 0.043540626764297485, 0.008422564715147018, 0.04606955498456955, -0.09465043991804123, 0.01039412897080183, 0.007269534282386303, 0.0287949051707983, -0.009010600857436657, -0.026913514360785484, -0.019279517233371735, 0.12176168709993362, 0.02274378575384617, 0.013010317459702492, -0.02688332460820675, 0.04555843397974968, 0.06791824102401733, 0.013572516851127148, 0.020469695329666138, -0.013130932115018368, 0.007098170928657055, -0.039390478283166885, -0.029130833223462105, 0.037779755890369415, 0.015434565022587776, -0.07768327742815018, 0.029544657096266747, 0.009517299942672253, -0.02366352081298828, -0.00941087119281292, -0.05394788831472397, 0.014421110041439533, 0.005142336245626211, 0.0013279300183057785, 0.09823582321405411, 0.003270456800237298, -0.0011884834384545684, -0.0135512575507164, -0.0028487571980804205, 0.040505893528461456, 0.014946109615266323, 0.13621830940246582, -0.057844601571559906, -0.0614437535405159, 0.03627937659621239, 0.08241920173168182, -0.033392079174518585, -0.03603222593665123, -0.016015972942113876, -0.02110098861157894, 0.01869124546647072, 0.002692677779123187, -0.020889997482299805, -0.021130193024873734, 0.04085064306855202, -0.04112797975540161, 0.07028529047966003, 0.06829077750444412, -0.0492020845413208, 0.04173019155859947, -0.014218766242265701, 0.01729428768157959, 0.0744968056678772, -0.028529131785035133, -0.0069889770820736885, 0.02147487923502922, 0.013153543695807457, 0.045065853744745255, -0.024951070547103882, 0.01340161170810461, -0.07224467396736145, 0.05833800137042999, -0.03219287469983101, 0.06970991939306259, 0.025312241166830063, -0.07392467558383942, 0.010853617452085018, -0.01535466406494379, -0.023036660626530647, 0.018450815230607986, -0.0576089546084404, 0.026678403839468956, 0.10001229494810104, -0.03651713207364082, 0.0497649684548378, -0.08174078911542892, 0.012757044285535812, 0.11461186408996582, 0.06562082469463348, 0.005321980454027653, 0.03287980705499649, -0.005764024332165718, 0.024155814200639725, -0.019137369468808174, -0.02974206767976284, -0.04846462607383728, 0.0696297362446785, -0.07717827707529068, 0.022845104336738586, -0.008246026933193207, -0.011015976779162884, -0.12982705235481262, 0.008842925541102886, -0.08847223967313766, 0.049095794558525085, -0.01146782748401165, 0.03681822121143341, -0.011957669630646706, 0.005017036106437445, -0.015317930839955807, 0.15775281190872192, -0.0225127711892128, -0.033035967499017715, 0.08357912302017212, -0.01971745677292347, 0.0214875265955925, 0.07112550735473633, 0.010752792470157146, 0.08881805092096329, -0.06324291974306107, -0.05187049135565758, -0.030853578820824623, 0.02515602670609951, 0.08237656205892563, 0.010717525146901608, -0.0002970550558529794, 0.010772536508738995, -0.023019058629870415, 0.002424439648166299, -0.052192434668540955, -0.015303468331694603, -0.017790768295526505, -0.02298867516219616, 0.07475326210260391, -0.08083026111125946, -0.04929999262094498, 0.056024741381406784, 0.004926188383251429, -0.002247389405965805, -0.03270868584513664, -0.06553370505571365, -0.002247830620035529, 0.004869655705988407, -0.03765003755688667, -0.02391819842159748, -0.007388904225081205, -0.021757300943136215, 0.0026144187431782484, -0.020688386633992195, 0.033188510686159134, 0.04137647897005081, -0.007340305019170046, 0.019917044788599014, 0.018206465989351273, 0.027161717414855957, -0.029619406908750534, -0.012676962651312351, 0.01662365533411503, 0.023994846269488335, -0.02567278780043125, -0.01097817625850439, -0.013273029588162899, 0.04222608357667923, 0.0014794464223086834, -0.012668278068304062, -0.022582191973924637, 0.02958534099161625, -0.011500412598252296, -0.02026347629725933, 0.004629210568964481, 0.003679700428619981, -0.003025434911251068, 0.04799375683069229, 0.030808376148343086, -0.005726961884647608, -0.01557205431163311, -0.02559763193130493, 0.02004251442849636, -0.03709344565868378, 0.03210952877998352, -0.016535060480237007, 0.02100532315671444, -0.028619935736060143, -0.018078984692692757, -0.008558833040297031, 0.006383733823895454, -0.02379431203007698, -0.020705904811620712, 0.008855123072862625, -0.01323259063065052, -0.023126499727368355, 0.009107956662774086, -0.020579474046826363, -0.03812052309513092, -0.02501380257308483, 0.017524076625704765, 0.038105469197034836, 0.0338471420109272, -0.11755356192588806, -0.016773005947470665, -0.03226285055279732, 0.02546602301299572, -0.022767608985304832, -0.01367703266441822, 0.02288568951189518, -0.033783674240112305, -0.0034159368369728327, -0.02614053711295128, -0.019091850146651268, 0.023498833179473877, -0.010249602608382702, 0.017158443108201027, -0.02529483661055565, 0.0065039596520364285, -0.004687627777457237, 0.00948941707611084, 0.01557285338640213, 0.01638735644519329, -0.020542483776807785, 0.07239820808172226, -0.0011755565647035837, 0.03294648602604866, -0.025499574840068817, 0.05062483251094818, 0.02820906788110733, 0.04490126296877861, -0.03080025687813759, -0.02297697588801384, -0.028768308460712433, 0.01644127443432808, -0.048411108553409576, 0.03533484414219856, 0.006099138408899307, -0.01095171831548214, 0.006480848416686058, 0.011021245270967484, -0.00012974554556421936, 0.07082416862249374, 0.0037741533014923334, 0.030163181945681572, 0.026445981115102768, 0.04397431015968323, 0.01159864105284214, 0.039969880133867264, 0.02636043354868889, 0.00569922337308526, 0.03910905122756958, -0.05851248651742935, -0.011462198570370674, -0.006766126956790686, 0.01649181731045246, -0.01830771192908287, 0.00730783911421895, -0.010983862914144993, 0.010728851892054081, 0.030588814988732338, 0.0379982627928257, 0.011539888568222523, -0.006820789072662592, 0.03798167034983635, 0.009617578238248825, -0.01769062876701355, -0.006751900538802147, 0.019281048327684402, 0.033038023859262466, 0.011139553040266037, -0.0336136519908905, 0.027950089424848557, 0.025591647252440453, 0.010311915539205074, 0.026847882196307182, -0.0003466324706096202, 0.0005912467604503036, 0.0026796264573931694, -0.03468906134366989, 0.013533822260797024, 0.060183219611644745, 0.037239622324705124, -0.02815796434879303, -0.04796405881643295, -0.05045660212635994, -0.030055759474635124, 0.006097850389778614, 0.022210387513041496, 0.028413299471139908, -0.055298589169979095, 0.008132023736834526, 0.03929802030324936, 0.03318014368414879, 0.002342385007068515, 0.027083128690719604, -0.030047712847590446, -0.01810254529118538, 0.02751312032341957, 0.031854402273893356, 0.01056501641869545, 0.015130246989428997, 0.013105270452797413, 0.03435851261019707, -0.02990635856986046, 0.021824579685926437, 0.0021297310013324022, -0.003694758517667651, 0.015087542124092579, -0.05431685224175453, -0.03469105437397957, -0.012237954884767532, -0.007447071839123964, -0.0036571889650076628, -0.029254769906401634, -0.015308625064790249, -0.005741408094763756, 0.05692142993211746, 0.01533057913184166, -0.0330510213971138, 0.01681135594844818, -0.008259838446974754, -0.009930746629834175, -0.031369127333164215, 0.01925632357597351, -0.01935564912855625, -0.026695817708969116, 0.05264317989349365, -0.000991948414593935, 0.051071103662252426, 0.026173517107963562, -0.02145586535334587, -0.007597415708005428, -0.03322374448180199, -0.023010313510894775, 0.0436558872461319, -0.0005354698514565825, -0.000682904152199626, 0.02870572917163372, 0.00345223187468946, 0.03160030022263527, -0.008161937817931175, -0.03780842199921608, 0.024903934448957443, 0.02689421735703945, 0.006375884171575308, -0.052272215485572815, 0.04903408885002136, 0.01571965590119362, -0.0532144270837307, -0.011167977936565876, -0.03348991647362709, 0.012188092805445194, 0.04946575686335564, -0.011235053651034832, -0.02365085482597351, 0.02901795133948326, 0.021047156304121017, -0.06822963804006577, 0.015344046987593174, 0.01373226847499609, 0.0005651592509821057, 0.029053812846541405, 0.0014092214405536652, -0.0013539433712139726, -0.02793075144290924, 0.0012407763861119747, 0.020302513614296913, 0.009361292235553265, 0.021475698798894882, -0.009955490939319134, -0.041321802884340286, -0.031056122854351997, 0.005555246956646442, -0.008570631965994835, 0.020859144628047943, -0.05399896204471588, 0.008697890676558018, 0.002157586393877864, 0.022143494337797165, 0.0014013071777299047, 0.02111695148050785, 0.021126294508576393, 0.008126717992126942, 0.0020996066741645336, 0.00465215602889657, 0.008826670236885548, -0.015893016010522842, 0.032075319439172745, 0.05467492714524269, 0.050810959190130234, 0.018835267052054405, 0.0012695749755948782, 0.020080801099538803, -0.011277921497821808, 0.04555913060903549, -0.0465998612344265, 0.009100663475692272, 0.027309050783514977, 0.02183366008102894, -0.011190766468644142, -0.0235124584287405, -0.03754787892103195, 0.011864803731441498, 0.011796165257692337, -0.02694164216518402, -0.023106710985302925, 0.05602879077196121, 0.01929534040391445, -0.0335063673555851, -0.009147433564066887, 0.030008461326360703, -0.024839410558342934, -0.006228691432625055, -0.004208090249449015, -0.03360926732420921, -0.02545374259352684, 0.015971070155501366, -0.026872046291828156, -0.07555299997329712, 0.030914654955267906, 0.046919967979192734, 0.05192110314965248, 0.0008135840762406588, -0.03888995572924614, -0.03518861159682274, -0.023041976615786552, 0.02500881627202034, -0.05390075221657753, -0.022135592997074127, 0.008052632212638855, -0.015114376321434975, 0.02857557311654091, 0.014077359810471535, -0.015544815920293331, -0.04061629995703697, 0.031677499413490295, 0.012620600871741772, -0.06457507610321045, -0.010650590993463993, 0.059940237551927567, 0.02973473072052002, 0.014533746056258678, -0.03282827511429787, 0.004418168682605028, -0.047516368329524994, 0.0101320780813694, -0.036985646933317184, 0.05674513429403305, 0.04072589799761772, -0.001450450625270605, -0.01510621141642332, -0.022640476003289223, 0.05401177704334259, -0.015313400886952877, -0.02501104772090912, 0.0236254520714283, 0.02011425606906414, 0.038261622190475464, -0.00736462464556098, -0.011896330863237381, 0.031776368618011475, 0.023024586960673332, 0.02666354551911354, -0.048793453723192215, 0.03287980705499649, 0.014375627972185612, -0.04038442671298981, -0.0026341350749135017, 0.017975691705942154, -0.04139223322272301, 0.014381145127117634, 0.02069449983537197, 0.03538447618484497, 0.019932705909013748, 0.003439019899815321, 0.039420515298843384, 0.035506270825862885, 0.00840516947209835, -0.030725855380296707, 0.03763915225863457, -0.011940200813114643, 0.015260843560099602, 0.012877250090241432, 0.019738338887691498, 0.04536415636539459, -0.06401457637548447, 0.0210503488779068, 0.003877203678712249, 0.06041344627737999, 0.05086859315633774, 0.05002479627728462, 0.02353156916797161, -0.018335681408643723, -0.016440756618976593, -0.010465070605278015, -0.025715777650475502, -0.01342573668807745, 0.005317970644682646, 0.049574919044971466, -0.019943371415138245, -0.010996682569384575, -0.014319120906293392, 0.021936606615781784, 0.004730435088276863, 0.011059715412557125, 0.0074358368292450905, 0.02918163686990738, 0.04794367402791977, 0.02410586178302765, -0.031657516956329346, 0.04131380096077919, 0.027433572337031364, -0.02932586707174778, 0.021557582542300224, -0.017299823462963104, 0.012326379306614399, 0.0104117002338171, -0.025939689949154854, 0.0037772245705127716, -0.020462404936552048, 0.012351472862064838, 0.011725177988409996, 0.03147027641534805, 0.012260646559298038, -0.015022952109575272, 0.01264825090765953, -0.03783280402421951, -0.02848942205309868, -0.030511870980262756, 0.0018850074848160148, -0.024646596983075142, -0.005257818382233381, -0.028134770691394806, 0.06304386258125305, -0.012299948371946812, -0.05444303900003433, -0.03089096024632454, -0.018381230533123016, 0.005402249284088612, 0.01291138306260109, -0.008582529611885548, -0.04221804440021515, -0.02650039829313755, -0.016591686755418777, 0.018734514713287354, 0.009948218241333961, -0.04025406762957573, -0.017804687842726707, 0.03142353147268295, -0.0004405234649311751, -0.02715769223868847, 0.011088293977081776, 0.008822246454656124, -0.03034231811761856, -0.02019767463207245, 0.044162072241306305, -0.03857598826289177, -0.0051543693989515305, 0.013668996281921864, 0.010271173901855946, -0.017241332679986954, -0.011249392293393612, 0.011332371272146702, 0.0068151867017149925, 0.008841784670948982, -0.01843375898897648, -0.02525513432919979, 0.03666204214096069, -0.040272779762744904, -0.014051062986254692, 0.003839816665276885, 0.012716787867248058, -0.01984216831624508, -0.002124628983438015, -0.004099820740520954, -0.03570021688938141, -0.004915983881801367, 0.02460753731429577, 0.01246399525552988, -0.024430615827441216, -0.043304987251758575, -0.04120825603604317, 0.0649867057800293, 0.026990683749318123, 0.027790594846010208, 0.0341440849006176, 0.025589775294065475, -0.01617647521197796, -0.03503794223070145, 0.02373688668012619, -0.02627241052687168, 0.010852213017642498, -0.013871717266738415, -0.03398369625210762, -0.029701003804802895, 0.0018799395766109228, -0.017235375940799713, 0.00648251548409462, -0.03196730092167854, -0.012907085940241814, -0.020085694268345833, -0.008886395022273064, -0.06524483114480972, 0.011455642990767956, 0.05140263959765434, 0.03481699898838997, -0.007160932756960392, 0.02452804520726204, 0.006038910709321499, 0.03684891387820244, 0.013009056448936462, 0.021129213273525238, 0.03391243889927864, 0.010563370771706104, -0.004962933715432882, -0.017698194831609726, 0.04624374210834503, 0.02782648243010044, -0.01136156264692545, -0.020531916990876198, 0.04997110739350319, 0.003162560286000371, -0.030214356258511543, -0.034148670732975006, 0.018272532150149345, 0.024532677605748177, 0.03095133975148201, -0.014341635629534721, 0.006154182832688093, -0.02787494845688343, 0.0312548466026783, -0.018591783940792084, -0.0022956279572099447, -0.02411620318889618, -0.014349009841680527, 0.01476044487208128, 0.04236884415149689, 0.007262750994414091, 0.014042330905795097, -0.052318401634693146, -0.0042818160727620125, 0.019008921459317207, -0.05346992239356041, -0.04078182578086853, -0.03011663258075714, 0.02970532327890396, -0.02681698650121689, -0.028937717899680138, 0.022078873589634895, 0.02935122326016426, -0.034641142934560776, 0.014308130368590355, 0.01578192599117756, 0.01902220956981182, -0.0121327368542552, 0.013125043362379074, -0.018226556479930878, 0.06699159741401672, 0.02643117494881153, 0.004047674126923084, -0.00008326635725097731, 0.03850192949175835 ]
Simple considerations for simple people building fancy neural networks
VictorSanh
February 25, 2021
simple-considerations
guide
https://huggingface.co/blog/simple-considerations
Photo by Henry & Co. on Unsplash # 🚧 Simple considerations for simple people building fancy neural networks As machine learning continues penetrating all aspects of the industry, neural networks have never been so hyped. For instance, models like GPT-3 have been all over social media in the past few weeks and continue to make headlines outside of tech news outlets with fear-mongering titles. An article from The Guardian At the same time, deep learning frameworks, tools, and specialized libraries democratize machine learning research by making state-of-the-art research easier to use than ever. It is quite common to see these almost-magical/plug-and-play 5 lines of code that promise (near) state-of-the-art results. Working at Hugging Face 🤗, I admit that I am partially guilty of that. 😅 It can give an inexperienced user the misleading impression that neural networks are now a mature technology while in fact, the field is in constant development. In reality, building and training neural networks can often be an extremely frustrating experience: * It is sometimes hard to understand if your performance comes from a bug in your model/code or is simply limited by your model’s expressiveness. * You can make tons of tiny mistakes at every step of the process without realizing at first, and your model will still train and give a decent performance. In this post, I will try to highlight a few steps of my mental process when it comes to building and debugging neural networks. By “debugging”, I mean making sure you align what you have built and what you have in mind. I will also point out things you can look at when you are not sure what your next step should be by listing the typical questions I ask myself. A lot of these thoughts stem from my experience doing research in natural language processing but most of these principles can be applied to other fields of machine learning.
[ 0.09761688858270645, -0.0051412866450846195, 0.02874424308538437, 0.004053147044032812, 0.05203522369265556, 0.046559639275074005, 0.02372361533343792, 0.05713789910078049, -0.025612110272049904, -0.038752149790525436, -0.06548388302326202, 0.0771353617310524, -0.05713612586259842, 0.0554032176733017, 0.022482819855213165, -0.06321495026350021, 0.0564543791115284, -0.01907343603670597, 0.0036430046893656254, 0.016372596845030785, -0.017795274034142494, -0.041533213108778, 0.017871510237455368, -0.012810399755835533, -0.01095747109502554, -0.11270999163389206, 0.021719353273510933, -0.02154591679573059, 0.0016798494616523385, 0.050378475338220596, -0.1474124938249588, -0.03894403204321861, -0.03664238750934601, 0.006896213162690401, -0.016235722228884697, -0.01536733377724886, -0.06272933632135391, 0.07102594524621964, 0.013545472174882889, -0.01453422661870718, -0.018555371090769768, -0.027007637545466423, -0.09533648192882538, 0.06956417113542557, -0.005627330858260393, 0.008673032745718956, -0.1801811158657074, 0.024994181469082832, -0.04129001498222351, -0.029758760705590248, -0.07949638366699219, 0.07601051777601242, -0.04648180305957794, 0.02910204976797104, -0.019158994778990746, -0.016435377299785614, 0.023456724360585213, -0.03924892097711563, -0.01434702891856432, 0.0023647251073271036, 0.04852381348609924, 0.03208677098155022, 0.01335233636200428, 0.028663810342550278, 0.02115827612578869, 0.0006595647428184748, 0.030225438997149467, 0.043887242674827576, -0.08800122141838074, 0.043779823929071426, 0.059609971940517426, -0.034790411591529846, 0.0025679515674710274, -0.08392129838466644, 0.003302381606772542, -0.036625854671001434, 0.04780038818717003, 0.008318946696817875, 0.03991375118494034, 0.04462302848696709, -0.010660022497177124, 0.0017653761897236109, 0.04292960464954376, 0.04984589293599129, 0.004073777701705694, 0.014077061787247658, -0.0008424603729508817, 0.01901659183204174, -0.04253197833895683, 0.052166715264320374, -0.0035692777018994093, -0.10715898871421814, -0.00043368659680709243, 0.05262076482176781, 0.02257833257317543, -0.04424667730927467, -0.037485700100660324, -0.0035505550913512707, 0.026273084804415703, -0.055952198803424835, -0.03494763746857643, -0.026524821296334267, 0.04167654737830162, -0.07065195590257645, -0.040229372680187225, 0.03473687171936035, -0.009916174225509167, -0.026549145579338074, -0.04707345739006996, 0.0017474946798756719, -0.05727667734026909, 0.032023485749959946, 0.007993407547473907, 0.04330499470233917, -0.12064452469348907, 0.029612256214022636, 0.012548142112791538, -0.03519802913069725, 0.00014367418771144003, -0.025465145707130432, 0.05214405059814453, 0.04534348100423813, 0.03201310709118843, 0.03083929233253002, -0.00940910167992115, 0.05746018514037132, 0.016566207632422447, 0.0471205897629261, 0.021427715197205544, -0.04364361986517906, -0.006405137944966555, -0.007557777222245932, 0.016757503151893616, -0.021812357008457184, 0.03847501054406166, -0.0563383549451828, -0.001066387165337801, -0.04791324958205223, 0.009047478437423706, 0.006916566751897335, -0.018327975645661354, 0.05557452514767647, 0.028232045471668243, -0.00897539034485817, 0.08445281535387039, -0.010542552918195724, -0.017303384840488434, 0.03253654018044472, -0.003845473285764456, 0.007486266084015369, -0.058139536529779434, 0.03938155621290207, -0.03825618326663971, -0.023181630298495293, 0.029747262597084045, 0.08763168007135391, -0.02138669602572918, -0.051158834248781204, 0.025352956727147102, -0.024154970422387123, 0.027533207088708878, -0.03237916901707649, -0.00613022968173027, 0.01107719261199236, 0.0917021632194519, -0.061212170869112015, 0.0683983638882637, 0.030041689053177834, -0.027122674509882927, 0.08548910915851593, 0.04950592666864395, 0.004699078854173422, 0.057762496173381805, -0.07548913359642029, 0.01514738705009222, 0.015446699224412441, -0.018393555656075478, 0.013216518796980381, 0.021767184138298035, 0.03686564415693283, -0.06011376157402992, 0.034460052847862244, -0.008689087815582752, 0.05437455326318741, 0.028309838846325874, -0.07289837300777435, -0.02536158077418804, -0.03971449285745621, -0.048909373581409454, -0.00826156698167324, -0.05919945240020752, 0.035564571619033813, 0.06025078892707825, -0.03726639598608017, 0.026296356692910194, -0.06327647715806961, -0.013653050176799297, 0.16089405119419098, -0.008166348561644554, 0.04243169352412224, 0.06174125522375107, -0.054675471037626266, 0.022529466077685356, -0.04950619861483574, -0.020225493237376213, -0.011469156481325626, 0.06632454693317413, -0.05341118574142456, 0.002658059122040868, -0.014195729978382587, 0.025971001014113426, -0.11126603186130524, 0.05944642052054405, -0.0385153703391552, 0.02861655317246914, -0.05656607076525688, 0.0505845844745636, 0.007046516519039869, -0.003103508846834302, 0.004525156691670418, 0.16407990455627441, -0.04962896928191185, -0.008752120658755302, 0.08145126700401306, -0.042241085320711136, 0.04436993971467018, 0.08598794788122177, 0.03567583113908768, 0.09776134043931961, -0.058905117213726044, -0.04369606077671051, -0.06135893240571022, 0.008823259733617306, 0.03454762324690819, -0.038857921957969666, 0.028510382398962975, 0.05373220145702362, -0.021012477576732635, 0.0023234402760863304, -0.039959073066711426, -0.05186199024319649, -0.018892955034971237, 0.010820435360074043, 0.02596350386738777, -0.0452333427965641, -0.0018018755363300443, 0.08839738368988037, -0.0002594943216536194, -0.016883675009012222, -0.016808031126856804, -0.07807442545890808, 0.08660989999771118, 0.002442683093249798, 0.02113370969891548, 0.008405404165387154, 0.02331157587468624, -0.012936520390212536, -0.01310635358095169, -0.05509239062666893, 0.009639626368880272, 0.005753714125603437, -0.030936896800994873, -0.013657109811902046, -0.01357685960829258, -0.023380087688565254, -0.061440639197826385, -0.015035133808851242, -0.010726000182330608, 0.04526207223534584, 0.01769333705306053, 0.024387039244174957, -0.008371441625058651, 0.032456982880830765, 0.013585960492491722, 0.000019993613022961654, -0.016517825424671173, 0.02290336601436138, -0.028031466528773308, -0.043473415076732635, -0.032444436103105545, -0.01981274224817753, -0.010293055325746536, 0.01829526573419571, 0.0434260331094265, 0.039540208876132965, -0.03211773559451103, -0.023670505732297897, 0.03653138130903244, -0.06929649412631989, -0.009918948635458946, -0.02053201198577881, 0.0353127084672451, -0.011842304840683937, -0.03905884549021721, -0.004809235222637653, -0.010702608153223991, 0.017992917448282242, -0.02518043853342533, 0.008860459551215172, 0.020101051777601242, -0.011583671905100346, 0.023772211745381355, -0.018086737021803856, 0.015937726944684982, -0.023347649723291397, -0.0015559967141598463, 0.08503405004739761, 0.01185239665210247, -0.11542920768260956, -0.02467639185488224, -0.0034369018394500017, 0.03874786198139191, -0.0010889149270951748, -0.02895672433078289, 0.00015747416182421148, 0.00250221136957407, 0.01366614643484354, -0.027725137770175934, -0.023468373343348503, -0.01520262099802494, -0.0027925537433475256, 0.033785175532102585, -0.028800006955862045, 0.03273966163396835, -0.02394476905465126, -0.008961876854300499, 0.040353093296289444, 0.012840083800256252, -0.055720530450344086, 0.06236176937818527, -0.002071066526696086, 0.017529647797346115, -0.0212007537484169, 0.012606758624315262, 0.033527906984090805, 0.05461368337273598, 0.0010173689806833863, 0.01647479273378849, -0.019214758649468422, -0.023863118141889572, -0.007349035236984491, 0.002875805599614978, -0.01031231228262186, -0.011693348176777363, 0.0487087108194828, 0.013017966412007809, 0.021343860775232315, 0.04940199851989746, -0.008064248599112034, 0.008710523135960102, -0.023158850148320198, 0.01791270077228546, 0.0005951802595518529, -0.026780087500810623, -0.015479153953492641, -0.03504461050033569, 0.004030028358101845, -0.05389019101858139, -0.004759259056299925, 0.0317716971039772, -0.00025025810464285314, 0.04054759442806244, 0.008812717162072659, 0.00917828269302845, -0.00035685140755958855, 0.0074271331541240215, -0.007831864058971405, -0.024061162024736404, -0.05934034660458565, 0.08707350492477417, -0.011432464234530926, 0.005615005735307932, -0.01873534731566906, 0.016604986041784286, 0.02473919466137886, -0.00047252376680262387, 0.00918098259717226, 0.05690987780690193, 0.0013566857669502497, -0.011139600537717342, 0.015898678451776505, -0.00020952077466063201, -0.028546694666147232, 0.011092332191765308, -0.013078505173325539, -0.030180711299180984, 0.08166151493787766, 0.049650438129901886, -0.019687240943312645, -0.07225961238145828, -0.0256335511803627, -0.02564903534948826, 0.018086811527609825, 0.00025558090419508517, 0.019856031984090805, -0.021769095212221146, -0.00913424976170063, 0.038293126970529556, 0.009985596872866154, -0.007366182282567024, 0.011072651483118534, -0.040775399655103683, 0.009255689568817616, -0.05469028651714325, -0.00685790553689003, -0.0011733848368749022, 0.007033267989754677, 0.015390698798000813, 0.05874486267566681, -0.052341070026159286, 0.0013542191591113806, 0.005857307463884354, -0.012056642211973667, 0.05026354640722275, -0.030562959611415863, -0.021875809878110886, -0.02335537038743496, 0.019923625513911247, 0.002955028787255287, -0.010640162974596024, -0.0017094279173761606, -0.002226749435067177, 0.022651292383670807, 0.014213685877621174, -0.010793227702379227, -0.0022596765775233507, -0.0018723998218774796, -0.008701159618794918, 0.015646949410438538, 0.018491046503186226, -0.008924384601414204, -0.027552029117941856, 0.047932472079992294, -0.001993935089558363, 0.03168218582868576, -0.009778624400496483, -0.003658589441329241, -0.011955052614212036, -0.023942478001117706, 0.010042773559689522, 0.04336130991578102, -0.005803168285638094, 0.016230758279561996, 0.031823135912418365, -0.0016194726340472698, 0.0293632410466671, 0.006074053701013327, -0.052193332463502884, 0.013373645022511482, 0.02059386484324932, -0.008496847935020924, -0.04694726690649986, 0.008984208106994629, -0.0037793233059346676, -0.04001838341355324, -0.0021427865140140057, -0.012987877242267132, 0.015554459765553474, 0.0300196073949337, -0.021283529698848724, -0.034733232110738754, 0.013280512765049934, 0.023112207651138306, -0.04066909849643707, 0.012346276082098484, 0.002825359581038356, 0.0013649780303239822, 0.030249543488025665, -0.021754678338766098, -0.019033489748835564, -0.02747727744281292, 0.004544376395642757, 0.02190014347434044, -0.037287637591362, 0.005273156333714724, -0.018517835065722466, -0.030375562608242035, -0.04430751875042915, 0.002666287124156952, 0.0035281393211334944, 0.02259761095046997, -0.03211837634444237, 0.016796302050352097, 0.031244603917002678, 0.007620919030159712, 0.03422980383038521, -0.013646607287228107, 0.024570561945438385, -0.017681675031781197, 0.002894494216889143, 0.018868865445256233, -0.012296697124838829, 0.01810411550104618, -0.018099989742040634, 0.060546502470970154, 0.05804013833403587, -0.0042515164241194725, 0.011786769144237041, -0.004123802296817303, 0.012526622042059898, 0.039768803864717484, -0.005793893244117498, -0.004298323765397072, 0.01597747951745987, 0.03185814619064331, 0.001211727736517787, -0.04288734495639801, -0.00951444637030363, -0.0027106888592243195, 0.026591114699840546, -0.0331130214035511, -0.0026607844047248363, 0.06530755758285522, -0.00123077561147511, -0.014193380251526833, -0.03685401380062103, 0.015012875199317932, -0.01296128612011671, -0.00569403450936079, -0.01165435928851366, 0.012275809422135353, -0.0387134812772274, -0.005145896691828966, -0.01882772706449032, -0.048123423010110855, 0.04781998321413994, 0.02970503270626068, 0.059320561587810516, 0.014975453726947308, -0.026955455541610718, -0.04335027560591698, -0.012865142896771431, 0.04762786626815796, -0.004645145498216152, -0.02973265014588833, 0.022350696846842766, 0.0193610992282629, 0.024652447551488876, -0.002166948514059186, 0.00005957325629424304, 0.013424638658761978, 0.04521070048213005, -0.032982237637043, -0.04564662650227547, -0.03727927431464195, 0.06544457376003265, 0.04635876044631004, -0.03474859893321991, -0.037555985152721405, 0.02139001339673996, -0.032180432230234146, -0.004788686987012625, -0.03740229457616806, 0.02308148704469204, 0.03428030386567116, -0.03023722395300865, 0.00018851245113182813, -0.0021613985300064087, 0.027138888835906982, -0.000016505035091540776, -0.014047205448150635, 0.0060808295384049416, 0.03021782450377941, 0.030693933367729187, 0.0455438606441021, -0.02016756869852543, -0.03122941218316555, -0.004168470855802298, 0.04940385743975639, -0.08261825889348984, 0.014155743643641472, -0.005971792619675398, -0.014355199411511421, 0.005672958679497242, -0.0072889020666480064, -0.020749129354953766, 0.03676383197307587, -0.007968216203153133, 0.017997993156313896, 0.023071298375725746, 0.0338081419467926, 0.03750326856970787, -0.026809467002749443, -0.03557530418038368, 0.008308010175824165, 0.047156013548374176, -0.032595813274383545, -0.0013910004636272788, 0.005723491311073303, 0.020452644675970078, 0.07154572755098343, -0.028525443747639656, 0.04304203391075134, 0.0019072279101237655, 0.06552227586507797, -0.006730052176862955, 0.016580896452069283, 0.05061381310224533, -0.031166672706604004, -0.026509184390306473, -0.022970635443925858, -0.018363777548074722, -0.026578927412629128, 0.03224585950374603, 0.02716916613280773, -0.03179631382226944, -0.025548040866851807, -0.027003450319170952, 0.04454338923096657, 0.03853830322623253, 0.04743951931595802, 0.02719583548605442, 0.043289072811603546, 0.06151733174920082, 0.026534730568528175, 0.003957281354814768, 0.056447263807058334, 0.009551266208291054, -0.014097562059760094, 0.032317839562892914, 0.03823716193437576, 0.03576185926795006, -0.00802905485033989, 0.010484922677278519, 0.027046246454119682, 0.0017568481853231788, 0.034375227987766266, 0.01502834353595972, -0.024938570335507393, 0.015933770686388016, -0.01323095802217722, -0.007461600471287966, 0.008950754068791866, 0.011617068201303482, -0.03722086176276207, 0.025787711143493652, 0.009445294737815857, -0.021005291491746902, -0.017127837985754013, 0.04740264639258385, 0.013309021480381489, -0.021611971780657768, 0.03415676951408386, -0.03922522813081741, -0.010246822610497475, 0.0005877088406123221, -0.020749999210238457, -0.05344438925385475, -0.03126204013824463, -0.01480343472212553, -0.023855308070778847, 0.010444692336022854, -0.002421006793156266, -0.035293515771627426, 0.02902473695576191, 0.04995984211564064, -0.02031410112977028, -0.025690415874123573, -0.0012268561404198408, -0.018454303964972496, -0.028645412996411324, 0.04529736191034317, -0.04220500960946083, -0.018153496086597443, -0.015697721391916275, -0.022339407354593277, 0.007209464907646179, -0.027962513267993927, 0.036455702036619186, 0.008481748402118683, 0.004984010476619005, -0.017358774319291115, -0.04455069452524185, 0.03641021251678467, -0.0215400792658329, -0.014886773191392422, 0.013458402827382088, 0.025573763996362686, -0.024711206555366516, 0.02714923769235611, 0.0077698021195828915, -0.022239187732338905, -0.011078567244112492, 0.026399249210953712, 0.013679285533726215, -0.0048802695237100124, -0.03313267230987549, -0.014165946282446384, 0.03849026560783386, 0.038557492196559906, 0.03600238636136055, 0.023817500099539757, 0.01748315803706646, -0.00042969940113835037, -0.05700342729687691, 0.03307931497693062, -0.02851823903620243, -0.0017348791006952524, -0.022863546386361122, -0.01202146615833044, -0.028748217970132828, 0.03226388245820999, 0.004207623191177845, -0.008025006391108036, -0.0744667500257492, -0.014955172315239906, -0.035377491265535355, -0.01914018951356411, -0.04669022560119629, 0.02007688209414482, 0.06608374416828156, 0.04917941242456436, -0.04243644326925278, -0.013177349232137203, 0.0003925344499293715, 0.028131332248449326, 0.01143849827349186, 0.025601619854569435, 0.03319958969950676, 0.009798912331461906, -0.00020182973821647465, 0.018156832084059715, 0.007665229495614767, 0.00468567106872797, -0.0025752377696335316, 0.01685454696416855, 0.03917413204908371, 0.01802080310881138, -0.005500006023794413, -0.0008983961888588965, 0.025439191609621048, -0.001790352980606258, -0.0007430802215822041, -0.006072682794183493, -0.01481186505407095, -0.007598736323416233, 0.009317055344581604, -0.02546783909201622, 0.011321832425892353, -0.020831573754549026, 0.010872715152800083, 0.018355529755353928, 0.024372532963752747, -0.005116090644150972, 0.006170165725052357, -0.0347835049033165, 0.01853141561150551, 0.0494280606508255, -0.048528511077165604, -0.012075754813849926, -0.0048902686685323715, 0.025749020278453827, -0.035939771682024, -0.006774904206395149, 0.01522163487970829, 0.0058214981108903885, -0.03006112389266491, 0.004654336720705032, 0.00613937433809042, 0.012859181500971317, 0.004656203091144562, 0.008015175350010395, -0.00448477640748024, 0.08486407995223999, 0.032528456300497055, -0.0448065921664238, -0.005778918508440256, 0.010255234315991402 ]
Hugging Face Reads, Feb. 2021 - Long-range Transformers
VictorSanh
March 09, 2021
long-range-transformers
research, nlp
https://huggingface.co/blog/long-range-transformers
Main findings * The authors proposed the dilated windowed self-attention (Figure c) and showed that it yields better results on language modeling compared to just windowed/sparse self-attention (Figure b). The window sizes are increased through the layers. This pattern further outperforms previous architectures (such as Transformer-XL, or adaptive span attention) on downstream benchmarks. * Global attention allows the information to flow through the whole sequence and applying the global attention to task-motivated tokens (such as the tokens of the question in QA, CLS token for sentence classification) leads to stronger performance on downstream tasks. Using this global pattern, Longformer can be successfully applied to document-level NLP tasks in the transfer learning setting. * Standard pre-trained models can be adapted to long-range inputs by simply replacing the standard self-attention with the long-range self-attention proposed in this paper and then fine-tuning on the downstream task. This avoids costly pre-training specific to long-range inputs.
[ 0.03910357505083084, -0.05006230250000954, 0.0026847529225051403, 0.017346829175949097, -0.019870664924383163, 0.07435543090105057, -0.052392374724149704, 0.042201269418001175, -0.030600300058722496, 0.009736095555126667, -0.09063716232776642, 0.09578799456357956, 0.011393819935619831, 0.04403476417064667, 0.007280654739588499, 0.03810490295290947, 0.10201527923345566, -0.05810568109154701, -0.02082456462085247, -0.00899133924394846, 0.038314089179039, -0.06387043744325638, 0.0899832546710968, 0.03429684787988663, -0.039863646030426025, 0.011685287579894066, -0.035080552101135254, 0.051701001822948456, -0.03112964518368244, -0.019153805449604988, -0.06788161396980286, 0.015359602868556976, 0.020727457478642464, -0.013622897677123547, 0.012307675555348396, -0.051787398755550385, -0.051763880997896194, -0.004704821854829788, -0.03757023438811302, -0.07337287068367004, -0.06599565595388412, -0.004723592661321163, -0.044171661138534546, 0.05223062261939049, 0.024730131030082703, -0.03068637102842331, -0.08220774680376053, 0.030870646238327026, 0.024914514273405075, 0.01648968830704689, -0.09141841530799866, 0.051851242780685425, 0.01749313622713089, 0.008932068012654781, 0.049587808549404144, 0.011019794270396233, -0.03701514005661011, -0.06949402391910553, -0.019615506753325462, -0.06447504460811615, 0.03758605942130089, -0.015434646978974342, 0.008840986527502537, 0.034991830587387085, -0.0030869522597640753, -0.05883568152785301, -0.018854130059480667, -0.0012563822092488408, -0.066165491938591, -0.03432668000459671, -0.04731081798672676, -0.03444921225309372, 0.021596863865852356, 0.02068447880446911, -0.03972296416759491, 0.014580857940018177, -0.017641477286815643, -0.018907537683844566, -0.06835535913705826, -0.03471545875072479, 0.04444572329521179, 0.0566374771296978, 0.049301084131002426, -0.002570471726357937, 0.0021809174213558435, 0.009633616544306278, 0.02015216276049614, -0.1132744550704956, -0.03515704721212387, -0.006676505785435438, -0.032384492456912994, -0.10330934822559357, 0.022099569439888, -0.05648955702781677, 0.07985472679138184, -0.0032513902988284826, 0.029989374801516533, 0.051394108682870865, -0.06592363864183426, -0.02703763358294964, -0.011414824984967709, -0.0724884569644928, 0.01911722682416439, -0.0684080421924591, -0.06394229084253311, 0.0071459198370575905, -0.030094848945736885, -0.06516627967357635, -0.050841961055994034, -0.016248684376478195, 0.03169221058487892, 0.07302994281053543, -0.022952064871788025, 0.02282177098095417, -0.05246656760573387, -0.02078731544315815, -0.010537178255617619, 0.06375453621149063, 0.012366223149001598, -0.013476194813847542, -0.01540222018957138, 0.09880726039409637, 0.06791011989116669, -0.06747812032699585, 0.02362368255853653, -0.0024489157367497683, -0.027059370651841164, -0.012681187130510807, -0.01420761551707983, -0.05046730116009712, 0.096958689391613, -0.013709994032979012, 0.07575834542512894, 0.07137051224708557, -0.02308611199259758, -0.04079586640000343, 0.06676799803972244, -0.014011622406542301, -0.0010744092287495732, -0.013536923564970493, -0.036590296775102615, -0.04082489386200905, -0.010445945896208286, -0.057784304022789, 0.07902131974697113, 0.0010745532345026731, -0.0649329274892807, 0.058549631386995316, 0.04503553360700607, 0.015253349207341671, -0.03856995701789856, -0.009518370032310486, -0.04895753785967827, -0.026752924546599388, 0.04975452646613121, 0.028683751821517944, 0.02072582207620144, -0.03662561997771263, -0.03638479486107826, -0.008658361621201038, -0.03187379240989685, 0.06562354415655136, -0.00911188218742609, 0.06752597540616989, -0.004407164175063372, -0.09075325727462769, 0.00673828786239028, 0.030106136575341225, -0.03707868605852127, 0.017631210386753082, 0.0887560173869133, 0.07289741933345795, 0.06389103829860687, 0.013301552273333073, -0.07169078290462494, -0.02170408144593239, -0.03698890656232834, 0.03734483942389488, 0.0200135949999094, 0.004283452872186899, -0.0004119476943742484, 0.006175240967422724, 0.007181132677942514, 0.010837184265255928, -0.022379154339432716, -0.0586949959397316, 0.0234167892485857, 0.011800400912761688, -0.09950333088636398, -0.034774068742990494, -0.09240073710680008, 0.06478864699602127, 0.016351891681551933, 0.0053844153881073, 0.015800775960087776, -0.0558038130402565, -0.006501405965536833, 0.07831995189189911, 0.08123977482318878, 0.09442753344774246, 0.08666546642780304, 0.007682515773922205, -0.008572442457079887, -0.02884208783507347, 0.02187160588800907, -0.035092443227767944, -0.05148397013545036, 0.023312296718358994, 0.01732524484395981, -0.003755618119612336, 0.03089284338057041, -0.07550789415836334, 0.01374888140708208, 0.014175939373672009, -0.03749074414372444, -0.04207345098257065, 0.028809547424316406, 0.03213103488087654, -0.04081972688436508, 0.05251160264015198, 0.13375462591648102, -0.011223310604691505, 0.0033248476684093475, 0.020799901336431503, 0.0223713256418705, 0.026316234841942787, 0.08571924269199371, 0.001551810884848237, 0.043484751135110855, -0.04268818348646164, 0.002984342398121953, -0.14872202277183533, 0.03885689005255699, -0.04673966020345688, -0.018417220562696457, -0.030694806948304176, -0.005839436315000057, -0.012302807532250881, 0.0051548234187066555, -0.0362870879471302, -0.003068390302360058, -0.008517734706401825, 0.040193937718868256, 0.034002553671598434, 0.007287896703928709, 0.002611065749078989, 0.04910655319690704, 0.03713361173868179, 0.005678639281541109, -0.002755027264356613, -0.025710899382829666, 0.11337897181510925, 0.017016777768731117, -0.05825032293796539, 0.02704082429409027, -0.01228809729218483, 0.000950462359469384, -0.05517495796084404, 0.018007364124059677, -0.0029290723614394665, 0.05780620872974396, 0.026862293481826782, -0.023431334644556046, -0.027302218601107597, -0.00781469140201807, -0.03345433622598648, 0.011161543428897858, -0.008067215792834759, 0.04771231487393379, -0.019666390493512154, -0.03658916801214218, -0.03384164720773697, -0.02073880285024643, -0.004124769940972328, 0.0045701852068305016, 0.01856546476483345, -0.007189930882304907, -0.03662321716547012, -0.031096817925572395, -0.08492045104503632, 0.006875886581838131, -0.06413567811250687, 0.049633149057626724, 0.01850818283855915, 0.026453407481312752, -0.020395081490278244, 0.005930732470005751, -0.033322181552648544, -0.015009509399533272, 0.008780929259955883, 0.015247869305312634, 0.0069798254407942295, -0.0374581478536129, -0.015033314935863018, -0.03826617822051048, 0.030583685263991356, 0.017359793186187744, -0.02845865488052368, -0.0014093902427703142, 0.021168477833271027, -0.033314526081085205, 0.06190374866127968, 0.005799003876745701, 0.025006385520100594, 0.017575040459632874, 0.03168034926056862, -0.019502807408571243, 0.07224942743778229, -0.06527423113584518, -0.04720045626163483, -0.0035102765541523695, -0.0006989354151301086, -0.030143143609166145, -0.04151033237576485, 0.019350841641426086, 0.02312442660331726, 0.0031017870642244816, -0.014813074842095375, -0.03458555415272713, 0.0037393991369754076, 0.007348658051341772, -0.015450351871550083, -0.016130121424794197, 0.02616768516600132, -0.01758754998445511, -0.032175298780202866, 0.0461980365216732, 0.008717503398656845, 0.008839746937155724, -0.0006564065697602928, 0.0015707777347415686, 0.013106470927596092, -0.016244908794760704, 0.0028919761534780264, 0.02344975806772709, -0.024857090786099434, 0.022133197635412216, 0.03775092214345932, -0.021579338237643242, -0.02521468698978424, 0.03670784458518028, 0.03183931112289429, -0.03380662947893143, 0.0198346097022295, 0.009574837982654572, 0.05299204960465431, 0.018108010292053223, 0.04609869420528412, 0.06195778027176857, -0.02123785763978958, 0.04406081885099411, 0.014805321581661701, 0.04208282753825188, 0.021878927946090698, 0.0038644028827548027, -0.0468592531979084, 0.027425488457083702, -0.008592388592660427, -0.04663302004337311, 0.0128552271053195, -0.03639732673764229, 0.015541968867182732, 0.007732264697551727, -0.0284457765519619, 0.02529314160346985, -0.030053695663809776, -0.03464917466044426, 0.0010979932267218828, -0.0342048816382885, 0.028769666329026222, -0.026411350816488266, -0.010309857316315174, -0.014801504090428352, 0.03321181982755661, 0.003808808047324419, -0.0263888631016016, -0.0019496157765388489, 0.022054284811019897, -0.007213856093585491, 0.030500952154397964, -0.0175305362790823, -0.013280592858791351, -0.038165315985679626, -0.0147932767868042, 0.03211154043674469, 0.011147513054311275, 0.048379164189100266, 0.01063631009310484, -0.031030641868710518, -0.009413140825927258, 0.00023886685085017234, -0.0007330552907660604, -0.022572429850697517, 0.0006675892509520054, 0.04293293133378029, 0.0015459537971764803, 0.03834659233689308, 0.005753503181040287, 0.011705819517374039, 0.0028676048386842012, 0.01933530531823635, -0.051373500376939774, -0.014306962490081787, -0.0004843174247071147, 0.001104831462725997, 0.009098326787352562, 0.06364688277244568, -0.06646785885095596, 0.04056188464164734, -0.04418017342686653, 0.006374189630150795, 0.049658820033073425, -0.02997087687253952, 0.05726458504796028, -0.047056958079338074, 0.005312420427799225, 0.0023931418545544147, -0.0022233137860894203, -0.029447853565216064, 0.004048490896821022, 0.006163021549582481, 0.03217976912856102, 0.00937646720558405, -0.03155181184411049, -0.023819630965590477, 0.022524720057845116, -0.035959310829639435, -0.01247628964483738, -0.006160018965601921, 0.025802291929721832, 0.012548103928565979, -0.008131077513098717, 0.05038655549287796, -0.01432835590094328, 0.042125068604946136, -0.024298030883073807, 0.03499619662761688, -0.015929287299513817, -0.02812976948916912, -0.033189307898283005, 0.021377498283982277, 0.0008967175963334739, 0.023836690932512283, -0.006009518168866634, -0.05721009522676468, 0.03146081045269966, -0.008823079988360405, 0.009779522195458412, -0.06976532936096191, -0.010169719345867634, 0.02823183685541153, -0.021924270316958427, 0.006535003427416086, -0.01770053431391716, -0.014774543233215809, 0.011053696274757385, -0.021000046283006668, 0.03134053200483322, 0.04448379576206207, -0.02809068001806736, -0.0417138896882534, 0.03636961057782173, 0.036593321710824966, -0.008950160816311836, 0.017152199521660805, 0.034166108816862106, 0.010930734686553478, 0.01560875866562128, 0.036777473986148834, -0.021289493888616562, -0.06193527206778526, 0.01213471032679081, 0.03400110825896263, -0.012926911003887653, -0.04411806911230087, 0.006538145709782839, 0.02321486733853817, 0.0031997147016227245, -0.04226834326982498, 0.0019752238877117634, -0.02802245132625103, -0.0013902165228500962, 0.013410910032689571, 0.008909136056900024, -0.03709147870540619, 0.0017821775982156396, 0.0009234464378096163, 0.04173416271805763, 0.007646647281944752, 0.022997422143816948, 0.04200322553515434, 0.009186780080199242, 0.019225144758820534, 0.03340300917625427, 0.0686304122209549, 0.004316168837249279, -0.003677159082144499, 0.07903962582349777, 0.009304222650825977, 0.035868093371391296, -0.004907754249870777, -0.01170673593878746, 0.0202413871884346, -0.015799544751644135, 0.009615798480808735, 0.01744208298623562, -0.03432925045490265, 0.042815130203962326, 0.010546067729592323, 0.040215637534856796, -0.0031248044688254595, -0.01596156135201454, 0.024772463366389275, 0.05664868652820587, -0.03767368197441101, -0.015484276227653027, -0.008184955455362797, 0.004168266896158457, -0.013369781896471977, 0.011747992597520351, -0.004425523336976767, -0.024035252630710602, 0.027100631967186928, -0.048708390444517136, 0.012889756821095943, 0.043570369482040405, 0.025006256997585297, 0.0324137806892395, 0.007867064327001572, -0.023515375331044197, -0.006811128463596106, 0.001946079544723034, -0.016069184988737106, -0.037265099585056305, -0.02565751224756241, -0.00978122279047966, 0.008652230724692345, -0.008141137659549713, -0.027813296765089035, -0.0417046956717968, 0.040093082934617996, -0.0010426148073747754, -0.004531801678240299, -0.05574547126889229, 0.01269591599702835, 0.04395902529358864, 0.02872074395418167, -0.0010572669561952353, 0.03953520581126213, 0.018852703273296356, -0.022340666502714157, 0.02271697111427784, -0.0717257559299469, 0.05380973592400551, 0.06398309767246246, -0.015858696773648262, 0.003532064612954855, -0.01025352906435728, 0.021512962877750397, -0.02391667105257511, -0.006049381103366613, 0.00658967811614275, 0.00016448866517748684, -0.01365201361477375, 0.015538539737462997, -0.008658806793391705, 0.008773531764745712, 0.003992580343037844, -0.011802157387137413, -0.008346774615347385, 0.007107218727469444, 0.03998509794473648, 0.003617426147684455, 0.01279739011079073, 0.05170418694615364, -0.03195713087916374, -0.01887134276330471, 0.0016639992827549577, 0.03594671189785004, -0.024597207084298134, -0.029139798134565353, -0.054004598408937454, 0.005453495308756828, -0.021116238087415695, 0.007440031040459871, 0.00895986519753933, 0.06572318077087402, 0.030019111931324005, -0.030872024595737457, 0.011113829910755157, 0.07236996293067932, 0.02369556948542595, 0.034008558839559555, -0.028347371146082878, 0.00753143522888422, -0.030941300094127655, 0.012634433805942535, 0.006935368292033672, -0.021822020411491394, 0.005614527501165867, -0.014591907151043415, -0.014652501791715622, -0.03734413906931877, 0.0067717889323830605, 0.04239223897457123, -0.007897627539932728, -0.05448610335588455, -0.010737206786870956, 0.03173055499792099, 0.04888483136892319, 0.014359577558934689, 0.008340668864548206, 0.02185811847448349, 0.007105530239641666, 0.025235356763005257, 0.0228621456772089, 0.03367794305086136, 0.0019301651045680046, -0.022582026198506355, 0.01646253652870655, 0.020207995548844337, 0.029064446687698364, -0.014830158092081547, -0.017490170896053314, -0.03500107675790787, -0.052393268793821335, -0.036178261041641235, 0.026136398315429688, 0.022146577015519142, -0.00017210950318258256, 0.01898961141705513, -0.00150238536298275, -0.03065943904221058, 0.022022781893610954, 0.02881299890577793, -0.012173488736152649, 0.014641937799751759, -0.02388753928244114, -0.010425383225083351, 0.029886197298765182, 0.018427370116114616, -0.024296371266245842, -0.021191375330090523, 0.04337667301297188, 0.023043997585773468, 0.06252223253250122, 0.018448159098625183, -0.07704200595617294, 0.009492208249866962, 0.0366559773683548, -0.0059154401533305645, 0.04912804812192917, 0.04656526446342468, 0.013700717128813267, 0.03905217722058296, 0.0634816586971283, -0.02008850686252117, 0.015178649686276913, 0.007361104711890221, -0.010057037696242332, -0.03393535688519478, 0.017329193651676178, -0.02575514279305935, -0.09352563321590424, -0.005410097073763609, -0.0730995237827301, -0.014873776584863663, -0.018001614138484, 0.031438104808330536, 0.055594444274902344, 0.053503185510635376, 0.0008787937113083899, 0.012631560675799847, -0.02872193418443203, -0.004603251814842224, -0.03142242878675461, 0.01504477672278881, 0.020030802115797997, -0.022364776581525803, 0.0012670074356719851, -0.02769821137189865, -0.03502779081463814, 0.007678584195673466, 0.002117403782904148, 0.03131977468729019, 0.020777085795998573, -0.02649574726819992, -0.02710050716996193, -0.004602388944476843, -0.0033490308560431004, 0.04173557832837105, 0.04652492702007294, 0.019540874287486076, 0.04894739016890526, -0.05578096956014633, -0.0267740897834301, -0.00663793133571744, -0.016963256523013115, -0.0167114045470953, -0.011773522943258286, -0.018713003024458885, 0.05879543349146843, 0.039567455649375916, -0.009387465193867683, -0.021061036735773087, 0.06019919365644455, -0.07085886597633362, -0.03238263726234436, 0.016909809783101082, -0.04415528103709221, 0.06445213407278061, -0.034683387726545334, 0.02054763026535511, 0.022829880937933922, -0.024493679404258728, -0.011113558895885944, -0.018815845251083374, 0.006625744979828596, 0.023890938609838486, -0.02725033089518547, 0.004262135364115238, -0.00851993728429079, -0.013553093187510967, -0.02143048867583275, -0.029453428462147713, 0.01675276830792427, 0.019748397171497345, 0.0037485002540051937, 0.014450599439442158, 0.013381872326135635, 0.01540333405137062, 0.025749189779162407, -0.014533862471580505, 0.045222315937280655, -0.010805518366396427, 0.006872834637761116, -0.008151710033416748, -0.04559683799743652, -0.03390330448746681, -0.00971897877752781, 0.06117203086614609, 0.06200745329260826, -0.006072551477700472, 0.006536018569022417, 0.0019731931388378143, -0.01699209026992321, 0.010964794084429741, 0.000996016780845821, 0.00682959146797657, -0.05238240584731102, 0.04189910367131233, 0.010008512996137142, 0.013960259966552258, 0.007189183961600065, 0.018767252564430237, 0.0032501304522156715, 0.017487624660134315, -0.014583854004740715, 0.015519380569458008, 0.03869100287556648, -0.059781551361083984, 0.03980989754199982, -0.025965753942728043, 0.0266402717679739, 0.012922383844852448, 0.028935283422470093, -0.02374531887471676, -0.03652891144156456 ]
Hugging Face Reads, Feb. 2021 - Long-range Transformers
VictorSanh
March 09, 2021
long-range-transformers
research, nlp
https://huggingface.co/blog/long-range-transformers
Follow-up questions * Even though the projections matrices are shared between layers, the approach presented here comes in contrast with the Johnson-Lindenstrauss that states that random orthogonal projections are sufficient (in polynomial time). Would random projections have worked here? This is reminiscent of Reformer which uses random projections in locally sensitive hashing to reduce the memory complexity of the self-attention.
[ 0.06268687546253204, 0.009646529331803322, 0.059609003365039825, 0.009516526013612747, 0.044761478900909424, 0.02187117375433445, -0.011228399351239204, 0.012494117021560669, -0.03502844274044037, -0.09753844887018204, -0.024554535746574402, 0.014420481398701668, 0.015585988759994507, -0.003994861617684364, -0.05409213900566101, 0.007846450433135033, 0.08189018815755844, -0.0005684330826625228, 0.020366182550787926, 0.012780574150383472, 0.044185739010572433, -0.00809712614864111, 0.06920933723449707, -0.05551299825310707, 0.025205204263329506, -0.07719793170690536, -0.00367601471953094, -0.027486400678753853, -0.05401371791958809, 0.012081490829586983, -0.1234641745686531, 0.010728088207542896, 0.07655327767133713, -0.049166254699230194, -0.00043568582623265684, -0.03467034921050072, -0.041310105472803116, 0.01469774916768074, 0.03728223219513893, -0.04393571987748146, 0.046983398497104645, 0.04061919078230858, -0.047738440334796906, 0.007923961617052555, -0.08347894996404648, -0.04812019690871239, -0.13067476451396942, 0.10208377242088318, -0.09938690066337585, -0.02912679873406887, -0.010839665308594704, 0.024030815809965134, -0.01059106457978487, 0.08747774362564087, -0.006807930767536163, 0.023005902767181396, 0.09489188343286514, -0.028658045455813408, 0.05351047217845917, -0.03427092730998993, 0.016140049323439598, -0.018188942223787308, -0.0010131533490493894, 0.015637099742889404, 0.029723001644015312, 0.05024454742670059, 0.05854189768433571, -0.023451710119843483, -0.05774344876408577, 0.01674215868115425, 0.03172653168439865, -0.025605497881770134, -0.011100942268967628, 0.050142522901296616, 0.03748369589447975, -0.009974454529583454, 0.011069887317717075, 0.002956526121124625, 0.02757376618683338, -0.019937140867114067, 0.02144818753004074, 0.0369291789829731, 0.0784892737865448, 0.034688837826251984, -0.009161834605038166, -0.019483596086502075, 0.04778917506337166, -0.03932730108499527, -0.041325319558382034, 0.047977548092603683, -0.04133762791752815, -0.048929620534181595, -0.022965995594859123, -0.0288515817373991, 0.04664044827222824, -0.039140038192272186, -0.012075713835656643, -0.02125014364719391, -0.02058304101228714, -0.02277482859790325, 0.022082854062318802, -0.030191710218787193, 0.04349742829799652, -0.03993908315896988, -0.06649886071681976, 0.02539559081196785, 0.008847731165587902, -0.04482078552246094, -0.059438399970531464, 0.012708120979368687, 0.022260982543230057, 0.14207874238491058, 0.07085863500833511, 0.043834466487169266, 0.009930850937962532, 0.008998052217066288, -0.019515087828040123, 0.028668370097875595, 0.03406819328665733, -0.010519694536924362, -0.03259800374507904, 0.13920697569847107, 0.04874347522854805, 0.030181163921952248, 0.048772744834423065, -0.05432131141424179, -0.008514519780874252, 0.06399206072092056, -0.0753309428691864, -0.01776801608502865, 0.008154362440109253, -0.01087513193488121, 0.003653168212622404, 0.03789758309721947, -0.001867287210188806, -0.06533433496952057, -0.0016579200746491551, 0.031676098704338074, -0.012000661343336105, -0.06986892968416214, -0.060928575694561005, 0.008878982625901699, 0.04655314236879349, 0.028548603877425194, 0.006008849013596773, -0.05898754671216011, -0.024683034047484398, 0.06422857195138931, 0.03607283905148506, 0.06496664136648178, 0.009552638046443462, 0.10257425159215927, -0.05145178735256195, -0.11780625581741333, -0.013935331255197525, 0.08140925318002701, 0.048172369599342346, -0.0410270169377327, -0.07126792520284653, -0.002376098185777664, 0.0032308832742273808, 0.03850499540567398, -0.009681654162704945, 0.032121650874614716, -0.00670724269002676, -0.022075211629271507, 0.0799446851015091, -0.020029444247484207, 0.06214379146695137, 0.04526820406317711, 0.03526381030678749, 0.04769381135702133, 0.024489738047122955, 0.02560519240796566, -0.003252430586144328, 0.04973322153091431, 0.012450089678168297, 0.06764329969882965, 0.04282853752374649, -0.008041666820645332, -0.07641439139842987, -0.0802093967795372, -0.00972268357872963, 0.010306398384273052, 0.004142113495618105, 0.015985209494829178, 0.04321941360831261, -0.01955069601535797, -0.025905746966600418, 0.04782579839229584, -0.12380614131689072, -0.025635257363319397, 0.07429765164852142, -0.03446837142109871, 0.0033626279328018427, -0.0027944319881498814, -0.025410443544387817, 0.0857231542468071, 0.07008258253335953, 0.09257509559392929, 0.026649750769138336, 0.0008822424570098519, 0.057190097868442535, -0.024071184918284416, 0.032317016273736954, 0.01066220086067915, -0.05698511004447937, -0.0006334274658001959, 0.030212154611945152, 0.008562780916690826, -0.03993719071149826, -0.08575190603733063, -0.03542240709066391, 0.0013075403403490782, -0.016211386770009995, -0.001333045307546854, 0.018404938280582428, 0.021286023780703545, 0.0035502698738127947, -0.010279267095029354, 0.13186192512512207, 0.03887655586004257, -0.008792736567556858, 0.0481688529253006, 0.001885912730358541, 0.079572893679142, -0.034508589655160904, -0.05896906182169914, 0.05810277909040451, -0.0642019733786583, 0.04260540008544922, -0.05473795905709267, 0.046517688781023026, 0.07371554523706436, 0.008848491124808788, 0.028229109942913055, -0.007018889766186476, -0.04762681573629379, 0.009301280602812767, -0.08234812319278717, 0.024641068652272224, 0.03645816817879677, 0.020877458155155182, 0.04599083960056305, -0.03246663138270378, -0.0080332662910223, 0.03641321137547493, 0.017124231904745102, -0.05415281280875206, 0.02415611408650875, -0.1480294167995453, 0.03296728804707527, -0.04212114214897156, -0.0656781941652298, 0.07918476313352585, -0.03144944831728935, -0.007932298816740513, -0.03600683435797691, -0.015020105056464672, -0.0014665992930531502, -0.000056431534176226705, -0.0008130501955747604, -0.0076142288744449615, -0.0017475304193794727, -0.025500116869807243, -0.026314634829759598, 0.013573793694376945, 0.014817011542618275, 0.03718103468418121, 0.001474174321629107, 0.027871252968907356, 0.0054499260149896145, 0.024319177493453026, 0.012049912475049496, -0.008904954418540001, -0.019334442913532257, 0.0014048772864043713, -0.04861421510577202, -0.0044226557947695255, -0.042668890208005905, 0.00934959389269352, -0.02008170634508133, 0.0017521254485473037, 0.033036619424819946, 0.024188928306102753, -0.05704580619931221, 0.01791120134294033, 0.021345101296901703, -0.03215974196791649, -0.014396408572793007, -0.02491167187690735, 0.03436538577079773, -0.0050837271846830845, -0.0453387126326561, -0.03274047002196312, 0.029578424990177155, -0.01921028457581997, 0.017266232520341873, -0.04867756739258766, -0.013972312211990356, -0.002235887572169304, -0.003369724377989769, 0.03426603972911835, -0.011786178685724735, -0.008388484828174114, 0.007879244163632393, -0.009592210873961449, 0.07596851885318756, -0.10327330976724625, -0.06067945808172226, 0.015510452911257744, 0.043833911418914795, -0.008588847704231739, -0.029700445011258125, 0.02817176841199398, -0.020939074456691742, -0.01742485538125038, -0.02060895971953869, 0.005699195433408022, -0.006720800884068012, 0.0209210105240345, -0.006540956441313028, 0.00836118869483471, -0.01383204385638237, 0.07022044062614441, -0.022174863144755363, 0.03890978917479515, 0.007488808128982782, 0.036485735327005386, -0.017370684072375298, -0.01005143765360117, -0.02562408149242401, -0.03342414274811745, 0.02438882179558277, 0.005184984765946865, 0.043367110192775726, 0.05300263315439224, -0.02212761715054512, -0.012906069867312908, 0.003093039384111762, 0.021230826154351234, 0.008005248382687569, -0.04793097823858261, -0.0064443498849868774, 0.01732019893825054, 0.0219506174325943, -0.0012357707601040602, 0.004779197741299868, 0.019427435472607613, -0.0076678418554365635, -0.025261351838707924, 0.03567397966980934, 0.02183482237160206, -0.008392187766730785, 0.02215384505689144, 0.004370472393929958, 0.010084069333970547, -0.09994648396968842, -0.016169624403119087, 0.009431274607777596, 0.03831210732460022, 0.01699371077120304, -0.04374050348997116, -0.013103450648486614, -0.015663713216781616, 0.026814984157681465, -0.01626749336719513, -0.0317196398973465, 0.023426972329616547, -0.004608380142599344, 0.035022296011447906, -0.01964646764099598, 0.005404474679380655, 0.036240365356206894, 0.013928891159594059, 0.03158377856016159, 0.01444809790700674, -0.01135033555328846, 0.015173337422311306, 0.030643755570054054, 0.010219440795481205, -0.0031264503486454487, 0.007864207960665226, 0.048386916518211365, 0.0024792233016341925, -0.04519996792078018, 0.06401748210191727, -0.033751316368579865, -0.02943475730717182, 0.0008059359388425946, -0.012146876193583012, 0.0008003602270036936, -0.016602206975221634, 0.027427243068814278, -0.02194821648299694, 0.009807081893086433, 0.0142062958329916, 0.010141879320144653, 0.0115286223590374, -0.012524531222879887, 0.005345563404262066, 0.0056298961862921715, -0.013993794098496437, 0.03190417215228081, 0.049522772431373596, 0.013425224460661411, 0.003183957189321518, -0.02440982684493065, 0.018584968522191048, -0.04061203822493553, -0.026596518233418465, 0.013019119389355183, -0.02771817520260811, 0.043080490082502365, -0.011367501690983772, 0.028964823111891747, -0.027190307155251503, -0.05382205545902252, 0.008233084343373775, -0.006548688281327486, -0.0012180983321741223, 0.02757789008319378, 0.055841922760009766, 0.010271421633660793, -0.030903715640306473, -0.03764868155121803, -0.013426115736365318, -0.016101209446787834, -0.013124923221766949, -0.005201774183660746, 0.02365715801715851, -0.014536134898662567, -0.015385376289486885, -0.010084327310323715, 0.008653191849589348, 0.037149012088775635, -0.02967436984181404, 0.0024406947195529938, -0.011081166565418243, -0.0007587642758153379, -0.0032793290447443724, -0.01100072544068098, 0.0016876523150131106, 0.008293812163174152, -0.049907386302948, 0.022148381918668747, -0.0483233705163002, -0.04825402796268463, -0.024209914728999138, 0.008787740021944046, 0.06162318214774132, -0.007711182348430157, 0.006848026532679796, -0.023022959008812904, -0.018931088969111443, 0.008888673968613148, -0.061909787356853485, 0.03840192034840584, 0.057804953306913376, -0.03383733704686165, -0.003007515799254179, 0.01513384934514761, 0.023574115708470345, -0.006672289222478867, 0.019847314804792404, -0.017440447583794594, 0.05317092314362526, 0.0448613204061985, -0.031178470700979233, 0.011663357727229595, -0.048931729048490524, 0.041712887585163116, -0.01136169396340847, -0.019966062158346176, -0.00966168288141489, -0.020093237981200218, -0.01383299008011818, 0.011445497162640095, 0.013799190521240234, -0.02726121060550213, 0.013694504275918007, -0.0535726398229599, 0.01471170037984848, 0.004790913313627243, 0.007114401552826166, -0.004644146654754877, 0.05340785160660744, -0.04188648238778114, -0.018038641661405563, 0.016357621178030968, 0.04205510392785072, -0.011576267890632153, 0.031275425106287, -0.01656186580657959, 0.03910869359970093, 0.009033650159835815, 0.0074716294184327126, -0.005702277645468712, 0.010944174602627754, -0.018055874854326248, 0.012499061413109303, -0.03956075757741928, 0.040455933660268784, 0.0033157896250486374, -0.012497450225055218, -0.0032567696180194616, -0.009156608954071999, 0.021930530667304993, 0.01438061147928238, 0.024035902693867683, -0.009854261763393879, -0.028720645233988762, 0.026808761060237885, -0.005938113201409578, -0.021326526999473572, -0.015524599701166153, 0.001955687068402767, -0.03076452761888504, 0.011739159002900124, 0.01345738209784031, -0.04416504502296448, -0.029144378378987312, 0.0024182016495615244, -0.04340910166501999, -0.011780084110796452, 0.022716596722602844, 0.03329465910792351, 0.02457394264638424, 0.04882136359810829, -0.00027649119147099555, -0.029497670009732246, 0.03720320016145706, 0.059555694460868835, -0.012935176491737366, -0.07002045214176178, 0.03729716315865517, -0.03470805659890175, 0.021262817084789276, 0.008338545449078083, -0.02838923968374729, 0.0004308513889554888, 0.0032541637774556875, 0.00363220926374197, -0.055433765053749084, 0.0045694164000451565, 0.05120648071169853, 0.024599842727184296, 0.03772968798875809, 0.03609735891222954, -0.049189019948244095, -0.025663044303655624, 0.031822994351387024, -0.023160694167017937, 0.06758257746696472, 0.05980556830763817, -0.021335573866963387, -0.017050085589289665, -0.01898106560111046, 0.0076476032845675945, -0.009216801263391972, 0.004160398151725531, -0.033906735479831696, 0.0433124378323555, 0.012330042198300362, 0.02173830009996891, -0.021733589470386505, 0.04673529043793678, 0.004627041984349489, -0.022469963878393173, -0.05569804832339287, 0.007719350978732109, 0.010748636908829212, -0.02353658713400364, 0.011514123529195786, 0.031365495175123215, 0.005655873101204634, 0.01875491812825203, 0.007412673439830542, 0.00439049955457449, 0.005664118565618992, -0.01082465797662735, 0.013048927299678326, -0.03456197306513786, 0.022504620254039764, 0.022440431639552116, 0.021428337320685387, 0.023610835894942284, 0.018838146701455116, -0.013989849016070366, -0.008042159490287304, 0.025799093768000603, 0.021371416747570038, -0.009997757151722908, -0.014161019586026669, 0.006787983700633049, 0.01601060852408409, 0.037562549114227295, -0.00035431209835223854, 0.02376732975244522, -0.011411277577280998, -0.016614379361271858, 0.0068994867615401745, -0.042830534279346466, 0.0559355691075325, -0.008324493654072285, -0.010182904079556465, 0.03100312128663063, -0.0016154745826497674, 0.018710335716605186, 0.03054714761674404, 0.016100149601697922, 0.037752650678157806, -0.026319218799471855, 0.03375132009387016, 0.055511873215436935, 0.014084083028137684, -0.004314822144806385, -0.015994494780898094, -0.0026389386039227247, 0.008175062015652657, -0.021639274433255196, -0.0014798549236729741, 0.00467871967703104, -0.047726068645715714, 0.03729388490319252, -0.02031971514225006, -0.03390265256166458, 0.02522239089012146, -0.00292949378490448, -0.005795761477202177, -0.017780615016818047, 0.03164380043745041, -0.014965143986046314, -0.003252697642892599, 0.043462060391902924, -0.008810754865407944, -0.04767957329750061, 0.0010070923017337918, -0.006141590885818005, 0.011030061170458794, 0.004367031157016754, -0.020306868478655815, 0.027207469567656517, -0.008951352909207344, 0.03211812302470207, 0.013966328464448452, -0.05039536580443382, -0.002750929445028305, -0.02897793799638748, 0.02140280231833458, -0.01603519171476364, 0.014224101789295673, -0.043923478573560715, -0.021440699696540833, 0.027806691825389862, -0.03335915505886078, -0.07932312041521072, 0.03896203264594078, 0.0039903284050524235, -0.008682286366820335, -0.02386751025915146, -0.012263989076018333, -0.00932798720896244, 0.02850206382572651, 0.028277141973376274, 0.003948110155761242, 0.014322350732982159, -0.009708033874630928, 0.061836790293455124, 0.030315043404698372, -0.019331740215420723, -0.012697727419435978, -0.047210145741701126, -0.02435392513871193, -0.04342785105109215, 0.0037708936724811792, -0.029409730806946754, 0.012515471316874027, -0.009316742420196533, -0.022051993757486343, 0.01642725244164467, -0.023257989436388016, -0.044220879673957825, 0.009017271921038628, 0.02151460386812687, 0.002658805577084422, 0.00398082984611392, -0.02404954843223095, 0.021845413371920586, 0.0028767024632543325, 0.048541709780693054, 0.027623429894447327, 0.002241907874122262, 0.034692686051130295, -0.015998423099517822, -0.005283781792968512, 0.03866254538297653, 0.02950303442776203, -0.01874123327434063, -0.056463565677404404, -0.04118490591645241, 0.060533907264471054, 0.018680810928344727, 0.006675836630165577, -0.05691082030534744, 0.004157208371907473, -0.005342938005924225, 0.02922334522008896, -0.07587641477584839, -0.007472504395991564, 0.03941219300031662, -0.02663944661617279, 0.026133058592677116, 0.007323552388697863, -0.024974334985017776, -0.050192877650260925, -0.005941038951277733, -0.027375390753149986, 0.008701189421117306, -0.008649260737001896, 0.027384907007217407, -0.06265652924776077, 0.0070029376074671745, -0.06676477938890457, -0.046715013682842255, -0.021510694175958633, 0.04357459023594856, -0.00851195678114891, 0.01568126119673252, -0.03360841050744057, 0.03956114500761032, -0.005096638109534979, 0.023026874288916588, 0.002151584019884467, -0.0035040194634348154, 0.022562259808182716, 0.02279072254896164, -0.013962163589894772, -0.02008676342666149, 0.005137698259204626, 0.008524441160261631, 0.029865572229027748, 0.0009751831530593336, -0.024140948429703712, -0.013217536732554436, -0.04713978245854378, 0.004374568350613117, 0.0038220167625695467, -0.029550714418292046, -0.042609646916389465, 0.026253100484609604, -0.02789524756371975, -0.048162102699279785, -0.061769068241119385, -0.006594260688871145, 0.005588060710579157, -0.020157936960458755, -0.004107234068214893, -0.06223207339644432, -0.011201160028576851, 0.002311795251443982, 0.02300979383289814, 0.014418182894587517, 0.07189259678125381, -0.0023797175381332636, 0.03401695191860199, -0.011833603493869305, 0.013631761074066162 ]
Hugging Face Reads, Feb. 2021 - Long-range Transformers
VictorSanh
March 09, 2021
long-range-transformers
research, nlp
https://huggingface.co/blog/long-range-transformers
@Hugging Face 🤗: Long-range modeling The Longformer implementation and the associated open-source checkpoints are available through the Transformers library and the model hub. Performer and Big Bird, which is a long-range model based on sparse attention, are currently in the works as part of our call for models, an effort involving the community in order to promote open-source contributions. We would be pumped to hear from you if you’ve wondered how to contribute to transformers but did not know where to start! For further reading, we recommend checking Patrick Platen’s blog on Reformer, Teven Le Scao’s post on Johnson-Lindenstrauss approximation, Efficient Transfomers: A Survey, and Long Range Arena: A Benchmark for Efficient Transformers. Next month, we'll cover self-training methods and applications. See you in March!
[ 0.019165657460689545, -0.02953481860458851, 0.022670792415738106, -0.07485151290893555, 0.041055891662836075, 0.02080054208636284, -0.010110118426382542, 0.041828703135252, -0.017528919503092766, 0.007273694965988398, -0.055948950350284576, 0.06934455782175064, -0.06062505766749382, -0.03970121592283249, -0.00032550535979680717, 0.02803676389157772, 0.03403058648109436, -0.05926886200904846, -0.0006177576724439859, 0.04348694160580635, 0.018736833706498146, -0.06824186444282532, 0.06667797267436981, 0.013790145516395569, -0.030615709722042084, -0.0340646393597126, 0.06562424451112747, 0.03742104768753052, 0.018800092861056328, 0.03541640192270279, -0.08799514174461365, 0.030684737488627434, 0.026495125144720078, -0.061900462955236435, -0.03629251942038536, 0.027136124670505524, -0.08641048520803452, 0.06280210614204407, 0.04595280811190605, -0.046008698642253876, 0.035940684378147125, 0.037096504122018814, -0.015901951119303703, 0.06142362207174301, 0.024236291646957397, -0.04717890918254852, -0.13632065057754517, 0.04009502753615379, 0.0008803900564089417, -0.04279962554574013, -0.07452847808599472, 0.10925722867250443, -0.014231609180569649, 0.021758275106549263, 0.0613107830286026, -0.028472179546952248, 0.0317520909011364, -0.06058670952916145, 0.015478040091693401, -0.034406956285238266, 0.054380882531404495, -0.034547559916973114, -0.021703587844967842, -0.0333293192088604, 0.03355034068226814, -0.018937429413199425, 0.03427121788263321, -0.01980827935039997, -0.025697914883494377, -0.023844001814723015, 0.0065825688652694225, -0.025774074718356133, 0.04231100529432297, -0.003489650087431073, -0.03928498923778534, -0.040701571851968765, 0.0018684432143345475, 0.05120917782187462, 0.020382452756166458, 0.0051911151967942715, 0.025994544848799706, 0.04817422479391098, 0.051165975630283356, -0.029802434146404266, 0.009721675887703896, 0.034366995096206665, 0.045876968652009964, -0.15053428709506989, -0.07359855622053146, 0.001341822906397283, -0.023169072344899178, -0.10455832630395889, -0.03152550384402275, 0.01025367435067892, 0.05056585371494293, -0.01941808871924877, -0.021425602957606316, -0.0018727919086813927, -0.07388091832399368, -0.05882687866687775, -0.040893685072660446, -0.04856069013476372, 0.016912568360567093, -0.08703900873661041, -0.06269504874944687, 0.0013289477210491896, 0.008970269002020359, -0.07229848206043243, -0.003681336296722293, -0.004578650463372469, 0.004979247227311134, -0.005605603568255901, -0.04816679283976555, 0.08019565045833588, -0.08339749276638031, 0.05511796474456787, 0.028343889862298965, -0.06673416495323181, 0.015199570916593075, 0.03323329612612724, -0.016295526176691055, 0.14583835005760193, 0.03858683258295059, -0.015948453918099403, -0.0021253388840705156, 0.06639961153268814, -0.010542916133999825, -0.014397060498595238, 0.005165033508092165, -0.05642310902476311, 0.04572100564837456, -0.02223118022084236, 0.028562650084495544, -0.025206686928868294, 0.009523645043373108, -0.06346715241670609, 0.05701085180044174, -0.029147913679480553, 0.031211160123348236, 0.03614259138703346, -0.03351510316133499, 0.0447942279279232, 0.0577218160033226, -0.07514791190624237, 0.06247357279062271, -0.04155360162258148, -0.09431860595941544, 0.07304161041975021, 0.051317594945430756, 0.001785306609235704, -0.04931537061929703, 0.07491864264011383, -0.047973621636629105, -0.03246287256479263, -0.048855651170015335, 0.0007478031329810619, -0.01724998466670513, 0.03014877624809742, 0.0008774265297688544, -0.020404908806085587, -0.03422039747238159, -0.00258718547411263, -0.05282748490571976, 0.007647937163710594, 0.037602320313453674, -0.076774001121521, 0.012673640623688698, 0.008153004571795464, -0.013564660213887691, 0.01630561053752899, 0.04461740329861641, 0.028860336169600487, 0.08041933923959732, -0.04291221871972084, 0.005136966239660978, 0.04931560531258583, 0.07770107686519623, 0.04294021055102348, 0.013001392595469952, 0.05332852527499199, -0.038379982113838196, -0.018946528434753418, 0.033590324223041534, 0.015532569959759712, 0.06337305903434753, -0.01926424354314804, 0.05462776497006416, 0.04039548337459564, -0.035769347101449966, 0.007223394233733416, -0.02999171055853367, 0.03470509126782417, 0.06448167562484741, 0.0002531963982619345, 0.016377778723835945, -0.0009082469623535872, -0.03385451063513756, 0.01137611549347639, 0.08346496522426605, 0.05658235028386116, 0.03471359610557556, -0.003183867083862424, 0.05116565525531769, 0.0005859271041117609, -0.05824323371052742, 0.02185295894742012, -0.003245685249567032, -0.01363714225590229, 0.04413045942783356, -0.011370166204869747, 0.0147025715559721, -0.10966881364583969, 0.011425555683672428, -0.04404382407665253, -0.03986813500523567, -0.06350915133953094, 0.02701224386692047, -0.018163299188017845, -0.041657861322164536, 0.039152298122644424, 0.16864773631095886, -0.03374606743454933, -0.06203486770391464, -0.09095432609319687, -0.0022351164370775223, 0.059074822813272476, 0.08212966471910477, 0.01069669984281063, 0.02958688512444496, -0.03442465513944626, 0.0030175393912941217, -0.0411921963095665, -0.044096145778894424, 0.013507413677871227, 0.027941951528191566, -0.03242017701268196, 0.041666772216558456, -0.030856726691126823, 0.029181260615587234, 0.00743747316300869, -0.04250653088092804, 0.019891241565346718, 0.028293997049331665, 0.043715205043554306, 0.005055570974946022, 0.013256018981337547, 0.016890930011868477, 0.06321610510349274, -0.012174803763628006, 0.03700847923755646, -0.07122953236103058, 0.09524184465408325, -0.018436472862958908, -0.062058210372924805, 0.03696433827280998, 0.016241734847426414, 0.011181932874023914, -0.0036661801859736443, 0.006161285564303398, 0.023947183042764664, 0.011160469613969326, 0.007044257130473852, -0.04868856072425842, -0.033970847725868225, -0.030918516218662262, -0.04705161228775978, 0.0045226942747831345, -0.00027748182765208185, 0.05406668782234192, 0.009088246151804924, 0.02338731847703457, -0.03753087669610977, -0.038267236202955246, -0.005035220645368099, -0.007157439831644297, 0.020072758197784424, 0.01718258671462536, 0.010047097690403461, -0.012359902262687683, -0.03935930132865906, 0.0001281973673030734, -0.009503444656729698, 0.024800708517432213, 0.02402888983488083, 0.05232808366417885, 0.03026643767952919, 0.014684533700346947, -0.02878384105861187, 0.00821390375494957, 0.03140723332762718, 0.02874990552663803, 0.0368700735270977, -0.02515675313770771, -0.004428525920957327, -0.05084460973739624, 0.03908078745007515, 0.022969892248511314, -0.000668709515593946, -0.02322658896446228, -0.00023820005299057811, -0.014689200557768345, 0.009397679939866066, 0.040482793003320694, -0.015523145906627178, 0.02307145856320858, 0.006363936234265566, -0.021771302446722984, 0.04428640380501747, -0.08810985088348389, -0.0104157580062747, -0.04990650713443756, -0.011877096258103848, -0.03751524165272713, -0.05530434101819992, 0.026755191385746002, -0.00861449260264635, 0.012475145049393177, 0.016946863383054733, 0.015694482252001762, -0.007480983156710863, -0.010015515610575676, 0.011971883475780487, -0.029492897912859917, -0.009749915450811386, -0.01827218569815159, -0.02216755598783493, 0.03278212994337082, 0.025653397664427757, -0.005588318686932325, 0.04040275514125824, 0.017835155129432678, -0.013130187056958675, 0.01148196216672659, -0.0014856792986392975, 0.03403713181614876, -0.009628357365727425, 0.07040094584226608, 0.017108861356973648, -0.016283433884382248, 0.01139440294355154, -0.012332301586866379, 0.052769891917705536, -0.009406558237969875, 0.02254428155720234, -0.0033868520986288786, 0.026926381513476372, 0.057018715888261795, 0.024364346638321877, 0.005106176249682903, -0.029570817947387695, 0.004237588029354811, 0.017543110996484756, 0.003598380833864212, 0.008588846772909164, 0.003698133397847414, 0.030917661264538765, 0.03653524070978165, -0.016969848424196243, 0.01782946102321148, 0.002899778541177511, 0.02047649212181568, 0.014382323250174522, -0.02211916632950306, -0.038477879017591476, 0.013346130028367043, -0.0169843677431345, 0.005175138358026743, -0.017435412853956223, -0.04311523213982582, 0.01595205068588257, -0.03943467512726784, 0.01946922205388546, 0.006511799059808254, 0.04127633944153786, 0.00897682923823595, -0.03408331423997879, -0.00662569934502244, -0.008167282678186893, 0.0022641641553491354, 0.01963544636964798, -0.005276789423078299, 0.001964486436918378, -0.0328533910214901, 0.035103749483823776, 0.018036751076579094, -0.029179878532886505, 0.04254626855254173, 0.06701338291168213, -0.041773829609155655, -0.07620637118816376, -0.024452252313494682, 0.0015839478000998497, -0.002291106851771474, 0.007146679330617189, 0.01860908791422844, 0.015664847567677498, 0.01995527371764183, 0.02610677480697632, 0.015758084133267403, -0.007414891384541988, -0.00151454983279109, -0.034597184509038925, 0.04495173320174217, -0.01662360318005085, -0.00761065911501646, 0.0016444415086880326, -0.0148270633071661, -0.017224373295903206, -0.011917226016521454, -0.03738010674715042, -0.009219232946634293, 0.0008730252739042044, 0.002592756412923336, 0.03679366409778595, -0.03245432302355766, -0.024572640657424927, 0.012736390344798565, 0.0023277427535504103, -0.007958976551890373, -0.04231804236769676, -0.024770935997366905, -0.000970724388025701, 0.003346203826367855, 0.0008309463737532496, -0.06654919683933258, -0.006239193491637707, -0.007305908016860485, 0.035043731331825256, -0.03335750848054886, -0.0006909574149176478, 0.017476338893175125, -0.015087543055415154, 0.04130444675683975, -0.0002969952183775604, -0.001197543810121715, 0.007553179282695055, -0.01761678047478199, 0.003645148826763034, -0.044026222079992294, -0.006855865940451622, 0.03350093960762024, 0.007961531169712543, 0.010773470625281334, 0.014875748194754124, -0.029197895899415016, 0.03034999780356884, 0.006670287810266018, -0.011462668888270855, -0.026165135204792023, -0.05419250950217247, 0.04142431542277336, -0.030763978138566017, 0.017611943185329437, -0.035840898752212524, -0.009295101277530193, -0.024104341864585876, -0.06463661789894104, 0.01612262986600399, 0.053530383855104446, -0.009800092317163944, -0.03846081718802452, -0.002251343335956335, 0.05027718096971512, -0.0053277090191841125, -0.009809114970266819, 0.009205424226820469, 0.033381979912519455, 0.04426977410912514, 0.006426469888538122, 0.03197035193443298, -0.041662637144327164, 0.015566037967801094, 0.01757967099547386, 0.0017158662667497993, -0.002807629993185401, -0.05607139319181442, 0.005504160653799772, -0.004692446440458298, -0.06654844433069229, -0.015480199828743935, 0.009970557875931263, -0.0074447947554290295, 0.014614583924412727, 0.04857686534523964, 0.04423496872186661, 0.01173673290759325, -0.023106064647436142, 0.046390049159526825, -0.030427109450101852, 0.0023334918078035116, 0.06150359660387039, 0.0048157814890146255, 0.03258049115538597, 0.013057347387075424, 0.08038415014743805, 0.050861191004514694, -0.015180853195488453, 0.004913159180432558, 0.008609038777649403, -0.020773444324731827, -0.023576581850647926, 0.016188930720090866, -0.016531573608517647, -0.023647965863347054, -0.01496167667210102, -0.04423132911324501, -0.05086826905608177, 0.02726060152053833, 0.05096840113401413, 0.04784056916832924, -0.039941027760505676, -0.00005223765765549615, 0.05919456481933594, 0.0018256604671478271, -0.021779008209705353, 0.013374251313507557, 0.05050278082489967, -0.02263106219470501, 0.009767578914761543, -0.004534974228590727, 0.010388368740677834, -0.0047105057165026665, 0.03465753048658371, -0.008891506120562553, -0.0032960553653538227, 0.016334136947989464, 0.016239803284406662, 0.02175103686749935, -0.014549599960446358, 0.015900280326604843, -0.04676872119307518, -0.020999517291784286, 0.016286874189972878, -0.04969731345772743, -0.000394581031287089, 0.010584873147308826, -0.007615998387336731, -0.002518639201298356, -0.01006545964628458, 0.034285757690668106, 0.022843316197395325, 0.013007682748138905, -0.011005518957972527, -0.04033027961850166, -0.052161190658807755, 0.013267016038298607, 0.032188430428504944, 0.017966723069548607, -0.0017379700439050794, -0.014740405604243279, -0.020377926528453827, 0.017860982567071915, -0.05438326671719551, 0.049698356539011, 0.06703735888004303, -0.01182263158261776, -0.03395812585949898, -0.06268217414617538, 0.0027750947047024965, 0.0024831858463585377, 0.00834453385323286, 0.022683415561914444, 0.030508531257510185, -0.000832928461022675, -0.0289746280759573, 0.011304717510938644, 0.005133769940584898, -0.007228900212794542, -0.016643276438117027, -0.025707794353365898, 0.0002548696065787226, 0.05139223858714104, -0.0034269902389496565, 0.013769750483334064, -0.007225880865007639, -0.015561912208795547, 0.026217279955744743, 0.0021387895103543997, -0.017964249476790428, -0.0026560453698039055, 0.016326725482940674, -0.01214356254786253, -0.023642679676413536, -0.036373332142829895, 0.08579482138156891, 0.01577800326049328, 0.032425154000520706, 0.028885481879115105, 0.0330074168741703, 0.04590783640742302, 0.019280172884464264, 0.011770387180149555, 0.009460840374231339, -0.014066750183701515, 0.034918513149023056, 0.006492787506431341, 0.020633254200220108, 0.06995346397161484, -0.012336277402937412, -0.015710104256868362, 0.011092226020991802, -0.01446592342108488, -0.02870122715830803, 0.015385119244456291, 0.0029235631227493286, -0.016473278403282166, -0.005521116778254509, -0.06131194159388542, 0.012474505230784416, -0.003763138083741069, 0.017198681831359863, -0.00774905551224947, 0.03367670625448227, 0.05298848822712898, 0.008096126839518547, 0.027471164241433144, -0.006445856299251318, -0.008221057243645191, -0.021801717579364777, 0.03600810468196869, 0.011423963122069836, 0.042736951261758804, -0.020249156281352043, -0.01971813477575779, -0.019674457609653473, 0.0035542785190045834, -0.0033540332224220037, 0.019154170528054237, 0.0041503580287098885, -0.021369807422161102, 0.038064874708652496, 0.011331465095281601, -0.01462949812412262, 0.0229219701141119, 0.003217916237190366, 0.00404576538130641, -0.00268317642621696, -0.01044387649744749, 0.013757768087089062, 0.0018185439985245466, 0.0020460167434066534, -0.008422027342021465, 0.029736625030636787, 0.004945659544318914, 0.03915669023990631, 0.08035308122634888, -0.030311286449432373, -0.02414841204881668, -0.02537098340690136, 0.033268533647060394, 0.04729781299829483, 0.035411786288022995, 0.019451292231678963, -0.017735140398144722, 0.0176658034324646, 0.043169017881155014, -0.024191852658987045, 0.029225746169686317, 0.02163730561733246, -0.0005013644695281982, -0.07243417948484421, -0.011570111848413944, -0.02100955694913864, -0.0593077726662159, -0.004908667411655188, -0.004890657961368561, 0.02789701335132122, -0.00047279722639359534, 0.04054513946175575, 0.03123127855360508, 0.05763176083564758, -0.040428582578897476, -0.04232269525527954, -0.04726332426071167, -0.02013498917222023, 0.002892139833420515, 0.03538023680448532, 0.0048912037163972855, -0.037217412143945694, 0.0027967446949332952, -0.026904573664069176, 0.05167897045612335, -0.014137295074760914, 0.003924955613911152, 0.04863295331597328, -0.016707831993699074, -0.04477032646536827, 0.02105138637125492, 0.000964405364356935, 0.024936551228165627, 0.02221759408712387, 0.03348734229803085, 0.0296393521130085, 0.025958862155675888, -0.03973693400621414, -0.03437623009085655, 0.010836725123226643, -0.015462596900761127, -0.05592138320207596, -0.03351151943206787, -0.04476868733763695, 0.031018909066915512, 0.03607512637972832, -0.02377871796488762, -0.013216743245720863, 0.042220473289489746, -0.04707831144332886, -0.007702686823904514, 0.006900399457663298, -0.025331387296319008, 0.04125702753663063, 0.007583885919302702, 0.0247073695063591, -0.024170733988285065, -0.024822605773806572, -0.022151648998260498, -0.0212747473269701, 0.011776892468333244, 0.08394908905029297, 0.007029832806438208, 0.001988441916182637, -0.05242239311337471, -0.05146755278110504, 0.009375237859785557, -0.11779312789440155, -0.013120854273438454, 0.000242993890424259, -0.026476530358195305, -0.04876328259706497, -0.01252297218888998, 0.014098791405558586, 0.004599229898303747, 0.04310533404350281, -0.028384923934936523, -0.024206150323152542, -0.005630911327898502, 0.013450096361339092, -0.01014721393585205, -0.04408106207847595, -0.015928732231259346, 0.011280424892902374, 0.059540532529354095, -0.0041460152715444565, -0.02595742791891098, 0.051830727607011795, 0.0031350674107670784, -0.01892944797873497, 0.017130818217992783, -0.024264704436063766, -0.02565891295671463, 0.05347782373428345, 0.018310468643903732, -0.022631671279668808, -0.05661553144454956, 0.024621492251753807, -0.008228548802435398, -0.026300393044948578, -0.00528276851400733, 0.0036085965111851692, 0.02219400182366371, -0.022902002558112144, 0.015450620092451572, -0.027012594044208527, 0.0245193038135767, 0.0034783941227942705, -0.024915844202041626, -0.023914720863103867, -0.059486761689186096 ]
Hugging Face Reads, Feb. 2021 - Long-range Transformers
VictorSanh
March 09, 2021
long-range-transformers
research, nlp
https://huggingface.co/blog/long-range-transformers
Introduction After the rise of large transformer models in 2018 and 2019, two trends have quickly emerged to bring their compute requirements down. First, conditional computation, quantization, distillation, and pruning have unlocked inference of large models in compute-constrained environments; we’ve already touched upon this in part in our last reading group post. The research community then moved to reduce the cost of pre-training. In particular, one issue has been at the center of the efforts: the quadratic cost in memory and time of transformer models with regard to the sequence length. In order to allow efficient training of very large models, 2020 saw an onslaught of papers to address that bottleneck and scale transformers beyond the usual 512- or 1024- sequence lengths that were the default in NLP at the start of the year. This topic has been a key part of our research discussions from the start, and our own Patrick Von Platen has already dedicated a 4-part series to Reformer. In this reading group, rather than trying to cover every approach (there are so many!), we’ll focus on four main ideas: * Custom attention patterns (with Longformer) * Recurrence (with Compressive Transformer) * Low-rank approximations (with Linformer) * Kernel approximations (with Performer) For exhaustive views of the subject, check out Efficient Transfomers: A Survey and Long Range Arena.
[ 0.035946883261203766, -0.06673212349414825, -0.001346121309325099, -0.00794366467744112, -0.022974930703639984, 0.012278237380087376, 0.051401786506175995, 0.02107265032827854, -0.012260213494300842, 0.013417750597000122, -0.04237716272473335, 0.06421088427305222, -0.033640164881944656, 0.04524333029985428, 0.024785231798887253, 0.018781712278723717, 0.03915328532457352, -0.03974075987935066, 0.006246696691960096, -0.02172147110104561, 0.003398734610527754, -0.07610711455345154, 0.07936245948076248, 0.020807377994060516, 0.005635729990899563, -0.04011550918221474, 0.014262723736464977, -0.01277027279138565, -0.044089481234550476, 0.017150379717350006, -0.15703241527080536, 0.06117119640111923, -0.02000952512025833, -0.046052705496549606, -0.06864475458860397, -0.020822880789637566, -0.07693721354007721, 0.016974279657006264, 0.05742163211107254, 0.01273465808480978, 0.00633552111685276, -0.006783635355532169, -0.061183296144008636, 0.01970924250781536, 0.014655538834631443, -0.01971643790602684, -0.1011626124382019, 0.02564377896487713, -0.06101671978831291, -0.03507092967629433, -0.1068078950047493, 0.0759708508849144, -0.06573020666837692, 0.022578636184334755, 0.04525454342365265, -0.023633824661374092, 0.06021536514163017, -0.062427423894405365, -0.007565871812403202, -0.02672375924885273, -0.0015154898865148425, -0.03876017779111862, 0.004641158040612936, 0.006853366270661354, 0.03180550038814545, -0.03056250512599945, -0.01585986651480198, 0.016325050964951515, -0.09256590157747269, -0.011174654588103294, 0.011912002228200436, 0.0050994837656617165, -0.0026809023693203926, 0.034485869109630585, -0.06408647447824478, -0.0053461878560483456, 0.024436762556433678, 0.042375508695840836, 0.054284222424030304, 0.0064751161262393, 0.0050768316723406315, 0.011094452813267708, 0.05664448440074921, 0.02976052835583687, 0.03926406800746918, 0.019680239260196686, 0.07143831998109818, -0.07882121205329895, -0.05229109153151512, 0.063934326171875, 0.01395479217171669, -0.10948816686868668, -0.012230063788592815, 0.0013132282765582204, 0.011098836548626423, -0.010260474868118763, 0.024418171495199203, 0.013126113452017307, -0.06017467379570007, -0.07120590656995773, 0.042642395943403244, 0.010339786298573017, 0.023267852142453194, -0.06789474934339523, -0.05493885278701782, 0.019213788211345673, -0.052983056753873825, -0.0884024053812027, -0.0053351507522165775, -0.013349071145057678, -0.04039430618286133, 0.05183987691998482, 0.011327012442052364, 0.05650458112359047, -0.08753009140491486, 0.023147590458393097, 0.008428345434367657, -0.0007032568100839853, -0.03243575990200043, -0.031025564298033714, 0.005225316621363163, 0.09457875043153763, 0.08791560679674149, 0.01475518848747015, -0.035204626619815826, 0.020513592287898064, -0.04423918202519417, -0.013744344934821129, 0.032254863530397415, -0.07093019038438797, 0.010038533248007298, -0.10291620343923569, 0.029553277418017387, -0.037434473633766174, -0.005365103017538786, -0.05378636345267296, 0.026967274025082588, -0.030274750664830208, -0.014027509838342667, 0.013006019406020641, -0.03580860793590546, 0.02317383885383606, 0.06726501882076263, -0.08264949172735214, 0.08346083760261536, -0.0658196359872818, -0.10084913671016693, 0.04856262728571892, 0.030646225437521935, -0.007208347320556641, -0.09139392524957657, 0.042353466153144836, -0.07109289616346359, -0.06619536131620407, 0.026163386180996895, 0.012009898200631142, -0.030917281284928322, -0.0013944761594757438, -0.0792609378695488, -0.043613824993371964, -0.05713723227381706, -0.013494066894054413, 0.00459249084815383, 0.03032516874372959, 0.05615847185254097, -0.08141642808914185, 0.03637745603919029, 0.07264586538076401, -0.029216771945357323, 0.045367609709501266, 0.02413155883550644, 0.02954931929707527, 0.04362757131457329, -0.010027037002146244, -0.05596300959587097, 0.03855786845088005, 0.03616867959499359, 0.04493651166558266, -0.006872791796922684, -0.0250232070684433, -0.05532541498541832, 0.006597626954317093, -0.009801119565963745, 0.027298012748360634, 0.03571830689907074, -0.060125239193439484, 0.044213954359292984, -0.02436162531375885, -0.005681594833731651, 0.02220710925757885, -0.062378883361816406, 0.02307235077023506, 0.07737121731042862, 0.018638864159584045, 0.04651416093111038, 0.016186878085136414, -0.04372423142194748, 0.06178891286253929, 0.033722203224897385, 0.08045777678489685, 0.04178236797451973, 0.08752379566431046, 0.03431489318609238, -0.024781925603747368, -0.027241479605436325, -0.003532679285854101, -0.06720773130655289, -0.06769701093435287, 0.023844150826334953, 0.00124726677313447, 0.04046585410833359, -0.09818616509437561, -0.01984414830803871, -0.0851011723279953, -0.019130278378725052, -0.05147126689553261, 0.004870109725743532, -0.02904236689209938, -0.01432394701987505, -0.026569707319140434, 0.14978235960006714, -0.012860018759965897, -0.07814343273639679, 0.0033502813894301653, -0.03726598620414734, 0.021550262346863747, 0.08475062251091003, -0.03972192108631134, 0.03571626543998718, -0.013642733916640282, 0.02044409140944481, -0.04749109596014023, -0.024111732840538025, 0.008331969380378723, 0.025996128097176552, -0.05672108754515648, -0.07336591184139252, -0.013984695076942444, -0.031425826251506805, -0.003669362748041749, -0.0008734095026738942, 0.010660162195563316, 0.029227780178189278, 0.0526382140815258, 0.0034361297730356455, -0.0046515935100615025, 0.045748520642519, 0.04184635728597641, 0.007247107103466988, -0.05685262382030487, -0.06227369233965874, 0.0890064537525177, -0.06923744082450867, -0.08905348181724548, 0.0041207256726920605, 0.04785181209445, -0.013209769502282143, -0.008784104138612747, -0.036264948546886444, 0.013079995289444923, 0.012771670706570148, -0.0015402553835883737, -0.02733735553920269, -0.03170951083302498, -0.047186609357595444, -0.05824556574225426, -0.01643124595284462, -0.033252790570259094, 0.0379156731069088, -0.017296316102147102, -0.00800459273159504, -0.009074055589735508, 0.0017146723112091422, 0.011604007333517075, 0.015439539216458797, -0.03165046498179436, 0.04460736736655235, -0.014976057223975658, 0.0045327553525567055, -0.029358329251408577, -0.022043565288186073, -0.019141873344779015, 0.05432350933551788, 0.029155954718589783, 0.0019992864690721035, 0.02474348433315754, 0.05044683814048767, -0.019410010427236557, 0.006870226468890905, -0.010094696655869484, 0.008572536520659924, 0.03899701312184334, -0.0012774502392858267, -0.0229691993445158, -0.020737100392580032, 0.02472141943871975, 0.0019984969403594732, -0.03632175549864769, -0.014800682663917542, -0.0017427176935598254, -0.025740189477801323, 0.003795141587033868, -0.01663423329591751, 0.014894234016537666, -0.004815190099179745, -0.0036167341750115156, 0.009181292727589607, 0.08693139255046844, -0.08243177831172943, -0.030728522688150406, -0.041494220495224, 0.014823779463768005, -0.04362805187702179, -0.0038899306673556566, -0.002593954326584935, -0.018469981849193573, -0.044066909700632095, -0.02380034327507019, 0.014269103296101093, 0.03129304200410843, -0.01864858902990818, 0.029197609052062035, -0.027403822168707848, 0.013421274721622467, 0.007559552788734436, 0.000006029765700077405, 0.07626453042030334, 0.03758377209305763, 0.026188291609287262, 0.027256613597273827, 0.012301752343773842, -0.0010681741405278444, -0.02211643010377884, 0.04845445603132248, 0.031288545578718185, 0.05584250018000603, 0.0468929223716259, 0.007594131864607334, -0.04901634156703949, -0.005481326952576637, -0.03827103227376938, 0.05080602318048477, -0.019364837557077408, 0.0001939404319273308, -0.030428729951381683, 0.018874073401093483, 0.038612354546785355, 0.04592757672071457, 0.03427177295088768, -0.01631235145032406, 0.002577702747657895, 0.021953625604510307, 0.009333552792668343, 0.014742407947778702, -0.0013700139243155718, -0.004426182247698307, 0.02176751382648945, -0.023441486060619354, -0.04581267014145851, -0.0034767368342727423, 0.038061656057834625, 0.000523029244504869, 0.022519409656524658, 0.014087891206145287, 0.009012764319777489, -0.03555361554026604, 0.029375554993748665, 0.004777353722602129, -0.023491613566875458, 0.02543278969824314, 0.02888559177517891, 0.00797270331531763, -0.006252148188650608, 0.037397343665361404, 0.029711054638028145, -0.00977246928960085, 0.013570467941462994, 0.029453178867697716, -0.020309358835220337, 0.04796479269862175, 0.005990439094603062, 0.000992856454104185, -0.025083176791667938, 0.04829082638025284, 0.010686919093132019, -0.03662308678030968, 0.09489154070615768, 0.042118992656469345, -0.05257418006658554, -0.038147132843732834, -0.09235858917236328, -0.00418991269543767, 0.008493945002555847, 0.0017544690053910017, 0.0030938079580664635, 0.0009335898794233799, 0.042136482894420624, 0.002504908014088869, 0.0006650934810750186, -0.026268545538187027, -0.004674730822443962, -0.029810799285769463, 0.01658822037279606, -0.008675753138959408, 0.018086809664964676, 0.0012018057750537992, -0.015046261250972748, 0.0010062617948278785, 0.027996068820357323, -0.030575048178434372, 0.01288751233369112, -0.01018549595028162, -0.03966561704874039, 0.02194768562912941, -0.014093409292399883, 0.02022056095302105, -0.017699597403407097, 0.015023569576442242, 0.02318417839705944, -0.006090114358812571, 0.009037712588906288, -0.00408629747107625, 0.030725790187716484, 0.04298273101449013, -0.03643301874399185, 0.05071675404906273, -0.01774546690285206, 0.027278635650873184, -0.010711763985455036, -0.000311874522594735, -0.008615873754024506, -0.0009504838963039219, 0.05817168205976486, -0.02150229923427105, -0.014956174418330193, 0.03916623443365097, -0.021681545302271843, -0.0036415914073586464, 0.00005634089757222682, -0.013947430066764355, 0.00896186102181673, 0.0405927337706089, 0.018275225535035133, 0.03680132329463959, 0.012414983473718166, 0.006321784574538469, -0.05064240097999573, 0.02632031962275505, -0.014474453404545784, -0.006718401797115803, -0.002950612921267748, -0.023363174870610237, -0.002463599434122443, 0.0005640409071929753, -0.031566981226205826, -0.019233403727412224, -0.02963707409799099, 0.057057637721300125, 0.02937164157629013, 0.003590117208659649, -0.012196001596748829, 0.03453347459435463, 0.0615868978202343, -0.015854764729738235, -0.033182356506586075, 0.028458742424845695, 0.02254927158355713, 0.014320463873445988, -0.009525364264845848, 0.0377509705722332, -0.0496438667178154, 0.012607940472662449, 0.013167709112167358, 0.019150014966726303, -0.01828981563448906, -0.045462466776371, 0.002491880441084504, 0.024970643222332, -0.024344148114323616, -0.006993724964559078, 0.016993895173072815, -0.035961925983428955, 0.0026822169311344624, 0.01587521657347679, 0.01726224273443222, 0.01714462786912918, -0.01497156172990799, 0.0031926725059747696, -0.029939759522676468, -0.01800944283604622, 0.008807488717138767, 0.015666743740439415, 0.03918104246258736, 0.025521812960505486, 0.038063276559114456, 0.06896133720874786, -0.028341088443994522, 0.028560858219861984, 0.0480964332818985, 0.012053645215928555, 0.03220267966389656, -0.001808298984542489, -0.024170048534870148, -0.021559275686740875, 0.018206993117928505, 0.028855739161372185, -0.0316736064851284, 0.00148103479295969, 0.06373222172260284, 0.016199350357055664, -0.012992534786462784, 0.014826783910393715, 0.053789909929037094, 0.03135683387517929, 0.0008361327345483005, -0.01213846169412136, 0.020270776003599167, -0.05367136001586914, 0.02554675191640854, 0.024230364710092545, -0.011704077012836933, -0.014187023043632507, 0.014840196818113327, -0.016113411635160446, -0.010550024919211864, 0.025547416880726814, 0.00482166837900877, 0.035716477781534195, -0.02950899861752987, -0.015423400327563286, 0.004113893955945969, 0.01876608468592167, 0.011001692153513432, -0.025390662252902985, -0.01484590768814087, 0.04157127067446709, 0.009977527894079685, 0.011181958019733429, -0.0045075369998812675, -0.006718537770211697, 0.0008448002045042813, 0.028424063697457314, -0.0020371663849800825, -0.025986969470977783, -0.021318595856428146, 0.05832821875810623, 0.0054755862802267075, -0.017180252820253372, 0.011190231889486313, -0.05622848495841026, -0.016916250810027122, 0.033489447087049484, -0.05254683271050453, 0.03695773333311081, 0.03487732261419296, -0.011032133363187313, -0.02059309184551239, -0.030108114704489708, 0.02465531788766384, -0.02165619656443596, 0.025085149332880974, 0.01701677031815052, 0.03661581873893738, 0.00025942802312783897, -0.022411631420254707, 0.0054562827572226524, 0.024638840928673744, 0.030935639515519142, 0.008788789622485638, -0.018191756680607796, 0.009985853917896748, 0.0196148119866848, -0.0017811288125813007, 0.020220957696437836, 0.00027651997515931726, -0.05757712572813034, 0.04619660973548889, 0.04320609197020531, -0.0470396913588047, 0.0013251533964648843, -0.018301354721188545, -0.001302840537391603, -0.0006981605547480285, 0.008452939800918102, 0.04808332398533821, 0.01702107861638069, 0.045687366276979446, 0.04191957786679268, 0.0656590685248375, 0.03901401907205582, 0.06288542598485947, 0.018274731934070587, -0.011167955584824085, 0.0025727131869643927, 0.030490193516016006, -0.009669063612818718, 0.006909230723977089, 0.010087015107274055, -0.017057036980986595, 0.04067356884479523, 0.020211240276694298, 0.0054047503508627415, -0.04330361634492874, 0.016226058825850487, 0.04552014544606209, 0.017614439129829407, 0.01668887957930565, -0.042333103716373444, 0.0801837146282196, 0.03525993227958679, 0.011196311563253403, -0.002588556380942464, -0.002168743871152401, 0.05433440953493118, 0.03826441243290901, -0.0015670896973460913, 0.014904716983437538, -0.007761123590171337, -0.03539031744003296, 0.0335233137011528, 0.0029973143246024847, 0.059338025748729706, 0.0062379734590649605, -0.03500841557979584, -0.03524503856897354, -0.03232235461473465, 0.008649462834000587, 0.021124305203557014, -0.00011639193689916283, -0.03147037327289581, 0.023261569440364838, 0.019213713705539703, -0.028485802933573723, 0.023127345368266106, -0.0075060282833874226, -0.004822588991373777, 0.003681332338601351, -0.006959434598684311, 0.023561671376228333, 0.009192327037453651, -0.009642640128731728, -0.04150916263461113, -0.003105110488831997, -0.011869971640408039, 0.014994092285633087, 0.003048865357413888, -0.0009005958563648164, -0.004208274185657501, 0.004402557387948036, 0.033590659499168396, 0.03684728592634201, 0.05650799721479416, -0.024165187031030655, -0.022123944014310837, 0.045858338475227356, 0.01327160932123661, -0.006379535887390375, 0.05063347890973091, 0.014455040916800499, -0.013371712528169155, -0.07171070575714111, 0.027534613385796547, -0.008289466612040997, -0.04352003335952759, 0.003588480642065406, -0.04484887793660164, 0.00497568491846323, -0.011039861477911472, 0.016904592514038086, 0.019407134503126144, 0.026106983423233032, -0.029356181621551514, -0.015394540503621101, -0.04801506549119949, 0.00753451744094491, 0.024099882692098618, 0.01454609353095293, -0.005666587967425585, 0.007114003412425518, -0.007194866426289082, -0.011945657432079315, -0.015993954613804817, 0.000008492137567372993, -0.007092228624969721, 0.03359992802143097, -0.017251577228307724, -0.04666256904602051, -0.0031878859736025333, 0.007557722739875317, 0.013428602367639542, 0.0027055854443460703, 0.040559977293014526, 0.02930697426199913, 0.019444530829787254, -0.04760368913412094, -0.054648496210575104, -0.009995218366384506, -0.013128160499036312, -0.04473694786429405, -0.03707260638475418, -0.05502144247293472, 0.05613686144351959, -0.007686318829655647, 0.02335933968424797, -0.01777699962258339, 0.018886368721723557, -0.06299082189798355, -0.018768176436424255, 0.03129361942410469, -0.03365646302700043, 0.06023814529180527, 0.01215373445302248, 0.036466047167778015, -0.018788263201713562, -0.038816966116428375, -0.005424081347882748, -0.0084184305742383, 0.019718308001756668, 0.07563597708940506, 0.021507812663912773, 0.012506420724093914, -0.045330166816711426, -0.03409934043884277, -0.03436540812253952, -0.051047708839178085, 0.01592501625418663, 0.0008415830670855939, -0.000997765688225627, -0.042266763746738434, 0.032045260071754456, 0.023100823163986206, 0.015098934061825275, 0.05761938914656639, 0.01681658811867237, -0.03637545183300972, 0.027856459841132164, 0.014407997950911522, -0.002032270422205329, -0.03859153017401695, 0.03603004291653633, 0.036900244653224945, 0.032648779451847076, 0.022304486483335495, 0.03012511134147644, 0.01798528991639614, -0.018764516338706017, 0.006477386225014925, 0.006642315071076155, -0.034605421125888824, -0.00564822880551219, 0.05219658464193344, 0.028189662843942642, 0.0016433881828561425, -0.03265662118792534, 0.03790511563420296, 0.01567554846405983, 0.010794120840728283, -0.0014195385156199336, -0.021146288141608238, 0.020454585552215576, -0.026197053492069244, 0.013757680542767048, -0.03359438106417656, -0.010035507380962372, 0.014117949642241001, 0.027105169370770454, -0.02241101861000061, -0.03045305609703064 ]
Hugging Face Reads, Feb. 2021 - Long-range Transformers
VictorSanh
March 09, 2021
long-range-transformers
research, nlp
https://huggingface.co/blog/long-range-transformers
Reading group discussion The developments in pre-trained transformer-based language models for natural language understanding and generation are impressive. Making these systems efficient for production purposes has become a very active research area. This emphasizes that we still have much to learn and build both on the methodological and practical sides to enable efficient and general deep learning based systems, in particular for applications that require modeling long-range inputs. The four papers above offer different ways to deal with the quadratic memory complexity of the self-attention mechanism, usually by reducing it to linear complexity. Linformer and Longformer both rely on the observation that the self-attention matrix does not contain \(n × n\) worth of information (the attention matrix is low-rank and sparse). Performer gives a principled method to approximate the softmax-attention kernel (and any kernelizable attention mechanisms beyond softmax). Compressive Transformer offers an orthogonal approach to model long range dependencies based on recurrence. These different inductive biases have implications in terms of computational speed and generalization beyond the training setup. In particular, Linformer and Longformer lead to different trade-offs: Longformer explicitly designs the sparse attention patterns of the self-attention (fixed patterns) while Linformer learns the low-rank matrix factorization of the self-attention matrix. In our experiments, Longformer is less efficient than Linformer, and is currently highly dependent on implementation details. On the other hand, Linformer’s decomposition only works for fixed context length (fixed at training) and cannot generalize to longer sequences without specific adaptation. Moreover, it cannot cache previous activations which can be extremely useful in the generative setup. Interestingly, Performer is conceptually different: it learns to approximate the softmax attention kernel without relying on any sparsity or low-rank assumption. The question of how these inductive biases compare to each other for varying quantities of training data remains. All these works highlight the importance of long-range inputs modeling in natural language. In the industry, it is common to encounter use-cases such as document translation, document classification or document summarization which require modeling very long sequences in an efficient and robust way. Recently, zero-shot examples priming (a la GPT3) has also emerged as a promising alternative to standard fine-tuning, and increasing the number of priming examples (and thus the context size) steadily increases the performance and robustness. Finally, it is common in other modalities such as speech or protein modeling to encounter long sequences beyond the standard 512 time steps. Modeling long inputs is not antithetical to modeling short inputs but instead should be thought from the perspective of a continuum from shorter to longer sequences. Shortformer, Longformer and BERT provide evidence that training the model on short sequences and gradually increasing sequence lengths lead to an accelerated training and stronger downstream performance. This observation is coherent with the intuition that the long-range dependencies acquired when little data is available can rely on spurious correlations instead of robust language understanding. This echoes some experiments Teven Le Scao has run on language modeling: LSTMs are stronger learners in the low data regime compared to transformers and give better perplexities on small-scale language modeling benchmarks such as Penn Treebank. From a practical point of view, the question of positional embeddings is also a crucial methodological aspect with computational efficiency trade-offs. Relative positional embeddings (introduced in Transformer-XL and used in Compressive Transformers) are appealing because they can easily be extended to yet-unseen sequence lengths, but at the same time, relative positional embeddings are computationally expensive. On the other side, absolute positional embeddings (used in Longformer and Linformer) are less flexible for sequences longer than the ones seen during training, but are computationally more efficient. Interestingly, Shortformer introduces a simple alternative by adding the positional information to the queries and keys of the self-attention mechanism instead of adding it to the token embeddings. The method is called position-infused attention and is shown to be very efficient while producing strong results.
[ 0.03999016433954239, -0.026536617428064346, 0.04136280715465546, -0.005865433253347874, -0.02406679280102253, 0.046913959085941315, -0.03880781680345535, 0.026676315814256668, -0.020613709464669228, 0.04524940624833107, -0.05103557929396629, 0.11961954087018967, -0.01855757087469101, 0.01990724727511406, -0.0439143106341362, 0.04737717658281326, 0.03822547197341919, -0.06193109229207039, -0.04150388389825821, 0.013109431602060795, 0.017962787300348282, -0.0652831420302391, 0.05372945964336395, 0.03435472398996353, 0.015229453332722187, -0.00026990199694409966, 0.042856376618146896, -0.007499741390347481, -0.04244433715939522, -0.012081664055585861, -0.15691231191158295, 0.01111742202192545, -0.02005147933959961, -0.03399862349033356, -0.01545171532779932, -0.07358724623918533, -0.056539762765169144, 0.02053636685013771, 0.028328170999884605, -0.03667779639363289, 0.010034874081611633, 0.026659945026040077, -0.07709258794784546, 0.040967077016830444, 0.012950717471539974, 0.011793377809226513, -0.14157088100910187, 0.01757301203906536, -0.04432499781250954, -0.04083365947008133, -0.09121233224868774, 0.08625155687332153, -0.015650466084480286, 0.04110124334692955, 0.05539333447813988, 0.037140075117349625, 0.045985303819179535, -0.05900554731488228, -0.02042810618877411, -0.009967545978724957, 0.004216328728944063, 0.008185021579265594, -0.022219602018594742, -0.04788994416594505, 0.03248296678066254, -0.05974023789167404, 0.00324677093885839, -0.02051261067390442, -0.09017164260149002, 0.020269067957997322, -0.025065433233976364, -0.008803267031908035, 0.005912494380027056, 0.003075066488236189, -0.040530361235141754, 0.012137078680098057, 0.020513135939836502, 0.024735964834690094, -0.009774641133844852, 0.017247680574655533, -0.005408310331404209, 0.08029647171497345, 0.07117617130279541, -0.003375531639903784, 0.023173509165644646, 0.022567477077245712, 0.0656375139951706, -0.04751541092991829, -0.05387019366025925, 0.010471619665622711, -0.022885574027895927, -0.13312476873397827, -0.016095226630568504, -0.037636250257492065, 0.06503231078386307, -0.02477611042559147, 0.03015775792300701, 0.04413487762212753, -0.06801244616508484, -0.027274763211607933, -0.004303577821701765, 0.01001805067062378, 0.03467027470469475, -0.07259631901979446, -0.10241237282752991, 0.0008521511917933822, -0.035212673246860504, -0.027959393337368965, 0.010849966667592525, 0.018292594701051712, -0.01860256865620613, 0.07243850082159042, 0.006921165622770786, 0.024004371836781502, -0.09785493463277817, 0.0205477736890316, 0.025832409039139748, -0.022930800914764404, 0.004325877875089645, 0.005243474617600441, -0.02188723348081112, 0.06427031010389328, 0.05313592404127121, 0.025541730225086212, -0.0106054013594985, 0.02749074622988701, -0.005450502969324589, 0.0059100049547851086, -0.0041006566025316715, -0.07920586317777634, 0.09622330963611603, -0.07102563977241516, 0.057595137506723404, 0.021438563242554665, -0.05830807983875275, -0.03993481025099754, 0.04776838794350624, -0.05680597946047783, -0.02466408722102642, 0.006879137828946114, -0.0254755187779665, 0.012992627918720245, 0.03094419091939926, -0.09098785370588303, 0.1012256070971489, -0.027028357610106468, -0.10715347528457642, 0.08083036541938782, 0.054625846445560455, -0.014000538736581802, -0.052530985325574875, -0.014771069400012493, -0.06959137320518494, -0.02834223210811615, 0.01518742460757494, 0.03503263369202614, 0.010285500437021255, -0.02857374958693981, -0.06012829765677452, -0.02136112004518509, -0.051838573068380356, 0.015242657624185085, -0.027399154379963875, 0.0461667999625206, -0.026924991980195045, -0.101756751537323, 0.0055583142675459385, 0.05455681309103966, 0.010652236640453339, 0.058862414211034775, 0.04352188482880592, 0.0714123547077179, 0.07663081586360931, -0.025149310007691383, -0.07530491799116135, -0.019106408581137657, -0.026324685662984848, 0.039398193359375, 0.03058832697570324, -0.029649242758750916, -0.039539583027362823, 0.02691948413848877, 0.017757080495357513, 0.022207334637641907, 0.026827530935406685, -0.012079820036888123, 0.05732360854744911, -0.022594476118683815, -0.014396334066987038, -0.04125060886144638, -0.06598924100399017, 0.052225250750780106, 0.06407975405454636, 0.005693451967090368, 0.01748112216591835, -0.04159282520413399, 0.005266125313937664, 0.09160346537828445, 0.08670490980148315, 0.06079410761594772, 0.05484051629900932, -0.016208788380026817, 0.0064924657344818115, -0.0011206046910956502, -0.011577647179365158, -0.00942946970462799, -0.03752676397562027, 0.022125646471977234, 0.0670272633433342, -0.0011535129742696881, 0.01707572676241398, -0.1099761351943016, -0.005482203792780638, -0.031169524416327477, -0.028242506086826324, -0.05303000286221504, 0.0007874163566157222, 0.03202569857239723, 0.004199279937893152, 0.03198893740773201, 0.13546694815158844, -0.02771574817597866, -0.03365955501794815, 0.006766635458916426, -0.019158754497766495, 0.04757172241806984, 0.04701681807637215, -0.014012412168085575, 0.03053203783929348, -0.035118862986564636, 0.032013170421123505, -0.07449990510940552, 0.03243141993880272, -0.018131636083126068, -0.05089956894516945, -0.018935730680823326, -0.08106554299592972, 0.0106149110943079, -0.03807225823402405, 0.006797941867262125, 0.02207622304558754, 0.009577875956892967, -0.013373518362641335, 0.02670569159090519, -0.046570826321840286, -0.01918179728090763, 0.01089012622833252, 0.04163672775030136, -0.018794488161802292, -0.0649813711643219, -0.06979559361934662, 0.15388938784599304, -0.0165408868342638, -0.02181423269212246, 0.00288745597936213, 0.0031023265328258276, 0.01653178036212921, -0.0019220284884795547, 0.009915084578096867, 0.029276715591549873, 0.0042377919889986515, 0.03732966631650925, -0.01515110768377781, -0.04826474189758301, 0.0009059426374733448, -0.039309918880462646, 0.031802840530872345, 0.01640479452908039, 0.047379594296216965, -0.00429689371958375, -0.009228085167706013, -0.0036315119359642267, 0.0017454643966630101, 0.016372600570321083, -0.0044586691074073315, 0.03809107467532158, 0.002882094820961356, -0.006226398050785065, -0.016065679490566254, -0.05941910669207573, -0.0017870375886559486, -0.02514367550611496, 0.05057681351900101, 0.016023466363549232, 0.013903374783694744, -0.007232097443193197, 0.009719393216073513, -0.018415454775094986, -0.04152179881930351, -0.013871868140995502, -0.0026474222540855408, 0.020174462348222733, -0.04165557771921158, -0.0516854003071785, -0.03688063099980354, 0.04656281694769859, 0.017870252951979637, -0.04870707914233208, -0.004315553233027458, 0.00912704598158598, -0.036883771419525146, 0.010936709120869637, 0.01890735514461994, 0.033042870461940765, 0.008526541292667389, 0.03107854723930359, 0.027869364246726036, 0.058517374098300934, -0.07574138790369034, -0.04757406935095787, -0.00763380341231823, 0.0011117386166006327, -0.003339155111461878, -0.03102586418390274, 0.012782000005245209, 0.019073978066444397, -0.010838133282959461, -0.007808293215930462, -0.02058807574212551, 0.009251024574041367, -0.0007013655849732459, -0.01815977692604065, -0.012409016489982605, 0.026760593056678772, -0.024631299078464508, -0.02095460146665573, 0.06494488567113876, 0.00602396996691823, 0.032409802079200745, 0.015130836516618729, -0.01174625288695097, 0.01688566990196705, -0.0332934632897377, 0.04492194205522537, -0.011735265143215656, -0.003899376606568694, 0.0220436230301857, 0.011572605930268764, -0.010536208748817444, 0.017247973009943962, 0.03542768210172653, 0.06367342174053192, 0.0025717481039464474, -0.026987388730049133, -0.000026125548174604774, 0.05881825461983681, 0.03502544015645981, 0.0349370613694191, 0.05016591027379036, -0.03148222714662552, 0.015876945108175278, -0.00014721137995366007, 0.020171498879790306, -0.004752666223794222, -0.014080275781452656, -0.04255811497569084, -0.005214235745370388, -0.04217659682035446, -0.03909952938556671, -0.025469738990068436, -0.0076133375987410545, 0.02475380338728428, 0.044172514230012894, -0.011641023680567741, 0.053306929767131805, -0.023304712027311325, 0.027897512540221214, 0.0049241590313613415, -0.006804205477237701, 0.04399331286549568, -0.008642158471047878, -0.00736206816509366, -0.009023209102451801, 0.058992769569158554, 0.02078643999993801, -0.0542757585644722, 0.010857958346605301, 0.030996738001704216, -0.030139891430735588, 0.0009832807118073106, 0.014267507940530777, -0.007494400721043348, -0.01995122618973255, 0.0016808182699605823, 0.015100736171007156, -0.005327742081135511, 0.0808623731136322, 0.04040359705686569, -0.03941374644637108, -0.038318976759910583, -0.03916123881936073, 0.004974322393536568, 0.0260353684425354, -0.014922644942998886, 0.04035216197371483, -0.021202418953180313, 0.0652664378285408, -0.004357501864433289, 0.026481585577130318, -0.02917490154504776, 0.018009847030043602, -0.0376703217625618, 0.003372715786099434, -0.03574575111269951, 0.02734316699206829, -0.01918247528374195, 0.04985253885388374, -0.009947963058948517, 0.010084670037031174, -0.06121894344687462, 0.01683729700744152, 0.037085577845573425, -0.046119656413793564, 0.05712614208459854, -0.04657602310180664, 0.04028588905930519, 0.008927611634135246, 0.014038609340786934, 0.018541039898991585, -0.0018831233028322458, 0.01509924791753292, 0.005199243314564228, 0.03599705919623375, 0.01542272325605154, -0.04999770224094391, -0.01731300540268421, -0.025370964780449867, 0.005347144324332476, -0.008220470510423183, 0.005659658461809158, 0.030205082148313522, -0.004255778156220913, 0.0541309155523777, -0.013649621978402138, 0.005641449708491564, 0.022496217861771584, -0.021009163931012154, 0.001079627312719822, -0.036048468202352524, -0.005803581792861223, 0.039720844477415085, 0.008946437388658524, 0.03315988555550575, 0.013205289840698242, -0.010517890565097332, -0.007196225691586733, -0.045253388583660126, 0.019602753221988678, -0.04035872966051102, -0.01494442205876112, 0.021737966686487198, -0.03499705344438553, 0.03982575237751007, -0.025262072682380676, 0.016215363517403603, -0.014453931711614132, -0.03401567414402962, 0.013828713446855545, 0.03578716143965721, -0.008929583244025707, -0.0034750672057271004, 0.03294941782951355, 0.028044844046235085, -0.003354068612679839, 0.016870256513357162, 0.03140801936388016, 0.01809314452111721, -0.0004632635973393917, 0.017915939912199974, 0.015659326687455177, -0.04662226140499115, 0.009203588590025902, 0.028061024844646454, 0.01377385575324297, -0.01564866676926613, 0.005309866275638342, 0.012275584042072296, 0.02015925943851471, -0.005451940931379795, -0.01635633409023285, -0.012178502045571804, -0.007052139844745398, -0.016666768118739128, 0.017646552994847298, 0.003539102151989937, -0.000817695225123316, -0.04555132985115051, 0.027327798306941986, 0.006755142938345671, -0.00875281635671854, 0.023974839597940445, -0.021247101947665215, 0.04254690185189247, 0.01708877645432949, 0.028174791485071182, 0.027040980756282806, -0.026492321863770485, 0.006374919321388006, 0.01548624224960804, -0.004927306901663542, 0.014618517830967903, 0.0315755158662796, -0.007064267992973328, 0.013967545703053474, 0.0670119971036911, -0.007587384432554245, -0.06659343838691711, 0.04655235633254051, 0.05595880746841431, 0.0018505944171920419, -0.061150141060352325, -0.008469783701002598, 0.021045224741101265, 0.027928341180086136, -0.011165895499289036, -0.026112282648682594, 0.009902916848659515, -0.028929131105542183, 0.024112917482852936, 0.016900043934583664, -0.024173179641366005, -0.00945726316422224, 0.01990196481347084, -0.0236755833029747, 0.0008205025224015117, 0.044958438724279404, 0.029888669028878212, 0.042470745742321014, -0.009013842791318893, 0.001033549546264112, -0.021502645686268806, 0.01810918189585209, 0.004236618522554636, -0.043298717588186264, -0.03777464106678963, -0.012048586271703243, 0.01825484074652195, -0.034124720841646194, -0.0027455552481114864, -0.007250053342431784, 0.020051609724760056, 0.015600882470607758, -0.0101738590747118, -0.030191052705049515, -0.02320707030594349, 0.052849043160676956, 0.0002639362355694175, -0.0019524150993674994, 0.021835846826434135, -0.00811117235571146, -0.0045125484466552734, -0.01619080826640129, -0.030677160248160362, 0.05577636882662773, 0.035403888672590256, -0.03939826786518097, -0.019475163891911507, -0.004131673369556665, 0.024640122428536415, -0.01678825542330742, -0.0005589650245383382, 0.0072361622005701065, -0.007229240145534277, -0.00030578949372284114, -0.003052623476833105, 0.01822696253657341, 0.0009090893436223269, 0.010482551530003548, -0.006807061843574047, -0.004662236198782921, -0.038044121116399765, 0.03684377297759056, -0.02445121482014656, 0.00032319786259904504, 0.03678721562027931, -0.009013347327709198, 0.030994389206171036, 0.018253657966852188, -0.0036975396797060966, -0.008726180531084538, -0.017480891197919846, -0.014083382673561573, -0.019232457503676414, -0.013939855620265007, 0.011978856287896633, 0.018866997212171555, 0.04073910415172577, 0.018054785206913948, 0.0075591811910271645, 0.032090924680233, 0.07262589782476425, 0.005346468649804592, 0.03413839638233185, -0.011401761323213577, 0.0035668269265443087, -0.022407962009310722, -0.01135950442403555, 0.00859000626951456, -0.018415071070194244, 0.01761115901172161, 0.006692929193377495, -0.0025191509630531073, -0.05501604452729225, 0.02418631874024868, 0.051503702998161316, 0.0026493750046938658, -0.0003567054809536785, -0.024496836587786674, 0.0378274992108345, 0.04214669391512871, 0.03328070044517517, -0.0162001121789217, 0.02707565389573574, 0.04497406631708145, 0.02574855089187622, 0.025610415264964104, 0.00019356742268428206, 0.011884371750056744, -0.02812013030052185, 0.030356809496879578, 0.01128548476845026, 0.06098121032118797, -0.0007292929803952575, -0.06587530672550201, -0.03183702751994133, -0.009688743390142918, -0.02644650638103485, 0.015181148424744606, 0.00985485315322876, -0.03619402274489403, 0.03094533644616604, -0.009357176721096039, -0.019463084638118744, 0.025277025997638702, 0.022286050021648407, -0.016854053363204002, 0.016793295741081238, -0.03950526565313339, -0.009643363766372204, 0.03834029659628868, -0.012729782611131668, -0.015328174456954002, -0.004225233569741249, -0.003798428922891617, 0.005420463625341654, 0.044402625411748886, 0.009722595103085041, -0.056777555495500565, -0.03320729732513428, 0.006699119228869677, 0.01005889568477869, 0.02786051109433174, 0.011821391992270947, -0.029615385457873344, 0.04413776844739914, 0.014677813276648521, -0.018465252593159676, 0.0025342623703181744, 0.001938380766659975, 0.0013027762761339545, -0.0608987994492054, 0.039392489939928055, -0.00981470663100481, -0.06408432126045227, 0.022973183542490005, -0.047320082783699036, 0.0259284358471632, -0.02040691114962101, -0.004970272071659565, 0.052151910960674286, 0.06060236319899559, -0.005240557715296745, -0.010673780925571918, -0.018127307295799255, 0.024976016953587532, -0.023168185725808144, 0.013851099647581577, 0.020263079553842545, -0.023580914363265038, 0.007994529791176319, -0.047683943063020706, -0.0020665659103542566, -0.009074371308088303, 0.01841728761792183, 0.0618913434445858, 0.008236759342253208, -0.020431583747267723, -0.05687068775296211, 0.025502175092697144, 0.0157302338629961, 0.011118005961179733, 0.0759711042046547, 0.03260335326194763, 0.023492248728871346, -0.059530094265937805, -0.01243331003934145, -0.024235906079411507, -0.006815555039793253, -0.0157714132219553, -0.033624887466430664, -0.05990828573703766, 0.022470833733677864, 0.013218103908002377, -0.002678576624020934, -0.028642823919653893, 0.031636759638786316, -0.08537168800830841, -0.012349682860076427, -0.017603043466806412, -0.03190863877534866, 0.08429765701293945, -0.020120792090892792, -0.012196516618132591, -0.018849235028028488, -0.04487733915448189, -0.03530643507838249, -0.01660831831395626, -0.012208561412990093, 0.07235393673181534, -0.0014489733148366213, 0.04728873074054718, -0.03898308798670769, -0.02682351879775524, -0.007273013237863779, -0.008330706506967545, 0.012876823544502258, 0.01032352913171053, -0.019338611513376236, 0.03637642785906792, 0.026215454563498497, -0.00738539919257164, 0.03846905007958412, 0.028517944738268852, 0.030347079038619995, -0.020463472232222557, 0.026243891566991806, -0.0054815057665109634, -0.01613086648285389, -0.032744135707616806, 0.014521258883178234, 0.04357887804508209, 0.07211346179246902, 0.01726447232067585, 0.04426025599241257, 0.019496167078614235, -0.012419085018336773, -0.012187150306999683, 0.040271956473588943, -0.043982867151498795, -0.009649707935750484, 0.03321939706802368, -0.0030290125869214535, 0.006434975657612085, -0.03421803563833237, 0.0070418305695056915, -0.009924620389938354, 0.01646147482097149, -0.03167055919766426, -0.02926839515566826, -0.01780119352042675, -0.053534381091594696, 0.03140709549188614, -0.005909194238483906, 0.026673367246985435, 0.020390992984175682, 0.01911081187427044, -0.03717669099569321, -0.05356310307979584 ]
Hugging Face Reads, Feb. 2021 - Long-range Transformers
VictorSanh
March 09, 2021
long-range-transformers
research, nlp
https://huggingface.co/blog/long-range-transformers
Summaries
[ 0.0106375552713871, 0.008925279602408409, 0.08120866864919662, -0.011149734258651733, 0.12229831516742706, 0.0485740527510643, 0.015188091434538364, 0.0324539951980114, -0.03069370426237583, -0.08812026679515839, -0.017751995474100113, 0.047522347420454025, 0.010587320663034916, 0.010291574522852898, -0.010670564137399197, 0.08688271045684814, 0.07256012409925461, -0.029344310984015465, 0.01617615669965744, -0.025463366881012917, -0.013508488424122334, -0.003355885623022914, 0.06256896257400513, 0.0442502498626709, 0.04262237623333931, -0.018417464569211006, 0.01588681899011135, -0.009221095591783524, -0.08594409376382828, 0.0669126957654953, -0.05862418934702873, -0.0382888987660408, 0.05182097479701042, 0.029639769345521927, -0.05261595919728279, -0.009551137685775757, -0.09483165293931961, -0.002100653015077114, 0.02404238097369671, -0.043538156896829605, 0.06010082736611366, -0.058337852358818054, -0.015189535915851593, 0.05444240942597389, -0.049954287707805634, 0.009519207291305065, -0.28621265292167664, 0.09127192944288254, -0.0397292897105217, -0.00786331295967102, -0.05784563347697258, 0.03314722329378128, 0.02363145910203457, 0.02616495080292225, 0.027196351438760757, 0.03370507434010506, 0.05899696424603462, -0.021057985723018646, 0.031579647213220596, -0.07219210267066956, 0.06990846991539001, 0.005698447581380606, 0.03684590011835098, 0.003572721965610981, 0.04849550500512123, 0.004490311723202467, 0.014098037965595722, 0.040361326187849045, -0.05528276041150093, 0.027766671031713486, 0.0103530278429389, -0.016091007739305496, -0.0715487003326416, 0.02814035676419735, 0.04563252627849579, -0.06355665624141693, -0.0386183001101017, 0.0008045872091315687, 0.022692542523145676, 0.03648974373936653, -0.011404088698327541, -0.0018671139841899276, 0.0978626236319542, 0.06277630478143692, 0.0064475154504179955, -0.07493770122528076, 0.05721985921263695, 0.01807277649641037, -0.017706599086523056, -0.009051801636815071, -0.03989063948392868, -0.05228770524263382, 0.009137257933616638, 0.06825480610132217, 0.0021326919086277485, -0.04031478613615036, 0.06876348704099655, -0.002155692782253027, 0.021980756893754005, -0.007506998255848885, -0.030052434653043747, 0.0393623448908329, 0.03688688576221466, -0.01932436227798462, -0.047384873032569885, 0.004100708290934563, 0.00416343379765749, -0.0757923498749733, -0.05757461115717888, 0.042155008763074875, -0.019371936097741127, 0.04299424961209297, 0.03015143610537052, -0.043539419770240784, -0.03633866459131241, 0.02593829296529293, -0.007714385632425547, -0.01823919638991356, 0.029274003580212593, 0.06453122943639755, -0.028705548495054245, 0.08324413001537323, 0.06832996755838394, -0.000044989283196628094, 0.024609336629509926, -0.019762039184570312, 0.03984396159648895, 0.017918145284056664, -0.07751621305942535, -0.058325618505477905, 0.002680562436580658, -0.028876811265945435, 0.019411297515034676, 0.025994345545768738, -0.0606975294649601, -0.036827392876148224, -0.032738834619522095, 0.021392162889242172, -0.00641701091080904, 0.014372242614626884, -0.011763405986130238, 0.056737396866083145, -0.01451717596501112, 0.09154875576496124, 0.015700701624155045, -0.038633473217487335, -0.027240579947829247, 0.011968155391514301, -0.03140953183174133, -0.016005929559469223, 0.036746907979249954, 0.035653918981552124, -0.024504592642188072, -0.04617271572351456, 0.01349727250635624, 0.05993960052728653, 0.08263308554887772, 0.032878849655389786, -0.05164510756731033, -0.02640615403652191, 0.04036228731274605, 0.04789634421467781, 0.021634243428707123, -0.015858830884099007, 0.06542742252349854, -0.030588366091251373, 0.020213648676872253, 0.003637108951807022, -0.04916474595665932, -0.07537967711687088, -0.06950241327285767, -0.010683535598218441, 0.06206323951482773, -0.05086824297904968, -0.09332255274057388, 0.053408704698085785, 0.05133168399333954, 0.0480341762304306, 0.00932452641427517, 0.011161577887833118, -0.03378879651427269, 0.04036743566393852, -0.03215356171131134, 0.0017365291714668274, -0.010897347703576088, -0.026461103931069374, 0.048359498381614685, -0.010786705650389194, -0.013558744452893734, 0.04876276105642319, -0.1223384439945221, -0.04398258030414581, 0.07913445681333542, -0.021268974989652634, 0.039054352790117264, -0.12547707557678223, -0.0016494650626555085, 0.09830885380506516, 0.021424908190965652, 0.01779947057366371, 0.06573381274938583, 0.050952013581991196, 0.08916025608778, -0.010688471607863903, -0.0636809766292572, 0.03727465867996216, 0.014081181958317757, 0.0022867624647915363, 0.023487675935029984, -0.015688445419073105, -0.03196975588798523, -0.06854307651519775, 0.03354380279779434, -0.09123536944389343, 0.012453841045498848, -0.03025893308222294, -0.009652954526245594, 0.02233978733420372, 0.09704101085662842, -0.03014780767261982, 0.04472178593277931, -0.013547226786613464, 0.003578592324629426, 0.048297200351953506, -0.037910085171461105, 0.07640360295772552, 0.10125353932380676, 0.007149945013225079, 0.04288548231124878, -0.07378935068845749, 0.0014145427849143744, -0.006420000921934843, 0.01614472270011902, 0.07598795741796494, 0.048578888177871704, 0.05402202159166336, -0.03566351905465126, -0.01258606743067503, 0.05685736984014511, -0.0347713902592659, 0.05229911580681801, 0.005860967095941305, 0.00833094585686922, 0.06394568830728531, -0.03583027422428131, -0.047454528510570526, 0.021385861560702324, 0.011957122012972832, -0.06556504219770432, -0.011059819720685482, -0.045212503522634506, 0.10044334083795547, 0.015739044174551964, -0.014295047149062157, 0.06785564869642258, -0.03676005080342293, 0.0031804642640054226, -0.026317091658711433, 0.00024061102885752916, 0.005298205651342869, 0.021637924015522003, -0.04057323932647705, -0.023829011246562004, -0.08108509331941605, 0.02222476899623871, -0.0104074040427804, 0.012685436755418777, -0.00016821137978695333, -0.038337111473083496, 0.05430060252547264, -0.011666650883853436, -0.01998908817768097, 0.049388282001018524, -0.001069914666004479, -0.009142137132585049, -0.012081102468073368, 0.03089122287929058, -0.007044516503810883, -0.01625346951186657, 0.003453603247180581, -0.015945645049214363, -0.024660132825374603, 0.023919016122817993, 0.016972403973340988, 0.042895860970020294, -0.03246764466166496, 0.023502884432673454, -0.00008126633474603295, -0.014286565594375134, -0.0026669639628380537, -0.008372394368052483, 0.01751059480011463, 0.01197354681789875, -0.044763918966054916, 0.03578895330429077, -0.02414092607796192, -0.02188434638082981, 0.04223771393299103, -0.034275755286216736, -0.004392520058900118, 0.020164012908935547, -0.011909274384379387, -0.029719170182943344, 0.0004946765257045627, -0.04423025622963905, 0.03379128873348236, 0.02335232123732567, 0.04879787191748619, -0.15776191651821136, -0.044973284006118774, 0.04085097834467888, 0.02223576232790947, 0.0075903055258095264, -0.0025995501782745123, 0.04924590513110161, -0.01183837465941906, -0.036560144275426865, -0.021504005417227745, 0.04006629064679146, 0.02048272080719471, 0.01606873981654644, -0.01225854828953743, -0.004267294891178608, -0.0022769561037421227, -0.02866131067276001, -0.000007085080596880289, -0.01116552110761404, 0.007415611296892166, 0.009956961497664452, 0.0392676405608654, -0.029241031035780907, -0.020070364698767662, -0.02795231156051159, 0.0533071905374527, 0.006422753911465406, 0.022699378430843353, 0.0038793340791016817, 0.0009840228594839573, -0.0360422283411026, 0.05896131694316864, -0.013000324368476868, 0.02369868755340576, 0.011922867968678474, -0.015590017661452293, -0.006561264395713806, 0.00092316820519045, -0.01467820629477501, 0.060706909745931625, 0.023998674005270004, 0.0016136978520080447, 0.033894456923007965, 0.04041384533047676, -0.0479617714881897, 0.020326990634202957, -0.0062797036953270435, -0.015312621369957924, 0.04047703742980957, -0.03227974846959114, -0.050853829830884933, 0.027044691145420074, -0.024761997163295746, 0.046243757009506226, -0.027407044544816017, 0.003766921116039157, -0.05366838350892067, -0.0170429814606905, 0.04242786392569542, -0.016714293509721756, -0.008172331377863884, 0.022251244634389877, 0.007726085837930441, -0.02405107021331787, -0.02174852229654789, 0.036524418741464615, -0.04639001190662384, 0.013921142555773258, -0.04513835906982422, 0.02898022159934044, 0.01851069927215576, 0.02702948823571205, 0.002089525107294321, 0.017575372010469437, -0.004857458174228668, 0.03439236804842949, -0.04297657310962677, 0.004525299184024334, 0.06406174600124359, -0.02093050256371498, 0.004249976947903633, -0.023096010088920593, -0.01564360223710537, -0.010919393040239811, -0.006391194649040699, 0.03667763993144035, 0.0051828594878315926, 0.0369744636118412, 0.007483452092856169, 0.014419261366128922, 0.039388079196214676, -0.013154709711670876, 0.005588332656770945, -0.005077507346868515, 0.0026740652974694967, 0.02346087247133255, 0.030818119645118713, -0.01679205894470215, 0.022181980311870575, -0.00022908173559699208, 0.005191580858081579, -0.008053725585341454, -0.020409615710377693, 0.013082482852041721, -0.0018482838058844209, 0.02391989156603813, -0.022213613614439964, 0.00045501140994019806, -0.007951163686811924, 0.0070558227598667145, 0.027575327083468437, -0.03236841410398483, 0.021112700924277306, -0.05947841703891754, 0.0010109650902450085, 0.01728123426437378, -0.019971635192632675, -0.054127998650074005, -0.03012651391327381, 0.015253592282533646, -0.024699384346604347, 0.011306141503155231, -0.0013601211830973625, -0.019594766199588776, -0.0008098739781416953, -0.004523194395005703, -0.007414988242089748, -0.008689062669873238, 0.007915816269814968, -0.0092155197635293, -0.01734638214111328, -0.04612904414534569, 0.034066665917634964, -0.008291471749544144, 0.02505047805607319, 0.015906335785984993, 0.010757749900221825, 0.02864021435379982, -0.006609153468161821, -0.06371964514255524, -0.012974560260772705, -0.004463751334697008, 0.02363491617143154, -0.005904110614210367, 0.03364464268088341, -0.010991129092872143, -0.025098027661442757, -0.012261347845196724, -0.01875167153775692, -0.0007849647081457078, 0.02334514632821083, -0.016525058075785637, -0.010709783062338829, -0.006052996963262558, -0.012804102152585983, 0.0011256098514422774, 0.021026311442255974, -0.01770102046430111, -0.03329113498330116, 0.07736894488334656, -0.030327925458550453, -0.023048823699355125, -0.04687356576323509, 0.030623499304056168, -0.024813121184706688, 0.021213293075561523, -0.002997372066602111, -0.0031452449038624763, -0.010248934850096703, 0.00895440112799406, -0.018516726791858673, 0.0021987417712807655, 0.037654247134923935, -0.012698454782366753, 0.028539488092064857, 0.015576580539345741, 0.007160474546253681, 0.02688141167163849, 0.007824739441275597, 0.032023750245571136, 0.00465672742575407, -0.03383190557360649, 0.00399350468069315, -0.011936703696846962, 0.002436776179820299, -0.007056564092636108, 0.018954111263155937, -0.019998731091618538, -0.03153504431247711, 0.06280343979597092, -0.016705401241779327, -0.03607830032706261, -0.001185740577057004, -0.0037998808547854424, -0.00819458719342947, 0.01027654204517603, 0.008563056588172913, -0.0020251539535820484, 0.02092425897717476, 0.020032119005918503, 0.0248432420194149, 0.02464180998504162, -0.00017199973808601499, -0.03991113603115082, -0.016293562948703766, 0.014843004755675793, 0.008747581392526627, -0.030637994408607483, -0.01065088901668787, -0.013921840116381645, -0.012901771813631058, -0.0022453470155596733, -0.06384416669607162, -0.010065197013318539, 0.0010759957367554307, -0.034841399639844894, -0.049017034471035004, 0.029136046767234802, 0.014976459555327892, 0.026774104684591293, 0.02070816606283188, 0.010380195453763008, 0.004217846319079399, 0.060694098472595215, 0.05356023460626602, -0.018063640221953392, -0.028404640033841133, 0.01051423605531454, -0.004600038751959801, 0.04608326405286789, 0.02157636173069477, 0.00212908536195755, -0.028470851480960846, -0.005484519526362419, 0.038054514676332474, 0.04493890330195427, -0.06092141568660736, 0.006081094965338707, -0.004119155928492546, 0.018024805933237076, -0.0008580626454204321, -0.02333565428853035, 0.00391756696626544, 0.004012232646346092, -0.0009662058437243104, 0.018112197518348694, 0.06550994515419006, -0.040109217166900635, 0.029716964811086655, 0.006285897921770811, 0.003554055467247963, -0.005316698458045721, 0.02358086220920086, -0.015914687886834145, 0.005225226283073425, 0.006689406931400299, -0.01013221126049757, 0.0007388051017187536, 0.018277039751410484, 0.014893471263349056, 0.008689639158546925, -0.006517961621284485, 0.01783129759132862, -0.022117281332612038, -0.03671650588512421, 0.014385753311216831, -0.013974706642329693, -0.01187143474817276, 0.048565078526735306, 0.018076453357934952, -0.00959542952477932, -0.007771589327603579, 0.0313061960041523, -0.00943842064589262, 0.010357900522649288, 0.0016276781680062413, 0.01213851198554039, 0.019833995029330254, -0.00016151025192812085, -0.004305536393076181, 0.036656640470027924, 0.015823980793356895, 0.018630629405379295, -0.007839273661375046, -0.028445230796933174, 0.00879809632897377, 0.0007703872397542, 0.01239020749926567, 0.008930838666856289, 0.026130056008696556, 0.007372575346380472, 0.0031848123762756586, -0.018172400072216988, 0.017464473843574524, -0.016115378588438034, 0.01752559468150139, -0.001004429766908288, -0.019562380388379097, 0.030935224145650864, -0.01757803000509739, 0.0231182761490345, 0.02124389074742794, -0.021356921643018723, -0.006078224629163742, 0.002438518451526761, -0.004397418349981308, 0.025776240974664688, -0.019377730786800385, -0.003905792720615864, -0.048271384090185165, 0.020893217995762825, 0.04418167099356651, -0.012917130254209042, 0.0027255818713456392, -0.00754157779738307, -0.0782076045870781, 0.01794477365911007, -0.035081252455711365, -0.005197168793529272, -0.009478213265538216, 0.0460473857820034, -0.02602173201739788, 0.007438448257744312, -0.011908063665032387, -0.035923756659030914, -0.04535337910056114, 0.0183662548661232, -0.011687594465911388, -0.008577143773436546, -0.02168562449514866, 0.01515887025743723, 0.03962463513016701, -0.01770663447678089, 0.018342940136790276, -0.03163186460733414, 0.06043652445077896, 0.016700690612196922, 0.04208013042807579, 0.005597598850727081, -0.026445087045431137, -0.012615101411938667, -0.0188192967325449, -0.0003491310926619917, -0.020222047343850136, 0.004534047096967697, -0.0026966736186295748, -0.017556920647621155, 0.001008076244033873, -0.03151611238718033, 0.030533291399478912, 0.04420711100101471, 0.02382848970592022, 0.009607507847249508, 0.0310721043497324, 0.004047519061714411, 0.01543373242020607, -0.01292643416672945, 0.018384337425231934, -0.00937877781689167, -0.007402227260172367, 0.00250658649019897, 0.02305024117231369, 0.01722032204270363, -0.025950690731406212, -0.01615723967552185, 0.004102443344891071, -0.028034664690494537, -0.000908166985027492, 0.0014845217810943723, 0.020152270793914795, -0.015833107754588127, -0.03698345646262169, 0.021780677139759064, -0.011327465064823627, -0.036148764193058014, -0.008389570750296116, -0.046954281628131866, -0.020991498604416847, 0.006388140842318535, -0.025913765653967857, 0.06135592237114906, 0.009516247548162937, 0.021250588819384575, 0.0017536042723804712, 0.03177739679813385, 0.004850875586271286, -0.01898803748190403, -0.003875918686389923, 0.014796960167586803, 0.03131413832306862, -0.01731010526418686, -0.03631604090332985, -0.038808587938547134, -0.03686060011386871, 0.01294335164129734, 0.0021625268273055553, -0.05224945396184921, -0.02306472323834896, 0.02091089077293873, -0.0014740051701664925, -0.06417220830917358, 0.02673957683146, 0.02673463337123394, -0.012505562976002693, 0.026523135602474213, -0.01706589385867119, 0.0069915493950247765, -0.02107013761997223, -0.009496383368968964, -0.011259807273745537, 0.04289057105779648, 0.02183026261627674, -0.005505224224179983, -0.04783210530877113, 0.0530521385371685, -0.060287147760391235, -0.05733715370297432, -0.007472269237041473, 0.04924134165048599, 0.016689475625753403, -0.03610694035887718, -0.009386141784489155, 0.004245825577527285, 0.01418700348585844, 0.0011833541793748736, 0.023281967267394066, -0.04167696833610535, 0.017892371863126755, 0.028156649321317673, -0.034444596618413925, -0.0005423012771643698, -0.001404032576829195, 0.030420128256082535, 0.037397973239421844, 0.07806467264890671, -0.01467930618673563, -0.006072974763810635, -0.05455276742577553, 0.004289213567972183, -0.002488555619493127, -0.025218753144145012, -0.005032253917306662, 0.025817720219492912, -0.049390364438295364, -0.00922337081283331, -0.05609140917658806, 0.03094601444900036, 0.016410348936915398, 0.005759807303547859, -0.02429785020649433, -0.022021690383553505, 0.024246644228696823, -0.00759788416326046, 0.036674436181783676, -0.006234155036509037, 0.04326949268579483, 0.04290374740958214, -0.011641412042081356, 0.013253053650259972, 0.01599591039121151 ]
Hugging Face Reads, Feb. 2021 - Long-range Transformers
VictorSanh
March 09, 2021
long-range-transformers
research, nlp
https://huggingface.co/blog/long-range-transformers
Efficient Transformers taxonomy from Efficient Transformers: a Survey by Tay et al. # Hugging Face Reads, Feb. 2021 - Long-range Transformers Co-written by Teven Le Scao, Patrick Von Platen, Suraj Patil, Yacine Jernite and Victor Sanh. > Each month, we will choose a topic to focus on, reading a set of four papers recently published on the subject. We will then write a short blog post summarizing their findings and the common trends between them, and questions we had for follow-up work after reading them. The first topic for January 2021 was Sparsity and Pruning, in February 2021 we addressed Long-Range Attention in Transformers.
[ 0.05478827655315399, -0.05320538580417633, -0.01870419830083847, -0.06902161985635757, -0.026279324665665627, 0.02566758170723915, -0.007054914254695177, 0.025661861523985863, -0.026582863181829453, -0.007204627152532339, -0.07262570410966873, 0.09124118089675903, -0.017972029745578766, 0.06943569332361221, -0.03621760383248329, 0.03852659463882446, 0.016895346343517303, 0.02634737454354763, -0.030708976089954376, 0.05279482528567314, 0.021614842116832733, -0.1383611112833023, 0.10692588984966278, 0.0091191865503788, 0.03527427092194557, -0.00246219988912344, 0.021388934925198555, -0.002713811583817005, 0.00296551245264709, 0.044343382120132446, -0.12637686729431152, 0.03514918312430382, 0.005907897837460041, -0.029052356258034706, -0.061539746820926666, -0.04945392161607742, -0.06316473335027695, -0.004337558522820473, 0.009634781628847122, -0.006079592276364565, 0.0018873363733291626, -0.019296547397971153, -0.045105837285518646, -0.00234621437266469, 0.0008978899568319321, -0.04155533015727997, -0.09615671634674072, 0.007873177528381348, -0.08332014083862305, -0.012928852811455727, -0.01310094352811575, 0.057678963989019394, -0.03742480278015137, 0.002448242623358965, -0.01660420186817646, 0.019204510375857353, 0.006096870172768831, -0.10327930748462677, -0.015632348135113716, -0.02204367145895958, 0.026503346860408783, 0.009361425414681435, -0.004134421702474356, 0.07032714784145355, 0.014491134323179722, -0.029118727892637253, -0.018662387505173683, 0.01384096872061491, -0.047117188572883606, 0.01135472021996975, 0.024026723578572273, 0.018969545140862465, 0.03181522339582443, 0.020842120051383972, -0.033023614436388016, 0.02750859409570694, -0.025490237399935722, -0.002637919271364808, 0.015359005890786648, 0.007726718671619892, 0.000530935125425458, 0.009243854321539402, 0.10830750316381454, 0.03692508861422539, 0.030884932726621628, -0.017384763807058334, 0.08967410027980804, -0.05464908853173256, -0.06907860189676285, 0.005736287217587233, -0.0018840533448383212, -0.07961355894804001, -0.028679978102445602, -0.007815210148692131, 0.09646575897932053, -0.04920651763677597, -0.005460566841065884, -0.0022682861890643835, -0.05558660998940468, -0.04285602644085884, -0.00001167872324003838, 0.03326861932873726, 0.0008529647020623088, -0.07258205860853195, -0.029685186222195625, -0.05225301906466484, -0.04325346648693085, -0.08626939356327057, -0.008062098175287247, 0.0013310813810676336, -0.019906405359506607, 0.009350357577204704, 0.03860277682542801, 0.08708079904317856, -0.056909509003162384, 0.07820522040128708, 0.018209543079137802, -0.01619289442896843, -0.03784959763288498, -0.04331406205892563, -0.013457972556352615, 0.09974027425050735, 0.042598024010658264, -0.028507189825177193, 0.00477364007383585, 0.016847731545567513, 0.01389110554009676, -0.00021311696036718786, 0.009377852082252502, -0.06330201029777527, 0.036898452788591385, -0.0707836002111435, 0.04269997030496597, -0.032404735684394836, -0.05556773021817207, -0.0740334540605545, 0.031684331595897675, 0.01863776706159115, 0.010284640826284885, -0.03867653012275696, -0.06092236936092377, 0.030133996158838272, 0.06210842356085777, -0.054906584322452545, 0.06142587959766388, -0.07236918807029724, -0.09109467267990112, 0.060581546276807785, 0.007627553306519985, -0.004948589019477367, -0.00948184821754694, 0.0039371103048324585, -0.10375692695379257, 0.02439798414707184, -0.020311124622821808, 0.03790536895394325, 0.026484817266464233, 0.05108416825532913, -0.009005899541079998, -0.03773346170783043, -0.034555040299892426, -0.03035789541900158, 0.03205667808651924, 0.010349681600928307, 0.03750265762209892, -0.036098599433898926, 0.026426000520586967, 0.0321776457130909, -0.0032472279854118824, 0.05781644210219383, 0.04132755473256111, 0.021697208285331726, 0.03721456229686737, -0.013997217640280724, -0.08696246892213821, 0.04716721922159195, 0.053729403764009476, 0.05240289866924286, 0.00007904452650109306, -0.005130051169544458, -0.02140096202492714, -0.019305728375911713, 0.03332829847931862, 0.049357473850250244, 0.07295998930931091, -0.02058548480272293, 0.08177822083234787, 0.048241015523672104, 0.016681663691997528, 0.024563247337937355, -0.013480528257787228, -0.013843520544469357, 0.10683361440896988, -0.03528415784239769, 0.01146188285201788, -0.02241596207022667, 0.023241497576236725, 0.041759196668863297, 0.04565178230404854, 0.03547109290957451, 0.04790529981255531, 0.0018867385806515813, 0.028736012056469917, 0.01581365056335926, -0.02932734228670597, 0.005983591079711914, -0.009542552754282951, 0.01037701964378357, 0.05291575565934181, -0.020445192232728004, 0.013999048620462418, -0.07940119504928589, 0.01783035881817341, -0.016488026827573776, 0.03415892645716667, -0.11859450489282608, 0.059646133333444595, -0.01975596323609352, -0.026087062433362007, -0.018595663830637932, 0.08629235625267029, 0.004631124436855316, -0.052289385348558426, 0.03970685973763466, 0.005466278642416, -0.004801664035767317, 0.13709507882595062, -0.0018062017625197768, 0.06394539773464203, -0.03999166190624237, 0.03610929474234581, 0.002919557271525264, -0.01002771407365799, -0.02422286383807659, -0.017014769837260246, -0.030690273270010948, -0.016201907768845558, -0.05468979850411415, 0.02016168273985386, -0.007422368507832289, -0.05764421820640564, 0.006918491795659065, 0.0635998323559761, 0.08421206474304199, 0.02247079461812973, -0.02670118771493435, 0.07932104170322418, 0.01922861859202385, -0.029783664271235466, 0.024783344939351082, -0.04313424229621887, 0.10403561592102051, 0.01934179477393627, -0.049136873334646225, -0.018972530961036682, -0.0034738448448479176, 0.019761947914958, -0.009575923904776573, -0.016658393666148186, 0.04181978106498718, -0.029937798157334328, -0.0018546337960287929, -0.020557330921292305, -0.06264287233352661, -0.019223978742957115, -0.029499460011720657, 0.044722042977809906, 0.03510843589901924, 0.03983430191874504, 0.026938488706946373, 0.03007715567946434, -0.010942318476736546, -0.0390302948653698, 0.0026349122636020184, -0.0000678334035910666, -0.031808219850063324, 0.0060440669767558575, -0.01418041530996561, 0.015095144510269165, -0.058468542993068695, -0.00796392373740673, 0.016927029937505722, 0.05505452677607536, -0.0006617467734031379, -0.00028041951009072363, -0.008492185734212399, 0.03922763094305992, -0.05455980822443962, -0.0021918138954788446, 0.014457819052040577, 0.02628822810947895, -0.016357148066163063, -0.015930386260151863, -0.02043955959379673, -0.04169744253158569, 0.014690735377371311, -0.02059370093047619, -0.011945881880819798, -0.01751222275197506, 0.04323733225464821, 0.0012411356437951326, 0.0023786171805113554, -0.022847997024655342, 0.012067081406712532, -0.0019949558191001415, 0.027365826070308685, -0.01426902785897255, 0.06081020459532738, -0.08363306522369385, -0.07930289953947067, 0.007275082170963287, -0.0003522043116390705, -0.06041186302900314, -0.05575678125023842, -0.006163573358207941, -0.017214858904480934, 0.018780389800667763, -0.021769920364022255, 0.033429209142923355, 0.020959416404366493, -0.004338177852332592, 0.035865217447280884, 0.008229545317590237, 0.016356930136680603, -0.03024664707481861, -0.0012650268618017435, -0.003491358133032918, 0.013834851793944836, -0.007535919081419706, 0.026704730466008186, 0.010596111416816711, -0.019904276356101036, 0.017424611374735832, 0.010790742933750153, 0.03540819138288498, 0.0422581322491169, 0.03894035145640373, -0.009579489938914776, -0.017398042604327202, 0.0466935969889164, -0.03327630087733269, 0.06430093944072723, -0.0191497802734375, -0.013524924404919147, -0.016295796260237694, 0.03503860533237457, 0.04609151929616928, 0.06332036852836609, 0.07002418488264084, -0.06829214841127396, 0.01137411966919899, 0.03846433386206627, 0.011371826753020287, -0.032325394451618195, -0.0018242994556203485, 0.025508955121040344, -0.00004611969779944047, -0.016026778146624565, 0.012076971121132374, 0.0015958903823047876, -0.006253419443964958, -0.018774451687932014, -0.00624337000772357, 0.0041741132736206055, 0.042787760496139526, -0.024827027693390846, -0.01316202525049448, -0.011476230807602406, -0.032950349152088165, -0.006474481895565987, -0.0014326631790027022, -0.012284777127206326, -0.03408535569906235, 0.038372963666915894, -0.008540256880223751, -0.0228500384837389, -0.0065392740070819855, -0.013320344500243664, -0.05657282844185829, 0.013188592158257961, -0.013061247766017914, -0.01493725087493658, -0.03967335820198059, 0.06634633243083954, 0.018288850784301758, 0.008593627251684666, 0.050522807985544205, 0.02461283840239048, -0.04153996706008911, -0.06996273994445801, -0.041526418179273605, 0.03912036865949631, -0.024242401123046875, -0.004904800094664097, 0.0682465136051178, -0.024341613054275513, -0.006768861319869757, 0.016175271943211555, -0.006195453926920891, 0.004847505129873753, 0.0018816952360793948, -0.050122279673814774, 0.013933571055531502, -0.015152482315897942, -0.02149900607764721, 0.024799255654215813, 0.00851046945899725, -0.05193709954619408, -0.005793577525764704, -0.03608022257685661, 0.004586041904985905, 0.03666232153773308, -0.003973707091063261, 0.021767862141132355, -0.023384783416986465, -0.017957156524062157, -0.009646761231124401, 0.012588710524141788, 0.028832685202360153, -0.019877832382917404, -0.06438951939344406, 0.015467116609215736, 0.03396197035908699, 0.03826996311545372, -0.02548331581056118, 0.00021660185302607715, -0.03601348027586937, 0.006255537271499634, -0.04488902911543846, -0.0012905268231406808, 0.020052378997206688, 0.0039821406826376915, 0.057791952043771744, -0.003565073711797595, -0.02230282872915268, 0.03742960840463638, -0.012067839503288269, 0.004434114322066307, -0.017483429983258247, -0.0012378072133287787, 0.032567113637924194, 0.02068040519952774, 0.014231821522116661, 0.04989747703075409, 0.004794162232428789, -0.018538087606430054, -0.05909164249897003, -0.019821302965283394, -0.047421883791685104, 0.02099531702697277, 0.03272642195224762, -0.038127824664115906, -0.014021256938576698, 0.02456083707511425, -0.029846685007214546, -0.019999492913484573, -0.004290028475224972, 0.032547395676374435, 0.016080845147371292, -0.019664427265524864, -0.0249467920511961, 0.04221072047948837, 0.05174504965543747, 0.007661833427846432, -0.011713123880326748, 0.04098581522703171, 0.005529194138944149, 0.032690223306417465, 0.009981346316635609, 0.03857198357582092, -0.08716728538274765, 0.016590112820267677, 0.005572192836552858, -0.01665419712662697, -0.029678605496883392, -0.029683582484722137, 0.015242214314639568, 0.011814191937446594, -0.02254260703921318, -0.05267611891031265, 0.013397326692938805, -0.028911832720041275, -0.007613270543515682, 0.01788404770195484, 0.015834977850317955, -0.0002209671220043674, -0.018755745142698288, -0.004166556056588888, 0.00600050063803792, 0.03717682510614395, 0.02547040581703186, -0.004843683447688818, 0.027299383655190468, 0.043716851621866226, 0.0195662509649992, 0.055241044610738754, 0.008695756085216999, 0.016855252906680107, 0.03831832483410835, -0.023192724213004112, -0.0160994715988636, 0.054225124418735504, -0.025740979239344597, -0.03614666685461998, 0.03662789985537529, 0.00017822117661125958, -0.06565636396408081, 0.012347044423222542, 0.06184539571404457, 0.02142036333680153, -0.03482327237725258, -0.012113912031054497, 0.0092746801674366, 0.01873595081269741, -0.0250801183283329, -0.023820018395781517, 0.0031634008046239614, -0.060590848326683044, 0.041883308440446854, 0.012819034047424793, -0.00979358609765768, -0.0301256962120533, 0.018967589363455772, -0.04377317056059837, -0.03293411061167717, -0.015476226806640625, 0.03440478444099426, 0.03411369025707245, -0.007715949323028326, 0.007939125411212444, 0.003891837317496538, 0.005099852569401264, 0.003753197379410267, -0.004920946434140205, -0.029675358906388283, -0.003587209153920412, -0.01719113439321518, -0.021499641239643097, -0.011775234714150429, -0.005455190781503916, 0.02767045609652996, 0.026079123839735985, -0.009191161021590233, -0.010188133455812931, -0.054406359791755676, 0.04488297551870346, 0.047034140676259995, 0.031260162591934204, 0.01923190988600254, -0.036062419414520264, -0.0009021366131491959, -0.0002983982558362186, -0.04413532838225365, 0.027770817279815674, 0.017457524314522743, -0.016919495537877083, -0.034475598484277725, -0.02004559338092804, 0.03793661296367645, 0.005372314248234034, -0.034087926149368286, 0.04550926387310028, -0.013912021182477474, -0.008521451614797115, -0.01174718514084816, 0.013880424201488495, -0.005812427029013634, -0.0058113276027143, 0.025400986894965172, -0.0007162804249674082, 0.018951095640659332, 0.03742573782801628, 0.015856890007853508, -0.018058642745018005, 0.0024129305966198444, -0.025044038891792297, 0.05365803465247154, 0.015573968179523945, -0.044449664652347565, -0.025370849296450615, 0.030994998291134834, -0.01859308034181595, -0.027504486963152885, -0.021571213379502296, 0.03701290115714073, -0.014698725193738937, 0.04072567820549011, -0.055375948548316956, 0.06383650749921799, -0.0005493180360645056, 0.04842197522521019, 0.02001074329018593, -0.0010835796128958464, -0.03367879241704941, 0.02165626734495163, -0.02457265742123127, 0.00780881242826581, 0.026926152408123016, -0.02167273499071598, 0.021106721833348274, 0.016709666699171066, -0.03703385964035988, -0.01234441064298153, 0.028257936239242554, 0.012170098721981049, 0.008627270348370075, 0.02830219641327858, -0.03096548467874527, 0.04474272578954697, 0.02220885083079338, 0.031018022447824478, -0.027049578726291656, -0.010254533030092716, 0.04658226668834686, 0.008523410186171532, 0.020478833466768265, -0.008417483419179916, -0.005174640566110611, -0.03418046236038208, 0.051779404282569885, -0.012293132022023201, 0.07444611191749573, -0.008821087889373302, -0.03025718778371811, -0.03551161289215088, -0.03190892934799194, -0.005336196627467871, 0.012911573052406311, -0.006239787209779024, -0.00040070555405691266, 0.038644060492515564, -0.01860988326370716, -0.006691501941531897, 0.04848451539874077, 0.0014252321561798453, -0.0047919247299432755, -0.030986715108156204, -0.017741352319717407, 0.04132453724741936, 0.048603761941194534, -0.04658491909503937, -0.0024118523579090834, 0.06254665553569794, 0.020353494212031364, 0.033281728625297546, 0.017851384356617928, -0.03148694336414337, -0.03959685191512108, -0.016204332932829857, 0.010322041809558868, 0.05805687978863716, 0.027467912063002586, -0.03469831496477127, -0.04933580756187439, 0.005706640891730785, 0.07300078123807907, -0.02663109265267849, 0.05685203894972801, -0.01911410503089428, 0.004262136295437813, -0.06722673028707504, 0.034731123596429825, -0.025194238871335983, -0.012388625182211399, -0.02126840315759182, 0.011298757046461105, -0.02988743595778942, -0.02923646941781044, -0.015279467217624187, 0.09275273978710175, 0.026651347056031227, -0.023817937821149826, 0.016637781634926796, -0.03482329100370407, 0.0055720922537148, 0.005656121764332056, 0.007585437502712011, 0.016264252364635468, 0.0071229697205126286, 0.023188069462776184, -0.0009544278145767748, 0.048713602125644684, -0.012811454012989998, -0.004034245852380991, 0.05014568194746971, -0.003555681323632598, -0.03964615240693092, 0.013244537636637688, 0.010009096935391426, 0.0013830795651301742, -0.024785315617918968, 0.019640715792775154, 0.011922101490199566, 0.004514061380177736, -0.03254246339201927, -0.03443669155240059, 0.0034347262699157, -0.02971781976521015, 0.009850661270320415, -0.009638586081564426, -0.031197775155305862, 0.02390305884182453, 0.003610997460782528, -0.005061497446149588, -0.04631785303354263, 0.038547780364751816, -0.016829468309879303, -0.01273295097053051, -0.0024500195868313313, -0.015899164602160454, 0.03666231036186218, 0.02917124517261982, 0.03353738784790039, -0.033679984509944916, -0.021294567734003067, -0.006265101954340935, 0.022010698914527893, 0.007001496385782957, 0.09893777966499329, 0.04875492677092552, -0.006580381654202938, -0.047148559242486954, -0.03803061321377754, -0.028600327670574188, -0.063959501683712, -0.01743461936712265, 0.007353302091360092, -0.038994740694761276, -0.009468579664826393, -0.033927857875823975, 0.023190580308437347, 0.0008835542248561978, 0.015057883225381374, -0.0020971738267689943, -0.01989746280014515, 0.013853047043085098, 0.035988785326480865, 0.0008553093066439033, -0.0008462087716907263, -0.0044654966332018375, 0.03142736479640007, 0.016242017969489098, 0.020843366160988808, -0.017643094062805176, 0.0037352244835346937, -0.01816379651427269, 0.014371245168149471, 0.04862414300441742, -0.029190750792622566, -0.05503174662590027, 0.08240149915218353, 0.01735447533428669, 0.0062453048303723335, -0.05902475491166115, 0.018789488822221756, 0.04969526454806328, -0.01136112492531538, 0.0006550343823619187, -0.060301825404167175, 0.01343363244086504, -0.033380698412656784, 0.014937958680093288, 0.032540325075387955, 0.013314587064087391, -0.0018884595483541489, 0.026136178523302078, 0.00694122863933444, -0.04517633467912674 ]
Hugging Face Reads, Feb. 2021 - Long-range Transformers
VictorSanh
March 09, 2021
long-range-transformers
research, nlp
https://huggingface.co/blog/long-range-transformers
Main findings * Compressive Transformer significantly outperforms the state-of-the-art perplexity on language modeling, namely on the enwik8 and WikiText-103 datasets. In particular, compressed memory plays a crucial role in modeling rare words occurring on long sequences. * The authors show that the model learns to preserve salient information by increasingly attending the compressed memory instead of the regular memory, which goes against the trend of older memories being accessed less frequently. * All compression functions (average pooling, max pooling, 1D convolution) yield similar results confirming that memory compression is an effective way to store past information.
[ -0.0001037610272760503, -0.04537980258464813, -0.027425110340118408, 0.008180944249033928, -0.01659346930682659, 0.021688712760806084, -0.008338894695043564, 0.014852087944746017, -0.03651745244860649, -0.028289418667554855, -0.041327960789203644, 0.0016238442622125149, 0.02374214492738247, 0.08146791905164719, -0.06283174455165863, -0.01863272488117218, 0.0008967959438450634, -0.015259863808751106, 0.021442057564854622, 0.04459592327475548, -0.018301494419574738, -0.06035812944173813, 0.07619798928499222, -0.000897920923307538, 0.023387715220451355, 0.03778451681137085, 0.012186959385871887, -0.05478984862565994, -0.0373702198266983, -0.010916992090642452, -0.1118236556649208, 0.07316742092370987, 0.00467254500836134, -0.026212403550744057, -0.005240127444267273, -0.03224801644682884, -0.09492073208093643, 0.0457536056637764, -0.04659673199057579, -0.004444790538400412, 0.034668538719415665, 0.03089297190308571, -0.06815332919359207, 0.030437052249908447, 0.019253943115472794, -0.0062797702848911285, -0.16234347224235535, 0.06495131552219391, -0.08400927484035492, -0.08960331976413727, -0.06234968081116676, 0.06752835959196091, -0.01677834801375866, 0.08500588685274124, -0.03391444310545921, 0.020975947380065918, 0.0018122328910976648, -0.03811614215373993, 0.03348615765571594, 0.04626768082380295, -0.02809913270175457, 0.0007051164866425097, 0.018139734864234924, -0.0013884550426155329, 0.02218184433877468, 0.00164307514205575, -0.04441669583320618, 0.027569467201828957, -0.04800145700573921, -0.01628747582435608, 0.015312150120735168, 0.07187596708536148, 0.016515469178557396, 0.011392883025109768, -0.048500142991542816, -0.0003503879706840962, 0.023157116025686264, 0.020120050758123398, 0.022179000079631805, 0.0128775117918849, -0.06125064939260483, 0.03487630933523178, 0.08589424192905426, 0.022961268201470375, 0.0312894731760025, 0.03729594498872757, 0.04282496124505997, -0.06980481743812561, -0.1389811784029007, 0.008204498328268528, -0.026905164122581482, -0.11611445993185043, 0.007965789176523685, 0.041946835815906525, -0.015275928191840649, -0.00021566082432400435, -0.015357493422925472, 0.026765793561935425, -0.032054319977760315, -0.0018091729143634439, 0.010800626128911972, -0.03379909694194794, 0.02725694328546524, -0.01435236819088459, -0.050343986600637436, -0.008726229891180992, -0.04594806581735611, -0.0546734593808651, 0.08199869096279144, 0.03486429899930954, 0.039684880524873734, 0.07090727984905243, 0.008099135011434555, -0.013614698313176632, -0.1325952112674713, -0.019997745752334595, 0.07635882496833801, 0.030824370682239532, -0.014119534753262997, 0.009257317520678043, -0.04238016530871391, 0.061329685151576996, 0.07941403985023499, -0.012153374031186104, 0.04818699136376381, -0.0022449332755059004, 0.04441288486123085, -0.00603008596226573, 0.03012876771390438, -0.027591386809945107, 0.04547524079680443, -0.02784736081957817, 0.025158928707242012, 0.017465341836214066, -0.034201156347990036, 0.03676222264766693, -0.02852247841656208, -0.05113792419433594, -0.07161165773868561, 0.007318513467907906, -0.012766603380441666, 0.06270981580018997, -0.05403248220682144, -0.13743926584720612, 0.041370689868927, 0.042910974472761154, -0.0682128518819809, 0.028261352330446243, 0.09045659750699997, 0.020712461322546005, -0.0021593838464468718, -0.06697411090135574, -0.06739641726016998, -0.07967457920312881, 0.050524234771728516, 0.04382132738828659, -0.021708544343709946, 0.007600821554660797, -0.009913547895848751, -0.04629881680011749, -0.08071735501289368, -0.02419154904782772, -0.0013588625006377697, 0.010868736542761326, -0.011847564950585365, -0.016345050185918808, 0.01829942688345909, 0.03349432349205017, 0.0050940909422934055, 0.06825441867113113, -0.005620534997433424, 0.05675617605447769, -0.021105559542775154, 0.013706554658710957, -0.11534339189529419, 0.04360209405422211, -0.013107308186590672, 0.03967637941241264, 0.015711110085248947, -0.06738327443599701, -0.02675166353583336, -0.0005058631650172174, 0.02204235829412937, 0.057118009775877, 0.04270868003368378, -0.04693802446126938, 0.03791913762688637, -0.04898937791585922, -0.02887086756527424, -0.02714945748448372, -0.03529223054647446, 0.006284323986619711, 0.031823452562093735, -0.019538087770342827, 0.061460331082344055, -0.003379453206434846, -0.015491983853280544, 0.0691891759634018, 0.10592369735240936, 0.06482791900634766, 0.01831853576004505, -0.0077863698825240135, -0.032380230724811554, -0.03916209191083908, -0.019023291766643524, 0.02444574423134327, -0.01204940490424633, 0.01947268284857273, -0.00936681404709816, 0.011495763435959816, 0.05030474439263344, -0.07351554930210114, -0.03581821545958519, -0.08475416153669357, -0.02884340099990368, -0.07030223309993744, -0.04226722940802574, -0.0055328779853880405, -0.06153314933180809, -0.008462092839181423, 0.0883789137005806, -0.007044082973152399, -0.043256863951683044, -0.01979495771229267, 0.02228335291147232, 0.04793330654501915, 0.03476257249712944, -0.002093339106068015, 0.12083073705434799, -0.06832680106163025, 0.023710692301392555, -0.04740767553448677, -0.009918492287397385, -0.01124713383615017, 0.006260143592953682, -0.05990222096443176, -0.04876633360981941, 0.05459623038768768, -0.06701187044382095, 0.03224398195743561, -0.02325201965868473, 0.04412031173706055, 0.011783947236835957, 0.032478492707014084, 0.0035962697584182024, -0.01283908449113369, 0.040332015603780746, -0.05815436318516731, -0.05084826052188873, -0.005344616714864969, -0.05355386063456535, 0.09771358221769333, -0.028742222115397453, -0.053383152931928635, -0.004245520103722811, 0.019583312794566154, 0.04540342837572098, -0.035112619400024414, 0.01789894886314869, 0.014488223008811474, 0.020122161135077477, -0.016167733818292618, 0.006669995374977589, -0.04764541611075401, 0.039285674691200256, -0.057267822325229645, 0.030604341998696327, 0.00473839370533824, 0.03898390009999275, -0.0021337587386369705, 0.01637074165046215, -0.010075785219669342, 0.038743793964385986, 0.038080986589193344, 0.014328522607684135, 0.01979411020874977, 0.026746274903416634, -0.02376568131148815, 0.0011979711707681417, -0.04269979149103165, -0.01629612408578396, -0.01753506436944008, 0.026871459558606148, -0.02997749298810959, 0.016630766913294792, 0.058887582272291183, 0.015186337754130363, 0.009274395182728767, -0.046534668654203415, 0.005082245916128159, -0.008448359556496143, -0.0027947360649704933, -0.021146047860383987, -0.01367997657507658, 0.008010057732462883, 0.020886743441224098, 0.0006501166499219835, -0.019513314589858055, -0.0372791551053524, 0.0028942804783582687, -0.051105231046676636, 0.02243211306631565, -0.006558620370924473, 0.024568552151322365, 0.016284653916954994, 0.01031921524554491, 0.0044304970651865005, 0.06069548428058624, -0.07146989554166794, -0.024463657289743423, -0.012252576649188995, -0.04690667614340782, 0.002336818492040038, -0.0052802674472332, -0.007386505603790283, 0.06511209160089493, -0.01420503854751587, 0.07351730763912201, 0.005781920161098242, 0.026686513796448708, -0.04252779483795166, 0.009438357315957546, -0.03438889980316162, -0.021514790132641792, -0.05900967866182327, 0.029451722279191017, 0.06382282078266144, 0.010039390064775944, 0.015852464362978935, 0.0018217989709228277, -0.0343129001557827, 0.012653623707592487, -0.02354242466390133, 0.0024941503070294857, 0.02981744147837162, -0.013104704208672047, 0.012199442833662033, -0.008980478160083294, 0.010571645572781563, -0.005034043453633785, 0.05503346398472786, 0.008546389639377594, -0.02449471317231655, 0.014930942095816135, 0.016299773007631302, 0.03602490574121475, 0.05277899652719498, 0.03914007917046547, 0.0339566208422184, 0.013211248442530632, 0.02600080892443657, -0.016789894551038742, 0.021471910178661346, 0.005678501445800066, 0.02433852106332779, -0.07283812761306763, -0.00938932504504919, -0.06598357111215591, -0.045811086893081665, -0.061879295855760574, -0.01923357881605625, 0.06257718056440353, 0.04986174777150154, -0.010209967382252216, 0.07185663282871246, -0.04741493985056877, 0.011506578885018826, 0.0291012953966856, -0.01731874793767929, 0.05667414143681526, 0.01611403562128544, 0.0032264101319015026, -0.0010730150388553739, 0.04743855819106102, -0.02135767973959446, 0.007026453036814928, 0.00913274846971035, 0.04082897678017616, 0.008667459711432457, 0.0026961883995682, -0.028806446120142937, 0.003800109028816223, -0.02828115038573742, 0.04487664997577667, 0.0015590001130476594, -0.007696790620684624, 0.09671767801046371, 0.035220660269260406, -0.03790826350450516, -0.006791340187191963, -0.06309179216623306, 0.02456015907227993, 0.02303970605134964, 0.010997465811669827, -0.010573158040642738, -0.014248923398554325, 0.026010852307081223, -0.018710728734731674, 0.02671605348587036, -0.011193908751010895, -0.03585154190659523, -0.003375825472176075, -0.013860722072422504, 0.015562823973596096, 0.004128139931708574, 0.004098796285688877, 0.03298851475119591, -0.02209869958460331, 0.045328471809625626, -0.02849399670958519, 0.008330046199262142, -0.034397728741168976, -0.030568810179829597, 0.028086714446544647, -0.010124439373612404, -0.0031683866400271654, 0.010276563465595245, 0.01621301844716072, 0.00005413336111814715, 0.010638177394866943, 0.018107803538441658, 0.013390264473855495, 0.01982465200126171, 0.011965826153755188, 0.011785103008151054, -0.020814038813114166, -0.027184495702385902, -0.003160280641168356, -0.015387807972729206, -0.02068297378718853, 0.016145022585988045, 0.02529587224125862, 0.014522689394652843, 0.015472488477826118, -0.02363940142095089, -0.001536889816634357, -0.074287049472332, -0.0017153550870716572, -0.011812819167971611, 0.019790686666965485, 0.06093835085630417, 0.029078906401991844, 0.02437533810734749, -0.023470740765333176, 0.003029643325135112, 0.006338586565107107, -0.04643942788243294, -0.01242457702755928, -0.028047796338796616, -0.03638112172484398, 0.00478462316095829, -0.07541889697313309, 0.023346493020653725, 0.004042124841362238, 0.030664417892694473, 0.010773149318993092, 0.0026221119333058596, 0.02491193264722824, -0.02332168072462082, -0.029996082186698914, 0.006058739498257637, 0.039030563086271286, 0.016136711463332176, 0.03803063556551933, -0.011546139605343342, 0.025207839906215668, 0.01689566858112812, -0.011437415145337582, 0.02187720686197281, 0.003876101691275835, -0.07289952784776688, 0.02203330211341381, 0.004730710294097662, -0.023210866376757622, -0.03631720691919327, -0.03972325474023819, 0.023856235668063164, 0.000832568621262908, 0.007625236175954342, -0.00956067256629467, 0.004410011228173971, 0.015671079978346825, 0.019246798008680344, -0.0015895066317170858, 0.027364136651158333, 0.023212846368551254, -0.012903518043458462, 0.01017905492335558, 0.008192741312086582, -0.002966158324852586, -0.00692007876932621, 0.02056514471769333, 0.041508447378873825, -0.0030516842380166054, 0.02068253979086876, 0.05114573985338211, -0.042719025164842606, -0.002081445185467601, 0.04425162076950073, -0.01761201024055481, 0.009549811482429504, -0.031189218163490295, 0.009673004038631916, -0.022860495373606682, 0.013399338349699974, 0.02208196371793747, -0.039118632674217224, 0.04780861735343933, 0.012193450704216957, 0.0181609895080328, -0.035998132079839706, -0.013444876298308372, -0.018323400989174843, 0.019571997225284576, -0.012065310962498188, -0.008594753220677376, -0.034229934215545654, -0.07280119508504868, -0.011882995255291462, -0.0067626675590872765, 0.004122510086745024, -0.005436439532786608, 0.01569404825568199, -0.04745015874505043, -0.00711140688508749, 0.02255125902593136, 0.02860897406935692, 0.032360274344682693, 0.018002215772867203, 0.03432042896747589, 0.01950625143945217, -0.0002251187979709357, 0.025496652349829674, -0.017102381214499474, 0.008029814809560776, 0.01171452458947897, -0.0249676201492548, 0.03635009378194809, 0.008526294492185116, -0.03252813592553139, -0.007152964826673269, 0.028400791808962822, 0.001145054935477674, -0.023344509303569794, 0.015151873230934143, 0.07051917910575867, -0.0024376469664275646, -0.028325418010354042, 0.014547218568623066, -0.07192755490541458, -0.07158243656158447, 0.050274576991796494, -0.0009718140936456621, 0.036691613495349884, 0.04033618047833443, 0.01577252335846424, 0.0016502219950780272, 0.009074707515537739, 0.027466479688882828, -0.03964313492178917, -0.013038626872003078, 0.03117215260863304, 0.009924514219164848, -0.0232740119099617, -0.004491993226110935, -0.001008374965749681, -0.01855810545384884, -0.01036849245429039, 0.021729618310928345, -0.0060263206250965595, 0.0433976985514164, 0.06119653582572937, -0.01695496216416359, 0.031965237110853195, 0.06545311212539673, -0.030815741047263145, 0.014424985274672508, -0.013188622891902924, 0.00475492887198925, 0.013348802924156189, -0.04214441031217575, 0.01752326637506485, -0.002298166509717703, 0.020722854882478714, 0.038759179413318634, 0.03146423026919365, 0.03851274773478508, 0.04786427319049835, 0.0229970570653677, 0.005821601953357458, 0.05674215778708458, 0.040087245404720306, -0.04312146455049515, -0.01027133408933878, -0.00030327457352541387, 0.024364804849028587, -0.00024584835045970976, 0.006285809446126223, -0.027615973725914955, 0.01855929009616375, 0.025370895862579346, 0.002105409512296319, -0.03718387335538864, 0.015886995941400528, -0.020054850727319717, 0.020756525918841362, -0.010544642806053162, -0.055021245032548904, 0.0442679263651371, 0.05221540853381157, 0.04988565668463707, 0.0061544328927993774, 0.0063778371550142765, -0.005855712573975325, 0.045134011656045914, -0.0008872094331309199, 0.028877176344394684, 0.029481178149580956, -0.028074637055397034, 0.00743600120767951, 0.050974976271390915, 0.006931784097105265, 0.019547242671251297, -0.03443806245923042, 0.030354954302310944, -0.02464407868683338, 0.00893340166658163, -0.018450843170285225, -0.02136179804801941, -0.011219658888876438, 0.027705790475010872, 0.011952927336096764, -0.05777806416153908, 0.06645739823579788, 0.02119617536664009, 0.01827588677406311, -0.044439926743507385, 0.023793945088982582, -0.02912246808409691, 0.042848799377679825, -0.01983470469713211, -0.0616505928337574, -0.006543530151247978, -0.02259434200823307, -0.011709839105606079, 0.044335369020700455, 0.005970541387796402, -0.004053913056850433, -0.03048178367316723, 0.010576742701232433, 0.01257748156785965, 0.04107549041509628, 0.006209315732121468, -0.028602439910173416, 0.01502756867557764, 0.009287675842642784, 0.003546454245224595, 0.013142308220267296, -0.04251720383763313, -0.008875171653926373, -0.014031978324055672, 0.007684643846005201, 0.020872071385383606, -0.03923757001757622, -0.02214682288467884, -0.06949350982904434, -0.0001012488137348555, -0.003377985442057252, 0.052400797605514526, 0.0010256137466058135, 0.021846886724233627, -0.016776612028479576, 0.012051032856106758, -0.020093128085136414, -0.03940340876579285, 0.01919160597026348, 0.006555663421750069, 0.015310785733163357, -0.038952309638261795, -0.024824317544698715, -0.027655266225337982, -0.006179129239171743, -0.00504900049418211, 0.02758922055363655, 0.04114628583192825, -0.0294705368578434, 0.0037983336951583624, -0.0356362946331501, 0.011638272553682327, -0.0009667204576544464, 0.013942833989858627, -0.00525244977325201, 0.05258847028017044, 0.029768647626042366, -0.01166696660220623, 0.0045759715139865875, -0.01540415920317173, -0.010748406872153282, -0.006461170502007008, -0.026019686833024025, -0.028225164860486984, 0.019341537728905678, 0.024648047983646393, 0.025330806151032448, -0.06780613213777542, 0.006121547427028418, -0.013167385943233967, 0.010891173034906387, 0.0022297855466604233, -0.001704191556200385, 0.07334726303815842, -0.005387427750974894, 0.00879598781466484, -0.029371509328484535, -0.03313101455569267, -0.025124704465270042, 0.015657098963856697, 0.045651860535144806, 0.06839615106582642, -0.010624771006405354, -0.02612297609448433, -0.034103602170944214, -0.05442788079380989, 0.0005099656991660595, -0.020937828347086906, 0.00320037710480392, 0.01723957620561123, -0.027598876506090164, -0.013532412238419056, 0.018171129748225212, 0.02633236162364483, -0.027153538540005684, 0.02952609956264496, 0.029467443004250526, -0.0003638739581219852, 0.010832480154931545, 0.022744543850421906, -0.035955555737018585, -0.018690768629312515, 0.007296585477888584, -0.0025900828186422586, 0.02499610371887684, 0.03831808269023895, 0.05123265087604523, 0.005937827285379171, 0.012706044130027294, 0.009306578896939754, 0.015141202136874199, -0.022349748760461807, -0.037492819130420685, 0.046456556767225266, -0.0026733276899904013, 0.030105821788311005, -0.000725834455806762, 0.01247552502900362, 0.0027762153185904026, 0.01671016402542591, -0.008763052523136139, 0.03153923526406288, 0.006727798376232386, -0.037236109375953674, 0.028070131316781044, -0.005441517569124699, 0.01098567619919777, -0.015240227803587914, 0.005852275528013706, -0.053630512207746506, -0.03027200885117054 ]
Hugging Face Reads, Feb. 2021 - Long-range Transformers
VictorSanh
March 09, 2021
long-range-transformers
research, nlp
https://huggingface.co/blog/long-range-transformers
Linformer: Self-Attention with Linear Complexity Sinong Wang, Belinda Z. Li, Madian Khabsa, Han Fang, Hao Ma The goal is to reduce the complexity of the self-attention with respect to the sequence length \(n\)) from quadratic to linear. This paper makes the observation that the attention matrices are low rank (i.e. they don’t contain \(n × n\) worth of information) and explores the possibility of using high-dimensional data compression techniques to build more memory efficient transformers. The theoretical foundations of the proposed approach are based on the Johnson-Lindenstrauss lemma. Let’s consider \(m\)) points in a high-dimensional space. We want to project them to a low-dimensional space while preserving the structure of the dataset (i.e. the mutual distances between points) with a margin of error \(\varepsilon\). The Johnson-Lindenstrauss lemma states we can choose a small dimension \(k \sim 8 \log(m) / \varepsilon^2\) and find a suitable projection into Rk in polynomial time by simply trying random orthogonal projections. Linformer projects the sequence length into a smaller dimension by learning a low-rank decomposition of the attention context matrix. The matrix multiplication of the self-attention can be then cleverly re-written such that no matrix of size \(n × n\) needs to be ever computed and stored. Standard transformer: $$\text{Attention}(Q, K, V) = \text{softmax}(Q * K) * V$$ (n * h) (n * n) (n * h) Linformer: $$\text{LinAttention}(Q, K, V) = \text{softmax}(Q * K * W^K) * W^V * V$$ (n * h) (n * d) (d * n) (n * h)
[ 0.0062671140767633915, -0.030969955027103424, 0.08355425298213959, -0.04145488515496254, -0.05650432035326958, 0.04874281585216522, -0.02346905693411827, 0.0006375206867232919, 0.013963968493044376, 0.024568552151322365, -0.07322125881910324, 0.03474833816289902, -0.011026590131223202, -0.009586408734321594, -0.03825315088033676, 0.04812288656830788, 0.05379366874694824, -0.01090686023235321, 0.02074190229177475, -0.039329249411821365, -0.035697780549526215, -0.023316211998462677, 0.05658732354640961, 0.003874336602166295, -0.013207401148974895, -0.03248019516468048, 0.0292058065533638, 0.04331279173493385, -0.03877745196223259, -0.006328382063657045, -0.12709607183933258, -0.00789537001401186, 0.02705327235162258, -0.03254327550530434, -0.0054636611603200436, -0.026092203333973885, -0.0416366271674633, 0.04066258296370506, 0.04203983023762703, 0.00888584740459919, 0.029724296182394028, 0.01745576411485672, -0.07811771333217621, 0.051544178277254105, -0.05926918238401413, -0.05996406823396683, -0.10020185261964798, 0.029151713475584984, -0.10141798853874207, -0.009454546496272087, 0.008157636038959026, 0.05273496359586716, 0.021394096314907074, 0.09930598735809326, -0.010228488594293594, 0.028936216607689857, 0.0504419282078743, 0.00683617452159524, 0.036443937569856644, -0.007619534619152546, -0.004084988031536341, -0.021105991676449776, 0.024943169206380844, 0.03844539076089859, 0.024792535230517387, -0.020486805588006973, 0.09240077435970306, -0.0289692971855402, -0.07514915615320206, 0.00673581613227725, -0.036530230194330215, -0.01172166783362627, -0.011597623117268085, 0.022590460255742073, -0.03530694916844368, -0.04130646213889122, -0.005849472712725401, 0.0529073067009449, 0.05202080309391022, 0.007749880664050579, 0.05580605939030647, 0.09880425035953522, 0.11299744993448257, 0.010224899277091026, -0.010717462748289108, -0.040750693529844284, -0.018700553104281425, -0.018559206277132034, -0.0452042855322361, 0.03512547165155411, -0.05544004216790199, -0.1250518411397934, -0.040019530802965164, -0.026084957644343376, 0.05609024316072464, -0.04068026319146156, -0.013403031043708324, 0.026386499404907227, -0.049566157162189484, -0.07170582562685013, 0.03761231526732445, 0.08114558458328247, 0.08883985131978989, -0.04114551469683647, -0.07245761156082153, 0.05738937482237816, 0.0035047598648816347, -0.039884407073259354, -0.022955533117055893, -0.021348750218749046, -0.033068593591451645, 0.09875795990228653, 0.02451377548277378, -0.004968326538801193, -0.07697762548923492, 0.03201650455594063, 0.000006066286914574448, 0.018098682165145874, -0.033874399960041046, 0.010264377109706402, -0.08736500889062881, 0.10067421942949295, 0.07669119536876678, 0.0005847915890626609, 0.030125288292765617, -0.008670002222061157, -0.023556387051939964, 0.00873303972184658, 0.006543468218296766, -0.009932201355695724, 0.04317585751414299, -0.043572697788476944, -0.020490135997533798, 0.0125254075974226, 0.05076439678668976, -0.04450564831495285, 0.03144507110118866, 0.010004174895584583, -0.03346706181764603, 0.0002489923208486289, -0.04166156053543091, -0.004117768257856369, 0.03004227578639984, -0.06949503719806671, 0.07922729849815369, -0.03336872532963753, -0.07114006578922272, 0.07228191941976547, 0.05372658744454384, 0.017758416011929512, 0.01021160464733839, -0.008043940179049969, -0.0622488409280777, -0.0054327393881976604, -0.0235622338950634, 0.048438046127557755, 0.031333569437265396, -0.00011060134420404211, -0.09408921003341675, 0.022233137860894203, -0.05377219244837761, 0.08504214137792587, -0.07124742865562439, 0.06810133159160614, 0.02001390978693962, -0.10903362184762955, 0.03396620228886604, 0.0224568173289299, 0.03635689616203308, 0.004517414607107639, 0.04626985266804695, 0.0255285631865263, 0.020413115620613098, 0.05553889647126198, -0.07238014787435532, 0.0018953167600557208, -0.0026985767763108015, 0.05956827104091644, -0.009446470998227596, -0.04480992257595062, -0.03644461929798126, -0.05633383244276047, -0.021487092599272728, 0.01761670596897602, 0.038115475326776505, -0.010193915106356144, 0.04622839018702507, 0.005931293126195669, 0.007896102033555508, -0.04613073542714119, -0.04737013578414917, -0.0019296224927529693, 0.016903242096304893, -0.02373889461159706, 0.06962243467569351, 0.005547516047954559, -0.0616188645362854, 0.07027006149291992, 0.03971672058105469, 0.008267100900411606, 0.04303720220923424, 0.052946556359529495, 0.04600268974900246, 0.03536397963762283, 0.0037722880952060223, -0.019272098317742348, -0.09065241366624832, -0.03537486866116524, 0.0718776062130928, -0.03171992674469948, -0.00016032744315452874, -0.10705455392599106, -0.018188174813985825, 0.013399630784988403, 0.006785825826227665, 0.010593906044960022, -0.01396586000919342, 0.03339631110429764, 0.005188168957829475, -0.014696093276143074, 0.11831988394260406, 0.018972357735037804, -0.0629553273320198, 0.05498579144477844, -0.02249971590936184, 0.016258958727121353, 0.01213887333869934, -0.03358079120516777, 0.030075697228312492, -0.017474379390478134, 0.00981358252465725, -0.014212739653885365, 0.10601216554641724, 0.03103943169116974, -0.02557922899723053, 0.013313109055161476, -0.039663996547460556, -0.014162405394017696, -0.010239621624350548, -0.07547695189714432, 0.04669033735990524, 0.016736730933189392, 0.01011277362704277, 0.04953046143054962, -0.03737230598926544, -0.012458782643079758, 0.006491256877779961, -0.01019738893955946, -0.015042299404740334, 0.041128966957330704, -0.09553242474794388, 0.11488687992095947, 0.03287883102893829, -0.04767771065235138, -0.005940706469118595, 0.006358602084219456, 0.00818245206028223, -0.029874062165617943, 0.03542811796069145, -0.0009422340081073344, 0.007970760576426983, -0.014053789898753166, 0.039912618696689606, -0.014305493794381618, 0.011208520270884037, -0.032152894884347916, 0.07880552858114243, 0.00018437433755025268, 0.023859061300754547, 0.04559696465730667, -0.0014873214531689882, 0.02099526859819889, -0.0035427173133939505, 0.05194796621799469, 0.0018498339923098683, -0.0359254851937294, 0.04280564934015274, -0.04630003869533539, -0.030388573184609413, -0.05281809717416763, -0.01948641799390316, -0.012707469053566456, 0.05224069952964783, 0.021248728036880493, 0.0073423199355602264, 0.028287937864661217, 0.022334694862365723, 0.03948035091161728, 0.002585552865639329, 0.0004766006604768336, -0.08016517013311386, 0.02678968757390976, 0.004380835220217705, -0.018214086070656776, -0.037486542016267776, 0.01286601833999157, 0.008822019211947918, 0.03289462998509407, -0.010203436948359013, -0.04358633607625961, 0.0012781469849869609, 0.03709176182746887, 0.0689961165189743, -0.010837778449058533, -0.011256569996476173, -0.007492054719477892, 0.008027883246541023, 0.0769893154501915, -0.08457095175981522, -0.05956811457872391, 0.0016968686832115054, 0.04446161910891533, -0.0008316885796375573, -0.03470826521515846, 0.01216879952698946, 0.04037528857588768, -0.028793761506676674, -0.0311800017952919, 0.003212530631572008, 0.008516098372638226, 0.010070160031318665, 0.0112370690330863, 0.046278830617666245, 0.03325583413243294, 0.03349379822611809, -0.0026966349687427282, 0.09264928102493286, 0.023143094033002853, 0.017033934593200684, 0.0077901664189994335, -0.014764629304409027, 0.0021401853300631046, -0.02729937992990017, 0.011244313791394234, 0.008190467953681946, 0.05460548400878906, 0.036858100444078445, -0.0004106312117073685, -0.0017385490937158465, -0.05391129106283188, -0.0027637688908725977, 0.02649715170264244, -0.041202738881111145, 0.0024105168413370848, 0.006521948613226414, 0.008487340994179249, 0.029645025730133057, 0.00858020968735218, 0.001062452094629407, -0.028365472331643105, 0.03064894862473011, 0.013190963305532932, 0.023290125653147697, -0.018914591521024704, 0.005541299469769001, -0.01035416778177023, -0.0385802760720253, -0.06673403829336166, -0.011924883350729942, -0.014249209314584732, 0.0320327989757061, 0.021787190809845924, -0.02651236020028591, 0.0010394814889878035, -0.0020813229493796825, 0.008070804178714752, -0.004809468053281307, 0.000739922106731683, -0.01116267591714859, -0.017645396292209625, 0.008467307314276695, -0.020747952163219452, 0.006794617976993322, 0.012847714126110077, 0.005853031761944294, -0.011269240640103817, 0.0007659023976884782, 0.03379201516509056, -0.02902793511748314, -0.017147719860076904, 0.03742213174700737, -0.0011303212959319353, -0.005365921650081873, 0.0025162657257169485, -0.00589680764824152, -0.0195989441126585, 0.07770169526338577, 0.027122115716338158, -0.03253357857465744, -0.007607586681842804, -0.01787843555212021, 0.03909282013773918, 0.010662238113582134, -0.001729858573526144, 0.04298241063952446, -0.009740559384226799, 0.04819276183843613, -0.02622053399682045, 0.003793478710576892, -0.031441058963537216, -0.0000736618458176963, -0.041742559522390366, -0.012723954394459724, 0.02821533754467964, 0.011906112544238567, -0.0024072714149951935, 0.039931099861860275, -0.010703777894377708, -0.004622879903763533, -0.010176155716180801, 0.011268218979239464, 0.046801842749118805, -0.028510190546512604, 0.014646629802882671, -0.028880348429083824, 0.03737407550215721, -0.008851929567754269, -0.014387466944754124, 0.0457121767103672, -0.05334264412522316, -0.026444178074598312, 0.014868351630866528, 0.05159784480929375, -0.0010465477826073766, -0.03896202892065048, -0.04063090309500694, -0.043258022516965866, 0.015408805571496487, -0.003776481142267585, -0.014876670204102993, 0.02527715265750885, -0.007216827478259802, 0.03227797895669937, -0.014603659510612488, -0.016119282692670822, 0.04868675768375397, -0.04938890412449837, -0.005809997674077749, -0.04606794938445091, -0.01894311234354973, 0.014474957250058651, 0.0012300575617700815, 0.03693270683288574, 0.017965834587812424, -0.06392866373062134, 0.017015932127833366, -0.043003059923648834, -0.02035568282008171, -0.004472802858799696, -0.02209324948489666, 0.05034443736076355, -0.018211185932159424, 0.0020547686144709587, -0.008539734408259392, -0.029983585700392723, 0.005532704759389162, -0.06604357808828354, 0.01056800875812769, 0.03962421417236328, -0.0178214143961668, 0.029049592092633247, 0.034079812467098236, -0.017847135663032532, 0.01429841946810484, 0.017094889655709267, 0.01231527328491211, 0.006670626346021891, 0.01594744622707367, 0.004513618536293507, 0.016177987679839134, -0.04393119737505913, 0.033645469695329666, 0.02899923548102379, 0.029184788465499878, 0.01831352524459362, -0.02463129349052906, 0.03270253911614418, -0.026039741933345795, -0.009714119136333466, -0.027404334396123886, 0.027366841211915016, -0.0330934152007103, -0.02106395922601223, 0.002743589924648404, -0.0036874618381261826, -0.0009250171133317053, -0.037166692316532135, -0.005820741876959801, -0.03061467781662941, -0.0037506981752812862, -0.014424614608287811, 0.01654030941426754, 0.010624786838889122, 0.019657988101243973, 0.03394032269716263, 0.009383291937410831, -0.06584397703409195, 0.007448527030646801, 0.035799089819192886, -0.012685245834290981, 0.0076913186348974705, 0.011700574308633804, 0.019084835425019264, 0.024706197902560234, 0.03184664249420166, -0.01001137774437666, -0.015116116032004356, -0.0026164455339312553, 0.05508577823638916, -0.02921486087143421, -0.03994071111083031, 0.007737007457762957, 0.028778279200196266, 0.0032376982271671295, 0.007302948273718357, -0.07932999730110168, 0.006142462603747845, -0.02310234308242798, 0.030928155407309532, 0.017716046422719955, -0.03295627981424332, -0.023445261642336845, 0.026439156383275986, -0.00955052487552166, -0.019445620477199554, 0.015087934210896492, 0.005027263890951872, 0.03383171558380127, 0.004089113790541887, 0.026831237599253654, 0.006236222572624683, 0.02135024406015873, 0.0009763725684024394, -0.06526462733745575, -0.026391223073005676, 0.04603663831949234, 0.004756530746817589, 0.03805536404252052, 0.013628971762955189, -0.003668775549158454, -0.008857181295752525, -0.011153293773531914, -0.02584845945239067, -0.02797701023519039, -0.023280994966626167, 0.055626410990953445, 0.02189006470143795, 0.023873984813690186, 0.02529849298298359, 0.008199826814234257, -0.014647522009909153, 0.03197360783815384, 0.015472186729311943, 0.03911807760596275, 0.03714936971664429, -0.04437877982854843, -0.01348327286541462, -0.05704144015908241, 0.02233985997736454, -0.03910985216498375, 0.01834094524383545, -0.013731813989579678, 0.027234237641096115, 0.07387581467628479, -0.0027168255764991045, -0.013142911717295647, 0.04399659484624863, -0.0008494965732097626, -0.014837672002613544, -0.026996800675988197, 0.00036648366949521005, 0.004899062216281891, 0.019386548548936844, 0.015444298274815083, 0.038036637008190155, 0.0018255246104672551, 0.03297928348183632, 0.02358953095972538, -0.01224199216812849, -0.012095960788428783, -0.02760506421327591, 0.001012260909192264, -0.016776546835899353, 0.020575547590851784, -0.020022094249725342, 0.007108123041689396, 0.032850880175828934, 0.039458468556404114, 0.02355981431901455, 0.003474365919828415, 0.021671047434210777, 0.002167229540646076, 0.0014060756657272577, -0.05363345518708229, -0.010503667406737804, 0.02665582299232483, -0.0027060071006417274, -0.01912371814250946, 0.04041861370205879, -0.011569460853934288, 0.027170667424798012, 0.04994424432516098, -0.07966813445091248, 0.028339015319943428, 0.006942279636859894, -0.009414401836693287, 0.02876979671418667, -0.0045278253965079784, 0.0644674152135849, 0.012020076625049114, 0.04589593783020973, 0.02269037812948227, 0.019011376425623894, 0.013962352648377419, 0.018557751551270485, 0.023561233654618263, -0.03318816423416138, -0.017397448420524597, -0.017681453377008438, -0.0053146593272686005, -0.025647079572081566, 0.021872127428650856, -0.01102178730070591, -0.06941845268011093, -0.040274351835250854, -0.06951594352722168, -0.016336124390363693, -0.006646776106208563, -0.014017853885889053, -0.026303457096219063, 0.04827987775206566, 0.010765432380139828, -0.03884327784180641, -0.002802843926474452, 0.018432606011629105, -0.04522237554192543, -0.02252236194908619, -0.01063079945743084, 0.04012084752321243, 0.004098155535757542, -0.02144608274102211, 0.014435065910220146, -0.016222432255744934, -0.0273449569940567, -0.0010686666937544942, -0.036108363419771194, -0.05563175305724144, -0.07161439210176468, -0.028502052649855614, 0.0061760470271110535, -0.007736878003925085, 0.033112574368715286, -0.03736879676580429, -0.02782811038196087, 0.05707484856247902, 0.042355578392744064, -0.05584872141480446, -0.0002941965067293495, 0.02880672551691532, 0.016554534435272217, -0.06389983743429184, 0.013083496131002903, 0.009598728269338608, -0.01374858245253563, -0.004684214945882559, 0.02537723444402218, 0.01421617902815342, 0.01111680269241333, 0.010187075473368168, 0.02622245065867901, 0.01651061698794365, 0.025903714820742607, -0.01872791163623333, -0.00851548369973898, 0.00692698685452342, 0.011875327676534653, -0.006058833561837673, -0.007603837642818689, 0.018882935866713524, -0.008105154149234295, 0.0036953138187527657, -0.028391394764184952, -0.04474816471338272, 0.029446644708514214, 0.07077934592962265, 0.02598419599235058, -0.03987059369683266, -0.03825169429183006, 0.011894830502569675, 0.016777416691184044, 0.011647532694041729, 0.03883134946227074, -0.00009211908036377281, 0.007550826761871576, -0.06986256688833237, -0.011810355819761753, 0.028843723237514496, 0.006301483139395714, -0.023835431784391403, -0.07793068140745163, -0.036490313708782196, 0.03226008638739586, 0.03316675126552582, 0.007239470258355141, -0.04026034474372864, 0.027816029265522957, -0.04339359328150749, -0.025835156440734863, -0.03981886804103851, -0.021070439368486404, 0.03337611258029938, -0.02294539473950863, 0.016568223014473915, -0.032234057784080505, -0.01645583286881447, -0.019885338842868805, -0.01801472343504429, -0.024649616330862045, 0.04064507037401199, -0.013998950831592083, 0.029008755460381508, -0.05139259994029999, -0.05088608339428902, 0.013537611812353134, -0.07575460523366928, 0.012649370357394218, -0.0052545820362865925, -0.0034567750990390778, -0.012791239656507969, 0.017761150375008583, -0.0020202400628477335, 0.01606712117791176, 0.013791462406516075, 0.020732371136546135, -0.02010008692741394, 0.020509915426373482, 0.033182382583618164, -0.013586998917162418, -0.0342646948993206, 0.035562001168727875, 0.01415588241070509, 0.002815632615238428, 0.02833573892712593, 0.017842045053839684, 0.04446744546294212, 0.015030602924525738, 0.03684864938259125, -0.007805529050529003, -0.045202914625406265, 0.012321879155933857, 0.05880306288599968, -0.0126140546053648, 0.01096707209944725, -0.05321147292852402, -0.032642584294080734, 0.030760345980525017, 0.04075163975358009, -0.035724710673093796, -0.03250633925199509, 0.010929390788078308, -0.03035910613834858, -0.008499921299517155, -0.021364884451031685, 0.033225808292627335, -0.0023628021590411663, 0.045773401856422424, -0.02388276532292366, -0.005899759475141764 ]
Hugging Face Reads, Feb. 2021 - Long-range Transformers
VictorSanh
March 09, 2021
long-range-transformers
research, nlp
https://huggingface.co/blog/long-range-transformers
Follow-up questions * Compressive Transformer requires a special optimization schedule in which the effective batch size is progressively increased to avoid significant performance degradation for lower learning rates. This effect is not well understood and calls into more analysis. * The Compressive Transformer has many more hyperparameters compared to a simple model like BERT or GPT2: the compression rate, the compression function and loss, the regular and compressed memory sizes, etc. It is not clear whether those parameters generalize well across different tasks (other than language modeling) or similar to the learning rate, make the training also very brittle. * It would be interesting to probe the regular memory and compressed memory to analyze what kind of information is memorized through the long sequences. Shedding light on the most salient pieces of information can inform methods such as Funnel Transformer which reduces the redundancy in maintaining a full-length token-level sequence.
[ 0.0366365946829319, 0.006790484767407179, 0.00439851451665163, 0.02003137208521366, -0.0038576279766857624, 0.04241308942437172, -0.028273895382881165, 0.031430572271347046, 0.003246643580496311, -0.05356929451227188, -0.03668688237667084, 0.04002029076218605, 0.031015414744615555, 0.05629885569214821, -0.07974589616060257, -0.031951479613780975, 0.02012503519654274, 0.014312786981463432, -0.005313480272889137, 0.03868725895881653, -0.06838301569223404, -0.0447704903781414, 0.09120573848485947, -0.007431005127727985, 0.025067390874028206, 0.011654268950223923, -0.013163859955966473, -0.06236545369029045, -0.026263797655701637, 0.0028417569119483232, -0.1292857974767685, 0.018240055069327354, 0.0011112723732367158, -0.02050814963877201, -0.024684159085154533, 0.0022679741960018873, -0.10920590907335281, 0.03382985666394234, 0.03849739208817482, -0.0006425608298741281, 0.0040558986365795135, 0.048864200711250305, -0.06667108088731766, 0.019953513517975807, 0.029097547754645348, 0.03252846375107765, -0.12399327754974365, 0.0542357973754406, -0.058362141251564026, -0.08609140664339066, -0.044068653136491776, 0.12562216818332672, -0.006694628391414881, 0.007072981912642717, 0.006766452454030514, -0.01717190258204937, 0.058350175619125366, -0.002952275099232793, 0.023311791941523552, -0.001119420863687992, 0.026702798902988434, -0.0032654432579874992, 0.024656033143401146, -0.02935243956744671, 0.00191867642570287, -0.016544748097658157, -0.04797812178730965, 0.024477636441588402, -0.06359049677848816, -0.019959881901741028, 0.0020636192057281733, -0.021184399724006653, 0.026925675570964813, 0.0070710564032197, -0.0432831309735775, -0.009471334517002106, 0.02092410810291767, -0.013593040406703949, 0.018260419368743896, 0.048424698412418365, -0.014118448831140995, 0.06925126165151596, 0.057329531759023666, 0.05788251385092735, 0.009691287763416767, 0.04562760144472122, 0.023877382278442383, -0.001047626486979425, -0.09558873623609543, 0.05654049664735794, 0.0030595764983445406, -0.13727745413780212, -0.04962697997689247, 0.01578829623758793, -0.015856843441724777, -0.02079496532678604, 0.0021874140948057175, -0.00033025778247974813, -0.07020261138677597, 0.016876177862286568, 0.008370370604097843, -0.051526039838790894, 0.011791813187301159, 0.04445915296673775, -0.08728969097137451, -0.031847625970840454, -0.06484144926071167, -0.08514104783535004, 0.024001101031899452, 0.025834571570158005, -0.00651582283899188, 0.035010069608688354, -0.02751024067401886, 0.031160838901996613, -0.1034301146864891, -0.016269702464342117, 0.006349620874971151, 0.013448430225253105, -0.05183786526322365, 0.03516332805156708, -0.023807374760508537, 0.09806924313306808, 0.052276886999607086, -0.0241288673132658, -0.012990330345928669, -0.007441425696015358, 0.03021450899541378, -0.03325159475207329, 0.015205257572233677, -0.09046836942434311, 0.031011005863547325, -0.040948595851659775, -0.021629871800541878, 0.011286159045994282, -0.025462055578827858, -0.010860998183488846, -0.021584155037999153, -0.06593285501003265, -0.018908457830548286, -0.02475569397211075, -0.03653869777917862, 0.06919936835765839, -0.05314799025654793, -0.07671616971492767, 0.027758466079831123, 0.007121392525732517, -0.08620762079954147, 0.04248100891709328, 0.03839811310172081, -0.003292408073320985, -0.03218049556016922, 0.04009087383747101, -0.05438562482595444, -0.059108417481184006, 0.04217694327235222, 0.04538280889391899, -0.00942558515816927, -0.046619825065135956, -0.07807669043540955, -0.021082624793052673, -0.017148610204458237, -0.020616913214325905, -0.0057363370433449745, 0.045929986983537674, 0.004700396675616503, -0.031097544357180595, 0.017460208386182785, 0.0071685295552015305, 0.0011135126696899533, 0.0598396435379982, 0.012700664810836315, 0.06396638602018356, 0.006077047903090715, -0.008992276154458523, -0.09157329797744751, 0.028873275965452194, -0.014021756127476692, 0.05864650756120682, -0.020999768748879433, -0.06181495264172554, -0.05085962638258934, 0.049221888184547424, 0.03350256010890007, 0.057239070534706116, 0.04379124566912651, -0.1046910509467125, 0.032201167196035385, -0.018721086904406548, -0.07197996973991394, 0.01797357015311718, -0.005893485154956579, 0.0071150436997413635, 0.012702642939984798, -0.019378239288926125, 0.051345862448215485, -0.05769555643200874, 0.011519212275743484, 0.12022064626216888, 0.07366716116666794, 0.05477764829993248, 0.00790141336619854, 0.0036966565530747175, -0.01919931173324585, -0.020524615421891212, -0.022122777998447418, 0.06878560036420822, -0.015017653815448284, -0.03700381889939308, 0.031038466840982437, 0.027220020070672035, 0.03231678903102875, -0.1276630312204361, -0.04643580690026283, -0.12205158174037933, -0.007730260957032442, -0.026195762678980827, -0.016464054584503174, -0.015077282674610615, -0.0015845549060031772, 0.010781623423099518, 0.13588272035121918, -0.03598959371447563, -0.013893875293433666, 0.00411797221750021, -0.0236292015761137, 0.012892702594399452, 0.059609536081552505, -0.021353913471102715, 0.12899747490882874, -0.0763101875782013, -0.006795492488890886, -0.07469340413808823, -0.0021500512957572937, 0.03266318142414093, -0.01161160133779049, -0.014511815272271633, -0.08194178342819214, -0.03633851930499077, 0.010906729847192764, -0.019326288253068924, 0.007304972968995571, 0.047711145132780075, 0.05255778878927231, 0.06485050916671753, -0.07668941468000412, -0.020131263881921768, 0.06463818997144699, 0.02588975615799427, -0.06834636628627777, -0.011770457960665226, -0.10846514254808426, 0.10260611027479172, 0.0469077043235302, -0.08806010335683823, 0.006980505306273699, 0.013130763545632362, 0.021073220297694206, -0.015972910448908806, 0.005859175231307745, 0.02812347374856472, 0.033235978335142136, 0.004929033108055592, -0.006024162285029888, 0.0016490743728354573, 0.02062917873263359, -0.03822290897369385, 0.0019719144329428673, -0.011129849590361118, 0.009238488972187042, 0.021161289885640144, 0.031952984631061554, 0.013610570691525936, 0.0616481751203537, 0.0416729673743248, 0.0017239308217540383, -0.005215335637331009, 0.037706393748521805, -0.026217332109808922, -0.044404465705156326, -0.021717209368944168, 0.008554704487323761, -0.025732019916176796, 0.0348128080368042, 0.022481396794319153, 0.015803495422005653, 0.04340871796011925, -0.004290278535336256, -0.029531292617321014, -0.047885920852422714, -0.015786785632371902, -0.0282122865319252, 0.028342921286821365, -0.015675311908125877, -0.03080412931740284, 0.0047548683360219, 0.022138452157378197, 0.008743209764361382, -0.034255318343639374, 0.029432352632284164, 0.038747917860746384, -0.007244733162224293, 0.03098682314157486, 0.02469247579574585, 0.01202192809432745, 0.002638117643073201, 0.028209108859300613, 0.02887028641998768, 0.08269048482179642, -0.08669982850551605, -0.020437922328710556, 0.004056365229189396, -0.016814472153782845, -0.009384697303175926, -0.019708070904016495, -0.007602871395647526, 0.03984120488166809, -0.026617830619215965, 0.011424796655774117, 0.011165821924805641, 0.027590341866016388, -0.0022870416287332773, 0.017483647912740707, -0.019129334017634392, -0.02843279018998146, -0.016823234036564827, 0.007380613125860691, 0.06037783995270729, 0.024304524064064026, 0.007651913445442915, -0.006682293023914099, 0.022510264068841934, 0.00776835810393095, -0.021425308659672737, 0.031606025993824005, 0.020965170115232468, 0.050808101892471313, -0.012555571272969246, 0.005729606840759516, 0.01695832796394825, -0.009999885223805904, 0.014973384328186512, 0.023732241243124008, -0.016349509358406067, -0.0008737824973650277, 0.023307351395487785, 0.026096779853105545, 0.012547311373054981, 0.064357690513134, 0.025049153715372086, -0.01931183971464634, 0.032114237546920776, -0.02977532334625721, 0.033084020018577576, -0.0018025371246039867, 0.014322406612336636, -0.050561536103487015, -0.0020113163627684116, -0.04842231050133705, -0.011220014654099941, -0.050678979605436325, -0.026261648163199425, 0.05465589463710785, 0.05499007925391197, -0.01824558712542057, 0.0026114280335605145, -0.019407302141189575, 0.04047761112451553, 0.017885908484458923, -0.009481881745159626, 0.037764646112918854, -0.00959225557744503, 0.01521377544850111, -0.008604895323514938, 0.05234971642494202, 0.018661439418792725, -0.009248585440218449, 0.026418302208185196, 0.043848082423210144, -0.0014269910752773285, 0.03508572652935982, 0.007861074060201645, 0.007558378390967846, -0.03120039775967598, -0.0163058303296566, -0.011470222845673561, 0.02232566848397255, 0.06835523992776871, 0.04198035970330238, -0.025666268542408943, 0.0035485997796058655, -0.04095490649342537, -0.003641575574874878, 0.05737660080194473, -0.005340574309229851, 0.04444948211312294, 0.015120050869882107, 0.01824544183909893, 0.026892852038145065, 0.010223005898296833, 0.01060536876320839, 0.03540220856666565, -0.028727559372782707, -0.010545405559241772, -0.00022884614008944482, 0.030066119506955147, 0.027922622859477997, 0.003723402041941881, -0.007828881964087486, 0.028197837993502617, -0.04909973591566086, 0.010375047102570534, 0.0024192144628614187, 0.01700817421078682, 0.026696089655160904, -0.01503692101687193, 0.006303870584815741, 0.018259884789586067, -0.00714599946513772, 0.031187891960144043, -0.036728620529174805, -0.0008993903174996376, -0.013470419682562351, 0.030683791264891624, 0.01723376289010048, -0.022017713636159897, -0.033125270158052444, -0.00221791653893888, 0.007817930541932583, -0.0031664161942899227, 0.032771650701761246, 0.013564279302954674, 0.03302871435880661, 0.016158873215317726, -0.012584143318235874, 0.01760740391910076, 0.038072437047958374, -0.02925725467503071, -0.003063949989154935, -0.007280910387635231, 0.04378302022814751, -0.01919492520391941, -0.023431675508618355, 0.007052277680486441, 0.03567294031381607, 0.0007993245380930603, -0.033468928188085556, -0.002312261611223221, -0.03620124235749245, 0.016345873475074768, 0.010213903151452541, 0.013386727310717106, -0.058868974447250366, 0.024453377351164818, 0.027080636471509933, -0.01618722453713417, -0.02850942686200142, -0.01684875600039959, 0.00011708679812727496, 0.01759551651775837, -0.02554824948310852, -0.033588871359825134, 0.056091632694005966, 0.016396354883909225, -0.010715481825172901, 0.0060164774768054485, 0.04764242842793465, 0.030741771683096886, -0.00987356249243021, 0.0097291748970747, 0.013855328783392906, -0.09391128271818161, 0.011564004234969616, 0.042295727878808975, 0.007887886837124825, -0.02339165098965168, -0.0420551523566246, 0.018562739714980125, 0.0028640353120863438, 0.0022291752975434065, -0.04975467547774315, -0.0010797542054206133, -0.04001717269420624, 0.02521362341940403, 0.017827900126576424, 0.02332090586423874, 0.014502175152301788, -0.0012755704810842872, -0.03352423757314682, -0.0028171821031719446, -0.01273035816848278, 0.016160940751433372, -0.011297943070530891, 0.009148912504315376, 0.033178944140672684, 0.01000346802175045, 0.08015788346529007, -0.028445744886994362, 0.017535926774144173, 0.014356582425534725, -0.013560920022428036, 0.023491673171520233, -0.04252946376800537, -0.01276538148522377, -0.008437599055469036, 0.017712147906422615, 0.029564766213297844, -0.00711108697578311, 0.049820300191640854, 0.041962817311286926, 0.008653516881167889, -0.019261356443166733, -0.020639976486563683, 0.010728515684604645, 0.023042121902108192, -0.001109799137338996, -0.0123788733035326, -0.0004155566275585443, -0.06650079041719437, 0.0331394337117672, 0.0024421324487775564, -0.01755174621939659, -0.008482721634209156, -0.004487127065658569, -0.07129981368780136, -0.043616652488708496, 0.06573363393545151, 0.060829177498817444, 0.03939651697874069, -0.04242682829499245, 0.005594578105956316, -0.02037639357149601, 0.012688800692558289, 0.028224844485521317, -0.03268978372216225, -0.0021648816764354706, 0.009599188342690468, -0.02517264150083065, 0.02640337310731411, 0.02940100058913231, -0.04010636731982231, -0.020122691988945007, 0.036027126014232635, -0.003279472468420863, -0.01362132653594017, 0.002045834669843316, 0.0655863806605339, -0.004647891037166119, -0.013125537894666195, -0.0030659909825772047, -0.04839972406625748, -0.02967805042862892, 0.021062517538666725, -0.06527715176343918, 0.047946128994226456, 0.07128246128559113, -0.016393257305026054, -0.026678182184696198, 0.0014483424602076411, 0.06843183934688568, -0.009768021292984486, -0.026821954175829887, 0.0004452702996786684, -0.012570254504680634, -0.00219500414095819, -0.04054754599928856, -0.011698536574840546, 0.006047697272151709, -0.005882894154638052, 0.033561546355485916, -0.04963500425219536, 0.03597206622362137, 0.042541928589344025, -0.03227010741829872, 0.0249590165913105, 0.02984655648469925, 0.003081962466239929, 0.01682707481086254, -0.011423764750361443, -0.015172697603702545, 0.04552575200796127, 0.0020279299933463335, 0.014940489083528519, -0.007776681799441576, 0.007570331450551748, 0.011565509252250195, 0.035458773374557495, 0.014719507656991482, 0.016627289354801178, 0.025061793625354767, 0.013673007488250732, 0.03904225304722786, 0.015778379514813423, -0.0007281722500920296, -0.028480669483542442, 0.034937527030706406, 0.015225018374621868, 0.003823371371254325, -0.013576783239841461, 0.010215471498668194, -0.013080512173473835, 0.0028342981822788715, -0.0038796020671725273, -0.033224303275346756, -0.007432204205542803, -0.005039440933614969, -0.027746401727199554, 0.013739503920078278, 0.006859580520540476, 0.024414438754320145, 0.03440764918923378, 0.03562457486987114, -0.015815237537026405, 0.008684837259352207, 0.028460893779993057, 0.04309878870844841, -0.01889554224908352, 0.03945307433605194, -0.016558796167373657, -0.028801102191209793, 0.031653694808483124, 0.024341613054275513, 0.03239302709698677, -0.0047971769236028194, -0.057343490421772, 0.007525444962084293, -0.0033937529660761356, -0.005885730497539043, -0.0017126811435446143, 0.020627832040190697, -0.023032017052173615, 0.010460039600729942, 0.019489455968141556, -0.05181654915213585, 0.06273850053548813, -0.004087274428457022, 0.035493042320013046, 0.0006082723848521709, -0.006079019512981176, -0.026580918580293655, 0.051256269216537476, -0.036110274493694305, -0.06597259640693665, 0.014520646072924137, -0.03843669965863228, -0.0028025817591696978, 0.04846915230154991, -0.029560565948486328, -0.03518692031502724, -0.0029395846650004387, -0.01867177151143551, 0.012760305777192116, 0.03548215702176094, 0.001964010763913393, 0.005741915665566921, 0.04899153485894203, 0.01895095221698284, 0.009814925491809845, 0.022597314789891243, 0.011691990308463573, -0.025643721222877502, -0.05610330030322075, 0.027174420654773712, -0.0004014135629404336, -0.01277462113648653, 0.021482964977622032, -0.0630561113357544, -0.012728785164654255, 0.016972916200757027, 0.0346754752099514, 0.010330334305763245, 0.03712014481425285, -0.040445879101753235, 0.01770745776593685, -0.022063804790377617, -0.03347383067011833, 0.008347139693796635, 0.00021452856890391558, 0.04639780521392822, -0.036525752395391464, -0.012050413526594639, -0.03760457783937454, -0.022366590797901154, -0.0036002029664814472, 0.049178291112184525, 0.054545771330595016, 0.01317182183265686, -0.010163390077650547, 0.00010197590017924085, 0.0452938973903656, 0.005824198946356773, 0.009888515807688236, 0.016101306304335594, 0.018415387719869614, 0.012476406991481781, -0.021832244470715523, 0.01002553291618824, -0.007740264292806387, -0.007664009928703308, -0.054937951266765594, -0.041739147156476974, -0.024296151474118233, 0.02398061379790306, -0.01945367269217968, 0.011052407324314117, -0.0737016424536705, -0.01120554655790329, 0.0011168821947649121, -0.015132879838347435, -0.031817477196455, 0.00261450232937932, 0.04803222417831421, -0.0008167856140062213, 0.020511945709586143, -0.004276146646589041, -0.033160533756017685, -0.0064086634665727615, 0.01659323275089264, 0.04609169065952301, 0.04354820400476456, 0.023510094732046127, -0.028158729895949364, -0.03154970332980156, -0.012179874815046787, 0.01379849761724472, -0.03791370615363121, -0.005037483759224415, 0.011756697669625282, -0.005049253348261118, 0.013814295642077923, -0.02195068635046482, 0.026030408218503, 0.012625990435481071, 0.04682135954499245, 0.020249493420124054, -0.03813204914331436, -0.0014668167568743229, -0.0019039029721170664, -0.009650436230003834, -0.04553687945008278, -0.016412975266575813, -0.007101483643054962, 0.037523303180933, 0.03967760503292084, 0.016336552798748016, 0.0016565279802307487, -0.018541889265179634, 0.03323964774608612, -0.009853856638073921, -0.031552866101264954, -0.01831413060426712, 0.05203152820467949, 0.010811630636453629, 0.012280711904168129, -0.03157420456409454, 0.042087260633707047, 0.004408714827150106, 0.010603121481835842, 0.03419417515397072, -0.006437245290726423, 0.00003257180651417002, -0.020390991121530533, 0.014805560931563377, -0.040888652205467224, 0.021976493299007416, 0.007186324335634708, 0.0003412791993469, -0.01855733059346676, -0.018618440255522728 ]
Hugging Face Reads, Feb. 2021 - Long-range Transformers
VictorSanh
March 09, 2021
long-range-transformers
research, nlp
https://huggingface.co/blog/long-range-transformers
Main findings * The self-attention matrix is low-rank which implies that most of its information can be recovered by its first few highest eigenvalues and can be approximated by a low-rank matrix. * Lot of works focus on reducing the dimensionality of the hidden states. This paper shows that reducing the sequence length with learned projections can be a strong alternative while shrinking the memory complexity of the self-attention from quadratic to linear. * Increasing the sequence length doesn’t affect the inference speed (time-clock) of Linformer, when transformers have a linear increase. Moreover, the convergence speed (number of updates) is not impacted by Linformer's self-attention. Figure taken from Linformer
[ 0.04782044142484665, -0.0716656967997551, 0.08420658856630325, -0.010868367739021778, -0.06439705193042755, 0.04921693354845047, 0.016749896109104156, 0.033661890774965286, 0.011960155330598354, -0.007745514623820782, 0.0011344553204253316, 0.07436851412057877, -0.05619915947318077, 0.005002904217690229, -0.03990525007247925, 0.009746899828314781, 0.047159209847450256, 0.00029475646442733705, -0.025208810344338417, 0.016955848783254623, 0.021025480702519417, -0.043013524264097214, 0.08863700181245804, -0.02494906447827816, -0.0038896012119948864, 0.01430380530655384, 0.0028985345270484686, 0.008657514117658138, -0.04985029250383377, -0.01799820549786091, -0.12327605485916138, -0.04214652627706528, 0.024979015812277794, -0.03945378586649895, -0.018770115450024605, -0.005141390021890402, -0.06360029429197311, 0.019824916496872902, 0.01623918116092682, 0.007150045596063137, -0.032334525138139725, 0.029005583375692368, -0.10356553643941879, 0.06058603897690773, -0.036965783685445786, -0.018096797168254852, -0.12241735309362411, 0.05636103078722954, -0.07136314362287521, -0.03759624436497688, -0.024441363289952278, 0.0106732826679945, -0.02338957041501999, 0.11089840531349182, 0.011068759486079216, -0.001797832315787673, 0.07293351739645004, 0.0016161449020728469, -0.04358486458659172, 0.008575201034545898, -0.014826608821749687, -0.04638214036822319, 0.020284457132220268, 0.04406354948878288, 0.030947228893637657, -0.025714345276355743, 0.08178997784852982, -0.0071972948499023914, -0.04406844824552536, 0.01441163383424282, -0.07556468993425369, -0.006602080073207617, -0.006922556087374687, 0.010016960091888905, -0.03624935820698738, -0.03417932242155075, 0.012162626720964909, 0.06058526039123535, -0.0025062074419111013, -0.0840158462524414, 0.0350043885409832, 0.07223913073539734, 0.028732098639011383, 0.022029967978596687, 0.005045993719249964, -0.02584933489561081, 0.016751861199736595, -0.05110861361026764, -0.06398926675319672, 0.007620240096002817, -0.0700216144323349, -0.07943062484264374, -0.02683139778673649, -0.006079613231122494, 0.02841619960963726, -0.023539695888757706, 0.02226780541241169, 0.037829361855983734, -0.03625166788697243, -0.04293995723128319, 0.01092122308909893, -0.018802782520651817, 0.04635456204414368, -0.040559276938438416, -0.04248228296637535, -0.028426386415958405, -0.022248944267630577, -0.04547342658042908, -0.06052807718515396, -0.013597146607935429, -0.07956421375274658, 0.11653778702020645, 0.020809534937143326, 0.04548656940460205, -0.08343783766031265, 0.060780372470617294, -0.001947656855918467, 0.033146798610687256, 0.013016332872211933, 0.02858031913638115, -0.03561908379197121, 0.10591574013233185, 0.05718351900577545, 0.009249798953533173, 0.03669934347271919, -0.010363953188061714, -0.028400860726833344, -0.011055671609938145, 0.02845291793346405, 0.02748328261077404, -0.000795660656876862, -0.02429673634469509, -0.006300619803369045, 0.01708003506064415, -0.02875469997525215, -0.04310113564133644, 0.016402466222643852, -0.02197554148733616, -0.00005927014353801496, 0.012623557820916176, -0.08099537342786789, -0.020356006920337677, 0.06289181858301163, -0.07977307587862015, 0.0712502971291542, -0.04350171238183975, -0.09926241636276245, 0.06525786966085434, 0.07447142153978348, 0.03767985850572586, -0.03197310119867325, 0.023126725107431412, -0.028227034956216812, -0.09700755774974823, 0.014224812388420105, -0.023678842931985855, 0.03061598539352417, -0.03085579164326191, -0.08418528735637665, -0.005126722157001495, -0.04126632586121559, 0.03697429224848747, 0.009080749936401844, 0.04075499624013901, 0.047378066927194595, -0.08166413754224777, 0.020546194165945053, -0.003024654695764184, 0.02848283015191555, 0.008748531341552734, 0.01447558868676424, 0.06841413676738739, 0.059807781130075455, 0.012483710423111916, -0.07736509293317795, 0.031524889171123505, -0.04650796949863434, 0.05760154873132706, 0.019298264756798744, -0.0857158824801445, 0.011143548414111137, -0.01762094907462597, -0.040955688804388046, 0.032711420208215714, 0.0312517024576664, -0.03203952684998512, 0.03295250982046127, 0.02063319832086563, -0.03341970592737198, -0.08546242862939835, -0.036471545696258545, 0.007808522786945105, 0.02712971344590187, -0.022759411484003067, 0.033424366265535355, 0.019439684227108955, -0.054999493062496185, 0.10673470050096512, 0.041042666882276535, 0.029535846784710884, 0.029469428583979607, 0.03095141239464283, 0.03535369038581848, 0.04402691498398781, 0.03580920398235321, -0.02615983411669731, -0.060789212584495544, 0.007295298855751753, 0.060409341007471085, 0.012510078959167004, 0.028988264501094818, -0.09969881176948547, -0.0440470315515995, -0.03001873381435871, -0.022149769589304924, 0.0032217656262218952, 0.004155913833528757, 0.05623027682304382, 0.010045059956610203, -0.000846508308313787, 0.04538827762007713, 0.03343113139271736, -0.11038632690906525, 0.06015770137310028, -0.01978861540555954, 0.010147529654204845, -0.008901020511984825, -0.08055095374584198, 0.02280675247311592, 0.04464751482009888, -0.019825339317321777, -0.06534469872713089, 0.03821879252791405, 0.02838471531867981, -0.021194370463490486, -0.032279420644044876, -0.05668569356203079, -0.02100018598139286, -0.034618839621543884, -0.0844254419207573, 0.026432538405060768, -0.003703440073877573, 0.005522352177649736, 0.04067423939704895, -0.02798193134367466, 0.005046377424150705, 0.00004104986146558076, 0.005643586628139019, -0.020891014486551285, 0.025984229519963264, -0.12362552434206009, 0.0884157121181488, 0.022203650325536728, -0.08495116978883743, 0.04319735988974571, -0.00022244988940656185, -0.003125767456367612, -0.03644099086523056, 0.02168717421591282, 0.003710313467308879, 0.016240529716014862, 0.03785640373826027, -0.013652520254254341, 0.03534301370382309, -0.00830724835395813, -0.03764752298593521, 0.007686156313866377, 0.0205569826066494, 0.003256063675507903, 0.0311123076826334, -0.007327752187848091, 0.01751447282731533, 0.005015956237912178, 0.02889297716319561, -0.0006162662757560611, -0.03716311976313591, 0.02976495958864689, -0.011566749773919582, -0.013024844229221344, -0.020340297371149063, 0.008640310727059841, 0.029032636433839798, 0.018988369032740593, -0.005013179965317249, 0.017036963254213333, 0.0157263595610857, 0.005592797417193651, 0.01953003741800785, -0.01876237988471985, -0.019758688285946846, -0.019614480435848236, 0.00899499747902155, -0.02419235371053219, -0.04383351653814316, -0.05247637629508972, 0.02159019373357296, 0.011533881537616253, -0.007891636341810226, 0.02988937310874462, -0.05098384618759155, -0.003448907984420657, 0.03377832844853401, 0.05552038550376892, 0.004477708600461483, -0.0250447615981102, 0.044400107115507126, -0.0005045396974310279, 0.023577431216835976, -0.07839801907539368, -0.07627024501562119, -0.003307306906208396, 0.03193853795528412, 0.018585562705993652, -0.015744805335998535, -0.012989282608032227, 0.05521742254495621, -0.03294631093740463, -0.02803441323339939, -0.021725306287407875, 0.0014770746929571033, 0.0185711570084095, 0.02048579417169094, 0.0017811278812587261, 0.02073027566075325, 0.03727273270487785, 0.019070105627179146, 0.0690334364771843, -0.003995480015873909, 0.05507476627826691, -0.000797111657448113, -0.01394442468881607, 0.011769174598157406, -0.030437633395195007, 0.010348331183195114, 0.004586091730743647, 0.05789772421121597, 0.021035516634583473, -0.02974761836230755, -0.003084265859797597, -0.038945384323596954, -0.013737929053604603, 0.022435083985328674, -0.03769424557685852, 0.028297260403633118, -0.002865058835595846, -0.0017786513781175017, 0.015668869018554688, 0.014146765694022179, 0.02900570258498192, -0.026284517720341682, 0.020095644518733025, 0.024286845698952675, 0.029245536774396896, -0.020730316638946533, 0.012707901187241077, -0.03073614276945591, -0.02004120871424675, -0.07885031402111053, -0.005955768283456564, -0.0175782423466444, 0.020839067175984383, 0.00911986269056797, -0.03241802379488945, -0.012335625477135181, 0.025646110996603966, -0.028963999822735786, -0.03160883113741875, 0.028147172182798386, -0.037582047283649445, 0.033870261162519455, 0.009317152202129364, 0.011756586842238903, -0.003952269442379475, 0.050558023154735565, 0.017118699848651886, 0.010621117427945137, 0.03414040431380272, 0.006299519445747137, -0.0378224216401577, -0.00971494521945715, 0.01932600885629654, -0.017744319513440132, 0.027805976569652557, 0.020541319623589516, 0.003299474949017167, 0.012601634487509727, 0.07509078830480576, 0.005315286573022604, -0.05600350722670555, 0.022701498121023178, -0.01785566285252571, 0.06066957861185074, 0.012252775952219963, 0.01867651380598545, -0.007958530448377132, 0.022623958066105843, 0.046163272112607956, -0.010159519501030445, 0.007753088138997555, -0.04475730285048485, 0.03337746113538742, -0.06515970826148987, -0.006682622712105513, 0.05123772472143173, 0.03340928629040718, 0.009736686013638973, 0.0419006422162056, 0.006014017388224602, 0.008804011158645153, 0.004484065342694521, 0.024881748482584953, 0.028516987338662148, -0.03903673589229584, 0.04611074551939964, -0.010987164452672005, 0.014840959571301937, -0.021090777590870857, -0.02560052089393139, 0.007832838222384453, -0.03017505817115307, 0.02108362689614296, 0.02194879949092865, 0.06474129110574722, 0.0155630586668849, -0.047361526638269424, -0.03080177865922451, -0.0016320953145623207, 0.005694416351616383, -0.01702052168548107, 0.0011475908104330301, -0.008171145804226398, -0.027555450797080994, 0.014702480286359787, 0.022178126499056816, -0.023685738444328308, 0.05823366343975067, -0.011033543385565281, -0.05005796253681183, -0.02452477253973484, 0.009336707182228565, 0.044949788600206375, 0.004184079822152853, 0.034198712557554245, 0.01315381471067667, -0.028403058648109436, 0.021734539419412613, -0.05129944160580635, -0.0028216091450303793, -0.008598500862717628, 0.0053596277721226215, 0.034051623195409775, -0.041144195944070816, -0.016199126839637756, -0.026330310851335526, -0.01708517037332058, 0.0032260229345411062, -0.03658425435423851, -0.00010181809921050444, 0.08184891939163208, -0.0066503239795565605, 0.013759471476078033, 0.03401005268096924, 0.011453310027718544, 0.0008766756509430707, -0.002454822650179267, -0.009868262335658073, -0.0019308110931888223, -0.02392147108912468, -0.018561528995633125, 0.008252299390733242, -0.040999382734298706, 0.028238555416464806, 0.025454502552747726, -0.02707015350461006, 0.016002492979168892, -0.010408884845674038, 0.035388097167015076, -0.0008005704148672521, -0.011224348098039627, -0.038032416254282, 0.014560953713953495, -0.041599661111831665, -0.010215803049504757, 0.004093571566045284, 0.02725062146782875, -0.03501812368631363, -0.008228692226111889, -0.003740127431228757, -0.0018838047981262207, 0.009837420657277107, 0.019435521215200424, 0.002262731781229377, 0.005530851427465677, -0.02900068834424019, 0.0113445483148098, 0.03649163246154785, -0.057871013879776, -0.01881956309080124, 0.04855005443096161, 0.03029649890959263, -0.03806668147444725, -0.012007790617644787, 0.05333230644464493, -0.014006356708705425, 0.061558861285448074, -0.014690288342535496, -0.03790361061692238, 0.03881513699889183, 0.03255930170416832, 0.018272418528795242, -0.030241161584854126, -0.017146682366728783, 0.02184543013572693, -0.004478523042052984, 0.02110215649008751, 0.004743466153740883, 0.009874067269265652, -0.008839369751513004, 0.01572307012975216, 0.028940964490175247, -0.020664168521761894, -0.013571971096098423, -0.007951200008392334, -0.02301711030304432, -0.01326002273708582, 0.04057091474533081, 0.024656232446432114, 0.015148217789828777, 0.0037952212151139975, -0.012216946110129356, -0.01995040662586689, 0.020280439406633377, 0.02130698226392269, -0.05319666117429733, -0.044166162610054016, 0.02752547897398472, 0.004146364983171225, 0.014218112453818321, 0.012619390152394772, -0.00003433947131270543, -0.03342172130942345, 0.009821471758186817, -0.019213654100894928, -0.05690501630306244, -0.038715556263923645, 0.04545198753476143, 0.05382495000958443, 0.035896625369787216, 0.011323658749461174, 0.008517534472048283, -0.013871022500097752, 0.027740487828850746, -0.0004519587673712522, 0.062413185834884644, 0.06457941979169846, -0.011846262961626053, -0.031924113631248474, -0.022798078134655952, 0.06616491079330444, -0.03397955745458603, 0.03499818593263626, 0.004657648969441652, 0.00822444073855877, 0.02733418717980385, 0.03819208964705467, -0.017336543649435043, 0.03514135256409645, 0.010728152468800545, -0.05508360639214516, -0.014192329719662666, 0.017156897112727165, 0.005223038140684366, -0.016734598204493523, 0.011595278047025204, 0.040585216134786606, 0.02129920944571495, 0.046716272830963135, 0.049445103853940964, 0.03009248897433281, -0.048272404819726944, 0.006466810125857592, 0.016156574711203575, -0.027350937947630882, 0.025460509583353996, 0.03452156111598015, 0.03556004539132118, 0.05235937610268593, 0.034856341779232025, 0.04410908371210098, 0.005646927282214165, 0.05401552468538284, -0.023502089083194733, 0.005929605569690466, -0.04955531656742096, -0.010983096435666084, -0.015651710331439972, 0.01917986199259758, -0.04143505543470383, 0.0354849137365818, 0.03164878115057945, 0.06471936404705048, 0.03127454221248627, -0.04426557198166847, 0.020137032493948936, 0.015788333490490913, 0.022167887538671494, 0.04105907306075096, 0.008225190453231335, 0.029136057943105698, 0.01202318724244833, 0.06116124987602234, 0.005244693718850613, -0.023387499153614044, 0.011705948039889336, 0.04685838520526886, 0.051902297884225845, 0.018212424591183662, 0.004462577868252993, -0.02455001324415207, -0.0064284163527190685, 0.009588905610144138, 0.02187635935842991, -0.0025661769323050976, -0.06692811846733093, -0.005607513710856438, -0.025605840608477592, -0.027377039194107056, 0.013387255370616913, 0.013356370851397514, -0.027081746608018875, 0.03850897029042244, 0.007017047144472599, -0.01999426633119583, 0.011506862938404083, 0.04200845956802368, -0.020021041855216026, -0.02852521650493145, -0.007680660113692284, 0.05808518826961517, 0.012086019851267338, -0.02525995671749115, 0.018685366958379745, -0.017322678118944168, -0.017853468656539917, 0.021687520667910576, -0.01959904097020626, -0.018525373190641403, -0.023669682443141937, 0.01792152412235737, -0.0007734408718533814, -0.00025002777692861855, 0.04583638533949852, -0.04743722826242447, -0.004303580150008202, 0.050998710095882416, 0.030544424429535866, -0.04718770459294319, 0.030826346948742867, 0.010784117504954338, 0.0015299111837521195, -0.06327365338802338, -0.00652208412066102, -0.022144079208374023, -0.039821967482566833, 0.02657485194504261, -0.012878749519586563, -0.014349603094160557, 0.009692509658634663, 0.03655003383755684, 0.008684005588293076, 0.018480397760868073, 0.00814916379749775, 0.017050620168447495, 0.022741850465536118, -0.022917671129107475, -0.00952987466007471, -0.00467121135443449, 0.010217764414846897, -0.0317988283932209, -0.013209732249379158, 0.0211956650018692, -0.07360267639160156, -0.041620779782533646, 0.0431603379547596, 0.05373840406537056, 0.04051152616739273, -0.026224255561828613, -0.005994383245706558, -0.0027224686928093433, -0.00827631913125515, 0.0023745461367070675, 0.039908189326524734, -0.018730148673057556, 0.05573568865656853, -0.08313343673944473, -0.04658026620745659, 0.005369873251765966, 0.013254500925540924, -0.02026611566543579, -0.04462365433573723, -0.06780895590782166, 0.04522572457790375, -0.0007881042547523975, 0.011398888193070889, -0.01936580426990986, 0.037294041365385056, -0.05024557560682297, 0.022703032940626144, -0.02274717576801777, 0.02593420445919037, 0.03834259510040283, -0.008903278969228268, 0.010622884146869183, 0.01215394027531147, -0.004658145364373922, -0.03412506729364395, -0.02541901171207428, 0.013531890697777271, 0.01649855077266693, -0.025080790743231773, 0.007516690995544195, -0.06160841882228851, -0.034371085464954376, 0.0036347899585962296, -0.031663693487644196, 0.030170870944857597, -0.0028588802088052034, -0.0043886639177799225, 0.03172288462519646, -0.011174065060913563, 0.006634197197854519, 0.0554761067032814, 0.03773766756057739, 0.025332804769277573, -0.03578810766339302, 0.01149759441614151, -0.0030762935057282448, -0.023699967190623283, -0.031721387058496475, 0.034280918538570404, 0.0392366424202919, 0.05458567664027214, -0.006004560273140669, 0.02019985020160675, 0.026460466906428337, -0.004247594159096479, 0.03568699583411217, -0.011848719790577888, -0.04034876823425293, -0.029371103271842003, 0.04101715236902237, 0.001140157924965024, -0.007823360152542591, -0.06436566263437271, -0.009265373460948467, 0.024642232805490494, 0.03538902848958969, -0.022912707179784775, -0.07122188061475754, 0.003966819494962692, -0.02041519246995449, 0.024826178327202797, -0.04525972530245781, 0.02107393555343151, -0.008711677975952625, 0.033363599330186844, -0.03500387817621231, -0.026535898447036743 ]
Hugging Face Reads, Feb. 2021 - Long-range Transformers
VictorSanh
March 09, 2021
long-range-transformers
research, nlp
https://huggingface.co/blog/long-range-transformers
Rethinking Attention with Performers Krzysztof Choromanski, Valerii Likhosherstov, David Dohan, Xingyou Song, Andreea Gane, Tamas Sarlos, Peter Hawkins, Jared Davis, Afroz Mohiuddin, Lukasz Kaiser, David Belanger, Lucy Colwell, Adrian Weller The goal is (again!) to reduce the complexity of the self-attention with respect to the sequence length \(n\)) from quadratic to linear. In contrast to other papers, the authors note that the sparsity and low-rankness priors of the self-attention may not hold in other modalities (speech, protein sequence modeling). Thus the paper explores methods to reduce the memory burden of the self-attention without any priors on the attention matrix. The authors observe that if we could perform the matrix multiplication \(K × V\) through the softmax ( \(\text{softmax}(Q × K) × V\) ), we wouldn’t have to compute the \(Q x K\) matrix of size \(n x n\) which is the memory bottleneck. They use random feature maps (aka random projections) to approximate the softmax by: $$\text{softmax}(Q * K) \sim Q’ * K’ = \phi(Q) * \phi(K)$$ , where \(phi\) is a non-linear suitable function. And then: $$\text{Attention}(Q, K, V) \sim \phi(Q) * (\phi(K) * V)$$ Taking inspiration from machine learning papers from the early 2000s, the authors introduce FAVOR+ (Fast Attention Via Orthogonal Random positive (+) Features) a procedure to find unbiased or nearly-unbiased estimations of the self-attention matrix, with uniform convergence and low estimation variance.
[ 0.03628731891512871, 0.007223799359053373, 0.01275111734867096, -0.053896714001894, -0.052487149834632874, 0.062074366956949234, -0.046113889664411545, 0.008426018059253693, -0.010336825624108315, -0.019936036318540573, -0.04439117759466171, 0.07104387879371643, -0.0710306167602539, -0.055015191435813904, -0.016024701297283173, 0.08759649097919464, 0.07492970675230026, -0.051058266311883926, 0.018588664010167122, -0.017406094819307327, 0.006017612759023905, 0.012290380895137787, 0.03885161504149437, -0.035237934440374374, -0.042094457894563675, 0.007235972676426172, -0.0025049750693142414, 0.019152890890836716, -0.03024674952030182, -0.051718082278966904, -0.1209806278347969, 0.03165329992771149, 0.06528989225625992, 0.013165167532861233, -0.031020980328321457, -0.023441510275006294, -0.0504775196313858, 0.030639739707112312, 0.04138508811593056, -0.02029879204928875, 0.014173765666782856, 0.0186492670327425, -0.11425097286701202, 0.07137741893529892, -0.05896609649062157, -0.0807933360338211, -0.08833099901676178, 0.04200177639722824, -0.1035919338464737, -0.017275135964155197, 0.03495271876454353, 0.037353046238422394, 0.015937406569719315, 0.06232839450240135, -0.026082316413521767, -0.0566430538892746, 0.021188829094171524, -0.05423349887132645, -0.02956433780491352, -0.009232570417225361, -0.021145200356841087, 0.014549502171576023, -0.00790834054350853, 0.019698331132531166, 0.04159579798579216, -0.007695973850786686, 0.08633509278297424, 0.02061050944030285, -0.05871856212615967, 0.026649393141269684, -0.003988299984484911, 0.0041094692423939705, -0.025328969582915306, 0.010444803163409233, -0.01470540463924408, -0.03721277788281441, 0.055792659521102905, 0.055250901728868484, 0.02941051498055458, -0.041526492685079575, 0.06436489522457123, 0.028082210570573807, 0.10493141412734985, 0.037239305675029755, -0.010024297051131725, -0.01751473732292652, 0.06421685963869095, -0.045090701431035995, -0.06529149413108826, 0.00854305736720562, -0.09575864672660828, -0.08837798237800598, 0.026236094534397125, -0.0008479878888465464, 0.035617977380752563, -0.03056846186518669, 0.0019470847910270095, -0.044998981058597565, -0.04743557050824165, -0.054554544389247894, -0.017894862219691277, -0.007225120905786753, 0.03262006491422653, -0.13048312067985535, -0.06625217944383621, 0.01837081089615822, 0.0298449769616127, -0.04960821941494942, -0.06974419951438904, 0.013931763358414173, -0.020916936919093132, 0.08317804336547852, -0.0007096290937624872, 0.03555556759238243, -0.060559116303920746, 0.051542941480875015, -0.006889914628118277, 0.02187603898346424, -0.035502102226018906, 0.014538636431097984, -0.05070078745484352, 0.1043270006775856, 0.06950480490922928, -0.023791667073965073, -0.032273005694150925, 0.021352551877498627, 0.02784436196088791, 0.02501218020915985, -0.010635729879140854, 0.015536201186478138, 0.04570939391851425, -0.06466154009103775, 0.010630425997078419, 0.02955622784793377, -0.027547841891646385, -0.025627175346016884, 0.030135449022054672, -0.03663859888911247, -0.05427972972393036, -0.04278504103422165, -0.004392429254949093, -0.010436559095978737, 0.04571566358208656, -0.042139068245887756, 0.10120540112257004, -0.06880452483892441, -0.06685063242912292, 0.09046190232038498, 0.06397151201963425, 0.033326875418424606, 0.013661534525454044, 0.016308996826410294, -0.0198451466858387, -0.04749993979930878, -0.008531174622476101, 0.027514129877090454, 0.03687596321105957, -0.05809434503316879, -0.0132494131103158, 0.046060532331466675, -0.012295756489038467, 0.05434205010533333, -0.04035264998674393, 0.015410305932164192, -0.005445449613034725, -0.00165357009973377, -0.03259313479065895, 0.03900677710771561, -0.006544726900756359, 0.05809721350669861, 0.02738618105649948, 0.046904731541872025, 0.03883170709013939, 0.01691478304564953, -0.04717511311173439, 0.027397628873586655, -0.031311314553022385, 0.09125887602567673, 0.002991942223161459, -0.013212849386036396, -0.0665060356259346, -0.021812476217746735, 0.013541221618652344, 0.02861247956752777, 0.025324583053588867, -0.03026343509554863, 0.05316205322742462, -0.00933639146387577, 0.003494151635095477, -0.03425957262516022, -0.06719595938920975, 0.028207987546920776, -0.002799617825075984, 0.004561834968626499, 0.010771038010716438, 0.036059118807315826, -0.01682332158088684, 0.03481833636760712, 0.048184774816036224, 0.06652242690324783, 0.06937453895807266, -0.0051339976489543915, 0.04570282995700836, 0.03343768045306206, -0.00885794498026371, -0.007512564770877361, -0.03849862888455391, -0.04682885482907295, 0.033922724425792694, -0.03592442348599434, -0.022192010655999184, -0.07570380717515945, -0.01172489020973444, 0.018167955800890923, -0.006081840023398399, 0.014466922730207443, 0.053703755140304565, 0.0541134811937809, -0.027550509199500084, -0.05375811830163002, 0.17476153373718262, 0.014295336790382862, -0.06933553516864777, 0.03570279851555824, -0.030534785240888596, 0.030174080282449722, 0.026235781610012054, -0.026705127209424973, 0.010446607135236263, 0.012217785231769085, -0.011208999902009964, -0.013550164178013802, 0.055448923259973526, -0.006539925932884216, 0.01297969464212656, 0.004199541173875332, -0.03505470231175423, 0.024871790781617165, -0.024720121175050735, -0.07305311411619186, 0.010856608860194683, 0.019421974197030067, -0.011006548069417477, 0.09435267001390457, -0.05892740935087204, -0.0018205142114311457, 0.011418875306844711, -0.009379956871271133, -0.051962606608867645, 0.009543314576148987, -0.06900525838136673, 0.0669628381729126, 0.010773112066090107, -0.022320682182908058, 0.005818541161715984, 0.08837241679430008, -0.007572091184556484, -0.04864304140210152, -0.011534255929291248, -0.004470003768801689, 0.028515519574284554, 0.005704276729375124, 0.0008468220476061106, 0.024606626480817795, 0.0037891436368227005, -0.05274425446987152, 0.03451729193329811, 0.017578192055225372, 0.011576849035918713, 0.008334849961102009, 0.04419811815023422, 0.01756005920469761, -0.01934424228966236, 0.017323587089776993, -0.03412158042192459, 0.017167523503303528, 0.03023493103682995, -0.053862106055021286, -0.002098657889291644, -0.058614399284124374, -0.005840929225087166, 0.027585364878177643, 0.04428049921989441, 0.01573272980749607, -0.003530724672600627, 0.0018913305830210447, -0.01242922805249691, 0.005733834579586983, -0.02604074403643608, 0.0021136312279850245, -0.006808542646467686, 0.056516099721193314, -0.006492625456303358, -0.0364878885447979, -0.0570041723549366, 0.015058139339089394, -0.0008123851730488241, 0.023090025410056114, -0.020984087139368057, -0.008540297858417034, -0.03884262219071388, -0.005488184746354818, 0.005002936348319054, 0.02292189560830593, 0.010490786284208298, 0.021699368953704834, 0.03195938467979431, 0.0422569140791893, -0.07621026784181595, -0.08075037598609924, -0.016721853986382484, 0.05613899230957031, -0.010016169399023056, -0.036116041243076324, 0.01732904091477394, 0.008597384206950665, -0.04772840067744255, -0.004427384585142136, -0.017807329073548317, 0.00961397122591734, -0.004506890196353197, 0.0026493456680327654, 0.00629369355738163, 0.02669338881969452, 0.010068465024232864, -0.0019054542062804103, 0.055318720638751984, 0.005016634706407785, 0.027246439829468727, 0.03592924028635025, -0.015892794355750084, -0.06817349791526794, -0.03025146573781967, 0.025336911901831627, 0.019958531484007835, 0.030104858800768852, 0.03178343549370766, 0.02056760899722576, 0.001011954853311181, -0.039859041571617126, 0.015121950767934322, 0.017243489623069763, -0.014924656599760056, 0.03311903029680252, -0.03187466785311699, 0.0327862948179245, 0.004479262046515942, 0.04077991098165512, 0.02453884482383728, -0.030165519565343857, 0.01813136786222458, -0.009205860085785389, 0.01908445544540882, -0.0009156023734249175, 0.013190110214054585, 0.008753306232392788, 0.0002935620432253927, -0.06332482397556305, -0.04681449756026268, -0.008954157121479511, 0.021793803200125694, 0.02939068153500557, -0.013321894221007824, -0.028550192713737488, 0.03889976069331169, -0.004926551133394241, 0.004965192638337612, 0.009971384890377522, -0.010117141529917717, 0.02238033525645733, 0.02867021970450878, -0.045767880976200104, 0.009347827173769474, 0.025002218782901764, 0.03889115899801254, 0.007468661293387413, -0.006260198075324297, 0.00995472352951765, 0.020213492214679718, -0.05838150903582573, 0.00024082782329060137, -0.015345695428550243, -0.006252181716263294, 0.03432057797908783, 0.046280864626169205, 0.005102534778416157, 0.043642036616802216, 0.007639148272573948, -0.044626228511333466, -0.01858719252049923, -0.026443371549248695, 0.00614570826292038, 0.012381536886096, -0.019259829074144363, 0.023026691749691963, 0.015891583636403084, 0.03043362870812416, -0.02982853539288044, -0.004053929820656776, -0.010819196701049805, -0.036709416657686234, -0.02337397262454033, 0.008604750037193298, 0.010523809120059013, 0.076020248234272, 0.007543513085693121, 0.05833486467599869, 0.0061605931259691715, -0.012086133472621441, -0.03353429585695267, 0.031177762895822525, 0.031493593007326126, -0.019207021221518517, 0.02753256820142269, -0.06590993702411652, 0.008563944138586521, 0.004599705804139376, -0.045965470373630524, 0.03947082534432411, -0.006170719861984253, -0.016582459211349487, 0.004871043376624584, 0.040368761867284775, 0.005035384092479944, -0.05744514241814613, -0.0142483189702034, 0.018987752497196198, 0.01023615337908268, -0.036351267248392105, -0.02621813304722309, 0.03161739557981491, -0.011133469641208649, 0.026645008474588394, 0.036979660391807556, -0.0004916209145449102, 0.016330434009432793, -0.043033190071582794, -0.006422264967113733, -0.038115739822387695, -0.04316389188170433, -0.0010062881046906114, -0.004489584360271692, 0.07646583765745163, 0.009539266116917133, -0.033645905554294586, 0.03348926827311516, -0.04327354207634926, -0.018653294071555138, 0.016768259927630424, -0.04171356186270714, 0.010832916013896465, 0.0038930096197873354, -0.004709938075393438, -0.015616786666214466, -0.02765308879315853, -0.00040200978401117027, -0.03186582401394844, 0.006372188683599234, 0.08144928514957428, -0.0302150696516037, 0.02845018170773983, 0.04967265948653221, 0.03726707771420479, -0.02455781400203705, 0.008692897856235504, -0.0033095374237746, -0.02069111540913582, -0.007248169742524624, 0.004432620480656624, 0.02392488904297352, -0.04431518167257309, 0.012062312103807926, 0.043092358857393265, -0.01554207131266594, 0.008596311323344707, -0.05688778683543205, 0.004285120405256748, 0.001042023184709251, -0.013500085100531578, -0.005839498247951269, 0.0029113360214978456, -0.03485182300209999, 0.02459685690701008, -0.020477693527936935, 0.011332863010466099, -0.0018720015650615096, -0.049188900738954544, 0.013671488501131535, -0.018063925206661224, 0.008917218074202538, -0.0012998777674511075, 0.03262554109096527, 0.017372120171785355, 0.030164841562509537, 0.028344664722681046, 0.028171436861157417, -0.04101163521409035, -0.0032125143334269524, 0.025427652522921562, 0.027201419696211815, -0.02264486625790596, -0.019079431891441345, 0.03998749330639839, 0.008051406592130661, -0.0010407959343865514, -0.023138107731938362, -0.055091921240091324, -0.009701868519186974, 0.05595278739929199, -0.01758629083633423, -0.02065962366759777, -0.031021980568766594, 0.037797532975673676, 0.007905212230980396, -0.04150880128145218, -0.03959989547729492, 0.006692021153867245, -0.014343204908072948, 0.03651774674654007, 0.02677108533680439, -0.05450983718037605, -0.042984526604413986, -0.006165927741676569, -0.028625257313251495, -0.02164318785071373, 0.026284653693437576, 0.00042564162868075073, 0.03875676542520523, -0.0018670643912628293, -0.02618621289730072, -0.0760495513677597, 0.05753466486930847, 0.01652003638446331, -0.0904829353094101, -0.04760723561048508, -0.03164301812648773, 0.00881888996809721, -0.015716487541794777, 0.0025408167857676744, -0.011403338983654976, 0.014109685085713863, 0.015680624172091484, -0.060818783938884735, -0.07450038939714432, -0.03981548547744751, 0.05751447007060051, 0.02476084604859352, 0.030296683311462402, 0.007700593210756779, 0.025282615795731544, -0.02999808080494404, 0.016169479116797447, -0.04128212481737137, 0.05848146602511406, 0.05250413715839386, -0.014860369265079498, 0.04387955740094185, -0.043385159224271774, 0.004223486874252558, -0.008640547282993793, 0.003452475182712078, 0.002880051266402006, -0.021287627518177032, -0.0003931565734092146, -0.019421657547354698, -0.04275865480303764, 0.023775288835167885, 0.03440314158797264, -0.025635089725255966, -0.012873711064457893, 0.01308764610439539, -0.03682577610015869, -0.029663145542144775, 0.0291507039219141, 0.054939642548561096, 0.012659215368330479, 0.032507073134183884, 0.014559165574610233, 0.02557060681283474, -0.035195525735616684, -0.037097517400979996, 0.000815492239780724, -0.027495544403791428, 0.015855075791478157, 0.000059161426179343835, -0.005445527378469706, 0.03660834953188896, -0.0006249789148569107, 0.019429190084338188, -0.0006250496371649206, 0.05143247917294502, 0.009821612387895584, 0.04736733064055443, -0.04007498174905777, -0.006518580950796604, -0.008551433682441711, 0.030796684324741364, 0.007067585363984108, 0.0075184740126132965, 0.004286113660782576, 0.007788544055074453, 0.005120627582073212, -0.06708210706710815, 0.03207499161362648, 0.01978331431746483, 0.02171064354479313, 0.032772794365882874, -0.037888605147600174, 0.054478719830513, 0.020989809185266495, 0.05906670540571213, 0.04617253318428993, -0.022237299010157585, 0.019911842420697212, 0.03776351734995842, 0.030106892809271812, -0.041948650032281876, -0.009126839227974415, -0.026118678972125053, 0.03135096654295921, 0.008287039585411549, 0.03659544140100479, -0.022632939741015434, -0.05057483911514282, -0.0019045856315642595, -0.0392816886305809, -0.02174287661910057, 0.0005588566418737173, -0.018977567553520203, -0.006489913910627365, 0.05366000160574913, -0.007213866338133812, -0.00980674009770155, 0.003108115866780281, 0.057688843458890915, -0.025392919778823853, 0.0013232820201665163, 0.006707831751555204, -0.0030705928802490234, 0.02722412347793579, 0.06528647243976593, 0.021587375551462173, -0.005488029681146145, -0.006998517084866762, -0.0016505405073985457, 0.010521957650780678, -0.014934412203729153, -0.06375357508659363, -0.036350466310977936, 0.026461487635970116, 0.01730744168162346, -0.018128138035535812, -0.048939965665340424, -0.010895689949393272, 0.06747589260339737, 0.023030145093798637, -0.04656795412302017, -0.046733055263757706, 0.024121148511767387, -0.0005301274359226227, -0.04762761667370796, 0.01670130155980587, 0.0063891964964568615, -0.019185006618499756, 0.006077561993151903, 0.014351407065987587, 0.03729899972677231, -0.0062399269081652164, -0.0078082578256726265, 0.04247419536113739, 0.04947514086961746, 0.009751331992447376, -0.002990149427205324, 0.0036370335146784782, -0.0006908141076564789, -0.023906031623482704, 0.037817612290382385, -0.009046261198818684, -0.043184131383895874, -0.031208032742142677, -0.029917310923337936, -0.03438189998269081, 0.0004759122966788709, 0.028546864166855812, 0.04460444301366806, 0.02113834209740162, -0.038323670625686646, -0.03874772787094116, 0.002765698591247201, 0.0008488462190143764, 0.025950370356440544, 0.04297251999378204, -0.004783756099641323, 0.036967646330595016, -0.048339374363422394, -0.025965064764022827, 0.029728533700108528, -0.014694149605929852, 0.0027886161115020514, -0.055115506052970886, -0.029082460328936577, 0.07392774522304535, 0.02567150816321373, -0.024495437741279602, -0.011236720718443394, 0.0007551572634838521, -0.02728598192334175, -0.013471616432070732, -0.05241640657186508, -0.0004641504492610693, 0.06278584152460098, -0.000017209022189490497, 0.004066976718604565, -0.019882841035723686, -0.03987770900130272, -0.022075721994042397, -0.029403943568468094, -0.008918695151805878, 0.023410383611917496, -0.023399265483021736, 0.017769087105989456, -0.02377629093825817, -0.0031929875258356333, 0.008280222304165363, -0.038809020072221756, 0.004551315680146217, -0.008184333331882954, 0.004717694595456123, 0.0024485415779054165, 0.012312548235058784, -0.0058584208600223064, 0.013208259828388691, -0.026125386357307434, 0.04808439314365387, -0.01691625639796257, 0.03043651580810547, 0.0243948046118021, -0.0019416451686993241, -0.01615348644554615, 0.021726587787270546, 0.0655142217874527, 0.028511768206954002, -0.010566825978457928, 0.00980315264314413, 0.07143985480070114, 0.032225776463747025, 0.028848957270383835, 0.014992830343544483, -0.005915390327572823, 0.008283492177724838, 0.0672089010477066, 0.011030835099518299, 0.00522799976170063, -0.04289979115128517, -0.005704187322407961, 0.032904770225286484, -0.030116604641079903, -0.011233106255531311, 0.006357374135404825, 0.011786453425884247, -0.029070774093270302, 0.030236216261982918, -0.014604794792830944, 0.05670134350657463, -0.029514260590076447, 0.05651606619358063, 0.034795131534338, 0.004092216957360506 ]
Hugging Face Reads, Feb. 2021 - Long-range Transformers
VictorSanh
March 09, 2021
long-range-transformers
research, nlp
https://huggingface.co/blog/long-range-transformers
Follow-up questions * The increasing size (throughout the layers) of the dilated windowed self-attention echoes findings in computer vision on increasing the receptive field of stacked CNN. How do these two findings relate? What are the transposable learnings? * Longformer’s Encoder-Decoder architecture works well for tasks that do not require a long target length (e.g. summarization). However, how would it work for long-range seq2seq tasks which require a long target length (e.g. document translation, speech recognition, etc.) especially considering the cross-attention layer of encoder-decoder’s models? * In practice, the sliding window self-attention relies on many indexing operations to ensure a symmetric query-key weights matrix. Those operations are very slow on TPUs which highlights the question of the applicability of such patterns on other hardware.
[ 0.02410227432847023, -0.043845128268003464, 0.03329608216881752, -0.021428868174552917, -0.04413113370537758, 0.048474784940481186, -0.08218282461166382, 0.08024630695581436, -0.04780768230557442, -0.013763831928372383, -0.04657457768917084, 0.09538225084543228, 0.002626340603455901, 0.016297735273838043, -0.05076650157570839, 0.014332415536046028, 0.08318225294351578, -0.06816607713699341, 0.04530074819922447, 0.0364636592566967, 0.007585820276290178, -0.03265335038304329, 0.07639113813638687, 0.002086607739329338, -0.054110776633024216, -0.02329910919070244, -0.07167857885360718, 0.005318756215274334, -0.08356994390487671, -0.010524818673729897, -0.08638232201337814, 0.009913276880979538, -0.00826441403478384, -0.04097987711429596, -0.009658142924308777, -0.02788286842405796, -0.09871769696474075, 0.03859616443514824, 0.013744800351560116, -0.02562841959297657, -0.05466192588210106, -0.023872267454862595, -0.08983681350946426, 0.0574302114546299, 0.008651304990053177, 0.0031950874254107475, -0.10924956947565079, 0.00843897182494402, -0.00155851140152663, -0.019836924970149994, -0.021212268620729446, 0.06380877643823624, 0.017718957737088203, 0.03787586838006973, 0.08155940473079681, 0.050734858959913254, 0.0316842645406723, -0.008949510753154755, -0.013462829403579235, -0.029991187155246735, 0.05229440703988075, -0.03267316520214081, 0.026877379044890404, 0.023846490308642387, 0.00791077595204115, -0.042980778962373734, -0.012029270641505718, 0.022207949310541153, -0.017914101481437683, -0.00748285511508584, -0.02311895228922367, -0.03326612710952759, 0.04061928018927574, 0.036071036010980606, -0.0431821271777153, 0.0008429401204921305, -0.013175766915082932, -0.010163876228034496, -0.020145250484347343, -0.0463838092982769, 0.027378549799323082, 0.05272572115063667, 0.022511007264256477, 0.042768873274326324, -0.02697966992855072, 0.0032772838603705168, -0.002833444392308593, -0.044461943209171295, -0.04797758534550667, 0.03419838100671768, -0.04170892760157585, -0.09467882663011551, 0.008451196365058422, -0.0038072301540523767, 0.030427876859903336, -0.05587390810251236, -0.020563021302223206, 0.042769916355609894, -0.04106803610920906, -0.011410725302994251, -0.04197756201028824, -0.041597139090299606, 0.02732749655842781, -0.06640558689832687, -0.02364581637084484, 0.00307225133292377, -0.06654231250286102, -0.07087963819503784, -0.052511025220155716, -0.014873353764414787, 0.022914893925189972, 0.06444807350635529, -0.030683794990181923, 0.014314121566712856, -0.07377409189939499, 0.019111599773168564, 0.01366776879876852, 0.021604223176836967, 0.04091300070285797, 0.006401026155799627, -0.027045266702771187, 0.11344855278730392, -0.008153149858117104, -0.03310965374112129, 0.01056004874408245, -0.0337798185646534, -0.048156868666410446, -0.042302295565605164, -0.021636145189404488, -0.05472353845834732, 0.05437488108873367, -0.01993543840944767, 0.040891192853450775, 0.03295300155878067, -0.02475166693329811, -0.06877459585666656, 0.020247725769877434, -0.05472629889845848, -0.03145622834563255, 0.0006041034357622266, -0.033165059983730316, 0.015170063823461533, 0.06617937237024307, -0.06783825904130936, 0.051941096782684326, -0.013407478109002113, -0.10954722762107849, 0.12125863879919052, 0.0089903948828578, 0.0363289974629879, -0.020741920918226242, 0.0467192679643631, -0.02460198849439621, -0.0702022835612297, 0.028678691014647484, 0.04182470217347145, -0.02237739972770214, -0.08720168471336365, -0.03123699687421322, 0.023887645453214645, 0.04687846079468727, 0.02417811006307602, -0.012326645664870739, 0.07775110006332397, -0.002494081389158964, -0.08325253427028656, 0.050616249442100525, 0.009169679135084152, -0.010411862283945084, 0.01692349649965763, -0.01377339567989111, 0.08833419531583786, 0.05676943063735962, 0.004909258335828781, -0.08542050421237946, 0.05110121890902519, -0.03889819234609604, 0.07186956703662872, 0.029848843812942505, -0.03209196776151657, -0.03766637295484543, -0.037970881909132004, -0.025181496515870094, -0.006052170414477587, -0.04751520976424217, -0.005694541614502668, 0.065237857401371, 0.02196134440600872, -0.07782616466283798, -0.016778498888015747, -0.06580233573913574, 0.018901774659752846, -0.0718359649181366, 0.01776752807199955, 0.02286938950419426, -0.048634398728609085, 0.018565818667411804, 0.10756869614124298, 0.06245805695652962, 0.03816162422299385, 0.05103299021720886, 0.004004770424216986, 0.03893689438700676, 0.012079386040568352, -0.006209143437445164, -0.06823232024908066, -0.02244299091398716, -0.017581449821591377, -0.002417919458821416, 0.010984867811203003, -0.0014811638975515962, -0.10677575320005417, -0.03149972856044769, -0.013621311634778976, -0.010662037879228592, -0.058657076209783554, 0.07469987869262695, 0.02539268508553505, -0.03625006973743439, 0.027813944965600967, 0.0895460695028305, -0.010701308958232403, -0.008463618345558643, 0.017027702182531357, -0.012077562510967255, 0.03183547407388687, 0.05509765073657036, -0.04840433597564697, 0.07746428996324539, -0.04248915612697601, -0.056054092943668365, -0.062319718301296234, 0.013855335302650928, -0.03602588176727295, 0.007899561896920204, -0.025959210470318794, -0.0006968049565330148, -0.018687795847654343, 0.058194853365421295, -0.04942207783460617, 0.035777900367975235, 0.000945843814406544, 0.05162575840950012, 0.044757336378097534, -0.03427219018340111, -0.05029025673866272, 0.08624093234539032, 0.047814156860113144, -0.02682219259440899, 0.004803393967449665, -0.04990171641111374, 0.1362743228673935, -0.01641356386244297, -0.09639385342597961, 0.04188810661435127, 0.004687564447522163, 0.026847176253795624, -0.06221151351928711, -0.004728303290903568, -0.007944388315081596, 0.0416703075170517, 0.03678928315639496, -0.021736519411206245, 0.006051978096365929, 0.00933798123151064, 0.002720216289162636, 0.003771023126319051, -0.024723529815673828, 0.011502215638756752, 0.010579708963632584, -0.028904857113957405, 0.011903489008545876, 0.015504511073231697, -0.0034593024756759405, 0.0007110438891686499, -0.019252043217420578, 0.03322436287999153, -0.020871318876743317, -0.025641320273280144, -0.07873964309692383, 0.008066888898611069, -0.028131280094385147, 0.0702604129910469, 0.045521847903728485, 0.010629984550178051, -0.03972828388214111, -0.05410434305667877, -0.025548690930008888, -0.019244132563471794, 0.03181184455752373, 0.018811717629432678, -0.0015517062274739146, -0.011235801503062248, -0.014492797665297985, -0.04822985827922821, 0.04227596893906593, -0.012973811477422714, -0.03132173791527748, -0.01943846605718136, 0.003952241037040949, -0.043359071016311646, 0.02969277650117874, 0.0480295829474926, -0.02560439147055149, 0.015495242550969124, 0.0018972191028296947, -0.016023315489292145, 0.07084986567497253, -0.07700646668672562, -0.04392532259225845, 0.032300543040037155, -0.0032125518191605806, -0.025316281244158745, -0.01726723648607731, 0.02274201437830925, 0.010024000890552998, 0.004983941093087196, -0.024868831038475037, 0.001535462448373437, -0.0055144596844911575, -0.022100111469626427, -0.0026058305520564318, 0.008173918351531029, 0.0397399477660656, 0.02494627796113491, -0.0018694079481065273, 0.0658881664276123, -0.003793282900005579, 0.010613263584673405, -0.0021708435378968716, -0.005465980153530836, -0.012726041488349438, -0.05545647442340851, 0.0016592234605923295, 0.03170105069875717, 0.002537816995754838, 0.008793906308710575, 0.034069932997226715, 0.0022210453171283007, -0.014913555234670639, 0.0010272336658090353, 0.030868420377373695, -0.056983862072229385, -0.0058085317723453045, -0.019170716404914856, -0.009971416555345058, 0.009675806388258934, 0.05520571395754814, 0.028005171567201614, -0.03450140357017517, 0.03419358655810356, 0.028704430907964706, 0.04629172757267952, 0.018788224086165428, 0.05236262455582619, -0.004544105846434832, 0.022731781005859375, -0.026888877153396606, -0.014435228891670704, 0.002835041843354702, -0.025475582107901573, 0.015074211172759533, 0.013113410212099552, 0.0009964794153347611, 0.014601361937820911, 0.0022006777580827475, -0.0144673315808177, 0.019269311800599098, -0.053472720086574554, 0.04290986433625221, -0.04154909774661064, -0.01823924295604229, 0.008407952263951302, 0.0421779602766037, 0.01380615308880806, -0.0010049104457721114, -0.004044199362397194, 0.025105958804488182, -0.00016770978982094675, 0.009065940044820309, 0.03601878508925438, -0.011710314080119133, 0.027660086750984192, 0.017188047990202904, 0.036575961858034134, 0.0082310251891613, 0.05937926471233368, 0.05175288766622543, -0.03206218406558037, -0.017144085839390755, -0.0468648262321949, -0.008601859211921692, -0.02305247262120247, -0.023604916408658028, 0.020047426223754883, 0.006371870171278715, 0.03689740225672722, -0.0001684615563135594, 0.0438363179564476, -0.04100919887423515, 0.06396577507257462, -0.02030024118721485, -0.024507364258170128, 0.008659660816192627, -0.01030475739389658, 0.006421738304197788, 0.06019248068332672, -0.015776637941598892, 0.017649278044700623, -0.08129044622182846, 0.009830694645643234, 0.029296625405550003, 0.00039538598502986133, 0.03740421310067177, -0.02780170366168022, 0.002963925478979945, -0.012448321096599102, -0.029217520728707314, -0.004744204226881266, -0.04753347858786583, 0.00825337041169405, 0.012335704639554024, 0.0475945845246315, 0.01109310146421194, -0.015580551698803902, -0.056279268115758896, -0.056319065392017365, -0.03146304190158844, 0.014331420883536339, 0.033043425530195236, -0.04090046137571335, -0.019874976947903633, 0.03940383717417717, 0.005706349853426218, 0.04067486897110939, -0.02327512577176094, 0.004790422506630421, -0.025143355131149292, -0.039131782948970795, -0.03294486179947853, 0.021611083298921585, -0.0059820846654474735, 0.015231163240969181, 0.010656657628715038, -0.0353030189871788, 0.043991319835186005, -0.02406076155602932, -0.029384572058916092, -0.014202427119016647, 0.01496646273881197, 0.03130912408232689, -0.04289650917053223, -0.013215768150985241, -0.03563280403614044, 0.00846178736537695, 0.010594004765152931, -0.06696934998035431, 0.0023204698227345943, 0.040114544332027435, -0.035772182047367096, -0.07743213325738907, 0.0439625009894371, 0.029087061062455177, -0.020666807889938354, 0.061432987451553345, 0.032694268971681595, -0.000012508819054346532, 0.007056932430714369, -0.012948757968842983, 0.024538064375519753, -0.046149108558893204, -0.014883290976285934, 0.02307843044400215, 0.03976817801594734, -0.01122954674065113, -0.0024107852950692177, 0.006851914804428816, -0.01182873547077179, -0.01190903503447771, 0.014013558626174927, -0.015371316112577915, -0.0057544042356312275, 0.010043185204267502, -0.016369404271245003, 0.0036335070617496967, 0.03152019530534744, -0.022470442578196526, 0.013988749124109745, 0.006039200816303492, 0.010466755367815495, 0.04455295205116272, -0.02480042353272438, 0.029293829575181007, 0.0052845473401248455, 0.043249160051345825, 0.0482446551322937, -0.004362438805401325, 0.06648941338062286, 0.055761463940143585, 0.009997757151722908, -0.019773246720433235, -0.020579896867275238, 0.009974179789423943, -0.009973504580557346, 0.05486251413822174, -0.01607324182987213, -0.03716999664902687, 0.05266345292329788, 0.0029426910914480686, 0.014026958495378494, -0.0001114648039219901, 0.005012002307921648, 0.02817571721971035, 0.005332781933248043, 0.015026337467133999, -0.011309781111776829, -0.014966434799134731, -0.03560315817594528, 0.013970604166388512, 0.02071274444460869, 0.011233442462980747, 0.012397844344377518, 0.017014052718877792, -0.04517363756895065, -0.02823605388402939, 0.031027130782604218, 0.040451981127262115, 0.030847635120153427, -0.008844207040965557, 0.026646297425031662, 0.01381857693195343, 0.009769166819751263, -0.02123044803738594, -0.024659816175699234, -0.04121343418955803, 0.006680021993815899, 0.0039565893821418285, -0.0046302019618451595, 0.02660132572054863, -0.045079030096530914, 0.02657780796289444, 0.041203517466783524, -0.013723514974117279, -0.048468057066202164, 0.04070841521024704, 0.04214048385620117, 0.000625909713562578, 0.02745150960981846, 0.050159845501184464, 0.02441227436065674, 0.0212620310485363, 0.03823358565568924, -0.03040548786520958, 0.07826220989227295, 0.04306931793689728, -0.02606281079351902, -0.000504101742990315, -0.022131480276584625, 0.06097865104675293, -0.009717973880469799, -0.00013963661331217736, -0.008443187922239304, 0.036715470254421234, -0.02559184655547142, 0.019429868087172508, -0.023010555654764175, 0.030100002884864807, 0.029140887781977654, -0.044478125870227814, -0.04929196834564209, 0.01662069372832775, 0.009196612052619457, -0.0008502708515152335, 0.01268005557358265, 0.06021783500909805, -0.01610640622675419, 0.020010769367218018, -0.0035604157019406557, 0.03277925029397011, 0.01532950159162283, -0.0016603665426373482, -0.05085604637861252, -0.01604139618575573, 0.003536342177540064, 0.027692709118127823, 0.06640834361314774, 0.04257088527083397, -0.009325683116912842, -0.009700284339487553, 0.011145410127937794, 0.05360386520624161, -0.012350233271718025, 0.0044285631738603115, -0.012179762125015259, 0.0033676025923341513, -0.00010471674613654613, 0.030071953311562538, -0.04116629436612129, 0.01233789511024952, -0.025539109483361244, 0.04780132696032524, 0.0035753061529248953, -0.03344564884901047, 0.03428877145051956, 0.025949234142899513, 0.010014157742261887, -0.01351841352880001, 0.026243701577186584, 0.0416419580578804, 0.03644472360610962, -0.013930722139775753, 0.01202330645173788, 0.02861901745200157, 0.051770422607660294, 0.057382456958293915, 0.033775050193071365, 0.04334322735667229, -0.0054409084841609, -0.004550308920443058, 0.019620168954133987, 0.03856799751520157, 0.05095476657152176, -0.004548149183392525, -0.03650086373090744, -0.032761093229055405, 0.012725801207125187, -0.02521790750324726, -0.001563958590850234, -0.0019198957597836852, -0.004436937160789967, 0.010700556449592113, 0.006322168745100498, -0.02630377747118473, 0.01090935617685318, 0.03940830007195473, 0.011510453186929226, 0.004010799806565046, -0.009834825061261654, 0.0015073505928739905, 0.04977092891931534, -0.007482949178665876, -0.017628595232963562, -0.006543176714330912, -0.00962526910007, -0.009608607739210129, 0.037321098148822784, -0.03281175345182419, -0.06781599670648575, -0.011059965007007122, 0.053987644612789154, 0.0017796407919377089, 0.05212374031543732, -0.0042946720495820045, 0.03299107775092125, 0.06493853032588959, 0.020382685586810112, -0.03505833074450493, 0.00229047448374331, 0.011966833844780922, -0.011875875294208527, -0.04108104854822159, 0.034447409212589264, -0.04048556089401245, -0.018686508759856224, 0.020577767863869667, -0.056160759180784225, -0.03392845764756203, -0.007102153263986111, -0.004516603425145149, 0.04426063597202301, 0.03404437378048897, 0.006239135283976793, -0.027704831212759018, -0.015104849822819233, -0.050055548548698425, -0.014707369729876518, 0.04084369167685509, 0.008938378654420376, -0.01782247982919216, -0.005741897039115429, -0.015095862559974194, -0.027250872924923897, 0.008865502662956715, 0.01588517241179943, 0.01993386447429657, 0.01027745846658945, -0.01676480658352375, 0.0013438028981909156, 0.02909626066684723, -0.021471917629241943, 0.01648090034723282, 0.013148024678230286, 0.0016916252207010984, 0.033212266862392426, -0.06459108740091324, -0.012355378828942776, -0.022474627941846848, 0.0012357173254713416, -0.019194429740309715, -0.01739344373345375, -0.03731168061494827, 0.029259487986564636, 0.01935649663209915, -0.029738450422883034, -0.0170980766415596, 0.027096763253211975, -0.05647801235318184, 0.0377890020608902, 0.022000370547175407, 0.02040891721844673, 0.02869011089205742, -0.013141810894012451, 0.011418682523071766, 0.014187509194016457, -0.023052148520946503, -0.04382149875164032, -0.0017698773881420493, 0.01921621337532997, 0.04491329938173294, 0.014772227965295315, -0.019200019538402557, -0.025869540870189667, -0.03066856972873211, 0.008350644260644913, -0.007303745951503515, -0.009503691457211971, 0.03246297687292099, -0.007530792150646448, -0.033584114164114, -0.04126599058508873, 0.04247152805328369, 0.025458425283432007, 0.012805371545255184, 0.04166914522647858, -0.028446560725569725, 0.024547886103391647, -0.0005042479024268687, -0.0027357216458767653, -0.03972342237830162, 0.0008449874585494399, 0.06731291860342026, 0.026780515909194946, 0.02458317019045353, -0.04852307215332985, 0.025624895468354225, 0.007551864255219698, 0.022867964580655098, -0.021644439548254013, -0.014613931067287922, 0.001696622697636485, 0.0532669797539711, 0.004692160990089178, 0.00026234795222990215, -0.014532012864947319, 0.024690842255949974, -0.021108588203787804, -0.038181617856025696, -0.02365799807012081, -0.025853140279650688, 0.021708641201257706, -0.049436021596193314, 0.02099219523370266, -0.021817492321133614, 0.07353901118040085, 0.025763459503650665, 0.03407049551606178, -0.007042394019663334, -0.021226968616247177 ]
Hugging Face Reads, Feb. 2021 - Long-range Transformers
VictorSanh
March 09, 2021
long-range-transformers
research, nlp
https://huggingface.co/blog/long-range-transformers
Compressive Transformers for Long-Range Sequence Modelling Jack W. Rae, Anna Potapenko, Siddhant M. Jayakumar, Timothy P. Lillicrap Transformer-XL (2019) showed that caching previously computed layer activations in a memory can boost performance on language modeling tasks (such as enwik8). Instead of just attending the current \(n\) input tokens, the model can also attend to the past \(n_m\) tokens, with \(n_m\) being the memory size of the model. Transformer-XL has a memory complexity of \(O(n^2+ n n_m)\), which shows that memory cost can increase significantly for very large \(n_m\). Hence, Transformer-XL has to eventually discard past activations from the memory when the number of cached activations gets larger than \(n_m\). Compressive Transformer addresses this problem by adding an additional compressed memory to efficiently cache past activations that would have otherwise eventually been discarded. This way the model can learn better long-range sequence dependencies having access to significantly more past activations. Figure taken from Compressive Transfomer A compression factor \(c\) (equal to 3 in the illustration) is chosen to decide the rate at which past activations are compressed. The authors experiment with different compression functions \(f_c\) such as max/mean pooling (parameter-free) and 1D convolution (trainable layer). The compression function is trained with backpropagation through time or local auxiliary compression losses. In addition to the current input of length \(n\), the model attends to \(n_m\) cached activations in the regular memory and \(n_{cm}\) compressed memory activations allowing a long temporal dependency of \(l × (n_m + c n_{cm})\), with \(l\) being the number of attention layers. This increases Transformer-XL’s range by additional \(l × c × n_{cm}\) tokens and the memory cost amounts to \(O(n^2+ n n_m+ n n_{cm})\). Experiments are conducted on Reinforcement learning, audio generation, and natural language processing. The authors also introduce a new long-range language modeling benchmark called PG19.
[ -0.01627531461417675, -0.005818016827106476, -0.02149290218949318, -0.05523598939180374, -0.024308009073138237, 0.03522932529449463, -0.01351409126073122, 0.01901155151426792, 0.020235922187566757, -0.028453173115849495, -0.056575097143650055, 0.0434764102101326, 0.015811653807759285, 0.05736891180276871, -0.01549447886645794, -0.007056622300297022, 0.017795134335756302, -0.01563747599720955, 0.011743142269551754, 0.05814341455698013, -0.02244691178202629, -0.045798931270837784, 0.100650355219841, 0.020397242158651352, -0.008960949257016182, 0.0020286121871322393, 0.04361599683761597, 0.009862424805760384, -0.055860426276922226, -0.011734120547771454, -0.14576847851276398, 0.042636774480342865, -0.009425243362784386, -0.008227427490055561, -0.005102535709738731, -0.0275984276086092, -0.11552630364894867, 0.024157032370567322, 0.04499467834830284, -0.019564954563975334, 0.04025505483150482, 0.02834451012313366, -0.08790040016174316, 0.03952062129974365, 0.05313130468130112, -0.018080180510878563, -0.08637495338916779, 0.018899770453572273, -0.07227881997823715, -0.02464882656931877, -0.01768883317708969, 0.0406905934214592, 0.035557910799980164, 0.03712168708443642, 0.01019944716244936, 0.007877852767705917, -0.008088002912700176, -0.05177699029445648, 0.061950452625751495, 0.012687714770436287, 0.007153818383812904, 0.010250619612634182, 0.017956828698515892, -0.015992753207683563, 0.007464619819074869, -0.009569333866238594, -0.020202578976750374, 0.02353733591735363, -0.0634230524301529, -0.007575566880404949, -0.033534590154886246, 0.043095532804727554, 0.014942594803869724, 0.027436500415205956, -0.04486038163304329, -0.01948719285428524, -0.03531591594219208, 0.04136602580547333, 0.07035495340824127, 0.05337056145071983, -0.02612316980957985, 0.05606517568230629, 0.08516634255647659, 0.023569045588374138, 0.06516613811254501, 0.03703515604138374, 0.04743830859661102, -0.07186023890972137, -0.10044814646244049, 0.0036625058855861425, -0.005544539075344801, -0.13667497038841248, -0.028964616358280182, -0.009069874882698059, 0.0159456804394722, -0.019688153639435768, -0.019372114911675453, 0.02424296736717224, -0.09175673872232437, -0.029935771599411964, 0.02357853390276432, 0.00027893323567695916, 0.04110656678676605, -0.02322138287127018, -0.09504465758800507, 0.031189855188131332, -0.04517338052392006, -0.04668066278100014, 0.02087385207414627, -0.028201060369610786, 0.06791041791439056, 0.04133109003305435, -0.02126273140311241, -0.01136864349246025, -0.1158970445394516, -0.016131246462464333, 0.027830449864268303, -0.013588887639343739, -0.04896397888660431, -0.03096604160964489, -0.041795626282691956, 0.10170365124940872, 0.05948968976736069, -0.011299981735646725, -0.006194589659571648, 0.03583071753382683, 0.0427837111055851, -0.027439864352345467, 0.011976940557360649, -0.06829538941383362, 0.08879583328962326, -0.06061488017439842, 0.006089858245104551, 0.009272873401641846, 0.006179096642881632, -0.016260890290141106, 0.007986961863934994, -0.03367186337709427, -0.0385654978454113, 0.003182667074725032, -0.062223657965660095, 0.016248969361186028, 0.012734797783195972, -0.15293166041374207, 0.05905801057815552, -0.0035124856512993574, -0.08884260803461075, 0.07187242805957794, 0.09489449113607407, -0.006021149922162294, -0.005261337850242853, -0.04901808872818947, -0.10632544755935669, -0.057127468287944794, -0.04104334115982056, 0.04458572715520859, 0.01055406965315342, 0.051469892263412476, -0.04103846848011017, -0.0448605939745903, -0.01936853863298893, 0.025398598983883858, -0.025200041010975838, 0.039710693061351776, -0.00006473194662248716, -0.009447616524994373, 0.01916668564081192, 0.03168027102947235, -0.012801866047084332, 0.05961168557405472, 0.021142348647117615, 0.02960938587784767, -0.022922102361917496, 0.05389542877674103, -0.09987641870975494, 0.001442538108676672, -0.0354878269135952, 0.09817561507225037, -0.0148469228297472, -0.029696563258767128, -0.06024384871125221, -0.025515487417578697, 0.022359145805239677, 0.012907994911074638, 0.06608617305755615, -0.06350072473287582, 0.03946366533637047, -0.03621556609869003, -0.04086480662226677, 0.005552216432988644, -0.036481961607933044, -0.02587796375155449, 0.03878622502088547, -0.029014557600021362, 0.04533954709768295, -0.007036260794848204, -0.00674307020381093, 0.06379644572734833, 0.08382095396518707, 0.059656284749507904, 0.052705828100442886, 0.061367329210042953, 0.033676885068416595, -0.02160118892788887, 0.008169693872332573, 0.020343197509646416, -0.03359019011259079, -0.027535781264305115, 0.017130047082901, 0.0001845697988756001, 0.035464510321617126, -0.07505916059017181, -0.023089813068509102, -0.0670720562338829, 0.017488110810518265, -0.06232922524213791, -0.018710408359766006, 0.0007274344097822905, -0.008658301085233688, -0.02546900324523449, 0.11749779433012009, 0.022175665944814682, -0.02584186941385269, -0.02724608965218067, 0.0032696006819605827, -0.01766224578022957, 0.030185652896761894, -0.03725592792034149, 0.06957372277975082, -0.05447706952691078, 0.02215646766126156, -0.06401076912879944, -0.02421698346734047, 0.024936750531196594, 0.02450786530971527, -0.040220290422439575, -0.06450185924768448, -0.018881432712078094, -0.044989489018917084, 0.0018636040622368455, 0.008757428266108036, 0.02281573787331581, 0.012624328024685383, 0.06829481571912766, -0.019029317423701286, 0.013217472471296787, 0.045543473213911057, -0.00400317320600152, -0.0727839469909668, -0.01805386133491993, -0.06274301558732986, 0.10852456092834473, -0.009794066660106182, -0.06010160967707634, -0.0030859094113111496, 0.06029808148741722, 0.02822696417570114, -0.02872725948691368, 0.029722655192017555, 0.008198699913918972, 0.00483358558267355, 0.003900333307683468, -0.01705976389348507, -0.04470989108085632, 0.011828247457742691, -0.029753701761364937, 0.04007306694984436, -0.0034859550651162863, 0.016975387930870056, -0.002869880059733987, 0.06256882846355438, 0.00705857016146183, 0.01956183649599552, 0.047453928738832474, -0.004543135408312082, -0.00867529958486557, 0.025569891557097435, -0.023763975128531456, -0.03057505562901497, -0.05185981094837189, -0.007514967117458582, -0.05442965403199196, 0.03899843618273735, 0.000962289806921035, 0.016128607094287872, 0.05119021609425545, 0.029530473053455353, -0.020655496045947075, 0.00774383544921875, 0.007835282944142818, -0.007356726098805666, 0.00480400025844574, -0.011248032562434673, -0.0083688423037529, -0.02002863772213459, 0.02380547672510147, -0.018203390762209892, -0.01036166213452816, -0.02664104476571083, -0.005925585515797138, -0.05982103943824768, 0.02915714494884014, 0.01887829229235649, 0.035186707973480225, 0.014480899088084698, 0.008653374388813972, 0.006486433558166027, 0.10636082291603088, -0.07360426336526871, -0.05084247142076492, 0.009926004335284233, -0.007274674251675606, -0.022698242217302322, -0.03716683387756348, -0.03866283595561981, 0.03405960649251938, -0.014944128692150116, 0.047912534326314926, 0.03171469271183014, 0.028363656252622604, -0.015542891807854176, 0.018951887264847755, -0.010321996174752712, -0.0020486542489379644, -0.040815651416778564, 0.01650802232325077, 0.05198824778199196, 0.03338557854294777, -0.005455141421407461, -0.0024089659564197063, -0.013601838611066341, -0.022323865443468094, -0.011317436583340168, 0.01234570611268282, 0.032919835299253464, 0.009188064374029636, 0.04180788993835449, -0.02391446754336357, -0.018498728051781654, -0.03982558101415634, 0.03415996581315994, 0.019765015691518784, -0.02908202074468136, 0.005164597649127245, 0.007461939938366413, 0.04522329196333885, 0.05667824298143387, 0.036615435034036636, 0.03661267086863518, -0.023602178320288658, 0.04387020319700241, 0.0014551256317645311, 0.014268028549849987, 0.00046669357107020915, 0.022222714498639107, -0.0313933901488781, 0.00287026260048151, -0.03882823884487152, -0.02025306224822998, -0.05687416344881058, -0.03736360743641853, 0.028868168592453003, 0.050141915678977966, -0.023106787353754044, 0.011253741569817066, -0.015255139209330082, 0.012688123621046543, 0.017594773322343826, -0.0034169750288128853, 0.027336910367012024, 0.008073607459664345, 0.0016678966348990798, 0.004899321123957634, 0.02945811301469803, -0.003721666755154729, -0.02122911624610424, -0.03137033432722092, 0.006381718907505274, -0.04360467568039894, -0.0024413717910647392, 0.018741218373179436, 0.0019942233338952065, -0.0632607564330101, -0.0011205372866243124, 0.0020353016443550587, -0.0230771005153656, 0.07709067314863205, 0.03378787264227867, -0.06655346602201462, -0.021528752520680428, -0.033173929899930954, 0.05725759267807007, 0.013760646805167198, 0.029182039201259613, 0.04316334053874016, 0.009308434091508389, 0.05587560683488846, -0.019266493618488312, 0.0030173270497471094, -0.014117882587015629, -0.020010510459542274, -0.012360076420009136, 0.004033753648400307, -0.027256611734628677, 0.012420025654137135, 0.01937701180577278, 0.02664646878838539, -0.03113972395658493, -0.023979801684617996, -0.04677489772439003, 0.01738886721432209, -0.01854546181857586, -0.005795795004814863, -0.0045970347709953785, -0.035234253853559494, -0.00618686294183135, 0.012122117914259434, -0.0001617399393580854, 0.007030808832496405, -0.04991316795349121, -0.025279691442847252, 0.019713887944817543, 0.00019053040887229145, 0.029646044597029686, -0.012882928363978863, -0.03790164738893509, -0.01985028013586998, 0.0018993396079167724, 0.011831211857497692, -0.03333103284239769, 0.024110209196805954, 0.04735097661614418, 0.03831552714109421, 0.000331998395267874, -0.008765095844864845, 0.010413776151835918, -0.087099090218544, 0.02547396533191204, -0.03943254053592682, 0.014420578256249428, 0.06516347080469131, 0.0063848067075014114, 0.019126616418361664, 0.01817488856613636, -0.028875702992081642, -0.028456075116991997, -0.04432494938373566, -0.01431046798825264, -0.0197470523416996, -0.02423454076051712, 0.029206540435552597, -0.03639369457960129, 0.009613653644919395, 0.025561561807990074, 0.008313965983688831, -0.004621720872819424, -0.029849477112293243, 0.013759183697402477, 0.023726634681224823, 0.01366549264639616, -0.011545536108314991, 0.017216909676790237, 0.028652112931013107, 0.030688034370541573, -0.008567902259528637, 0.04590974748134613, 0.038468096405267715, 0.025568952783942223, 0.026913098990917206, 0.030654404312372208, -0.07152089476585388, 0.04280253127217293, 0.013592472299933434, 0.02209683507680893, -0.04153360426425934, -0.0630563497543335, 0.03656535595655441, -0.01440389920026064, -0.018963608890771866, -0.026059402152895927, 0.013974059373140335, -0.018091512843966484, 0.008703561499714851, -0.006496040150523186, 0.021022502332925797, 0.001659394707530737, -0.006097861099988222, 0.017741579562425613, 0.011035329662263393, 0.0036062230356037617, 0.010320141911506653, 0.003872281638905406, 0.030554363504052162, 0.02732786163687706, 0.030350400134921074, 0.047340985387563705, -0.01057301927357912, 0.01166926696896553, 0.040028829127550125, -0.0495440848171711, 0.03959870710968971, -0.026021158322691917, -0.019178634509444237, 0.008246170356869698, 0.028874974697828293, 0.0024606205988675356, -0.022857200354337692, 0.01799161359667778, 0.08287545293569565, 0.024057557806372643, -0.027603479102253914, -0.016711177304387093, -0.006292988546192646, 0.019046012312173843, -0.03783781826496124, -0.04158026725053787, 0.0079324496909976, -0.04041200876235962, 0.0184942539781332, -0.011519275605678558, -0.02411249279975891, 0.010545559227466583, 0.04153718426823616, -0.03502983599901199, -0.031241681426763535, 0.05218098685145378, 0.03009665012359619, 0.03525937721133232, -0.024273622781038284, 0.04177287966012955, 0.03903006389737129, 0.00630218256264925, 0.010696597397327423, -0.050400033593177795, -0.031082825735211372, 0.01637895591557026, -0.006020265631377697, 0.002146968385204673, 0.011707482859492302, -0.03188449516892433, 0.02477087639272213, 0.03206166252493858, -0.006293687969446182, -0.009060662239789963, -0.011437438428401947, 0.06379067897796631, -0.011357204057276249, -0.0010558008216321468, -0.014494282193481922, -0.051690541207790375, -0.02834164910018444, 0.029888708144426346, -0.019829953089356422, 0.049805015325546265, 0.04534219577908516, -0.014749503694474697, -0.02572617307305336, -0.01027490384876728, 0.04858311265707016, -0.018787821754813194, -0.022458551451563835, -0.006134150084108114, -0.00903906300663948, 0.02543502300977707, -0.0009392137872055173, -0.01269934419542551, 0.00997053924947977, -0.0053991954773664474, 0.03582896292209625, -0.01540306955575943, 0.008500033058226109, 0.034250203520059586, 0.005246371030807495, 0.02125120349228382, 0.01132180355489254, -0.032643262296915054, 0.03629999980330467, 0.017130278050899506, -0.02426384575664997, -0.006426321808248758, -0.03889773041009903, 0.01084214635193348, -0.0010366678470745683, 0.018393943086266518, 0.052898649126291275, 0.020528404042124748, 0.044750962406396866, 0.00004905068635707721, 0.044001102447509766, 0.0026960656978189945, 0.018689412623643875, 0.04779987409710884, 0.024615591391921043, -0.01601650007069111, 0.02523903362452984, 0.0034434765111654997, -0.0013739840360358357, -0.007407058961689472, -0.021374838426709175, 0.0012370621552690864, 0.02729797549545765, 0.005472761113196611, -0.04084160178899765, 0.007441550027579069, -0.03079187497496605, -0.005029156804084778, 0.023909926414489746, -0.011903033591806889, 0.06727390736341476, 0.04656597226858139, 0.010688197799026966, 0.005818404257297516, 0.017637958750128746, 0.02178993448615074, 0.021940521895885468, -0.012501456774771214, 0.007327348459511995, 0.00021879334235563874, -0.03457934781908989, 0.026833927258849144, 0.01250358484685421, 0.007506619207561016, 0.03128800541162491, -0.008103686384856701, -0.007852684706449509, -0.04419345036149025, -0.009118662215769291, 0.008877142332494259, -0.032860103994607925, 0.01453656516969204, 0.04374551400542259, 0.011705144308507442, -0.035864781588315964, 0.053373679518699646, 0.002614950994029641, -0.012805905193090439, -0.027636071667075157, -0.003238583914935589, -0.024587266147136688, 0.05788865312933922, -0.04255383461713791, -0.010305369272828102, -0.004829661920666695, 0.009806022979319096, 0.0031017763540148735, 0.03017008863389492, -0.04521455988287926, -0.04044581204652786, -0.025671249255537987, 0.019077638164162636, 0.018070681020617485, 0.022552426904439926, 0.0036044472362846136, -0.03323473781347275, 0.07400916516780853, 0.022951241582632065, -0.0068962532095611095, 0.02929513156414032, 0.0017418400384485722, 0.02252602018415928, -0.028917480260133743, 0.002947903471067548, 0.011294114403426647, -0.041601330041885376, 0.014771620742976665, -0.05154094099998474, 0.007955214940011501, 0.014558096416294575, 0.06147107109427452, 0.05079015716910362, 0.04835117608308792, -0.02186388336122036, -0.0099521204829216, -0.07562924921512604, -0.014480636455118656, 0.05553960055112839, 0.00219413498416543, -0.031231477856636047, 0.015129543840885162, -0.03119753673672676, -0.030452203005552292, 0.017651591449975967, 0.0055735451169312, 0.017592759802937508, 0.053891755640506744, -0.020714975893497467, -0.014421076513826847, -0.024831227958202362, 0.019264547154307365, 0.025978101417422295, 0.004421992227435112, 0.02568812295794487, 0.05348635092377663, -0.0008005512645468116, -0.05791749805212021, -0.024932043626904488, 0.008068897761404514, 0.00883483700454235, -0.04313158243894577, -0.024743275716900826, -0.030927980318665504, 0.024684185162186623, 0.01272334810346365, 0.006275803316384554, -0.05485662817955017, 0.01917748525738716, -0.045298151671886444, -0.036732688546180725, -0.0006767417653463781, -0.030210578814148903, 0.07849815487861633, 0.010270887985825539, 0.020742660388350487, -0.020858898758888245, -0.02017735131084919, 0.018997956067323685, -0.01578003540635109, -0.008552215062081814, 0.07813628762960434, -0.0005799578502774239, 0.007803371641784906, -0.04438629746437073, -0.05445726215839386, 0.021422119811177254, -0.04616934061050415, 0.028601158410310745, -0.01214950904250145, -0.03173235058784485, -0.0287674181163311, 0.022750552743673325, 0.029464220628142357, -0.004525044001638889, -0.009404916316270828, 0.018714791163802147, -0.03727118670940399, 0.041607506573200226, 0.011082787998020649, -0.03301478177309036, -0.053153350949287415, -0.001656082458794117, 0.0220240019261837, 0.007031358778476715, 0.0517968125641346, 0.03721844032406807, 0.05817798152565956, 0.009662607684731483, 0.016188422217965126, 0.012942538596689701, -0.0036510189529508352, -0.029207799583673477, 0.03477941080927849, 0.007459604647010565, 0.004141415469348431, -0.024176249280571938, 0.0038038359489291906, 0.03223036602139473, 0.023962033912539482, -0.011241094209253788, -0.008815942332148552, 0.04963753744959831, -0.029411574825644493, 0.026887478306889534, -0.01743915118277073, 0.003663798561319709, 0.014332663267850876, 0.017827019095420837, -0.015965944156050682, -0.04938258230686188 ]
Hugging Face Reads, Feb. 2021 - Long-range Transformers
VictorSanh
March 09, 2021
long-range-transformers
research, nlp
https://huggingface.co/blog/long-range-transformers
Main findings * The FAVOR+ procedure can be used to approximate self-attention matrices with high accuracy, without any priors on the form of the attention matrix, making it applicable as a drop-in replacement of standard self-attention and leading to strong performances in multiple applications and modalities. * The very thorough mathematical investigation of how-to and not-to approximate softmax highlights the relevance of principled methods developed in the early 2000s even in the deep learning era. * FAVOR+ can also be applied to efficiently model other kernelizable attention mechanisms beyond softmax.
[ 0.05234237387776375, -0.052189137786626816, 0.09261240810155869, -0.036156754940748215, -0.012740585021674633, 0.03075091354548931, -0.026679329574108124, 0.05471653863787651, -0.006197344046086073, -0.03905224800109863, -0.08979056030511856, 0.067466601729393, -0.032825544476509094, -0.02966642752289772, -0.039005130529403687, 0.05553817376494408, 0.09700286388397217, -0.004434945993125439, 0.03775125369429588, -0.03573749214410782, 0.01579507254064083, -0.03697694465517998, 0.0016899857437238097, -0.05310671404004097, -0.034037549048662186, 0.022779105231165886, -0.007420794107019901, -0.03389320150017738, -0.05154545232653618, -0.035210900008678436, -0.0408245250582695, 0.04183041304349899, -0.033613938838243484, -0.022176994010806084, 0.01668534241616726, -0.04844650626182556, -0.027008140459656715, -0.0017879835795611143, 0.034323550760746, -0.06766407191753387, -0.019687984138727188, -0.012088142335414886, -0.13196825981140137, 0.0034535585436969995, -0.04813229665160179, -0.09161762148141861, -0.09482601284980774, 0.06161845847964287, -0.0712931752204895, -0.042582374066114426, 0.013092485256493092, 0.06439037621021271, -0.0020395806059241295, 0.05243068188428879, 0.006535560358315706, 0.017955778166651726, 0.046753767877817154, -0.025028930976986885, -0.013973161578178406, 0.027658848091959953, 0.026764843612909317, -0.04888619855046272, 0.028494298458099365, 0.055237434804439545, 0.015336203388869762, 0.006526175886392593, 0.037596870213747025, 0.03488655015826225, -0.09713215380907059, -0.0007171823526732624, 0.004217217676341534, -0.07647135853767395, -0.05413103848695755, -0.012081039138138294, -0.008057931438088417, -0.04346847906708717, -0.0025352181401103735, 0.02316032536327839, 0.014163506217300892, -0.05954767391085625, 0.012992567382752895, -0.021680714562535286, 0.08287520706653595, -0.006041100714355707, 0.08126813173294067, 0.05696551501750946, 0.02373127080500126, -0.019927065819501877, 0.003988354001194239, 0.040482040494680405, -0.034262996166944504, -0.05875782668590546, 0.08061988651752472, 0.03138918802142143, 0.043004151433706284, -0.11117427051067352, 0.016678491607308388, -0.010229775682091713, 0.012837252579629421, 0.013326580636203289, -0.05858519300818443, -0.006938493344932795, 0.021536875516176224, -0.06341249495744705, 0.01202536839991808, 0.0033611287362873554, -0.03683817386627197, -0.0402977429330349, -0.03808274865150452, 0.0255950428545475, -0.05078084394335747, 0.07129766792058945, 0.04105076566338539, 0.04310426115989685, -0.06488057971000671, 0.059887517243623734, 0.016190895810723305, 0.01825924590229988, -0.043827831745147705, 0.031290724873542786, 0.0026109698228538036, 0.08868078142404556, 0.04166213050484657, -0.03146788105368614, 0.009781149215996265, 0.06752815842628479, 0.004849085118621588, -0.012495964765548706, -0.04914218187332153, 0.07272250205278397, 0.04492150992155075, -0.01747421734035015, 0.08714901655912399, 0.0007694124360568821, -0.01681293547153473, -0.037221476435661316, 0.026488076895475388, -0.06046730652451515, -0.04809361323714256, -0.004847624804824591, 0.0000770234182709828, -0.045641571283340454, 0.02891366370022297, -0.028576411306858063, 0.16747191548347473, -0.006352209486067295, -0.0156963262706995, 0.049791041761636734, 0.006684133782982826, 0.04491044953465462, -0.0399126261472702, -0.0030071598012000322, 0.02004222199320793, -0.06526128947734833, -0.01873011328279972, 0.021322820335626602, -0.010191229172050953, -0.05441010370850563, -0.029559634625911713, 0.02894439920783043, -0.011564702726900578, 0.018433675169944763, -0.045526232570409775, -0.0037432305980473757, 0.004502205643802881, 0.03530476614832878, 0.049665212631225586, 0.0059374128468334675, 0.020694730803370476, 0.064483143389225, 0.0314604826271534, 0.031538769602775574, 0.07850053161382675, -0.0495174378156662, -0.038441769778728485, 0.017908772453665733, -0.03500664606690407, 0.08893387019634247, -0.005088301841169596, 0.015565450303256512, -0.04472273960709572, -0.016277769580483437, -0.03622652217745781, 0.031814273446798325, 0.023339830338954926, -0.03325838968157768, 0.04109986498951912, 0.004912775009870529, 0.023991629481315613, -0.011660556308925152, -0.06935558468103409, 0.07870153337717056, 0.06298034638166428, 0.03467720001935959, 0.06955002248287201, 0.01069654617458582, -0.08359165489673615, 0.07294981926679611, 0.04069911316037178, 0.04781495779752731, 0.05032918229699135, -0.0662863701581955, -0.03695063665509224, -0.018303703516721725, -0.020764118060469627, -0.03206607326865196, -0.02274014800786972, 0.021410854533314705, 0.0043107615783810616, 0.04694158956408501, -0.047221630811691284, -0.05976574122905731, -0.048018742352724075, -0.03321916237473488, -0.039169248193502426, 0.030898364260792732, 0.006900109350681305, 0.029430843889713287, -0.09073076397180557, -0.025334568694233894, 0.14346057176589966, -0.013883927837014198, -0.05678651109337807, 0.011789541691541672, -0.06925599277019501, 0.054931215941905975, 0.016676392406225204, -0.032042134553194046, 0.011685442179441452, 0.049450263381004333, -0.0014973323559388518, -0.03479774296283722, 0.00876003410667181, 0.04633944481611252, 0.00009062556637218222, -0.004915142431855202, 0.000021700876459362917, 0.04049084335565567, -0.023483501747250557, -0.061693862080574036, -0.04166500270366669, -0.014026934280991554, -0.029407985508441925, 0.06380895525217056, 0.002779982052743435, -0.029023783281445503, -0.0008385216351598501, 0.046536143869161606, -0.005203685723245144, -0.014100895263254642, -0.08288978785276413, 0.0756605789065361, 0.030159154906868935, -0.09785602241754532, 0.007132772821933031, 0.04718371853232384, 0.023973986506462097, -0.012277320958673954, -0.004747392144054174, -0.0168090108782053, 0.00856101419776678, 0.004444032441824675, 0.012994782067835331, 0.029898906126618385, -0.0379771925508976, -0.0445781871676445, 0.07163488864898682, -0.00001595587673364207, 0.027757681906223297, 0.0024558333680033684, -0.011097773909568787, -0.0061866664327681065, 0.010458214208483696, 0.009174373932182789, -0.01658577471971512, -0.019792813807725906, 0.049139246344566345, -0.05517309904098511, 0.02193288505077362, -0.02756831794977188, 0.004793423227965832, 0.019681157544255257, 0.07107840478420258, 0.0334971658885479, -0.011453707702457905, -0.0072228554636240005, -0.0134998494759202, -0.027653884142637253, -0.006709854118525982, -0.011004629544913769, -0.001591077889315784, -0.007880082353949547, -0.01831730641424656, -0.030667800456285477, -0.048124928027391434, 0.0008761418866924942, -0.0008891826728358865, 0.018933715298771858, 0.006995351519435644, -0.020083054900169373, 0.03125374764204025, 0.005082320421934128, 0.009296196512877941, -0.035663992166519165, 0.00864359550178051, 0.056584857404232025, 0.01785244047641754, 0.006272889208048582, -0.08923188596963882, -0.054716672748327255, -0.055283114314079285, 0.014231553301215172, 0.008929543197154999, -0.012379717081785202, 0.0285892765969038, -0.0015874177915975451, -0.02198762632906437, -0.00906730443239212, -0.023707730695605278, -0.06357023119926453, -0.007675540167838335, 0.019984109327197075, -0.04190630093216896, 0.052732914686203, 0.05875227972865105, -0.005710171535611153, 0.024021156132221222, -0.032226186245679855, 0.008814002387225628, 0.03016182780265808, 0.0017188264755532146, -0.0063292114064097404, -0.010614858008921146, 0.006218687165528536, 0.011099287308752537, 0.037962693721055984, 0.019482990726828575, -0.05186276137828827, -0.002209569327533245, -0.04431382939219475, 0.003745111869648099, 0.054404016584157944, -0.023217614740133286, 0.03703838959336281, 0.02983461320400238, 0.023651763796806335, 0.028706641867756844, 0.030621623620390892, 0.015568595379590988, 0.018986038863658905, 0.03339947387576103, 0.009647408500313759, 0.029263190925121307, 0.008465748280286789, -0.026312205940485, -0.021641617640852928, -0.011751686222851276, -0.10667138546705246, -0.04898930341005325, -0.005185787100344896, 0.024941913783550262, 0.07049590349197388, 0.057958051562309265, -0.01745939813554287, 0.007978281006217003, 0.013889807276427746, 0.003987207543104887, 0.014944080263376236, -0.04725951328873634, 0.011421979404985905, 0.010961865074932575, 0.0083517050370574, -0.010428297333419323, 0.006987378466874361, 0.019584443420171738, -0.027125032618641853, 0.02667807787656784, 0.035222869366407394, -0.03300520032644272, -0.031044675037264824, 0.012446152046322823, 0.0047927056439220905, 0.013476038351655006, 0.03782523423433304, -0.01310664787888527, 0.013357717543840408, 0.021587375551462173, 0.04316093772649765, -0.013794378377497196, -0.02329038269817829, 0.030595190823078156, -0.009101338684558868, -0.014228515326976776, -0.019894426688551903, -0.004994495306164026, 0.0024228414986282587, 0.022928591817617416, -0.003397111315280199, -0.013045265339314938, -0.02571278251707554, 0.010755673982203007, -0.018565813079476357, -0.003694390645250678, -0.01464066281914711, 0.011544570326805115, 0.0022893124260008335, 0.05465882644057274, 0.004792900290340185, 0.015698935836553574, 0.012873528525233269, 0.036911819130182266, 0.020803244784474373, -0.003711311612278223, 0.004077538847923279, -0.049562226980924606, 0.02330889366567135, 0.026110367849469185, -0.02665886841714382, 0.005031005013734102, -0.013172298669815063, -0.008052757009863853, 0.032094694674015045, 0.041338756680488586, 0.034138575196266174, -0.015744050964713097, 0.012568974867463112, -0.03658013418316841, -0.030028052628040314, -0.03667155280709267, -0.03549790754914284, -0.03316700831055641, -0.018316760659217834, 0.01030114945024252, 0.026579860597848892, 0.027257151901721954, 0.01978159323334694, -0.009479411877691746, -0.005634053610265255, -0.014888902194797993, -0.006593699567019939, -0.004710123408585787, 0.025858517736196518, 0.030182955786585808, 0.03670792281627655, -0.018510404974222183, 0.048699844628572464, -0.04166015237569809, -0.04215151071548462, 0.028035800904035568, -0.023075204342603683, 0.012539935298264027, -0.031995970755815506, 0.00626536225900054, 0.006475294474512339, -0.05026627331972122, -0.0004241210117470473, -0.030955296009778976, 0.042918283492326736, 0.05320108309388161, -0.01892217807471752, 0.010586009360849857, 0.03572894260287285, 0.05574413388967514, -0.044694606214761734, 0.012204510159790516, -0.024815160781145096, 0.027712382376194, -0.008418481796979904, 0.014023899100720882, 0.025873398408293724, -0.04282550513744354, -0.008555221371352673, 0.00035680734436027706, -0.02958698756992817, 0.0062101371586322784, -0.037768714129924774, 0.03732255846261978, -0.006477440241724253, -0.0034738618414849043, -0.04641110450029373, 0.029953375458717346, -0.05467042326927185, -0.006464020349085331, 0.01285083219408989, 0.0204437468200922, 0.010515511967241764, -0.05709568038582802, 0.032871901988983154, -0.01682407781481743, -0.0024691857397556305, -0.0027944990433752537, 0.012033749371767044, 0.040713608264923096, -0.01672912947833538, 0.05088977888226509, 0.018746593967080116, -0.00988448690623045, 0.020240942016243935, 0.04886767268180847, 0.021570399403572083, -0.03333976864814758, 0.019027458503842354, 0.07272134721279144, 0.01678532175719738, 0.004266317468136549, 0.009529227390885353, -0.08047934621572495, -0.007173517718911171, 0.011432057246565819, 0.005057476926594973, -0.04188871011137962, 0.021367408335208893, -0.008922007866203785, 0.030850965529680252, -0.035596150904893875, -0.01564331352710724, 0.022185470908880234, -0.0031014890410006046, 0.003305660095065832, 0.004152398090809584, -0.030139967799186707, -0.013137171976268291, -0.0027386511210352182, 0.004472794476896524, 0.0025973638985306025, 0.021915756165981293, -0.041949380189180374, 0.004422066267579794, 0.041623812168836594, -0.033501289784908295, -0.05834094434976578, 0.03703315556049347, -0.006447973661124706, -0.0600510872900486, -0.03605986014008522, -0.028557484969496727, 0.0105451550334692, 0.04373548552393913, 0.03530393913388252, 0.01113911997526884, -0.021921321749687195, 0.005305311176925898, -0.016523748636245728, -0.06694038212299347, -0.028590256348252296, 0.08822531253099442, 0.01572592742741108, -0.015502994880080223, 0.011924735270440578, -0.002533758757635951, -0.037324752658605576, -0.008721360005438328, -0.060360293835401535, 0.017100604251027107, 0.017229793593287468, 0.06306895613670349, 0.05833960324525833, -0.0024348036386072636, 0.034372247755527496, -0.015547152608633041, 0.0014706746442243457, 0.018290041014552116, 0.004179170820862055, -0.030423663556575775, 0.005516767036169767, -0.025104012340307236, 0.003887300379574299, 0.019956080242991447, -0.009407262317836285, -0.005658586975187063, 0.0004815868742298335, 0.012361983768641949, -0.04637792333960533, 0.025527672842144966, 0.06051087751984596, -0.03729945793747902, -0.005950004793703556, 0.026401132345199585, 0.07509105652570724, 0.0013205822324380279, 0.015521853230893612, 0.027032405138015747, -0.012032030150294304, 0.005576463416218758, 0.019673138856887817, 0.013330662623047829, 0.007551777176558971, 0.008132288232445717, 9.178995128422685e-7, 0.023444484919309616, 0.0602896548807621, 0.015627367421984673, 0.019418172538280487, -0.03469226136803627, 0.027171647176146507, -0.048833779990673065, 0.015283317305147648, 0.013308723457157612, -0.0028241053223609924, 0.006611282471567392, -0.0022664403077214956, 0.00761442631483078, -0.034495990723371506, 0.06169551983475685, 0.030371151864528656, 0.03568827360868454, 0.034851402044296265, -0.01447316724807024, 0.016411129385232925, 0.02038193866610527, 0.06446778029203415, 0.03069867007434368, -0.023303020745515823, 0.025909705087542534, 0.03842918947339058, -0.02999907359480858, -0.024619629606604576, -0.0322486087679863, -0.007258753292262554, 0.04941008612513542, -0.021732890978455544, 0.03440719470381737, -0.05480983480811119, -0.031306520104408264, 0.008272658102214336, -0.008290350437164307, 0.011852282099425793, -0.001266001258045435, 0.008702676743268967, -0.00800485908985138, 0.0397975817322731, -0.013326512649655342, -0.0308243241161108, -0.0027477224357426167, 0.042877331376075745, -0.006708839908242226, -0.015551119111478329, 0.006354960147291422, 0.009040114469826221, 0.02870285138487816, -0.009054011665284634, 0.042271923273801804, 0.028024062514305115, -0.006989676505327225, 0.07944784313440323, -0.026672566309571266, -0.0547928623855114, -0.04051464423537254, -0.0708557590842247, 0.012870034202933311, 0.022448746487498283, 0.011950048618018627, -0.010032589547336102, 0.0049649192951619625, 0.04696044325828552, -0.007321749813854694, 0.005422556307166815, -0.010498647578060627, 0.02696019783616066, 0.04595120996236801, -0.061741892248392105, 0.058462947607040405, -0.015403445810079575, -0.026167772710323334, 0.0020690876990556717, -0.013880395330488682, -0.025649886578321457, -0.028498968109488487, 0.034499477595090866, -0.006626911927014589, -0.008577088825404644, -0.011919709853827953, 0.000894232071004808, -0.010149555280804634, 0.004779363516718149, 0.005483871325850487, -0.01891099102795124, 0.052073054015636444, -0.0395490936934948, 0.02584642730653286, 0.012238672003149986, -0.031739894300699234, 0.012490926310420036, 0.012520827353000641, -0.004591828212141991, 0.054351285099983215, -0.04007211700081825, -0.04560009390115738, 0.020517202094197273, -0.013989522121846676, 0.03064844384789467, 0.06851405650377274, 0.023202478885650635, 0.01758897863328457, -0.03989023342728615, -0.0406687967479229, -0.01124182716012001, -0.0142066590487957, -0.023073401302099228, -0.005804647225886583, -0.023540852591395378, 0.07109341770410538, -0.005160463508218527, -0.003757528029382229, -0.013846874237060547, 0.026708511635661125, -0.05834534019231796, -0.04163051024079323, -0.06074198707938194, -0.014775654301047325, 0.044293589890003204, -0.015081074088811874, -0.0024983577895909548, -0.033466145396232605, -0.06465679407119751, -0.03811320662498474, -0.015138082206249237, 0.016541657969355583, 0.04576537013053894, -0.03420112654566765, -0.009618736803531647, -0.016848992556333542, 0.004781228490173817, 0.005226328037679195, -0.016710519790649414, -0.009771926328539848, 0.01830747351050377, 0.0026171989738941193, -0.009900610893964767, -0.02922845631837845, -0.03854023665189743, 0.02018444985151291, 0.003167486749589443, 0.024463169276714325, -0.012800321914255619, 0.013291128911077976, -0.001381654990836978, 0.004943112842738628, 0.01632774993777275, 0.014343981631100178, 0.026208581402897835, 0.04461393877863884, 0.0032648039050400257, 0.04421152547001839, 0.0007120798691175878, -0.005219343118369579, 0.02234666422009468, -0.030460545793175697, 0.011840982362627983, -0.06510789692401886, 0.04465346038341522, 0.027198975905776024, -0.009019430726766586, -0.06955621391534805, -0.01004153024405241, 0.006121685728430748, -0.014446181245148182, 0.004496404435485601, -0.019011206924915314, 0.01194423995912075, -0.015415050089359283, -0.0030612298287451267, 0.00443880632519722, 0.08507321774959564, 0.00697728618979454, 0.04081867262721062, -0.01728794351220131, 0.0037643779069185257 ]
Hugging Face Reads, Feb. 2021 - Long-range Transformers
VictorSanh
March 09, 2021
long-range-transformers
research, nlp
https://huggingface.co/blog/long-range-transformers
Follow-up questions * Even if the approximation of the attention mechanism is tight, small errors propagate through the transformer layers. This raises the question of the convergence and stability of fine-tuning a pre-trained network with FAVOR+ as an approximation of self-attention. * The FAVOR+ algorithm is the combination of multiple components. It is not clear which of these components have the most empirical impact on the performance, especially in view of the variety of modalities considered in this work.
[ 0.06967136263847351, -0.0890774056315422, 0.08562994748353958, 0.007705217227339745, -0.007365352474153042, 0.005808503367006779, -0.032756634056568146, 0.1094343289732933, -0.014986001886427402, -0.027903158217668533, -0.0319877564907074, 0.09674612432718277, -0.007550610229372978, -0.04678849130868912, -0.11426449567079544, 0.03688505291938782, 0.08307184278964996, 0.026592569425702095, -0.041292883455753326, 0.014181180857121944, -0.01602146402001381, -0.06259248405694962, -0.027591269463300705, -0.0215311199426651, -0.03063766099512577, -0.022696224972605705, -0.048346806317567825, 0.008993672206997871, 0.00033220701152458787, -0.044353269040584564, -0.06168071925640106, -0.0018229784909635782, -0.0045396205969154835, -0.03867865353822708, -0.014001966454088688, -0.028288062661886215, -0.08054237812757492, 0.00315107055939734, 0.03256469964981079, -0.04979199543595314, -0.026510711759328842, -0.0026057783979922533, -0.11552754789590836, 0.05736839026212692, -0.001098050270229578, -0.08663956075906754, -0.09790518134832382, 0.053810372948646545, -0.06835584342479706, -0.039943188428878784, -0.018663261085748672, 0.021755754947662354, 0.05693987384438515, 0.05881265178322792, 0.017739776521921158, -0.007797249127179384, 0.041392236948013306, 0.05445412918925285, 0.02368347905576229, 0.04286216199398041, 0.03056185320019722, -0.024014241993427277, -0.008650144562125206, 0.01432223990559578, 0.03583656996488571, 0.04420723021030426, 0.02762996405363083, 0.07600576430559158, -0.08334340155124664, -0.0027154090348631144, 0.016493717208504677, -0.026043200865387917, 0.018645603209733963, 0.01341354101896286, -0.012741810642182827, 0.012388781644403934, 0.0007861701888032258, -0.0006257580243982375, -0.011249159462749958, -0.0870879516005516, -0.05043923854827881, 0.03597640246152878, 0.03485916554927826, 0.0507710836827755, 0.05009803548455238, 0.013409503735601902, 0.016867587342858315, 0.029730677604675293, -0.0500098317861557, 0.009868084453046322, -0.007991361431777477, -0.1298297792673111, -0.0010645582806318998, 0.0400068499147892, 0.041557736694812775, -0.04512307047843933, 0.01793406531214714, -0.03767956420779228, -0.04106924682855606, -0.029228994622826576, 0.018199702724814415, -0.037279851734638214, 0.0673493817448616, -0.02332126535475254, 0.0007371435058303177, 0.002254283521324396, -0.0381169468164444, -0.05011522024869919, -0.049610819667577744, 0.04108502343297005, 0.0006269671721383929, 0.038390133529901505, 0.030926154926419258, 0.03433647006750107, -0.061823613941669464, 0.03709873929619789, -0.05804136022925377, -0.026339389383792877, 0.002675356576219201, -0.008309368044137955, 0.011135237291455269, 0.11218152940273285, -0.022350743412971497, -0.02014632150530815, 0.013245739974081516, 0.0883905217051506, -0.03517255559563637, -0.03907959908246994, -0.034381940960884094, 0.0033432613126933575, 0.024843227118253708, -0.04187266528606415, 0.01984904147684574, -0.027032967656850815, 0.0006670341244898736, -0.02793349325656891, 0.024117253720760345, -0.05555284768342972, -0.05488138273358345, 0.004890828393399715, -0.02227984368801117, -0.026833361014723778, -0.004976869095116854, -0.005870253313332796, 0.10890214890241623, -0.028598053380846977, -0.07743306457996368, 0.1252094805240631, 0.048613540828228, 0.010391284711658955, -0.006672513671219349, 0.04059472307562828, -0.03494441136717796, -0.02945520728826523, -0.012289785780012608, 0.04238557070493698, -0.0027591162361204624, -0.029396727681159973, -0.06613311916589737, 0.0328449048101902, 0.02162015065550804, 0.03880530968308449, -0.006036294624209404, 0.05115221440792084, 0.04902169108390808, -0.001101840054616332, 0.02154354751110077, 0.059295255690813065, 0.019341526553034782, 0.057786975055933, 0.06431407481431961, 0.025979287922382355, 0.08806291222572327, -0.05826760455965996, -0.05219012498855591, 0.04406852647662163, -0.005460037384182215, 0.08231750875711441, 0.008400927297770977, -0.011243189685046673, 0.039974600076675415, 0.051757194101810455, -0.02738899178802967, 0.04630911722779274, 0.06785505264997482, -0.025856085121631622, 0.04792312905192375, -0.013426108285784721, -0.04305219277739525, 0.03786854445934296, -0.02662316896021366, 0.04808250069618225, 0.06365916132926941, -0.014637315645813942, 0.05291324108839035, -0.05189072713255882, -0.010799236595630646, 0.05811641365289688, 0.06716896593570709, 0.0030586121138185263, 0.0778375118970871, -0.04750146344304085, 0.025643445551395416, -0.0218907929956913, -0.04069038853049278, 0.009491628967225552, -0.05820886045694351, -0.007515279110521078, -0.009084400720894337, 0.02123395912349224, 0.03131351247429848, -0.07026231288909912, -0.06686858087778091, -0.015026161447167397, 0.008387379348278046, -0.01770978979766369, 0.004316763486713171, 0.009242694824934006, -0.07378953695297241, 0.022968553006649017, 0.07836313545703888, 0.027011962607502937, -0.06164427101612091, 0.05166785046458244, -0.054978158324956894, 0.025658586993813515, 0.03642963990569115, -0.04012346640229225, -0.015239810571074486, -0.01013137772679329, -0.006483554374426603, -0.03343301638960838, 0.005465392488986254, 0.0009760422399267554, 0.03311268985271454, -0.012495342642068863, -0.048383601009845734, 0.036753810942173004, 0.026093263179063797, -0.0769752487540245, 0.006079156883060932, 0.03070894069969654, -0.02051582559943199, 0.10419473797082901, -0.040979981422424316, -0.024450968950986862, 0.023442650213837624, 0.050740327686071396, -0.008927457965910435, 0.010565214790403843, -0.13051240146160126, 0.07516435533761978, 0.032038453966379166, -0.11972890049219131, -0.01988193765282631, -0.03265494853258133, 0.03204317018389702, -0.017816882580518723, 0.005434799939393997, 0.000026207519113086164, 0.015134051442146301, -0.0006955934222787619, -0.02150520123541355, 0.04021110758185387, 0.014290887862443924, -0.017864614725112915, 0.03222809359431267, 0.017689472064375877, 0.000127696170238778, -0.0011015621712431312, -0.0019646757282316685, 0.007336429785937071, 0.010279782116413116, 0.010398217476904392, -0.015086127445101738, 0.008091200143098831, 0.06696872413158417, -0.03183458745479584, -0.006880683358758688, -0.006107392255216837, -0.013619602657854557, 0.04915814474225044, 0.06968282908201218, 0.04195299744606018, 0.0007522414089180529, -0.008194400928914547, -0.0008605260518379509, -0.011148042976856232, -0.026111768558621407, -0.03642631322145462, -0.02148527279496193, -0.004394545219838619, -0.01872219331562519, -0.02609526924788952, -0.05259532481431961, -0.020958954468369484, 0.010593868792057037, 0.010119839571416378, 0.0007510621217079461, -0.05553083494305611, -0.01779980957508087, 0.007771150674670935, 0.033119458705186844, -0.025156090036034584, 0.009801682084798813, 0.04446106776595116, 0.015126127749681473, 0.03694309666752815, -0.07845639437437057, -0.045497097074985504, -0.0005296228337101638, 0.019447827711701393, -0.016643047332763672, -0.04129839688539505, -0.0019443014170974493, 0.018441690132021904, -0.010360576212406158, -0.010793390683829784, 0.002768944716081023, -0.05898762121796608, -0.010149721056222916, 0.012150916270911694, -0.011700497008860111, 0.00020437863713596016, 0.03863327577710152, -0.010582958348095417, 0.03575727343559265, -0.03151599317789078, -0.030164755880832672, 0.037527307868003845, 0.0032034870237112045, 0.0025284632574766874, -0.020959097892045975, 0.0227889996021986, 0.002219421323388815, 0.036807265132665634, -0.004987676162272692, -0.03650780767202377, -0.0051143537275493145, -0.021855829283595085, -0.0649028941988945, 0.04965204745531082, -0.026268446817994118, -0.0004786450299434364, 0.020279202610254288, 0.030052119866013527, 0.0292129497975111, 0.046181533485651016, 0.00917008239775896, -0.026046209037303925, 0.0197302158921957, 0.012181458063423634, 0.06035294011235237, 0.034947872161865234, -0.02302754484117031, -0.03551720082759857, -0.011418089270591736, -0.07176358997821808, -0.035849545150995255, 0.02497556246817112, 0.0006438931450247765, 0.024875402450561523, 0.0014606865588575602, 0.006947406567633152, -0.022572431713342667, -0.019161902368068695, 0.0318213552236557, 0.005053305067121983, -0.0647258386015892, 0.020627697929739952, -0.022826319560408592, -0.010030238889157772, -0.004497171379625797, 0.01752140186727047, 0.0007633891655132174, -0.030697211623191833, 0.027705423533916473, 0.03588047996163368, -0.03194336220622063, 0.003684436436742544, 0.012104067020118237, 0.004546963144093752, -0.008228774182498455, 0.00948997400701046, -0.03662160038948059, 0.035719189792871475, 0.06318482011556625, 0.012560420669615269, -0.026450935751199722, -0.019632447510957718, 0.020640330389142036, 0.0026738648302853107, -0.005646767560392618, -0.013314193114638329, 0.01740233413875103, -0.016227321699261665, 0.0492875762283802, 0.027583487331867218, 0.011455081403255463, -0.013112694956362247, 0.007807412184774876, -0.026190470904111862, -0.02246510051190853, 0.006755236070603132, -0.03988545760512352, 0.038028180599212646, 0.0251508466899395, 0.02382062003016472, -0.007860403507947922, -0.013160056434571743, 0.03750685602426529, 0.016137879341840744, -0.02270246483385563, 0.023853309452533722, -0.008087431080639362, 0.004449150990694761, 0.0010451276320964098, -0.022625723853707314, 0.038449596613645554, -0.0248098261654377, 0.005539509933441877, 0.019131235778331757, 0.05453766509890556, 0.018482953310012817, -0.005004704464226961, -0.010566359385848045, -0.0033748105634003878, -0.011090649291872978, -0.0026987388264387846, -0.017071163281798363, 0.0360131561756134, 0.00685139512643218, 0.01695077121257782, 0.038841333240270615, -0.025257643312215805, 0.01631009206175804, -0.017286011949181557, -0.026336774230003357, -0.035488635301589966, -0.015517988242208958, 0.023098375648260117, 0.00978446751832962, -0.005722785834223032, 0.04697014391422272, -0.02447456680238247, 0.02253592573106289, -0.01287520956248045, -0.026097126305103302, 0.035235147923231125, 0.007113644853234291, 0.018160533159971237, -0.07221926003694534, 0.033493757247924805, 0.04207008332014084, -0.0032772754784673452, -0.008135940879583359, -0.023366866633296013, -0.006402837112545967, 0.07803601026535034, -0.04490894451737404, 0.012954678386449814, 0.024424294009804726, 0.013137983158230782, -0.03873422369360924, 0.03415486961603165, -0.03072018176317215, 0.06092878058552742, 0.03853607177734375, 0.010187004692852497, 0.03095419518649578, -0.03637615591287613, 0.011728493496775627, 0.021792670711874962, -0.02350361831486225, -0.004699625540524721, -0.012230340391397476, -0.02583087608218193, -0.02360081486403942, 0.008994482457637787, -0.04441872239112854, -0.008549497462809086, -0.032451335340738297, 0.011341996490955353, -0.007245427928864956, -0.01685621589422226, -0.030288513749837875, -0.018882257863879204, -0.02108004130423069, 0.04079962894320488, -0.0018872793298214674, 0.010977201163768768, -0.006407907232642174, 0.030624233186244965, -0.024037059396505356, 0.051382724195718765, 0.03335816413164139, 0.0066146282479166985, 0.012896794825792313, 0.05499293655157089, 0.014285006560385227, -0.04885714128613472, 0.046579331159591675, 0.038679953664541245, 0.04074550047516823, -0.003654889529570937, -0.019136587157845497, -0.0397440642118454, 0.01083400659263134, 0.04781768098473549, 0.01730279251933098, -0.0015638124896213412, 0.0069476221688091755, -0.04609508812427521, -0.008410152047872543, -0.008602929301559925, -0.004897906444966793, -0.016171075403690338, -0.02261751890182495, 0.032960884273052216, 0.01882142201066017, -0.014848831109702587, 0.013721594586968422, -0.004020463675260544, -0.03145387023687363, -0.03271102160215378, 0.03259475529193878, 0.04429281875491142, 0.028790894895792007, -0.00683963717892766, -0.02403535135090351, -0.020890891551971436, -0.0016719071427360177, -0.016320088878273964, -0.0443764291703701, -0.013540972024202347, -0.025248661637306213, -0.008946497924625874, -0.005308119114488363, 0.03791690990328789, 0.021948492154479027, -0.02059508115053177, 0.0011994842207059264, -0.0486571304500103, -0.06324112415313721, -0.011371777392923832, 0.03428017720580101, 0.03431643173098564, 0.007059202995151281, 0.03450604900717735, -0.015249139629304409, -0.00911987479776144, 0.017171982675790787, -0.03114338591694832, 0.09491367638111115, 0.026505567133426666, 0.028989149257540703, 0.03817901015281677, -0.02073809690773487, 0.008370171301066875, 0.004386765882372856, -0.04672756791114807, -0.010119903832674026, -0.003036628244444728, -0.028025075793266296, -0.015468676574528217, -0.010214279405772686, -0.004260339308530092, -0.032273270189762115, -0.033398110419511795, -0.07289180904626846, 0.010930856689810753, 0.00409289263188839, -0.023118017241358757, -0.007683001458644867, 0.048517413437366486, -0.03470154106616974, 0.022585256025195122, 0.029275933280587196, 0.061953164637088776, -0.0033065988682210445, 0.04035035893321037, 0.009985636919736862, -0.01602163538336754, 0.004920742474496365, 0.008306983858346939, 0.020704369992017746, 0.027684355154633522, -0.034397006034851074, 0.04362552985548973, -0.02238660864531994, 0.08215872943401337, 0.02472114749252796, 0.004549054894596338, -0.024187704548239708, 0.03427034616470337, 0.005721225868910551, 0.017650529742240906, 0.002447630977258086, -0.0006328472518362105, -0.016141150146722794, 0.008139962330460548, -0.049388591200113297, -0.037403903901576996, 0.05064747482538223, 0.050032418221235275, 0.004341585095971823, 0.024747803807258606, 0.00356350583024323, -0.002147284336388111, 0.03831104934215546, 0.061981696635484695, 0.0002503844443708658, -0.001716016442514956, 0.018401116132736206, 0.018754329532384872, -0.004330073948949575, -0.029560457915067673, -0.02628438174724579, -0.024520250037312508, -0.003078396199271083, -0.02443966455757618, 0.04660423472523689, -0.07566406577825546, -0.028476811945438385, 0.016615787521004677, -0.009928008541464806, -0.0037881506141275167, 0.003026927588507533, 0.026372438296675682, -0.013050227425992489, 0.020174242556095123, 0.03116244450211525, -0.04583246260881424, -0.03856620937585831, 0.016188839450478554, 0.004446965176612139, -0.03584498167037964, -0.0068464926443994045, 0.0017027880530804396, 0.04972241073846817, -0.007126813288778067, -0.006752249784767628, -0.010728131979703903, -0.04064513370394707, 0.050590693950653076, 0.03237345069646835, -0.07216882705688477, -0.07096641510725021, -0.06941132247447968, 0.0314946286380291, 0.02274159900844097, 0.06949953734874725, 0.03688100352883339, 0.00908179022371769, 0.07513284683227539, -0.007016098126769066, -0.016320807859301567, -0.014399515464901924, 0.032293759286403656, -0.03205190226435661, -0.058344319462776184, 0.030836254358291626, 0.013321997597813606, -0.010898453183472157, 0.00791473314166069, -0.015253238379955292, -0.027899891138076782, -0.02698061242699623, 0.0530056469142437, 0.006877690553665161, 0.023487910628318787, -0.01218955498188734, 0.004545424599200487, 0.006226210854947567, -0.006384782958775759, 0.031173713505268097, 0.010533811524510384, 0.06645383685827255, -0.0419749990105629, -0.00479409983381629, 0.0047029717825353146, -0.05339302867650986, -0.02392233908176422, 0.007010624278336763, 0.031880877912044525, 0.022952228784561157, 0.0027767017018049955, -0.01902448944747448, 0.018835386261343956, 0.010444204322993755, 0.006069020833820105, 0.06973715126514435, 0.03305702283978462, 0.022537216544151306, -0.02472873404622078, -0.022380473092198372, -0.03867414966225624, -0.04092085361480713, -0.017734121531248093, -0.04045712575316429, -0.016597578302025795, 0.06092778220772743, -0.0016720793209969997, -0.028991542756557465, -0.03614421188831329, 0.00458516413345933, -0.054456498473882675, -0.008332006633281708, -0.03445297107100487, 0.020240947604179382, 0.03040420636534691, 0.006358745973557234, 0.004475207068026066, 0.006495649926364422, 0.00005417201100499369, -0.03256602957844734, -0.010285234078764915, -0.03622310608625412, 0.04574377089738846, -0.02480451762676239, 0.0064259422942996025, -0.04964675381779671, 0.03537096083164215, -0.026325693354010582, -0.005977277178317308, -0.02950812131166458, 0.04372348263859749, 0.010639656335115433, 0.021777555346488953, -0.06074526906013489, -0.0016886221710592508, 0.03338406980037689, 0.031117001548409462, -0.006665356922894716, -0.03306158259510994, 0.03262181207537651, 0.0028685748111456633, 0.03196744620800018, 0.020996522158384323, 0.029445011168718338, 0.041673507541418076, 0.035037536174058914, 0.013201076537370682, 0.01742316223680973, 0.025887098163366318, -0.030073989182710648, 0.04411919042468071, -0.02286141738295555, -0.06593242287635803, -0.07356906682252884, 0.05453974008560181, -0.0017279192106798291, -0.007256430108100176, -0.0504128560423851, 0.01856154389679432, 0.02884020283818245, -0.00036233573337085545, -0.03989970684051514, -0.016019631177186966, -0.0023752241395413876, -0.04348951578140259, -0.0005603532190434635, -0.0016949065029621124, 0.03434991091489792, -0.0030881220009177923, -0.007174432743340731, -0.016297973692417145, -0.007718035485595465 ]
Hugging Face Reads, Feb. 2021 - Long-range Transformers
VictorSanh
March 09, 2021
long-range-transformers
research, nlp
https://huggingface.co/blog/long-range-transformers
Longformer - The Long-Document Transformer Iz Beltagy, Matthew E. Peters, Arman Cohan Longformer addresses the memory bottleneck of transformers by replacing conventional self-attention with a combination of windowed/local/sparse (cf. Sparse Transformers (2019)) attention and global attention that scales linearly with the sequence length. As opposed to previous long-range transformer models (e.g. Transformer-XL (2019), Reformer (2020), Adaptive Attention Span (2019)), Longformer’s self-attention layer is designed as a drop-in replacement for the standard self-attention, thus making it possible to leverage pre-trained checkpoints for further pre-training and/or fine-tuning on long sequence tasks. The standard self-attention matrix (Figure a) scales quadratically with the input length: Figure taken from Longformer Longformer uses different attention patterns for autoregressive language modeling, encoder pre-training & fine-tuning, and sequence-to-sequence tasks. * For autoregressive language modeling, the strongest results are obtained by replacing causal self-attention (a la GPT2) with dilated windowed self-attention (Figure c). With \(n\) being the sequence length and \(w\) being the window length, this attention pattern reduces the memory consumption from \(n^2\) to \(wn\), which under the assumption that \(w << n\), scales linearly with the sequence length. * For encoder pre-training, Longformer replaces the bi-directional self-attention (a la BERT) with a combination of local windowed and global bi-directional self-attention (Figure d). This reduces the memory consumption from \(n^2\) to \(w n + g n\) with \(g\) being the number of tokens that are attended to globally, which again scales linearly with the sequence length. * For sequence-to-sequence models, only the encoder layers (a la BART) are replaced with a combination of local and global bi-directional self-attention (Figure d) because for most seq2seq tasks, only the encoder processes very large inputs (e.g. summarization). The memory consumption is thus reduced from \(n_s^2+ n_s n_t +n_t^2\) to \(w n_s +gn_s +n_s n_t +n_t^2\) with \(n_s\) and \(n_t\) being the source (encoder input) and target (decoder input) lengths respectively. For Longformer Encoder-Decoder to be efficient, it is assumed that \(n_s\) is much bigger than \(n_t\).
[ -0.024969009682536125, -0.0525580495595932, 0.033119723200798035, -0.004050830844789743, -0.03364650160074234, 0.011777788400650024, -0.04789034277200699, -0.01646357588469982, 0.021834827959537506, -0.012549664825201035, -0.09610358625650406, 0.11701757460832596, 0.017162377014756203, 0.0596599318087101, -0.03912901505827904, 0.06983373314142227, 0.08269211649894714, -0.06726894527673721, -0.023282084614038467, -0.02133282646536827, 0.026507515460252762, -0.06267648190259933, 0.09566397964954376, 0.06022460758686066, 0.00019051451818086207, -0.007730958983302116, -0.019967814907431602, 0.03652002662420273, -0.08859720081090927, 0.006862257607281208, -0.1139598861336708, -0.023932747542858124, 0.030820248648524284, -0.01597931608557701, 0.020221738144755363, -0.011323575861752033, -0.09315293282270432, 0.026747452095150948, 0.009820537641644478, -0.03208273649215698, -0.028358548879623413, 0.024129139259457588, -0.07699646055698395, 0.05443815886974335, 0.02568068541586399, -0.02086733654141426, -0.09205561131238937, 0.06154361739754677, -0.016992293298244476, 0.009017313830554485, -0.09543952345848083, 0.10389340668916702, 0.015223728492856026, 0.03868446499109268, -0.002990975044667721, 0.010441196151077747, 0.013932467438280582, -0.034729354083538055, 0.017109595239162445, -0.022587407380342484, 0.019278863444924355, 0.009696504101157188, -0.001674177125096321, 0.011265316046774387, 0.016429884359240532, -0.08114473521709442, -0.027376050129532814, 0.018221648409962654, -0.07491657137870789, -0.03260188549757004, -0.03211226686835289, -0.014458693563938141, -0.005547666922211647, 0.02782563865184784, -0.0670420452952385, -0.020489532500505447, 0.0023409733548760414, 0.024561194702982903, -0.0024263516534119844, 0.00961674191057682, 0.018226174637675285, 0.07297901064157486, 0.05720816180109978, 0.01598919928073883, -0.028934020549058914, -0.010290523059666157, 0.028112083673477173, -0.08858807384967804, -0.06643113493919373, 0.016845859587192535, -0.02084963023662567, -0.15111228823661804, -0.02038447931408882, -0.032468199729919434, 0.03445225581526756, -0.0497233122587204, 0.005869187414646149, 0.0422123484313488, -0.048627737909555435, -0.0374690480530262, -0.01659180037677288, 0.01627560518682003, 0.07939419150352478, -0.047327883541584015, -0.07532690465450287, 0.011341831646859646, -0.013366036117076874, -0.0845935046672821, 0.043174147605895996, -0.04177781939506531, 0.00030304043320938945, 0.05258167162537575, -0.04009297117590904, 0.040642477571964264, -0.05715566873550415, 0.029125245288014412, 0.028149714693427086, 0.017669476568698883, 0.005509223323315382, -0.004483177326619625, -0.08573607355356216, 0.11221002787351608, 0.07047079503536224, -0.00265327375382185, -0.02366810478270054, 0.0065276166424155235, -0.026621093973517418, -0.02205684781074524, 0.006103528663516045, -0.0534619502723217, 0.11067140847444534, -0.02205118164420128, 0.0386987179517746, 0.02975788339972496, -0.02831542305648327, -0.028830600902438164, 0.038585614413022995, -0.021711403504014015, -0.010745558887720108, -0.01899873837828636, -0.06738438457250595, 0.01862877421081066, 0.01252791564911604, -0.07752519845962524, 0.047763578593730927, -0.017921634018421173, -0.09903337806463242, 0.10173588246107101, 0.08396697789430618, 0.011620302684605122, -0.051900316029787064, 0.006614461541175842, -0.04173418879508972, -0.027771489694714546, 0.03581314533948898, 0.03476989269256592, 0.02905566431581974, 0.010426885448396206, -0.053179118782281876, -0.02888593263924122, -0.03619389608502388, 0.090704046189785, -0.012820879928767681, 0.06025877594947815, 0.007404309697449207, -0.09075263887643814, 0.023927923291921616, 0.0320010669529438, 0.024321526288986206, 0.014961871318519115, 0.05108436197042465, 0.04209696501493454, 0.08021844178438187, 0.009018856100738049, -0.06551343202590942, 0.0059749046340584755, 0.005609126295894384, 0.06575015932321548, -0.0066635990515351295, -0.004315183963626623, -0.03942913934588432, 0.0028227355796843767, 0.007031410466879606, 0.01608116738498211, 0.026196463033556938, -0.060708265751600266, 0.04580077528953552, -0.003010099520906806, -0.03991810232400894, -0.03962576389312744, -0.046635884791612625, 0.03398597985506058, 0.028358440846204758, -0.00985308364033699, 0.02261795848608017, -0.023900164291262627, -0.04726819321513176, 0.06104610115289688, 0.061723534017801285, 0.05269351601600647, 0.057855669409036636, 0.030919086188077927, 0.026893839240074158, 0.012434021569788456, 0.02650020271539688, 0.0046590701676905155, -0.018551839515566826, 0.015427620150148869, 0.0799064040184021, 0.001628776197321713, 0.04726671800017357, -0.10383722186088562, -0.00990248005837202, -0.005120499059557915, 0.0328294076025486, -0.042462997138500214, 0.03902564197778702, 0.013876881450414658, 0.003322357777506113, 0.04729298874735832, 0.15223291516304016, -0.04252048209309578, -0.03846414387226105, 0.007998206652700901, -0.01851610094308853, 0.0367361456155777, 0.05687308311462402, -0.044243741780519485, 0.03226013481616974, -0.040217842906713486, 0.014151439070701599, -0.050350259989500046, 0.04263352230191231, -0.021741492673754692, -0.018782170489430428, -0.02006164751946926, -0.05002932250499725, -0.005239524412900209, 0.021393025293946266, -0.05274372547864914, -0.015601356513798237, 0.01281485240906477, 0.03495365008711815, 0.019515151157975197, -0.04470296576619148, -0.0022237638477236032, 0.0007702835719101131, 0.0565505214035511, -0.03405526652932167, -0.04002823680639267, -0.047021377831697464, 0.09442383050918579, 0.009511617012321949, -0.08163480460643768, 0.007097306661307812, 0.053759850561618805, -0.018270395696163177, -0.05252161622047424, 0.050565410405397415, 0.02181103639304638, 0.01726904697716236, 0.030669061467051506, -0.04628566652536392, -0.03929471969604492, -0.002891122130677104, -0.04762249067425728, 0.028056195005774498, -0.027643997222185135, 0.03284672275185585, 0.00020824797684326768, 0.01882854662835598, 0.011922040954232216, -0.015358311124145985, 0.024968452751636505, -0.003182783955708146, 0.022838810458779335, 0.02148693986237049, -0.010253692977130413, -0.041021592915058136, -0.06184281036257744, 0.024710604920983315, -0.031994953751564026, 0.04843953624367714, 0.003216417506337166, 0.0251399464905262, 0.013403531163930893, 0.018839040771126747, -0.013277140446007252, -0.005320210475474596, -0.01668713055551052, -0.022176388651132584, 0.031303271651268005, -0.006632980424910784, 0.007446026895195246, -0.01895095221698284, 0.050500597804784775, 0.02519150637090206, -0.0018800245597958565, -0.0014342193026095629, 0.007135334424674511, -0.019452808424830437, 0.027615902945399284, 0.02859954722225666, 0.021939633414149284, -0.005424585193395615, 0.01612698659300804, -0.0008351320284418762, 0.08839195221662521, -0.08010391891002655, -0.06996764987707138, -0.013464223593473434, 0.002556012012064457, -0.05358634516596794, -0.05951373651623726, 0.008155928924679756, 0.03139205276966095, -0.01384798064827919, -0.03007538616657257, -0.014535828493535519, 0.0020189424976706505, 0.002902803011238575, -0.001412091893143952, 0.0008699774625711143, 0.03856289014220238, -0.0053710355423390865, -0.029011128470301628, 0.04538093879818916, 0.012156650424003601, 0.008590811863541603, -0.013389011844992638, -0.007439078763127327, -0.005605182610452175, -0.018386373296380043, 0.006082148756831884, -0.02231345884501934, 0.005745230708271265, 0.014345374889671803, 0.02639726549386978, -0.011155379004776478, -0.02228640578687191, 0.038322024047374725, 0.04993659630417824, -0.017436407506465912, 0.010352951474487782, 0.010104617103934288, 0.04570196196436882, 0.02668432705104351, 0.05987957492470741, 0.07019586861133575, -0.008587400428950787, 0.034797824919223785, 0.015131250955164433, 0.06335418671369553, -0.02871059998869896, -0.019757943227887154, -0.060792069882154465, -0.006201402749866247, -0.017338301986455917, -0.036601513624191284, -0.01914416439831257, -0.0220570657402277, 0.015095595270395279, -0.014512276276946068, -0.03313184157013893, 0.0055176508612930775, -0.03343489021062851, -0.018223358318209648, 0.014724633656442165, -0.03259105235338211, 0.002391617512330413, -0.027938630431890488, -0.006406603381037712, 0.007367551792412996, 0.042112115770578384, 0.02234361506998539, -0.013672263361513615, -0.0038539778906852007, 0.029017796739935875, -0.045339394360780716, 0.012442202307283878, 0.026634180918335915, 0.0002542140136938542, -0.03766241669654846, 0.01631818898022175, 0.013448342680931091, 0.006276518572121859, 0.06499398499727249, 0.008681084960699081, -0.023416869342327118, -0.00427126232534647, -0.02918810024857521, -0.011749902740120888, -0.02063322626054287, 0.007329026237130165, 0.05125362426042557, 0.01744244620203972, 0.08953922986984253, 0.0023247527424246073, 0.01236563827842474, -0.02059049904346466, 0.02894425392150879, -0.014189879409968853, -0.014635981060564518, -0.0028559518977999687, -0.008345860987901688, 0.013319390825927258, 0.03432610258460045, -0.013588585890829563, 0.01821320503950119, -0.06801394373178482, 0.016485411673784256, 0.019693395122885704, -0.011358465999364853, 0.03346652165055275, -0.04045190289616585, 0.037209801375865936, -0.008383063599467278, 0.016749253496527672, 0.014607367105782032, -0.017574435099959373, -0.007002363447099924, 0.01389257051050663, 0.023489080369472504, 0.0008964219596236944, -0.04001348093152046, -0.042181387543678284, -0.037932123988866806, 0.000032475571060786024, -0.005897474940866232, -0.004638149868696928, -0.003407740732654929, 0.008194982074201107, 0.04660404846072197, -0.001487621571868658, 0.027863724157214165, 0.0238913856446743, 0.0004975152551196516, -0.027847398072481155, -0.04662498086690903, -0.03322122246026993, 0.02593185007572174, -0.002777093555778265, 0.003397532505914569, 0.017061708495020866, -0.03327851742506027, 0.0072676935233175755, -0.00508437305688858, 0.0070958989672362804, -0.03259153291583061, -0.034827008843421936, 0.024509316310286522, -0.058207426220178604, 0.004757042042911053, -0.03391179069876671, -0.040502939373254776, 0.016173552721738815, -0.054071374237537384, 0.03134876489639282, 0.04308881238102913, 0.0003040895680896938, -0.02802499197423458, 0.013671647757291794, 0.035237979143857956, -0.013678625226020813, 0.026832494884729385, 0.03340145945549011, 0.02980281412601471, 0.026470063254237175, 0.014368964359164238, 0.00692503247410059, -0.07940331846475601, 0.007593900430947542, 0.008529232814908028, 0.021194903180003166, 0.023613963276147842, -0.03669416904449463, 0.02513144537806511, 0.013731452636420727, -0.04554552957415581, -0.028248026967048645, -0.0007016769959591329, -0.02392311580479145, 0.002739821095019579, 0.005782897584140301, -0.009497934952378273, 0.005223044194281101, -0.014260812662541866, 0.03159267455339432, 0.02489737793803215, 0.012728570029139519, 0.012122133746743202, 0.0025342844892293215, 0.013332370668649673, 0.011769639328122139, 0.053764164447784424, 0.03796183317899704, -0.029200630262494087, 0.07000692188739777, 0.06774936616420746, -0.002960426500067115, 0.008021155372262001, -0.014632158912718296, -0.012581717222929, -0.022046010941267014, 0.03218706697225571, 0.024070028215646744, -0.007476195227354765, 0.0028754647355526686, 0.06920013576745987, 0.026254309341311455, -0.032874349504709244, -0.022023789584636688, 0.027537059038877487, 0.01543612964451313, -0.026581905782222748, -0.05054767429828644, -0.02506428211927414, -0.015369992703199387, 0.04084878787398338, -0.009400366805493832, -0.02521471306681633, -0.017786595970392227, 0.02442084066569805, -0.041362639516592026, -0.004613407421857119, 0.04224821925163269, 0.014773020520806313, 0.04435588791966438, -0.00823613815009594, 0.021959323436021805, -0.007242502178996801, 0.013822820968925953, -0.013241582550108433, -0.047191765159368515, -0.010780198499560356, 0.00689981784671545, 0.02734724059700966, 0.001139886793680489, 0.021393874660134315, -0.022862736135721207, 0.012385949492454529, 0.013655554503202438, -0.0074380203150212765, -0.04650052264332771, -0.027894480153918266, 0.06437801569700241, 0.014297515153884888, 0.02345382422208786, 0.027173643931746483, -0.007724352180957794, -0.017223285511136055, 0.05749070644378662, -0.019939644262194633, 0.05212702602148056, 0.041831303387880325, -0.018953828141093254, -0.00796342920511961, -0.02053758129477501, 0.02391086146235466, -0.014234187081456184, 0.0008453187765553594, -0.005559387616813183, 0.038207534700632095, 0.030137300491333008, -0.015926677733659744, 0.006984890904277563, 0.0032372118439525366, 0.014191540889441967, -0.0003456916310824454, -0.027259094640612602, -0.002088711131364107, 0.02136591076850891, -0.010788497515022755, 0.030133575201034546, 0.06613362580537796, -0.040455181151628494, -0.008878353051841259, 0.027152152732014656, -0.0140623077750206, -0.012741496786475182, -0.04503331333398819, -0.024690069258213043, 0.002837334992364049, -0.019926950335502625, 0.051578715443611145, 0.029705921187996864, 0.037734612822532654, 0.04387875273823738, 0.025361664593219757, 0.025286220014095306, 0.04650669917464256, 0.020279815420508385, 0.003427057061344385, -0.02793833613395691, 0.001082289032638073, -0.023606140166521072, -0.014797521755099297, 0.0042861285619437695, -0.032477863132953644, -0.011101235635578632, 0.0007041902863420546, 0.01074781734496355, -0.05874181166291237, 0.0024622499477118254, 0.018465323373675346, 0.014745719730854034, 0.017439521849155426, -0.005177841056138277, 0.03771612048149109, 0.03710690513253212, 0.034766316413879395, -0.0032210499048233032, 0.022451482713222504, 0.022440779954195023, 0.010134454816579819, 0.026902813464403152, 0.014462725259363651, 0.009919920936226845, -0.026510845869779587, 0.03461170941591263, 0.00844634510576725, 0.027051882818341255, 0.025297990068793297, -0.05722561851143837, -0.03336159139871597, -0.06929930299520493, -0.0283100176602602, 0.023289760574698448, 0.02469070442020893, -0.03478490933775902, 0.030606362968683243, 0.008168017491698265, -0.024044806137681007, 0.053100280463695526, 0.022359460592269897, -0.04034764692187309, 0.017063170671463013, -0.04191676154732704, 0.025622868910431862, 0.023849301040172577, -0.0019892288837581873, -0.017159678041934967, 0.00488654850050807, 0.03794093430042267, 0.0050341421738266945, 0.03527698665857315, -0.0008983395528048277, -0.03567628934979439, -0.021681340411305428, 0.0005129279452376068, -0.013075655326247215, 0.043335337191820145, 0.025722438469529152, -0.011384936049580574, 0.03873568773269653, 0.05024994537234306, -0.012184275314211845, 0.010287095792591572, 0.010364060290157795, -0.03097689338028431, -0.04409080743789673, 0.00915108248591423, -0.014881463721394539, -0.07243426889181137, 0.024305732920765877, -0.03434457257390022, 0.025030240416526794, -0.036927543580532074, 0.021299496293067932, 0.04081841558218002, 0.025568990036845207, 0.014101455919444561, 0.005603776779025793, -0.044612981379032135, -0.026588326320052147, -0.0030776693020015955, -0.0018141509499400854, 0.018200170248746872, -0.031274814158678055, -0.008302979171276093, -0.03573798015713692, -0.028726551681756973, -0.005155688617378473, 0.017158877104520798, 0.06701895594596863, 0.011754589155316353, -0.05066997930407524, -0.03609326481819153, 0.023029133677482605, 0.004510427359491587, 0.019554128870368004, 0.032994162291288376, 0.01404324360191822, 0.038001492619514465, -0.029169755056500435, -0.04343832656741142, 0.023386335000395775, -0.027807438746094704, -0.03534768149256706, -0.037053607404232025, -0.032804299145936966, 0.021042093634605408, 0.014187490567564964, -0.00015520717715844512, -0.05032447353005409, 0.044233161956071854, -0.059185128659009933, -0.012052517384290695, -0.013353625312447548, -0.03829037398099899, 0.05455375462770462, -0.015753671526908875, 0.029719876125454903, -0.011471693404018879, -0.03622103109955788, -0.02958088368177414, -0.03219219297170639, 0.0024340683594346046, 0.050654880702495575, -0.010667992755770683, 0.006416034884750843, -0.017018690705299377, -0.0030823538545519114, 0.004689706955105066, -0.0513562336564064, 0.0050562527030706406, 0.0015715964836999774, -0.01709420047700405, -0.0013597180368378758, 0.009495135396718979, 0.011554116383194923, 0.027796104550361633, -0.0008426687563769519, 0.000529540004208684, -0.03377968445420265, 0.030925748869776726, 0.002047747140750289, -0.031563445925712585, -0.041851747781038284, -0.01113306637853384, 0.04340365529060364, 0.04112907871603966, 0.004809584468603134, 0.010630615055561066, 0.013452243059873581, 0.009572005830705166, -0.0018227961845695972, 0.040000077337026596, -0.014599191024899483, -0.03961293026804924, 0.06871883571147919, -0.0023467252030968666, 0.010184140875935555, -0.044696904718875885, -0.012277345173060894, 0.03469623252749443, 0.04922313988208771, -0.011449855752289295, -0.017560593783855438, 0.03195223584771156, -0.08113490045070648, 0.04654199257493019, -0.019803619012236595, -0.014975719153881073, 0.0028861933387815952, 0.028822410851716995, 0.012674134224653244, -0.028513118624687195 ]
Fine-Tune Wav2Vec2 for English ASR with 🤗 Transformers
patrickvonplaten
March 12, 2021
fine-tune-wav2vec2-english
guide, audio
https://huggingface.co/blog/fine-tune-wav2vec2-english
Preprocess Data So far, we have not looked at the actual values of the speech signal but just the transcription. In addition to sentence, our datasets include two more column names path and audio. path states the absolute path of the audio file. Let's take a look. python print(timit[0]["path"]) Print Output: bash '/root/.cache/huggingface/datasets/downloads/extracted/404950a46da14eac65eb4e2a8317b1372fb3971d980d91d5d5b221275b1fd7e0/data/TRAIN/DR4/MMDM0/SI681.WAV' Wav2Vec2 expects the input in the format of a 1-dimensional array of 16 kHz. This means that the audio file has to be loaded and resampled. Thankfully, datasets does this automatically by calling the other column audio. Let try it out. python common_voice_train[0]["audio"] Print Output: bash {'array': array([-2.1362305e-04, 6.1035156e-05, 3.0517578e-05, ..., -3.0517578e-05, -9.1552734e-05, -6.1035156e-05], dtype=float32), 'path': '/root/.cache/huggingface/datasets/downloads/extracted/404950a46da14eac65eb4e2a8317b1372fb3971d980d91d5d5b221275b1fd7e0/data/TRAIN/DR4/MMDM0/SI681.WAV', 'sampling_rate': 16000} We can see that the audio file has automatically been loaded. This is thanks to the new "Audio" feature introduced in datasets == 4.13.3, which loads and resamples audio files on-the-fly upon calling. The sampling rate is set to 16kHz which is what Wav2Vec2 expects as an input. Great, let's listen to a couple of audio files to better understand the dataset and verify that the audio was correctly loaded. python import IPython.display as ipd import numpy as np import random rand_int = random.randint(0, len(timit["train"])) print(timit["train"][rand_int]["text"]) ipd.Audio(data=np.asarray(timit["train"][rand_int]["audio"]["array"]), autoplay=True, rate=16000) It can be heard, that the speakers change along with their speaking rate, accent, etc. Overall, the recordings sound relatively clear though, which is to be expected from a read speech corpus. Let's do a final check that the data is correctly prepared, by printing the shape of the speech input, its transcription, and the corresponding sampling rate. python rand_int = random.randint(0, len(timit["train"])) print("Target text:", timit["train"][rand_int]["text"]) print("Input array shape:", np.asarray(timit["train"][rand_int]["audio"]["array"]).shape) print("Sampling rate:", timit["train"][rand_int]["audio"]["sampling_rate"]) Print Output: bash Target text: she had your dark suit in greasy wash water all year Input array shape: (52941,) Sampling rate: 16000 Good! Everything looks fine - the data is a 1-dimensional array, the sampling rate always corresponds to 16kHz, and the target text is normalized. Finally, we can process the dataset to the format expected by the model for training. We will make use of the map(...) function. First, we load and resample the audio data, simply by calling batch["audio"]. Second, we extract the input_values from the loaded audio file. In our case, the Wav2Vec2Processor only normalizes the data. For other speech models, however, this step can include more complex feature extraction, such as Log-Mel feature extraction. Third, we encode the transcriptions to label ids. Note: This mapping function is a good example of how the Wav2Vec2Processor class should be used. In "normal" context, calling processor(...) is redirected to Wav2Vec2FeatureExtractor's call method. When wrapping the processor into the as_target_processor context, however, the same method is redirected to Wav2Vec2CTCTokenizer's call method. For more information please check the docs. python def prepare_dataset(batch): audio = batch["audio"] # batched output is "un-batched" to ensure mapping is correct batch["input_values"] = processor(audio["array"], sampling_rate=audio["sampling_rate"]).input_values[0] with processor.as_target_processor(): batch["labels"] = processor(batch["text"]).input_ids return batch Let's apply the data preparation function to all examples. python timit = timit.map(prepare_dataset, remove_columns=timit.column_names["train"], num_proc=4) Note: Currently datasets make use of torchaudio and librosa for audio loading and resampling. If you wish to implement your own costumized data loading/sampling, feel free to just make use of the "path" column instead and disregard the "audio" column. Training & Evaluation --------------------- The data is processed so that we are ready to start setting up the training pipeline. We will make use of 🤗\'s Trainer for which we essentially need to do the following: - Define a data collator. In contrast to most NLP models, Wav2Vec2 has a much larger input length than output length. E.g., a sample of input length 50000 has an output length of no more than 100. Given the large input sizes, it is much more efficient to pad the training batches dynamically meaning that all training samples should only be padded to the longest sample in their batch and not the overall longest sample. Therefore, fine-tuning Wav2Vec2 requires a special padding data collator, which we will define below - Evaluation metric. During training, the model should be evaluated on the word error rate. We should define a compute_metrics function accordingly - Load a pretrained checkpoint. We need to load a pretrained checkpoint and configure it correctly for training. - Define the training configuration. After having fine-tuned the model, we will correctly evaluate it on the test data and verify that it has indeed learned to correctly transcribe speech.
[ -0.0023100802209228277, -0.020732784643769264, -0.027821645140647888, 0.02877771109342575, 0.03517230600118637, 0.05849740654230118, 0.07362200319766998, 0.02381877601146698, -0.0485445074737072, -0.05554479360580444, -0.06855520606040955, 0.05202912911772728, -0.01775178872048855, 0.007756897248327732, -0.02098139375448227, -0.06552902609109879, 0.0005707440432161093, -0.04396769404411316, 0.008574363775551319, 0.03287792578339577, -0.01090247742831707, -0.02390352636575699, 0.07212644070386887, 0.0793677270412445, 0.025556400418281555, -0.028377968817949295, 0.0028021479956805706, 0.00946503784507513, -0.0811619833111763, 0.027536777779459953, -0.16612564027309418, 0.03167638182640076, -0.0028169152792543173, -0.020823752507567406, 0.004922404885292053, 0.04215024784207344, -0.09073011577129364, 0.029327627271413803, 0.005595986265689135, -0.032082729041576385, -0.05074523389339447, -0.01850738376379013, -0.08795677870512009, 0.06558316200971603, -0.04010561481118202, -0.09815800189971924, -0.12816618382930756, 0.032707925885915756, -0.03400416299700737, -0.008394190110266209, -0.06659115850925446, 0.07517237216234207, -0.01273458544164896, 0.011666171252727509, 0.03559635579586029, -0.03609272092580795, 0.020678123459219933, 0.0010535799665376544, 0.0605572871863842, -0.01834578812122345, 0.018493738025426865, -0.02166261523962021, 0.034417156130075455, 0.023282624781131744, 0.08578617870807648, 0.005802547093480825, 0.02998308651149273, 0.07705019414424896, -0.0261943731456995, -0.012434495612978935, 0.01258039940148592, 0.015709996223449707, 0.017469484359025955, -0.00829791184514761, -0.019282106310129166, 0.006793210282921791, -0.0095798559486866, 0.04390707612037659, 0.0046420712023973465, 0.03670448064804077, -0.00947322603315115, 0.008032962679862976, -0.007898852229118347, 0.06169573590159416, 0.037024788558483124, -0.015333183109760284, 0.06405966728925705, -0.0017608286580070853, -0.06195053458213806, 0.018566442653536797, 0.04088379070162773, -0.08435167372226715, 0.000018009106497629546, 0.05105939134955406, 0.03421845659613609, 0.0030052228830754757, 0.021899547427892685, 0.03565049543976784, 0.0029185167513787746, 0.03289106488227844, -0.01727033220231533, -0.03457427769899368, 0.0735427588224411, 0.008682669140398502, -0.02371308021247387, 0.08660025894641876, -0.08149074018001556, -0.01673891209065914, -0.0639892965555191, -0.016701528802514076, 0.029090750962495804, 0.015482956543564796, 0.031203333288431168, 0.05097823962569237, -0.057276658713817596, 0.0059562064707279205, -0.008430300280451775, 0.014636940322816372, -0.024976016953587532, 0.040420111268758774, -0.014441551640629768, 0.059670768678188324, 0.019767899066209793, 0.025735698640346527, -0.023478351533412933, 0.006433421280235052, 0.03286735340952873, 0.03252281993627548, 0.08322104811668396, 0.009823134168982506, -0.04684216156601906, -0.007580558769404888, 0.1048974096775055, 0.045036546885967255, 0.0019658231176435947, -0.04560332000255585, -0.04112778604030609, -0.013729754835367203, 0.05497322976589203, -0.00552362808957696, 0.039505328983068466, 0.08345996588468552, -0.04263634979724884, 0.009563193656504154, 0.0321480892598629, 0.007821404375135899, -0.0676894262433052, 0.03380577638745308, -0.010316516272723675, 0.037851955741643906, -0.055174242705106735, 0.0658029243350029, 0.02627214789390564, -0.05183140188455582, 0.028021689504384995, 0.026056228205561638, -0.01442744955420494, -0.03551361337304115, -0.0927066057920456, 0.018827568739652634, 0.032732732594013214, 0.009173544123768806, -0.038110245019197464, -0.04968254640698433, -0.033536750823259354, -0.041182830929756165, -0.051461078226566315, 0.03231550753116608, 0.024727262556552887, 0.033997658640146255, -0.036703065037727356, -0.059591300785541534, 0.07351920753717422, 0.021138912066817284, -0.01392935961484909, 0.03342779725790024, 0.0015902708983048797, 0.01648734323680401, -0.0406448170542717, 0.00490418728441, 0.018235035240650177, 0.06009813770651817, 0.007908765226602554, 0.05870674178004265, 0.02140585333108902, -0.06256087124347687, 0.01599874347448349, -0.05644499883055687, 0.021377410739660263, 0.045646343380212784, -0.024324430152773857, -0.06365805864334106, 0.04734500125050545, -0.0692940428853035, 0.0528789646923542, -0.08816418051719666, 0.0006980970501899719, 0.05771558731794357, 0.06141011044383049, 0.02698870375752449, 0.009665185585618019, -0.025440894067287445, 0.006868076976388693, -0.0642799511551857, 0.019564203917980194, 0.03732512146234512, 0.027294175699353218, -0.13308490812778473, 0.05363801121711731, 0.02775980718433857, -0.0031917267479002476, -0.04310452193021774, 0.017875315621495247, -0.051585327833890915, -0.06309343129396439, -0.03141465038061142, -0.02365238405764103, 0.035010673105716705, -0.025391340255737305, -0.057264238595962524, 0.08630514144897461, -0.013906927779316902, 0.07567635178565979, -0.009082099422812462, -0.03229985758662224, 0.05551472678780556, 0.05922461301088333, 0.09907054901123047, -0.006802374497056007, -0.032781295478343964, -0.037996791303157806, -0.08924947679042816, -0.09292639046907425, 0.04939857870340347, 0.00941094197332859, -0.06901628524065018, 0.07111793011426926, 0.04920530691742897, 0.017270080745220184, -0.008715540170669556, 0.053835172206163406, -0.007945433259010315, 0.005360306706279516, 0.01679127663373947, -0.05398751422762871, -0.09871390461921692, 0.05748726800084114, -0.06445557624101639, -0.10024247318506241, 0.023735487833619118, -0.020696233958005905, 0.05842915549874306, -0.03286139294505119, -0.023045234382152557, -0.0062326365150511265, 0.09967099875211716, 0.02826811373233795, -0.013606594875454903, -0.024339137598872185, 0.0379902683198452, -0.000265546579612419, 0.001583036850206554, -0.014685382135212421, -0.07037759572267532, -0.0214251559227705, -0.07530426234006882, 0.035203080624341965, 0.0138248261064291, 0.043880436569452286, 0.03139600530266762, -0.006571085192263126, 0.00690444465726614, 0.0340384766459465, 0.0025214257184416056, 0.02641250193119049, 0.01611616462469101, 0.0008333895239047706, -0.01019745972007513, -0.004954705946147442, -0.03270364925265312, 0.006387714762240648, -0.020601846277713776, 0.003920142538845539, 0.05793505534529686, 0.04448539763689041, -0.012755060568451881, -0.0007375326822511852, 0.004646607208997011, 0.026309533044695854, 0.03554683178663254, -0.01636202074587345, 0.03796367719769478, 0.03741992637515068, -0.044029686599969864, 0.0265678558498621, 0.005638862494379282, -0.006301490589976311, -0.02373450994491577, -0.0016981515800580382, 0.011982273310422897, -0.05478668957948685, 0.030637504532933235, -0.019603177905082703, 0.003529188223183155, -0.0024015731178224087, 0.025116456672549248, -0.00024614567519165576, 0.04907327517867088, -0.09104649722576141, 0.0397590771317482, 0.03300394117832184, -0.04120975732803345, -0.018268343061208725, -0.0257207490503788, 0.045875612646341324, 0.010402695275843143, -0.0036981727462261915, 0.029190121218562126, -0.0481281541287899, -0.0039828685112297535, 0.03656167909502983, 0.02812405303120613, 0.007977687753736973, -0.02668802998960018, -0.018070364370942116, 0.04208465665578842, -0.02201094664633274, -0.00019254215294495225, -0.030897535383701324, -0.014026185497641563, 0.02942001260817051, -0.030377967283129692, -0.023815179243683815, 0.05571947246789932, 0.05048856884241104, 0.01290913112461567, -0.0006032287492416799, -0.036723606288433075, -0.0005470159230753779, -0.04184078052639961, 0.02925497107207775, 0.011347089894115925, -0.00711531937122345, -0.05371750518679619, -0.042115069925785065, 0.01570495404303074, -0.006627497263252735, 0.013736916705965996, 0.021351387724280357, 0.005087020341306925, 0.006726493127644062, -0.012149134650826454, 0.03692644461989403, 0.022270582616329193, -0.014122512191534042, -0.0019828621298074722, -0.028189370408654213, -0.02449771761894226, -0.048448119312524796, -0.05681798979640007, -0.008843114599585533, 0.04235072806477547, -0.0020948415622115135, -0.000004239097052050056, 0.03446343541145325, 0.028106944635510445, 0.056078534573316574, -0.034151382744312286, -0.03737514466047287, 0.03716080263257027, -0.020077010616660118, -0.010205396451056004, 0.023028358817100525, 0.016628989949822426, 0.00850569736212492, 0.02262730896472931, 0.0007153950864449143, 0.04564392939209938, 0.00241096131503582, -0.006210764404386282, 0.022118570283055305, -0.0022283766884356737, -0.008580285124480724, 0.004207047168165445, -0.01112323347479105, 0.020459145307540894, 0.03805709630250931, 0.06860629469156265, -0.04863128438591957, 0.0010088018607348204, -0.02285454049706459, -0.051133349537849426, 0.008731947280466557, -0.03287265822291374, -0.030966615304350853, -0.028049135580658913, 0.03076120838522911, -0.011186751537024975, -0.03144952282309532, -0.03016587160527706, -0.028676031157374382, -0.0031017735600471497, -0.043034907430410385, -0.006784036289900541, 0.01398363895714283, 0.013914083130657673, -0.018702808767557144, -0.011929086409509182, -0.008861049078404903, -0.05333767831325531, -0.04771817848086357, 0.01300975400954485, 0.01416577398777008, -0.025182627141475677, -0.03242954611778259, -0.045587025582790375, -0.015409792773425579, -0.022549748420715332, 0.018189115449786186, 0.0003219413629267365, 0.018015312030911446, -0.043725017458200455, 0.025327421724796295, 0.04085073247551918, -0.034880056977272034, -0.03636333718895912, 0.03357738256454468, 0.02888350561261177, 0.020392371341586113, -0.0010157865472137928, -0.050917044281959534, -0.011630835942924023, 0.04512283205986023, 0.0069807786494493484, -0.0020105524454265833, 0.024825436994433403, -0.023732714354991913, -0.039124369621276855, 0.0034387491177767515, 0.0019112415611743927, 0.022757932543754578, 0.0202218908816576, 0.004154372029006481, -0.028389913961291313, -0.004474588669836521, 0.014244820922613144, 0.007473585195839405, -0.03232984244823456, -0.010787751525640488, -0.010718821547925472, 0.011149841360747814, 0.002379685640335083, 0.0045432462356984615, 0.011976679787039757, -0.022453058511018753, -0.04458495229482651, -0.025966603308916092, 0.002678957534953952, 0.03527015820145607, 0.0033167710062116385, -0.02672744356095791, -0.016351304948329926, 0.012811263091862202, -0.021267633885145187, -0.0034513629507273436, -0.005672498140484095, 0.03000456467270851, 0.05220839008688927, -0.04180404916405678, -0.02593432366847992, -0.014161329716444016, 0.00997839868068695, -0.06160915642976761, -0.017663756385445595, -0.006063719745725393, -0.06779687106609344, 0.015372403897345066, 0.030269544571638107, -0.019818179309368134, 0.005381485912948847, 0.01690768264234066, -0.040205955505371094, 0.013405722565948963, 0.020826876163482666, 0.017658276483416557, 0.019250787794589996, 0.003076597349718213, -0.013743562623858452, -0.020325053483247757, -0.015567736700177193, 0.01593957282602787, 0.04555545747280121, -0.015866989269852638, 0.03025520220398903, -0.00841792207211256, 0.033812396228313446, 0.016036655753850937, 0.00587186636403203, 0.01815156266093254, -0.027638014405965805, 0.0055455719120800495, -0.05320174619555473, 0.007836545817553997, -0.02533654123544693, 0.004074401687830687, -0.014349918812513351, -0.024768570438027382, -0.062022846192121506, 0.009243492037057877, 0.06801634281873703, 0.031987350434064865, -0.04003937914967537, -0.00221199169754982, -0.030667684972286224, -0.021019402891397476, 0.027091845870018005, 0.01160154864192009, -0.043504953384399414, -0.0181906558573246, -0.03581596910953522, -0.007374631706625223, -0.012295082211494446, -0.00008019117376534268, -0.02538444846868515, -0.020662426948547363, 0.0001621109404368326, 0.007281977217644453, 0.02686169743537903, -0.044028379023075104, -0.03151864930987358, -0.023625971749424934, 0.030237386003136635, 0.013479134999215603, -0.0344386100769043, 0.017113663256168365, -0.0034992131404578686, 0.03866291791200638, -0.00959092564880848, -0.006154184695333242, 0.012979733757674694, 0.011445935815572739, 0.04952998459339142, -0.011305408552289009, 0.003851009299978614, -0.06615308672189713, 0.04229898378252983, 0.0030298263300210238, -0.0479784794151783, -0.007626519072800875, -0.006897787097841501, -0.015247945673763752, 0.055481210350990295, 0.01210068166255951, 0.03686576336622238, 0.030290042981505394, 0.0096806725487113, 0.040483176708221436, 0.055989764630794525, -0.033465854823589325, 0.017925677821040154, -0.027177082374691963, 0.03132215142250061, -0.011635455302894115, 0.016983306035399437, -0.01318111177533865, -0.0023573674261569977, 0.005572246853262186, -0.008821765892207623, 0.021911464631557465, -0.06816224753856659, 0.0075489855371415615, 0.04832267016172409, -0.007634258829057217, 0.01106053963303566, 0.022586846724152565, -0.008745073340833187, 0.039873573929071426, 0.019370902329683304, 0.027219949290156364, 0.009808314964175224, -0.01162384357303381, -0.028813214972615242, -0.021054701879620552, -0.03361808881163597, 0.008999986574053764, 0.07178141921758652, -0.012450690381228924, 0.006834318861365318, 0.02871035970747471, 0.039297450333833694, 0.06829728186130524, 0.003891150699928403, -0.028306994587183, 0.01923779770731926, 0.07777799665927887, 0.018914273008704185, 0.021607179194688797, 0.008452092297375202, 0.0016780602745711803, 0.03172553330659866, -0.011046157218515873, -0.04837658628821373, 0.00021010571799706668, -0.005119803361594677, 0.02895178273320198, -0.025471307337284088, 0.01900918409228325, -0.06648901104927063, 0.06725112348794937, 0.04295571520924568, 0.038495395332574844, 0.011725320480763912, 0.003357606241479516, 0.018659763038158417, 0.038427647203207016, -0.025416824966669083, 0.051863979548215866, -0.01656734012067318, 0.0018002516590058804, 0.07490495592355728, 0.047630298882722855, 0.038248300552368164, 0.02329784817993641, -0.030595310032367706, 0.001176989171653986, -0.014459436759352684, 0.0053732190281152725, 0.03664066642522812, 0.0034802912268787622, -0.04336337372660637, -0.028001602739095688, 0.039555709809064865, -0.019569532945752144, 0.013965082354843616, -0.006977207958698273, -0.004184531979262829, 0.007683017291128635, 0.00559690035879612, -0.009246109053492546, 0.040922753512859344, -0.023645631968975067, -0.05524950847029686, -0.04425279423594475, -0.014374148100614548, 0.03396319970488548, 0.04514295607805252, -0.023626944050192833, -0.01346154697239399, -0.009952939115464687, -0.03704994544386864, 0.048100583255290985, 0.0435464084148407, -0.005084809381514788, -0.004986482672393322, 0.004085753113031387, -0.010551989078521729, -0.0055598546750843525, 0.008137094788253307, 0.025418149307370186, 0.06721697747707367, 0.001247520325705409, 0.001334626693278551, 0.0015690502477809787, 0.012603547424077988, 0.016900556161999702, -0.038931649178266525, -0.010631036013364792, -0.027677001431584358, 0.02953265979886055, 0.053763795644044876, 0.027169885113835335, -0.019635332748293877, -0.04411743953824043, -0.008547787554562092, 0.017948318272829056, -0.06777121126651764, 0.042790111154317856, -0.008650633506476879, 0.01682843454182148, -0.0012557216687127948, -0.013684363104403019, -0.025277191773056984, -0.00947771780192852, -0.0020099314860999584, 0.04200385883450508, -0.02657650224864483, -0.015287807211279869, 0.03358521685004234, 0.029387906193733215, 0.01943439617753029, 0.02046041190624237, 0.013430356048047543, -0.01814389042556286, -0.0031638783402740955, -0.015510822646319866, 0.006715701427310705, -0.07469042390584946, -0.030069619417190552, 0.02040930464863777, -0.03483639657497406, -0.028966300189495087, -0.004219132009893656, -0.039766356348991394, 0.003457201411947608, -0.05298784002661705, 0.011316156946122646, -0.013147407211363316, 0.00235251197591424, -0.021839404478669167, 0.040244244039058685, 0.03783726319670677, 0.028756098821759224, -0.01595654897391796, 0.0756184458732605, -0.03194239363074303, -0.027083620429039, -0.009593064896762371, 0.021336298435926437, 0.00414664251729846, 0.023672565817832947, 0.020968638360500336, -0.003039086237549782, 0.06189553067088127, -0.0048352512530982494, -0.01846267469227314, -0.0027757976204156876, 0.024015622213482857, 0.01947268471121788, -0.02173895202577114, 0.042250849306583405, 0.004463614895939827, -0.036046676337718964, 0.021772898733615875, 0.02598819136619568, 0.0017824239330366254, 0.03538941964507103, -0.012206493876874447, -0.06640174984931946, 0.013509395532310009, -0.03065452165901661, 0.012290732935070992, 0.03624870628118515, 0.04443313553929329, 0.02131342887878418, 0.008662021718919277, 0.007387941237539053, 0.020620770752429962, 0.003934407606720924, 0.0001527600543340668, -0.02330430969595909, -0.036659836769104004, 0.05202706903219223, -0.017756503075361252, -0.0293746218085289, -0.024556510150432587, -0.00939410924911499, -0.04871290549635887, 0.01503237895667553, -0.035951703786849976, -0.0020694753620773554, -0.026462404057383537, -0.004118377808481455, -0.019662626087665558, 0.025359105318784714, 0.011097967624664307, 0.03751726076006889, -0.002797792898491025, 0.0472671277821064 ]
Fine-Tune Wav2Vec2 for English ASR with 🤗 Transformers
patrickvonplaten
March 12, 2021
fine-tune-wav2vec2-english
guide, audio
https://huggingface.co/blog/fine-tune-wav2vec2-english
Create Wav2Vec2CTCTokenizer The pretrained Wav2Vec2 checkpoint maps the speech signal to a sequence of context representations as illustrated in the figure above. A fine-tuned Wav2Vec2 checkpoint needs to map this sequence of context representations to its corresponding transcription so that a linear layer has to be added on top of the transformer block (shown in yellow). This linear layer is used to classifies each context representation to a token class analogous how, e.g., after pretraining a linear layer is added on top of BERT\'s embeddings for further classification - cf. with \"BERT\" section of this blog post. The output size of this layer corresponds to the number of tokens in the vocabulary, which does not depend on Wav2Vec2\'s pretraining task, but only on the labeled dataset used for fine-tuning. So in the first step, we will take a look at Timit and define a vocabulary based on the dataset\'s transcriptions. Let\'s start by loading the dataset and taking a look at its structure. python from datasets import load_dataset, load_metric timit = load_dataset("timit_asr") print(timit) Print Output: bash DatasetDict({ train: Dataset({ features: ['file', 'audio', 'text', 'phonetic_detail', 'word_detail', 'dialect_region', 'sentence_type', 'speaker_id', 'id'], num_rows: 4620 }) test: Dataset({ features: ['file', 'audio', 'text', 'phonetic_detail', 'word_detail', 'dialect_region', 'sentence_type', 'speaker_id', 'id'], num_rows: 1680 }) }) Many ASR datasets only provide the target text, 'text' for each audio file 'file'. Timit actually provides much more information about each audio file, such as the 'phonetic_detail', etc., which is why many researchers choose to evaluate their models on phoneme classification instead of speech recognition when working with Timit. However, we want to keep the notebook as general as possible, so that we will only consider the transcribed text for fine-tuning. python timit = timit.remove_columns(["phonetic_detail", "word_detail", "dialect_region", "id", "sentence_type", "speaker_id"]) Let\'s write a short function to display some random samples of the dataset and run it a couple of times to get a feeling for the transcriptions. python from datasets import ClassLabel import random import pandas as pd from IPython.display import display, HTML def show_random_elements(dataset, num_examples=10): assert num_examples <= len(dataset), "Can't pick more elements than there are in the dataset." picks = [] for _ in range(num_examples): pick = random.randint(0, len(dataset)-1) while pick in picks: pick = random.randint(0, len(dataset)-1) picks.append(pick) df = pd.DataFrame(dataset[picks]) display(HTML(df.to_html())) show_random_elements(timit["train"].remove_columns(["file", "audio"])) Print Output: | Idx | Transcription | |----------|:-------------:| | 1 | Who took the kayak down the bayou? | | 2 | As such it acts as an anchor for the people. | | 3 | She had your dark suit in greasy wash water all year. | | 4 | We're not drunkards, she said. | | 5 | The most recent geological survey found seismic activity. | | 6 | Alimony harms a divorced man's wealth. | | 7 | Our entire economy will have a terrific uplift. | | 8 | Don't ask me to carry an oily rag like that. | | 9 | The gorgeous butterfly ate a lot of nectar. | | 10 | Where're you takin' me? | Alright! The transcriptions look very clean and the language seems to correspond more to written text than dialogue. This makes sense taking into account that Timit is a read speech corpus. We can see that the transcriptions contain some special characters, such as ,.?!;:. Without a language model, it is much harder to classify speech chunks to such special characters because they don\'t really correspond to a characteristic sound unit. E.g., the letter "s" has a more or less clear sound, whereas the special character "." does not. Also in order to understand the meaning of a speech signal, it is usually not necessary to include special characters in the transcription. In addition, we normalize the text to only have lower case letters. python import re chars_to_ignore_regex = '[\,\?\.\!\-\;\:\"]' def remove_special_characters(batch): batch["text"] = re.sub(chars_to_ignore_regex, '', batch["text"]).lower() return batch timit = timit.map(remove_special_characters) Let's take a look at the preprocessed transcriptions. python show_random_elements(timit["train"].remove_columns(["file", "audio"])) Print Output: | Idx | Transcription | |----------|:-------------:| | 1 | anyhow it was high time the boy was salted | | 2 | their basis seems deeper than mere authority | | 3 | only the best players enjoy popularity | | 4 | tornados often destroy acres of farm land | | 5 | where're you takin' me | | 6 | soak up local color | | 7 | satellites sputniks rockets balloons what next | | 8 | i gave them several choices and let them set the priorities | | 9 | reading in poor light gives you eyestrain | | 10 | that dog chases cats mercilessly | Good! This looks better. We have removed most special characters from transcriptions and normalized them to lower-case only. In CTC, it is common to classify speech chunks into letters, so we will do the same here. Let\'s extract all distinct letters of the training and test data and build our vocabulary from this set of letters. We write a mapping function that concatenates all transcriptions into one long transcription and then transforms the string into a set of chars. It is important to pass the argument batched=True to the map(...) function so that the mapping function has access to all transcriptions at once. python def extract_all_chars(batch): all_text = " ".join(batch["text"]) vocab = list(set(all_text)) return {"vocab": [vocab], "all_text": [all_text]} vocabs = timit.map(extract_all_chars, batched=True, batch_size=-1, keep_in_memory=True, remove_columns=timit.column_names["train"]) Now, we create the union of all distinct letters in the training dataset and test dataset and convert the resulting list into an enumerated dictionary. python vocab_list = list(set(vocabs["train"]["vocab"][0]) | set(vocabs["test"]["vocab"][0])) vocab_dict = {v: k for k, v in enumerate(vocab_list)} vocab_dict Print Output: bash { ' ': 21, "'": 13, 'a': 24, 'b': 17, 'c': 25, 'd': 2, 'e': 9, 'f': 14, 'g': 22, 'h': 8, 'i': 4, 'j': 18, 'k': 5, 'l': 16, 'm': 6, 'n': 7, 'o': 10, 'p': 19, 'q': 3, 'r': 20, 's': 11, 't': 0, 'u': 26, 'v': 27, 'w': 1, 'x': 23, 'y': 15, 'z': 12 } Cool, we see that all letters of the alphabet occur in the dataset (which is not really surprising) and we also extracted the special characters " " and '. Note that we did not exclude those special characters because: - The model has to learn to predict when a word finished or else the model prediction would always be a sequence of chars which would make it impossible to separate words from each other. - In English, we need to keep the ' character to differentiate between words, e.g., "it's" and "its" which have very different meanings. To make it clearer that " " has its own token class, we give it a more visible character |. In addition, we also add an \"unknown\" token so that the model can later deal with characters not encountered in Timit\'s training set. python vocab_dict["|"] = vocab_dict[" "] del vocab_dict[" "] Finally, we also add a padding token that corresponds to CTC\'s \"blank token\". The \"blank token\" is a core component of the CTC algorithm. For more information, please take a look at the \"Alignment\" section here. python vocab_dict["[UNK]"] = len(vocab_dict) vocab_dict["[PAD]"] = len(vocab_dict) print(len(vocab_dict)) Print Output: bash 30 Cool, now our vocabulary is complete and consists of 30 tokens, which means that the linear layer that we will add on top of the pretrained Wav2Vec2 checkpoint will have an output dimension of 30. Let\'s now save the vocabulary as a json file. python import json with open('vocab.json', 'w') as vocab_file: json.dump(vocab_dict, vocab_file) In a final step, we use the json file to instantiate an object of the Wav2Vec2CTCTokenizer class. python from transformers import Wav2Vec2CTCTokenizer tokenizer = Wav2Vec2CTCTokenizer("./vocab.json", unk_token="[UNK]", pad_token="[PAD]", word_delimiter_token="|") If one wants to re-use the just created tokenizer with the fine-tuned model of this notebook, it is strongly advised to upload the tokenizer to the 🤗 Hub. Let's call the repo to which we will upload the files "wav2vec2-large-xlsr-turkish-demo-colab": python repo_name = "wav2vec2-base-timit-demo-colab" and upload the tokenizer to the 🤗 Hub. python tokenizer.push_to_hub(repo_name) Great, you can see the just created repository under https://huggingface.co/<your-username>/wav2vec2-base-timit-demo-colab
[ -0.000040631806768942624, -0.023917417973279953, -0.0306437686085701, -0.05056648328900337, 0.026690108701586723, 0.04333459213376045, 0.02625500038266182, 0.011926506645977497, -0.04899294301867485, -0.06554881483316422, -0.052780136466026306, 0.06711592525243759, 0.01861114427447319, 0.0097229378297925, -0.04879888892173767, -0.025334743782877922, 0.04070001468062401, -0.06266779452562332, 0.02428596094250679, -0.002429128857329488, -0.03713596612215042, -0.018026886507868767, 0.09650669246912003, 0.04999840259552002, 0.027439255267381668, 0.011687114834785461, 0.017534183338284492, 0.035076804459095, -0.0128419054672122, 0.0447423942387104, -0.07326111942529678, 0.026907198131084442, 0.004554049577564001, -0.07574295997619629, 0.01093407440930605, 0.07995127141475677, -0.07032611221075058, 0.006121008191257715, 0.04222642630338669, -0.018666502088308334, -0.023057352751493454, -0.03951491788029671, -0.0032141818664968014, 0.06427574157714844, 0.00822933204472065, -0.03307168930768967, -0.1143476814031601, 0.04789375513792038, 0.011755824089050293, -0.0454365611076355, -0.06683484464883804, 0.06574414670467377, 0.009787624701857567, 0.03339165076613426, -0.006302705034613609, -0.008796783164143562, -0.05001289024949074, -0.059257879853248596, 0.0005209980881772935, 0.023118896409869194, -0.023701461032032967, -0.0030139144510030746, -0.03235462307929993, 0.02131558023393154, 0.028939159587025642, 0.004351802170276642, -0.01917995698750019, 0.0755734071135521, -0.0323806032538414, 0.025348342955112457, -0.006145706865936518, 0.020789122208952904, -0.01565087027847767, -0.015641581267118454, -0.0013660779222846031, -0.07269975543022156, 0.021079955622553825, -0.0015015656827017665, 0.024035466834902763, 0.06788849085569382, 0.0218365341424942, 0.03477104380726814, 0.017597394064068794, 0.029352877289056778, 0.0059989928267896175, -0.04018978402018547, 0.05860321596264839, -0.07860901206731796, -0.08829423785209656, 0.040567927062511444, -0.016655080020427704, -0.09218288213014603, -0.032618649303913116, -0.009027097374200821, -0.005688325967639685, -0.0596102736890316, -0.006271047051995993, 0.07907405495643616, -0.02266669273376465, -0.009403407573699951, -0.009828679263591766, -0.05143037065863609, 0.09543345123529434, -0.01581035554409027, -0.08421012759208679, 0.08089477568864822, -0.025966407731175423, 0.003678316017612815, -0.05946099013090134, 0.016614044085144997, 0.06095028668642044, -0.08816423267126083, 0.013928988017141819, 0.06801892071962357, -0.05944269895553589, -0.009367022663354874, 0.0460532084107399, -0.04921276494860649, 0.007904823869466782, 0.020157210528850555, -0.026139942929148674, 0.10678036510944366, 0.03022390976548195, -0.018719833344221115, -0.017053399235010147, -0.008435365743935108, -0.00048186976346187294, 0.0037802669685333967, 0.004801461938768625, 0.027425294741988182, 0.03718438372015953, -0.00989601295441389, 0.06991451233625412, 0.03140980750322342, -0.007847226224839687, -0.03649317845702171, 0.023063404485583305, -0.0810374841094017, 0.054168451577425, -0.017511822283267975, 0.031364232301712036, 0.045615021139383316, -0.0024723955430090427, -0.04516011103987694, 0.024316197261214256, -0.017698926851153374, -0.060569651424884796, 0.0835776999592781, 0.0142905805259943, 0.04213355481624603, -0.06334958970546722, 0.025296051055192947, 0.013960268348455429, -0.061222776770591736, -0.025734102353453636, 0.038937121629714966, 0.023952666670084, 0.009391590021550655, -0.06006941199302673, -0.045588962733745575, 0.0014475466450676322, -0.001512486836872995, -0.025405535474419594, -0.0003000436699949205, 0.0038352725096046925, -0.07207757979631424, -0.024284014478325844, 0.04137621819972992, 0.05594448372721672, 0.03611817583441734, 0.012078139930963516, -0.05351288616657257, 0.02959204651415348, 0.00630680937319994, 0.047016073018312454, 0.01693330891430378, 0.010696805082261562, 0.02611161209642887, -0.024620406329631805, -0.013635685667395592, -0.02063291147351265, 0.03975480794906616, -0.03479225933551788, 0.028243429958820343, 0.0332866869866848, -0.03260738402605057, 0.0036278662737458944, -0.03962633013725281, -0.040233008563518524, 0.007093586027622223, 0.010107696987688541, -0.09086427092552185, 0.01814899779856205, -0.06002448871731758, 0.031110143288969994, -0.07721035182476044, -0.012463431805372238, 0.0849587619304657, 0.02408912219107151, 0.07013186812400818, 0.05141611024737358, 0.021683337166905403, 0.003061025170609355, 0.03865955397486687, 0.029361307621002197, -0.03821633383631706, -0.05560477077960968, -0.1503790020942688, 0.08120009303092957, 0.024859720841050148, 0.03381839767098427, -0.07546541839838028, -0.005775573197752237, -0.11831212043762207, -0.06993604451417923, -0.03060266748070717, -0.05217311903834343, 0.067378930747509, 0.021720049902796745, -0.07794277369976044, 0.08142407238483429, -0.07873794436454773, -0.003726816037669778, 0.0021465723402798176, 0.005170157179236412, 0.026604918763041496, 0.02917519584298134, 0.07116638123989105, 0.09486054629087448, -0.11079231649637222, -0.06909256428480148, -0.10393742471933365, -0.06704849749803543, -0.006381227634847164, -0.025868406519293785, -0.030187256634235382, 0.11637582629919052, 0.008307447656989098, 0.06393037736415863, 0.01402746420353651, 0.01801678165793419, -0.05162094533443451, -0.05348973348736763, 0.004812819417566061, -0.04360932484269142, 0.005225719418376684, 0.028347717598080635, -0.030109012499451637, -0.009846542030572891, -0.0011172823142260313, -0.0495903417468071, 0.06014086678624153, -0.0186715517193079, -0.06945540755987167, 0.028504403308033943, 0.08476653695106506, 0.0216450747102499, -0.04713842645287514, -0.0010344954207539558, 0.00447958754375577, -0.0512084923684597, -0.0038247969932854176, -0.019866634160280228, -0.04975268617272377, -0.009803309105336666, -0.08413057774305344, 0.01380479708313942, 0.02272355929017067, 0.025828223675489426, 0.02094356343150139, -0.007044585421681404, 0.0002888966992031783, 0.027063295245170593, 0.008073847740888596, 0.023323530331254005, 0.009797358885407448, 0.010640985332429409, 0.004201270639896393, -0.019646303728222847, -0.001102966140024364, -0.010520673356950283, -0.031223200261592865, 0.014550136402249336, 0.00730073731392622, 0.0064092460088431835, 0.013217373751103878, 0.009348179213702679, 0.027124986052513123, 0.014665803872048855, 0.02364542707800865, -0.004441972356289625, 0.031510595232248306, 0.010410492308437824, 0.00277437805198133, -0.008074815385043621, 0.03674637898802757, 0.0023023823741823435, 0.023834072053432465, 0.00642814114689827, 0.02186131663620472, -0.026644377037882805, 0.004052399657666683, -0.0035708448849618435, 0.009597315452992916, -0.033602867275476456, 0.014183349907398224, -0.001961264293640852, 0.004192186053842306, -0.0800882950425148, 0.003818978788331151, 0.024967629462480545, -0.0481957383453846, 0.0008920846739783883, 0.0021475404500961304, 0.052203088998794556, 0.005318979732692242, -0.031499456614255905, -0.002795102074742317, -0.007562851067632437, 0.013910333625972271, 0.0654304102063179, -0.0163375586271286, -0.015501368790864944, 0.0028176289051771164, -0.02790445275604725, -0.023872114717960358, 0.05013997480273247, 0.037136003375053406, -0.05349230393767357, -0.007090214639902115, 0.0022711053024977446, 0.02919771522283554, 0.008315344341099262, 0.007479564752429724, 0.02429230511188507, 0.0034660554956644773, 0.0041258735582232475, -0.017043936997652054, -0.020208802074193954, -0.03346313536167145, 0.0053823646157979965, -0.020350418984889984, 0.02005608007311821, -0.03503333777189255, 0.027571754530072212, 0.025189056992530823, 0.05480099841952324, -0.0056838467717170715, -0.012046697549521923, 0.008999969810247421, -0.005703364498913288, -0.02315078116953373, 0.0053161620162427425, -0.01072875689715147, 0.006363992113620043, -0.03919175639748573, -0.012986402958631516, -0.04377128928899765, -0.0017053672345355153, -0.005877093877643347, -0.017840227112174034, 0.06425733864307404, -0.012198444455862045, 0.0021166123915463686, 0.032255783677101135, 0.05359988659620285, 0.04292837157845497, -0.05371113121509552, -0.040314774960279465, -0.003874381072819233, -0.028442248702049255, -0.009775988757610321, 0.0016282058786600828, 0.013018752448260784, 0.02002980187535286, -0.025663815438747406, -0.009799497202038765, 0.03938869759440422, 0.011931266635656357, 0.03762340545654297, -0.0021290513686835766, 0.008222338743507862, -0.03568319231271744, 0.011454424820840359, -0.0246698297560215, 0.013264995068311691, 0.06377345323562622, 0.027576999738812447, -0.036570530384778976, -0.0025988053530454636, -0.00152225187048316, -0.006380675360560417, -0.00505768833681941, 0.028185449540615082, 0.006804409436881542, -0.029981855303049088, 0.0608971081674099, -0.007104826159775257, 0.006745283026248217, 0.0056977360509335995, -0.029454084113240242, -0.0056595890782773495, -0.020449819043278694, -0.0030808437149971724, 0.025393271818757057, 0.005902750883251429, -0.0024712698068469763, -0.019121341407299042, 0.021409180015325546, -0.027015622705221176, -0.02033226191997528, 0.0035155906807631254, 0.03148140385746956, -0.025221824645996094, -0.047509338706731796, -0.06702825427055359, 0.01364818960428238, 0.008357161656022072, 0.015225769020617008, 0.010032471269369125, -0.006483078468590975, 0.004076275043189526, -0.014623928815126419, -0.022035786882042885, -0.016232186928391457, -0.029491344466805458, -0.0023459014482796192, 0.015747828409075737, -0.003967277705669403, 0.027066363021731377, 0.04434327408671379, 0.009620852768421173, 0.07440700381994247, 0.009582932107150555, 0.05713116005063057, -0.005106447264552116, -0.03866974264383316, -0.02189645916223526, -0.0012243991950526834, -0.005993947386741638, 0.0373733714222908, 0.0184073094278574, -0.0027492092922329903, 0.009007010608911514, 0.007517319172620773, 0.032886404544115067, 0.0591718815267086, -0.025085143744945526, -0.050299350172281265, -0.042874470353126526, 0.02519913949072361, -0.009422936476767063, 0.033959195017814636, -0.009153611026704311, 0.0036315706092864275, -0.053170617669820786, -0.028298480436205864, 0.00807555764913559, 0.05228317901492119, 0.020001577213406563, -0.00754940090700984, -0.00594185059890151, 0.013877437449991703, -0.05785572528839111, 0.01511277537792921, 0.004371867049485445, 0.08236537128686905, 0.0765499547123909, -0.024163436144590378, -0.003355523105710745, -0.033767618238925934, 0.029436396434903145, 0.020858537405729294, 0.01592811569571495, -0.03812015801668167, -0.05642935261130333, 0.019513152539730072, 0.0012326360447332263, -0.02597130462527275, -0.02548488788306713, -0.0033683397341519594, -0.004056870471686125, -0.007778081577271223, 0.008512250147759914, 0.014119863510131836, 0.04303218424320221, -0.05118193477392197, -0.02112438715994358, 0.02812911570072174, 0.016764864325523376, -0.002782270312309265, 0.05438842624425888, -0.026713212952017784, 0.004982659127563238, 0.02710689604282379, 0.047812823206186295, 0.016453241929411888, 0.020648643374443054, 0.02905849553644657, -0.01753157004714012, 0.037124231457710266, -0.05139956623315811, -0.026577787473797798, -0.031337931752204895, -0.02269376441836357, 0.0134911322966218, -0.05337641388177872, -0.036764368414878845, 0.01190643198788166, 0.052816394716501236, 0.017824096605181694, 0.00013157482317183167, 0.025559481233358383, -0.0031886117067188025, -0.015257700346410275, -0.04008505493402481, -0.03204675391316414, -0.020480334758758545, -0.0462193600833416, -0.025101758539676666, 0.01735534518957138, -0.008923226967453957, -0.01842341385781765, -0.010291381739079952, -0.018722526729106903, 0.042281076312065125, 0.059266287833452225, 0.011254691518843174, -0.028677716851234436, -0.033180300146341324, 0.008465520106256008, 0.014059517532587051, -0.016536159440875053, 0.008651350624859333, 0.03152310103178024, -0.01150487456470728, 0.008004321716725826, -0.002917663427069783, -0.015306666493415833, -0.022137479856610298, 0.03265494108200073, 0.11031007766723633, -0.010182327590882778, -0.028942344710230827, -0.06561484932899475, 0.016289299353957176, 0.02642073668539524, -0.010926884599030018, 0.02448933757841587, 0.030861925333738327, -0.023896917700767517, 0.04660024866461754, -0.04119446873664856, 0.025257134810090065, 0.04621394723653793, -0.011033871211111546, 0.045087024569511414, 0.04565099999308586, 0.047779280692338943, 0.03904763236641884, -0.005454667378216982, -0.0007927614497020841, 0.031855758279561996, 0.02188655361533165, -0.03016923926770687, -0.011054353788495064, 0.02097191847860813, 0.011338595300912857, -0.009119727648794651, -0.1032446026802063, 0.0004427023231983185, 0.016773371025919914, -0.020996492356061935, 0.011540033854544163, -0.001023712451569736, -0.02416442520916462, 0.020853793248534203, 0.020419400185346603, 0.0074997046031057835, -0.010377888567745686, -0.006852102931588888, 0.002736746333539486, 0.0010870345868170261, -0.03962620347738266, 0.018405424430966377, 0.07109984010457993, 0.01316230371594429, 0.02079184725880623, 0.01337523479014635, -0.004817997571080923, -0.014659175649285316, 0.03196152672171593, 0.007139286026358604, 0.036511875689029694, 0.03482867404818535, -0.005123422481119633, 0.021245934069156647, -0.004420245997607708, 0.015987159684300423, -0.0032317477744072676, -0.005620119161903858, -0.00984822865575552, -0.009514722041785717, 0.023905422538518906, 0.020279603078961372, 0.00990643072873354, 0.01348926592618227, -0.03172231465578079, 0.07324081659317017, 0.045376237481832504, 0.014790630899369717, -0.01519398670643568, 0.047498248517513275, 0.016628913581371307, -0.006702654995024204, 0.007681819144636393, 0.0055199190974235535, -0.0002843063557520509, 0.008008656091988087, 0.05534536764025688, 0.030450671911239624, 0.040069907903671265, 0.042223673313856125, 0.020137812942266464, 0.04484625905752182, -0.03695616126060486, -0.022317681461572647, 0.05220402404665947, 0.004543272312730551, -0.04478571191430092, -0.020789097994565964, -0.007674878463149071, -0.021302955225110054, 0.010171240195631981, -0.009047235362231731, -0.01146731898188591, 0.007855548523366451, -0.024235710501670837, -0.0007449024124071002, 0.04367540404200554, 0.029201244935393333, -0.05598638951778412, -0.050845686346292496, -0.007846851833164692, -0.008264263160526752, 0.04757866635918617, -0.0002891884942073375, -0.02699107676744461, 0.002200086135417223, -0.05357595533132553, 0.030190259218215942, 0.010327251628041267, -0.01750742830336094, 0.014411887153983116, -0.020377501845359802, 0.03773025795817375, 0.013351252302527428, 0.006332575809210539, 0.012239177711308002, 0.03194471076130867, 0.03058662638068199, -0.025738026946783066, -0.01945933885872364, -0.0025846061762422323, 0.030139029026031494, -0.03333016112446785, 0.020674914121627808, 0.024637678638100624, 0.05544517934322357, 0.013417977839708328, 0.05562363937497139, -0.007176737766712904, -0.09373156726360321, -0.01282175537198782, 0.019491001963615417, -0.04741337522864342, 0.041600633412599564, 0.02200918272137642, -0.01719171553850174, 0.007174686063081026, -0.06439908593893051, -0.004334202967584133, 0.020968807861208916, -0.005211898125708103, 0.03459376096725464, -0.0031438027508556843, -0.03981862962245941, -0.0156947523355484, 0.015653690323233604, 0.019810806959867477, 0.0024194365832954645, 0.027107324451208115, -0.021126162260770798, 0.0024038038682192564, 0.01047135517001152, 0.026315346360206604, -0.042355675250291824, -0.05146068334579468, -0.03948810696601868, -0.05141377076506615, -0.006796021480113268, -0.004943420644849539, -0.0024627884849905968, 0.005913137458264828, -0.030446480959653854, 0.015610892325639725, -0.04434758052229881, -0.03361557051539421, -0.042449478060007095, -0.007956389337778091, 0.03501483052968979, 0.03502485901117325, 0.013521840795874596, 0.06769804656505585, -0.058357350528240204, -0.03207922726869583, -0.00588833587244153, 0.003268598346039653, -0.00593140721321106, 0.027598043903708458, -0.001428007148206234, -0.018921155482530594, -0.005160943605005741, -0.006076585501432419, -0.03470651060342789, -0.014617621898651123, 0.016673561185598373, 0.01142297126352787, -0.005098272580653429, 0.03838075324892998, 0.006702163722366095, -0.016659891232848167, 0.008798999711871147, 0.00040503882337361574, 0.015325059182941914, 0.000984570593573153, -0.010757888667285442, -0.029398631304502487, 0.004096638411283493, -0.02636108733713627, -0.006274133920669556, 0.054930731654167175, -0.0033019129186868668, 0.022027553990483284, 0.03138900175690651, 0.01133432425558567, 0.04515620321035385, 0.0038527364376932383, 0.008705823682248592, -0.05227266624569893, 0.020458998158574104, 0.05971577763557434, -0.03700157254934311, 0.007003934122622013, 0.059107705950737, 0.014856369234621525, -0.021194715052843094, 0.011068463325500488, -0.020862188190221786, 0.04811912402510643, -0.01188082154840231, 0.02255198173224926, 0.001387884607538581, 0.06386667490005493, 0.03061024472117424, 0.042536236345767975, 0.004767007660120726, 0.03259621933102608 ]
Fine-Tune Wav2Vec2 for English ASR with 🤗 Transformers
patrickvonplaten
March 12, 2021
fine-tune-wav2vec2-english
guide, audio
https://huggingface.co/blog/fine-tune-wav2vec2-english
# Fine-Tune Wav2Vec2 for English ASR with 🤗 Transformers Wav2Vec2 is a pretrained model for Automatic Speech Recognition (ASR) and was released in September 2020 by Alexei Baevski, Michael Auli, and Alex Conneau. Using a novel contrastive pretraining objective, Wav2Vec2 learns powerful speech representations from more than 50.000 hours of unlabeled speech. Similar, to BERT\'s masked language modeling, the model learns contextualized speech representations by randomly masking feature vectors before passing them to a transformer network. For the first time, it has been shown that pretraining, followed by fine-tuning on very little labeled speech data achieves competitive results to state-of-the-art ASR systems. Using as little as 10 minutes of labeled data, Wav2Vec2 yields a word error rate (WER) of less than 5% on the clean test set of LibriSpeech - cf. with Table 9 of the paper. In this notebook, we will give an in-detail explanation of how Wav2Vec2\'s pretrained checkpoints can be fine-tuned on any English ASR dataset. Note that in this notebook, we will fine-tune Wav2Vec2 without making use of a language model. It is much simpler to use Wav2Vec2 without a language model as an end-to-end ASR system and it has been shown that a standalone Wav2Vec2 acoustic model achieves impressive results. For demonstration purposes, we fine-tune the \"base\"-sized pretrained checkpoint on the rather small Timit dataset that contains just 5h of training data. Wav2Vec2 is fine-tuned using Connectionist Temporal Classification (CTC), which is an algorithm that is used to train neural networks for sequence-to-sequence problems and mainly in Automatic Speech Recognition and handwriting recognition. I highly recommend reading the blog post Sequence Modeling with CTC (2017) very well-written blog post by Awni Hannun. Before we start, let\'s install both datasets and transformers from master. Also, we need the soundfile package to load audio files and the jiwer to evaluate our fine-tuned model using the word error rate (WER) metric \({}^1\). bash !pip install datasets>=1.18.3 !pip install transformers==4.11.3 !pip install librosa !pip install jiwer Next we strongly suggest to upload your training checkpoints directly to the Hugging Face Hub while training. The Hub has integrated version control so you can be sure that no model checkpoint is getting lost during training. To do so you have to store your authentication token from the Hugging Face website (sign up here if you haven't already!) python from huggingface_hub import notebook_login notebook_login() Print Output: bash Login successful Your token has been saved to /root/.huggingface/token Authenticated through git-crendential store but this isn't the helper defined on your machine. You will have to re-authenticate when pushing to the Hugging Face Hub. Run the following command in your terminal to set it as the default git config --global credential.helper store Then you need to install Git-LFS to upload your model checkpoints: python !apt install git-lfs ------------------------------------------------------------------------ \({}^1\) Timit is usually evaluated using the phoneme error rate (PER), but by far the most common metric in ASR is the word error rate (WER). To keep this notebook as general as possible we decided to evaluate the model using WER. Prepare Data, Tokenizer, Feature Extractor ------------------------------------------ ASR models transcribe speech to text, which means that we both need a feature extractor that processes the speech signal to the model\'s input format, e.g. a feature vector, and a tokenizer that processes the model\'s output format to text. In 🤗 Transformers, the Wav2Vec2 model is thus accompanied by both a tokenizer, called Wav2Vec2CTCTokenizer, and a feature extractor, called Wav2Vec2FeatureExtractor. Let\'s start by creating the tokenizer responsible for decoding the model\'s predictions.
[ 0.02247779071331024, -0.037840139120817184, 0.019048981368541718, -0.0014475281350314617, -0.011637069284915924, 0.004993753973394632, 0.0034333127550780773, 0.023330966010689735, -0.06726603955030441, -0.029076362028717995, -0.07001205533742905, 0.10986561328172684, 0.03368031233549118, 0.007468385621905327, -0.0355726033449173, -0.053466830402612686, 0.028947124257683754, -0.006830177269876003, 0.003967438358813524, 0.0009793986100703478, -0.049690499901771545, -0.03679097071290016, 0.06157534942030907, 0.027082648128271103, -0.007889380678534508, 0.06270799040794373, 0.06250766664743423, 0.006276976317167282, -0.03242363780736923, -0.030505811795592308, -0.10912931710481644, 0.02584581822156906, 0.0009086936479434371, -0.049046918749809265, -0.02315828762948513, 0.032551687210798264, -0.09152243286371231, 0.025916920974850655, 0.005082018673419952, -0.06432988494634628, 0.010689368471503258, -0.0011855384800583124, -0.0191851444542408, 0.035868432372808456, 0.008662409149110317, -0.0562848336994648, -0.0822933241724968, 0.056445393711328506, -0.01379547268152237, -0.09133438020944595, -0.017657378688454628, 0.07378045469522476, 0.015488550066947937, 0.014028389938175678, 0.0027470893692225218, -0.02934884838759899, -0.0008350030402652919, -0.07361874729394913, -0.043197087943553925, 0.008377833291888237, 0.03665373846888542, -0.03358767181634903, -0.05689488351345062, -0.004005436319857836, 0.028887225314974785, 0.007748455740511417, -0.05740412324666977, 0.0955672413110733, -0.048608798533678055, 0.012780017219483852, 0.008562400005757809, 0.005963548086583614, 0.009591170586645603, -0.06899897009134293, -0.03815310448408127, -0.07621487230062485, -0.008642161265015602, -0.0018239743076264858, 0.02403191290795803, 0.037280403077602386, -0.004469654988497496, 0.05306781828403473, 0.01104326918721199, 0.05505998432636261, 0.009768007323145866, -0.012000066228210926, 0.04002300277352333, -0.02858232893049717, -0.1099802628159523, -0.0009383361903019249, -0.017201628535985947, -0.12631934881210327, -0.03224066644906998, -0.021284859627485275, 0.004185588099062443, -0.0068946839310228825, 0.0012023970484733582, 0.047274984419345856, -0.010897479020059109, -0.018779031932353973, -0.010568590834736824, -0.009716001339256763, 0.10700120776891708, -0.0329272486269474, -0.07635896652936935, 0.09764230251312256, -0.022837290540337563, 0.010761799290776253, -0.0337088406085968, 0.011239332146942616, 0.08560123294591904, 0.0011385862017050385, -0.005694956984370947, 0.0861939862370491, -0.1057797372341156, -0.005147173535078764, 0.06868817657232285, -0.03782559186220169, -0.0027129126247018576, 0.018315870314836502, -0.0508807897567749, 0.0872792974114418, 0.04731840640306473, -0.005610903725028038, 0.008120771497488022, 0.005337208975106478, 0.02594771236181259, 0.030566120520234108, 0.000235551837249659, -0.003646146971732378, 0.04900465905666351, -0.04184771701693535, 0.044290244579315186, 0.049321044236421585, 0.003179475897923112, -0.016160668805241585, -0.0019644908607006073, -0.059737179428339005, 0.01827724277973175, 0.03226222097873688, 0.02021014876663685, 0.048664242029190063, -0.0023456548806279898, -0.01072635967284441, 0.07858461886644363, 0.0001957531931111589, -0.03471945598721504, 0.06599501520395279, 0.019017312675714493, 0.06771425902843475, -0.07500619441270828, 0.0645277202129364, -0.05349260941147804, -0.10079421103000641, -0.0009772604098543525, 0.042579010128974915, 0.0008499354589730501, -0.012547183781862259, -0.03834516182541847, -0.0013777234125882387, -0.03960657864809036, 0.05222517251968384, -0.01568957231938839, -0.004067676607519388, -0.0012008646735921502, -0.06730997562408447, -0.008387959562242031, 0.04447352886199951, 0.03482639417052269, 0.052569132298231125, 0.06239801272749901, -0.0005975593230687082, 0.11507860571146011, -0.03147773817181587, -0.006824747659265995, 0.025534149259328842, -0.05130356550216675, 0.09437582641839981, 0.01970951072871685, -0.035120029002428055, -0.014725655317306519, 0.09338269382715225, 0.029861081391572952, 0.06210727244615555, 0.012118784710764885, -0.026181982830166817, 0.05679485201835632, -0.011949402280151844, 0.02930598519742489, 0.0927606150507927, -0.017421195283532143, -0.020348193123936653, 0.04452738165855408, -0.031781233847141266, 0.0026638577692210674, -0.036515552550554276, -0.03527868166565895, 0.10137194395065308, 0.047377295792102814, 0.019591402262449265, 0.059612106531858444, 0.01316454540938139, -0.014283737167716026, 0.03098178654909134, 0.01682310923933983, -0.009495074860751629, 0.020759863778948784, -0.08290599286556244, 0.042741451412439346, 0.02680092304944992, 0.055113229900598526, -0.07466107606887817, 0.005098088178783655, -0.06639259308576584, -0.016590286046266556, -0.05550001189112663, -0.022541237995028496, 0.041817594319581985, 0.014083890244364738, -0.05840139463543892, 0.1024555191397667, -0.026717226952314377, 0.004201970528811216, 0.02852375991642475, -0.06725895404815674, 0.010773325338959694, 0.04262816905975342, 0.031518686562776566, 0.04801276698708534, -0.05038079619407654, -0.05049620568752289, -0.0919317752122879, -0.07154172658920288, -0.021264636889100075, 0.007329395040869713, -0.06784679740667343, 0.05148430913686752, 0.0006877384730614722, 0.026608489453792572, 0.0438498817384243, 0.017988864332437515, -0.000052328268793644384, -0.03881189227104187, 0.09603264927864075, -0.05637864023447037, -0.007635863032191992, 0.04247850924730301, -0.024185962975025177, 0.0015423106960952282, 0.018999122083187103, -0.09124608337879181, 0.01441585086286068, 0.009457921609282494, -0.0409202054142952, 0.020639941096305847, 0.10300332307815552, 0.0056442925706505775, -0.02955821342766285, -0.00931550282984972, 0.03296494483947754, -0.015564044937491417, -0.009402823634445667, 0.00041127606527879834, -0.006537269335240126, 0.0003429912612773478, -0.054795004427433014, 0.019514603540301323, 0.03626849502325058, 0.04298324137926102, -0.007828394882380962, -0.009024478495121002, -0.014215520583093166, 0.02096376195549965, 0.004328192211687565, 0.02040504477918148, 0.0425942987203598, 0.028367778286337852, -0.042182933539152145, -0.04623251035809517, -0.0032825854141265154, -0.013475987128913403, -0.015597894787788391, 0.031055722385644913, 0.012107118032872677, 0.017920775339007378, 0.007154323160648346, 0.012530043721199036, 0.013447646982967854, 0.015697792172431946, 0.03029637224972248, -0.0005938750109635293, 0.011792436242103577, 0.005626215133816004, 0.004003258887678385, -0.007797286380082369, 0.022495519369840622, -0.009700482711195946, -0.0292814951390028, 0.014492112211883068, 0.03184651955962181, -0.03460174426436424, -0.014008347876369953, -0.014640025794506073, 0.009874904528260231, 0.003634703578427434, -0.02146376110613346, -0.0012642957735806704, 0.001348585239611566, -0.08360360562801361, -0.0122268320992589, -0.00501977326348424, -0.022353559732437134, 0.010731344111263752, 0.006862668786197901, 0.02607382833957672, 0.008540955372154713, -0.029993252828717232, 0.013188624754548073, 0.01129181869328022, 0.016586411744356155, 0.02590138278901577, 0.022823994979262352, 0.020731257274746895, -0.00718493340536952, -0.013917923904955387, -0.018302112817764282, 0.013058594428002834, -0.0047429222613573074, -0.03233550116419792, 0.0036488573532551527, -0.009399248287081718, 0.038273971527814865, 0.004172785673290491, 0.0322432704269886, -0.00445773359388113, -0.011266877874732018, -0.015964940190315247, -0.02064870111644268, 0.005683349445462227, -0.03909695893526077, 0.0068343100138008595, 0.011129460297524929, -0.018180834129452705, -0.05326923727989197, 0.024514995515346527, 0.033011943101882935, 0.043806202709674835, 0.030241895467042923, 0.004185118246823549, -0.011812618002295494, -0.014650973491370678, -0.012504547834396362, 0.007873580791056156, 0.017094161361455917, 0.0039535751566290855, -0.035743702203035355, -0.0005727758398279548, -0.040661152452230453, -0.02467675507068634, -0.008987282402813435, -0.02184046246111393, 0.08852961659431458, 0.03663969412446022, 0.019048351794481277, 0.021997397765517235, 0.03907172381877899, 0.03516075015068054, -0.03781336545944214, -0.02370142750442028, 0.02889373153448105, 0.013191255740821362, -0.00014549522893503308, -0.00817856378853321, 0.018665974959731102, 0.029436741024255753, -0.02952554076910019, -0.014737118035554886, 0.005137463100254536, 0.025180820375680923, 0.023748233914375305, -0.009013512171804905, -0.0016899063484743237, -0.04513467848300934, 0.01448320783674717, -0.01955200918018818, 0.045865729451179504, 0.03964899852871895, 0.010581595823168755, -0.0569487102329731, -0.03509829565882683, 0.026673048734664917, 0.03047470562160015, -0.00006747945008100942, 0.005517321173101664, 0.015560097061097622, -0.0019460645271465182, 0.05255630239844322, -0.0033206315711140633, 0.01625696010887623, 0.04250769689679146, -0.03371439129114151, -0.004348261281847954, -0.002611010568216443, -0.030453646555542946, -0.008156898431479931, 0.0006223118980415165, -0.016966506838798523, -0.0053635407239198685, 0.009797593578696251, -0.060846615582704544, 0.012061634100973606, -0.02957770600914955, 0.025443360209465027, -0.001630129525437951, -0.023072335869073868, -0.006445936858654022, -0.012528972700238228, 0.019675349816679955, 0.014678246341645718, -0.021083122119307518, 0.029669640585780144, 0.007992259226739407, -0.0040147313848137856, -0.01954633742570877, 0.001666208845563233, -0.034831251949071884, -0.009215269237756729, 0.013920716010034084, 0.009784535504877567, 0.014324364252388477, 0.02218363620340824, 0.009360497817397118, 0.07866975665092468, 0.008824857883155346, 0.026445602998137474, 0.0045339432545006275, -0.07362370938062668, -0.03161931782960892, 0.0009945366764441133, -0.004977579228579998, 0.007847264409065247, 0.001405180199071765, -0.0041214763186872005, 0.009845927357673645, 0.014417529106140137, 0.03761259466409683, -0.00303841894492507, -0.05274864286184311, -0.03933865204453468, -0.027565419673919678, 0.005403132177889347, -0.002455423353239894, 0.0639604777097702, 0.0018851521890610456, 0.005168795585632324, -0.050330791622400284, -0.027475979179143906, 0.03362425044178963, 0.05597558990120888, -0.0028480577748268843, 0.0049569932743906975, -0.03263554349541664, 0.027811221778392792, -0.05204838141798973, -0.028223402798175812, 0.04661848023533821, 0.047084566205739975, 0.07652243971824646, -0.0023258402943611145, 0.021497732028365135, -0.043553926050662994, 0.02429463528096676, 0.035762958228588104, -0.016693085432052612, -0.05894285440444946, -0.04492431506514549, -0.002238771179690957, 0.0007911385619081557, 0.005261221434921026, -0.03478757664561272, 0.01229850109666586, -0.001884167781099677, -0.028133058920502663, 0.03425237163901329, -0.008984075859189034, -0.02884446457028389, -0.01823512837290764, -0.025877194479107857, 0.017835665494203568, 0.0035753371194005013, -0.02115335315465927, 0.05314747244119644, -0.02431384287774563, 0.01257774792611599, 0.057866863906383514, 0.047284550964832306, 0.007182946428656578, -0.010471975430846214, 0.04344737529754639, -0.022271418944001198, 0.06172701716423035, -0.029509471729397774, -0.013915634714066982, -0.023235570639371872, 0.005214993376284838, 0.011128745973110199, -0.05137011781334877, -0.020208939909934998, 0.03542757034301758, 0.02842053398489952, -0.02779398113489151, -0.04045720398426056, -0.00012150869588367641, -0.04850965738296509, -0.027619743719697, -0.030780335888266563, -0.043831437826156616, -0.016085965558886528, -0.00586848147213459, -0.015452023595571518, -0.014184472151100636, -0.02229723334312439, -0.0009127888479270041, -0.06800362467765808, -0.017537329345941544, 0.03186929225921631, 0.045431315898895264, 0.017501922324299812, -0.009453004226088524, -0.04529399052262306, -0.011964317411184311, 0.005582605488598347, -0.01324406173080206, -0.03523935750126839, 0.03532557189464569, 0.0006609724368900061, -0.00333465076982975, 0.032504450529813766, -0.02366890199482441, -0.035524774342775345, 0.02351978048682213, 0.035940904170274734, -0.01643434911966324, -0.05903705582022667, -0.07732647657394409, 0.003997048828750849, 0.02221684716641903, 0.004652485717087984, -0.011798286810517311, 0.0021869749762117863, -0.01241104956716299, 0.021837877109646797, -0.06730260699987411, 0.0372171588242054, 0.008035600185394287, -0.016544340178370476, 0.05633294954895973, 0.01722003147006035, 0.025569507852196693, 0.040958043187856674, -0.044871736317873, -0.025772234424948692, 0.006005147937685251, 0.024308254942297935, -0.003628580132499337, 0.0030277548357844353, 0.013442326337099075, -0.030934210866689682, 0.0033065835013985634, -0.11505366861820221, 0.013760944828391075, 0.0468081459403038, -0.028069308027625084, -0.003089963225647807, 0.055451955646276474, -0.05154869332909584, 0.0018927569035440683, 0.07155980169773102, 0.022330181673169136, -0.03344367817044258, -0.02288319729268551, 0.001654055085964501, 0.008267808705568314, -0.034256041049957275, -0.016299258917570114, 0.06236395239830017, 0.020124351605772972, 0.027897946536540985, 0.04418275132775307, 0.010826158337295055, 0.03192657232284546, -0.014284582808613777, 0.0015388797037303448, 0.057534247636795044, 0.03899994492530823, -0.0007719419081695378, 0.028135938569903374, 0.03908022120594978, -0.011954245157539845, 0.012954127043485641, -0.005128782242536545, -0.042582012712955475, -0.03171398118138313, 0.007299204356968403, 0.037999290972948074, 0.03018781542778015, 0.02902267873287201, -0.04906613752245903, 0.06298453360795975, 0.033341869711875916, 0.06397707760334015, -0.023288456723093987, 0.057939693331718445, 0.015663018450140953, 0.012041737325489521, -0.00560458330437541, 0.0016549295978620648, -0.013538479804992676, -0.0012563973432406783, 0.03357284516096115, 0.013872397132217884, 0.04740709438920021, -0.003090914571657777, -0.024539031088352203, 0.042655717581510544, -0.039226844906806946, -0.02113320492208004, 0.029097069054841995, -0.039312608540058136, -0.014875509776175022, -0.026086580008268356, 0.010547961108386517, -0.029624445363879204, 0.016192030161619186, 0.013009827584028244, -0.03957375884056091, -0.03189806640148163, -0.018131248652935028, -0.013817760162055492, 0.06039853021502495, 0.014072072692215443, -0.05309395119547844, -0.04854825884103775, -0.014376991428434849, -0.02140599675476551, 0.0478375181555748, -0.022130880504846573, -0.046528201550245285, -0.036787230521440506, -0.03280358761548996, 0.02504449151456356, 0.03846602886915207, 0.009601199999451637, -0.022536320611834526, -0.017357254400849342, 0.025031041353940964, -0.03059542179107666, -0.026334235444664955, 0.04150744155049324, -0.012041527777910233, -0.014810637570917606, -0.0065672798082232475, -0.02063949778676033, 0.0035482924431562424, 0.008134483359754086, -0.018355773761868477, 0.04898500815033913, 0.003849014872685075, -0.007990844547748566, 0.00927942618727684, 0.07517407089471817, 0.011145227588713169, -0.0458030179142952, 0.0038302275352180004, 0.006832282058894634, 0.006961710285395384, 0.024113725870847702, 0.0401972196996212, -0.010086017660796642, -0.01878836192190647, -0.04904728755354881, -0.0024721957743167877, -0.027529451996088028, -0.016969941556453705, 0.023899300023913383, -0.012968365103006363, -0.062464144080877304, -0.022417571395635605, 0.03145066648721695, 0.027533745393157005, 0.02272280864417553, -0.0051903678104281425, 0.006641563028097153, 0.008723355829715729, -0.01091561745852232, 0.0016156923957169056, -0.033160291612148285, -0.0571262463927269, -0.030602028593420982, -0.06735917180776596, -0.02712179906666279, 0.02680564858019352, -0.03245836868882179, 0.024419378489255905, -0.05731393024325371, 0.019118644297122955, -0.03565986081957817, -0.048839569091796875, -0.021732883527874947, 0.0032156025990843773, 0.034076251089572906, 0.0016268379986286163, -0.0035154144279658794, 0.04230876266956329, -0.015380420722067356, -0.01450064592063427, -0.02893799915909767, 0.007068812381476164, 0.02599748969078064, 0.012724973261356354, -0.003733153222128749, 0.0072199697606265545, 0.006474103778600693, 0.009970571845769882, -0.020439719781279564, -0.025901377201080322, 0.004100048914551735, 0.01702365279197693, -0.0018557790899649262, 0.06022990122437477, 0.0178727637976408, -0.015778562054038048, 0.00694173201918602, 0.023367462679743767, -0.030275516211986542, 0.006097852718085051, -0.03572462126612663, -0.054052434861660004, 0.03035944141447544, 0.011822883039712906, -0.010503004305064678, 0.050715669989585876, 0.009610215201973915, 0.042768146842718124, -0.01619497500360012, 0.005308165214955807, 0.011909195221960545, 0.006865480914711952, -0.003373383544385433, -0.055358391255140305, 0.023099146783351898, 0.03315417096018791, -0.009172595106065273, -0.00826067104935646, 0.06523872166872025, 0.03712392970919609, -0.01720571331679821, 0.02387167699635029, -0.008305385708808899, 0.05049906671047211, 0.00011431912571424618, 0.02970718964934349, -0.008230741135776043, 0.07091154158115387, 0.021606842055916786, 0.037365492433309555, -0.01373773068189621, 0.01718566194176674 ]
Fine-Tune Wav2Vec2 for English ASR with 🤗 Transformers
patrickvonplaten
March 12, 2021
fine-tune-wav2vec2-english
guide, audio
https://huggingface.co/blog/fine-tune-wav2vec2-english
Create Wav2Vec2 Feature Extractor Speech is a continuous signal and to be treated by computers, it first has to be discretized, which is usually called sampling. The sampling rate hereby plays an important role in that it defines how many data points of the speech signal are measured per second. Therefore, sampling with a higher sampling rate results in a better approximation of the real speech signal but also necessitates more values per second. A pretrained checkpoint expects its input data to have been sampled more or less from the same distribution as the data it was trained on. The same speech signals sampled at two different rates have a very different distribution, e.g., doubling the sampling rate results in data points being twice as long. Thus, before fine-tuning a pretrained checkpoint of an ASR model, it is crucial to verify that the sampling rate of the data that was used to pretrain the model matches the sampling rate of the dataset used to fine-tune the model. Wav2Vec2 was pretrained on the audio data of LibriSpeech and LibriVox which both were sampling with 16kHz. Our fine-tuning dataset, Timit, was luckily also sampled with 16kHz. If the fine-tuning dataset would have been sampled with a rate lower or higher than 16kHz, we first would have had to up or downsample the speech signal to match the sampling rate of the data used for pretraining. A Wav2Vec2 feature extractor object requires the following parameters to be instantiated: - feature_size: Speech models take a sequence of feature vectors as an input. While the length of this sequence obviously varies, the feature size should not. In the case of Wav2Vec2, the feature size is 1 because the model was trained on the raw speech signal \({}^2\) . - sampling_rate: The sampling rate at which the model is trained on. - padding_value: For batched inference, shorter inputs need to be padded with a specific value - do_normalize: Whether the input should be zero-mean-unit-variance normalized or not. Usually, speech models perform better when normalizing the input - return_attention_mask: Whether the model should make use of an attention_mask for batched inference. In general, models should always make use of the attention_mask to mask padded tokens. However, due to a very specific design choice of Wav2Vec2\'s \"base\" checkpoint, better results are achieved when using no attention_mask. This is not recommended for other speech models. For more information, one can take a look at this issue. Important If you want to use this notebook to fine-tune large-lv60, this parameter should be set to True. python from transformers import Wav2Vec2FeatureExtractor feature_extractor = Wav2Vec2FeatureExtractor(feature_size=1, sampling_rate=16000, padding_value=0.0, do_normalize=True, return_attention_mask=False) Great, Wav2Vec2\'s feature extraction pipeline is thereby fully defined! To make the usage of Wav2Vec2 as user-friendly as possible, the feature extractor and tokenizer are wrapped into a single Wav2Vec2Processor class so that one only needs a model and processor object. python from transformers import Wav2Vec2Processor processor = Wav2Vec2Processor(feature_extractor=feature_extractor, tokenizer=tokenizer)
[ 0.011895815841853619, 0.008521177805960178, -0.04121529310941696, 0.027523968368768692, 0.041904516518116, 0.038602519780397415, 0.005761061329394579, -0.04567435756325722, -0.03874346986413002, -0.04057695344090462, -0.03939325362443924, 0.060178108513355255, 0.030174417421221733, -0.03407007455825806, 0.004930340219289064, -0.04811260476708412, 0.03941810131072998, -0.02012353204190731, 0.02603117562830448, -0.005427352152764797, -0.013798951171338558, -0.02716725692152977, 0.0857202336192131, 0.035791654139757156, 0.011785969138145447, 0.07065346837043762, 0.013944888487458229, 0.01662909798324108, -0.023954683914780617, -0.014203092083334923, -0.1582886129617691, 0.05885986611247063, 0.009440998546779156, -0.02125462517142296, 0.0005381711525842547, 0.0454319529235363, -0.11231175065040588, 0.02182065136730671, 0.016772111877799034, -0.03267471119761467, 0.05220196023583412, -0.0014819973148405552, -0.09025296568870544, 0.009767618030309677, -0.005827763117849827, -0.08383897691965103, -0.046166032552719116, 0.028199758380651474, -0.032060228288173676, -0.05431568995118141, -0.07577216625213623, 0.06616923958063126, -0.04537156596779823, 0.004156067036092281, 0.035561028867959976, -0.06307706236839294, 0.005175480619072914, -0.021354157477617264, -0.036271508783102036, -0.03135160729289055, 0.016136957332491875, -0.04122481122612953, 0.006018404848873615, 0.016327248886227608, -0.006634639110416174, 0.036097604781389236, -0.007711486425250769, 0.04492804780602455, -0.02939474582672119, -0.017520034685730934, 0.013005188666284084, -0.011147069744765759, 0.043646439909935, 0.015438036993145943, -0.0025107902474701405, -0.00878504291176796, 0.051710352301597595, 0.023490184918045998, 0.05637504160404205, 0.0515156015753746, -0.0037684827111661434, 0.05098559707403183, 0.03380078077316284, 0.04222632572054863, 0.008321139961481094, -0.047682635486125946, 0.025251412764191628, -0.03580012917518616, -0.05841337889432907, 0.01904725469648838, -0.08510638028383255, -0.07771900296211243, -0.024450337514281273, -0.04464227333664894, -0.0743914470076561, 0.03910534083843231, 0.010079722851514816, 0.016516640782356262, 0.018592985346913338, 0.013183239847421646, -0.032110344618558884, -0.04661225154995918, 0.08476907014846802, -0.018080398440361023, -0.08685621619224548, 0.11114607006311417, -0.06787968426942825, 0.005884960759431124, -0.050835996866226196, 0.0475362092256546, 0.04700875282287598, -0.043852996081113815, -0.00928009208291769, 0.08224472403526306, -0.09221669286489487, -0.034105896949768066, 0.05885478854179382, -0.00442824000492692, -0.03310577943921089, -0.0056394790299236774, -0.042846664786338806, 0.12039826065301895, 0.013018922880291939, -0.028173169121146202, -0.028076136484742165, -0.0021480738651007414, 0.03119836188852787, 0.0876687541604042, 0.017286112532019615, 0.02892393246293068, 0.024656221270561218, -0.06456606835126877, 0.015291105024516582, 0.044207409024238586, 0.023179441690444946, -0.020389340817928314, 0.026976637542247772, -0.07689612358808517, -0.006345453672111034, -0.008956778794527054, 0.014243035577237606, 0.012427853420376778, -0.014727719128131866, -0.0507078617811203, 0.006961990147829056, -0.02201627381145954, -0.010126199573278427, -0.004937096498906612, 0.044385600835084915, 0.05272842198610306, -0.06420554220676422, 0.06422243267297745, -0.03362858295440674, -0.05260208249092102, 0.012164538726210594, -0.04289080575108528, 0.008398538455367088, -0.03318969905376434, -0.03395514190196991, -0.021331442520022392, 0.0059415604919195175, 0.001940127112902701, -0.0025556469336152077, 0.012202516198158264, 0.014171388000249863, -0.031234251335263252, -0.015882583335042, 0.09278085082769394, 0.03745993226766586, 0.046386756002902985, -0.04538194462656975, 0.020857244729995728, 0.027263564988970757, -0.0305892713367939, 0.06809052079916, 0.048175148665905, -0.019497888162732124, 0.06598778814077377, -0.024752512574195862, -0.05154670402407646, 0.004037940409034491, 0.022166306152939796, 0.001420027925632894, 0.03826586902141571, 0.06849241256713867, -0.09134518355131149, 0.045863308012485504, -0.017600595951080322, -0.06937678158283234, 0.04036333039402962, -0.0003724385751411319, -0.04968481883406639, -0.0007185317808762193, -0.04868109151721001, 0.029653795063495636, -0.07100236415863037, -0.02262493036687374, 0.09974377602338791, 0.03296936675906181, 0.06566853076219559, -0.0024432754144072533, 0.015143128111958504, 0.025502000004053116, 0.018837889656424522, 0.0008158895652741194, -0.018247919157147408, 0.009372622705996037, -0.10724984854459763, 0.05500219017267227, 0.05716871842741966, 0.03300020843744278, -0.07718437910079956, -0.012651870027184486, -0.05690319091081619, -0.06204745173454285, 0.01573879085481167, -0.021981844678521156, 0.030993081629276276, 0.055609721690416336, -0.07627717405557632, 0.11649703234434128, -0.046346746385097504, 0.014792864210903645, 0.014407249167561531, -0.03119303099811077, -0.021295856684446335, 0.04866946488618851, 0.06826429814100266, 0.0496392659842968, -0.015780925750732422, -0.08789567649364471, -0.12407631427049637, -0.07878068834543228, 0.0056539662182331085, 0.0036251062992960215, -0.05259570851922035, 0.060173988342285156, 0.005677150096744299, 0.03434077650308609, 0.018510140478610992, 0.013161535374820232, -0.0595620796084404, -0.01295724231749773, 0.0691702738404274, -0.05877685546875, -0.018327651545405388, 0.07302659004926682, -0.0483727753162384, -0.044236306101083755, 0.04191824421286583, -0.0671321228146553, 0.017007077112793922, 0.04909508302807808, -0.059790629893541336, 0.0261625237762928, 0.11970753967761993, -0.00593202281743288, -0.03174860402941704, -0.02977818064391613, -0.02494971826672554, 0.0018991008400917053, -0.017719130963087082, -0.009468167088925838, -0.03352120518684387, -0.013840303756296635, -0.07424349337816238, -0.01844475045800209, 0.015866996720433235, -0.014456292614340782, 0.03434804081916809, 0.023645542562007904, 0.01262950710952282, -0.010128922760486603, 0.009576245211064816, 0.024523571133613586, -0.0010599512606859207, 0.012051373720169067, -0.028031019493937492, -0.04786253347992897, -0.025452254340052605, -0.0033974226098507643, -0.014076599851250648, 0.009201576933264732, 0.018055075779557228, 0.024245649576187134, 0.019556446000933647, 0.0014221025630831718, -0.003578895004466176, -0.02922515757381916, 0.04752671346068382, -0.025404445827007294, 0.04055187851190567, -0.004600582178682089, 0.011889700777828693, -0.03974049910902977, 0.049750495702028275, -0.023959841579198837, -0.01744840294122696, -0.017389211803674698, 0.005068226717412472, -0.044399816542863846, -0.03187545761466026, 0.01138245314359665, 0.010402198880910873, -0.031230293214321136, -0.015308032743632793, 0.021678779274225235, 0.023516086861491203, -0.07779752463102341, -0.0010606434661895037, 0.0016784800682216883, -0.053800083696842194, -0.0410977378487587, -0.020910892635583878, -0.01562507450580597, 0.018889520317316055, -0.018356796354055405, -0.0020299183670431376, -0.01065254956483841, 0.03031327947974205, 0.03664429113268852, 0.03887956961989403, 0.009984690696001053, -0.010022132657468319, -0.005027467850595713, -0.013320261612534523, 0.024355176836252213, -0.007192350458353758, -0.022999374195933342, -0.022425061091780663, 0.025800829753279686, -0.005507024470716715, -0.003725530579686165, 0.04411745071411133, 0.006340054329484701, -0.015980329364538193, 0.007005398161709309, -0.017452020198106766, -0.015979746356606483, -0.03786967322230339, 0.023665687069296837, -0.017309680581092834, -0.004974171984940767, -0.03462720662355423, 0.015806380659341812, 0.02037810906767845, 0.046978604048490524, 0.010895149782299995, 0.0006816085078753531, -0.03763863816857338, 0.00936814770102501, -0.03953683003783226, 0.02242283523082733, -0.0027574142441153526, -0.006023847032338381, 0.0075151436030864716, 0.0008152843220159411, -0.036432843655347824, -0.026624811813235283, -0.012232177890837193, 0.0024043279699981213, 0.054310012608766556, -0.0010661600390449166, 0.05236894264817238, 0.05666135996580124, 0.07156763970851898, 0.034456826746463776, -0.020435702055692673, -0.03423188626766205, 0.029288342222571373, 0.006462089251726866, -0.013733326457440853, 0.005300880875438452, -0.012124059721827507, 0.040376558899879456, -0.036250483244657516, -0.03306517377495766, 0.006659726146608591, 0.028155704960227013, 0.004594706930220127, -0.00737610412761569, 0.005618540104478598, -0.020065048709511757, 0.008346847258508205, 0.014954284764826298, 0.02298891916871071, 0.009840981103479862, 0.004499534144997597, -0.029866790398955345, -0.014102849178016186, 0.02881416492164135, 0.004983053542673588, -0.006181665230542421, 0.000010559734619164374, 0.010108201764523983, 0.011750325560569763, 0.06413299590349197, -0.004833817481994629, 0.00007716175605310127, 0.00423242524266243, -0.009161824360489845, -0.05803680792450905, -0.000998449744656682, -0.012230616062879562, 0.04086904600262642, 0.008000359870493412, 0.031980689615011215, 0.020985037088394165, -0.008264456875622272, -0.0006078289588913321, 0.015084265731275082, -0.01708393171429634, 0.05437031388282776, -0.010637214407324791, -0.05254139006137848, -0.016525795683264732, -0.010105188935995102, 0.019265571609139442, 0.023237349465489388, -0.017373129725456238, 0.026002459228038788, 0.021748462691903114, 0.02616260014474392, -0.0115346135571599, -0.038759250193834305, -0.04984762519598007, 0.02027168869972229, 0.0043381997384130955, -0.005457998253405094, 0.020401103422045708, 0.016148345544934273, 0.011973004788160324, 0.08686569333076477, 0.0041088745929300785, 0.028089802712202072, 0.009337527677416801, -0.04799843579530716, -0.048288494348526, 0.008216684684157372, 0.01612713374197483, 0.006223228760063648, 0.019802061840891838, -0.0013568407157436013, -0.005102775525301695, 0.010244487784802914, 0.06310824304819107, 0.0270784180611372, -0.008126320317387581, -0.006532891187816858, 0.006198580376803875, 0.003109677229076624, -0.012729140929877758, 0.035104915499687195, -0.001462977030314505, 0.009064912796020508, -0.0520869642496109, -0.05699121579527855, -0.02482476830482483, 0.017247622832655907, -0.004483805038034916, -0.0361756794154644, -0.00914373155683279, -0.00249891122803092, -0.03944259509444237, 0.01856435090303421, -0.008726837113499641, 0.04885261505842209, 0.017928065732121468, -0.0348375104367733, 0.01672143116593361, -0.024006901308894157, 0.009611901827156544, 0.0233765821903944, 0.03134198859333992, -0.06670819222927094, -0.051950547844171524, 0.040823064744472504, 0.0380539670586586, 0.003788501024246216, 0.0010936404578387737, -0.012608961202204227, 0.009239429607987404, 0.004805842414498329, 0.03491581231355667, 0.02215239219367504, -0.020667625591158867, -0.007722280453890562, 0.00008896553481463343, 0.015383866615593433, -0.003483155509456992, 0.006451855879276991, 0.058792583644390106, -0.012497958727180958, 0.017835058271884918, 0.0054182931780815125, 0.055831484496593475, 0.029251979663968086, 0.014390628784894943, -0.0007635183865204453, -0.004307838622480631, 0.06409367173910141, -0.06429193913936615, -0.04376893863081932, -0.008999563753604889, -0.025014791637659073, 0.020587217062711716, -0.052254755049943924, 0.0008928721654228866, 0.06883163750171661, 0.04995518922805786, 0.021471086889505386, -0.012592203915119171, -0.02314457856118679, 0.015567144379019737, -0.006497176364064217, -0.009267371147871017, -0.03349557891488075, -0.03432125970721245, -0.0006149680120870471, -0.009812342934310436, -0.03198299929499626, -0.013751634396612644, -0.0333300344645977, -0.07403229176998138, -0.06271661818027496, 0.026930440217256546, 0.024019422009587288, 0.01580754481256008, -0.054923735558986664, -0.06191883981227875, -0.04590856656432152, 0.014657892286777496, -0.014307272620499134, -0.059211473912000656, -0.008528036996722221, 0.007800040300935507, -0.0071578011848032475, 0.0012145874788984656, -0.04116542264819145, -0.018024152144789696, 0.025958120822906494, 0.028387831524014473, -0.008046431466937065, -0.017676115036010742, -0.05220377445220947, 0.058094147592782974, 0.046718794852495193, -0.005135291256010532, 0.001891187857836485, 0.0324406623840332, 0.016852177679538727, 0.06008367985486984, -0.06640483438968658, 0.013768641278147697, 0.009578553028404713, -0.039930347353219986, 0.003446731483563781, -0.01465250737965107, 0.010627520270645618, 0.01631002128124237, -0.020078308880329132, 0.014894138090312481, 0.0034494814462959766, -0.007477447856217623, 0.002683907048776746, -0.030200611799955368, 0.01807551458477974, -0.019262386485934258, 0.012894466519355774, -0.06466994434595108, 0.01627327874302864, 0.039953622967004776, -0.022070765495300293, 0.05199519544839859, 0.034431882202625275, -0.01647229678928852, 0.047507673501968384, 0.031885676085948944, 0.04632045701146126, -0.02318308874964714, -0.024271875619888306, -0.006992364302277565, -0.005483046639710665, -0.022339409217238426, -0.004391699098050594, 0.06624817103147507, -0.008487636223435402, 0.04450942203402519, 0.032203566282987595, 0.013906443491578102, 0.033257607370615005, -0.015857264399528503, -0.01793956570327282, 0.026887323707342148, 0.05529088154435158, 0.032818809151649475, 0.016591524705290794, 0.017121678218245506, 0.024977833032608032, 0.02649921365082264, 0.005720509681850672, -0.0019354606047272682, -0.027580514550209045, -0.013872076757252216, 0.044040996581315994, 0.015839871019124985, -0.009686858393251896, -0.056646961718797684, 0.04976634681224823, 0.02639954350888729, 0.0418635830283165, 0.030743775889277458, 0.03841887414455414, -0.008747600950300694, 0.050499141216278076, -0.009894980117678642, 0.016006339341402054, 0.0010428712703287601, -0.004631057847291231, 0.028912710025906563, 0.03285285830497742, 0.05876889452338219, -0.011658409610390663, -0.022229021415114403, 0.06026019901037216, -0.036256998777389526, -0.03685462474822998, 0.04389864578843117, 0.002514798427000642, -0.012713492847979069, -0.014237016439437866, 0.010169428773224354, -0.043140482157468796, 0.009703375399112701, -0.009973636828362942, -0.0033073124941438437, 0.02124769799411297, -0.006567652802914381, 0.002797115594148636, 0.0658690333366394, 0.013613971881568432, -0.08008147776126862, -0.009144295006990433, -0.007224053610116243, 0.008476716466248035, 0.010837584733963013, -0.01308396179229021, -0.046493858098983765, -0.0059198420494794846, -0.04438884183764458, 0.0381314717233181, 0.03907322883605957, -0.010789153166115284, 0.011179560795426369, 0.022708959877490997, -0.005581540521234274, 0.00863560475409031, 0.0027400958351790905, 0.038751229643821716, 0.009095449931919575, 0.021123280748724937, 0.01145877130329609, 0.02594571001827717, 0.0004272912337910384, 0.02617064118385315, -0.011774742975831032, 0.009272849187254906, 0.02939419262111187, 0.042976174503564835, -0.013010343536734581, 0.0893692895770073, 0.02191595360636711, -0.06979256868362427, 0.01058460958302021, -0.02616506814956665, -0.009301026351749897, 0.0650305449962616, 0.022949324920773506, -0.005469304975122213, 0.017220862209796906, -0.04001985117793083, -0.021836670115590096, -0.017179418355226517, -0.00523012550547719, 0.025590727105736732, -0.023515595123171806, -0.050543010234832764, -0.014378519728779793, -0.008521994575858116, 0.016348931938409805, 0.025377193465828896, -0.00429947767406702, -0.013762222602963448, 0.015399717725813389, 0.0016362008173018694, 0.010085443034768105, -0.05036287382245064, -0.03153211250901222, -0.043459147214889526, -0.04363491013646126, -0.010854892432689667, 0.00694656278938055, 0.0066000004298985004, 0.004019090440124273, -0.005118612200021744, -0.014459829777479172, -0.015836365520954132, -0.019377615302801132, 0.0017473372863605618, -0.01208046916872263, 0.03474859520792961, 0.0005531900096684694, 0.01443997211754322, 0.058341994881629944, -0.03201811760663986, -0.024543244391679764, -0.018935857340693474, 0.029646530747413635, -0.036884963512420654, 0.02891705185174942, -0.014875904656946659, -0.009783175773918629, -0.0006233890308067203, 0.027281325310468674, -0.01577836647629738, -0.0040624793618917465, 0.0008391154697164893, 0.0018890438368543983, -0.01902090571820736, 0.02616715058684349, 0.05314120650291443, -0.0033342528622597456, 0.00700415950268507, 0.02458506077528, -0.014170922338962555, -0.019248316064476967, 0.009486867114901543, -0.04889959841966629, 0.0036116966512054205, -0.012916824780404568, 0.025951387360692024, 0.05809975787997246, 0.033706072717905045, 0.004313786514103413, -0.004333297722041607, 0.020931629464030266, 0.009989049285650253, 0.03985913470387459, -0.0029181535355746746, -0.06246039271354675, -0.007780666928738356, 0.06869682669639587, -0.017788346856832504, 0.01746416464447975, 0.032133299857378006, 0.004229991231113672, -0.03674296289682388, 0.03656454756855965, -0.00527090672403574, 0.04052073881030083, 0.010712668299674988, 0.04759795963764191, -0.05642591789364815, 0.038973793387413025, 0.024062689393758774, 0.039329804480075836, 0.012681611813604832, 0.01882038451731205 ]
Fine-Tune Wav2Vec2 for English ASR with 🤗 Transformers
patrickvonplaten
March 12, 2021
fine-tune-wav2vec2-english
guide, audio
https://huggingface.co/blog/fine-tune-wav2vec2-english
Set-up Trainer Let\'s start by defining the data collator. The code for the data collator was copied from this example. Without going into too many details, in contrast to the common data collators, this data collator treats the input_values and labels differently and thus applies to separate padding functions on them (again making use of Wav2Vec2\'s context manager). This is necessary because in speech input and output are of different modalities meaning that they should not be treated by the same padding function. Analogous to the common data collators, the padding tokens in the labels with -100 so that those tokens are not taken into account when computing the loss. python import torch from dataclasses import dataclass, field from typing import Any, Dict, List, Optional, Union @dataclass class DataCollatorCTCWithPadding: """ Data collator that will dynamically pad the inputs received. Args: processor (:class:`~transformers.Wav2Vec2Processor`) The processor used for proccessing the data. padding (:obj:`bool`, :obj:`str` or :class:`~transformers.tokenization_utils_base.PaddingStrategy`, `optional`, defaults to :obj:`True`): Select a strategy to pad the returned sequences (according to the model's padding side and padding index) among: * :obj:`True` or :obj:`'longest'`: Pad to the longest sequence in the batch (or no padding if only a single sequence if provided). * :obj:`'max_length'`: Pad to a maximum length specified with the argument :obj:`max_length` or to the maximum acceptable input length for the model if that argument is not provided. * :obj:`False` or :obj:`'do_not_pad'` (default): No padding (i.e., can output a batch with sequences of different lengths). max_length (:obj:`int`, `optional`): Maximum length of the ``input_values`` of the returned list and optionally padding length (see above). max_length_labels (:obj:`int`, `optional`): Maximum length of the ``labels`` returned list and optionally padding length (see above). pad_to_multiple_of (:obj:`int`, `optional`): If set will pad the sequence to a multiple of the provided value. This is especially useful to enable the use of Tensor Cores on NVIDIA hardware with compute capability >= 7.5 (Volta). """ processor: Wav2Vec2Processor padding: Union[bool, str] = True max_length: Optional[int] = None max_length_labels: Optional[int] = None pad_to_multiple_of: Optional[int] = None pad_to_multiple_of_labels: Optional[int] = None def __call__(self, features: List[Dict[str, Union[List[int], torch.Tensor]]]) -> Dict[str, torch.Tensor]: # split inputs and labels since they have to be of different lengths and need # different padding methods input_features = [{"input_values": feature["input_values"]} for feature in features] label_features = [{"input_ids": feature["labels"]} for feature in features] batch = self.processor.pad( input_features, padding=self.padding, max_length=self.max_length, pad_to_multiple_of=self.pad_to_multiple_of, return_tensors="pt", ) with self.processor.as_target_processor(): labels_batch = self.processor.pad( label_features, padding=self.padding, max_length=self.max_length_labels, pad_to_multiple_of=self.pad_to_multiple_of_labels, return_tensors="pt", ) # replace padding with -100 to ignore loss correctly labels = labels_batch["input_ids"].masked_fill(labels_batch.attention_mask.ne(1), -100) batch["labels"] = labels return batch Let's initialize the data collator. python data_collator = DataCollatorCTCWithPadding(processor=processor, padding=True) Next, the evaluation metric is defined. As mentioned earlier, the predominant metric in ASR is the word error rate (WER), hence we will use it in this notebook as well. python wer_metric = load_metric("wer") The model will return a sequence of logit vectors: $$ \mathbf{y}1, \ldots, \mathbf{y}_m $$, with \(\mathbf{y}_1 = f{\theta}(x_1, \ldots, x_n)[0]\) and \(n >> m\). A logit vector \( \mathbf{y}_1 \) contains the log-odds for each word in the vocabulary we defined earlier, thus \(\text{len}(\mathbf{y}_i) =\) config.vocab_size. We are interested in the most likely prediction of the model and thus take the argmax(...) of the logits. Also, we transform the encoded labels back to the original string by replacing -100 with the pad_token_id and decoding the ids while making sure that consecutive tokens are not grouped to the same token in CTC style \({}^1\). python def compute_metrics(pred): pred_logits = pred.predictions pred_ids = np.argmax(pred_logits, axis=-1) pred.label_ids[pred.label_ids == -100] = processor.tokenizer.pad_token_id pred_str = processor.batch_decode(pred_ids) # we do not want to group tokens when computing the metrics label_str = processor.batch_decode(pred.label_ids, group_tokens=False) wer = wer_metric.compute(predictions=pred_str, references=label_str) return {"wer": wer} Now, we can load the pretrained Wav2Vec2 checkpoint. The tokenizer\'s pad_token_id must be to define the model\'s pad_token_id or in the case of Wav2Vec2ForCTC also CTC\'s blank token \({}^2\). To save GPU memory, we enable PyTorch\'s gradient checkpointing and also set the loss reduction to \"mean\". python from transformers import Wav2Vec2ForCTC model = Wav2Vec2ForCTC.from_pretrained( "facebook/wav2vec2-base", ctc_loss_reduction="mean", pad_token_id=processor.tokenizer.pad_token_id, ) Print Output: bash Some weights of Wav2Vec2ForCTC were not initialized from the model checkpoint at facebook/wav2vec2-base and are newly initialized: ['lm_head.weight', 'lm_head.bias'] You should probably TRAIN this model on a down-stream task to be able to use it for predictions and inference. The first component of Wav2Vec2 consists of a stack of CNN layers that are used to extract acoustically meaningful - but contextually independent - features from the raw speech signal. This part of the model has already been sufficiently trained during pretrainind and as stated in the paper does not need to be fine-tuned anymore. Thus, we can set the requires_grad to False for all parameters of the feature extraction part. python model.freeze_feature_extractor() In a final step, we define all parameters related to training. To give more explanation on some of the parameters: - group_by_length makes training more efficient by grouping training samples of similar input length into one batch. This can significantly speed up training time by heavily reducing the overall number of useless padding tokens that are passed through the model - learning_rate and weight_decay were heuristically tuned until fine-tuning has become stable. Note that those parameters strongly depend on the Timit dataset and might be suboptimal for other speech datasets. For more explanations on other parameters, one can take a look at the docs. During training, a checkpoint will be uploaded asynchronously to the hub every 400 training steps. It allows you to also play around with the demo widget even while your model is still training. Note: If one does not want to upload the model checkpoints to the hub, simply set push_to_hub=False. python from transformers import TrainingArguments training_args = TrainingArguments( output_dir=repo_name, group_by_length=True, per_device_train_batch_size=32, evaluation_strategy="steps", num_train_epochs=30, fp16=True, gradient_checkpointing=True, save_steps=500, eval_steps=500, logging_steps=500, learning_rate=1e-4, weight_decay=0.005, warmup_steps=1000, save_total_limit=2, ) Now, all instances can be passed to Trainer and we are ready to start training! python from transformers import Trainer trainer = Trainer( model=model, data_collator=data_collator, args=training_args, compute_metrics=compute_metrics, train_dataset=timit_prepared["train"], eval_dataset=timit_prepared["test"], tokenizer=processor.feature_extractor, ) ------------------------------------------------------------------------ \({}^1\) To allow models to become independent of the speaker rate, in CTC, consecutive tokens that are identical are simply grouped as a single token. However, the encoded labels should not be grouped when decoding since they don\'t correspond to the predicted tokens of the model, which is why the group_tokens=False parameter has to be passed. If we wouldn\'t pass this parameter a word like "hello" would incorrectly be encoded, and decoded as "helo". \({}^2\) The blank token allows the model to predict a word, such as "hello" by forcing it to insert the blank token between the two l\'s. A CTC-conform prediction of "hello" of our model would be [PAD] [PAD] "h" "e" "e" "l" "l" [PAD] "l" "o" "o" [PAD].
[ 0.007791656069457531, -0.02188803069293499, -0.0091028967872262, 0.004855039529502392, 0.02022133581340313, 0.06502752751111984, -0.004466954153031111, -0.013672765344381332, -0.04313899949193001, -0.030221043154597282, -0.08647242933511734, 0.025684792548418045, 0.04768601804971695, 0.033541690558195114, -0.02842903509736061, -0.012350434437394142, 0.06292366981506348, -0.015060873702168465, 0.011506293900310993, 0.049452491104602814, -0.05993141606450081, 0.012967471964657307, 0.07396888732910156, 0.05868798866868019, 0.003704555332660675, 0.018176395446062088, -0.0370401032269001, 0.05357453227043152, -0.10826923698186874, 0.05538036301732063, -0.10948894917964935, 0.0207661185413599, 0.03779635205864906, -0.049419742077589035, 0.01269600447267294, 0.009302337653934956, -0.10149787366390228, 0.05094257369637489, 0.043648459017276764, -0.05140339583158493, -0.018834734335541725, -0.0013722615549340844, -0.09467560797929764, 0.021060796454548836, -0.010631833225488663, -0.04490406811237335, -0.1355157196521759, 0.06880851089954376, 0.0042356024496257305, -0.056803371757268906, -0.08900760859251022, 0.0692581832408905, -0.06384646892547607, 0.041220273822546005, 0.01780218631029129, -0.06535401195287704, -0.06785622239112854, -0.08688101917505264, 0.011125331744551659, -0.06539230048656464, 0.0219154953956604, -0.002542303642258048, -0.013042463921010494, -0.003739020088687539, 0.028766270726919174, 0.04099370539188385, 0.011165631003677845, 0.006048142910003662, -0.03347630798816681, -0.02424769103527069, 0.004993299953639507, 0.023568764328956604, -0.006687542889267206, -0.05522061139345169, -0.005144267342984676, -0.07680148631334305, -0.03957323357462883, -0.024576226249337196, 0.0677807629108429, 0.05818744748830795, -0.02292965166270733, 0.01533652562648058, 0.03759695962071419, 0.05576132610440254, 0.0019985507242381573, 0.02309633232653141, 0.03781583160161972, -0.008520802482962608, -0.026104038581252098, 0.01734393648803234, -0.0331915020942688, -0.13154372572898865, 0.015864241868257523, 0.030597319826483727, -0.0032647293992340565, -0.055321935564279556, -0.026802610605955124, -0.01812848262488842, -0.0010724103776738048, 0.012271477840840816, 0.009544353000819683, -0.044142771512269974, 0.06196686998009682, -0.033766716718673706, -0.051406607031822205, 0.06941209733486176, -0.031329721212387085, -0.04122421145439148, -0.03200704976916313, 0.028784140944480896, -0.02719162218272686, -0.0193638913333416, -0.02411734312772751, 0.07518935948610306, -0.07529158145189285, -0.062051255255937576, 0.012538022361695766, 0.0420534648001194, -0.025722436606884003, 0.011512934230268002, 0.004623901564627886, 0.10613007843494415, 0.04092030227184296, 0.049961499869823456, -0.02747618965804577, -0.014631845988333225, 0.059812210500240326, 0.03305584937334061, 0.020098181441426277, -0.02055962383747101, -0.015520789660513401, -0.03679274395108223, 0.08384508639574051, 0.007871451787650585, 0.008973771706223488, -0.05200417712330818, 0.03241336718201637, -0.05130691081285477, -0.007813170552253723, -0.025969725102186203, 0.024118103086948395, 0.05680083855986595, -0.04049667716026306, 0.05568834766745567, -0.004310541786253452, 0.0008214125991798937, -0.08123819530010223, 0.035800110548734665, -0.02939688414335251, 0.03508753702044487, -0.020101243630051613, 0.07885611057281494, 0.0003226877888664603, -0.06198686361312866, -0.009604831226170063, 0.04879697039723396, -0.057965245097875595, -0.004645918030291796, -0.06216607615351677, 0.025687018409371376, -0.014006165787577629, 0.012094449251890182, -0.03736913204193115, 0.013633115217089653, 0.035323865711688995, -0.017274418845772743, -0.0016061589121818542, 0.03479046747088432, 0.005721943452954292, 0.05472685396671295, 0.027516527101397514, -0.042175546288490295, 0.02076282538473606, 0.04342354089021683, -0.03411135822534561, 0.05139540508389473, 0.04974602535367012, 0.03643020987510681, -0.043963510543107986, -0.02424025908112526, -0.04065079987049103, 0.07311441004276276, -0.015124715864658356, -0.0002759989583864808, 0.0593511238694191, -0.05730284005403519, -0.003669230965897441, -0.06608272343873978, -0.03325914591550827, 0.06358256191015244, -0.06473830342292786, -0.058542340993881226, 0.03461337462067604, -0.04173874482512474, 0.027388030663132668, -0.033246640115976334, -0.044118110090494156, 0.10263752192258835, 0.0194492619484663, 0.08661802113056183, 0.06801064312458038, 0.06292978674173355, -0.027061469852924347, 0.05146472901105881, -0.0019977695774286985, -0.0061992472037673, -0.025765765458345413, -0.05158086493611336, 0.02624375745654106, 0.04565116763114929, -0.02666376903653145, -0.06129222363233566, 0.02604302577674389, -0.08798731863498688, -0.03530225530266762, -0.04036276787519455, -0.02218274213373661, 0.01787559874355793, 0.0533951111137867, -0.02903852052986622, 0.13037675619125366, -0.07702609151601791, -0.01644016057252884, 0.0002189092629123479, -0.03148869797587395, 0.04087967425584793, 0.01793787255883217, 0.05691046267747879, 0.0444956012070179, -0.1014513447880745, -0.040590643882751465, -0.09732308238744736, -0.0019290612544864416, 0.04930965602397919, -0.013366774655878544, -0.07121842354536057, 0.05721462890505791, -0.0315258614718914, 0.06118932366371155, 0.0066040679812431335, -0.005028842482715845, 0.009871126152575016, 0.005483296699821949, 0.004355868324637413, -0.10148310661315918, 0.025748487561941147, 0.05845505744218826, -0.0042435768991708755, 0.0034886279609054327, -0.006006556563079357, -0.039980385452508926, 0.04013051465153694, 0.007377259433269501, -0.00353532237932086, 0.07267051190137863, 0.10311094671487808, 0.010467621497809887, -0.0031075316946953535, -0.026929760351777077, 0.01622924394905567, 0.02399158850312233, -0.008686279878020287, -0.002683395752683282, -0.053973887115716934, -0.01728612184524536, -0.050134021788835526, 0.012238865718245506, 0.0309509988874197, 0.005731635726988316, 0.004703541286289692, 0.003648728132247925, 0.014732329174876213, 0.028331663459539413, -0.04361029341816902, 0.008445066399872303, -0.0033004912547767162, 0.03060702607035637, -0.021683085709810257, -0.04584145545959473, -0.005887184292078018, -0.005628657527267933, 0.003140654182061553, 0.030140899121761322, 0.04479483515024185, 0.018327463418245316, 0.01725366711616516, 0.0031997724436223507, -0.025347433984279633, -0.03167042136192322, 0.03869984671473503, 0.00923460628837347, 0.05183086544275284, 0.01819741353392601, -0.01172950305044651, 0.02280619367957115, 0.016951972618699074, -0.0057385689578950405, -0.011850589886307716, -0.02094884216785431, 0.03435749188065529, -0.014557711780071259, -0.005022253841161728, -0.021929793059825897, 0.013410096988081932, -0.04613253474235535, -0.03139621391892433, 0.002397951204329729, 0.04719879478216171, -0.10184815526008606, 0.008870932273566723, -0.002709807828068733, 0.003232993884012103, -0.01028868742287159, -0.023442132398486137, 0.01560550183057785, -0.021824762225151062, -0.05959527567028999, 0.011700928211212158, 0.01013639010488987, 0.03764178603887558, 0.0027696825563907623, -0.009358691051602364, -0.0012354729697108269, -0.0008198493742384017, -0.004262860398739576, -0.017241498455405235, -0.004425709135830402, 0.03371812775731087, -0.017727242782711983, 0.01218249648809433, 0.005273367278277874, 0.03858065605163574, -0.01856067217886448, -0.011124460026621819, 0.020532594993710518, 0.027414420619606972, 0.0023059453815221786, -0.036038778722286224, -0.00712123466655612, 0.006512895226478577, -0.018440335988998413, -0.024077730253338814, -0.041732851415872574, 0.002323424443602562, 0.005850555840879679, 0.009516284801065922, -0.008384695276618004, 0.02268161065876484, -0.008797853253781796, 0.022893337532877922, 0.016468552872538567, -0.03112882934510708, 0.02995205856859684, -0.01595141552388668, 0.00020653069077525288, -0.014344913884997368, 0.039573732763528824, -0.042755287140607834, 0.003003709716722369, -0.01709531806409359, 0.015828555449843407, 0.013422392308712006, 0.013599276542663574, -0.010855171829462051, -0.006838676519691944, 0.07400283217430115, 0.02043193206191063, -0.013716811314225197, -0.009072726592421532, -0.02343985252082348, -0.00293520325794816, 0.014608742669224739, -0.0003563009377103299, 0.037048373371362686, 0.00004505680044530891, -0.011650613509118557, -0.03466936945915222, 0.02280632220208645, -0.005730260629206896, 0.02542434260249138, -0.01985073648393154, 0.008901845663785934, -0.010579337365925312, 0.010230090469121933, -0.01847555674612522, -0.010691726580262184, 0.04436902701854706, 0.013060284778475761, -0.05132932588458061, -0.03826846927404404, -0.032338276505470276, -0.0064069428481161594, -0.013039077632129192, 0.018245264887809753, 0.01760128140449524, 0.0009108592639677227, 0.01699967123568058, 0.02262420766055584, 0.041728466749191284, -0.013775489293038845, 0.020884303376078606, -0.006506146863102913, -0.017820481210947037, 0.014028997160494328, 0.025472769513726234, -0.019602281972765923, -0.021409330889582634, 0.051102399826049805, -0.0048421816900372505, -0.08697758615016937, 0.0009352428605780005, -0.04648382589221001, 0.05933636426925659, -0.016625436022877693, -0.06573319435119629, -0.03456578403711319, -0.005329082254320383, 0.013065597042441368, 0.021433254703879356, -0.01873459666967392, -0.003250343259423971, 0.025509078055620193, 0.03070368617773056, 0.03872416913509369, -0.0462798997759819, -0.07999363541603088, -0.06850874423980713, 0.03570839762687683, -0.015321487560868263, 0.001045340090058744, 0.014760292135179043, -0.009215009398758411, 0.04231111332774162, 0.011817080900073051, 0.05229084566235542, 0.035037584602832794, -0.013613085262477398, -0.021744631230831146, -0.01904330588877201, 0.02338230423629284, 0.029769986867904663, 0.012032230384647846, 0.009948400780558586, 0.012638367712497711, 0.008592601865530014, 0.006925139110535383, 0.024840185418725014, -0.03226158767938614, -0.015069338493049145, -0.022456880658864975, -0.0046978541649878025, -0.05808020010590553, 0.06298171728849411, 0.021437693387269974, -0.013867770321667194, -0.014918366447091103, -0.02096085622906685, 0.017336348071694374, 0.048188693821430206, -0.017036864534020424, -0.0001615793735254556, 0.008686769753694534, 0.014232849702239037, -0.05285845324397087, 0.012960032559931278, 0.042627718299627304, 0.03695403411984444, 0.05923760309815407, -0.008254113607108593, 0.00325913168489933, -0.010497592389583588, 0.05168682709336281, 0.0479239784181118, 0.0012152991257607937, -0.011974244378507137, -0.06881099194288254, 0.03848908469080925, 0.011545718647539616, 0.0122972521930933, -0.017438732087612152, 0.0064239720813930035, -0.028826948255300522, -0.0008617361891083419, 0.04086071252822876, 0.01760590262711048, 0.04613114520907402, -0.0029248648788779974, 0.009388439357280731, 0.005345932208001614, -0.005114268511533737, 0.021116994321346283, -0.012028375640511513, -0.003629285842180252, -0.0027302068192511797, 0.04538927227258682, 0.06279758363962173, 0.04046314209699631, 0.032637402415275574, -0.01846231520175934, -0.005038566887378693, -0.00006900952575961128, -0.014462312683463097, -0.009284290485084057, -0.004135677590966225, -0.04032263532280922, 0.04156535118818283, -0.004312629345804453, 0.010441184043884277, 0.024735726416110992, 0.00504999840632081, 0.014778503216803074, -0.023680731654167175, -0.00644642161205411, 0.011208164505660534, 0.0012409817427396774, -0.06844274699687958, -0.002595508238300681, -0.004441913682967424, -0.012560474686324596, -0.022199956700205803, 0.012429889291524887, 0.009458143264055252, -0.005809542257338762, -0.06076702103018761, -0.06005649268627167, 0.019108083099126816, 0.032650962471961975, 0.060434773564338684, 0.015504571609199047, -0.01373505312949419, 0.0025986717082560062, 0.0261919517070055, 0.005787931382656097, -0.03708212450146675, -0.014638985507190228, 0.039246149361133575, -0.014166249893605709, 0.0390893779695034, -0.008133568800985813, -0.01992085576057434, 0.009601302444934845, 0.06955450028181076, -0.026562433689832687, -0.008512045256793499, -0.06872877478599548, 0.04118359088897705, 0.01435770932585001, 0.004892855882644653, 0.021151509135961533, 0.020118577405810356, -0.0077889785170555115, 0.05904681608080864, -0.027905955910682678, 0.02715296484529972, 0.03674270957708359, -0.0015802597627043724, 0.004912274423986673, 0.011943276040256023, 0.03185778483748436, 0.04257930815219879, -0.003244273830205202, -0.02037103660404682, 0.05020568519830704, 0.021247895434498787, 0.011418497189879417, 0.014409251511096954, 0.025631984695792198, 0.017380008473992348, 0.04089120030403137, -0.09817357361316681, 0.01573394611477852, -0.00018374199862591922, -0.01861567050218582, 0.024933505803346634, 0.02594875916838646, -0.02171221375465393, -0.003997425548732281, -0.009323052130639553, 0.00842527486383915, 0.037123654037714005, 0.0001082212693290785, 0.04322681948542595, 0.017674388363957405, -0.028495077043771744, -0.030959324911236763, 0.0637269839644432, -0.02192862518131733, 0.021008051931858063, 0.03639090061187744, 0.022591309621930122, 0.005682263523340225, 0.0574076771736145, -0.0014997241087257862, 0.07051746547222137, 0.06925934553146362, -0.010665475390851498, 0.015225525014102459, 0.017671076580882072, 0.014732659794390202, 0.025936035439372063, -0.004361339844763279, -0.004312139004468918, -0.009090271778404713, -0.011635955423116684, 0.03229939565062523, -0.006505229510366917, 0.018032532185316086, -0.03695691376924515, 0.018311230465769768, 0.024604910984635353, -0.012134944088757038, -0.012964305467903614, 0.01986837573349476, 0.03900294378399849, 0.04023360833525658, 0.020428098738193512, 0.048530105501413345, 0.018481193110346794, -0.04123171791434288, 0.05638924986124039, 0.010951395146548748, 0.010112863034009933, -0.012100222520530224, -0.03116074949502945, 0.028552308678627014, -0.03363076224923134, -0.028914758935570717, 0.007346034981310368, 0.009930751286447048, -0.021297583356499672, 0.006846420932561159, 0.010680802166461945, -0.013685634359717369, 0.01761655882000923, 0.0004273404774721712, -0.0021031000651419163, 0.04754836484789848, 0.02354450523853302, -0.027041861787438393, 0.07956061512231827, 0.032299742102622986, -0.037926483899354935, -0.019868357107043266, -0.026587815955281258, 0.005405262112617493, 0.01755412481725216, -0.01022569090127945, 0.01967340148985386, -0.01505066454410553, -0.015530589036643505, 0.0016170726157724857, -0.01810384914278984, -0.02318488247692585, 0.011592285707592964, -0.039120692759752274, -0.001334957079961896, -0.033071354031562805, -0.024794889613986015, 0.00449580792337656, 0.006370102986693382, -0.005867088213562965, 0.000968765642028302, -0.009349973872303963, 0.03758547455072403, 0.01076432690024376, -0.03334634006023407, 0.028387287631630898, 0.020645931363105774, 0.01824992336332798, -0.030277879908680916, 0.05304841324687004, 0.01577942632138729, -0.087690569460392, -0.04264518618583679, -0.007320329546928406, -0.019966794177889824, 0.03170568123459816, 0.02770870365202427, -0.0361592136323452, -0.002748398343101144, -0.05573980510234833, -0.03910229727625847, -0.0245605930685997, 0.006330419331789017, 0.01361212506890297, 0.0008900708635337651, -0.0011653532274067402, -0.028124138712882996, 0.055339228361845016, 0.023539936169981956, -0.000817284919321537, 0.005646180361509323, 0.02009687013924122, 0.0031433606054633856, -0.007004959043115377, 0.034795232117176056, -0.0357683002948761, -0.008303079754114151, -0.060859501361846924, -0.049172595143318176, -0.0003298411029390991, 0.00832933746278286, -0.0009361781412735581, 0.001299880095757544, -0.037696439772844315, -0.011514019221067429, -0.028625324368476868, -0.028785470873117447, -0.0235676858574152, -0.004640106111764908, 0.04543065279722214, 0.0569111593067646, 0.041623957455158234, 0.04034038633108139, -0.04414929822087288, 0.011399660259485245, 0.02125050127506256, -0.01573631726205349, 0.04705892130732536, 0.00012673466699197888, 0.02324647270143032, -0.02721366286277771, 0.025309136137366295, 0.01965038850903511, -0.0266273096203804, 0.024942578747868538, -0.004265597555786371, 0.008979170583188534, -0.021462049335241318, 0.04005890339612961, 0.038915034383535385, 0.013804085552692413, 0.05976405367255211, -0.015107272192835808, -0.025358906015753746, 0.029530290514230728, -0.0018734431359916925, -0.11218804866075516, -0.013383666053414345, -0.02729615941643715, -0.03045043908059597, 0.023642174899578094, -0.003981215413659811, 0.040228139609098434, -0.002326371381059289, -0.0006496554124169052, -0.031303610652685165, -0.010572060942649841, 0.006017394829541445, -0.06601802259683609, 0.010303654707968235, 0.018356498330831528, -0.015917446464300156, 0.008651304990053177, 0.010868140496313572, 0.036917828023433685, -0.015003269538283348, -0.01023429911583662, -0.010662353597581387, 0.01203715056180954, 0.03912629187107086, -0.013990646228194237, 0.009187688119709492, 0.057102277874946594, 0.03134898096323013, 0.026997528970241547, -0.01613687537610531, 0.023700665682554245 ]
Fine-Tune Wav2Vec2 for English ASR with 🤗 Transformers
patrickvonplaten
March 12, 2021
fine-tune-wav2vec2-english
guide, audio
https://huggingface.co/blog/fine-tune-wav2vec2-english
Evaluation In the final part, we evaluate our fine-tuned model on the test set and play around with it a bit. Let\'s load the processor and model. python processor = Wav2Vec2Processor.from_pretrained(repo_name) model = Wav2Vec2ForCTC.from_pretrained(repo_name) Now, we will make use of the map(...) function to predict the transcription of every test sample and to save the prediction in the dataset itself. We will call the resulting dictionary "results". Note: we evaluate the test data set with batch_size=1 on purpose due to this issue. Since padded inputs don\'t yield the exact same output as non-padded inputs, a better WER can be achieved by not padding the input at all. python def map_to_result(batch): with torch.no_grad(): input_values = torch.tensor(batch["input_values"], device="cuda").unsqueeze(0) logits = model(input_values).logits pred_ids = torch.argmax(logits, dim=-1) batch["pred_str"] = processor.batch_decode(pred_ids)[0] batch["text"] = processor.decode(batch["labels"], group_tokens=False) return batch results = timit["test"].map(map_to_result, remove_columns=timit["test"].column_names) Let\'s compute the overall WER now. python print("Test WER: {:.3f}".format(wer_metric.compute(predictions=results["pred_str"], references=results["text"]))) Print Output: bash Test WER: 0.221 22.1% WER - not bad! Our demo model would have probably made it on the official leaderboard. Let's take a look at some predictions to see what errors are made by the model. Print Output: python show_random_elements(results.remove_columns(["speech", "sampling_rate"])) | pred_str | target_text | |----------|:-------------:| | am to balence your employe you benefits package | aim to balance your employee benefit package | | the fawlg prevented them from ariving on tom | the fog prevented them from arriving on time | | young children should avoide exposure to contagieous diseases | young children should avoid exposure to contagious diseases | | artifficial intelligence is for real | artificial intelligence is for real | | their pcrops were two step latters a chair and a polmb fan | their props were two stepladders a chair and a palm fan | | if people were more generous there would be no need for wealfare | if people were more generous there would be no need for welfare | | the fish began to leep frantically on the surface of the small ac | the fish began to leap frantically on the surface of the small lake | | her right hand eggs whenever the barametric pressur changes | her right hand aches whenever the barometric pressure changes | | only lawyers loved miliunears | only lawyers love millionaires | | the nearest cennagade may not be within wallkin distance | the nearest synagogue may not be within walking distance | It becomes clear that the predicted transcriptions are acoustically very similar to the target transcriptions, but often contain spelling or grammatical errors. This shouldn\'t be very surprising though given that we purely rely on Wav2Vec2 without making use of a language model. Finally, to better understand how CTC works, it is worth taking a deeper look at the exact output of the model. Let\'s run the first test sample through the model, take the predicted ids and convert them to their corresponding tokens. python model.to("cuda") with torch.no_grad(): logits = model(torch.tensor(timit["test"][:1]["input_values"], device="cuda")).logits pred_ids = torch.argmax(logits, dim=-1) # convert ids to tokens " ".join(processor.tokenizer.convert_ids_to_tokens(pred_ids[0].tolist())) Print Output: bash [PAD] [PAD] [PAD] [PAD] [PAD] [PAD] t t h e e | | b b [PAD] u u n n n g g [PAD] a [PAD] [PAD] l l [PAD] o o o [PAD] | w w a a [PAD] s s | | [PAD] [PAD] p l l e e [PAD] [PAD] s s e n n t t t [PAD] l l y y | | | s s [PAD] i i [PAD] t t t [PAD] u u u u [PAD] [PAD] [PAD] a a [PAD] t t e e e d d d | n n e e a a a r | | t h h e | | s s h h h [PAD] o o o [PAD] o o r r [PAD] [PAD] [PAD] [PAD] [PAD] [PAD] [PAD] [PAD] [PAD] [PAD] [PAD] The output should make it a bit clearer how CTC works in practice. The model is to some extent invariant to speaking rate since it has learned to either just repeat the same token in case the speech chunk to be classified still corresponds to the same token. This makes CTC a very powerful algorithm for speech recognition since the speech file\'s transcription is often very much independent of its length. I again advise the reader to take a look at this very nice blog post to better understand CTC.
[ 0.04991444945335388, -0.04491124674677849, -0.04256828874349594, 0.01829151250422001, -0.004657047800719738, 0.051695287227630615, 0.05545975640416145, -0.03674367815256119, -0.036256492137908936, -0.035051967948675156, -0.06003471463918686, 0.03802955523133278, 0.02810209058225155, -0.003840287681668997, -0.041272230446338654, -0.027192573994398117, 0.05855383723974228, -0.04305696487426758, 0.004565408919006586, 0.08122192323207855, 0.002558087697252631, -0.03455210477113724, 0.06853922456502914, 0.05660856142640114, -0.0003913765540346503, 0.024999970570206642, 0.010033631697297096, 0.010269220918416977, -0.054419826716184616, 0.01728450134396553, -0.1318882256746292, -0.0024349826853722334, -0.055198635905981064, -0.026485219597816467, -0.04271398112177849, 0.03427860885858536, -0.07094258069992065, 0.07681429386138916, 0.049469903111457825, -0.0338793620467186, 0.022739989683032036, -0.006603252608329058, -0.05450885742902756, 0.05426764860749245, 0.046721093356609344, -0.060242149978876114, -0.1157737448811531, 0.05891284719109535, -0.01107883732765913, -0.0833285003900528, -0.07777192443609238, 0.056964240968227386, -0.026226315647363663, 0.026952289044857025, 0.0002215848071500659, -0.03978022560477257, -0.023559993132948875, -0.03999701514840126, 0.01604461669921875, -0.017789378762245178, -0.01197659783065319, 0.043721284717321396, -0.026622368022799492, 0.06821112334728241, 0.01664559915661812, -0.0006213253363966942, 0.03529873862862587, 0.04636864736676216, -0.05390336737036705, -0.0026008645072579384, -0.04387388750910759, -0.007448282092809677, -0.0005107611650601029, -0.03738367557525635, 0.007382066920399666, -0.08538327366113663, -0.024289973080158234, -0.009934053756296635, 0.05254849046468735, 0.0786973163485527, -0.0611896887421608, -0.006929079536348581, -0.008787352591753006, 0.056009937077760696, 0.019733166322112083, -0.00810734461992979, 0.0400749109685421, -0.03804711252450943, -0.08496256917715073, 0.001003827783279121, -0.024509325623512268, -0.09554968774318695, -0.018589790910482407, 0.0062906271778047085, -0.002861985471099615, -0.04078741744160652, 0.01919758878648281, -0.023100832477211952, -0.03943242132663727, -0.05799683555960655, 0.03180593624711037, -0.04540267214179039, 0.0072982595302164555, -0.006101005245000124, -0.09106944501399994, 0.07243546843528748, -0.04916120320558548, -0.049015190452337265, -0.01625773310661316, 0.03553326800465584, 0.04818376526236534, 0.0029135732911527157, -0.041925594210624695, 0.06485574692487717, -0.05513997748494148, -0.07032738626003265, -0.03710753843188286, 0.054435428231954575, -0.03920058533549309, -0.008845758624374866, 0.015416925773024559, 0.09961526095867157, 0.06021043658256531, -0.04622510448098183, -0.01922113075852394, -0.02804257534444332, 0.06309102475643158, 0.030471069738268852, 0.03681224584579468, -0.004326309077441692, -0.010341405868530273, -0.020872946828603745, 0.08055748790502548, 0.034888844937086105, -0.03854937478899956, -0.05709031596779823, -0.016940444707870483, -0.0853303074836731, 0.0053482502698898315, -0.033809494227170944, -0.007329827640205622, 0.04289247840642929, -0.05106706544756889, 0.04169922322034836, 0.004637483973056078, 0.006296129431575537, -0.020214011892676353, 0.0952218770980835, -0.007077439222484827, 0.034584883600473404, -0.042550280690193176, 0.08213446289300919, -0.0036061035934835672, -0.06887475401163101, 0.005334108602255583, 0.07592777907848358, -0.05124340578913689, -0.04008474200963974, -0.06812950223684311, 0.03207961469888687, -0.028747890144586563, 0.014411507174372673, -0.01355025079101324, -0.03171512484550476, 0.015111936256289482, 0.01592487283051014, 0.020230324938893318, 0.018682992085814476, 0.018972231075167656, 0.05391674116253853, 0.020399967208504677, -0.04867738112807274, 0.08942452818155289, 0.03546769544482231, 0.0047437287867069244, 0.03278584033250809, 0.011108968406915665, 0.033957529813051224, 0.01190336886793375, -0.02992585115134716, -0.05194175988435745, 0.06889264285564423, -0.01960562914609909, 0.03178560361266136, 0.028546754270792007, -0.05943373590707779, -0.008045309223234653, -0.03856103494763374, -0.01087998691946268, 0.07574035972356796, -0.049872998148202896, -0.03228415548801422, 0.05250437557697296, -0.10215012729167938, 0.02053360641002655, -0.05770717188715935, -0.0341128446161747, 0.06191810220479965, 0.030883025377988815, 0.03251819312572479, 0.015429454855620861, 0.043315622955560684, 0.011348124593496323, -0.01731358841061592, 0.009722830727696419, -0.04455780237913132, 0.006218722555786371, -0.10216981172561646, 0.01008264347910881, 0.08143547922372818, 0.0584886260330677, -0.06408743560314178, 0.03226114809513092, -0.13137288391590118, -0.021709414198994637, 0.0059212371706962585, -0.06049860268831253, 0.011934679001569748, 0.021753806620836258, -0.03743760660290718, 0.11893777549266815, -0.03221479803323746, 0.056300509721040726, -0.05941781774163246, -0.04634028673171997, 0.05688467249274254, -0.005479324143379927, 0.08634094148874283, 0.043157193809747696, -0.07119021564722061, -0.06429678201675415, -0.09763416647911072, -0.030462678521871567, 0.03630227595567703, -0.03855949640274048, -0.058085761964321136, 0.026714660227298737, 0.039693478494882584, 0.03306146711111069, -0.03131631761789322, 0.05486437678337097, -0.0013471597339957952, -0.038860633969306946, 0.08590122312307358, -0.04130018502473831, -0.02785935252904892, 0.07300723344087601, -0.06409867107868195, -0.04035469889640808, -0.03398002311587334, -0.022436121478676796, 0.043184395879507065, 0.006396023090928793, -0.004701170604676008, 0.05715515837073326, 0.06208665296435356, -0.005424177274107933, -0.008395296521484852, -0.02394160069525242, 0.037404030561447144, -0.000558835978154093, -0.029150763526558876, 0.0005535005475394428, -0.015591125003993511, 0.02602677419781685, -0.04266176000237465, 0.052517540752887726, 0.02113579586148262, 0.013594912365078926, -0.0033876339439302683, -0.008531049825251102, -0.0018763497937470675, 0.037924155592918396, -0.018387680873274803, 0.04538962244987488, 0.04536227881908417, 0.00756659684702754, 0.00040795342647470534, -0.025858914479613304, -0.007562721148133278, -0.013388224877417088, -0.019063368439674377, 0.04723909869790077, 0.0021232308354228735, 0.011109627783298492, 0.012182394973933697, -0.001469730050303042, 0.022727040573954582, -0.037081025540828705, 0.03385542705655098, 0.013404658995568752, 0.051816098392009735, 0.02008647471666336, -0.013405544683337212, 0.036200739443302155, 0.03396741300821304, -0.002706780331209302, -0.014773360453546047, -0.002595460508018732, 0.022358113899827003, -0.07109000533819199, -0.03592824935913086, -0.031243978068232536, -0.003617708571255207, -0.01995057612657547, 0.005217497702687979, 0.013937355950474739, 0.014362242072820663, -0.08651168644428253, 0.03268548101186752, 0.025655323639512062, -0.013912883587181568, 0.0034666897263377905, 0.00970236212015152, 0.015065699815750122, 0.00428809504956007, -0.04981958121061325, 0.027722354978322983, 0.017269225791096687, 0.015060397796332836, 0.006689274683594704, 0.017736461013555527, 0.04153632000088692, 0.002640360966324806, 0.015096326358616352, -0.0114824790507555, 0.018653102219104767, 0.016565192490816116, 0.008318377658724785, 0.01033270638436079, -0.004879165440797806, 0.01983238011598587, -0.010205953381955624, 0.015971913933753967, 0.058381613343954086, 0.041898444294929504, 0.0002097395627060905, -0.02728661336004734, -0.03649092838168144, -0.026634318754076958, 0.013898679055273533, -0.021845072507858276, -0.010036495514214039, -0.036778613924980164, -0.007908953353762627, -0.007861836813390255, 0.019822819158434868, 0.018795473501086235, -0.014468126930296421, -0.0016328137135133147, 0.0054163578897714615, -0.027949940413236618, 0.003094813786447048, 0.01916363276541233, 0.023310208693146706, -0.02134862169623375, -0.0007076880428940058, -0.03386469557881355, -0.04046428203582764, 0.0004141696263104677, -0.027147479355335236, 0.0708676427602768, -0.009131461381912231, -0.00701866066083312, 0.012465526349842548, 0.05706857517361641, 0.05146637186408043, -0.007201588246971369, -0.03856371343135834, -0.017595091834664345, 0.00973924808204174, -0.002321254927664995, 0.031022677198052406, 0.013474363833665848, 0.014210725203156471, -0.03868609666824341, -0.05689205601811409, 0.0003440278524067253, 0.01677093654870987, 0.04553566500544548, -0.014305291697382927, 0.006082848645746708, -0.031421683728694916, 0.01350253913551569, -0.01838672161102295, 0.006921157240867615, 0.05457023158669472, 0.013823352754116058, -0.04003186896443367, -0.021773986518383026, 0.005565805360674858, 0.01717572659254074, -0.007245603948831558, 0.024296434596180916, 0.004373900592327118, 0.007415437139570713, 0.023594578728079796, 0.005404000636190176, 0.03682422637939453, 0.004978868644684553, -0.03158439323306084, 0.010030235163867474, -0.03598658740520477, 0.00016847917868290097, 0.008282299153506756, 0.011590193957090378, -0.008640745654702187, -0.019643189385533333, -0.007360192481428385, -0.09492082893848419, 0.027826713398098946, 0.003217685269191861, 0.02731638215482235, 0.0019522452494129539, -0.082007996737957, -0.0391329862177372, -0.0007462736102752388, -0.022848907858133316, 0.016624823212623596, -0.03201364725828171, 0.01883702166378498, -0.006330172996968031, 0.029910394921898842, 0.0048150429502129555, 0.009031293913722038, -0.022517777979373932, 0.010558738373219967, 0.031885650008916855, -0.02581326849758625, 0.012352654710412025, 0.018308235332369804, -0.021410491317510605, 0.049075137823820114, 0.026832863688468933, 0.04310493916273117, 0.02107863500714302, -0.026324551552534103, -0.021766211837530136, -0.010561599396169186, 0.016082148998975754, 0.03214138001203537, -0.026127677410840988, 0.017792023718357086, 0.00042519898852333426, 0.025415360927581787, -0.006430767010897398, 0.009837917983531952, -0.03188714012503624, -0.01551609206944704, -0.03062240034341812, -0.010345464572310448, -0.028070123866200447, 0.017216209322214127, 0.02224276214838028, -0.022168338298797607, -0.019142471253871918, -0.02223002351820469, 0.01987539976835251, 0.031149717047810555, -0.008901125751435757, -0.034106869250535965, -0.0013578260550275445, 0.054281122982501984, 0.006030297372490168, -0.007861755788326263, 0.020778456702828407, 0.032553669065237045, 0.0516059510409832, -0.026388399302959442, 0.012507622130215168, -0.03530866652727127, 0.054380837827920914, 0.029483303427696228, -0.030522383749485016, -0.040428999811410904, -0.0698738545179367, 0.01649526320397854, -0.027156010270118713, 0.009248976595699787, -0.0131616136059165, -0.02905215322971344, -0.020698735490441322, 0.018555862829089165, 0.015428240410983562, 0.024919940158724785, 0.01406532246619463, -0.023035835474729538, 0.024172089993953705, 0.035791829228401184, -0.015469161793589592, 0.029907573014497757, 0.0006523331394419074, -0.010583975352346897, 0.014485572464764118, 0.005614123772829771, 0.04418615996837616, 0.00529554532840848, 0.029001029208302498, 0.009883910417556763, -0.005320116877555847, 0.00903674028813839, -0.04455003887414932, 0.00542234443128109, 0.02368937060236931, -0.013303431682288647, 0.03170592337846756, -0.039227552711963654, -0.022040955722332, 0.02408953197300434, 0.04126255214214325, 0.009155020117759705, -0.02870851755142212, 0.012064208276569843, -0.051347073167562485, 0.010216612368822098, -0.009245657362043858, 0.027874020859599113, -0.0213511660695076, 0.002690691500902176, -0.008544040843844414, -0.007633247412741184, 0.016660967841744423, 0.03106565959751606, -0.03544501215219498, -0.031276144087314606, 0.05664178356528282, 0.016185160726308823, 0.006755306385457516, -0.02755584567785263, -0.038807280361652374, -0.0031715440563857555, 0.01176733709871769, 0.028250988572835922, -0.008149201050400734, 0.026613881811499596, 0.014176862314343452, 0.029698459431529045, 0.02131856419146061, 0.01525466050952673, -0.037854887545108795, -0.0032668206840753555, 0.042517513036727905, 0.005252850707620382, -0.016044631600379944, -0.04684052988886833, 0.07110722362995148, 0.03855496272444725, -0.03410889208316803, 0.00896980706602335, 0.006731119006872177, -0.043625619262456894, 0.0724160373210907, -0.02929152175784111, 0.03923368826508522, 0.014044011943042278, -0.01781216636300087, 0.036209627985954285, 0.02540145069360733, 0.011042824946343899, 0.0668124184012413, -0.016742439940571785, 0.014073560014367104, 0.0015368100721389055, 0.01975696161389351, -0.0052134268917143345, -0.0006655079778283834, 0.006628934759646654, 0.014639873057603836, 0.03800266981124878, -0.058770354837179184, 0.0013834310229867697, 0.01692674122750759, -0.0032923545222729445, 0.029773415997624397, 0.03104107640683651, -0.04372234642505646, -0.0017795284511521459, 0.023521067574620247, 0.016469629481434822, 0.020712334662675858, 0.01864919252693653, 0.06189640611410141, 0.041132740676403046, -0.02076946198940277, -0.03434710577130318, 0.044749438762664795, -0.0024452977813780308, 0.01497146300971508, 0.011447290889918804, 0.038749415427446365, 0.0018364132847636938, 0.03477896749973297, 0.009820815175771713, 0.0061178128235042095, 0.05540623143315315, -0.0038110341411083937, 0.007642344105988741, 0.007163988426327705, 0.043507784605026245, 0.0011091390624642372, -0.002252602716907859, -0.08377853780984879, -0.010675642639398575, -0.007542178500443697, 0.02823583222925663, 0.008981866762042046, 0.00026185251772403717, -0.04285451024770737, 0.03711872920393944, 0.04506458342075348, 0.027531517669558525, -0.014153600670397282, 0.0041200523264706135, 0.0050292243249714375, 0.028968283906579018, 0.018873078748583794, 0.02135528437793255, -0.015222749672830105, -0.02545030042529106, 0.05863729491829872, 0.002967130159959197, -0.0011597841512411833, 0.02753572352230549, 0.004352757707238197, 0.010656943544745445, -0.009133988991379738, -0.0015833622310310602, 0.03620889410376549, 0.016389787197113037, -0.0025861572939902544, -0.001372438739053905, 0.017645006999373436, -0.01981179602444172, 0.005564203951507807, -0.02145194821059704, -0.05556531250476837, -0.020627522841095924, -0.01719576306641102, -0.033144623041152954, 0.09480569511651993, 0.024789748713374138, -0.06994359195232391, -0.017044346779584885, 0.006853635422885418, 0.03535168990492821, 0.06789348274469376, -0.03260460123419762, -0.03497714921832085, -0.033909108489751816, -0.0004428189422469586, -0.00909594539552927, 0.026717420667409897, -0.023706242442131042, 0.03986069932579994, -0.0035471306182444096, 0.019186967983841896, -0.021006207913160324, 0.008964606560766697, 0.016093825921416283, -0.0085177943110466, -0.017102021723985672, 0.02574821375310421, 0.014531586319208145, 0.018482860177755356, 0.03912479802966118, -0.040373511612415314, -0.01807163655757904, 0.016912754625082016, 0.04143357276916504, -0.007830637507140636, 0.040027473121881485, 0.002887182403355837, -0.05120691657066345, -0.022487357258796692, -0.012617400847375393, -0.05001397803425789, 0.008646514266729355, -0.009485268965363503, 0.00902989599853754, 0.017511647194623947, -0.03793777525424957, -0.0555778332054615, -0.009780502878129482, -0.00437035271897912, 0.04239550605416298, -0.012852130457758904, -0.008641541004180908, -0.02100764587521553, 0.04980117827653885, 0.017802171409130096, 0.012965372763574123, 0.012171558104455471, -0.00023509954917244613, 0.022480865940451622, 0.022226883098483086, 0.04181448370218277, -0.05535373091697693, 0.02069724351167679, -0.0390615351498127, -0.0722668394446373, -0.02131866291165352, 0.021958760917186737, -0.03591500595211983, -0.0006731220055371523, -0.058641813695430756, 0.0021563046611845493, -0.01945502683520317, -0.014226009137928486, -0.039297379553318024, -0.015737878158688545, 0.05479735508561134, 0.05050066486001015, -0.009841563180088997, 0.0457514263689518, -0.05534195527434349, -0.01618756540119648, -0.007388505153357983, 0.000500036810990423, 0.012533837929368019, 0.0027356757782399654, 0.004461219999939203, -0.0011637889547273517, 0.027515247464179993, 0.016624324023723602, -0.03883485868573189, 0.004778537433594465, 0.029265275225043297, 0.02190299704670906, -0.026942450553178787, 0.053114041686058044, 0.04340861365199089, 0.002682352904230356, 0.01143154501914978, -0.003552048234269023, 0.012433568015694618, -0.02912014164030552, 0.020810741931200027, -0.08000367879867554, 0.007924794219434261, -0.02437557838857174, 0.002108283108100295, 0.010532069951295853, 0.005185174290090799, 0.06404998898506165, 0.02387295663356781, -0.003167737042531371, -0.03566571697592735, 0.008214609697461128, -0.022425711154937744, -0.059856973588466644, -0.0035396856255829334, 0.04155195876955986, -0.045462947338819504, -0.01065259613096714, 0.014606103301048279, 0.013228995725512505, -0.010546034201979637, 0.036233484745025635, -0.014929193072021008, 0.06582421064376831, 0.010083011351525784, -0.0024556159041821957, -0.0075345891527831554, 0.0671413391828537, 0.02216414362192154, 0.008490261621773243, 0.003701525740325451, 0.05413997545838356 ]
Fine-Tune Wav2Vec2 for English ASR with 🤗 Transformers
patrickvonplaten
March 12, 2021
fine-tune-wav2vec2-english
guide, audio
https://huggingface.co/blog/fine-tune-wav2vec2-english
Training Training will take between 90 and 180 minutes depending on the GPU allocated to the google colab attached to this notebook. While the trained model yields satisfying results on Timit\'s test data, it is by no means an optimally fine-tuned model. The purpose of this notebook is to demonstrate how Wav2Vec2\'s base, large, and large-lv60 checkpoints can be fine-tuned on any English dataset. In case you want to use this google colab to fine-tune your model, you should make sure that your training doesn\'t stop due to inactivity. A simple hack to prevent this is to paste the following code into the console of this tab (right mouse click -> inspect -> Console tab and insert code). javascript function ConnectButton(){ console.log("Connect pushed"); document.querySelector("#top-toolbar > colab-connect-button").shadowRoot.querySelector("#connect").click() } setInterval(ConnectButton,60000); python trainer.train() Depending on your GPU, it might be possible that you are seeing an "out-of-memory" error here. In this case, it's probably best to reduce per_device_train_batch_size to 16 or even less and eventually make use of gradient_accumulation. Print Output: | Step | Training Loss | Validation Loss | WER | Runtime | Samples per Second | |---|---|---|---|---|---| | 500 | 3.758100 | 1.686157 | 0.945214 | 97.299000 | 17.266000 | | 1000 | 0.691400 | 0.476487 | 0.391427 | 98.283300 | 17.093000 | | 1500 | 0.202400 | 0.403425 | 0.330715 | 99.078100 | 16.956000 | | 2000 | 0.115200 | 0.405025 | 0.307353 | 98.116500 | 17.122000 | | 2500 | 0.075000 | 0.428119 | 0.294053 | 98.496500 | 17.056000 | | 3000 | 0.058200 | 0.442629 | 0.287299 | 98.871300 | 16.992000 | | 3500 | 0.047600 | 0.442619 | 0.285783 | 99.477500 | 16.888000 | | 4000 | 0.034500 | 0.456989 | 0.282200 | 99.419100 | 16.898000 | The final WER should be below 0.3 which is reasonable given that state-of-the-art phoneme error rates (PER) are just below 0.1 (see leaderboard) and that WER is usually worse than PER. You can now upload the result of the training to the Hub, just execute this instruction: python trainer.push_to_hub() You can now share this model with all your friends, family, favorite pets: they can all load it with the identifier "your-username/the-name-you-picked" so for instance: python from transformers import AutoModelForCTC, Wav2Vec2Processor model = AutoModelForCTC.from_pretrained("patrickvonplaten/wav2vec2-base-timit-demo-colab") processor = Wav2Vec2Processor.from_pretrained("patrickvonplaten/wav2vec2-base-timit-demo-colab")
[ 0.004948330577462912, 0.0033926842734217644, 0.013438832014799118, 0.018305735662579536, 0.01362348347902298, -0.010484122671186924, 0.01590729132294655, 0.006582360714673996, 0.03312418609857559, -0.09351108968257904, 0.0012168801622465253, 0.035791512578725815, 0.034134503453969955, 0.013357620686292648, 0.03142475709319115, -0.056597232818603516, 0.08479779958724976, -0.007250063121318817, -0.004824109375476837, 0.05448280647397041, -0.03176875784993172, 0.002702700672671199, 0.045876938849687576, 0.021751768887043, -0.014238851144909859, 0.0033430270850658417, -0.0058688935823738575, 0.008154602721333504, -0.0529741495847702, -0.016947440803050995, -0.11224961280822754, 0.0055608139373362064, 0.048768091946840286, -0.07608775794506073, 0.01729193702340126, 0.027940373867750168, -0.0618269219994545, 0.029720963910222054, 0.06617986410856247, -0.02074476331472397, 0.004089054185897112, 0.017796093598008156, -0.07620758563280106, 0.08445177972316742, -0.00849477481096983, -0.0076688663102686405, -0.023113425821065903, 0.02442614547908306, -0.00997229479253292, -0.10082343220710754, -0.09305249154567719, 0.05765586718916893, 0.02529149129986763, -0.05077892169356346, -0.0203300341963768, -0.020174942910671234, 0.0068145026452839375, -0.026679787784814835, 0.006936008110642433, -0.042925622314214706, 0.04105818644165993, -0.0007544372347183526, -0.02353319525718689, 0.011116878129541874, -0.006259808782488108, 0.03841574862599373, 0.00961829349398613, 0.06933920830488205, -0.01622927188873291, -0.0947289988398552, -0.0377238392829895, -0.014664929360151291, 0.007434569764882326, -0.0032802685163915157, -0.08109956979751587, -0.05085047706961632, -0.013190183788537979, 0.04856919124722481, 0.07888974994421005, 0.054516296833753586, 0.022732501849532127, 0.025006592273712158, 0.020731834694743156, 0.03772437572479248, -0.023516375571489334, -0.021990545094013214, 0.03025980293750763, 0.01665850169956684, -0.04405136778950691, -0.010306300595402718, 0.0380023717880249, -0.04942947253584862, 0.025199400261044502, 0.012706522829830647, 0.044903505593538284, -0.060582488775253296, -0.02572411298751831, 0.06260965019464493, -0.03025716356933117, -0.043416451662778854, -0.07263465970754623, -0.0781605988740921, -0.01062521617859602, -0.022493621334433556, -0.062346335500478745, 0.10420411080121994, -0.07259225100278854, -0.03568289056420326, -0.03627147153019905, 0.000986655824817717, 0.0003371821658220142, 0.016596009954810143, -0.05180937051773071, 0.044017527252435684, -0.04721983149647713, 0.01914237067103386, 0.038462135940790176, 0.061910271644592285, -0.06296402215957642, 0.05912000313401222, -0.017613284289836884, 0.12353571504354477, 0.039928119629621506, -0.05442583188414574, 0.03373393043875694, 0.013988485559821129, -0.009072994813323021, 0.030280839651823044, 0.025692326948046684, -0.012116891331970692, 0.04201792925596237, -0.017526281997561455, 0.022299792617559433, 0.008285144343972206, -0.02136981673538685, -0.046447139233350754, 0.034230247139930725, -0.07194654643535614, -0.02002263069152832, 0.029557937756180763, -0.00926280952990055, 0.10818847268819809, -0.03155955299735069, 0.0677381157875061, 0.08859065920114517, -0.007200571708381176, -0.0715680867433548, 0.05820005387067795, -0.0013887172099202871, 0.012644779868423939, -0.11126265674829483, 0.11435501277446747, -0.0946369469165802, -0.08062230795621872, 0.03513012453913689, 0.08318843692541122, -0.0389927476644516, -0.00910857878625393, -0.039564598351716995, -0.009463830851018429, 0.008724602870643139, 0.024176526814699173, -0.03567728027701378, 0.002371119102463126, 0.05310343950986862, -0.041177526116371155, 0.03537954390048981, 0.03849325329065323, 0.030140038579702377, -0.016547003760933876, -0.006738483905792236, -0.07093869894742966, 0.06586817651987076, -0.013087653554975986, -0.012451304122805595, 0.047119371592998505, 0.006965936161577702, 0.035035375505685806, -0.011918382719159126, -0.01766345091164112, -0.009075694717466831, 0.036103103309869766, 0.03357585892081261, 0.022845610976219177, 0.07133619487285614, -0.12634079158306122, 0.011411299929022789, -0.04169705882668495, -0.01294050645083189, -0.018209999427199364, 0.06889820843935013, -0.01075765211135149, 0.02279113233089447, -0.061677079647779465, 0.07666586339473724, -0.11263347417116165, 0.04663040488958359, 0.04199365898966789, 0.016628477722406387, 0.06096308305859566, 0.0009568017558194697, -0.012016666121780872, 0.028167173266410828, 0.03417489305138588, 0.005490712821483612, -0.015522905625402927, 0.015064623206853867, -0.12606321275234222, -0.004570954479277134, 0.04148196429014206, -0.013290280476212502, -0.13223455846309662, 0.009865827858448029, -0.05218074470758438, 0.00646148482337594, -0.0320858471095562, 0.013497261330485344, -0.024257291108369827, 0.07573199272155762, -0.03751268610358238, 0.1205240935087204, -0.02297102101147175, -0.012348704040050507, -0.006103602237999439, -0.03826290741562843, -0.029601136222481728, -0.015510612167418003, 0.05803534761071205, 0.11137230694293976, -0.07350277900695801, -0.0817241370677948, -0.08147379755973816, -0.045908212661743164, 0.031974416226148605, -0.04182110354304314, -0.034233458340168, 0.006303256843239069, 0.005329841747879982, 0.047249045222997665, -0.0015143720665946603, 0.03277246654033661, -0.002502493327483535, 0.012182849459350109, 0.02683342806994915, -0.0700635239481926, -0.027942638844251633, 0.025119636207818985, 0.0013274999801069498, 0.02388608641922474, -0.02239961549639702, 0.021231884136795998, 0.01600588858127594, -0.059153757989406586, -0.0038047651760280132, 0.029846085235476494, 0.046002455055713654, 0.01749906875193119, -0.028948599472641945, -0.007766220718622208, 0.040351416915655136, -0.01840621791779995, 0.023530088365077972, -0.028024522587656975, 0.02668197639286518, 0.034429509192705154, -0.013224958442151546, -0.020752621814608574, -0.01838669739663601, 0.020421266555786133, -0.012547829188406467, -0.004117067903280258, 0.0010282660368829966, 0.008749040775001049, 0.0054728789255023, 0.01965431496500969, 0.05856907740235329, -0.006516343913972378, -0.05518117919564247, -0.02756001614034176, -0.05691250413656235, 0.045421283692121506, -0.03652617335319519, 0.040092453360557556, -0.0042443727143108845, 0.030172664672136307, 0.004954823292791843, 0.007099064998328686, 0.010220921598374844, -0.026698576286435127, 0.00675133615732193, 0.00023406613036058843, 0.011507558636367321, 0.03124982863664627, -0.0015218750340864062, -0.0013131072046235204, -0.004454352427273989, -0.024525033310055733, -0.03307422623038292, 0.04280637204647064, 0.021070975810289383, -0.052096687257289886, -0.02931387908756733, -0.017564479261636734, -0.027557894587516785, -0.0111486641690135, -0.013304886408150196, 0.025229625403881073, 0.007109639700502157, -0.08874554187059402, 0.009749104268848896, 0.011184546165168285, -0.01523760985583067, 0.007822908461093903, -0.018811050802469254, -0.017721878364682198, 0.003681965172290802, -0.03585703670978546, 0.002718257252126932, -0.06436716765165329, 0.019773701205849648, 0.004401562735438347, -0.005266394931823015, 0.01456377562135458, -0.025065673515200615, 0.0258099976927042, -0.01704922318458557, 0.003302239114418626, 0.030917372554540634, -0.03585418686270714, 0.027574852108955383, -0.017028309404850006, 0.020492233335971832, -0.012560222297906876, 0.055733371526002884, -0.011835848912596703, 0.004525897558778524, -0.017122916877269745, -0.014891155064105988, 0.0007672469364479184, -0.06683117896318436, -0.02130000852048397, 0.013560733757913113, -0.031263433396816254, 0.025239668786525726, 0.010161790996789932, -0.0009352824999950826, 0.004205567762255669, 0.011401020921766758, 0.015091425739228725, -0.015442033298313618, 0.0009061045129783452, -0.014593728817999363, 0.013565834611654282, 0.02501237392425537, -0.008826193399727345, 0.001450054463930428, 0.020477522164583206, 0.011462260968983173, 0.008349644020199776, 0.003614294109866023, -0.040670767426490784, 0.05294259637594223, -0.0158527884632349, 0.016499590128660202, 0.029117394238710403, 0.057576846331357956, 0.030688805505633354, -0.03832633048295975, -0.04128759726881981, 0.025565482676029205, -0.011896593496203423, 0.026473412290215492, 0.017858967185020447, -0.014239918440580368, 0.00997807364910841, -0.0302631426602602, -0.05721750855445862, 0.012347250245511532, 0.013037052005529404, 0.04897923767566681, 0.0035926923155784607, 0.0003399098350200802, -0.01807505078613758, -0.021432843059301376, -0.014549735002219677, 0.021323014050722122, 0.040027864277362823, 0.036238864064216614, -0.056188177317380905, -0.006208208855241537, -0.013538219034671783, 0.009108765050768852, 0.012912061996757984, -0.0009263654355891049, 0.012823871336877346, -0.014159598387777805, 0.04787486791610718, 0.002219096291810274, 0.03138948604464531, 0.013054240494966507, -0.0060375588946044445, -0.007503463886678219, 0.01496240682899952, 0.009274935349822044, 0.019869817420840263, 0.034974467009305954, 0.006289965007454157, 0.009220481850206852, 0.009433303959667683, -0.024601193144917488, -0.003009191947057843, -0.020999185740947723, 0.02990921214222908, 0.002058787737041712, -0.05170224606990814, -0.002733328379690647, -0.01039509940892458, 0.02226189896464348, 0.01643899641931057, 0.0050235288217663765, -0.026101715862751007, -0.004542464390397072, 0.00527575146406889, 0.049929194152355194, -0.018496980890631676, -0.0416482575237751, -0.008750323206186295, 0.01057897973805666, -0.027447175234556198, -0.008894688449800014, -0.006221349351108074, 0.02945973351597786, 0.07690595090389252, 0.050658803433179855, 0.04884134232997894, 0.0012692477321252227, -0.021830009296536446, -0.005127749405801296, -0.02765813283622265, -0.012161558493971825, -0.028595207259058952, 0.0073287286795675755, 0.006627969443798065, -0.02756509743630886, -0.013574673794209957, 0.005079650320112705, 0.01741328276693821, -0.02136373147368431, -0.04874512180685997, -0.020903222262859344, 0.035078924149274826, -0.011201906017959118, 0.015252506360411644, -0.004956922028213739, 0.0015616469318047166, -0.009931404143571854, -0.06815668195486069, 0.006491008214652538, 0.05129356309771538, -0.041457582265138626, -0.04933188483119011, 0.021493325009942055, 0.05237879231572151, 0.0009383499273099005, -0.02666497603058815, 0.05103832855820656, 0.03537439927458763, 0.05302823707461357, -0.034867435693740845, -0.0006111864931881428, -0.031494807451963425, 0.04590550810098648, 0.013485309667885303, -0.018224934116005898, 0.019210735335946083, -0.05075941979885101, 0.010262545198202133, -0.009445248171687126, 0.006265357136726379, -0.027429670095443726, 0.014671497978270054, -0.03206182271242142, 0.03276267275214195, 0.014607020653784275, 0.0216123778373003, 0.005915062502026558, -0.03904920443892479, 0.04648686945438385, -0.032588891685009, -0.011799263767898083, 0.031224450096488, 0.036787137389183044, 0.036166295409202576, -0.0030508346389979124, 0.06097980961203575, 0.028490452095866203, 0.015590658411383629, 0.013462327420711517, -0.014935598708689213, -0.028087368234992027, 0.017209792509675026, -0.06155303120613098, 0.0034263329580426216, -0.010568871162831783, -0.00119251967407763, 0.052914392203092575, 0.00012049084034515545, -0.028499556705355644, 0.04505252093076706, 0.052897147834300995, -0.008114543743431568, 0.0013092326698824763, 0.03032769076526165, 0.037718646228313446, -0.01594209298491478, -0.07554491609334946, 0.0010260898852720857, -0.00480031780898571, -0.02867778390645981, -0.02218516729772091, -0.014232519082725048, -0.01826024241745472, 0.018182625994086266, -0.03835989907383919, -0.023469870910048485, 0.03473510593175888, 0.0694856122136116, 0.02342347800731659, -0.0388852059841156, 0.013897753320634365, -0.020428024232387543, -0.012428456917405128, 0.00894196517765522, -0.008120430633425713, 0.047222115099430084, 0.02694987691938877, -0.004396235104650259, -0.000884735316503793, 0.020185096189379692, -0.024997008964419365, -0.011434000916779041, 0.07733386754989624, 0.030990926548838615, -0.009556656703352928, -0.03295066952705383, 0.01889616996049881, 0.016575878486037254, -0.0009009881177917123, -0.038319963961839676, -0.014232520945370197, -0.027204860001802444, 0.016635406762361526, -0.018844837322831154, 0.045431312173604965, 0.009153662249445915, -0.05691957846283913, 0.022602036595344543, -0.014169644564390182, -0.0004727443738374859, 0.056113071739673615, 0.027557101100683212, -0.012894123792648315, 0.017019379884004593, -0.01628749445080757, 0.017573747783899307, -0.018569041043519974, 0.048970647156238556, -0.01943729817867279, 0.011049398221075535, -0.06964973360300064, 0.0217069610953331, 0.04933355376124382, -0.03859693929553032, 0.014010674320161343, 0.0362943671643734, -0.06279146671295166, 0.013177769258618355, 0.03032323718070984, 0.031403981149196625, -0.0059224446304142475, -0.040773022919893265, 0.0130233783274889, -0.02382313646376133, -0.0553804375231266, -0.010355189442634583, 0.06413297355175018, -0.045115791261196136, 0.022411076352000237, 0.03481272980570793, 0.01361142098903656, -0.003554603550583124, -0.004065375775098801, -0.014129149727523327, 0.03721066191792488, 0.04958672076463699, 0.05363208428025246, 0.006565464194864035, 0.020269758999347687, 0.017242075875401497, 0.008796673268079758, -0.0097698625177145, -0.013309665024280548, -0.029198693111538887, 0.0158553346991539, 0.049327366054058075, 0.004147802945226431, 0.009264041669666767, -0.030092908069491386, 0.01614351011812687, 0.027398372069001198, 0.040461767464876175, -0.023902351036667824, 0.05972032994031906, 0.00047713302774354815, 0.023842178285121918, 0.03886699676513672, 0.040388621389865875, -0.04079185426235199, 0.02801528573036194, 0.0798148438334465, 0.06975274533033371, 0.05292297899723053, 0.02900889702141285, -0.0010927569819614291, 0.020841101184487343, -0.01834690012037754, -0.030793488025665283, 0.029395153746008873, -0.004184964578598738, -0.03227557986974716, -0.01028820313513279, -0.010334904305636883, -0.013628884218633175, 0.014224663376808167, -0.052701015025377274, -0.0366511307656765, -0.007829063571989536, -0.03302869573235512, -0.0423477366566658, 0.013675227761268616, 0.02601086162030697, -0.007120019290596247, -0.012243292294442654, -0.024977972730994225, -0.03202033042907715, 0.018513591960072517, -0.016829563304781914, -0.058169543743133545, 0.0011319154873490334, -0.04371697083115578, 0.0070831067860126495, 0.03974016755819321, -0.04889292269945145, 0.02043907530605793, -0.011476638726890087, -0.015105835162103176, -0.03648603335022926, -0.0011452926555648446, 0.02311684563755989, -0.01766730658710003, -0.025962630286812782, 0.00517855491489172, 0.01578376069664955, -0.019513772800564766, 0.05916185304522514, -0.004989721812307835, 0.010319414548575878, 0.012970558367669582, 0.04854213446378708, 0.00939246453344822, 0.011308115907013416, 0.017811421304941177, -0.06910336762666702, -0.003979285713285208, -0.015942344442009926, -0.04210513457655907, 0.041887883096933365, 0.03289303928613663, 0.021003855392336845, -0.010962269268929958, -0.04326360672712326, 0.000616464123595506, -0.023633677512407303, -0.010174195282161236, 0.027154315263032913, -0.010625830851495266, -0.006798444781452417, -0.030047975480556488, 0.016824981197714806, -0.000676412892062217, -0.009911064989864826, 0.021122638136148453, 0.01612177863717079, 0.0015481312293559313, -0.02411588840186596, 0.01310707163065672, -0.027258163318037987, -0.03094783052802086, -0.03560207039117813, -0.015783078968524933, -0.006553270388394594, -0.012397012673318386, 0.0034730720799416304, -0.04332166910171509, 0.023679401725530624, -0.030849793925881386, 0.012200262397527695, -0.001070996280759573, 0.012434912845492363, 0.03598492220044136, 0.03309816122055054, 0.06849028915166855, 0.008651389740407467, 0.03067960776388645, 0.007272772025316954, 0.004485255107283592, 0.005258165765553713, 0.029238829389214516, 0.02528739906847477, -0.0015166678931564093, -0.01591365598142147, -0.010536213405430317, 0.015510955825448036, -0.0017839956562966108, -0.03721824660897255, 0.00470109935849905, -0.019156238064169884, 0.022633060812950134, -0.021657651290297508, -0.0018929749494418502, 0.04449133202433586, -0.010428986512124538, 0.049551822245121, 0.01420541387051344, -0.03740761801600456, 0.03932836279273033, 0.00871307123452425, -0.04535975307226181, -0.012356888502836227, -0.00911630317568779, -0.006209290586411953, 0.0593978688120842, -0.0031688862945884466, -0.010197206400334835, 0.006999521981924772, -0.03097366727888584, -0.006485605612397194, -0.014325817115604877, -0.01296770479530096, -0.08153092861175537, 0.005298843141645193, 0.009830073453485966, -0.010369823314249516, -0.008691845461726189, 0.028432348743081093, 0.01630956120789051, -0.011816385202109814, -0.03963351994752884, 0.022800812497735023, 0.03036568872630596, 0.042414624243974686, 0.01822115108370781, -0.018946558237075806, 0.06619205325841904, 0.01662430353462696, 0.038651030510663986, 0.006830684375017881, 0.07138687372207642 ]
My Journey to a serverless transformers pipeline on Google Cloud
Maxence
March 18, 2021
how-to-deploy-a-pipeline-to-google-clouds
guide
https://huggingface.co/blog/how-to-deploy-a-pipeline-to-google-clouds
Implementation of the serverless pipeline The final solution consists of four different components: - main.py handling the request to the pipeline - Dockerfile used to create the image that will be deployed on Cloud Run. - Model folder having the pytorch_model.bin, config.json and vocab.txt. - Model : DistilBERT base uncased finetuned SST-2 - To download the model folder, follow the instructions in the button. - You don't need to keep the rust_model.ot or the tf_model.h5 as we will use PyTorch. - requirement.txt for installing the dependencies The content on the main.py is really simple. The idea is to receive a GET request containing two fields. First the review that needs to be analysed, second the API key to "protect" the service. The second parameter is optional, I used it to avoid setting up the oAuth2 of Cloud Run. After these arguments are provided, we load the pipeline which is built based on the model distilbert-base-uncased-finetuned-sst-2-english (provided above). In the end, the best match is returned to the client. python import os from flask import Flask, jsonify, request from transformers import pipeline app = Flask(__name__) model_path = "./model" @app.route('/') def classify_review(): review = request.args.get('review') api_key = request.args.get('api_key') if review is None or api_key != "MyCustomerApiKey": return jsonify(code=403, message="bad request") classify = pipeline("sentiment-analysis", model=model_path, tokenizer=model_path) return classify("that was great")[0] if __name__ == '__main__': # This is used when running locally only. When deploying to Google Cloud # Run, a webserver process such as Gunicorn will serve the app. app.run(debug=False, host="0.0.0.0", port=int(os.environ.get("PORT", 8080))) Then the DockerFile which will be used to create a docker image of the service. We specify that our service runs with python:3.7, plus that we need to install our requirements. Then we use gunicorn to handle our process on the port 5000. dockerfile # Use Python37 FROM python:3.7 # Allow statements and log messages to immediately appear in the Knative logs ENV PYTHONUNBUFFERED True # Copy requirements.txt to the docker image and install packages COPY requirements.txt / RUN pip install -r requirements.txt # Set the WORKDIR to be the folder COPY . /app # Expose port 5000 EXPOSE 5000 ENV PORT 5000 WORKDIR /app # Use gunicorn as the entrypoint CMD exec gunicorn --bind :$PORT main:app --workers 1 --threads 1 --timeout 0 It is important to note the arguments --workers 1 --threads 1 which means that I want to execute my app on only one worker (= 1 process) with a single thread. This is because I don't want to have 2 instances up at once because it might increase the billing. One of the downsides is that it will take more time to process if the service receives two requests at once. After that, I put the limit to one thread due to the memory usage needed for loading the model into the pipeline. If I were using 4 threads, I might have 4 Gb / 4 = 1 Gb only to perform the full process, which is not enough and would lead to a memory error. Finally, the requirement.txt file python Flask==1.1.2 torch===1.7.1 transformers~=4.2.0 gunicorn>=20.0.0
[ 0.042560890316963196, 0.01678996905684471, -0.03094724752008915, 0.06916431337594986, -0.006559285335242748, 0.12351685762405396, 0.061115812510252, 0.04396212846040726, -0.017697280272841454, 0.010256575420498848, -0.09633389115333557, 0.032874707132577896, -0.00016072941070888191, 0.08745831251144409, 0.033476583659648895, -0.05015435069799423, 0.10430476069450378, -0.011842547915875912, -0.02414153702557087, 0.05578451603651047, -0.0006650298601016402, -0.03765647113323212, 0.008742050267755985, -0.001027870224788785, -0.012120368890464306, -0.05172525718808174, 0.04277738183736801, 0.122393399477005, -0.0997920110821724, 0.0614352710545063, -0.0162125863134861, -0.009738404303789139, -0.0528571791946888, -0.07081124186515808, -0.024500256404280663, 0.022398993372917175, -0.04579510539770126, 0.024179808795452118, 0.03514419496059418, -0.028920134529471397, 0.01035971101373434, -0.018456080928444862, -0.07239473611116409, 0.09182706475257874, -0.0023058413062244654, 0.004398506134748459, -0.10544314235448837, 0.05031899735331535, -0.04127601161599159, 0.0029581633862107992, -0.029405152425169945, 0.0695217177271843, -0.019452668726444244, -0.03299616649746895, -0.008314017206430435, 0.05498282238841057, 0.0009399863192811608, -0.03404999524354935, -0.024983521550893784, 0.04760795459151268, 0.02491936832666397, -0.007440867368131876, 0.00564897945150733, 0.032936468720436096, 0.050747018307447433, -0.030322624370455742, -0.049632478505373, 0.05741667374968529, 0.028479352593421936, -0.04162454977631569, 0.040232330560684204, -0.007148788310587406, -0.027481619268655777, -0.05273362249135971, -0.03222625330090523, -0.059652939438819885, -0.017811348661780357, 0.031673990190029144, 0.048128996044397354, 0.10084987431764603, -0.023742178454995155, 0.03215643763542175, -0.031829219311475754, 0.03000079281628132, 0.0644134134054184, 0.00919687282294035, 0.05110010504722595, 0.003965259063988924, -0.06678906083106995, 0.04942867532372475, 0.015025531873106956, -0.04713079705834389, 0.015906203538179398, 0.04188444837927818, 0.03647306561470032, 0.04659673199057579, -0.04806482046842575, 0.010394012555480003, -0.01890673115849495, -0.05166571959853172, 0.014656733721494675, -0.049503687769174576, -0.0434928759932518, 0.013895519077777863, -0.04837274178862572, 0.10129214823246002, -0.012263717129826546, -0.003811117261648178, -0.05457326024770737, -0.004901467356830835, 0.05048798769712448, 0.023836245760321617, -0.07392886281013489, 0.05647331476211548, -0.018589550629258156, 0.024254871532320976, -0.040049463510513306, -0.00245014950633049, 0.01279763039201498, -0.00888175517320633, 0.05163956806063652, 0.06061108410358429, 0.046728119254112244, -0.03763147443532944, -0.005760013125836849, 0.030655408278107643, -0.032471802085638046, 0.04258812218904495, -0.004890638403594494, -0.06353724747896194, 0.04060189425945282, 0.009461453184485435, 0.09090152382850647, 0.0035603358410298824, -0.008164654485881329, -0.0069989706389606, -0.004083154257386923, -0.06335487961769104, -0.014227318577468395, 0.03089403361082077, 0.026752939447760582, 0.09510153532028198, -0.07958100736141205, 0.03737355023622513, 0.05521700903773308, 0.012622714973986149, 0.004808429162949324, -0.002645930740982294, 0.013073131442070007, 0.026340870186686516, -0.01457777339965105, 0.07540029287338257, -0.017727095633745193, -0.021447481587529182, -0.08426400274038315, 0.05794035270810127, -0.03549082577228546, 0.0011888131266459823, 0.020592330023646355, -0.014137228950858116, 0.0035679740831255913, 0.04822864755988121, -0.07596177607774734, -0.04090530425310135, 0.038557931780815125, 0.04848767817020416, 0.07078047841787338, -0.04739825055003166, 0.0270683653652668, -0.03599203750491142, -0.0212604608386755, -0.0397767499089241, 0.08046741783618927, 0.010166541673243046, 0.09745238721370697, 0.010986573994159698, 0.031199738383293152, 0.016494804993271828, 0.018785730004310608, -0.07712755352258682, -0.02793963998556137, 0.12320742756128311, 0.059414323419332504, 0.029847795143723488, -0.008883942849934101, -0.026317255571484566, 0.07197612524032593, -0.05747520551085472, -0.03792819008231163, 0.04593504220247269, -0.0178864523768425, -0.028531547635793686, 0.025473836809396744, -0.03734239190816879, 0.04123448580503464, -0.006495639681816101, -0.00752301374450326, 0.03696124255657196, -0.03413322567939758, 0.038928285241127014, 0.04050255939364433, -0.011236369609832764, -0.028813328593969345, -0.05668838322162628, 0.025622040033340454, 0.03651431202888489, -0.007475817576050758, -0.048481423407793045, -0.013747032731771469, 0.030947986990213394, -0.033398792147636414, -0.07908102869987488, -0.03630942478775978, -0.044644881039857864, -0.02214076556265354, -0.03625217825174332, -0.06862773001194, -0.015932247042655945, 0.03536999598145485, 0.03952741250395775, 0.1262497752904892, -0.07579252868890762, 0.02990688942372799, -0.00724258366972208, -0.021837938576936722, 0.025287747383117676, 0.0022518406622111797, 0.02365853264927864, 0.07788524776697159, -0.029540250077843666, -0.02107914350926876, -0.05274878442287445, -0.045131098479032516, 0.0524476133286953, -0.0424385666847229, 0.019895046949386597, 0.0424027256667614, 0.01897270604968071, -0.02134479582309723, -0.01947029121220112, 0.025687992572784424, -0.01762259379029274, -0.08032358437776566, 0.048800185322761536, -0.018015626817941666, -0.06253143399953842, 0.07561809569597244, -0.023167772218585014, 0.0008879104279913008, -0.07867749780416489, -0.015707015991210938, -0.0026016475167125463, -0.09728696197271347, -0.05951642245054245, 0.08257067948579788, -0.008778061717748642, 0.016233069822192192, 0.041245102882385254, -0.02304435521364212, 0.06673658639192581, 0.02131795510649681, 0.01889771968126297, 0.012172040529549122, -0.03476288914680481, -0.000783410738222301, 0.005558259319514036, 0.0065908473916351795, -0.028289644047617912, 0.05804186314344406, 0.026549892500042915, 0.009714220650494099, -0.014995824545621872, -0.0061644092202186584, 0.013516344130039215, 0.01624424383044243, 0.03080265037715435, -0.048939529806375504, 0.004586816765367985, 0.014477694407105446, -0.01708332449197769, 0.01100425235927105, -0.0037020030431449413, 0.037828776985406876, 0.051155950874090195, -0.020948344841599464, 0.008175229653716087, -0.011628011241555214, -0.05899835750460625, 0.0008082524291239679, 0.008214948698878288, -0.010539098642766476, 0.0468684546649456, 0.03211704641580582, -0.02022426761686802, -0.01664150506258011, 0.025233453139662743, -0.04951279237866402, -0.006442156620323658, -0.009066964499652386, 0.04866739362478256, -0.03197351098060608, -0.017747892066836357, -0.0327671617269516, -0.0267961286008358, -0.030167022719979286, -0.002587035298347473, 0.017315546050667763, -0.02194010466337204, -0.07551439851522446, -0.004184655379503965, -0.01217192504554987, 0.01789175719022751, 0.0062545305117964745, -0.007665102835744619, 0.03685764595866203, 0.04057842493057251, 0.004592567682266235, -0.0022491684649139643, -0.01369017269462347, 0.02873515710234642, -0.03509792312979698, -0.008053440600633621, 0.044249702244997025, -0.04538959637284279, 0.008113935589790344, 0.018593499436974525, 0.014443174004554749, 0.015706241130828857, -0.03707578405737877, 0.00409681024029851, 0.013021178543567657, -0.02298189513385296, 0.05172622203826904, 0.0017786587122827768, 0.035360194742679596, 0.046764109283685684, -0.024829648435115814, -0.012076811864972115, -0.04799725115299225, -0.029485667124390602, 0.010144759900867939, 0.0013101670192554593, -0.06352347880601883, -0.027870921418070793, -0.01005730964243412, -0.008019451051950455, -0.010523536242544651, 0.013455260545015335, -0.023900898173451424, 0.011667242273688316, -0.012354403734207153, -0.023676740005612373, 0.08526919037103653, -0.04341932386159897, -0.006633118260651827, -0.03483034297823906, 0.0031491415575146675, -0.03840135037899017, -0.04227646067738533, 0.009093567728996277, -0.026557158678770065, 0.07500743120908737, 0.011881636455655098, -0.025520293042063713, -0.01644193008542061, 0.008181476034224033, 0.035445597022771835, 0.037568215280771255, -0.039135970175266266, 0.0284529160708189, 0.03733732923865318, -0.02057816833257675, 0.0345488116145134, 0.023426132276654243, 0.033707987517118454, 0.0074312821961939335, -0.048506442457437515, -0.012215846218168736, -0.012127000838518143, 0.048887401819229126, 0.004242032300680876, -0.0013796045677736402, -0.02675415575504303, 0.0015352421905845404, -0.03606458008289337, -0.03339601680636406, 0.0303147304803133, 0.054948095232248306, -0.02760699763894081, -0.03059088997542858, -0.022636696696281433, 0.02502799965441227, 0.03996744006872177, 0.029574383050203323, 0.013998501002788544, -0.03387229144573212, 0.014985239133238792, 0.015384097583591938, 0.015329821035265923, -0.016702594235539436, 0.03379745036363602, -0.025080936029553413, -0.06068257614970207, -0.03228078410029411, 0.05049995332956314, -0.005478676408529282, -0.018029503524303436, -0.011201301589608192, -0.011157776229083538, 0.0051177446730434895, 0.005630522035062313, 0.036274246871471405, 0.017195912078022957, -0.02171996608376503, -0.046077970415353775, -0.012841678224503994, -0.019886652007699013, -0.02405146136879921, 0.019321851432323456, 0.031923286616802216, 0.025472862645983696, 0.019901499152183533, 0.012768088839948177, 0.037041448056697845, 0.040650319308042526, -0.012978206388652325, 0.034185394644737244, 0.013776738196611404, -0.03759332746267319, 0.006233386229723692, -0.01155373826622963, -0.015541971661150455, -0.01581716351211071, -0.009190937504172325, 0.03150925040245056, 0.0121010085567832, -0.03033412992954254, -0.0372195802628994, -0.012923347763717175, -0.027957722544670105, -0.014758097007870674, -0.018224870786070824, 0.011355111375451088, -0.018477313220500946, 0.022826915606856346, 0.017191559076309204, -0.0029236499685794115, 0.006381976418197155, -0.019429491832852364, -0.0043302192352712154, 0.023922638967633247, -0.05497021973133087, 0.04392014071345329, 0.034204013645648956, -0.03647847846150398, 0.060073819011449814, -0.018726861104369164, 0.03510572761297226, 0.02005777880549431, -0.029126424342393875, 0.0005696705193258822, -0.03741125017404556, 0.02266334928572178, 0.015389986336231232, -0.0069518848322331905, 0.007581433746963739, -0.027143824845552444, 0.050418585538864136, 0.00017258539446629584, -0.00020408796262927353, 0.006471462082117796, -0.006160879507660866, -0.005020809825509787, 0.04419604316353798, -0.0004060598148498684, -0.06935863941907883, -0.030850717797875404, -0.04209955409169197, -0.04908847436308861, 0.003513212548568845, 0.016930410638451576, -0.021903108805418015, 0.03343695029616356, 0.0481392964720726, 0.01733751967549324, 0.05641717091202736, -0.05630899965763092, 0.01678251475095749, -0.017376301810145378, 0.01957849971950054, 0.02005261369049549, -0.01358864363282919, 0.009767451323568821, 0.012330734170973301, 0.0512356236577034, 0.011661454103887081, -0.020955141633749008, 0.07335595041513443, -0.0035066150594502687, 0.011107858270406723, -0.004520121496170759, -0.0037757353857159615, 0.009798969142138958, -0.019434170797467232, -0.02535967528820038, 0.04211464151740074, 0.006916116923093796, 0.00150209607090801, 0.018248192965984344, 0.056735146790742874, -0.029771553352475166, 0.0037725011352449656, 0.06857304275035858, 0.014812746085226536, 0.02666984312236309, 0.018803471699357033, 0.0066410815343260765, -0.04176755249500275, 0.021133719012141228, -0.019990848377346992, 0.003812482813373208, 0.006016969680786133, 0.001803663675673306, -0.02608746476471424, -0.026920905336737633, 0.02677304483950138, -0.00806452613323927, 0.001651559490710497, -0.032350242137908936, -0.006822670344263315, -0.02755589969456196, 0.030013645067811012, -0.008843974210321903, -0.005486649461090565, -0.01866857148706913, 0.04184930771589279, -0.0000333681600750424, 0.013241018168628216, 0.004694133996963501, -0.011776654981076717, 0.013246875256299973, 0.009232508949935436, 0.01542267668992281, -0.06017553433775902, -0.004108295310288668, -0.0011827496346086264, 0.00010896566527662799, -0.05537876486778259, -0.027324775233864784, -0.03486365079879761, 0.0069206045009195805, -0.015562436543405056, -0.04876691475510597, 0.05054717883467674, 0.04870209842920303, -0.00272212247364223, 0.042861320078372955, -0.025007573887705803, 0.029077494516968727, 0.045152824372053146, -0.01778859831392765, -0.05241832509636879, 0.005584371276199818, -0.009920580312609673, 0.04282496124505997, 0.028353609144687653, -0.00806101318448782, 0.014382312074303627, 0.00978158786892891, -0.05243808776140213, -0.05347171425819397, -0.0016896756133064628, 0.006508026737719774, -0.02361098863184452, -0.021274270489811897, -0.08519090712070465, -0.04541808366775513, -0.008429181762039661, 0.05958385020494461, 0.018728937953710556, -0.010342353023588657, -0.0065297759138047695, 0.04279537498950958, -0.004987636581063271, 0.002600068226456642, 0.04631570726633072, -0.02295362763106823, 0.059127308428287506, -0.0013751350343227386, 0.04617547616362572, -0.009737802669405937, 0.010233423672616482, 0.01858501508831978, -0.010765032842755318, 0.07112164050340652, 0.02238854393362999, 0.01801392436027527, 0.048737913370132446, 0.025710241869091988, 0.004887924063950777, -0.011240161955356598, -0.02694321610033512, -0.024256009608507156, -0.047441087663173676, -0.028523843735456467, 0.03276754170656204, -0.004036900587379932, -0.00048218583106063306, 0.008607293479144573, 0.031705617904663086, 0.005824473686516285, 0.026942268013954163, -0.002677283715456724, 0.0598093718290329, 0.012938559986650944, 0.029888516291975975, 0.024866927415132523, -0.023902490735054016, -0.054697949439287186, 0.03668289631605148, -0.01698186807334423, 0.016728555783629417, -0.02679963782429695, 0.0051095010712742805, 0.003816937794908881, -0.012810753658413887, -0.010398423299193382, -0.0034153785090893507, 0.0007456482271663845, -0.06336377561092377, -0.008491521701216698, 0.03495315834879875, -0.03671712055802345, -0.0004755743721034378, 0.0020928282756358385, -0.05100630596280098, -0.02593955025076866, -0.011644368059933186, -0.04491735249757767, -0.006492243148386478, 0.00020480908278841525, -0.04963287338614464, -0.021475614979863167, 0.018175551667809486, 0.023172898218035698, 0.04980917274951935, -0.05420752987265587, -0.030176058411598206, -0.021443000063300133, 0.0014985079178586602, -0.02756960317492485, 0.017096957191824913, -0.024452947080135345, 0.007085876073688269, -0.014781263656914234, -0.00180553097743541, -0.033808812499046326, 0.02339678443968296, 0.028989139944314957, 0.0029873447492718697, 0.0012842799769714475, -0.018453044816851616, -0.01784992404282093, -0.040212567895650864, 0.0012177469907328486, -0.009494330734014511, -0.02500128746032715, -0.036253537982702255, 0.06489859521389008, -0.035361673682928085, -0.013689125888049603, -0.022342342883348465, -0.018979184329509735, 0.02021501585841179, 0.03783281892538071, -0.06923808157444, 0.0287006888538599, -0.03592380881309509, -0.015010944567620754, 0.015530765987932682, 0.00035448692506179214, 0.024856727570295334, 0.02013612911105156, 0.005719715729355812, 0.02387983724474907, -0.0021290876902639866, -0.011074390262365341, -0.005033120978623629, 0.015358706004917622, 0.0651940181851387, 0.05245830491185188, 0.0075764223001897335, -0.006731615401804447, -0.02020464837551117, -0.010245030745863914, -0.016628950834274292, -0.035867396742105484, -0.03688384220004082, -0.038717057555913925, -0.03451940044760704, -0.02333657816052437, 0.02905014529824257, -0.03545444831252098, -0.00890316441655159, -0.07701154798269272, -0.00008358350169146433, -0.00542028434574604, -0.03239407762885094, -0.004454611334949732, -0.017602022737264633, 0.03915901482105255, 0.074272021651268, -0.013787547126412392, -0.008112246170639992, -0.06902202218770981, 0.04792315512895584, -0.015128904022276402, 0.02370704710483551, 0.030215907841920853, 0.019838234409689903, -0.01692267879843712, -0.015837160870432854, 0.053941305726766586, 0.028357643634080887, -0.01828436180949211, -0.023020382970571518, 0.045931801199913025, -0.02157224714756012, -0.045412492007017136, 0.02329416014254093, 0.019474251195788383, -0.0068532307632267475, -0.007716028019785881, -0.005759045947343111, -0.02434849925339222, 0.021733416244387627, 0.010909163393080235, -0.05435430258512497, 0.015123526565730572, -0.001667109550908208, -0.03578636422753334, -0.007277326658368111, -0.01777801103889942, 0.008208845742046833, -0.029825592413544655, 0.012343224138021469, 0.027332881465554237, -0.024263715371489525, -0.04334526136517525, -0.031156200915575027, -0.030086034908890724, 0.03075147233903408, -0.01130509003996849, 0.01906135492026806, 0.02506588213145733, 0.0014862632378935814, -0.05602165311574936, 0.017418844625353813, -0.00470378901809454, 0.019575422629714012, 0.016903916373848915, 0.016492189839482307, -0.014283644035458565, 0.05316596478223801, 0.04081093147397041, -0.01814582571387291, -0.058574702590703964, 0.03577747941017151 ]
My Journey to a serverless transformers pipeline on Google Cloud
Maxence
March 18, 2021
how-to-deploy-a-pipeline-to-google-clouds
guide
https://huggingface.co/blog/how-to-deploy-a-pipeline-to-google-clouds
The Transformers library I was a bit confused at the beginning when I downloaded the .h5 file. I thought it would be compatible with tensorflow.keras.models.load_model, but this wasn't the case. After a few minutes of research I was able to figure out that the file was a weights checkpoint rather than a Keras model. After that, I tried out the API that Hugging Face offers and read a bit more about the pipeline feature they offer. Since the results of the API & the pipeline were great, I decided that I could serve the model through the pipeline on my own server. Below is the official example from the Transformers GitHub page. python from transformers import pipeline # Allocate a pipeline for sentiment-analysis classifier = pipeline('sentiment-analysis') classifier('We are very happy to include pipeline into the transformers repository.') [{'label': 'POSITIVE', 'score': 0.9978193640708923}]
[ 0.0029121628031134605, -0.05263287574052811, -0.00435372581705451, -0.023490356281399727, 0.02488454431295395, 0.09351500123739243, 0.03093031235039234, 0.06376998126506805, 0.048678863793611526, 0.008954324759542942, -0.05954248830676079, 0.06977147608995438, -0.04946008697152138, 0.11512821912765503, 0.027901092544198036, -0.050994373857975006, 0.04964422062039375, 0.003477555699646473, 0.01866300404071808, 0.03637584298849106, -0.007338413968682289, -0.055125948041677475, 0.037937622517347336, -0.008426154963672161, 0.0019601676613092422, -0.0787007212638855, 0.04403281956911087, 0.06309077888727188, -0.038431182503700256, 0.042695119976997375, -0.10288823395967484, 0.025942634791135788, 0.02120351791381836, -0.06496897339820862, 0.0050317407585680485, 0.07907605171203613, -0.11939030885696411, 0.03299305960536003, 0.04806658253073692, -0.05559801310300827, 0.025970803573727608, -0.00009626551036490127, -0.07277785986661911, 0.015792377293109894, -0.011595296673476696, -0.054678793996572495, -0.1593439280986786, 0.06334711611270905, -0.041283346712589264, 0.0017475505592301488, -0.058790095150470734, 0.07674659043550491, 0.008924185298383236, -0.0012303891126066446, 0.012666981667280197, 0.007691179867833853, 0.010445335879921913, -0.03920181840658188, 0.04006742313504219, 0.04186304286122322, 0.04277096688747406, 0.013531479984521866, -0.018306544050574303, 0.037721287459135056, 0.025172118097543716, 0.020528385415673256, -0.012812767177820206, 0.024854294955730438, -0.02587149292230606, -0.03625890985131264, 0.02816758304834366, -0.0424058735370636, 0.005801945924758911, -0.04725447669625282, -0.017473462969064713, 0.01600579544901848, 0.007999293506145477, 0.01022034790366888, 0.05406339839100838, 0.05108578875660896, 0.014502348378300667, 0.004771141801029444, 0.026921648532152176, 0.08113086968660355, 0.061523497104644775, 0.042926009744405746, 0.1000385656952858, -0.07763795554637909, -0.06138620153069496, 0.07109357416629791, 0.011677525006234646, -0.08389808982610703, -0.019524168223142624, -0.03437390550971031, 0.10451788455247879, -0.04412421956658363, -0.01696816459298134, 0.042967136949300766, -0.026557642966508865, -0.029780173674225807, -0.029934102669358253, -0.05682359263300896, 0.01801459677517414, -0.02622881345450878, 0.0008603900787420571, 0.0031818856950849295, 0.01569869928061962, -0.05651852861046791, -0.004627121612429619, -0.040896326303482056, 0.008946314454078674, -0.04834093153476715, 0.004946903791278601, 0.07482966035604477, -0.04434196278452873, 0.06951488554477692, 0.03504396229982376, -0.05605979263782501, 0.0016910379054024816, 0.04652775079011917, -0.00690254382789135, 0.12248707562685013, 0.017490485683083534, 0.0012359983520582318, 0.02724076807498932, 0.07858800888061523, -0.0024774884805083275, -0.005712523125112057, 0.020872587338089943, -0.018867917358875275, 0.033801041543483734, -0.02366415224969387, 0.04887087270617485, -0.01882830262184143, -0.05228891223669052, -0.08279117196798325, 0.015620367601513863, -0.0682460144162178, -0.01568482257425785, -0.018488239496946335, -0.015972796827554703, 0.08269361406564713, -0.02880655974149704, 0.0073188780806958675, 0.03481728583574295, -0.022879481315612793, -0.06626550853252411, 0.09986241906881332, 0.048045724630355835, 0.016291171312332153, -0.07919847965240479, 0.07237022370100021, -0.017142482101917267, -0.045207034796476364, -0.011305807158350945, 0.05782761052250862, -0.002320223953574896, -0.034872282296419144, -0.046722885221242905, -0.028018789365887642, -0.028474651277065277, 0.011071041226387024, -0.04593437537550926, -0.00847425777465105, 0.04505336284637451, -0.023495322093367577, -0.020589325577020645, -0.012540792115032673, 0.03442985564470291, 0.0199537742882967, 0.02432597428560257, -0.06947468966245651, 0.0544610470533371, -0.02911774441599846, 0.029576508328318596, 0.01963723823428154, 0.024503426626324654, 0.076236791908741, 0.03341805934906006, -0.05251069739460945, -0.06623479723930359, 0.062484681606292725, 0.014958388172090054, 0.04468630999326706, 0.033886849880218506, -0.06530316919088364, 0.017774289473891258, -0.035611145198345184, 0.013792354613542557, 0.02445147931575775, -0.06351710855960846, -0.05647427961230278, 0.03049282357096672, -0.0025442151818424463, 0.06352947652339935, -0.03984593227505684, -0.03910142928361893, 0.09852688014507294, -0.018708698451519012, 0.02869662269949913, 0.07111842185258865, -0.0032692342065274715, 0.0372883640229702, -0.05728214606642723, 0.0070976088754832745, -0.022597050294280052, -0.02917957305908203, -0.041220664978027344, 0.010700360871851444, 0.01398810837417841, -0.019795529544353485, -0.09917061030864716, 0.038088250905275345, -0.06221012771129608, -0.026462478563189507, -0.0415639728307724, -0.02926180511713028, 0.01532401330769062, -0.022435883060097694, 0.023987965658307076, 0.17361587285995483, -0.007982162758708, -0.0059225894510746, -0.04034046456217766, -0.010379252955317497, 0.04474629834294319, 0.06958340108394623, 0.025093965232372284, 0.04860860854387283, -0.06523317843675613, -0.028783157467842102, -0.03157496079802513, -0.054265931248664856, 0.044184405356645584, -0.06511230021715164, -0.008587163873016834, 0.037972453981637955, 0.015392037108540535, 0.01458305399864912, 0.009287633001804352, 0.0065689305774867535, 0.005289136897772551, -0.04330424591898918, 0.04859142377972603, -0.019459174945950508, 0.00907076708972454, 0.0835084319114685, 0.0114333750680089, -0.054694823920726776, -0.0036816999781876802, -0.11305404454469681, 0.021870646625757217, 0.005414407700300217, -0.06785910576581955, 0.04458010569214821, 0.050443604588508606, 0.026992294937372208, -0.009893889538943768, -0.010384097695350647, 0.028764912858605385, -0.004894488491117954, 0.011749029159545898, -0.04103823006153107, -0.03219512850046158, -0.031091656535863876, -0.012769108638167381, -0.01677071489393711, -0.0005754884332418442, 0.009642534889280796, 0.026060499250888824, 0.034103840589523315, -0.05587053671479225, 0.015261596068739891, 0.0046664937399327755, -0.012841218151152134, 0.029825156554579735, 0.028556082397699356, 0.01523720845580101, -0.015268005430698395, -0.04543454572558403, -0.008646993897855282, -0.029301706701517105, 0.03731146454811096, 0.0374901182949543, -0.0005101652350276709, -0.01891741342842579, 0.007019896060228348, -0.017938515171408653, 0.006167685613036156, 0.04963892325758934, 0.010326218791306019, 0.013185052201151848, -0.00007509393617510796, -0.04262370243668556, -0.024691438302397728, -0.012156256474554539, -0.00286211003549397, 0.013920755125582218, -0.006264308001846075, 0.054484959691762924, -0.01579870656132698, 0.012099075131118298, 0.02250421792268753, -0.0255091842263937, -0.03713181987404823, 0.018338380381464958, 0.025098757818341255, 0.02080627903342247, -0.1058555394411087, -0.020526105538010597, 0.029665598645806313, 0.02355571836233139, 0.01055493950843811, -0.04122012108564377, 0.03754669800400734, -0.01379887480288744, 0.00024690135614946485, 0.01560650859028101, 0.008534761145710945, -0.015161235816776752, 0.004887044429779053, 0.021428639069199562, 0.0016511324793100357, -0.03855806589126587, -0.00046731438487768173, -0.028309980407357216, 0.05901745706796646, 0.03784167021512985, -0.052545707672834396, 0.03691424801945686, 0.03234231844544411, -0.005307575222104788, -0.008413503877818584, 0.00815965048968792, 0.04596031457185745, 0.020799458026885986, -0.006865986157208681, -0.04050563648343086, -0.0035865085665136576, -0.04986979812383652, -0.01583145558834076, 0.01930205151438713, -0.016651403158903122, -0.0009392485371790826, -0.014527927152812481, -0.024777861312031746, 0.043368905782699585, 0.023057008162140846, -0.02351878397166729, -0.00539828184992075, 0.004207934252917767, -0.03565115109086037, 0.04019559174776077, -0.015156067907810211, -0.0035171504132449627, -0.014450710266828537, 0.0349954292178154, -0.030711781233549118, -0.011831195093691349, -0.03297772631049156, 0.009006237611174583, 0.05431283265352249, 0.0116163594648242, 0.0065996344201266766, 0.013011240400373936, 0.008648152463138103, 0.01187876146286726, 0.0024079501163214445, -0.07682965695858002, 0.0030066613107919693, 0.0028474372811615467, -0.033238060772418976, -0.024051792919635773, 0.042462319135665894, 0.0165387149900198, 0.049843188375234604, -0.007997114211320877, 0.023074839264154434, 0.0012138934107497334, 0.05579010769724846, 0.013661295175552368, 0.011910817585885525, -0.015191125683486462, 0.013371812179684639, 0.006782272830605507, -0.02500750683248043, 0.03788291662931442, 0.018749473616480827, -0.03453746810555458, -0.04656190797686577, -0.04751554876565933, -0.02667183242738247, -0.0019260525004938245, 0.007294161710888147, 0.030959200114011765, -0.01798100955784321, 0.035655632615089417, 0.04213029891252518, 0.016889898106455803, -0.03783654794096947, 0.005359972827136517, -0.03311722353100777, -0.03995320200920105, 0.00819581001996994, 0.017502905800938606, -0.013629980385303497, -0.01671900413930416, 0.010299528017640114, -0.0004986550775356591, -0.004869450349360704, -0.023752978071570396, 0.007817575708031654, 0.02165740728378296, -0.012111482210457325, -0.03770136833190918, -0.0444183349609375, 0.01381701324135065, -0.024367382749915123, 0.025629978626966476, -0.008869370445609093, -0.0028714509680867195, -0.0029297941364347935, 0.028528818860650063, 0.030065026134252548, -0.021583998575806618, -0.026256602257490158, -0.034891799092292786, 0.062176670879125595, -0.034166306257247925, 0.03151751309633255, -0.0033370961900800467, -0.03442725911736488, 0.008330280892550945, 0.030890144407749176, 0.05726521834731102, 0.04921886697411537, -0.04413395747542381, -0.02076624147593975, -0.006940092891454697, -0.026858506724238396, 0.032909560948610306, 0.025874923914670944, 0.01402494590729475, 0.017932960763573647, -0.034946490079164505, 0.030473345890641212, -0.03288387879729271, -0.013023912906646729, -0.027863776311278343, 0.0023796111345291138, 0.04253172501921654, -0.028919711709022522, 0.03329324722290039, -0.017924288287758827, -0.04652424901723862, 0.03134751319885254, -0.030941085889935493, -0.0029806538950651884, 0.05164932832121849, 0.023676060140132904, -0.016477735713124275, 0.006158291827887297, 0.04209939017891884, -0.004640390630811453, -0.008878862485289574, 0.01907551847398281, -0.010844951495528221, 0.05097084864974022, -0.007574227172881365, 0.013752727769315243, -0.04504034295678139, 0.028431111946702003, -0.008753740228712559, 0.00983080267906189, -0.012845727615058422, -0.10246919840574265, -0.0014388819690793753, 0.013810407370328903, -0.003268609754741192, -0.0036409536842256784, 0.03137413039803505, -0.04693828895688057, -0.031151270493865013, 0.0628211498260498, 0.03285227343440056, 0.015113799832761288, -0.024158930405974388, 0.00948185846209526, -0.015193749219179153, -0.009064650163054466, -0.007239642087370157, 0.022803762927651405, 0.017733680084347725, 0.02562195062637329, 0.009021975100040436, 0.07172891497612, -0.0027662136126309633, 0.004182386212050915, -0.019208773970603943, -0.035835739225149155, 0.023056458681821823, -0.015580537728965282, -0.01150334533303976, -0.055673230439424515, -0.003393570426851511, 0.01698850840330124, -0.01575068198144436, -0.0004246779717504978, 0.03598110377788544, 0.05227094143629074, -0.0006847891490906477, -0.0021631144918501377, 0.021423690021038055, -0.02170560322701931, -0.01914583146572113, -0.014871613122522831, 0.041084013879299164, -0.06436125934123993, 0.04173016920685768, -0.023883085697889328, -0.011115414090454578, 0.000522092857863754, -0.0005483131972141564, -0.03952851891517639, -0.008667475543916225, -0.012977475300431252, 0.03795221820473671, 0.04017425328493118, 0.0016850935062393546, -0.0033344102557748556, -0.02793382853269577, 0.006372736766934395, 0.03119008056819439, -0.053670499473810196, 0.00756921386346221, 0.03610092028975487, -0.0027214817237108946, 0.01723117008805275, 0.022372882813215256, -0.003001271979883313, 0.0067033651284873486, 0.02167387865483761, 0.014818052761256695, -0.0011651028180494905, -0.03120913915336132, 0.019988911226391792, 0.05257286876440048, -0.037886880338191986, -0.008312394842505455, 0.006923023145645857, -0.006283815950155258, 0.015076418407261372, -0.020923493430018425, 0.04188026115298271, 0.06596426665782928, -0.021562933921813965, 0.02076878398656845, -0.0075002131052315235, 0.0345732681453228, 0.025378460064530373, -0.010393754579126835, 0.009471761994063854, 0.025367677211761475, -0.0076653556898236275, 0.024624230340123177, -0.007655167952179909, -0.0016424705972895026, 0.016089728102087975, 0.0018249349668622017, -0.025696802884340286, -0.020991235971450806, 0.03132075443863869, -0.009191677905619144, 0.023894235491752625, -0.01103960257023573, -0.031151970848441124, 0.008900728076696396, 0.0010090996511280537, -0.014912980608642101, 0.04094695299863815, 0.0019561024382710457, -0.024009278044104576, -0.026041682809591293, -0.008625560440123081, 0.013453193008899689, 0.059611983597278595, -0.04195581376552582, 0.045660682022571564, 0.026092519983649254, 0.03362917900085449, 0.04947197809815407, 0.013842479325830936, 0.012172665446996689, -0.027371134608983994, 0.058985862880945206, 0.029476989060640335, 0.05235415697097778, 0.03199073299765587, -0.014973096549510956, -0.02761487103998661, -0.027457311749458313, -0.030712319537997246, -0.027410313487052917, -0.004590155556797981, -0.005148646421730518, 0.006603933870792389, -0.016871705651283264, -0.025308115407824516, 0.03224990889430046, 0.02155805006623268, 0.034396372735500336, 0.013127559795975685, 0.0317363366484642, 0.07243973761796951, 0.007607845589518547, 0.03249003365635872, 0.04171214625239372, -0.0053038266487419605, -0.005399021785706282, 0.052026551216840744, -0.0003388082841411233, 0.05898061767220497, -0.004835654515773058, -0.009903877042233944, 0.029474278911948204, -0.01204613409936428, -0.028855787590146065, -0.0016856605652719736, 0.00461038202047348, -0.03743300586938858, -0.002694465219974518, 0.02201845496892929, -0.021541113033890724, 0.003137750318273902, -0.0022175360936671495, 0.0023281185422092676, -0.03069918230175972, -0.010698377154767513, -0.02264065109193325, 0.019653895869851112, 0.009697441011667252, -0.009840454906225204, 0.011664199642837048, 0.0022278628312051296, 0.015939045697450638, 0.02351253107190132, -0.04586499556899071, -0.01597738265991211, -0.04061596468091011, -0.03262396901845932, -0.016427693888545036, 0.01332283765077591, -0.008301128633320332, -0.03176097944378853, 0.016674455255270004, 0.04349968582391739, 0.008651917800307274, 0.04286576434969902, 0.01785893924534321, -0.0013350914232432842, -0.041474346071481705, 0.005162299145013094, -0.00840681605041027, -0.021293455734848976, -0.009775200858712196, -0.041466228663921356, 0.026641635224223137, 0.002735259709879756, -0.01351515669375658, -0.00790919829159975, 0.02119535580277443, -0.03280363231897354, -0.04272307828068733, -0.01275262888520956, 0.016615938395261765, -0.021656760945916176, 0.05166419968008995, -0.017475474625825882, -0.03515608608722687, 0.008022296242415905, -0.0016751975053921342, 0.020820459350943565, 0.05029221251606941, 0.03766932338476181, 0.06907734274864197, 0.014970673248171806, -0.00761302700266242, 0.012539283372461796, 0.01959962770342827, 0.02061108499765396, 0.01782066561281681, 0.03836382180452347, 0.0028982197400182486, 0.010317877866327763, -0.033153433352708817, 0.026788314804434776, -0.021180573850870132, 0.0030812728218734264, -0.02380676195025444, -0.051139749586582184, -0.038753628730773926, 0.023409076035022736, -0.02288505807518959, 0.018402455374598503, -0.06316099315881729, 0.0066731818951666355, -0.06012710928916931, -0.032962992787361145, -0.0056506977416574955, -0.0027585201896727085, 0.015284772962331772, 0.07409322261810303, 0.013786742463707924, 0.021075326949357986, -0.04037469998002052, -0.01946788839995861, -0.043148159980773926, 0.03008338250219822, 0.04355722665786743, 0.004854605998843908, -0.009020442143082619, -0.05599743500351906, -0.01600826345384121, -0.007129595149308443, -0.0627974346280098, 0.00008466307917842641, 0.029971426352858543, -0.012517048977315426, -0.051358770579099655, -0.02008778601884842, 0.020199473947286606, -0.018318863585591316, 0.05642779916524887, -0.02478181943297386, -0.007518745958805084, -0.006019952241331339, -0.02040698379278183, -0.0761071965098381, 0.03407565504312515, -0.016350440680980682, -0.014284946024417877, 0.00017656461568549275, 0.00616118498146534, 0.007091464474797249, -0.0014043903211131692, 0.00261061848141253, 0.018955590203404427, 0.020576322451233864, -0.018327653408050537, -0.04827914759516716, -0.0015044420724734664, 0.07159638404846191, -0.04637034237384796, -0.05242229998111725, 0.039819128811359406, 0.014005759730935097, -0.021938631311058998, -0.003184063360095024, -0.015290450304746628, -0.015493161045014858, 0.004627531860023737, 0.021425697952508926, -0.008569274097681046, 0.04279734566807747, 0.018801648169755936, -0.047029417008161545, -0.020448407158255577, -0.00493248226121068 ]
My Journey to a serverless transformers pipeline on Google Cloud
Maxence
March 18, 2021
how-to-deploy-a-pipeline-to-google-clouds
guide
https://huggingface.co/blog/how-to-deploy-a-pipeline-to-google-clouds
Conclusion By using Transformers' sentiment analysis pipeline, I saved a non-negligible amount of time. Instead of training/fine-tuning a model, I could find one ready to be used in production and start the deployment in my system. I might fine-tune it in the future, but as shown on my test, the accuracy is already amazing! I would have liked a "pure TensorFlow" model, or at least a way to load it in TensorFlow without Transformers dependencies to use the AI platform. It would also be great to have a lite version.
[ 0.01837872713804245, -0.07402065396308899, 0.04691170156002045, 0.06730136275291443, 0.005303947255015373, 0.03713082894682884, 0.03844992071390152, 0.0524897500872612, 0.020884184166789055, -0.040280286222696304, -0.03337174654006958, 0.09304684400558472, -0.022420238703489304, 0.07664459943771362, 0.010565883480012417, -0.044808391481637955, 0.05569344758987427, -0.0014031887985765934, 0.047008316963911057, -0.0013224395224824548, -0.022641876712441444, -0.04704459384083748, 0.06347154080867767, -0.006734988186508417, -0.013011404313147068, -0.07293157279491425, 0.07444854825735092, 0.005909553728997707, -0.0807928591966629, -0.01399573776870966, -0.11255501210689545, 0.03238704428076744, -0.033552031964063644, -0.023046080023050308, -0.053351838141679764, 0.03135751932859421, -0.0867200568318367, 0.07973514497280121, -0.0008445570711046457, -0.04733353108167648, 0.00021606644440907985, 0.0030773375183343887, -0.02828068658709526, 0.0225523728877306, 0.0005727161769755185, -0.046487245708703995, -0.179506316781044, 0.08540009707212448, -0.044909264892339706, -0.04079107195138931, -0.048213448375463486, 0.09327394515275955, -0.015156930312514305, 0.01918684132397175, -0.013432707637548447, 0.02939889393746853, -0.0035036648623645306, -0.03941719979047775, 0.0024195369333028793, 0.013925180770456791, -0.0037302509881556034, 0.025653453543782234, 0.03810345381498337, 0.007441915106028318, 0.030333029106259346, -0.040364500135183334, -0.018113628029823303, 0.003436808940023184, -0.04318851977586746, -0.03628118336200714, 0.023207424208521843, -0.044685520231723785, -0.013271399773657322, -0.04206181690096855, -0.02429637685418129, -0.0017357644392177463, 0.01072243694216013, 0.021060137078166008, 0.03999839723110199, 0.06616615504026413, 0.0024741936940699816, 0.0036276516038924456, 0.04290730133652687, 0.0579909086227417, 0.07591323554515839, 0.0627971887588501, 0.1319819986820221, -0.0072148884646594524, -0.08176086097955704, 0.027811910957098007, 0.05277836322784424, -0.08070028573274612, -0.013415859080851078, -0.018633872270584106, 0.06381308287382126, -0.007059131283313036, 0.01168416254222393, 0.034643400460481644, -0.04681089147925377, -0.023542754352092743, -0.025026841089129448, -0.020738566294312477, -0.005238558631390333, -0.03705472871661186, -0.010176224634051323, 0.005644694436341524, 0.014466187916696072, -0.09695106744766235, 0.019260838627815247, 0.05166013538837433, -0.01931818760931492, -0.02312048338353634, 0.014727108180522919, 0.05252435430884361, -0.07993868738412857, 0.03885600343346596, 0.00963522121310234, -0.04835518077015877, 0.014140058308839798, 0.018808363005518913, 0.06078588217496872, 0.13014085590839386, 0.0009878515265882015, -0.010063731111586094, -0.003261463949456811, 0.06710384041070938, 0.016633611172437668, -0.013128300197422504, 0.00022176407219376415, 0.015093758702278137, -0.0015524931950494647, -0.0018821082776412368, 0.009356982074677944, 0.007609920110553503, -0.054310381412506104, -0.110899917781353, 0.014855128712952137, -0.0611097514629364, -0.0028396600391715765, -0.015438400208950043, -0.04380473122000694, 0.07326838374137878, -0.021742472425103188, 0.012039605528116226, 0.037684325128793716, -0.03992271050810814, -0.049291450530290604, 0.05018480122089386, 0.030079340562224388, 0.005064723547548056, -0.1150495707988739, 0.05029475688934326, -0.049754299223423004, -0.07582366466522217, 0.00984306912869215, 0.04665890336036682, -0.022686216980218887, -0.08377943933010101, -0.056215524673461914, -0.007946592755615711, -0.00518372468650341, 0.013455601409077644, -0.02958030439913273, -0.025381986051797867, 0.03645603358745575, -0.05957232415676117, 0.033908821642398834, -0.0033708366099745035, 0.038342107087373734, 0.031381890177726746, 0.07410896569490433, -0.00043193864985369146, 0.0808141753077507, -0.03312401473522186, -0.0013701894786208868, 0.03969944268465042, 0.009531436488032341, 0.07768905907869339, -0.003038819180801511, -0.042668238282203674, -0.0069173299707472324, 0.08819262683391571, -0.0003299154050182551, 0.036607563495635986, 0.06344814598560333, -0.08733449876308441, -0.0007713552331551909, -0.07963516563177109, -0.019434897229075432, -0.012804226018488407, -0.019525820389389992, -0.01912817358970642, 0.06094329059123993, -0.000498120323754847, 0.07981152087450027, -0.03942267969250679, -0.01800927333533764, 0.11191637814044952, 0.018843594938516617, 0.006751442328095436, 0.04050792381167412, -0.049048829823732376, 0.013519983738660812, -0.07342872023582458, 0.0069935135543346405, -0.03034478984773159, -0.026859890669584274, -0.009409918449819088, 0.010415980592370033, 0.030290354043245316, -0.024338357150554657, -0.16164541244506836, 0.004301218315958977, -0.06813779473304749, -0.018044641241431236, -0.03452308103442192, -0.03740258887410164, 0.044104114174842834, -0.004299039952456951, -0.04440932720899582, 0.17329825460910797, -0.03941141068935394, -0.05419689416885376, -0.021656109020113945, -0.04271745681762695, -0.012184670194983482, 0.05368415638804436, -0.012323268689215183, 0.07377880066633224, -0.06268557161092758, -0.06620868295431137, -0.07171326130628586, -0.025602241978049278, 0.011104946956038475, -0.03877308592200279, 0.0016501270001754165, -0.003890443127602339, -0.013937416486442089, 0.02564355358481407, 0.02877950295805931, 0.011287876404821873, -0.010286249220371246, -0.0012418779078871012, 0.09802216291427612, -0.03849398344755173, -0.027274277061223984, 0.0582125224173069, -0.010571657679975033, 0.001241052057594061, -0.036648791283369064, -0.0817524865269661, 0.017481088638305664, 0.01103968359529972, -0.024050692096352577, 0.04705476015806198, 0.005980385933071375, 0.006119933445006609, -0.022448264062404633, -0.016806090250611305, 0.034111566841602325, 0.002320729661732912, -0.02169467695057392, -0.010395225137472153, -0.03008210100233555, 0.057864535599946976, -0.027087360620498657, -0.026680266484618187, -0.012645641341805458, -0.0010934420861303806, 0.000783305149525404, 0.01494841743260622, -0.03582913056015968, 0.04353952407836914, 0.01265630591660738, -0.01592813804745674, 0.0181721318513155, 0.027284784242510796, 0.01965118758380413, -0.01731845550239086, -0.028478853404521942, 0.005130669102072716, -0.045228637754917145, 0.047723330557346344, 0.019302664324641228, 0.013706862926483154, -0.00857924297451973, 0.0028472591657191515, -0.03105424903333187, -0.008542779833078384, 0.00456618657335639, 0.03651934489607811, -0.004812504164874554, 0.008866491727530956, -0.017074253410100937, -0.029440585523843765, -0.00250898115336895, -0.0071825324557721615, 0.014888262376189232, 0.019858572632074356, 0.005213124677538872, -0.02675992250442505, 0.024293672293424606, 0.0013810929376631975, -0.02275463193655014, -0.046660128980875015, 0.020737016573548317, 0.045244064182043076, -0.00980598758906126, -0.10944529622793198, -0.023936443030834198, -0.0028358097188174725, 0.022057559341192245, 0.005440894979983568, -0.05909673124551773, 0.019938742741942406, -0.0047368393279612064, -0.012986603192985058, 0.011978703550994396, -0.004619629587978125, 0.027946550399065018, 0.017603343352675438, 0.021718531847000122, -0.015500087291002274, -0.03206489607691765, 0.02127835713326931, 0.010899360291659832, 0.047155313193798065, 0.04226920008659363, -0.03314342722296715, 0.038366518914699554, -0.0004118958895560354, 0.007416852749884129, -0.0412333719432354, 0.0391513891518116, 0.026033412665128708, 0.028004860505461693, 0.009335996583104134, -0.0398796983063221, 0.008052559569478035, -0.04022127389907837, -0.03368217125535011, 0.04497978091239929, -0.007066886872053146, -0.00007978472422109917, -0.01780327968299389, 0.033447183668613434, 0.035375095903873444, 0.029872454702854156, 0.0018170393304899335, 0.009603596292436123, 0.012012802064418793, -0.023859381675720215, 0.019682925194501877, 0.004605500493198633, -0.004063423722982407, 0.004130688030272722, 0.025947237387299538, -0.03905721753835678, -0.026644188910722733, -0.013700589537620544, -0.004728461150079966, 0.04162297025322914, 0.02311434969305992, 0.0052623506635427475, 0.010674763470888138, 0.009663159027695656, 0.01721944473683834, 0.024112913757562637, -0.06237339973449707, 0.028646336868405342, 0.027939053252339363, 0.004687958862632513, -0.03009369596838951, 0.026083018630743027, 0.01959232985973358, 0.027367522940039635, 0.018747268244624138, 0.0398893766105175, 0.0006616985192522407, 0.07499650865793228, -0.0012834646040573716, 0.007789428345859051, -0.01746424473822117, 0.03174588456749916, -0.010543745942413807, 0.00013440566544886678, 0.04641487076878548, 0.021735820919275284, -0.046025581657886505, -0.05681122466921806, -0.01296751108020544, -0.03248307853937149, 0.011879193596541882, 0.0259441789239645, -0.0034552644938230515, -0.019404057413339615, -0.006604023743420839, 0.043673641979694366, 0.027581779286265373, -0.0011410042643547058, 0.016944644972682, -0.018636317923665047, -0.01732279174029827, 0.00891287624835968, 0.027883533388376236, -0.02745780162513256, -0.006718863267451525, -0.01741216890513897, 0.03328974172472954, -0.004492717795073986, 0.004965184256434441, 0.006430116947740316, 0.026815688237547874, 0.023418549448251724, -0.02735545113682747, -0.007070325314998627, 0.03777404874563217, -0.00620880676433444, 0.013665893115103245, 0.013456256128847599, 0.021045275032520294, -0.021954962983727455, 0.06682811677455902, 0.025879506021738052, 0.004807163029909134, -0.0001605629950063303, -0.03666392341256142, 0.05181941017508507, -0.012121517211198807, 0.0253062192350626, -0.033202413469552994, 0.0045904675498604774, 0.03568582236766815, 0.010731948539614677, 0.03178858011960983, 0.057892441749572754, -0.05170208215713501, -0.0018312610918655992, 0.006305088754743338, -0.03417190536856651, 0.010051066055893898, 0.029308946803212166, 0.027826249599456787, 0.006534371990710497, -0.00006705942359985784, 0.016558989882469177, -0.03489308059215546, -0.01746329292654991, -0.042309489101171494, -0.009734380058944225, 0.002285171765834093, -0.010207850486040115, 0.04556126892566681, 0.026949170976877213, -0.0479218065738678, 0.00842180848121643, -0.016043489798903465, 0.03362061455845833, 0.046877842396497726, 0.0038788719102740288, -0.03073820471763611, 0.016610756516456604, 0.02782435156404972, -0.0415041521191597, -0.02224109135568142, 0.0034780828282237053, 0.002772401785477996, 0.029992416501045227, 0.005579505115747452, 0.02282867208123207, -0.03269248083233833, 0.03248727321624756, 0.029930349439382553, -0.032078422605991364, -0.002035522134974599, -0.05690531060099602, -0.007211621385067701, 0.014700761064887047, 0.019517024978995323, 0.028803380206227303, 0.03834877908229828, -0.020921392366290092, -0.01128812599927187, 0.04706155136227608, 0.030617831274867058, -0.009981987997889519, -0.0021560988388955593, 0.01863863691687584, -0.0042465138249099255, -0.023993341252207756, -0.026662860065698624, 0.024248627945780754, 0.0044137174263596535, 0.02027742750942707, 0.05822623521089554, 0.07977716624736786, -0.023243753239512444, 0.011909090913832188, -0.004454346839338541, 0.01745672896504402, 0.014209548011422157, -0.057302460074424744, -0.0031892014667391777, -0.01611393690109253, 0.007244285196065903, 0.0015511109959334135, -0.019366387277841568, 0.02619117498397827, 0.01162817794829607, 0.04149036109447479, -0.02495386451482773, -0.00973180215805769, 0.04163985326886177, 0.011547120288014412, 0.012851990759372711, -0.03626653179526329, 0.04454783350229263, -0.024733051657676697, -0.003362460294738412, -0.018816841766238213, 0.0002346280380152166, -0.015923749655485153, 0.011283277533948421, -0.031584035605192184, -0.021591711789369583, 0.01705334335565567, 0.03332630917429924, 0.03580182418227196, -0.013657255098223686, -0.007373088505119085, -0.0693725049495697, 0.019548635929822922, 0.021511580795049667, -0.04118817672133446, 0.01480787806212902, 0.02375051937997341, -0.03291038051247597, 0.013156077824532986, -0.019811352714896202, -0.012959703803062439, -0.003173166187480092, 0.0594366192817688, 0.03727931156754494, -0.02821137197315693, -0.029467133805155754, 0.02009243331849575, 0.038138896226882935, -0.04766092449426651, -0.015633199363946915, -0.024409620091319084, -0.0039335694164037704, 0.004076015669852495, -0.05343584343791008, 0.036800164729356766, 0.038240689784288406, 0.009662837721407413, 0.000034692817280301824, 0.01863330602645874, 0.007116576191037893, 0.0025741602294147015, 0.00521725881844759, -0.01815066486597061, 0.014362200163304806, 0.0052016437985002995, 0.03376177325844765, 0.0011654753470793366, 0.03244902938604355, 0.022335344925522804, 0.0019574237521737814, -0.0336323082447052, -0.006798384245485067, 0.057059962302446365, -0.015893196687102318, 0.04324781149625778, 0.03913528844714165, -0.037510327994823456, -0.006881651934236288, 0.008463675156235695, 0.022052394226193428, 0.017652887850999832, -0.00018282544624526054, 0.034204863011837006, -0.010416319593787193, -0.020952323451638222, 0.0008061142871156335, 0.04245602712035179, -0.022097691893577576, 0.0516580305993557, 0.009476060047745705, 0.039867427200078964, 0.03857649117708206, 0.0005221019382588565, -0.008476867340505123, -0.025391193106770515, 0.06311430037021637, 0.015787087380886078, 0.005839761346578598, 0.02458573319017887, -0.0035313188564032316, -0.024688921868801117, -0.016651233658194542, -0.02390805445611477, -0.059706151485443115, -0.010438737459480762, -0.000453815795481205, -0.025319822132587433, 0.00668239314109087, -0.02397890016436577, 0.03475292772054672, 0.011056467890739441, 0.03427364304661751, -0.008991144597530365, 0.052310384809970856, 0.06198633089661598, 0.048842087388038635, -0.004114220850169659, 0.03567631170153618, -0.027232082560658455, 0.0004531921586021781, 0.02733716368675232, -0.0014955340884625912, 0.06758767366409302, -0.017555255442857742, 0.013316448777914047, 0.026666661724448204, 0.012709797360002995, 0.011528090573847294, 0.012861170805990696, 0.004247433505952358, -0.003568128915503621, -0.016700249165296555, 0.04888797178864479, -0.004099827725440264, 0.021384036168456078, -0.007573834620416164, -0.018488029018044472, -0.05198404937982559, -0.013201567344367504, -0.027155233547091484, 0.062277697026729584, 0.020369701087474823, -0.004930152557790279, -0.013970788568258286, -0.05157396197319031, 0.012684699147939682, 0.018941111862659454, -0.03385290876030922, 0.01424821000546217, -0.02835177071392536, -0.03589533641934395, -0.03174690529704094, 0.0018937941640615463, -0.035275887697935104, -0.010179175063967705, 0.027404341846704483, 0.019181733950972557, 0.008477126248180866, 0.008037623018026352, 0.020124761387705803, -0.004672899842262268, -0.03174802288413048, 0.003371182596310973, -0.004842676687985659, -0.05945457145571709, -0.012173689901828766, -0.04680047929286957, -0.004930919501930475, 0.002240545116364956, -0.011880484409630299, 0.005178809631615877, 0.005663465242832899, -0.02301187627017498, -0.01853509247303009, 0.031018251553177834, 0.013633113354444504, 0.008393816649913788, 0.0004348929214756936, 0.002628943184390664, -0.020854830741882324, 0.007809319533407688, -0.007355630397796631, 0.0015609657857567072, 0.000839882530272007, 0.01487558800727129, 0.03739079460501671, -0.02090257592499256, -0.027799241244792938, -0.000815275707282126, 0.03702063858509064, 0.052085381001234055, 0.03055591508746147, 0.06286949664354324, 0.012405588291585445, -0.005227272864431143, -0.06535922735929489, 0.00260787270963192, -0.010333800688385963, -0.0024792898911982775, -0.022417908534407616, -0.05619101971387863, -0.04014037549495697, 0.02266230806708336, -0.023040007799863815, 0.004121842328459024, -0.05674421042203903, 0.013398288749158382, -0.05801111459732056, 0.017246562987565994, -0.013753005303442478, 0.02415362372994423, 0.060591574758291245, 0.05495462194085121, 0.0018928383942693472, -0.018445666879415512, -0.029022933915257454, -0.018467646092176437, -0.03188573941588402, 0.03452494740486145, 0.0316898450255394, 0.005380343180149794, -0.016597094014286995, -0.04067118093371391, 0.012617130763828754, -0.0018077028216794133, -0.023056084290146828, -0.021250922232866287, 0.05022067576646805, -0.029576022177934647, -0.018828872591257095, -0.015025747939944267, 0.02870880626142025, -0.0337563082575798, 0.04736320674419403, -0.005305293947458267, 0.012362170964479446, 0.0030459933914244175, -0.0003166650712955743, -0.05552451312541962, 0.017140306532382965, -0.02155250310897827, 0.006628905888646841, 0.01627509482204914, 0.0274215005338192, 0.011944880709052086, -0.009292698465287685, -0.025282250717282295, 0.005208087153732777, -0.0013234999496489763, -0.026881709694862366, -0.06946410238742828, -0.010214213281869888, 0.050845373421907425, -0.017980413511395454, -0.06884729862213135, 0.01818803884088993, -0.0026993609499186277, 0.0020869204308837652, 0.01609620824456215, -0.002054670127108693, 0.02441958710551262, 0.015266320668160915, 0.019843140617012978, -0.0058411345817148685, 0.047317907214164734, 0.04170392453670502, -0.014158088713884354, -0.00591069832444191, -0.007823056541383266 ]
My Journey to a serverless transformers pipeline on Google Cloud
Maxence
March 18, 2021
how-to-deploy-a-pipeline-to-google-clouds
guide
https://huggingface.co/blog/how-to-deploy-a-pipeline-to-google-clouds
# My Journey to a serverless transformers pipeline on Google Cloud >
[ 0.038535866886377335, 0.008852147497236729, 0.10866480320692062, 0.04767805337905884, -0.007382062263786793, 0.05712267383933067, 0.014060918241739273, 0.06377134472131729, 0.008391115814447403, -0.014650190249085426, -0.025025544688105583, 0.042240045964717865, -0.023010214790701866, 0.09647221118211746, 0.038896311074495316, -0.03639153018593788, 0.04995877295732498, -0.016780266538262367, 0.0048581818118691444, 0.014838575385510921, 0.017811201512813568, -0.05194650962948799, 0.07030422985553741, 0.004879468586295843, 0.014530275948345661, -0.08756153285503387, 0.001845480757765472, 0.048695795238018036, -0.0679447129368782, 0.05332981050014496, -0.011715198867022991, 0.0012141282204538584, 0.02172786369919777, -0.03695732355117798, -0.07783158868551254, 0.025310294702649117, -0.11169715225696564, 0.015221567824482918, -0.0292044784873724, -0.05210361257195473, -0.022085130214691162, -0.015506415627896786, -0.049911513924598694, 0.048336468636989594, -0.010573619976639748, 0.06456837803125381, -0.248924121260643, 0.06035862863063812, -0.05749549716711044, 0.001353449304588139, -0.03337369114160538, 0.08641453832387924, 0.025678880512714386, -0.027760514989495277, -0.0069597866386175156, 0.0652489960193634, -0.005649926606565714, -0.049384139478206635, -0.039295993745326996, 0.010155832394957542, 0.07114387303590775, 0.011512677185237408, 0.00923010054975748, 0.005579871125519276, 0.04023352637887001, -0.02823588438332081, 0.01726692169904709, 0.0021440042182803154, -0.020373022183775902, 0.0148250637575984, 0.06139157712459564, -0.08237898349761963, -0.0010020540794357657, -0.03261011466383934, -0.023884659633040428, -0.027561631053686142, 0.03348248451948166, 0.06035980209708214, 0.06922756880521774, 0.12867383658885956, 0.0034828386269509792, 0.0024496223777532578, -0.0051614707335829735, 0.05155201256275177, 0.026178212836384773, -0.04382004216313362, 0.09875722229480743, -0.008499330841004848, -0.04402900114655495, 0.09067079424858093, 0.0360952727496624, -0.16322138905525208, -0.05551387742161751, 0.05358133837580681, 0.06625816971063614, -0.025616906583309174, 0.02805398590862751, -0.020197991281747818, 0.015140397474169731, -0.03529437631368637, -0.015165850520133972, 0.033713921904563904, -0.012759532779455185, -0.012940121814608574, -0.051957838237285614, -0.020390473306179047, -0.011189262382686138, -0.10207614302635193, 0.016522858291864395, 0.016234835609793663, 0.004824601113796234, 0.033070601522922516, -0.017857788130640984, 0.0730060487985611, -0.021607082337141037, 0.10046934336423874, 0.01045052707195282, -0.055309053510427475, 0.004473291337490082, -0.039614733308553696, 0.06829503923654556, 0.09672816842794418, 0.02397499606013298, 0.01976439729332924, -0.01521594449877739, 0.0076797129586339, -0.024916496127843857, 0.001244224258698523, -0.02630220353603363, -0.05372282490134239, 0.007090384140610695, -0.011419275775551796, 0.05993401259183884, -0.04767424240708351, -0.046497445553541183, -0.07174714654684067, 0.01726594939827919, -0.06539154052734375, 0.01956014707684517, 0.0013499316992238164, -0.02042032591998577, 0.09295167028903961, -0.0007762622553855181, 0.04284236952662468, 0.06794481724500656, 0.006085020024329424, -0.04927785322070122, 0.011991770006716251, -0.021021636202931404, 0.033050522208213806, -0.020117461681365967, 0.06904800236225128, -0.0655527412891388, -0.051264695823192596, -0.00306942337192595, 0.03205050528049469, 0.02541719749569893, -0.0380982831120491, -0.016771532595157623, -0.02539430931210518, 0.011960312724113464, 0.023200087249279022, -0.01245698519051075, -0.0276957955211401, -0.00681863259524107, -0.04118223488330841, -0.008241143077611923, -0.02499414049088955, 0.025027580559253693, -0.03355690836906433, -0.02466523088514805, -0.048003990203142166, 0.011509441770613194, 0.015613416209816933, 0.007338100112974644, 0.0056627471931278706, 0.12742963433265686, 0.05134044960141182, -0.009216124191880226, -0.03449419513344765, -0.018439332023262978, 0.07279054075479507, 0.019684473052620888, 0.053943805396556854, 0.017824605107307434, 0.002339467639103532, 0.01932401955127716, -0.004927400965243578, 0.020195867866277695, 0.048112303018569946, -0.03675512969493866, -0.06878219544887543, 0.0602981299161911, -0.027659503743052483, 0.01104135625064373, -0.011127237230539322, -0.0025539316702634096, 0.06262513250112534, 0.004178869072347879, 0.08277888596057892, 0.019186243414878845, 0.028446249663829803, -0.023078737780451775, -0.0695391371846199, -0.011420030146837234, 0.04551773518323898, 0.070677250623703, -0.0260141771286726, 0.021224550902843475, 0.018693264573812485, -0.03131810575723648, -0.08223318308591843, -0.0017032237956300378, -0.04948626458644867, -0.027914518490433693, -0.07349905371665955, -0.06973078101873398, -0.02622649259865284, -0.0013018123572692275, -0.0007751762168481946, 0.1362008899450302, -0.030102966353297234, -0.01708918996155262, 0.014470119960606098, 0.007091808598488569, 0.027685631066560745, 0.06525791436433792, -0.024227892979979515, 0.10541819036006927, -0.05021626502275467, -0.07322488725185394, -0.028842950239777565, -0.01460130326449871, 0.04084935039281845, 0.01138351671397686, 0.014931153506040573, 0.015155602246522903, -0.0060800425708293915, 0.04145653173327446, -0.013146130368113518, -0.012946727685630322, -0.015441535972058773, -0.0073111094534397125, 0.056071408092975616, -0.03488009795546532, -0.006552967242896557, 0.052742768079042435, -0.0017564615700393915, -0.02308053709566593, -0.07431763410568237, -0.057244181632995605, 0.007373024709522724, -0.05407074838876724, -0.05514275282621384, 0.1064421534538269, -0.004125699400901794, -0.028057774528861046, 0.004421543329954147, -0.012495634146034718, 0.04134521633386612, -0.004223547410219908, -0.006856461055576801, 0.009374705143272877, -0.04330194741487503, 0.010358594357967377, -0.003925803117454052, 0.00008949830225901678, -0.012187880463898182, 0.006254187319427729, 0.03294006735086441, -0.017408186569809914, -0.034392692148685455, 0.033767130225896835, 0.022435272112488747, 0.003900049952790141, -0.021770760416984558, 0.004356061574071646, 0.011034755036234856, 0.01577826775610447, -0.03107137605547905, 0.055951304733753204, 0.005179218482226133, 0.03965870663523674, 0.0352308489382267, 0.004512491170316935, 0.006170324515551329, 0.0005450346507132053, -0.057999126613140106, 0.0075570959597826, -0.013346603140234947, 0.003375998931005597, 0.022373979911208153, -0.0013229666510596871, -0.01021028496325016, 0.008272934705018997, -0.0028589842841029167, -0.014948143623769283, -0.017958160489797592, -0.0338662713766098, 0.04893885925412178, -0.004254381638020277, 0.007501100189983845, -0.028264116495847702, -0.004020787309855223, -0.03683304786682129, 0.015525907278060913, 0.01655574142932892, -0.004011908546090126, -0.12784655392169952, -0.052027907222509384, 0.006028878036886454, 0.039463117718696594, -0.027962615713477135, -0.019636783748865128, 0.018581995740532875, 0.005145749542862177, 0.009332779794931412, -0.016232747584581375, -0.009199525229632854, 0.010111062787473202, -0.0004051881842315197, 0.0031133932061493397, -0.01493185106664896, -0.04144084453582764, -0.006740213371813297, 0.02947818487882614, 0.015154046006500721, 0.008798468858003616, -0.05331607535481453, 0.03264005854725838, -0.0043085054494440556, -0.010110284201800823, 0.06326445192098618, 0.0006379714468494058, 0.025063933804631233, 0.04114405810832977, 0.006073480937629938, 0.014656225219368935, -0.05757071077823639, 0.01615561731159687, -0.03149326145648956, 0.050495799630880356, -0.015365928411483765, 0.01502141822129488, -0.003978454042226076, 0.004789790604263544, 0.014207915402948856, 0.010217140428721905, 0.015928715467453003, -0.04055424779653549, 0.012076291255652905, -0.004791218787431717, 0.05313267186284065, -0.02196999080479145, -0.00384293170645833, 0.019392091780900955, 0.03600069880485535, -0.032620299607515335, -0.038236796855926514, -0.024252161383628845, 0.004712414462119341, 0.014566872268915176, 0.010071665048599243, -0.02551460638642311, -0.02556818351149559, 0.0012267461279407144, 0.02001926675438881, 0.007894698530435562, -0.04953015595674515, -0.0076718623749911785, 0.015046740882098675, 0.011128291487693787, -0.029830805957317352, 0.05856809765100479, 0.0074607692658901215, 0.03601201996207237, 0.01087841484695673, 0.01350918784737587, 0.0016649438766762614, 0.03306910768151283, -0.008531143888831139, 0.005941843613982201, -0.02553671784698963, 0.025253426283597946, 0.004756940063089132, -0.0019770455546677113, 0.06934424489736557, 0.012335438281297684, -0.0600895956158638, -0.016363687813282013, 0.0024571423418819904, -0.019974008202552795, 0.014410873875021935, 0.03483622521162033, 0.012398927472531796, -0.021041663363575935, -0.008771436288952827, 0.046557847410440445, 0.01713159680366516, -0.04415497928857803, 0.03049325756728649, -0.01902991347014904, 0.01094220019876957, -0.005914289969950914, 0.01889321208000183, -0.016508720815181732, -0.01257220096886158, 0.0068097347393631935, 0.029896710067987442, -0.024868100881576538, -0.0011789229465648532, 0.052160169929265976, 0.047116782516241074, 0.028803091496229172, -0.016250189393758774, -0.05414300039410591, -0.007190410979092121, 0.01655467413365841, 0.06325872242450714, -0.0022141989320516586, -0.010683946311473846, -0.057449180632829666, -0.01735895685851574, 0.05071934312582016, -0.0003173376026097685, -0.02871304750442505, -0.016044169664382935, 0.040745221078395844, -0.029827557504177094, 0.025139838457107544, -0.007821804843842983, 0.008682009764015675, -0.03154139220714569, -0.012285583652555943, 0.02513892762362957, 0.01830214075744152, -0.0217499528080225, -0.0011301904451102018, -0.009743562899529934, -0.025785572826862335, 0.05735710263252258, -0.040008295327425, -0.0012169542023912072, 0.007324835751205683, 0.00706560630351305, 0.018791290000081062, -0.004793909844011068, -0.008499838411808014, -0.012192162685096264, 0.034138526767492294, 0.025286313146352768, -0.03825371712446213, 0.04923149570822716, 0.009614833630621433, -0.032247550785541534, 0.012094669044017792, -0.02400398999452591, 0.03030359372496605, 0.037665706127882004, -0.017572026699781418, -0.033236708492040634, 0.03189576789736748, 0.016525575891137123, 0.02004796266555786, 0.020032169297337532, 0.012050073593854904, -0.011745374649763107, 0.03915369138121605, 0.0012624129885807633, -0.011126270517706871, -0.03965868055820465, 0.0016242566052824259, 0.005707294214516878, 0.0055480701848864555, 0.015227312222123146, -0.08014748990535736, -0.004431047942489386, 0.017863500863313675, 0.01685435324907303, 0.0022436315193772316, 0.03030000813305378, -0.005675181746482849, 0.0013123798416927457, 0.05742491036653519, 0.04952486604452133, 0.028916023671627045, -0.0006492846296168864, 0.024656159803271294, -0.022930454462766647, 0.019667556509375572, -0.0060447808355093, -0.008556968532502651, 0.008138174191117287, -0.018665974959731102, 0.04892589896917343, 0.030722273513674736, -0.012855084612965584, 0.05753961578011513, -0.005329301115125418, -0.0287554282695055, -0.030710352584719658, -0.021663278341293335, -0.0005995901883579791, -0.032067544758319855, 0.03498031571507454, 0.014229503460228443, -0.01446546707302332, 0.0010950792348012328, 0.02444031462073326, 0.03642887622117996, -0.02622881904244423, 0.0017117697279900312, 0.07401182502508163, 0.010925289243459702, -0.004982066806405783, 0.007140397559851408, 0.008524453267455101, -0.032971132546663284, 0.044767748564481735, 0.0112697072327137, -0.0191385205835104, -0.0294136144220829, 0.0034020242746919394, -0.0455678328871727, -0.01190925668925047, 0.026900049299001694, 0.012139109894633293, 0.01213112287223339, 0.0023117607925087214, 0.012611129321157932, 0.004748108331114054, 0.01457731518894434, 0.01970350556075573, 0.0008290975820273161, 0.011767164804041386, 0.03515705466270447, -0.016477437689900398, -0.009131141938269138, -0.0016479401383548975, 0.0035064013209193945, -0.020763171836733818, 0.026704827323555946, 0.02626078575849533, -0.022584930062294006, -0.034002337604761124, 0.022287897765636444, -0.011993464082479477, -0.024784278124570847, -0.027683718129992485, -0.0378076508641243, -0.01697380095720291, -0.010401386767625809, -0.03516468405723572, 0.01014766190201044, 0.03998599201440811, 0.008342276327311993, 0.022448495030403137, 0.023237252607941628, 0.02076222002506256, 0.01693625934422016, 0.009108802303671837, 0.0014187823981046677, 0.009379945695400238, -0.003291334491223097, 0.038235992193222046, -0.012000122107565403, -0.0035610694903880358, -0.030369022861123085, 0.01842919923365116, -0.032271068543195724, -0.014109698124229908, 0.0007032999419607222, 0.023922782391309738, 0.05344849452376366, -0.035151343792676926, -0.03063271753489971, -0.026012137532234192, 0.02017161063849926, 0.010603576898574829, 0.027005206793546677, -0.004585787188261747, -0.020876167342066765, -0.007328777574002743, -0.0415772907435894, 0.03671874850988388, 0.05302264541387558, 0.01990165375173092, 0.06544571369886398, 0.00253111170604825, 0.052823275327682495, 0.003981293179094791, 0.005429445765912533, 0.007415766827762127, 0.005283082369714975, 0.029969269409775734, -0.0100546358153224, 0.04812673106789589, 0.03416154906153679, 0.002966927597299218, -0.01927235908806324, -0.012743564322590828, -0.022612053900957108, -0.0299764983355999, -0.019153166562318802, 0.007264718413352966, -0.025476111099123955, 0.02265963889658451, -0.01980637013912201, 0.03358915075659752, 0.0014178386190906167, 0.0009311578469350934, -0.038906343281269073, 0.0017801086651161313, 0.07079951465129852, 0.011978072114288807, 0.048508938401937485, 0.06364532560110092, 0.006874901242554188, 0.004148094914853573, 0.07130564749240875, -0.02218456007540226, 0.03767435997724533, -0.017260784283280373, -0.024963049218058586, 0.0074384259060025215, 0.002351075178012252, -0.018934505060315132, -0.005581272300332785, -0.0057561504654586315, -0.0486018992960453, -0.029792798683047295, 0.019350001588463783, -0.024897661060094833, -0.0200948603451252, 0.0030330016743391752, -0.01154331024736166, -0.026868736371397972, -0.02613973058760166, -0.01902187615633011, 0.009299731813371181, 0.0039064534939825535, -0.03842482343316078, -0.006040225736796856, -0.007293407339602709, 0.01733766682446003, 0.016602393239736557, -0.0448809377849102, -0.00741885369643569, -0.033233433961868286, 0.00911401491612196, -0.015585851855576038, -0.02009682171046734, -0.029778046533465385, -0.01899510622024536, 0.033399548381567, 0.018726110458374023, -0.012093991972506046, 0.038053952157497406, 0.006466581951826811, 0.019899258390069008, -0.017870554700493813, 0.023698052391409874, -0.05031156912446022, -0.0062949033454060555, -0.047233544290065765, -0.0426565445959568, 0.012836594134569168, -0.016928749158978462, 0.001285885227844119, -0.002938870806246996, 0.0006774843204766512, -0.025805093348026276, -0.021033860743045807, 0.007164048962295055, -0.012999466620385647, -0.026168201118707657, 0.038993723690509796, -0.05943126976490021, -0.07538773864507675, -0.0015143334167078137, 0.02279585413634777, 0.04513881728053093, 0.007758019957691431, 0.0038677831180393696, 0.02439998649060726, -0.03240925818681717, -0.007203318644315004, -0.010906195268034935, 0.03722189739346504, 0.0067292144522070885, 0.030039023607969284, 0.014874822460114956, 0.017758768051862717, -0.013918749988079071, -0.06941898167133331, -0.005517641548067331, -0.03031999245285988, 0.008410660549998283, -0.0395328514277935, -0.05481589958071709, -0.006442912854254246, -0.02677938900887966, -0.03458557277917862, 0.006012545898556709, -0.06836697459220886, 0.0037846402265131474, 0.0021606346126645803, 0.004710273817181587, -0.035679783672094345, 0.016385843977332115, 0.056980159133672714, 0.04635123535990715, 0.033713553100824356, -0.028307290747761726, -0.012105826288461685, -0.0028635505586862564, 0.02101844735443592, 0.03380751609802246, 0.02914557419717312, 0.03999703377485275, -0.020488904789090157, -0.02853233367204666, 0.030815552920103073, -0.027303628623485565, -0.036960139870643616, 0.035448141396045685, 0.031140385195612907, -0.013598334044218063, -0.013490370474755764, -0.020048195496201515, 0.015776874497532845, -0.014256242662668228, 0.041482508182525635, -0.011915124021470547, -0.03706905245780945, 0.02822919934988022, -0.0026553417555987835, -0.0175201166421175, 0.0007899650372564793, 0.022728851065039635, -0.007260722108185291, 0.02265240252017975, 0.0423676036298275, -0.01948665827512741, -0.027215689420700073, -0.04633263126015663, 0.04694049060344696, 0.0017901594983413815, -0.05364692583680153, -0.04126974567770958, -0.0074193780310451984, 0.00565917044878006, -0.04926609992980957, -0.0561576671898365, 0.05636211857199669, 0.011268392205238342, -0.03172200173139572, 0.020393721759319305, 0.01280838344246149, -0.0026775214355438948, -0.03006730042397976, 0.035703394562006, -0.002457435242831707, 0.032653819769620895, 0.05296050384640694, -0.00412305723875761, 0.01404319703578949, 0.008203921839594841 ]
My Journey to a serverless transformers pipeline on Google Cloud
Maxence
March 18, 2021
how-to-deploy-a-pipeline-to-google-clouds
guide
https://huggingface.co/blog/how-to-deploy-a-pipeline-to-google-clouds
Step 2 - Test on AI-Platform Prediction As the model is not a "pure TensorFlow" saved model but a checkpoint, and I couldn't turn it into a "pure TensorFlow model", I figured out that the example on this page wouldn't work. From there I saw that I could write some custom code, allowing me to load the pipeline instead of having to handle the model, which seemed is easier. I also learned that I could define a pre-prediction & post-prediction action, which could be useful in the future for pre- or post-processing the data for customers' needs. I followed Google's guide but encountered an issue as the service is still in beta and everything is not stable. This issue is detailed here.
[ 0.03245037421584129, -0.08695752918720245, 0.05784350633621216, 0.03861777484416962, 0.08732972294092178, 0.04661588743329048, 0.03636208549141884, 0.01773699000477791, -0.015419620089232922, -0.027612775564193726, -0.02565370313823223, 0.01781630329787731, -0.007490508258342743, 0.0656447485089302, 0.02109895646572113, -0.044380318373441696, 0.06750129908323288, -0.050182703882455826, -0.0005254942225292325, 0.009996981360018253, -0.016801850870251656, -0.0168750137090683, 0.015712518244981766, -0.0509788952767849, -0.04233353212475777, -0.07500683516263962, 0.05096057429909706, 0.038571957498788834, -0.06059416010975838, -0.0013920239871367812, -0.10297314822673798, 0.02752785198390484, -0.017860986292362213, -0.03625204414129257, -0.017423078417778015, 0.0747375413775444, -0.08557558804750443, 0.017509302124381065, 0.007728059776127338, -0.03180691599845886, -0.005936925765126944, 0.038523487746715546, -0.051736798137426376, 0.062116675078868866, 0.024665310978889465, -0.0372430682182312, -0.19449567794799805, 0.006159680429846048, -0.006780704949051142, -0.04721151664853096, -0.006010251119732857, 0.11101075261831284, 0.015196805819869041, -0.018755916506052017, -0.034425780177116394, 0.01835760846734047, -0.00856038462370634, -0.025636961683630943, 0.00043639232171699405, 0.044338855892419815, 0.058379724621772766, 0.07119176536798477, -0.010808009654283524, -0.023094817996025085, 0.005503533408045769, -0.049009133130311966, 0.02360020950436592, -0.024617185816168785, -0.07960238307714462, -0.03491717576980591, -0.0006332444027066231, -0.04925774782896042, 0.010492468252778053, 0.026334362104535103, 0.007152395322918892, -0.0232390146702528, 0.005815799348056316, 0.04585760831832886, 0.07260291278362274, 0.036308810114860535, -0.01835707388818264, -0.024850165471434593, 0.03555215522646904, 0.031437672674655914, 0.01080202404409647, 0.011159264482557774, 0.07142854481935501, -0.01464143954217434, -0.03543222323060036, 0.07364637404680252, 0.037153612822294235, -0.11053241789340973, -0.00542057678103447, 0.008020182140171528, 0.009327879175543785, -0.024385645985603333, 0.040260300040245056, -0.012634233571588993, -0.03393162414431572, -0.0814180076122284, -0.05068773776292801, -0.04375532642006874, -0.03394291549921036, -0.03513879328966141, -0.03226684778928757, 0.01626201905310154, -0.017592044547200203, -0.08997661620378494, -0.023318106308579445, 0.026316003873944283, 0.022736825048923492, -0.002879165345802903, 0.023769650608301163, 0.0744742602109909, -0.12645775079727173, 0.042649250477552414, -0.014906852506101131, -0.035859331488609314, -0.0007618223899044096, 0.03747660666704178, 0.07502787560224533, 0.07983660697937012, 0.010031319223344326, -0.04362688586115837, 0.018472587689757347, 0.073739193379879, 0.01701720431447029, -0.014990292489528656, 0.00007755702245049179, -0.015289830975234509, 0.03258485347032547, -0.02218938060104847, 0.021470189094543457, -0.015757786110043526, -0.003082721261307597, -0.041351690888404846, -0.03656657785177231, -0.06144974008202553, 0.0577276386320591, -0.013846899382770061, -0.0473366305232048, 0.0209939107298851, 0.004782388918101788, -0.006954101379960775, 0.0769776850938797, 0.003009348176419735, 0.010354467667639256, 0.06567198038101196, -0.009997752495110035, 0.036138683557510376, -0.10394474864006042, 0.0593792200088501, -0.028539394959807396, -0.05383213981986046, 0.028733227401971817, 0.02078731544315815, 0.001396757084876299, -0.03971737623214722, -0.11207117885351181, -0.037435635924339294, 0.02382524684071541, 0.030248023569583893, -0.04681133106350899, -0.054350074380636215, 0.02236858941614628, -0.030305223539471626, 0.04864916577935219, -0.013154091313481331, 0.04673873633146286, 0.020663201808929443, 0.04673425853252411, -0.04569622874259949, 0.08435729146003723, -0.009366398677229881, 0.05834125727415085, 0.03896387293934822, 0.055050916969776154, 0.05982472375035286, 0.012275752611458302, -0.020553188398480415, -0.009710709564387798, 0.07531599700450897, -0.018894508481025696, 0.007453215774148703, 0.02466312237083912, -0.08055787533521652, -0.0005424031405709684, -0.021571483463048935, 0.008492546156048775, 0.05006089434027672, -0.018048910424113274, -0.0450718030333519, 0.05423576012253761, -0.0241137333214283, 0.050374262034893036, -0.10004565119743347, -0.023746805265545845, 0.05946008488535881, -0.021183153614401817, 0.07038703560829163, 0.06281354278326035, -0.017972297966480255, -0.004983019549399614, -0.08797677606344223, -0.001194674987345934, 0.013451016508042812, 0.02675103396177292, -0.09476727247238159, 0.006545436568558216, 0.010027863085269928, -0.01036813948303461, -0.1037960797548294, 0.032092124223709106, -0.06048968434333801, 0.013726436533033848, 0.030920103192329407, -0.028247477486729622, 0.012729826383292675, -0.04296678304672241, -0.05599682405591011, 0.1664896309375763, -0.009342607110738754, -0.0318940244615078, -0.01888037472963333, -0.0583321675658226, 0.029109671711921692, 0.024362413212656975, 0.04581895098090172, 0.0950525626540184, -0.06778423488140106, -0.02684110961854458, -0.05684630200266838, 0.01894291862845421, 0.08139420300722122, -0.025695383548736572, 0.0200202576816082, 0.05307665467262268, 0.012952848337590694, 0.03018198162317276, -0.037100907415151596, 0.01811123639345169, -0.010311844758689404, 0.002566762501373887, 0.0729547068476677, -0.056810639798641205, -0.023412425071001053, 0.07570897042751312, 0.011854034848511219, -0.03825650364160538, -0.04238055646419525, -0.049551814794540405, 0.004771035630255938, -0.024728236719965935, -0.022855833172798157, 0.04749489575624466, 0.035258546471595764, -0.006081667263060808, -0.014482569880783558, -0.02374395914375782, 0.05353032425045967, 0.024394074454903603, -0.00574575737118721, -0.01200038567185402, -0.01994880847632885, 0.020816199481487274, -0.0392170213162899, -0.028935682028532028, -0.033525221049785614, 0.016989709809422493, -0.006231413222849369, 0.0011635558912530541, -0.05299326777458191, 0.028153715655207634, 0.023338783532381058, 0.039286501705646515, 0.024819139391183853, 0.023150835186243057, 0.020995693281292915, -0.0038249031640589237, -0.009070505388081074, -0.008639946579933167, -0.05056291073560715, 0.08190760761499405, 0.04325246065855026, 0.04212558642029762, 0.004877276718616486, 0.00815050583332777, -0.032852012664079666, -0.03980507701635361, 0.03101598657667637, -0.01682368293404579, 0.0350193977355957, 0.024603761732578278, -0.019718045368790627, -0.020877430215477943, 0.025810344144701958, 0.037811145186424255, -0.018981747329235077, 0.011148614808917046, 0.02588590793311596, -0.01879073679447174, 0.012228346429765224, 0.017592206597328186, -0.03727711737155914, -0.026348790153861046, 0.06138763204216957, 0.037003546953201294, -0.011646955274045467, -0.11379682272672653, -0.031912822276353836, 0.04303576424717903, 0.022874444723129272, -0.03238365799188614, -0.014505162835121155, 0.03318015858530998, 0.0372956357896328, -0.00243613519705832, 0.006358232349157333, 0.010089355520904064, -0.0003834168310277164, 0.02108152210712433, -0.01648256555199623, -0.02192903682589531, -0.023019202053546906, 0.019626375287771225, -0.011529020965099335, 0.030973197892308235, 0.018688688054680824, -0.04402262344956398, 0.056133873760700226, 0.008768466301262379, 0.020933503285050392, -0.00681276386603713, 0.042862117290496826, 0.017131198197603226, 0.04576678201556206, -0.004556502215564251, -0.032971665263175964, -0.01576489955186844, -0.047552742063999176, -0.06402896344661713, 0.028247907757759094, -0.02817568928003311, -0.006645414046943188, -0.014591073617339134, 0.03623158112168312, 0.04708797112107277, 0.02022622711956501, -0.009472761303186417, -0.010606380179524422, 0.024891739711165428, -0.00943738967180252, 0.0015648874687030911, 0.004667559172958136, 0.027128009125590324, 0.023232175037264824, 0.016077140346169472, -0.037408795207738876, -0.041670773178339005, 0.027157729491591454, -0.016175400465726852, 0.049046844244003296, 0.009803976863622665, 0.03398376703262329, -0.004201480653136969, 0.04058217257261276, 0.03542594611644745, -0.028675468638539314, -0.05171912536025047, -0.013886187225580215, 0.02108280546963215, -0.014772034250199795, -0.04262702912092209, 0.015131721273064613, 0.03833157196640968, 0.009181885048747063, 0.008833280764520168, 0.0027696869801729918, 0.0022737206891179085, 0.053787365555763245, -0.024247286841273308, 0.009131318889558315, -0.01437150314450264, 0.015128374099731445, 0.010897232219576836, -0.014901245944201946, 0.07526719570159912, 0.03308578580617905, 0.01147499680519104, -0.013370582833886147, -0.025110336020588875, -0.0020273311529308558, 0.004505794029682875, 0.00979137048125267, -0.005760109983384609, -0.0036483248695731163, -0.00527995778247714, 0.030153824016451836, 0.04377655312418938, -0.027047866955399513, 0.026816969737410545, -0.0015976515132933855, 0.012837382033467293, 0.0149545818567276, 0.017723841592669487, 0.013679699040949345, 0.03172467648983002, 0.008181356824934483, 0.02354075014591217, -0.014928169548511505, 0.010411370545625687, 0.005853050388395786, 0.024377647787332535, -0.0036235253792256117, -0.016284994781017303, -0.05208338052034378, 0.02992120571434498, -0.023639241233468056, 0.012046249583363533, -0.004411465488374233, 0.0036667846143245697, -0.040139418095350266, 0.009912989102303982, 0.03335293009877205, -0.001732334727421403, -0.009423837065696716, -0.010396701283752918, 0.047077592462301254, -0.03304129093885422, 0.001357001718133688, -0.01572290249168873, -0.021038297563791275, 0.02953922189772129, 0.021719051524996758, 0.008309769444167614, 0.033488929271698, 0.026812314987182617, -0.001437081489712, -0.045535262674093246, -0.007870451547205448, 0.009913600981235504, -0.011603261344134808, 0.03177103400230408, -0.011322733014822006, -0.03706023469567299, 0.014047832228243351, -0.016225416213274002, -0.026370715349912643, -0.022856758907437325, -0.0042296950705349445, 0.024817418307065964, -0.022052140906453133, 0.058847859501838684, 0.02632908523082733, -0.05646287649869919, -0.010002406314015388, -0.013900966383516788, 0.010566768236458302, 0.025741415098309517, -0.0029933524783700705, -0.040391430258750916, -0.0009744437993504107, 0.01971052587032318, -0.030382797122001648, -0.0004352479591034353, 0.008697347715497017, -0.008674750104546547, 0.038846202194690704, -0.0023212353698909283, 0.011978830210864544, -0.012833109125494957, 0.027290426194667816, -0.011179432272911072, -0.007751299533993006, -0.019745077937841415, -0.07772278785705566, -0.0029734086710959673, 0.022005386650562286, -0.009766445495188236, 0.006433963309973478, 0.03499268740415573, -0.04238884896039963, 0.004692621994763613, 0.046956710517406464, 0.015204221941530704, 0.01727391965687275, -0.01837950199842453, 0.012051398865878582, 0.021786728873848915, -0.011068843305110931, 0.00023290353419724852, -0.007670172024518251, -0.009956913068890572, 0.024783136323094368, 0.044599346816539764, 0.030314672738313675, 0.030291058123111725, 0.012368601746857166, -0.010828658938407898, 0.010188627988100052, -0.0072188181802630424, -0.04759562015533447, 0.0356324128806591, 0.0005239508464001119, 0.008451022207736969, 0.023596301674842834, -0.036504775285720825, -0.02022361196577549, -0.005625078920274973, 0.049768295139074326, 0.0031745447777211666, 0.021172164008021355, 0.07171282172203064, -0.004290520679205656, -0.014812499284744263, 0.004406553227454424, 0.05223774537444115, -0.027931002900004387, 0.001612443826161325, -0.01025522779673338, 0.007521454244852066, 0.008876211941242218, 0.026640398427844048, -0.009777391329407692, -0.013347149826586246, 0.015422686003148556, 0.023492518812417984, 0.042961642146110535, -0.019017446786165237, -0.026235448196530342, -0.008529762737452984, 0.002038744045421481, 0.02967648394405842, 0.003154349746182561, 0.00874756183475256, 0.003367452882230282, -0.0353061817586422, 0.047482118010520935, 0.003915129229426384, -0.0034448851365596056, -0.014394334517419338, 0.032810043543577194, 0.03399631753563881, -0.026023853570222855, 0.0016627443255856633, 0.02677222713828087, 0.054175253957509995, -0.04247058182954788, -0.037353165447711945, -0.05142403021454811, -0.041093047708272934, 0.01669149473309517, -0.04302804172039032, 0.03853357210755348, 0.020053958520293236, -0.016698097810149193, 0.01681061089038849, 0.032052602618932724, 0.011922625824809074, -0.003751189447939396, 0.006852424703538418, -0.009629257954657078, 0.019461335614323616, 0.006921375170350075, 0.014946410432457924, -0.022768119350075722, -0.00036049296613782644, 0.06289450824260712, 0.009934225119650364, -0.06232672557234764, -0.034637387841939926, 0.029644884169101715, 0.006711226422339678, 0.039434414356946945, 0.001728133182041347, -0.0010963703971356153, -0.027380676940083504, 0.012906554155051708, 0.03947094455361366, 0.034634191542863846, 0.010928971692919731, -0.008748690597712994, -0.00526049081236124, -0.04058486223220825, 0.012698945589363575, 0.05896059423685074, -0.037545863538980484, 0.06594210118055344, -0.005800510756671429, 0.06502137333154678, 0.006053233053535223, 0.013199466280639172, 0.0031361852306872606, -0.009477660991251469, 0.09003421664237976, 0.04151912406086922, -0.004035723861306906, -0.010640803724527359, -0.004894667770713568, -0.020687280222773552, -0.010078192688524723, -0.032514411956071854, -0.03457827493548393, -0.005254186224192381, 0.02506323531270027, -0.02630569227039814, 0.01384203601628542, -0.010698802769184113, 0.025311680510640144, 0.022498048841953278, 0.034456364810466766, -0.028763335198163986, 0.028684141114354134, 0.06556256115436554, 0.014670279808342457, -0.00926528126001358, 0.004423788283020258, -0.028223812580108643, 0.021772705018520355, 0.056278862059116364, -0.02103416807949543, 0.05304400250315666, 0.016878942027688026, 0.004512597341090441, 0.035546135157346725, 0.03676820918917656, -0.05154953896999359, 0.016606982797384262, 0.004959241021424532, 0.011267867870628834, -0.006894445512443781, -0.00003316798756713979, -0.03526684641838074, -0.024522580206394196, -0.023802492767572403, -0.015236214734613895, -0.03380829095840454, -0.012436451390385628, -0.022577933967113495, 0.03807762637734413, 0.026332296431064606, -0.018585918471217155, -0.02034175582230091, -0.040954526513814926, 0.0163138248026371, -0.04771798849105835, -0.006415565498173237, -0.009250237606465816, -0.011446923948824406, -0.013227058574557304, -0.037388354539871216, -0.008518770337104797, -0.02191997691988945, -0.004831024445593357, 0.03204318508505821, 0.03098040446639061, 0.011086179874837399, 0.02054114267230034, 0.03946718946099281, -0.0005324714002199471, -0.00168922811280936, 0.005671736318618059, -0.028789132833480835, -0.05018337443470955, -0.007801926229149103, -0.07103868573904037, -0.012233375571668148, -0.0024101275485008955, -0.0034334466326981783, 0.024310622364282608, 0.030849650502204895, -0.005908356513828039, -0.03360036388039589, -0.029290709644556046, -0.011086171492934227, -0.0025359895080327988, 0.02376341074705124, 0.0027958296705037355, -0.027061790227890015, 0.010488527826964855, 0.02013799548149109, -0.010964802466332912, 0.004775654524564743, -0.00851021334528923, 0.025289319455623627, -0.000271532975602895, -0.019977789372205734, -0.007557006552815437, 0.02398202382028103, 0.013456368818879128, 0.030242441222071648, 0.06059887260198593, -0.0017658121651038527, 0.008184054866433144, -0.04410824552178383, 0.03324909880757332, -0.05159733444452286, 0.016625242307782173, -0.054457444697618484, -0.04929209500551224, -0.04287976399064064, -0.00847392063587904, -0.00649274280294776, 0.015976741909980774, -0.02557191252708435, -0.030933460220694542, -0.03446155786514282, 0.008382079191505909, -0.0500144362449646, -0.008047061040997505, 0.0827779546380043, 0.05891849845647812, 0.010345966555178165, 0.013404151424765587, 0.0027273083105683327, -0.015798494219779968, -0.010586236603558064, 0.03194785863161087, -0.0106008006259799, 0.013038389384746552, -0.0008541780989617109, -0.0013400543248280883, 0.012220453470945358, -0.029021546244621277, -0.03127860650420189, -0.033346302807331085, 0.030421635136008263, -0.03452293574810028, -0.04434230551123619, -0.013603411614894867, -0.020253771916031837, 0.027436211705207825, 0.022237174212932587, -0.00927176047116518, 0.009533308446407318, -0.014402215369045734, 0.013751326128840446, -0.07004294544458389, -0.03916091471910477, -0.026967031881213188, 0.004825790878385305, 0.008795248344540596, 0.04226785898208618, 0.008570345118641853, 0.0012357914820313454, -0.02685507945716381, 0.035416554659605026, 0.01936125010251999, -0.04128175228834152, -0.05489468574523926, -0.028696727007627487, 0.03810020536184311, -0.041159242391586304, -0.04983685165643692, 0.0341695100069046, 0.012723030522465706, -0.03242063894867897, 0.010874694213271141, 0.020707419142127037, 0.05089869722723961, -0.012656702660024166, 0.02815558947622776, -0.02049032598733902, 0.07758506387472153, 0.0418989323079586, -0.03558695688843727, -0.0029987082816660404, 0.022039256989955902 ]
My Journey to a serverless transformers pipeline on Google Cloud
Maxence
March 18, 2021
how-to-deploy-a-pipeline-to-google-clouds
guide
https://huggingface.co/blog/how-to-deploy-a-pipeline-to-google-clouds
A guest blog post by community member Maxence Dominici This article will discuss my journey to deploy the transformers sentiment-analysis pipeline on Google Cloud. We will start with a quick introduction to transformers and then move to the technical part of the implementation. Finally, we'll summarize this implementation and review what we have achieved.
[ 0.027025846764445305, -0.03386235237121582, 0.09386612474918365, 0.019161585718393326, 0.04900994151830673, 0.09305250644683838, 0.019492000341415405, 0.06720618903636932, 0.05623294413089752, -0.015771837905049324, -0.035458341240882874, 0.049412623047828674, -0.010781877674162388, 0.11439882218837738, 0.03317931666970253, -0.04970286041498184, 0.06938810646533966, 0.009661813266575336, 0.025731176137924194, -0.01301732286810875, -0.027519043534994125, -0.041600342839956284, 0.02946692518889904, -0.014815259724855423, 0.04418211057782173, -0.07040592283010483, 0.053321436047554016, 0.05102721229195595, -0.09320052713155746, 0.04033483937382698, -0.047964345663785934, 0.03142185136675835, -0.005148697644472122, -0.04594816640019417, -0.05678059160709381, 0.08334224671125412, -0.11609917134046555, 0.012245251797139645, 0.0013049078406766057, -0.04570392891764641, -0.01693565584719181, -0.04546143859624863, -0.08940315991640091, 0.02944326400756836, -0.024133192375302315, -0.001862427918240428, -0.21870572865009308, 0.08209532499313354, -0.047410111874341965, -0.014590957202017307, -0.035464417189359665, 0.09155281633138657, -0.018614154309034348, -0.030770262703299522, -0.007131744176149368, 0.05230003222823143, -0.003787370165809989, -0.03590734675526619, 0.004214860033243895, 0.028764430433511734, 0.010330170392990112, 0.0031525734812021255, -0.0012345919385552406, 0.021617243066430092, 0.011114324443042278, -0.012463904917240143, -0.00805969163775444, 0.05595064535737038, -0.027527837082743645, -0.03092908300459385, 0.025275347754359245, -0.04708163067698479, 0.012061632238328457, -0.010997781530022621, -0.0472569465637207, 0.03523857519030571, 0.03870034217834473, 0.04569348692893982, 0.04485499858856201, 0.07501212507486343, -0.004372266121208668, -0.01748475804924965, 0.029407033696770668, 0.027438655495643616, 0.059771083295345306, 0.010906404815614223, 0.1458691507577896, 0.00550402607768774, -0.05579414218664169, 0.07882662117481232, 0.04586755111813545, -0.17011646926403046, -0.03233380243182182, 0.015135690569877625, 0.08134374767541885, -0.027156418189406395, 0.0285202469676733, 0.00097183499019593, -0.022807078436017036, -0.021677052602171898, -0.02528175711631775, 0.03913213312625885, 0.0024919051211327314, -0.02532888762652874, 0.016420945525169373, -0.014278196729719639, 0.009045145474374294, -0.07758703082799911, 0.006267012562602758, 0.015398422256112099, 0.010185468941926956, -0.006678012199699879, 0.024909386411309242, 0.08905423432588577, -0.05460458621382713, 0.06282767653465271, 0.019520876929163933, -0.045530546456575394, 0.01671571470797062, -0.018999164924025536, 0.01774773560464382, 0.1319672018289566, -0.013229163363575935, 0.008847878314554691, -0.02131768688559532, 0.028379028663039207, -0.033167216926813126, -0.017044657841324806, -0.005457148887217045, -0.01810615509748459, -0.007796281483024359, -0.025082148611545563, 0.06127960607409477, -0.0835125669836998, -0.04674474149942398, -0.08742734789848328, 0.0215921550989151, -0.09315125644207001, 0.06295157223939896, 0.008373623713850975, -0.001181408646516502, 0.07603657245635986, -0.03735528513789177, 0.015982218086719513, 0.04276808351278305, 0.007417565677314997, -0.09265026450157166, 0.049445558339357376, -0.009501075372099876, 0.03521682322025299, -0.08099329471588135, 0.04454449564218521, -0.04143312945961952, -0.07050123810768127, -0.021787235513329506, 0.02530745230615139, 0.00046148549881763756, -0.036939650774002075, -0.054422736167907715, -0.00942954234778881, -0.011458816938102245, -0.009488488547503948, -0.04885734245181084, 0.009008425287902355, -0.009414991363883018, -0.044820427894592285, 0.05075904354453087, -0.018107246607542038, -0.0019910954870283604, 0.022644268348813057, 0.04697684943675995, -0.0461149699985981, 0.04321802407503128, 0.0007727268966846168, 0.004767157137393951, 0.018795737996697426, 0.07221852988004684, 0.053637199103832245, 0.04179259389638901, -0.05094227194786072, -0.02233090251684189, 0.07442514598369598, 0.01582491025328636, 0.04358797147870064, 0.006231122650206089, -0.02673940733075142, 0.0547073632478714, -0.06449496746063232, 0.048278484493494034, -0.03149671480059624, -0.0533335916697979, -0.04646971449255943, 0.012488395906984806, -0.009440755471587181, 0.05545513331890106, 0.004865236580371857, 0.03392644599080086, 0.057703301310539246, 0.009383190423250198, 0.03304449841380119, 0.046900443732738495, -0.02512071654200554, 0.02831248752772808, -0.057908255606889725, 0.00015433345106430352, -0.0036642777267843485, 0.01875837706029415, -0.022095149382948875, -0.015178580768406391, 0.025201117619872093, -0.05351949483156204, -0.08858630061149597, -0.017372794449329376, -0.03558206558227539, -0.011198118329048157, -0.05535603687167168, -0.04231613874435425, 0.03425018489360809, 0.030790729448199272, -0.04277919977903366, 0.1520785242319107, -0.039628177881240845, -0.0008688734378665686, 0.010087956674396992, -0.04400995373725891, -0.010046840645372868, 0.050636306405067444, 0.016155458986759186, 0.10274138301610947, -0.019926229491829872, -0.01186233852058649, -0.02451792173087597, -0.04375722259283066, -0.004205481149256229, -0.05071336776018143, 0.0280220378190279, 0.03474494442343712, 0.0034459210000932217, 0.019658073782920837, 0.006924875546246767, -0.008151574060320854, -0.007529326714575291, -0.0021609386894851923, 0.07861688733100891, -0.03024088777601719, 0.02477952651679516, 0.05281398072838783, -0.015769589692354202, 0.010014831088483334, -0.019749969244003296, -0.04990224167704582, 0.008870190009474754, -0.03337331488728523, -0.06428953260183334, 0.07617352157831192, 0.012883704155683517, 0.010776231996715069, -0.0068666329607367516, -0.0109632583335042, 0.032442934811115265, -0.015690093860030174, -0.01632484421133995, 0.020514007657766342, -0.05807027220726013, 0.02488614059984684, -0.00789023470133543, -0.0042908270843327045, 0.004173351917415857, -0.006162701640278101, 0.0205630324780941, -0.02554044872522354, -0.02686275541782379, 0.03267259895801544, 0.005558983888477087, -0.0010688048787415028, -0.004039971623569727, 0.013852284289896488, 0.02821209654211998, 0.005585331004112959, -0.02806142158806324, 0.028013339266180992, -0.05464554578065872, 0.03776465356349945, 0.020040137693285942, 0.029207399114966393, -0.02579878270626068, -0.003828627523034811, -0.052298713475465775, -0.013259334489703178, 0.03295227885246277, -0.0038800626061856747, 0.013406689278781414, 0.012777968309819698, 0.0031306736636906862, -0.006466895807534456, -0.000193360960111022, 0.01737741008400917, 0.020577192306518555, -0.023775286972522736, 0.07931792736053467, -0.0170146431773901, 0.005267131607979536, -0.0064314138144254684, -0.03204228729009628, -0.05232271924614906, 0.018249398097395897, 0.023225456476211548, 0.010291662067174911, -0.10723510384559631, -0.03848906606435776, -0.002436801791191101, 0.0240924209356308, -0.015857413411140442, -0.05757739022374153, 0.041464485228061676, -0.022798562422394753, 0.00765793863683939, 0.028289176523685455, -0.0004725784237962216, -0.006392128299921751, 0.01006895862519741, 0.0026659234426915646, -0.003417789936065674, -0.028830714523792267, -0.013017309829592705, 0.02474985644221306, 0.03391781076788902, 0.04970361292362213, -0.049500856548547745, 0.03876141458749771, 0.021932579576969147, -0.00930825900286436, 0.003923172131180763, 0.010512096807360649, 0.01700376160442829, 0.022086529061198235, 0.020727775990962982, -0.01989240013062954, 0.004436048213392496, 0.0013834635028615594, -0.03528609871864319, 0.041893571615219116, -0.019969714805483818, 0.0077310423366725445, -0.030502166599035263, 0.008433638140559196, 0.01798965409398079, 0.03183464705944061, -0.0014836955815553665, -0.0010785942431539297, 0.027358315885066986, -0.01851591281592846, 0.041868459433317184, -0.007291891612112522, -0.0002966660540550947, 0.010241971351206303, 0.005894616711884737, -0.01824556477367878, -0.03969118371605873, -0.02767868898808956, 0.0031537662725895643, 0.005857493728399277, -0.020123818889260292, -0.020640689879655838, 0.008993872441351414, -0.013934463262557983, 0.02429322339594364, 0.036154065281152725, -0.050257276743650436, 0.008216007612645626, 0.027950463816523552, 0.012055817060172558, -0.022589290514588356, 0.05443541333079338, 0.017894145101308823, 0.049780186265707016, 0.015454594045877457, 0.014523782767355442, -0.017115095630288124, 0.08099736273288727, 0.0005047841696068645, 0.0069669620133936405, -0.024607622995972633, 0.02095700241625309, 0.009994817897677422, -0.027776477858424187, 0.05384610593318939, 0.03169066086411476, -0.0334448516368866, -0.019912397488951683, -0.008313776925206184, -0.022152457386255264, 0.020948294550180435, 0.025906894356012344, 0.0006881711888127029, -0.03233619034290314, -0.01741779036819935, 0.02712070755660534, 0.05434376001358032, -0.043444808572530746, -0.009065045043826103, -0.02989220805466175, 0.00013508003030437976, -0.002050415612757206, 0.015539183281362057, -0.023861562833189964, -0.018705399706959724, 0.017650097608566284, 0.024706488475203514, -0.013575885444879532, -0.018422769382596016, 0.03427334129810333, 0.05090518295764923, -0.014994553290307522, -0.03330519050359726, -0.025811603292822838, 0.047404296696186066, 0.006748724263161421, 0.03207942470908165, 0.004319035913795233, -0.005835236981511116, -0.02778984233736992, 0.004566010553389788, 0.030066588893532753, 0.009622079320251942, -0.007421564776450396, -0.008736363612115383, 0.04026242345571518, -0.008198518306016922, 0.014446241781115532, -0.028578167781233788, 0.0427112951874733, -0.021752087399363518, 0.015996607020497322, 0.03710218146443367, 0.06225971877574921, -0.04667351022362709, 0.01218763180077076, 0.021358728408813477, -0.030453460291028023, 0.010996893048286438, 0.0060653374530375, -0.01565740443766117, -0.003888699458912015, -0.0068811760284006596, 0.03368491679430008, -0.027103887870907784, -0.01556303072720766, -0.006406374741345644, -0.0018688117852434516, 0.04455708712339401, -0.029220163822174072, 0.023987768217921257, -0.008412841707468033, -0.04426448419690132, -0.0010230547050014138, -0.020474353805184364, 0.018007811158895493, 0.04613962769508362, 0.0018486164044588804, -0.02625046670436859, 0.029423441737890244, 0.021804390475153923, -0.021245060488581657, -0.026824695989489555, 0.026595288887619972, -0.008243538439273834, 0.05302464962005615, -0.009893552400171757, 0.00453259376809001, -0.0522463396191597, -0.0016838315641507506, -0.002125658094882965, -0.016560634598135948, -0.016598956659436226, -0.07323180139064789, -0.01665099896490574, 0.0554368831217289, 0.00016721384599804878, 0.01781117543578148, 0.036822859197854996, -0.01397608034312725, -0.007639979477971792, 0.05078586935997009, 0.04649035632610321, 0.018880251795053482, 0.0017758161993697286, 0.011761673726141453, -0.04744649678468704, -0.01868678815662861, -0.028917711228132248, -0.016337167471647263, 0.0021203600335866213, 0.015118319541215897, 0.06256411969661713, 0.049791786819696426, -0.016820110380649567, 0.035740096122026443, -0.013133675791323185, -0.027070868760347366, -0.018794208765029907, -0.03702126443386078, -0.014721998013556004, -0.05302957445383072, 0.01847091317176819, 0.032024964690208435, -0.030134297907352448, -0.0060225496999919415, -0.0012197117321193218, 0.03495999798178673, -0.025215299800038338, 0.012581931427121162, 0.05786101892590523, 0.010451148264110088, 0.017741117626428604, -0.017517266795039177, 0.023339759558439255, -0.039173807948827744, 0.006317734252661467, 0.01698456145823002, 0.0039412411861121655, -0.01087518222630024, 0.0038007490802556276, -0.06567450612783432, -0.023988794535398483, -0.007257034070789814, 0.02739884704351425, 0.008996611461043358, -0.024366585537791252, 0.004278623033314943, -0.03079036995768547, 0.025849558413028717, 0.007862492464482784, -0.02414582297205925, 0.03289499133825302, 0.023315902799367905, -0.017684342339634895, 0.00006496210698969662, 0.014094414189457893, 0.011562662199139595, -0.01600412279367447, 0.05356080085039139, 0.01130731962621212, -0.02617063745856285, -0.03252784535288811, 0.024068785831332207, 0.03397319093346596, -0.02600930444896221, -0.02102339267730713, -0.041184600442647934, -0.007939309813082218, -0.014841100201010704, -0.04332862049341202, 0.0343979150056839, 0.0430007129907608, -0.018835371360182762, 0.014648866839706898, 0.028240421786904335, 0.006788665894418955, 0.02902982383966446, -0.007938862778246403, -0.004240265116095543, 0.04625814035534859, 0.020340654999017715, 0.04709318280220032, -0.003634394146502018, -0.0045336284674704075, 0.014709968119859695, 0.016497554257512093, -0.0652373880147934, -0.0138266421854496, 0.015710003674030304, -0.007701084017753601, 0.02447381056845188, -0.0005813284660689533, -0.023300979286432266, -0.030556634068489075, 0.02163708582520485, 0.03815099224448204, 0.03971938416361809, 0.028457416221499443, -0.016295993700623512, -0.014269901439547539, -0.014529282227158546, 0.02499612234532833, 0.06734955310821533, -0.018794937059283257, 0.038456499576568604, 0.02181299775838852, 0.018386855721473694, 0.02407078631222248, 0.030664540827274323, -0.005990169011056423, -0.003642031690105796, 0.04880703613162041, 0.004770927596837282, 0.03336342051625252, -0.012629085220396519, -0.004834591411054134, -0.013444721698760986, -0.01740828901529312, -0.027712620794773102, -0.048974379897117615, -0.009534744545817375, -0.023117108270525932, -0.03129548206925392, 0.0010844845091924071, -0.01583247445523739, 0.0377027690410614, 0.020602773874998093, 0.04541825130581856, -0.015588064678013325, 0.031246909871697426, 0.07852239161729813, 0.022744232788681984, 0.04700911417603493, 0.033403754234313965, -0.018477769568562508, -0.008686808869242668, 0.04509906470775604, 0.008243829011917114, 0.04888780415058136, -0.02887178771197796, -0.001012491062283516, 0.009695849381387234, 0.00948101095855236, -0.011883513070642948, -0.00039069337071850896, -0.01687854342162609, -0.014441567473113537, -0.016730189323425293, 0.02874021604657173, -0.00434424914419651, -0.013455510139465332, 0.006143879611045122, 0.018512127920985222, -0.007873325608670712, -0.025342732667922974, -0.026496220380067825, 0.03200242668390274, 0.006685791537165642, -0.011139209382236004, -0.0039028446190059185, -0.02867824397981167, -0.009272867813706398, 0.008939428254961967, -0.06705622375011444, -0.003284662729129195, -0.05559297651052475, -0.020296400412917137, -0.023903770372271538, 0.0019717314280569553, -0.0290873721241951, -0.013035810552537441, 0.019785022363066673, 0.004258362110704184, -0.03056498058140278, 0.03455055132508278, 0.031085526570677757, 0.0063761817291378975, -0.05062290281057358, 0.011905054561793804, -0.03235839679837227, -0.05061935633420944, -0.016268925741314888, -0.02417188324034214, 0.006975547876209021, -0.003356080735102296, -0.019124235957860947, -0.015696438029408455, -0.000028752465368597768, -0.0259795431047678, -0.008103769272565842, 0.020976953208446503, 0.03132832050323486, -0.006745929829776287, 0.014984226785600185, -0.033044226467609406, -0.04473615437746048, 0.01033491175621748, 0.012460004538297653, 0.019758740440011024, 0.025040557608008385, -0.004842279478907585, 0.0370352640748024, -0.010898934677243233, -0.015532203949987888, 0.004437686409801245, 0.02616533637046814, 0.006752901244908571, 0.008103917352855206, 0.047746215015649796, 0.0012292598839849234, 0.006056546233594418, -0.07021946460008621, 0.029605751857161522, -0.028682861477136612, -0.026437900960445404, -0.04183889180421829, -0.05715808644890785, -0.03666604310274124, 0.019268706440925598, -0.00593495974317193, 0.044388074427843094, -0.07149551808834076, 0.018141038715839386, -0.019144395366311073, -0.0066788713447749615, -0.022199515253305435, 0.005156141705811024, 0.05603529512882233, 0.06120767816901207, 0.04094652459025383, -0.024681437760591507, -0.026109209284186363, -0.02493729628622532, -0.011461764574050903, 0.007661228068172932, 0.025459494441747665, 0.04360571876168251, -0.01862703636288643, -0.03082672879099846, 0.01659686490893364, -0.021911319345235825, -0.03637409582734108, 0.025163333863019943, 0.018281295895576477, -0.02968021295964718, -0.04684028774499893, -0.0022050568368285894, -0.002764012198895216, -0.022571483626961708, 0.04731171950697899, -0.015138075686991215, 0.016369182616472244, 0.030524063855409622, -0.024897510185837746, -0.04672732576727867, 0.01835625059902668, 0.01931133307516575, -0.027766676619648933, -0.003713158890604973, 0.03591703996062279, 0.00011701472249114886, -0.01294616051018238, -0.0462111160159111, 0.008724427781999111, 0.016337208449840546, -0.04521114379167557, -0.05558370426297188, -0.026615841314196587, 0.022364933043718338, -0.034837640821933746, -0.07543236762285233, 0.033030055463314056, -0.00453663244843483, -0.04601769894361496, 0.022859763354063034, 0.01405845396220684, -0.00057559076230973, 0.011906420812010765, 0.024779921397566795, -0.0026814534794539213, 0.04958408698439598, 0.025341099128127098, -0.014837323687970638, -0.006114869378507137, -0.008036144077777863 ]
My Journey to a serverless transformers pipeline on Google Cloud
Maxence
March 18, 2021
how-to-deploy-a-pipeline-to-google-clouds
guide
https://huggingface.co/blog/how-to-deploy-a-pipeline-to-google-clouds
Performances Handling a request takes less than five seconds from the moment you send the request including loading the model into the pipeline, and prediction. The cold start might take up an additional 10 seconds more or less. We can improve the request handling performance by warming the model, it means loading it on start-up instead on each request (global variable for example), by doing so, we win time and memory usage.
[ 0.027384189888834953, -0.0006565598887391388, 0.04127194732427597, 0.0007336045964621007, 0.051318176090717316, 0.023921258747577667, -0.0039351643063127995, 0.06853152811527252, 0.022324368357658386, -0.025626633316278458, -0.01463373750448227, 0.03793465346097946, -0.009511936455965042, 0.04639362171292305, 0.0090540936216712, -0.025635594502091408, 0.08967392146587372, -0.034870412200689316, -0.009514058008790016, -0.02597522735595703, 0.04932849481701851, -0.09612004458904266, 0.09172220528125763, 0.005393245257437229, -0.03159130737185478, -0.043218206614255905, -0.05497230589389801, 0.014345922507345676, -0.0345773808658123, 0.02251395769417286, -0.10756710916757584, -0.048495251685380936, 0.011471870355308056, -0.01908598653972149, -0.022616757079958916, -0.008366699330508709, -0.0743405893445015, 0.056929342448711395, 0.03368445113301277, -0.10362399369478226, 0.01691208966076374, 0.0165904238820076, -0.04677172005176544, -0.004581938963383436, -0.02037050947546959, -0.06458745151758194, -0.1665956974029541, 0.050944868475198746, 0.042846739292144775, -0.05051177740097046, -0.11654972285032272, 0.037134427577257156, 0.005574310664087534, 0.04760659858584404, -0.014800474978983402, -0.031092416495084763, 0.016805093735456467, 0.004465258214622736, -0.02875998243689537, -0.004837385844439268, 0.07787470519542694, -0.03631100058555603, 0.007341210730373859, -0.013271814212203026, 0.01206836849451065, -0.02453600987792015, -0.012711895629763603, -0.003587116487324238, 0.04758847504854202, -0.01789155788719654, -0.005346120335161686, 0.02593315951526165, 0.012762474827468395, 0.02238435111939907, -0.0029981350526213646, -0.031124237924814224, 0.05202367156744003, 0.005755827762186527, 0.016365937888622284, 0.06509329378604889, -0.013490397483110428, -0.01539883017539978, 0.00841270200908184, 0.02216903492808342, 0.03361693024635315, 0.013139436952769756, 0.07527593523263931, 0.015618897043168545, -0.0680641233921051, 0.028462447226047516, 0.04343090578913689, -0.05598684400320053, 0.03758363053202629, -0.02068578265607357, 0.02574153244495392, -0.024446966126561165, 0.01690482161939144, 0.0027415151707828045, -0.020085671916604042, -0.04547533392906189, -0.03324538841843605, -0.08983658999204636, -0.0507022850215435, 0.022400308400392532, -0.0008734611910767853, 0.04936738312244415, -0.0631805807352066, -0.16278627514839172, -0.05950675904750824, 0.0305241160094738, -0.015587560832500458, 0.08098619431257248, -0.013957936316728592, 0.05323144420981407, -0.0901489332318306, -0.0001635578810237348, -0.0106058893725276, -0.06874697655439377, -0.025144286453723907, 0.027280287817120552, 0.051586125046014786, 0.055115796625614166, 0.0645408183336258, -0.03435676172375679, -0.02684883587062359, 0.053556177765131, 0.11913100630044937, 0.09048867225646973, 0.06471679359674454, -0.019611969590187073, 0.04621056467294693, 0.025195376947522163, 0.03908083960413933, 0.02370857074856758, 0.018574317917227745, -0.02442263253033161, -0.010252423584461212, -0.02408243902027607, 0.0257643461227417, -0.027544116601347923, -0.05971141532063484, 0.00480504659935832, -0.0020671775564551353, -0.016750622540712357, 0.11943644285202026, 0.06050568446516991, -0.05814913660287857, 0.0025444345083087683, 0.029606390744447708, -0.0004030438722111285, -0.09234414994716644, 0.0766327753663063, -0.06566645950078964, -0.03198758885264397, -0.0019467916572466493, 0.10397449880838394, -0.030119193717837334, -0.03114754520356655, -0.038355737924575806, 0.030979542061686516, -0.017701566219329834, 0.04906327277421951, -0.043512411415576935, -0.007075773552060127, 0.0784304067492485, -0.0016330003272742033, 0.005263128783553839, -0.029143059626221657, 0.04050793498754501, -0.05016612261533737, -0.008795883506536484, 0.04827946424484253, 0.06957262009382248, -0.019764799624681473, 0.016764314845204353, 0.06358262151479721, 0.003126690164208412, 0.05328136309981346, 0.03925728425383568, -0.028645552694797516, -0.0000754064240027219, 0.10212131589651108, -0.05570570379495621, 0.057787876576185226, 0.02085600420832634, -0.0911165103316307, 0.02559935301542282, -0.008020703680813313, -0.023393848910927773, 0.013246705755591393, -0.04037238657474518, 0.0038509289734065533, 0.06926757097244263, -0.0367651991546154, -0.011682355776429176, -0.026462236419320107, -0.0012794416397809982, 0.08043339848518372, -0.01957409456372261, 0.03451172262430191, 0.061257947236299515, 0.06032976880669594, 0.06026575341820717, -0.03730227053165436, 0.004637546371668577, 0.014645521529018879, 0.062230825424194336, -0.05384531244635582, 0.024407606571912766, -0.013657295145094395, -0.0197222251445055, -0.1210940033197403, -0.012873929925262928, -0.08997368812561035, -0.00244632619433105, -0.015858763828873634, 0.03878789395093918, -0.009769479744136333, 0.030624551698565483, 0.0011790023418143392, 0.16155950725078583, 0.003940795082598925, 0.0032459404319524765, 0.01446281187236309, -0.0449090339243412, -0.0004417870077304542, 0.0476536750793457, 0.032242871820926666, 0.051620688289403915, -0.06725472211837769, 0.021934231743216515, -0.04765542969107628, -0.03952500969171524, 0.04679019749164581, -0.033459313213825226, 0.0630493015050888, -0.012521186843514442, 0.07172495126724243, -0.01571931503713131, 0.008887327276170254, -0.0008386035333387554, 0.00613319082185626, -0.006581499706953764, 0.056604232639074326, -0.029387788847088814, -0.054975301027297974, 0.08009333908557892, -0.021185189485549927, -0.017290661111474037, -0.04371439293026924, -0.06147913634777069, 0.027513666078448296, -0.00678960420191288, -0.007884521968662739, 0.008532002568244934, -0.029599102213978767, -0.024271581321954727, -0.041677188128232956, 0.02141198143362999, 0.060749318450689316, 0.042457930743694305, -0.00383925624191761, -0.05054694786667824, 0.01459362544119358, 0.042997878044843674, -0.024034086614847183, -0.018297787755727768, -0.02947060391306877, 0.005050708074122667, -0.010556354187428951, 0.018553385511040688, -0.0383152961730957, 0.01802709698677063, 0.013153286650776863, 0.006857675034552813, 0.04053502529859543, 0.030678167939186096, -0.02175949700176716, -0.0030973374377936125, -0.02343820221722126, -0.0012589175021275878, -0.029826300218701363, 0.039622530341148376, 0.006959592457860708, -0.011970913037657738, -0.027046674862504005, 0.020239558070898056, -0.015284118242561817, -0.028806202113628387, 0.033307068049907684, 0.00022623120457865298, -0.010114981792867184, -0.014521784149110317, -0.009275727905333042, 0.0030505808535963297, -0.010673877783119678, -0.022858230397105217, -0.04692772775888443, 0.00022711428755428642, -0.006437677890062332, -0.05033664405345917, -0.029841475188732147, -0.02559739537537098, -0.02880834974348545, -0.054483700543642044, 0.005799201317131519, -0.020754488185048103, -0.002485841978341341, -0.11091320961713791, -0.02494419366121292, 0.033687788993120193, -0.01821867562830448, -0.005445456597954035, -0.024716243147850037, 0.05254323035478592, 0.0017166918842121959, 0.012136018835008144, 0.023390738293528557, -0.0318024605512619, -0.009801113046705723, -0.010990495793521404, -0.01778627745807171, 0.031081434339284897, -0.0024456949904561043, 0.01328713446855545, 0.02601921372115612, 0.011377332732081413, -0.011559988372027874, 0.033427946269512177, 0.014866642653942108, 0.012292503379285336, -0.017405416816473007, -0.024143315851688385, 0.032547727227211, -0.014446338638663292, 0.010651633143424988, -0.0033225095830857754, -0.029970984905958176, -0.03987991809844971, -0.04569771885871887, 0.005417886655777693, 0.026718592271208763, -0.004116884432733059, -0.015508167445659637, -0.02456948347389698, 0.012393581680953503, 0.018396349623799324, 0.034122809767723083, -0.02535282075405121, -0.007570998277515173, 0.02066737227141857, -0.004640736151486635, -0.017628414556384087, 0.0033074081875383854, 0.042500097304582596, -0.0214091744273901, 0.04700873792171478, -0.02646634168922901, -0.009439344517886639, -0.0028930106200277805, -0.007872525602579117, 0.03982418030500412, -0.009768838994204998, 0.019757447764277458, -0.033865030854940414, 0.02800806611776352, 0.027224494144320488, -0.011248505674302578, -0.01651475764811039, 0.00808768905699253, 0.04945884272456169, -0.0006205721292644739, -0.04198400676250458, 0.025673750787973404, 0.038753919303417206, 0.047318678349256516, -0.021726248785853386, 0.005471761338412762, 0.017120491713285446, 0.019316192716360092, 0.00700326357036829, 0.007974975742399693, 0.028992818668484688, -0.03313904255628586, 0.0386197566986084, -0.01557585783302784, 0.0816989317536354, 0.04316362366080284, -0.008627470582723618, 0.012731527909636497, -0.048047516494989395, -0.031171459704637527, 0.02401154302060604, 0.0018685427494347095, 0.01687879115343094, -0.028474994003772736, 0.016966087743639946, 0.036350689828395844, 0.026798587292432785, -0.020104462280869484, -0.008500153198838234, -0.009251847863197327, -0.024260183796286583, -0.004581192042678595, 0.054528482258319855, 0.021671732887625694, -0.021418169140815735, -0.01781381107866764, -0.0009822157444432378, -0.0037096217274665833, 0.026831544935703278, 0.01744602620601654, -0.007777333725243807, 0.005549099296331406, -0.0003190759161952883, -0.028360450640320778, 0.03927379846572876, 0.015513545833528042, 0.004653431475162506, 0.01469153817743063, 0.051938436925411224, -0.03171810507774353, 0.007598460651934147, 0.07057636231184006, -0.033624086529016495, 0.038198813796043396, 0.014055563136935234, 0.046236783266067505, -0.039267346262931824, 0.022678805515170097, -0.025058425962924957, 0.005923113320022821, 0.055145297199487686, 0.023125968873500824, 0.013160811737179756, 0.021466534584760666, 0.0008997422410175204, -0.006153713911771774, -0.0261100884526968, 0.02651715651154518, 0.0412551686167717, 0.00853010918945074, 0.02834358625113964, -0.011595901101827621, -0.017286790534853935, 0.021498387679457664, 0.015830611810088158, -0.006946129724383354, 0.018638579174876213, -0.008454624563455582, -0.003893159795552492, -0.038401082158088684, 0.034244224429130554, 0.04928223788738251, -0.021522345021367073, 0.013265680521726608, 0.004967191256582737, 0.022007564082741737, 0.03242676705121994, -0.022043095901608467, -0.0548383928835392, 0.01721404492855072, 0.015590834431350231, -0.04036826640367508, -0.01161209773272276, -0.03776293620467186, -0.0319819338619709, 0.04934638366103172, -0.0208460483700037, -0.02201373688876629, -0.043964553624391556, -0.005057682283222675, 0.03496013209223747, 0.014704211615025997, 0.010441727004945278, -0.013485119678080082, -0.00855144765228033, 0.014113924466073513, -0.024207938462495804, -0.0028717152308672667, -0.00026551392511464655, -0.04220665991306305, 0.04338455572724342, 0.02307971566915512, -0.02046755887567997, -0.0008403097745031118, 0.01974390260875225, 0.01833380199968815, -0.03346463665366173, -0.018632683902978897, 0.011532731354236603, -0.05572767183184624, 0.009796984493732452, 0.019917411729693413, 0.06803768873214722, 0.03467540442943573, 0.020306361839175224, 0.04970455542206764, 0.0005390910664573312, -0.00462178373709321, 0.02000225894153118, -0.028924228623509407, 0.023630697280168533, -0.008736967109143734, -0.008733119815587997, -0.02028638869524002, -0.024772552773356438, 0.004250944126397371, 0.013426465913653374, 0.07343557476997375, -0.007379150949418545, -0.017920559272170067, 0.002836884232237935, 0.02716834843158722, 0.010341882705688477, -0.008976386860013008, 0.02549748495221138, -0.053974512964487076, -0.0009475347469560802, -0.00011740039190044627, -0.012106776237487793, 0.02153634838759899, 0.010450967587530613, -0.010780824348330498, -0.04090163856744766, 0.03765442222356796, 0.04107256233692169, 0.056496549397706985, 0.02033275179564953, 0.0443415530025959, -0.05607970058917999, -0.023798545822501183, -0.01161962654441595, -0.07285936176776886, -0.001265989849343896, -0.003299953415989876, -0.0101127615198493, 0.009861055761575699, 0.047168437391519547, -0.05325859785079956, 0.009588648565113544, 0.028964871540665627, 0.026873381808400154, 0.024315914139151573, -0.01660638116300106, 0.017039496451616287, 0.011571504175662994, -0.027043089270591736, -0.046181902289390564, -0.05096113309264183, 0.013238506391644478, -0.02160673402249813, -0.057826220989227295, 0.029651673510670662, 0.06273786723613739, -0.01913844794034958, -0.000766069395467639, 0.042572956532239914, 0.0014930223114788532, -0.024743342772126198, 0.04448265954852104, -0.02116246521472931, 0.018953846767544746, -0.011560153216123581, 0.016648484393954277, 0.014995156787335873, 0.005131684243679047, 0.004962696228176355, 0.023778393864631653, -0.025730324909090996, 0.011297405697405338, -0.00015498703578487039, -0.02812029793858528, 0.03434917703270912, 0.0364513024687767, -0.04436255246400833, -0.013192333281040192, 0.02583516575396061, 0.014371124096214771, 0.002657142234966159, -0.0090742576867342, -0.005989932455122471, -0.021415265277028084, 0.011393727734684944, -0.02017989568412304, 0.04946751892566681, -0.008381959982216358, 0.03527840971946716, 0.047661587595939636, 0.028029274195432663, 0.013477333821356297, 0.02355870045721531, 0.006838001776486635, -0.0026258081197738647, 0.050144262611866, 0.02337966486811638, -0.010904977098107338, 0.01563108153641224, 0.02515307627618313, 0.012311449274420738, -0.02092623896896839, 0.01824217475950718, -0.006978960707783699, -0.04264553636312485, 0.03215021640062332, 0.013739393092691898, -0.01828739047050476, -0.05350298807024956, 0.021222740411758423, 0.015757624059915543, 0.03300630673766136, -0.0009801584528759122, 0.01259580533951521, 0.07228615880012512, 0.0010083705419674516, 0.02383098378777504, 0.0203775055706501, -0.03236472234129906, -0.010458381846547127, 0.022615091875195503, 0.017543725669384003, 0.043050091713666916, -0.008280838839709759, -0.015856530517339706, -0.006370223592966795, -0.03269944712519646, -0.021309474483132362, 0.026657935231924057, 0.01965292915701866, -0.027073120698332787, 0.007556856144219637, 0.0014034268679097295, -0.05888880416750908, 0.020819108933210373, -0.015715129673480988, -0.026789167895913124, -0.010497437790036201, 0.0013988972641527653, -0.006299247965216637, 0.012956144288182259, -0.015199501998722553, -0.01934865489602089, -0.014499682933092117, 0.03392050787806511, -0.011544293724000454, 0.018939487636089325, -0.07443123310804367, -0.04111838340759277, -0.01891336776316166, -0.006210006307810545, 0.0026869310531765223, 0.04221489652991295, -0.001476622186601162, -0.027750032022595406, 0.04668967425823212, 0.002026577480137348, -0.04138382524251938, 0.012313781306147575, -0.016020620241761208, -0.0033958125859498978, -0.01936524733901024, 0.004400200676172972, -0.047341931611299515, -0.05270198732614517, 0.04730837792158127, -0.016598407179117203, -0.002220535185188055, -0.0036692407447844744, 0.03987516090273857, 0.006961049512028694, 0.006308571435511112, -0.008456551469862461, 0.023400824517011642, -0.016422312706708908, -0.04082907363772392, -0.031746190041303635, 0.01775992289185524, 0.006926369853317738, -0.002219534246250987, 0.024270545691251755, -0.021942738443613052, -0.035470861941576004, -0.04147666320204735, 0.01302839070558548, 0.022371932864189148, -0.017016222700476646, -0.012664961628615856, -0.02921721152961254, 0.020096225664019585, 0.04698091372847557, 0.029286840930581093, 0.04581119120121002, -0.03383324667811394, -0.003701223060488701, -0.08092457056045532, -0.003532236674800515, 0.004250091500580311, 0.031786754727363586, -0.028538497164845467, -0.01621163636445999, -0.03941318020224571, 0.014388623647391796, 0.023721039295196533, -0.004710438195616007, -0.051849365234375, -0.02012002281844616, -0.012735157273709774, 0.004985574167221785, -0.032743558287620544, 0.010230098851025105, 0.06604866683483124, 0.020054984837770462, 0.020699327811598778, 0.02120739035308361, -0.02105989307165146, 0.01100169774144888, -0.009089558385312557, 0.02900267392396927, 0.047371771186590195, -0.006783099379390478, -0.009698948822915554, 0.008668871596455574, 0.010760338045656681, -0.015047543682157993, -0.06133405119180679, 0.024517614394426346, 0.01348947361111641, -0.027940763160586357, -0.06298547983169556, -0.03211064264178276, 0.04529563710093498, -0.009913988411426544, 0.047892775386571884, 0.01337156817317009, -0.03896799311041832, 0.002066654385998845, 0.029716234654188156, -0.050006281584501266, 0.011706726625561714, 0.012042705900967121, 0.0004623826243914664, 0.04987877607345581, 0.0122686130926013, 0.03382408991456032, 0.025364695116877556, -0.024044044315814972, 0.020059684291481972, -0.022496193647384644, -0.047949958592653275, -0.013172234408557415, -0.03228025510907173, -0.018128614872694016, -0.013697606511414051, -0.07053006440401077, 0.008256650529801846, -0.020770583301782608, -0.03164168819785118, 0.014364153146743774, -0.00021180951443966478, -0.012273544445633888, 0.0190439373254776, 0.01889527216553688, -0.038273826241493225, -0.004451036918908358, 0.07443162798881531, -0.0161613579839468, -0.03449730575084686, 0.012505163438618183 ]
My Journey to a serverless transformers pipeline on Google Cloud
Maxence
March 18, 2021
how-to-deploy-a-pipeline-to-google-clouds
guide
https://huggingface.co/blog/how-to-deploy-a-pipeline-to-google-clouds
The Goal I wanted to create a micro-service that automatically detects whether a customer review left in Discord is positive or negative. This would allow me to treat the comment accordingly and improve the customer experience. For instance, if the review was negative, I could create a feature which would contact the customer, apologize for the poor quality of service, and inform him/her that our support team will contact him/her as soon as possible to assist him and hopefully fix the problem. Since I don't plan to get more than 2,000 requests per month, I didn't impose any performance constraints regarding the time and the scalability.
[ 0.04958152770996094, -0.0485382154583931, 0.06986584514379501, 0.0001282754965359345, 0.049410123378038406, 0.038516815751791, 0.05467377230525017, 0.023243045434355736, 0.04563557356595993, -0.010363317094743252, -0.035076942294836044, 0.07556264847517014, 0.015169039368629456, 0.03546074777841568, -0.08045290410518646, 0.025615692138671875, 0.11871672421693802, 0.012919449247419834, 0.004862101282924414, -0.044056277722120285, -0.08142358809709549, -0.00859135389328003, 0.025510618463158607, -0.04234037920832634, 0.000517603475600481, -0.027158420532941818, 0.023852188140153885, 0.03885645046830177, -0.15715084969997406, -0.036712419241666794, 0.03687217831611633, 0.05178863927721977, -0.025273522362113, -0.04923590272665024, -0.0023319462779909372, 0.017796508967876434, -0.015949569642543793, 0.025313347578048706, 0.031031107529997826, -0.034357886761426926, -0.0337710902094841, -0.07544577866792679, -0.03990662097930908, -0.01995503343641758, -0.05661724507808685, -0.04575740918517113, -0.23397228121757507, 0.05505130812525749, -0.06437622010707855, -0.02575768530368805, -0.02376319095492363, 0.05531661957502365, -0.0370246022939682, 0.014176800847053528, -0.04891829565167427, 0.038981761783361435, -0.021951735019683838, -0.008314969018101692, -0.010233444161713123, 0.009770860895514488, 0.0361914299428463, -0.015059727244079113, 0.01565977744758129, 0.018816273659467697, 0.030913304537534714, 0.007918289862573147, 0.03423495963215828, 0.04709591343998909, -0.02561403624713421, -0.013940644450485706, 0.009081108495593071, -0.04855027794837952, -0.028560053557157516, 0.007563397288322449, 0.02645770087838173, -0.019955404102802277, -0.0328875370323658, 0.00855373963713646, 0.0028022644110023975, 0.01691622845828533, -0.004844155162572861, 0.0006309807649813592, 0.14421021938323975, -0.03731752559542656, -0.008536791428923607, -0.033392950892448425, 0.06656618416309357, -0.00378650170750916, -0.06999203562736511, 0.0196524690836668, 0.05717112869024277, -0.0619148425757885, 0.0872243195772171, 0.024306081235408783, 0.012000120244920254, -0.05615414306521416, 0.017511431127786636, 0.03989654779434204, -0.0037126110401004553, -0.027689723297953606, 0.03358839079737663, -0.03221721574664116, -0.0020689598750323057, -0.01826142519712448, -0.014936248771846294, 0.02032405138015747, 0.010424709878861904, -0.03444082289934158, -0.06104612722992897, 0.014559685252606869, -0.016385965049266815, 0.06086054444313049, -0.023044032976031303, 0.12781722843647003, -0.0055885412730276585, 0.10960233211517334, -0.005438460037112236, -0.00902019627392292, -0.021013911813497543, -0.006393931806087494, 0.11326263844966888, 0.0532989501953125, 0.022165322676301003, 0.032548002898693085, -0.03228145092725754, -0.032724086195230484, 0.020663591101765633, 0.03205645829439163, -0.018013514578342438, -0.05812907963991165, -0.011464311741292477, 0.037667468190193176, 0.005102515686303377, -0.011358741670846939, -0.03393350541591644, -0.02254531718790531, -0.003493374912068248, -0.08549046516418457, 0.0421983040869236, -0.008192582055926323, 0.005541358608752489, -0.006732953246682882, -0.03523123636841774, 0.10648917406797409, 0.06551075726747513, -0.014411131851375103, -0.017622867599129677, -0.028139660134911537, -0.012268845923244953, -0.006571177858859301, -0.08604422956705093, -0.018884841352701187, 0.00012996510486118495, -0.04242324084043503, -0.06887290626764297, 0.035323549062013626, -0.021016448736190796, -0.05947421118617058, -0.057864200323820114, 0.048224080353975296, -0.01158664096146822, 0.04618063569068909, -0.0528155080974102, -0.04467826709151268, 0.051720649003982544, 0.05922756716609001, 0.003200086299329996, -0.00034955801675096154, 0.015561492182314396, 0.03482748568058014, 0.050659675151109695, -0.0075379651971161366, -0.001901427865959704, -0.0027838998939841986, 0.05653294920921326, 0.031149178743362427, 0.10864350944757462, -0.010795844718813896, -0.04873029515147209, -0.06728312373161316, -0.012393825687468052, 0.06692621111869812, 0.01593766175210476, -0.004612246993929148, 0.019852997735142708, -0.04625263810157776, 0.034649357199668884, -0.03803516924381256, -0.015252325683832169, 0.012852777726948261, 0.0039838943630456924, 0.01575181819498539, 0.04276719689369202, 0.005507180001586676, 0.06862536072731018, -0.017893578857183456, -0.04106131196022034, 0.09918003529310226, 0.04241485893726349, 0.07159186899662018, 0.026169775053858757, 0.01894591748714447, 0.07454986870288849, 0.018192850053310394, -0.0009472661768086255, 0.020268186926841736, 0.028146669268608093, 0.01763630472123623, -0.02868579886853695, 0.026911363005638123, -0.006693621166050434, -0.05128094553947449, 0.028099801391363144, -0.03875536844134331, 0.024351226165890694, -0.0020016119815409184, -0.017392754554748535, 0.0014623524621129036, -0.04128113016486168, -0.025115448981523514, 0.1567336618900299, -0.06089654564857483, 0.0033709025010466576, 0.03356412425637245, 0.05643751844763756, 0.030740199610590935, 0.05402025952935219, 0.04342266544699669, 0.08769198507070541, 0.0011223669862374663, -0.05210910737514496, -0.003896117676049471, -0.09385708719491959, 0.030561598017811775, 0.035357553511857986, 0.06385039538145065, -0.009235098026692867, -0.054538968950510025, 0.06603214144706726, 0.08374369889497757, -0.05774165689945221, 0.03674807399511337, 0.010074912570416927, 0.10922210663557053, -0.0021983329206705093, -0.0022644398268312216, 0.015280934050679207, 0.02611365169286728, -0.022998124361038208, 0.008393649011850357, -0.045084308832883835, -0.029043572023510933, 0.018008362501859665, -0.015585803426802158, 0.10314062982797623, -0.02758246846497059, -0.014612872153520584, -0.003597334260120988, -0.04540988802909851, 0.0015810029581189156, -0.03208566829562187, -0.01366248819977045, 0.03021037019789219, -0.0360775962471962, 0.06663432717323303, -0.0031267080921679735, -0.02653581276535988, 0.004976279102265835, 0.0041040764190256596, 0.030047226697206497, -0.0038960070814937353, -0.02292460948228836, 0.0060303532518446445, 0.0020724968053400517, -0.04751773178577423, -0.00322604994289577, 0.027051039040088654, -0.013233623467385769, 0.00298991147428751, -0.04246038943529129, 0.00400116853415966, 0.0025953289587050676, 0.02383117377758026, 0.02136743627488613, 0.03682972118258476, -0.041018981486558914, -0.02222379483282566, -0.02963537536561489, -0.012406210415065289, 0.006084841210395098, -0.01116759330034256, -0.02472773566842079, 0.009954981505870819, 0.0007435806910507381, 0.023279564455151558, -0.009569787420332432, -0.006094164680689573, 0.041653119027614594, -0.012441672384738922, -0.011980651877820492, -0.006218345835804939, -0.03113594278693199, -0.009937806986272335, -0.04260575398802757, -0.02900954708456993, 0.03493485972285271, 0.024711020290851593, 0.004903407301753759, -0.11681420356035233, -0.020688675343990326, 0.011509682983160019, 0.02023768611252308, -0.016200445592403412, -0.014807560481131077, 0.071987584233284, 0.007977527566254139, -0.013136068359017372, 0.003253927920013666, -0.07327418774366379, 0.02300487644970417, 0.03815017268061638, 0.012739773839712143, 0.0031479967292398214, -0.05403568595647812, 0.015003333799540997, 0.031147180125117302, 0.019505327567458153, 0.006958645302802324, -0.06409924477338791, 0.05631318688392639, 0.012106985785067081, 0.00005013040208723396, -0.031090419739484787, -0.020300960168242455, 0.025710415095090866, 0.045671772211790085, 0.05025238171219826, -0.050024427473545074, -0.00897684134542942, 0.02585970237851143, -0.029335882514715195, -0.021660609170794487, -0.03016549162566662, 0.035688307136297226, 0.0007779579027555883, 0.028454702347517014, -0.0064256805926561356, -0.004239731468260288, -0.014257882721722126, 0.004805901553481817, 0.03785114362835884, -0.0038453221786767244, 0.015649985522031784, -0.0022738242987543344, 0.006595080252736807, 0.012689766474068165, 0.03208122029900551, -0.02014508843421936, 0.02227848954498768, -0.02333724871277809, -0.026037564501166344, 0.049991779029369354, -0.01231297291815281, -0.03960616514086723, -0.059681929647922516, 0.008468715474009514, -0.015912339091300964, -0.006156221963465214, -0.009423654526472092, -0.013089364394545555, -0.006054540630429983, -0.03562720865011215, -0.004708845634013414, 0.014489160850644112, -0.006116690579801798, 0.004415993578732014, 0.006340924650430679, 0.009983033873140812, 0.049512870609760284, 0.021743329241871834, 0.039076898247003555, 0.012426747009158134, 0.04622994363307953, 0.00892149843275547, 0.028005095198750496, 0.001882410841062665, 0.03855906054377556, 0.049188241362571716, -0.010499892756342888, -0.03444276005029678, -0.0418713241815567, -0.01757056452333927, 0.0038297101855278015, 0.009982539340853691, 0.0320960134267807, 0.031617581844329834, -0.012511657550930977, 0.04579806700348854, -0.0005597965209744871, -0.014148791320621967, 0.01260282751172781, -0.01559531781822443, -0.028223417699337006, 0.013421818614006042, 0.06451377272605896, -0.01569349132478237, 0.017429934814572334, 0.01717352122068405, 0.043089792132377625, 0.015806568786501884, 0.021626247093081474, 0.02661196142435074, 0.019058741629123688, 0.03141971305012703, -0.07026799023151398, -0.010950849391520023, 0.009272913448512554, -0.009791516698896885, 0.013230959884822369, 0.003773209871724248, -0.042072270065546036, -0.038710951805114746, 0.03351511433720589, 0.036651551723480225, -0.013525811955332756, 0.027268484234809875, -0.022228538990020752, 0.0437278114259243, -0.03428570181131363, -0.042468320578336716, -0.0008376449695788324, 0.02950296737253666, -0.004570620134472847, -0.005541414953768253, 0.028075508773326874, -0.009062124416232109, -0.002613428048789501, -0.023430027067661285, -0.00921081192791462, -0.03586551547050476, -0.03431923687458038, 0.022199301049113274, 0.011280866339802742, -0.00755479047074914, 0.005272372625768185, 0.01337265782058239, -0.023739419877529144, -0.018586160615086555, 0.015231517143547535, -0.030590489506721497, -0.012115512043237686, -0.059748489409685135, 0.0029734980780631304, 0.00682394253090024, -0.044535618275403976, 0.026992667466402054, 0.03515465930104256, 0.04060598835349083, -0.018293583765625954, -0.029887430369853973, -0.022677768021821976, -0.023187020793557167, 0.027179569005966187, -0.008285101503133774, -0.010828318074345589, -0.0013598661171272397, -0.033805280923843384, 0.029810646548867226, 0.007849865593016148, -0.0318639911711216, -0.004828049335628748, 0.010797192342579365, 0.020491676405072212, -0.0054520778357982635, -0.014948715455830097, -0.005879241041839123, 0.02759368345141411, 0.022499283775687218, 0.009222582913935184, 0.043953973799943924, -0.001588011160492897, 0.03866095468401909, 0.01708993688225746, 0.020882699638605118, 0.020199213176965714, -0.01612987369298935, -0.013751067221164703, -0.07175291329622269, 0.02441803365945816, 0.034466542303562164, 0.007943520322442055, 0.031901437789201736, 0.0016072187572717667, 0.02726943977177143, 0.08033207058906555, 0.012988501228392124, 0.014141786843538284, 0.08364541828632355, -0.005088409874588251, 0.040828537195920944, -0.004596049897372723, -0.04654325917363167, 0.03384674713015556, -0.056141022592782974, -0.023317689076066017, 0.02249719202518463, -0.01383989118039608, -0.0073458850383758545, 0.03733613342046738, 0.04069700464606285, -0.036776989698410034, 0.005810969974845648, 0.028391221538186073, 0.035777147859334946, 0.03205271065235138, -0.023764409124851227, -0.0017020911909639835, -0.00969034805893898, -0.0009288522996939719, -0.019503436982631683, -0.008233859203755856, -0.030109450221061707, 0.010655631311237812, -0.016334665939211845, -0.010662782937288284, -0.030934009701013565, -0.0033944579772651196, -0.008755738846957684, 0.021522166207432747, 0.03359663113951683, -0.058260176330804825, 0.011069427244365215, 0.014860895462334156, -0.0016917703906074166, 0.013938060030341148, 0.0012598061002790928, -0.021955575793981552, 0.005506444256752729, 0.013442795723676682, 0.004000814165920019, -0.013324154540896416, -0.007852250710129738, 0.008956612087786198, -0.006040263455361128, -0.04616887494921684, 0.009186840616166592, -0.02639850415289402, -0.02555525302886963, -0.040462274104356766, -0.01012330874800682, -0.03941798582673073, -0.03566369414329529, -0.04567139968276024, 0.0389348641037941, 0.05977670103311539, 0.018947189673781395, 0.001593572087585926, 0.003907567355781794, 0.008915849030017853, 0.029340332373976707, -0.024917246773838997, -0.0182053055614233, 0.03473745658993721, 0.003943734336644411, 0.010975902900099754, 0.02800510637462139, -0.02106257900595665, -0.04804074391722679, 0.008691709488630295, -0.021599387750029564, -0.007086703088134527, 0.01821092888712883, -0.018610786646604538, 0.05966348573565483, 0.022332744672894478, -0.03637813404202461, -0.03262077271938324, 0.006648039910942316, 0.060449860990047455, -0.0006551742553710938, 0.034884318709373474, -0.011437169276177883, -0.014706038869917393, -0.0258320439606905, -0.004133856855332851, 0.042876552790403366, -0.04566069692373276, 0.053894367069005966, 0.05811147019267082, 0.019082166254520416, -0.0028319458942860365, 0.08111146092414856, 0.004514949396252632, -0.024369118735194206, 0.04791497439146042, 0.0033827133011072874, 0.045298293232917786, 0.007497807033360004, 0.02371150068938732, 0.01882096566259861, -0.0019093186128884554, 0.01745331659913063, -0.04284392297267914, -0.014961970038712025, 0.021268075332045555, -0.011186766438186169, -0.028096618130803108, -0.0050217402167618275, 0.007118938956409693, 0.004437593277543783, 0.02276306226849556, 0.016622129827737808, -0.010990418493747711, 0.04199451208114624, -0.021118799224495888, 0.030592700466513634, 0.01611545868217945, -0.032530657947063446, -0.03507557511329651, 0.0379713736474514, -0.016108695417642593, 0.005362493451684713, -0.01117661502212286, -0.007704731076955795, 0.028441354632377625, -0.018214156851172447, 0.005447627045214176, 0.019035344943404198, -0.023964300751686096, -0.0344688780605793, 0.0052809929475188255, 0.006693062838166952, -0.03345179557800293, -0.01781998574733734, 0.02584807761013508, 0.007189233787357807, 0.03237021341919899, -0.010801684111356735, -0.009722788818180561, 0.029088588431477547, -0.016033312305808067, -0.03003545105457306, -0.008501913398504257, -0.04470266401767731, 0.0009030975052155554, 0.027524128556251526, -0.08140100538730621, 0.017963990569114685, -0.010333165526390076, -0.010229428298771381, -0.019700787961483, -0.05031139776110649, -0.03391466662287712, 0.006119552534073591, 0.03046521730720997, -0.009745328687131405, -0.006714279297739267, 0.011490698903799057, 0.03627622500061989, -0.004411657340824604, -0.018523389473557472, 0.003259527264162898, -0.08028867095708847, -0.021394895389676094, -0.045725103467702866, -0.03625331446528435, 0.013644468039274216, -0.012190226465463638, 0.0020548023749142885, -0.04286054149270058, -0.00500637199729681, -0.0459308885037899, -0.0038140907417982817, 0.019739555194973946, 0.008908423595130444, -0.0029072551988065243, -0.006978180725127459, 0.0004893863224424422, 0.006555782165378332, 0.010450080037117004, -0.029541118070483208, -0.009505159221589565, 0.004398733843117952, -0.0031075531151145697, 0.04718185216188431, 0.011627170257270336, -0.008320743218064308, 0.00820905901491642, 0.025934452190995216, 0.03262288495898247, 0.006001334171742201, -0.00527903763577342, 0.01756342314183712, 0.01572578400373459, -0.05934680253267288, -0.008049282245337963, 0.003637193003669381, -0.019594796001911163, -0.018616484478116035, -0.01707267016172409, -0.014837919734418392, -0.016792817041277885, -0.03549869731068611, -0.0033004358410835266, -0.06926698237657547, 0.011352207511663437, 0.013382747769355774, 0.015413856133818626, -0.05501545965671539, -0.008884266018867493, 0.052897073328495026, 0.00947829894721508, 0.0262884683907032, -0.03318345546722412, -0.045960813760757446, -0.029332200065255165, -0.02576778456568718, 0.05338544771075249, 0.03447244316339493, 0.055966150015592575, -0.029552601277828217, 0.013627673499286175, 0.05029219016432762, -0.0193319134414196, -0.018066639080643654, 0.015282592736184597, 0.02278888411819935, -0.016322877258062363, -0.016480205580592155, 0.00006484398181783035, -0.015972647815942764, -0.01612183265388012, 0.06380932778120041, -0.028071705251932144, -0.017976416274905205, 0.018375813961029053, -0.01632552035152912, -0.0026157600805163383, -0.026275409385561943, 0.004228174686431885, 0.006324307527393103, 0.021732022985816002, 0.0029723825864493847, 0.0035316997673362494, -0.0050895861349999905, -0.010656919330358505, 0.021412014961242676, -0.016018172726035118, -0.03088763728737831, -0.06173216924071312, -0.029161136597394943, 0.01573183760046959, -0.00445751054212451, -0.05151518061757088, -0.01846759021282196, 0.004728736821562052, -0.03842544183135033, -0.025117293000221252, -0.011370963416993618, -0.02595689706504345, 0.03691656142473221, 0.05230660364031792, -0.030874306336045265, 0.08315208554267883, 0.006297255400568247, 0.018295850604772568, -0.015138426795601845, -0.00892749521881342 ]
My Journey to a serverless transformers pipeline on Google Cloud
Maxence
March 18, 2021
how-to-deploy-a-pipeline-to-google-clouds
guide
https://huggingface.co/blog/how-to-deploy-a-pipeline-to-google-clouds
Deployment instructions First, you will need to meet some requirements such as having a project on Google Cloud, enabling the billing and installing the gcloud cli. You can find more details about it in the Google's guide - Before you begin, Second, we need to build the docker image and deploy it to cloud run by selecting the correct project (replace PROJECT-ID) and set the name of the instance such as ai-customer-review. You can find more information about the deployment on Google's guide - Deploying to. shell gcloud builds submit --tag gcr.io/PROJECT-ID/ai-customer-review gcloud run deploy --image gcr.io/PROJECT-ID/ai-customer-review --platform managed After a few minutes, you will also need to upgrade the memory allocated to your Cloud Run instance from 256 MB to 4 Gb. To do so, head over to the Cloud Run Console of your project. There you should find your instance, click on it. After that you will have a blue button labelled "edit and deploy new revision" on top of the screen, click on it and you'll be prompt many configuration fields. At the bottom you should find a "Capacity" section where you can specify the memory.
[ -0.009045401588082314, 0.004536499734967947, 0.02094799466431141, 0.04192730784416199, 0.07893777638673782, 0.12958627939224243, -0.04772908240556717, 0.04190655052661896, -0.02472629025578499, 0.022856177762150764, -0.032393865287303925, 0.05260149762034416, -0.06604056060314178, 0.06041167303919792, 0.0619729720056057, -0.08062861859798431, 0.08982838690280914, -0.04037976264953613, -0.05628098174929619, 0.011891639791429043, -0.03585356846451759, 0.011238270439207554, -0.007157245185226202, -0.009837324731051922, 0.014977793209254742, 0.011108996346592903, 0.01260269433259964, 0.0856713354587555, -0.040248531848192215, -0.049904681742191315, -0.05387631058692932, 0.005788331851363182, -0.025218205526471138, -0.02764129266142845, 0.005839749239385128, 0.08726079016923904, 0.004754763096570969, 0.003125149291008711, -0.023035982623696327, -0.02729087695479393, 0.0033846236765384674, 0.008255789056420326, -0.08622188121080399, 0.0826256275177002, -0.003690846962854266, 0.04789359122514725, -0.08046339452266693, -0.026654276996850967, -0.006619534455239773, -0.01518966443836689, -0.012998751364648342, -0.008462140336632729, -0.013618660159409046, -0.08873521536588669, 0.024565497413277626, 0.03612443804740906, -0.003776790341362357, -0.02272765524685383, -0.02856442518532276, 0.03558787330985069, 0.029617151245474815, -0.0035329642705619335, 0.0200542900711298, 0.045494358986616135, -0.031413380056619644, -0.02727479487657547, -0.00746467150747776, 0.024889791384339333, 0.01629778929054737, -0.012672158889472485, -0.0029612798243761063, -0.05723738670349121, 0.032260145992040634, -0.021135859191417694, -0.06977269798517227, -0.05353418365120888, 0.03307583928108215, 0.053758785128593445, 0.04622157663106918, 0.03294501453638077, 0.009947201237082481, 0.026767216622829437, -0.014030084013938904, -0.03453943505883217, 0.008541611023247242, -0.018079398199915886, 0.034769266843795776, 0.04719395935535431, -0.07311758399009705, 0.08025053143501282, 0.060458190739154816, -0.1183801144361496, -0.0051171132363379, 0.06402882933616638, 0.024513645097613335, 0.013449766673147678, 0.006341573782265186, -0.026432877406477928, 0.04094424843788147, 0.012880939058959484, -0.040354497730731964, 0.027642665430903435, -0.04418153315782547, 0.014805442653596401, -0.07767419517040253, 0.027974765747785568, 0.00022620335221290588, -0.06836037337779999, -0.013105855323374271, 0.0036363755352795124, 0.06196019425988197, 0.032925717532634735, -0.03860731050372124, 0.03509340062737465, -0.08412326872348785, 0.006343698129057884, -0.00023262537433765829, -0.0657443180680275, 0.024334004148840904, -0.0008292347774840891, 0.07553808391094208, 0.06947259604930878, 0.02882169373333454, -0.008185002952814102, -0.024804603308439255, 0.007491488475352526, -0.05265020951628685, -0.01923859678208828, -0.012663593515753746, -0.0920599177479744, 0.0235451627522707, -0.058496907353401184, 0.07052544504404068, -0.052600450813770294, -0.027553828433156013, -0.049887463450431824, 0.01294025406241417, -0.04298105090856552, 0.08362109959125519, 0.043070584535598755, 0.04040909931063652, 0.02179439179599285, -0.04718286544084549, 0.07011128962039948, 0.0770355835556984, 0.03029288724064827, -0.010315130464732647, -0.0372905507683754, -0.03817295283079147, 0.07621743530035019, -0.04540026932954788, 0.046724382787942886, -0.04997679591178894, -0.04366926848888397, 0.02590796910226345, 0.08462550491094589, -0.07117193937301636, 0.01814509555697441, -0.06517741084098816, 0.008511342108249664, -0.003808565903455019, 0.009864242747426033, -0.1323808878660202, 0.015812871977686882, 0.0009501559543423355, 0.025275645777583122, 0.06923066824674606, -0.03934784233570099, 0.02262319251894951, -0.09301236271858215, 0.022465046495199203, -0.09209601581096649, 0.05571423098444939, 0.05945620313286781, 0.08602670580148697, 0.057663194835186005, 0.07549747079610825, 0.06641131639480591, 0.009522246196866035, -0.0772642195224762, -0.0013255421072244644, 0.06878642737865448, -0.018203336745500565, 0.058846451342105865, -0.0343027338385582, -0.09558464586734772, -0.005071746185421944, -0.07431327551603317, 0.06261159479618073, -0.02411939576268196, -0.01188809797167778, -0.04595861956477165, -0.05145440623164177, -0.0036852750927209854, 0.04014364257454872, -0.0036576890852302313, 0.009509818628430367, 0.07892803102731705, 0.03438005596399307, 0.09450415521860123, -0.02586854062974453, 0.07677938044071198, 0.0419662669301033, -0.02864954061806202, -0.03918451815843582, 0.017920177429914474, -0.0030527254566550255, -0.0840214341878891, -0.005857023410499096, 0.0459032766520977, -0.044072527438402176, -0.03685183450579643, 0.03945351019501686, -0.04213102534413338, 0.022345691919326782, -0.03494071960449219, 0.002940154168754816, -0.03292495384812355, 0.050425995141267776, -0.009896895848214626, 0.1299782693386078, 0.036588460206985474, -0.03778945282101631, 0.039750661700963974, -0.034256406128406525, 0.006205291952937841, 0.022157341241836548, 0.08185625821352005, 0.06401114910840988, 0.007037352304905653, -0.02810484729707241, -0.04279455915093422, -0.06268055737018585, 0.030662253499031067, 0.0044944449327886105, 0.05523896589875221, 0.0232809167355299, -0.038463857024908066, 0.008013002574443817, -0.023593243211507797, -0.011026883497834206, -0.03324982896447182, -0.06697852909564972, 0.03330232948064804, 0.053064413368701935, 0.012776329182088375, 0.0685696005821228, 0.019851407036185265, 0.00707967858761549, -0.08496382087469101, -0.014567975886166096, -0.05950698256492615, -0.028996972367167473, -0.023772021755576134, 0.05260513722896576, 0.0019370961235836148, 0.004080547485500574, -0.006426333915442228, -0.03475870564579964, 0.051201559603214264, -0.03873391076922417, 0.040540359914302826, 0.008495362475514412, 0.005127736367285252, 0.014454567804932594, 0.04886847361922264, -0.038089290261268616, -0.029716741293668747, 0.000010023733921116218, -0.04051428288221359, -0.04770170897245407, 0.0030319022480398417, 0.011062543839216232, -0.01946895197033882, -0.006546155083924532, -0.01558674406260252, -0.03378544747829437, -0.016043489798903465, 0.0226913932710886, 0.044167160987854004, 0.03286364674568176, -0.03660222887992859, -0.0033034191001206636, 0.09542634338140488, 0.009040218777954578, 0.0043097250163555145, 0.014301970601081848, -0.07012205570936203, -0.05541902780532837, 0.0036442887503653765, -0.010495580732822418, 0.01237246859818697, 0.013819686137139797, 0.0072202845476567745, 0.02021525800228119, -0.01669917069375515, -0.00515877828001976, -0.027302779257297516, 0.020965613424777985, 0.08910294622182846, -0.020145032554864883, -0.004493198357522488, -0.004885067231953144, -0.021861456334590912, -0.04259165748953819, 0.016643226146697998, 0.02588833123445511, 0.009886691346764565, -0.08689315617084503, -0.011782616376876831, -0.008544269017875195, 0.02635456621646881, -0.03234250470995903, -0.02696971781551838, 0.05996439978480339, 0.030285898596048355, -0.004732981324195862, 0.01296586450189352, -0.013719012960791588, 0.019167855381965637, 0.007758099120110273, -0.00621061073616147, 0.0045566195622086525, 0.020435545593500137, 0.02974875643849373, -0.012238956987857819, -0.006419740151613951, -0.004627584479749203, -0.06235454976558685, 0.0029204036109149456, 0.03514976426959038, 0.013147503137588501, 0.04705950617790222, 0.005229865200817585, -0.013123488053679466, 0.04353880137205124, 0.004372395575046539, -0.017956528812646866, 0.022918395698070526, -0.020886022597551346, -0.014626776799559593, -0.014730623923242092, -0.08531901240348816, 0.01967150904238224, -0.03634283319115639, 0.017615923658013344, -0.00805706437677145, -0.011360159143805504, -0.0014294409193098545, 0.013992433436214924, 0.030995244160294533, -0.015069413930177689, 0.06429963558912277, -0.007475811522454023, 0.003951692022383213, 0.018157649785280228, 0.039394401013851166, 0.004304205533117056, -0.038480184972286224, -0.003523638704791665, 0.021680735051631927, 0.049097709357738495, -0.015243436209857464, -0.024310821667313576, 0.00786780659109354, 0.04336882010102272, -0.008965253829956055, 0.03793366625905037, -0.02126326784491539, -0.002598362509161234, 0.024095168337225914, 0.04697539657354355, 0.01613076962530613, -0.008222992531955242, 0.04282907396554947, -0.0016839703312143683, -0.00781792402267456, 0.024083659052848816, -0.03633962944149971, 0.04686332494020462, 0.011674785986542702, 0.0015411532949656248, -0.01388450525701046, -0.033552512526512146, -0.005476287100464106, 0.0020429303403943777, 0.02781052701175213, 0.06123703718185425, -0.0015136452857404947, 0.01419015508145094, -0.04146881774067879, 0.006810404360294342, -0.012464149855077267, 0.02025969699025154, 0.006920977961272001, -0.014838216826319695, 0.020724957808852196, 0.0098769161850214, 0.029589060693979263, -0.05607368052005768, 0.017521612346172333, -0.03476964682340622, -0.00625741109251976, -0.05289679765701294, 0.0336703360080719, 0.0026679185684770346, 0.01265428215265274, -0.01974494196474552, -0.011246851645410061, -0.0008315924787893891, 0.026875751093029976, 0.014332435093820095, 0.005217073485255241, -0.027981089428067207, -0.018940964713692665, -0.04407142475247383, -0.01350603997707367, 0.014386539347469807, 0.039448052644729614, -0.03164195641875267, -0.0020106863230466843, -0.030191853642463684, -0.027232138440012932, 0.061373643577098846, 0.019874779507517815, -0.03693702071905136, 0.0020627437625080347, 0.018757926300168037, 0.01122130174189806, -0.02051328681409359, -0.028565026819705963, 0.01580294594168663, -0.05420027673244476, 0.041395023465156555, 0.034439824521541595, 0.0015700699295848608, 0.00004423911013873294, 0.022166658192873, 0.00004067574263899587, -0.03363878279924393, 0.03175199404358864, -0.0325956717133522, -0.02860981412231922, -0.03254302963614464, -0.00644043879583478, 0.026807814836502075, -0.002298555104061961, 0.01968449354171753, -0.001421741209924221, -0.005265640094876289, 0.033429164439439774, -0.032346490770578384, -0.004959526471793652, 0.018435325473546982, -0.07094679027795792, 0.01754469983279705, -0.018941780552268028, 0.002949109999462962, -0.0009822630090638995, -0.013272063806653023, -0.007859556004405022, 0.04294688627123833, 0.008416143245995045, -0.025758417323231697, -0.01608932763338089, -0.0002459531824570149, 0.005131836049258709, 0.02430548705160618, -0.0034952645655721426, -0.01717965491116047, -0.018616434186697006, -0.006184173747897148, -0.008952281437814236, 0.07051241397857666, 0.045000799000263214, -0.06293876469135284, -0.029153870418667793, 0.02088838443160057, -0.027480611577630043, 0.015890829265117645, 0.009507394395768642, -0.04398239776492119, 0.0014043835690245032, 0.04927286505699158, 0.029205787926912308, 0.04251391813158989, 0.010777843184769154, 0.022930897772312164, -0.029438409954309464, -0.01610683836042881, -0.026799846440553665, -0.005692911799997091, -0.012661496177315712, 0.019883276894688606, 0.06451866775751114, 0.028825528919696808, 0.00018471806833986193, 0.01644439995288849, -0.030377468094229698, 0.005891460459679365, 0.016556529328227043, -0.018702929839491844, 0.012167534790933132, -0.023783639073371887, 0.0027198970783501863, 0.058665644377470016, -0.03525979071855545, -0.03767501190304756, 0.04026748985052109, 0.024269530549645424, -0.05804979428648949, -0.005677107721567154, 0.05421699583530426, 0.016713948920369148, 0.01975858211517334, 0.008119283244013786, 0.03603873401880264, 0.04418506845831871, -0.04570235311985016, -0.010989498347043991, -0.006721855606883764, -0.036610305309295654, -0.0115786362439394, 0.005358776077628136, -0.030701464042067528, 0.009384913370013237, 0.03362257406115532, -0.0019347254419699311, -0.04147946834564209, -0.011783129535615444, 0.0064849830232560635, 0.019704902544617653, -0.01086524035781622, 0.004899787716567516, 0.03487645834684372, 0.02146635577082634, -0.04439690336585045, -0.001955736894160509, 0.011191355995833874, -0.023578790947794914, -0.0080751683562994, 0.03330843150615692, 0.02140817791223526, 0.017508985474705696, 0.024713564664125443, -0.02222428470849991, 0.019505949690937996, -0.016147371381521225, -0.026204343885183334, -0.04531094431877136, -0.0312780998647213, -0.005629232153296471, -0.0390520803630352, 0.01643196865916252, 0.026727454736828804, -0.022254949435591698, 0.032822154462337494, -0.007963263429701328, 0.022465452551841736, 0.022117458283901215, 0.02457488141953945, -0.09210382401943207, -0.01239368412643671, -0.001212083618156612, -0.007540619466453791, 0.023381181061267853, -0.025308813899755478, 0.03190271556377411, 0.025464694947004318, -0.049550995230674744, -0.014379932545125484, 0.0029871198348701, 0.0035672211088240147, 0.004958086647093296, -0.009325125254690647, -0.04263869673013687, 0.01110842451453209, 0.04723802208900452, 0.025096101686358452, 0.031725265085697174, -0.006370155140757561, -0.007773873396217823, -0.021880289539694786, 0.005026145838201046, -0.010231941938400269, 0.024154549464583397, -0.013651050627231598, 0.05793753266334534, 0.014339890331029892, 0.0716961994767189, -0.0047281826846301556, -0.0028069387190043926, 0.002364284126088023, -0.01744302362203598, 0.06473615765571594, 0.01119275577366352, 0.029339944943785667, -0.009994098916649818, 0.0432087704539299, -0.011786988005042076, 0.003633851883932948, 0.02129269950091839, -0.038939498364925385, 0.00012160347978351638, -0.011260874569416046, 0.025041287764906883, 0.019058827310800552, -0.0037856644485145807, 0.03668910264968872, 0.04240709915757179, 0.02028941549360752, 0.005727321840822697, 0.01942279189825058, 0.03729292377829552, -0.011655810289084911, 0.0568423792719841, 0.031167510896921158, 0.012667164206504822, -0.019677521660923958, 0.03289971873164177, -0.020028499886393547, 0.050831880420446396, 0.02280377224087715, -0.0096215745434165, -0.02362123131752014, -0.03283972293138504, -0.032093074172735214, -0.007295271381735802, -0.015087233856320381, -0.0573195219039917, -0.02988414093852043, 0.03327128663659096, -0.039794471114873886, -0.0072814542800188065, -0.043084755539894104, -0.01215699128806591, 0.009521382860839367, -0.03981715068221092, -0.0368732213973999, 0.0043239411897957325, 0.0169233288615942, -0.019828999415040016, -0.05091407522559166, -0.0033915210515260696, -0.0353609137237072, -0.0004297111590858549, -0.056118495762348175, -0.00985639076679945, -0.039041969925165176, -0.010931157507002354, -0.02187359891831875, 0.028663255274295807, -0.01604567840695381, 0.01563730277121067, -0.0027113857213407755, 0.020117338746786118, -0.012268051505088806, 0.048281800001859665, 0.021249623969197273, 0.018303170800209045, 0.012228305451571941, -0.00489168893545866, -0.014712810516357422, -0.054160669445991516, -0.021424107253551483, -0.015436207875609398, -0.00808008573949337, -0.013536021113395691, 0.006339236628264189, -0.00947681162506342, 0.003606890793889761, -0.0006978765013627708, -0.002931531984359026, 0.01185325812548399, 0.030062315985560417, 0.009619825519621372, 0.039947759360075, 0.0015449621714651585, -0.0051093935035169125, 0.02901325561106205, 0.02447075955569744, -0.005049167666584253, -0.004203317686915398, -0.022423071786761284, 0.003936797380447388, 0.03738798573613167, -0.031369052827358246, 0.008201723918318748, 0.024708449840545654, -0.007263974752277136, 0.02865665964782238, 0.028222784399986267, -0.016115788370370865, 0.014350401237607002, -0.033504001796245575, 0.023236287757754326, -0.019830666482448578, 0.015614987351000309, -0.051906101405620575, -0.048289839178323746, -0.03765758126974106, -0.03462662547826767, -0.036559879779815674, 0.061537668108940125, -0.05754963308572769, -0.020471328869462013, 0.022613398730754852, -0.013599960133433342, -0.04074528440833092, 0.0016951124416664243, 0.04019489511847496, 0.09096269309520721, 0.023993292823433876, -0.017681047320365906, -0.003276519011706114, 0.035950127989053726, 0.0027107372879981995, 0.006016189698129892, 0.0052214753814041615, 0.02178969606757164, -0.006741310004144907, 0.008210179395973682, 0.033370304852724075, -0.0035832880530506372, -0.014110267162322998, 0.00848906859755516, -0.01937449723482132, -0.025773359462618828, -0.056008290499448776, 0.038454893976449966, -0.026981279253959656, 0.01034401822835207, 0.03770264610648155, -0.0386861152946949, -0.004219961818307638, 0.017414698377251625, -0.008184541016817093, -0.03790409490466118, -0.019508356228470802, 0.02199333719909191, -0.025683149695396423, 0.01410464197397232, -0.00440233526751399, -0.04532407596707344, 0.0075753009878098965, -0.03550181910395622, 0.037342485040426254, -0.015795178711414337, -0.026224514469504356, -0.013890896923840046, -0.023987455293536186, 0.05347367003560066, -0.02778736501932144, -0.022262509912252426, 0.006637453567236662, 0.013299361802637577, -0.025519996881484985, 0.00676142331212759, 0.049314551055431366, -0.004986498039215803, 0.008323236368596554, 0.005505056586116552, -0.020664319396018982, 0.0707353875041008, 0.05528388172388077, -0.018109677359461784, -0.02949988655745983, 0.013715456239879131 ]
My Journey to a serverless transformers pipeline on Google Cloud
Maxence
March 18, 2021
how-to-deploy-a-pipeline-to-google-clouds
guide
https://huggingface.co/blog/how-to-deploy-a-pipeline-to-google-clouds
Step 4 - Test on Cloud Run Lastly, I moved to Cloud Run with a docker image. I followed this guide to get an idea of how it works. In Cloud Run, I could configure a higher memory and more vCPUs to perform the prediction with PyTorch. I ditched Tensorflow as PyTorch seems to load the model faster.
[ 0.04419195279479027, -0.0436447411775589, 0.03250272199511528, 0.05224459990859032, 0.04674701392650604, 0.05221504718065262, -0.001945821801200509, 0.05512656271457672, -0.08015859872102737, -0.060760218650102615, -0.029423261061310768, 0.030767813324928284, -0.016218798235058784, 0.07916407287120819, 0.07716827094554901, -0.09924418479204178, 0.09369439631700516, -0.04969663918018341, 0.021652674302458763, 0.0277099572122097, -0.02801326848566532, -0.04213986173272133, -0.01861875131726265, -0.007852582260966301, -0.04200795292854309, -0.040896784514188766, -0.012004693038761616, 0.04058950021862984, -0.05562145262956619, -0.04553506150841713, -0.09408414363861084, 0.023228324949741364, 0.0072289095260202885, -0.02142227813601494, -0.012188631109893322, 0.05090361833572388, -0.08041612803936005, 0.06825946271419525, 0.005133866332471371, -0.053864769637584686, -0.0132597666233778, -0.00025156172341667116, -0.06290251016616821, 0.061874743551015854, -0.010018368251621723, 0.02018054947257042, -0.20227733254432678, 0.03824818134307861, -0.02813323214650154, -0.06648833304643631, -0.043238770216703415, 0.06111903488636017, -0.04222394526004791, -0.021263664588332176, 0.015782993286848068, 0.04653947800397873, -0.03260822966694832, -0.013612469658255577, 0.018991630524396896, 0.018538853153586388, 0.021326391026377678, 0.022661304101347923, -0.010173517279326916, 0.041643187403678894, -0.0177927203476429, -0.04350602626800537, 0.015527159906923771, 0.0007694477098993957, -0.028003692626953125, -0.0018647739198058844, -0.0009462357265874743, -0.02773701213300228, 0.025615865364670753, -0.021474923938512802, -0.028717821463942528, -0.053372930735349655, 0.002309096045792103, 0.03928306698799133, 0.09416169673204422, 0.0485270619392395, -0.020460767671465874, -0.005816570017486811, 0.02574215829372406, 0.02613990753889084, 0.03410229831933975, -0.004189085680991411, 0.028754007071256638, 0.0216042660176754, -0.050469771027565, 0.08730893582105637, 0.06285220384597778, -0.07546426355838776, 0.03897244110703468, 0.07784117013216019, -0.02541583962738514, 0.02334335818886757, 0.03166911005973816, -0.032190900295972824, -0.03288407251238823, -0.053456973284482956, 0.0052397469989955425, -0.05314483493566513, -0.04237591102719307, -0.011055303737521172, -0.04006940498948097, 0.06396551430225372, -0.0039894538931548595, -0.10587533563375473, -0.024613169953227043, 0.02145444042980671, 0.008363630622625351, 0.0504777692258358, -0.041861642152071, 0.0394776351749897, -0.0796494409441948, -0.004603441338986158, -0.022553829476237297, -0.0025514031294733286, 0.018217304721474648, -0.01647348143160343, 0.01370368804782629, 0.12947164475917816, 0.03752073645591736, -0.01672765053808689, -0.032532285898923874, 0.03185226023197174, 0.005368636921048164, -0.00983755849301815, -0.014185432344675064, -0.0371931791305542, 0.05936837196350098, -0.04369697347283363, 0.06925120949745178, -0.020884007215499878, 0.002172298962250352, -0.036075856536626816, -0.054996319115161896, -0.023176617920398712, 0.016887951642274857, 0.0056318421848118305, -0.0649520754814148, 0.0410575270652771, 0.004153970628976822, 0.09135784953832626, 0.04103513062000275, -0.0012871805811300874, -0.021703453734517097, 0.044121209532022476, -0.01853746548295021, 0.047696664929389954, -0.08993164449930191, 0.10764959454536438, -0.05406377092003822, -0.040172550827264786, -0.003763596061617136, 0.06069906800985336, -0.054517004638910294, -0.005087397526949644, -0.03825077414512634, -0.06076852232217789, 0.015336178243160248, 0.04152848944067955, -0.09837240725755692, -0.030784107744693756, 0.03862697258591652, 0.016519218683242798, 0.05308052897453308, -0.015018927864730358, 0.015549217350780964, -0.009868370369076729, 0.03664649277925491, -0.035754792392253876, 0.08174529671669006, 0.02930413745343685, 0.011868282221257687, 0.06676633656024933, 0.03685513511300087, 0.032363250851631165, -0.015390710905194283, -0.07811379432678223, -0.02981451340019703, 0.09551285952329636, -0.030990341678261757, 0.049243681132793427, 0.0062866308726370335, -0.0997576117515564, 0.02840447425842285, -0.04592052474617958, -0.005104531068354845, 0.04216407611966133, -0.029235465452075005, -0.03806028887629509, 0.04615223407745361, -0.0005283346399664879, 0.0647783875465393, -0.030772024765610695, 0.005202607251703739, 0.056844428181648254, 0.02364860661327839, 0.08981125056743622, 0.001731552998535335, 0.021856579929590225, 0.02222520299255848, -0.03309914097189903, -0.0045533692464232445, 0.008894531987607479, 0.04774303734302521, -0.06676795333623886, -0.016682075336575508, -0.04185278341174126, -0.016416411846876144, -0.12554189562797546, -0.011368345469236374, -0.054650358855724335, -0.010524215176701546, 0.004789111204445362, -0.06843507289886475, -0.01627981849014759, -0.014312523417174816, 0.015962786972522736, 0.1586257815361023, 0.006167988292872906, 0.01314337458461523, 0.007950326427817345, -0.0668560191988945, 0.04073050618171692, 0.017172805964946747, 0.026042263954877853, 0.06408567726612091, -0.06551282852888107, -0.03164030984044075, -0.08872845768928528, -0.046342313289642334, 0.06932146847248077, -0.019044142216444016, 0.01707754284143448, 0.008629458956420422, 0.0031888249795883894, 0.005991827230900526, -0.02078143320977688, 0.0011384044773876667, -0.026948081329464912, -0.028904903680086136, 0.08241152763366699, -0.01118493266403675, -0.07276890426874161, 0.07925169169902802, -0.0193039383739233, -0.03590867668390274, -0.08644574135541916, -0.018468983471393585, -0.0006446765619330108, -0.021952012553811073, -0.0001736869162414223, 0.08583226054906845, 0.022098256275057793, -0.00788835994899273, 0.0005292023997753859, -0.01902967505156994, 0.04841357097029686, -0.0024439729750156403, 0.012970770709216595, 0.025273848325014114, -0.012472769245505333, 0.026874437928199768, 0.0013925343519076705, -0.005606530699878931, -0.045447029173374176, 0.045054297894239426, 0.013403582386672497, -0.015942221507430077, -0.058874115347862244, 0.04949759691953659, -0.008733324706554413, 0.006111194845288992, 0.013211999088525772, 0.013036058284342289, -0.036759961396455765, -0.00016681340639479458, 0.0013363778125494719, -0.00411498686298728, -0.03389155492186546, 0.058048732578754425, 0.031336840242147446, 0.013465200550854206, -0.004497507121413946, 0.008432378992438316, -0.04070621356368065, -0.03660959377884865, 0.014426261186599731, -0.010661524720489979, 0.03266853839159012, 0.02411676198244095, -0.0020970336627215147, 0.021012285724282265, 0.005814450792968273, 0.020887155085802078, -0.01002963725477457, -0.028156187385320663, 0.038140006363391876, -0.05083341524004936, 0.002952566836029291, -0.03328390792012215, -0.0326002761721611, -0.040608253329992294, 0.008138896897435188, 0.03317955136299133, 0.02007746696472168, -0.10774865001440048, -0.003252219408750534, 0.020726513117551804, 0.020436225458979607, -0.03214540332555771, -0.014083337970077991, 0.05201077088713646, 0.034466322511434555, 0.014130648225545883, 0.01582653820514679, -0.015752356499433517, 0.026311315596103668, 0.007671642117202282, 0.004723868798464537, -0.015498603694140911, 0.023682473227381706, 0.03342191129922867, 0.0178073737770319, 0.021858572959899902, 0.01671782322227955, -0.03627772256731987, 0.04199906438589096, 0.006354274228215218, 0.010347374714910984, -0.0026668303180485964, 0.017444908618927002, 0.013625092804431915, 0.059178680181503296, -0.017014198005199432, -0.007920170202851295, -0.03673446923494339, -0.03708071634173393, 0.00943696964532137, 0.03511374443769455, -0.0379718542098999, 0.012355489656329155, -0.019672539085149765, 0.015425236895680428, 0.017197659239172935, 0.03857288882136345, 0.014412989839911461, 0.0038843355141580105, 0.03585714474320412, -0.00102651072666049, 0.05133410543203354, 0.027243949472904205, -0.004128347150981426, 0.0032419513445347548, 0.043651141226291656, -0.014058452099561691, -0.058794718235731125, -0.004303945694118738, 0.000953204114921391, 0.07001566886901855, 0.010980790480971336, -0.015463077463209629, -0.01720678247511387, 0.0628860592842102, 0.018677610903978348, 0.0044227647595107555, -0.03510157763957977, -0.0061656334437429905, 0.059383783489465714, -0.002415117109194398, -0.013481314294040203, -0.013300585560500622, 0.04975971207022667, 0.027133919298648834, -0.02858472801744938, 0.004746343474835157, -0.022996369749307632, 0.022733736783266068, -0.000298081838991493, 0.005710762459784746, -0.02983388863503933, -0.012339816428720951, -0.014421889558434486, -0.016532065346837044, 0.08363211899995804, 0.03920597583055496, -0.011396560817956924, -0.01811670884490013, -0.009510794654488564, -0.005207363050431013, 0.030228126794099808, 0.025829067453742027, -0.015296787954866886, -0.02990063652396202, 0.005486129317432642, 0.03491993993520737, 0.050818413496017456, -0.03521237149834633, 0.020870178937911987, -0.006650455761700869, 0.008097520098090172, 0.0025773015804588795, 0.040400419384241104, 0.01799800433218479, -0.0005425736308097839, 0.014534136280417442, 0.006875013932585716, -0.015488655306398869, 0.019959108904004097, 0.006873975973576307, 0.012918077409267426, -0.011424954980611801, -0.002351320581510663, -0.00009096256690099835, 0.02226555533707142, -0.015997501090168953, 0.03412714973092079, -0.003956951666623354, 0.024263188242912292, -0.04131382703781128, 0.007159672677516937, 0.031023338437080383, 0.029589174315333366, -0.018962524831295013, -0.016092190518975258, 0.03014352172613144, -0.018994534388184547, 0.03771235793828964, -0.03393850475549698, -0.015269690193235874, -0.031150029972195625, -0.0005918310489505529, 0.014056977815926075, 0.027602294459939003, -0.010820533148944378, -0.017284588888287544, -0.024389002472162247, -0.016567891463637352, 0.03231174126267433, 0.008911377750337124, 0.011507734656333923, -0.04449501633644104, 0.01748369261622429, -0.011147789657115936, -0.012375269085168839, -0.030301976948976517, -0.03459026291966438, -0.001977793639525771, 0.015897801145911217, -0.017879102379083633, -0.00430793222039938, 0.00904763862490654, -0.07913881540298462, 0.032793980091810226, -0.03922669589519501, 0.01191007997840643, 0.012660658918321133, -0.026137234643101692, -0.037950899451971054, 0.033377595245838165, 0.021997958421707153, -0.010411743074655533, -0.010056301951408386, 0.02771599031984806, 0.01220608875155449, 0.03902662917971611, 0.018053073436021805, -0.011440197005867958, -0.02176838368177414, 0.0029443318489938974, 0.002436626935377717, 0.02516036480665207, 0.016375921666622162, -0.08302510529756546, -0.019713276997208595, -0.011794619262218475, -0.045480478554964066, -0.02523818053305149, -0.009164548479020596, -0.04672745615243912, 0.007364711724221706, 0.055020108819007874, 0.00715362373739481, 0.018941305577754974, 0.008115757256746292, 0.03803505003452301, -0.005055197514593601, -0.00627821683883667, -0.00001760184568411205, -0.009250689297914505, -0.008915912359952927, 0.05129922926425934, 0.04505039006471634, 0.009797324426472187, 0.01634129136800766, 0.036423031240701675, -0.009127584286034107, 0.006526685319840908, -0.0030455829109996557, -0.04109393060207367, 0.055833600461483, 0.005321789998561144, 0.0017963950522243977, 0.04807613417506218, -0.020649343729019165, -0.005792370531708002, 0.009027985855937004, 0.024760421365499496, -0.03636758774518967, -0.0029150599148124456, 0.07366623729467392, 0.02285957522690296, -0.006026959512382746, 0.026236649602651596, 0.05331612378358841, -0.011889309622347355, 0.010334523394703865, 0.01275696698576212, -0.01120803039520979, -0.01766565814614296, 0.0015952411340549588, -0.012705264613032341, -0.016250912100076675, 0.045609474182128906, 0.02621660754084587, 0.027601391077041626, -0.016001347452402115, -0.016933202743530273, -0.003353629494085908, -0.019914500415325165, 0.023762274533510208, -0.0037819661665707827, -0.006743880920112133, 0.016914740204811096, -0.03549991920590401, 0.028297828510403633, 0.026944417506456375, 0.00976831279695034, 0.001565636950545013, 0.02108270861208439, 0.037884633988142014, -0.011570732109248638, 0.025360574945807457, 0.039153214544057846, 0.0008750800043344498, -0.035789817571640015, -0.03672352805733681, -0.044646017253398895, -0.016611894592642784, 0.007797544356435537, -0.05460453778505325, 0.002662464277818799, 0.07024140655994415, -0.009804586879909039, 0.021510427817702293, -0.010917344130575657, 0.03137349337339401, 0.005858464632183313, 0.031046738848090172, -0.05016832798719406, 0.00842963345348835, -0.0022121937945485115, -0.0009809012990444899, -0.03446153178811073, -0.027382923290133476, 0.013488729484379292, 0.03263558819890022, -0.045413896441459656, 0.004607342649251223, 0.014164548367261887, -0.035168033093214035, 0.017918173223733902, 0.017044106498360634, -0.042621366679668427, -0.01967514492571354, 0.026812003925442696, 0.0738493874669075, 0.03742705285549164, -0.012670761905610561, 0.002656490309163928, 0.013682170771062374, 0.013121710158884525, 0.002341028768569231, 0.05286785960197449, -0.007697358727455139, 0.05214744806289673, 0.010252240113914013, 0.06387706845998764, -0.013538516126573086, 0.004941367078572512, -0.014913016930222511, 0.0018674636958166957, 0.057911865413188934, -0.009729825891554356, 0.02455422654747963, 0.026806779205799103, 0.011442827992141247, -0.013035930693149567, -0.020937109366059303, -0.03224258869886398, -0.03715931624174118, -0.018682483583688736, -0.00353925209492445, 0.004628286696970463, 0.007901705801486969, -0.04800195246934891, 0.027296289801597595, 0.05729813128709793, 0.05766241252422333, -0.028446514159440994, 0.004536682274192572, 0.028592176735401154, 0.024993356317281723, 0.028180602937936783, 0.026338165625929832, 0.0007126075215637684, 0.004018857143819332, 0.04288814961910248, -0.008096483536064625, 0.037897106260061264, 0.005970311816781759, 0.005740768741816282, 0.03488893806934357, 0.00016898158355616033, -0.021903496235609055, 0.0026770534459501505, 0.014150531962513924, -0.013914855197072029, -0.005918440874665976, 0.042206957936286926, -0.055953338742256165, -0.029615458101034164, -0.013526891358196735, -0.026544369757175446, -0.03082432597875595, -0.02246280200779438, -0.04135209321975708, 0.04659275338053703, -0.00013126635167282075, -0.016660895198583603, -0.0196275245398283, -0.019147656857967377, 0.006496736314147711, 0.004753309767693281, -0.024800267070531845, -0.028998594731092453, -0.014412209391593933, 0.007344839163124561, -0.027995647862553596, 0.04171987250447273, -0.0283821988850832, -0.0029423125088214874, 0.016901815310120583, 0.014027483761310577, -0.02465704269707203, 0.024275414645671844, 0.03369222581386566, 0.017293207347393036, 0.011057980358600616, 0.008106125518679619, -0.00536772795021534, -0.052686452865600586, -0.010038906708359718, -0.006899020168930292, -0.00652686832472682, -0.024681517854332924, 0.02819017320871353, 0.004936558660119772, -0.001711096498183906, -0.010816183872520924, -0.02935115247964859, 0.004550458397716284, -0.009222415275871754, -0.013209073804318905, 0.017348527908325195, 0.00946389976888895, -0.012106041423976421, 0.010084646753966808, -0.006868596188724041, -0.011329498142004013, -0.009206753224134445, -0.0074457935988903046, 0.028637228533625603, 0.007092208601534367, -0.01740141212940216, 0.00985041819512844, 0.05336398631334305, 0.014523726888000965, 0.002705050865188241, 0.06465521454811096, 0.001539391465485096, 0.03843562304973602, -0.046466901898384094, 0.045379240065813065, -0.033567700535058975, 0.02471446618437767, -0.04352010786533356, -0.0659778043627739, -0.007616402581334114, -0.011532701551914215, -0.045076265931129456, 0.019339246675372124, -0.05293209105730057, -0.0225745290517807, -0.022968297824263573, -0.0009873972740024328, -0.04707138612866402, -0.012457179836928844, 0.052797552198171616, 0.06844215095043182, 0.004962938837707043, 0.011088310740888119, -0.023321278393268585, 0.03185109794139862, -0.03661326691508293, 0.051100749522447586, 0.01804114133119583, 0.01961728371679783, -0.00965290516614914, -0.02114330232143402, 0.05318203940987587, 0.010862831026315689, -0.034653689712285995, -0.012831582687795162, 0.006055091507732868, -0.02923695370554924, -0.04226825758814812, -0.0004553052131086588, 0.013116370886564255, 0.0006034923135302961, 0.06585678458213806, -0.026938892900943756, -0.030775872990489006, -0.006304647773504257, 0.005618617869913578, -0.051303330808877945, -0.04208225756883621, -0.004526767414063215, -0.03608103096485138, 0.008261816576123238, 0.006872264668345451, 0.024551987648010254, -0.013703618198633194, -0.03339037299156189, 0.00919475220143795, -0.016841329634189606, -0.032447442412376404, -0.04787960276007652, -0.02576407417654991, 0.03429524973034859, -0.017429308965802193, -0.02263372763991356, 0.035206396132707596, -0.019232669845223427, -0.031370148062705994, -0.004564186558127403, -0.007483627647161484, 0.04611953720450401, -0.010961264371871948, 0.04145612195134163, -0.005956864915788174, 0.07256753742694855, 0.03709857910871506, -0.010392562486231327, 0.00012740153761114925, 0.021211575716733932 ]
My Journey to a serverless transformers pipeline on Google Cloud
Maxence
March 18, 2021
how-to-deploy-a-pipeline-to-google-clouds
guide
https://huggingface.co/blog/how-to-deploy-a-pipeline-to-google-clouds
Step 3 - Test on App Engine I moved to Google's App Engine as it's a service that I am familiar with, but encountered an installation issue with TensorFlow due to a missing system dependency file. I then tried with PyTorch which worked with an F4_1G instance, but it couldn't handle more than 2 requests on the same instance, which isn't really great performance-wise.
[ 0.03253432735800743, -0.03446003049612045, 0.0751931294798851, 0.0981622189283371, 0.03874850645661354, 0.09397951513528824, 0.05334199592471123, 0.02160569652915001, -0.03641023486852646, -0.0748772844672203, -0.03562119975686073, 0.07468792051076889, -0.02169865369796753, 0.01836485043168068, 0.029700685292482376, -0.04885483533143997, 0.0846487507224083, -0.06383274495601654, -0.033148519694805145, -0.002674501622095704, -0.03741613030433655, -0.021110011264681816, 0.009468832984566689, 0.03683694824576378, -0.044524312019348145, -0.05190163850784302, -0.04141727089881897, 0.05185246467590332, -0.08973436802625656, -0.011843470856547356, -0.05897361412644386, 0.02389919012784958, 0.002042831853032112, -0.03576657548546791, -0.018595639616250992, 0.024529939517378807, -0.06407976150512695, 0.025783348828554153, 0.043875668197870255, -0.03930066153407097, 0.008964808657765388, -0.006595842074602842, -0.10642112791538239, 0.05665953829884529, -0.03145072981715202, 0.07135378569364548, -0.19292910397052765, 0.057936955243349075, -0.02401822805404663, -0.020867837592959404, -0.11078761518001556, 0.04182763025164604, 0.04776199907064438, -0.08415132015943527, 0.040389515459537506, 0.043122950941324234, 0.007865888997912407, 0.017673302441835403, 0.0023942815605551004, 0.03584018722176552, 0.09425048530101776, 0.020018145442008972, 0.005738937295973301, 0.028177784755825996, -0.020626692101359367, -0.019787732511758804, 0.02030317857861519, 0.013409643433988094, -0.013770431280136108, -0.01586143672466278, 0.06242363527417183, -0.08815981447696686, -0.026600124314427376, 0.007211006712168455, 0.0036119550932198763, -0.08354472368955612, 0.061300359666347504, -0.002976259682327509, 0.04114578291773796, 0.07996558398008347, -0.03196072578430176, 0.024589218199253082, 0.04070727154612541, 0.021951502189040184, 0.04702014848589897, -0.0020462058018893003, 0.039692770689725876, -0.0027702979277819395, 0.007167980074882507, 0.05083608999848366, 0.06770467013120651, -0.10743112117052078, 0.003213950665667653, 0.05772856995463371, -0.014714371412992477, -0.005012014415115118, 0.026134729385375977, 0.00748760299757123, 0.01409207284450531, -0.026771152392029762, -0.043603602796792984, -0.0530887246131897, -0.04298277199268341, -0.037278641015291214, -0.04080135375261307, 0.04921703040599823, -0.008637704886496067, -0.07078753411769867, -0.04026028513908386, 0.014605515636503696, 0.0015517190331593156, 0.07084010541439056, -0.009908315725624561, 0.05561916530132294, -0.07856485992670059, 0.022738903760910034, -0.02083725482225418, -0.02808096632361412, 0.017056765034794807, 0.008896170184016228, 0.04586978629231453, 0.12053149938583374, 0.002499281195923686, 0.006369840819388628, 0.050722770392894745, 0.058004461228847504, 0.033213116228580475, -0.0021479062270373106, -0.07223586738109589, -0.05074863135814667, 0.046164270490407944, -0.00858987309038639, 0.09461462497711182, -0.015547104179859161, 0.014173424802720547, -0.022686196491122246, -0.02191704697906971, 0.008363042958080769, -0.02262500859797001, 0.01058240793645382, -0.02513105422258377, 0.026279844343662262, -0.005491544492542744, 0.07935816049575806, 0.05114518851041794, -0.04328570514917374, -0.02093442529439926, 0.0038422856014221907, 0.03234272450208664, -0.05557166039943695, -0.0712924525141716, 0.08298804610967636, -0.04586101323366165, 0.011743014678359032, -0.006514203269034624, 0.039456699043512344, -0.015833619982004166, -0.026606988161802292, -0.023151353001594543, -0.060562167316675186, -0.005673171486705542, -0.024803489446640015, -0.09355176240205765, -0.02180667780339718, 0.025344185531139374, -0.04751529544591904, 0.053606338798999786, -0.022603193297982216, -0.020485984161496162, -0.0386793278157711, -0.03421966731548309, -0.03586697205901146, 0.05489780753850937, 0.019841114059090614, -0.021234147250652313, 0.03356311842799187, 0.06795196980237961, 0.04436535760760307, 0.04255751147866249, -0.030150361359119415, -0.03636375069618225, 0.027537548914551735, 0.004632097203284502, -0.000497976376209408, 0.009836329147219658, -0.08693017810583115, 0.030382944270968437, -0.055712100118398666, 0.041052501648664474, 0.04161829873919487, -0.039357151836156845, -0.043019525706768036, 0.06472169607877731, -0.02205771952867508, 0.07444749027490616, 0.013392649590969086, -0.011207126080989838, 0.09612686932086945, 0.03502614423632622, 0.032922517508268356, 0.05024214833974838, 0.020057599991559982, 0.015868142247200012, -0.019649863243103027, 0.0018612289568409324, -0.003467109752818942, 0.03382626175880432, -0.08651295304298401, -0.0197262205183506, -0.015380227006971836, 0.011077644303441048, -0.14820624887943268, -0.005290262866765261, -0.05588270723819733, -0.023084821179509163, -0.015735894441604614, -0.01676436886191368, 0.01686115749180317, 0.01674492470920086, -0.000667900312691927, 0.13631826639175415, -0.038147199898958206, -0.0046295528300106525, -0.029924850910902023, -0.07062683254480362, 0.03838289901614189, 0.07019194960594177, 0.005349811166524887, 0.0834612250328064, -0.11713147163391113, 0.0028908809181302786, -0.0557858906686306, -0.03053182177245617, 0.07030914723873138, 0.011027399450540543, 0.016844699159264565, -0.006099591962993145, -0.001450939103960991, 0.04509382322430611, -0.0399915911257267, 0.035922881215810776, 0.0314880833029747, -0.02127360738813877, 0.04256280139088631, -0.0655447319149971, -0.034124795347452164, 0.04861923307180405, -0.0052596041932702065, -0.01146832387894392, -0.10645509511232376, -0.024577880278229713, -0.017447374761104584, 0.009738022461533546, 0.024236075580120087, 0.08512356132268906, -0.024323001503944397, 0.002771277679130435, -0.007627868093550205, 0.01895418018102646, 0.013808117248117924, 0.01984296180307865, 0.011527745984494686, -0.0025984891690313816, -0.02319319173693657, 0.02077639289200306, -0.021571284160017967, -0.02740187756717205, -0.07201223075389862, 0.015205641277134418, -0.009376754984259605, 0.0006903751054778695, -0.0471344068646431, 0.03719381242990494, 0.014090700075030327, -0.0023943136911839247, 0.05374634638428688, 0.02962261065840721, -0.0019628664012998343, -0.01029246672987938, -0.035272326320409775, 0.005094690248370171, -0.03226616233587265, 0.07253067940473557, 0.006380412727594376, 0.0031534398440271616, -0.014527029357850552, 0.01338149979710579, -0.006860767025500536, -0.028729023411870003, 0.030041467398405075, -0.011388249695301056, 0.04668540135025978, 0.01784447766840458, -0.005179747007787228, 0.012233639135956764, 0.014057949185371399, -0.002871196949854493, -0.03364412114024162, -0.030292565003037453, 0.04017067700624466, -0.024919843301177025, 0.005354289431124926, -0.009538168087601662, -0.026901045814156532, -0.04467250034213066, 0.0020905162673443556, 0.0027413482312113047, -0.0032820829655975103, -0.12257376313209534, -0.03372769057750702, -0.013320155441761017, 0.04848262667655945, -0.024644745513796806, -0.025993872433900833, 0.048899296671152115, 0.011009318754076958, 0.011770744808018208, 0.017590943723917007, -0.048632677644491196, 0.005697503685951233, 0.016427595168352127, 0.006594741251319647, -0.01626845821738243, 0.01269656140357256, 0.01084883976727724, 0.04578426480293274, 0.026469700038433075, 0.019081231206655502, -0.04265967383980751, 0.04708423092961311, 0.011641518212854862, 0.01151191908866167, -0.020890772342681885, 0.0274231918156147, -0.005227595567703247, 0.04883274435997009, -0.00999935157597065, -0.01142212189733982, -0.027121519669890404, -0.018531493842601776, -0.010715039446949959, 0.02890276350080967, -0.035670820623636246, -0.0011780333006754518, -0.05174294486641884, -0.007507112808525562, 0.03244713693857193, 0.013141253963112831, 0.003289667656645179, 0.01060151495039463, 0.03343052789568901, -0.024674134328961372, 0.00384914199821651, 0.009020882658660412, -0.0010716271353885531, -0.013562706299126148, 0.0694388598203659, -0.03284696489572525, -0.05672238767147064, -0.004110756795853376, -0.016060631722211838, 0.039572980254888535, -0.007760327775031328, -0.0010249639162793756, -0.020794430747628212, 0.030692117288708687, 0.06992743909358978, -0.001280959346331656, -0.024936795234680176, 0.006644962355494499, 0.027925856411457062, 0.018381129950284958, -0.03603493049740791, 0.04505854845046997, 0.033923353999853134, -0.009847643785178661, -0.038516540080308914, -0.006036651320755482, -0.03988552838563919, 0.05949007347226143, 0.01578286662697792, 0.007212353870272636, 0.002664259634912014, -0.0014737979508936405, 0.009736422449350357, -0.006110493093729019, 0.06977469474077225, 0.03270513191819191, -0.004598047584295273, -0.016209861263632774, -0.020131155848503113, -0.0420648455619812, 0.0022498660255223513, 0.0354037843644619, -0.02430657669901848, -0.011515536345541477, 0.030557336285710335, 0.04301883652806282, 0.01820315420627594, -0.026756441220641136, 0.06452637910842896, 0.004435677081346512, -0.004367998335510492, 0.014598436653614044, 0.050380121916532516, 0.007450655102729797, -0.004852591548115015, 0.031032653525471687, 0.012902678921818733, 0.0056601520627737045, -0.004585260059684515, 0.04762662202119827, 0.001209020847454667, 0.01323920302093029, -0.024094657972455025, -0.025164064019918442, 0.02703368477523327, 0.01922096312046051, 0.02020537666976452, -0.010646119713783264, 0.00011109936895081773, -0.048055633902549744, -0.006019045133143663, 0.03265189006924629, -0.0024422246497124434, -0.02900386042892933, -0.00941141415387392, 0.039214249700307846, -0.021283522248268127, 0.033390112221241, 0.025528699159622192, -0.020084042102098465, 0.0027622911147773266, -0.021887287497520447, 0.035243213176727295, 0.013641082681715488, 0.0038114874623715878, 0.004141045268625021, -0.05689452588558197, -0.02109563536942005, 0.028862884268164635, 0.008484828285872936, 0.020218221470713615, -0.0399339385330677, 0.02466564252972603, 0.02730644680559635, -0.025990942493081093, -0.017515739426016808, -0.019141636788845062, 0.059060897678136826, 0.005258336663246155, -0.05752585083246231, 0.02919718809425831, 0.0183075163513422, -0.0033319348003715277, 0.023021366447210312, -0.056730903685092926, 0.019130559638142586, 0.020094728097319603, -0.04406169056892395, -0.04324483871459961, 0.060494985431432724, 0.0021300907246768475, 0.004960578866302967, 0.006825277581810951, 0.03593829646706581, 0.007908772677183151, 0.0668283998966217, 0.008030576631426811, -0.026846466585993767, -0.017930202186107635, 0.0036275519523769617, -0.0296662375330925, 0.0012227129191160202, 0.010599572211503983, -0.05647352337837219, -0.0102633535861969, -0.01123744435608387, -0.018862441182136536, 0.0022533934097737074, -0.003931858576834202, -0.016632765531539917, 0.0328088216483593, 0.0417780764400959, -0.003083855612203479, 0.020059859380126, 0.007072525564581156, 0.020725054666399956, -0.0005008145817555487, -0.020600060001015663, 0.038516148924827576, -0.0031681556720286608, 0.0278096292167902, 0.026168595999479294, 0.031608808785676956, 0.022576112300157547, 0.02655770257115364, 0.04504188150167465, -0.03699544072151184, 0.0006506254430860281, 0.029995949938893318, -0.021570228040218353, 0.02449706196784973, -0.019146442413330078, -0.003631524508818984, 0.0456942580640316, -0.0001574627385707572, -0.0224059596657753, 0.005563556682318449, 0.0226843673735857, -0.004218866117298603, -0.030179116874933243, 0.06132248789072037, -0.009694493375718594, -0.002234183019027114, -0.012798583135008812, 0.06543589383363724, -0.034604739397764206, 0.005807230249047279, 0.030952855944633484, -0.05505511909723282, -0.019964328035712242, -0.024018744006752968, -0.021017199382185936, -0.03331189975142479, 0.0451369471848011, -0.002215877640992403, 0.02667306363582611, -0.03740224242210388, -0.006535966414958239, 0.01630432717502117, 0.042176492512226105, 0.03959771990776062, -0.0008805891848169267, -0.02041548863053322, 0.00527304457500577, -0.044681333005428314, 0.032267533242702484, 0.05086974799633026, 0.010336513631045818, -0.010654633864760399, -0.0018106484785676003, 0.03907163441181183, -0.0031466882210224867, 0.04959483444690704, 0.0027587611693888903, 0.03215790167450905, -0.01408711913973093, -0.020774589851498604, 0.00033458153484389186, -0.026289572939276695, 0.01932365447282791, -0.006208883598446846, 0.029720008373260498, 0.06500612199306488, 0.012424387969076633, 0.002404669299721718, -0.0007616732618771493, 0.03445586934685707, 0.019185692071914673, 0.01789126731455326, -0.02511782944202423, 0.012367249466478825, -0.008947685360908508, 0.02401875890791416, -0.005865249317139387, -0.004752141423523426, 0.006809931248426437, 0.017289157956838608, -0.016848472878336906, -0.0013446903321892023, -0.010183907113969326, -0.017739059403538704, 0.015184427611529827, 0.006622417829930782, -0.04909467697143555, -0.02995488978922367, -0.0069838641211390495, 0.03885678946971893, 0.05274226516485214, 0.025679083541035652, -0.006269603502005339, 0.013464618474245071, -0.0039324150420725346, -0.0024291749577969313, 0.03900827094912529, 0.017096232622861862, 0.0403614342212677, -0.004239445086568594, 0.03389805182814598, 0.0069103664718568325, -0.02941042371094227, -0.002203710377216339, -0.015378665179014206, 0.04143306612968445, 0.009138449095189571, 0.022174730896949768, 0.03300924226641655, -0.0014256865251809359, -0.017701363191008568, -0.00571840163320303, 0.02907732129096985, -0.035416457802057266, -0.013176302425563335, 0.01715451292693615, -0.01956251636147499, 0.00645090825855732, -0.03570840135216713, 0.017316048964858055, 0.0347747802734375, 0.06062298268079758, -0.01259349100291729, 0.0025688139721751213, 0.03232547640800476, 0.00929154735058546, 0.0035605195444077253, 0.015420535579323769, -0.016076579689979553, -0.02429375983774662, 0.013399885036051273, -0.004511016886681318, 0.04781665652990341, -0.055368732661008835, -0.013944102451205254, 0.017038900405168533, 0.019420599564909935, -0.0015295196790248156, 0.02957991138100624, 0.03793579712510109, 0.004748843610286713, -0.003251502988860011, -0.0006886824849061668, -0.041530150920152664, -0.030193135142326355, -0.042702920734882355, 0.0024557607248425484, -0.031111696735024452, -0.023133426904678345, -0.009364739060401917, 0.01876341737806797, 0.006931591313332319, -0.0025700880214571953, -0.022507591173052788, -0.010120805352926254, -0.004439609590917826, -0.014631509780883789, -0.04024934768676758, 0.0076498300768435, -0.019703108817338943, -0.0006253980682231486, 0.005719097796827555, -0.0025505011435598135, -0.023593490943312645, 0.009450532495975494, 0.04598165675997734, 0.011837243102490902, -0.01507280021905899, 0.011376863345503807, 0.0342889130115509, 0.006128881126642227, -0.015596356242895126, 0.03438509255647659, -0.05566563084721565, -0.05872882530093193, 0.017739418894052505, -0.03321829065680504, 0.003869081614539027, -0.027125108987092972, 0.04304569959640503, -0.011452309787273407, 0.02247569151222706, -0.011646417900919914, -0.06899659335613251, -0.004637955687940121, -0.018486730754375458, -0.039924077689647675, 0.022913150489330292, 0.015255438163876534, -0.03103671781718731, -0.008717554621398449, 0.03890735283493996, -0.0036309610586613417, -0.015398448333144188, -0.033151719719171524, -0.021875660866498947, 0.00581351900473237, -0.012792278081178665, -0.02088814787566662, 0.0612645260989666, 0.03570578992366791, 0.04453914240002632, 0.0023728220257908106, 0.006222045049071312, -0.0032229076605290174, -0.031223803758621216, 0.02137831784784794, -0.03859884664416313, 0.018955172970891, -0.03842368721961975, -0.08012260496616364, -0.03578639030456543, -0.025907818228006363, 0.0022436436265707016, 0.014938737265765667, -0.046948712319135666, -0.01538276020437479, -0.007612340617924929, 0.013128770515322685, -0.04425528272986412, -0.023834217339754105, 0.03851224109530449, 0.035489000380039215, -0.014903802424669266, 0.010590638965368271, -0.014399833045899868, 0.01861618459224701, 0.01975424401462078, 0.037525806576013565, 0.018188292160630226, 0.032946620136499405, 0.0005011846078559756, -0.016139142215251923, 0.03318417817354202, -0.005518512800335884, -0.024925481528043747, -0.02542579546570778, 0.009427363984286785, -0.004202025011181831, -0.030835146084427834, -0.008741375058889389, -0.022075558081269264, 0.00972446333616972, 0.03326795622706413, -0.017488667741417885, -0.026018954813480377, 0.009618313983082771, -0.008555459789931774, -0.04699113219976425, -0.03556116670370102, 0.03340640291571617, -0.016217246651649475, -0.004322987515479326, 0.01673990488052368, 0.002731418702751398, 0.012819945812225342, -0.009575980715453625, 0.026164332404732704, 0.010504085570573807, -0.06421052664518356, -0.013804072514176369, -0.01330123096704483, 0.06205882132053375, -0.028947796672582626, -0.04396995157003403, 0.02680061198771, 0.011069344356656075, -0.04302272945642471, -0.0007032561697997153, 0.00775608466938138, -0.0020883006509393454, -0.020072614774107933, 0.03422444686293602, -0.01509694755077362, 0.05580075830221176, 0.020129447802901268, -0.009782343171536922, -0.008508101105690002, 0.034303825348615646 ]
My Journey to a serverless transformers pipeline on Google Cloud
Maxence
March 18, 2021
how-to-deploy-a-pipeline-to-google-clouds
guide
https://huggingface.co/blog/how-to-deploy-a-pipeline-to-google-clouds
Costs I simulated the cost based on the Cloud Run instance configuration with Google pricing simulator For my micro-service, I am planning to near 1,000 requests per month, optimistically. 500 may more likely for my usage. That's why I considered 2,000 requests as an upper bound when designing my microservice. Due to that low number of requests, I didn't bother so much regarding the scalability but might come back into it if my billing increases. Nevertheless, it's important to stress that you will pay the storage for each Gigabyte of your build image. It's roughly €0.10 per Gb per month, which is fine if you don't keep all your versions on the cloud since my version is slightly above 1 Gb (Pytorch for 700 Mb & the model for 250 Mb).
[ 0.0009511676034890115, 0.08293738961219788, 0.028286313638091087, 0.0714789479970932, -0.01683465763926506, 0.10011258721351624, 0.09644709527492523, 0.03596936911344528, -0.005594985093921423, -0.008050058968365192, -0.011786768212914467, 0.0002878502709791064, -0.04081393778324127, 0.03475244343280792, 0.04085801541805267, -0.07271535694599152, 0.0946904718875885, 0.02894553169608116, -0.006604349240660667, -0.014463565312325954, -0.0429341159760952, -0.009668271988630295, 0.012488155625760555, 0.028396274894475937, -0.04281078279018402, -0.048976413905620575, -0.06780913472175598, -0.0011082130949944258, -0.04067394137382507, -0.04205410182476044, -0.0402064323425293, 0.04507265239953995, -0.08759883791208267, 0.01569351553916931, 0.03184468671679497, -0.033932361751794815, -0.026526985689997673, 0.043564990162849426, -0.03207938373088837, -0.04999259486794472, -0.0018723367247730494, 0.023451969027519226, -0.11005023121833801, 0.0363481268286705, -0.00612840848043561, 0.016549361869692802, -0.07961957156658173, -0.006687316112220287, -0.09314236789941788, 0.0258592888712883, -0.015235411003232002, 0.00021625650697387755, 0.01510767824947834, 0.007306168787181377, 0.011512327939271927, 0.02041471004486084, 0.01410042867064476, 0.003842992940917611, -0.019657613709568977, 0.02026873081922531, 0.04479771852493286, -0.05206450819969177, 0.09193950146436691, 0.045580409467220306, -0.03969956934452057, -0.0672977939248085, 0.026938147842884064, 0.04485040158033371, 0.017254848033189774, -0.039579082280397415, 0.01801137439906597, -0.018019339069724083, 0.001075279084034264, 0.04988297075033188, -0.07419567555189133, -0.06883089244365692, 0.01769270934164524, 0.04848802834749222, 0.08835642784833908, -0.021138107404112816, -0.057740043848752975, 0.003052670508623123, 0.04361635446548462, -0.11488945782184601, -0.02010439522564411, -0.029181642457842827, -0.02606653980910778, 0.06368063390254974, -0.08750476688146591, 0.040933143347501755, 0.053323641419410706, -0.09749071300029755, 0.05463099107146263, 0.05499072000384331, 0.04316934198141098, -0.0038567136507481337, 0.01525820977985859, -0.046315230429172516, 0.014035838656127453, 0.027951298281550407, 0.02971433289349079, 0.018759282305836678, -0.04436824470758438, -0.008994720876216888, -0.022538933902978897, 0.04152197390794754, -0.03156068176031113, -0.12355341762304306, 0.01663518138229847, 0.02095237746834755, 0.005784386303275824, 0.034142546355724335, -0.039069660007953644, 0.05098685622215271, -0.013298881240189075, 0.013888687826693058, -0.04206889495253563, -0.05320402979850769, -0.0197827760130167, -0.0060407924465835094, 0.03690875321626663, 0.014739359728991985, 0.021558016538619995, -0.013958051800727844, -0.06555119901895523, -0.026922374963760376, 0.020511023700237274, -0.012036191299557686, 0.003563749371096492, -0.025422751903533936, 0.03550412878394127, -0.006093112286180258, 0.022235803306102753, -0.11301004886627197, 0.09007728844881058, 0.0005951187340542674, -0.05399274826049805, 0.009647304192185402, 0.012715262360870838, 0.017310742288827896, 0.012154972180724144, 0.016962194815278053, 0.017122065648436546, 0.05300459638237953, 0.042537789791822433, -0.02942514605820179, 0.026661256328225136, -0.007906104438006878, 0.00687740184366703, 0.048190660774707794, -0.06945662945508957, 0.08305881917476654, -0.0025729313492774963, 0.033775441348552704, 0.012180379591882229, 0.015550438314676285, -0.003832008922472596, -0.025762850418686867, 0.01589558832347393, -0.020594103261828423, 0.020239461213350296, 0.027539288625121117, -0.03882962092757225, -0.02504877932369709, 0.1034746989607811, 0.07611031830310822, 0.01995362527668476, -0.023203179240226746, 0.00147242471575737, 0.001293868524953723, 0.027616189792752266, -0.04881865531206131, 0.08366388827562332, 0.051157914102077484, 0.05238628387451172, -0.0018950627418234944, 0.06944349408149719, 0.02963845059275627, 0.04149901494383812, -0.0751519501209259, -0.006851484067738056, 0.028224946931004524, 0.05604783818125725, 0.055236462503671646, -0.014098508283495903, -0.1339920610189438, 0.059856269508600235, -0.005254822317510843, -0.029239900410175323, -0.0482349656522274, -0.006864297203719616, -0.0742955133318901, 0.062168654054403305, -0.04180101305246353, 0.014483586885035038, 0.011592760682106018, 0.06237601116299629, -0.025547336786985397, 0.07336503267288208, 0.04426870495080948, 0.048415567725896835, 0.08427555859088898, 0.0462878942489624, -0.02680887095630169, 0.006658988073468208, -0.01848463900387287, 0.005829527508467436, -0.11862459033727646, -0.009418035857379436, 0.03752632439136505, 0.005580108147114515, -0.05492234602570534, -0.037319544702768326, -0.03525145724415779, 0.03287016972899437, -0.05766221880912781, -0.003496964229270816, -0.023182816803455353, -0.007284523919224739, 0.024541351944208145, 0.17767056822776794, -0.008509337902069092, -0.05882623791694641, 0.018330665305256844, -0.05472203716635704, -0.04812752082943916, 0.022339709103107452, 0.039862848818302155, 0.03139157220721245, -0.033753324300050735, -0.05846555903553963, -0.0363512746989727, -0.0946456640958786, 0.07935360074043274, -0.024928657338023186, 0.09134232252836227, -0.053597256541252136, -0.04639575257897377, 0.04728760942816734, -0.004164968151599169, -0.03255103528499603, 0.04370662942528725, -0.016514431685209274, 0.03137790039181709, 0.04672388732433319, -0.06925705820322037, 0.009212218225002289, 0.009371786378324032, 0.013873685151338577, -0.0817602276802063, -0.0562911219894886, -0.05083661898970604, -0.04880016669631004, 0.013082334771752357, 0.034168586134910583, -0.018953507766127586, -0.014859768562018871, -0.019743677228689194, -0.050202447921037674, 0.05025406926870346, -0.013219568878412247, 0.033907514065504074, 0.025469094514846802, -0.0030649711843580008, 0.038261592388153076, -0.0307873897254467, -0.0183968935161829, -0.06440413743257523, 0.006103035062551498, 0.005892494227737188, 0.0021384109277278185, 0.018000373616814613, 0.00694098649546504, 0.005048499442636967, 0.035607241094112396, -0.008586015552282333, 0.037702951580286026, 0.0007079275674186647, 0.04788626357913017, -0.012382036074995995, -0.01273662131279707, -0.006449277047067881, 0.014875765889883041, 0.013423577882349491, 0.022256657481193542, -0.02407655492424965, 0.03670644760131836, -0.04168984293937683, 0.008480122312903404, -0.0269461739808321, -0.0030344573315232992, 0.021486319601535797, -0.0028726744931191206, 0.02606028877198696, -0.012747574597597122, -0.014030437916517258, -0.03128235414624214, -0.03610948845744133, -0.0394633524119854, 0.02121836319565773, -0.06403633207082748, -0.04370761662721634, -0.0018401902634650469, -0.02919631451368332, -0.008761209435760975, -0.022156357765197754, 0.029613308608531952, 0.017905745655298233, -0.06991618871688843, -0.023438652977347374, -0.03435466066002846, 0.0008317306055687368, -0.0646696463227272, 0.006463800091296434, -0.03076365776360035, 0.012639644555747509, 0.03638378158211708, 0.010252440348267555, -0.0396370068192482, 0.001610657898709178, 0.012164776213467121, 0.0055883582681417465, 0.02567184716463089, 0.012273582629859447, 0.02977326698601246, 0.02716214582324028, 0.004684771411120892, -0.009144688956439495, -0.004053723067045212, 0.015409142710268497, -0.028074907138943672, -0.016357028856873512, 0.006175510119646788, -0.015768036246299744, 0.01142458152025938, -0.0222464632242918, 0.012432142160832882, -0.04065721109509468, 0.005997269414365292, -0.05040660500526428, 0.005693619605153799, -0.006474682595580816, -0.028262345120310783, -0.00900863204151392, -0.026164047420024872, -0.014975081197917461, -0.002316488651558757, 0.02278164215385914, 0.00042307362309657037, 0.0028636555653065443, 0.05792556330561638, 0.003948413301259279, 0.047479934990406036, -0.0011177334235981107, -0.010753183625638485, 0.010637694038450718, 0.03588290140032768, 0.0061830561608076096, -0.03503236547112465, 0.030793534591794014, -0.007764462381601334, 0.07990419119596481, -0.005378975998610258, -0.026708386838436127, -0.009568708948791027, 0.039274848997592926, 0.0024309256114065647, 0.03809428960084915, -0.029793471097946167, 0.014607056975364685, 0.01678086631000042, 0.015066985972225666, 0.030395332723855972, -0.0035251618828624487, 0.03147999942302704, 0.007668392267078161, -0.044331733137369156, -0.0034687803126871586, -0.03082846663892269, 0.0040372638031840324, 0.041441358625888824, -0.004569212440401316, -0.01747044362127781, -0.00937595684081316, 0.024102089926600456, 0.0062906560488045216, 0.028235845267772675, 0.04666798934340477, 0.015734093263745308, -0.03476163372397423, -0.06869327276945114, -0.004983383696526289, 0.012023724615573883, -0.016536610201001167, -0.011136281304061413, -0.03766779974102974, -0.0023953758645802736, 0.027445483952760696, 0.036237917840480804, -0.02463192492723465, 0.04384467378258705, -0.0023338135797530413, 0.01873810775578022, -0.051702070981264114, 0.05120265856385231, 0.026041140779852867, -0.017689215019345284, 0.027841215953230858, 0.023014554753899574, -0.02269200049340725, 0.03390924632549286, 0.03476322442293167, -0.03743448853492737, -0.0295887291431427, 0.005474326200783253, 0.002935388358309865, 0.052083417773246765, 0.06768948584794998, 0.06280327588319778, 0.043868739157915115, -0.0228147991001606, -0.049544744193553925, 0.029959337785840034, 0.04620075225830078, 0.019934214651584625, 0.011627240106463432, 0.024757029488682747, -0.004703378304839134, -0.021992145106196404, -0.06279762834310532, 0.0046512712724506855, 0.014393400400876999, -0.020061258226633072, 0.01128628384321928, -0.020580297335982323, 0.007812675088644028, -0.005213661585003138, -0.008266521617770195, -0.04147382825613022, -0.020741596817970276, -0.008923321962356567, -0.012893656268715858, -0.01585359312593937, 0.008443322032690048, -0.0011550051858648658, 0.011349552311003208, -0.0454770028591156, 0.013607640750706196, 0.0402512326836586, 0.05055646598339081, 0.0016489028930664062, -0.006057119928300381, -0.029298357665538788, 0.05462886765599251, -0.05910369008779526, 0.026492049917578697, 0.03038959950208664, -0.020105062052607536, -0.007501429412513971, -0.022706326097249985, -0.03172038123011589, 0.006025468464940786, 0.011700603179633617, -0.012638214975595474, -0.04108620807528496, -0.007073684129863977, -0.03072347864508629, 0.01796661876142025, 0.012329841032624245, 0.004483210854232311, -0.025065558031201363, 0.016380146145820618, 0.017952758818864822, 0.056331735104322433, 0.0555741973221302, -0.02308911271393299, -0.031096715480089188, -0.007476454135030508, -0.016324644908308983, -0.014600743539631367, -0.0039123063907027245, 0.01003604382276535, 0.04163249209523201, 0.038300346583127975, -0.0026791547425091267, 0.01401162426918745, -0.021335771307349205, 0.031038107350468636, -0.005460959859192371, -0.024396700784564018, 0.006821726448833942, -0.036812249571084976, 0.022359494119882584, 0.007020163349807262, 0.040511686354875565, 0.015459183603525162, 0.013211916200816631, 0.01812259666621685, -0.0056963758543133736, 0.017090225592255592, -0.014869581907987595, -0.022042471915483475, 0.0524505153298378, -0.033179428428411484, 0.004210984334349632, 0.051264457404613495, 0.022445393726229668, -0.04448452219367027, 0.02596079185605049, 0.05089499428868294, -0.041090868413448334, 0.03975735977292061, 0.012778712436556816, 0.03712131083011627, 0.014042279683053493, 0.015925627201795578, 0.048768989741802216, 0.0023096646182239056, -0.004351478070020676, -0.010864287614822388, -0.043081607669591904, -0.028847521170973778, -0.015397441573441029, -0.020092640072107315, -0.05435347557067871, 0.025336068123579025, 0.014849869534373283, -0.009053457528352737, -0.03584911674261093, 0.004215877503156662, 0.011254604905843735, -0.04310205578804016, 0.00011180018191225827, -0.01613965816795826, -0.015656480565667152, 0.009545856155455112, -0.048402078449726105, -0.013209926895797253, 0.02119957096874714, -0.022774681448936462, -0.012916077859699726, -0.011873085051774979, 0.035548850893974304, 0.008102417923510075, 0.023971157148480415, 0.03543328121304512, -0.0038626070600003004, -0.05015340819954872, -0.018407445400953293, -0.009539660066366196, -0.017946023494005203, 0.0008743120124563575, -0.06324528902769089, 0.019872408360242844, 0.07063078880310059, -0.01788761280477047, 0.01660168170928955, 0.007318827323615551, 0.0029451020527631044, -0.00659232959151268, -0.05095074698328972, -0.006654432043433189, 0.03216826543211937, -0.011612783186137676, 0.004411173984408379, 0.0010937836486846209, 0.029610633850097656, 0.016254913061857224, 0.05203293263912201, -0.020821664482355118, 0.05448306351900101, 0.042477868497371674, 0.012048487551510334, -0.000172498170286417, -0.01447400450706482, -0.030513020232319832, -0.027243103832006454, -0.01154695637524128, 0.06200588867068291, -0.0018129150848835707, -0.04121937230229378, -0.010539728216826916, -0.0022195891942828894, 0.020243380218744278, -0.021668484434485435, 0.006945366505533457, -0.008147921413183212, 0.038770921528339386, 0.023858854547142982, 0.06546615809202194, -0.0011692021507769823, 0.03237596154212952, 0.01792123168706894, -0.008966800756752491, 0.0115499934181571, 0.011588804423809052, 0.027259625494480133, 0.02038927935063839, -0.014834383502602577, -0.04425574094057083, -0.027364956215023994, 0.023966215550899506, -0.04116173833608627, -0.047773245722055435, -0.04019356891512871, -0.025688929483294487, -0.0006934353732503951, 0.01792638562619686, -0.019482776522636414, 0.013504466973245144, 0.047659412026405334, 0.009549492970108986, 0.006623067427426577, 0.021478384733200073, -0.010628274641931057, 0.027476472780108452, 0.039538633078336716, -0.029258746653795242, -0.02082682028412819, 0.017077678814530373, 0.0074472445994615555, 0.010304264724254608, 0.011772454716265202, -0.018891531974077225, 0.003992538433521986, -0.022252904251217842, -0.024249542504549026, 0.04835142940282822, -0.03194466233253479, -0.00516103720292449, -0.006246983073651791, 0.05872881039977074, -0.025129538029432297, -0.014359971508383751, 0.01043506246060133, -0.03091760352253914, -0.02803884446620941, -0.04427668824791908, -0.024259060621261597, -0.012559933587908745, -0.018717557191848755, -0.059887953102588654, -0.02332170680165291, -0.016793429851531982, -0.031041797250509262, -0.004553517326712608, -0.08280718326568604, -0.009560717269778252, -0.01180273573845625, 0.00659408513456583, -0.06197165325284004, 0.03247220069169998, -0.011042289435863495, 0.055788252502679825, 0.02888145111501217, -0.014644438400864601, 0.02227562852203846, 0.020085956901311874, -0.013122977688908577, 0.022381648421287537, -0.05198731645941734, -0.006392920855432749, -0.031399134546518326, -0.06937792897224426, 0.0011396206682547927, -0.001316620851866901, 0.03274749964475632, -0.03654498979449272, 0.06080484017729759, -0.05226830765604973, 0.009638028219342232, -0.02651415951550007, -0.022944241762161255, 0.04315834119915962, -0.02555501088500023, 0.02837837114930153, 0.03659181296825409, -0.028207113966345787, 0.00943586602807045, 0.009447327814996243, -0.02232462167739868, 0.007040969096124172, -0.00618973420932889, -0.05650148540735245, 0.0437895804643631, 0.013257837854325771, 0.03295128792524338, 0.011597700417041779, 0.0029440175276249647, 0.013423771597445011, 0.04199795052409172, -0.014742926694452763, -0.005073125474154949, 0.0031076958402991295, -0.02736664190888405, -0.0025628635194152594, 0.0037126897368580103, -0.02033054642379284, -0.018003618344664574, -0.00836463738232851, -0.019130786880850792, 0.002440619980916381, -0.05008706822991371, -0.020401937887072563, -0.03682492673397064, -0.0024718851782381535, 0.023288510739803314, 0.019360410049557686, -0.036602992564439774, -0.022234858945012093, -0.012345057912170887, 0.035777751356363297, 0.018403390422463417, -0.00508837541565299, -0.007139099761843681, 0.03306255117058754, 0.021266648545861244, 0.017215892672538757, 0.016736581921577454, 0.055927958339452744, -0.012658216059207916, 0.018680397421121597, 0.07069799304008484, 0.03133220598101616, -0.014499729499220848, 0.013318747282028198, 0.04173823073506355, 0.00676378607749939, 0.01115105114877224, -0.006350008770823479, 0.011092141270637512, 0.01772124692797661, 0.06835205107927322, -0.00033521748264320195, 0.019827479496598244, 0.04131866618990898, 0.011492853984236717, -0.0264885351061821, -0.034092895686626434, 0.0729743018746376, -0.03645830973982811, 0.013222191482782364, -0.0401177778840065, 0.012748184613883495, -0.012579153291881084, -0.02688528038561344, 0.04727248474955559, 0.002522603841498494, -0.06101275235414505, 0.010514245368540287, 0.0063840062357485294, 0.048181481659412384, 0.016819745302200317, -0.03237929940223694, -0.003049134509637952, 0.03820030763745308, -0.01918351836502552, -0.006745176389813423, 0.004657797981053591, -0.005893603898584843, -0.015423729084432125, 0.010679865255951881, -0.021596936509013176, 0.01075852569192648, 0.0430583693087101, 0.024285275489091873, -0.025520194321870804, 0.022017549723386765 ]
My Journey to a serverless transformers pipeline on Google Cloud
Maxence
March 18, 2021
how-to-deploy-a-pipeline-to-google-clouds
guide
https://huggingface.co/blog/how-to-deploy-a-pipeline-to-google-clouds
Step 1 - Research I already knew that I could use an API-Service like flask to serve a transformers model. I searched in the Google Cloud AI documentation and found a service to host Tensorflow models named AI-Platform Prediction. I also found App Engine and Cloud Run there, but I was concerned about the memory usage for App Engine and was not very familiar with Docker.
[ 0.03175606206059456, -0.027359524741768837, 0.06687698513269424, 0.05972383916378021, 0.013228995725512505, 0.08552998304367065, 0.030207963660359383, 0.06530643254518509, -0.05093206837773323, 0.007832708768546581, -0.04735511168837547, 0.05511368438601494, -0.021247712895274162, 0.0951373279094696, 0.04214410483837128, -0.08799449354410172, 0.026657281443476677, -0.01767936907708645, -0.02069254219532013, 0.04449746385216713, -0.029028842225670815, -0.040233220905065536, -0.005650022067129612, 0.016897251829504967, -0.03043443337082863, -0.07067319750785828, -0.01012476347386837, 0.04332694783806801, -0.08709882944822311, 0.02037258818745613, -0.07594029605388641, 0.04542049765586853, -0.030606132000684738, -0.020693685859441757, -0.033582769334316254, 0.01371562946587801, -0.05526670813560486, 0.013541790656745434, -0.01101980172097683, -0.0506151057779789, -0.01368589885532856, 0.025207161903381348, -0.11015930771827698, 0.05911840498447418, -0.00043618949712254107, 0.008261995390057564, -0.19414642453193665, 0.06351229548454285, -0.018286854028701782, -0.02814018353819847, -0.023621372878551483, 0.05402000620961189, 0.00010552060120971873, -0.0000431199514423497, 0.013949055224657059, 0.06870587915182114, 0.030155377462506294, -0.052126429975032806, -0.0649886503815651, 0.03398028761148453, 0.04997222498059273, 0.049950312823057175, 0.04818050563335419, 0.02924330160021782, -0.007831648923456669, -0.04858207330107689, -0.005641934461891651, -0.005050569772720337, -0.003927859012037516, -0.03005461022257805, -0.00031424127519130707, -0.014399311505258083, -0.05447949096560478, -0.0023441112134605646, -0.03597696125507355, -0.061480309814214706, 0.0013827752554789186, 0.04832244664430618, 0.08861072361469269, 0.02687111496925354, -0.022984536364674568, -0.014634435065090656, 0.022942785173654556, 0.00987018458545208, 0.04574482887983322, -0.004564923699945211, 0.01713123358786106, -0.007516597863286734, -0.0749439150094986, 0.060395747423172, 0.10278677195310593, -0.12593387067317963, -0.010050083510577679, 0.024637563154101372, 0.04189488664269447, 0.006939608603715897, 0.019900241866707802, -0.041145771741867065, -0.018580548465251923, -0.02131243236362934, -0.03462668135762215, 0.002033250406384468, -0.05335460230708122, 0.017901580780744553, -0.04724903777241707, 0.057153116911649704, 0.016274265944957733, -0.11636991053819656, -0.0089363232254982, -0.0324619822204113, 0.04382836073637009, 0.011999130249023438, -0.003696763189509511, 0.07438257336616516, -0.0814552903175354, 0.019850362092256546, -0.003685894189402461, -0.05238860845565796, -0.002152044093236327, 0.024418430402874947, 0.06267406791448593, 0.09438607096672058, -0.014502380974590778, -0.032998379319906235, -0.030040493234992027, 0.029719192534685135, -0.008601564913988113, -0.00976504571735859, -0.05313374102115631, -0.05340065807104111, 0.08635794371366501, -0.04931500926613808, 0.0954890251159668, -0.02290656976401806, -0.0030857278034090996, -0.02306678704917431, -0.03167648985981941, -0.026407236233353615, 0.02341211773455143, -0.004385714419186115, -0.03256864845752716, 0.05492892116308212, -0.02979099750518799, 0.04346133768558502, 0.09619054943323135, 0.012086564674973488, -0.04428625479340553, 0.03280790522694588, 0.015855325385928154, 0.029805954545736313, -0.10431044548749924, 0.08603230118751526, -0.04583168774843216, -0.004230388440191746, 0.010920431464910507, 0.04389321804046631, -0.02449386939406395, -0.01172003522515297, -0.027522217482328415, -0.06837853044271469, -0.014046781696379185, 0.01581178419291973, -0.12997794151306152, 0.019017333164811134, 0.04009157046675682, -0.014693479984998703, 0.0006150086992420256, -0.032022200524806976, 0.022438734769821167, 0.003693006467074156, -0.00843899603933096, -0.012267131358385086, 0.07190997153520584, -0.003907979466021061, 0.0687728077173233, 0.006775354500859976, 0.061821386218070984, 0.03509323671460152, 0.03451734036207199, -0.072495236992836, -0.017026884481310844, 0.09679744392633438, 0.03832319751381874, 0.04242169111967087, 0.04498298466205597, -0.08331063389778137, -0.007020242512226105, -0.058077841997146606, 0.031111564487218857, 0.030536744743585587, -0.012512562796473503, -0.060183051973581314, 0.024894434958696365, 0.04349235072731972, 0.07438001781702042, -0.018735013902187347, -0.02396247908473015, 0.029610900208353996, -0.010724775493144989, 0.09846392273902893, 0.031727343797683716, -0.019700491800904274, -0.011136899702250957, -0.05987560749053955, -0.0036535386461764574, -0.011562637984752655, 0.010126509703695774, -0.06721588969230652, -0.011811327189207077, 0.025983799248933792, -0.02872936613857746, -0.11994284391403198, 0.03152628615498543, -0.0656905546784401, -0.020091969519853592, -0.04686128720641136, -0.051501281559467316, -0.01658877544105053, -0.04606730863451958, -0.00873346533626318, 0.13216130435466766, -0.02097446471452713, -0.027671927586197853, -0.023111075162887573, -0.04448271170258522, 0.056921590119600296, 0.04373129829764366, 0.019666463136672974, 0.08502249419689178, -0.06609237939119339, -0.009090401232242584, -0.04636169224977493, -0.05155874043703079, 0.019253771752119064, -0.04204602167010307, 0.04372750595211983, 0.07293941080570221, 0.019458753988146782, 0.028086435049772263, -0.008429371751844883, 0.01816747337579727, 0.007057173177599907, -0.0472295805811882, 0.052643973380327225, 0.01013723760843277, -0.015705225989222527, 0.03920748829841614, 0.007407255936414003, -0.027151737362146378, -0.08616262674331665, -0.056506384164094925, -0.01134089007973671, -0.031632449477910995, -0.012387014925479889, 0.0848151296377182, 0.016272826120257378, -0.005907129496335983, 0.004342515487223864, -0.020006097853183746, 0.047054558992385864, -0.0021645817905664444, 0.01075813453644514, -0.004949105437844992, -0.03341974318027496, 0.014011695049703121, 0.0018471250077709556, -0.005026684608310461, -0.03832389786839485, 0.02623620256781578, 0.004467851482331753, 0.0015726537676528096, -0.029181301593780518, 0.04568071290850639, 0.002794613130390644, 0.018209779635071754, 0.04177594557404518, -0.005980241112411022, 0.003034633817151189, 0.02070465497672558, -0.010158021934330463, -0.00048767554108053446, -0.024534374475479126, 0.05600058287382126, 0.05316808819770813, -0.01621188595890999, -0.03209669142961502, -0.007241959683597088, -0.053968023508787155, -0.020365040749311447, 0.01913761906325817, 0.001545242383144796, 0.049634940922260284, 0.02419068105518818, -0.012006224133074284, -0.0164116732776165, 0.019436627626419067, 0.009919028729200363, -0.02016565203666687, -0.03475180268287659, 0.06111803650856018, -0.02484920062124729, 0.01482914574444294, -0.0037506138905882835, -0.015498461201786995, -0.03144010528922081, 0.010695424862205982, 0.015225586481392384, -0.008754941634833813, -0.09895258396863937, -0.05265980213880539, -0.031924985349178314, 0.04045861214399338, 0.0001747257774695754, 0.0012707565911114216, 0.045837488025426865, 0.021071817725896835, -0.007847431115806103, 0.025787534192204475, -0.007103125099092722, 0.017120258882641792, 0.002510525519028306, 0.017551392316818237, 0.016631541773676872, -0.0007720637368038297, 0.016866689547896385, 0.029542382806539536, 0.039486631751060486, -0.0069466764107346535, -0.0654507726430893, 0.04550781473517418, 0.020231666043400764, 0.008216899819672108, 0.013573568314313889, 0.003250827779993415, 0.01028908509761095, 0.021669084206223488, 0.0038546810392290354, -0.021502602845430374, -0.029788710176944733, -0.019512135535478592, -0.010908428579568863, 0.04134729132056236, -0.03403487801551819, 0.000498496403452009, -0.03561222180724144, 0.0060996138490736485, 0.017339365556836128, 0.01683107018470764, -0.01761440560221672, -0.0033629550598561764, 0.029517153277993202, -0.009310299530625343, 0.03538026660680771, -0.0035730444360524416, 0.013951126486063004, 0.027878623455762863, 0.025705557316541672, -0.020126471295952797, -0.04201775789260864, -0.011031728237867355, -0.005491582676768303, 0.04710375890135765, 0.038276996463537216, -0.0020095249637961388, -0.005362310446798801, 0.06169858202338219, 0.030567554756999016, 0.018078437075018883, -0.05499754846096039, 0.0031492288690060377, -0.00001269068889087066, 0.01716172881424427, -0.011658437550067902, 0.02568132057785988, 0.041411496698856354, 0.019232511520385742, 0.02076868899166584, 0.019499732181429863, -0.019225401803851128, 0.05132019892334938, -0.006406092084944248, 0.008257324807345867, -0.01835242472589016, 0.047308485954999924, -0.010448480024933815, 0.007864236831665039, 0.08132608979940414, 0.0397995300590992, -0.030650878325104713, -0.017040161415934563, -0.04262540489435196, 0.004062681924551725, 0.01640269346535206, 0.010508356615900993, 0.0038164714351296425, -0.01317291148006916, 0.029813077300786972, 0.03543120622634888, 0.05493947118520737, -0.025449829176068306, 0.03320091962814331, -0.002346716821193695, 0.005527387838810682, 0.006945124361664057, 0.014237646013498306, 0.017325472086668015, -0.014170173555612564, -0.023879356682300568, -0.0015019315760582685, -0.0005260797333903611, 0.00838578213006258, 0.02390149049460888, -0.026850253343582153, -0.0361471064388752, 0.019336408004164696, -0.020613165572285652, 0.06188001111149788, 0.015939822420477867, 0.02895737998187542, 0.011342641897499561, -0.01003788597881794, -0.022655993700027466, -0.014342623762786388, 0.05050111562013626, 0.02254980057477951, -0.01980782486498356, 0.02354075200855732, 0.05176374316215515, 0.001927493023686111, 0.0196613110601902, -0.030538303777575493, -0.0033020779956132174, -0.0018563105259090662, 0.020103253424167633, 0.010593172162771225, 0.014264887198805809, -0.026024172082543373, 0.0296028945595026, -0.014895045198500156, -0.033720847219228745, 0.02925681509077549, -0.00786229595541954, 0.010246891528367996, -0.013684962876141071, -0.016165662556886673, 0.00594951119273901, -0.02245674841105938, -0.009976578876376152, -0.040010541677474976, 0.012288409285247326, 0.012855448760092258, -0.047190312296152115, 0.00624209875240922, 0.025214528664946556, -0.06369588524103165, 0.0002312081487616524, -0.02100173383951187, -0.014129122719168663, 0.00878248829394579, -0.013521411456167698, -0.02034282125532627, 0.031125681474804878, 0.03168842941522598, -0.01323749776929617, -0.0044111162424087524, 0.022503139451146126, -0.008787806145846844, 0.061595119535923004, 0.009859045036137104, 0.0033984575420618057, -0.013173297047615051, -0.00914657674729824, -0.005957162939012051, 0.03776535764336586, 0.013872276060283184, -0.09413547813892365, -0.019501807168126106, 0.014531193301081657, -0.04884413257241249, -0.011283958330750465, 0.01596974767744541, -0.038531236350536346, -0.006410791072994471, 0.06292997300624847, 0.021766699850559235, 0.02965228259563446, -0.03192770108580589, 0.03066284954547882, 0.005465835332870483, -0.014788737520575523, -0.015125279314815998, -0.00491745350882411, 0.007505100220441818, 0.03220236673951149, 0.07655420154333115, 0.0346439853310585, 0.0036381888203322887, 0.02091633714735508, 0.005885050166398287, -0.00009522537584416568, 0.0007444863440468907, -0.026964042335748672, 0.02436472848057747, -0.01972644403576851, 0.003435852937400341, 0.026752794161438942, 0.003673237981274724, -0.00852679368108511, 0.005754114128649235, 0.059876177459955215, -0.03812054172158241, 0.00424184650182724, 0.07802404463291168, 0.0071999551728367805, 0.014318945817649364, 0.00844710785895586, 0.06804904341697693, 0.010715141892433167, 0.018058331683278084, 0.008423133753240108, -0.01311319787055254, -0.016534045338630676, -0.02681739442050457, -0.01387773547321558, 0.026664622128009796, -0.0008892967598512769, 0.01996213011443615, 0.01315921451896429, -0.026333337649703026, -0.035250842571258545, 0.003201838117092848, 0.006751369684934616, 0.03114662505686283, -0.0331156924366951, -0.02254841849207878, 0.033518318086862564, -0.054805923253297806, 0.01234525442123413, 0.039921268820762634, -0.014823505654931068, -0.028140174224972725, 0.02311996929347515, 0.011175267398357391, -0.018529994413256645, 0.01793495938181877, 0.047975532710552216, 0.018544459715485573, -0.04535040631890297, -0.01540301088243723, -0.04397479072213173, -0.011396927759051323, -0.005635004490613937, -0.01774413138628006, 0.034222718328237534, 0.05066460743546486, 0.00442085787653923, 0.009989035315811634, 0.010515585541725159, -0.0011502077104523778, 0.01139567419886589, 0.019665438681840897, -0.042868472635746, 0.002016273094341159, -0.0255565382540226, -0.008376887999475002, 0.00923091173171997, -0.013463027775287628, 0.034285400062799454, -0.000672894821036607, -0.0027872163336724043, -0.007249950896948576, 0.033841487020254135, -0.0010939878411591053, 0.010290073230862617, -0.00021950869995635003, -0.058040376752614975, -0.031860776245594025, -0.013183295726776123, 0.015128877013921738, 0.04309548810124397, 0.018848976120352745, -0.0064745997078716755, 0.051327433437108994, -0.028051607310771942, 0.025407809764146805, 0.036481305956840515, 0.000768544094171375, 0.08356601744890213, 0.01618957705795765, 0.06238545477390289, -0.003853133413940668, 0.0001601626572664827, 0.013504035770893097, -0.008930319920182228, 0.07391957938671112, 0.029827190563082695, 0.017096377909183502, 0.0032196904066950083, -0.001978829735890031, -0.029331788420677185, -0.008408895693719387, 0.011791651137173176, -0.036954913288354874, -0.018336188048124313, -0.0010355077683925629, -0.01394478790462017, 0.0016097031766548753, -0.03553171083331108, 0.0026874267496168613, 0.05459984019398689, 0.04657243564724922, -0.013091305270791054, 0.013365437276661396, 0.07081733644008636, 0.02953542210161686, 0.04305082559585571, 0.018204713240265846, -0.0005403971881605685, -0.002038378268480301, 0.035094741731882095, -0.02842833660542965, 0.03123205155134201, 0.007906544953584671, -0.015254459343850613, 0.015085243619978428, -0.008295710198581219, -0.05421699583530426, 0.0003769048198591918, -0.02852463163435459, -0.029680104926228523, -0.008823682554066181, 0.01346180122345686, -0.04916875809431076, -0.015908438712358475, -0.01637205481529236, -0.02546379715204239, -0.00745471240952611, -0.01938652992248535, -0.03301133215427399, 0.013614370487630367, 0.019576888531446457, -0.0033711616415530443, -0.010982784442603588, -0.013652211055159569, -0.0025498054455965757, 0.008683428168296814, -0.04016842693090439, -0.019861659035086632, -0.054271992295980453, 0.0012490320950746536, -0.021614989265799522, 0.012449105270206928, -0.0069395327009260654, -0.01370343379676342, 0.031933657824993134, 0.04328400641679764, 0.009022914804518223, 0.034846074879169464, 0.018103666603565216, 0.005984365940093994, -0.032017771154642105, 0.012207753956317902, -0.058379124850034714, -0.026896607130765915, -0.014281918294727802, -0.03461899980902672, -0.0020821159705519676, -0.018914008513092995, 0.00412233779206872, 0.01808096282184124, 0.023442093282938004, -0.03957832232117653, -0.028515029698610306, 0.034854207187891006, 0.022421343252062798, -0.048413630574941635, 0.05023398622870445, -0.002062444807961583, -0.0142151964828372, 0.026063526049256325, 0.03394866734743118, 0.02720879390835762, -0.013771147467195988, -0.009513572789728642, 0.037397269159555435, 0.014255291782319546, -0.027901969850063324, -0.0019844495691359043, 0.02521033026278019, 0.019588589668273926, 0.05103488266468048, 0.03290310874581337, -0.00840822048485279, -0.01127617061138153, -0.034411318600177765, 0.009872077964246273, -0.04558148607611656, 0.009297342039644718, -0.05050507187843323, -0.05584326386451721, -0.021594805642962456, -0.006434174720197916, -0.03673544526100159, 0.012686748057603836, -0.06789226084947586, -0.011915281414985657, -0.0359916053712368, -0.02903013676404953, -0.04951778054237366, 0.00036495664971880615, 0.04145405814051628, 0.07127555459737778, 0.0007477069739252329, 0.005047098733484745, -0.01730670966207981, -0.0007824069471098483, -0.0017879537772387266, 0.03244012966752052, 0.019983025267720222, -0.008212809450924397, 0.0030004926957190037, -0.03451750800013542, 0.014984752051532269, -0.01917818747460842, -0.03565463051199913, -0.013911995105445385, 0.011658028699457645, -0.011097750626504421, -0.018021445721387863, 0.021366359665989876, -0.016382258385419846, -0.02078939974308014, 0.030538272112607956, -0.028466492891311646, -0.00636460492387414, 0.005544476676732302, -0.019900847226381302, -0.05803760513663292, -0.017873862758278847, 0.0003109305980615318, -0.03051747754216194, 0.030558599159121513, 0.0010473649017512798, 0.0008850019075907767, -0.028487106785178185, -0.015324573032557964, 0.06308626383543015, -0.005858379881829023, -0.043447211384773254, -0.038807108998298645, -0.02915884554386139, 0.03615022450685501, -0.007307910826057196, -0.038385480642318726, 0.04412055388092995, -0.004238730762153864, -0.021112937480211258, 0.010946176946163177, -0.0004293326346669346, -0.009968176484107971, 0.00021349416056182235, 0.024594737216830254, -0.025612512603402138, 0.057422708719968796, 0.06028122082352638, -0.01884816773235798, -0.0018431184580549598, 0.023279279470443726 ]
My Journey to a serverless transformers pipeline on Google Cloud
Maxence
March 18, 2021
how-to-deploy-a-pipeline-to-google-clouds
guide
https://huggingface.co/blog/how-to-deploy-a-pipeline-to-google-clouds
Deploy transformers to Google Cloud > GCP is chosen as it is the cloud environment I am using in my personal organization.
[ 0.018102077767252922, 0.0070667448453605175, 0.10163089632987976, 0.06669765710830688, 0.03028370626270771, 0.06190405413508415, -0.005935991182923317, 0.11737047135829926, 0.002806083532050252, -0.027251755818724632, -0.05879152938723564, 0.05396246537566185, -0.0531320720911026, 0.09369738399982452, 0.015897203236818314, -0.026876628398895264, 0.027978846803307533, -0.03456805273890495, -0.02348315715789795, -0.01927303709089756, -0.011057822033762932, -0.04217683896422386, 0.005375393666327, -0.014608718454837799, 0.04196522384881973, -0.0688042938709259, -0.03042178601026535, 0.03057049587368965, -0.06363757699728012, 0.02078382670879364, -0.022380847483873367, -0.0024760940577834845, 0.0032643068116158247, 0.012412054464221, -0.04139375686645508, 0.03332436457276344, -0.05611540377140045, 0.005647051613777876, -0.05667409673333168, -0.10154064744710922, 0.00023131405760068446, -0.056498438119888306, -0.06340015679597855, 0.03885553032159805, -0.014491678215563297, 0.02564913220703602, -0.21811528503894806, 0.08354121446609497, -0.035550761967897415, 0.018387440592050552, -0.08038011193275452, 0.03859928250312805, 0.03481869399547577, -0.036807019263505936, 0.029015516862273216, 0.04842909052968025, 0.004880592692643404, -0.026098763570189476, -0.01441684365272522, -0.020699216052889824, 0.04607976973056793, -0.0015009867493063211, 0.007608321961015463, 0.047247570008039474, 0.0022387723438441753, -0.05887310951948166, -0.022346431389451027, -0.02926524728536606, -0.01662556082010269, -0.017183998599648476, -0.02108372189104557, -0.050232719630002975, 0.04282847419381142, -0.017025724053382874, -0.0548301562666893, -0.020820271223783493, -0.006230759900063276, 0.05392345413565636, 0.05029433220624924, 0.12395122647285461, 0.03223612904548645, -0.005383422132581472, -0.02692742459475994, 0.025132078677415848, 0.003775001736357808, -0.009268377907574177, 0.08620773255825043, -0.00632124301046133, -0.040290217846632004, 0.05920273810625076, 0.07774196565151215, -0.11222320795059204, -0.02947629615664482, 0.045746151357889175, 0.082369364798069, -0.031922969967126846, 0.04793991148471832, -0.019608622416853905, -0.03242290019989014, 0.0072479392401874065, -0.0554535835981369, 0.0579882375895977, -0.01808801479637623, -0.0012189231347292662, 0.010063721798360348, -0.062372803688049316, 0.030417870730161667, -0.09550057351589203, 0.027615869417786598, 0.05066830292344093, 0.008303487673401833, -0.04168134555220604, 0.030124997720122337, 0.034158043563365936, 0.020779065787792206, 0.06840088218450546, 0.02607261762022972, -0.06405062228441238, 0.03819672390818596, 0.007966460660099983, 0.07257191836833954, 0.11709246784448624, -0.03090045042335987, 0.038707226514816284, -0.01044599711894989, 0.012895798310637474, -0.0402015820145607, -0.001225478365086019, -0.08102712035179138, -0.08316891640424728, 0.06975200027227402, -0.014532540924847126, 0.0320616252720356, -0.05305797606706619, -0.015485922805964947, -0.06993059813976288, 0.007396001368761063, -0.04458475112915039, 0.02551756240427494, -0.02021949365735054, -0.05243465304374695, 0.07555246353149414, -0.021156512200832367, 0.03801805153489113, 0.047821708023548126, 0.012265562079846859, -0.057924479246139526, 0.04898478835821152, 0.010657157748937607, 0.07629939168691635, 0.006249693688005209, 0.08191251754760742, -0.07307570427656174, -0.03389602154493332, 0.014818272553384304, 0.024723969399929047, -0.012596691027283669, -0.016130153089761734, -0.06221790611743927, -0.04798050969839096, -0.01718556508421898, -0.012115170247852802, -0.027300303801894188, -0.0032221574801951647, -0.018854737281799316, -0.04458301141858101, 0.03286108747124672, -0.03314279392361641, 0.039719726890325546, -0.03044460155069828, -0.003013667883351445, -0.06140509620308876, 0.055147476494312286, 0.010503808036446571, 0.0008206419879570603, 0.031836140900850296, 0.09018311649560928, 0.09142480790615082, 0.054224271327257156, -0.08935682475566864, -0.028085775673389435, 0.09533947706222534, -0.01649603247642517, 0.03407949209213257, 0.059388693422079086, -0.050331830978393555, 0.04051842913031578, -0.0804138258099556, 0.04628876596689224, -0.007675543427467346, -0.04671432822942734, -0.05802028253674507, 0.055022597312927246, 0.012991130352020264, 0.05158184841275215, 0.012353604659438133, 0.004258990287780762, 0.06905423104763031, 0.011461847461760044, 0.05371176078915596, 0.04023823142051697, -0.01203139778226614, -0.004212315659970045, -0.04229583963751793, -0.016411926597356796, 0.043876998126506805, 0.0004982335376553237, -0.04597936198115349, 0.03229788318276405, 0.031763866543769836, 0.010075199417769909, -0.06655243039131165, 0.022108258679509163, -0.07429565489292145, -0.014413994736969471, -0.05379088968038559, -0.08648248761892319, -0.011913682334125042, 0.028521062806248665, 0.0038550416938960552, 0.11506784707307816, -0.00717354379594326, 0.03588008135557175, 0.004023218527436256, -0.03019510768353939, 0.04029545560479164, 0.020978309214115143, -0.026151731610298157, 0.09157746285200119, -0.0362098328769207, -0.018895916640758514, -0.044767603278160095, 0.012619267217814922, 0.019291387870907784, 0.013008525595068932, 0.008950378745794296, 0.008023053407669067, -0.01965496502816677, 0.059809643775224686, -0.0067360796965658665, -0.0011617322452366352, -0.010527608916163445, 0.01933995634317398, 0.06735498458147049, -0.04029913246631622, 0.019582726061344147, 0.018161997199058533, -0.018048064783215523, -0.015037746168673038, -0.06886577606201172, -0.055142778903245926, -0.02800632081925869, 0.018183134496212006, -0.03600135073065758, 0.11709406226873398, 0.020494835451245308, -0.030404018238186836, -0.004232991486787796, -0.010131814517080784, 0.011959459632635117, -0.031749580055475235, -0.022722985595464706, -0.003772896248847246, -0.04488962143659592, 0.04138587787747383, -0.013955892994999886, 0.009187530726194382, -0.003915212582796812, -0.027841631323099136, 0.0054695443250238895, 0.001832739682868123, -0.04188495874404907, 0.014229896478354931, -0.013415919616818428, -0.021004803478717804, 0.0044685774482786655, 0.020983776077628136, 0.012147080153226852, 0.010976824909448624, -0.019921015948057175, 0.049645811319351196, -0.028079800307750702, 0.011164113879203796, 0.04093698039650917, -0.011519288644194603, -0.008410206064581871, 0.008464103564620018, -0.06174447014927864, -0.005108002573251724, -0.001775045762769878, 0.003645800519734621, 0.011853431351482868, -0.012861761264503002, 0.030315887182950974, -0.035691358149051666, -0.004865741822868586, 0.02189088612794876, -0.01611311361193657, -0.008389487862586975, 0.059890564531087875, -0.012821666896343231, 0.02366078458726406, 0.0070818704552948475, -0.013442753814160824, -0.05168747901916504, 0.03434804081916809, 0.005176921840757132, 0.0187192615121603, -0.11487429589033127, -0.04745743051171303, -0.0034849983640015125, 0.04684032127261162, -0.0063997856341302395, -0.03838496655225754, 0.014287840574979782, -0.00019743586017284542, -0.0010376020800322294, 0.03117302805185318, 0.0065695480443537235, -0.00718339579179883, 0.023653557524085045, 0.011333347298204899, -0.023935647681355476, 0.002903929678723216, 0.017920520156621933, 0.015595687553286552, 0.02315698377788067, -0.005618505645543337, -0.031546566635370255, 0.020949289202690125, -0.027113614603877068, -0.0031166013795882463, 0.028189990669488907, 0.031898580491542816, -0.000950300192926079, 0.03268023207783699, -0.005970736499875784, -0.022145239636301994, -0.012433853931725025, 0.006558891385793686, -0.020956307649612427, 0.014165448024868965, -0.012545624747872353, 0.01595655083656311, 0.003802309511229396, 0.04041565582156181, 0.025464722886681557, 0.0411536730825901, 0.016761982813477516, -0.04262217879295349, 0.013262713328003883, -0.0005456260987557471, 0.0169038325548172, -0.02384221740067005, -0.006051874253898859, 0.026799598708748817, 0.03557578846812248, 0.007298695854842663, -0.050690632313489914, -0.02675018273293972, -0.000040792685467749834, 0.005781786981970072, 0.02810763195157051, -0.016924651339650154, -0.007005015388131142, 0.015179899521172047, 0.035552773624658585, 0.027025070041418076, -0.030182581394910812, -0.008377532474696636, 0.004013779107481241, -0.00299850944429636, -0.024002717807888985, 0.045467521995306015, -0.01561853475868702, 0.06692531704902649, -0.0068298098631203175, 0.02089051902294159, 0.0026158655527979136, 0.056733883917331696, 0.0005303464713506401, 0.012304154224693775, -0.04564717039465904, 0.012814931571483612, 0.00912440661340952, -0.008057378232479095, 0.0606001652777195, -0.02168082632124424, -0.04610942676663399, -0.01387807633727789, 0.005893476773053408, -0.010901412926614285, -0.0029660954605787992, 0.02634636126458645, 0.029701897874474525, 0.015428760088980198, -0.008739139884710312, 0.024890301749110222, 0.021643023937940598, -0.07335297763347626, 0.026303639635443687, -0.0037991583812981844, 0.007332310546189547, 0.0025953873991966248, 0.017918217927217484, -0.038212429732084274, -0.028146130964159966, 0.025868117809295654, -0.011883992701768875, -0.022065313532948494, -0.023412127047777176, 0.034987494349479675, 0.026487361639738083, -0.005288776010274887, -0.0032851756550371647, -0.018232913687825203, 0.016652647405862808, 0.019030103459954262, 0.06197422742843628, 0.015167847275733948, -0.004370390437543392, -0.05748865380883217, -0.014891538769006729, 0.026546061038970947, 0.04499323293566704, -0.002634376985952258, -0.036629460752010345, 0.04902113601565361, -0.015507861040532589, 0.019050661474466324, -0.01734972558915615, 0.010595239698886871, -0.05712881684303284, 0.0007799704326316714, 0.018614623695611954, 0.035908639430999756, -0.04130991920828819, 0.018185226246714592, -0.0184984989464283, -0.02114262804389, 0.046608418226242065, -0.015087896026670933, -0.009857306256890297, 0.0023986510932445526, -0.009856389835476875, 0.03892108052968979, -0.0035268219653517008, -0.009326671250164509, 0.009122553281486034, 0.038264960050582886, 0.03782634064555168, -0.036621782928705215, 0.047412190586328506, 0.018752753734588623, -0.04114196449518204, 0.00707334466278553, -0.0231892429292202, 0.005564116407185793, 0.07138391584157944, 0.01831977255642414, -0.04256158322095871, 0.03215324878692627, 0.009231331758201122, -0.0067057483829557896, -0.02766471914947033, -0.0006045798072591424, 0.003403807757422328, 0.0430939607322216, -0.004049177281558514, -0.01678946241736412, -0.051396213471889496, 0.00958645436912775, 0.039853159338235855, 0.025875410065054893, 0.022105081006884575, -0.05852406099438667, -0.025312107056379318, 0.01822066865861416, -0.0012347194133326411, -0.012265562079846859, -0.012680906802415848, -0.02167556621134281, -0.007692679762840271, 0.03199887275695801, 0.02219793014228344, 0.02087458223104477, 0.03257082775235176, 0.027288995683193207, 0.019647056236863136, -0.01274198293685913, -0.031299740076065063, -0.0035338718444108963, -0.014452099800109863, -0.017099890857934952, 0.06004200875759125, 0.0348571240901947, -0.004140129312872887, 0.04568307846784592, -0.010007266886532307, -0.031184539198875427, -0.005687621422111988, -0.0242279302328825, -0.025668615475296974, -0.04067974537611008, 0.03199047967791557, 0.013145294971764088, 0.0024048027116805315, 0.006744233425706625, 0.021741705015301704, 0.04660141468048096, -0.03784757852554321, -0.0004915411118417978, 0.04098159074783325, 0.004957469645887613, 0.018671073019504547, 0.01040547713637352, 0.018190136179327965, -0.019996535032987595, 0.010842377319931984, 0.010104700922966003, 0.007584335748106241, -0.039518244564533234, -0.01050609815865755, -0.07415873557329178, -0.043929293751716614, 0.013727505691349506, -0.01218998059630394, 0.03262192755937576, 0.0013587550492957234, -0.0052296994253993034, -0.0013652605703100562, 0.02661379985511303, 0.018230674788355827, 0.012287193909287453, 0.02956434153020382, 0.023742152377963066, -0.03172146901488304, -0.007708203513175249, 0.021450746804475784, 0.0004970224108546972, -0.019151678308844566, 0.02171020768582821, 0.020247410982847214, -0.006072426214814186, 0.008740440011024475, 0.014978193677961826, 0.020123153924942017, -0.04121073707938194, -0.02285008691251278, -0.038317564874887466, -0.02718440629541874, -0.012948540970683098, -0.024735573679208755, -0.007140648551285267, 0.05794396251440048, 0.013413923792541027, 0.02093276008963585, 0.013519812375307083, 0.016546785831451416, 0.026642505079507828, 0.0012209778651595116, -0.0316140241920948, -0.00041352352127432823, -0.012962874956429005, 0.009029725566506386, 0.033103860914707184, -0.025913599878549576, 0.0006741551915183663, 0.02658589743077755, -0.001985571114346385, -0.030246013775467873, 0.026736032217741013, -0.006662266328930855, 0.027725260704755783, -0.008328044787049294, -0.029254479333758354, -0.030161693692207336, -0.006384550128132105, 0.02901586890220642, 0.051264628767967224, 0.05376117303967476, -0.02493400312960148, 0.022868206724524498, -0.04981258884072304, 0.05243852362036705, 0.039317939430475235, -0.007198967970907688, 0.064228355884552, -0.017876457422971725, 0.04697992280125618, 0.016363129019737244, -0.02024383842945099, 0.005859203636646271, -0.013716891407966614, 0.034459151327610016, 0.0013498234329745173, 0.047791823744773865, 0.018545374274253845, 0.026340439915657043, -0.030357424169778824, -0.022289816290140152, 0.00665426068007946, -0.058275025337934494, 0.005235401913523674, -0.038427967578172684, -0.012096173129975796, 0.00887556653469801, -0.03329326957464218, 0.023288678377866745, 0.03268365189433098, 0.02828828990459442, -0.011166432872414589, -0.011956795118749142, 0.01849367469549179, 0.026931770145893097, 0.05779963731765747, 0.028581520542502403, -0.006512098014354706, 0.016717493534088135, 0.058276381343603134, -0.03184524551033974, 0.04763580858707428, -0.03238740190863609, -0.03589248284697533, 0.021264582872390747, -0.01723462902009487, -0.028527764603495598, -0.022142495959997177, 0.010272015817463398, -0.030927997082471848, -0.043716736137866974, 0.046946585178375244, -0.02068110927939415, 0.0025288125034421682, -0.01014783140271902, 0.014959205873310566, -0.027680501341819763, -0.036696866154670715, -0.01612498238682747, 0.042592138051986694, 0.02081848308444023, -0.006401849910616875, -0.02526821196079254, -0.005140621215105057, -0.03612320125102997, 0.027793092653155327, -0.03612273186445236, -0.0018196096643805504, -0.035890817642211914, -0.015581464394927025, -0.026905549690127373, 0.03692783787846565, -0.023257816210389137, 0.030738264322280884, 0.013250119984149933, 0.0012751001631841063, -0.006963115185499191, 0.02893294021487236, 0.010500505566596985, 0.014105592854321003, -0.012595877051353455, 0.032820649445056915, -0.039489321410655975, -0.04020053148269653, -0.03486645594239235, -0.028849251568317413, 0.04424284026026726, -0.03079206310212612, 0.001160057378001511, 0.004950323142111301, -0.019734568893909454, -0.040423594415187836, -0.009910144843161106, 0.018619785085320473, 0.0109671326354146, -0.013400213792920113, 0.032573480159044266, 0.021952783688902855, -0.04652295634150505, 0.0013700872659683228, 0.014806423336267471, 0.027878694236278534, 0.03383484482765198, 0.04489240422844887, 0.030092623084783554, 0.005579458549618721, 0.014047698117792606, -0.003298344323411584, 0.06129167973995209, 0.004373953212052584, 0.03946346789598465, 0.02740088291466236, 0.05178293585777283, 0.010814816690981388, -0.03821154311299324, 0.004936541430652142, -0.05215107277035713, -0.007113971281796694, -0.013744263909757137, -0.04709814116358757, -0.03247974067926407, -0.03148181363940239, -0.031116098165512085, 0.01828368566930294, -0.03133019804954529, 0.00038194985245354474, -0.017333069816231728, 0.02208167314529419, -0.03918609395623207, 0.016118237748742104, 0.0665317177772522, 0.07513883709907532, 0.026508754119277, -0.049925774335861206, 0.00967918336391449, -0.017660140991210938, 0.047816552221775055, -0.011318041011691093, 0.00794824119657278, 0.014541835524141788, -0.008344694972038269, -0.038154345005750656, 0.0532589927315712, -0.04434255138039589, -0.03687374293804169, 0.043095991015434265, -0.008661373518407345, -0.012544658966362476, -0.010653835721313953, -0.00011263538181083277, 0.002306501381099224, -0.029411781579256058, 0.04713752493262291, -0.024992763996124268, 0.019211947917938232, 0.013427544385194778, -0.024281339719891548, -0.031176410615444183, -0.01589636504650116, -0.005994404200464487, -0.023443184792995453, 0.009668824262917042, 0.02827119268476963, -0.042345352470874786, -0.03361573442816734, -0.04638339579105377, 0.013997777365148067, -0.014935198239982128, -0.05336873605847359, -0.030637813732028008, 0.0060536363162100315, 0.011661331169307232, -0.03522191569209099, -0.08843985944986343, 0.045693423599004745, -0.006891520228236914, -0.03569552302360535, 0.018202414736151695, 0.0012031708611175418, -0.020864078775048256, -0.00825171172618866, 0.003796824486926198, 0.012524913065135479, 0.020057685673236847, 0.03120524436235428, -0.008276059292256832, 0.014773639850318432, 0.023907838389277458 ]
The Partnership: Amazon SageMaker and Hugging Face
philschmid
March 23, 2021
the-partnership-amazon-sagemaker-and-hugging-face
partnerships, aws
https://huggingface.co/blog/the-partnership-amazon-sagemaker-and-hugging-face
Documentation - Hugging Face documentation for Amazon SageMaker - Run training on Amazon SageMaker - Deploy models to Amazon SageMaker - Frequently Asked Questions - Amazon SageMaker documentation for Hugging Face - Python SDK SageMaker documentation for Hugging Face - Deep Learning Container - SageMaker's Distributed Data Parallel Library - SageMaker's Distributed Model Parallel Library
[ 0.03946154937148094, -0.016023511067032814, 0.03537756949663162, 0.005773992743343115, 0.08292773365974426, 0.0822201669216156, -0.005518543999642134, 0.022177068516612053, -0.0418362021446228, -0.05971478298306465, -0.051275189965963364, 0.051947224885225296, 0.007158293854445219, 0.09690853208303452, -0.013820316642522812, -0.010204353369772434, 0.029605763033032417, 0.017888013273477554, -0.012836918234825134, 0.03299734368920326, 0.0014143812004476786, -0.037006210535764694, 0.0073892492800951, 0.029279503971338272, -0.009628696367144585, -0.029955852776765823, 0.026947643607854843, -0.012500321492552757, -0.016293808817863464, 0.043348528444767, -0.11218608915805817, -0.0009402394061908126, 0.03140381723642349, -0.010102015919983387, 0.011970147490501404, 0.027129752561450005, -0.14466507732868195, 0.06191882863640785, 0.01210431195795536, -0.023501001298427582, 0.003001017030328512, -0.03419007360935211, -0.08416113257408142, 0.05387686938047409, -0.009364360943436623, -0.03225872293114662, -0.1926657110452652, 0.0854664146900177, 0.026123687624931335, -0.004488601814955473, -0.10522717982530594, 0.08122359216213226, 0.017015837132930756, -0.008164460770785809, 0.014988201670348644, 0.007034107111394405, -0.01830008625984192, -0.045274849981069565, -0.0013530527940019965, -0.020534049719572067, 0.008330395445227623, -0.024711918085813522, -0.020191263407468796, 0.00581340491771698, 0.033722177147865295, 0.019081758335232735, 0.014689303934574127, -0.027062982320785522, -0.045876726508140564, -0.0013520304346457124, 0.0025293591897934675, -0.06424089521169662, -0.035624854266643524, -0.006037726067006588, -0.006611622404307127, -0.07381897419691086, 0.002437986433506012, -0.018171517178416252, 0.05968432128429413, 0.06308479607105255, -0.03303911164402962, -0.007119706366211176, 0.014868632890284061, 0.06734564900398254, 0.023009682074189186, -0.008601374924182892, 0.03435608744621277, -0.05877005681395531, -0.026428386569023132, 0.0618378221988678, -0.009171691723167896, -0.09473783522844315, -0.0031546943355351686, 0.01279117725789547, 0.05232149362564087, -0.043660420924425125, 0.027919886633753777, -0.013316531665623188, 0.006324338261038065, -0.007184247486293316, 0.012864883989095688, -0.044333916157484055, 0.0358692966401577, -0.014526480808854103, -0.021230682730674744, 0.02784954197704792, -0.003309553023427725, -0.11701588332653046, -0.028765268623828888, 0.01724192127585411, 0.014903770759701729, 0.005980946589261293, -0.008134681731462479, 0.054273784160614014, -0.10782135277986526, 0.09966585785150528, 0.01860656961798668, -0.025987636297941208, 0.034508999437093735, 0.010526064783334732, 0.03087850846350193, 0.12013567239046097, 0.07610920816659927, 0.01978949084877968, 0.00250524515286088, 0.06470398604869843, 0.025889214128255844, -0.01583057828247547, -0.03216971457004547, -0.04473575949668884, 0.024863284081220627, -0.048439186066389084, 0.049922335892915726, -0.006011972203850746, -0.011103128083050251, -0.07478182762861252, -0.007423742674291134, -0.05706413835287094, 0.03288012370467186, 0.024053869768977165, 0.0014736264711245894, 0.11481859534978867, 0.016937121748924255, 0.08679872751235962, 0.0662476122379303, 0.023485513404011726, -0.05797955021262169, 0.033224765211343765, -0.03978044167160988, 0.046722520142793655, -0.07839880138635635, 0.0714540183544159, -0.03568892180919647, -0.07926810532808304, 0.008175934664905071, 0.08581776171922684, -0.01874450035393238, 0.016624564304947853, -0.05214640125632286, -0.061619289219379425, -0.009797400794923306, -0.006004026625305414, -0.043230313807725906, -0.021291518583893776, 0.030722344294190407, -0.011831643991172314, 0.037793342024087906, 0.009906300343573093, 0.0321158692240715, -0.0583970807492733, -0.009156892076134682, -0.03712340444326401, 0.04385746270418167, 0.00430498318746686, -0.005889269057661295, 0.051805682480335236, 0.06454171240329742, 0.10317189246416092, -0.02188960649073124, -0.010221896693110466, -0.039974503219127655, 0.044910892844200134, -0.0361846461892128, -0.008304326795041561, 0.04028177633881569, -0.02937660925090313, 0.03485143184661865, 0.026157261803746223, 0.006832439918071032, 0.04521343484520912, -0.06578059494495392, -0.015310862101614475, 0.06203227862715721, -0.004555057268589735, 0.025957705453038216, -0.06889521330595016, -0.029789768159389496, 0.14067383110523224, 0.012518576346337795, 0.06941824406385422, 0.06281274557113647, 0.02609378844499588, 0.0012742498656734824, 0.024588540196418762, -0.024648277088999748, 0.054448164999485016, 0.025890981778502464, -0.028110424056649208, 0.054481811821460724, -0.03285546973347664, 0.020306799560785294, -0.12053779512643814, 0.03423338755965233, -0.07859944552183151, 0.01617019809782505, -0.01076600607484579, -0.02462993748486042, -0.024985475465655327, 0.04658040404319763, 0.013049671426415443, 0.17344553768634796, -0.030267752707004547, 0.021099844947457314, -0.010726134292781353, -0.014826816506683826, 0.05036189407110214, 0.0857696682214737, 0.07292490452528, 0.10204259306192398, -0.09128663688898087, -0.013567334972321987, -0.0525847002863884, -0.010792993940412998, 0.06117989495396614, 0.020994145423173904, -0.010344239883124828, 0.02041868306696415, -0.0372682586312294, 0.01433851383626461, -0.018083613365888596, 0.03176560625433922, -0.015409955754876137, 0.011386102996766567, 0.025094827637076378, -0.001399112050421536, -0.0482323095202446, 0.04103705659508705, 0.0003951470134779811, -0.05898463353514671, 0.002776766661554575, -0.08301451802253723, 0.06829270720481873, 0.016034379601478577, -0.026611462235450745, 0.05830225348472595, 0.004548890981823206, -0.00982767902314663, -0.01058564055711031, 0.012634393759071827, 0.042636219412088394, 0.004668444395065308, -0.005176337901502848, -0.016577303409576416, -0.041419949382543564, -0.02841818705201149, -0.04449398070573807, -0.02017330937087536, -0.009010525420308113, 0.006535002496093512, 0.039621639996767044, 0.007243097759783268, -0.03119729273021221, 0.029839666560292244, 0.012545254081487656, -0.006591138429939747, 0.013265129178762436, 0.047509364783763885, 0.0016252151690423489, -0.004003778100013733, -0.024052247405052185, 0.006105528678745031, -0.040322765707969666, 0.010254239663481712, 0.03323604539036751, 0.021531257778406143, -0.022959034889936447, -0.006050777155905962, -0.033558957278728485, -0.045330338180065155, 0.008030992932617664, 0.02188900113105774, 0.04708736389875412, -0.0010757806012406945, -0.03233898803591728, 0.02346649393439293, 0.024571947753429413, -0.008616704493761063, -0.018399182707071304, -0.015663592144846916, 0.04962082579731941, 0.00715514924377203, 0.008995261043310165, -0.012878690846264362, -0.006820851005613804, -0.05003716051578522, 0.013087542727589607, 0.02710437960922718, 0.012319195084273815, -0.12791544198989868, -0.04323171079158783, -0.0013006269000470638, 0.03813992440700531, -0.005047190468758345, -0.02400718443095684, 0.06105661019682884, -0.029611872509121895, -0.009862851351499557, 0.014186102896928787, 0.020876439288258553, 0.02749590203166008, 0.02639307640492916, -0.019120771437883377, -0.013312219642102718, -0.0012453790986910462, -0.021301371976733208, -0.0017678039148449898, 0.020539388060569763, 0.0075060403905808926, -0.035752005875110626, 0.04690863564610481, -0.003662403440102935, -0.015677262097597122, -0.008107990026473999, -0.0035389892291277647, 0.02823459729552269, 0.015293546952307224, 0.023983759805560112, -0.03532150760293007, -0.03824556618928909, -0.00312366196885705, -0.04263681545853615, 0.014822943136096, -0.03276969864964485, -0.0034150078427046537, -0.014655773527920246, 0.029948312789201736, 0.02663455717265606, 0.03853460028767586, 0.011283153668045998, 0.015943819656968117, 0.036289896816015244, -0.0032851959113031626, 0.008500014431774616, 0.025178637355566025, -0.023867174983024597, 0.01940031722187996, 0.05266247317194939, -0.010660764761269093, -0.030233781784772873, -0.0000643053645035252, 0.014780182391405106, 0.014645377174019814, -0.008768635801970959, 0.00799612607806921, -0.0015861971769481897, 0.02903527021408081, 0.025626961141824722, -0.024904370307922363, -0.047502849251031876, 0.023096710443496704, -0.008490204811096191, -0.03007511794567108, -0.008165791630744934, 0.038396112620830536, -0.002105663064867258, 0.0040558637119829655, -0.012358907610177994, 0.03227686509490013, -0.00793435424566269, 0.028235243633389473, -0.0158174280077219, 0.01494747307151556, -0.021454963833093643, -0.004212492611259222, -0.009595504030585289, -0.007556362543255091, 0.0632946640253067, 0.017133081331849098, -0.01771206595003605, -0.01892416924238205, -0.010290180332958698, -0.04675804451107979, 0.01392322313040495, 0.0030698662158101797, 0.004983891267329454, -0.015151315368711948, 0.03759763389825821, 0.06389845907688141, -0.011778810992836952, -0.03600677102804184, 0.03946215286850929, -0.010288814082741737, 0.003581757191568613, -0.000736963062081486, 0.05077246204018593, 0.009338349103927612, -0.011613422073423862, 0.020914634689688683, 0.02379288710653782, -0.020766692236065865, 0.002477359026670456, -0.0141673618927598, -0.011843944899737835, 0.03801681101322174, -0.039069537073373795, -0.04429520666599274, -0.006984206847846508, -0.029289906844496727, 0.03590596094727516, -0.013858096674084663, 0.021357040852308273, -0.027159832417964935, -0.0020717312581837177, 0.043990358710289, -0.03437946364283562, -0.04477980360388756, -0.02126011624932289, 0.04083880037069321, -0.04312484711408615, 0.045960985124111176, -0.030307594686746597, -0.03590772673487663, -0.011036512441933155, -0.013172321952879429, 0.012225283309817314, 0.028177393600344658, -0.007194466423243284, -0.012099857442080975, -0.032425541430711746, -0.025338489562273026, 0.03289108723402023, -0.003791633527725935, 0.008770975284278393, 0.016135862097144127, -0.026467345654964447, 0.04912775754928589, 0.01824882999062538, -0.021910754963755608, -0.013469222001731396, -0.0069184135645627975, 0.03591148555278778, -0.009678815491497517, 0.040894102305173874, -0.01708412542939186, -0.06459642946720123, -0.022423364222049713, -0.04367635399103165, 0.046292971819639206, 0.03813283517956734, 0.0020621069706976414, -0.0615323968231678, 0.016903316602110863, 0.010782706551253796, -0.01879245787858963, 0.006400034762918949, 0.027757104486227036, 0.003742021741345525, 0.0652666687965393, -0.02950562909245491, -0.004352487623691559, -0.0262985210865736, 0.012121962383389473, 0.013539348728954792, 0.01306150108575821, -0.020310966297984123, -0.06070253252983093, 0.00854345690459013, 0.015131325460970402, -0.02413317747414112, -0.030229277908802032, 0.011565780267119408, -0.046436961740255356, 0.011622936464846134, 0.05509022995829582, 0.04697299748659134, 0.029165765270590782, -0.0061309137381613255, 0.022303083911538124, -0.03257919102907181, -0.004826657008379698, -0.018483426421880722, -0.006857639644294977, -0.031173577532172203, 0.03124227002263069, 0.056253474205732346, 0.020641528069972992, 0.0018746152054518461, 0.04753408581018448, -0.020905617624521255, -0.021625660359859467, 0.02643909491598606, -0.030526407063007355, 0.014290324412286282, 0.00012906482152175158, 0.01812363602221012, 0.009601527824997902, -0.023453865200281143, 0.000006244156338652829, 0.014594114385545254, 0.04288250580430031, -0.02248854748904705, -0.005578718613833189, 0.035158343613147736, -0.014651202596724033, -0.010709921829402447, -0.03920803591609001, 0.011783086694777012, -0.04095310717821121, -0.001944438205100596, 0.012003033421933651, -0.03718138858675957, -0.01888183131814003, -0.010834728367626667, -0.026472538709640503, -0.024602901190519333, 0.03343404829502106, 0.01921970583498478, 0.019569920375943184, -0.006407000590115786, 0.0020018538925796747, 0.008924073539674282, 0.006536816246807575, 0.024149538949131966, -0.021950336173176765, 0.007808543276041746, 0.03865879029035568, -0.02245514653623104, 0.04038028046488762, 0.013755032792687416, -0.005219327751547098, -0.034725114703178406, 0.007936088368296623, -0.0053678397089242935, -0.001708165043964982, -0.04872933402657509, 0.04506523534655571, 0.0081012649461627, -0.013204561546444893, -0.007646625395864248, -0.014220836572349072, -0.015347563661634922, 0.00038188870530575514, -0.030648978427052498, 0.025937961414456367, 0.07299067825078964, -0.025758741423487663, 0.006596571300178766, -0.008952273055911064, 0.024596460163593292, 0.007692441344261169, 0.04667947441339493, -0.014234045520424843, 0.0327412374317646, 0.006241721101105213, 0.00009754674101714045, 0.009887193329632282, 0.003956177271902561, -0.03252485394477844, 0.02605639025568962, -0.07250364124774933, 0.029333341866731644, 0.0035003761295229197, -0.04049699380993843, 0.0019235286163166165, 0.0007237752433866262, -0.04296375811100006, 0.02266491763293743, 0.029078204184770584, 0.04207661375403404, 0.049859583377838135, 0.010316373780369759, -0.015956919640302658, 0.006019815802574158, -0.013151131570339203, 0.019236767664551735, 0.06415416300296783, -0.03429774194955826, 0.010425007902085781, 0.0022071131970733404, 0.041188500821590424, 0.028089292347431183, 0.027260595932602882, 0.010694506578147411, 0.0038766036741435528, 0.05967772379517555, -0.016919633373618126, 0.03915220499038696, 0.03712286055088043, -0.018915588036179543, -0.00845495704561472, -0.03205002099275589, -0.0023259937297552824, -0.030256150290369987, -0.004703423473984003, 0.046859193593263626, -0.0035380551125854254, 0.03693339601159096, -0.020016774535179138, 0.05805930122733116, 0.0545230470597744, 0.021023858338594437, 0.000879368744790554, 0.012913588434457779, 0.05808813124895096, 0.012641038745641708, 0.007997558452188969, 0.03316907957196236, -0.009040922857820988, 0.025698937475681305, 0.04534187912940979, 0.005157644394785166, 0.016539474949240685, -0.018856216222047806, -0.03230578452348709, -0.003422623500227928, -0.0125206857919693, 0.008273622021079063, -0.02701915055513382, 0.02443075366318226, -0.04717080295085907, -0.005041563883423805, -0.010865887627005577, -0.023852353915572166, -0.006507225334644318, -0.02763519622385502, 0.029089907184243202, -0.017115673050284386, -0.012833211570978165, 0.010189501568675041, 0.03679357096552849, -0.003175318008288741, -0.050345469266176224, -0.010660502128303051, 0.037623289972543716, 0.003007882507517934, 0.013378864154219627, -0.023696841672062874, -0.01617395132780075, -0.01840597204864025, -0.004410332068800926, -0.0046345884911715984, 0.01493567693978548, -0.02679307945072651, -0.006399332080036402, 0.015574169345200062, 0.02372913621366024, -0.01856139861047268, 0.031001919880509377, 0.025626858696341515, 0.005705391522496939, -0.022469330579042435, 0.027748966589570045, -0.01068246178328991, 0.00008744982915231958, -0.00168471725191921, -0.041944995522499084, 0.03970981761813164, -0.019661271944642067, 0.029323121532797813, 0.007203606888651848, 0.020758889615535736, 0.006144682876765728, -0.02117670513689518, -0.02491365373134613, -0.0043708947487175465, -0.015342716127634048, 0.016754524782299995, 0.010908887721598148, -0.04054627940058708, 0.00935609545558691, -0.0054176547564566135, -0.003231008304283023, -0.015191738493740559, 0.016584644094109535, 0.015827486291527748, -0.03540826588869095, 0.0073113939724862576, -0.014085553586483002, 0.059619639068841934, 0.030697224661707878, 0.017904963344335556, 0.021236024796962738, 0.00803339947015047, 0.01669883169233799, -0.04998597875237465, -0.00018323883705306798, -0.020496852695941925, 0.005093208514153957, -0.0373523086309433, -0.059317417442798615, -0.02139064110815525, -0.03971143066883087, -0.009584330022335052, 0.007494645658880472, -0.05309115722775459, -0.01318895723670721, 0.0006204982055351138, -0.002364278770983219, -0.04169302061200142, 0.0027126579079777002, 0.07379388809204102, 0.04674340412020683, 0.03655795007944107, -0.0025373727548867464, -0.02443723939359188, 0.00400314899161458, -0.003336861729621887, 0.03489638492465019, 0.04934535175561905, -0.0007509950664825737, -0.0019235500367358327, -0.038753949105739594, -0.004459949675947428, -0.02922014892101288, -0.06193051487207413, 0.007213264238089323, 0.016208238899707794, -0.0197912510484457, -0.04188544303178787, -0.009979388676583767, 0.021337436512112617, 0.0280865840613842, 0.04345957934856415, -0.020266594365239143, -0.01867697201669216, -0.01989142782986164, -0.00579368369653821, -0.055463287979364395, 0.017643241211771965, -0.03448169678449631, -0.026073437184095383, 0.03514180704951286, 0.010191373527050018, 0.014163890853524208, -0.044134072959423065, -0.015730028972029686, -0.009966409765183926, -0.017571724951267242, -0.04786562919616699, -0.044087741523981094, 0.0015642177313566208, 0.010305911302566528, -0.030369622632861137, -0.04549436271190643, 0.005840659607201815, -0.0011300690239295363, -0.031759876757860184, -0.020548231899738312, -0.020535079762339592, -0.010530455969274044, -0.05429218336939812, 0.028984209522604942, 0.018022792413830757, 0.057808730751276016, 0.033294420689344406, -0.023699894547462463, -0.005310933105647564, 0.01732126623392105 ]
The Partnership: Amazon SageMaker and Hugging Face
philschmid
March 23, 2021
the-partnership-amazon-sagemaker-and-hugging-face
partnerships, aws
https://huggingface.co/blog/the-partnership-amazon-sagemaker-and-hugging-face
Sample Notebook - all Notebooks - Getting Started Pytorch - Getting Started Tensorflow - Distributed Training Data Parallelism - Distributed Training Model Parallelism - Spot Instances and continue training - SageMaker Metrics - Distributed Training Data Parallelism Tensorflow - Distributed Training Summarization - Image Classification with Vision Transformer - Deploy one of the 10,000+ Hugging Face Transformers to Amazon SageMaker for Inference - Deploy a Hugging Face Transformer model from S3 to SageMaker for inference ---
[ 0.024646680802106857, -0.0316416397690773, -0.01916968636214733, 0.027415169402956963, 0.058963846415281296, 0.07039180397987366, 0.011863441206514835, 0.05677204951643944, -0.06815119832754135, -0.07395008206367493, -0.041576649993658066, 0.04388733580708504, 0.026607133448123932, 0.09625252336263657, 0.010451334528625011, -0.023715917021036148, 0.022702833637595177, 0.012349260970950127, -0.011838246136903763, 0.036637648940086365, 0.009193453006446362, -0.036355290561914444, -0.02621331810951233, 0.02048920840024948, -0.010098230093717575, -0.02348264679312706, 0.03724914416670799, 0.0012020689900964499, -0.042326975613832474, 0.061006441712379456, -0.11889734864234924, 0.0005058706155978143, 0.03705056011676788, 0.0020319053437560797, -0.01964014582335949, 0.0016368686920031905, -0.1226566806435585, 0.07356606423854828, 0.03834269195795059, -0.04123946279287338, 0.03244912251830101, -0.046708978712558746, -0.08050233125686646, 0.046411577612161636, -0.0008755088201723993, 0.012083682231605053, -0.16513468325138092, 0.04914836585521698, 0.012453405186533928, -0.004533989820629358, -0.08422033488750458, 0.08971294015645981, 0.019931603223085403, -0.02604738436639309, -0.005818580277264118, 0.04977507144212723, 0.03307545557618141, -0.047237396240234375, 0.01910279132425785, -0.013577170670032501, 0.010988746769726276, 0.0019134941976517439, -0.01027480885386467, 0.05072231963276863, 0.005015564616769552, -0.010158267803490162, 0.040704432874917984, -0.01369998324662447, -0.04537418112158775, -0.01793978363275528, 0.008176524192094803, -0.0674908310174942, -0.01609836518764496, -0.01990484446287155, -0.017535382881760597, -0.07338126748800278, 0.027302436530590057, -0.04525604844093323, 0.01508923526853323, 0.04163815826177597, -0.018714115023612976, -0.01208080630749464, 0.011311507783830166, 0.05048374831676483, 0.04675981402397156, -0.004300587344914675, -0.0027375577483326197, -0.0380055271089077, -0.043270889669656754, 0.08428041636943817, 0.03544861078262329, -0.09581836313009262, -0.013326975516974926, 0.025792893022298813, 0.020158987492322922, -0.037210170179605484, 0.02383529208600521, -0.039125531911849976, -0.007277822587639093, -0.05505150929093361, 0.044580262154340744, -0.052349917590618134, 0.02111188694834709, -0.05226806923747063, -0.0008826191769912839, 0.05212393030524254, -0.007077828515321016, -0.12394167482852936, -0.036132801324129105, 0.02936158888041973, -0.021432803943753242, -0.031074322760105133, -0.02917107194662094, 0.06077686697244644, -0.10074641555547714, 0.0396878756582737, 0.001612723688594997, -0.026446672156453133, 0.02557210437953472, 0.0009210437419824302, 0.019457217305898666, 0.09227534383535385, 0.06958255171775818, 0.001230381429195404, -0.02992309257388115, 0.06850240379571915, -0.000971156929153949, -0.0519346259534359, -0.038099583238363266, -0.0313742496073246, 0.061134614050388336, -0.0928015187382698, 0.05132514610886574, -0.0001936184271471575, -0.015274968929588795, -0.09098141640424728, 0.014117498882114887, -0.059969719499349594, 0.02370179258286953, 0.05690903216600418, 0.0013146671699360013, 0.09875226020812988, 0.03049635700881481, 0.0480668880045414, 0.05196082219481468, 0.013366280123591423, -0.05348866432905197, 0.049809712916612625, 0.0009436797117814422, 0.02625482901930809, -0.11393451690673828, 0.09020346403121948, -0.06640361249446869, -0.032878365367650986, 0.045080456882715225, 0.06032351776957512, 0.029252782464027405, -0.00638884911313653, -0.06502159684896469, -0.03512810543179512, -0.029169395565986633, 0.031042560935020447, -0.03284703567624092, 0.02920435182750225, -0.013111666776239872, -0.029887204989790916, 0.05120231211185455, 0.0017510970355942845, 0.044196613132953644, -0.01752423122525215, -0.010102823376655579, -0.05496169626712799, 0.007656723260879517, 0.01010473445057869, -0.015842271968722343, 0.07418055087327957, 0.047440748661756516, 0.0970688909292221, 0.016688035801053047, -0.010210140608251095, -0.03155794367194176, 0.018702784553170204, -0.0032369738910347223, -0.0034880717284977436, 0.055685654282569885, -0.056928593665361404, 0.0741524025797844, -0.0005453538615256548, -0.0004325679037719965, 0.036143600940704346, -0.08449617773294449, -0.021518371999263763, 0.07427425682544708, -0.01653081551194191, 0.047365255653858185, -0.07004547119140625, -0.011820755898952484, 0.09853367507457733, 0.00940707791596651, 0.05759074166417122, 0.019816206768155098, -0.017055219039320946, -0.022396652027964592, 0.020495228469371796, -0.012157169170677662, 0.03775395452976227, -0.003442643443122506, -0.026236148551106453, 0.05412828549742699, -0.02724338509142399, 0.003923778887838125, -0.12978973984718323, -0.001598007627762854, -0.04052693396806717, 0.02170463278889656, -0.006161564961075783, -0.06905145198106766, 0.0401228591799736, 0.06360287219285965, -0.004195218440145254, 0.1728704869747162, -0.04363582655787468, 0.005056477151811123, 0.018402287736535072, 0.009726964868605137, 0.00645739771425724, 0.09574157744646072, 0.07755901664495468, 0.09551768749952316, -0.08098546415567398, -0.03871900960803032, -0.02756146341562271, -0.03262050077319145, 0.06421568989753723, 0.03785570710897446, -0.02831033244729042, -0.011290214024484158, -0.05731041356921196, 0.04338877648115158, -0.0336647666990757, 0.04276305437088013, 0.017745953053236008, 0.020345592871308327, -0.009112372063100338, 0.013428090140223503, -0.05022843927145004, 0.06956415623426437, -0.000002774197355392971, -0.021111134439706802, -0.034611206501722336, -0.11215469986200333, 0.0571264922618866, 0.018638601526618004, -0.036147281527519226, 0.03917383402585983, 0.01868441328406334, 0.008375642821192741, 0.01203395426273346, 0.004739943891763687, 0.04717627167701721, -0.001740646781399846, 0.004739564843475819, -0.025360172614455223, -0.052881281822919846, -0.023452097550034523, -0.026060054078698158, -0.005442287772893906, -0.0002790568396449089, 0.01841912604868412, -0.0023301311302930117, 0.014504832215607166, -0.033672820776700974, 0.034130971878767014, -0.0011238440638408065, 0.019543234258890152, -0.013487567193806171, 0.035121846944093704, 0.012308411300182343, 0.00353694474324584, -0.02224670723080635, -0.007381299044936895, -0.03211459144949913, 0.025387179106473923, 0.0119097288697958, 0.030276823788881302, -0.026585131883621216, 0.0034552484285086393, -0.027408655732870102, -0.03797537833452225, -0.013980833813548088, 0.033117592334747314, 0.05770397186279297, 0.005748213734477758, -0.01650938205420971, 0.01631734147667885, 0.03897050395607948, 0.005643364507704973, -0.03074393793940544, -0.01746390014886856, 0.032487113028764725, -0.014004151336848736, -0.006672114133834839, 0.010389401577413082, -0.026265177875757217, -0.027950389310717583, 0.018371012061834335, 0.025264747440814972, 0.028546446934342384, -0.11161495745182037, -0.03534708172082901, 0.01323850266635418, 0.049791350960731506, 0.00421413779258728, -0.0350322425365448, 0.03900645300745964, -0.011878613382577896, -0.021922487765550613, -0.008293434977531433, -0.0030595429707318544, 0.01602756418287754, 0.019163550809025764, 0.0007529898430220783, -0.014015765860676765, 0.013936311937868595, 0.0027663654182106256, -0.016459479928016663, 0.042729951441287994, 0.03284697234630585, -0.05169685557484627, 0.03192867338657379, -0.008490324020385742, -0.01303007174283266, -0.0067060175351798534, 0.013890789821743965, 0.031000422313809395, 0.029163485392928123, 0.030758582055568695, -0.024210063740611076, 0.005610655061900616, 0.002778098452836275, -0.049105871468782425, -0.0018844513688236475, -0.00507665378972888, 0.0030254540033638477, -0.024928338825702667, 0.03542196750640869, 0.019184131175279617, 0.027375437319278717, 0.029224758967757225, -0.005001398269087076, 0.02770003117620945, -0.01658010669052601, 0.0467987135052681, 0.015520621091127396, -0.014212368056178093, 0.00502258725464344, 0.0453522689640522, -0.038282476365566254, -0.014045393094420433, 0.0004498264752328396, 0.019977865740656853, 0.022172048687934875, -0.011724050156772137, -0.0013410880928859115, -0.023586520925164223, 0.020754028111696243, 0.019157826900482178, -0.01764659769833088, -0.025789406150579453, 0.04091981425881386, -0.013778685592114925, -0.04708471521735191, -0.019220909103751183, 0.05556740239262581, 0.025151582434773445, -0.0028814231045544147, -0.02872207760810852, 0.014127813279628754, -0.038137976080179214, 0.06564304977655411, -0.019648151472210884, 0.0013524778187274933, -0.04993675276637077, 0.015009528957307339, -0.026379430666565895, -0.02049173042178154, 0.06200561299920082, 0.03983758017420769, -0.02502501755952835, -0.031301289796829224, -0.02754710242152214, -0.05348368361592293, 0.020418118685483932, 0.016739455983042717, 0.016653653234243393, -0.0619291216135025, 0.040565408766269684, 0.04921562224626541, 0.008619901724159718, -0.031062182039022446, 0.03996134176850319, -0.019737547263503075, 0.006150323431938887, 0.006123857107013464, 0.014389819465577602, -0.005139704328030348, -0.003360309172421694, 0.0020763089414685965, 0.007268620654940605, -0.04476650431752205, 0.028031492605805397, -0.008147538639605045, -0.012384564615786076, 0.050811223685741425, -0.026860464364290237, -0.030788535252213478, -0.016293302178382874, -0.015890982002019882, 0.04705975949764252, 0.000048628087824909016, 0.02292148396372795, -0.009384077973663807, 0.008374041877686977, 0.04572928324341774, -0.007823368534445763, -0.038287390023469925, -0.01620480976998806, 0.02119140885770321, -0.029555650427937508, 0.01622036285698414, -0.008282771334052086, -0.04402407631278038, 0.007293112576007843, -0.010174606926739216, 0.02841225452721119, 0.014121996238827705, 0.001887534512206912, -0.04569181799888611, -0.01180102676153183, -0.02322227507829666, 0.019027099013328552, 0.0462883897125721, -0.005084403790533543, 0.006189459934830666, -0.01988484337925911, 0.027756907045841217, 0.0037864663172513247, -0.0014719190075993538, -0.017615020275115967, 0.02666151151061058, 0.03878512978553772, -0.00626303581520915, 0.01968519575893879, 0.009892203845083714, -0.07372360676527023, -0.011001390404999256, -0.050795141607522964, 0.028738470748066902, 0.010957881808280945, 0.003940270747989416, -0.02634160965681076, 0.03725207969546318, 0.029268987476825714, -0.004478047136217356, -0.013689231127500534, 0.0053496770560741425, 0.015636980533599854, 0.08120787143707275, -0.029546238481998444, 0.0060811652801930904, -0.03747693449258804, 0.01184737030416727, 0.0171901136636734, 0.009815376251935959, -0.0010472110006958246, -0.05886790528893471, 0.018481256440281868, 0.018756333738565445, 0.004392633214592934, -0.03506273776292801, 0.014086788520216942, -0.024059485644102097, 0.01415460929274559, 0.0783793032169342, 0.03741798922419548, 0.040917813777923584, -0.021213708445429802, 0.014632876962423325, -0.018908938392996788, -0.03976687043905258, -0.0015328736044466496, -0.020909152925014496, -0.00698376540094614, 0.0038790195249021053, 0.05293647199869156, 0.030216433107852936, -0.008724951185286045, 0.03759659454226494, -0.007406438235193491, -0.02906944788992405, 0.01497033704072237, -0.023864125832915306, -0.0031404716428369284, 0.001908751088194549, 0.021074514836072922, 0.03958750143647194, -0.021128181368112564, -0.01488588284701109, 0.003886535530909896, 0.049708083271980286, -0.016167616471648216, -0.02413284033536911, 0.018585186451673508, -0.017120612785220146, -0.006576023064553738, -0.04268234968185425, -0.000804015900939703, -0.03770150616765022, 0.005251755937933922, 0.0026480352971702814, -0.016295574605464935, -0.027246538549661636, 0.004760622512549162, -0.03546596318483353, -0.022982282564044, 0.02492688037455082, 0.039873167872428894, 0.0362839438021183, -0.04012405872344971, 0.0014868228463456035, 0.031882740557193756, 0.015094898641109467, 0.007134057115763426, -0.03426492586731911, -0.004279926884919405, 0.005244406405836344, -0.040081191807985306, 0.05196557566523552, 0.0061307926662266254, 0.03489577770233154, -0.03451305627822876, 0.02359948679804802, -0.0012299063382670283, 0.003224382409825921, -0.02133128046989441, 0.05139995738863945, 0.047790639102458954, -0.03970005735754967, -0.036497052758932114, -0.010497068986296654, -0.0019481489434838295, -0.0024949940852820873, -0.029117828235030174, 0.02600429393351078, 0.08431795239448547, -0.02998531050980091, 0.012416164390742779, -0.021887490525841713, -0.00008675974095240235, 0.021505624055862427, 0.035562701523303986, -0.0174518134444952, 0.01920880377292633, 0.009613034315407276, 0.0018514101393520832, 0.0015468158526346087, 0.0298566035926342, -0.02415156364440918, 0.0067773545160889626, -0.043174345046281815, 0.02726403810083866, -0.005983269307762384, -0.037281665951013565, -0.014308508485555649, -0.0030223142821341753, -0.03107067570090294, 0.020814931020140648, 0.01756594516336918, 0.0652342438697815, 0.02678276225924492, -0.001192212221212685, -0.020040787756443024, 0.020942259579896927, 0.019534436985850334, 0.020057544112205505, 0.04299631714820862, -0.018541626632213593, -0.006851219572126865, -0.0015304619446396828, 0.03828129172325134, 0.02492920495569706, -0.00003452556120464578, 0.0071124969981610775, -0.01937703974545002, 0.05343291535973549, -0.002467934275045991, 0.024836156517267227, 0.04741556569933891, -0.005961076822131872, -0.05685373768210411, -0.03689524531364441, -0.012220727279782295, -0.03977394104003906, 0.010640354827046394, 0.03294852748513222, 0.002863304689526558, 0.011523210443556309, -0.016817310824990273, 0.056062787771224976, 0.07321954518556595, 0.029779566451907158, -0.019588761031627655, 0.01934802159667015, 0.034071896225214005, 0.011195426806807518, 0.013941076584160328, 0.03850903362035751, 0.008408460766077042, 0.019360212609171867, 0.00912889838218689, 0.008145306259393692, 0.02457062341272831, -0.030501868575811386, -0.009687342680990696, 0.001873695058748126, -0.014680570922791958, -0.0049560172483325005, -0.023897672072052956, 0.018695807084441185, -0.025145577266812325, 0.0036495651584118605, -0.012938621453940868, -0.04810674861073494, 0.03028135932981968, -0.014357296749949455, -0.0032202941365540028, -0.01433182880282402, -0.010369135066866875, 0.010557965375483036, 0.04160309582948685, 0.0003623749944381416, -0.04116811230778694, -0.01536224689334631, 0.01293120812624693, -0.022092130035161972, 0.009804760105907917, -0.017269425094127655, -0.007975702174007893, -0.013434597291052341, 0.009539969265460968, 0.01570594497025013, 0.035240501165390015, -0.028485490009188652, -0.028658676892518997, 0.02195788361132145, 0.03222551569342613, -0.014672763645648956, 0.023221822455525398, 0.0028550876304507256, 0.03404970094561577, 0.0007369432714767754, 0.03891310468316078, -0.012998389080166817, -0.03956618905067444, 0.02533308044075966, -0.029202913865447044, 0.048030558973550797, -0.019182272255420685, 0.017708493396639824, -0.007299087010324001, 0.04663938656449318, -0.002693655900657177, -0.010194443166255951, -0.0007544715190306306, -0.014795842580497265, -0.01007282268255949, 0.03641756996512413, 0.006539355032145977, -0.030580885708332062, 0.012089320458471775, 0.009997989982366562, 0.021344823762774467, -0.018674127757549286, 0.007908489555120468, 0.05380654335021973, -0.02461402863264084, 0.015018760226666927, 0.0026777232997119427, 0.0480223074555397, 0.012940586544573307, 0.032628513872623444, 0.002925889566540718, 0.01020683441311121, 0.03404558077454567, -0.03515233099460602, -0.020228896290063858, -0.006513502914458513, 0.004472216125577688, -0.05538483336567879, -0.04820534586906433, -0.01573505625128746, -0.013439849950373173, -0.03498977795243263, 0.032499752938747406, -0.0734613761305809, 0.006354538723826408, -0.016603663563728333, -0.0035802521742880344, -0.025597045198082924, -0.01765563152730465, 0.07772704213857651, 0.024944402277469635, 0.034422606229782104, 0.010617502965033054, -0.03157622367143631, 0.004774107132107019, -0.031682778149843216, 0.0211971215903759, 0.04459928721189499, -0.016966011375188828, 0.004457989241927862, -0.04848245903849602, 0.01737627573311329, 0.008159755729138851, -0.0451258085668087, -0.002931433729827404, 0.0053114695474505424, 0.003001878969371319, -0.03848719596862793, -0.006284811999648809, 0.02263588458299637, 0.0019034428987652063, 0.023892994970083237, -0.04029751569032669, -0.0333692692220211, -0.014866787008941174, -0.012130732648074627, -0.03769298270344734, 0.016179649159312248, -0.018654165789484978, -0.015641259029507637, 0.008240205235779285, 0.011640740558505058, -0.004940359387546778, -0.04036487638950348, -0.031562063843011856, -0.019712723791599274, -0.024271659553050995, -0.0663970485329628, -0.05802137777209282, 0.023669026792049408, 0.009738605469465256, -0.025685038417577744, -0.041472163051366806, 0.01615731045603752, -0.005101267714053392, -0.014298995956778526, -0.011677160859107971, -0.01156030222773552, 0.008888212032616138, -0.03500746935606003, 0.03662548214197159, 0.017239885404706, 0.04158457741141319, 0.03240750730037689, 0.006631995085626841, -0.006661264691501856, -0.008849396370351315 ]
The Partnership: Amazon SageMaker and Hugging Face
philschmid
March 23, 2021
the-partnership-amazon-sagemaker-and-hugging-face
partnerships, aws
https://huggingface.co/blog/the-partnership-amazon-sagemaker-and-hugging-face
Features & Benefits 🔥
[ 0.04700368270277977, 0.0052488199435174465, 0.12388724088668823, 0.013973184861242771, 0.133266419172287, 0.05012747645378113, 0.018364781513810158, 0.07152847945690155, -0.027501925826072693, -0.10829663276672363, -0.041806455701589584, 0.044995151460170746, -0.01135945226997137, -0.0027184810023754835, -0.014632058329880238, 0.028812311589717865, 0.06763796508312225, 0.019439561292529106, 0.01358432974666357, -0.0034208903089165688, -0.010372430086135864, -0.04104679077863693, 0.09863387793302536, 0.010682675987482071, 0.0050392611883580685, 0.006883555091917515, 0.009943779557943344, -0.027485541999340057, -0.08169792592525482, 0.040769003331661224, -0.01957559958100319, -0.015685053542256355, 0.057975877076387405, -0.003128020791336894, 0.019560599699616432, -0.01366757694631815, -0.05986691638827324, -0.0061596161685884, -0.049892060458660126, -0.05021681636571884, 0.0010677330428734422, -0.07223009318113327, -0.04486453905701637, 0.06705200672149658, -0.062458306550979614, -0.005496205762028694, -0.28131917119026184, 0.05351034924387932, -0.04402157664299011, 0.010903269983828068, -0.039760783314704895, 0.020576953887939453, -0.008018708787858486, -0.022241806611418724, 0.08148036152124405, 0.012871055863797665, 0.032391101121902466, -0.0063056438229978085, -0.02805139496922493, -0.07138834148645401, 0.04685073718428612, -0.04527478292584419, 0.011231406591832638, 0.019477562978863716, 0.03509829193353653, -0.0013257665559649467, -0.020911777392029762, 0.02593882568180561, -0.010213143192231655, -0.006836208049207926, 0.019201721996068954, -0.03379356861114502, -0.029971599578857422, -0.005696951877325773, 0.037201933562755585, -0.0672258734703064, -0.09347458928823471, 0.02656031958758831, 0.06411303579807281, 0.06084822863340378, 0.018105167895555496, 0.018334100022912025, 0.07336781173944473, 0.06324765831232071, -0.01907549612224102, -0.04588053748011589, 0.055835627019405365, -0.050139572471380234, 0.0030693619046360254, -0.005357437767088413, -0.013047137297689915, -0.07341071963310242, 0.07981444895267487, 0.01653323322534561, 0.02306651696562767, -0.07397568225860596, 0.039495933800935745, 0.013767911121249199, 0.06813235580921173, -0.023699967190623283, -0.03552228957414627, -0.01289372704923153, -0.01794140785932541, -0.01863100752234459, -0.02857600711286068, -0.0222699586302042, -0.05584278702735901, -0.07554261386394501, -0.00950764212757349, 0.07480904459953308, -0.02986452914774418, 0.019096164032816887, 0.0379222109913826, -0.009113282896578312, -0.041683875024318695, 0.05002250149846077, 0.00965149886906147, -0.0023905865382403135, 0.014319543726742268, 0.011364899575710297, 0.010308540426194668, 0.08965602517127991, 0.05915641412138939, 0.05520626902580261, 0.03947169706225395, 0.019150570034980774, 0.03634653985500336, 0.026554344221949577, -0.05597326159477234, -0.03234381973743439, 0.010056187398731709, -0.02123197726905346, 0.008038511499762535, -0.008061399683356285, -0.08655495196580887, -0.0391707569360733, -0.01319681666791439, -0.022952232509851456, 0.04204435274004936, -0.02494366466999054, -0.03200965374708176, 0.0663970410823822, -0.011875837109982967, 0.034418102353811264, 0.028300413861870766, -0.0342126227915287, -0.030655579641461372, 0.0328286737203598, -0.0016911099664866924, -0.019973428919911385, 0.02062491700053215, 0.05843952298164368, -0.021398814395070076, -0.06853102147579193, -0.03617503494024277, 0.05614672228693962, 0.031015921384096146, 0.023065997287631035, -0.06898801773786545, -0.032842427492141724, 0.0214255191385746, -0.014879478141665459, -0.003112342907115817, 0.0029665608890354633, 0.01852026954293251, -0.022179141640663147, 0.019735414534807205, -0.025016693398356438, -0.03053208254277706, -0.07492011040449142, -0.04248592630028725, -0.021459689363837242, 0.06121299788355827, -0.016391733661293983, -0.055736180394887924, 0.061088528484106064, 0.05959175527095795, 0.056866005063056946, -0.002283102134242654, 0.03174380213022232, -0.04081740602850914, 0.02618285082280636, -0.004323306027799845, 0.024225596338510513, 0.01680469699203968, -0.0856652781367302, 0.055056266486644745, -0.02143249660730362, -0.007204078137874603, 0.033848587423563004, -0.12902304530143738, -0.04998837038874626, 0.1177913025021553, -0.009773960337042809, -0.010734571143984795, -0.0878208726644516, -0.022563371807336807, 0.13610532879829407, 0.04287382960319519, 0.03761778026819229, 0.05005095526576042, 0.052515652030706406, 0.07193911820650101, -0.025164449587464333, -0.11287602037191391, 0.02952408604323864, 0.0948186069726944, -0.033459264785051346, -0.008495970629155636, -0.011209450662136078, -0.009370633400976658, -0.09835933893918991, 0.04653346166014671, -0.048039503395557404, 0.029441550374031067, -0.024370089173316956, -0.004463164135813713, -0.016539636999368668, 0.028676830232143402, -0.042676445096731186, 0.08059544116258621, 0.010142797604203224, -0.019324757158756256, 0.049429308623075485, -0.028139356523752213, 0.0969579741358757, 0.09968916326761246, -0.007822111248970032, 0.04389408975839615, -0.04469869285821915, -0.03267636150121689, -0.01889759488403797, -0.026378626003861427, 0.07312903553247452, 0.02525116503238678, 0.05766971781849861, 0.01314571499824524, -0.055128347128629684, 0.04535285010933876, -0.005774881690740585, -0.030520634725689888, 0.008268054574728012, 0.011965501122176647, 0.03811465948820114, 0.00894893892109394, -0.03823637217283249, 0.019706256687641144, 0.041211701929569244, -0.08052872866392136, -0.03713751211762428, -0.0542617104947567, 0.07527948170900345, 0.026940785348415375, 0.008745511062443256, 0.09793384373188019, -0.01823718287050724, -0.00899581704288721, -0.022330280393362045, 0.003586836624890566, -0.0008606220362707973, 0.014023654162883759, -0.02784610353410244, 0.00019427914230618626, -0.06122126430273056, 0.012391562573611736, -0.0210824366658926, 0.0003611425345297903, 0.0003398281696718186, -0.0011946933809667826, 0.04008153825998306, -0.015252944082021713, -0.01387192215770483, 0.028109950944781303, 0.01866927556693554, -0.011879835277795792, 0.00957887340337038, 0.042088136076927185, -0.0003464765613898635, -0.02605946734547615, -0.0264925304800272, 0.00939023308455944, -0.024344924837350845, 0.04498303681612015, 0.02101953886449337, 0.06649501621723175, -0.021345771849155426, 0.017213352024555206, -0.010113037191331387, -0.025364071130752563, 0.017161907628178596, 0.004000070039182901, 0.014174116775393486, 0.013066772371530533, -0.029067588970065117, 0.017599111422896385, -0.03750864416360855, -0.01199612021446228, 0.016835886985063553, -0.01848180964589119, -0.01368425041437149, 0.039940860122442245, -0.020090872421860695, -0.004907030146569014, 0.02371569164097309, -0.02414296753704548, 0.03631874546408653, -0.0011955831432715058, -0.025156978517770767, -0.16175925731658936, -0.02746439352631569, 0.0373709574341774, 0.04193945974111557, -0.001443487242795527, -0.01687595807015896, 0.027918681502342224, -0.03290320187807083, -0.038401324301958084, -0.008022584021091461, 0.042202357202768326, -0.004043081775307655, 0.04353892058134079, -0.04150732606649399, -0.03300895541906357, 0.03227049857378006, -0.006465176586061716, 0.0162236075848341, 0.010691777803003788, -0.023306893184781075, 0.0005538450204767287, 0.05975482985377312, -0.022245343774557114, -0.02241259068250656, -0.03681015595793724, 0.04793347045779228, 0.02396949753165245, 0.021903809159994125, 0.0020652441307902336, -0.03186403959989548, -0.030041171237826347, 0.04600956663489342, -0.012196660041809082, 0.026934728026390076, 0.0054901051335036755, 0.011671681888401508, 0.0015226593241095543, -0.00034458894515410066, -0.009971004910767078, 0.030641011893749237, 0.04001990333199501, 0.008366042748093605, 0.03345654159784317, 0.029061848297715187, -0.014560773968696594, 0.018998729065060616, 0.009541786275804043, -0.01619832031428814, 0.0710846334695816, -0.01880669593811035, -0.03710642457008362, -0.011428719386458397, -0.008853101171553135, 0.04466746002435684, -0.033614106476306915, 0.002470927080139518, -0.034069228917360306, 0.011418637819588184, 0.05491092801094055, -0.016738390550017357, -0.029512090608477592, 0.025110244750976562, 0.004514501895755529, 0.0059916055761277676, -0.034821271896362305, 0.044426169246435165, -0.04180973768234253, -0.0009357382659800351, -0.04126770421862602, 0.038774680346250534, -0.008080626837909222, -0.002490622689947486, -0.011511753313243389, 0.019418245181441307, 0.003570456523448229, 0.03146575018763542, -0.006861502770334482, 0.0020912380423396826, 0.03619653731584549, 0.0061372728087008, 0.005534972529858351, -0.02227124385535717, 0.002629379043355584, -0.014747156761586666, -0.01067122258245945, 0.015470867976546288, -0.0057261050678789616, 0.019402800127863884, -0.011996353045105934, 0.04141363874077797, 0.015298287384212017, -0.0000480394228361547, 0.02012662962079048, -0.003068457590416074, 0.007526018191128969, 0.032626569271087646, 0.05991653352975845, -0.020440008491277695, -0.00462731160223484, -0.01632140949368477, 0.016989655792713165, 0.003847370622679591, -0.007628653198480606, 0.01692948304116726, 0.004846327938139439, 0.03159206733107567, -0.03222722187638283, -0.0556587353348732, -0.013629906810820103, 0.031437668949365616, 0.018373282626271248, -0.019949939101934433, -0.009264035150408745, -0.03003654070198536, 0.003013026434928179, 0.01120024360716343, -0.011134780943393707, -0.042855679988861084, -0.04499325156211853, 0.029525460675358772, -0.008349761366844177, 0.029878810048103333, 0.01994134858250618, -0.03920487314462662, -0.0005510633927769959, 0.011335987597703934, 0.017738740891218185, -0.019231662154197693, 0.01460891030728817, 0.002380745718255639, -0.0314343124628067, -0.026597851887345314, 0.042646873742341995, 0.0098143694922328, 0.01708940789103508, 0.0020054723136126995, -0.019361792132258415, 0.05582412704825401, -0.020856447517871857, -0.07356924563646317, 0.020058197900652885, 0.01707560382783413, 0.020664477720856667, 0.0009111241088248789, 0.043240465223789215, -0.026046928018331528, -0.025820201262831688, 0.01767447032034397, -0.015634533017873764, 0.007472112774848938, 0.024871116504073143, -0.04678367078304291, -0.030815068632364273, 0.002310926793143153, 0.009489852003753185, 0.02404029294848442, -0.0016200268873944879, -0.0036739713978022337, -0.03305643051862717, 0.03165840357542038, 0.01080808974802494, -0.00781640037894249, -0.06392373889684677, 0.03272036090493202, -0.014936133287847042, 0.001957220956683159, 0.00945327803492546, 0.014775288291275501, -0.029271284118294716, -0.010382445529103279, -0.002228623488917947, -0.014859640970826149, 0.038586392998695374, 0.00040507828816771507, 0.010051700286567211, 0.021360650658607483, 0.01843850314617157, 0.013952197507023811, 0.0377083458006382, 0.0243169404566288, -0.009042901918292046, -0.007647456601262093, 0.027120918035507202, 0.04012322053313255, -0.0019527573604136705, -0.013098216615617275, 0.044631849974393845, 0.003544450970366597, 0.02417750656604767, 0.05642247572541237, -0.05007912963628769, -0.012334872037172318, -0.0048023732379078865, -0.03946400433778763, 0.00729697709903121, -0.014270296320319176, 0.019313490018248558, 0.02530229464173317, -0.010514861904084682, 0.0033099253196269274, 0.023093383759260178, 0.03077244758605957, -0.013980078510940075, -0.0018365546129643917, -0.007337808609008789, 0.049134522676467896, -0.0007177991792559624, 0.00415005860850215, -0.026549583300948143, -0.028201771900057793, -0.027462931349873543, 0.023226704448461533, 0.0044557745568454266, -0.009184850379824638, -0.010341747663915157, -0.051381632685661316, -0.04751736298203468, 0.02986060082912445, 0.006567072123289108, 0.010347213596105576, 0.007751359138637781, 0.009871049784123898, -0.03638250380754471, 0.04387752711772919, 0.03836773335933685, -0.02473529800772667, 0.004280401859432459, 0.02701590210199356, -0.018084270879626274, 0.017412912100553513, 0.03794277459383011, 0.007032177411019802, -0.019089125096797943, 0.005672553554177284, 0.02489229291677475, 0.047521233558654785, -0.08320361375808716, 0.02170475572347641, -0.011701623909175396, -0.007555338088423014, -0.008440043777227402, -0.012129012495279312, -0.01681397296488285, -0.04642646759748459, -0.041792482137680054, 0.0379246324300766, 0.03167453780770302, -0.02557218447327614, 0.011396161280572414, 0.008932155556976795, 0.017331596463918686, 0.004930384922772646, 0.005338037386536598, 0.0002858731895685196, -0.0019723253790289164, -0.010594751685857773, -0.0018708817660808563, 0.012263053096830845, 0.002390825655311346, -0.007973101921379566, -0.003645588643848896, -0.0013348275097087026, 0.03997345641255379, 0.04145224392414093, -0.0072417170740664005, 0.026843177154660225, 0.002981839468702674, -0.03217903524637222, 0.031167423352599144, 0.024018969386816025, -0.03095761314034462, 0.025536516681313515, 0.03640490025281906, -0.01223092433065176, -0.009745517745614052, -0.003140330081805587, 0.04826933890581131, 0.023426663130521774, 0.011948072351515293, 0.0009933779947459698, 0.03210293501615524, 0.038049060851335526, 0.012744298204779625, -0.01573798805475235, -0.04901008680462837, 0.01907947286963463, 0.015293044969439507, -0.00321017112582922, 0.03145923092961311, 0.028078731149435043, 0.026336995884776115, 0.0065641202963888645, -0.0051762135699391365, 0.020479917526245117, -0.03309943154454231, -0.035321012139320374, 0.020636355504393578, -0.01667885296046734, 0.03180950507521629, -0.03880429267883301, 0.031493835151195526, 0.006808986887335777, 0.0005773373995907605, 0.027236968278884888, -0.022926079109311104, 0.00791282020509243, 0.02898446097970009, 0.00010085599205922335, -0.00035411465796642005, -0.032664019614458084, 0.03996197506785393, 0.05015723407268524, -0.01085719745606184, -0.022382810711860657, -0.0029797956813126802, -0.03172999247908592, 0.03321116045117378, -0.013951970264315605, -0.004830072168260813, -0.005670726299285889, 0.03796660900115967, -0.0012972557451575994, -0.02135319821536541, -0.014986920170485973, -0.05642589554190636, -0.06455854326486588, 0.0008044862770475447, 0.03303119167685509, 0.011837650090456009, 0.004948669113218784, 0.006218949798494577, 0.03676774725317955, -0.01575678028166294, -0.006291418336331844, -0.01646939292550087, 0.050663307309150696, -0.0028194021433591843, 0.03722190111875534, -0.01822044514119625, -0.02015712670981884, -0.0034005430061370134, -0.010816656053066254, 0.021727828308939934, 0.009490023367106915, 0.008714757859706879, 0.0038460928481072187, -0.01678577810525894, 0.015243178233504295, 0.0008181464509107172, 0.029829466715455055, 0.015197132714092731, 0.0051414514891803265, -0.016006430611014366, 0.02670888602733612, -0.022915391251444817, -0.016114987432956696, -0.024065149948000908, -0.014030071906745434, 0.0333256870508194, -0.025808006525039673, 0.0033105157781392336, 0.03794236108660698, 0.005662659183144569, -0.03046848252415657, -0.02142721600830555, -0.009889697656035423, -0.03228858858346939, 0.005352403502911329, 0.016684729605913162, 0.02766583114862442, -0.03487362712621689, -0.02130306512117386, 0.02468149922788143, 0.007872937247157097, -0.03425846993923187, 0.014634218998253345, -0.030030634254217148, -0.00418868288397789, -0.021894682198762894, -0.008556123822927475, 0.07094105333089828, 0.014116281643509865, 0.03021838329732418, 0.026552347466349602, 0.011495307087898254, 0.01069800928235054, -0.057442549616098404, -0.003924354910850525, 0.008348005823791027, 0.022631166502833366, -0.006600907538086176, 0.000924513500649482, -0.02795715443789959, -0.053138501942157745, 0.014890054240822792, 0.003802931634709239, -0.029088523238897324, -0.03307068720459938, 0.008366761729121208, 0.001900606439448893, -0.053463004529476166, 0.016108017414808273, 0.02551134303212166, -0.004971047397702932, 0.029239661991596222, -0.005752980709075928, 0.0011307341046631336, -0.013383443467319012, 0.019926924258470535, -0.00773880910128355, 0.039274752140045166, 0.01797601580619812, -0.009438380599021912, -0.042002614587545395, 0.03887886554002762, -0.05426346883177757, -0.03935793787240982, 0.017045730724930763, 0.04081706702709198, -0.000012400553714542184, 0.002851537661626935, 0.0012596339220181108, 0.021213138476014137, 0.0014836940681561828, 0.005410908721387386, 0.028277628123760223, -0.014606163837015629, 0.003405475988984108, 0.004376294557005167, -0.03457975760102272, -0.014542557299137115, -0.0008739210315980017, 0.0026187573093920946, 0.04023222252726555, -0.013667785562574863, -0.01025419868528843, 0.0022577913478016853, -0.0513177216053009, 0.02961347997188568, -0.010886473581194878, -0.027586128562688828, -0.0029451455920934677, 0.01638079434633255, -0.03666524961590767, -0.0010093421442434192, -0.04164621978998184, 0.02582072839140892, 0.014722663909196854, -0.030947519466280937, -0.02302812598645687, -0.02708849124610424, -0.012019958347082138, -0.0009838547557592392, 0.02365249954164028, 0.019052475690841675, 0.06349363178014755, 0.043573424220085144, -0.0013186807045713067, 0.0059458427131175995, 0.01733565144240856 ]
The Partnership: Amazon SageMaker and Hugging Face
philschmid
March 23, 2021
the-partnership-amazon-sagemaker-and-hugging-face
partnerships, aws
https://huggingface.co/blog/the-partnership-amazon-sagemaker-and-hugging-face
Resources, Documentation & Samples 📄 Below you can find all the important resources to all published blog posts, videos, documentation, and sample Notebooks/scripts.
[ 0.08126653730869293, 0.010339568369090557, 0.06887798756361008, 0.03769183158874512, 0.12445961683988571, 0.030648406594991684, -0.028847331181168556, 0.04321148991584778, 0.0008344774832949042, -0.06995443999767303, -0.05952122062444687, 0.04822021350264549, 0.04707440361380577, 0.021265797317028046, 0.03315878286957741, 0.011478614062070847, 0.02103031799197197, 0.00350445625372231, -0.004760571289807558, 0.02598636969923973, 0.01200565230101347, 0.006633295211941004, 0.016495907679200172, 0.01795000582933426, 0.04888082668185234, -0.0008766535902395844, 0.03191239386796951, 0.0002912708150688559, -0.07101448625326157, -0.01201783400028944, -0.12231587618589401, -0.006356175057590008, 0.028678134083747864, -0.028740864247083664, 0.012967778369784355, 0.00341735128313303, -0.0677221268415451, 0.0557125099003315, -0.02249549888074398, -0.032236285507678986, -0.004093429539352655, -0.09707655757665634, -0.03134498372673988, 0.07510022073984146, -0.014659899286925793, -0.0038785876240581274, -0.23008041083812714, 0.06744223088026047, -0.011437522247433662, 0.002126251580193639, -0.04733783006668091, 0.06710303574800491, 0.035669829696416855, -0.023111337795853615, -0.0023600615095347166, 0.027212684974074364, 0.05105692520737648, -0.03447466343641281, -0.014862793497741222, 0.003408365184441209, 0.09366636723279953, 0.02387688308954239, -0.019340990111231804, 0.049994152039289474, 0.05304089933633804, 0.024479655548930168, -0.011872300878167152, 0.09512901306152344, -0.03006180189549923, 0.00616480503231287, -0.011928439140319824, -0.01204892061650753, 0.0270275566726923, -0.0291884858161211, 0.045696187764406204, -0.043851010501384735, -0.03362002968788147, 0.022759582847356796, 0.035713713616132736, 0.030808497220277786, 0.02409873716533184, 0.0052401344291865826, 0.07879307866096497, 0.06410975754261017, 0.0011268105590716004, 0.015156285837292671, 0.05144942179322243, 0.0026189915370196104, -0.016309350728988647, 0.015583778731524944, -0.02240549772977829, -0.08669767528772354, 0.027860267087817192, 0.04372444376349449, 0.061460450291633606, -0.06473168730735779, 0.051347944885492325, 0.020734164863824844, 0.03382206708192825, 0.009890560060739517, -0.003088712226599455, -0.008086126297712326, -0.020223451778292656, -0.0052525969222188, -0.0370437391102314, 0.008535833097994328, -0.019436920061707497, -0.07071239501237869, -0.05593755468726158, 0.058356162160634995, -0.011839048936963081, 0.027163757011294365, -0.03538397327065468, -0.0056532383896410465, -0.018748581409454346, 0.11486274749040604, -0.01963319443166256, -0.036315467208623886, -0.024908345192670822, 0.0585867278277874, -0.011050049215555191, 0.04250886291265488, 0.06549681723117828, 0.04796769469976425, 0.02831021510064602, 0.051584161818027496, 0.009211334399878979, -0.0015440002316609025, -0.0694359615445137, -0.0662706047296524, -0.009490512311458588, -0.04481225460767746, 0.08957125246524811, -0.05440859496593475, -0.028601501137018204, -0.07165053486824036, -0.0033088484779000282, -0.05007222667336464, 0.06477109342813492, 0.028792623430490494, -0.0022190106101334095, 0.012850580736994743, -0.045719366520643234, 0.03835020586848259, 0.02932089939713478, -0.07750949263572693, -0.04968007653951645, -0.016448503360152245, -0.06077934056520462, 0.01999320276081562, -0.015079434029757977, 0.06373129040002823, -0.019096551463007927, -0.051524966955184937, 0.0021829467732459307, 0.0006979110185056925, 0.030768506228923798, 0.01887810043990612, -0.0632304847240448, -0.00018810197070706636, -0.0021199528127908707, 0.005360519979149103, 0.02704440802335739, 0.0041184136644005775, 0.050137437880039215, -0.036156199872493744, 0.04060227796435356, -0.01546353381127119, 0.03506476804614067, -0.04731888696551323, -0.013717779889702797, -0.07088247686624527, 0.06705431640148163, -0.04071809723973274, -0.03303169831633568, 0.0685015469789505, 0.0784308984875679, 0.032277483493089676, 0.015263949520885944, 0.008670858107507229, -0.059603966772556305, 0.0055162920616567135, -0.006811428349465132, -0.02237999625504017, 0.019703039899468422, -0.06780105084180832, 0.046864308416843414, -0.029220063239336014, 0.01662842556834221, -0.0022843843325972557, -0.15053169429302216, -0.04099300131201744, 0.09969639033079147, 0.03767715394496918, 0.013795171864330769, -0.038034938275814056, -0.021447833627462387, 0.14649295806884766, 0.07559987902641296, 0.0751461535692215, 0.03652697429060936, 0.011750537902116776, 0.04997263848781586, -0.004617898724973202, -0.059936296194791794, 0.05733068659901619, 0.09672775119543076, -0.05366138368844986, 0.044477228075265884, -0.06327206641435623, 0.021848078817129135, -0.041961174458265305, 0.03431869298219681, -0.038157377392053604, 0.03720622509717941, -0.04434763640165329, 0.0065951840952038765, -0.0013897126773372293, 0.031011128798127174, -0.04097428172826767, 0.1397724747657776, -0.014421775005757809, 0.017879171296954155, 0.07452763617038727, -0.048514075577259064, 0.0461236834526062, 0.09016888588666916, 0.07369669526815414, 0.08040598779916763, -0.040819648653268814, -0.03325215354561806, 0.024738330394029617, -0.02285804972052574, 0.06675630062818527, 0.01920945756137371, 0.028914842754602432, 0.00029914366314187646, -0.031031841412186623, -0.015437381342053413, -0.03297709673643112, 0.016539083793759346, -0.008711685426533222, 0.008749454282224178, 0.058562684804201126, 0.021432720124721527, -0.001727231778204441, 0.04855185002088547, 0.014019491150975227, -0.04561661556363106, 0.024889890104532242, -0.04494529590010643, 0.057562634348869324, 0.019205572083592415, -0.028749508783221245, 0.04417244344949722, 0.030627332627773285, 0.011941301636397839, -0.006153225898742676, -0.010027876123785973, 0.03963536396622658, -0.021839682012796402, 0.0009632523288019001, -0.025833630934357643, -0.06772219389677048, 0.017946891486644745, -0.011704536154866219, -0.009375566616654396, -0.020350759848952293, 0.002355694305151701, 0.003165061119943857, -0.0021422223653644323, 0.0012813776265829802, 0.01877719536423683, 0.001951354555785656, -0.017466198652982712, -0.008042140863835812, 0.018245212733745575, -0.019697654992341995, -0.000643394305370748, 0.009545956738293171, -0.021424192935228348, -0.019460691139101982, 0.037368521094322205, 0.022548558190464973, 0.04916767030954361, -0.015606213361024857, 0.011980321258306503, -0.02127845585346222, -0.01566767320036888, -0.01965419203042984, 0.000031064726499607787, 0.003257847623899579, 0.009096933528780937, -0.04078018665313721, 0.0223013274371624, -0.02756718173623085, 0.02142944000661373, -0.017043108120560646, -0.03591842204332352, 0.031268589198589325, -0.009633040055632591, -0.009328951127827168, 0.012090127915143967, 0.005086567718535662, -0.04906743764877319, 0.06582833081483841, 0.005265743937343359, 0.012704453431069851, -0.14456719160079956, -0.025384917855262756, 0.010813484899699688, 0.037451837211847305, -0.018877562135457993, -0.04434095323085785, 0.03382383659482002, -0.011236563324928284, -0.034480128437280655, -0.04528263211250305, -0.01501644216477871, -0.004651347640901804, 0.025610199198126793, 0.003203297732397914, -0.02878744713962078, 0.023636749014258385, -0.02718072198331356, 0.015613687224686146, 0.0034344764426350594, 0.002237572567537427, -0.022837530821561813, 0.057074010372161865, -0.004697328433394432, -0.024624723941087723, -0.012227172963321209, 0.02931763045489788, 0.03247451409697533, 0.048006489872932434, 0.011832316406071186, -0.01761135458946228, 0.01273388508707285, 0.02088138461112976, -0.03676734119653702, -0.008259739726781845, -0.04757896438241005, -0.011598022654652596, -0.02408568374812603, -0.005598337855190039, -0.016406159847974777, 0.05315174534916878, 0.0009307170403189957, 0.010023055598139763, 0.0475686676800251, 0.02383292280137539, -0.009910576976835728, 0.00808111485093832, 0.0072942390106618404, 0.015012959949672222, 0.03234146162867546, -0.026861965656280518, -0.033403459936380386, -0.01366785541176796, -0.0045555587857961655, 0.048283547163009644, -0.006997113116085529, -0.011795205064117908, -0.007367337122559547, -0.0013434776337817311, 0.025729777291417122, -0.04174135997891426, -0.03851335123181343, 0.017188144847750664, 0.0014101224951446056, 0.012024134397506714, -0.05870286375284195, 0.060799822211265564, -0.03976437449455261, -0.004205110017210245, -0.01833111234009266, 0.03171319514513016, 0.022820953279733658, 0.01055414043366909, 0.005586439743638039, 0.013054230250418186, -0.04381771385669708, 0.014517080038785934, -0.018489550799131393, -0.033102188259363174, 0.05998731404542923, 0.03253835067152977, -0.02631187252700329, -0.042668819427490234, -0.037598997354507446, -0.010299918241798878, -0.04111620783805847, 0.0392003171145916, -0.025467397645115852, 0.021854309365153313, -0.02190546691417694, 0.03914877399802208, 0.015136218629777431, -0.008984465152025223, 0.0017876616911962628, -0.0002410402667010203, 0.007934517227113247, 0.04830449819564819, 0.05200713127851486, 0.006623462773859501, 0.018240751698613167, 0.0056403628550469875, 0.0037441132590174675, -0.018669160082936287, -0.004946346860378981, -0.005781611893326044, -0.004418579861521721, 0.03234226629137993, -0.03776996210217476, -0.03898894414305687, -0.018730714917182922, 0.011279511265456676, 0.0036465972661972046, -0.04744258522987366, -0.005804058630019426, -0.01830339804291725, -0.0053563546389341354, 0.014848882332444191, -0.006384836044162512, -0.02958228625357151, -0.03611711785197258, 0.016692157834768295, -0.023566650226712227, -0.011115697212517262, 0.006328871939331293, -0.026811257004737854, -0.005419252440333366, 0.024963663890957832, -0.01327514834702015, -0.021341480314731598, 0.002306516980752349, 0.00976734422147274, -0.032505445182323456, -0.032759007066488266, 0.002098680706694722, 0.013902763836085796, -0.007362650707364082, 0.013589557260274887, 0.012543334625661373, 0.07539677619934082, -0.03494084253907204, -0.09425576031208038, 0.0005970931379124522, 0.021216796711087227, 0.049767106771469116, -0.008969496935606003, 0.031094254925847054, 0.006935343611985445, -0.0673118531703949, -0.010485969483852386, -0.01727713830769062, 0.018482042476534843, 0.05319538339972496, -0.006553438492119312, -0.04197314754128456, 0.011405585333704948, -0.005611541215330362, 0.005392394959926605, -0.0021458512637764215, 0.03612464666366577, -0.013538705185055733, 0.021210195496678352, -0.003512799507007003, 0.019178997725248337, -0.054333049803972244, 0.02264789305627346, -0.038366805762052536, 0.01790516823530197, -0.028531115502119064, -0.010919298976659775, -0.0007229637703858316, -0.002021634951233864, 0.027110176160931587, -0.012386409565806389, 0.029677480459213257, -0.01606183871626854, 0.0454808808863163, 0.0230866689234972, 0.03204641118645668, 0.061504434794187546, 0.017642635852098465, -0.012235638685524464, -0.034573037177324295, -0.010490266606211662, 0.048253223299980164, 0.005395055282860994, -0.03370516374707222, 0.010541100054979324, 0.0487552247941494, 0.011704315431416035, -0.005946791265159845, 0.04174640774726868, -0.043842051178216934, -0.015426026657223701, -0.02327626757323742, -0.036345355212688446, 0.0052464730106294155, -0.029173491522669792, 0.029573632404208183, 0.020913951098918915, -0.015718407928943634, -0.028886528685688972, 0.02718573436141014, 0.05246834456920624, -0.026453647762537003, 0.025722278282046318, 0.0269846823066473, -0.0026436878833919764, -0.0028277693782001734, -0.02196640335023403, -0.004836295265704393, -0.03440210223197937, -0.010332069359719753, 0.007149158511310816, -0.007296946831047535, -0.022414423525333405, 0.0019292167853564024, -0.050562284886837006, -0.03688885644078255, -0.007433260791003704, -0.0018481879960745573, 0.05223200097680092, 0.010485772974789143, 0.03964875265955925, -0.03354756906628609, 0.07129130512475967, 0.0050759813748300076, 0.017132200300693512, 0.008069874718785286, 0.02964906580746174, -0.007184282876551151, -0.0077002160251140594, 0.041561026126146317, 0.002787896664813161, -0.0016005001962184906, -0.0051899864338338375, 0.015850691124796867, 0.0032839432824403048, -0.09188008308410645, 0.022428860887885094, 0.02026195451617241, -0.00927656702697277, -0.02040279284119606, -0.007537362165749073, -0.02750306949019432, -0.011282959952950478, -0.042091961950063705, 0.005842326208949089, 0.08858402818441391, -0.016048939898610115, 0.03521185368299484, 0.01975051313638687, 0.02789992466568947, -0.0059941112995147705, -0.006522755604237318, -0.024705009534955025, 0.005769752431660891, 0.00813281163573265, 0.0030824148561805487, -0.0034356238320469856, 0.006326163653284311, -0.051396992057561874, 0.017997054383158684, -0.025937967002391815, 0.059078704565763474, 0.009409073740243912, -0.03055577725172043, 0.003486777888610959, -0.0037696019280701876, -0.031216079369187355, 0.04200505092740059, 0.02878549136221409, -0.006876375991851091, 0.024388782680034637, 0.012829727493226528, -0.04714022949337959, -0.0023196262773126364, -0.029130980372428894, 0.027227776125073433, 0.03197484463453293, -0.010149618610739708, 0.03164282813668251, 0.008463815785944462, 0.02167491987347603, 0.01765298657119274, -0.008665541186928749, -0.010466004721820354, -0.002618405967950821, 0.023734232410788536, 0.017250098288059235, -0.004729743115603924, 0.005394099745899439, -0.013408838771283627, -0.015794621780514717, -0.029266158118844032, 0.0026530460454523563, -0.05514518916606903, 0.026281332597136497, 0.0022846912033855915, -0.0032382153440266848, 0.02486666664481163, -0.0740877240896225, 0.047121811658144, 0.018335549160838127, 0.021884825080633163, 0.016576120629906654, 0.0016308082267642021, 0.04451090469956398, -0.01452355831861496, -0.013886523433029652, 0.032944951206445694, -0.026242874562740326, 0.02627301961183548, 0.08910883218050003, 0.045474644750356674, -0.009452166967093945, 0.007769374642521143, -0.009881841950118542, 0.01419281680136919, -0.0044469996355473995, 0.016330759972333908, -0.008827279321849346, 0.010775872506201267, -0.03066284768283367, -0.02974102459847927, -0.020682930946350098, -0.04506061226129532, -0.061404675245285034, 0.0033763155806809664, 0.020434102043509483, 0.008585669100284576, -0.042916566133499146, 0.015179433859884739, 0.043287307024002075, 0.0019942549988627434, -0.005119370762258768, 0.0015155390137806535, 0.06917086243629456, -0.012624313123524189, 0.018489468842744827, -0.027298280969262123, -0.002969921100884676, -0.04463619738817215, -0.008230169303715229, 0.007822697050869465, 0.0020872363820672035, -0.0029829926788806915, -0.02407447062432766, 0.014514680951833725, -0.0009327974985353649, -0.026771290227770805, 0.027605395764112473, -0.007515354081988335, -0.0018627223325893283, -0.03466128185391426, 0.05050916597247124, -0.01736438274383545, -0.022289704531431198, -0.0006090850802138448, 0.01098627969622612, 0.03530136123299599, -0.02956566773355007, -0.02967498078942299, 0.008515138179063797, 0.02563701570034027, -0.00873731728643179, -0.02000562846660614, 0.021411707624793053, -0.010078925639390945, 0.0012784777209162712, 0.025628570467233658, 0.009671728126704693, 0.0108156343922019, -0.012212852947413921, -0.017741722986102104, 0.0028450465761125088, -0.03327907621860504, -0.011652499437332153, -0.005970491096377373, -0.0204616766422987, -0.017476774752140045, 0.014202829450368881, 0.05718868970870972, -0.004456745460629463, 0.009061728604137897, 0.03164754435420036, 0.008906010538339615, -0.0006996502634137869, -0.03128299489617348, -0.005571411922574043, 0.004467756487429142, 0.030214926227927208, -0.026981083676218987, -0.04669111222028732, -0.035833582282066345, -0.04226157069206238, -0.029924670234322548, 0.01980682462453842, -0.059683907777071, -0.0222382303327322, 0.0034607599955052137, -0.022339314222335815, -0.04677046835422516, 0.0026344740763306618, 0.027189915999770164, 0.003010955173522234, 0.042874082922935486, -0.01634400710463524, 0.01230406854301691, -0.005148743279278278, -0.020048245787620544, 0.00006729899178026244, 0.005824706517159939, 0.0368555523455143, -0.02464328147470951, -0.001586511847563088, 0.026143159717321396, -0.06598420441150665, -0.008485495112836361, 0.0033589256927371025, 0.03745593503117561, -0.00664001377299428, -0.03818586468696594, -0.006055471021682024, 0.01869886741042137, 0.031118784099817276, 0.016838613897562027, 0.010678618215024471, -0.05310972034931183, -0.005718282889574766, 0.012390307150781155, -0.019331030547618866, 0.003535099560394883, -0.0028499336913228035, -0.016747809946537018, 0.03448419272899628, 0.0041598123498260975, -0.025011537596583366, -0.030064566060900688, -0.05195855349302292, 0.012740526348352432, 0.01016987580806017, -0.018780238926410675, -0.007750572636723518, -0.01204614620655775, -0.019425276666879654, -0.036927904933691025, -0.023769089952111244, 0.04512086138129234, 0.027008965611457825, -0.022611115127801895, 0.01221079844981432, 0.017335988581180573, -0.019041454419493675, -0.018060915172100067, 0.03594309836626053, -0.008761035278439522, 0.06274749338626862, 0.005930108949542046, -0.019778365269303322, -0.008169818669557571, 0.003016652772203088 ]
The Partnership: Amazon SageMaker and Hugging Face
philschmid
March 23, 2021
the-partnership-amazon-sagemaker-and-hugging-face
partnerships, aws
https://huggingface.co/blog/the-partnership-amazon-sagemaker-and-hugging-face
One Command is All you Need With the new Hugging Face Deep Learning Containers available in Amazon SageMaker, training cutting-edge Transformers-based NLP models has never been simpler. There are variants specially optimized for TensorFlow and PyTorch, for single-GPU, single-node multi-GPU and multi-node clusters.
[ 0.020799657329916954, -0.04893752932548523, -0.00851539894938469, 0.021869352087378502, -0.0213493499904871, 0.05787956714630127, -0.00882204994559288, 0.0296905767172575, -0.0533871091902256, -0.03761086240410805, -0.07260385155677795, 0.06991931796073914, -0.01089794933795929, 0.0932704359292984, 0.029514506459236145, -0.03789743781089783, -0.004557102918624878, 0.02633318491280079, -0.03487946093082428, 0.04362977668642998, 0.01912274770438671, -0.0640178769826889, 0.0338192954659462, 0.0061418735422194, -0.04923130199313164, -0.04853144288063049, 0.0011385252000764012, -0.046484168618917465, 0.012179569341242313, 0.04964558035135269, -0.08282072097063065, -0.0040374440141022205, 0.011883114464581013, 0.0017664290498942137, 0.056123409420251846, -0.004756885580718517, -0.15183378756046295, 0.06071633845567703, 0.0020770705305039883, 0.012755642645061016, -0.07564447820186615, 0.0010298050474375486, -0.09684981405735016, -0.011169558390974998, 0.001099388231523335, -0.0061056786216795444, -0.12685833871364594, 0.06784038990736008, 0.004779407754540443, -0.024316566064953804, -0.09261048585176468, 0.09436491131782532, -0.013068877160549164, -0.013406295329332352, 0.0456637479364872, 0.03458322957158089, -0.00486527755856514, -0.04908863082528114, -0.004817217122763395, -0.03207796439528465, -0.029785890132188797, -0.00855995062738657, -0.025657005608081818, 0.025123456493020058, -0.0036103809252381325, -0.05418112874031067, -0.005037048831582069, -0.07484324276447296, -0.05437019094824791, -0.014639223925769329, 0.03022824600338936, -0.03060552105307579, -0.011102160438895226, -0.02643641084432602, -0.02732507884502411, -0.06690569221973419, -0.04268307611346245, -0.04752731695771217, 0.045249320566654205, 0.05003533884882927, -0.059006135910749435, 0.023014456033706665, 0.007993189617991447, 0.06165965646505356, 0.027708914130926132, 0.04089304432272911, 0.01748098060488701, -0.08385884761810303, -0.07415122538805008, 0.07107152044773102, 0.019269008189439774, -0.0651673749089241, 0.02272365801036358, 0.02080461010336876, 0.05505501851439476, 0.008373718708753586, -0.0018008494516834617, -0.04868372902274132, -0.01762743666768074, -0.03649058938026428, 0.032934922724962234, -0.06807280331850052, 0.02814595028758049, -0.045757319778203964, -0.05247322842478752, 0.03217211738228798, -0.027631105855107307, -0.11966639757156372, 0.030972955748438835, 0.017507364973425865, 0.037918031215667725, -0.013555832207202911, 0.020579034462571144, 0.10964671522378922, -0.09540881961584091, 0.07912030071020126, 0.029710324481129646, -0.04990286007523537, -0.026734361425042152, -0.01721094734966755, 0.04328644275665283, 0.09004436433315277, 0.08170855045318604, -0.003006309038028121, 0.01741892844438553, 0.03165777772665024, 0.015608424320816994, 0.006311855278909206, 0.04298769682645798, -0.05446577072143555, 0.025069449096918106, -0.05242636054754257, 0.08242695033550262, 0.027919581159949303, 0.03008408471941948, -0.053126562386751175, 0.04389636218547821, -0.059925831854343414, 0.01709800213575363, 0.01486932672560215, 0.005564322229474783, 0.11109095066785812, 0.016899507492780685, 0.03667786717414856, 0.04043744504451752, 0.020803291350603104, -0.0556778647005558, 0.040836434811353683, -0.026172291487455368, 0.06063321605324745, -0.08077095448970795, 0.04408298060297966, -0.04205106571316719, -0.08827360719442368, 0.025054773315787315, 0.09415560215711594, -0.03648204356431961, -0.013413569889962673, -0.03089355304837227, -0.09466812014579773, -0.03211250528693199, -0.05226195976138115, -0.04199272394180298, -0.04419289529323578, -0.01832818239927292, -0.039228953421115875, 0.02237263321876526, 0.06033811345696449, 0.05443111062049866, 0.006748667452484369, 0.04127202555537224, -0.005232182331383228, 0.018381936475634575, -0.0304366797208786, 0.01520693302154541, -0.008922995999455452, 0.048573464155197144, 0.07396093755960464, 0.000056712149671511725, -0.02655969187617302, -0.08692588657140732, 0.030955001711845398, -0.04538055136799812, 0.01112956739962101, 0.03758244961500168, -0.10129301249980927, -0.007884819060564041, 0.03693574666976929, 0.02895849011838436, 0.024304939433932304, -0.023886842653155327, 0.014874833635985851, 0.05932120233774185, 0.03568078577518463, 0.052285004407167435, -0.017800431698560715, -0.07734375447034836, 0.12236304581165314, 0.043555308133363724, 0.032114408910274506, 0.0570458360016346, -0.015389102511107922, -0.03627902641892433, -0.022537803277373314, -0.00924342405050993, 0.02108203060925007, -0.0481850765645504, -0.026257500052452087, 0.009975414723157883, -0.010454080067574978, 0.032717812806367874, -0.16021423041820526, 0.003704880131408572, -0.05338829383254051, 0.012226141057908535, -0.0197437796741724, -0.08174934983253479, 0.032101523131132126, 0.031510718166828156, 0.05121724307537079, 0.13080240786075592, -0.03145020082592964, -0.01277252472937107, -0.019121289253234863, -0.03921978548169136, 0.057691819965839386, 0.05013584345579147, 0.0038267234340310097, 0.0480181910097599, -0.06604890525341034, -0.009781165048480034, -0.06068700924515724, -0.00855723861604929, 0.03981827199459076, 0.015775036066770554, -0.03355616331100464, 0.051858823746442795, 0.014270756393671036, -0.005856415256857872, -0.010219795629382133, 0.002984813880175352, 0.010963925160467625, 0.03914676606655121, 0.01913456618785858, 0.05625573545694351, -0.01513199508190155, 0.04103926569223404, -0.030912939459085464, 0.0071962447836995125, 0.009612438268959522, -0.0753459557890892, 0.05567019060254097, -0.004603071138262749, -0.046097978949546814, 0.025434840470552444, -0.0177382230758667, -0.00008611391967860982, -0.012788954190909863, 0.012792310677468777, 0.06808671355247498, -0.007252878975123167, 0.024379925802350044, -0.02369115874171257, -0.009099970571696758, -0.019744837656617165, -0.059978652745485306, 0.005031442269682884, -0.0288375336676836, 0.019914858043193817, -0.00023856287589296699, 0.02115776389837265, -0.01998721994459629, 0.021939413622021675, -0.023905200883746147, -0.001679195323958993, 0.02363421767950058, 0.04954490065574646, -0.0001884782686829567, -0.026378339156508446, -0.03278718516230583, -0.007839163765311241, -0.059598542749881744, 0.022001706063747406, 0.041525643318891525, 0.007361961528658867, -0.006606488022953272, 0.020120669156312943, -0.006172326859086752, -0.02630949206650257, 0.013897639699280262, 0.01068123709410429, 0.047181256115436554, 0.017645273357629776, -0.017262259498238564, -0.023517576977610588, 0.03038259595632553, -0.0020575097296386957, -0.006913830991834402, -0.016340499743819237, 0.06264810264110565, -0.013906759209930897, -0.0011313195573166013, 0.007566130254417658, 0.03545299917459488, -0.003414091421291232, -0.005852299276739359, 0.03940810635685921, 0.00852884165942669, -0.08301897346973419, -0.06045522540807724, -0.051284607499837875, 0.0004993657348677516, -0.0017916244687512517, -0.018180491402745247, 0.004320970270782709, -0.009875102899968624, 0.008223063312470913, 0.022719712927937508, 0.01169638056308031, 0.023929275572299957, 0.015002979896962643, 0.01891661249101162, -0.023034032434225082, 0.04151783883571625, -0.00971762090921402, -0.026400446891784668, -0.006010203156620264, 0.031858522444963455, -0.0020948268938809633, 0.02867918461561203, -0.011306501924991608, -0.0241144597530365, -0.013222141191363335, -0.029020320624113083, 0.04923933744430542, -0.004441233351826668, 0.0013418970629572868, -0.012933021411299706, -0.01063571684062481, 0.009307424537837505, -0.02943331003189087, 0.015506630763411522, -0.04156244546175003, 0.0053857676684856415, 0.010672313161194324, 0.045226097106933594, 0.051192570477724075, 0.005879389587789774, 0.04185226559638977, -0.011808488517999649, 0.0070394291542470455, -0.013784587383270264, 0.02743556536734104, -0.009909327141940594, -0.020615607500076294, -0.005738628562539816, 0.013804268091917038, -0.051805634051561356, -0.037454549223184586, -0.02792343683540821, 0.01880442351102829, 0.03013553097844124, 0.02173660323023796, 0.012088824063539505, -0.011623851023614407, 0.016103506088256836, 0.004041701555252075, -0.020388958975672722, -0.047201406210660934, 0.010946452617645264, -0.01888859085738659, 0.00239703175611794, -0.00760605838149786, 0.04831945151090622, -0.014489121735095978, -0.0168694369494915, 0.04715784639120102, 0.039704497903585434, -0.0017670131055638194, 0.03896990045905113, -0.030132535845041275, 0.0024523225147277117, -0.044922105967998505, 0.01443675346672535, -0.019040662795305252, -0.019810866564512253, 0.05710424482822418, 0.007259635720402002, -0.018969785422086716, -0.009658549912273884, -0.012257096357643604, -0.018385088071227074, 0.03773915767669678, -0.006937140598893166, -0.036360565572977066, -0.04729924350976944, 0.04381752759218216, 0.040593311190605164, -0.007579091936349869, -0.03637286275625229, 0.04508141055703163, -0.008474953472614288, -0.0009178439504466951, -0.016889706254005432, 0.016002483665943146, 0.03938363492488861, -0.0181098785251379, 0.008886979892849922, -0.0012299908557906747, -0.044195499271154404, 0.011895573697984219, 0.0014810982393100858, -0.041111938655376434, 0.010618343017995358, 0.01822405867278576, 0.0062180873937904835, -0.01776246912777424, 0.005714177154004574, 0.047474734485149384, 0.0025937685277312994, -0.0061892494559288025, -0.01901736855506897, 0.05412193387746811, 0.029147911816835403, 0.005886574275791645, -0.006384734064340591, -0.001944612362422049, 0.0402565598487854, -0.019332686439156532, 0.048356011509895325, -0.024256156757473946, -0.023212039843201637, 0.021553464233875275, 0.020589951425790787, 0.011109369806945324, 0.027141790837049484, -0.020129475742578506, -0.03121793642640114, -0.030060915276408195, 0.005047591868788004, 0.0398978553712368, 0.005705974996089935, 0.036395568400621414, -0.023625127971172333, -0.03607865795493126, 0.020299838855862617, -0.01727655529975891, -0.009516960009932518, -0.04415757954120636, -0.0006025444017723203, 0.05524548143148422, -0.0007244663429446518, 0.030924635007977486, 0.028027672320604324, -0.038084402680397034, 0.012865516357123852, -0.02923557721078396, 0.09101825952529907, 0.002979051787406206, 0.015111531130969524, -0.0570402555167675, 0.02985330857336521, 0.05129764601588249, -0.011988742277026176, -0.006678116973489523, 0.007074764464050531, 0.021617157384753227, 0.04657384753227234, -0.010353713296353817, 0.0029225018806755543, -0.0022901222109794617, 0.00006562211638083681, 0.05772128701210022, 0.021607225760817528, -0.015084042213857174, -0.020104140043258667, -0.025811290368437767, 0.010843397118151188, -0.025080062448978424, -0.014996125362813473, -0.005511964205652475, -0.04773273319005966, 0.027490556240081787, 0.07526060938835144, 0.05531793832778931, 0.0018572269473224878, -0.019884683191776276, 0.03027992509305477, -0.023344717919826508, 0.009823580272495747, -0.0167835745960474, -0.002219134010374546, -0.009964077733457088, 0.05962427332997322, 0.033916667103767395, 0.051278211176395416, 0.01060544978827238, 0.03305196762084961, -0.009803199209272861, -0.012948310934007168, 0.02708715945482254, -0.026373187080025673, 0.026770615950226784, 0.0069265044294297695, 0.03116568922996521, 0.02790708839893341, 0.013801084831357002, 0.014320827089250088, 0.03393028303980827, 0.030231574550271034, -0.02055799774825573, -0.028185613453388214, 0.039142802357673645, -0.02024267241358757, 0.005649106111377478, -0.007343028672039509, 0.0035441238433122635, -0.02524479664862156, 0.025646841153502464, 0.018994469195604324, 0.011169248260557652, -0.000363560306141153, -0.016293244436383247, -0.02572702430188656, -0.0058640530332922935, 0.03519647940993309, 0.022811029106378555, 0.02768489345908165, -0.002645994070917368, -0.010756835341453552, 0.016451826319098473, -0.025366710498929024, 0.01320264395326376, -0.024771979078650475, -0.001443962100893259, 0.01664108969271183, -0.02143264189362526, 0.030961500480771065, 0.020919810980558395, 0.020434608682990074, -0.027342133224010468, -0.018799541518092155, -0.016838792711496353, -0.01565384492278099, -0.017735067754983902, 0.02972453273832798, 0.010490328073501587, -0.038938771933317184, -0.001786350621841848, -0.03210930526256561, -0.03907240554690361, -0.019075820222496986, -0.05604107305407524, 0.044314686208963394, 0.05553155764937401, 0.009288011118769646, 0.010195770300924778, 0.010099680162966251, 0.03686739131808281, -0.005886015482246876, 0.006733033340424299, -0.01739668659865856, 0.043092530220746994, -0.012140566483139992, 0.01874413527548313, 0.03157114237546921, -0.017570825293660164, -0.011908205226063728, -0.009159773588180542, -0.06730780005455017, 0.0347304530441761, 0.018427956849336624, -0.04235530272126198, -0.006388252601027489, 0.00099998340010643, -0.0416710190474987, -0.0023394173476845026, -0.010141109116375446, 0.02209179848432541, 0.05996938794851303, 0.0033880143892019987, 0.016846882179379463, -0.005744014400988817, -0.017849097028374672, 0.011327363550662994, 0.054609574377536774, -0.02590646967291832, 0.02032255195081234, -0.005735516548156738, 0.058194972574710846, 0.016101717948913574, 0.01946362294256687, -0.0024052318185567856, -0.012491797097027302, 0.027929872274398804, -0.060896288603544235, 0.050211843103170395, 0.044218774884939194, -0.01991664618253708, -0.0455281026661396, -0.013103281147778034, -0.016200346872210503, -0.023948954418301582, 0.001722895191051066, 0.04888024181127548, -0.01253674179315567, -0.006192076951265335, -0.02943558804690838, 0.07641077786684036, 0.07083775103092194, 0.031857866793870926, 0.01512496080249548, 0.016111087054014206, 0.03871983289718628, 0.015094546601176262, 0.0015978934243321419, 0.0444832518696785, 0.009670471772551537, 0.016995105892419815, 0.013791906647384167, 0.03314828872680664, 0.051071640104055405, -0.0356820672750473, -0.011682923883199692, -0.01097076665610075, 0.00702828960493207, -0.0012829244369640946, 0.00381262949667871, 0.010961045511066914, -0.055596642196178436, -0.01107003353536129, -0.007121209520846605, -0.019386108964681625, 0.05374293401837349, -0.0231359601020813, 0.03007563017308712, -0.023199040442705154, 0.010955731384456158, -0.0042883665300905704, -0.012205555103719234, 0.0008874799823388457, -0.05884954333305359, 0.03879814222455025, 0.009222234599292278, 0.07047347724437714, -0.00007253900548676029, -0.029950391501188278, -0.016347674652934074, 0.006753589957952499, -0.023296095430850983, -0.011478498578071594, 0.014310512691736221, -0.01937234215438366, 0.016263702884316444, -0.015854498371481895, 0.04450904205441475, 0.0006444836617447436, 0.012084515765309334, 0.00725523428991437, 0.02558082528412342, -0.03089912422001362, -0.0037666731514036655, 0.005330911371856928, -0.004417864140123129, 0.0369434617459774, -0.06912601739168167, 0.0257053691893816, 0.0021275533363223076, 0.044102221727371216, 0.03532920032739639, 0.011541048996150494, 0.016898376867175102, -0.00536694098263979, -0.005118107423186302, -0.009139960631728172, -0.0340440608561039, 0.030323078855872154, 0.011505907401442528, -0.016407188028097153, 0.032133445143699646, -0.027803665027022362, 0.002443264704197645, -0.015173513442277908, 0.036506686359643936, 0.01668117567896843, 0.00042056868551298976, -0.0226312093436718, 0.007199716754257679, 0.03359522670507431, 0.021971477195620537, 0.01801847480237484, 0.007127268239855766, -0.008072666823863983, -0.0010380313033238053, -0.03526946157217026, -0.011775325983762741, -0.024381371214985847, 0.0026007406413555145, -0.045087140053510666, -0.03347760811448097, -0.02097892202436924, 0.004783038515597582, -0.00044610947952605784, 0.028752723708748817, -0.0539080947637558, 0.03474270924925804, -0.043076857924461365, -0.026900172233581543, -0.031012175604701042, 0.015797864645719528, 0.04872199147939682, 0.0656922459602356, 0.030987093225121498, -0.02582024224102497, -0.022392384707927704, -0.025085145607590675, 0.009724859148263931, 0.032333701848983765, 0.07587125897407532, -0.032352741807699203, 0.024346554651856422, -0.053312256932258606, -0.019146665930747986, 0.028966518118977547, -0.04703791067004204, 0.0156705342233181, 0.023643895983695984, -0.003856167895719409, -0.032957565039396286, -0.007015743292868137, 0.028914056718349457, -0.02217341586947441, 0.029449541121721268, -0.03532661870121956, 0.003108744043856859, 0.008053717203438282, 0.012841553427278996, -0.03699195757508278, -0.012842396274209023, 0.0015499871224164963, -0.02060730941593647, -0.0037495035212486982, 0.01509722787886858, 0.028975825756788254, -0.03762831538915634, -0.012659677304327488, -0.01943218894302845, -0.03986045718193054, -0.012876864522695541, -0.03906461223959923, -0.001336464425548911, 0.0219501331448555, -0.030732931569218636, -0.04278465360403061, -0.01512653287500143, -0.023510705679655075, -0.003332042135298252, -0.0012255713809281588, -0.03270096331834793, -0.008403080515563488, -0.04699229449033737, 0.01202058419585228, 0.019811414182186127, 0.018710898235440254, 0.052663709968328476, -0.0018140650354325771, 0.004614892415702343, -0.010303745046257973 ]
The Partnership: Amazon SageMaker and Hugging Face
philschmid
March 23, 2021
the-partnership-amazon-sagemaker-and-hugging-face
partnerships, aws
https://huggingface.co/blog/the-partnership-amazon-sagemaker-and-hugging-face
Git Repositories When you create an HuggingFace Estimator, you can specify a training script that is stored in a GitHub repository as the entry point for the estimator, so that you don’t have to download the scripts locally. If Git support is enabled, then entry_point and source_dir should be relative paths in the Git repo if provided. As an example to use git_config with an example script from the transformers repository. Be aware that you need to define output_dir as a hyperparameter for the script to save your model to S3 after training. Suggestion: define output_dir as /opt/ml/model since it is the default SM_MODEL_DIR and will be uploaded to S3. - Example Notebook python # configure git settings git_config = {'repo': 'https://github.com/huggingface/transformers.git','branch': 'master'} # create the Estimator huggingface_estimator = HuggingFace( entry_point='run_glue.py', source_dir='./examples/text-classification', git_config=git_config, instance_type='ml.p3.2xlarge', instance_count=1, role=role, transformers_version='4.4', pytorch_version='1.6', py_version='py36', hyperparameters=hyperparameters )
[ -0.004300791770219803, 0.013420341536402702, -0.06672926247119904, 0.025596726685762405, 0.045468661934137344, 0.06858724355697632, -0.0045316810719668865, 0.024509938433766365, -0.02509733848273754, -0.04261544346809387, -0.10531135648488998, 0.05572885274887085, 0.02262396551668644, 0.050599031150341034, -0.02053513005375862, -0.05600578337907791, 0.014350268058478832, -0.009812457486987114, -0.03829800710082054, 0.026239441707730293, -0.02281544730067253, -0.028968293219804764, -0.029160164296627045, 0.012159580364823341, -0.022820668295025826, -0.06947513669729233, 0.05223921313881874, 0.03243051469326019, -0.03758588805794716, 0.03769991546869278, -0.08545644581317902, -0.02413753792643547, 0.024291440844535828, -0.08946620672941208, 0.03307361900806427, 0.06839931756258011, -0.1238296777009964, 0.008509354665875435, 0.04900861904025078, -0.057209234684705734, -0.0035293635446578264, 0.0459766611456871, -0.0801268070936203, 0.04321733117103577, 0.0004208283789921552, -0.03369789570569992, -0.12752556800842285, 0.0468929298222065, -0.0480445921421051, 0.024602551013231277, -0.06924448162317276, 0.05088222399353981, -0.04407967999577522, -0.05407891422510147, -0.019596165046095848, 0.025540800765156746, 0.06317513436079025, -0.09749448299407959, 0.011377755552530289, 0.03210614621639252, 0.021319881081581116, -0.009885396808385849, 0.023880619555711746, 0.1218201145529747, 0.03433965519070625, -0.0412503257393837, -0.029302680864930153, -0.03913797065615654, -0.04784070700407028, -0.08011974394321442, 0.03031395748257637, 0.015258386731147766, 0.002603961154818535, -0.00400119461119175, -0.08348773419857025, -0.026455046609044075, -0.012117988429963589, 0.0605289489030838, 0.010459903627634048, 0.08592486381530762, -0.005102235823869705, 0.01853630319237709, -0.044801801443099976, 0.07622193545103073, 0.04440738633275032, 0.05846097692847252, 0.02467472478747368, -0.10204977542161942, -0.07214709371328354, 0.036956723779439926, 0.02790233865380287, -0.0743081346154213, -0.022282836958765984, 0.045073892921209335, 0.02917347103357315, -0.029677335172891617, -0.017587456852197647, 0.013215006329119205, -0.012480193749070168, 0.01060844399034977, -0.02283748798072338, -0.019722772762179375, -0.07330497354269028, -0.0810694471001625, -0.02227679453790188, 0.05668608471751213, -0.01535606849938631, -0.033949028700590134, -0.03646541386842728, -0.040354423224925995, -0.01203926932066679, -0.04827636480331421, 0.0033724033273756504, 0.03263327106833458, -0.032757099717855453, -0.008088217116892338, -0.021382534876465797, -0.07705072313547134, -0.00370906013995409, -0.0014230484375730157, 0.017282482236623764, 0.10258319228887558, -0.012832310982048512, 0.06376120448112488, -0.003914003726094961, 0.07966125756502151, -0.03539818152785301, -0.018334874883294106, -0.01671581156551838, -0.058336205780506134, 0.005485039670020342, -0.025069106370210648, 0.073256716132164, -0.04531604424118996, 0.013247218914330006, -0.0614924281835556, 0.02225612848997116, -0.06079287827014923, 0.01171903870999813, -0.009821162559092045, -0.04812169075012207, 0.11392803490161896, -0.05206245929002762, -0.0004245561722200364, 0.024932902306318283, -0.019119227305054665, -0.048436909914016724, 0.004627978429198265, 0.05037445202469826, 0.07633082568645477, -0.04253604635596275, 0.10140322893857956, 0.031174378469586372, -0.036588311195373535, -0.030216524377465248, 0.06015123054385185, -0.0020490786992013454, 0.045659516006708145, -0.03583868220448494, 0.018786059692502022, -0.013868700712919235, 0.08960913121700287, -0.10136552155017853, -0.002513515530154109, 0.016833491623401642, -0.0347583070397377, 0.026227988302707672, 0.003379709552973509, 0.03943590819835663, -0.01501467078924179, 0.026347531005740166, -0.06463275849819183, 0.05240928381681442, -0.034306850284338, 0.11132805794477463, 0.0069325752556324005, -0.0007442435598932207, 0.02916661463677883, 0.004851562436670065, -0.06533528864383698, -0.0436953566968441, 0.04789614677429199, -0.011057479307055473, 0.0034269033931195736, 0.07146777212619781, -0.08153743296861649, 0.014314266853034496, -0.039064761251211166, -0.023203976452350616, -0.009371333755552769, -0.011097780428826809, -0.07984178513288498, 0.0779481828212738, 0.027193583548069, 0.05045682564377785, 0.015396544709801674, 0.03024885803461075, 0.08060833811759949, 0.06030384078621864, -0.024671049788594246, 0.00882434006780386, -0.05040598288178444, 0.00006998071330599487, 0.009353531524538994, -0.0018123198533430696, 0.016278648748993874, -0.05067705363035202, -0.09366504848003387, 0.05914362892508507, -0.0009896386181935668, -0.004807665012776852, -0.023833947256207466, 0.009802870452404022, -0.031405553221702576, -0.016201509162783623, -0.001988372066989541, -0.0726030096411705, -0.021060418337583542, -0.0032993892673403025, 0.021484991535544395, 0.1305921971797943, -0.023694880306720734, 0.04130664840340614, 0.014078838750720024, -0.033186573535203934, 0.0019804900512099266, 0.04937602952122688, 0.07585638016462326, 0.0652206689119339, -0.07349130511283875, -0.027235141023993492, -0.07808583229780197, -0.016579847782850266, 0.041222769767045975, -0.015090749599039555, -0.08099875599145889, -0.016355745494365692, -0.03174139931797981, -0.059472814202308655, 0.02837524004280567, 0.021956827491521835, -0.002135075395926833, -0.016787905246019363, -0.033339593559503555, 0.06745114177465439, -0.03789620101451874, 0.04689142107963562, 0.012684818357229233, -0.028643077239394188, -0.03266460821032524, -0.0652211457490921, 0.02762661688029766, 0.021462228149175644, 0.00037766090827062726, -0.010029862634837627, 0.043134476989507675, -0.008176658302545547, 0.014966370537877083, 0.004125170409679413, 0.06990767270326614, -0.0017812872538343072, 0.07027924805879593, -0.034314289689064026, -0.012470271438360214, -0.012194429524242878, -0.0483468733727932, 0.006856299005448818, -0.02256266586482525, 0.010310772806406021, -0.0014982579741626978, 0.019362976774573326, 0.0025612202007323503, -0.01311531849205494, 0.014271451160311699, 0.016041923314332962, 0.019237643107771873, 0.0021312697790563107, -0.0076782661490142345, -0.024455256760120392, -0.0046773431822657585, 0.037183817476034164, -0.03798052296042442, 0.002625787165015936, 0.018788035959005356, -0.009171010926365852, 0.03323908522725105, 0.0183330699801445, -0.03295052424073219, 0.005990547593683004, 0.027292439714074135, 0.020807262510061264, 0.041154637932777405, 0.04588909074664116, 0.00004864062066189945, -0.04509061202406883, 0.007510258350521326, 0.017914332449436188, -0.005619251634925604, -0.003773240139707923, 0.046358078718185425, -0.03891366347670555, 0.019194047898054123, 0.03542139753699303, -0.03458472713828087, -0.035906609147787094, 0.04194928705692291, 0.004249465651810169, 0.0005680931499227881, -0.08199598640203476, -0.005045280791819096, -0.04434080794453621, 0.024294324219226837, 0.037686318159103394, -0.023923173546791077, 0.008122840896248817, 0.009667502716183662, -0.016950245946645737, -0.008595823310315609, -0.022580349817872047, 0.013532107695937157, 0.04514184594154358, 0.02756762132048607, 0.011771610006690025, -0.0530850775539875, 0.009421256370842457, -0.007520521525293589, 0.014547421596944332, 0.017694545909762383, -0.04879524186253548, 0.009637787938117981, -0.015285610221326351, -0.039630573242902756, -0.014970126561820507, 0.00320143299177289, 0.051793914288282394, 0.01743120513856411, -0.009587744250893593, -0.06785231828689575, -0.009199311025440693, -0.04337894171476364, -0.008877494372427464, -0.0057686264626681805, -0.047260675579309464, -0.0022750268690288067, 0.01405336894094944, 0.027910983189940453, 0.012783735059201717, 0.01819109357893467, 0.019926348701119423, -0.01749298721551895, -0.0067988294176757336, -0.012330414727330208, 0.06460551172494888, -0.02415315806865692, -0.005249203648418188, 0.02722509205341339, -0.01923026330769062, -0.009465687908232212, -0.0034682401455938816, 0.019529467448592186, 0.02020101249217987, 0.04336021468043327, -0.024362480267882347, 0.00017833516176324338, 0.011260186322033405, 0.02781062014400959, 0.01842372678220272, 0.020977117121219635, -0.0607646219432354, 0.027840951457619667, -0.016555724665522575, -0.05672037601470947, 0.014499003067612648, 0.02455742470920086, 0.0014079241082072258, 0.008848343975841999, -0.012161259539425373, 0.02666644938290119, 0.004012247081845999, 0.017448941245675087, 0.0014359449269250035, 0.011822549626231194, -0.08007896691560745, -0.026955442503094673, -0.05037496238946915, -0.06621134281158447, 0.050678178668022156, 0.054853931069374084, -0.045357123017311096, 0.024784257635474205, -0.011800595559179783, 0.012395631521940231, -0.028595659881830215, 0.028892112895846367, 0.0340348482131958, -0.05435826629400253, 0.03644474223256111, 0.02766932174563408, -0.004409685265272856, -0.006642698775976896, 0.024224035441875458, -0.049014825373888016, -0.04956686124205589, -0.0032740028109401464, 0.00706381443887949, 0.010517423041164875, -0.02200174890458584, 0.004594017285853624, 0.005583238322287798, -0.02313687838613987, -0.015142716467380524, -0.014984723180532455, 0.042003173381090164, 0.0206817165017128, -0.006820795591920614, -0.01610066182911396, -0.00866100937128067, 0.011274226941168308, -0.011216610670089722, -0.017631230875849724, -0.015450372360646725, -0.02890658751130104, 0.043806083500385284, 0.019265005365014076, 0.02442024275660515, -0.05636458843946457, -0.009144304320216179, 0.06620829552412033, -0.009139129891991615, 0.016515906900167465, 0.01511916983872652, -0.040562909096479416, 0.044653572142124176, 0.002477208385244012, 0.01802849769592285, 0.01777731627225876, -0.015446395613253117, -0.011564024724066257, -0.0066023352555930614, 0.00372499693185091, -0.002107328036800027, 0.011171657592058182, -0.014666428789496422, -0.012097812257707119, 0.008002705872058868, 0.008689331822097301, 0.003385997610166669, -0.014540675096213818, -0.027290252968668938, 0.03571011871099472, 0.029298504814505577, -0.02933030016720295, 0.007901047356426716, 0.021900257095694542, -0.009918169118463993, 0.015015574172139168, -0.045055266469717026, 0.0036470468621701, 0.026483451947569847, 0.027376066893339157, 0.001668095588684082, 0.02404877357184887, 0.061660561710596085, -0.015334829688072205, -0.045456413179636, -0.0036435446236282587, 0.0038442956283688545, 0.042322054505348206, -0.011946256272494793, 0.009913437999784946, 0.0006815610686317086, 0.012144574895501137, 0.008786859922111034, 0.05083799734711647, 0.017779963091015816, -0.0695887953042984, -0.018727729097008705, 0.015506034716963768, -0.0035358744207769632, 0.0004768325306940824, 0.012740753591060638, -0.035295046865940094, -0.005720110144466162, 0.0447891503572464, 0.07878527045249939, 0.02058727666735649, -0.03334485739469528, 0.0177040696144104, -0.016857480630278587, -0.03877140209078789, 0.053096238523721695, -0.03420313820242882, 0.034643396735191345, 0.01242294441908598, 0.05769510194659233, 0.03619726374745369, -0.0007806486100889742, 0.023568030446767807, -0.033532194793224335, 0.01373398955911398, 0.05289171263575554, -0.016969535499811172, -0.01567453145980835, 0.006154809147119522, 0.03209729865193367, 0.0024603719357401133, 0.01492245588451624, -0.034132279455661774, 0.04690910503268242, 0.08933864533901215, -0.019948557019233704, -0.013077213428914547, 0.02088947407901287, 0.0029493914917111397, 0.01166792493313551, 0.028738273307681084, 0.008469989523291588, 0.015434796921908855, 0.015911661088466644, -0.026282386854290962, 0.0021507812198251486, 0.0047087338753044605, -0.05271867662668228, -0.044117994606494904, -0.007584600243717432, 0.04551469162106514, -0.004375017248094082, 0.04076090082526207, -0.043116457760334015, 0.0025829619262367487, 0.01243132445961237, 0.026667172089219093, 0.00847318023443222, -0.05088454857468605, -0.011609910055994987, 0.023913437500596046, -0.014102990739047527, -0.013215865008533001, 0.006952640134841204, -0.027377193793654442, 0.03375905752182007, 0.0001481646322645247, 0.027313994243741035, -0.006883041933178902, 0.0021638188045471907, 0.03648145869374275, 0.03824692964553833, -0.02904488891363144, -0.008595298044383526, -0.040473572909832, 0.016532033681869507, -0.004347526468336582, -0.018744733184576035, 0.025463491678237915, 0.036766715347766876, 0.03565981611609459, 0.026512296870350838, 0.03736664727330208, 0.019913841038942337, 0.008400384336709976, 0.00010268695768900216, 0.0016326566692441702, -0.0021198757458478212, 0.031232083216309547, 0.02208545431494713, 0.01574641279876232, -0.012470336630940437, 0.034570880234241486, 0.005569117609411478, -0.046109266579151154, 0.010284483432769775, 0.007962890900671482, -0.01660115085542202, -0.013133591040968895, -0.04020913690328598, -0.02993599884212017, 0.021119456738233566, -0.006074175238609314, 0.01869836263358593, -0.012242590077221394, 0.032863400876522064, -0.020431088283658028, -0.001332893967628479, -0.033889058977365494, -0.005849259905517101, 0.021050971001386642, -0.0484975166618824, 0.058568961918354034, 0.016969218850135803, 0.024302901700139046, 0.03975042700767517, -0.014878053218126297, 0.007558958139270544, -0.009308074600994587, 0.06971877068281174, 0.03970549628138542, 0.056329283863306046, 0.04846007376909256, -0.00956706888973713, 0.0040769511833786964, -0.016970131546258926, -0.004498506896197796, -0.02956574596464634, 0.020846234634518623, 0.003363303141668439, 0.007402761373668909, 0.0028966350946575403, 0.0064537618309259415, 0.043044716119766235, -0.004598270170390606, 0.0387394018471241, 0.029545066878199577, -0.011066253297030926, 0.051236897706985474, -0.012005251832306385, -0.001945377211086452, 0.028476964682340622, 0.024297157302498817, -0.014106840826570988, 0.0009145567892119288, 0.03310927376151085, -0.0061162677593529224, 0.014245480298995972, -0.02098718471825123, 0.011275768280029297, -0.03133498877286911, -0.01149171032011509, -0.012175322510302067, 0.027056636288762093, -0.016583656892180443, -0.05932005122303963, 0.0036712137516587973, -0.013682571239769459, 0.07653723657131195, -0.02009822055697441, 0.022713754326105118, -0.0007294461247511208, -0.008583886548876762, -0.010610206052660942, 0.01903124339878559, 0.03241749107837677, -0.033766813576221466, -0.02134731039404869, 0.010672523640096188, 0.02918088808655739, -0.000244060909608379, 0.007468614727258682, -0.03892270848155022, -0.04158623516559601, -0.005917930975556374, 0.012765581719577312, 0.02999536693096161, -0.018558045849204063, -0.04642050340771675, 0.017503464594483376, 0.04874825105071068, 0.00954754650592804, 0.034625254571437836, 0.029910532757639885, 0.029827985912561417, -0.05003790929913521, 0.01973753049969673, -0.008783048018813133, -0.041263364255428314, 0.003188991453498602, -0.01259545236825943, 0.0133441723883152, 0.0015741455135867, 0.05714193359017372, 0.04294341802597046, -0.005899874959141016, -0.027010127902030945, -0.011712863110005856, 0.029506711289286613, 0.00929376482963562, -0.055760856717824936, 0.0596805140376091, 0.028361812233924866, -0.0005289881373755634, 0.04328959062695503, -0.008395262993872166, 0.03847913444042206, 0.03441058471798897, -0.0177418552339077, 0.058278389275074005, 0.0070243580266833305, -0.006899648811668158, 0.043595895171165466, 0.04627656936645508, 0.03473612293601036, 0.03558512032032013, 0.009840748272836208, 0.015053912065923214, -0.0036753532476723194, -0.05029100179672241, 0.013596955686807632, -0.008411082439124584, -0.026075154542922974, 0.005518653895705938, -0.0655154138803482, -0.029433108866214752, -0.019630374386906624, -0.03269105777144432, 0.03823190927505493, -0.04742829501628876, 0.0022005371283739805, -0.026556774973869324, 0.022776620462536812, -0.0367249920964241, 0.004510397091507912, 0.026686090975999832, 0.04487127438187599, 0.021266240626573563, 0.01416798122227192, -0.036995355039834976, 0.011337934993207455, 0.014663171954452991, 0.031621698290109634, 0.04279761016368866, 0.01645432971417904, -0.02231723815202713, -0.015575150959193707, 0.03724788501858711, -0.0003657153865788132, -0.05216574668884277, 0.0028665976133197546, -0.012869562953710556, 0.011809062212705612, -0.01667962037026882, 0.006978085730224848, 0.050202373415231705, 0.024558503180742264, 0.04789005592465401, -0.0365472286939621, -0.00016840618627611548, 0.003260403173044324, -0.002794848755002022, -0.031625889241695404, 0.010305007919669151, -0.015273360535502434, -0.01277758739888668, 0.0019169793231412768, -0.026568640023469925, 0.05308621749281883, 0.005609449930489063, -0.03570332005620003, 0.02706134133040905, -0.011033976450562477, -0.027188418433070183, -0.032783959060907364, 0.018619446083903313, 0.03861087188124657, -0.022194361314177513, -0.014137525111436844, -0.020885102450847626, -0.024471083655953407, -0.03196008503437042, 0.02149612084031105, -0.0011193534592166543, 0.0017589015187695622, 0.008700815960764885, 0.009439093060791492, -0.039890892803668976, 0.01160199474543333, -0.023023737594485283, -0.02005675435066223, -0.05227834731340408, 0.0005365369142964482 ]
The Partnership: Amazon SageMaker and Hugging Face
philschmid
March 23, 2021
the-partnership-amazon-sagemaker-and-hugging-face
partnerships, aws
https://huggingface.co/blog/the-partnership-amazon-sagemaker-and-hugging-face
Set up a development environment and install sagemaker As mentioned above we are going to use SageMaker Notebook Instances for this. To get started you need to jump into your Jupyer Notebook or JupyterLab and create a new Notebook with the conda_pytorch_p36 kernel. Note: The use of Jupyter is optional: We could also launch SageMaker Training jobs from anywhere we have an SDK installed, connectivity to the cloud and appropriate permissions, such as a Laptop, another IDE or a task scheduler like Airflow or AWS Step Functions. After that we can install the required dependencies bash pip install "sagemaker>=2.31.0" "transformers==4.6.1" "datasets[s3]==1.6.2" --upgrade To run training on SageMaker we need to create a sagemaker Session and provide an IAM role with the right permission. This IAM role will be later attached to the TrainingJob enabling it to download data, e.g. from Amazon S3. python import sagemaker sess = sagemaker.Session() # sagemaker session bucket -> used for uploading data, models and logs # sagemaker will automatically create this bucket if it not exists sagemaker_session_bucket=None if sagemaker_session_bucket is None and sess is not None: # set to default bucket if a bucket name is not given sagemaker_session_bucket = sess.default_bucket() role = sagemaker.get_execution_role() sess = sagemaker.Session(default_bucket=sagemaker_session_bucket) print(f"sagemaker role arn: {role}") print(f"sagemaker bucket: {sess.default_bucket()}") print(f"sagemaker session region: {sess.boto_region_name}")
[ 0.04372214525938034, 0.002616083947941661, 0.00610851077362895, 0.06584938615560532, 0.03111153468489647, 0.04167066141963005, -0.0006809330079704523, 0.023474205285310745, -0.036239903420209885, -0.008595735765993595, -0.038197439163923264, 0.05936393141746521, -0.005458528641611338, 0.1006542295217514, -0.00039853533962741494, -0.050421491265296936, 0.055234603583812714, -0.0000970968249021098, -0.017659824341535568, 0.002676574746146798, 0.006383419502526522, 0.00857806857675314, -0.04512801021337509, 0.0011675594141706824, 0.016245191916823387, -0.05328924208879471, 0.048450615257024765, 0.0008369321003556252, -0.03811896964907646, 0.03195040300488472, -0.05796215310692787, 0.013516721315681934, 0.049085646867752075, -0.02934359200298786, 0.022838696837425232, 0.04943570867180824, -0.08253086358308792, 0.05396560579538345, 0.07075828313827515, -0.052876874804496765, -0.027073994278907776, -0.0025358605198562145, -0.0688893124461174, 0.0387469083070755, -0.02882681041955948, -0.03569681569933891, -0.1670750379562378, 0.01675902120769024, 0.03535039350390434, -0.0034316193778067827, -0.13514398038387299, 0.1250201165676117, 0.03338756784796715, -0.07854565232992172, 0.0017541456036269665, 0.021282859146595, 0.04903154820203781, -0.002765172626823187, 0.0041174753569066525, -0.03572024032473564, 0.02697223424911499, -0.02049533650279045, -0.047924596816301346, 0.020322725176811218, 0.020278703421354294, -0.027775529772043228, 0.04747668653726578, -0.018414922058582306, -0.03864580765366554, -0.06051614508032799, 0.003357470501214266, -0.09963230043649673, -0.017326300963759422, 0.0018507057102397084, -0.028146233409643173, -0.14433838427066803, 0.024618571624159813, -0.011608375236392021, 0.029825478792190552, 0.0847993865609169, 0.03427324444055557, 0.007251410279422998, -0.031568076461553574, 0.015576181933283806, 0.051793813705444336, -0.007297956850379705, -0.009227288886904716, -0.055426064878702164, 0.0043151187710464, 0.06543254107236862, 0.04809708148241043, -0.023193592205643654, 0.008949238806962967, 0.012960881926119328, 0.014420151710510254, -0.03115043416619301, -0.00975712202489376, -0.01817939057946205, 0.0032962122932076454, -0.056769419461488724, 0.0458899587392807, -0.05113239958882332, 0.0173051655292511, -0.057941555976867676, -0.011881141923367977, 0.08672595024108887, 0.01620452292263508, -0.08738630264997482, 0.006725827697664499, 0.012009522877633572, 0.04270277917385101, -0.01853065751492977, -0.016065187752246857, 0.07265734672546387, -0.07643663138151169, 0.0730980932712555, 0.019895311444997787, -0.027958156540989876, -0.007559959311038256, 0.004202084615826607, 0.036250315606594086, 0.06907957047224045, 0.041888345032930374, 0.042073871940374374, -0.02683217264711857, 0.048837143927812576, 0.02066849358379841, -0.000901543244253844, 0.03749401122331619, -0.07483381032943726, 0.04923030734062195, -0.028867652639746666, 0.05295199900865555, -0.0075722867622971535, 0.023291561752557755, 0.00044176209485158324, -0.017279241234064102, -0.04454369843006134, 0.03301224857568741, 0.03202812001109123, 0.02406308613717556, 0.11692417412996292, 0.020045315846800804, 0.10222163051366806, 0.04774519428610802, 0.022913802415132523, -0.03917904943227768, 0.021286115050315857, 0.020334500819444656, 0.0655653327703476, -0.055290061980485916, 0.04428797960281372, -0.04498371481895447, -0.08933721482753754, -0.006434103474020958, 0.06904300302267075, -0.03851693123579025, -0.010180415585637093, -0.025770142674446106, -0.03849690780043602, 0.023993534967303276, -0.011751637794077396, -0.04863395169377327, -0.03286776691675186, -0.00199685525149107, -0.05834010988473892, 0.0630331039428711, -0.00824514590203762, 0.04536505043506622, -0.05314335599541664, -0.001896147383376956, -0.060881245881319046, 0.045220885425806046, 0.016672408208251, 0.05036455765366554, 0.01768713817000389, 0.0377565361559391, 0.03515741601586342, -0.009994188323616982, -0.014399188570678234, -0.044746994972229004, 0.06324565410614014, -0.054780200123786926, 0.014386974275112152, 0.07237850874662399, -0.06774135679006577, 0.07371586561203003, -0.0019206105498597026, 0.026944763958454132, 0.03709321841597557, -0.02679448202252388, -0.04994084686040878, 0.0478580966591835, -0.016883395612239838, 0.05975444242358208, 0.00730093801394105, 0.008350959978997707, 0.10392900556325912, 0.02095717005431652, 0.07668916881084442, -0.011653019115328789, 0.008800121955573559, -0.0005416494677774608, 0.03641102835536003, -0.011511428281664848, 0.0807897225022316, 0.011292267590761185, -0.03230738639831543, 0.08426453918218613, -0.024562448263168335, -0.011793830431997776, -0.10343285650014877, 0.05361691489815712, -0.07713410258293152, -0.02166585437953472, 0.04849599301815033, -0.09480820596218109, 0.0032682938035577536, 0.05387992039322853, 0.03230506554245949, 0.13787199556827545, -0.045492514967918396, 0.045598965138196945, -0.021913878619670868, 0.012864558026194572, 0.0032117131631821394, 0.06886013597249985, 0.06783473491668701, 0.0747610330581665, -0.07804704457521439, -0.04793493449687958, -0.041692137718200684, -0.022694677114486694, 0.039090804755687714, 0.0022885187063366175, -0.011720829643309116, -0.02510746382176876, -0.05572166293859482, 0.007903778925538063, 0.04080810025334358, 0.07617968320846558, 0.038536377251148224, -0.022213689982891083, -0.03049374744296074, 0.011911999434232712, -0.028493190184235573, 0.079459547996521, -0.01038382574915886, -0.008637464605271816, -0.04624904319643974, -0.07843456417322159, 0.01100214384496212, -0.009886263869702816, 0.0071217273361980915, 0.04924610257148743, 0.04260697960853577, -0.0225930567830801, -0.008755975402891636, 0.03882283344864845, 0.0569305494427681, -0.009346711449325085, 0.013999215327203274, -0.008914983831346035, -0.02623487450182438, -0.035497553646564484, -0.007404593750834465, 0.015708908438682556, -0.04982936009764671, 0.020137855783104897, -0.02594677358865738, 0.06054999306797981, -0.04472542926669121, 0.029606573283672333, 0.009676598943769932, -0.01661641150712967, 0.020647168159484863, 0.040812015533447266, 0.011983880773186684, 0.014723839238286018, -0.01791524514555931, 0.020816106349229813, -0.04731149226427078, -0.005254028365015984, -0.005067923106253147, 0.022114640101790428, 0.018445273861289024, -0.008810319937765598, -0.01052588876336813, -0.030174771323800087, 0.012052005156874657, -0.00042659626342356205, 0.037704773247241974, 0.029563631862401962, -0.005465438589453697, 0.018363801762461662, -0.0018318077782168984, -0.0029151251073926687, -0.019254954531788826, -0.004300625063478947, 0.05836213007569313, -0.01348613016307354, -0.012048346921801567, -0.010775024071335793, -0.03263654559850693, -0.0561949722468853, -0.0025701450649648905, 0.03894912824034691, -0.03131123632192612, -0.10282658785581589, 0.006790026091039181, -0.026106003671884537, 0.011251670308411121, 0.033651355654001236, 0.005141319707036018, 0.06811052560806274, 0.002478195121511817, -0.03223888948559761, 0.022624706849455833, -0.04671737924218178, 0.030569231137633324, 0.003389104036614299, 0.0024874734226614237, -0.007363511249423027, 0.016642864793539047, -0.008016671054065228, -0.0024805606808513403, 0.012008678168058395, 0.022991899400949478, -0.04299321398139, 0.06676138937473297, 0.0004594409838318825, -0.02851000986993313, -0.0023222421295940876, 0.0004503691161517054, 0.027251018211245537, 0.030737556517124176, 0.02369605004787445, -0.0324680358171463, -0.014027244411408901, -0.011287475004792213, 0.003394325263798237, -0.004021017346531153, -0.03878822177648544, -0.013057979755103588, 0.021343857049942017, 0.04184996336698532, 0.01121107954531908, 0.016998201608657837, -0.005576869938522577, -0.030508065596222878, -0.006185545586049557, -0.02273392118513584, 0.03853701427578926, -0.011800517328083515, -0.00848469790071249, -0.01378556527197361, 0.025981374084949493, -0.008726621977984905, -0.015360468998551369, 0.0071939281187951565, 0.0010271555511280894, 0.00586471613496542, -0.0010568412253633142, -0.0027521285228431225, 0.01483057625591755, 0.060799386352300644, 0.033915210515260696, -0.02568904496729374, -0.006558964494615793, 0.04078366979956627, 0.020981572568416595, -0.023005036637187004, -0.007956298999488354, 0.03491947799921036, 0.015010252594947815, 0.020481862127780914, 0.0002475100045558065, 0.033066276460886, -0.02109096758067608, 0.02745039016008377, -0.008543681353330612, 0.0163729265332222, -0.026467375457286835, -0.018324395641684532, -0.0024472693912684917, -0.024693477898836136, 0.044880595058202744, 0.05107813701033592, 0.00898720696568489, -0.02320977672934532, 0.009843452833592892, -0.024138394743204117, 0.012251755222678185, 0.01788773387670517, 0.0034812057856470346, -0.04047875851392746, 0.076109379529953, 0.059453971683979034, 0.020235605537891388, -0.039610687643289566, 0.033938489854335785, -0.013466531410813332, -0.0016692703356966376, -0.02683105133473873, 0.022820746526122093, -0.019516699016094208, -0.025101425126194954, 0.013615562580525875, 0.004501617047935724, -0.03042389079928398, -0.0013900253688916564, -0.010002121329307556, -0.040647245943546295, 0.0056830779649317265, -0.05334251746535301, -0.04071425646543503, -0.05121443420648575, -0.02392280288040638, 0.024445461109280586, -0.0006876068655401468, -0.017337540164589882, -0.030162284150719643, 0.015297187492251396, 0.06713351607322693, 0.0013832402182742953, -0.044145602732896805, -0.0032453564926981926, 0.06467387825250626, -0.05366840213537216, 0.0069100926630198956, -0.01961274817585945, -0.01769014447927475, -0.0050621055997908115, -0.018456116318702698, 0.0333033986389637, 0.05230901017785072, -0.03444985672831535, -0.03531055897474289, -0.029779547825455666, -0.008608167059719563, 0.014776881784200668, 0.012227635830640793, 0.031451087445020676, -0.008156276308000088, 0.0031800498254597187, 0.038950931280851364, 0.010313877835869789, -0.002056840807199478, -0.0265142060816288, 0.017336849123239517, 0.049040671437978745, -0.051996126770973206, 0.013637479394674301, 0.027149749919772148, -0.07342974841594696, -0.023139966651797295, -0.04397139325737953, 0.012151772156357765, 0.025067763403058052, -0.008379759266972542, -0.0470825619995594, 0.02006293646991253, 0.015961304306983948, -0.01981671340763569, -0.02577400580048561, 0.009324347600340843, 0.025290751829743385, 0.06399981677532196, -0.03266904130578041, -0.02933936007320881, -0.004944134969264269, -0.015253997407853603, 0.035601656883955, 0.027949258685112, -0.023641139268875122, -0.019222645089030266, 0.01190447248518467, 0.006698112469166517, -0.04558006674051285, -0.0404316782951355, 0.013125273399055004, -0.02664385363459587, 0.0019635786302387714, 0.03846107795834541, 0.028509214520454407, 0.03656740486621857, -0.03843163326382637, 0.03461253643035889, -0.006554656196385622, -0.02721581980586052, -0.019102023914456367, -0.011474807746708393, -0.024453600868582726, -0.0026010842993855476, 0.04583776742219925, 0.019214710220694542, 0.0018482048762962222, 0.045501917600631714, -0.008436057716608047, -0.006088802590966225, 0.05651598051190376, -0.05321255326271057, -0.003136393614113331, 0.0033352298196405172, -0.0034036661963909864, 0.009423877112567425, -0.018575802445411682, -0.0339108407497406, 0.006146245636045933, 0.05423041805624962, -0.02492167055606842, -0.038569748401641846, 0.041205134242773056, 0.004609455354511738, -0.025641290470957756, -0.00006250551086850464, -0.0071253348141908646, -0.009766444563865662, 0.017295721918344498, 0.011206629686057568, 0.0025140049401670694, -0.01145880576223135, -0.02206500433385372, -0.011688930913805962, 0.0062641273252666, 0.0417092889547348, 0.0021278259810060263, -0.006037015933543444, -0.031932104378938675, -0.006654148455709219, 0.03513317555189133, -0.010370162315666676, 0.02019997499883175, -0.04710742458701134, -0.002593755489215255, 0.0002892306656576693, -0.012776504270732403, 0.022313712164759636, 0.022198747843503952, 0.035243671387434006, -0.019810935482382774, 0.0008879860397428274, 0.02260701172053814, -0.05282609164714813, -0.0023742439225316048, 0.042645424604415894, -0.021754637360572815, -0.034355174750089645, -0.03306660056114197, -0.02441658452153206, -0.015551614575088024, -0.020823867991566658, -0.03246542066335678, 0.008664906024932861, 0.051340971142053604, 0.011378422379493713, 0.0406152606010437, -0.012607995420694351, -0.010097619146108627, 0.037466101348400116, 0.06082489341497421, 0.00531894201412797, 0.030321350321173668, 0.007472949102520943, -0.006979245692491531, 0.0007204631110653281, 0.0009644474484957755, -0.038005370646715164, 0.02375476062297821, -0.050399381667375565, 0.0015624586958438158, 0.0016160620143637061, -0.017589928582310677, -0.005753475707024336, -0.016689861193299294, -0.021330084651708603, -0.007088860496878624, -0.006097931880503893, 0.04699847102165222, 0.03630509227514267, 0.015518555417656898, -0.019001031294465065, 0.009250285103917122, -0.007999777793884277, -0.009068484418094158, 0.03191199526190758, -0.06490178406238556, 0.03638318553566933, -0.03951156139373779, 0.039446406066417694, 0.015737976878881454, -0.0010428864043205976, 0.014173598960042, -0.007863770239055157, 0.07087074220180511, -0.008987100794911385, 0.02010953240096569, 0.036084409803152084, 0.001342310686595738, -0.05044045299291611, -0.02571081556379795, 0.022929217666387558, -0.014802716672420502, -0.014305025339126587, 0.025433994829654694, -0.018021514639258385, 0.017526518553495407, -0.029552651569247246, 0.0730910524725914, 0.053791020065546036, 0.04787682741880417, 0.01665976271033287, 0.009098735637962818, 0.061323851346969604, -0.0028110193088650703, -0.017585966736078262, 0.03752411901950836, 0.015784673392772675, 0.029635563492774963, -0.008749439381062984, 0.011065457947552204, 0.02365995943546295, 0.005745908245444298, -0.026997875422239304, -0.03005298599600792, -0.020576611161231995, -0.007780499290674925, -0.0014201905578374863, 0.010880518704652786, -0.06199631839990616, -0.04037868231534958, -0.011561460793018341, -0.010434100404381752, 0.024420415982604027, -0.012771422043442726, 0.00034383285674266517, -0.00760482857003808, -0.03467787429690361, -0.01446388941258192, 0.005542684346437454, 0.002617100952193141, -0.03538193181157112, -0.051743220537900925, 0.015088147483766079, -0.006688155699521303, -0.03495921194553375, -0.02147490717470646, -0.04844638332724571, -0.0041382405906915665, -0.02207576297223568, -0.03336009010672569, 0.032565563917160034, -0.04870619252324104, -0.014940711669623852, 0.009349856525659561, 0.007298820652067661, 0.0019045863300561905, 0.038472022861242294, 0.03513341397047043, 0.03611689805984497, -0.02100752294063568, 0.02228294312953949, -0.009907708503305912, -0.046519163995981216, 0.03535129874944687, -0.046663325279951096, 0.07536430656909943, -0.014442726038396358, 0.03232010081410408, -0.019104858860373497, -0.02291983738541603, 0.01930921897292137, 0.004075758624821901, -0.013703999109566212, 0.02983257919549942, -0.030604280531406403, 0.024755507707595825, 0.015068648383021355, 0.010707235895097256, 0.0228884220123291, 0.003436230355873704, -0.008430643938481808, 0.01945178210735321, 0.0005465939757414162, -0.0011219335719943047, -0.025832392275333405, 0.012781512923538685, -0.008177794516086578, 0.04003060236573219, 0.00020368302648421377, 0.033183783292770386, -0.003724877256900072, -0.00972733460366726, 0.005348933394998312, -0.03039674460887909, -0.003476759186014533, -0.03933576121926308, 0.010556521825492382, -0.06778746843338013, -0.06594614684581757, -0.028665460646152496, -0.03348072990775108, -0.02166539616882801, 0.0210243109613657, -0.05019959434866905, -0.009814593940973282, -0.0011973289074376225, 0.012274427339434624, -0.020898303017020226, 0.002981433877721429, 0.04548828303813934, 0.03191310912370682, 0.019340448081493378, -0.008975386619567871, -0.05358979105949402, -0.0019221218535676599, 0.014936603605747223, 0.008919564075767994, 0.03832175210118294, -0.0026576390955597162, 0.009056873619556427, -0.0006604177178815007, 0.0530492402613163, -0.004860769957304001, -0.03975480794906616, 0.02492162212729454, 0.0036237866152077913, -0.008344357833266258, -0.02383674867451191, 0.020152388140559196, 0.02684476040303707, 0.01340802013874054, 0.030835572630167007, 0.0014557265676558018, -0.018685054033994675, 0.004765475634485483, 0.006474448833614588, -0.04402121156454086, -0.01385439746081829, -0.004921765998005867, -0.04570532217621803, 0.005924020893871784, -0.011589959263801575, -0.026061134412884712, -0.04195301979780197, -0.02881014719605446, -0.03599734976887703, 0.006950867362320423, -0.06451626867055893, -0.04685279354453087, 0.022258391603827477, 0.04544801265001297, -0.02731691487133503, -0.04003358632326126, -0.03375472128391266, -0.025050479918718338, -0.04635734483599663, 0.014139696024358273, -0.010654838755726814, 0.004542254842817783, -0.0313129723072052, 0.04882831126451492, 0.006621045060455799, 0.04517972841858864, 0.031647369265556335, 0.002965007210150361, -0.005729996133595705, 0.017414353787899017 ]
The Partnership: Amazon SageMaker and Hugging Face
philschmid
March 23, 2021
the-partnership-amazon-sagemaker-and-hugging-face
partnerships, aws
https://huggingface.co/blog/the-partnership-amazon-sagemaker-and-hugging-face
> Look at these smiles! # The Partnership: Amazon SageMaker and Hugging Face Today, we announce a strategic partnership between Hugging Face and Amazon to make it easier for companies to leverage State of the Art Machine Learning models, and ship cutting-edge NLP features faster. Through this partnership, Hugging Face is leveraging Amazon Web Services as its Preferred Cloud Provider to deliver services to its customers. As a first step to enable our common customers, Hugging Face and Amazon are introducing new Hugging Face Deep Learning Containers (DLCs) to make it easier than ever to train Hugging Face Transformer models in Amazon SageMaker. To learn how to access and use the new Hugging Face DLCs with the Amazon SageMaker Python SDK, check out the guides and resources below. > On July 8th, 2021 we extended the Amazon SageMaker integration to add easy deployment and inference of Transformers models. If you want to learn how you can deploy Hugging Face models easily with Amazon SageMaker take a look at the new blog post and the documentation. ---
[ 0.01745406910777092, 0.01524310652166605, 0.0363071970641613, 0.00019618839723989367, -0.019425440579652786, 0.06911769509315491, 0.00907451193779707, 0.04681076854467392, -0.060090865939855576, -0.0008470460306853056, -0.050706684589385986, 0.059057027101516724, -0.02466624416410923, 0.1439238041639328, -0.007071590516716242, -0.06650174409151077, -0.0018194729927927256, 0.04120086506009102, -0.025421956554055214, 0.052764892578125, -0.03583681210875511, -0.03945554420351982, -0.022733399644494057, 0.012279399670660496, -0.02164115011692047, -0.03601646423339844, 0.06084730476140976, -0.044410340487957, 0.013624392449855804, 0.024154605343937874, -0.03208434209227562, -0.028777973726391792, -0.00045695059816353023, -0.015097832307219505, 0.00018891858053393662, 0.053918253630399704, -0.18915969133377075, 0.041873324662446976, 0.02214856818318367, 0.008520055562257767, -0.010356028564274311, -0.01776270754635334, -0.07439953833818436, -0.027674473822116852, -0.015417255461215973, -0.04190672188997269, -0.11502107977867126, 0.023402472957968712, 0.02526773139834404, -0.0038466600235551596, -0.07143387198448181, 0.0934460312128067, -0.049580298364162445, -0.01481170579791069, 0.01698947325348854, 0.03024864010512829, -0.006988463923335075, -0.06289557367563248, -0.03465215489268303, -0.025335654616355896, -0.005556462798267603, -0.060547418892383575, 0.024131733924150467, 0.017094621434807777, 0.020022792741656303, 0.010116188786923885, 0.007082877214998007, -0.04271981120109558, -0.028297215700149536, -0.009901181794703007, 0.045424677431583405, -0.10667335242033005, -0.029273169115185738, 0.016750959679484367, 0.013719726353883743, -0.045159097760915756, -0.036518797278404236, -0.022858241572976112, 0.015141968615353107, 0.014605803415179253, -0.06219903379678726, 0.01637187972664833, 0.011672391556203365, 0.04135138913989067, 0.023646607995033264, 0.051548998802900314, 0.026582472026348114, -0.07865601778030396, -0.0925038531422615, 0.07813597470521927, -0.008558648638427258, -0.08269412070512772, 0.0025851160753518343, 0.00392537284642458, 0.05849764496088028, -0.000326802022755146, 0.010649618692696095, -0.05903765931725502, 0.0018874866655096412, -0.055139608681201935, 0.050362445414066315, -0.08088460564613342, -0.007765740621834993, -0.06347287446260452, -0.0038332000840455294, -0.010957257822155952, -0.031027864664793015, -0.10523956269025803, 0.052846409380435944, 0.045878492295742035, 0.060505691915750504, -0.027517452836036682, 0.009222679771482944, 0.07529992610216141, -0.06940511614084244, 0.08661312609910965, -0.0004958509816788137, 0.0015947711654007435, -0.005887042265385389, 0.01535928063094616, 0.01794644631445408, 0.0665799230337143, 0.04268225282430649, 0.018318457528948784, 0.009294609539210796, 0.050193119794130325, -0.034446537494659424, -0.01329994946718216, 0.051917415112257004, -0.059663597494363785, -0.006312110461294651, -0.04469643905758858, 0.0393214114010334, -0.000632764829788357, 0.07023798674345016, -0.05211121588945389, -0.0211982112377882, -0.09686993807554245, 0.047266971319913864, 0.021894147619605064, 0.008046615868806839, 0.09701994061470032, -0.006955140270292759, 0.029939057305455208, 0.061346981674432755, 0.036502864211797714, -0.07582204788923264, 0.017473263666033745, 0.011289039626717567, 0.06417600065469742, -0.08311161398887634, 0.050087910145521164, -0.0077089471742510796, -0.0833941325545311, 0.016296900808811188, 0.07434555143117905, 0.0004490823484957218, -0.012219657190144062, -0.0016750269569456577, -0.09429097920656204, -0.008747021667659283, -0.05691734328866005, -0.10332014411687851, -0.015804775059223175, -0.00044242883450351655, 0.004425829742103815, 0.03427406772971153, -0.01185920462012291, 0.052909865975379944, -0.02591170184314251, -0.0021169211249798536, -0.03850569203495979, 0.04887910187244415, -0.018329061567783356, 0.04017990827560425, 0.06686793267726898, 0.0536494143307209, 0.09132377803325653, 0.01686503365635872, -0.005035619717091322, -0.07589206099510193, 0.055550090968608856, -0.015630273148417473, 0.005646480247378349, 0.020086826756596565, -0.02852235548198223, 0.05017799884080887, 0.02674173191189766, 0.04815041273832321, 0.017652271315455437, -0.04024157673120499, 0.015307363122701645, 0.041740965098142624, 0.002142947167158127, 0.03499343618750572, 0.0676921010017395, -0.054875802248716354, 0.08112642168998718, 0.019266538321971893, 0.01192709244787693, 0.06822173297405243, -0.04372761398553848, -0.024072201922535896, 0.054270319640636444, -0.010920475237071514, 0.01123860664665699, -0.02227339893579483, -0.053087107837200165, -0.00515018031001091, 0.009081886149942875, 0.033835750073194504, -0.12054789066314697, 0.01932261325418949, -0.00942782498896122, 0.019738230854272842, -0.05305679515004158, -0.029136907309293747, 0.016446037217974663, -0.0035246212501078844, 0.07250658422708511, 0.0976366251707077, 0.018186505883932114, 0.03575791046023369, -0.05623622238636017, -0.002711317967623472, 0.045152727514505386, 0.11654731631278992, 0.0526040755212307, 0.05059211701154709, -0.054056257009506226, -0.02531113103032112, -0.0715460255742073, -0.017934467643499374, 0.0013559618964791298, -0.005963881965726614, -0.02698497287929058, 0.08002837002277374, -0.03199966996908188, 0.008977607823908329, 0.004710289649665356, 0.0030961704906076193, -0.009403797797858715, 0.010219549760222435, 0.02942797541618347, 0.04943287372589111, -0.07858971506357193, 0.05381399393081665, -0.05393586307764053, -0.0006564708310179412, 0.01229153759777546, -0.09891732037067413, 0.09087895601987839, -0.016626499593257904, 0.0024444700684398413, -0.0043997629545629025, -0.0010753837414085865, -0.020041560754179955, 0.0057608215138316154, 0.01396351121366024, 0.0739603191614151, -0.006972011178731918, 0.005677014123648405, -0.03421221673488617, -0.005997844040393829, 0.009043434634804726, -0.03994453325867653, -0.008712450042366982, -0.002917909761890769, 0.04049079120159149, 0.0006284128758125007, 0.008931628428399563, -0.03396473824977875, 0.021194763481616974, -0.0023263609036803246, 0.005734469275921583, 0.027811631560325623, 0.040176499634981155, 0.010229973122477531, -0.014686350710690022, -0.027783114463090897, -0.003269892418757081, -0.02266453020274639, 0.01818010024726391, 0.001156131038442254, -0.011597800999879837, 0.009409330785274506, -0.0024766260758042336, -0.027838457375764847, -0.049414172768592834, -0.017191361635923386, 0.04122578352689743, 0.06228626146912575, 0.045936133712530136, -0.010057068429887295, 0.0028994593303650618, 0.02197788655757904, 0.01857275888323784, -0.030113114044070244, -0.03338915854692459, 0.06424815207719803, -0.0033102724701166153, -0.026084301993250847, -0.019922157749533653, 0.006150458473712206, 0.0023494188208132982, -0.018746281042695045, 0.07148665189743042, -0.0015664087841287255, -0.07727308571338654, -0.06636682152748108, -0.0403868705034256, -0.0024609051179140806, 0.016547955572605133, -0.011300265789031982, 0.05499257519841194, 0.01834915019571781, 0.0008651210810057819, 0.023489154875278473, -0.001251059235073626, 0.02719697542488575, 0.00470403116196394, -0.027708927169442177, -0.01204673945903778, 0.003957852255553007, -0.03537771478295326, 0.017591511830687523, -0.015385699458420277, 0.03143707662820816, -0.020737960934638977, 0.03143063560128212, 0.019134681671857834, -0.05276758596301079, 0.017039963975548744, -0.02219008095562458, 0.07904127985239029, -0.020707780495285988, 0.042006924748420715, -0.011949201114475727, 0.028421947732567787, -0.011116317473351955, -0.0032210424542427063, 0.01018153689801693, -0.06489796936511993, 0.00042756093898788095, -0.02220304310321808, 0.030861960723996162, 0.06873887032270432, 0.02624731883406639, 0.017480269074440002, 0.0003231964074075222, 0.016928507015109062, 0.0003551232221070677, 0.04408206045627594, -0.031012393534183502, -0.05503730848431587, -0.008647087961435318, 0.01229272224009037, -0.017521854490041733, 0.00043902822653762996, -0.0136621268466115, 0.016000622883439064, 0.02030348591506481, -0.0027321260422468185, -0.013814732432365417, 0.0007441874477081001, 0.009662963449954987, 0.02552569843828678, 0.01398923248052597, -0.03836403042078018, 0.04494887962937355, 0.00415119668468833, -0.002826541429385543, 0.007277431432157755, 0.018419422209262848, 0.02039959840476513, -0.03896632790565491, 0.035588931292295456, 0.04347209259867668, 0.011452659033238888, 0.041389595717191696, -0.06512746214866638, 0.0007209681207314134, -0.01833692006766796, -0.034566015005111694, 0.020183321088552475, -0.025705207139253616, 0.025213368237018585, 0.001290994812734425, -0.008711783215403557, -0.027465518563985825, 0.0033214495051652193, 0.011527006514370441, 0.03072231262922287, -0.003770440584048629, 0.005901539698243141, -0.050103116780519485, 0.03519759699702263, 0.02672615461051464, 0.018058625981211662, -0.04026520252227783, 0.024823440238833427, -0.01450392883270979, -0.017711011692881584, -0.018205104395747185, 0.021433206275105476, 0.03380411118268967, -0.014379322528839111, -0.040798574686050415, -0.019385937601327896, -0.03546625375747681, -0.014833979308605194, -0.014843509532511234, -0.03256106749176979, 0.02004983462393284, -0.001483030035160482, -0.028149982914328575, 0.003877732204273343, -0.02824978157877922, 0.03890551999211311, 0.001921259332448244, -0.02966412529349327, -0.00033032585633918643, 0.052690230309963226, 0.029155846685171127, -0.002699977718293667, -0.007257156074047089, 0.0062768165953457355, 0.023504778742790222, -0.0012545324862003326, 0.02224116213619709, -0.016893768683075905, -0.009335345588624477, 0.015957674011588097, 0.016791151836514473, 0.008776464499533176, 0.009365937672555447, -0.005088512320071459, -0.030242159962654114, -0.028919043019413948, 0.003365736920386553, 0.03044065646827221, -0.023094456642866135, 0.015981381759047508, 0.007113557308912277, -0.019581181928515434, 0.02993936836719513, -0.02615387737751007, -0.009815027937293053, 0.01340189017355442, 0.023549294099211693, 0.0624079555273056, 0.002848264994099736, -0.0028715382795780897, -0.01705312542617321, -0.031682923436164856, -0.03581387177109718, -0.016794515773653984, 0.05756623297929764, 0.009101715870201588, -0.02701047621667385, -0.06846188008785248, 0.04742288589477539, 0.0067939767614007, -0.020505359396338463, -0.0036983389873057604, 0.024724438786506653, 0.00522229028865695, 0.04488256201148033, -0.011266477406024933, 0.013393825851380825, -0.019942471757531166, -0.005983618088066578, 0.03644995763897896, 0.019751377403736115, -0.01987733691930771, -0.03871025890111923, -0.0048698680475354195, 0.01752200908958912, -0.0025946954265236855, 0.005441390909254551, -0.010512086562812328, -0.01510605402290821, -0.03362088277935982, 0.07217903435230255, 0.03515259176492691, 0.02953875996172428, -0.03281174227595329, -0.0026720864698290825, -0.034312568604946136, -0.025052014738321304, -0.05269179865717888, -0.009124401956796646, 0.00201827147975564, 0.05357341095805168, 0.06503766775131226, 0.06572680175304413, 0.004862820729613304, -0.0005947238532826304, -0.029805798083543777, -0.023843925446271896, 0.013708963058888912, -0.03856341540813446, 0.02948286011815071, -0.0028644781559705734, 0.03748435154557228, -0.012030684389173985, 0.007548036053776741, -0.005578634794801474, -0.001050774473696947, 0.016109179705381393, -0.028885290026664734, -0.009755943901836872, 0.022942177951335907, -0.021304484456777573, -0.021861569955945015, -0.017353998497128487, 0.017467088997364044, -0.027325736358761787, 0.04991941899061203, 0.014753586612641811, 0.008997355587780476, 0.0012004824820905924, -0.016454385593533516, -0.048480208963155746, -0.005988385062664747, 0.03871849924325943, 0.0065778703428804874, -0.0016740189166739583, -0.014674310572445393, -0.03311993181705475, -0.01009337231516838, -0.03521612659096718, 0.007846021093428135, -0.013450134545564651, -0.0037375122774392366, 0.0076625170186161995, -0.03020048700273037, -0.010380460880696774, 0.03385195508599281, 0.01240942720323801, -0.006517455913126469, 0.0071942745707929134, 0.0012098508886992931, 0.002738434122875333, -0.0051329913549125195, 0.04831990227103233, 0.011047274805605412, -0.025605186820030212, -0.010918615385890007, -0.009135943837463856, -0.021292442455887794, -0.028873881325125694, -0.03536934405565262, 0.023087376728653908, 0.04658697172999382, 0.00466943858191371, 0.02464795857667923, 0.0035967077128589153, 0.017020132392644882, 0.06195151433348656, 0.02749290131032467, 0.001862998935393989, 0.04085418954491615, 0.01146372128278017, -0.003482127794995904, 0.0004995889030396938, -0.011397212743759155, -0.04096931964159012, -0.03067399002611637, -0.07285500317811966, 0.034072063863277435, 0.022618604823946953, -0.02667975053191185, 0.013416481204330921, 0.011283163912594318, -0.00702015170827508, 0.0032127313315868378, 0.028543323278427124, 0.02064339816570282, 0.04475091025233269, 0.01575738936662674, 0.010711073875427246, 0.01585807278752327, -0.011701979674398899, 0.04049244523048401, 0.06332764774560928, -0.01849866285920143, -0.04899827763438225, -0.009678841568529606, 0.03360164910554886, -0.0220410767942667, 0.0069475844502449036, 0.04050256311893463, -0.000058155790611635894, 0.04267146438360214, -0.0313071608543396, 0.07736997306346893, 0.021913735195994377, -0.019286958500742912, -0.0325852632522583, -0.02736516483128071, -0.027683742344379425, -0.012263558804988861, -0.028098920360207558, -0.0075440420769155025, -0.029592085629701614, 0.008953633718192577, 0.0018668228294700384, 0.06482527405023575, 0.03228864446282387, 0.03864148631691933, 0.005527886562049389, 0.013038711622357368, 0.0800233781337738, 0.0027634957805275917, 0.06274779886007309, 0.019781947135925293, -0.018095653504133224, 0.018199637532234192, -0.008355304598808289, 0.036867912858724594, 0.05938883498311043, -0.007513001095503569, 0.00870779249817133, -0.019605645909905434, -0.02859403006732464, 0.009417031891644001, -0.013290245085954666, -0.023742826655507088, -0.03877951204776764, -0.01804339699447155, 0.003943128045648336, -0.03247217461466789, -0.010359612293541431, 0.00828623864799738, 0.05992063134908676, -0.0018118658335879445, 0.03618088364601135, 0.04135472699999809, 0.0015990666579455137, 0.021287886425852776, -0.036694787442684174, -0.008462483063340187, 0.009594673290848732, 0.02773261070251465, 0.004765476565808058, -0.05212904140353203, -0.031292662024497986, -0.0031705815345048904, -0.008045880123972893, -0.01528007723391056, 0.03930756077170372, -0.008044575341045856, -0.01112904492765665, -0.002783954842016101, 0.06293375045061111, 0.00247254129499197, 0.023568056523799896, 0.02247457765042782, 0.024447264149785042, -0.04090332239866257, 0.027834134176373482, 0.04201940819621086, 0.0328274741768837, -0.007080284412950277, -0.05304456129670143, 0.026351649314165115, 0.002388713648542762, 0.013591407798230648, 0.005128249526023865, 0.04615205526351929, 0.004884213674813509, 0.002185783116146922, -0.0018820457626134157, 0.020351767539978027, -0.0057521783746778965, 0.04695639759302139, 0.007196143735200167, -0.044792596250772476, 0.04713834822177887, -0.002893518190830946, -0.003507281420752406, 0.009608541615307331, 0.046106722205877304, 0.04073221981525421, -0.010634948499500751, -0.01713787391781807, 0.02991289086639881, 0.044483672827482224, 0.00833352655172348, 0.02340869791805744, 0.0008951210184022784, 0.009878215380012989, 0.011156778782606125, -0.03615058586001396, -0.013259670697152615, -0.04646562784910202, -0.01844599097967148, -0.04300859943032265, -0.028252042829990387, -0.02583548240363598, -0.01865384913980961, -0.014287760481238365, 0.017358453944325447, -0.05369843170046806, 0.03384973481297493, -0.01635182648897171, 0.006946908310055733, -0.012440153397619724, 0.02674330584704876, 0.046197764575481415, -0.007367693353444338, 0.022477593272924423, -0.043480124324560165, -0.03214177489280701, 0.0031183764804154634, 0.014974079094827175, 0.01640002243220806, 0.02930731512606144, -0.03090466745197773, 0.03125875070691109, -0.05722186714410782, -0.037958063185214996, -0.005239203106611967, -0.046380575746297836, 0.028827056288719177, 0.005608283448964357, -0.018256941810250282, -0.042518746107816696, -0.0024191425181925297, 0.03583787754178047, -0.008270458318293095, 0.01776905730366707, -0.05284320190548897, -0.020979953929781914, 0.007518760394304991, 0.025620723143219948, -0.04910602420568466, 0.01204429380595684, -0.003741009859368205, -0.029814552515745163, 0.011047989130020142, -0.006490373983979225, 0.025219324976205826, -0.02813984453678131, 0.0072532896883785725, -0.03929905220866203, -0.036536432802677155, -0.04350746423006058, -0.03258679807186127, -0.015602250583469868, 0.036879394203424454, -0.03341614082455635, -0.03968512639403343, -0.022516338154673576, -0.04846666380763054, -0.02229497581720352, -0.0000664943436277099, 0.0017814576858654618, -0.032202739268541336, -0.029520971700549126, -0.007368219550698996, 0.0302896648645401, 0.04424823075532913, 0.042712584137916565, -0.02498658001422882, -0.03663816675543785, -0.011608737520873547 ]
The Partnership: Amazon SageMaker and Hugging Face
philschmid
March 23, 2021
the-partnership-amazon-sagemaker-and-hugging-face
partnerships, aws
https://huggingface.co/blog/the-partnership-amazon-sagemaker-and-hugging-face
Spot instances With the creation of HuggingFace Framework extension for the SageMaker Python SDK we can also leverage the benefit of fully-managed EC2 spot instances and save up to 90% of our training cost. Note: Unless your training job will complete quickly, we recommend you use checkpointing with managed spot training, therefore you need to define the checkpoint_s3_uri. To use spot instances with the HuggingFace Estimator we have to set the use_spot_instances parameter to True and define your max_wait and max_run time. You can read more about the managed spot training lifecycle here. - Example Notebook python # hyperparameters, which are passed into the training job hyperparameters={'epochs': 1, 'train_batch_size': 32, 'model_name':'distilbert-base-uncased', 'output_dir':'/opt/ml/checkpoints' } # create the Estimator huggingface_estimator = HuggingFace( entry_point='train.py', source_dir='./scripts', instance_type='ml.p3.2xlarge', instance_count=1, checkpoint_s3_uri=f's3://{sess.default_bucket()}/checkpoints' use_spot_instances=True, max_wait=3600, # This should be equal to or greater than max_run in seconds' max_run=1000, role=role, transformers_version='4.4', pytorch_version='1.6', py_version='py36', hyperparameters = hyperparameters ) # Training seconds: 874 # Billable seconds: 105 # Managed Spot Training savings: 88.0%
[ -0.051625099033117294, 0.013177278451621532, -0.030658453702926636, 0.02236545830965042, 0.007647785358130932, 0.03591059893369675, 0.05376485362648964, -0.007406375836580992, -0.09796221554279327, -0.00562475249171257, -0.0710039883852005, 0.06384097784757614, 0.04059523344039917, 0.07519502937793732, 0.0322585329413414, -0.05175655335187912, 0.010916712693870068, 0.015187671408057213, -0.06953311711549759, 0.020534122362732887, -0.01807580702006817, -0.03383900225162506, 0.02560488134622574, 0.02473711222410202, -0.04739457741379738, -0.06366533786058426, 0.009654519148170948, -0.038085371255874634, -0.025678908452391624, 0.034681882709264755, -0.0590515099465847, 0.010913004167377949, -0.003807990811765194, -0.0077493274584412575, 0.06637898832559586, 0.05884410813450813, -0.11630064249038696, 0.06412135064601898, 0.042281027883291245, -0.03312351927161217, -0.015087569132447243, -0.0432351715862751, -0.05699699744582176, 0.021309075877070427, 0.03381585329771042, -0.009975464083254337, -0.1534585803747177, -0.0022623215336352587, 0.0149333281442523, -0.03214617446064949, -0.10451986640691757, 0.11870818585157394, 0.0027755056507885456, -0.019407637417316437, -0.013702706433832645, 0.011415517888963223, 0.005344493314623833, -0.02786947600543499, 0.0031198584474623203, -0.025467537343502045, -0.029470721259713173, -0.018051788210868835, -0.003056772518903017, 0.031842418015003204, -0.008163811638951302, 0.011985288932919502, 0.017482588067650795, -0.0018358066445216537, -0.05418901517987251, -0.04414359852671623, 0.010486776009202003, -0.08776504546403885, 0.005422863177955151, 0.08355443924665451, -0.06924115121364594, -0.05681582912802696, -0.007092127576470375, -0.04661743342876434, 0.02352408692240715, 0.07038841396570206, -0.02271922491490841, -0.015194782055914402, -0.025022616609930992, -0.019069770351052284, 0.013527017086744308, -0.011050897650420666, -0.0017164995661005378, -0.043518371880054474, -0.03785263001918793, 0.00921868346631527, 0.04065805301070213, -0.03825046122074127, 0.05108422413468361, 0.022154342383146286, 0.027878766879439354, -0.01676875166594982, 0.048412714153528214, -0.04393206536769867, 0.016664719209074974, -0.03953196108341217, -0.003047120524570346, -0.06491788476705551, -0.04534553736448288, -0.06191769242286682, -0.056727901101112366, 0.07351940870285034, -0.010573014616966248, -0.0805632695555687, 0.00043840668513439596, 0.01983896642923355, -0.0010051026474684477, -0.05761175602674484, -0.03581531345844269, 0.09995310753583908, -0.07107637822628021, 0.042406387627124786, -0.031665656715631485, -0.011785764247179031, 0.010723277926445007, 0.0023704771883785725, 0.048038557171821594, 0.07641033083200455, 0.05234497785568237, 0.03840447589755058, -0.06282765418291092, 0.06816164404153824, -0.013560954481363297, 0.022460149601101875, 0.019750334322452545, -0.010324068367481232, 0.01538490504026413, -0.00813403818756342, 0.021369706839323044, -0.0328616127371788, 0.018096039071679115, -0.050336237996816635, 0.05437324196100235, -0.02784220688045025, -0.009222785010933876, 0.04302557185292244, -0.006292116828262806, 0.1556820124387741, 0.00956331193447113, -0.022876543924212456, 0.035625159740448, 0.04511214420199394, -0.052665162831544876, -0.022977732121944427, 0.05551537126302719, 0.05662057548761368, -0.10473170876502991, 0.052817750722169876, -0.0200851671397686, -0.03319452702999115, 0.005513438489288092, 0.06768511235713959, -0.03218073770403862, -0.01116291806101799, -0.06958113610744476, 0.009805633686482906, 0.01560919638723135, 0.022111615166068077, -0.04289430007338524, -0.03486594930291176, 0.04453517496585846, -0.011936855502426624, 0.029515039175748825, 0.0068509988486766815, 0.01720568537712097, -0.02478310652077198, 0.02913675084710121, -0.04125054180622101, 0.043877314776182175, -0.024637239053845406, 0.036242373287677765, 0.045441415160894394, 0.039549678564071655, 0.06251794844865799, -0.014308768324553967, -0.027605600655078888, -0.01788255199790001, 0.04634164273738861, -0.021473664790391922, 0.03825606405735016, 0.03222069516777992, -0.12781937420368195, 0.04879963397979736, 0.05434739589691162, 0.005311798769980669, 0.028762610629200935, 0.028363864868879318, -0.02811613865196705, -0.005951091647148132, -0.03086862713098526, 0.02874981053173542, -0.0325419083237648, -0.01741127111017704, 0.10933110117912292, 0.05574969947338104, -0.02318272925913334, 0.004678536672145128, 0.04682299122214317, -0.02605612389743328, 0.040891531854867935, -0.08862387388944626, 0.05286797136068344, -0.027369355782866478, -0.07755609601736069, 0.01917434111237526, 0.0019404955673962831, 0.02315429598093033, -0.12277486175298691, -0.02006523497402668, -0.05606923997402191, -0.01023111492395401, -0.008602654561400414, -0.05305648595094681, -0.05110139399766922, 0.008729505352675915, -0.008883988484740257, 0.16027697920799255, 0.005702702794224024, 0.013139843940734863, -0.05988037586212158, -0.03597765043377876, -0.00455012172460556, 0.02023777924478054, 0.05758029222488403, 0.1128493994474411, -0.08413102477788925, -0.03691914677619934, -0.07023408263921738, -0.02106527052819729, 0.05516998469829559, -0.036822423338890076, -0.013428617268800735, 0.054023027420043945, -0.02334468625485897, 0.03650527819991112, 0.058782681822776794, -0.02768782526254654, 0.011184469796717167, -0.02023002877831459, -0.004103925544768572, 0.09149780869483948, -0.017814667895436287, 0.026298679411411285, 0.034729357808828354, -0.08578075468540192, -0.0656653344631195, -0.1156969964504242, 0.020496118813753128, -0.04059197008609772, -0.06960128992795944, 0.016574159264564514, 0.024833615869283676, -0.04849434271454811, 0.0016604001866653562, -0.0014369158307090402, 0.08957605808973312, 0.038883648812770844, 0.04525301977992058, -0.05297904834151268, 0.0036138612776994705, -0.004980855155736208, -0.041512470692396164, 0.023003825917840004, -0.04306581988930702, 0.032690610736608505, -0.004164049401879311, 0.03902743384242058, -0.006318181753158569, -0.004447912331670523, 0.046417560428380966, 0.053692109882831573, 0.002474800683557987, 0.034262482076883316, 0.011792791076004505, -0.002684169914573431, -0.02328890562057495, -0.017610469833016396, -0.05254918336868286, -0.0026213934179395437, 0.024175014346837997, 0.020542915910482407, 0.02923624962568283, -0.030820012092590332, -0.03436460345983505, -0.03396274149417877, 0.02089170552790165, 0.045225899666547775, 0.0540042370557785, 0.048671018332242966, 0.005921410862356424, 0.007962789386510849, 0.036802973598241806, -0.047958359122276306, -0.02709256112575531, -0.0108256870880723, 0.055071186274290085, -0.05005313456058502, 0.010379967279732227, -0.02058270387351513, -0.0327305905520916, -0.03331470862030983, -0.01325957104563713, 0.01834510825574398, -0.02863314375281334, -0.08832063525915146, -0.03955286368727684, -0.036031633615493774, 0.02834876999258995, -0.016618145629763603, -0.032855842262506485, 0.049491554498672485, 0.015305543318390846, -0.013821914792060852, -0.0017501149559393525, -0.009633268229663372, 0.050177201628685, 0.014255921356379986, -0.009480016306042671, -0.02873832732439041, 0.021746791899204254, 0.0017877693753689528, -0.017893001437187195, -0.013308936730027199, 0.000588852446526289, -0.031605884432792664, 0.028211938217282295, 0.0166067685931921, -0.01157824695110321, -0.00663274759426713, 0.012079227715730667, 0.012821352109313011, -0.001227717031724751, 0.041949909180402756, -0.03974537178874016, -0.003785590175539255, -0.02620786987245083, -0.03187032788991928, 0.01746918447315693, -0.04056507349014282, -0.0068067447282373905, -0.0007611151086166501, 0.03969929367303848, 0.014539799652993679, -0.01865284889936447, 0.0013535083271563053, -0.028499847277998924, 0.045842960476875305, 0.013015723787248135, 0.01649653911590576, -0.019811464473605156, -0.018414270132780075, -0.02959951013326645, 0.04878631979227066, 0.03881068527698517, -0.0028935917653143406, -0.004177836701273918, 0.004882635083049536, 0.013852065429091454, 0.007316937204450369, 0.020818466320633888, 0.00022402065224014223, 0.025830106809735298, 0.012663899920880795, -0.010761498473584652, -0.061190467327833176, 0.04632381722331047, -0.020513715222477913, -0.019563009962439537, -0.0007781172171235085, 0.012218052521348, 0.0068406518548727036, -0.001622917247004807, 0.01042980793863535, 0.029755275696516037, 0.03644217178225517, 0.03228159248828888, 0.019711460918188095, 0.013961905613541603, -0.051591623574495316, -0.020420555025339127, -0.03447387367486954, -0.00237670773640275, 0.026112083345651627, 0.02423364482820034, 0.001129988464526832, 0.016942810267210007, -0.004115037154406309, -0.011992010287940502, 0.015385283157229424, 0.01185065507888794, 0.049733441323041916, -0.02848786674439907, 0.045794252306222916, 0.05984054505825043, 0.010977404192090034, -0.02083418145775795, 0.037106335163116455, 0.0006430114153772593, -0.006066088564693928, -0.028108391910791397, -0.006205099634826183, 0.008449602872133255, -0.0133816534653306, 0.01943928375840187, 0.005529175978153944, -0.0010431852424517274, 0.0316346138715744, -0.005627537611871958, -0.01621691696345806, -0.0228470116853714, -0.040632281452417374, -0.04211416840553284, -0.0036650761030614376, -0.017313823103904724, 0.02627735026180744, 0.020037062466144562, -0.024063942953944206, -0.03136593848466873, 0.019728993996977806, 0.054878443479537964, 0.032700441777706146, -0.011988162994384766, -0.005003828089684248, 0.06867960840463638, -0.038295354694128036, 0.05407026410102844, -0.012370182201266289, -0.027143381536006927, 0.010002869181334972, -0.009079251438379288, 0.021888582035899162, 0.014432966709136963, 0.027815844863653183, -0.022156141698360443, -0.025737406685948372, -0.009177463129162788, 0.00852593407034874, 0.018858959898352623, 0.020091991871595383, -0.024438783526420593, -0.008989847265183926, 0.014186643995344639, 0.026831118389964104, -0.000872812990564853, -0.0006085601053200662, 0.0024505839683115482, 0.014322440139949322, -0.014079894870519638, 0.028729785233736038, -0.0038120769895613194, -0.046169012784957886, -0.008050432428717613, -0.015488483011722565, 0.030080808326601982, 0.026885462924838066, 0.014395298436284065, -0.038980159908533096, -0.004236998967826366, 0.046177010983228683, -0.017627984285354614, -0.03153126314282417, -0.04011126980185509, 0.019561024382710457, 0.0297953262925148, -0.01783730648458004, 0.015733584761619568, -0.023836947977542877, -0.014356243424117565, 0.010833588428795338, -0.009781568311154842, 0.00048184156185016036, -0.028917774558067322, 0.01586509309709072, 0.014430523850023746, -0.0033905822783708572, -0.01171734556555748, 0.005139535292983055, -0.02023392729461193, 0.009453393518924713, 0.05528745800256729, 0.049883823841810226, 0.007987959310412407, -0.019834117963910103, 0.043955832719802856, -0.006873314268887043, -0.00005499008693732321, -0.015454163774847984, -0.014523639343678951, 0.01938982680439949, 0.017504064366221428, 0.05810222402215004, 0.06229986995458603, -0.002488266211003065, 0.03615930676460266, 0.01979571022093296, -0.005859708413481712, 0.05627836659550667, -0.011029329150915146, 0.010466882027685642, -0.006464724894613028, -0.004832749720662832, 0.058883197605609894, -0.042709831148386, -0.03083975985646248, 0.01817760057747364, 0.04225980490446091, -0.03328518941998482, -0.009721627458930016, -0.01041490864008665, 0.021176369860768318, 0.009226055815815926, 0.01825173944234848, -0.013857733458280563, -0.0438021756708622, -0.00529343169182539, -0.02989358827471733, -0.02088133990764618, 0.019796257838606834, 0.014302359893918037, -0.012488072738051414, 0.014846897684037685, 0.05958441272377968, 0.021656187251210213, 0.005390369798988104, -0.04298774152994156, 0.018501725047826767, 0.01207948662340641, -0.02429923787713051, 0.009918165393173695, -0.028878916054964066, -0.022998930886387825, -0.03129153698682785, -0.02362348511815071, 0.01663302630186081, -0.002712036482989788, 0.014901991002261639, -0.019396532326936722, 0.022498859092593193, 0.029586389660835266, -0.01260059978812933, -0.022265490144491196, 0.019452644512057304, -0.01063085999339819, -0.039766520261764526, -0.026833077892661095, 0.012931336648762226, -0.013049202971160412, -0.0395624153316021, -0.030529852956533432, 0.008285721763968468, 0.03246831148862839, -0.007164022885262966, 0.007175483275204897, 0.018118981271982193, -0.005549462977796793, 0.023895487189292908, 0.028302334249019623, 0.023769298568367958, 0.03138573840260506, 0.01201423816382885, -0.001436693943105638, -0.007345665246248245, 0.01787746325135231, 0.014550735242664814, -0.01842624507844448, -0.04145767167210579, 0.03640934079885483, 0.06645456701517105, -0.03944958746433258, -0.0013431099941954017, -0.05061648041009903, -0.06269314140081406, 0.0021139190066605806, 0.01707238145172596, 0.046445682644844055, 0.00964455958455801, -0.009299586527049541, 0.026707259938120842, 0.0002681058249436319, 0.008334298618137836, 0.012574227526783943, 0.0543852262198925, -0.037827976047992706, 0.04381696507334709, -0.004584131762385368, 0.03734211251139641, 0.007905909791588783, 0.014238354749977589, 0.0014573460211977363, -0.02241590805351734, 0.035248883068561554, 0.018723301589488983, 0.039419133216142654, 0.03585726395249367, 0.0034475720021873713, -0.00768911512568593, -0.01722467504441738, 0.018000297248363495, -0.026442106813192368, -0.023948978632688522, 0.03655800595879555, -0.03193888068199158, 0.00731583870947361, 0.01712009310722351, 0.03660191223025322, 0.04358963668346405, 0.029604364186525345, -0.016127465292811394, 0.01103998627513647, 0.01912289299070835, 0.01170788612216711, -0.041008125990629196, 0.042859774082899094, 0.007650584913790226, 0.029480818659067154, 0.025522494688630104, 0.04733772948384285, -0.00247007398866117, -0.0005673766136169434, -0.0003677213389892131, -0.004772315267473459, -0.02880208194255829, 0.008542492985725403, 0.005166381131857634, 0.022499319165945053, -0.025734497234225273, 0.0012242314405739307, 0.014380077831447124, -0.005057389382272959, 0.03158872574567795, -0.007080174516886473, 0.02709917724132538, 0.011982261203229427, 0.03607084974646568, 0.002031650859862566, 0.0013326184125617146, 0.020950550213456154, -0.06457140296697617, 0.014971463941037655, 0.017415223643183708, 0.005168383475393057, -0.012517951428890228, -0.031207982450723648, -0.04609692469239235, -0.007697523571550846, -0.004632953088730574, -0.008780485950410366, 0.03975716605782509, -0.057792630046606064, -0.0028226589784026146, -0.020866962149739265, 0.01818559318780899, 0.07203975319862366, 0.034726131707429886, 0.033097635954618454, 0.01955348812043667, -0.0391601137816906, 0.0031267821323126554, -0.02376733534038067, -0.04027826339006424, 0.04797286540269852, -0.041598353534936905, 0.027318818494677544, -0.0010466274106875062, 0.06788159906864166, -0.004419410135596991, -0.012452725321054459, 0.006153259426355362, 0.0001554086629766971, -0.04092330113053322, -0.002673121402040124, 0.012936469167470932, 0.04775993525981903, -0.01934761181473732, -0.018497684970498085, 0.02640669047832489, -0.028389666229486465, -0.003588591469451785, 0.022523729130625725, -0.04520070180296898, 0.05345521867275238, -0.02683383785188198, 0.017208555713295937, 0.031385280191898346, 0.035948533564805984, 0.014350607991218567, 0.009017827920615673, 0.014360785484313965, 0.010105022229254246, 0.03901419788599014, -0.046699244529008865, -0.007097296416759491, -0.04251272976398468, -0.01371609978377819, -0.031034188345074654, -0.03138800710439682, -0.008787070401012897, -0.029883945360779762, -0.043117549270391464, 0.028490209951996803, -0.03255029395222664, -0.0012289265869185328, -0.023449935019016266, 0.027253812178969383, -0.02114003710448742, 0.0057678972370922565, 0.05120689794421196, 0.06787344813346863, 0.04589490965008736, -0.008656717836856842, -0.026816898956894875, 0.0032068730797618628, -0.003516851458698511, 0.035760991275310516, 0.07964915037155151, -0.0004125715931877494, -0.0035626552999019623, -0.07081075012683868, -0.016200050711631775, 0.020455753430724144, -0.0729791671037674, 0.020938854664564133, 0.025551510974764824, 0.01879866234958172, -0.013358199037611485, -0.02035580761730671, 0.018291063606739044, 0.001605287310667336, 0.052701279520988464, -0.0462644062936306, -0.022277772426605225, 0.0076286448165774345, 0.019549813121557236, -0.030402803793549538, 0.005343445111066103, 0.00765428738668561, -0.020520998165011406, 0.04463128745555878, -0.00450216606259346, 0.013980181887745857, -0.03217022493481636, -0.02454363740980625, -0.006545294541865587, -0.023552635684609413, -0.03639248386025429, -0.040179476141929626, 0.04330788925290108, 0.027580535039305687, -0.004608978983014822, -0.011019997298717499, -0.010886140167713165, -0.023737866431474686, -0.004286883864551783, 0.011919447220861912, -0.000981458812020719, 0.004668315406888723, -0.008717645891010761, 0.014719168655574322, 0.0015595884760841727, 0.04745112732052803, 0.04747525602579117, 0.0064055160619318485, -0.01962524652481079, 0.023372216150164604 ]
The Partnership: Amazon SageMaker and Hugging Face
philschmid
March 23, 2021
the-partnership-amazon-sagemaker-and-hugging-face
partnerships, aws
https://huggingface.co/blog/the-partnership-amazon-sagemaker-and-hugging-face
Additional Features 🚀 In addition to the Deep Learning Container and the SageMaker SDK, we have implemented other additional features.
[ 0.0304242130368948, -0.03510458022356033, 0.0513581857085228, 0.012212556786835194, 0.053666383028030396, 0.031244808807969093, -0.0146002983674407, 0.040155429393053055, -0.04871111363172531, -0.06470993161201477, -0.03582043573260307, 0.021115999668836594, 0.018726417794823647, 0.07669022679328918, -0.012359310872852802, -0.027796337381005287, 0.031865399330854416, 0.0001876800088211894, 0.002641374245285988, 0.0076209018006920815, 0.0024147743824869394, -0.06824100017547607, 0.03490658476948738, -0.029363619163632393, -0.04905339702963829, -0.004132484085857868, 0.009380684234201908, -0.040735676884651184, -0.04739100858569145, 0.02580857463181019, -0.06396254152059555, -0.007288021966814995, 0.04918671026825905, -0.0013310832437127829, 0.0056167966686189175, -0.03172852843999863, -0.12426600605249405, 0.04663684219121933, -0.02248242497444153, -0.051682859659194946, -0.08381302654743195, -0.024573497474193573, -0.07692620158195496, 0.054868221282958984, 0.0009385874145664275, -0.04488636553287506, -0.1896529197692871, 0.06697695702314377, 0.026102792471647263, -0.00584819819778204, -0.09140214323997498, 0.10214263200759888, -0.027217501774430275, -0.006074633914977312, 0.04708707332611084, 0.02631019987165928, 0.010516953654587269, -0.003097620327025652, 0.033845555037260056, -0.04081471264362335, -0.015273887664079666, -0.05076418071985245, -0.012639405205845833, -0.017398051917552948, 0.016272742301225662, -0.024790260940790176, -0.003692922880873084, -0.029114924371242523, -0.04659238085150719, 0.01575065590441227, 0.017886081710457802, -0.0680052638053894, -0.023487739264965057, 0.016059882938861847, -0.029777109622955322, -0.056938014924526215, -0.024326635524630547, -0.015411289408802986, 0.021382050588726997, 0.018119148910045624, -0.010975624434649944, 0.03402210399508476, 0.03265466168522835, 0.055390629917383194, -0.006675352342426777, -0.01722322404384613, 0.0036935273092240095, -0.042929623275995255, 0.000426836108090356, 0.055099133402109146, 0.043716832995414734, -0.10035903006792068, 0.04701092094182968, 0.017011789605021477, 0.04361423850059509, -0.05385567992925644, 0.03648575022816658, 0.0021139720920473337, 0.00726287392899394, 0.0027938594575971365, -0.036023035645484924, -0.08936688303947449, 0.021654533222317696, -0.0386216901242733, -0.04530400410294533, -0.00678715854883194, -0.03931039199233055, -0.13685905933380127, -0.01990019716322422, 0.07532952725887299, 0.01594819873571396, 0.03335622698068619, 0.009332748129963875, 0.09321749955415726, -0.10458622872829437, 0.10635007172822952, -0.015361007302999496, -0.01963874138891697, 0.017142094671726227, -0.0054453294724226, 0.010474328882992268, 0.0808967798948288, 0.08131343126296997, 0.06073307245969772, 0.010442693717777729, 0.02503211423754692, 0.036752600222826004, 0.011932325549423695, -0.008700490929186344, -0.06783800572156906, 0.008748636581003666, -0.026556041091680527, 0.0832885354757309, 0.009010924026370049, 0.007457071449607611, -0.08387146890163422, -0.03357419744133949, -0.08741231262683868, 0.012551257386803627, 0.01859365403652191, -0.011310961097478867, 0.07481737434864044, 0.02085350640118122, 0.020167425274848938, 0.02120455540716648, 0.02121017687022686, -0.006963052321225405, 0.04891892522573471, -0.055676817893981934, 0.05456862598657608, -0.04756607115268707, 0.058973465114831924, -0.008990644477307796, -0.1005903109908104, -0.01444096490740776, 0.06806930154561996, -0.026989949867129326, 0.015786856412887573, -0.056609682738780975, -0.0152235496789217, -0.026440471410751343, -0.00614587077870965, -0.03001503087580204, -0.01016403827816248, 0.030034160241484642, -0.025730401277542114, 0.07544166594743729, 0.02446821518242359, 0.040059030055999756, -0.02021143212914467, 0.013351419940590858, -0.07829615473747253, 0.05679778754711151, -0.03577106073498726, 0.0075154537335038185, 0.0360504686832428, 0.04182511940598488, 0.07694949209690094, 0.011753837577998638, -0.014234735630452633, -0.08861079066991806, 0.0018734063487499952, -0.07181097567081451, -0.029916690662503242, 0.02394813857972622, -0.060823410749435425, 0.035005196928977966, 0.017695853486657143, 0.051789600402116776, -0.017071036621928215, -0.04551567882299423, -0.012088478542864323, 0.007620614487677813, 0.0376291424036026, 0.022884545847773552, -0.05634089559316635, -0.04334134981036186, 0.13431912660598755, 0.055221278220415115, 0.0851665735244751, 0.06308009475469589, 0.04279853776097298, -0.04293011128902435, 0.03845914825797081, 0.02759937196969986, 0.034855686128139496, 0.06499138474464417, -0.0026288842782378197, 0.012004532851278782, -0.03211406245827675, 0.029326563701033592, -0.14452412724494934, 0.02181362733244896, -0.04506349563598633, 0.0157354474067688, 0.01019957847893238, -0.05552591755986214, -0.010292931459844112, 0.011721105314791203, -0.014086843468248844, 0.12473253905773163, -0.0478660985827446, 0.02387474663555622, 0.016822027042508125, -0.03941984847187996, 0.09235893189907074, 0.06480185687541962, -0.023099305108189583, 0.059851787984371185, -0.05656595155596733, -0.016941482201218605, -0.07468464970588684, -0.025473911315202713, 0.027902856469154358, 0.001722195534966886, 0.024574806913733482, 0.012145845219492912, -0.0006693096365779638, -0.0007487456314265728, -0.02157699130475521, 0.04202321171760559, 0.011423719115555286, 0.018745452165603638, 0.07998333126306534, 0.03293545916676521, -0.02869664877653122, 0.05207839235663414, 0.016935080289840698, -0.026819609105587006, -0.011547667905688286, -0.05854066088795662, 0.03315974771976471, 0.005623409524559975, -0.05220963805913925, 0.06507381051778793, 0.02555842511355877, -0.0037051851395517588, -0.021441426128149033, 0.0031329100020229816, 0.043946683406829834, 0.0163698922842741, 0.016660185530781746, -0.018936483189463615, -0.031551115214824677, 0.0034472376573830843, -0.060206301510334015, -0.03714470565319061, -0.020006854087114334, 0.016202161088585854, 0.009824782609939575, 0.009419606998562813, -0.04208488389849663, -0.012595213949680328, -0.025076525285840034, -0.008614077232778072, 0.0017351232236251235, 0.04262036457657814, 0.003960055764764547, -0.035319823771715164, -0.02321034111082554, 0.0018823713762685657, -0.04888278245925903, 0.03809567913413048, 0.07145165652036667, 0.0475064218044281, -0.02323850803077221, 0.007323583122342825, -0.001938814064487815, -0.057195473462343216, 0.008475006558001041, -0.012782663106918335, 0.02550380676984787, 0.017555542290210724, -0.011084145866334438, 0.01603403314948082, 0.022510185837745667, 0.016790736466646194, -0.02581166662275791, 0.0036847437731921673, 0.029808616265654564, 0.022745143622159958, 0.01639184169471264, 0.0030560814775526524, -0.003928240388631821, -0.026505878195166588, 0.03642778843641281, 0.02884424291551113, 0.02916586771607399, -0.116844542324543, -0.05666324496269226, -0.023746982216835022, 0.030201338231563568, 0.005548811051994562, -0.008845707401633263, 0.0004183679702691734, -0.012580754235386848, -0.0004457045579329133, 0.019120734184980392, 0.015111073851585388, 0.022382255643606186, 0.002650998067110777, -0.023230087012052536, -0.034627072513103485, 0.02841661497950554, -0.023710081353783607, 0.026502147316932678, -0.011779450811445713, 0.015443737618625164, -0.020208170637488365, 0.050929080694913864, -0.027850031852722168, -0.021748529747128487, -0.021237295120954514, 0.017002156004309654, 0.04161703959107399, 0.018756989389657974, 0.012884438969194889, 0.010411139577627182, -0.018670689314603806, 0.0016873409040272236, -0.0328042097389698, 0.009034231305122375, -0.04420004412531853, 0.020353524014353752, -0.008773980662226677, 0.024640945717692375, 0.05965156480669975, 0.015586214140057564, 0.0487515889108181, 0.020234184339642525, 0.030964870005846024, 0.0023138721007853746, 0.01694532483816147, 0.0064934934489429, -0.004136418458074331, 0.0023561790585517883, 0.06705254316329956, -0.025991138070821762, -0.026823021471500397, -0.002489193342626095, 0.00651925802230835, 0.024880537763237953, -0.013981739990413189, -0.005177254788577557, -0.0006037644925527275, 0.021758658811450005, 0.03155460208654404, -0.028615785762667656, -0.0438670739531517, 0.021954912692308426, 0.020543711259961128, 0.01237583439797163, -0.023944107815623283, 0.026811907067894936, 0.0010550416773185134, 0.009973171167075634, 0.026763489469885826, 0.015169805847108364, -0.01099738571792841, 0.039385437965393066, 0.014478635042905807, 0.023692334070801735, -0.013731839135289192, 0.025287838652729988, -0.004232475068420172, -0.0014781501377001405, 0.0875961184501648, 0.025441525503993034, 0.014328662306070328, 0.0007966190460138023, 0.05309682711958885, -0.023715659976005554, 0.01627069152891636, -0.0068491012789309025, -0.02879008837044239, -0.010952640324831009, 0.006832981016486883, 0.047544050961732864, 0.028900066390633583, -0.030197327956557274, 0.04970521852374077, -0.026140697300434113, 0.016598131507635117, 0.017306143417954445, 0.0325741171836853, 0.01596834883093834, -0.008996889926493168, 0.01952074095606804, 0.008884330280125141, -0.018591051921248436, -0.011270403861999512, 0.0030510425567626953, -0.03727986663579941, -0.01128336600959301, -0.057352375239133835, -0.028432723134756088, 0.008790664374828339, -0.01740979216992855, 0.04046499356627464, -0.017382275313138962, 0.00003023953286174219, -0.02271045744419098, 0.02822553552687168, 0.036148060113191605, 0.0036208515521138906, -0.030027149245142937, -0.00886231753975153, 0.0681869387626648, -0.027188340201973915, 0.0489426925778389, -0.023448733612895012, -0.005088872276246548, -0.020278191193938255, -0.02416284568607807, 0.0028729175683110952, 0.010191394947469234, -0.021641885861754417, -0.03439105674624443, -0.006202886812388897, -0.008085041306912899, 0.015880852937698364, 0.0242545735090971, 0.04943959042429924, -0.00638965331017971, -0.029734760522842407, 0.05350499600172043, 0.0034700960386544466, -0.06995239853858948, -0.014970562420785427, 0.0165734700858593, 0.036742981523275375, -0.02005060762166977, 0.04743575304746628, -0.058429617434740067, -0.03867052495479584, -0.019790086895227432, -0.03558187931776047, 0.02688261680305004, 0.030717013403773308, -0.015044483356177807, -0.04523046314716339, -0.02257208526134491, 0.023481210693717003, -0.02036391571164131, -0.001908825826831162, 0.03657880052924156, 0.019030500203371048, 0.055539246648550034, 0.005275045987218618, 0.03284869343042374, -0.02473963238298893, 0.011787664145231247, 0.02492736466228962, 0.03379831090569496, -0.017271770164370537, -0.0010122517123818398, 0.0024025654420256615, 0.02565363049507141, -0.018058424815535545, -0.020756183192133904, -0.0011264522327110171, -0.01759447157382965, 0.028611261397600174, 0.032853864133358, 0.02741621434688568, 0.025968164205551147, -0.00018394658400211483, -0.013086678460240364, -0.003034752095118165, -0.0018034238601103425, -0.015471597202122211, -0.0012039515422657132, -0.011199051514267921, 0.02884693816304207, 0.053953416645526886, 0.015591400675475597, -0.0010950305731967092, 0.03594205155968666, -0.014551430940628052, 0.0054001170210540295, 0.003723986679688096, -0.021181417629122734, 0.033108003437519073, -0.0037261589895933867, 0.04419869929552078, 0.017408840358257294, -0.039391957223415375, -0.004253209102898836, 0.021260865032672882, 0.00213983072899282, -0.022468728944659233, -0.02617422305047512, 0.03203863650560379, -0.010085290297865868, 0.012549931183457375, -0.020891519263386726, 0.02525906451046467, -0.03193177655339241, 0.0021699934732168913, 0.01216981653124094, -0.019334392622113228, -0.0357305109500885, -0.01679716818034649, -0.033367425203323364, -0.02883492037653923, 0.030011454597115517, -0.004963526036590338, -0.001934230444021523, 0.025608032941818237, 0.003750988282263279, -0.015010464005172253, 0.009480628184974194, 0.012432392686605453, -0.030042769387364388, 0.0026383833028376102, 0.011351003311574459, -0.01918376423418522, 0.020982569083571434, 0.040804069489240646, 0.004324583802372217, -0.022356603294610977, -0.025503311306238174, -0.032703764736652374, -0.013196456246078014, -0.02768765762448311, 0.05311128497123718, 0.005609125830233097, -0.03582722321152687, 0.010836171917617321, -0.008300087414681911, -0.02052575722336769, -0.02523673139512539, -0.058390889316797256, 0.018736915662884712, 0.04862919822335243, 0.02798004262149334, 0.02301892451941967, 0.033068642020225525, 0.04586697369813919, 0.019518787041306496, 0.035704270005226135, -0.0066908858716487885, 0.04028739780187607, 0.010727434419095516, 0.0042385016568005085, 0.013068840838968754, 0.0001816302683437243, -0.01079192291945219, -0.013222611509263515, -0.07152996212244034, 0.02165372297167778, 0.03407355397939682, -0.06529061496257782, 0.018757101148366928, 0.021877365186810493, -0.05287390947341919, 0.0007905794773250818, 0.012174558825790882, 0.015249219723045826, 0.0796181857585907, 0.021955890581011772, -0.014692594297230244, -0.013781874440610409, 0.00012705034168902785, 0.018550988286733627, 0.0838339775800705, -0.009416487999260426, 0.02224249206483364, -0.012576805427670479, 0.04240741208195686, 0.039440739899873734, 0.010648883879184723, -0.02946319803595543, 0.01645791158080101, 0.026352278888225555, -0.04545960947871208, 0.03962217643857002, 0.0028753727674484253, -0.00754989730194211, -0.011170841753482819, -0.02373933047056198, 0.025184612721204758, -0.05218515917658806, -0.030564818531274796, 0.043851107358932495, 0.0051526776514947414, 0.029641589149832726, -0.03146573156118393, 0.053816989064216614, 0.049353014677762985, 0.037919726222753525, 0.047791991382837296, -0.0170042272657156, 0.03932902216911316, 0.016649683937430382, -0.006402248982340097, 0.030895328149199486, -0.013918828219175339, 0.04146486893296242, 0.04469083994626999, 0.003945864737033844, -0.009324230253696442, -0.02117655798792839, -0.0004232869250699878, 0.0006681945524178445, 0.022722633555531502, -0.017843682318925858, -0.00034432721440680325, 0.020579444244503975, -0.06812121719121933, -0.01101731788367033, -0.002017123159021139, -0.05467746779322624, -0.002825577510520816, -0.017789242789149284, 0.03387392312288284, -0.012498104944825172, 0.009070824831724167, 0.004623490385711193, 0.0086874570697546, -0.015206505544483662, -0.046169497072696686, -0.026141580194234848, 0.04161129146814346, 0.024514658376574516, 0.01233499962836504, -0.040948107838630676, -0.04920626059174538, -0.008121082559227943, 0.006835526786744595, 0.029194919392466545, 0.005458928178995848, -0.0445510633289814, 0.015730300918221474, 0.007088049780577421, 0.017453523352742195, -0.012612037360668182, 0.011383618228137493, 0.0058569577522575855, 0.02236337400972843, -0.02027231641113758, 0.007521526422351599, -0.023019947111606598, -0.006876926403492689, 0.018275650218129158, -0.035378873348236084, 0.019592801108956337, -0.021880891174077988, 0.0066872150637209415, 0.01777278259396553, 0.013579871505498886, -0.002238106681033969, 0.005508194677531719, -0.028136231005191803, -0.0051616220735013485, 0.004640424158424139, 0.011901285499334335, 0.024466216564178467, -0.043285828083753586, 0.030266540125012398, -0.017372025176882744, -0.012146767228841782, -0.015770914033055305, 0.051406096667051315, 0.022808581590652466, -0.018775228410959244, -0.015751995146274567, -0.01999829337000847, 0.07887617498636246, -0.010007793083786964, 0.0027816379442811012, 0.011376732029020786, 0.02017088793218136, 0.0010156725766137242, -0.06742005050182343, 0.03986407816410065, -0.003092352766543627, 0.02330084703862667, -0.049102090299129486, -0.02777964062988758, -0.03205513581633568, -0.010003197938203812, 0.01863201893866062, 0.02682662010192871, -0.03746851161122322, 0.018376944586634636, 0.025285013020038605, -0.033508554100990295, -0.08020725846290588, -0.023264605551958084, 0.0708702951669693, 0.051567643880844116, 0.01125437393784523, -0.007120983209460974, -0.01711539551615715, -0.0031925905495882034, -0.01623835600912571, 0.04425666108727455, 0.04631752520799637, -0.026831384748220444, -0.013234610669314861, -0.029618222266435623, -0.0139961838722229, -0.0254010371863842, -0.036193158477544785, 0.026712803170084953, 0.014920469373464584, -0.00041732145473361015, -0.03800100088119507, -0.00311481487005949, 0.025078823789954185, 0.005652001593261957, 0.053591012954711914, -0.0018652688013389707, -0.006904243025928736, -0.026244044303894043, -0.001100839115679264, -0.042017824947834015, -0.02105569653213024, -0.015400262549519539, -0.03810707479715347, 0.022071655839681625, 0.02148977853357792, 0.046730928122997284, -0.02846953086555004, -0.01908532902598381, 0.005719282198697329, -0.05068043991923332, -0.04429321736097336, -0.02020975574851036, -0.010705169290304184, -0.00752374529838562, -0.027802424505352974, -0.03982659801840782, -0.014918708242475986, -0.016082780435681343, -0.016563106328248978, -0.004196762107312679, 0.005422668065875769, 0.0036209220997989178, -0.020238032564520836, 0.039704810827970505, 0.021888913586735725, 0.060811515897512436, 0.060323938727378845, -0.004251051694154739, -0.004742308985441923, -0.012647449970245361 ]
The Partnership: Amazon SageMaker and Hugging Face
philschmid
March 23, 2021
the-partnership-amazon-sagemaker-and-hugging-face
partnerships, aws
https://huggingface.co/blog/the-partnership-amazon-sagemaker-and-hugging-face
Preprocess our data and upload it to s3 We use the datasets library to download and preprocess our imdb dataset. After preprocessing, the dataset will be uploaded to the current session’s default s3 bucket sess.default_bucket() used within our training job. The imdb dataset consists of 25000 training and 25000 testing highly polar movie reviews. python import botocore from datasets import load_dataset from transformers import AutoTokenizer from datasets.filesystems import S3FileSystem # tokenizer used in preprocessing tokenizer_name = 'distilbert-base-uncased' # filesystem client for s3 s3 = S3FileSystem() # dataset used dataset_name = 'imdb' # s3 key prefix for the data s3_prefix = 'datasets/imdb' # load dataset dataset = load_dataset(dataset_name) # download tokenizer tokenizer = AutoTokenizer.from_pretrained(tokenizer_name) # tokenizer helper function def tokenize(batch): return tokenizer(batch['text'], padding='max_length', truncation=True) # load dataset train_dataset, test_dataset = load_dataset('imdb', split=['train', 'test']) test_dataset = test_dataset.shuffle().select(range(10000)) # smaller the size for test dataset to 10k # tokenize dataset train_dataset = train_dataset.map(tokenize, batched=True, batch_size=len(train_dataset)) test_dataset = test_dataset.map(tokenize, batched=True, batch_size=len(test_dataset)) # set format for pytorch train_dataset = train_dataset.rename_column("label", "labels") train_dataset.set_format('torch', columns=['input_ids', 'attention_mask', 'labels']) test_dataset = test_dataset.rename_column("label", "labels") test_dataset.set_format('torch', columns=['input_ids', 'attention_mask', 'labels']) # save train_dataset to s3 training_input_path = f's3://{sess.default_bucket()}/{s3_prefix}/train' train_dataset.save_to_disk(training_input_path,fs=s3) # save test_dataset to s3 test_input_path = f's3://{sess.default_bucket()}/{s3_prefix}/test' test_dataset.save_to_disk(test_input_path,fs=s3)
[ 0.00970709603279829, 0.020356429740786552, -0.029518693685531616, 0.11722086369991302, 0.02201705612242222, 0.06528103351593018, 0.03695698082447052, 0.023141343146562576, -0.03159935772418976, 0.0203852616250515, -0.09805476665496826, 0.05366393178701401, -0.019919440150260925, 0.00737640680745244, -0.013588731177151203, -0.019037002697587013, 0.08941765129566193, 0.002532379701733589, -0.01271894946694374, 0.043032556772232056, 0.006230812985450029, -0.09608303010463715, 0.0303955115377903, 0.03204211965203285, -0.03419872373342514, 0.014381516724824905, -0.010591821745038033, 0.025903446599841118, -0.03285156935453415, 0.06695128232240677, -0.10144265741109848, -0.04340377449989319, 0.026640819385647774, 0.019359732046723366, -0.028933215886354446, 0.0062717716209590435, -0.06019687280058861, 0.049481794238090515, 0.06351344287395477, -0.0746527686715126, -0.04959127679467201, 0.022483903914690018, -0.06572844833135605, 0.08637622743844986, -0.0032029624562710524, -0.05547028034925461, -0.14100825786590576, 0.055186912417411804, 0.030911779031157494, 0.01856006309390068, -0.07399829477071762, 0.06862282752990723, 0.03189367428421974, -0.0012053821701556444, 0.0017936372896656394, 0.06918945163488388, 0.05118700489401817, -0.0507701151072979, 0.020177330821752548, 0.00778499199077487, 0.05166275426745415, 0.014337355270981789, 0.040891438722610474, 0.0543912909924984, 0.06538739055395126, 0.0005789257702417672, 0.01219436340034008, 0.051437925547361374, -0.0020093752536922693, -0.08805542439222336, 0.06540657579898834, -0.05738074332475662, -0.004984644241631031, -0.03409634903073311, -0.0391838438808918, 0.009169677272439003, 0.045790646225214005, -0.04182310774922371, 0.006016346160322428, 0.05641835182905197, 0.013393360190093517, 0.015595567412674427, -0.03747237101197243, 0.02099139615893364, 0.04977133870124817, 0.016422567889094353, 0.028959451243281364, -0.053699791431427, -0.040329352021217346, 0.035481587052345276, 0.011406069621443748, -0.03147440776228905, -0.013861292041838169, 0.0063730888068675995, 0.051022302359342575, 0.03400370851159096, -0.022852472960948944, -0.02099062129855156, -0.01833498477935791, 0.026875289157032967, 0.04782719165086746, -0.0756583958864212, 0.030595164746046066, -0.04979090392589569, -0.03564555570483208, 0.05346917733550072, -0.03463505581021309, -0.07672461122274399, 0.024267638102173805, -0.0039416044019162655, 0.04438665509223938, -0.005887544248253107, -0.0635233074426651, 0.05648903176188469, -0.04770098254084587, -0.05485859513282776, -0.006029834505170584, -0.016246899962425232, -0.06754170358181, 0.03748483210802078, 0.01606096513569355, 0.03583955764770508, 0.047074154019355774, -0.008117967285215855, -0.08962532877922058, 0.014910400845110416, 0.009872522205114365, 0.035728730261325836, 0.04711532220244408, -0.042824938893318176, 0.002767988247796893, -0.013895017094910145, 0.043840136379003525, 0.00029948484734632075, -0.039289578795433044, -0.026312630623579025, -0.06619395315647125, 0.004452982917428017, 0.04481520131230354, 0.005453789606690407, 0.05664031580090523, 0.0739651769399643, -0.08210378885269165, 0.032571952790021896, 0.042178526520729065, -0.0035041479859501123, -0.0029301666654646397, 0.0935276448726654, 0.04377578943967819, 0.04847326502203941, -0.0615478940308094, 0.07922197133302689, -0.004020536318421364, -0.0666218250989914, 0.0214386023581028, 0.07087813317775726, -0.04078018292784691, -0.03804023191332817, -0.0728759840130806, -0.004661167971789837, 0.0030944705940783024, 0.01815270073711872, -0.027586907148361206, -0.0395919494330883, 0.00040082831401377916, -0.05662816762924194, 0.007572975475341082, -0.026712054386734962, 0.03694170340895653, -0.04578271508216858, 0.009316983632743359, -0.04957040771842003, 0.05334137752652168, 0.01059724111109972, 0.023371068760752678, 0.05064762011170387, 0.030381975695490837, 0.04135773330926895, -0.04000198841094971, -0.01886114850640297, -0.032932255417108536, 0.04797471687197685, -0.008686067536473274, 0.04321490228176117, 0.04628375545144081, -0.010572836734354496, 0.053474415093660355, -0.014033697545528412, 0.005932123865932226, 0.04796309396624565, 0.004452323075383902, -0.07091102004051208, 0.03688077628612518, -0.04745759814977646, 0.07687661051750183, 0.021460898220539093, -0.004100338090211153, 0.05236532539129257, -0.02162238582968712, 0.054488569498062134, -0.07523513585329056, 0.020332245156168938, -0.0011442680843174458, -0.03503701090812683, 0.01159476488828659, 0.006460137199610472, 0.01890765130519867, -0.05323678255081177, 0.034221578389406204, -0.01561958808451891, 0.023255743086338043, -0.07985063642263412, 0.023026324808597565, -0.08050137013196945, -0.02989351563155651, 0.015561300329864025, -0.06942413002252579, -0.006573224440217018, -0.0063782949000597, -0.0015109069645404816, 0.17655281722545624, -0.02989749051630497, 0.10639604181051254, -0.03959926217794418, -0.0084380516782403, 0.03848900645971298, 0.05631784349679947, 0.0684211477637291, 0.09496207535266876, -0.04902462288737297, -0.017921732738614082, -0.08489221334457397, -0.06604550778865814, 0.026168784126639366, -0.05479639023542404, -0.048213422298431396, -0.024150017648935318, -0.008800670504570007, -0.03220072761178017, -0.0036870629992336035, 0.039451468735933304, 0.025933440774679184, -0.015599297359585762, -0.02368846721947193, 0.060454487800598145, 0.03384549915790558, 0.09941110014915466, -0.10402055084705353, -0.03903541341423988, -0.034177184104919434, -0.04521860554814339, 0.00330931949429214, -0.03263316676020622, -0.03556562215089798, 0.04410926625132561, 0.02281179465353489, 0.014017561450600624, 0.01433567889034748, 0.006100740283727646, 0.07848122715950012, 0.0006563985371030867, 0.006449616979807615, -0.06120239943265915, -0.04924639314413071, -0.027944695204496384, -0.024923406541347504, 0.008873704820871353, 0.0066732848063111305, 0.03540652245283127, -0.024729358032345772, -0.021788302809000015, -0.017161520197987556, 0.009826546534895897, 0.01883045583963394, 0.007213253993541002, 0.05896454676985741, 0.023344306275248528, -0.020382266491651535, -0.01710457354784012, -0.022447269409894943, 0.01981392689049244, -0.06008671969175339, 0.0033837330993264914, 0.0072712586261332035, -0.008237513713538647, 0.020964793860912323, -0.009146125055849552, -0.025151515379548073, -0.0027668029069900513, 0.030689409002661705, 0.024820417165756226, 0.018526243045926094, 0.036338213831186295, -0.027358567342162132, 0.014564499258995056, 0.025293836370110512, 0.01287710852921009, -0.019652873277664185, 0.005733145866543055, 0.04049582779407501, -0.025176269933581352, 0.012320234440267086, -0.049726542085409164, -0.018841326236724854, -0.034131672233343124, 0.03432071954011917, 0.004573557525873184, 0.00915618147701025, -0.08757667988538742, 0.013758129440248013, 0.021127143874764442, 0.018807295709848404, -0.017583832144737244, -0.044621992856264114, 0.024630554020404816, -0.010061834938824177, -0.006715327501296997, 0.07567189633846283, 0.017976833507418633, 0.018379224464297295, 0.012245912104845047, 0.050132621079683304, 0.039078690111637115, -0.03531988337635994, -0.018363473936915398, 0.024218782782554626, 0.022239306941628456, 0.02077862061560154, -0.04067591577768326, 0.0020794395823031664, -0.008251175284385681, 0.00840215664356947, 0.0006462695309892297, 0.015358946286141872, 0.05587247759103775, 0.0281098373234272, 0.014549488201737404, 0.009978245012462139, -0.004446100909262896, -0.044330451637506485, 0.02857452630996704, -0.023059846833348274, -0.0259946808218956, -0.028568267822265625, -0.018724732100963593, 0.024661723524332047, -0.029176857322454453, -0.01380375400185585, -0.03695419058203697, -0.011611667461693287, -0.0034128576517105103, -0.013294416479766369, 0.0964450091123581, -0.009854581207036972, -0.011230433359742165, -0.026307566091418266, 0.011063898913562298, -0.04763197526335716, -0.015094981528818607, -0.002293709432706237, 0.008428136818110943, 0.01513980794698, -0.00317018898203969, -0.050731111317873, 0.014998169615864754, 0.03938589245080948, 0.030500372871756554, -0.002959462581202388, 0.008929023519158363, 0.05807585269212723, 0.01856386661529541, -0.019622808322310448, -0.02180798165500164, 0.03319387510418892, 0.004730564542114735, -0.013393241912126541, -0.01916670612990856, 0.038386791944503784, -0.010945308953523636, 0.01593494787812233, -0.00830685906112194, 0.004430617671459913, -0.07044381648302078, 0.023791151121258736, -0.002179572591558099, -0.009292937815189362, -0.004645125009119511, 0.06002890691161156, -0.037014495581388474, -0.01760348677635193, 0.01942536048591137, -0.007877337746322155, 0.0077694859355688095, 0.0004762067983392626, -0.028906863182783127, -0.07272637635469437, 0.0075082965195178986, -0.003842234844341874, 0.013510392047464848, 0.02144877053797245, 0.005852073896676302, -0.014980288222432137, -0.02147194929420948, -0.03252972662448883, 0.0059745339676737785, -0.004868783056735992, -0.005097114481031895, -0.016533682122826576, 0.01363326795399189, -0.06423145532608032, 0.0010640552500262856, -0.016784880310297012, 0.0046735187061131, 0.004368159919977188, -0.028654418885707855, -0.02098115161061287, -0.005922744516283274, 0.023543212562799454, 0.035060521215200424, 0.01129557378590107, -0.003798055462539196, -0.044271405786275864, 0.035889141261577606, 0.06455598771572113, 0.011021883226931095, -0.045032065361738205, 0.028078587725758553, 0.026806529611349106, -0.04626280069351196, 0.01928683929145336, -0.02020564116537571, -0.0348171703517437, -0.032107412815093994, -0.04604188725352287, 0.041985783725976944, 0.021238451823592186, 0.001579175004735589, -0.07369770854711533, -0.03317993879318237, 0.027507394552230835, 0.016235893592238426, 0.016264723613858223, -0.011214368976652622, -0.012717796489596367, -0.004047743510454893, 0.01330889854580164, 0.05005896836519241, -0.0012442790903151035, -0.01946154609322548, 0.0051695965230464935, -0.00823406595736742, -0.018055114895105362, 0.0024622990749776363, 0.04326262325048447, -0.034048862755298615, -0.01983569748699665, -0.03203153610229492, -0.014692587777972221, -0.014917325228452682, 0.013617381453514099, -0.03166720271110535, -0.012774878181517124, 0.030497552827000618, -0.005507003050297499, -0.0018316402565687895, -0.02455579675734043, 0.02575061470270157, 0.012141164392232895, -0.01721680350601673, -0.002379286102950573, -0.04178253561258316, -0.0045033846981823444, 0.01898209936916828, -0.04053252935409546, -0.00653096754103899, -0.03689779341220856, 0.031949110329151154, 0.0006878810818307102, -0.010442400351166725, 0.0248098261654377, -0.006357395555824041, -0.04550523683428764, 0.0342489592730999, 0.05005365610122681, 0.021433740854263306, 0.022435221821069717, -0.03328107297420502, 0.003270451445132494, 0.005401508882641792, -0.025449113920331, -0.006320437416434288, 0.019666625186800957, -0.0136902816593647, 0.015095546841621399, 0.02735171839594841, 0.055048856884241104, -0.027966463938355446, 0.04352010786533356, -0.019628144800662994, -0.008335236459970474, 0.0002968704793602228, -0.023557109758257866, -0.023319676518440247, 0.018761903047561646, -0.0032012262381613255, 0.015538616105914116, 0.009157758206129074, -0.01640673168003559, 0.03323618695139885, 0.09984584152698517, -0.01371599081903696, 0.0016112892189994454, 0.005203040316700935, -0.0357055589556694, -0.01432966347783804, 0.03212837502360344, 0.003252612194046378, -0.022015048190951347, 0.033516306430101395, 0.019396664574742317, -0.004176553804427385, -0.014546326361596584, -0.021357255056500435, -0.018784411251544952, -0.013926551677286625, 0.029109783470630646, 0.01806996949017048, 0.013026508502662182, -0.023464815691113472, -0.01915728859603405, 0.024228986352682114, 0.04389609768986702, 0.02821210026741028, -0.01653245836496353, 0.02910851128399372, -0.010959806852042675, 0.009416317567229271, 0.02561330981552601, 0.004656199831515551, -0.009548647329211235, 0.003355596447363496, 0.02059810794889927, 0.000404875521780923, -0.03446859493851662, 0.024385392665863037, 0.07180910557508469, 0.012202566489577293, -0.08854636549949646, -0.021464664489030838, -0.023407159373164177, -0.042298924177885056, 0.04557130113244057, -0.04091649875044823, 0.015130986459553242, 0.03179359808564186, -0.00033141757012344897, 0.04933375492691994, -0.01715140789747238, -0.024287348613142967, 0.01122402772307396, -0.011083358898758888, -0.013006380759179592, 0.008527694270014763, 0.02141805924475193, 0.00844572577625513, 0.0011102964635938406, 0.006735715549439192, -0.008412113413214684, 0.020041778683662415, -0.03243473544716835, 0.010453109629452229, -0.018060456961393356, -0.0022244425490498543, 0.02038734033703804, -0.0051699536852538586, -0.026651665568351746, 0.001215663505718112, -0.03455573692917824, 0.05323217809200287, 0.07061904668807983, 0.01082042045891285, -0.008566072210669518, 0.0023663961328566074, 0.030374549329280853, -0.026173852384090424, 0.04382171854376793, -0.039587609469890594, 0.058339741080999374, -0.01128297857940197, 0.05769092217087746, 0.04543397203087807, 0.017956672236323357, -0.00258745183236897, -0.03508489578962326, 0.03533844277262688, 0.020536640658974648, 0.009818912483751774, 0.03241260349750519, 0.03976867347955704, 0.003315106499940157, -0.04490409791469574, 0.014917004853487015, 0.02485688216984272, -0.013187924399971962, 0.03360390663146973, 0.008467146195471287, -0.008030633442103863, -0.02959132008254528, 0.05603230372071266, 0.03201494365930557, 0.015050160698592663, -0.03398292511701584, 0.01845363900065422, 0.050275951623916626, 0.026021065190434456, 0.026746569201350212, 0.019406767562031746, 0.01077893003821373, -0.02916008234024048, 0.012561710551381111, 0.03544251620769501, 0.053808752447366714, 0.034056056290864944, -0.005632213316857815, 0.017747977748513222, -0.04271171614527702, -0.023795630782842636, 0.03344031050801277, 0.004758802708238363, -0.023738235235214233, -0.02012290619313717, 0.04151025786995888, -0.03178190439939499, 0.029884980991482735, -0.027151795104146004, 0.00408670911565423, -0.021564526483416557, -0.0011767519172281027, -0.010620634071528912, 0.007241664920002222, -0.03712276369333267, -0.0427112802863121, -0.0067705013789236546, 0.04164375737309456, -0.026670437306165695, 0.025171387940645218, -0.014388315379619598, -0.03400604799389839, -0.021033551543951035, -0.0041593885980546474, -0.03910749405622482, 0.020140066742897034, -0.022210905328392982, -0.005507675930857658, -0.024855010211467743, -0.0294075608253479, 0.00832486990839243, 0.03186057507991791, 0.013624817132949829, 0.05736635625362396, 0.00459649134427309, -0.001891772961243987, 0.018672993406653404, -0.04767436534166336, 0.04943770542740822, -0.04069194570183754, 0.035071056336164474, -0.009606696665287018, 0.02700730785727501, 0.00009216749458573759, 0.019124699756503105, -0.02949945442378521, -0.013398866169154644, 0.021792221814393997, 0.011245821602642536, -0.03650614619255066, 0.04268575459718704, -0.03680858388543129, -0.022189926356077194, 0.03131743147969246, -0.010472258552908897, -0.05334646627306938, 0.015434365719556808, -0.0028605209663510323, 0.06060203164815903, -0.03562320023775101, -0.018509892746806145, 0.002331616124138236, 0.05571254342794418, 0.012736168690025806, 0.006102002691477537, -0.017244350165128708, 0.01512822974473238, -0.0017524934373795986, -0.028692161664366722, 0.02438497729599476, -0.02533997781574726, 0.008379437029361725, -0.028621265664696693, -0.050175126641988754, -0.023211998865008354, -0.0143946073949337, -0.06492240726947784, 0.00100475805811584, -0.10903757065534592, 0.01821325346827507, -0.009144723415374756, -0.03798630088567734, -0.014364775270223618, -0.028562134131789207, 0.05022507533431053, 0.03034340590238571, 0.009660771116614342, 0.06151570379734039, -0.09943302720785141, 0.010386551730334759, 0.006242373026907444, 0.0242693480104208, 0.02326357550919056, 0.015982937067747116, 0.005736729130148888, 0.018437623977661133, 0.0625031515955925, 0.002003441099077463, -0.03713853657245636, 0.013527383096516132, 0.016449619084596634, 0.019236035645008087, -0.022312264889478683, 0.006700946483761072, 0.03660641610622406, 0.01583050563931465, -0.008169007487595081, -0.004151635803282261, -0.05682327225804329, -0.0034573550801724195, 0.0229620561003685, -0.07021578401327133, 0.0028718181420117617, -0.010335504077374935, -0.017339149489998817, 0.02549809217453003, -0.000497899018228054, -0.010573442094027996, -0.012634558603167534, -0.008813922293484211, -0.0004505902179516852, 0.009540324099361897, -0.034754879772663116, -0.027366437017917633, -0.011154825799167156, 0.027126392349600792, -0.004326389636844397, -0.03697718307375908, 0.028169941157102585, -0.025076819583773613, -0.03909452259540558, 0.00044909949065186083, -0.00997659470885992, -0.0008875569910742342, 0.006578907370567322, -0.005222112871706486, -0.016885602846741676, 0.031150629743933678, -0.003907148726284504, -0.015014147385954857, -0.023044370114803314, 0.019848961383104324 ]
The Partnership: Amazon SageMaker and Hugging Face
philschmid
March 23, 2021
the-partnership-amazon-sagemaker-and-hugging-face
partnerships, aws
https://huggingface.co/blog/the-partnership-amazon-sagemaker-and-hugging-face
FAQ 🎯 You can find the complete Frequently Asked Questions in the documentation. Q: What are Deep Learning Containers? A: Deep Learning Containers (DLCs) are Docker images pre-installed with deep learning frameworks and libraries (e.g. transformers, datasets, tokenizers) to make it easy to train models by letting you skip the complicated process of building and optimizing your environments from scratch. Q: Do I have to use the SageMaker Python SDK to use the Hugging Face Deep Learning Containers? A: You can use the HF DLC without the SageMaker Python SDK and launch SageMaker Training jobs with other SDKs, such as the AWS CLI or boto3. The DLCs are also available through Amazon ECR and can be pulled and used in any environment of choice. Q: Why should I use the Hugging Face Deep Learning Containers? A: The DLCs are fully tested, maintained, optimized deep learning environments that require no installation, configuration, or maintenance. Q: Why should I use SageMaker Training to train Hugging Face models? A: SageMaker Training provides numerous benefits that will boost your productivity with Hugging Face : (1) first it is cost-effective: the training instances live only for the duration of your job and are paid per second. No risk anymore to leave GPU instances up all night: the training cluster stops right at the end of your job! It also supports EC2 Spot capacity, which enables up to 90% cost reduction. (2) SageMaker also comes with a lot of built-in automation that facilitates teamwork and MLOps: training metadata and logs are automatically persisted to a serverless managed metastore, and I/O with S3 (for datasets, checkpoints and model artifacts) is fully managed. Finally, SageMaker also allows to drastically scale up and out: you can launch multiple training jobs in parallel, but also launch large-scale distributed training jobs Q: Once I've trained my model with Amazon SageMaker, can I use it with 🤗/Transformers ? A: Yes, you can download your trained model from S3 and directly use it with transformers or upload it to the Hugging Face Model Hub. Q: How is my data and code secured by Amazon SageMaker? A: Amazon SageMaker provides numerous security mechanisms including encryption at rest and in transit, Virtual Private Cloud (VPC) connectivity and Identity and Access Management (IAM). To learn more about security in the AWS cloud and with Amazon SageMaker, you can visit Security in Amazon SageMaker and AWS Cloud Security. Q: Is this available in my region? A: For a list of the supported regions, please visit the AWS region table for all AWS global infrastructure. Q: Do I need to pay for a license from Hugging Face to use the DLCs? A: No - the Hugging Face DLCs are open source and licensed under Apache 2.0. Q: How can I run inference on my trained models? A: You have multiple options to run inference on your trained models. One option is to use Hugging Face Accelerated Inference-API hosted service: start by uploading the trained models to your Hugging Face account to deploy them publicly, or privately. Another great option is to use SageMaker Inference to run your own inference code in Amazon SageMaker. We are working on offering an integrated solution for Amazon SageMaker with Hugging Face Inference DLCs in the future - stay tuned! Q: Do you offer premium support or support SLAs for this solution? A: AWS Technical Support tiers are available from AWS and cover development and production issues for AWS products and services - please refer to AWS Support for specifics and scope. If you have questions which the Hugging Face community can help answer and/or benefit from, please post them in the Hugging Face forum. If you need premium support from the Hugging Face team to accelerate your NLP roadmap, our Expert Acceleration Program offers direct guidance from our open source, science and ML Engineering team - contact us to learn more. Q: What are you planning next through this partnership? A: Our common goal is to democratize state of the art Machine Learning. We will continue to innovate to make it easier for researchers, data scientists and ML practitioners to manage, train and run state of the art models. If you have feature requests for integration in AWS with Hugging Face, please let us know in the Hugging Face community forum. Q: I use Hugging Face with Azure Machine Learning or Google Cloud Platform, what does this partnership mean for me? A: A foundational goal for Hugging Face is to make the latest AI accessible to as many people as possible, whichever framework or development environment they work in. While we are focusing integration efforts with Amazon Web Services as our Preferred Cloud Provider, we will continue to work hard to serve all Hugging Face users and customers, no matter what compute environment they run on.
[ 0.02290884219110012, 0.006126802414655685, 0.03099721297621727, 0.040686577558517456, 0.04084949195384979, 0.06101953610777855, 0.012130474671721458, 0.048293113708496094, -0.0515589639544487, -0.029198328033089638, -0.07250932604074478, 0.10306210815906525, 0.002649437403306365, 0.06678754836320877, -0.03107418119907379, -0.07499606162309647, 0.06195606663823128, 0.045525532215833664, -0.0496862530708313, 0.08253055065870285, 0.02143958956003189, -0.05207083374261856, -0.016549427062273026, 0.01614975370466709, -0.03620585426688194, -0.04826771467924118, -0.0010907301912084222, -0.024510936811566353, -0.010711174458265305, 0.02508334256708622, -0.0877985879778862, -0.03379085659980774, 0.04718736559152603, -0.01982075721025467, 0.04891127347946167, 0.011205916292965412, -0.1389034390449524, 0.05068168044090271, 0.03827577456831932, -0.022420475259423256, -0.02536645345389843, -0.00948728434741497, -0.11333131045103073, 0.020932551473379135, -0.011297880671918392, -0.01898179203271866, -0.1306866854429245, 0.044603802263736725, 0.007745120208710432, 0.013548717834055424, -0.12005496025085449, 0.07357937097549438, 0.01767791621387005, -0.023223040625452995, 0.05425752326846123, 0.017940670251846313, -0.0014215901028364897, -0.013577369973063469, -0.020130164921283722, -0.037519894540309906, 0.014941473491489887, -0.04462515562772751, -0.020599212497472763, -0.013342033140361309, 0.005391676910221577, 0.015965981408953667, 0.015609660185873508, -0.009764029644429684, -0.03191833943128586, -0.04766158387064934, 0.01708092726767063, -0.052213624119758606, -0.026906117796897888, -0.0035863840021193027, -0.035613805055618286, -0.05701826885342598, -0.04582170024514198, -0.011323744431138039, 0.03420082852244377, 0.003999432548880577, -0.03960633650422096, 0.052270013839006424, -0.004651797469705343, 0.03667760640382767, 0.03697323426604271, -0.060403697192668915, -0.003056710120290518, -0.045146502554416656, -0.03273103013634682, 0.07952194660902023, 0.006536472588777542, -0.06620113551616669, 0.016302987933158875, 0.013181687332689762, 0.03854024037718773, -0.015245866030454636, 0.008071048185229301, -0.005225574132055044, -0.0009117656154558063, -0.01944863796234131, 0.007626421749591827, -0.06560727208852768, 0.0005282458150759339, -0.043502047657966614, -0.03338116779923439, 0.024145981296896935, -0.04561736807227135, -0.11326927691698074, -0.002055530436336994, 0.016741694882512093, 0.03585745766758919, -0.024831924587488174, -0.014284960925579071, 0.08388234674930573, -0.11070236563682556, 0.07652861624956131, 0.017591070383787155, -0.047675278037786484, 0.012148357927799225, -0.00913944374769926, 0.0629376769065857, 0.07086434960365295, 0.041938416659832, -0.00702259037643671, -0.029294606298208237, 0.03966619819402695, 0.0051961601711809635, -0.012198398821055889, 0.0007561425445601344, -0.06022871658205986, 0.015267633832991123, -0.037076182663440704, 0.029533086344599724, -0.019567448645830154, -0.027713855728507042, -0.047274064272642136, -0.0034595977049320936, -0.04603656008839607, 0.03332635387778282, -0.02177894115447998, -0.012282542884349823, 0.11512402445077896, 0.030134031549096107, 0.03374570608139038, 0.07326782494783401, 0.032326363027095795, -0.04955674335360527, 0.02660559117794037, 0.005151487421244383, 0.06488646566867828, -0.06364476680755615, 0.08062133938074112, -0.022704558447003365, -0.11358169466257095, 0.00853035319596529, 0.049247369170188904, -0.025293320417404175, -0.004114591516554356, -0.06244970113039017, -0.07188238948583603, -0.032510269433259964, -0.031132780015468597, -0.058148086071014404, -0.015856266021728516, 0.03786056488752365, -0.021345412358641624, 0.03808441758155823, 0.01673540286719799, 0.013292503543198109, -0.03541390225291252, 0.008019892498850822, -0.04202033579349518, 0.07697634398937225, -0.028150957077741623, 0.03433195874094963, 0.056973110884428024, 0.04542011395096779, 0.08929219841957092, 0.03563275560736656, -0.0004307414055801928, -0.09403551369905472, 0.04910721629858017, -0.016343416646122932, -0.002187430625781417, 0.06773373484611511, -0.05674644187092781, 0.026942195370793343, 0.016340196132659912, -0.005157028324902058, 0.032098136842250824, -0.02193034067749977, 0.0019562984816730022, 0.060842398554086685, 0.0007462515495717525, 0.03332853317260742, -0.05677110329270363, -0.005060916766524315, 0.14005479216575623, 0.03131185844540596, 0.058614812791347504, 0.052756067365407944, 0.045749157667160034, 0.003988614305853844, -0.0020486819557845592, -0.0664600282907486, 0.06472483277320862, 0.009636398404836655, -0.04339771345257759, 0.022470949217677116, 0.006391931790858507, 0.012185155414044857, -0.16019897162914276, 0.003553154645487666, -0.03566021844744682, 0.04939926788210869, -0.023861544206738472, -0.025234518572688103, -0.02407573163509369, 0.059827979654073715, 0.014822052791714668, 0.161184161901474, -0.009227019734680653, -0.010116015560925007, -0.02644200064241886, -0.02458924800157547, 0.006886580027639866, 0.0510229617357254, 0.040347132831811905, 0.10127100348472595, -0.08106659352779388, -0.054459426552057266, -0.07469594478607178, -0.05037987232208252, 0.020874515175819397, -0.02448546513915062, -0.0013385523343458772, 0.029309505596756935, -0.03406725823879242, -0.02082717791199684, 0.027100766077637672, 0.01797163300216198, -0.052034441381692886, 0.03230723738670349, 0.013507809489965439, 0.020005449652671814, -0.013479100540280342, 0.05315018817782402, 0.024552417919039726, -0.08331789076328278, -0.030235422775149345, -0.0963214710354805, 0.060657501220703125, -0.03741452097892761, -0.029507294297218323, 0.06597280502319336, -0.0077368770726025105, 0.001185606699436903, 0.008077318780124187, 0.007908638566732407, 0.062070976942777634, -0.012718298472464085, 0.0040892502292990685, -0.04844547063112259, -0.01423520315438509, -0.021578660234808922, -0.04359276220202446, -0.020399725064635277, -0.024040907621383667, 0.006904338486492634, 0.022686488926410675, 0.0566394068300724, -0.015032049268484116, 0.032524313777685165, 0.007486390415579081, -0.004852233454585075, 0.02828029915690422, 0.049627386033535004, -0.018262527883052826, -0.00011230273958062753, -0.015634015202522278, 0.031170010566711426, -0.042572271078825, -0.01217870507389307, 0.06222804635763168, 0.031589575111866, -0.001173364813439548, -0.010466128587722778, -0.03076399676501751, -0.05516999587416649, 0.002575215417891741, 0.03803245350718498, 0.0475553423166275, 0.021715277805924416, -0.008327731862664223, -0.03497030586004257, 0.018736708909273148, -0.019773226231336594, -0.024928873404860497, 0.0029236532282084227, 0.06491763144731522, 0.014453798532485962, -0.03206532448530197, 0.005176854319870472, -0.013166820630431175, -0.02327880822122097, -0.006207040511071682, 0.016219642013311386, 0.007511791307479143, -0.1059252917766571, -0.0202400591224432, -0.04213188588619232, 0.04290817677974701, -0.021020349115133286, -0.014874709770083427, 0.05423128232359886, 0.006472326349467039, -0.0008645078050903976, 0.021273698657751083, 0.007294666953384876, 0.03680387884378433, 0.015215392224490643, -0.027290457859635353, -0.020245090126991272, 0.000014249929336074274, -0.0017638576682657003, -0.03313606232404709, 0.028689051046967506, -0.002971105743199587, -0.04513184353709221, 0.028893116861581802, 0.016609933227300644, 0.007057199254631996, -0.016420111060142517, 0.01512907724827528, 0.028993522748351097, 0.003934596665203571, 0.005902776960283518, -0.029854746535420418, -0.017248904332518578, -0.004780217073857784, -0.024377962574362755, 0.018564267084002495, -0.035723090171813965, -0.011642592027783394, -0.007919641211628914, 0.030339810997247696, 0.03544582426548004, 0.01380757987499237, 0.01432292815297842, 0.0006753357592970133, 0.000704969628714025, 0.03075222298502922, 0.06910498440265656, -0.012814478948712349, -0.015427100472152233, -0.03474172204732895, 0.05392128974199295, -0.009396717883646488, -0.027124151587486267, -0.021100349724292755, 0.009741847403347492, 0.04233086109161377, -0.019855232909321785, 0.007298858370631933, 0.009182380512356758, 0.02635331265628338, 0.020224912092089653, -0.030637528747320175, -0.035733651369810104, 0.032131098210811615, -0.01068966742604971, -0.0015653613954782486, -0.004004392307251692, 0.04264562204480171, 0.014189157634973526, -0.035887498408555984, 0.010985411703586578, 0.054159168154001236, -0.0008544566226191819, 0.052856434136629105, -0.0007441102061420679, 0.004191683605313301, -0.012249328196048737, -0.019139006733894348, -0.012591687962412834, 0.0024973475374281406, 0.059567634016275406, 0.02191138081252575, 0.014289806596934795, -0.013973238877952099, 0.00690082460641861, -0.030971381813287735, 0.01378239132463932, -0.006924370303750038, 0.04189438372850418, -0.030952446162700653, 0.056068770587444305, 0.0698717013001442, 0.02797500416636467, -0.029958708211779594, 0.036796730011701584, -0.02185259759426117, 0.008814672939479351, -0.04254581406712532, 0.041899751871824265, 0.029064860194921494, -0.024696702137589455, 0.02248026616871357, 0.007661898620426655, -0.021484622731804848, 0.008906322531402111, -0.025073764845728874, -0.027492865920066833, -0.006790651008486748, -0.03435535728931427, -0.0391216017305851, -0.021243929862976074, -0.014813043177127838, 0.033174458891153336, 0.024115262553095818, -0.0030653197318315506, 0.004038357641547918, 0.02618330344557762, 0.05801606550812721, -0.005564996041357517, -0.027531346306204796, -0.006814949214458466, 0.060392096638679504, -0.023416776210069656, 0.04294031113386154, -0.012784031219780445, -0.043193381279706955, -0.004891294054687023, 0.013345452956855297, 0.010201656259596348, 0.007128497585654259, -0.007702024653553963, -0.02985098585486412, -0.022364400327205658, -0.009567285887897015, 0.034380730241537094, -0.027824126183986664, 0.011091974563896656, -0.0045445989817380905, -0.018584946170449257, 0.026820139959454536, 0.004099510610103607, -0.006033092737197876, 0.014895301312208176, -0.0021783332340419292, 0.055055443197488785, -0.013819800689816475, 0.01996408961713314, 0.001671831589192152, -0.03954876959323883, -0.011273151263594627, -0.025260478258132935, 0.019862685352563858, 0.01916751265525818, -0.007802433799952269, -0.036285899579524994, 0.01430827658623457, 0.026517551392316818, -0.029070483520627022, 0.007797558791935444, 0.006373900454491377, 0.013639770448207855, 0.04569097235798836, -0.019411636516451836, 0.01475560199469328, -0.02174089103937149, 0.0019112665904685855, 0.02994483709335327, 0.013940518721938133, -0.01881749927997589, -0.02575918659567833, -0.010875371284782887, 0.003052615327760577, -0.04460252448916435, -0.019285792484879494, -0.003422164125367999, -0.03605557978153229, 0.007571736350655556, 0.05388343334197998, 0.026597188785672188, 0.021616347134113312, 0.010904540307819843, 0.004717896692454815, -0.026618042960762978, 0.007419088389724493, 0.0009849219350144267, -0.011056488379836082, -0.028398433700203896, 0.017116399481892586, 0.0664462000131607, 0.048015594482421875, 0.009028260596096516, 0.04490687698125839, -0.027079623192548752, -0.04146846756339073, 0.04276122525334358, -0.04638911411166191, -0.0030176991131156683, -0.011730571277439594, 0.04926522076129913, 0.0529230572283268, 0.005113172810524702, -0.01152115035802126, 0.011468927375972271, 0.06135916709899902, -0.03631173446774483, -0.008274461142718792, 0.045022428035736084, -0.021653125062584877, -0.011985914781689644, -0.02156802825629711, 0.019196081906557083, -0.02107589691877365, 0.0049176826141774654, 0.023936644196510315, -0.020628588274121284, 0.003428736003115773, -0.01387518085539341, -0.0283375047147274, -0.03807142376899719, 0.057575467973947525, 0.05449940636754036, 0.008419648744165897, -0.02136840485036373, -0.02312655933201313, 0.005267946049571037, -0.006122741382569075, 0.016653332859277725, -0.016241727396845818, 0.018169207498431206, 0.018122123554348946, 0.004920963663607836, -0.007008269429206848, 0.02846698649227619, 0.010188964195549488, -0.04628951847553253, 0.009151771664619446, -0.002710970351472497, -0.00986662320792675, -0.010575724765658379, 0.03373970463871956, -0.00044464177335612476, -0.03297761082649231, -0.0013071022694930434, 0.006748383864760399, 0.012244005687534809, -0.030959798023104668, -0.04907672852277756, 0.0522771030664444, 0.05805324763059616, -0.01678686961531639, 0.02147030457854271, -0.028099801391363144, 0.013730814680457115, 0.032233189791440964, 0.053050071001052856, -0.012576763518154621, 0.03536299988627434, -0.007351921405643225, 0.0005098004476167262, 0.030873248353600502, 0.009182769805192947, -0.028187477961182594, -0.019608210772275925, -0.0746145248413086, 0.02142273262143135, 0.026129819452762604, -0.05603450536727905, 0.006601480767130852, -0.0031306464225053787, -0.02545579895377159, 0.03457298502326012, 0.039490021765232086, 0.0013619770761579275, 0.049421533942222595, 0.022442810237407684, 0.003175091464072466, 0.00002930360824393574, 0.010460324585437775, 0.003213433315977454, 0.028407016769051552, -0.03295191377401352, -0.00511866994202137, 0.006985201966017485, 0.040318019688129425, 0.051818203181028366, -0.008347177878022194, 0.017379919067025185, -0.021768782287836075, 0.033025965094566345, -0.018126636743545532, 0.061390168964862823, 0.0225646011531353, -0.036419227719306946, -0.0097887571901083, -0.01723426952958107, 0.0251142717897892, -0.009730758145451546, -0.004666977562010288, 0.025747155770659447, 0.017808841541409492, 0.04181984066963196, 0.0010727664921432734, 0.024782642722129822, 0.058593351393938065, 0.017627758905291557, 0.04419272392988205, 0.01587212271988392, 0.05399136245250702, -0.00020938957459293306, 0.011442695744335651, 0.053237590938806534, 0.015234255231916904, 0.03123856894671917, 0.038881272077560425, 0.025075098499655724, 0.034963786602020264, -0.0026584488805383444, -0.020960010588169098, -0.012946446426212788, -0.018624836578965187, -0.0153603320941329, -0.005604624282568693, 0.014750881120562553, -0.05484325811266899, -0.034986790269613266, 0.018551040440797806, -0.015475692227482796, 0.008135011419653893, -0.0097965057939291, 0.00975649245083332, -0.010371506214141846, 0.01703852415084839, 0.01915029063820839, 0.02700802870094776, -0.00045173364924266934, -0.07104035466909409, -0.009454428218305111, 0.014828229323029518, 0.013302043080329895, -0.013237559236586094, -0.022971605882048607, -0.04513845592737198, 0.0016999667277559638, -0.00973623525351286, -0.0005016226787120104, 0.046050749719142914, -0.03463238477706909, 0.010740154422819614, 0.006648911628872156, 0.015487569384276867, 0.01750621572136879, 0.03862594813108444, 0.012401138432323933, -0.018360788002610207, -0.01609104312956333, -0.0006910545635037124, -0.001207334571518004, 0.008590677753090858, 0.01396358385682106, -0.03705832362174988, 0.034228451550006866, -0.041603025048971176, 0.042346417903900146, 0.007733201142400503, 0.0073554967530071735, 0.01070335041731596, -0.011551241390407085, -0.03891824185848236, 0.00560732651501894, 0.011046627536416054, 0.038807790726423264, -0.009996059350669384, -0.03147866576910019, 0.017524579539895058, 0.006258143577724695, -0.010860267095267773, -0.007358133792877197, 0.01322869211435318, 0.04295545443892479, -0.034179240465164185, 0.0050631435588002205, 0.011228258721530437, 0.05317681282758713, 0.02512042224407196, 0.05106388404965401, 0.017767339944839478, 0.003349742852151394, 0.009411199949681759, -0.05210624262690544, -0.008664428256452084, -0.03366857022047043, 0.0014604928437620401, -0.041923679411411285, -0.030003143474459648, -0.010679725557565689, -0.02320069633424282, -0.009873045608401299, 0.0004863025969825685, -0.04358036816120148, -0.029144708067178726, -0.022969622164964676, -0.020872697234153748, -0.025056378915905952, -0.00009908265201374888, 0.06419678777456284, 0.03579114004969597, 0.008372428826987743, 0.0006976677104830742, -0.008329887874424458, 0.02212768979370594, -0.009253899566829205, 0.03689825162291527, 0.07115627825260162, -0.013647467829287052, -0.0007311410736292601, -0.044168442487716675, -0.030188659206032753, 0.002141315955668688, -0.04987352341413498, 0.00010350629599997774, 0.036815378814935684, 0.008204562589526176, 0.003847019514068961, -0.02092517539858818, 0.028969697654247284, 0.008563901297748089, 0.03796524927020073, -0.04183628782629967, -0.015046553686261177, 0.01521800272166729, 0.022947367280721664, -0.048856303095817566, -0.008105062879621983, 0.011319532059133053, -0.01239557471126318, 0.03350776061415672, 0.0037370766513049603, 0.002130028558894992, -0.053191155195236206, -0.020747533068060875, -0.0020521304104477167, -0.030826600268483162, -0.03463791310787201, -0.05473185330629349, 0.005066927056759596, 0.031447216868400574, -0.018010210245847702, -0.040631674230098724, -0.003223639214411378, -0.022130610421299934, -0.025889474898576736, -0.0041357167065143585, -0.016689587384462357, -0.013532129116356373, -0.03952822461724281, 0.01869647018611431, 0.017634164541959763, 0.03328387066721916, 0.041174884885549545, -0.005481402389705181, -0.030662043020129204, 0.02945491299033165 ]
The Partnership: Amazon SageMaker and Hugging Face
philschmid
March 23, 2021
the-partnership-amazon-sagemaker-and-hugging-face
partnerships, aws
https://huggingface.co/blog/the-partnership-amazon-sagemaker-and-hugging-face
Getting started: End-to-End Text Classification 🧭 In this getting started guide, we will use the new Hugging Face DLCs and Amazon SageMaker extension to train a transformer model on binary text classification using the transformers and datasets libraries. We will use an Amazon SageMaker Notebook Instance for the example. You can learn here how to set up a Notebook Instance. What are we going to do: - set up a development environment and install sagemaker - create the training script train.py - preprocess our data and upload it to Amazon S3 - create a HuggingFace Estimator and train our model
[ -0.015577000565826893, -0.06458345800638199, -0.04608938470482826, -0.014968753792345524, 0.038820698857307434, 0.05341682583093643, 0.007845121435821056, 0.06614235788583755, -0.02889140322804451, -0.03984940052032471, -0.12794709205627441, 0.07017368823289871, -0.021383462473750114, 0.07144027948379517, 0.040976714342832565, -0.03111714869737625, -0.00643001776188612, 0.03399493545293808, -0.030981138348579407, 0.05344923213124275, -0.002330457093194127, -0.0403900109231472, -0.013739245012402534, 0.019065214321017265, -0.014565481804311275, -0.019952578470110893, 0.044791314750909805, -0.019422855228185654, 0.004346616566181183, 0.041417524218559265, -0.07201924920082092, -0.036163873970508575, -0.0006772040505893528, -0.06293857097625732, -0.02171115018427372, 0.06574840098619461, -0.12949326634407043, -0.0193047896027565, 0.05100593343377113, -0.02622007578611374, -0.03795395791530609, -0.003257319563999772, -0.07312784343957901, 0.005669449921697378, -0.010456161573529243, -0.025387296453118324, -0.16227397322654724, 0.017302632331848145, -0.031383104622364044, -0.027969185262918472, -0.07985749840736389, 0.1072445958852768, 0.0012453959789127111, 0.011058817617595196, 0.010191763751208782, 0.015762312337756157, 0.008688356727361679, -0.07063442468643188, -0.0016417898004874587, -0.008395466953516006, 0.02233635075390339, -0.03542935475707054, -0.03805984929203987, 0.02739752270281315, 0.03415043652057648, -0.010666893795132637, -0.03342980146408081, -0.006315197795629501, -0.04267630726099014, -0.008889554999768734, -0.006023545283824205, -0.02231961116194725, 0.03242358937859535, -0.05351636931300163, 0.007021969649940729, -0.049491997808218, 0.06513812392950058, -0.03393878415226936, 0.017224237322807312, 0.02537420019507408, -0.038528844714164734, 0.0811530351638794, 0.018249405547976494, 0.0037765074521303177, 0.05055433139204979, 0.029704030603170395, 0.023414138704538345, -0.0523516982793808, -0.04776200279593468, 0.05283575877547264, 0.027157101780176163, -0.08972149342298508, -0.012887995690107346, 0.027998801320791245, 0.07329046726226807, -0.02799195796251297, -0.0017538720276206732, -0.010420442558825016, -0.015483235940337181, -0.08225546777248383, 0.06030469015240669, -0.07892416417598724, 0.022833650931715965, -0.12306158989667892, -0.008490003645420074, 0.06656157970428467, -0.027429703623056412, -0.05645139142870903, 0.04033077880740166, 0.018841292709112167, -0.01333584263920784, -0.10154082626104355, -0.012213648296892643, 0.10606369376182556, -0.08362327516078949, 0.0724342092871666, -0.008580716326832771, -0.025963518768548965, -0.00893254391849041, 0.050050314515829086, 0.04614986479282379, 0.060378894209861755, 0.02467505820095539, -0.04017786681652069, -0.022238610312342644, 0.023716578260064125, -0.0041677928529679775, -0.03238701447844505, 0.03059169091284275, 0.013494741171598434, 0.027190379798412323, -0.03448901325464249, 0.06852379441261292, -0.01699688658118248, -0.03393629938364029, -0.044890597462654114, -0.027600204572081566, -0.08321111649274826, 0.03610296547412872, 0.0059485239908099174, 0.027162881568074226, 0.129769966006279, 0.016769569367170334, -0.012924914248287678, 0.06077132746577263, 0.04505978524684906, -0.05649464577436447, 0.027262968942523003, -0.039917439222335815, 0.0801243707537651, -0.08251975476741791, 0.037596382200717926, -0.006641353480517864, -0.08859141916036606, 0.0065254466608166695, 0.051292747259140015, -0.011293495073914528, 0.007230415008962154, -0.08024962246417999, -0.015907347202301025, -0.006238396745175123, -0.02929937280714512, -0.042951397597789764, -0.0019720233976840973, 0.03644552826881409, -0.06739770621061325, 0.04999037832021713, 0.04178439825773239, 0.044658251106739044, -0.025292297825217247, 0.022745879366993904, -0.07614217698574066, 0.03254377841949463, -0.026977667585015297, 0.03477045148611069, -0.004749637097120285, 0.05818372219800949, 0.0643322616815567, -0.043113045394420624, -0.04424726963043213, -0.03582317754626274, 0.0556061677634716, 0.026755165308713913, -0.022558286786079407, 0.04497593268752098, -0.02913076989352703, 0.055698245763778687, 0.014999445527791977, 0.02259458601474762, 0.034155428409576416, 0.011978661641478539, 0.020425403490662575, 0.0694514587521553, 0.015117980539798737, 0.021605506539344788, -0.028842944651842117, 0.0073115164414048195, 0.12390201538801193, -0.02271118201315403, 0.04634808748960495, 0.034403957426548004, -0.019479282200336456, 0.013903885148465633, 0.03730763867497444, 0.00267259543761611, 0.013193793594837189, -0.02432161383330822, 0.03455681726336479, 0.0358988456428051, -0.01666792295873165, 0.022913292050361633, -0.07525176554918289, 0.02747650444507599, -0.06808526813983917, -0.010999614372849464, -0.017038734629750252, -0.0349249430000782, 0.01097999420017004, 0.036916788667440414, -0.03334042802453041, 0.12975718080997467, -0.02930605597794056, 0.00605345843359828, -0.06840326637029648, -0.05293628200888634, 0.027818720787763596, 0.07173364609479904, 0.10696925222873688, 0.08569637686014175, -0.1037784293293953, -0.010577884502708912, -0.010569143109023571, 0.009089995175600052, 0.002344392705708742, -0.0709008127450943, -0.05982065573334694, -0.0024573327973484993, -0.010242206044495106, 0.025871850550174713, -0.0016595743363723159, 0.010688518173992634, -0.011776937171816826, 0.0029692749958485365, -0.0226203054189682, 0.026324588805437088, -0.03267994895577431, 0.08349071443080902, 0.0022092440631240606, -0.03568194434046745, 0.011540195904672146, -0.046225570142269135, 0.10573636740446091, -0.03496445715427399, -0.023327229544520378, 0.0024839809630066156, 0.01833835430443287, -0.004727151244878769, 0.039760902523994446, 0.0033152124378830194, 0.0834006518125534, -0.021011732518672943, 0.01138393860310316, -0.02203383669257164, -0.04340406507253647, -0.023295195773243904, -0.05450286343693733, -0.019901642575860023, 0.010794557631015778, 0.01900455169379711, -0.010237352922558784, -0.003994882572442293, 0.014573118649423122, 0.012912522070109844, -0.012279583141207695, 0.018817182630300522, 0.03146142140030861, 0.07834377139806747, -0.008561994880437851, -0.01659470796585083, -0.05286663770675659, 0.0027741880621761084, -0.034997303038835526, 0.0053205667063593864, 0.010561413131654263, 0.0085616959258914, -0.0035971347242593765, -0.0015831075143069029, -0.009005308151245117, -0.048287056386470795, 0.004890912212431431, 0.026813818141818047, 0.026345277205109596, -0.0006931053940206766, 0.010354622267186642, 0.019263701513409615, 0.024115048348903656, 0.01194714941084385, -0.01678263396024704, -0.015204211696982384, 0.06840053200721741, 0.008601773530244827, 0.0004770112282130867, -0.005290314555168152, 0.0032085261773318052, -0.02952755056321621, 0.007165166083723307, 0.021820269525051117, 0.0102723129093647, -0.08240171521902084, -0.02117997594177723, -0.019931064918637276, -0.024073420092463493, 0.022196417674422264, -0.015100933611392975, 0.01935492269694805, -0.01339629851281643, -0.014082798734307289, 0.00459503848105669, 0.012805044651031494, 0.031681302934885025, 0.015920531004667282, 0.02093074657022953, 0.016940196976065636, -0.0027065174654126167, 0.009188997559249401, -0.012575737200677395, 0.009288221597671509, 0.06714307516813278, -0.039139483124017715, 0.033756837248802185, 0.01187205035239458, -0.011333365924656391, 0.025565247982740402, 0.002525423187762499, 0.006024176720529795, 0.011799858883023262, 0.03810008987784386, -0.031083201989531517, 0.022510463371872902, 0.011791610158979893, -0.04370812326669693, 0.02050439640879631, -0.0355495847761631, -0.00795675627887249, 0.04947132244706154, 0.04904521256685257, 0.02181396633386612, 0.026577357202768326, 0.003930511884391308, 0.00854459684342146, 0.020990854129195213, -0.013307549990713596, 0.03725341707468033, 0.0016791248926892877, -0.021160945296287537, 0.026239322498440742, 0.00548740616068244, -0.020904317498207092, 0.0006739881937392056, 0.004948233719915152, -0.010358856990933418, 0.046588100492954254, -0.004816139116883278, 0.002123939571902156, 0.02429380640387535, 0.031118154525756836, -0.0005549654015339911, -0.048940736800432205, -0.04438834637403488, 0.04497545585036278, -0.00040936737786978483, -0.050111912190914154, -0.015896134078502655, 0.048616040498018265, -0.007183065637946129, 0.005560982506722212, 0.03720278665423393, 0.008161001838743687, 0.012753540650010109, 0.02828434854745865, 0.0028444023337215185, 0.0014111915370449424, -0.0513790138065815, 0.011856808327138424, -0.012707867659628391, -0.03336558863520622, 0.05039002001285553, 0.04064149037003517, -0.01673879474401474, -0.0141832260414958, -0.04425215721130371, -0.04092288389801979, 0.03194553405046463, -0.013212169520556927, 0.011141250841319561, -0.09799540042877197, 0.01509817410260439, 0.03137972205877304, 0.03933163732290268, -0.050697505474090576, -0.027173558250069618, -0.012324762530624866, -0.005044074729084969, -0.001964385388419032, 0.00399950472638011, 0.04425273835659027, -0.034138455986976624, -0.017290862277150154, 0.013543620705604553, -0.03241855278611183, 0.012360118329524994, -0.044424280524253845, -0.006958699785172939, 0.024424437433481216, -0.029118336737155914, -0.04461454972624779, 0.021336086094379425, -0.0160021111369133, 0.019602064043283463, -0.015994705259799957, -0.0178094282746315, -0.003982908558100462, 0.014502444304525852, 0.05221714451909065, 0.0015174970030784607, -0.033696841448545456, -0.001982372719794512, 0.02989649772644043, 0.024568304419517517, 0.026591619476675987, 0.018474025651812553, -0.06969482451677322, 0.01202384103089571, -0.02294895425438881, 0.02580450102686882, 0.06715996563434601, 0.04516054689884186, -0.06710636615753174, -0.013145594857633114, -0.01720639504492283, 0.022522762417793274, 0.006882888730615377, 0.027112318202853203, 0.003550006076693535, -0.022858424112200737, 0.014603394083678722, 0.02685125544667244, 0.017353752627968788, -0.023138955235481262, -0.024557199329137802, 0.03983562812209129, -0.0031863348558545113, 0.0037212201859802008, -0.02294248156249523, -0.04944411665201187, -0.0136845288798213, -0.0018406403250992298, 0.011522828601300716, -0.008890582248568535, 0.012068468146026134, -0.02405180223286152, 0.01983785629272461, 0.02249663695693016, 0.006989339366555214, -0.002544069429859519, 0.022818496450781822, 0.030219299718737602, 0.044722218066453934, -0.012661407701671124, 0.02069348841905594, -0.010091300122439861, -0.004997691605240107, 0.057943277060985565, 0.036785468459129333, -0.014006772078573704, -0.036862779408693314, 0.00023403821978718042, 0.025621749460697174, -0.022595960646867752, -0.0003054523258469999, 0.03379063680768013, -0.00014968198956921697, 0.011073313653469086, 0.04651839658617973, 0.03698282316327095, 0.012250827625393867, -0.038187406957149506, 0.023004496470093727, -0.02406913787126541, -0.03948865830898285, 0.0037302770651876926, -0.004014088772237301, 0.0026117439847439528, 0.0023961279075592756, 0.050636257976293564, 0.05542057007551193, -0.011735012754797935, 0.0008339024498127401, 0.0016514406306669116, -0.035928357392549515, 0.00430443836376071, -0.037240978330373764, -0.02441183663904667, -0.011549942195415497, 0.040924474596977234, 0.027984216809272766, -0.03496344015002251, -0.02028810977935791, 0.0126658258959651, 0.05225091055035591, -0.0227709598839283, -0.008516794070601463, 0.04572540894150734, -0.02038116566836834, 0.0029518280643969774, -0.0315789133310318, 0.0005934860673733056, -0.043645601719617844, 0.017064696177840233, 0.005455643869936466, 0.0018784793792292476, -0.01207350380718708, -0.012472139671444893, -0.022515293210744858, -0.011440657079219818, 0.037648119032382965, -0.003986003343015909, 0.038810890167951584, -0.03845721110701561, -0.0011604286264628172, 0.001525995903648436, 0.03235015273094177, 0.04330335557460785, -0.04541410505771637, 0.010948503389954567, 0.002927925903350115, -0.005616048816591501, -0.011189291253685951, 0.02616608887910843, -0.011931471526622772, 0.0023859061766415834, 0.016090039163827896, 0.012935804203152657, -0.0020193790551275015, -0.03075314685702324, 0.022388717159628868, 0.02684476599097252, -0.012327016331255436, 0.013157516717910767, -0.0393701046705246, -0.006480263080447912, -0.011485659517347813, -0.03366407752037048, 0.02686889097094536, 0.05231648311018944, -0.020122895017266273, -0.00662589306011796, 0.009086649864912033, 0.006240211892873049, 0.023526152595877647, 0.00728242052718997, 0.03290826082229614, 0.01928914338350296, 0.03032737784087658, 0.001204883330501616, 0.012738672085106373, -0.016749946400523186, -0.011717346496880054, -0.016899406909942627, -0.037382833659648895, 0.04380781203508377, 0.025677943602204323, -0.008304106071591377, -0.010346432216465473, -0.007296406663954258, -0.025912240147590637, 0.0005838971119374037, 0.05335841327905655, 0.04338515177369118, 0.016452299430966377, 0.013496453873813152, -0.017224999144673347, -0.014075013808906078, -0.02489621192216873, 0.021122658625245094, 0.04960397630929947, -0.053430479019880295, -0.0055412002839148045, -0.022040875628590584, 0.038288407027721405, 0.03807293251156807, 0.022527530789375305, 0.04214359447360039, -0.03313059359788895, 0.06843757629394531, -0.02709558606147766, 0.02873269096016884, 0.04017053544521332, -0.0353890098631382, -0.01986715942621231, -0.03480597212910652, -0.01893913745880127, -0.023434575647115707, 0.010489426553249359, 0.032297421246767044, 0.009682518430054188, 0.00943105947226286, -0.008038859814405441, 0.061842598021030426, 0.04199765622615814, 0.04159516096115112, 0.0017609791830182076, 0.034771692007780075, 0.04699051007628441, -0.0009713495965115726, -0.012594026513397694, 0.02757917158305645, 0.017129987478256226, -0.04352642968297005, 0.036728911101818085, 0.008862492628395557, 0.047107499092817307, 0.022727370262145996, -0.025738203898072243, -0.01258806325495243, 0.006325391121208668, 0.01247642282396555, 0.008046925999224186, -0.020475780591368675, -0.029921511188149452, 0.0026602488942444324, -0.009158557280898094, -0.04879525303840637, 0.04270771145820618, -0.037843815982341766, 0.022551804780960083, -0.04463724419474602, 0.010618343949317932, 0.04975501075387001, 0.02319781668484211, 0.00973005685955286, -0.06538665294647217, -0.0021060886792838573, 0.005610146559774876, 0.014127342961728573, 0.03097766451537609, -0.00018425818416289985, -0.043103791773319244, -0.015289279632270336, -0.03502843901515007, -0.04418081045150757, 0.0042211455292999744, -0.05437507480382919, -0.027422694489359856, -0.02185511589050293, 0.013743547722697258, 0.004832499660551548, 0.0394163578748703, 0.01183504331856966, 0.04101386293768883, -0.025896016508340836, 0.015220475383102894, 0.009148512966930866, -0.0368620865046978, 0.007967732846736908, -0.06467907130718231, 0.011350983753800392, -0.01821119152009487, -0.005365258082747459, 0.028433723375201225, 0.04590996354818344, 0.015158411115407944, -0.017591329291462898, -0.037873271852731705, 0.011505677364766598, -0.04427707567811012, 0.05230730026960373, 0.0023051868192851543, -0.03483987972140312, 0.004062694497406483, -0.031409237533807755, -0.000462035444797948, 0.013557873666286469, 0.01745712012052536, 0.04225438833236694, -0.009821097366511822, -0.0005378518835641444, -0.0017056606011465192, 0.0461457334458828, -0.0037684054113924503, -0.009241096675395966, 0.0011407765559852123, 0.033802472054958344, -0.012294646352529526, -0.019955582916736603, 0.005519545637071133, -0.03473425284028053, -0.02305198647081852, -0.05486803501844406, -0.02732996828854084, -0.03444666787981987, 0.014662572182714939, -0.020127320662140846, 0.0568867102265358, -0.047170240432024, 0.00829129945486784, -0.03557033836841583, -0.012115973979234695, -0.0009141198243014514, -0.005889181047677994, 0.02016603574156761, 0.046832356601953506, 0.023484231904149055, 0.017975475639104843, -0.026707245036959648, 0.059471845626831055, 0.0007338548311963677, 0.04636859521269798, 0.08550387620925903, 0.00824243389070034, 0.003549261251464486, -0.04645494744181633, -0.013815800659358501, -0.008053794503211975, -0.08844752609729767, 0.014607930555939674, 0.014184034429490566, -0.005831767339259386, -0.022178662940859795, 0.04015976935625076, 0.018271390348672867, 0.022956831380724907, 0.015167000703513622, -0.006858368404209614, -0.030957555398344994, 0.003858489217236638, 0.005172867327928543, -0.05103912949562073, 0.01782495714724064, -0.033390674740076065, -0.00696633942425251, 0.013232632540166378, 0.009762637317180634, 0.041854377835989, -0.03181229159235954, 0.005838069133460522, -0.0023650608491152525, -0.0034610657021403313, -0.033146023750305176, -0.03460033982992172, 0.029648564755916595, 0.041527148336172104, -0.012976386584341526, -0.023977698758244514, 0.008785192854702473, -0.016028694808483124, -0.018748588860034943, -0.001966847339645028, -0.06617297977209091, -0.019306035712361336, -0.03684466704726219, 0.008118047378957272, 0.025022095069289207, 0.04145747795701027, 0.01375915203243494, -0.004433710128068924, -0.005971693433821201, -0.005422390066087246 ]
The Partnership: Amazon SageMaker and Hugging Face
philschmid
March 23, 2021
the-partnership-amazon-sagemaker-and-hugging-face
partnerships, aws
https://huggingface.co/blog/the-partnership-amazon-sagemaker-and-hugging-face
Create the training script train.py In a SageMaker TrainingJob we are executing a python script with named arguments. In this example, we use PyTorch together with transformers. The script will - pass the incoming parameters (hyperparameters from HuggingFace Estimator) - load our dataset - define our compute metrics function - set up our Trainer - run training with trainer.train() - evaluate the training and save our model at the end to S3. bash from transformers import AutoModelForSequenceClassification, Trainer, TrainingArguments from sklearn.metrics import accuracy_score, precision_recall_fscore_support from datasets import load_from_disk import random import logging import sys import argparse import os import torch if __name__ == "__main__": parser = argparse.ArgumentParser() # hyperparameters sent by the client are passed as command-line arguments to the script. parser.add_argument("--epochs", type=int, default=3) parser.add_argument("--train-batch-size", type=int, default=32) parser.add_argument("--eval-batch-size", type=int, default=64) parser.add_argument("--warmup_steps", type=int, default=500) parser.add_argument("--model_name", type=str) parser.add_argument("--learning_rate", type=str, default=5e-5) # Data, model, and output directories parser.add_argument("--output-data-dir", type=str, default=os.environ["SM_OUTPUT_DATA_DIR"]) parser.add_argument("--model-dir", type=str, default=os.environ["SM_MODEL_DIR"]) parser.add_argument("--n_gpus", type=str, default=os.environ["SM_NUM_GPUS"]) parser.add_argument("--training_dir", type=str, default=os.environ["SM_CHANNEL_TRAIN"]) parser.add_argument("--test_dir", type=str, default=os.environ["SM_CHANNEL_TEST"]) args, _ = parser.parse_known_args() # Set up logging logger = logging.getLogger(__name__) logging.basicConfig( level=logging.getLevelName("INFO"), handlers=[logging.StreamHandler(sys.stdout)], format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", ) # load datasets train_dataset = load_from_disk(args.training_dir) test_dataset = load_from_disk(args.test_dir) logger.info(f" loaded train_dataset length is: {len(train_dataset)}") logger.info(f" loaded test_dataset length is: {len(test_dataset)}") # compute metrics function for binary classification def compute_metrics(pred): labels = pred.label_ids preds = pred.predictions.argmax(-1) precision, recall, f1, _ = precision_recall_fscore_support(labels, preds, average="binary") acc = accuracy_score(labels, preds) return {"accuracy": acc, "f1": f1, "precision": precision, "recall": recall} # download model from model hub model = AutoModelForSequenceClassification.from_pretrained(args.model_name) # define training args training_args = TrainingArguments( output_dir=args.model_dir, num_train_epochs=args.epochs, per_device_train_batch_size=args.train_batch_size, per_device_eval_batch_size=args.eval_batch_size, warmup_steps=args.warmup_steps, evaluation_strategy="epoch", logging_dir=f"{args.output_data_dir}/logs", learning_rate=float(args.learning_rate), ) # create Trainer instance trainer = Trainer( model=model, args=training_args, compute_metrics=compute_metrics, train_dataset=train_dataset, eval_dataset=test_dataset, ) # train model trainer.train() # evaluate model eval_result = trainer.evaluate(eval_dataset=test_dataset) # writes eval result to file which can be accessed later in s3 output with open(os.path.join(args.output_data_dir, "eval_results.txt"), "w") as writer: print(f"***** Eval results *****") for key, value in sorted(eval_result.items()): writer.write(f"{key} = {value}\\n") # Saves the model to s3; default is /opt/ml/model which SageMaker sends to S3 trainer.save_model(args.model_dir)
[ 0.014826660044491291, 0.06452406197786331, -0.05549273639917374, -0.0022707602474838495, 0.012423703446984291, 0.08940498530864716, 0.003996595740318298, 0.005758076906204224, -0.01713847555220127, 0.04021627828478813, -0.05589257925748825, 0.06669369339942932, -0.013901813887059689, 0.08714981377124786, 0.003070106264203787, -0.06737460941076279, 0.010185277089476585, 0.019530177116394043, -0.047158170491456985, 0.006883955094963312, -0.02321682684123516, -0.01239773165434599, 0.008416381664574146, 0.02726949192583561, 0.0036708335392177105, -0.003062985837459564, 0.0018705080728977919, -0.018692949786782265, -0.018362846225500107, 0.04927720129489899, -0.10554030537605286, -0.023867513984441757, -0.012499880976974964, -0.04609011486172676, 0.017180638387799263, 0.053885262459516525, -0.11987123638391495, 0.017463037744164467, 0.06704789400100708, -0.04388249292969704, -0.01969681866466999, -0.009907722473144531, -0.03938701003789902, 0.012100262567400932, 0.006212268490344286, -0.07421272248029709, -0.11823224276304245, 0.016197971999645233, -0.0027972739189863205, -0.04094221442937851, -0.0705372542142868, 0.10453376173973083, -0.0034302689600735903, -0.013903987593948841, -0.02206023782491684, 0.04379814863204956, 0.06047990545630455, -0.034472472965717316, -0.026279786601662636, -0.0036784657277166843, -0.01747153140604496, 0.011825348250567913, -0.034998465329408646, 0.07190456986427307, 0.03414662927389145, -0.003094107611104846, -0.020325293764472008, 0.012685687281191349, -0.047111403197050095, -0.041985686868429184, 0.007455776445567608, -0.04519939050078392, -0.01660018600523472, -0.0016725745517760515, -0.050801534205675125, -0.05509541556239128, 0.04467906802892685, -0.0016053183935582638, 0.012285210192203522, 0.12274967133998871, -0.044937945902347565, 0.009275462478399277, -0.03022083267569542, 0.019555069506168365, 0.038726408034563065, 0.02157995104789734, -0.0105189960449934, -0.07794582098722458, -0.03115459345281124, 0.023942001163959503, 0.013369821943342686, -0.05688526853919029, 0.000765659031458199, 0.046872783452272415, 0.06188489496707916, -0.01712384819984436, -0.016945259645581245, 0.006453962065279484, -0.00878950860351324, -0.028304273262619972, 0.02802170440554619, -0.08136823028326035, 0.02713828906416893, -0.033361393958330154, -0.026266630738973618, 0.1029498428106308, 0.0226474329829216, -0.07924225926399231, -0.007911166176199913, -0.002221360569819808, 0.020929884165525436, -0.034344762563705444, -0.01980569213628769, 0.07336803525686264, -0.043189115822315216, 0.006994493771344423, -0.03653820604085922, -0.034551747143268585, -0.03525356948375702, -0.04400608688592911, 0.01020082924515009, 0.06709953397512436, 0.03244616091251373, 0.04046981781721115, -0.06844977289438248, 0.06827452033758163, 0.07076587527990341, 0.006839521694928408, 0.051803771406412125, -0.02956407330930233, 0.03139260783791542, -0.021239127963781357, 0.08925516903400421, 0.024271579459309578, 0.025142045691609383, -0.04488109052181244, -0.026835063472390175, -0.04494063928723335, -0.01441273558884859, 0.06808014214038849, 0.018879620358347893, 0.12217096984386444, 0.021526580676436424, 0.017570223659276962, 0.03900649771094322, 0.0017499789828434587, 0.010851440019905567, 0.06082506850361824, 0.020686985924839973, 0.04144330695271492, -0.09250476956367493, 0.10082679241895676, 0.005478524602949619, -0.07251284271478653, 0.02261432446539402, 0.08513142168521881, -0.03981267288327217, 0.0025946260429918766, -0.06658516079187393, -0.022102495655417442, 0.020856428891420364, 0.04358948767185211, -0.06263694912195206, -0.0018846362363547087, -0.03321852162480354, -0.038614388555288315, 0.02088726870715618, -0.025923073291778564, 0.04872792959213257, -0.004764355719089508, 0.008452325128018856, -0.04010535031557083, 0.040943071246147156, 0.0029600828420370817, 0.05278343707323074, 0.027516795322299004, 0.02058211900293827, 0.08643653243780136, 0.0015115237329155207, -0.02514895610511303, -0.04526880383491516, 0.0612151063978672, -0.031596407294273376, 0.020416485145688057, 0.07102120667695999, -0.07942656427621841, 0.012786979787051678, -0.06463297456502914, 0.033011544495821, 0.046969130635261536, -0.02458365075290203, -0.012219169177114964, 0.05405113101005554, -0.001797705888748169, 0.06904936581850052, -0.055680181831121445, -0.013481687754392624, 0.10360034555196762, 0.047316692769527435, 0.05252794176340103, -0.017056172713637352, -0.003958538174629211, -0.012768939137458801, 0.01221259031444788, 0.022439589723944664, 0.09951937198638916, -0.025173969566822052, -0.06818576157093048, 0.06187603995203972, 0.015873786062002182, -0.011952477507293224, -0.07168487459421158, 0.06382196396589279, -0.060700587928295135, -0.0016827989602461457, 0.025373851880431175, -0.04390442371368408, -0.062408287078142166, 0.010741843841969967, 0.060185082256793976, 0.09799742698669434, -0.02725742757320404, 0.004329387564212084, -0.052266038954257965, -0.01722565107047558, 0.012360445223748684, 0.05427565798163414, 0.08601029217243195, 0.05102081969380379, -0.1376078873872757, -0.033670514822006226, -0.07666617631912231, -0.026397516950964928, 0.07535451650619507, -0.012811601161956787, -0.03379117324948311, 0.03332686424255371, 0.002265304559841752, -0.04178641736507416, -0.015291434712707996, 0.06159154698252678, 0.024357926100492477, -0.012486238032579422, 0.02944260835647583, -0.04219371825456619, -0.013289960101246834, 0.08421009033918381, -0.02650507353246212, -0.003386284224689007, -0.0043631321750581264, -0.0608033612370491, 0.05475777015089989, 0.03680849075317383, -0.035271789878606796, 0.016605854034423828, 0.013353893533349037, -0.03211398422718048, -0.03509358689188957, 0.02052527479827404, 0.05475015193223953, 0.007636501453816891, 0.06751924753189087, -0.04239220917224884, -0.0028485117945820093, -0.0063063157722353935, -0.04401405155658722, 0.025099216029047966, -0.019670676440000534, -0.009457485750317574, -0.020215604454278946, 0.008440578356385231, 0.0023007430136203766, 0.009098791517317295, 0.007192114368081093, 0.00783874187618494, 0.031242232769727707, 0.032885726541280746, 0.005466424394398928, -0.020423678681254387, -0.012430991977453232, -0.003644014010205865, -0.027349568903446198, -0.05241074785590172, 0.02754317969083786, -0.012376591563224792, -0.015096630901098251, 0.007796042133122683, -0.011326146312057972, -0.023285403847694397, 0.018960922956466675, -0.004337160848081112, 0.057227134704589844, 0.027197645977139473, 0.001586036174558103, -0.013199275359511375, 0.019811179488897324, -0.009342827834188938, -0.04639533907175064, 0.017329780384898186, 0.07312269508838654, -0.002867824165150523, 0.012993698008358479, -0.0015001241117715836, -0.0072204722091555595, -0.042039304971694946, -0.0307785551995039, -0.0048781493678689, 0.020061969757080078, -0.08419357240200043, 0.008703639730811119, -0.03717648237943649, -0.03319313004612923, 0.04575932398438454, -0.021406741812825203, 0.0354347862303257, -0.018180374056100845, -0.006895418278872967, 0.01915794052183628, -0.03838451951742172, 0.028273986652493477, -0.01464140135794878, 0.008727340027689934, 0.02311042696237564, 0.008712487295269966, -0.02150837332010269, -0.002406548708677292, 0.00033396482467651367, 0.02392389066517353, -0.019441165030002594, 0.03931937366724014, 0.00694272993132472, -0.021685020998120308, -0.009407821111381054, 0.04332605376839638, 0.03703716769814491, 0.03586343303322792, 0.015032418072223663, -0.042045675218105316, -0.01154404692351818, -0.027225783094763756, 0.008296065032482147, 0.0046272133477032185, -0.027764685451984406, -0.023603681474924088, 0.03168970346450806, 0.012854804284870625, 0.023941753432154655, -0.006488173268735409, -0.004616203717887402, -0.0062342057935893536, 0.011530330404639244, -0.0027591646648943424, 0.020613236352801323, 0.004684400744736195, -0.02867494709789753, -0.02425912395119667, 0.0071541196666657925, -0.03519641235470772, -0.012041553854942322, 0.0038369200192391872, 0.0009039356955327094, 0.01810222677886486, 0.004541049245744944, 0.007840999402105808, 0.024274524301290512, 0.05733997002243996, 0.04402513802051544, -0.02976512908935547, -0.03911888226866722, 0.02912016771733761, -0.008696489036083221, -0.028793547302484512, -0.002540366956964135, 0.019239302724599838, 0.0018910795915871859, -0.0015621194615960121, 0.0023514563217759132, 0.041114065796136856, -0.006171054672449827, 0.008526780642569065, -0.02979421056807041, 0.015487691387534142, -0.06538102775812149, -0.01720641739666462, -0.05216528847813606, -0.04658456891775131, 0.058224309235811234, 0.035087838768959045, -0.001543056801892817, -0.01413768995553255, -0.01691160723567009, -0.042845480144023895, 0.010223617777228355, 0.028806276619434357, -0.0014940450200811028, -0.07166241109371185, 0.07189524918794632, 0.04187546670436859, 0.015263860113918781, -0.04172750189900398, 0.005869194865226746, 0.0184120275080204, -0.0487200953066349, -0.042445480823516846, 0.014548178762197495, -0.02847336418926716, -0.029139036312699318, 0.008199344389140606, -0.004677295219153166, -0.04600772634148598, 0.006555119529366493, -0.009348484687507153, -0.03037199378013611, -0.0040678055956959724, -0.019411830231547356, -0.03489072993397713, -0.004485064651817083, -0.009174213744699955, 0.027608752250671387, -0.005445673130452633, -0.0012342113768681884, -0.02835540845990181, 0.018407292664051056, 0.08653353899717331, -0.026764580979943275, -0.02984049543738365, 0.0298788920044899, 0.059943266212940216, -0.05949384719133377, 0.008400140330195427, -0.011317132972180843, -0.01681736670434475, 0.013732844032347202, -0.019373247399926186, 0.04451536759734154, 0.05200823396444321, -0.005558825563639402, -0.04343317076563835, -0.04483263939619064, 0.019250648096203804, -0.0015847822651267052, 0.008488927036523819, 0.011072414927184582, 0.019511230289936066, -0.017285721376538277, 0.020852867513895035, 0.03200676292181015, 0.0042097438126802444, -0.06833752244710922, 0.027560291811823845, -0.003957109525799751, -0.03327806293964386, 0.008916166611015797, 0.016642121598124504, -0.06766817718744278, -0.004026349633932114, -0.018848497420549393, 0.04033709689974785, 0.0049301693215966225, -0.0056782071478664875, -0.040087200701236725, -0.018879922106862068, 0.037824973464012146, -0.015339024364948273, -0.006832235027104616, -0.009618938900530338, 0.028714917600154877, 0.05201733112335205, -0.013292839750647545, -0.015403829514980316, -0.0069252257235348225, 0.010830724611878395, 0.005818622186779976, 0.041618891060352325, -0.026012513786554337, -0.051635824143886566, 0.010517962276935577, 0.02713567204773426, -0.019028672948479652, -0.006747087929397821, 0.01822296343743801, -0.047470077872276306, 0.018081944435834885, 0.041046928614377975, 0.051666684448719025, 0.015890898182988167, -0.08397528529167175, 0.0040319496765732765, 0.009590545669198036, -0.048309244215488434, -0.013202868402004242, -0.04867194965481758, -0.03232019767165184, -0.005671246442943811, 0.04234955459833145, 0.018699467182159424, 0.00927452277392149, 0.02658814564347267, 0.0033348449505865574, -0.008382558822631836, 0.04988417029380798, -0.06676476448774338, -0.023487288504838943, 0.019523780792951584, -0.00007939875649753958, 0.010693292133510113, -0.0009858962148427963, -0.018823450431227684, 0.049939271062612534, 0.028355753049254417, 0.005090440157800913, -0.0420699380338192, 0.02295224741101265, -0.0008500392432324588, -0.03220176696777344, -0.0025707960594445467, 0.012922113761305809, -0.00039682662463746965, 0.018650585785508156, 0.013831878080964088, 0.01353107113391161, -0.012525186873972416, -0.01600317284464836, -0.002937095472589135, 0.014706444926559925, 0.03443200886249542, 0.0060268291272223, 0.003568529151380062, -0.029829729348421097, -0.0028095159213989973, 0.023661306127905846, -0.005513749085366726, 0.049352504312992096, -0.0321071594953537, 0.016357742249965668, 0.022428039461374283, 0.022107478231191635, 0.029816754162311554, 0.016289373859763145, 0.008200504817068577, -0.02048974484205246, -0.0009881800506263971, -0.005820297170430422, -0.035632338374853134, -0.023247668519616127, 0.07948924601078033, 0.02964882366359234, -0.04678377881646156, -0.019276002421975136, 0.027764813974499702, -0.00008407833229284734, 0.02571152336895466, -0.022534994408488274, 0.03202600032091141, 0.05564875528216362, -0.013706719502806664, -0.004918125458061695, 0.008684247732162476, -0.007698639761656523, 0.030300723388791084, 0.02329033613204956, -0.0005001190584152937, 0.004340726882219315, -0.0011483854614198208, -0.011737924069166183, 0.010266788303852081, 0.007375919725745916, 0.0007688603363931179, 0.02651204913854599, -0.06175459176301956, 0.006756300572305918, 0.004623608663678169, -0.00865870900452137, 0.008337904699146748, 0.008798345923423767, -0.025613123551011086, 0.008629107847809792, -0.016429292038083076, 0.0496438592672348, 0.04012114554643631, -0.012392394244670868, 0.024261051788926125, 0.040977269411087036, 0.001130651799030602, 0.004045996814966202, 0.055309537798166275, -0.035983942449092865, 0.021349158138036728, -0.012370864860713482, 0.026361070573329926, 0.03028498962521553, 0.026693595573306084, 0.016987435519695282, -0.04859716072678566, 0.08373507857322693, 0.004931694362312555, -0.0036241249181330204, 0.04032546654343605, 0.004654287360608578, -0.026462003588676453, -0.038229797035455704, -0.009631344117224216, -0.02524649165570736, 0.0015078909927979112, 0.040733374655246735, -0.011631865985691547, 0.001823925063945353, -0.002398061566054821, 0.062389735132455826, 0.04776462912559509, 0.03991258516907692, 0.029468119144439697, 0.014348911121487617, 0.08098404109477997, -0.012292793951928616, -0.025303514674305916, 0.040441494435071945, 0.004306836053729057, -0.01130069699138403, 0.006134657189249992, 0.030916864052414894, -0.005799117498099804, 0.027910280972719193, 0.008022438734769821, 0.01343264989554882, -0.030210629105567932, -0.014715592376887798, 0.037205759435892105, 0.01626438833773136, -0.011411715298891068, -0.03610469400882721, -0.0204935260117054, -0.01008241344243288, 0.03039836511015892, -0.046642642468214035, -0.000358622899511829, -0.015131334774196148, -0.02564275823533535, -0.05448093265295029, 0.0028435864951461554, 0.011207325384020805, -0.05997500941157341, -0.026435384526848793, 0.010283228009939194, 0.013790782541036606, 0.04793712869286537, -0.01855447143316269, -0.055744320154190063, -0.009826871566474438, -0.017224013805389404, -0.014089120551943779, 0.009130816906690598, -0.016419939696788788, -0.017032260075211525, 0.022950422018766403, -0.005178546998649836, -0.008105508051812649, 0.03645205870270729, 0.018429270014166832, 0.035924818366765976, -0.032793886959552765, 0.025813307613134384, -0.021939702332019806, -0.03827492147684097, 0.06211485713720322, -0.016202565282583237, 0.05569186061620712, 0.00990946777164936, 0.03951238468289375, -0.008180384524166584, 0.019386596977710724, 0.0018176853191107512, -0.013583502732217312, -0.0009080138988792896, 0.019056471064686775, -0.03326297923922539, 0.06991741061210632, -0.015449808910489082, -0.007063433062285185, 0.03590787947177887, -0.024970903992652893, -0.013172786682844162, -0.00769377825781703, -0.04005234315991402, 0.04472638666629791, -0.02034912258386612, 0.02678772620856762, 0.00022358624846674502, 0.033667292445898056, -0.008764239028096199, 0.014620985835790634, -0.005372151732444763, -0.0012699757935479283, 0.017643995583057404, -0.007948578335344791, -0.009255761280655861, -0.058496709913015366, -0.014610454440116882, -0.023205971345305443, -0.08742544054985046, -0.03407556936144829, -0.02136601321399212, -0.04568858817219734, 0.04871699586510658, -0.06597355753183365, 0.01231412123888731, -0.026453809812664986, -0.007317211478948593, -0.023456934839487076, 0.02555830590426922, 0.04574943333864212, 0.04369499906897545, 0.023172108456492424, -0.01088040228933096, -0.06527218222618103, -0.0025171588640660048, 0.01904197409749031, -0.00627400865778327, 0.06242360547184944, 0.03148409351706505, -0.0017225883202627301, 0.0002123093290720135, 0.04024507477879524, -0.011848934926092625, -0.03849892318248749, -0.021780647337436676, 0.0012942398898303509, -0.005687804892659187, -0.027543924748897552, 0.009974964894354343, 0.03012371063232422, -0.01634257659316063, 0.034235306084156036, -0.019771462306380272, -0.024489354342222214, -0.022402318194508553, 0.04632505401968956, -0.055349066853523254, 0.050292883068323135, -0.03299630060791969, -0.04753045365214348, 0.015728453174233437, 0.024541713297367096, 0.0306563563644886, -0.010437151417136192, -0.022743472829461098, -0.008189104497432709, -0.015035299584269524, -0.03162923455238342, -0.06133846566081047, 0.00002891558142437134, 0.024364812299609184, -0.023404864594340324, -0.000040314866055268794, -0.0342567153275013, -0.04588058963418007, -0.0035725447814911604, 0.01918134093284607, -0.006061952095478773, -0.02277003973722458, -0.012879735790193081, 0.016982007771730423, -0.004950871225446463, 0.014079551212489605, 0.021821780130267143, -0.017511826008558273, -0.019509118050336838, 0.016505440697073936 ]
The Partnership: Amazon SageMaker and Hugging Face
philschmid
March 23, 2021
the-partnership-amazon-sagemaker-and-hugging-face
partnerships, aws
https://huggingface.co/blog/the-partnership-amazon-sagemaker-and-hugging-face
Built-in Performance With the Hugging Face DLCs, SageMaker customers will benefit from built-in performance optimizations for PyTorch or TensorFlow, to train NLP models faster, and with the flexibility to choose the training infrastructure with the best price/performance ratio for your workload. The Hugging Face DLCs are fully integrated with the SageMaker distributed training libraries, to train models faster than was ever possible before, using the latest generation of instances available on Amazon EC2. ---
[ 0.0028425976634025574, 0.027372682467103004, -0.004318482242524624, 0.02818608097732067, -0.06207043677568436, 0.014186669141054153, -0.03355772793292999, 0.04275944083929062, -0.04816236346960068, -0.018369654193520546, -0.02570277452468872, 0.07114031165838242, -0.026624111458659172, 0.06165541335940361, 0.01182151585817337, -0.049754466861486435, 0.027116643264889717, 0.02837112545967102, -0.03838164359331131, 0.06219293177127838, 0.053550153970718384, -0.03738876432180405, 0.031366780400276184, 0.057065729051828384, -0.05548112466931343, -0.0005924772121943533, -0.0028694134671241045, -0.06924732774496078, 0.003067216370254755, 0.0025072800926864147, -0.05914631485939026, -0.043319057673215866, 0.0004651603812817484, -0.025364702567458153, 0.008138926699757576, 0.04785744473338127, -0.15918797254562378, 0.0408477857708931, 0.019725054502487183, -0.01592506282031536, -0.021225471049547195, -0.014814249239861965, -0.10031396895647049, 0.01449945755302906, -0.014027124270796776, -0.00429145572707057, -0.05629345774650574, 0.024978039786219597, 0.022207213565707207, -0.01966986432671547, -0.12379905581474304, 0.08944681286811829, 0.019246498122811317, -0.008311477489769459, 0.02998335286974907, 0.009623817168176174, 0.01410499308258295, -0.0036623741034418344, -0.003941764123737812, -0.030749471858143806, -0.009911014698445797, -0.03651434928178787, -0.0048028999008238316, -0.000052346706070238724, -0.017068656161427498, 0.00033884565345942974, -0.020292315632104874, -0.06604616343975067, -0.054663050919771194, -0.03544657677412033, 0.0032108419109135866, -0.05875896289944649, -0.004482250660657883, -0.008829624392092228, -0.044678207486867905, -0.03312082961201668, -0.02253655716776848, -0.0853450745344162, 0.03504007309675217, 0.04767017811536789, -0.040121227502822876, 0.0695904791355133, 0.009617145173251629, 0.026760149747133255, 0.039772290736436844, 0.0510961189866066, 0.0014412145828828216, -0.12758763134479523, -0.05812384933233261, 0.04260477051138878, 0.0043493956327438354, -0.0355527326464653, 0.01870618388056755, 0.0005403452087193727, 0.07105608284473419, 0.0024071151856333017, 0.033915452659130096, -0.015187721699476242, -0.031140843406319618, -0.02954055368900299, 0.025587989017367363, -0.13269291818141937, -0.011776171624660492, -0.09620004892349243, -0.017471814528107643, 0.061029937118291855, -0.05446499586105347, -0.12728175520896912, 0.000634602562058717, 0.07372578978538513, 0.012210839428007603, -0.057688724249601364, 0.01609022542834282, 0.07365094125270844, -0.0995863750576973, 0.07543806731700897, -0.03247478976845741, 0.008410714566707611, 0.01895371451973915, -0.004269421100616455, 0.03409716486930847, 0.07254192233085632, 0.057442471385002136, -0.003100993810221553, -0.00871073268353939, 0.06523337215185165, 0.026897961273789406, 0.015274489298462868, 0.06715982407331467, -0.044026196002960205, 0.010779543779790401, -0.012190711684525013, 0.005185844376683235, 0.024195583537220955, -0.002982872072607279, -0.07957782596349716, -0.020548973232507706, -0.06866937130689621, -0.020821480080485344, 0.004944915417581797, -0.02006380818784237, 0.14561118185520172, 0.0008047270239330828, -0.0250412505120039, 0.042462874203920364, -0.015710704028606415, -0.04619184136390686, 0.03683028370141983, 0.016904212534427643, 0.0068657598458230495, -0.09593775868415833, 0.07020973414182663, -0.007911376655101776, -0.0694316104054451, 0.016456549987196922, 0.09187036007642746, -0.028944749385118484, -0.03649880737066269, -0.030553918331861496, -0.06244910880923271, -0.059979792684316635, -0.02387484349310398, -0.016865607351064682, -0.05735485255718231, 0.0301523320376873, -0.00317816948518157, 0.047800205647945404, 0.023775804787874222, 0.039508603513240814, -0.03826383128762245, 0.006699461489915848, -0.029214397072792053, 0.036810338497161865, -0.020208386704325676, 0.07910429686307907, 0.008912390097975731, 0.035505179315805435, 0.10905905812978745, -0.0028716507367789745, -0.02836628071963787, -0.029965640977025032, 0.05534985661506653, -0.034307949244976044, 0.002803424373269081, 0.06991297006607056, -0.0743703618645668, 0.0521542951464653, 0.012274038977921009, 0.05246814712882042, 0.0032040001824498177, 0.009489200077950954, 0.038002658635377884, 0.03311657905578613, 0.008387738838791847, 0.022374805063009262, -0.01048494502902031, -0.0131244957447052, 0.1018388569355011, 0.03379403427243233, 0.04137321189045906, 0.038691431283950806, -0.019418615847826004, 0.0012790332548320293, 0.06087898463010788, -0.0117707634344697, -0.009172026999294758, -0.053938694298267365, -0.034282341599464417, 0.02286791242659092, -0.0624171681702137, 0.02554740011692047, -0.13549135625362396, 0.036995600908994675, -0.02589460089802742, -0.0020706369541585445, -0.009663891978561878, -0.07080403715372086, 0.003396103158593178, 0.016446635127067566, 0.04735824838280678, 0.1611679643392563, 0.001906024175696075, 0.0018179590115323663, -0.05667940899729729, -0.03725344315171242, 0.006765415892004967, 0.05931483581662178, 0.0547824501991272, 0.08202578127384186, -0.04580732434988022, -0.05870486795902252, -0.0845165029168129, -0.0327434204518795, 0.029783859848976135, -0.007738746237009764, -0.02756594307720661, 0.044642623513936996, -0.011037870310246944, 0.03036523051559925, 0.026863768696784973, -0.005557287018746138, 0.019986309111118317, 0.00880902074277401, 0.037243328988552094, 0.08474365621805191, -0.015484843403100967, 0.005564740858972073, -0.01755506359040737, -0.024288564920425415, 0.006572561338543892, -0.09188736230134964, 0.058554187417030334, 0.02889997884631157, -0.016656242311000824, 0.023091450333595276, 0.018549315631389618, -0.028659023344516754, 0.013571816496551037, 0.015834631398320198, 0.07622665166854858, 0.008492178283631802, 0.01805540919303894, -0.06836733222007751, -0.018842237070202827, 0.003599642077460885, -0.06497392803430557, 0.004541236441582441, -0.0446702279150486, -0.001579653937369585, -0.023358607664704323, 0.03502797707915306, -0.0304067712277174, 0.011259234510362148, -0.021445224061608315, 0.0035664329770952463, 0.030341297388076782, 0.048013828694820404, -0.026924487203359604, -0.0267405416816473, -0.05488398298621178, 0.024883495643734932, -0.05303150787949562, 0.013073326088488102, 0.0553506463766098, -0.015134681016206741, 0.019082464277744293, -0.012465900741517544, -0.011474106460809708, -0.0715455636382103, 0.01663828268647194, 0.021254317834973335, 0.025441186502575874, 0.01903321035206318, -0.014438518323004246, -0.013264008797705173, 0.028661267831921577, -0.008024715818464756, -0.026344776153564453, -0.020926982164382935, 0.07068071514368057, -0.005852844566106796, -0.020888129249215126, 0.008172846399247646, 0.0010688320035114884, -0.002641157479956746, -0.01150057464838028, 0.03939858451485634, 0.021429620683193207, -0.07296521216630936, -0.03433341160416603, -0.057252924889326096, 0.005738347303122282, 0.019156942144036293, -0.025272665545344353, 0.010284553281962872, 0.005312042310833931, -0.008882783353328705, 0.00460954662412405, 0.02857120707631111, 0.028223682194948196, 0.013932745903730392, -0.0003192540898453444, -0.0029390291310846806, 0.02121051959693432, 0.0023442297242581844, -0.0011832576710730791, 0.021709129214286804, 0.040744584053754807, -0.015171955339610577, 0.03280487656593323, 0.008269797079265118, -0.04253631457686424, -0.0031820808071643114, 0.0176869947463274, 0.04406777396798134, -0.04828047752380371, 0.013517227955162525, 0.0070655327290296555, -0.026922600343823433, -0.03464839607477188, -0.006982642225921154, -0.014357754960656166, -0.017696594819426537, -0.006660215090960264, 0.0002772093575913459, 0.05388016253709793, 0.07060308754444122, 0.010007660835981369, 0.017991364002227783, -0.01566716842353344, 0.0341455340385437, 0.012824367731809616, 0.029620565474033356, -0.009984572418034077, -0.03239315003156662, 0.015451954677700996, 0.04568063095211983, -0.009954330511391163, -0.01904723048210144, -0.026781698688864708, 0.020697398111224174, 0.044319845736026764, -0.007861270569264889, -0.004444184247404337, 0.006839946378022432, 0.007261521182954311, -0.007537581957876682, -0.03122972883284092, -0.0302447322756052, 0.016390103846788406, 0.007200125139206648, -0.015005598776042461, -0.02824300341308117, 0.01902821846306324, -0.00006499532901216298, -0.02189975045621395, 0.010684880428016186, 0.010541527532041073, 0.017427658662199974, 0.024837443605065346, -0.04640456289052963, 0.0031536445021629333, -0.011882482096552849, -0.023809194564819336, 0.015335699543356895, -0.0031698625534772873, 0.039663467556238174, 0.03632707521319389, 0.02362532541155815, -0.025376208126544952, 0.01778385043144226, -0.02999112382531166, 0.006572087295353413, 0.0004634970973711461, 0.007200623396784067, -0.04595175012946129, 0.05174558609724045, 0.04464700445532799, 0.04074554890394211, -0.03536165878176689, 0.018209751695394516, -0.02320394292473793, -0.021024441346526146, -0.029943859204649925, 0.024704325944185257, 0.048032261431217194, -0.056948788464069366, -0.012791999615728855, 0.02818824164569378, -0.016135040670633316, 0.03460488095879555, -0.03064815141260624, -0.04065484181046486, 0.0024456013925373554, -0.008431372232735157, -0.013570868410170078, 0.03157702833414078, 0.015078715048730373, 0.030959224328398705, 0.003999053034931421, 0.013382554054260254, -0.011057207360863686, 0.03902633488178253, 0.06394807994365692, -0.007693611551076174, -0.007280606310814619, -0.006135672330856323, 0.06627757102251053, -0.016873009502887726, 0.05942021310329437, 0.00031726923771202564, -0.03984853997826576, 0.030804835259914398, -0.0061529166996479034, -0.013197877444326878, 0.029976587742567062, 0.024918440729379654, -0.04035249724984169, -0.013736305758357048, -0.01256337109953165, 0.03285418823361397, 0.006429331377148628, 0.039879877120256424, -0.05623709782958031, -0.05314046889543533, 0.02286408841609955, 0.009824050590395927, -0.00329300994053483, 0.005690678022801876, 0.01939624734222889, 0.04045235365629196, 0.00016771553782746196, 0.028469853103160858, -0.015042895451188087, -0.03466389700770378, 0.013754723593592644, -0.02618776261806488, 0.044135645031929016, 0.03140958771109581, -0.0008160732686519623, -0.04650801792740822, 0.009544075466692448, 0.06639843434095383, -0.011557606980204582, -0.008118660189211369, 0.03186652436852455, 0.051672592759132385, 0.0438692681491375, -0.024715863168239594, -0.001025569741614163, -0.012084653601050377, -0.005615876521915197, 0.03554624691605568, 0.020048879086971283, -0.017126595601439476, -0.0070243654772639275, -0.02211000770330429, 0.00905545148998499, 0.0007885876693762839, -0.01017045509070158, -0.03091689571738243, -0.006917127873748541, 0.004221022594720125, 0.040623392909765244, 0.05667496845126152, -0.0005924922879785299, -0.017255164682865143, 0.020761817693710327, -0.01219555176794529, -0.01398436538875103, -0.007013363763689995, 0.005747540388256311, -0.0017783846706151962, 0.032139457762241364, 0.034922271966934204, 0.0645039826631546, -0.0012192323338240385, 0.0026470401789993048, 0.016854288056492805, -0.026331527158617973, 0.05601451173424721, -0.06421472877264023, 0.01976560615003109, -0.004126678686589003, 0.0066698635928332806, 0.02797408029437065, -0.002347235567867756, -0.01794167421758175, 0.03539557009935379, -0.0036963920574635267, -0.008400434628129005, -0.03489592671394348, -0.00204869220033288, -0.004611752927303314, -0.002454017987474799, -0.002245913026854396, 0.006354717072099447, -0.0300915464758873, 0.04411214962601662, 0.01324564777314663, -0.015492680482566357, 0.0034956138115376234, -0.005083475727587938, -0.010845024138689041, -0.020313451066613197, 0.04206755757331848, 0.005892610177397728, -0.0039021773263812065, -0.02827330119907856, -0.010033594444394112, -0.007201348431408405, -0.022747725248336792, 0.00398798706009984, -0.032835885882377625, 0.002200641203671694, -0.016893161460757256, -0.018522195518016815, 0.022093867883086205, 0.010686889290809631, 0.0012524198973551393, -0.026507645845413208, -0.009692295454442501, 0.026274651288986206, -0.027678892016410828, 0.00794188678264618, 0.03674907609820366, 0.016494587063789368, -0.06203882768750191, -0.012534860521554947, -0.013692515902221203, -0.029025202617049217, -0.023643486201763153, -0.021321818232536316, 0.012938481755554676, 0.05015498772263527, 0.004820383619517088, 0.04489848017692566, -0.01570487953722477, 0.016189957037568092, -0.003321489319205284, 0.024085626006126404, -0.0043396842665970325, 0.02794276736676693, -0.0008072523633018136, -0.0005136742256581783, -0.00495388638228178, 0.0018692546291276813, -0.030708786100149155, -0.013404306024312973, -0.042352065443992615, 0.03443383425474167, 0.032712146639823914, -0.05592484027147293, 0.008548878133296967, 0.015156499110162258, -0.05338325724005699, 0.01459875050932169, 0.04085588455200195, -0.01755489967763424, 0.03715842217206955, 0.016970273107290268, 0.011795106343925, 0.0015037417178973556, 0.020809689536690712, -0.004141984041780233, 0.04817875102162361, -0.015149928629398346, -0.021324198693037033, -0.014515640214085579, 0.04969456046819687, 0.04217928647994995, 0.012698904611170292, 0.010594944469630718, -0.03071589395403862, 0.004678721074014902, -0.018094917759299278, 0.07170800864696503, 0.056351955980062485, -0.033490296453237534, -0.028714653104543686, -0.011983802542090416, 0.007404385134577751, -0.02246336080133915, -0.01930917426943779, 0.02026536874473095, -0.0071543301455676556, -0.004707763437181711, -0.0024294047616422176, 0.02958131767809391, 0.051018260419368744, 0.060458701103925705, 0.03446763753890991, -0.0024020099081099033, 0.034713663160800934, 0.015324682928621769, 0.00032087217550724745, 0.017337260767817497, -0.009504996240139008, 0.039738766849040985, 0.014027651399374008, 0.02220894768834114, 0.05156156048178673, -0.04027752950787544, -0.004049866460263729, 0.008841818198561668, -0.023490769788622856, 0.03279300779104233, 0.019330648705363274, -0.009603292681276798, -0.04674723744392395, -0.011099370196461678, 0.020345302298665047, -0.007365883328020573, 0.026331031695008278, -0.04553725942969322, 0.03410382941365242, -0.012969378381967545, 0.02431081421673298, 0.029522785916924477, 0.005877568386495113, 0.007002058904618025, -0.049458038061857224, 0.007692826446145773, 0.01078025996685028, 0.013778901658952236, 0.036745622754096985, -0.019757289439439774, -0.03810304403305054, 0.01823459006845951, -0.003945383243262768, -0.011613495647907257, 0.017373451963067055, -0.0019776038825511932, 0.01050439290702343, -0.00935409590601921, 0.034574028104543686, 0.007988406345248222, 0.027069268748164177, 0.005649670027196407, 0.015184768475592136, -0.04903333634138107, 0.002684704028069973, 0.013433403335511684, -0.03222303465008736, 0.03806295245885849, -0.04530669376254082, 0.06029164046049118, -0.015924403443932533, 0.04241757467389107, 0.021915430203080177, 0.034080538898706436, 0.004638096783310175, -0.018250640481710434, -0.006723371334373951, -0.01474300678819418, 0.0019375341944396496, 0.05359918251633644, 0.02376970835030079, -0.007819537073373795, 0.015493051148951054, -0.02662157639861107, -0.010476605035364628, 0.0010923875961452723, 0.013104335404932499, 0.06422552466392517, -0.04166907072067261, -0.012106635607779026, 0.0003264921251684427, 0.042915090918540955, 0.011013803072273731, -0.012681705877184868, 0.013997863046824932, 0.027032671496272087, -0.010978922247886658, -0.06265564262866974, -0.020034991204738617, -0.03316586837172508, -0.03305235505104065, -0.050747841596603394, -0.027935560792684555, -0.011961682699620724, 0.006073898170143366, -0.012108294293284416, 0.02090146206319332, -0.0454520545899868, 0.02438516356050968, -0.017699236050248146, -0.002895524026826024, 0.02725842408835888, 0.03177583962678909, 0.01859929785132408, 0.06124598905444145, 0.014676010236144066, -0.006597372703254223, -0.008568142540752888, 0.026090525090694427, -0.011853454634547234, 0.02656576782464981, 0.05584533512592316, -0.02593519166111946, -0.013711131177842617, -0.07075285911560059, -0.01881268434226513, 0.03350618854165077, -0.044984813779592514, 0.04081008955836296, -0.021586062386631966, 0.013282900676131248, -0.0044169039465487, -0.013719514943659306, 0.046943482011556625, -0.03264075890183449, 0.03938866779208183, -0.015411016531288624, -0.0009285377454943955, -0.036897845566272736, 0.007847970351576805, -0.04494250938296318, 0.024293750524520874, 0.0020945908036082983, -0.03400859609246254, 0.006550896447151899, -0.02261003479361534, 0.034854706376791, -0.057996053248643875, -0.0024482719600200653, -0.02100788988173008, -0.022119777277112007, -0.05708147585391998, -0.05562346801161766, -0.009245943278074265, 0.04498066008090973, -0.016544284299016, -0.030569668859243393, -0.038075242191553116, -0.05149915814399719, 0.01364311296492815, 0.030239678919315338, -0.030861426144838333, -0.00922673661261797, -0.026247745379805565, 0.009262818843126297, 0.014408670365810394, 0.010202784091234207, 0.03374950960278511, -0.03273962065577507, -0.003440248081460595, 0.018721528351306915 ]
The Partnership: Amazon SageMaker and Hugging Face
philschmid
March 23, 2021
the-partnership-amazon-sagemaker-and-hugging-face
partnerships, aws
https://huggingface.co/blog/the-partnership-amazon-sagemaker-and-hugging-face
SageMaker Metrics SageMaker Metrics can automatically parse the logs for metrics and send those metrics to CloudWatch. If you want SageMaker to parse logs you have to specify the metrics that you want SageMaker to send to CloudWatch when you configure the training job. You specify the name of the metrics that you want to send and the regular expressions that SageMaker uses to parse the logs that your algorithm emits to find those metrics. - Example Notebook python # define metrics definitions metric_definitions = [ {"Name": "train_runtime", "Regex": "train_runtime.*=\D*(.*?)$"}, {"Name": "eval_accuracy", "Regex": "eval_accuracy.*=\D*(.*?)$"}, {"Name": "eval_loss", "Regex": "eval_loss.*=\D*(.*?)$"}, ] # create the Estimator huggingface_estimator = HuggingFace( entry_point='train.py', source_dir='./scripts', instance_type='ml.p3.2xlarge', instance_count=1, role=role, transformers_version='4.4', pytorch_version='1.6', py_version='py36', metric_definitions=metric_definitions, hyperparameters = hyperparameters ) ---
[ 0.01368655078113079, 0.04758656769990921, -0.030720919370651245, -0.027734791859984398, 0.026562996208667755, 0.02199680171906948, 0.035192228853702545, -0.04766525328159332, -0.07138887792825699, 0.007631998509168625, -0.048705704510211945, 0.042836714535951614, 0.03679003566503525, 0.08652940392494202, -0.0076902275905013084, -0.020166104659438133, 0.00753989489749074, 0.005029586143791676, 0.04121693596243858, -0.010189084336161613, 0.03908412158489227, -0.014464026317000389, -0.010792319662868977, 0.029882758855819702, 0.025169851258397102, 0.007230311632156372, -0.006692529655992985, -0.0198824442923069, -0.10735341906547546, 0.032285887748003006, -0.040426433086395264, 0.056506652384996414, -0.001696268911473453, -0.0351933129131794, -0.003964938223361969, 0.048740532249212265, -0.13236431777477264, 0.061311352998018265, 0.02992788515985012, -0.050603169947862625, -0.02708391658961773, -0.07018570601940155, -0.08588001877069473, 0.0461304597556591, 0.0330481193959713, -0.005777010694146156, -0.12671108543872833, -0.003450932214036584, 0.06485102325677872, 0.03238742798566818, -0.0660010352730751, 0.13147832453250885, -0.011327633634209633, -0.009289355017244816, -0.03147909417748451, -0.013925384730100632, 0.024447565898299217, -0.05226368457078934, -0.019100667908787727, -0.016471395269036293, -0.07197561115026474, -0.050191719084978104, -0.023529784753918648, 0.0031985598616302013, 0.024936800822615623, 0.017996028065681458, 0.02037949487566948, 0.021160533651709557, -0.0030412026681005955, -0.015217195264995098, -0.02209949679672718, -0.08122910559177399, -0.009138965979218483, -0.004303719382733107, -0.03597617521882057, -0.07000172138214111, -0.014846468344330788, -0.04022859409451485, -0.00856832042336464, 0.09934273362159729, -0.028419580310583115, 0.011200528591871262, -0.05571374669671059, 0.011537380516529083, -0.005474741104990244, 0.008269773796200752, 0.04096287488937378, -0.03902377933263779, -0.027125179767608643, 0.11390484869480133, 0.04858603700995445, -0.09028380364179611, 0.029849180951714516, 0.03598567843437195, 0.0017645953921601176, -0.030348079279065132, 0.0325382798910141, 0.02306453511118889, -0.0028045102953910828, -0.039983078837394714, 0.03632592037320137, -0.07014333456754684, 0.0405321829020977, -0.004721826408058405, -0.004612406715750694, 0.007793936412781477, -0.00802017655223608, -0.08697988092899323, -0.026649875566363335, -0.0064082881435751915, 0.02711520530283451, 0.0022421858739107847, -0.03304750472307205, 0.0702991634607315, -0.02311498299241066, 0.026776375249028206, -0.004194330889731646, -0.029499990865588188, -0.0009043399477377534, -0.0394899807870388, 0.016535915434360504, 0.10230115056037903, 0.0674416720867157, 0.03092913143336773, -0.002664212603121996, 0.043374765664339066, 0.06094035506248474, -0.05723630264401436, 0.070217564702034, -0.05148402228951454, -0.03155979514122009, 0.025273656472563744, 0.05577826127409935, -0.011973769403994083, 0.0369991734623909, -0.047076694667339325, 0.02290535345673561, -0.06031220778822899, 0.01994539238512516, 0.030903710052371025, -0.021583231166005135, 0.1271294504404068, -0.04714924842119217, 0.021612681448459625, 0.04020697996020317, 0.05144207179546356, -0.008758681826293468, 0.0007331345113925636, -0.026711249724030495, 0.06823649257421494, -0.11327113956212997, 0.08104532957077026, 0.015948869287967682, -0.07257227599620819, -0.023249784484505653, -0.001305070356465876, 0.0031493999995291233, -0.03206571564078331, -0.04932017996907234, 0.023100720718503, -0.010411001741886139, 0.07128681987524033, -0.05809415504336357, -0.0075870053842663765, -0.04364153742790222, -0.0034993488807231188, 0.066959910094738, -0.03616700321435928, 0.04723866656422615, -0.03788697347044945, 0.014286233112215996, -0.02491999976336956, 0.041285913437604904, -0.006804673466831446, 0.07056337594985962, 0.05937083438038826, 0.04955820366740227, 0.012601965107023716, -0.021314473822712898, -0.049973294138908386, -0.021574178710579872, 0.041728973388671875, -0.041328590363264084, -0.00594581663608551, 0.07846549153327942, -0.004702836740761995, 0.02850869670510292, 0.012755699455738068, 0.05051878094673157, -0.002088001696392894, -0.034475505352020264, -0.018201632425189018, 0.010885088704526424, 0.0063101197592914104, 0.0009548402158543468, -0.04000994935631752, 0.03774726763367653, 0.10418000817298889, 0.06385495513677597, 0.06856163591146469, -0.0035059598740190268, -0.023039560765028, -0.00979187898337841, -0.002473962027579546, -0.0027003425639122725, 0.10060691833496094, 0.009981390088796616, -0.04184850677847862, 0.022666893899440765, -0.048448916524648666, -0.0025465290527790785, -0.08707530796527863, 0.0769483670592308, -0.07562752813100815, 0.0036805402487516403, -0.000618662394117564, -0.02835218235850334, -0.0290088951587677, -0.01715579815208912, 0.01929134875535965, 0.10828560590744019, -0.006409159861505032, 0.05265850946307182, -0.039664532989263535, -0.05034844949841499, -0.004232425708323717, 0.05293932929635048, 0.12969493865966797, 0.03384571895003319, -0.08385143429040909, -0.06257159262895584, -0.07300619781017303, -0.00948658399283886, 0.052652694284915924, -0.056089550256729126, -0.03033822402358055, -0.02765853889286518, -0.021943029016256332, 0.05389014631509781, 0.05380178615450859, 0.08894158154726028, -0.009910431690514088, 0.012779798358678818, 0.03481757268309593, 0.03957029804587364, -0.04343671724200249, 0.0638047382235527, -0.05657926946878433, -0.06296851485967636, -0.01257190853357315, -0.03696110099554062, 0.027473298832774162, 0.07928956300020218, -0.07112211734056473, 0.015621735714375973, 0.013465476222336292, -0.02091282792389393, 0.01259900163859129, -0.007622662000358105, 0.06971614807844162, 0.027106961235404015, 0.03795550391077995, -0.001181690371595323, -0.020987680181860924, -0.004239972215145826, -0.01792050339281559, -0.010613812133669853, -0.002674110233783722, -0.016464198008179665, -0.005377244204282761, 0.01229868270456791, -0.03263264149427414, -0.005762362387031317, 0.03234796226024628, 0.04787534102797508, -0.012364600785076618, 0.03267204388976097, -0.006904429290443659, -0.02566618099808693, -0.009662454947829247, 0.02610945887863636, -0.056817956268787384, 0.02053777128458023, 0.018171701580286026, 0.018199339509010315, 0.00777816167101264, -0.0011400746880099177, -0.022704415023326874, -0.013938620686531067, 0.04062040150165558, -0.014104031026363373, 0.05423766374588013, 0.032614223659038544, -0.005910533480346203, 0.0067777871154248714, 0.06136108934879303, 0.011815302073955536, -0.022153517231345177, 0.01347990334033966, 0.09490537643432617, -0.017347751185297966, 0.02223261073231697, 0.005790675058960915, -0.023047994822263718, -0.06903817504644394, -0.007651612162590027, 0.01335899718105793, -0.015599952079355717, -0.09156017005443573, -0.0010922999354079366, -0.006926948204636574, -0.0033032489009201527, 0.02424739859998226, 0.03016357310116291, 0.051305338740348816, 0.003858003532513976, 0.0008261915645562112, 0.03391573578119278, -0.013236351311206818, 0.015648774802684784, 0.0391521081328392, -0.013096895068883896, 0.00852348655462265, 0.0035326010547578335, -0.05871548503637314, 0.018853111192584038, 0.012666607275605202, 0.03271883726119995, 0.005775367375463247, 0.034898798912763596, 0.012204590253531933, -0.05310438200831413, -0.029677895829081535, 0.03149242699146271, 0.022292234003543854, 0.01896541193127632, 0.008481862023472786, -0.02264266274869442, 0.012067931704223156, -0.003335125744342804, 0.00831556599587202, -0.02956201508641243, -0.027001334354281425, -0.04938853532075882, -0.005829986650496721, 0.03785403445363045, 0.044732287526130676, 0.0033337427303195, -0.005581871140748262, 0.013879906386137009, 0.02870313636958599, 0.0004866151721216738, 0.04006991162896156, 0.014629006385803223, 0.016902334988117218, 0.004112705122679472, 0.0005126633914187551, 0.0015900928992778063, -0.02097458392381668, -0.02604128047823906, 0.0013254641089588404, 0.027477359399199486, -0.015959613025188446, -0.03617188334465027, 0.019631024450063705, 0.020814472809433937, 0.006772931665182114, 0.009407375939190388, -0.05323978140950203, 0.004689993802458048, -0.012182037346065044, -0.009720631875097752, -0.004392172209918499, 0.02904149703681469, 0.030143817886710167, 0.04301373288035393, 0.00758780213072896, 0.028470510616898537, -0.013845019042491913, 0.035130031406879425, 0.003453213721513748, 0.015271471813321114, -0.056982435286045074, -0.016797291114926338, -0.013411229476332664, -0.02435891702771187, 0.05085953325033188, 0.033605363219976425, 0.0000857105478644371, 0.0008412151946686208, -0.016894826665520668, -0.05109812319278717, 0.0209652166813612, -0.0030094976536929607, -0.014309968799352646, -0.004444518126547337, 0.04481428489089012, 0.037776779383420944, 0.01541395764797926, -0.06359610706567764, 0.01397091243416071, 0.007838510908186436, -0.028386887162923813, -0.023138409480452538, 0.030210036784410477, -0.00531194731593132, -0.012229097075760365, 0.024541351944208145, 0.004975428804755211, -0.011232493445277214, 0.03820625692605972, 0.004842504393309355, 0.01662265881896019, 0.011430218815803528, -0.04436725378036499, -0.017603185027837753, 0.036340974271297455, -0.011344208382070065, 0.03281044960021973, -0.03238609805703163, -0.005183669738471508, -0.03723334148526192, -0.0006655524484813213, 0.043966155499219894, 0.01814659684896469, -0.033805783838033676, 0.012349676340818405, 0.07705731689929962, -0.04851476848125458, 0.022731047123670578, -0.05531283840537071, -0.006097780540585518, -0.0027851099148392677, -0.034685004502534866, 0.010390985757112503, 0.013224429450929165, -0.019596727564930916, -0.047388553619384766, -0.01745794154703617, -0.00011118632392026484, 0.015252482146024704, -0.0005101025453768671, 0.02463759109377861, -0.01862519606947899, -0.00991129595786333, 0.03196971118450165, 0.03077533096075058, 0.0038678639102727175, -0.042215678840875626, 0.017113514244556427, 0.000496304826810956, -0.0004554978513624519, 0.016804564744234085, 0.04287014156579971, -0.04457337409257889, -0.013210351578891277, -0.021155646070837975, 0.002963656559586525, 0.03400714695453644, 0.0067856633104383945, -0.036907561123371124, 0.001716865343041718, 0.0011997225228697062, -0.020892323926091194, -0.013267286121845245, 0.001371564925648272, 0.012240452691912651, 0.033812448382377625, -0.03323589637875557, -0.02869253233075142, 0.013665738515555859, -0.03215176239609718, 0.04612966254353523, 0.004964823834598064, -0.018120624125003815, -0.030565470457077026, 0.022238001227378845, 0.01643124222755432, -0.0056383381597697735, -0.010294507257640362, 0.012522002682089806, -0.03693766891956329, 0.029102226719260216, 0.07489663362503052, 0.018331104889512062, 0.0376431941986084, -0.02506835199892521, -0.014977800659835339, -0.0015710897278040648, -0.016329513862729073, 0.02175229974091053, -0.012012179009616375, -0.03665383905172348, 0.001767134526744485, 0.006811065133661032, 0.032163094729185104, -0.02441064827144146, 0.021160101518034935, 0.008731545880436897, -0.01636466383934021, 0.027222584933042526, -0.06608158349990845, 0.030597710981965065, -0.013399523682892323, 0.05085412412881851, 0.0021357189398258924, -0.052610237151384354, -0.01872403919696808, 0.05513870716094971, 0.021562151610851288, -0.03142261505126953, -0.021420417353510857, -0.004708711989223957, -0.009862224571406841, 0.011020747944712639, 0.00047651524073444307, -0.02224360965192318, 0.0000704316480550915, -0.0007334220572374761, -0.021089056506752968, 0.013529116287827492, 0.016370298340916634, 0.009035157971084118, -0.034220632165670395, 0.029286472126841545, 0.009694884531199932, 0.01880291849374771, -0.040961042046546936, -0.002614384749904275, 0.011706825345754623, 0.002591082826256752, 0.009941321797668934, 0.0007183916168287396, -0.02229807898402214, 0.0223835576325655, 0.01863795705139637, -0.012076182290911674, 0.04347556456923485, 0.009921804070472717, -0.006550916936248541, -0.040099095553159714, -0.007713743019849062, -0.015771260485053062, -0.006644342094659805, -0.030673174187541008, 0.05062665417790413, 0.030867893248796463, -0.01567591167986393, 0.002718145726248622, 0.0023659896105527878, -0.014582175761461258, 0.037286628037691116, -0.02222338318824768, 0.014823914505541325, 0.024083182215690613, 0.00709801260381937, 0.031029004603624344, 0.03849602863192558, 0.011420413851737976, 0.029581105336546898, 0.009168274700641632, 0.018894603475928307, 0.02746322937309742, 0.0009413392399437726, -0.020026471465826035, 0.023526577278971672, -0.0041359784081578255, -0.04344043880701065, 0.025537805631756783, -0.08416882902383804, 0.028640391305088997, 0.021730603650212288, -0.05007151886820793, 0.017899664118885994, -0.03698872774839401, -0.02135409228503704, 0.008507052436470985, 0.016940206289291382, 0.023761054500937462, 0.02709190919995308, -0.0011925192084163427, -0.02965659834444523, 0.03716990351676941, 0.008087463676929474, -0.008349725976586342, 0.08922143280506134, -0.056700944900512695, 0.04116057977080345, -0.03483378514647484, 0.04387768730521202, 0.022470619529485703, 0.03194369003176689, 0.01298503577709198, -0.04643359035253525, 0.06026950106024742, 0.0072416095063090324, 0.05122306942939758, 0.03459457680583, -0.016663847491145134, 0.012460857629776001, -0.0486125648021698, -0.011682798154652119, -0.025863420218229294, -0.0226530060172081, 0.040046583861112595, -0.022029083222150803, 0.03179679438471794, 0.006118917837738991, 0.04006253555417061, 0.034009359776973724, 0.019579024985432625, 0.004047594964504242, -0.01732349395751953, 0.05689805746078491, 0.00005223618427407928, 0.00446799723431468, 0.04097101464867592, -0.0072405519895255566, 0.01829618215560913, 0.04472607001662254, 0.04506600648164749, -0.008092944510281086, -0.02046811394393444, 0.010435059666633606, -0.032439567148685455, -0.004253866150975227, -0.0023147817701101303, 0.04162577912211418, 0.04428483918309212, -0.052760761231184006, -0.023580215871334076, 0.007293530274182558, -0.012933828867971897, 0.01719667576253414, -0.019887609407305717, 0.03436237573623657, -0.00045149054494686425, -0.012377852573990822, -0.0017265992937609553, 0.02456059865653515, -0.007266933098435402, -0.08953854441642761, -0.03102838061749935, 0.0016015301225706935, -0.03827391937375069, 0.027259990572929382, -0.028584135696291924, -0.07952248305082321, -0.0028341254219412804, -0.035663776099681854, 0.014819548465311527, 0.03525274619460106, -0.030595574527978897, -0.023870008066296577, 0.008627418428659439, 0.010700317099690437, 0.0118734585121274, 0.061488211154937744, -0.014591949060559273, 0.04726843163371086, 0.04413720220327377, -0.0063251773826777935, -0.04432854801416397, -0.009564138017594814, 0.022077346220612526, -0.007295424584299326, 0.029270650818943977, -0.01058292854577303, 0.023310385644435883, -0.04802826792001724, -0.03353376314043999, 0.008575434796512127, -0.0030750748701393604, -0.030000826343894005, 0.02916264720261097, -0.027526700869202614, 0.017414670437574387, 0.00956302136182785, 0.0009985839715227485, 0.03734567388892174, 0.0171222947537899, -0.00692472280934453, -0.003343217307701707, -0.02292850986123085, 0.04750044271349907, -0.03300303965806961, 0.016289671882987022, -0.0036191949620842934, 0.037053920328617096, 0.034046731889247894, 0.02332785725593567, 0.007542700506746769, -0.013363828882575035, 0.028605632483959198, -0.038339149206876755, 0.0167112834751606, -0.03321341052651405, -0.0210857130587101, -0.03678708150982857, -0.07741348445415497, 0.005646504461765289, -0.016196701675653458, -0.06370034068822861, 0.0020940378308296204, -0.03439280763268471, 0.037579163908958435, -0.005830153822898865, -0.008750460110604763, -0.039462387561798096, -0.025862785056233406, 0.05016622692346573, 0.02149295248091221, 0.009384949691593647, -0.0173923522233963, -0.07178016006946564, -0.000006521604063891573, 0.011319599114358425, 0.00598561204969883, 0.037339746952056885, -0.006885937415063381, -0.009136597625911236, -0.02037142962217331, 0.03259885311126709, -0.04402019456028938, -0.010713906958699226, 0.03272910416126251, -0.01395424548536539, -0.017067717388272285, -0.02935023419559002, -0.019647756591439247, 0.03606542944908142, -0.019263217225670815, 0.046357933431863785, -0.020535537973046303, -0.005716947838664055, -0.025312364101409912, 0.015259976498782635, -0.026411153376102448, -0.002468762919306755, -0.022394917905330658, -0.06374933570623398, 0.012368526309728622, -0.009689351543784142, 0.024166623130440712, -0.048424556851387024, -0.005075401626527309, 0.0007947098347358406, -0.01700185053050518, -0.016915621235966682, -0.07862190157175064, -0.00041990840691141784, 0.04180094599723816, -0.04201803356409073, -0.024949587881565094, -0.026790838688611984, -0.049681853502988815, -0.04313480481505394, 0.03266438841819763, 0.012860539369285107, -0.009407242760062218, -0.012323947623372078, 0.0009929753141477704, 0.0019098010379821062, 0.02538169175386429, 0.01028341706842184, -0.012187770567834377, 0.013421766459941864, -0.03239180147647858 ]
The Partnership: Amazon SageMaker and Hugging Face
philschmid
March 23, 2021
the-partnership-amazon-sagemaker-and-hugging-face
partnerships, aws
https://huggingface.co/blog/the-partnership-amazon-sagemaker-and-hugging-face
Blog/Video - AWS: Embracing natural language processing with Hugging Face - Deploy Hugging Face models easily with Amazon SageMaker - AWS and Hugging Face collaborate to simplify and accelerate adoption of natural language processing models - Walkthrough: End-to-End Text Classification - Working with Hugging Face models on Amazon SageMaker - Distributed Training: Train BART/T5 for Summarization using 🤗 Transformers and Amazon SageMaker - Deploy a Hugging Face Transformers Model from S3 to Amazon SageMaker - Deploy a Hugging Face Transformers Model from the Model Hub to Amazon SageMaker
[ -0.007682402152568102, -0.03119666315615177, 0.009990801103413105, -0.026162438094615936, 0.010522142052650452, 0.08244279772043228, 0.015574316494166851, 0.05453459918498993, -0.03531062230467796, 0.012917833402752876, -0.08832858502864838, 0.0718306303024292, -0.026263240724802017, 0.12508291006088257, 0.007088657934218645, -0.05178080499172211, 0.01591350883245468, 0.018383605405688286, 0.024471882730722427, 0.018127603456377983, -0.014301585033535957, -0.05360335856676102, 0.005260744597762823, 0.024515900760889053, 0.022133171558380127, -0.028534812852740288, 0.04572146013379097, -0.007034859620034695, 0.004358931444585323, 0.06332331150770187, -0.054360441863536835, -0.025385264307260513, 0.00006760009273421019, -0.01588086411356926, -0.00951943825930357, 0.019574465230107307, -0.15762124955654144, 0.03948015347123146, 0.010228406637907028, 0.005646226927638054, -0.02131796069443226, -0.04466910660266876, -0.07216834276914597, 0.023482436314225197, -0.002491473453119397, -0.03502614423632622, -0.15376771986484528, 0.04819869622588158, 0.003883386729285121, -0.0037739279214292765, -0.09749088436365128, 0.11644613742828369, -0.007178496569395065, -0.009560349397361279, -0.03197778761386871, 0.013364804908633232, -0.02518106810748577, -0.12450357526540756, -0.010708159767091274, 0.0009869728237390518, -0.011310938745737076, -0.02982364222407341, -0.014543460682034492, 0.013519303873181343, 0.021078094840049744, -0.007485818583518267, 0.016357863321900368, -0.016543209552764893, -0.04468065872788429, 0.04367627948522568, 0.029705656692385674, -0.08378428965806961, -0.029375581070780754, -0.011862805113196373, -0.013542670756578445, -0.03075619973242283, 0.019301719963550568, -0.02754097431898117, 0.0014548922190442681, 0.06676150113344193, -0.019263900816440582, 0.024670125916600227, -0.0022507086396217346, 0.05247381702065468, 0.043689318001270294, 0.031167712062597275, 0.06425127387046814, -0.07872238010168076, -0.07871290296316147, 0.0787530466914177, 0.03148651495575905, -0.092779241502285, -0.05385482683777809, 0.02830403670668602, 0.0687861517071724, 0.02788885496556759, -0.018854666501283646, -0.03545018658041954, -0.03118937835097313, -0.04102680832147598, 0.03513028100132942, -0.06038123741745949, 0.06351450085639954, -0.061217889189720154, -0.019765185192227364, 0.031886253505945206, -0.015700552612543106, -0.13117101788520813, 0.02330949530005455, 0.008639165200293064, 0.06318516284227371, -0.056040599942207336, 0.013586041517555714, 0.06208428740501404, -0.12850289046764374, 0.09589799493551254, 0.040536850690841675, -0.02925959601998329, 0.015862995758652687, 0.0359576940536499, 0.07117869704961777, 0.07171779870986938, 0.039288781583309174, -0.02316327765583992, -0.020333442836999893, 0.03612229600548744, -0.0010346173075959086, -0.042717766016721725, 0.001249960158020258, -0.03401733562350273, 0.010603479109704494, -0.0374382920563221, 0.06419509649276733, -0.016066094860434532, -0.012985157780349255, -0.03634832426905632, 0.027407048270106316, -0.06951223313808441, 0.01570984721183777, 0.028282243758440018, 0.003433553734794259, 0.11418741196393967, 0.021072927862405777, 0.03967313840985298, 0.061288826167583466, 0.012183526530861855, -0.06422782689332962, 0.015874706208705902, -0.0014968676259741187, 0.032604772597551346, -0.11206243932247162, 0.019448403269052505, -0.031804151833057404, -0.08864058554172516, 0.05067801475524902, 0.0812266394495964, 0.012097611092031002, -0.040209028869867325, -0.04120287299156189, -0.039830055087804794, -0.024575408548116684, -0.016944726929068565, -0.04880928620696068, -0.020999634638428688, -0.02102646976709366, -0.020528532564640045, 0.019290033727884293, -0.011780726723372936, 0.0527629591524601, -0.0045705921947956085, 0.009726449847221375, -0.027914905920624733, 0.033453043550252914, 0.020259065553545952, -0.0006484600598923862, 0.03893987461924553, 0.04866700991988182, 0.09694896638393402, -0.041940927505493164, -0.010462324135005474, -0.04132865369319916, 0.06166538596153259, 0.012158496305346489, -0.003139011561870575, 0.05011649429798126, -0.0500025674700737, 0.03728633373975754, 0.010652001015841961, 0.061520662158727646, 0.026630589738488197, 0.006794453598558903, -0.0027725063264369965, 0.03373057767748833, 0.0032360695768147707, 0.015293288975954056, 0.0049918596632778645, -0.018035952001810074, 0.13003437221050262, -0.00944921188056469, 0.0970413014292717, 0.04734325781464577, -0.05886322632431984, -0.00916340108960867, 0.019353920593857765, -0.009600433520972729, 0.04592324420809746, -0.036097895354032516, 0.01394152082502842, 0.05518458038568497, -0.00000550552795175463, 0.013077791780233383, -0.11382465809583664, 0.012407300062477589, -0.06863944977521896, -0.012073458172380924, -0.05748242512345314, -0.042788248509168625, 0.02235870063304901, 0.020302407443523407, 0.017618637531995773, 0.14264589548110962, -0.01921636052429676, 0.021275265142321587, -0.049082666635513306, 0.0020654764957726, -0.004713830072432756, 0.04193556308746338, 0.09804260730743408, 0.07134087383747101, -0.03812089562416077, -0.027858449146151543, -0.07475710660219193, 0.000770147773437202, -0.03634431213140488, -0.005837702192366123, 0.006503982935100794, 0.0500604547560215, -0.021546855568885803, 0.0024744102265685797, -0.00850021280348301, 0.019871992990374565, -0.029914038255810738, 0.017138710245490074, 0.004925484769046307, 0.030727215111255646, -0.02577655203640461, 0.05788019672036171, -0.03820976987481117, -0.02929081954061985, 0.036577388644218445, -0.08141113072633743, 0.08733917772769928, 0.001680380548350513, -0.01136566698551178, 0.05132094398140907, 0.0020949237514287233, 0.023157039657235146, 0.030592937022447586, -0.001785590429790318, 0.048245422542095184, -0.00694287708029151, -0.014277844689786434, -0.003056011628359556, -0.04752373322844505, -0.006165817845612764, -0.03524117171764374, -0.020644109696149826, 0.009904150851070881, 0.0053112078458070755, -0.010800939984619617, 0.021717039868235588, -0.03465527296066284, 0.025397703051567078, 0.005602272693067789, 0.0013285021996125579, 0.017886491492390633, 0.03804401308298111, -0.00022126841940917075, 0.0003398419648874551, -0.021160710602998734, 0.01736697182059288, -0.02086281217634678, 0.008650445379316807, 0.024990994483232498, 0.00891665555536747, -0.007549624424427748, -0.011061295866966248, -0.029811127111315727, -0.03179127722978592, 0.021904705092310905, 0.055520400404930115, 0.021926485002040863, 0.0022558842319995165, 0.014053200371563435, 0.02996418997645378, 0.029218528419733047, 0.011095683090388775, -0.015017541125416756, -0.02320083975791931, 0.0639057382941246, 0.007146330550312996, 0.014717274345457554, -0.010921952314674854, -0.014458243735134602, -0.03710933402180672, -0.013867576606571674, 0.05175471678376198, 0.015242945402860641, -0.09137466549873352, -0.059620752930641174, -0.013753063976764679, 0.0034435272682458162, 0.01923537813127041, -0.013608512468636036, 0.05131096392869949, -0.02749033086001873, -0.003251119516789913, 0.03743850067257881, 0.02577679604291916, 0.03151522949337959, 0.03845695033669472, -0.014544959180057049, 0.008428865112364292, -0.002395949326455593, -0.03572728857398033, -0.01942424103617668, 0.014955557882785797, 0.05499520152807236, -0.04950059950351715, 0.016294335946440697, 0.029343536123633385, -0.031599849462509155, 0.01842697151005268, -0.04830342158675194, 0.03442220017313957, -0.02031070366501808, 0.037581462413072586, -0.03274061903357506, 0.0072297328151762486, -0.0004278655396774411, -0.038225818425416946, -0.006340791936963797, -0.04773903265595436, 0.0015229724813252687, 0.013127743266522884, 0.05183904618024826, 0.03883013874292374, 0.030174532905220985, -0.0077978880144655704, -0.012297905050218105, 0.014047016389667988, -0.003125464078038931, 0.05537240207195282, -0.00015115593851078302, -0.025102756917476654, -0.009780194610357285, 0.04478294029831886, -0.03762761503458023, -0.024082470685243607, -0.004223235882818699, -0.020102890208363533, 0.029851382598280907, 0.019550854340195656, 0.012082302011549473, 0.007362553849816322, 0.0014529475010931492, 0.0009208715637214482, -0.03091118484735489, -0.05946384742856026, 0.019523726776242256, -0.017954502254724503, -0.03993891924619675, 0.0002334868913749233, 0.05055411905050278, -0.0089399553835392, -0.020301053300499916, 0.030153639614582062, 0.029881948605179787, 0.013991807587444782, 0.027717188000679016, -0.039686936885118484, 0.009043392725288868, -0.04895225167274475, 0.006103656720370054, 0.016258616000413895, -0.027032384648919106, 0.04280494526028633, 0.020708106458187103, -0.040698014199733734, -0.027226615697145462, -0.03768448904156685, -0.04370107874274254, 0.03536321595311165, 0.012636043131351471, 0.010889813303947449, -0.017043715342879295, 0.040797438472509384, 0.052901722490787506, -0.006768518593162298, -0.0753277838230133, -0.012082134373486042, -0.009529286995530128, -0.0040897466242313385, -0.02578483335673809, 0.009480074979364872, -0.007296400144696236, -0.021128373220562935, -0.02742479369044304, 0.0021181688643991947, -0.029943499714136124, 0.009251273237168789, -0.003177073784172535, -0.031225701794028282, 0.01804536022245884, -0.014938144944608212, -0.024914024397730827, -0.009772072546184063, -0.012098109349608421, 0.05165580287575722, 0.021336743608117104, 0.018794160336256027, -0.0018884685123339295, 0.03242598846554756, 0.05460352450609207, -0.021517902612686157, -0.011573635041713715, -0.01654285192489624, 0.036977313458919525, -0.01206610444933176, 0.02042906917631626, -0.02226671203970909, -0.017251601442694664, 0.00924252811819315, -0.0011510078329592943, 0.02783927507698536, 0.03310391306877136, -0.01470591314136982, -0.04182541370391846, -0.02785564959049225, -0.003969231154769659, 0.045303408056497574, 0.011037761345505714, 0.01194809190928936, 0.010892095044255257, -0.023640669882297516, 0.01691487431526184, 0.011850620619952679, 0.0024076274130493402, -0.059146344661712646, 0.028884826228022575, 0.05210411921143532, 0.004057538695633411, 0.026985086500644684, -0.028979310765862465, -0.06926576048135757, -0.023515969514846802, -0.006866756826639175, 0.04045606404542923, 0.024620814248919487, 0.0023909236770123243, -0.041822656989097595, 0.03642551600933075, 0.033420950174331665, -0.024989455938339233, -0.00600225105881691, 0.03610112890601158, 0.006076697260141373, 0.05533115193247795, 0.002967298496514559, 0.014433207921683788, -0.029771972447633743, -0.015118133276700974, 0.02846304140985012, 0.008436818607151508, -0.041201427578926086, -0.043731071054935455, 0.018508244305849075, 0.05105824023485184, -0.003945148549973965, 0.0034849722869694233, 0.013170061632990837, -0.024581408128142357, 0.02222699113190174, 0.03737502172589302, 0.03643018379807472, 0.02117854170501232, -0.030319899320602417, 0.02144504152238369, -0.031421858817338943, -0.016002483665943146, -0.055580493062734604, -0.0021415979135781527, 0.010744779370725155, 0.004415361676365137, 0.06722057610750198, 0.059327930212020874, -0.017730288207530975, 0.0023974275682121515, -0.0013694504741579294, -0.015953591093420982, -0.0034040790051221848, -0.033135898411273956, 0.0011298948666080832, 0.0020187008194625378, 0.029185477644205093, -0.006946424022316933, -0.022276006639003754, 0.008513829670846462, 0.00275150197558105, 0.03797578439116478, -0.02590710110962391, -0.007877231575548649, 0.025283755734562874, -0.02531293034553528, 0.01196387317031622, -0.029975946992635727, -0.012149762362241745, 0.0018276285845786333, 0.010872120037674904, 0.0074836392886936665, -0.008419002406299114, -0.03052918240427971, -0.0044983429834246635, -0.019611552357673645, 0.016949443146586418, 0.017146538943052292, 0.008266876451671124, 0.03093896433711052, -0.007097871042788029, -0.002432381734251976, -0.006376872770488262, -0.005399515386670828, 0.030424853786826134, -0.01944219134747982, 0.00010691686475183815, 0.012183282524347305, -0.022867828607559204, 0.017592696473002434, -0.0007586692809127271, 0.003818606259301305, -0.011163999326527119, 0.05694884434342384, 0.012834375724196434, -0.02481324039399624, -0.04601215571165085, 0.045573439449071884, 0.0513576902449131, -0.02841927669942379, 0.004034718032926321, -0.01941734552383423, -0.030917085707187653, -0.017869556322693825, -0.04102475941181183, 0.025676870718598366, 0.05920260399580002, -0.0035000282805413008, 0.011895347386598587, -0.00779251242056489, 0.0186337698251009, 0.02345084771513939, 0.03407943248748779, 0.01301772240549326, 0.023987645283341408, 0.027203010395169258, 0.009602724574506283, 0.00014618468412663788, -0.017625056207180023, -0.02559015154838562, 0.01816738396883011, -0.0411527045071125, 0.006561839487403631, 0.017839115113019943, -0.017522387206554413, 0.006478774826973677, -0.01032715942710638, -0.025003764778375626, 0.006358047015964985, 0.028824124485254288, 0.024168264120817184, 0.03120468743145466, -0.020424479618668556, 0.004797681234776974, -0.00874771736562252, 0.0016012225532904267, 0.0521419532597065, 0.06097222492098808, -0.04286442697048187, 0.008589372970163822, -0.017239369451999664, 0.04429500922560692, 0.006529124453663826, 0.02046038955450058, 0.009104911237955093, -0.021278783679008484, 0.062405530363321304, -0.019121840596199036, 0.0412154495716095, 0.037372685968875885, -0.002549719763919711, -0.023032227531075478, -0.006240837275981903, -0.022870313376188278, -0.043786391615867615, -0.01218878198415041, 0.0160515196621418, -0.015859393402934074, 0.009262830018997192, -0.006081718951463699, 0.06176125630736351, 0.0569426491856575, 0.03520972281694412, -0.012383366003632545, 0.014177997596561909, 0.07300862669944763, -0.0033537657000124454, 0.05145617201924324, 0.044021476060152054, 0.0020688013173639774, 0.006682702340185642, 0.041209518909454346, 0.04521450027823448, 0.06334425508975983, -0.016964739188551903, -0.004558071494102478, -0.021648431196808815, -0.014892914332449436, -0.01258387416601181, 0.005229747388511896, -0.0015474706888198853, -0.06080545857548714, -0.011948887258768082, 0.0008209410007111728, 0.004960701800882816, 0.05846916884183884, -0.014510605484247208, 0.007193570025265217, -0.012478109449148178, -0.018900450319051743, 0.008833007887005806, 0.048454124480485916, -0.018516335636377335, -0.03810456022620201, -0.012567944824695587, -0.024141132831573486, -0.0007817868608981371, 0.004552510101348162, -0.025952370837330818, -0.026609918102622032, 0.009697828441858292, -0.0329856313765049, -0.03447405621409416, -0.0123249851167202, -0.03990132361650467, -0.03889887034893036, 0.01613604463636875, 0.020985247567296028, 0.012106847018003464, 0.0334307961165905, 0.01902967318892479, 0.01765955612063408, -0.02223433367908001, 0.0030338126234710217, 0.0003752972115762532, -0.014244775287806988, 0.003327560843899846, -0.0805690735578537, 0.017892736941576004, -0.02230982482433319, 0.0075624543242156506, 0.023865394294261932, 0.04481944441795349, 0.004514313768595457, -0.01668403297662735, -0.018538637086749077, 0.017265023663640022, -0.03790094703435898, 0.021745705977082253, -0.013461844064295292, -0.029084524139761925, 0.025791488587856293, 0.0018585188081488013, -0.018336528912186623, 0.027428103610873222, 0.015868712216615677, 0.05118536204099655, -0.03683847934007645, 0.01430634967982769, 0.000827521551400423, 0.015855493023991585, 0.028334690257906914, -0.005285282619297504, 0.009004333056509495, -0.008066892623901367, 0.02158808708190918, -0.03692175820469856, 0.010920654982328415, -0.05300244688987732, -0.007259742356836796, -0.046944767236709595, -0.07401204109191895, -0.020426088944077492, -0.025333555415272713, -0.011857246048748493, 0.046761468052864075, -0.04780108481645584, 0.023965144529938698, 0.0006051656091585755, 0.006612737197428942, -0.014807225205004215, 0.014186464250087738, 0.061808545142412186, 0.030317336320877075, 0.04386181756854057, -0.02070595510303974, -0.029672279953956604, 0.006698936689645052, -0.01165861263871193, 0.020463425666093826, 0.042617399245500565, 0.0007066393736749887, 0.005597019102424383, -0.027138380333781242, -0.032023556530475616, -0.004518195521086454, -0.0434623658657074, 0.04666111245751381, 0.005035314243286848, 0.004383888561278582, -0.027885090559720993, -0.0005179969593882561, 0.0010655896039679646, -0.014337528496980667, 0.031576741486787796, -0.03638315573334694, -0.02125602401793003, -0.013729414902627468, 0.01052150409668684, -0.05426041781902313, 0.02702314779162407, -0.010125447064638138, -0.01665729656815529, 0.01644928753376007, 0.01980445720255375, 0.01652885228395462, -0.03925509750843048, 0.004740653559565544, -0.01369215827435255, -0.006291029043495655, -0.029339371249079704, -0.05683358758687973, 0.0065964884124696255, 0.04961741715669632, -0.02840358391404152, -0.051383521407842636, 0.019328463822603226, -0.031973011791706085, -0.016796143725514412, -0.03288731724023819, -0.010061954148113728, -0.04470055550336838, -0.035152509808540344, 0.0051393164321780205, 0.03296025097370148, 0.03898884356021881, 0.023974236100912094, -0.003387674456462264, -0.0032584292348474264, -0.004102797247469425 ]