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
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
Accelerating Machine Learning from Science to Production In addition to Hugging Face DLCs, we created a first-class Hugging Face extension to the SageMaker Python-sdk to accelerate data science teams, reducing the time required to set up and run experiments from days to minutes. You can use the Hugging Face DLCs with the Automatic Model Tuning capability of Amazon SageMaker, in order to automatically optimize your training hyperparameters and quickly increase the accuracy of your models. Thanks to the SageMaker Studio web-based Integrated Development Environment (IDE), you can easily track and compare your experiments and your training artifacts.
[ 0.032351113855838776, 0.008116998709738255, 0.004451395478099585, 0.03827214241027832, -0.058123618364334106, 0.034090783447027206, 0.0038650697097182274, -0.01819370500743389, -0.036255937069654465, -0.02393386699259281, -0.10086575150489807, 0.023655526340007782, 0.020549658685922623, 0.057055458426475525, 0.02036621980369091, -0.10102034360170364, 0.0007748866337351501, 0.004744998645037413, -0.06128116324543953, 0.07217597216367722, 0.022303566336631775, -0.041666850447654724, 0.02461143024265766, 0.05751214921474457, -0.1021142452955246, -0.014162641949951649, -0.012180907651782036, -0.06076464056968689, 0.036923181265592575, 0.011369328014552593, -0.035017773509025574, -0.05210031569004059, -0.01790367066860199, -0.024068335071206093, -0.0011612820671871305, 0.052273448556661606, -0.10988131910562515, 0.004671250469982624, 0.001937379944138229, -0.04266107827425003, -0.032358650118112564, -0.018119702115654945, -0.07458245754241943, -0.014627830125391483, 0.02188809961080551, -0.012007400393486023, -0.07286905497312546, 0.03836456686258316, -0.0002018336090259254, -0.036328207701444626, -0.08230901509523392, 0.12433335185050964, 0.03682210296392441, -0.06129322946071625, 0.027735181152820587, 0.027112551033496857, 0.0040396819822490215, -0.01815345510840416, -0.0069663808681070805, 0.002267432864755392, -0.010117387399077415, -0.06965219229459763, 0.009613647125661373, -0.027588127180933952, 0.02166358008980751, 0.020460743457078934, -0.03878967463970184, -0.0334288626909256, -0.060916200280189514, -0.017795797437429428, -0.01068949606269598, -0.057478100061416626, -0.06784888356924057, -0.01661074161529541, -0.028109459206461906, -0.07495752722024918, -0.033362552523612976, -0.056883350014686584, 0.04986446350812912, 0.026589710265398026, -0.0174215417355299, 0.020132768899202347, 0.013936029747128487, 0.022450650110840797, 0.03990904241800308, 0.004771977663040161, -0.02872135490179062, -0.12443265318870544, -0.02263864316046238, 0.04145670309662819, -0.016036776825785637, -0.03719427436590195, 0.0066350242123007774, -0.02953825518488884, 0.05809152498841286, -0.011277629062533379, 0.014249399304389954, -0.019859597086906433, 0.0017989297630265355, -0.04283677041530609, 0.02915577031672001, -0.11655189841985703, -0.044868338853120804, -0.0474991649389267, -0.008497347123920918, 0.022732408717274666, -0.04176046699285507, -0.09631232172250748, -0.022288713604211807, 0.09849326312541962, 0.004854222293943167, -0.023392872884869576, -0.01514060702174902, 0.11862028390169144, -0.0869651734828949, 0.08704603463411331, -0.010997921228408813, 0.00026632373919710517, 0.006415085401386023, -0.00851960014551878, 0.019557427614927292, 0.04839402809739113, 0.055204376578330994, 0.00385698932223022, -0.010454351082444191, 0.10112303495407104, 0.026784546673297882, -0.005501945503056049, 0.08279120922088623, -0.0369175560772419, -0.016678325831890106, -0.041816066950559616, 0.01993582397699356, 0.03907786309719086, 0.013834085315465927, -0.017257599160075188, -0.024396609514951706, -0.07805080711841583, -0.001600735355168581, 0.041266072541475296, 0.028259525075554848, 0.1088782399892807, 0.00032653394737280905, -0.03809752315282822, 0.06660695374011993, 0.01708899810910225, -0.05330558866262436, 0.0031541469506919384, -0.0227320846170187, 0.08062758296728134, -0.1163584291934967, 0.05662578344345093, -0.0335405059158802, -0.04701150581240654, 0.0059716785326600075, 0.08506307750940323, -0.03648422658443451, -0.030497416853904724, -0.033438872545957565, -0.03302055597305298, -0.019930975511670113, -0.0051401047967374325, -0.045311570167541504, -0.05668476223945618, 0.035296592861413956, 0.011642622761428356, 0.0674474760890007, 0.04293348640203476, 0.04194776713848114, -0.042323652654886246, 0.01000470481812954, -0.03526967018842697, 0.03397751227021217, -0.03419175744056702, 0.08795834332704544, 0.033239684998989105, 0.02301977574825287, 0.08730728924274445, -0.004766739904880524, -0.0034468837548047304, -0.06705062836408615, 0.06367943435907364, -0.0294144656509161, 0.010329916141927242, 0.08482928574085236, -0.04287394881248474, 0.07378976792097092, 0.0272672101855278, 0.0041693104431033134, -0.022374780848622322, -0.0021438717376440763, 0.05861424282193184, 0.08670404553413391, -0.01329770963639021, 0.01302175410091877, -0.014472545124590397, -0.006234489846974611, 0.08996547013521194, 0.045518938452005386, 0.0216204896569252, 0.0022109998390078545, -0.0011816415935754776, 0.0331299714744091, 0.03504352271556854, 0.0015793879283592105, 0.0012957964790984988, 0.005312649067491293, -0.05786921828985214, 0.04152761027216911, -0.07018507272005081, 0.01846490427851677, -0.12185695022344589, 0.02945762500166893, -0.02944742515683174, -0.015204844996333122, 0.011893924325704575, -0.07174426317214966, -0.04278232902288437, -0.011842740699648857, -0.003169392701238394, 0.1332249492406845, -0.009133844636380672, 0.02461564913392067, -0.09030843526124954, -0.02864879183471203, -0.02345946431159973, 0.0872386246919632, 0.07627841085195541, 0.07685793191194534, -0.06261162459850311, -0.035648345947265625, -0.048149432986974716, -0.03305354341864586, 0.024685895070433617, -0.03685258328914642, -0.04514108598232269, 0.05420880764722824, -0.02273424156010151, 0.01412049401551485, 0.0031303802970796824, 0.06130005419254303, -0.012621470727026463, 0.011628841981291771, 0.010688358917832375, 0.06156773492693901, -0.017431501299142838, 0.07947391271591187, -0.016628367826342583, -0.0312783308327198, -0.010580628179013729, -0.06411504745483398, 0.05643593892455101, 0.014559936709702015, 0.008719894103705883, -0.03308140113949776, 0.03080545924603939, -0.03218257054686546, 0.024914611130952835, 0.00934920459985733, 0.0916886031627655, 0.014141436666250229, 0.006837830878794193, -0.02588028647005558, 0.005674319341778755, -0.002766055054962635, -0.03694803640246391, 0.031614288687705994, -0.0007985917036421597, -0.008503670804202557, -0.04241378977894783, 0.0052029225043952465, -0.01176272053271532, 0.01878400892019272, 0.0073988595977425575, 0.015255794860422611, 0.03274333104491234, 0.06196299195289612, -0.006290126591920853, -0.03138840198516846, -0.0402645580470562, 0.029356757178902626, -0.04424935579299927, 0.015342197380959988, 0.033650387078523636, -0.0010877199238166213, -0.0025872006081044674, -0.022620761767029762, -0.017915820702910423, -0.0598716214299202, -0.0014522501733154058, 0.03669627010822296, 0.010735585354268551, 0.014835461974143982, -0.0004213050415273756, 0.03582197055220604, 0.014452870935201645, 0.013617333956062794, -0.07065374404191971, -0.007669844198971987, 0.046887099742889404, 0.00659268070012331, -0.014195147901773453, -0.026872040703892708, -0.010587614960968494, -0.005990452133119106, 0.012469001114368439, 0.037298135459423065, -0.009570783004164696, -0.06838630884885788, -0.011871930211782455, -0.06278529018163681, 0.0016338045243173838, 0.03421737998723984, -0.020635247230529785, 0.017496956512331963, 0.004655186552554369, -0.0010782757308334112, 0.030165448784828186, -0.004770082421600819, 0.020027045160531998, 0.023726118728518486, 0.013721649535000324, 0.027415866032242775, -0.015524855814874172, -0.01582418382167816, -0.020892402157187462, 0.00632412638515234, 0.05062781274318695, -0.028795447200536728, 0.04289470613002777, -0.008255371823906898, -0.030845442786812782, 0.029389355331659317, -0.003543573198840022, 0.04738564044237137, -0.03800778090953827, 0.002029980765655637, -0.03150651976466179, -0.010324334725737572, -0.04333054646849632, -0.03523030877113342, 0.0015403758734464645, -0.008356889709830284, 0.0038252403028309345, -0.004333853255957365, 0.030015047639608383, 0.04727700352668762, 0.021054957062005997, 0.023614510893821716, -0.016810817644000053, 0.02982431650161743, 0.004043697379529476, 0.053960781544446945, -0.006833274383097887, -0.018728235736489296, 0.02152193896472454, 0.01605352573096752, -0.016674911603331566, 0.004153834655880928, -0.004426122177392244, 0.0071066622622311115, 0.019440576434135437, -0.026556357741355896, 0.017964329570531845, 0.025673530995845795, 0.01618790812790394, 0.021666569635272026, 0.0003312507178634405, -0.04900294914841652, 0.037307072430849075, -0.010668259114027023, -0.025876428931951523, -0.007342896889895201, 0.02127680368721485, 0.006761473137885332, -0.03892902284860611, -0.0170715544372797, 0.013299128971993923, 0.0001568779262015596, 0.020806627348065376, -0.03266924247145653, -0.0015699109062552452, -0.011209897696971893, -0.03908593952655792, 0.005562500096857548, -0.03677438572049141, 0.02009754255414009, 0.05279434099793434, 0.049779705703258514, 0.006990314926952124, 0.010691993869841099, -0.0084947869181633, 0.04755721613764763, 0.006640322506427765, -0.007089810911566019, -0.057327188551425934, 0.03174934908747673, 0.05406685918569565, 0.034988485276699066, -0.028363144025206566, 0.030110469087958336, -0.03714344650506973, -0.01390022225677967, -0.019249513745307922, 0.024306222796440125, 0.031182032078504562, -0.008658011443912983, -0.017388522624969482, -0.02232254482805729, -0.01445537619292736, 0.010919350199401379, -0.03870715573430061, -0.06314852088689804, 0.007779011968523264, -0.004512222949415445, -0.03625981882214546, 0.034267328679561615, 0.005137485917657614, 0.0076830461621284485, 0.00035310894600115716, -0.027855252847075462, -0.011264652945101261, 0.05517938733100891, 0.061962440609931946, 0.017988914623856544, 0.004694879520684481, -0.023293927311897278, 0.06044112518429756, -0.00871199369430542, 0.06232087314128876, -0.0005314642912708223, -0.04511762782931328, 0.017827654257416725, -0.006671600043773651, -0.01841450296342373, 0.03434804081916809, 0.012608307413756847, -0.0304443147033453, -0.030211729928851128, -0.00807175412774086, 0.030257321894168854, 0.001195781514979899, 0.032448481768369675, -0.030122488737106323, -0.032429177314043045, 0.027761995792388916, 0.0019275869708508253, 0.02558370865881443, 0.0268404521048069, 0.012019685469567776, 0.01625737175345421, -0.00046079340972937644, 0.010162551887333393, -0.0006133256829343736, -0.020349951460957527, -0.009860793128609657, -0.029544329270720482, 0.05224521458148956, 0.03940591961145401, 0.011666256934404373, -0.06210307031869888, -0.00813322514295578, 0.06650882959365845, -0.0209149532020092, 0.015389444306492805, 0.0419287234544754, 0.056463856250047684, 0.046737466007471085, -0.00819732528179884, 0.007431359961628914, -0.030620994046330452, -0.016991736367344856, 0.03356098011136055, 0.020183144137263298, -0.03726673498749733, -0.007354088127613068, -0.00364435906521976, -0.004967720713466406, -0.024402985349297523, 0.021188003942370415, -0.024830250069499016, -0.013744136318564415, -0.024432454258203506, 0.04079539701342583, 0.06067003309726715, 0.0020562238059937954, -0.04460664838552475, 0.020167259499430656, -0.015380756929516792, -0.03605104610323906, -0.015146313235163689, -0.010485309176146984, -0.01642993837594986, 0.0396936796605587, 0.04304218664765358, 0.03846996650099754, 0.003117515007033944, 0.010921617969870567, -0.016188686713576317, -0.026997745037078857, 0.013727957382798195, -0.07056873291730881, 0.017999790608882904, 0.010384900495409966, 0.004786356817930937, 0.0045690168626606464, -0.03982529044151306, -0.042512137442827225, 0.020337043330073357, 0.011349953711032867, -0.028001969680190086, -0.022955473512411118, 0.024002768099308014, -0.009848770685493946, -0.001572066335938871, -0.0069493441842496395, -0.002532847924157977, -0.032398615032434464, 0.021902071312069893, -0.01598731428384781, -0.016567682847380638, -0.007031113840639591, -0.03315054625272751, -0.02227947488427162, 0.02763650193810463, 0.04619070887565613, 0.03288180008530617, -0.02100020833313465, -0.06302886456251144, -0.004374658688902855, -0.004429817199707031, -0.02710077166557312, 0.010403608903288841, -0.03815115615725517, -0.023365577682852745, 0.0021332798060029745, -0.00801868736743927, 0.03636365011334419, 0.02534077875316143, 0.03324592113494873, -0.01430419646203518, -0.001742643304169178, 0.020207604393363, -0.024675652384757996, -0.01635800115764141, 0.05577385798096657, 0.005493336822837591, -0.04282647743821144, 0.00530677055940032, -0.031635742634534836, -0.033489882946014404, -0.025494897738099098, -0.025148404762148857, 0.018804464489221573, 0.034026142209768295, 0.00142770167440176, 0.04605071619153023, -0.00174945336766541, 0.008935236372053623, 0.0066363029181957245, 0.04848456755280495, 0.026768049225211143, 0.004832601174712181, -0.009839938022196293, 0.023788494989275932, 0.007753298152238131, -0.014007286168634892, -0.03244772180914879, 0.0030348366126418114, -0.03930148482322693, 0.05513061210513115, 0.007566357962787151, -0.03619775548577309, -0.005958585534244776, 0.0004578520020004362, -0.025963453575968742, 0.016760312020778656, 0.023625873029232025, -0.00713219353929162, 0.017642319202423096, 0.015834933146834373, 0.006331608630716801, 0.004293936304748058, 0.0068923900835216045, 0.012696806341409683, 0.06068052724003792, -0.026098424568772316, -0.02668548934161663, -0.0074260663241147995, 0.0579240508377552, 0.032024700194597244, 0.019648808985948563, 0.032623957842588425, -0.02269717864692211, 0.028530476614832878, -0.021029286086559296, 0.05161988362669945, 0.029694175347685814, -0.0501333512365818, -0.005585510283708572, -0.004549473058432341, 0.015846451744437218, -0.009542487561702728, -0.018337126821279526, 0.06468125432729721, -0.029214022681117058, 0.0006637212936766446, 0.00798764731734991, 0.06897564232349396, 0.056969787925481796, 0.02579493448138237, 0.038192056119441986, 0.0008741913479752839, 0.050437577068805695, -0.014384198933839798, 0.0018408528994768858, 0.010805903002619743, 0.016763493418693542, 0.013536423444747925, 0.0024167178198695183, 0.0056916833855211735, 0.005921081639826298, -0.0015508030774071813, 0.024029184132814407, 0.00003163261862937361, -0.017497960478067398, 0.024433623999357224, -0.0008177753770723939, -0.010065908543765545, -0.0133748734369874, -0.016416527330875397, 0.003500571008771658, -0.010858161374926567, 0.018414346501231194, -0.023016495630145073, 0.03547380492091179, -0.026154162362217903, 0.027328411117196083, 0.03393978998064995, -0.006175361108034849, 0.015528567135334015, -0.0731600746512413, 0.008939022198319435, -0.003521105507388711, -0.013511605560779572, 0.005850779823958874, -0.002649175701662898, -0.023003308102488518, 0.01806633174419403, -0.008374430239200592, 0.0014630284858867526, 0.03351382166147232, -0.022266345098614693, -0.020144188776612282, -0.017563965171575546, 0.03935381397604942, 0.01628730446100235, 0.034479234367609024, 0.021520840004086494, 0.025612249970436096, -0.030020002275705338, 0.025032104924321175, 0.001171258045360446, -0.027978502213954926, 0.04635890573263168, -0.06153154373168945, 0.05491304397583008, 0.019612088799476624, 0.0329241082072258, 0.005420860834419727, 0.027157839387655258, 0.006057883612811565, 0.00525076175108552, -0.0037709439639002085, -0.023126984015107155, -0.015440701507031918, 0.03205485641956329, 0.01220283005386591, -0.00863326620310545, 0.000061002887377981097, -0.019662044942378998, -0.012952967546880245, 0.008427632972598076, 0.0067808846943080425, 0.053549785166978836, -0.011872249655425549, 0.014810336753726006, -0.0037392862141132355, 0.04412662982940674, 0.05474038049578667, 0.027838312089443207, 0.020597010850906372, 0.006986516527831554, -0.010446593165397644, -0.05329009145498276, -0.01875419169664383, -0.040537625551223755, -0.0173789095133543, -0.058212634176015854, -0.026335755363106728, -0.013076886534690857, -0.025912396609783173, -0.025427483022212982, 0.024469560012221336, -0.011791902594268322, 0.014718028716742992, -0.00896496046334505, -0.009779142215847969, -0.007384027354419231, 0.004813321866095066, 0.04788397252559662, 0.027423439547419548, 0.004573804326355457, 0.023641828447580338, -0.004907597322016954, 0.04189373180270195, 0.013078977353870869, 0.05394035205245018, 0.06786929816007614, 0.0016176662174984813, 0.005270180758088827, -0.05505682900547981, 0.001497990102507174, 0.03579873591661453, -0.07009010761976242, 0.05164407193660736, -0.0007572815520688891, 0.005432280246168375, -0.037457432597875595, -0.000011383219316485338, 0.06313548237085342, 0.014277519658207893, 0.008258486166596413, -0.0042894803918898106, -0.034132033586502075, -0.030387399718165398, 0.035905297845602036, -0.04351147264242172, 0.0016970779979601502, 0.009093929082155228, -0.007290231995284557, 0.035723671317100525, -0.031291570514440536, 0.048952966928482056, -0.02950194850564003, 0.0050925929099321365, -0.004876064136624336, -0.02428344450891018, -0.07956501841545105, -0.04702536761760712, -0.03825918957591057, 0.052697326987981796, -0.0018056733533740044, -0.0206659696996212, -0.03310967609286308, -0.027138028293848038, -0.015171656385064125, 0.00426239799708128, -0.02270597778260708, -0.01412508450448513, -0.017357995733618736, 0.011156134307384491, 0.011525707319378853, 0.004731937311589718, 0.06635288149118423, -0.02471204102039337, -0.027347693219780922, 0.006351137068122625 ]
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
Distributed Training: Model Parallel You can use SageMaker Model Parallelism Library out of the box for distributed training. We added the functionality of Model Parallelism directly into the Trainer. If your train.py uses the Trainer API you only need to define the distribution parameter in the HuggingFace Estimator. For detailed information about the adjustments take a look here. - Example Notebook python # configuration for running training on smdistributed Model Parallel mpi_options = { "enabled" : True, "processes_per_host" : 8 } smp_options = { "enabled":True, "parameters": { "microbatches": 4, "placement_strategy": "spread", "pipeline": "interleaved", "optimize": "speed", "partitions": 4, "ddp": True, } } distribution={ "smdistributed": {"modelparallel": smp_options}, "mpi": mpi_options } # create the Estimator huggingface_estimator = HuggingFace( entry_point='train.py', source_dir='./scripts', instance_type='ml.p3dn.24xlarge', instance_count=2, role=role, transformers_version='4.4.2', pytorch_version='1.6.0', py_version='py36', hyperparameters = hyperparameters, distribution = distribution )
[ 0.03128637373447418, 0.027096912264823914, -0.02266782708466053, 0.018194371834397316, -0.013428539037704468, 0.04646840691566467, 0.002196083776652813, -0.023959673941135406, -0.06821221858263016, -0.02660665102303028, -0.06768529862165451, 0.006331003736704588, 0.052685532718896866, 0.12816861271858215, -0.008704489096999168, -0.05685659870505333, 0.006985110696405172, -0.01919087953865528, -0.032278381288051605, 0.01754385605454445, 0.004296936094760895, -0.03618737310171127, 0.021326392889022827, 0.02141258493065834, -0.05771433189511299, -0.03349936008453369, 0.05756602808833122, 0.009679817594587803, 0.02715422585606575, 0.007633877452462912, -0.11330194771289825, 0.021548546850681305, 0.05572780966758728, -0.012628383003175259, 0.016496192663908005, 0.03117893822491169, -0.11284796893596649, 0.03972256928682327, 0.036920592188835144, -0.004337943159043789, 0.03212597221136093, -0.026764430105686188, -0.08160991966724396, 0.029265793040394783, -0.003492513671517372, -0.03663354367017746, -0.02023046649992466, 0.025686856359243393, 0.012677853927016258, -0.03600694239139557, -0.08708816766738892, 0.07711450755596161, 0.00011538382386788726, -0.0020770535338670015, 0.016601162031292915, -0.009591090492904186, -0.05278828367590904, -0.03490438312292099, -0.010739832185208797, 0.02111891843378544, -0.025918249040842056, -0.004432215355336666, -0.02597646974027157, 0.06279557943344116, -0.004546615295112133, 0.015927303582429886, 0.01534384023398161, -0.04312080144882202, -0.05768575146794319, -0.08159603923559189, 0.0005365745746530592, -0.052422817796468735, 0.0010773740941658616, 0.028760656714439392, -0.02746129408478737, -0.06296944618225098, -0.0007885121740400791, -0.02175815775990486, 0.07726169377565384, 0.09280240535736084, -0.046273745596408844, -0.00043972188723273575, 0.00734978960826993, 0.05489916726946831, 0.0602283701300621, 0.02193932607769966, -0.00430738739669323, -0.07112285494804382, -0.025179820135235786, 0.012300350703299046, 0.027821840718388557, -0.06124783307313919, -0.018829721957445145, -0.0031552650034427643, 0.03704983741044998, -0.015975015237927437, -0.009853717871010303, -0.0034173012245446444, -0.03420216962695122, -0.025167835876345634, 0.024212993681430817, -0.08755767345428467, 0.032358042895793915, 0.0062738279812037945, -0.012080417014658451, 0.09345710277557373, -0.0053632319904863834, -0.13227152824401855, -0.04161626845598221, 0.02076774463057518, 0.008578726090490818, -0.07227655500173569, -0.07638614624738693, 0.062587209045887, -0.08081831783056259, 0.032199371606111526, -0.0020454612094908953, 0.003090243088081479, 0.013607141561806202, -0.01154389325529337, -0.048389334231615067, 0.08573504537343979, 0.061990026384592056, 0.037733253091573715, -0.030784450471401215, 0.09306727349758148, 0.03754671663045883, -0.055114276707172394, 0.02779163047671318, -0.016737397760152817, 0.05544012784957886, -0.054611936211586, 0.050060346722602844, 0.014419068582355976, 0.06812231242656708, -0.08408188074827194, 0.014930972829461098, -0.011542834341526031, -0.0009652242297306657, 0.011119063012301922, -0.04806014150381088, 0.11072138696908951, 0.044729314744472504, 0.02551710046827793, 0.026687582954764366, 0.03763145953416824, -0.07190334796905518, 0.022242456674575806, -0.004507730714976788, -0.0017828772542998195, -0.12541402876377106, 0.13155397772789001, -0.03005632571876049, -0.026918327435851097, 0.06926017999649048, 0.09044233709573746, -0.028448164463043213, -0.012237158603966236, -0.052998024970293045, -0.03867657110095024, -0.010502707213163376, 0.021877432242035866, -0.045671332627534866, -0.02159334160387516, -0.023640044033527374, 0.036945734173059464, 0.024454444646835327, 0.01838868483901024, 0.02572096325457096, -0.021452363580465317, -0.018985506147146225, 0.015873339027166367, -0.03195697069168091, 0.018671831116080284, 0.04161059111356735, 0.01726233772933483, 0.025466307997703552, 0.139602929353714, -0.003506843699142337, -0.0031192628666758537, -0.025999058037996292, 0.02437543123960495, -0.00877645704895258, 0.040803637355566025, 0.0478735975921154, -0.034365370869636536, 0.05956380441784859, -0.039158277213573456, -0.032132867723703384, 0.05912819504737854, -0.03299698233604431, -0.028485309332609177, 0.05638541281223297, -0.01493113860487938, 0.04296045005321503, -0.03961862251162529, -0.032420992851257324, 0.03429804742336273, 0.02638779953122139, 0.02156485617160797, 0.05818738788366318, -0.06276539713144302, -0.03740639612078667, 0.04773600772023201, 0.014586151577532291, 0.02705065719783306, -0.015780910849571228, -0.052569590508937836, 0.04322842136025429, -0.011212513782083988, -0.053925931453704834, -0.11847467720508575, 0.007886332459747791, -0.037617865949869156, 0.01466367393732071, 0.032763127237558365, -0.04300972446799278, 0.02170100063085556, 0.02246842533349991, 0.04549472779035568, 0.19560974836349487, -0.05485273525118828, 0.03776293992996216, -0.04353119805455208, 0.03930380195379257, -0.009252103045582771, 0.03910389542579651, 0.0724010095000267, 0.056791678071022034, -0.034902166575193405, -0.022583823651075363, -0.02945864200592041, 0.001803237129934132, 0.04927537217736244, 0.029571782797574997, -0.016379117965698242, -0.03578554466366768, -0.03769978508353233, 0.025492969900369644, -0.04343915358185768, 0.0018106967909261584, 0.058305125683546066, 0.00414514122530818, 0.01107262633740902, 0.03142085671424866, 0.009222503751516342, 0.05045250430703163, 0.0018510696245357394, -0.031593091785907745, -0.03208594396710396, -0.07237739861011505, 0.017337286844849586, 0.023372672498226166, -0.05878586322069168, 0.009123070165514946, 0.052040547132492065, -0.003685625968500972, -0.003611756255850196, 0.007107728626579046, 0.060818664729595184, 0.03318195044994354, 0.02764086052775383, -0.019514642655849457, -0.04043407365679741, -0.022947747260332108, -0.04503193870186806, 0.011732568964362144, -0.02281245030462742, 0.029723769053816795, -0.002379094948992133, 0.04307772219181061, -0.026159295812249184, 0.022804168984293938, -0.021777814254164696, 0.022162050008773804, 0.0015834788791835308, 0.029520653188228607, -0.017272071912884712, -0.0030321674421429634, -0.024752652272582054, -0.008767873048782349, -0.027911638841032982, -0.038473550230264664, 0.025707848370075226, -0.02609468623995781, -0.007327443920075893, -0.00868246890604496, -0.014477825723588467, -0.0374160073697567, -0.012088185176253319, 0.0342729315161705, 0.05929958075284958, 0.026187030598521233, -0.009724086150527, 0.0009461825829930604, 0.025106240063905716, -0.017080334946513176, -0.0054154046811163425, -0.014591756276786327, 0.005172926001250744, -0.017981529235839844, -0.000311603129375726, 0.0037569706328213215, -0.019764691591262817, -0.028207041323184967, -0.05817405506968498, -0.014923245646059513, 0.024098705500364304, -0.07475701719522476, -0.057906486093997955, -0.04679917171597481, 0.03504391387104988, 0.008343087509274483, -0.018410643562674522, 0.03876093402504921, -0.014824718236923218, -0.0033427136950194836, 0.007735599763691425, 0.011344967409968376, 0.02877062000334263, -0.007784111890941858, -0.028373170644044876, -0.021039027720689774, -0.022264063358306885, 0.004604449030011892, -0.04116956517100334, 0.020870093256235123, 0.03334945812821388, -0.014042533934116364, 0.035342536866664886, 0.009067073464393616, -0.02886354923248291, -0.008527022786438465, 0.00027032761136069894, 0.03443281725049019, 0.01199981477111578, 0.00700205285102129, -0.06263098120689392, -0.036580465734004974, -0.031878549605607986, -0.030104687437415123, -0.04421800374984741, 0.005903533194214106, -0.006446723360568285, 0.0256926491856575, 0.031684864312410355, 0.04614843428134918, 0.011327141895890236, 0.02821562997996807, -0.029301932081580162, 0.058240678161382675, -0.04706389456987381, 0.05743935704231262, 0.013272853568196297, -0.020963827148079872, -0.012540980242192745, 0.03282460197806358, 0.008222663775086403, 0.019850555807352066, -0.00987223256379366, 0.02186940237879753, -0.023787185549736023, -0.02332344837486744, 0.01933787763118744, 0.0012985216453671455, 0.05222314968705177, 0.020770322531461716, 0.0007274080999195576, -0.032442357391119, 0.02375088818371296, -0.0452103428542614, -0.030447492375969887, -0.02172386646270752, 0.018243510276079178, 0.042861755937337875, 0.01379354577511549, -0.031363602727651596, 0.02249113842844963, 0.004952038638293743, 0.025458641350269318, 0.005780346691608429, 0.011149365454912186, -0.03685350343585014, -0.0066919270902872086, -0.041158583015203476, -0.04676663503050804, 0.030825452879071236, 0.01806037314236164, 0.005643399897962809, -0.017413917928934097, -0.030397359281778336, -0.06074429675936699, 0.012355558574199677, 0.005800125189125538, 0.03560657426714897, -0.04326556250452995, 0.06386963278055191, 0.041827403008937836, -0.017693035304546356, -0.03710964694619179, 0.047827448695898056, -0.0010722657898440957, 0.002897617407143116, -0.011457836255431175, 0.012651479803025723, 0.03451774641871452, -0.046600278466939926, -0.005398918408900499, 0.022630615159869194, -0.06063826382160187, 0.0001595017674844712, -0.003696150379255414, -0.02998305670917034, 0.03192752227187157, 0.005117514170706272, -0.040855757892131805, -0.010008218698203564, 0.000703005469404161, -0.0041096699424088, -0.0022211221512407064, 0.00599956838414073, 0.002708274405449629, 0.02068723924458027, 0.04151158034801483, -0.03194836527109146, 0.0020889313891530037, -0.023325012996792793, 0.038051310926675797, -0.057633236050605774, 0.02619381621479988, 0.011909262277185917, -0.031434960663318634, 0.011028791777789593, 0.02031133510172367, 0.01351441815495491, 0.02174215577542782, -0.010141958482563496, -0.035601984709501266, -0.04343627020716667, -0.016250990331172943, -0.02613839879631996, -0.003806081600487232, -0.0141927320510149, 0.002445460297167301, -0.02326083742082119, 0.024276504293084145, 0.015071769244968891, 0.008294209837913513, -0.030946848914027214, 0.05346975475549698, 0.03366738185286522, 0.014380075968801975, 0.020363392308354378, 0.0100295664742589, -0.06029047444462776, 0.003994327038526535, -0.0630355030298233, 0.015042545273900032, 0.018488788977265358, 0.005742928013205528, -0.049908220767974854, 0.019255582243204117, 0.05380704998970032, -0.0037583892699331045, -0.011499292217195034, 0.045163486152887344, 0.03523939475417137, 0.05256224423646927, -0.019342884421348572, -0.010304918512701988, -0.0255232322961092, -0.013523034751415253, -0.004372109659016132, 0.026448329910635948, 0.0018610155675560236, -0.06492027640342712, -0.002288521034643054, -0.00014756702876184136, -0.015934431925415993, -0.0025294129736721516, 0.028928060084581375, -0.022060055285692215, -0.010502520017325878, 0.06394193321466446, 0.07620636373758316, 0.014680509455502033, -0.05592330917716026, 0.00480066379532218, 0.005120381247252226, -0.056114137172698975, -0.028616461902856827, -0.04045568406581879, -0.02390648052096367, 0.03354121744632721, 0.025993168354034424, 0.046087246388196945, 0.010647203773260117, 0.0161932073533535, 0.028512369841337204, -0.014183838851749897, 0.03636008873581886, -0.044548798352479935, 0.009909150190651417, -0.008486909791827202, -0.000679488992318511, 0.02736397087574005, -0.022403819486498833, -0.014955182559788227, 0.04048410803079605, 0.041750773787498474, -0.010367173701524734, -0.05805063992738724, 0.007053321227431297, 0.01136048510670662, -0.010375840589404106, -0.04783220216631889, -0.01845836080610752, -0.01672082394361496, 0.017657414078712463, -0.020814841613173485, -0.023078065365552902, 0.001683710841462016, 0.009801030158996582, -0.023296531289815903, -0.025433991104364395, 0.02086525596678257, 0.005189698189496994, 0.043688029050827026, -0.048172347247600555, 0.00046444431063719094, 0.012376535683870316, -0.0509057343006134, -0.013044178485870361, -0.04306478798389435, -0.002471267245709896, 0.015279515646398067, 0.0031026487704366446, 0.06020555645227432, -0.003867823863402009, 0.006461712531745434, -0.039374686777591705, -0.013091995380818844, 0.04365864396095276, -0.005678950343281031, 0.0035748742520809174, 0.07408519834280014, 0.017055023461580276, -0.0646916925907135, -0.02688530832529068, -0.03118283487856388, -0.00352338794618845, 0.03927736356854439, -0.02591421641409397, 0.001954821404069662, 0.036142367869615555, -0.03981957957148552, 0.008689834736287594, -0.039994511753320694, 0.007688615471124649, 0.020120052620768547, 0.02803150936961174, 0.001832710113376379, -0.011101369746029377, 0.028519930317997932, -0.025176873430609703, -0.017434652894735336, 0.02058553136885166, 0.023805346339941025, 0.018478380516171455, -0.0407603420317173, 0.00994645245373249, -0.007146183867007494, -0.014238088391721249, -0.005380830727517605, 0.005455601494759321, -0.05507216975092888, -0.010519350878894329, -0.009305720217525959, 0.035137008875608444, 0.03352520242333412, -0.029778651893138885, -0.0021406346932053566, 0.008890937082469463, 0.013275942765176296, -0.010262209922075272, 0.05837957561016083, -0.020293930545449257, 0.01962869241833687, 0.013902676291763783, 0.010608851909637451, 0.008672920055687428, 0.017503123730421066, 0.01636045053601265, -0.003966497257351875, 0.06188156455755234, -0.013670877553522587, 0.026090767234563828, 0.04537773132324219, -0.012722427025437355, -0.008273192681372166, -0.04199127480387688, -0.012295187450945377, -0.014897101558744907, -0.011536014266312122, 0.016040757298469543, -0.013345461338758469, -0.0008412278839387, 0.007495852652937174, 0.03770320862531662, 0.06322116404771805, 0.050512202084064484, 0.0017164446180686355, 0.003136905375868082, 0.03402424603700638, 0.010401853360235691, -0.015966905280947685, 0.06486246734857559, 0.02698393166065216, 0.030392993241548538, -0.0012180556077510118, 0.039697375148534775, 0.03683258220553398, -0.015016202814877033, 0.011445107869803905, -0.00426147598773241, -0.028133615851402283, -0.03337501734495163, 0.010845857672393322, 0.010804560966789722, -0.025562230497598648, -0.003066875971853733, 0.01628957688808441, -0.0038183173164725304, 0.048984088003635406, -0.02925194799900055, 0.021975457668304443, -0.012136152014136314, -0.010768353939056396, -0.013647924177348614, 0.023992111906409264, -0.002361105754971504, -0.03209496662020683, 0.02192232571542263, -0.006643800996243954, 0.01234224159270525, 0.034731175750494, -0.03999581187963486, 0.0107990438118577, -0.01742665097117424, 0.015370343811810017, 0.0128812026232481, 0.03408973291516304, -0.0011906871804967523, 0.02110719494521618, 0.0488135851919651, -0.0067998990416526794, 0.011657166294753551, 0.053080759942531586, 0.029758937656879425, 0.03677910566329956, -0.047613125294446945, 0.012509562075138092, 0.009240451268851757, -0.05842137336730957, 0.07648533582687378, -0.03393104299902916, 0.038338880985975266, -0.00898671429604292, 0.03553661331534386, 0.01341327466070652, 0.019449075683951378, 0.014062299393117428, -0.022166626527905464, -0.005811259150505066, 0.0009417847031727433, 0.001180026214569807, 0.04347914084792137, 0.02624165639281273, -0.018560461699962616, 0.007258256431668997, 0.023272139951586723, 0.004252597689628601, -0.007012253627181053, 0.006516383495181799, 0.05982246994972229, -0.04230998456478119, 0.033421602100133896, 0.0009132613777182996, 0.020053217187523842, 0.002335519762709737, 0.02563379518687725, -0.011240744031965733, -0.0001491251605330035, 0.022274106740951538, -0.02250947803258896, -0.002356225624680519, -0.030422132462263107, 0.002645009197294712, -0.01474054902791977, -0.041439276188611984, 0.002320285188034177, 0.0035919162910431623, -0.05730164796113968, 0.05081624910235405, -0.030716141685843468, 0.009912898764014244, 0.02310178428888321, 0.001628255588002503, -0.015831371769309044, -0.012044448405504227, 0.07269652932882309, 0.0294524896889925, 0.03323427587747574, 0.002365917433053255, -0.07053539156913757, -0.011054014787077904, -0.03969406336545944, 0.03278582915663719, 0.06508219987154007, -0.010075116530060768, 0.006818144116550684, -0.012728985399007797, 0.018651815131306648, 0.03693162649869919, -0.05853252112865448, -0.0030871385242789984, -0.015687409788370132, -0.007601166609674692, -0.04245142266154289, 0.010810146108269691, 0.06452884525060654, -0.03241337090730667, 0.05407285317778587, -0.008369809947907925, 0.008546095341444016, -0.048631489276885986, 0.0012240478536114097, -0.02957271598279476, 0.013718190602958202, -0.027413971722126007, -0.028298722580075264, 0.027336137369275093, -0.01840881071984768, 0.054306693375110626, -0.022860964760184288, 0.007648367900401354, -0.009526528418064117, -0.01272906456142664, -0.029312942177057266, -0.09908327460289001, 0.012650709599256516, 0.028712313622236252, -0.030620962381362915, -0.018520742654800415, -0.001986934570595622, 0.006479424890130758, -0.03064863383769989, -0.016363197937607765, 0.0009121699258685112, 0.04001667723059654, -0.027090908959507942, 0.027180006727576256, 0.01369465235620737, 0.020924430340528488, 0.005734069738537073, -0.024994807317852974, -0.016409054398536682, -0.0064184824004769325 ]
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 a HuggingFace Estimator and train our model In order to create a SageMaker Trainingjob we can use a HuggingFace Estimator. The Estimator handles the end-to-end Amazon SageMaker training. In an Estimator, we define which fine-tuning script should be used as entry_point, which instance_type should be used, which hyperparameters are passed in. In addition to this, a number of advanced controls are available, such as customizing the output and checkpointing locations, specifying the local storage size or network configuration. SageMaker takes care of starting and managing all the required Amazon EC2 instances for us with the Hugging Face DLC, it uploads the provided fine-tuning script, for example, our train.py, then downloads the data from the S3 bucket, sess.default_bucket(), into the container. Once the data is ready, the training job will start automatically by running. bash /opt/conda/bin/python train.py --epochs 1 --model_name distilbert-base-uncased --train_batch_size 32 The hyperparameters you define in the HuggingFace Estimator are passed in as named arguments. python from sagemaker.huggingface import HuggingFace # hyperparameters, which are passed into the training job hyperparameters={'epochs': 1, 'train_batch_size': 32, 'model_name':'distilbert-base-uncased' } # 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.6', pytorch_version='1.7', py_version='py36', hyperparameters = hyperparameters ) To start our training we call the .fit() method and pass our S3 uri as input. python # starting the train job with our uploaded datasets as input huggingface_estimator.fit({'train': training_input_path, 'test': test_input_path}) ---
[ -0.008009861223399639, 0.005329040344804525, -0.01330367662012577, 0.019872061908245087, 0.039086852222681046, 0.06623131036758423, 0.040327344089746475, -0.009751581586897373, -0.050589144229888916, 0.00015340880781877786, -0.062254536896944046, 0.04505184665322304, 0.023173004388809204, 0.09331309050321579, -0.001165406429208815, -0.08547628670930862, 0.00861866120249033, -0.002691964851692319, -0.03218843415379524, 0.02428976073861122, -0.01686759851872921, -0.011719976551830769, -0.0010585737181827426, 0.013330833986401558, 0.0014615770196542144, -0.06135629117488861, 0.0386505052447319, -0.014883921481668949, 0.0021622509229928255, 0.049177251756191254, -0.06400702893733978, 0.004073040094226599, 0.013899626210331917, -0.09020177274942398, 0.025279026478528976, 0.04544607177376747, -0.13916939496994019, 0.010110278613865376, 0.04675369709730148, -0.004301393870264292, -0.030178628861904144, 0.008121875114738941, -0.06849589943885803, 0.05184842646121979, 0.006444981787353754, -0.07194782048463821, -0.17041434347629547, 0.03126588463783264, 0.009930010885000229, 0.000436238304246217, -0.05970655754208565, 0.1361314058303833, 0.012490455061197281, -0.006469179410487413, -0.013278365135192871, -0.011778167448937893, 0.05024927109479904, -0.038171011954545975, -0.022112471982836723, -0.033779677003622055, -0.005419302731752396, -0.02055376023054123, -0.04490778595209122, 0.038386791944503784, 0.013754958286881447, 0.029529530555009842, -0.009101263247430325, -0.042892638593912125, -0.07773435860872269, -0.058291126042604446, -0.005323578137904406, -0.06430076062679291, 0.022189384326338768, 0.022621359676122665, -0.057686638087034225, -0.07326055318117142, 0.035163186490535736, -0.03110537864267826, 0.029431356117129326, 0.08168450742959976, -0.05890897661447525, -0.019980143755674362, 0.008721986785531044, 0.031117793172597885, 0.043142277747392654, 0.049922626465559006, -0.021249884739518166, -0.050432804971933365, -0.05070946738123894, 0.07578901946544647, 0.022277552634477615, -0.0814012736082077, -0.018024805933237076, 0.03009958565235138, 0.021024852991104126, -0.043503861874341965, -0.005537485703825951, -0.006629808805882931, 0.034532587975263596, -0.031412795186042786, 0.028618456795811653, -0.07855159789323807, 0.009951457381248474, -0.08803942054510117, -0.03645789250731468, 0.08182241022586823, 0.024827608838677406, -0.0800766870379448, -0.010340346023440361, 0.01685453951358795, 0.024552538990974426, -0.03430524095892906, -0.02049090340733528, 0.11469294130802155, -0.08109339326620102, 0.058627430349588394, 0.01255571749061346, -0.04967690631747246, -0.003969481680542231, -0.02474331669509411, 0.024994205683469772, 0.08440900593996048, 0.0427437387406826, 0.0014540328411385417, -0.060980264097452164, 0.05446271970868111, 0.018200721591711044, -0.021531235426664352, 0.04356412589550018, -0.035210657864809036, 0.007651511579751968, -0.05301400646567345, 0.06207885965704918, -0.017008384689688683, 0.03083202987909317, -0.07355041056871414, 0.004646404646337032, -0.039692655205726624, 0.014989521354436874, 0.04889851063489914, 0.01279598381370306, 0.12463492155075073, 0.02308032289147377, -0.0002950284397229552, 0.04494883865118027, 0.01823960244655609, -0.015681704506278038, 0.02782273478806019, 0.042068757116794586, 0.05027474835515022, -0.10003587603569031, 0.060631901025772095, -0.013225176371634007, -0.06736411154270172, 0.04859655722975731, 0.06491897255182266, -0.022978488355875015, -0.03566281870007515, -0.029255054891109467, -0.017789045348763466, 0.026202276349067688, 0.0016870202962309122, -0.04460407793521881, -0.038299206644296646, 0.0088804354891181, -0.009578132070600986, 0.03954477235674858, 0.033346742391586304, 0.026874475181102753, -0.040687695145606995, -0.01282245758920908, -0.03234259411692619, 0.03543363884091377, -0.005664346273988485, 0.05852704122662544, 0.011552904732525349, 0.05016675218939781, 0.05679066479206085, -0.028669986873865128, 0.006198066286742687, -0.04434555396437645, 0.07348179817199707, -0.02787058986723423, 0.03598393499851227, 0.0821060985326767, -0.0745415911078453, 0.013170536607503891, 0.0028483124915510416, 0.02695188857614994, 0.03417613357305527, 0.007152842357754707, -0.008803113363683224, 0.03247229754924774, -0.0039039435796439648, 0.07965943962335587, -0.030334051698446274, -0.007525216322392225, 0.1150764673948288, 0.025820834562182426, 0.04233947768807411, 0.025639189407229424, -0.025846220552921295, -0.0035092972684651613, 0.039996542036533356, -0.03088175132870674, 0.04756564274430275, -0.010530931875109673, -0.03683082014322281, 0.06535904109477997, -0.0009672855376265943, -0.004995654337108135, -0.1079542338848114, 0.01179114356637001, -0.07799063622951508, -0.010226266458630562, 0.010429850779473782, -0.04792703688144684, -0.05756818503141403, 0.023049242794513702, 0.03079867735505104, 0.14616666734218597, -0.011813950724899769, 0.02560427598655224, -0.06348690390586853, -0.024820661172270775, -0.0006611918215639889, 0.05325785279273987, 0.06004337593913078, 0.07216263562440872, -0.0991220474243164, -0.024140821769833565, -0.07374083250761032, 0.0174042209982872, 0.050598472356796265, -0.01566314324736595, -0.0599883608520031, 0.028173083439469337, -0.023024164140224457, -0.01378672756254673, 0.029727885499596596, 0.061038944870233536, 0.011227542534470558, 0.01779216155409813, 0.011354386806488037, -0.0020401240326464176, -0.0002713567519094795, 0.06331740319728851, 0.008634916506707668, -0.0804005041718483, -0.03219282627105713, -0.08231084793806076, 0.07167664170265198, 0.033195458352565765, -0.025638559833168983, 0.0017752938438206911, 0.034170567989349365, -0.014492882415652275, 0.014707931317389011, 0.0032773546408861876, 0.098877914249897, 0.009879101067781448, 0.03222902491688728, -0.023038949817419052, 0.008157769218087196, -0.01444551907479763, -0.05319316312670708, -0.006894961465150118, -0.004290719982236624, 0.0025820296723395586, 0.002854574704542756, 0.03846849873661995, -0.016683775931596756, 0.0061193183064460754, 0.03277729079127312, 0.015182234346866608, 0.02195119298994541, 0.052409421652555466, 0.0009590550325810909, -0.0065079983323812485, -0.0037043183110654354, 0.01799178123474121, -0.007445153780281544, -0.019502516835927963, 0.034635499119758606, 0.013924822211265564, -0.010372919030487537, -0.013230145908892155, -0.037000905722379684, -0.021716365590691566, 0.029268480837345123, 0.014593041501939297, 0.060195814818143845, 0.03885618969798088, 0.0006122193299233913, 0.01276436261832714, 0.010790127329528332, -0.014089948497712612, -0.012386397458612919, 0.0009334143251180649, 0.083558589220047, -0.020270884037017822, 0.00013470333942677826, -0.0029818397015333176, -0.0028413443360477686, -0.04731258749961853, -0.011531348340213299, 0.018000144511461258, 0.01778763346374035, -0.09088239073753357, -0.02461862564086914, -0.033802736550569534, -0.0017111905617639422, 0.011188491247594357, -0.005840401165187359, 0.04731352999806404, -0.016308266669511795, -0.03473903238773346, -0.0035934497136622667, 0.009623085148632526, 0.07344525307416916, -0.0015316817443817854, -0.015449689701199532, -0.019538315013051033, -0.0035401058848947287, -0.002286277711391449, -0.010982229374349117, 0.011055754497647285, 0.029452653601765633, -0.0516679547727108, 0.037118908017873764, 0.017205219715833664, -0.027261212468147278, 0.0037384771276265383, 0.007086939178407192, 0.019318491220474243, -0.003682483686134219, 0.019983798265457153, -0.03533202037215233, -0.005699324421584606, -0.009006592445075512, -0.021694179624319077, 0.010465459898114204, -0.052366457879543304, -0.02511618658900261, 0.05036349222064018, 0.04376648738980293, 0.018453732132911682, 0.017445292323827744, 0.004659275058656931, 0.001168363611213863, -0.0008505808655172586, 0.008540698327124119, 0.040942419320344925, -0.0031635465566068888, -0.0020849539432674646, -0.016553087159991264, -0.005480800289660692, 0.0057219211012125015, 0.011992758139967918, 0.007497936952859163, 0.029227327555418015, 0.013905259780585766, -0.010205617174506187, 0.017711449414491653, 0.023754503577947617, 0.042743001133203506, 0.029034405946731567, -0.025920720770955086, -0.05278847739100456, 0.03928223252296448, -0.034124501049518585, -0.01133854128420353, -0.01182528305798769, 0.03539753705263138, 0.00878988765180111, -0.0035874349996447563, 0.01165228895843029, 0.03326454386115074, 0.003954153507947922, 0.023220228031277657, -0.029849600046873093, 0.016089720651507378, -0.06060948967933655, -0.015337413176894188, -0.05123006924986839, -0.020707227289676666, 0.04466954991221428, 0.01700015924870968, -0.0024191271513700485, 0.009616429917514324, -0.017176054418087006, -0.03757617622613907, 0.020297445356845856, 0.017533840611577034, 0.017452767118811607, -0.08328110724687576, 0.04753618314862251, 0.06977465003728867, 0.004944941028952599, -0.036823172122240067, 0.0017755875596776605, 0.00242604804225266, -0.011721216142177582, -0.009574134834110737, 0.02157551981508732, -0.012490037828683853, -0.010206631384789944, 0.00736628845334053, 0.030048707500100136, -0.02565181441605091, 0.014590722508728504, 0.002672613598406315, -0.006101635284721851, -0.0025988700799643993, -0.04842449724674225, -0.05143805593252182, 0.008059092797338963, -0.02598278969526291, 0.029940228909254074, -0.023984195664525032, -0.015802286565303802, -0.02966979332268238, 0.02484787628054619, 0.06656578928232193, -0.0021568089723587036, -0.02466011419892311, 0.00869739893823862, 0.06335777044296265, -0.027679625898599625, 0.03913842514157295, 0.00731674674898386, -0.02053879387676716, 0.014729240909218788, -0.011611179448664188, 0.03574223443865776, 0.04055989906191826, 0.0006077539292164147, -0.062389880418777466, -0.036637868732213974, -0.00491675827652216, -0.00007623035344295204, -0.01670033298432827, 0.015008276328444481, -0.0005874622147530317, -0.02971954457461834, 0.02289743348956108, 0.02665075659751892, 0.015425393357872963, -0.02313409000635147, 0.025780225172638893, 0.021631766110658646, -0.024493539705872536, 0.040194638073444366, 0.02914292924106121, -0.06312984228134155, -0.023517832159996033, -0.022392280399799347, 0.03174050152301788, -0.0034084287472069263, 0.01803668402135372, -0.04102154076099396, -0.012194739654660225, 0.019083311781287193, -0.03649552911520004, -0.009086602367460728, 0.002981096040457487, 0.02265811525285244, 0.05414918065071106, 0.005672197788953781, 0.0013560311635956168, -0.004966201260685921, -0.007203296758234501, 0.03036941960453987, 0.018953587859869003, -0.018590591847896576, -0.041427433490753174, -0.0028102565556764603, 0.021525220945477486, -0.007499870844185352, -0.004290943033993244, -0.003041131654754281, -0.046762630343437195, -0.004756863694638014, 0.03737303614616394, 0.048294778913259506, 0.0015561579493805766, -0.0530608668923378, 0.018326207995414734, 0.00667854817584157, -0.030081886798143387, -0.01182490959763527, -0.036082904785871506, -0.0007736727129667997, 0.00023995593073777854, 0.056407347321510315, 0.041154198348522186, -0.01058129034936428, 0.026484210044145584, 0.021860282868146896, -0.01368815079331398, 0.039064470678567886, -0.047006089240312576, -0.00299823097884655, 0.006824919953942299, 0.0062815966084599495, 0.01349628996104002, -0.0318344421684742, -0.01877816952764988, 0.02735684998333454, 0.038368746638298035, -0.022879470139741898, -0.032883986830711365, 0.035994596779346466, 0.020510924980044365, -0.020915616303682327, 0.0015139925526455045, 0.010887608863413334, -0.030667932704091072, 0.0088809160515666, -0.014188856817781925, -0.005854388698935509, 0.01011846773326397, -0.015304003842175007, -0.02437102049589157, -0.000621414219494909, 0.050088509917259216, 0.011968839913606644, 0.015307295136153698, -0.025519993156194687, 0.004107925109565258, 0.024110842496156693, -0.02630496956408024, 0.01845395192503929, -0.05505931004881859, -0.005630800500512123, -0.0059774103574454784, -0.018553726375102997, 0.040879733860492706, 0.007759633474051952, 0.011658999137580395, -0.029445551335811615, -0.010743185877799988, 0.01999921165406704, -0.03437255695462227, -0.01931030862033367, 0.06721228361129761, 0.021266603842377663, -0.025358285754919052, -0.003711942583322525, -0.017611758783459663, 0.012945126742124557, -0.016469936817884445, -0.03742697834968567, 0.034924935549497604, 0.05695463344454765, -0.0026578509714454412, 0.007037982810288668, -0.019847605377435684, 0.0063453963957726955, 0.019078049808740616, 0.027024826034903526, 0.012875551357865334, 0.030539914965629578, 0.01342820655554533, -0.04830797016620636, 0.01153737585991621, 0.006435389164835215, -0.0034334438387304544, 0.008288698270916939, -0.07512117177248001, 0.03488680720329285, 0.03307170048356056, -0.0362316258251667, 0.010921699926257133, -0.01673291064798832, -0.013084962964057922, 0.007976054213941097, -0.037320543080568314, 0.042239710688591, 0.026195472106337547, -0.010718125849962234, 0.0075140842236578465, 0.01967286504805088, 0.0015586224617436528, 0.016121702268719673, 0.06741844117641449, -0.03163238614797592, 0.019862953573465347, -0.00591734703630209, 0.0329040065407753, 0.03633715957403183, 0.008465033024549484, 0.020740201696753502, -0.01646292582154274, 0.07420377433300018, 0.01515695359557867, 0.023593220859766006, 0.056076779961586, -0.014302938245236874, -0.015495858155190945, -0.024015070870518684, -0.0027688757982105017, -0.029491275548934937, -0.01020686887204647, 0.04904767870903015, -0.008576854132115841, 0.001906331512145698, -0.002811216516420245, 0.047235846519470215, 0.06150917708873749, 0.04007421061396599, 0.033244527876377106, 0.025922058150172234, 0.07305515557527542, -0.020003488287329674, -0.031684208661317825, 0.04679196700453758, 0.00650350796058774, 0.005286667961627245, 0.01822051592171192, 0.03470757231116295, -0.002612836193293333, 0.025147853419184685, -0.011475170031189919, -0.004648968577384949, -0.0024809923488646746, -0.031153904274106026, 0.011530917137861252, 0.02266010083258152, -0.03885185346007347, -0.024967269971966743, 0.013327623717486858, -0.008104093372821808, 0.06272657215595245, -0.027131376788020134, 0.015680059790611267, -0.023740191012620926, 0.005153935868293047, -0.023668641224503517, 0.010604644194245338, 0.026212135329842567, -0.06291862577199936, -0.01485033892095089, -0.0012161133345216513, 0.003486599773168564, 0.0022920810151845217, -0.026781203225255013, -0.05715646594762802, -0.0184753630310297, -0.03442870080471039, -0.029613351449370384, 0.02074596844613552, -0.04889623448252678, -0.025836823508143425, -0.012020425871014595, 0.003772812196984887, 0.024489983916282654, 0.03664731606841087, 0.049847621470689774, 0.009227633476257324, -0.021477561444044113, 0.012926442548632622, -0.010274712927639484, -0.004712113179266453, 0.0241464264690876, -0.050853464752435684, 0.028118612244725227, -0.003965304233133793, 0.03905155137181282, -0.030864709988236427, 0.016054809093475342, -0.00012254179455339909, -0.019933059811592102, -0.0008413476753048599, -0.0192201416939497, -0.013737693428993225, 0.029799146577715874, -0.0015440394636243582, -0.01696881838142872, 0.019779790192842484, -0.0050713419914245605, -0.008561904542148113, 0.01361687108874321, -0.003366622840985656, 0.03666789457201958, -0.04517300799489021, -0.009263458661735058, 0.0057382769882678986, 0.014387371018528938, -0.0055987779051065445, 0.011197861284017563, 0.023722916841506958, 0.011596285738050938, 0.0014161234721541405, -0.026532577350735664, 0.000652099319268018, -0.04484253749251366, -0.04139568656682968, -0.046432413160800934, -0.0720338299870491, -0.022202346473932266, -0.02647733874619007, -0.03862325847148895, 0.038282036781311035, -0.04458591714501381, -0.014218216761946678, -0.03722057864069939, 0.006740971002727747, -0.03522450476884842, 0.005409501027315855, 0.05903499200940132, 0.04185820743441582, 0.027068058028817177, -0.0009608852560631931, -0.07362078130245209, 0.0010208084713667631, 0.020242951810359955, 0.030189476907253265, 0.0616130530834198, 0.014164119027554989, -0.010026445612311363, -0.011709770187735558, -0.003614073386415839, 0.03246697410941124, -0.06385141611099243, 0.01149141974747181, -0.001251036999747157, 0.0042840600945055485, -0.021488234400749207, -0.0037225729320198298, 0.02143680863082409, 0.01418335735797882, 0.041679397225379944, -0.028053009882569313, -0.019089877605438232, -0.03218912333250046, 0.050272975116968155, -0.029188523069024086, 0.030148617923259735, -0.025390170514583588, -0.032112061977386475, 0.006117599550634623, -0.007385466247797012, 0.0593525692820549, -0.041768450289964676, -0.017295416444540024, -0.014322775416076183, -0.0029564425349235535, -0.05592020973563194, -0.04817351698875427, 0.030548477545380592, 0.02176089398562908, -0.02387186326086521, -0.031066585332155228, -0.033868592232465744, -0.032564371824264526, -0.014625118114054203, 0.03037283383309841, -0.005241915117949247, -0.0034432285465300083, -0.029220495373010635, 0.01594575121998787, -0.004320497624576092, 0.03748328983783722, 0.033437103033065796, -0.00482159061357379, -0.02233639732003212, 0.004533124156296253 ]
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
Distributed Training: Data-Parallel You can use SageMaker Data Parallelism Library out of the box for distributed training. We added the functionality of Data Parallelism directly into the Trainer. If your train.py uses the Trainer API you only need to define the distribution parameter in the HuggingFace Estimator. - Example Notebook PyTorch - Example Notebook TensorFlow python # configuration for running training on smdistributed Data Parallel distribution = {'smdistributed':{'dataparallel':{ 'enabled': True }}} # create the Estimator huggingface_estimator = HuggingFace( entry_point='train.py', source_dir='./scripts', instance_type='ml.p3dn.24xlarge', instance_count=2, role=role, transformers_version='4.4.2', pytorch_version='1.6.0', py_version='py36', hyperparameters = hyperparameters distribution = distribution ) The "Getting started: End-to-End Text Classification 🧭" example can be used for distributed training without any changes.
[ 0.0319100059568882, 0.018850263208150864, -0.03061562031507492, 0.012277062982320786, -0.011306189000606537, 0.047806210815906525, -0.006778468377888203, -0.009084553457796574, -0.03275265172123909, -0.043065834790468216, -0.06751006096601486, 0.020676851272583008, 0.029571477323770523, 0.1295347958803177, -0.007099649868905544, -0.052693743258714676, -0.0024460693821310997, -0.012016854248940945, -0.031003903597593307, 0.039186544716358185, 0.01256475504487753, -0.012536873109638691, -0.006682917475700378, 0.030452910810709, -0.061289649456739426, -0.010721283033490181, 0.06732181459665298, 0.025698861107230186, 0.0327763706445694, 0.014614592306315899, -0.12595315277576447, 0.032295797020196915, 0.052475593984127045, -0.009102675132453442, 0.02162097580730915, 0.04749360308051109, -0.10856660455465317, 0.04653221741318703, 0.05450217053294182, -0.00153509306255728, 0.01681949384510517, -0.020582495257258415, -0.09790829569101334, 0.03309185430407524, -0.019659077748656273, -0.030637966468930244, -0.03604156896471977, 0.02668439969420433, 0.013172373175621033, -0.011657541617751122, -0.10875168442726135, 0.07307487726211548, 0.00945886317640543, 0.01020106766372919, 0.016819005832076073, 0.0000707574508851394, -0.07840163260698318, -0.04166802018880844, -0.008210957981646061, 0.02939646504819393, -0.02462439052760601, -0.007166481111198664, -0.03249720484018326, 0.059379227459430695, -0.007601442746818066, 0.019757764413952827, 0.01697995699942112, -0.04524341970682144, -0.05855399742722511, -0.07980400323867798, -0.005236918572336435, -0.036675892770290375, -0.01066545769572258, 0.015071014873683453, -0.043886128813028336, -0.06146195903420448, 0.003937327768653631, -0.02429630048573017, 0.06505084037780762, 0.06561537832021713, -0.049142446368932724, 0.027797453105449677, 0.009064525365829468, 0.03912507742643356, 0.052074309438467026, 0.040565770119428635, 0.0007252604118548334, -0.06792611628770828, -0.03149905428290367, 0.0226440392434597, 0.0320696160197258, -0.05775991827249527, -0.012727819383144379, -0.00606909953057766, 0.0300039853900671, -0.006861651781946421, -0.008027646690607071, 0.014106692746281624, -0.03481990844011307, -0.026533998548984528, 0.017451206222176552, -0.0877385213971138, 0.038717590272426605, -0.03550922870635986, 0.0008093601209111512, 0.0815771222114563, -0.004279640968888998, -0.11129364371299744, -0.02801109477877617, 0.023096589371562004, 0.006031511817127466, -0.06823533773422241, -0.06130020692944527, 0.06945653259754181, -0.09139252454042435, 0.03620860353112221, 0.004096467979252338, 0.011189408600330353, -0.0005310842534527183, -0.03403787687420845, -0.02435038797557354, 0.07622804492712021, 0.03959343582391739, 0.01890169084072113, -0.03774026408791542, 0.08695164322853088, 0.022997142747044563, -0.030377645045518875, 0.04837212339043617, 0.003092745319008827, 0.05732450261712074, -0.04238606616854668, 0.04154721274971962, 0.010427537374198437, 0.02138143591582775, -0.07261055707931519, -0.018096979707479477, -0.0024096937850117683, 0.020876917988061905, 0.020277060568332672, -0.02351190894842148, 0.1228850781917572, 0.04497509077191353, 0.032874345779418945, 0.023048369213938713, 0.03928491473197937, -0.060976747423410416, 0.03077424317598343, -0.022773224860429764, 0.005863521248102188, -0.12807826697826385, 0.14103075861930847, -0.01930627040565014, -0.026880264282226562, 0.0780390128493309, 0.07670757174491882, -0.020642166957259178, -0.00077825877815485, -0.06371236592531204, -0.007731548976153135, -0.020164549350738525, 0.034046027809381485, -0.016721975058317184, -0.008819581009447575, -0.04917050525546074, 0.0051442719995975494, 0.013521114364266396, -0.0001379355089738965, 0.02662898227572441, -0.01356111653149128, -0.022536523640155792, -0.001819138415157795, -0.050299953669309616, 0.025952767580747604, 0.045064590871334076, 0.012907962314784527, 0.013480243273079395, 0.12894365191459656, -0.02661551907658577, -0.005941686220467091, -0.018222082406282425, 0.026984233409166336, 0.00935802236199379, 0.004268350545316935, 0.03399426117539406, -0.03156915679574013, 0.06600221246480942, -0.033661991357803345, -0.0007844480569474399, 0.0650624930858612, -0.04989800974726677, -0.01280286256223917, 0.051369231194257736, -0.019485237076878548, 0.05603630840778351, -0.04754338786005974, -0.01808515377342701, 0.04455622285604477, 0.009572460316121578, 0.04562220349907875, 0.05939649045467377, -0.0836908221244812, -0.028364187106490135, 0.04455059766769409, 0.03835340216755867, 0.044462159276008606, -0.024858277291059494, -0.05014157295227051, 0.049579549580812454, -0.042679909616708755, -0.06183171644806862, -0.1107296571135521, -0.011846027337014675, -0.019463039934635162, 0.0005315129528753459, 0.03878900036215782, -0.03864644095301628, 0.036502137780189514, 0.044962845742702484, 0.035657092928886414, 0.19935652613639832, -0.06968182325363159, 0.047349780797958374, -0.014355533756315708, 0.0258660688996315, 0.03140481561422348, 0.059962451457977295, 0.09558302909135818, 0.059407662600278854, -0.046908892691135406, -0.008944841101765633, -0.023061584681272507, -0.005964541342109442, 0.03213595971465111, 0.02260565012693405, -0.02630184032022953, -0.031543899327516556, -0.051471833139657974, 0.02539766952395439, -0.039570026099681854, 0.014503693208098412, 0.056107692420482635, 0.002583889989182353, 0.021891973912715912, 0.026073571294546127, -0.009037173353135586, 0.06875903904438019, -0.012700744904577732, -0.017750700935721397, -0.05130215734243393, -0.06426896154880524, 0.019781989976763725, 0.0150340860709548, -0.04759916290640831, 0.0027524656616151333, 0.03849533572793007, 0.001860312419012189, 0.00024029731866903603, 0.00438425038009882, 0.05065689608454704, 0.03504057601094246, 0.006282460875809193, -0.019583288580179214, -0.03282303735613823, -0.02742147631943226, -0.060608167201280594, 0.01883235201239586, -0.017766745761036873, 0.03467361256480217, -0.003042327705770731, 0.04950743913650513, -0.02572455443441868, 0.024205954745411873, -0.026147061958909035, 0.012981497682631016, -0.0007654287037439644, 0.03692558780312538, -0.021299270913004875, -0.006926802918314934, -0.04131017252802849, -0.005624629091471434, -0.036781080067157745, -0.03450958803296089, 0.02570663020014763, -0.031100960448384285, -0.010388487949967384, -0.005817038007080555, -0.0010056068422272801, -0.03693080693483353, -0.018054308369755745, 0.0398159958422184, 0.053930480033159256, 0.016821296885609627, -0.016928113996982574, 0.006683529354631901, 0.024223975837230682, -0.01569334976375103, 0.001851238077506423, -0.0079578198492527, 0.021077850833535194, -0.008048760704696178, 0.0004887109971605241, 0.01718204654753208, -0.007396393921226263, -0.0366365984082222, -0.05126242712140083, -0.013006508350372314, 0.023561658337712288, -0.07560404390096664, -0.044181253761053085, -0.03270880505442619, 0.01854880340397358, 0.006134605500847101, -0.03629736974835396, 0.04012342169880867, -0.01543926540762186, 0.005253591574728489, -0.008132479153573513, 0.015472875908017159, 0.04017922282218933, -0.0021368316374719143, -0.03030691295862198, -0.011351180262863636, -0.012437000870704651, 0.015778308734297752, -0.050800520926713943, 0.023180771619081497, 0.03511834144592285, -0.020219851285219193, 0.018435684964060783, 0.023574940860271454, -0.01164804957807064, -0.0190910454839468, 0.010160704143345356, 0.0451614186167717, 0.021745910868048668, 0.007873295806348324, -0.0604616217315197, -0.015501391142606735, -0.0419694185256958, -0.04953724518418312, -0.029808247461915016, 0.0017803817754611373, -0.009367787279188633, 0.04806431382894516, 0.0324658639729023, 0.0406554639339447, 0.005546160042285919, 0.023142194375395775, -0.018204310908913612, 0.04989023506641388, -0.06479241698980331, 0.05595291405916214, 0.021510755643248558, -0.038058795034885406, -0.006958515848964453, 0.037410806864500046, -0.005302149802446365, 0.011034240014851093, -0.013003692030906677, 0.0062451050616800785, -0.025855744257569313, -0.031744688749313354, 0.005024768877774477, 0.004450615961104631, 0.04374225437641144, 0.017331920564174652, -0.00451347790658474, -0.03305497020483017, 0.020729154348373413, -0.04436837136745453, -0.04582565650343895, -0.03033195436000824, 0.013928723521530628, 0.027347225695848465, -0.0036991939414292574, -0.01470805611461401, 0.0232708677649498, -0.017525559291243553, 0.019980154931545258, 0.010455901734530926, 0.007939223200082779, -0.032447636127471924, -0.010731451213359833, -0.034526657313108444, -0.04163186997175217, 0.034801580011844635, 0.037848494946956635, 0.00937340222299099, -0.011438900604844093, -0.024750344455242157, -0.0638241246342659, 0.021301858127117157, 0.01679927296936512, 0.02876722812652588, -0.05598761513829231, 0.04141572490334511, 0.021542299538850784, -0.007409271318465471, -0.040055494755506516, 0.034352030605077744, 0.0022966167889535427, 0.008546137250959873, 0.0016908636316657066, 0.007442539557814598, 0.037882789969444275, -0.04930448159575462, -0.002896221587434411, 0.02438735030591488, -0.05560406297445297, -0.0012026994954794645, -0.019510401412844658, -0.015199624001979828, 0.028419550508260727, 0.002946936758235097, -0.020912393927574158, -0.002294030738994479, 0.004997779615223408, 0.012531469576060772, -0.001245131716132164, 0.01008011493831873, -0.00711072888225317, 0.017527904361486435, 0.032976966351270676, -0.020990466699004173, 0.009867968037724495, -0.03077554702758789, 0.05600006878376007, -0.04652571678161621, 0.03040659800171852, 0.01896052621304989, -0.02481936849653721, 0.009939111769199371, 0.01190103404223919, 0.016302792355418205, 0.016893655061721802, 0.005543840117752552, -0.05427944287657738, -0.041430678218603134, -0.02239263616502285, -0.04123260825872421, 0.009462320245802402, -0.01401521172374487, -0.02011711522936821, -0.015425178222358227, 0.020050302147865295, 0.00448292912915349, 0.006008842494338751, -0.05076674744486809, 0.03931264206767082, 0.024734249338507652, 0.02218606323003769, 0.016180191189050674, 0.013475840911269188, -0.0716283991932869, -0.0000973544447333552, -0.05524687469005585, 0.0014543336583301425, 0.006564820185303688, 0.01317943911999464, -0.040379803627729416, 0.028076067566871643, 0.047533564269542694, -0.0012983335182070732, -0.005545128136873245, 0.06649714708328247, 0.02619345299899578, 0.04579537734389305, -0.03706177696585655, -0.01878923736512661, -0.009865179657936096, -0.02992076799273491, 0.006087183952331543, 0.0021672663278877735, 0.004444442223757505, -0.07944060117006302, 0.00017383637896273285, 0.011278274469077587, -0.008671915158629417, -0.003222418949007988, 0.02824842743575573, -0.020896997302770615, -0.01250398438423872, 0.06777910143136978, 0.06832153350114822, 0.025668570771813393, -0.056034352630376816, 0.002657390432432294, -0.012156656943261623, -0.06357582658529282, -0.028939465060830116, -0.02641056850552559, -0.0148519491776824, 0.03199795261025429, 0.03241952508687973, 0.04133056476712227, -0.003490910865366459, 0.008356411010026932, 0.008966277353465557, -0.019792448729276657, 0.017581449821591377, -0.04132043570280075, 0.02039305306971073, -0.010073068551719189, 0.004205762408673763, 0.026447495445609093, -0.00840451568365097, -0.013708559796214104, 0.033201396465301514, 0.03306605666875839, -0.009245029650628567, -0.05140947923064232, 0.014707330614328384, 0.004971504211425781, -0.011750830337405205, -0.04555049166083336, -0.023056745529174805, -0.019525375217199326, 0.01737872138619423, -0.014883928932249546, -0.03485439345240593, -0.006366361863911152, 0.008230400271713734, -0.02780359610915184, -0.02932901121675968, 0.029929231852293015, -0.0009420783608220518, 0.03549620136618614, -0.04058380797505379, -0.002472009975463152, 0.015237006358802319, -0.036985840648412704, -0.016353731974959373, -0.05261814221739769, -0.004175254609435797, 0.009937634691596031, 0.011740343645215034, 0.05351058766245842, -0.001198768150061369, 0.01467693317681551, -0.05432842671871185, -0.010484897531569004, 0.02143598534166813, -0.004231741186231375, 0.001608990947715938, 0.07721807807683945, 0.012370902113616467, -0.0647108405828476, -0.03695805370807648, -0.050910551100969315, 0.016664592549204826, 0.02403986267745495, -0.02282695099711418, 0.012645652517676353, 0.0274315495043993, -0.035262949764728546, 0.01756097935140133, -0.05596382915973663, 0.014127712696790695, 0.014584721997380257, 0.03407219052314758, -0.015728330239653587, 0.0011066452134400606, 0.021305866539478302, -0.017081040889024734, -0.028387267142534256, 0.009858803823590279, 0.01667392998933792, 0.0002527687465772033, -0.048332035541534424, 0.022501587867736816, -0.005185892339795828, -0.02035677433013916, -0.011825752444565296, 0.019318467006087303, -0.035923104733228683, -0.003160402411594987, -0.015433007851243019, 0.044061772525310516, 0.0387832410633564, -0.022282632067799568, -0.004147897008806467, 0.014623344875872135, -0.002532570157200098, -0.018455015495419502, 0.04422644525766373, -0.02754254825413227, 0.02726629003882408, 0.006417158525437117, 0.021027822047472, 0.010017416439950466, 0.018281104043126106, 0.0044632176868617535, -0.01005668006837368, 0.06333506852388382, -0.02095150388777256, 0.027138663455843925, 0.05154184624552727, -0.011200569570064545, -0.011321980506181717, -0.03638214245438576, -0.017394402995705605, -0.008983630686998367, 0.002371043199673295, 0.014391065575182438, 0.0030798346269875765, 0.008179182186722755, 0.0008878392982296646, 0.04464134946465492, 0.08201625198125839, 0.059721481055021286, -0.007084317971020937, 0.017281578853726387, 0.03185882419347763, 0.011035876348614693, -0.015858858823776245, 0.0704951286315918, 0.024265231564641, 0.020428918302059174, -0.0012187043903395534, 0.041384197771549225, 0.05132322385907173, -0.022191394120454788, 0.00872879009693861, -0.018311209976673126, -0.009233572520315647, -0.027186736464500427, 0.00580561812967062, 0.0010947794653475285, -0.01601996272802353, -0.01345585472881794, 0.010359367355704308, -0.0011842980748042464, 0.05967230349779129, -0.035068292170763016, 0.022292746230959892, -0.015405950136482716, -0.02055674046278, -0.014195814728736877, 0.017338471487164497, -0.015433194115757942, -0.035529233515262604, 0.01251900102943182, 0.00800556130707264, 0.015350868925452232, 0.037270452827215195, -0.02390468493103981, -0.004043151158839464, -0.02388778328895569, 0.00806477665901184, 0.018018880859017372, 0.021928193047642708, -0.0026007958222180605, 0.005937510635703802, 0.027893636375665665, 0.0016013587592169642, 0.008879300206899643, 0.030709566548466682, 0.026331443339586258, 0.03999767825007439, -0.04244164377450943, 0.009452386759221554, 0.01747731678187847, -0.04894401133060455, 0.0638812780380249, -0.035316865891218185, 0.052234381437301636, -0.005960029549896717, 0.01914156600832939, 0.015825463458895683, 0.03505464270710945, 0.026271125301718712, -0.021483758464455605, -0.009148583747446537, 0.02675594389438629, -0.0215486790984869, 0.03435905650258064, 0.02619706653058529, -0.029293468222022057, 0.01680571213364601, 0.011348647065460682, -0.00038268641219474375, -0.003865150734782219, 0.012495087459683418, 0.0697208046913147, -0.03155239298939705, 0.030849331989884377, 0.009636115282773972, 0.01743720844388008, 0.010793144814670086, -0.0011481744004413486, -0.020228320732712746, 0.0016069059493020177, 0.027033044025301933, -0.023782463744282722, -0.0001127155774156563, -0.023418257012963295, 0.002057422185316682, -0.003034531371667981, -0.05114394798874855, 0.0009755173232406378, -0.007093167398124933, -0.06260249018669128, 0.058477409183979034, -0.03497959300875664, 0.0200391486287117, 0.03802797198295593, -0.004833760671317577, -0.016360055655241013, -0.004603463690727949, 0.07122383266687393, 0.033454664051532745, 0.06007469817996025, 0.018920019268989563, -0.0668109878897667, -0.004276868887245655, -0.03379754349589348, 0.028651978820562363, 0.05959513783454895, -0.0106975007802248, 0.0024631598498672247, -0.01351234968751669, 0.011531010270118713, 0.024044044315814972, -0.03814113885164261, -0.00600286852568388, -0.034596383571624756, 0.006650873459875584, -0.05517417564988136, 0.0125119062140584, 0.05391703546047211, -0.01738261617720127, 0.043803200125694275, -0.01233941875398159, 0.01637793704867363, -0.040347397327423096, -0.009206973016262054, -0.04121054708957672, 0.04368634894490242, -0.02194371446967125, -0.034369662404060364, 0.013605142943561077, -0.01752399280667305, 0.03581152483820915, -0.04106821492314339, 0.011565333232283592, -0.016291826963424683, -0.003010772867128253, -0.03225964307785034, -0.07916699349880219, 0.02764207497239113, 0.014783859252929688, -0.032848913222551346, -0.000514583196491003, -0.004634439945220947, 0.002659423043951392, -0.03841574862599373, -0.002622055821120739, -0.015113678760826588, 0.027949772775173187, -0.036795757710933685, 0.021876364946365356, 0.03009388968348503, 0.04337609186768532, 0.016398487612605095, -0.01467772014439106, -0.027299506589770317, 0.000024293362002936192 ]
Understanding BigBird's Block Sparse Attention
vasudevgupta
March 31, 2021
big-bird
community, research, nlp
https://huggingface.co/blog/big-bird
BigBird block sparse attention BigBird block sparse attention is just an efficient implementation of what we discussed above. Each token is attending some **global tokens**, **sliding tokens**, & **random tokens** instead of attending to **all** other tokens. The authors hardcoded the attention matrix for multiple query components separately; and used a cool trick to speed up training/inference on GPU and TPU. ![BigBird block sparse attention](assets/18_big_bird/attn.png) *Note: on the top, we have 2 extra sentences. As you can notice, every token is just switched by one place in both sentences. This is how sliding attention is implemented. Whenq[i]is multiplied withk[i,0:3], we will get a sliding attention score forq[i](whereiis index of element in sequence).* You can find the actual implementation ofblock_sparseattention [here](https://github.com/vasudevgupta7/transformers/blob/5f2d6a0c93ca2017961199aa04a344b9b779d454/src/transformers/models/big_bird/modeling_big_bird.py#L513). This may look very scary 😨😨 now. But this article will surely ease your life in understanding the code.
[ 0.03396768495440483, 0.0017161115538328886, -0.014734067022800446, -0.028511520475149155, 0.012885257601737976, -0.032017335295677185, -0.011985699646174908, 0.10568930953741074, -0.024141225963830948, 0.009865179657936096, -0.050926510244607925, 0.034439314156770706, -0.0450933463871479, -0.007682370021939278, -0.01255836058408022, 0.06708891689777374, 0.08755037933588028, -0.021846676245331764, -0.005308307241648436, -0.03016367368400097, 0.04032095894217491, -0.04251815378665924, 0.11665625125169754, -0.048662323504686356, -0.03249235823750496, 0.056003276258707047, 0.009786575101315975, 0.014643875882029533, -0.05993400141596794, 0.034380242228507996, -0.08113772422075272, 0.030741345137357712, 0.015083151869475842, -0.043940503150224686, 0.013989454135298729, -0.03525812551379204, -0.08388666808605194, 0.06852211803197861, 0.025230543687939644, -0.02787998504936695, -0.010652695782482624, -0.012494528666138649, -0.06815103441476822, 0.024611305445432663, -0.05772764980792999, -0.03140295669436455, -0.13427002727985382, 0.1006963849067688, -0.041609399020671844, -0.08647721260786057, -0.06289692968130112, 0.03593531250953674, 0.026902055367827415, 0.036543410271406174, 0.0546109601855278, -0.014132639393210411, -0.046084482222795486, -0.04535389319062233, 0.039610520005226135, -0.03193202614784241, 0.003654713509604335, -0.021492693573236465, -0.009143210016191006, 0.06792512536048889, 0.06474293023347855, 0.012556538917124271, 0.047506995499134064, 0.04831935092806816, -0.03067874163389206, 0.0407976359128952, 0.08037222921848297, -0.005180723499506712, 0.014796774834394455, 0.03304294869303703, -0.050235897302627563, 0.015949299558997154, -0.016433382406830788, 0.08171622455120087, 0.010087292641401291, 0.04029882699251175, 0.01336860191076994, 0.056716471910476685, 0.01567954756319523, 0.035828642547130585, -0.012082431465387344, -0.004829964600503445, 0.05697588622570038, -0.07695262879133224, -0.05566635727882385, -0.008030249737203121, -0.031670957803726196, -0.1401800513267517, 0.019588811323046684, 0.036725159734487534, -0.042411647737026215, -0.04304518923163414, 0.021440332755446434, 0.02740384079515934, 0.01300388015806675, -0.042450983077287674, 0.01468316838145256, -0.042813025414943695, 0.06226186454296112, -0.03794384002685547, -0.028592616319656372, 0.06301071494817734, -0.01583823934197426, -0.08522895723581314, -0.007197536062449217, 0.014969322830438614, -0.00284050265327096, 0.008342871442437172, -0.0259261354804039, 0.037452246993780136, -0.0665728896856308, 0.060293808579444885, -0.04163382947444916, 0.012912248261272907, -0.04090374335646629, 0.039311733096838, -0.05421924963593483, 0.09574247151613235, 0.11030541360378265, -0.0319456085562706, 0.033256229013204575, 0.01325726043432951, 0.06517601758241653, 0.013235396705567837, 0.0008413750911131501, -0.03887544944882393, 0.03975219652056694, 0.007734913844615221, 0.045435287058353424, 0.013380740769207478, 0.04049563407897949, -0.06300950795412064, -0.0007990834419615567, -0.03918394818902016, 0.04920532554388046, -0.028866926208138466, -0.048143450170755386, -0.015530629083514214, 0.030661065131425858, -0.04929482564330101, 0.03227905556559563, 0.03145034611225128, -0.0716138631105423, -0.001483890344388783, 0.011350834742188454, 0.007760047446936369, -0.013127574697136879, 0.049666643142700195, -0.03374948352575302, -0.025229711085557938, -0.03734249994158745, 0.00866977870464325, 0.03798650577664375, -0.0664907693862915, -0.09115327149629593, -0.01526844035834074, -0.012730687856674194, -0.018790116533637047, -0.02161744050681591, 0.005036086309701204, 0.012400403618812561, -0.009836924262344837, 0.08779576420783997, 0.019131729379296303, 0.01479368843138218, 0.04683290049433708, -0.005319556687027216, -0.016683125868439674, 0.061425644904375076, -0.0379193015396595, -0.06568270176649094, 0.049968939274549484, 0.00140759174246341, 0.019607195630669594, 0.025227226316928864, 0.024683469906449318, -0.07735991477966309, -0.04873454570770264, 0.014058270491659641, 0.07051476091146469, -0.0014777886681258678, -0.057144831866025925, 0.1128811314702034, 0.05755966156721115, -0.013698136433959007, -0.014298101887106895, -0.07008974254131317, 0.04227824881672859, 0.02430194802582264, 0.009221931919455528, 0.028604062274098396, -0.07177425175905228, -0.04701859503984451, 0.028354382142424583, 0.09645521640777588, 0.07382411509752274, -0.01063739974051714, -0.008224478922784328, -0.0342726856470108, -0.000526521063875407, -0.03873288631439209, -0.022194843739271164, -0.020433736965060234, -0.011827093549072742, 0.018163753673434258, 0.011380177922546864, -0.024900715798139572, -0.09911013394594193, -0.013936102390289307, -0.07429322600364685, -0.024822315201163292, 0.041029203683137894, 0.07525112479925156, 0.047731056809425354, -0.019843369722366333, -0.006981969345360994, 0.17526590824127197, -0.019877035170793533, -0.022394081577658653, -0.020391324535012245, -0.038520921021699905, -0.018418114632368088, 0.03688715398311615, -0.030147943645715714, 0.06517963856458664, -0.02163415029644966, 0.024505706503987312, -0.023780211806297302, -0.02028278447687626, 0.02140054665505886, 0.031895529478788376, -0.06330335885286331, 0.011606975458562374, 0.06763502955436707, 0.0030253962613642216, -0.03565115109086037, -0.08502376824617386, -0.019803958013653755, 0.01995498687028885, -0.015683220699429512, 0.01431751437485218, -0.031709808856248856, 0.06539329141378403, -0.0358082540333271, -0.03097601607441902, 0.0007883861544542015, -0.03195594251155853, 0.027506135404109955, -0.011173400096595287, -0.047490473836660385, 0.05946929752826691, 0.013639727607369423, 0.01998411864042282, -0.04422706365585327, 0.04581344500184059, -0.039716947823762894, 0.021319951862096786, 0.014116195961833, -0.01318997610360384, -0.013736123219132423, -0.02017626166343689, -0.04168802127242088, 0.02878381311893463, 0.003333150874823332, 0.032781943678855896, 0.013540716841816902, -0.0022126617841422558, -0.006587600335478783, -0.01628953404724598, -0.015545180067420006, -0.015689263120293617, 0.006479338742792606, -0.016187667846679688, -0.07882113754749298, -0.013715695589780807, -0.03271763399243355, 0.02065553143620491, -0.04395156726241112, 0.027386698871850967, -0.0025589538272470236, 0.028769416734576225, 0.020254943519830704, 0.03658080846071243, 0.009763052687048912, -0.030335716903209686, -0.01575760543346405, -0.0018977498402819037, -0.0016195260686799884, -0.006034586112946272, -0.021304354071617126, -0.03623919561505318, 0.046401605010032654, -0.012410720810294151, 0.03619292005896568, -0.011128098703920841, -0.001140404725447297, 0.02807711623609066, 0.015496709384024143, -0.012670820578932762, 0.00876463484019041, 0.003624493256211281, 0.01966674253344536, -0.036149222403764725, 0.06605430692434311, -0.09287726879119873, -0.0166156105697155, -0.035575684159994125, -0.00370454671792686, -0.005242557264864445, -0.038657885044813156, 0.06027184799313545, 0.02744840458035469, 0.03144940733909607, -0.0035527872387319803, 0.03166993334889412, -0.02006438374519348, -0.024725258350372314, -0.015342491678893566, 0.00807495228946209, 0.031853631138801575, 0.012848224490880966, 0.016247902065515518, 0.007916644215583801, -0.01388143002986908, 0.024154119193553925, 0.024871649220585823, 0.0007129556615836918, -0.041776251047849655, -0.0074577322229743, -0.020044557750225067, 0.03169730305671692, 0.013472468592226505, 0.05189729481935501, 0.035382840782403946, -0.03936225175857544, -0.008976924233138561, 0.01289446372538805, 0.03604414314031601, -0.05829785019159317, 0.014891439117491245, 0.03181605041027069, -0.030257131904363632, 0.037784941494464874, 0.02422032132744789, 0.019643941894173622, -0.02840338833630085, 0.018038688227534294, -0.017816396430134773, 0.08664140850305557, -0.00640689954161644, 0.005285888910293579, -0.017713772132992744, -0.004792921710759401, -0.05528562515974045, -0.019733861088752747, 0.009598474949598312, 0.014941651374101639, 0.030178535729646683, -0.023546475917100906, -0.029987676069140434, 0.021092651411890984, -0.016269441694021225, 0.04355521872639656, -0.007932540960609913, -0.04763254150748253, 0.0409361906349659, 0.014610445126891136, 0.014122419990599155, -0.01776086911559105, 0.04540608078241348, 0.024640703573822975, 0.021559014916419983, -0.03943484649062157, 0.030063649639487267, 0.009742623195052147, 0.009502068161964417, 0.004127629566937685, -0.003064515767619014, 0.0021392786875367165, 0.002860989887267351, -0.017139481380581856, -0.007457421161234379, 0.04221852496266365, 0.03832035884261131, -0.011343738064169884, -0.05558592826128006, -0.009507737122476101, 0.015246734954416752, -0.0038558163214474916, 0.020043430849909782, -0.0019470558036118746, 0.005904033780097961, 0.007066564168781042, -0.012786434963345528, -0.008999385870993137, -0.010206532664597034, 0.02311868593096733, 0.008704583160579205, 0.00828423723578453, 0.025637775659561157, -0.0053269024938344955, 0.004640223458409309, 0.031095514073967934, -0.012022798880934715, 0.09309867769479752, -0.04395975545048714, 0.028145737946033478, -0.019143283367156982, 0.01133776269853115, -0.0018030669307336211, -0.04396088048815727, -0.031685374677181244, 0.02932753600180149, 0.02050376869738102, 0.01743571273982525, -0.033392854034900665, -0.008270912803709507, -0.00332630705088377, -0.005750633776187897, 0.016116367653012276, -0.021077122539281845, -0.04797784239053726, 0.010980679653584957, 0.000676533963996917, -0.04836944490671158, 0.02071567066013813, -0.011672367341816425, -0.025653578341007233, 0.02340766042470932, 0.00905084889382124, 0.004301359876990318, -0.04440639913082123, -0.015217469073832035, -0.032070741057395935, -0.03701013699173927, -0.022417576983571053, 0.014820929616689682, 0.014729290269315243, 0.026363875716924667, 0.022503333166241646, -0.035838570445775986, 0.009496406652033329, 0.031199391931295395, -0.07430742681026459, -0.016108902171254158, -0.04765532165765762, 0.027818335220217705, -0.03050549142062664, 0.01775461994111538, -0.00501134293153882, -0.0653449222445488, -0.01478150300681591, -0.04381313547492027, 0.033245135098695755, 0.023420270532369614, -0.07742484658956528, -0.03534471243619919, 0.020234115421772003, 0.03741798549890518, -0.022660676389932632, 0.01824861578643322, -0.027416730299592018, -0.01693940907716751, 0.049932509660720825, -0.010324669070541859, -0.0024114581756293774, -0.06200547143816948, -0.028099162504076958, 0.03545134887099266, -0.028759123757481575, -0.02922244183719158, -0.06906719505786896, -0.014186667278409004, 0.0017278491286560893, -0.0031963582150638103, -0.027643602341413498, -0.017051178961992264, 0.019200319424271584, 0.028241684660315514, -0.0158353541046381, 0.010018136352300644, 0.02324754185974598, 0.024602331221103668, -0.02156889997422695, -0.022180350497364998, 0.020598188042640686, 0.046298734843730927, 0.05351812392473221, -0.0018879951676353812, 0.01022808812558651, 0.03413661941885948, 0.06717115640640259, -0.04221130907535553, 0.04985685646533966, 0.01256390381604433, 0.022163396701216698, 0.0341762900352478, -0.011302439495921135, 0.03577988222241402, -0.021505361422896385, -0.021080762147903442, -0.00938792061060667, -0.06495040655136108, 0.020473172888159752, -0.02161545678973198, 0.005967680364847183, -0.027492264285683632, 0.030746810138225555, 0.02186049520969391, 0.051498349756002426, -0.048467956483364105, -0.00578280258923769, -0.023618558421730995, -0.05185698717832565, 0.005705379415303469, -0.01888885535299778, -0.04914962872862816, -0.023010607808828354, 0.03030710108578205, -0.03357589989900589, -0.03448166698217392, 0.017883172258734703, -0.0038489929866045713, 0.030708178877830505, -0.018505249172449112, -0.024203162640333176, -0.07247813045978546, -0.011474347673356533, -0.014088813215494156, -0.003960257861763239, -0.005746565759181976, 0.006600645370781422, 0.006371690891683102, 0.043418366461992264, 0.03506818041205406, 0.017704367637634277, 0.021189719438552856, 0.005463282112032175, -0.02110866643488407, 0.0030830204486846924, -0.04827509820461273, 0.021974526345729828, 0.04579516872763634, 0.0007932932930998504, -0.010605252347886562, -0.008195590227842331, -0.038019437342882156, 0.009282312355935574, -0.053323131054639816, 0.01237772312015295, 0.05935560539364815, 0.007198810577392578, 0.0024335270281881094, 0.0027404918801039457, 0.03417397290468216, 0.026521699503064156, 0.013230896554887295, 0.03259805589914322, 0.003918143454939127, 0.027248816564679146, 0.03314528241753578, -0.04539674520492554, 0.012126623652875423, 0.008581893518567085, -0.011482286266982555, -0.029025858268141747, 0.023073483258485794, 0.016218677163124084, -0.028836287558078766, 0.006761231459677219, 0.024702658876776695, -0.03640514984726906, 0.0039006948936730623, 0.02562573552131653, 0.017033684998750687, 0.003588092280551791, -0.00023539600078947842, 0.0018823506543412805, -0.026388023048639297, -0.021566489711403847, 0.011177978478372097, 0.03853614628314972, 0.005736361723393202, 0.04748958349227905, 0.010012203827500343, 0.01335842814296484, 0.031860340386629105, 0.034619178622961044, 0.018818838521838188, -0.019347507506608963, 0.009089302271604538, -0.0054249996319413185, 0.03508397191762924, -0.016857080161571503, -0.0036122784949839115, 0.017835335806012154, -0.001172450021840632, -0.03989340737462044, -0.04094734787940979, 0.036378324031829834, 0.03648444265127182, 0.005287923850119114, 0.08333183825016022, -0.07367119193077087, -0.02140083722770214, 0.012028253637254238, 0.022539108991622925, -0.005066374782472849, -0.008053453639149666, 0.0034366927575320005, 0.007803086191415787, -0.004380063619464636, 0.033348314464092255, 0.01753017120063305, -0.029621858149766922, 0.05546005815267563, 0.02283754199743271, 0.07388239353895187, -0.0007475661113858223, -0.00693765003234148, 0.0011121178977191448, -0.01652935892343521, -0.03166608139872551, 0.007907815277576447, -0.007504961919039488, 0.035514943301677704, 0.046271901577711105, -0.03603618964552879, -0.05412013828754425, 0.041091438382864, -0.007422836031764746, -0.008720241487026215, 0.001101550180464983, 0.013027435168623924, 0.004846680443733931, 0.028931332752108574, 0.01109488308429718, -0.040894802659749985, 0.018592655658721924, 0.002714666537940502, 0.05087364837527275, 0.017174353823065758, -0.07684751600027084, -0.036646030843257904, 0.019745387136936188, 0.035157106816768646, 0.005362385418266058, 0.0065391166135668755, -0.0005964966840110719, 0.008343026973307133, 0.0553378127515316, 0.023694921284914017, -0.03673650696873665, 0.07885778695344925, 0.0018867964390665293, 0.06001156195998192, -0.06988303363323212, -0.0023589669726788998, 0.022292695939540863, -0.021170474588871002, -0.037535615265369415, 0.00616456288844347, -0.058619286864995956, -0.02591869980096817, 0.017376258969306946, 0.0493704229593277, 0.01969207637012005, 0.00802865345031023, -0.0029520802199840546, 0.00013968614803161472, -0.06333890557289124, -0.0103760976344347, -0.0030757628846913576, 0.021713929250836372, 0.0025044323410838842, -0.013956626877188683, -0.02883795276284218, -0.000566629518289119, -0.00574388075619936, 0.018681373447179794, 0.03294907137751579, 0.013015426695346832, -0.00813268031924963, -0.011648362502455711, 0.001845862134359777, 0.012937054969370365, 0.035064179450273514, 0.06478183716535568, 0.00937658827751875, 0.01941417157649994, -0.02607111632823944, -0.014579729177057743, 0.009372543543577194, -0.02085268869996071, -0.022530917078256607, 0.0124629782512784, -0.05471181869506836, 0.03787662088871002, 0.03517313301563263, 0.01087824534624815, -0.025019008666276932, 0.029419412836432457, -0.02198474481701851, 0.03037729114294052, -0.049923963844776154, -0.021545952185988426, 0.04037553817033768, 0.007524630520492792, 0.014072224497795105, -0.021490860730409622, -0.01941578835248947, -0.046628646552562714, -0.02231522463262081, 0.017370816320180893, 0.044627636671066284, -0.0026153738144785166, 0.019310174509882927, -0.028448425233364105, -0.01474513579159975, 0.0035459408536553383, -0.05077865719795227, -0.0006232127780094743, 0.026192843914031982, 0.013199562206864357, -0.026118552312254906, 0.009772956371307373, 0.04938861355185509, 0.007550177164375782, 0.04131856933236122, 0.0181723739951849, 0.033492833375930786, 0.008957919664680958, 0.020182736217975616, -0.027245832607150078, -0.04500196874141693, -0.020594092085957527, 0.015372559428215027, 0.06700712442398071, 0.012258389964699745, -0.0020517841912806034, -0.0024855819065123796, 0.041427601128816605, -0.00030624278588220477, -0.015333476476371288, -0.03248431533575058, -0.02257617376744747, -0.004376914817839861, 0.025702977553009987, -0.050359491258859634, -0.02566094882786274, 0.030719591304659843, 0.012543149292469025, -0.007543611340224743, -0.008021309040486813, 0.03253959119319916, 0.019875874742865562, -0.024849005043506622, 0.011147847399115562, -0.026447972282767296, 0.023777008056640625, 0.03626739978790283, 0.042685505002737045, 0.027173083275556564, 0.016150496900081635 ]
Understanding BigBird's Block Sparse Attention
vasudevgupta
March 31, 2021
big-bird
community, research, nlp
https://huggingface.co/blog/big-bird
Sliding Attention The sequence of key tokens is copied 2 times with each element shifted to the right in one of the copies and to the left in the other copy. Now if we multiply query sequence vectors by these 3 sequence vectors, we will cover all the sliding tokens. Computational complexity is simplyO(3xn) = O(n). Referring to the above picture, the orange boxes represent the sliding attention. You can see 3 sequences at the top of the figure with 2 of them shifted by one token (1 to the left, 1 to the right). ```python # what we want to do Q[i] x [K[i-1], K[i], K[i+1]] for i = 1:-1 # efficient implementation in code (assume dot product multiplication 👇) [Q[0], Q[1], Q[2], ......, Q[n-2], Q[n-1]] x [K[1], K[2], K[3], ......, K[n-1], K[0]] [Q[0], Q[1], Q[2], ......, Q[n-1]] x [K[n-1], K[0], K[1], ......, K[n-2]] [Q[0], Q[1], Q[2], ......, Q[n-1]] x [K[0], K[1], K[2], ......, K[n-1]] # Each sequence is getting multiplied by only 3 sequences to keepwindow_size = 3. # Some computations might be missing; this is just a rough idea. ```
[ -0.027959244325757027, 0.08374910056591034, 0.10001010447740555, -0.026598768308758736, -0.02756606601178646, 0.05106458067893982, -0.010124605149030685, 0.06344371289014816, -0.08167486637830734, 0.007004980463534594, -0.016127808019518852, 0.035115864127874374, -0.03132829815149307, 0.032734598964452744, 0.00478392094373703, 0.07744703441858292, 0.07236776500940323, -0.04558362811803818, -0.007448784541338682, -0.00011948381143156439, -0.000797279120888561, 0.021889226511120796, 0.11174019426107407, -0.040814828127622604, -0.028435634449124336, 0.0059311226941645145, -0.03363579884171486, 0.0005724002257920802, -0.06551971286535263, 0.06337489932775497, -0.10180160403251648, 0.000953319831751287, 0.04348256438970566, -0.027428671717643738, 0.016404466703534126, -0.04875176399946213, -0.0957549512386322, 0.09408153593540192, 0.05367802456021309, -0.02822485752403736, -0.02721281722187996, -0.024480124935507774, -0.056943755596876144, 0.043263498693704605, -0.06183524802327156, 0.05649683624505997, -0.13703937828540802, 0.016754360869526863, -0.07725873589515686, -0.04779190942645073, -0.05497046932578087, -0.04215514659881592, 0.0005617854767479002, 0.06500651687383652, 0.015540418215095997, 0.019155576825141907, -0.03987383469939232, -0.013081133365631104, -0.026535505428910255, 0.020004404708743095, -0.01679443009197712, -0.01713862642645836, 0.04793388396501541, 0.013187884353101254, 0.07107867300510406, 0.10149037837982178, 0.03305141255259514, 0.06861221790313721, -0.003684167517349124, 0.02702895551919937, 0.03709294646978378, -0.0432976670563221, -0.004251890815794468, 0.044882625341415405, -0.007589153945446014, -0.04635200276970863, -0.037269774824380875, 0.04311472177505493, -0.002778986468911171, -0.017664294689893723, 0.03906456008553505, 0.07045164704322815, 0.08081598579883575, 0.06003590300679207, 0.014823328703641891, -0.01617412269115448, -0.017194829881191254, -0.0017561445711180568, -0.049586210399866104, -0.003773655276745558, -0.04110283777117729, -0.09788277000188828, -0.05278238654136658, -0.035397980362176895, -0.025994084775447845, -0.05180070176720619, 0.04369763284921646, -0.0025315622333437204, 0.01840112917125225, -0.04580695927143097, 0.033467501401901245, -0.07212535291910172, 0.09261012822389603, 0.02149011567234993, -0.02901998721063137, 0.05097024515271187, 0.0018118832958862185, -0.03934631496667862, -0.051082711666822433, -0.010143870487809181, -0.012084918096661568, 0.06881806254386902, 0.045200638473033905, 0.07486487179994583, -0.026913747191429138, 0.0417967215180397, -0.05669334903359413, 0.05352208390831947, -0.044922761619091034, 0.03017573058605194, -0.04599352180957794, 0.07409215718507767, 0.09752187877893448, 0.034974899142980576, 0.012262788601219654, -0.010472697205841541, -0.004048834089189768, 0.02130560204386711, -0.02512311562895775, -0.0861673578619957, -0.003257639706134796, -0.011125191114842892, 0.0401001013815403, -0.016464151442050934, -0.0019481912022456527, -0.03874444589018822, 0.02468879520893097, 0.0524645633995533, -0.015383216552436352, -0.07452920079231262, -0.05635666102170944, 0.015173894353210926, 0.0642818957567215, 0.029174983501434326, 0.05677792429924011, -0.05066278204321861, -0.14438308775424957, 0.025792915374040604, 0.006309737917035818, 0.018565639853477478, 0.01632867008447647, -0.00905044749379158, -0.036681633442640305, -0.050161831080913544, -0.03591400757431984, 0.05688463896512985, -0.008097902871668339, -0.04271220043301582, -0.09502016752958298, -0.03928355872631073, 0.05206234008073807, 0.0009039446013048291, -0.0786660835146904, 0.03409866988658905, -0.004158887080848217, -0.01673285663127899, 0.08555088937282562, 0.050273213535547256, 0.007254346739500761, 0.07080268859863281, -0.047167133539915085, 0.04741132631897926, 0.007751067169010639, 0.01979186199605465, -0.07273127138614655, -0.006166337989270687, 0.02057798020541668, 0.06286785006523132, 0.058639463037252426, -0.04385508969426155, -0.03020806796848774, -0.029884098097682, -0.0012653237208724022, 0.03242470696568489, -0.07577287405729294, -0.06116611510515213, 0.024280250072479248, -0.01701551117002964, -0.0027903388254344463, 0.010433556511998177, -0.06265851110219955, -0.02817327342927456, 0.011103745549917221, -0.022036036476492882, -0.061584070324897766, -0.01763949915766716, 0.016906844452023506, 0.025066932663321495, 0.053181130439043045, 0.05326236039400101, -0.005736477207392454, 0.060333602130413055, 0.05208785459399223, -0.022738728672266006, -0.05462297052145004, -0.004273233003914356, -0.04393720254302025, -0.11527377367019653, 0.06888508796691895, 0.04016762971878052, -0.03980129957199097, -0.059082578867673874, -0.013740493915975094, -0.09370607882738113, -0.005886939819902182, 0.005481529049575329, 0.005946577060967684, 0.07143736630678177, 0.006206887774169445, -0.011225747875869274, 0.10758708417415619, 0.0010075806640088558, 0.0012939729494974017, 0.015202580019831657, -0.07535591721534729, -0.002487389836460352, 0.032350149005651474, 0.0009512606775388122, 0.03264235332608223, -0.059117138385772705, -0.051024582237005234, -0.08412164449691772, 0.018724724650382996, -0.0414612777531147, 0.009249098598957062, -0.004582286346703768, 0.011547540314495564, 0.062289588153362274, 0.011924770660698414, -0.03365224972367287, -0.029606198891997337, -0.01609952561557293, 0.007220093626528978, 0.02210543118417263, 0.017688170075416565, -0.018513396382331848, 0.034151338040828705, -0.0539570190012455, -0.027147218585014343, 0.007158649619668722, 0.013005753979086876, 0.06207089126110077, -0.01956005021929741, -0.036064840853214264, 0.02224663272500038, 0.029511479660868645, 0.019977902993559837, -0.0561198927462101, -0.021186627447605133, -0.024274978786706924, 0.02685568481683731, -0.0028847306966781616, -0.0022719777189195156, -0.0358104445040226, -0.0231093168258667, -0.029075730592012405, 0.017980901524424553, 0.005711056757718325, -0.0011521594133228064, 0.03372899070382118, -0.007111121900379658, -0.027315720915794373, -0.002697976538911462, 0.009229454211890697, 0.03416498377919197, -0.03307011350989342, 0.018061095848679543, -0.04810759425163269, -0.030965249985456467, -0.03686634078621864, -0.004499309230595827, -0.01369952317327261, 0.03136724233627319, 0.04139058664441109, -0.007054346613585949, 0.006556142121553421, 0.023849111050367355, -0.002818069187924266, -0.022120118141174316, 0.022493895143270493, -0.018737519159913063, 0.0411565937101841, -0.003213518997654319, 0.008076622150838375, 0.011785346083343029, -0.004671750124543905, -0.08132842183113098, 0.018215205520391464, -0.00047916482435539365, 0.018553415313363075, 0.015072906389832497, -0.010293704457581043, -0.012029721401631832, 0.02941444143652916, -0.014877437613904476, -0.035398099571466446, -0.04603003337979317, 0.056061726063489914, -0.0909624770283699, -0.013091862201690674, 0.0008529942715540528, 0.012809262610971928, 0.02536863647401333, -0.008674446493387222, 0.01397309172898531, 0.03665295988321304, -0.00542717520147562, -0.014647558331489563, 0.017768152058124542, 0.018341686576604843, -0.039425093680620193, 0.0037410834338515997, 0.024034474045038223, 0.05228593200445175, 0.02215271256864071, 0.04580555856227875, 0.04057805985212326, 0.0076554156839847565, 0.010834457352757454, -0.023997915908694267, -0.014720135368406773, -0.03799881413578987, -0.018502457067370415, -0.014162464998662472, 0.014778833836317062, 0.0023374122101813555, 0.03486587107181549, -0.016279160976409912, -0.068201445043087, 0.001826408552005887, -0.020554907619953156, -0.017576606944203377, -0.07889262586832047, 0.0004509623977355659, 0.034501638263463974, -0.05466630309820175, 0.013775731436908245, 0.02326238341629505, 0.005562567617744207, -0.00493269506841898, 0.009014470502734184, 0.010106091387569904, 0.04185906797647476, -0.04961206018924713, 0.0017917088698595762, -0.04984273016452789, -0.002817301545292139, -0.08847551047801971, -0.015629999339580536, -0.02420797571539879, -0.012764578685164452, 0.02168620377779007, -0.004579837433993816, 0.011189169250428677, -0.0039032986387610435, 0.003491317853331566, 0.04439394921064377, 0.02830568514764309, -0.015220679342746735, 0.01726178079843521, 0.04344026744365692, -0.011324319988489151, -0.008377966471016407, 0.018070664256811142, 0.01184381265193224, 0.007921850308775902, -0.024834053590893745, 0.061447273939847946, -0.024466516450047493, 0.01644149422645569, 0.040273576974868774, -0.00506348442286253, -0.034055911004543304, 0.01884218491613865, 0.01529641542583704, 0.0002836721541825682, 0.05278438702225685, 0.039066243916749954, -0.036095984280109406, -0.027835361659526825, -0.007935467176139355, -0.005355335772037506, 0.010105668567121029, -0.017547767609357834, 0.009592846967279911, -0.0057871295139193535, -0.008229248225688934, -0.03670483082532883, -0.04507731646299362, -0.03705203905701637, 0.017824742943048477, 0.014338293112814426, -0.01826983503997326, -0.018940750509500504, 0.03522346168756485, 0.012172210961580276, 0.003706174436956644, -0.01952141895890236, 0.005992590915411711, -0.0434398390352726, -0.01005661953240633, 0.045664072036743164, -0.062229953706264496, -0.03239680826663971, -0.02240726724267006, -0.005292413756251335, -0.000037741836422355846, -0.004649173002690077, -0.022742144763469696, -0.028046950697898865, 0.030076932162046432, -0.015970584005117416, 0.04775337874889374, 0.0243284460157156, -0.007154616992920637, -0.05622188001871109, -0.03480493649840355, -0.02417721040546894, -0.03048090450465679, 0.053777117282152176, 0.043331533670425415, 0.02691502869129181, 0.012532142922282219, 0.014698326587677002, 0.024287817999720573, -0.03974771127104759, 0.050657711923122406, 0.021367233246564865, -0.015058021061122417, -0.016094651073217392, 0.023618638515472412, -0.033659208565950394, 0.025056423619389534, 0.016249503940343857, -0.007231661584228277, 0.015254090540111065, -0.00206076935864985, -0.07720977813005447, -0.045256245881319046, -0.05105637386441231, 0.015269012190401554, 0.010470760986208916, -0.03461238741874695, 0.011567876674234867, -0.023352891206741333, -0.015572326257824898, -0.02548939548432827, 0.05461934208869934, 0.0019382910104468465, -0.030417175963521004, 0.01843656413257122, 0.0402463935315609, 0.04479209706187248, -0.0012124560307711363, 0.010670000687241554, -0.01861521415412426, 0.007868758402764797, 0.0025519654154777527, 0.009030891582369804, -0.061371736228466034, -0.035119205713272095, 0.014187097549438477, -0.0020694369450211525, -0.009844237007200718, -0.010828142054378986, -0.038092657923698425, -0.019439201802015305, -0.028300156816840172, -0.01573663391172886, -0.009540354833006859, -0.04431914538145065, -0.01720251329243183, 0.007663407828658819, 0.007616464048624039, 0.020785529166460037, 0.011424945667386055, 0.030506478622555733, -0.040275994688272476, -0.02202841453254223, 0.021990614011883736, 0.014325165189802647, 0.017134852707386017, 0.000980790238827467, -0.006415149662643671, 0.025017794221639633, 0.05266225337982178, -0.03895232826471329, 0.014370615594089031, 0.026864085346460342, 0.0222944226115942, 0.01431654766201973, 0.01048782654106617, 0.02143951505422592, -0.013782178983092308, -0.021185560151934624, -0.01907556690275669, -0.029569126665592194, -0.028441540896892548, 0.028723757714033127, 0.002725476399064064, 0.0011601254809647799, 0.003665958298370242, 0.020076006650924683, 0.0387064665555954, 0.024706650525331497, -0.05279424786567688, 0.00731317326426506, -0.048826176673173904, 0.019086899235844612, 0.00560757564380765, -0.038270432502031326, -0.035074710845947266, -0.02819347009062767, -0.03253280371427536, -0.020312145352363586, 0.02480948530137539, 0.02755984105169773, 0.031056441366672516, 0.020360823720693588, -0.009036111645400524, -0.015990694984793663, 0.04072004556655884, 0.02239098958671093, -0.0024136167485266924, -0.05142761021852493, 0.0627092644572258, 0.011082748882472515, 0.011626318097114563, 0.03647381439805031, 0.020934317260980606, 0.037417344748973846, 0.05047561973333359, -0.027150245383381844, -0.01851365715265274, -0.05226213112473488, 0.017601344734430313, 0.002506233286112547, 0.0006667276029475033, 0.011460250243544579, 0.03430646285414696, -0.006901819724589586, -0.01567232608795166, -0.02872529998421669, 0.0048142410814762115, 0.07684499025344849, -0.02149512618780136, 0.01191597618162632, 0.0017382563091814518, 0.03713632747530937, -0.006185934878885746, -0.004134657327085733, -0.0026674638502299786, 0.02447204664349556, 0.006770411040633917, 0.02142966352403164, 0.004066345281898975, 0.0312005877494812, -0.0025809460785239935, -0.001408823998644948, -0.021092575043439865, 0.04708697274327278, -0.0026839401107281446, -0.022008227184414864, 0.01200901623815298, 0.03289283812046051, -0.015420765615999699, 0.006303372327238321, 0.04325396567583084, -0.006726380437612534, -0.009070278145372868, -0.010158681310713291, 0.008556189946830273, -0.05262963846325874, 0.04282106086611748, 0.006608034949749708, 0.019077647477388382, -0.012331207282841206, 0.03375360742211342, 0.01879126764833927, 0.018828677013516426, -0.0057119522243738174, 0.03043682500720024, -0.004215608350932598, 0.03641652315855026, -0.004369070287793875, 0.007240530103445053, 0.03722585737705231, -0.019160594791173935, 0.005537762772291899, 0.025692319497466087, -0.014122501015663147, 0.007533485535532236, -0.06393350660800934, 0.057281285524368286, 0.013196509331464767, -0.03892987221479416, 0.04790763929486275, -0.049160540103912354, 0.03582736849784851, 0.007365001831203699, 0.03544219583272934, 0.017853938043117523, -0.021449696272611618, 0.014086064882576466, 0.033401209861040115, 0.003516600001603365, 0.005227282177656889, -0.0053900424391031265, 0.0032069722656160593, 0.0651136040687561, 0.049332145601511, 0.05489427596330643, 0.030681151896715164, -0.027811840176582336, -0.0044351727701723576, -0.07059235870838165, -0.028965702280402184, 0.046042490750551224, 0.008777855895459652, -0.012838593684136868, 0.04877069592475891, -0.030762603506445885, 0.01018779817968607, -0.01572209782898426, 0.003992237150669098, -0.013123917393386364, -0.0013131959130987525, 0.0012672288576141, -0.030777454376220703, 0.03741303086280823, -0.01323276199400425, -0.018954221159219742, -0.04076848551630974, 0.004137437790632248, 0.023469582200050354, -0.016528958454728127, -0.03815832734107971, -0.023610791191458702, -0.019571565091609955, 0.059988848865032196, -0.024365419521927834, -0.01127507071942091, 0.002246689749881625, -0.028145644813776016, 0.06093341112136841, -0.03463635593652725, -0.0588090643286705, 0.06553158164024353, -0.001452166703529656, 0.06417705863714218, -0.049465619027614594, 0.021391533315181732, 0.0124266492202878, 0.051119204610586166, 0.029958225786685944, -0.01321407314389944, -0.01269651297479868, 0.014878916554152966, 0.010859168134629726, -0.01070474088191986, 0.0086315106600523, -0.013098479248583317, -0.02661183662712574, 0.02388552948832512, -0.036224573850631714, 0.0009194118902087212, 0.004442436620593071, 0.05054936185479164, 0.045517027378082275, -0.007428871933370829, -0.010318323969841003, -0.02538449317216873, -0.0013756102416664362, 0.015030867420136929, -0.0010988711146637797, 0.000003089824758717441, 0.01871493086218834, 0.009687216952443123, 0.004676551558077335, 0.01470489427447319, 0.018665237352252007, 0.06136109307408333, -0.022576207295060158, 0.06432709842920303, -0.06499665230512619, 0.026062004268169403, 0.014119479805231094, -0.002460296032950282, -0.017692411318421364, -0.0012069100048393011, -0.0018775652861222625, 0.01744139939546585, 0.03310471028089523, -0.004512222949415445, -0.02733558975160122, 0.03272522985935211, 0.014631143771111965, -0.005915158428251743, -0.005222393665462732, -0.008171935565769672, 0.019673073664307594, 0.019215796142816544, 0.02678130567073822, 0.06472183018922806, -0.02729795314371586, -0.034956201910972595, 0.04485832154750824, 0.0014535014051944017, 0.0010229845065623522, 0.02277495339512825, -0.009253640659153461, -0.03852150961756706, -0.009868594817817211, -0.03959587216377258, -0.048301585018634796, 0.048363082110881805, 0.023762427270412445, -0.03686084225773811, 0.02709810435771942, 0.0377744697034359, -0.014047896489501, -0.02780337631702423, 0.02363036386668682, 0.006782824639230967, 0.037909895181655884, 0.03467534855008125, 0.021232394501566887, -0.019750969484448433, -0.055570509284734726, 0.05624070018529892, -0.008178853429853916, 0.025436734780669212, 0.0407877042889595, -0.009197434410452843, 0.010546472854912281, 0.025554463267326355, 0.019288761541247368, -0.007288845255970955, 0.006551016587764025, -0.007140063215047121, 0.024568529799580574, 0.03133801370859146, -0.025201277807354927, -0.0019004297209903598, 0.03092028573155403, 0.016888637095689774, 0.026928819715976715, -0.01992376148700714, 0.00006536120781674981, 0.023889262229204178, -0.022037481889128685, 0.04635639861226082, -0.011276140809059143, 0.005111681763082743, 0.015043984167277813, 0.03233124688267708, 0.025746848434209824, 0.03069738857448101 ]
Understanding BigBird's Block Sparse Attention
vasudevgupta
March 31, 2021
big-bird
community, research, nlp
https://huggingface.co/blog/big-bird
Implementation **Recap:** In regular BERT attention, a sequence of tokens i.e. \\( X = x_1, x_2, ...., x_n \\) is projected through a dense layer into \\( Q,K,V \\) and the attention score \\( Z \\) is calculated as \\( Z=Softmax(QK^T) \\). In the case of BigBird block sparse attention, the same algorithm is used but only with some selected query & key vectors. Let's have a look at how bigbird block sparse attention is implemented. To begin with, let's assume \\(b, r, s, g\\) representblock_size,num_random_blocks,num_sliding_blocks,num_global_blocks, respectively. Visually, we can illustrate the components of big bird's block sparse attention with \\(b=4, r=1, g=2, s=3, d=5\\) as follows: <img src="assets/18_big_bird/intro.png" width=500 height=250> Attention scores for \\({q}_{1}, {q}_{2}, {q}_{3:n-2}, {q}_{n-1}, {q}_{n}\\) are calculated separately as described below: --- Attention score for \\(\mathbf{q}_{1}\\) represented by \\(a_1\\) where \\(a_1=Softmax(q_1 * K^T)\\), is nothing but attention score between all the tokens in 1st block with all the other tokens in the sequence. ![BigBird block sparse attention](assets/18_big_bird/q1.png) \\(q_1\\) represents 1st block, \\(g_i\\) represents \\(i\\) block. We are simply performing normal attention operation between \\(q_1\\) & \\(g\\) (i.e. all the keys). --- For calculating attention score for tokens in seconcd block, we are gathering the first three blocks, the last block, and the fifth block. Then we can compute \\(a_2 = Softmax(q_2 * concat(k_1, k_2, k_3, k_5, k_7)\\). ![BigBird block sparse attention](assets/18_big_bird/q2.png) *I am representing tokens by \\(g, r, s\\) just to represent their nature explicitly (i.e. showing global, random, sliding tokens), else they are \\(k\\) only.* --- For calculating attention score for \\({q}_{3:n-2}\\), we will gather global, sliding, random keys & will compute the normal attention operation over \\({q}_{3:n-2}\\) and the gathered keys. Note that sliding keys are gathered using the special shifting trick as discussed earlier in the sliding attention section. ![BigBird block sparse attention](assets/18_big_bird/q_middle.png) --- For calculating attention score for tokens in previous to last block (i.e. \\({q}_{n-1}\\)), we are gathering the first block, last three blocks, and the third block. Then we can apply the formula \\({a}_{n-1} = Softmax({q}_{n-1} * concat(k_1, k_3, k_5, k_6, k_7))\\). This is very similar to what we did for \\(q_2\\). ![BigBird block sparse attention](assets/18_big_bird/qlast_sec.png) --- Attention score for \\(\mathbf{q}_{n}\\) is represented by \\(a_n\\) where \\(a_n=Softmax(q_n * K^T)\\), and is nothing but attention score between all the tokens in the last block with all the other tokens in sequence. This is very similar to what we did for \\( q_1 \\) . ![BigBird block sparse attention](assets/18_big_bird/qlast.png) --- Let's combine the above matrices to get the final attention matrix. This attention matrix can be used to get a representation of all the tokens. ![BigBird block sparse attention](assets/18_big_bird/block-sparse-attn.gif) *blue -> global blocks,red -> random blocks,orange -> sliding blocksThis attention matrix is just for illustration. During the forward pass, we aren't storingwhiteblocks, but are computing a weighted value matrix (i.e. representation of each token) directly for each separated components as discussed above.* Now, we have covered the hardest part of block sparse attention, i.e. its implementation. Hopefully, you now have a better background to understand the actual code. Feel free to dive into it and to connect each part of the code with one of the components above.
[ 0.012228344567120075, -0.03147752583026886, 0.02282366156578064, -0.020737770944833755, 0.07189106196165085, 0.021179944276809692, 0.01310034841299057, 0.0779840275645256, -0.006034860387444496, -0.02204400673508644, -0.0577206052839756, 0.04702920839190483, -0.03829130530357361, -0.012541709467768669, -0.0059121157974004745, 0.10978632420301437, 0.07302320748567581, -0.027155444025993347, -0.013738411478698254, -0.04330071061849594, -0.016150223091244698, -0.06805931031703949, 0.10309906303882599, -0.03870163857936859, 0.01719518005847931, 0.02238238975405693, -0.02082628756761551, 0.0504281111061573, -0.005442763678729534, 0.06873003393411636, -0.09559772163629532, -0.011041282676160336, 0.032758958637714386, -0.037051815539598465, -0.02216349169611931, 0.0017055192729458213, -0.07906118035316467, 0.10439114272594452, 0.00993052776902914, -0.04737960547208786, -0.037059199064970016, 0.011595248244702816, -0.02623359113931656, 0.03232847526669502, -0.04993639886379242, -0.04431505873799324, -0.1004013866186142, 0.08031073212623596, -0.06064515933394432, -0.05448553338646889, -0.04936585947871208, 0.06909949332475662, 0.0017324662767350674, 0.06757759302854538, 0.02358826994895935, -0.042306870222091675, -0.0036200324539095163, -0.05484859272837639, 0.09221723675727844, -0.003945825155824423, 0.000015576850273646414, -0.033339206129312515, 0.006442901212722063, 0.030827974900603294, 0.04058309644460678, 0.057453032582998276, 0.015620299614965916, 0.038176700472831726, -0.05953128635883331, 0.028527120128273964, 0.10701058059930801, 0.005826793145388365, 0.012760200537741184, 0.028651872649788857, -0.0560457780957222, 0.013886346481740475, 0.034589823335409164, 0.036719754338264465, 0.02731892839074135, 0.011627675034105778, 0.023941868916153908, 0.023370685055851936, 0.0021753667388111353, 0.03352910280227661, 0.009704397059977055, 0.02254260703921318, 0.09356828033924103, -0.10207260400056839, -0.08280912041664124, 0.020829856395721436, -0.07595406472682953, -0.15180616080760956, -0.008710267953574657, 0.008712979033589363, -0.025155318900942802, -0.08969393372535706, -0.00803698506206274, 0.024443374946713448, -0.006232034880667925, -0.01635752059519291, 0.0054728370159864426, 0.014821512624621391, 0.08792313933372498, -0.030423881486058235, -0.09182144701480865, -0.0029100908432155848, -0.004325591027736664, -0.11944347620010376, -0.011253508739173412, -0.03176908940076828, 0.017399100586771965, -0.03141056001186371, -0.00406250637024641, 0.005328397266566753, -0.05465017631649971, 0.009932323358952999, 0.014542858116328716, 0.02337646298110485, -0.005489591043442488, 0.03556182235479355, -0.06730270385742188, 0.10496669262647629, 0.07970515638589859, -0.06559530645608902, 0.0043776980601251125, -0.019903549924492836, 0.004283009562641382, 0.026574065908789635, -0.004872344899922609, -0.022900942713022232, 0.10034086555242538, 0.007474283222109079, 0.07957786321640015, 0.023642348125576973, 0.015191552229225636, -0.0202505923807621, 0.011060462333261967, -0.0451413132250309, 0.012556679546833038, -0.048366814851760864, -0.0474957711994648, 0.010210459120571613, -0.0222838893532753, -0.01577945053577423, 0.07008946686983109, 0.01746920682489872, -0.049245789647102356, -0.0005551844951696694, 0.015880579128861427, 0.05135514587163925, -0.0004753079847432673, 0.01875227876007557, -0.00396986398845911, 0.014294375665485859, -0.01932649500668049, 0.038899991661310196, 0.033787310123443604, -0.0702921524643898, -0.07230149209499359, 0.006097590085119009, -0.0008169895736500621, 0.010968304239213467, -0.06849402189254761, 0.018914954736828804, -0.015067029744386673, -0.0464586541056633, 0.07898556441068649, 0.012018146924674511, 0.005779411643743515, 0.10351819545030594, 0.013510354794561863, 0.011961540207266808, 0.020044567063450813, -0.018866458907723427, -0.056790612637996674, 0.015532033517956734, 0.04345424100756645, 0.04112128168344498, -0.0015984668862074614, 0.05016062408685684, -0.08356951177120209, -0.07583317905664444, 0.07184155285358429, 0.037323325872421265, -0.026030389592051506, -0.029302513226866722, 0.07412860542535782, 0.0003590112319216132, -0.039227280765771866, -0.004041645675897598, -0.045528344810009, 0.041403260082006454, 0.03992128372192383, -0.016357796266674995, -0.0020819352939724922, -0.03226197138428688, -0.03649790212512016, 0.027751551941037178, 0.0839470773935318, 0.04616644233465195, 0.02051587961614132, 0.03438028693199158, -0.00875488854944706, -0.014568365179002285, -0.018055325374007225, 0.02236662432551384, -0.045420918613672256, -0.04041381552815437, 0.025307727977633476, 0.0006317833322100341, -0.06784681230783463, -0.047147445380687714, -0.020484494045376778, -0.10210400074720383, -0.017180750146508217, -0.017903750762343407, 0.08449497818946838, 0.05578389763832092, -0.02714668959379196, -0.008017608895897865, 0.12115880101919174, -0.014266746118664742, -0.041419342160224915, -0.05173644796013832, -0.04000547528266907, -0.014604145660996437, 0.032675083726644516, -0.02340577356517315, 0.0518609955906868, 0.02892933413386345, -0.026698624715209007, -0.020423270761966705, 0.029355060309171677, 0.024796633049845695, -0.0273931585252285, -0.0553993359208107, -0.020161908119916916, 0.052907634526491165, 0.008447116240859032, -0.03830741345882416, -0.07603265345096588, -0.0033919515553861856, 0.03221007436513901, 0.010013038292527199, -0.00929661188274622, 0.020411120727658272, 0.03929414600133896, 0.012283851392567158, -0.060973793268203735, 0.017013825476169586, -0.05695280805230141, 0.02116541564464569, -0.05342843011021614, -0.05500612035393715, 0.05629053711891174, 0.08255939185619354, 0.014017640613019466, -0.04809335991740227, -0.0010593103943392634, -0.0622875839471817, 0.014771440997719765, -0.011622975580394268, -0.015507152304053307, -0.007276053074747324, -0.04853018373250961, -0.03429506719112396, -0.0030240402556955814, -0.03250710293650627, 0.01653500273823738, 0.025175608694553375, -0.008237931877374649, 0.01689174771308899, -0.004515273962169886, 0.006164831575006247, 0.013017019256949425, 0.017614835873246193, -0.008054547011852264, -0.06462517380714417, 0.0016123168170452118, -0.019871313124895096, 0.024386662989854813, -0.035456057637929916, 0.06227074936032295, 0.0007409848622046411, 0.016907978802919388, 0.025536539033055305, 0.023621538653969765, 0.0069098519161343575, -0.021322758868336678, -0.01110695581883192, -0.004115834832191467, 0.03985298052430153, -0.020451758056879044, -0.022668451070785522, -0.00927425455302, 0.04942817986011505, -0.0007207002490758896, 0.05205882713198662, -0.01335367001593113, 0.015305273234844208, 0.03117409534752369, 0.02783193439245224, -0.030275648459792137, -0.03710629791021347, 0.019199835136532784, -0.0041448757983744144, -0.007538347505033016, 0.06367132067680359, -0.07938322424888611, -0.006420730147510767, 0.00009567559754941612, 0.031737081706523895, -0.012834003195166588, -0.022249814122915268, 0.028730154037475586, -0.012614881619811058, 0.009668602608144283, 0.010880958288908005, 0.03855091333389282, -0.04844791814684868, 0.003212410258129239, 0.02413502149283886, 0.022396545857191086, -0.01669839210808277, 0.022381378337740898, -0.01012958213686943, 0.021149903535842896, -0.006259900983422995, 0.01832663267850876, -0.005628001876175404, 0.00958759244531393, -0.04604216292500496, -0.007244325242936611, -0.02306406758725643, 0.021905111148953438, 0.00403745798394084, 0.04977666214108467, 0.03967397287487984, -0.026033010333776474, -0.023338325321674347, 0.010728226974606514, 0.011795397847890854, -0.04483780264854431, 0.02250160649418831, 0.05901404097676277, 0.012479208409786224, 0.042092859745025635, 0.02541401796042919, 0.0056011611595749855, 0.008312770165503025, -0.03164863586425781, -0.02222469449043274, 0.05828075483441353, -0.013800094835460186, 0.032631684094667435, -0.017322421073913574, -0.000561947119422257, -0.04193255677819252, -0.03242352232336998, -0.002102454425767064, -0.011324997060000896, 0.011035824194550514, -0.05049984157085419, -0.037772178649902344, 0.0215865857899189, -0.05442038178443909, 0.0333736278116703, 0.003033506218343973, 0.0074452185072004795, 0.04997217282652855, -0.001918006339110434, 0.0153881274163723, 0.022985221818089485, -0.002251851838082075, 0.011431141756474972, 0.03124271146953106, -0.025475256145000458, 0.025606488808989525, -0.012262011878192425, -0.0014507449232041836, 0.025283213704824448, -0.0015544052002951503, 0.004719291348010302, 0.0035179145634174347, -0.019221244379878044, -0.032419946044683456, 0.04195291921496391, 0.02191760763525963, 0.0018476750701665878, 0.008408525958657265, -0.010960884392261505, 0.014441451989114285, -0.003246016800403595, 0.002591712400317192, 0.010561416856944561, -0.016587115824222565, -0.000980947632342577, -0.024730607867240906, -0.019057223573327065, -0.0037388894706964493, 0.007611168082803488, -0.014315536245703697, 0.00377329858019948, -0.030078493058681488, -0.01638396456837654, -0.028385674580931664, 0.01744825206696987, 0.023456592112779617, 0.07096118479967117, -0.04725584387779236, 0.014412450604140759, -0.022215336561203003, 0.03486398980021477, -0.0005487945163622499, -0.05494730547070503, -0.01665220409631729, 0.06912580132484436, 0.02354786917567253, 0.007927656173706055, -0.012774506583809853, -0.009151022881269455, 0.024515848606824875, 0.025243263691663742, 0.01425252016633749, -0.033161599189043045, -0.0603446364402771, -0.01218321267515421, -0.021215643733739853, -0.0157901830971241, 0.004465865436941385, 0.010305322706699371, 0.003998770844191313, 0.01402125135064125, 0.0008447368745692074, 0.0049509163945913315, 0.021901680156588554, -0.006353150121867657, -0.004148112144321203, -0.026545464992523193, 0.006776898168027401, 0.026572251692414284, -0.0010206670267507434, 0.027437640354037285, 0.038743820041418076, -0.047361962497234344, 0.002172003500163555, 0.01371118612587452, -0.07765262573957443, -0.010536390356719494, -0.0621473491191864, 0.011862284503877163, -0.020652245730161667, 0.0007903644000180066, 0.006962064187973738, -0.02641099877655506, -0.01964561454951763, -0.041578542441129684, 0.029294826090335846, 0.04775796830654144, -0.020352739840745926, -0.05535544455051422, 0.030270757153630257, 0.03816979378461838, -0.043966833502054214, 0.02005687914788723, -0.019560115411877632, 0.01282105315476656, 0.017630817368626595, -0.012094270437955856, 0.029204662889242172, -0.0726228803396225, 0.013724499382078648, 0.01806250959634781, -0.027883650735020638, 0.0036855507642030716, -0.07133940607309341, 0.013103117235004902, -0.009406549856066704, -0.01142185926437378, -0.04500936344265938, -0.004472881555557251, 0.014868002384901047, 0.008853654377162457, 0.005129143130034208, -0.019983964040875435, 0.007716641761362553, 0.022190582007169724, -0.00942928809672594, -0.03548627719283104, 0.009824467822909355, 0.02466815710067749, 0.01834039017558098, -0.02348385378718376, -0.008727065287530422, 0.029732685536146164, 0.0564841628074646, -0.07451547682285309, 0.06130056083202362, 0.02394295297563076, 0.031148836016654968, 0.012933399528265, -0.00980187114328146, -0.012149209156632423, -0.009728755801916122, -0.0018265456892549992, 0.007898722775280476, -0.030990438535809517, 0.003304131329059601, -0.015094306319952011, -0.002163573633879423, -0.010418867692351341, 0.01740233600139618, 0.019881952553987503, 0.013317457400262356, -0.026053117588162422, -0.04092421382665634, -0.00837505329400301, -0.03774246200919151, 0.0027253523003309965, -0.003489263355731964, -0.0402410626411438, -0.006265133619308472, 0.039126019924879074, -0.054987769573926926, -0.01165219396352768, 0.023019926622509956, 0.036255329847335815, 0.02226456068456173, -0.013339993543922901, -0.036168422549963, -0.05899561941623688, -0.0007862042402848601, -0.02804005704820156, -0.01926414668560028, -0.024471892043948174, -0.005660378839820623, 0.025373009964823723, 0.05085401609539986, 0.0552416667342186, -0.01640903949737549, 0.01393764279782772, 0.0019260767148807645, -0.049586109817028046, -0.006397855468094349, -0.0399891659617424, 0.03640752285718918, 0.03057164140045643, -0.004333741031587124, -0.002992989495396614, 0.007071312516927719, -0.024000918492674828, 0.020825551822781563, -0.0532137006521225, 0.018209801986813545, 0.05077551305294037, -0.01694982871413231, 0.026901207864284515, -0.018725069239735603, 0.013301768340170383, 0.014148118905723095, -0.0031029677484184504, 0.039556652307510376, 0.009118098765611649, 0.04403524845838547, 0.03158946335315704, -0.013126546517014503, 0.017036493867635727, 0.05860273167490959, -0.00056347536155954, -0.012701629661023617, 0.03539895638823509, 0.028096811845898628, -0.039172641932964325, 0.01902833580970764, -0.017888609319925308, -0.018359707668423653, -0.008406704291701317, 0.05165620148181915, 0.019717082381248474, -0.001664654933847487, -0.04047427326440811, 0.018351934850215912, -0.014031530357897282, -0.010756377130746841, 0.033622704446315765, 0.023428382351994514, 0.007360717281699181, 0.03350820392370224, 0.0021501558367162943, -0.0027037684340029955, 0.014913002960383892, 0.042918361723423004, -0.004775961395353079, -0.005103483330458403, 0.0016446411609649658, -0.016236184164881706, 0.04689406603574753, -0.028739385306835175, 0.020442981272935867, 0.06745285540819168, -0.01616879552602768, -0.052698541432619095, -0.05605735257267952, 0.014278768561780453, 0.012523949146270752, -0.029486900195479393, 0.059589385986328125, -0.07523489743471146, -0.03271915391087532, 0.034267816692590714, 0.03804197162389755, -0.015384086407721043, -0.00899767130613327, -0.007218648213893175, 0.008059712126851082, 0.011299909092485905, 0.021212289109826088, 0.031037356704473495, -0.05284210294485092, 0.06927362084388733, 0.01838361844420433, 0.07652708142995834, 0.012541287578642368, -0.04678713530302048, 0.03751892223954201, -0.02241232804954052, -0.004990716464817524, 0.033145204186439514, 0.01343221589922905, -0.01082630641758442, 0.03311449661850929, -0.020168481394648552, -0.054178014397621155, 0.06169414520263672, -0.01266566850244999, -0.01772097870707512, 0.02561727911233902, -0.01269581075757742, 0.016572585329413414, 0.03169477730989456, -0.0001476714387536049, -0.02079118974506855, 0.016588257625699043, 0.02216682955622673, 0.05536402016878128, 0.0180964432656765, -0.040987446904182434, -0.015248027630150318, -0.027210373431444168, 0.024364648386836052, 0.00883149541914463, 0.00961257703602314, 0.0020312415435910225, 0.0030919797718524933, 0.05755028873682022, 0.010189606808125973, -0.012918388471007347, 0.04298676177859306, -0.004403105936944485, 0.0034617010969668627, -0.07939877361059189, -0.0009014035458676517, 0.03189437836408615, -0.012471764348447323, -0.030501583591103554, -0.016708025708794594, -0.013054112903773785, 0.01490798033773899, 0.008075997233390808, 0.032228097319602966, 0.04478941857814789, -0.016364427283406258, 0.014818372204899788, 0.009655490517616272, -0.01748713105916977, -0.006784115917980671, -0.0009317058138549328, 0.04011454060673714, -0.019557025283575058, 0.0005938890972174704, -0.004245847463607788, -0.00419563427567482, -0.021416865289211273, 0.019642299041152, -0.0067605008371174335, 0.000988344894722104, -0.027216454967856407, -0.030399570241570473, 0.012235001660883427, 0.008065356872975826, 0.0065667955204844475, 0.08030080795288086, 0.008989493362605572, 0.04193428158760071, -0.006600068882107735, 0.019693909212946892, 0.0271576177328825, 0.0026262765750288963, -0.0684346854686737, -0.03112150728702545, -0.04447010159492493, 0.01768750511109829, 0.04975929856300354, 0.039485134184360504, -0.03606215491890907, 0.047528523951768875, -0.012211478315293789, -0.0453437864780426, -0.0543513149023056, -0.010925502516329288, 0.022669712081551552, 0.01411229744553566, 0.05678277835249901, -0.023497533053159714, -0.04029406979680061, -0.048268429934978485, -0.0039841048419475555, -0.02883951924741268, 0.02871476300060749, 0.032526299357414246, -0.01111114863306284, -0.01517427247017622, -0.034637391567230225, -0.010297195054590702, -0.04519420117139816, 0.01788836345076561, 0.025928571820259094, 0.010098317638039589, -0.02138708159327507, 0.021388519555330276, 0.03880259022116661, 0.005207936745136976, 0.022145651280879974, 0.015195794403553009, 0.01863483525812626, -0.0032982092816382647, 0.0019608086440712214, -0.026048757135868073, -0.03566461428999901, 0.003454918973147869, 0.0018275860929861665, 0.06960447132587433, -0.00723345298320055, 0.012606148608028889, 0.016483288258314133, 0.02857418730854988, 0.02444596216082573, -0.009563513100147247, -0.024035613983869553, -0.01785527728497982, 0.019682802259922028, 0.010489344596862793, -0.05227358639240265, -0.043042104691267014, 0.023673608899116516, 0.030368292704224586, -0.028664981946349144, -0.01503678783774376, 0.014618677087128162, -0.004199587274342775, -0.0173025019466877, -0.005874830763787031, -0.033222366124391556, 0.03975237160921097, -0.038664743304252625, 0.045782070606946945, 0.06341555714607239, 0.023616058751940727 ]
Understanding BigBird's Block Sparse Attention
vasudevgupta
March 31, 2021
big-bird
community, research, nlp
https://huggingface.co/blog/big-bird
What tokens should be attended to? We will give a practical example of how attention works by considering the sentence "BigBird is now available in HuggingFace for extractive question answering". In BERT-like attention, every word would simply attend to all other tokens. Put mathematically, this would mean that each queried token \( \text{query-token} \in {\text{BigBird},\text{is},\text{now},\text{available},\text{in},\text{HuggingFace},\text{for},\text{extractive},\text{question},\text{answering}} \), would attend to the full list of \( \text{key-tokens} = \left[\text{BigBird},\text{is},\text{now},\text{available},\text{in},\text{HuggingFace},\text{for},\text{extractive},\text{question},\text{answering} \right]\). Let's think about a sensible choice of key tokens that a queried token actually only should attend to by writing some pseudo-code. Will will assume that the token available is queried and build a sensible list of key tokens to attend to. python >>> # let's consider following sentence as an example >>> example = ['BigBird', 'is', 'now', 'available', 'in', 'HuggingFace', 'for', 'extractive', 'question', 'answering'] >>> # further let's assume, we're trying to understand the representation of 'available' i.e. >>> query_token = 'available' >>> # We will initialize an empty `set` and fill up the tokens of our interest as we proceed in this section. >>> key_tokens = [] # => currently 'available' token doesn't have anything to attend Nearby tokens should be important because, in a sentence (sequence of words), the current word is highly dependent on neighboring past & future tokens. This intuition is the idea behind the concept of sliding attention. python >>> # considering `window_size = 3`, we will consider 1 token to left & 1 to right of 'available' >>> # left token: 'now' ; right token: 'in' >>> sliding_tokens = ["now", "available", "in"] >>> # let's update our collection with the above tokens >>> key_tokens.append(sliding_tokens) Long-range dependencies: For some tasks, it is crucial to capture long-range relationships between tokens. E.g., in question-answering the model needs to compare each token of the context to the whole question to be able to figure out which part of the context is useful for a correct answer. If most of the context tokens would just attend to other context tokens, but not to the question, it becomes much harder for the model to filter important context tokens from less important context tokens. Now,BigBirdproposes two ways of allowing long-term attention dependencies while staying computationally efficient. * **Global tokens:** Introduce some tokens which will attend to every token and which are attended by every token. Eg: *"HuggingFace is building nice libraries for easy NLP"*. Now, let's say *'building'* is defined as a global token, and the model needs to know the relation among *'NLP'* & *'HuggingFace'* for some task (Note: these 2 tokens are at two extremes); Now having *'building'* attend globally to all other tokens will probably help the model to associate *'NLP'* with *'HuggingFace'*. ```python >>> # let's assume 1st & last token to beglobal, then >>> global_tokens = ["BigBird", "answering"] >>> # fill up global tokens in our key tokens collection >>> key_tokens.append(global_tokens) ``` * **Random tokens:** Select some tokens randomly which will transfer information by transferring to other tokens which in turn can transfer to other tokens. This may reduce the cost of information travel from one token to other. ```python >>> # now we can choosertoken randomly from our example sentence >>> # let's choose 'is' assumingr=1>>> random_tokens = ["is"] # Note: it is chosen compleletly randomly; so it can be anything else also. >>> # fill random tokens to our collection >>> key_tokens.append(random_tokens) >>> # it's time to see what tokens are in ourkey_tokenslist >>> key_tokens {'now', 'is', 'in', 'answering', 'available', 'BigBird'} # Now, 'available' (query we choose in our 1st step) will attend only these tokens instead of attending the complete sequence ``` This way, the query token attends only to a subset of all possible tokens while yielding a good approximation of full attention. The same approach will is used for all other queried tokens. But remember, the whole point here is to approximateBERT's full attention as efficiently as possible. Simply making each queried token attend all key tokens as it's done for BERT can be computed very effectively as a sequence of matrix multiplication on modern hardware, like GPUs. However, a combination of sliding, global & random attention appears to imply sparse matrix multiplication, which is harder to implement efficiently on modern hardware. One of the major contributions ofBigBirdis the proposition of ablock sparseattention mechanism that allows computing sliding, global & random attention effectively. Let's look into it!
[ -0.0070374226197600365, 0.011155009269714355, 0.027030115947127342, -0.009554671123623848, 0.009906838648021221, 0.01830068975687027, 0.01075349934399128, 0.08457393199205399, -0.037471186369657516, 0.025754865258932114, -0.046424172818660736, 0.04278673604130745, -0.016348281875252724, 0.036386873573064804, -0.02194327674806118, 0.09699022024869919, 0.08323847502470016, -0.0210444163531065, -0.02475685440003872, -0.04824483394622803, 0.06757118552923203, -0.0015476468252018094, 0.06196432560682297, -0.017016083002090454, 0.07477089017629623, -0.05442918837070465, -0.030204424634575844, -0.0024691543076187372, -0.02983926236629486, 0.011322769336402416, -0.116471067070961, 0.03665942698717117, 0.04114261269569397, -0.016475072130560875, 0.017015807330608368, -0.0072947111912071705, -0.07527022808790207, 0.07517674565315247, 0.05359164625406265, -0.06745787709951401, -0.01711815968155861, -0.0479511022567749, -0.05271134153008461, -0.03553640469908714, -0.0793379470705986, 0.005049614701420069, -0.15469875931739807, 0.0770188719034195, -0.028732193633913994, 0.0035789846442639828, -0.06975840032100677, -0.02249591238796711, 0.031491346657276154, 0.07229918986558914, 0.044276680797338486, -0.022249288856983185, -0.0530589334666729, -0.0822797566652298, 0.007936635985970497, 0.0055060675367712975, 0.05006948858499527, -0.008039155974984169, -0.002067327732220292, 0.058919575065374374, 0.0746491327881813, 0.021232319995760918, -0.020632440224289894, -0.0014987523900344968, -0.088826484978199, -0.007086159661412239, 0.06271906197071075, -0.026388613507151604, -0.0007356610149145126, 0.03197866305708885, -0.021194742992520332, -0.04507066309452057, -0.011877682991325855, 0.00826227106153965, -0.004820141475647688, 0.033762022852897644, 0.04587022215127945, -0.003893070388585329, 0.06706804782152176, 0.06111539900302887, 0.02218046598136425, 0.022188859060406685, 0.0240203645080328, -0.08412095159292221, -0.0876903161406517, 0.02354806661605835, -0.00160421512555331, -0.1671343296766281, 0.03334326297044754, 0.008261943235993385, 0.04947054386138916, -0.06240011751651764, 0.0441109798848629, -0.004819197580218315, -0.07747072726488113, 0.007088907994329929, -0.029222166165709496, -0.03760582581162453, 0.0886756181716919, -0.015565680339932442, -0.07946173846721649, 0.04139193147420883, -0.011000065132975578, -0.0500667504966259, -0.05570510774850845, -0.041403092443943024, 0.026380034163594246, -0.024674972519278526, 0.028458738699555397, 0.012223546393215656, -0.015369872562587261, 0.02182025834918022, -0.018579522147774696, 0.02733984962105751, 0.02544170618057251, -0.025921039283275604, -0.007611753884702921, 0.06676588207483292, 0.10987183451652527, -0.038388870656490326, 0.012232801876962185, 0.0167294479906559, -0.009056277573108673, 0.03960394114255905, -0.07326225191354752, -0.06449317932128906, 0.027325903996825218, 0.0013936433242633939, 0.002973313443362713, -0.0006230784929357469, -0.05188439041376114, -0.016103707253932953, -0.021199094131588936, -0.045939359813928604, 0.030392618849873543, -0.046094268560409546, -0.01427043043076992, 0.0100172134116292, -0.002894252073019743, -0.00804068148136139, 0.05362548306584358, -0.012207316234707832, -0.12247485667467117, 0.028136806562542915, -0.006821796298027039, 0.04891582205891609, -0.024851147085428238, 0.04487362131476402, -0.00770913390442729, -0.004257430788129568, 0.0029249878134578466, 0.06037291884422302, 0.013676696456968784, -0.03642451763153076, -0.06062448397278786, -0.04555871710181236, -0.05125884339213371, 0.019007720053195953, 0.005868099629878998, 0.04934423044323921, 0.025898655876517296, 0.010857654735445976, -0.011562283150851727, 0.05449637398123741, 0.03742082417011261, 0.05076420307159424, 0.039685022085905075, 0.011882628314197063, -0.027937553822994232, -0.07213941961526871, -0.0016880728071555495, 0.007404956966638565, -0.01736571080982685, 0.009070458821952343, -0.03325802460312843, 0.01096571609377861, -0.03283245116472244, -0.02761179208755493, 0.019522415474057198, 0.029497671872377396, 0.05397775024175644, -0.042405031621456146, 0.03958733379840851, 0.005472143180668354, -0.001538438256829977, -0.010549153201282024, -0.056827183812856674, 0.02117280662059784, 0.051252331584692, -0.023676132783293724, -0.010678081773221493, -0.061524420976638794, -0.04116997495293617, 0.05598176270723343, 0.053436871618032455, 0.0570419616997242, 0.04766883701086044, 0.055847711861133575, -0.02139418199658394, 0.002849050099030137, 0.006845132447779179, -0.010075505822896957, -0.008025402203202248, -0.11270041763782501, 0.056329160928726196, 0.005020475015044212, -0.020022336393594742, -0.08079379796981812, 0.007930020801723003, -0.09854573011398315, -0.05925172194838524, -0.08462653309106827, 0.017241761088371277, 0.036030203104019165, 0.010621950030326843, -0.07022054493427277, 0.11620228737592697, -0.035582464188337326, 0.06438784301280975, -0.040915489196777344, 0.0006448753410950303, 0.012819185853004456, 0.06911646574735641, 0.02730526216328144, 0.05211029574275017, -0.016168873757123947, -0.03850771114230156, -0.04442093148827553, 0.01764547824859619, -0.05386775732040405, -0.022638536989688873, -0.047071244567632675, -0.037781037390232086, 0.05726800858974457, 0.008848363533616066, -0.03266054019331932, -0.022123262286186218, -0.051067229360342026, 0.0773734599351883, 0.0861857458949089, 0.007023773156106472, 0.01666966825723648, 0.056726932525634766, -0.03712816536426544, -0.07242486625909805, -0.00761386239901185, -0.05786806717514992, 0.06659632921218872, -0.05230817198753357, -0.07690604031085968, 0.06895863264799118, 0.024051733314990997, 0.0023933143820613623, -0.012768808752298355, -0.00001918006455525756, -0.00991938915103674, 0.010170613415539265, 0.02124711126089096, 0.02211068384349346, -0.027676116675138474, -0.03640538826584816, -0.05763748288154602, 0.008387438952922821, 0.0008374596363864839, 0.01738678477704525, 0.06910889595746994, 0.0000031655931707064155, 0.02286941558122635, 0.0013616003561764956, 0.0064229946583509445, 0.004435321316123009, 0.022491835057735443, 0.054057247936725616, -0.026440460234880447, -0.022966528311371803, -0.016236431896686554, 0.03364846482872963, -0.03009723499417305, -0.005092148203402758, 0.0073622590862214565, -0.056520991027355194, 0.031289875507354736, 0.017189515754580498, 0.01927236281335354, -0.02700825035572052, -0.007989739067852497, 0.031319063156843185, 0.00289219175465405, -0.024832360446453094, -0.010537863709032536, -0.003735382342711091, 0.028653515502810478, -0.049806367605924606, -0.008650303818285465, -0.022256502881646156, 0.0014973782235756516, -0.032676730304956436, 0.029263144358992577, -0.02096441760659218, 0.006608089432120323, -0.02867671474814415, -0.0035363740753382444, -0.04523317888379097, 0.05707288905978203, -0.0930432453751564, -0.03554295748472214, 0.041211195290088654, 0.044932037591934204, -0.01923578791320324, -0.03668110817670822, 0.04098525270819664, 0.014162209816277027, -0.023160386830568314, -0.01531669870018959, 0.012967031449079514, -0.024192452430725098, -0.010957370512187481, 0.01508280634880066, 0.0192605908960104, -0.011910717003047466, 0.03080127388238907, -0.03392671048641205, 0.0596604160964489, 0.01287263073027134, 0.015333667397499084, 0.014079054817557335, -0.01956399343907833, -0.028779951855540276, -0.010592457838356495, -0.008097875863313675, 0.029613785445690155, 0.04299288988113403, 0.03860168904066086, 0.004833984654396772, 0.007683356758207083, -0.0004136492789257318, 0.01216390635818243, 0.0201302170753479, -0.04525231570005417, 0.03594835475087166, 0.014080608263611794, -0.010933402925729752, -0.010730870068073273, 0.05743144080042839, 0.02648768201470375, 0.005314018577337265, -0.011372443288564682, -0.028513628989458084, 0.013972370885312557, -0.03973044827580452, -0.007743214722722769, -0.02425897866487503, -0.008097457699477673, -0.06429274380207062, -0.03922158107161522, -0.01569129154086113, -0.012231670320034027, 0.006129371467977762, -0.019472835585474968, -0.018769262358546257, -0.003917568363249302, -0.004564390983432531, 0.004395622760057449, -0.034398969262838364, -0.010103443637490273, 0.009504355490207672, -0.017391595989465714, -0.013457464054226875, -0.03353331610560417, 0.0056541250087320805, -0.01715925708413124, 0.007579355966299772, -0.010075756348669529, 0.0005242827464826405, -0.007221279665827751, 0.004453776869922876, 0.025627782568335533, 0.0010193509515374899, 0.020107559859752655, 0.01308349147439003, -0.018662601709365845, -0.021440429612994194, 0.054114677011966705, 0.008119966834783554, -0.022503705695271492, 0.020990774035453796, -0.04050722345709801, -0.004502671770751476, -0.011864451691508293, -0.019055061042308807, 0.024214839562773705, -0.0034350482746958733, -0.01892370916903019, -0.011181460693478584, -0.03173079714179039, -0.04212401062250137, 0.01566149666905403, -0.016237448900938034, -0.02933536469936371, 0.011907809413969517, 0.006567399948835373, -0.015288390219211578, 0.021410580724477768, -0.0068345461040735245, 0.06592383235692978, -0.03650861606001854, 0.0018871371867135167, 0.03614996373653412, -0.008961568586528301, 0.005725949537009001, -0.04050591588020325, -0.05229613184928894, 0.06891817599534988, 0.02140551619231701, 0.025912808254361153, -0.01012751180678606, -0.01111133024096489, -0.02730325050652027, 0.018327847123146057, 0.003457598853856325, 0.002378046978265047, -0.0010124678956344724, -0.0626160204410553, -0.0005746374954469502, -0.01723041571676731, 0.0397830605506897, 0.013141686096787453, 0.004122970160096884, 0.06581795960664749, -0.019156957045197487, 0.0463407076895237, -0.02190316654741764, -0.00007763512985548005, 0.03489139303565025, -0.03303797170519829, -0.014829677529633045, 0.03077215515077114, -0.013884525746107101, -0.015524201095104218, 0.01332029327750206, -0.027650929987430573, 0.03715231269598007, 0.004561000969260931, -0.07268423587083817, -0.02550509385764599, -0.05323658883571625, 0.011346682906150818, -0.015105750411748886, -0.005079028662294149, 0.021295268088579178, -0.031326573342084885, -0.0034928962122648954, -0.02075960859656334, 0.030718054622411728, 0.07134399563074112, 0.022158730775117874, -0.051632124930620193, 0.03349624201655388, 0.027521343901753426, -0.020281972363591194, 0.009612131863832474, -0.009787079878151417, 0.03996403515338898, 0.045578137040138245, -0.006244223564863205, 0.0024280590005218983, -0.008401134051382542, -0.005810744594782591, 0.029342681169509888, -0.053864073008298874, -0.040301527827978134, -0.04538840427994728, -0.009057821705937386, -0.02634189836680889, -0.028706086799502373, -0.05406532809138298, -0.02069244347512722, 0.007141551002860069, 0.0014281165786087513, -0.006306395400315523, 0.022512873634696007, 0.03416581079363823, -0.009262451902031898, -0.01182387862354517, -0.027934247627854347, 0.009884794242680073, 0.010905534029006958, 0.029286233708262444, 0.01671157032251358, 0.04653104394674301, 0.04574592411518097, 0.04219117760658264, -0.0650075376033783, 0.042120665311813354, -0.008807748556137085, -0.004986644722521305, 0.00905250571668148, -0.028429225087165833, -0.02367558516561985, -0.011717773973941803, 0.02213873341679573, 0.01599147915840149, 0.0024962658062577248, -0.0006600056658498943, 0.01736849918961525, 0.020401418209075928, 0.005486080422997475, 0.013080630451440811, 0.012667226605117321, 0.032538581639528275, 0.01607646979391575, -0.04729851335287094, -0.04879215359687805, -0.03845203295350075, 0.0018795240903273225, -0.004951561335474253, -0.03935893625020981, 0.0124929528683424, 0.002298919251188636, -0.02729785442352295, -0.03695974871516228, 0.0420118123292923, -0.0031468786764889956, 0.04025806859135628, 0.024157345294952393, -0.009019610472023487, -0.016091573983430862, -0.005514220334589481, 0.03420252352952957, -0.02136612869799137, -0.012907438911497593, 0.03182981163263321, 0.030126145109534264, 0.028502609580755234, -0.00034829354262910783, 0.0005803633248433471, 0.01778481714427471, 0.027856189757585526, -0.017497746273875237, 0.018965503200888634, -0.04903039708733559, 0.017263304442167282, 0.007449757307767868, 0.01168410200625658, 0.050611142069101334, 0.021495072171092033, -0.05901089683175087, 0.025045646354556084, -0.04312816262245178, 0.010267616249620914, 0.09071788936853409, -0.024482406675815582, 0.00678254896774888, 0.006378756836056709, 0.022875884547829628, 0.0060932752676308155, -0.02046629786491394, 0.04089657589793205, 0.025654777884483337, 0.02076568268239498, 0.03468218445777893, -0.0075434669852256775, -0.02214367315173149, -0.00833980180323124, 0.05266448110342026, -0.047644976526498795, 0.014491843990981579, 0.0031924964860081673, -0.02615175023674965, 0.01384455244988203, 0.017248045653104782, -0.041631296277046204, 0.03020564652979374, 0.042995721101760864, 0.050443798303604126, -0.019302336499094963, -0.03017072193324566, -0.018547944724559784, 0.0012949865777045488, 0.01165721844881773, 0.020730070769786835, 0.03018084354698658, -0.012965296395123005, 0.0235464945435524, 0.006950941868126392, 0.024762524291872978, 0.02246437408030033, 0.03080800361931324, 0.035140179097652435, 0.011302771046757698, 0.01454200129956007, -0.003793050767853856, 0.05214741453528404, -0.015987297520041466, 0.00034550385316833854, 0.02222382090985775, -0.015771398320794106, -0.002297155326232314, -0.00814742874354124, 0.026966068893671036, 0.02465038187801838, -0.0062775760889053345, 0.04018620774149895, -0.0032440519426018, 0.022941192612051964, 0.027729617431759834, 0.026169363409280777, 0.00435302872210741, -0.020649641752243042, -0.004489491228014231, 0.033767350018024445, 0.051552459597587585, 0.03115599788725376, -0.008496240712702274, -0.02918286994099617, 0.05655967816710472, 0.032503776252269745, 0.07854543626308441, 0.03227299824357033, -0.0292443186044693, 0.015934934839606285, -0.050720375031232834, -0.031049808487296104, 0.06467212736606598, 0.016151059418916702, -0.02998349256813526, -0.024608733132481575, 0.007746560033410788, -0.009271621704101562, 0.03370622545480728, -0.02865109033882618, -0.04573613777756691, 0.0005439877859316766, -0.032909270375967026, 0.0326477475464344, 0.07787801325321198, 0.0020763820502907038, -0.012324790470302105, -0.008617253974080086, 0.005044488236308098, 0.0017876867204904556, 0.03098098188638687, -0.04853612184524536, -0.010953443124890327, -0.022034291177988052, 0.034517694264650345, -0.043861355632543564, 0.016663111746311188, 0.005135313142091036, 0.013280365616083145, 0.04023342207074165, 0.03935966640710831, -0.027473652735352516, 0.06804750114679337, 0.016906358301639557, 0.02504757232964039, -0.018479011952877045, -0.0054499367251992226, -0.011194271966814995, 0.030636489391326904, -0.024334324523806572, -0.025507565587759018, 0.011295882053673267, -0.0045151193626224995, 0.0029314367566257715, 0.04991071671247482, 0.01973201520740986, 0.009858092293143272, 0.018477458506822586, -0.0009409859194420278, -0.04242229834198952, -0.03129119053483009, -0.0035399822518229485, 0.034522298723459244, 0.012169881723821163, -0.010314120911061764, -0.055026859045028687, -0.0020500251557677984, -0.006552564911544323, -0.001207332476042211, 0.030766386538743973, 0.021025236696004868, 0.000028328779080766253, -0.029453219845891, 0.015490422956645489, 0.05176696926355362, 0.04665374383330345, 0.06120065972208977, -0.007114502135664225, 0.02515854313969612, -0.01377140637487173, 0.04647371172904968, -0.007886814884841442, 0.019434070214629173, -0.02998148836195469, 0.037329189479351044, -0.012374172918498516, -0.00009074726403923705, -0.030754433944821358, 0.031354621052742004, -0.05149078741669655, 0.04166760668158531, -0.04212716594338417, -0.020915180444717407, -0.014400438405573368, -0.014726083725690842, 0.02613527700304985, -0.04101790860295296, 0.05377526953816414, 0.03263227269053459, -0.023384125903248787, -0.05396687611937523, 0.017969900742173195, 0.014623967930674553, 0.02942350134253502, -0.001859972020611167, 0.005998584907501936, -0.015469281934201717, -0.016401812434196472, -0.06242462992668152, -0.045562535524368286, 0.05718345567584038, 0.0369725376367569, -0.0009409155463799834, 0.03470175340771675, 0.05797931179404259, 0.010882480069994926, 0.01990034617483616, -0.010686920024454594, 0.04206953942775726, -0.0013990794541314244, 0.014165357686579227, 0.019705887883901596, -0.024743130430579185, -0.014546920545399189, -0.008543442003428936, 0.013318936340510845, 0.04633183032274246, 0.018828699365258217, -0.005365757271647453, -0.012461720034480095, 0.043346334248781204, 0.018088558688759804, -0.012865841388702393, -0.03812864050269127, -0.03398716449737549, 0.045727405697107315, 0.02616679109632969, -0.028713976964354515, -0.002073375042527914, 0.0426810123026371, 0.010655365884304047, -0.04447859898209572, 0.03431987389922142, 0.020386407151818275, -0.020553793758153915, -0.02109605446457863, 0.01800444722175598, 0.008041976019740105, 0.024361560121178627, 0.0051108491607010365, 0.03426919877529144, 0.016609610989689827, 0.033756937831640244 ]
Understanding BigBird's Block Sparse Attention
vasudevgupta
March 31, 2021
big-bird
community, research, nlp
https://huggingface.co/blog/big-bird
Using BigBird with 🤗Transformers You can use BigBirdModel just like any other 🤗 model. Let's see some code below: python from transformers import BigBirdModel # loading bigbird from its pretrained checkpoint model = BigBirdModel.from_pretrained("google/bigbird-roberta-base") # This will init the model with default configuration i.e. attention_type = "block_sparse" num_random_blocks = 3, block_size = 64. # But You can freely change these arguments with any checkpoint. These 3 arguments will just change the number of tokens each query token is going to attend. model = BigBirdModel.from_pretrained("google/bigbird-roberta-base", num_random_blocks=2, block_size=16) # By setting attention_type to `original_full`, BigBird will be relying on the full attention of n^2 complexity. This way BigBird is 99.9 % similar to BERT. model = BigBirdModel.from_pretrained("google/bigbird-roberta-base", attention_type="original_full") There are total 3 checkpoints available in 🤗Hub (at the point of writing this article): bigbird-roberta-base, bigbird-roberta-large, bigbird-base-trivia-itc. The first two checkpoints come from pretraining BigBirdForPretraining with masked_lm loss; while the last one corresponds to the checkpoint after finetuning BigBirdForQuestionAnswering on trivia-qa dataset. Let's have a look at minimal code you can write (in case you like to use your PyTorch trainer), to use 🤗's BigBird model for fine-tuning your tasks. python # let's consider our task to be question-answering as an example from transformers import BigBirdForQuestionAnswering, BigBirdTokenizer import torch device = torch.device("cpu") if torch.cuda.is_available(): device = torch.device("cuda") # lets initialize bigbird model from pretrained weights with randomly initialized head on its top model = BigBirdForQuestionAnswering.from_pretrained("google/bigbird-roberta-base", block_size=64, num_random_blocks=3) tokenizer = BigBirdTokenizer.from_pretrained("google/bigbird-roberta-base") model.to(device) dataset = "torch.utils.data.DataLoader object" optimizer = "torch.optim object" epochs = ... # very minimal training loop for e in range(epochs): for batch in dataset: model.train() batch = {k: batch[k].to(device) for k in batch} # forward pass output = model(**batch) # back-propogation output["loss"].backward() optimizer.step() optimizer.zero_grad() # let's save final weights in a local directory model.save_pretrained("<YOUR-WEIGHTS-DIR>") # let's push our weights to 🤗Hub from huggingface_hub import ModelHubMixin ModelHubMixin.push_to_hub("<YOUR-WEIGHTS-DIR>", model_id="<YOUR-FINETUNED-ID>") # using finetuned model for inference question = ["How are you doing?", "How is life going?"] context = ["<some big context having ans-1>", "<some big context having ans-2>"] batch = tokenizer(question, context, return_tensors="pt") batch = {k: batch[k].to(device) for k in batch} model = BigBirdForQuestionAnswering.from_pretrained("<YOUR-FINETUNED-ID>") model.to(device) with torch.no_grad(): start_logits, end_logits = model(**batch).to_tuple() # now decode start_logits, end_logits with what ever strategy you want. # Note: # This was very minimal code (in case you want to use raw PyTorch) just for showing how BigBird can be used very easily # I would suggest using 🤗Trainer to have access for a lot of features It's important to keep the following points in mind while working with big bird: * Sequence length must be a multiple of block size i.e. seqlen % block_size = 0. You need not worry since 🤗Transformers will automatically <pad> (to smallest multiple of block size which is greater than sequence length) if batch sequence length is not a multiple of block_size. * Currently, HuggingFace version doesn't support ETC and hence only 1st & last block will be global. * Current implementation doesn't support num_random_blocks = 0. * It's recommended by authors to set attention_type = "original_full" when sequence length < 1024. * This must hold: seq_length > global_token + random_tokens + sliding_tokens + buffer_tokens where global_tokens = 2 x block_size, sliding_tokens = 3 x block_size, random_tokens = num_random_blocks x block_size & buffer_tokens = num_random_blocks x block_size. In case you fail to do that, 🤗Transformers will automatically switch attention_type to original_full with a warning. * When using big bird as decoder (or using BigBirdForCasualLM), attention_type should be original_full. But you need not worry, 🤗Transformers will automatically switch attention_type to original_full in case you forget to do that.
[ 0.02015458047389984, 0.03709252551198006, -0.046587660908699036, -0.05051509290933609, 0.04831061512231827, 0.025830239057540894, 0.05071689561009407, 0.06510992348194122, -0.02406388521194458, -0.03175139054656029, -0.04393109306693077, 0.02566511742770672, -0.07434170693159103, -0.0331745408475399, 0.008830545470118523, -0.013664498925209045, 0.08915456384420395, -0.04226313903927803, -0.03537692874670029, 0.006546791642904282, 0.028714925050735474, -0.0043918415904045105, 0.05646293982863426, -0.01989130489528179, -0.017821792513132095, -0.06991275399923325, 0.019718831405043602, 0.05465665087103844, -0.03823308274149895, 0.030767444521188736, -0.0848541185259819, -0.008877977728843689, 0.041124098002910614, -0.043039094656705856, 0.04218402877449989, 0.055800918489694595, -0.10193935036659241, 0.056880827993154526, 0.022360937669873238, -0.023652220144867897, 0.019479786977171898, 0.025698024779558182, -0.02466997131705284, 0.041171103715896606, -0.04847464710474014, -0.01976027339696884, -0.12478421628475189, 0.108436718583107, -0.006952615454792976, -0.03626172989606857, -0.07070394605398178, 0.07930802553892136, 0.013375982642173767, 0.03835948929190636, 0.04379706829786301, 0.012576784938573837, -0.0328633077442646, -0.049619924277067184, -0.006651084404438734, -0.032482296228408813, 0.04131126403808594, -0.010640749707818031, 0.005000751931220293, 0.04528921842575073, -0.01954084448516369, 0.04172109067440033, -0.01703442446887493, 0.01060810312628746, -0.08914923667907715, 0.00024911793298088014, 0.018588542938232422, -0.05425581336021423, 0.010838671587407589, -0.022940000519156456, -0.06930495798587799, -0.0636582151055336, -0.010292423889040947, 0.052802398800849915, 0.08520642668008804, 0.07761642336845398, -0.03665190190076828, 0.055166035890579224, 0.013215363025665283, -0.0024744479451328516, 0.017320947721600533, 0.003952282015234232, 0.04150036722421646, -0.0688583254814148, -0.024459460750222206, 0.01772957481443882, -0.05341361463069916, -0.1740061342716217, 0.022418059408664703, -0.014006021432578564, 0.002701852237805724, -0.019526787102222443, -0.0240528155118227, 0.02908848598599434, 0.006056776735931635, -0.04334764555096626, -0.022329239174723625, -0.08503890037536621, 0.046730030328035355, -0.028406908735632896, -0.08761771768331528, 0.04322724789381027, -0.0347132533788681, -0.13105763494968414, -0.03380102291703224, -0.012882795184850693, -0.012368571013212204, -0.04022294655442238, -0.07472395151853561, 0.06458429247140884, -0.09315667301416397, -0.014924412593245506, -0.00777915446087718, -0.002350509399548173, -0.003108847886323929, 0.03572692349553108, -0.03381417691707611, 0.09089140594005585, 0.05754327401518822, -0.020765041932463646, 0.007564898580312729, 0.04518827050924301, 0.035982463508844376, 0.00821562297642231, -0.005957779474556446, -0.023745445534586906, 0.048696257174015045, -0.001725957146845758, 0.03738093376159668, -0.012360875494778156, 0.030904356390237808, -0.023170847445726395, -0.007054541260004044, -0.06251595169305801, 0.03239068388938904, 0.03772085905075073, -0.08966580778360367, 0.010006078518927097, 0.012008405290544033, -0.011916025541722775, 0.03162435069680214, 0.009562762454152107, -0.07076127082109451, 0.04968787357211113, 0.019773347303271294, 0.018922148272395134, -0.0457376167178154, 0.09373095631599426, -0.043034058064222336, -0.05587377771735191, -0.05521109700202942, 0.017410574480891228, -0.04168692231178284, -0.06769756972789764, -0.07471167296171188, -0.019470123574137688, 0.029542505741119385, -0.008537407964468002, -0.05164079740643501, 0.003141411580145359, -0.006112119182944298, -0.06404369324445724, 0.05332408845424652, -0.017053985968232155, 0.043544333428144455, 0.02375231683254242, -0.009416609071195126, -0.01575564779341221, 0.12811295688152313, 0.0067570991814136505, -0.015281995758414268, 0.09459039568901062, 0.021981339901685715, -0.021803725510835648, -0.010062118992209435, 0.07587023079395294, -0.06362004578113556, -0.008986943401396275, 0.030288215726614, 0.044737111777067184, 0.016161751002073288, -0.02660101279616356, 0.09293411672115326, -0.007086602039635181, -0.026840640231966972, 0.03047417849302292, -0.05214206129312515, 0.031096039339900017, 0.042817119508981705, 0.06493823230266571, 0.044647231698036194, -0.05161584913730621, -0.02173231914639473, 0.060685403645038605, 0.05484916269779205, 0.03278195858001709, 0.030917633324861526, 0.042107872664928436, 0.02032356522977352, -0.011272275820374489, -0.04374174028635025, 0.002498955000191927, -0.008677194826304913, -0.02427813783288002, 0.036397337913513184, -0.006780080031603575, 0.04520449414849281, -0.10071591287851334, 0.012672817334532738, -0.08725932240486145, -0.03583494573831558, -0.014054251834750175, 0.0070705595426261425, -0.034044597297906876, -0.015187186188995838, -0.01020851545035839, 0.13635262846946716, -0.020565122365951538, -0.010764306411147118, -0.09849677234888077, -0.02276676520705223, -0.004434310831129551, 0.038687143474817276, 0.0022680240217596292, 0.011135701090097427, -0.03106878325343132, -0.036976516246795654, -0.030721167102456093, -0.00988740287721157, 0.06688901782035828, 0.006860020104795694, -0.02579672820866108, -0.013770475052297115, -0.02858961932361126, -0.03214162588119507, -0.0214246716350317, -0.03833011910319328, -0.010082198306918144, -0.02257380075752735, 0.01207215990871191, -0.005408646073192358, 0.04078441485762596, -0.013916682451963425, -0.020128844305872917, -0.006955469958484173, -0.019294021651148796, -0.04512380063533783, 0.0396324060857296, 0.01852741651237011, -0.043743330985307693, 0.09484492242336273, 0.04606335982680321, -0.003941698931157589, -0.00883719976991415, 0.024661196395754814, -0.0031635041814297438, 0.034524478018283844, 0.02633536420762539, -0.006717049982398748, -0.008815954439342022, -0.010166849009692669, -0.0645039975643158, -0.01168904174119234, -0.02285320870578289, 0.051759425550699234, -0.012899201363325119, 0.025393040850758553, -0.006919765844941139, 0.02410104312002659, 0.04637684300541878, 0.0015130896354094148, 0.05268773064017296, 0.017479971051216125, -0.038660891354084015, -0.05149872601032257, -0.0010606615105643868, 0.015490376390516758, -0.05724189057946205, -0.007904533296823502, -0.01988225057721138, 0.006821504328399897, 0.03475860133767128, 0.01525106094777584, -0.0029112957417964935, -0.023287825286388397, 0.021819505840539932, 0.013369104824960232, 0.017663197591900826, 0.014325032941997051, -0.02001834847033024, -0.05556246638298035, 0.03990951552987099, 0.015595270320773125, 0.019316604360938072, 0.006301887333393097, 0.0027872994542121887, 0.014333227649331093, -0.009441635571420193, 0.052320051938295364, 0.019996855407953262, 0.009827121160924435, 0.0045643956400454044, 0.008898412808775902, 0.0322105847299099, -0.09884896129369736, -0.01003680843859911, -0.018485503271222115, 0.02087932452559471, -0.009267409332096577, -0.02052375115454197, 0.05864223092794418, -0.019725972786545753, 0.009544751606881618, -0.009667390957474709, 0.031050242483615875, -0.005994379986077547, 0.0054283542558550835, 0.0002446688595227897, -0.0408516526222229, 0.007609362713992596, -0.002390139037743211, -0.0071205198764801025, -0.007312146481126547, -0.007635494228452444, 0.01809009537100792, 0.0275416262447834, 0.015099279582500458, -0.04393403232097626, -0.029407251626253128, -0.01446520909667015, 0.01508542150259018, 0.028355782851576805, 0.031374283134937286, 0.0055959089659154415, -0.014138411730527878, -0.015973970293998718, 0.017585886642336845, 0.035883236676454544, -0.028005529195070267, 0.030892865732312202, -0.0028893700800836086, 0.014474527910351753, 0.039724200963974, 0.027800681069493294, -0.009446637704968452, -0.04337456077337265, -0.024132460355758667, -0.0368691012263298, 0.05287107825279236, -0.023778967559337616, 0.0069600497372448444, -0.0059716845862567425, 0.012955318205058575, -0.029874032363295555, -0.008544507436454296, 0.004935082048177719, 0.021637864410877228, 0.01953738182783127, -0.007990792393684387, -0.06251085549592972, 0.015797188505530357, 0.01827598176896572, 0.06801202893257141, -0.02566751278936863, -0.05174493044614792, 0.038083139806985855, -0.029246700927615166, 0.0152101069688797, -0.021002747118473053, 0.03949246555566788, 0.007427528966218233, -0.030330242589116096, -0.018786340951919556, 0.024036873131990433, 0.014180931262671947, 0.05819474160671234, 0.031991198658943176, 0.005317248869687319, 0.015409993007779121, 0.017540816217660904, -0.042218711227178574, -0.028945039957761765, 0.019135722890496254, 0.02015812136232853, -0.014278870075941086, -0.04459254816174507, -0.01779501885175705, -0.009015029296278954, -0.017863700166344643, 0.025169583037495613, 0.007590769790112972, -0.01714477315545082, -0.026002652943134308, 0.02177751436829567, 0.027750417590141296, 0.00888877548277378, 0.041368674486875534, -0.005930707789957523, 0.005576268769800663, -0.04424756020307541, 0.0044746496714651585, -0.013344434089958668, 0.035515908151865005, -0.00860222615301609, 0.036593496799468994, -0.055675845593214035, -0.006898380815982819, -0.024070048704743385, 0.04663797840476036, 0.03154364228248596, -0.08673366159200668, -0.03435855731368065, 0.019711874425411224, -0.012703894637525082, 0.022131092846393585, -0.04897472262382507, -0.02356971614062786, 0.009813130833208561, -0.01152445562183857, 0.02302985079586506, 0.012469315901398659, -0.033777348697185516, 0.02475767396390438, 0.01567482016980648, -0.07599565386772156, 0.012335078790783882, 0.0007458885665982962, -0.045963410288095474, 0.010840041562914848, -0.017810357734560966, 0.05526192858815193, -0.012732161208987236, -0.022239355370402336, -0.016432493925094604, -0.07652892172336578, -0.031294409185647964, -0.015836913138628006, 0.008458415977656841, -0.024224337190389633, 0.01592566817998886, -0.03916832432150841, 0.02145647630095482, 0.03159681335091591, -0.05870502442121506, 0.01956547237932682, -0.011293831281363964, 0.031548693776130676, -0.043085597455501556, 0.024872679263353348, 0.01778949424624443, -0.012663700617849827, 0.015102113597095013, -0.03989145904779434, -0.012006132863461971, 0.050474707037210464, 0.00010569328878773376, -0.054938916116952896, -0.024624811485409737, 0.05317806079983711, -0.007250000722706318, 0.018719878047704697, -0.009038073010742664, 0.038922350853681564, 0.03312678262591362, 0.026766996830701828, -0.001821164507418871, -0.02273266576230526, 0.039767347276210785, 0.06162135675549507, 0.002000233856961131, -0.012757821008563042, -0.07168012857437134, 0.009402906522154808, 0.039740804582834244, -0.00941742118448019, -0.019601184874773026, -0.014849428087472916, -0.008003342896699905, 0.056136276572942734, 0.02221907489001751, 0.002483305288478732, 0.0473877489566803, -0.026351384818553925, -0.00531803397461772, -0.03442453593015671, -0.021366091445088387, 0.04854236915707588, 0.04439198598265648, -0.00561787374317646, -0.02007770538330078, 0.04075899347662926, 0.07771577686071396, 0.020456572994589806, 0.03430484980344772, -0.03590871021151543, 0.01015991996973753, 0.0287697184830904, -0.024502696469426155, 0.02320200577378273, -0.017389018088579178, -0.030604684725403786, -0.005833332892507315, -0.027272725477814674, 0.010389353148639202, 0.03125879541039467, 0.023349212482571602, -0.008637001737952232, 0.014743218198418617, 0.026390060782432556, 0.027801798656582832, -0.041270241141319275, -0.0391937755048275, 0.02668379433453083, -0.02919606678187847, 0.005712405778467655, 0.030052658170461655, 0.023795869201421738, 0.024539852514863014, 0.04799308255314827, 0.0007763203466311097, -0.028924359008669853, 0.08943156898021698, 0.030961940065026283, 0.010077040642499924, -0.011818776838481426, -0.05132533609867096, -0.026295628398656845, -0.015097555704414845, -0.0026345683727413416, -0.026421405375003815, 0.017771009355783463, 0.030620498582720757, -0.008898927830159664, 0.02834591083228588, 0.02298172004520893, 0.04395124688744545, 0.017940085381269455, 0.002456583082675934, 0.01148201897740364, -0.00643605412915349, -0.06302883476018906, 0.0549563392996788, 0.043087296187877655, -0.03770077973604202, -0.02436870150268078, -0.03436562791466713, 0.00794140063226223, 0.031590454280376434, -0.058167628943920135, 0.02499835565686226, 0.032981619238853455, 0.005144985858350992, 0.02321454882621765, -0.02146107144653797, 0.010056319646537304, 0.03323587030172348, 0.01856766827404499, 0.00875933188945055, -0.0019456337904557586, 0.00551199447363615, 0.0023023129906505346, -0.031072823330760002, 0.012754305265843868, 0.02661708928644657, 0.004072650335729122, -0.03306075558066368, 0.00929014291614294, 0.021554667502641678, -0.006688578519970179, 0.033581145107746124, -0.005352836102247238, -0.02693294733762741, 0.0006728509324602783, 0.045048829168081284, 0.03516760841012001, 0.02217918634414673, 0.004909530747681856, -0.00305203627794981, 0.02039080113172531, 0.006331682670861483, 0.046417005360126495, 0.03245021030306816, 0.01309994701296091, 0.025446590036153793, 0.024356219917535782, 0.014199390076100826, 0.016181545332074165, 0.02144198678433895, 0.008860722184181213, -0.020470310002565384, 0.0621657632291317, 0.009778086096048355, 0.050916433334350586, 0.007123411167412996, 0.015879200771450996, 0.023364627733826637, -0.04264114797115326, -0.03796820342540741, -0.0006678092177025974, 0.02248527854681015, 0.02110297791659832, -0.0011130579514428973, 0.06537096947431564, -0.035499803721904755, -0.019090507179498672, 0.044078342616558075, 0.013091335073113441, 0.006126443389803171, 0.027672169730067253, 0.012261397205293179, 0.004557708743959665, 0.03616086021065712, 0.01088921818882227, 0.04605923965573311, -0.025658410042524338, 0.052149660885334015, 0.0008662529289722443, 0.04628288745880127, 0.006732800044119358, 0.0013774228282272816, 0.0011601895093917847, 0.005538010969758034, -0.04069456458091736, 0.029813731089234352, 0.03567223250865936, 0.012735394760966301, -0.024783488363027573, 0.043091580271720886, -0.02874845266342163, 0.0033023918513208628, -0.02286744862794876, 0.009849613532423973, 0.024560419842600822, 0.007856491953134537, 0.010135157965123653, 0.011349217034876347, 0.018575113266706467, -0.022074881941080093, 0.027454271912574768, 0.03935635834932327, 0.02660638839006424, -0.005856766831129789, -0.045740287750959396, 0.015730295330286026, 0.004784146323800087, -0.015228988602757454, 0.006982123013585806, 0.03962656483054161, 0.0005482439300976694, 0.018679138273000717, 0.03371063619852066, 0.022366801276803017, -0.03505278006196022, 0.061091259121894836, 0.010020943358540535, 0.02669101022183895, -0.0013383468613028526, -0.00923717301338911, 0.02918715588748455, -0.037416715174913406, 0.0044976696372032166, -0.02534964121878147, -0.01077920664101839, 0.003517166245728731, 0.05458451434969902, 0.04244360700249672, 0.043606627732515335, -0.006176344584673643, -0.045499708503484726, -0.023946421220898628, -0.027194177731871605, -0.038274310529232025, 0.028770478442311287, 0.012772913090884686, 0.016136279329657555, -0.013700654730200768, -0.01999071054160595, 0.005800907965749502, -0.012457896955311298, -0.0299930851906538, 0.01909974031150341, 0.008916827850043774, -0.0174307432025671, -0.031961631029844284, 0.02868524007499218, 0.027545077726244926, 0.03555978462100029, 0.04647154361009598, 0.016695963218808174, 0.04253675043582916, -0.006292132660746574, -0.018503697589039803, -0.06096509099006653, 0.007367892190814018, -0.06495892256498337, -0.020309748128056526, -0.08043466508388519, -0.0016495356103405356, 0.010522685945034027, 0.021775927394628525, 0.009544098749756813, -0.029513994231820107, -0.039122555404901505, -0.010473920032382011, -0.03999771177768707, 0.011714030057191849, 0.017671775072813034, -0.004311056807637215, 0.024823226034641266, -0.0021748968865722418, 0.0009416553657501936, -0.023681923747062683, -0.01788463443517685, -0.03770367056131363, 0.024199016392230988, 0.011027520522475243, 0.016021616756916046, -0.020910421386361122, -0.013765108771622181, 0.009242314845323563, -0.06101022660732269, -0.013238885439932346, -0.02269013226032257, 0.02117866650223732, -0.04772526025772095, 0.004724958445876837, 0.032064035534858704, 0.024396758526563644, 0.04081312566995621, -0.016531482338905334, -0.024863967671990395, -0.022555330768227577, -0.0013510789722204208, -0.07428082823753357, -0.00619589863345027, -0.009335266426205635, -0.026005033403635025, 0.04450897127389908, -0.012069118209183216, -0.01571572571992874, 0.04759058728814125, -0.008628356270492077, 0.012612031772732735, -0.0015067635104060173, -0.05157062038779259, -0.02379540354013443, 0.0030932000372558832, 0.051803454756736755, -0.04261993616819382, -0.011004721745848656, 0.0724373459815979, 0.004910521674901247, 0.00842858012765646, 0.003491854527965188, 0.004987899214029312, 0.014005742035806179, 0.01718081161379814, -0.02048196829855442, -0.023882415145635605, 0.013339019380509853, 0.038695354014635086, -0.003408808493986726, 0.044502999633550644, 0.04338918998837471 ]
Understanding BigBird's Block Sparse Attention
vasudevgupta
March 31, 2021
big-bird
community, research, nlp
https://huggingface.co/blog/big-bird
Introduction Transformer-based models have shown to be very useful for many NLP tasks. However, a major limitation of transformers-based models is its \(O(n^2)\) time & memory complexity (where \(n\) is sequence length). Hence, it's computationally very expensive to apply transformer-based models on long sequences \(n > 512\). Several recent papers, e.g. Longformer, Performer, Reformer, Clustered attention try to remedy this problem by approximating the full attention matrix. You can checkout 🤗's recent blog post in case you are unfamiliar with these models. BigBird (introduced in paper) is one of such recent models to address this issue. BigBird relies on block sparse attention instead of normal attention (i.e. BERT's attention) and can handle sequences up to a length of 4096 at a much lower computational cost compared to BERT. It has achieved SOTA on various tasks involving very long sequences such as long documents summarization, question-answering with long contexts. BigBird RoBERTa-like model is now available in 🤗Transformers. The goal of this post is to give the reader an in-depth understanding of big bird implementation & ease one's life in using BigBird with 🤗Transformers. But, before going into more depth, it is important to remember that the BigBird's attention is an approximation of BERT's full attention and therefore does not strive to be better than BERT's full attention, but rather to be more efficient. It simply allows to apply transformer-based models to much longer sequences since BERT's quadratic memory requirement quickly becomes unbearable. Simply put, if we would have \(\infty\) compute & \(\infty\) time, BERT's attention would be preferred over block sparse attention (which we are going to discuss in this post). If you wonder why we need more compute when working with longer sequences, this blog post is just right for you! --- Some of the main questions one might have when working with standard BERT-like attention include: * Do all tokens really have to attend to all other tokens? * Why not compute attention only over important tokens? * How to decide what tokens are important? * How to attend to just a few tokens in a very efficient way? --- In this blog post, we will try to answer those questions.
[ 0.010033768601715565, -0.013156578876078129, 0.01743989810347557, -0.020375056192278862, 0.011627355590462685, 0.011796628125011921, 0.03917667269706726, 0.07300496846437454, -0.0007018828182481229, 0.0050796321593225, -0.04451115056872368, 0.0729605183005333, -0.028056375682353973, -0.00261287996545434, -0.007521497551351786, 0.04223715886473656, 0.08238023519515991, -0.030074825510382652, -0.012369710952043533, -0.060780759900808334, 0.011140486225485802, -0.041159141808748245, 0.08184874057769775, -0.010482506826519966, 0.011818522587418556, 0.0022804054897278547, 0.00721748499199748, 0.012303153052926064, -0.06895434856414795, 0.04339296743273735, -0.1332591474056244, 0.015032890252768993, 0.05566795915365219, -0.027485745027661324, -0.02520672231912613, -0.0030075896065682173, -0.09123104065656662, 0.08367667347192764, 0.025827951729297638, -0.06864598393440247, -0.0038746024947613478, -0.014935426414012909, -0.062336843460798264, -0.004887862596660852, -0.04833095520734787, 0.0030754164326936007, -0.16773618757724762, 0.13399137556552887, -0.045500870794057846, -0.0533318817615509, -0.07819043099880219, 0.0960979014635086, -0.010243304073810577, 0.08939366787672043, 0.057215381413698196, -0.01253404002636671, -0.03569614514708519, -0.06460876762866974, 0.017798231914639473, -0.024167058989405632, 0.0014495825162157416, -0.047877926379442215, -0.030345411971211433, 0.00008583230373915285, 0.02873419225215912, 0.03917277231812477, -0.019800735637545586, 0.020458711311221123, -0.08301270008087158, 0.012890785001218319, 0.053338710218667984, -0.03562959283590317, -0.02508380450308323, 0.02033744566142559, -0.038086388260126114, -0.010760468430817127, -0.009272524155676365, 0.04950597882270813, 0.055379267781972885, 0.028950965031981468, -0.020809682086110115, 0.03905189409852028, 0.06542545557022095, 0.01830964721739292, 0.018298285081982613, -0.004075028467923403, 0.06914916634559631, -0.07515589892864227, -0.11088741570711136, 0.021729249507188797, -0.041758839040994644, -0.1598648875951767, -0.01941980980336666, 0.023845385760068893, 0.017494849860668182, -0.040074627846479416, -0.0036459253169596195, 0.01867821253836155, -0.02956986054778099, -0.03143525496125221, -0.01082516647875309, -0.021506033837795258, 0.0678325966000557, -0.042851563543081284, -0.07974960654973984, 0.019678866490721703, 0.0010704252636060119, -0.12482656538486481, -0.010105771012604237, -0.0317167304456234, -0.03197524696588516, 0.01686151511967182, -0.02584071084856987, 0.029806654900312424, -0.06343433260917664, 0.04218772426247597, 0.012093227356672287, 0.019969306886196136, -0.03383231908082962, 0.050914935767650604, -0.029624836519360542, 0.06365328282117844, 0.066407710313797, -0.02831379882991314, 0.003443916328251362, 0.0144285187125206, 0.005139548797160387, -0.04974457621574402, -0.04708828777074814, -0.038004688918590546, 0.04746519774198532, -0.028299624100327492, 0.03639005124568939, 0.011175926774740219, -0.016516556963324547, -0.03418737277388573, -0.013218186795711517, -0.07372955977916718, 0.0025523111689835787, -0.017631055787205696, -0.024808673188090324, 0.016249485313892365, 0.054977405816316605, -0.02866940386593342, 0.07113142311573029, -0.035745833069086075, -0.10997454822063446, 0.051027122884988785, 0.03262856602668762, -0.0023219087161123753, -0.05149292200803757, 0.03073934279382229, -0.04339538514614105, -0.055969540029764175, -0.01834145374596119, 0.027641240507364273, 0.005942306946963072, -0.054078828543424606, -0.08898569643497467, -0.014194712042808533, -0.02731199935078621, 0.016156192868947983, -0.008964549750089645, 0.03644067421555519, 0.027595875784754753, -0.09476275742053986, 0.043015848845243454, 0.03876886144280434, -0.0007102382951416075, 0.024823607876896858, 0.05607959255576134, 0.046202801167964935, 0.06318098306655884, -0.029682686552405357, -0.06193404644727707, 0.03729260340332985, 0.024079766124486923, 0.0169235747307539, -0.010506315156817436, 0.013637171126902103, -0.04024364426732063, 0.019931728020310402, 0.055360276252031326, 0.04117638245224953, 0.03808816894888878, -0.04787640646100044, 0.046903323382139206, -0.0039033214561641216, -0.03659503534436226, -0.004480471834540367, -0.0329950749874115, -0.017792444676160812, 0.10078967362642288, 0.027450181543827057, 0.0015399028779938817, -0.02795981988310814, -0.036937031894922256, 0.10936958342790604, 0.042044226080179214, 0.08078370988368988, 0.018829651176929474, 0.072189100086689, 0.02788006328046322, -0.020569035783410072, -0.034703563898801804, 0.0009320205426774919, -0.03152460232377052, -0.031142305582761765, 0.04639867693185806, -0.016259722411632538, 0.009602697566151619, -0.0700775533914566, 0.006112575065344572, -0.10854917019605637, -0.0493718758225441, -0.06027574837207794, 0.04664217308163643, -0.012989635579288006, 0.0014158738777041435, -0.013862247578799725, 0.12278369814157486, -0.036136288195848465, -0.09025663137435913, -0.07722526788711548, -0.017208553850650787, 0.02903066761791706, 0.05436355620622635, -0.030200254172086716, 0.03914504870772362, 0.007691764738410711, -0.018122103065252304, -0.02346738614141941, 0.015673130750656128, -0.010629504919052124, -0.023569989949464798, -0.027364393696188927, -0.052475456148386, -0.010471370071172714, -0.01897822879254818, 0.03453487530350685, -0.0482083298265934, -0.024132825434207916, 0.03243319317698479, 0.06241738051176071, -0.011989477090537548, 0.01925375498831272, -0.010813870467245579, 0.021477214992046356, -0.00280612800270319, 0.009356469847261906, -0.07037270069122314, 0.0720122754573822, -0.048059459775686264, -0.08658496290445328, 0.04969269782304764, 0.05732008069753647, -0.010171793401241302, -0.006984751205891371, -0.006899784319102764, -0.02927750162780285, 0.005100574344396591, -0.009119872003793716, 0.0033743642270565033, -0.018553664907813072, -0.029949622228741646, -0.03927331045269966, -0.026116089895367622, -0.027179088443517685, 0.04505797103047371, 0.01997748576104641, 0.0025096586905419827, 0.016757560893893242, 0.005568943452090025, 0.0186874121427536, -0.009525948204100132, 0.025917962193489075, 0.02137053944170475, -0.032680902630090714, -0.026292262598872185, -0.011832257732748985, 0.01090964488685131, -0.04069173336029053, 0.03144603595137596, -0.0016714413650333881, 0.040966395288705826, 0.0424724742770195, 0.022489480674266815, -0.02624489553272724, -0.016865292564034462, -0.012246828526258469, 0.01174369640648365, 0.022120069712400436, -0.014188573695719242, -0.035612158477306366, -0.012269306927919388, 0.007345603313297033, 0.002240569796413183, -0.0012366932351142168, -0.02730601280927658, -0.005904404912143946, 0.03402720391750336, 0.017232628539204597, -0.015866542235016823, 0.013940297067165375, 0.008002085611224174, 0.025192324072122574, 0.013684412464499474, 0.04367397725582123, -0.09638502448797226, -0.025053078308701515, -0.034186866134405136, 0.01742030680179596, -0.019836649298667908, -0.042313460260629654, 0.03345770761370659, -0.0002570186916273087, -0.010183624923229218, -0.010212075896561146, 0.03513144329190254, -0.008807426318526268, -0.01419878751039505, 0.013486451469361782, -0.014504052698612213, -0.025211594998836517, 0.008169257082045078, -0.027544762939214706, 0.05249277129769325, 0.03364570066332817, 0.026761051267385483, 0.03529791906476021, -0.0061192745342850685, -0.013146428391337395, -0.047414425760507584, -0.01301973033696413, 0.02090252749621868, 0.022998813539743423, 0.04854775592684746, 0.009495755657553673, -0.02244100719690323, -0.014350645244121552, 0.011796538718044758, 0.04085755720734596, -0.042706448584795, 0.02915618009865284, 0.00400293106213212, 0.01947600394487381, 0.01084684394299984, 0.04092490300536156, 0.028072601184248924, -0.038412999361753464, 0.0002113810769515112, -0.007319229654967785, 0.024658041074872017, -0.0328473299741745, -0.00336106913164258, -0.01810363121330738, 0.02011464722454548, -0.028084995225071907, -0.018154026940464973, -0.0012671140721067786, -0.005978377535939217, 0.027921341359615326, 0.018222413957118988, -0.027339855208992958, -0.009545710869133472, -0.022624680772423744, 0.016187898814678192, -0.01955360360443592, -0.023569313809275627, 0.03568318858742714, 0.014812219887971878, 0.0036310337018221617, -0.027824733406305313, 0.03599768131971359, 0.006319120526313782, 0.013911153189837933, 0.01163722574710846, 0.02945134788751602, 0.010503274388611317, 0.008694371208548546, 0.02233779802918434, 0.005618023686110973, 0.0016643092967569828, 0.028965437784790993, -0.022224334999918938, -0.006327976007014513, 0.05428776890039444, 0.011519541963934898, -0.031935229897499084, -0.033762916922569275, -0.06228262558579445, -0.003241160186007619, 0.01624816097319126, 0.032175492495298386, 0.026598531752824783, 0.021482206881046295, -0.004669494461268187, 0.0005758036277256906, 0.003806215478107333, -0.008914533071219921, 0.001048085861839354, -0.026152143254876137, -0.008763379417359829, -0.024660540744662285, 0.03774087131023407, -0.030742866918444633, 0.03899547457695007, -0.00882826279848814, 0.03834119066596031, -0.04559667408466339, 0.01125276368111372, -0.008710098452866077, 0.014176624827086926, 0.01641617901623249, -0.05521213635802269, 0.007561835926026106, 0.035630736500024796, 0.0016095840837806463, 0.02393907681107521, -0.0230316910892725, -0.01630043238401413, 0.022478528320789337, -0.01219793502241373, 0.004527959506958723, -0.0139530124142766, -0.03169393911957741, -0.03808135911822319, 0.03685084730386734, -0.0328902006149292, 0.012590977363288403, -0.009324523620307446, -0.0051477523520588875, 0.04078005254268646, 0.013822810724377632, 0.020330142229795456, 0.0270043034106493, -0.01574612967669964, 0.024637551978230476, -0.019629770889878273, -0.030439600348472595, 0.0023769065737724304, -0.006141160614788532, 0.03533487394452095, 0.03607102110981941, -0.013308149762451649, 0.029671834781765938, 0.0032775208819657564, -0.0327223464846611, -0.012649725191295147, -0.057824622839689255, 0.04032450169324875, -0.028908494859933853, 0.00281606731005013, 0.0019113023299723864, -0.024468371644616127, -0.018102744594216347, -0.022450322285294533, 0.02096979133784771, 0.04610579088330269, -0.017376255244016647, -0.027662351727485657, 0.018139062449336052, 0.04042581096291542, -0.028619665652513504, 0.01244103442877531, -0.002752426778897643, 0.04105251654982567, 0.012544886209070683, 0.005491835530847311, 0.016877129673957825, -0.06283712387084961, 0.021173693239688873, 0.03345963731408119, 0.023862101137638092, -0.03259718045592308, -0.08653683960437775, 0.013522046618163586, 0.014698714017868042, -0.030745049938559532, -0.03693585470318794, -0.00534180598333478, 0.013736609369516373, 0.01115396898239851, 0.019275063648819923, 0.004069758579134941, 0.0485508069396019, -0.01550319790840149, -0.0030133528634905815, -0.048912446945905685, -0.0052977073937654495, 0.009753577411174774, 0.04152418673038483, 0.03368860483169556, 0.002689775312319398, 0.06269241124391556, 0.0856732651591301, -0.04037908837199211, 0.04434318467974663, 0.009205914102494717, 0.010959195904433727, -0.003072669031098485, -0.029177727177739143, 0.000044071359297959134, -0.021817341446876526, -0.006889988202601671, 0.0020715503487735987, -0.029080623760819435, 0.03472568839788437, 0.025622757151722908, 0.04198019206523895, -0.017359387129545212, 0.011067114770412445, 0.029209645465016365, 0.034528277814388275, -0.00987542886286974, -0.040794745087623596, 0.0023074664641171694, -0.04586010426282883, 0.0005482444539666176, 0.01577668823301792, -0.019838273525238037, 0.028507769107818604, 0.04005027189850807, -0.023086078464984894, 0.00656550470739603, 0.05029349774122238, 0.05103757232427597, 0.06201009824872017, -0.008944024331867695, -0.011479047127068043, -0.005042377859354019, 0.02445356734097004, 0.012688329443335533, -0.026220446452498436, -0.007459040265530348, 0.019207661971449852, 0.011713515035808086, 0.016739496961236, 0.023301150649785995, 0.006703468970954418, -0.0023350815754383802, 0.03477005660533905, -0.011616438627243042, -0.030018962919712067, -0.041326023638248444, 0.022667348384857178, 0.04000922664999962, 0.008151020854711533, 0.020471248775720596, -0.021236341446638107, -0.024236084893345833, 0.0524631068110466, -0.05973994359374046, 0.03709717467427254, 0.07017529755830765, 0.002377940807491541, -0.01327026728540659, -0.008848637342453003, 0.03216366842389107, 0.0006940473685972393, 0.026089873164892197, 0.04101043567061424, -0.00009305255662184209, 0.030713755637407303, 0.002557421335950494, 0.006779497489333153, 0.019871465861797333, 0.04475449398159981, 0.02623196691274643, -0.034722816199064255, 0.02369433268904686, 0.030803009867668152, -0.01197785697877407, 0.03258443996310234, 0.018299169838428497, -0.032422542572021484, 0.018362727016210556, 0.06445679813623428, 0.00006231961015146226, 0.0009435195242986083, -0.0199830774217844, -0.00856921635568142, 0.0001485553802922368, 0.01216801442205906, 0.06307792663574219, 0.030083874240517616, 0.01564681902527809, 0.04740133136510849, 0.051696475595235825, 0.03536747023463249, 0.02753853239119053, 0.02779601886868477, 0.005212103947997093, 0.011261585168540478, 0.02431337535381317, -0.03221594914793968, 0.019572842866182327, 0.000696086382959038, -0.012368325144052505, 0.03145543485879898, -0.009614933282136917, -0.011107622645795345, -0.06110890582203865, -0.0021534557454288006, 0.028797632083296776, 0.005977866239845753, 0.041445694863796234, -0.05670946091413498, 0.007391293067485094, 0.0327082984149456, 0.051808737218379974, 0.0014610416255891323, -0.003600587835535407, 0.016158703714609146, 0.04102364927530289, 0.02363135665655136, 0.006112959235906601, 0.0036033594515174627, -0.03354685381054878, 0.06974580883979797, 0.0009363710996694863, 0.05724696069955826, 0.011366471648216248, -0.04609781876206398, -0.011293400079011917, -0.0022069844417274, -0.008410328067839146, 0.04553501680493355, 0.0183568075299263, -0.024695107713341713, 0.019986052066087723, 0.022155918180942535, -0.02566511742770672, 0.05117904022336006, 0.010661591775715351, -0.008911887183785439, -0.0003429605276323855, -0.03869510442018509, 0.02125757373869419, 0.04487628489732742, -0.013446178287267685, -0.00025827877107076347, 0.034723177552223206, 0.003570963628590107, 0.023776855319738388, 0.054948125034570694, -0.0400799922645092, -0.002469765255227685, -0.006312667857855558, -0.015467541292309761, -0.008868934586644173, 0.022856177762150764, -0.008215581066906452, -0.01978178881108761, 0.05343900993466377, 0.02393277920782566, -0.0023312652483582497, 0.06156260892748833, 0.01273986417800188, 0.014069915749132633, -0.040156442672014236, 0.016550809144973755, 0.01423273142427206, -0.0308760367333889, -0.0033336488995701075, -0.037748079746961594, 0.013291051611304283, -0.016640298068523407, 0.04538993164896965, 0.02587822452187538, 0.02107652649283409, -0.008241167291998863, 0.004068936221301556, -0.02041451260447502, -0.020535307005047798, -0.014523242600262165, -0.022438256070017815, 0.02103503979742527, 0.008583731018006802, -0.017181631177663803, -0.038979679346084595, -0.007433590479195118, -0.03821341693401337, -0.0048213680274784565, 0.02190050110220909, 0.021290548145771027, -0.008230453357100487, -0.04797625169157982, 0.01776244305074215, 0.015124754048883915, 0.002802789444103837, 0.06795737892389297, 0.019872387871146202, 0.049018025398254395, -0.03769299015402794, -0.009985757991671562, -0.011687555350363255, -0.014102938584983349, -0.05333906039595604, -0.021248111501336098, -0.04212165251374245, 0.040577467530965805, 0.017064549028873444, 0.01482433546334505, -0.036472074687480927, 0.03634071722626686, -0.04578201100230217, -0.01817048154771328, -0.03607720136642456, -0.007972617633640766, 0.038048192858695984, -0.026072029024362564, 0.0380714125931263, -0.04254154860973358, -0.03392699733376503, -0.04108642786741257, -0.019958587363362312, -0.013395235873758793, 0.055215023458004, 0.0007246756576932967, 0.008575528860092163, -0.032464027404785156, -0.03896502032876015, -0.009768705815076828, -0.054465409368276596, 0.0045974720269441605, 0.018455607816576958, -0.0006970067042857409, -0.007021782919764519, 0.022099850699305534, 0.005180555395781994, 0.017481504008173943, 0.03012976609170437, 0.0107664093375206, -0.04031427949666977, 0.001958179287612438, -0.0031622466631233692, -0.035956885665655136, -0.04011630266904831, -0.0034797003027051687, 0.002410006010904908, 0.0968502089381218, 0.03640950471162796, 0.0073030609637498856, 0.033963099122047424, -0.006227749399840832, 0.01659601926803589, -0.01570456102490425, -0.020973296836018562, -0.03327486291527748, 0.020445629954338074, 0.012098047882318497, -0.05315336585044861, -0.03412584215402603, 0.07219065725803375, 0.014894450083374977, -0.00947025790810585, -0.04748547077178955, -0.013590415939688683, 0.014482354745268822, -0.013511124067008495, 0.0292934849858284, -0.004965926054865122, 0.013073844835162163, 0.022439466789364815, 0.03160269185900688, 0.03614818677306175, -0.002844981849193573 ]
Understanding BigBird's Block Sparse Attention
vasudevgupta
March 31, 2021
big-bird
community, research, nlp
https://huggingface.co/blog/big-bird
ITC vs ETC The BigBird model can be trained using 2 different strategies: **ITC** & **ETC**. ITC (internal transformer construction) is simply what we discussed above. In ETC (extended transformer construction), some additional tokens are made global such that they will attend to / will be attended by all tokens. ITC requires less compute since very few tokens are global while at the same time the model can capture sufficient global information (also with the help of random attention). On the other hand, ETC can be very helpful for tasks in which we need a lot of global tokens such asquestion-answering for which the entire question should be attended to globally by the context to be able to relate the context correctly to the question. Note: It is shown in the Big Bird paper that in many ETC experiments, the number of random blocks is set to 0. This is reasonable given our discussions above in the graph section. The table below summarizes ITC & ETC: | | ITC | ETC | |----------------------------------------------|---------------------------------------|--------------------------------------| | Attention Matrix with global attention | \( A = \begin{bmatrix} 1 & 1 & 1 & 1 & 1 & 1 & 1 \ 1 & & & & & & 1 \ 1 & & & & & & 1 \ 1 & & & & & & 1 \ 1 & & & & & & 1 \ 1 & & & & & & 1 \ 1 & 1 & 1 & 1 & 1 & 1 & 1 \end{bmatrix} \) | \( B = \begin{bmatrix} 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 \ 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 \ 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 \ 1 & 1 & 1 & & & & & & 1 \ 1 & 1 & 1 & & & & & & 1 \ 1 & 1 & 1 & & & & & & 1 \ 1 & 1 & 1 & & & & & & 1 \ 1 & 1 & 1 & & & & & & 1 \ 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 \end{bmatrix} \) | | global_tokens | 2 x block_size | extra_tokens + 2 x block_size | | random_tokens | num_random_blocks x block_size | num_random_blocks x block_size | | sliding_tokens | 3 x block_size | 3 x block_size |
[ 0.05239800736308098, -0.0250697024166584, -0.01919003762304783, -0.01632346212863922, 0.04202771931886673, -0.03247048705816269, -0.01036172453314066, 0.06400597840547562, 0.004962477367371321, -0.011562821455299854, -0.0771661177277565, 0.011657867580652237, -0.057103481143713, -0.03886817395687103, -0.039522621780633926, 0.05671010538935661, 0.08612459897994995, -0.027895353734493256, -0.05840355530381203, -0.053573042154312134, -0.012016226537525654, 0.01889987848699093, 0.09686436504125595, -0.0002526958123780787, -0.006481708027422428, -0.007780717685818672, -0.04202256351709366, -0.08577070385217667, -0.003719968255609274, 0.06097952648997307, -0.0694369226694107, 0.04747883602976799, -0.01834978349506855, -0.04380094259977341, -0.006232897285372019, 0.0076478575356304646, -0.12360530346632004, 0.04539618268609047, -0.0024182945489883423, -0.12361300736665726, 0.005606306251138449, -0.02719300426542759, -0.060437243431806564, -0.002993982285261154, -0.047769926488399506, -0.010241588577628136, -0.15531645715236664, 0.09293627738952637, -0.030805125832557678, 0.013620416633784771, -0.09699608385562897, 0.06629107892513275, 0.03632105886936188, 0.08466233313083649, 0.07049635797739029, -0.026815716177225113, 0.011758977547287941, -0.02187802828848362, 0.004122269805520773, -0.05961522087454796, 0.1002788320183754, -0.0350060798227787, 0.012144150212407112, 0.059464503079652786, 0.0092421630397439, -0.03905535861849785, 0.022951573133468628, -0.065643809735775, -0.030772170051932335, -0.008354589343070984, -0.029515527188777924, -0.07666948437690735, 0.031147366389632225, 0.06445354223251343, 0.03773558512330055, 0.01340634748339653, 0.014160994440317154, 0.026632266119122505, 0.050383083522319794, 0.010070097632706165, 0.03450201451778412, 0.054560430347919464, 0.08511952310800552, -0.010051370598375797, 0.058775875717401505, 0.017659567296504974, 0.05098867043852806, -0.024376560002565384, -0.05160078778862953, 0.01023739855736494, -0.04376259818673134, -0.11127327382564545, -0.03438935428857803, 0.042603056877851486, -0.03131026029586792, -0.05047634616494179, -0.04647599160671234, -0.053271207958459854, -0.05828222259879112, -0.04274573549628258, -0.006795295048505068, -0.014866582117974758, 0.07616377621889114, -0.06112753599882126, -0.06819295138120651, 0.0550704151391983, -0.057084862142801285, -0.10331104695796967, -0.03024023398756981, 0.019980236887931824, -0.043656621128320694, -0.04128347337245941, -0.019531888887286186, 0.025313889607787132, -0.07524443417787552, 0.033574093133211136, -0.018753191456198692, -0.06618885695934296, -0.00831600558012724, 0.005590425338596106, -0.05034031346440315, 0.07107284665107727, 0.0351003035902977, -0.013328507542610168, -0.013823227025568485, 0.0014487993903458118, 0.027653297409415245, -0.02821473963558674, -0.04040387645363808, -0.04562728479504585, 0.03225928172469139, 0.001103367772884667, 0.0483558289706707, -0.016335390508174896, 0.009993637911975384, -0.04402310773730278, 0.02239151857793331, -0.04275108501315117, 0.08389834314584732, -0.0334087498486042, -0.11884098500013351, -0.029553573578596115, 0.0009151542326435447, -0.06237922981381416, 0.0060867490246891975, 0.01861530914902687, -0.036264315247535706, -0.04670906439423561, 0.007531959563493729, -0.007105264347046614, -0.019995244219899178, 0.003132069483399391, -0.05020517855882645, -0.08864018321037292, -0.013386879116296768, 0.03495234251022339, 0.024093134328722954, -0.02742522582411766, -0.0906471386551857, -0.008464242331683636, -0.020877627655863762, -0.02072223089635372, 0.04884664714336395, -0.015672484412789345, 0.005574455484747887, -0.08245711773633957, 0.018268004059791565, 0.03594141826033592, 0.038921158760786057, 0.04654666781425476, 0.0031429091468453407, -0.04407474026083946, 0.08157949894666672, -0.07092497497797012, 0.019922569394111633, 0.025139344856142998, -0.05431203171610832, 0.010629689320921898, 0.05510484427213669, 0.04998817667365074, -0.059336189180612564, -0.02828022837638855, -0.05182082578539848, 0.05007711425423622, -0.050222333520650864, -0.008707321248948574, 0.05473925918340683, 0.007657090201973915, -0.011551517061889172, 0.0108101861551404, -0.05266324430704117, 0.0033281720243394375, 0.06864457577466965, 0.04272175952792168, 0.04818015918135643, -0.05896075442433357, -0.032454509288072586, 0.04042345657944679, 0.0753713920712471, 0.051834654062986374, 0.027777284383773804, 0.021738337352871895, 0.022606000304222107, 0.004698821343481541, -0.0032067352440208197, 0.006005869247019291, -0.038344528526067734, 0.019369395449757576, -0.02920094132423401, -0.04983627051115036, 0.022230427712202072, -0.06931304931640625, -0.034967899322509766, -0.06580403447151184, -0.05979996174573898, 0.003916543442755938, 0.0069178128615021706, 0.03386467695236206, -0.03662068024277687, -0.028095481917262077, 0.13954396545886993, -0.008586716838181019, 0.004870914854109287, -0.09431198239326477, -0.04750604182481766, -0.007878546603024006, 0.03385670855641365, -0.004951889161020517, 0.04084545001387596, -0.04391947388648987, 0.03328652307391167, -0.016304809600114822, 0.046419814229011536, 0.034406065940856934, -0.008052066899836063, -0.011619810946285725, 0.03049011342227459, -0.05416871979832649, 0.01847226358950138, -0.026379767805337906, -0.10404258221387863, -0.021189523860812187, -0.03363557532429695, 0.044400427490472794, -0.0030802462715655565, 0.018383577466011047, -0.022176401689648628, -0.02079247497022152, -0.03646546229720116, -0.027725456282496452, -0.04356340318918228, 0.03447387367486954, 0.02264316938817501, -0.05376725643873215, 0.08056174218654633, -0.01099918968975544, 0.03439353406429291, -0.022904155775904655, 0.037610962986946106, -0.020292013883590698, -0.011203323490917683, -0.015160909853875637, -0.002527989214286208, -0.05042529106140137, -0.003496880177408457, -0.09014423191547394, 0.002347245579585433, 0.009452540427446365, 0.03654022514820099, 0.0009637323091737926, 0.04169929772615433, -0.03438912704586983, -0.0022767172195017338, 0.0034461396280676126, -0.013985688798129559, 0.0458722859621048, 0.002792569575831294, -0.010730287991464138, -0.026684457436203957, -0.01238014455884695, -0.019768914207816124, -0.034827232360839844, 0.013285554014146328, -0.0038206700701266527, 0.001669477205723524, 0.06053335592150688, 0.004378059878945351, 0.025294000282883644, -0.025260433554649353, -0.05334412679076195, 0.02981998398900032, 0.005869782995432615, 0.007616429589688778, 0.004369842354208231, -0.030499206855893135, 0.005982018541544676, 0.008219762705266476, 0.013995151035487652, -0.004626916721463203, -0.01008334755897522, 0.030708353966474533, 0.012818364426493645, -0.004845027811825275, 0.01816321723163128, 0.0034857711289077997, 0.04737836495041847, 0.018223874270915985, 0.05498031899333, -0.08940053731203079, 0.039515767246484756, -0.020562119781970978, 0.026140009984374046, -0.02283559925854206, -0.023582464084029198, 0.08370795100927353, -0.014340685680508614, 0.029541699215769768, -0.028751496225595474, 0.00861466582864523, -0.026375753805041313, -0.017539700493216515, 0.003409575903788209, -0.023158950731158257, -0.013279695063829422, 0.012316117994487286, -0.028642721474170685, 0.0392625592648983, 0.019053224474191666, 0.04250278323888779, 0.017862306907773018, 0.0042336867190897465, -0.002175228903070092, -0.013125908561050892, 0.020973602309823036, 0.027707351371645927, 0.025616532191634178, 0.07162196934223175, -0.008284270763397217, 0.02062850631773472, -0.01053151860833168, 0.055492326617240906, 0.01629839651286602, -0.052227940410375595, 0.011926393024623394, 0.03669648617506027, -0.005618864670395851, 0.03967447578907013, 0.06749476492404938, -0.021688127890229225, -0.052291691303253174, -0.005686833523213863, -0.009474124759435654, 0.02959800511598587, -0.00237246579490602, 0.022462118417024612, 0.015485040843486786, -0.013518291525542736, -0.051084235310554504, -0.015578610822558403, -0.0267472080886364, 0.014890537597239017, 0.004337637219578028, -0.011270412243902683, -0.039446428418159485, -0.027571329846978188, -0.01976027525961399, 0.015417038463056087, -0.039131347090005875, -0.005735729355365038, 0.0068206144496798515, 0.01140083558857441, -0.009929928928613663, 0.006743321660906076, 0.042329270392656326, -0.0096796415746212, 0.010036105290055275, -0.018886486068367958, 0.0038921209052205086, 0.035254351794719696, -0.006611189339309931, 0.019210387021303177, -0.005348811857402325, -0.005429686047136784, 0.016718197613954544, -0.015229938551783562, 0.004120759665966034, 0.02989412099123001, 0.01935247890651226, -0.021006030961871147, -0.02140684798359871, -0.032477423548698425, -0.0177831519395113, 0.0010196041548624635, -0.0255964957177639, 0.017972733825445175, -0.024829275906085968, 0.0014116819947957993, 0.026054460555315018, 0.008124151267111301, 0.0013276352547109127, 0.01771460846066475, -0.005903464276343584, 0.018291285261511803, 0.0019128648564219475, 0.021372802555561066, 0.003790532471612096, 0.0054555353708565235, -0.007608524989336729, 0.031551603227853775, -0.06301237642765045, -0.002934759948402643, 0.003961628768593073, 0.019714009016752243, 0.004827974829822779, -0.0428926907479763, 0.009299696423113346, 0.03797547519207001, 0.012593193911015987, 0.0021887561306357384, -0.01505487784743309, -0.009616578929126263, 0.0014296985464170575, -0.017491372302174568, 0.012469282373785973, -0.007171606179326773, -0.016695508733391762, -0.0036186266224831343, -0.02783629670739174, -0.004495752975344658, -0.0019568665884435177, -0.005965255666524172, 0.00484427297487855, 0.029876230284571648, -0.017194239422678947, 0.05153565853834152, -0.013018806464970112, -0.003232913790270686, 0.014732426032423973, -0.043853577226400375, 0.006633710581809282, 0.033735133707523346, 0.005473772995173931, -0.018142065033316612, 0.03914962336421013, -0.010019746609032154, 0.06428135931491852, 0.023112289607524872, -0.031052399426698685, -0.016907090321183205, -0.016696518287062645, 0.062489092350006104, -0.0002827308198902756, 0.0003030862717423588, -0.013964897952973843, -0.04061516374349594, -0.01164379995316267, -0.029737619683146477, 0.030849309638142586, 0.036516640335321426, -0.004943882580846548, -0.06927872449159622, 0.06968133896589279, 0.008155507035553455, -0.024294210597872734, 0.05528053268790245, -0.021444523707032204, 0.02456742897629738, 0.0032779891043901443, 0.024446897208690643, 0.004190397914499044, -0.03284788131713867, 0.011562343686819077, 0.07764910906553268, 0.011845729313790798, 0.01770944707095623, -0.02343161031603813, 0.025455964729189873, 0.010102938860654831, 0.01121172122657299, -0.014918225817382336, 0.0017818572232499719, 0.020224526524543762, 0.02402941882610321, 0.021553685888648033, -0.0042654974386096, 0.005729767959564924, 0.020112523809075356, -0.004270927049219608, -0.00169610814191401, 0.019004764035344124, -0.010429222136735916, 0.02995624579489231, 0.014518732205033302, -0.00020929778111167252, 0.0709158331155777, 0.03931110352277756, -0.02029668539762497, 0.04840846359729767, 0.03436660394072533, 0.013343071565032005, 0.047264643013477325, 0.002648714929819107, 0.0304779801517725, -0.021148081868886948, -0.021871443837881088, 0.012252585031092167, -0.04341438412666321, 0.003617763752117753, 0.003923027776181698, 0.0031928173266351223, -0.0014871538151055574, 0.016960998997092247, 0.022936765104532242, 0.022821595892310143, -0.04338887333869934, -0.010214201174676418, 0.05738883092999458, -0.012934327125549316, 0.003156650345772505, -0.0038975817151367664, -0.026020457968115807, 0.02967686392366886, 0.005645584315061569, -0.03386319428682327, -0.044208791106939316, 0.04071490094065666, -0.01663088984787464, 0.041008833795785904, 0.01495741680264473, 0.015088208951056004, -0.007381564937531948, 0.009770511649549007, 0.01906607486307621, -0.03740893304347992, 0.002314049983397126, 0.00411240616813302, 0.020862266421318054, -0.003036287147551775, -0.009907176718115807, 0.025338780134916306, -0.01799940876662731, -0.050854459404945374, 0.041245199739933014, 0.015536139719188213, -0.06224703788757324, 0.010424576699733734, 0.054375458508729935, -0.019611768424510956, -0.013110637664794922, -0.03010743297636509, -0.008908784948289394, 0.009455250576138496, -0.03416525572538376, 0.0057413214817643166, 0.07440154999494553, -0.017416536808013916, -0.008973888121545315, 0.02725706249475479, 0.043436963111162186, -0.011079361662268639, 0.006806279998272657, 0.06697159260511398, -0.0011499034008011222, 0.005555468611419201, 0.0264666099101305, 0.007223979569971561, -0.04126214236021042, 0.016602106392383575, 0.0022516425233334303, -0.014778912998735905, 0.015019417740404606, 0.015821320936083794, 0.009087203070521355, 0.01803286373615265, 0.015940139070153236, 0.0033009611070156097, 0.032227519899606705, 0.057900406420230865, 0.053829167038202286, -0.011863612569868565, 0.05100047215819359, -0.028872590512037277, -0.010485518723726273, 0.030915450304746628, 0.01218879409134388, 0.06598217040300369, 0.03691231086850166, 0.025566289201378822, -0.0035873265005648136, 0.05473950505256653, 0.08038587868213654, 0.02807486802339554, -0.002623434877023101, -0.028971713036298752, -0.003955654799938202, -0.014416618272662163, 0.050756730139255524, -0.007754677906632423, -0.007506590336561203, -0.016612883657217026, 0.012140435166656971, 0.013881667517125607, -0.032265231013298035, 0.019174788147211075, -0.00453637819737196, 0.015599866397678852, 0.06759387254714966, -0.03558812662959099, 0.01519902516156435, -0.0011916462099179626, 0.015127708204090595, 0.01430845633149147, -0.0011037882650271058, 0.019171712920069695, 0.03301218897104263, 0.011370347812771797, 0.024057233706116676, -0.02296893484890461, 0.0000389145607186947, 0.012680917046964169, 0.00704839127138257, 0.0641079992055893, -0.014047019183635712, -0.04610976576805115, 0.019091196358203888, -0.016381993889808655, -0.01363841537386179, 0.005439527798444033, 0.05465921387076378, 0.00471325870603323, 0.017727231606841087, 0.018836215138435364, -0.019697822630405426, 0.010874642990529537, 0.027822230011224747, 0.007601205725222826, -0.024841802194714546, 0.00038777137524448335, 0.014283089898526669, 0.02798444777727127, 0.014997960068285465, -0.013675468042492867, 0.048497896641492844, -0.012947680428624153, 0.03405236080288887, 0.015969552099704742, -0.04504189267754555, 0.005691045429557562, -0.020251814275979996, -0.018943199887871742, 0.022071165964007378, 0.0504101924598217, 0.018737591803073883, 0.002879747189581394, 0.03941742330789566, 0.02949439361691475, -0.02314971759915352, 0.066644586622715, -0.029429253190755844, 0.03458581492304802, -0.014839363284409046, -0.010447755455970764, 0.004161073360592127, -0.04912165552377701, -0.0009733197512105107, -0.005981395952403545, 0.0070835016667842865, -0.0121122682467103, 0.027571121230721474, 0.0562962181866169, 0.028864815831184387, 0.01582852378487587, 0.01575298048555851, 0.002689656103029847, -0.035777583718299866, -0.008331989869475365, -0.0030267066322267056, 0.007968197576701641, -0.03577630594372749, -0.02412988618016243, -0.030270664021372795, 0.009945456869900227, -0.004746661055833101, 0.03075427934527397, 0.053187478333711624, 0.02815810963511467, -0.026917608454823494, 0.04398852959275246, 0.013014866039156914, 0.002372977789491415, 0.05182967334985733, 0.04805530607700348, 0.05247827619314194, -0.015360632911324501, -0.02190018631517887, 0.018868857994675636, -0.0027647288516163826, 0.017963340505957603, -0.03313099592924118, -0.03189527988433838, -0.03399408981204033, 0.06978194415569305, 0.022600919008255005, 0.0052040573209524155, -0.044916339218616486, 0.041185412555933, -0.035120852291584015, 0.02383504994213581, -0.01153504103422165, -0.009418105706572533, 0.04962322115898132, 0.012771806679666042, 0.03350977972149849, -0.013453718274831772, -0.02385719306766987, -0.022649144753813744, -0.01266712136566639, 0.007484701927751303, 0.039611414074897766, 0.015547811053693295, 0.04072146490216255, -0.042897265404462814, -0.01853153109550476, -0.026463957503437996, -0.08284638822078705, -0.016102079302072525, 0.013637077063322067, 0.04125930741429329, -0.0035140994004905224, 0.02742006629705429, 0.014278142713010311, 0.01799098402261734, 0.01313849724829197, -0.0037998752668499947, 0.0011274085845798254, -0.00965289305895567, 0.0010779474396258593, -0.009114553220570087, -0.022713975980877876, 0.010637713596224785, 0.010121777653694153, 0.06031060218811035, -0.005106780678033829, -0.009817064739763737, -0.007509836461395025, -0.01019362360239029, 0.045351944863796234, 0.013467183336615562, -0.04412934184074402, -0.02604171819984913, 0.030871998518705368, 0.03790954872965813, -0.06281401962041855, -0.05503307282924652, 0.036431003361940384, 0.01802056096494198, 0.006172924302518368, -0.0034898375160992146, -0.035535577684640884, 0.026243748143315315, -0.026473846286535263, -0.0030574759002774954, -0.049137916415929794, 0.024091944098472595, 0.040717583149671555, 0.06105511263012886, 0.023160725831985474, 0.022817406803369522 ]
Understanding BigBird's Block Sparse Attention
vasudevgupta
March 31, 2021
big-bird
community, research, nlp
https://huggingface.co/blog/big-bird
End Notes The original implementation of block sparse attention matrix** can be found here. You can find 🤗's version here.
[ 0.06633248180150986, -0.009816858917474747, 0.09041956812143326, -0.020984124392271042, 0.04349232092499733, -0.015458192676305771, -0.025937238708138466, 0.010316534899175167, -0.07550222426652908, -0.0663018673658371, -0.025954466313123703, 0.055812299251556396, -0.015076018869876862, -0.02194882184267044, -0.01714443229138851, 0.07130153477191925, 0.08630336076021194, -0.05752280727028847, 0.006150176282972097, -0.0008550795027986169, 0.017573323100805283, -0.03490866348147392, 0.08543851971626282, -0.07138039916753769, 0.040581509470939636, 0.04569946974515915, 0.01608382910490036, 0.007707705721259117, -0.0827871784567833, 0.019160743802785873, -0.08575401455163956, 0.013021676801145077, 0.061478663235902786, -0.04001752287149429, -0.024103445932269096, -0.002840527566149831, -0.08612723648548126, 0.041148923337459564, 0.008379063569009304, -0.04567369818687439, 0.019439781084656715, -0.04359935224056244, -0.0620197094976902, 0.05609791725873947, -0.10148434340953827, -0.03294013813138008, -0.22209641337394714, 0.09609544277191162, -0.04947997257113457, -0.019967051222920418, -0.053099457174539566, 0.05098297446966171, 0.009740415960550308, 0.04622519388794899, -0.018660331144928932, -0.02207927405834198, 0.018541214987635612, -0.014350714161992073, 0.04715147241950035, -0.03854164108633995, 0.016296764835715294, -0.03854987025260925, 0.010181542485952377, 0.051285091787576675, 0.07459515333175659, 0.011994289234280586, 0.07920850813388824, 0.041428547352552414, -0.05317036807537079, 0.03283504396677017, 0.061716023832559586, -0.013633735477924347, -0.010466069914400578, 0.024275481700897217, -0.01010924857109785, -0.029881631955504417, 0.013543907552957535, 0.04972037300467491, 0.005966693162918091, 0.054962024092674255, 0.02566494792699814, 0.02681337296962738, 0.06490727514028549, 0.04430834576487541, -0.024369696155190468, 0.0056340331211686134, 0.0345945730805397, -0.0468418262898922, -0.0625229924917221, 0.02846456505358219, -0.04974311590194702, -0.07643338292837143, -0.02637004852294922, -0.04194551706314087, 0.005159304942935705, -0.0541829988360405, 0.031764112412929535, 0.0030145596247166395, 0.02837331034243107, 0.04095787554979324, -0.004980405326932669, 0.01804586499929428, 0.032197993248701096, -0.038169343024492264, -0.03248114511370659, 0.021567383781075478, 0.019702134653925896, -0.06577523797750473, -0.04379209131002426, -0.006197771988809109, -0.00965188816189766, 0.03247957304120064, 0.05263258516788483, 0.016596481204032898, -0.054415442049503326, 0.0630258247256279, -0.0005362609517760575, 0.038517169654369354, -0.013671847991645336, 0.08144556730985641, -0.03928217664361, 0.12124080210924149, 0.05377870425581932, -0.003710714867338538, 0.08279698342084885, 0.029260048642754555, 0.013423243537545204, 0.015641408041119576, -0.034335408359766006, -0.00745557714253664, 0.025032784789800644, 0.021279992535710335, 0.07859808206558228, -0.02146761119365692, -0.03885873407125473, -0.06594762206077576, 0.015336434356868267, -0.02661958895623684, 0.0029960833489894867, -0.02820611745119095, -0.045966047793626785, -0.023172598332166672, 0.018337545916438103, 0.03872103989124298, 0.09484616667032242, -0.06684330850839615, -0.05932401120662689, 0.019895220175385475, -0.004352601245045662, 0.029738323763012886, 0.0032252471428364515, 0.026344457641243935, -0.021547649055719376, -0.057657390832901, -0.017544711008667946, -0.022448502480983734, 0.014886952005326748, -0.04595140740275383, -0.12404831498861313, -0.017232129350304604, -0.0013573870528489351, 0.026380907744169235, -0.0115373395383358, 0.00010525263496674597, 0.024661751464009285, -0.03183674439787865, 0.06808412820100784, -0.008155722171068192, 0.009364211931824684, -0.015034444630146027, -0.01151167880743742, -0.00449001882225275, 0.006883607711642981, -0.019223526120185852, -0.08319737017154694, 0.03927754983305931, 0.06884105503559113, 0.10530279576778412, -0.007343863602727652, 0.024103395640850067, -0.021519307047128677, -0.02828407473862171, -0.008497041650116444, 0.049217574298381805, -0.029988523572683334, -0.034132108092308044, 0.10379400849342346, 0.011447684839367867, -0.02089538238942623, 0.008854296989738941, -0.06988818943500519, 0.00151632574852556, 0.02656036615371704, 0.015128367580473423, 0.0837530568242073, -0.056215230375528336, -0.0910014882683754, 0.08341565728187561, 0.0724250003695488, 0.11591033637523651, 0.0671277791261673, -0.022050688043236732, -0.004491826985031366, 0.0304617490619421, -0.013179555535316467, -0.024198366329073906, 0.010885621421039104, -0.003482528030872345, 0.01455530896782875, -0.00869004987180233, -0.014367084950208664, -0.09120909124612808, 0.00777868228033185, -0.049805205315351486, -0.021514184772968292, 0.05504962056875229, 0.028780801221728325, 0.05775308609008789, 0.00027432770002633333, -0.050422657281160355, 0.13731829822063446, 0.005644273944199085, -0.05948936194181442, 0.03874815255403519, -0.06518476456403732, 0.06574927270412445, 0.06120189651846886, -0.039018746465444565, 0.08943039178848267, -0.0060555231757462025, 0.013505390845239162, -0.02641342394053936, 0.016109216958284378, 0.09947079420089722, -0.0010720741702243686, 0.012090448290109634, 0.015918994322419167, 0.01894395239651203, 0.04149607941508293, -0.053183745592832565, -0.03155340626835823, -0.018193915486335754, 0.02208717167377472, -0.009167621843516827, -0.05307454615831375, -0.021773729473352432, 0.032851800322532654, -0.005315706599503756, -0.03926045075058937, 0.03167162835597992, -0.027425525709986687, 0.04181947931647301, 0.019955862313508987, -0.07139424234628677, 0.07932787388563156, 0.020999940112233162, 0.01251756027340889, -0.06785661727190018, 0.03501661494374275, -0.02476000413298607, 0.02086985483765602, -0.0057216971181333065, -0.00967052485793829, -0.03765734285116196, -0.016831720247864723, -0.05485035106539726, 0.025387568399310112, 0.01691499352455139, -0.00274218013510108, 0.033397041261196136, 0.0030253282748162746, -0.005203533917665482, -0.0064518204890191555, -0.010761363431811333, 0.0025833251420408487, -0.026958042755723, 0.009812690317630768, -0.07983382046222687, 0.00258939852938056, -0.027559788897633553, 0.0037557256873697042, -0.002583031775429845, 0.02931847982108593, 0.009929091669619083, 0.04966079816222191, -0.022052101790905, 0.010775137692689896, -0.008914890699088573, -0.010724361054599285, 0.0023860379587858915, -0.033666688948869705, 0.017961081117391586, 0.007507198490202427, -0.035511333495378494, -0.022802632302045822, 0.007210021372884512, -0.006046572234481573, 0.032048482447862625, -0.04116714745759964, 0.00042670813854783773, 0.04515228420495987, 0.039796456694602966, -0.009048553183674812, -0.013422473333775997, -0.041812822222709656, 0.03991512954235077, -0.00934659130871296, 0.04544190689921379, -0.1279388666152954, -0.04854306951165199, 0.013632840476930141, 0.01693498156964779, -0.044875677675008774, -0.016340654343366623, 0.021882224828004837, -0.030062759295105934, 0.02420942857861519, -0.04738547280430794, 0.029039984568953514, -0.015057210810482502, -0.004612716846168041, 0.0049855648539960384, -0.03162289410829544, -0.0007956581539474428, 0.013429553247988224, 0.007491705007851124, 0.025343632325530052, -0.024510711431503296, -0.0000026775041988003068, 0.07142145186662674, 0.008384739980101585, -0.028782786801457405, -0.0014201236190274358, 0.00999035406857729, 0.02925182692706585, 0.03505954518914223, 0.040423206984996796, -0.029991663992404938, -0.03243611380457878, 0.010678152553737164, -0.017167462036013603, -0.011506078764796257, -0.041167572140693665, 0.013175155967473984, 0.007551643531769514, -0.004153480287641287, 0.009352350607514381, 0.02636392042040825, 0.025293707847595215, 0.00693831592798233, 0.04133923351764679, -0.008402886800467968, 0.03834668919444084, 0.006786910817027092, -0.0068796128034591675, 0.004071044269949198, 0.017854129895567894, -0.06445920467376709, -0.019834667444229126, -0.015650121495127678, 0.0010924589587375522, 0.04011165350675583, -0.029559165239334106, -0.012990196235477924, -0.002501159440726042, 0.03586160019040108, 0.036783672869205475, -0.0073740677908062935, -0.01374639943242073, 0.03677824139595032, -0.014757045544683933, 0.0031518128234893084, -0.030944088473916054, 0.049331184476614, 0.004497608169913292, 0.01904500089585781, 0.0003614388406276703, 0.018200445920228958, 0.022725045680999756, -0.01627686806023121, 0.007775479461997747, 0.019119812175631523, -0.013942967168986797, 0.05372233688831329, 0.004457029514014721, 0.00984454806894064, 0.0728512778878212, 0.010491736233234406, -0.026972848922014236, -0.002171511761844158, 0.017287781462073326, -0.01060640998184681, 0.007865400984883308, 0.006419395096600056, 0.015353242866694927, 0.03683605417609215, 0.018699804320931435, -0.0040697320364415646, -0.011558769270777702, -0.025143306702375412, 0.020404383540153503, -0.019780749455094337, 0.010981669649481773, 0.02127479389309883, 0.03315761685371399, -0.018975520506501198, 0.04581202194094658, 0.014147953130304813, 0.0581163726747036, -0.008264916948974133, 0.023205779492855072, -0.012464783154428005, 0.020415330305695534, -0.023621240630745888, -0.050987303256988525, -0.020744867622852325, 0.014603056944906712, -0.004847439005970955, 0.014351918362081051, -0.0480102077126503, 0.005892693065106869, -0.01820867322385311, 0.023157743737101555, -0.02610006555914879, -0.030065365135669708, -0.0390157550573349, -0.01416853815317154, -0.015650033950805664, -0.052901770919561386, 0.019505035132169724, 0.010179074481129646, -0.0017539948457852006, 0.02305983565747738, 0.004504645708948374, -0.0018551882822066545, 0.00924297608435154, -0.016032224521040916, 0.0040143318474292755, -0.013284852728247643, -0.03486380726099014, -0.002051656600087881, 0.04008784517645836, 0.0355244055390358, 0.008539787493646145, -0.026481714099645615, 0.04406547173857689, 0.006089502014219761, -0.08199013769626617, -0.015831178054213524, -0.012647764757275581, 0.03112613409757614, -0.036183055490255356, 0.04113192856311798, 0.014698485843837261, -0.05148610472679138, -0.0008123655570670962, -0.03064698353409767, 0.049352049827575684, 0.06114255264401436, -0.05712812393903732, -0.011675740592181683, 0.019999712705612183, 0.011551517061889172, -0.011539388447999954, 0.011035447008907795, -0.004775300156325102, -0.003533817594870925, 0.036348551511764526, -0.019353579729795456, -0.011986499652266502, -0.06759952753782272, 0.007757039740681648, 0.010107062757015228, -0.027769431471824646, 0.02508142963051796, -0.04503617808222771, 0.01666351966559887, 0.01818746328353882, -0.016400763764977455, -0.03282283619046211, 0.009206454269587994, -0.006775739137083292, 0.02902790904045105, 0.018575584515929222, 0.009032243862748146, -0.009134043008089066, 0.005200720392167568, 0.018980305641889572, -0.01914890483021736, 0.0026662047021090984, 0.01989107020199299, 0.042434677481651306, 0.006373640149831772, -0.0006937840371392667, -0.0010914106387645006, 0.05006585270166397, -0.017762215808033943, 0.046597208827733994, 0.013459921814501286, 0.0004814982821699232, 0.0057474710047245026, -0.008815962821245193, 0.01874622516334057, -0.02489358000457287, -0.027746621519327164, -0.026444390416145325, -0.02278144843876362, 0.019810816273093224, 0.0057188295759260654, 0.03546011447906494, -0.03479477018117905, 0.021435996517539024, 0.034040361642837524, 0.02833523042500019, 0.0050115096382796764, -0.023446207866072655, -0.04566064104437828, -0.03331559896469116, -0.02887064591050148, -0.006275034509599209, -0.0575903058052063, -0.0320979580283165, 0.0106485765427351, -0.032363928854465485, -0.03304889425635338, -0.01037069782614708, 0.01292671263217926, 0.0216604582965374, 0.021204590797424316, -0.014450387097895145, -0.05556609109044075, 0.04121561348438263, 0.0029860706999897957, -0.014581914991140366, -0.008092192932963371, 0.0035160144325345755, -0.006262431386858225, 0.0792105421423912, 0.048541340976953506, -0.011382399126887321, 0.032397523522377014, 0.01532598864287138, -0.002938975812867284, -0.020563559606671333, -0.05564481019973755, 0.040992770344018936, 0.01640588603913784, 0.0013770024525001645, -0.012798380106687546, -0.008507294580340385, -0.021964356303215027, -0.01477104239165783, -0.05607355758547783, 0.017266517505049706, 0.08328850567340851, -0.02208050526678562, 0.03719509765505791, 0.004254764411598444, 0.04672922194004059, -0.0024062783923000097, 0.016967667266726494, 0.002969668246805668, 0.0006772828637622297, 0.04015307500958443, -0.004597633145749569, -0.0440751276910305, 0.004436967894434929, 0.0025041953194886446, 0.0042081126011908054, 0.0032295307610183954, 0.01305107120424509, -0.012831434607505798, -0.04273860529065132, 0.034585438668727875, 0.010225002653896809, -0.021085267886519432, -0.007325281854718924, 0.007401762995868921, 0.013269850052893162, 0.023534048348665237, 0.007061873562633991, 0.0021454908419400454, -0.019073262810707092, -0.050251226872205734, 0.008524826727807522, 0.04644092544913292, 0.0005429226439446211, 0.04379111900925636, -0.019803760573267937, 0.021741434931755066, 0.012565736658871174, 0.01173727959394455, 0.0063284020870924, -0.003739073174074292, 0.016896327957510948, -0.030317040160298347, 0.042262621223926544, 0.002435043454170227, -0.012606462463736534, 0.010285931639373302, -0.0062147341668605804, -0.0023118655662983656, -0.07074136286973953, 0.04376712068915367, 0.013698263093829155, -0.00006295858474913985, 0.025868980213999748, -0.05088450387120247, 0.01925036869943142, 0.0251298937946558, 0.03196793794631958, -0.01022089459002018, -0.01664799451828003, 0.016285384073853493, 0.010911764577031136, -0.03483206033706665, -0.039712801575660706, -0.030163222923874855, 0.0019053940195590258, 0.06952560693025589, 0.009402002207934856, 0.03859856352210045, -0.011116494424641132, -0.06403720378875732, 0.027957715094089508, 0.002213360508903861, -0.004779154900461435, 0.0035448940470814705, 0.02554510161280632, -0.00958552397787571, 0.01896875724196434, -0.03104119934141636, -0.019273508340120316, -0.024676762521266937, 0.03578149899840355, 0.0074500455521047115, -0.01339961588382721, -0.000882798049133271, -0.001846190309152007, 0.025543423369526863, -0.002912753028795123, 0.017243245616555214, -0.0015686985570937395, 0.008474844507873058, 0.04032786935567856, 0.020894445478916168, -0.04103478416800499, -0.015464061871170998, -0.00728979567065835, 0.03255553916096687, -0.031003285199403763, 0.004273007158190012, -0.011846721172332764, -0.011756553314626217, 0.025216879323124886, -0.007224132306873798, -0.020975712686777115, 0.03105662763118744, 0.060428593307733536, 0.020653897896409035, -0.036054827272892, 0.05610807240009308, -0.03619121015071869, -0.010680748149752617, -0.018283070996403694, -0.0248448234051466, -0.006042703986167908, -0.015707625076174736, 0.02212710678577423, 0.021007537841796875, -0.006365349981933832, -0.014768038876354694, -0.022737085819244385, -0.003883914789184928, -0.0318259634077549, -0.018530819565057755, -0.0257695484906435, 0.044776465743780136, -0.0012941776076331735, -0.0007720233406871557, -0.009532870724797249, -0.01198556274175644, -0.018963603302836418, 0.018901625648140907, -0.0052344296127557755, -0.012719015590846539, -0.003318669507279992, -0.050720371305942535, 0.07975172996520996, 0.01204447727650404, 0.02279597334563732, 0.0494820661842823, 0.03919631615281105, 0.02008741907775402, -0.04563158378005028, -0.007595126051455736, 0.029955504462122917, -0.022042011842131615, -0.0338541679084301, -0.03587919846177101, -0.025826001539826393, -0.02155826985836029, 0.04274975508451462, 0.01185608934611082, -0.03815823048353195, 0.020397167652845383, -0.011800378561019897, -0.012677312828600407, -0.0784669741988182, 0.021859537810087204, 0.039415135979652405, 0.00032503652619197965, 0.0246341023594141, -0.017119543626904488, -0.03179245814681053, -0.040343739092350006, 0.013382011093199253, 0.004979920107871294, -0.006127017550170422, -0.010336281731724739, 0.019329287111759186, -0.04323075711727142, -0.004387438762933016, -0.02513454481959343, -0.04504833370447159, -0.005157897248864174, 0.017738670110702515, -0.005321723874658346, -0.035983577370643616, -0.008060122840106487, -0.025722144171595573, 0.019095540046691895, 0.018174679949879646, 0.04773035645484924, 0.003258688375353813, 0.003519226796925068, 0.01257751788944006, -0.03225426375865936, -0.0057563320733606815, 0.01742425560951233, 0.03902992978692055, 0.037171803414821625, 0.02277999371290207, -0.014488982036709785, 0.004333188757300377, -0.009686225093901157, 0.011220116168260574, 0.009823991917073727, 0.0009507783688604832, -0.03566054254770279, -0.0162329263985157, -0.0076570105738937855, -0.02615358494222164, -0.07526817917823792, 0.026834731921553612, 0.03518566116690636, -0.012677313759922981, 0.01288356352597475, -0.008510679937899113, 0.010099527426064014, 0.012719566933810711, 0.032445862889289856, 0.013358027674257755, 0.0648551657795906, -0.002833481878042221, 0.022519700229167938, 0.016697125509381294, 0.011912181973457336 ]
Understanding BigBird's Block Sparse Attention
vasudevgupta
March 31, 2021
big-bird
community, research, nlp
https://huggingface.co/blog/big-bird
Global Attention For global attention, each query is simply attending to all the other tokens in the sequence & is attended by every other token. Let's assumeVasudev(1st token) &them(last token) to be global (in the above figure). You can see that these tokens are directly connected to all other tokens (blue boxes). ```python # pseudo code Q -> Query martix (seq_length, head_dim) K -> Key matrix (seq_length, head_dim) # 1st & last token attends all other tokens Q[0] x [K[0], K[1], K[2], ......, K[n-1]] Q[n-1] x [K[0], K[1], K[2], ......, K[n-1]] # 1st & last token getting attended by all other tokens K[0] x [Q[0], Q[1], Q[2], ......, Q[n-1]] K[n-1] x [Q[0], Q[1], Q[2], ......, Q[n-1]] ```
[ 0.020973173901438713, 0.05557103455066681, 0.047210581600666046, -0.06420885026454926, 0.003844182938337326, -0.006512954365462065, 0.01570190116763115, 0.06897250562906265, -0.025860745459794998, -0.011437270790338516, -0.07030728459358215, 0.035265449434518814, -0.017564136534929276, 0.0805758610367775, 0.033754121512174606, 0.07634608447551727, 0.05889900028705597, -0.024275274947285652, -0.023842625319957733, -0.02547444775700569, 0.03912101686000824, -0.022827669978141785, 0.09779112786054611, -0.04010597616434097, -0.04985511675477028, 0.03859558701515198, -0.0689489096403122, -0.012432701885700226, -0.05612901970744133, -0.0017895565833896399, -0.07403687387704849, 0.01745721511542797, 0.06667457520961761, -0.007489718962460756, 0.046671394258737564, -0.03788338601589203, -0.10141384601593018, 0.07377339899539948, 0.08898001909255981, -0.05106828361749649, -0.02803187444806099, -0.03856855630874634, -0.07670749723911285, 0.05026960372924805, -0.0721454992890358, -0.007521445397287607, -0.13831651210784912, 0.10311868786811829, -0.048334091901779175, -0.00527047598734498, -0.08650986850261688, 0.002750296611338854, 0.02249325066804886, 0.07304452359676361, -0.018976446241140366, -0.0013556134654209018, -0.028507908806204796, -0.028543362393975258, -0.020267007872462273, -0.010844461619853973, 0.027216169983148575, -0.004201433155685663, 0.03968806937336922, 0.06847453862428665, 0.05891561135649681, 0.05700939521193504, 0.024667920544743538, 0.0224692951887846, -0.027798760682344437, 0.02716952934861183, 0.018960801884531975, 0.0042644403874874115, -0.0028961473144590855, 0.06404900550842285, -0.0123099060729146, -0.003586818231269717, -0.013960334472358227, 0.017773449420928955, -0.006781651172786951, -0.006010375451296568, 0.05668934807181358, 0.017652489244937897, 0.07932630181312561, 0.021968556568026543, 0.020301321521401405, 0.013315689750015736, 0.048493701964616776, -0.06460504978895187, -0.06162387132644653, -0.004525233060121536, -0.07493838667869568, -0.11512856930494308, 0.013522256165742874, 0.018104486167430878, -0.03961345925927162, -0.04358385130763054, 0.024778559803962708, -0.014034844934940338, -0.05073791742324829, -0.01351519301533699, -0.016271568834781647, -0.03996366634964943, 0.09025971591472626, -0.05202952399849892, -0.07365121692419052, 0.04085332900285721, -0.010134010575711727, -0.04536969214677811, -0.08225100487470627, -0.037745147943496704, -0.024562040343880653, 0.047786299139261246, 0.021930057555437088, 0.002846810268238187, 0.03828200697898865, 0.048849787563085556, -0.05431361868977547, 0.025023072957992554, -0.027689523994922638, 0.004193882457911968, -0.014791972935199738, 0.026681311428546906, 0.1131688728928566, -0.006850381847470999, 0.036517433822155, -0.032241132110357285, 0.0024689454585313797, 0.0031754060182720423, -0.026792218908667564, -0.0670262947678566, 0.007159990258514881, 0.023413339629769325, 0.05243656411767006, 0.032669585198163986, -0.033621497452259064, -0.05193007364869118, 0.005504043307155371, 0.012701175175607204, 0.046127498149871826, -0.06229493394494057, -0.020794427022337914, -0.04478808864951134, -0.0698648989200592, -0.010153889656066895, 0.08277875930070877, 0.038258522748947144, -0.10126569867134094, 0.004835047293454409, 0.020958444103598595, 0.039399757981300354, 0.033467523753643036, 0.017534814774990082, -0.004815611522644758, -0.05804330110549927, 0.03191560134291649, 0.009268668480217457, 0.02027185447514057, -0.018710704520344734, -0.09053383022546768, -0.016703298315405846, 0.0031937623862177134, 0.03500402718782425, -0.045669347047805786, -0.010097634978592396, -0.0022717160172760487, 0.002682030200958252, 0.047211967408657074, 0.010392623022198677, 0.00028617808129638433, 0.01909179985523224, -0.02770274132490158, 0.02170991711318493, -0.016978127881884575, -0.0716828852891922, -0.0776284784078598, 0.0007280913996510208, 0.0014027381548658013, 0.06497503072023392, 0.020756395533680916, 0.027076197788119316, -0.051507219672203064, -0.04882003739476204, -0.034507934004068375, -0.004900092724710703, -0.017636658623814583, -0.014599804766476154, 0.032458797097206116, -0.0029190597124397755, 0.01472472120076418, 0.0047835796140134335, -0.06101527437567711, 0.04916731268167496, -0.003180039580911398, -0.04816499724984169, 0.010151831433176994, -0.058220818638801575, 0.006912616081535816, 0.005642795003950596, 0.034334778785705566, 0.04455725848674774, -0.00005370907092583366, 0.031814150512218475, 0.016243671998381615, -0.013279377482831478, -0.03527271747589111, 0.010415636003017426, -0.03578700125217438, -0.12395168095827103, 0.050526443868875504, 0.026751361787319183, -0.022934727370738983, -0.09139129519462585, -0.09921543300151825, -0.05753558874130249, -0.0459262914955616, 0.02535424567759037, 0.0018911233637481928, 0.03236018866300583, -0.008391517214477062, 0.02452731691300869, 0.17019787430763245, 0.006658849772065878, 0.06112130731344223, -0.008828697726130486, -0.03789374977350235, 0.018368273973464966, 0.05499888211488724, 0.01678154058754444, 0.04369870945811272, -0.0671500638127327, 0.0005050310865044594, -0.00957382284104824, 0.04708399996161461, 0.007346551865339279, -0.06712371855974197, -0.019026974216103554, -0.008876083418726921, 0.06906256824731827, -0.0010630280012264848, -0.03746644780039787, 0.010145610198378563, -0.008718718774616718, 0.01592790149152279, 0.0066373590379953384, 0.007353024557232857, 0.00008939756662584841, 0.06562080979347229, -0.0719887837767601, -0.06444517523050308, -0.04346422478556633, -0.0035173783544451, 0.052306342869997025, -0.04573827236890793, -0.03386550769209862, 0.07255567610263824, -0.00008329719275934622, 0.019050439819693565, -0.02866220474243164, 0.00402218708768487, -0.0019514347659423947, 0.038439713418483734, 0.02368679642677307, 0.0013330234214663506, -0.04649180546402931, -0.04657689854502678, -0.02520374022424221, 0.03347039222717285, 0.01241901982575655, 0.02014780603349209, 0.009030915796756744, 0.04407906159758568, -0.0022376165725290775, -0.0136019978672266, 0.0029430824797600508, -0.011494306847453117, 0.008006472140550613, 0.015351277776062489, -0.04767042398452759, -0.017798155546188354, -0.04543052613735199, 0.03534742072224617, -0.03580845519900322, 0.04460804536938667, 0.0014966462040320039, -0.02842945046722889, -0.004518538247793913, 0.03782074898481369, 0.010698503814637661, -0.0004369322268757969, -0.01602959632873535, -0.0121776033192873, 0.035441894084215164, -0.006969241891056299, 0.022506821900606155, -0.004433704074472189, -0.021763283759355545, -0.0461711660027504, 0.024676308035850525, -0.009869873523712158, 0.02604716643691063, -0.022815749049186707, 0.045271195471286774, -0.0488605760037899, -0.007248990703374147, -0.023190105333924294, -0.0018109697848558426, -0.04248649626970291, 0.060323189944028854, -0.08754059672355652, -0.013752399012446404, -0.037109579890966415, 0.015069014392793179, 0.019536133855581284, -0.03602128475904465, 0.058649126440286636, 0.04085255414247513, -0.015055147930979729, -0.03898947685956955, -0.006728989537805319, -0.003222011961042881, -0.04678938165307045, -0.004206100478768349, 0.009262886829674244, 0.03878667950630188, 0.018481263890862465, 0.02999008446931839, 0.027613060548901558, 0.014302310533821583, 0.05607553571462631, 0.009882018901407719, -0.04465643689036369, -0.06456652283668518, 0.003682507434859872, -0.00144323636777699, 0.040674980729818344, 0.010653126984834671, 0.024806028231978416, -0.019690247252583504, -0.017702676355838776, -0.0031026441138237715, 0.04645980894565582, -0.01606566272675991, -0.08102396875619888, 0.004408970940858126, 0.01861402951180935, -0.04734543710947037, 0.002528891433030367, 0.031104998663067818, 0.016437828540802002, 0.009122157469391823, 0.009546052664518356, -0.012549258768558502, 0.05761399865150452, -0.034758683294057846, -0.006959549617022276, -0.05788588151335716, 0.020123135298490524, -0.06621360033750534, -0.03487280011177063, -0.04863949120044708, -0.03692297637462616, 0.0236513689160347, -0.04542511701583862, -0.040084000676870346, -0.0012714889599010348, 0.011361949145793915, 0.031130358576774597, -0.024030018597841263, -0.0025096458848565817, -0.008227686397731304, 0.01946583203971386, -0.0017350211273878813, -0.025500664487481117, 0.025841226801276207, 0.006789057515561581, 0.0018286674749106169, -0.03925393149256706, 0.02801073156297207, 0.007724029943346977, 0.005541096907109022, -0.022788360714912415, 0.0039262850768864155, -0.0281336959451437, 0.01376347616314888, -0.016187723726034164, 0.017091920599341393, 0.09356412291526794, 0.010900829918682575, -0.010351055301725864, 0.023286117240786552, -0.021477021276950836, -0.027283791452646255, -0.002694713417440653, -0.016352327540516853, 0.01742621697485447, -0.010564682073891163, -0.017408834770321846, -0.020396370440721512, -0.03339000046253204, -0.026670094579458237, 0.027203012257814407, 0.015438543632626534, -0.008945786394178867, 0.023174889385700226, 0.02926063910126686, 0.05724530294537544, 0.02381991408765316, -0.025801094248890877, 0.0542149692773819, -0.007422789931297302, -0.00839934777468443, 0.02003806084394455, -0.02158086746931076, -0.0011678937589749694, -0.026263318955898285, -0.023725435137748718, 0.023860270157456398, -0.010343077592551708, -0.02245405688881874, -0.003635009750723839, 0.019193438813090324, -0.03739876672625542, -0.0018944103503599763, -0.004183202516287565, -0.0011763586662709713, -0.012675303965806961, -0.01327850203961134, -0.04108741879463196, -0.008339906111359596, 0.0615532323718071, 0.015773966908454895, 0.00963994488120079, 0.03314413130283356, -0.02004900388419628, 0.04709325358271599, -0.03007405251264572, 0.002826677169650793, -0.018469082191586494, -0.0123185645788908, -0.026708997786045074, 0.015278118662536144, -0.003565840423107147, 0.016851525753736496, 0.015451447106897831, 0.021452520042657852, -0.008038359694182873, 0.03622287139296532, -0.06689796596765518, -0.05385817214846611, -0.03816892206668854, 0.03108271397650242, 0.0053290147334337234, -0.05335211753845215, -0.004884628113359213, -0.023475661873817444, 0.003948109690099955, -0.03195863589644432, 0.041289206594228745, 0.06318122893571854, -0.0017163471784442663, -0.007390921004116535, -0.014013937674462795, 0.02621522545814514, -0.016807356849312782, 0.038193266838788986, 0.00853799469769001, 0.017186837270855904, 0.03650765120983124, 0.0053087943233549595, -0.044225726276636124, -0.01952698640525341, 0.008566794916987419, -0.0037419223226606846, -0.014793294481933117, 0.00311938114464283, -0.06076272577047348, 0.03426513820886612, 0.008732518181204796, 0.002535056322813034, 0.025828717276453972, -0.02506082132458687, 0.000024039782147156075, 0.02409074269235134, 0.003482045838609338, 0.0016904395306482911, 0.027467994019389153, 0.019165007397532463, -0.021131308749318123, -0.016467304900288582, 0.030928753316402435, 0.01349115464836359, 0.008858499117195606, 0.023438390344381332, 0.012059984728693962, 0.026954632252454758, 0.018548790365457535, -0.049106404185295105, 0.044020459055900574, 0.02396611124277115, 0.0007253666408360004, -0.008694309741258621, -0.01310056447982788, -0.01955888234078884, 0.0034291839692741632, -0.021787825971841812, 0.050842829048633575, -0.049391262233257294, -0.02431657910346985, 0.015925168991088867, 0.030275875702500343, 0.01077656727284193, -0.0038781603798270226, 0.03975340723991394, 0.018685925751924515, -0.03334556519985199, -0.05194564536213875, -0.01160650234669447, -0.038108453154563904, 0.016326315701007843, 0.01638856902718544, -0.060586072504520416, 0.01463632844388485, 0.02744411863386631, -0.03608983755111694, -0.013854756951332092, 0.04449424520134926, -0.01337858010083437, 0.048958584666252136, 0.027579132467508316, -0.005052376072853804, 0.0019720301497727633, 0.024799566715955734, 0.018821896985173225, 0.03741629049181938, -0.030097991228103638, 0.048957474529743195, 0.03751906752586365, 0.025427721440792084, 0.03995348885655403, -0.029000137001276016, 0.022633934393525124, 0.012269900180399418, 0.00028307968750596046, 0.023041998967528343, -0.04978974536061287, 0.03992258384823799, 0.015703614801168442, 0.0204654261469841, 0.018386127427220345, 0.013406633399426937, -0.034250352531671524, 0.014790591783821583, -0.0474352203309536, 0.013926289044320583, 0.07083138078451157, -0.031015511602163315, 0.022237000986933708, -0.01826832816004753, 0.02644626796245575, -0.0021320111118257046, 0.0010181816760450602, 0.04150153324007988, 0.005846791435033083, 0.0226533655077219, 0.0293765626847744, -0.03051333874464035, 0.023061824962496758, 0.03107171133160591, -0.024503381922841072, -0.01619310863316059, 0.019032631069421768, -0.009174274280667305, -0.02318180911242962, 0.038860250264406204, 0.02944563515484333, -0.0007487926632165909, -0.00254079420119524, 0.05286118760704994, 0.021366054192185402, -0.019411778077483177, -0.04444302245974541, -0.01642586663365364, -0.01104576513171196, -0.008710872381925583, -0.0014134527882561088, 0.045867450535297394, 0.02463967725634575, 0.027117205783724785, -0.037110112607479095, 0.01958341710269451, 0.028399325907230377, 0.07083528488874435, 0.028302554041147232, 0.006486058700829744, -0.008648072369396687, 0.056797970086336136, 0.0268047284334898, 0.001692799967713654, -0.0021665298845618963, 0.03316538780927658, -0.00661363685503602, 0.017367515712976456, 0.007141927722841501, 0.05549319088459015, 0.02070901170372963, 0.03208167478442192, 0.04171895608305931, -0.03575209528207779, 0.047001779079437256, 0.0432925708591938, 0.04759713634848595, 0.012938028201460838, -0.030747080221772194, -0.00023459338990505785, 0.0049620033241808414, 0.02032620832324028, 0.04323534667491913, -0.03755207732319832, 0.004724688362330198, 0.03611539304256439, 0.05656284838914871, 0.027791060507297516, 0.01007822249084711, -0.039841268211603165, -0.012742919847369194, -0.04240129142999649, -0.06705018132925034, 0.033838339149951935, 0.05424094200134277, -0.013074550777673721, 0.02354898490011692, 0.0037163759116083384, -0.043057575821876526, 0.004419853910803795, -0.013621321879327297, -0.02589821256697178, -0.008602362126111984, -0.010718700475990772, -0.003995816223323345, 0.026850666850805283, 0.0220810417085886, -0.035158783197402954, -0.02846919558942318, 0.01403792668133974, 0.014869127422571182, 0.05228765308856964, -0.021005447953939438, -0.0722484141588211, -0.02990906499326229, 0.009759089909493923, -0.040775563567876816, -0.01663167215883732, -0.02940736524760723, 0.011015599593520164, 0.043076351284980774, 0.00300188222900033, -0.021338146179914474, 0.08486568927764893, 0.005163232330232859, 0.03964183107018471, -0.05902225896716118, 0.0028852394316345453, 0.005269078072160482, 0.025420984253287315, 0.0359913595020771, -0.013892012648284435, -0.012152010574936867, -0.0292772576212883, 0.0044919634237885475, 0.021452318876981735, -0.013989811763167381, 0.03221801295876503, 0.028701435774564743, 0.02097378298640251, -0.03772837296128273, -0.05345494672656059, -0.015863409265875816, 0.005167646799236536, 0.00596580421552062, -0.015942957252264023, -0.026162223890423775, -0.012639048509299755, -0.010038587264716625, -0.00575272599235177, 0.015665113925933838, 0.02325274795293808, -0.012313648127019405, 0.003341091563925147, 0.016365041956305504, 0.047901321202516556, 0.04418923333287239, 0.05036389082670212, -0.020272569730877876, 0.050092555582523346, -0.01554618589580059, 0.04319339245557785, -0.00023358363250736147, 0.002765464363619685, -0.031022651121020317, 0.05830959603190422, -0.00618218956515193, -0.0041768113151192665, 0.021643323823809624, -0.0007392084808088839, -0.04256661608815193, 0.04949859157204628, -0.031332019716501236, -0.02271207422018051, -0.01791495457291603, -0.05864755064249039, 0.06572658568620682, -0.0014464111300185323, 0.053860053420066833, 0.07027807086706161, -0.008441487327218056, -0.04210273548960686, 0.021267004311084747, 0.003750756848603487, 0.001098977285437286, -0.001900581526570022, -0.0010479685151949525, -0.027399413287639618, -0.011319051496684551, -0.07055370509624481, -0.0605437234044075, 0.05991537868976593, 0.010443036444485188, 0.01937221549451351, -0.010644827969372272, 0.0038968785665929317, 0.007386535871773958, 0.006037348415702581, 0.0017306641675531864, 0.019051942974328995, 0.025297192856669426, 0.00874368753284216, 0.017011817544698715, -0.004177214577794075, -0.0020816174801439047, 0.014356615021824837, 0.02716444432735443, 0.03006906434893608, 0.032540690153837204, -0.032437048852443695, 0.0154498890042305, 0.032133761793375015, -0.0075843012891709805, -0.020577268674969673, -0.012925693765282631, -0.02406253293156624, -0.010154985822737217, 0.00012463520397432148, -0.0287712961435318, -0.029584068804979324, -0.00782975647598505, -0.011844921857118607, -0.029810337349772453, 0.032348502427339554, 0.011742746457457542, -0.01182575523853302, -0.03172163665294647, 0.014158053323626518, -0.004584880545735359, 0.05389534309506416, 0.03906239941716194, 0.014910674653947353, 0.04493667185306549, 0.05192392319440842 ]
Understanding BigBird's Block Sparse Attention
vasudevgupta
March 31, 2021
big-bird
community, research, nlp
https://huggingface.co/blog/big-bird
Understanding the need for global, sliding, random keys with Graphs First, let's get a better understanding ofglobal,sliding&randomattention using graphs and try to understand how the combination of these three attention mechanisms yields a very good approximation of standardBert-likeattention. <img src="assets/18_big_bird/global.png" width=250 height=250> <img src="assets/18_big_bird/sliding.png" width=250 height=250> <img src="assets/18_big_bird/random.png" width=250 height=250> <br> *The above figure showsglobal(left),sliding(middle) &random(right) connections respectively as a graph. Each node corresponds to a token and each line represents an attention score. If no connection is made between 2 tokens, then an attention score is assumed to 0.* ![](assets/18_big_bird/graph.gif) <img src="assets/18_big_bird/full.png" width=230 height=230> **BigBird block sparse attention** is a combination of sliding, global & random connections (total 10 connections) as shown ingifin left. While a graph of **normal attention** (right) will have all 15 connections (note: total 6 nodes are present). You can simply think of normal attention as all the tokens attending globally \\( {}^1 \\). **Normal attention:** Model can transfer information from one token to another token directly in a single layer since each token is queried over every other token and is attended by every other token. Let's consider an example similar to what is shown in the above figures. If the model needs to associate *'going'* with *'now'*, it can simply do that in a single layer since there is a direct connection joining both the tokens. **Block sparse attention:** If the model needs to share information between two nodes (or tokens), information will have to travel across various other nodes in the path for some of the tokens; since all the nodes are not directly connected in a single layer. *Eg.*, assuming model needs to associate *'going'* with *'now'*, then if only sliding attention is present the flow of information among those 2 tokens, is defined by the path:going -> am -> i -> now(i.e. it will have to travel over 2 other tokens). Hence, we may need multiple layers to capture the entire information of the sequence. Normal attention can capture this in a single layer. In an extreme case, this could mean that as many layers as input tokens are needed. If, however, we introduce some global tokens information can travel via the path:going -> i -> now(which is shorter). If we in addition introduce random connections it can travel via:going -> am -> now. With the help of random connections & global connections, information can travel very rapidly (with just a few layers) from one token to the next. In case, we have many global tokens, then we may not need random connections since there will be multiple short paths through which information can travel. This is the idea behind keepingnum_random_tokens = 0when working with a variant of BigBird, called ETC (more on this in later sections). \\( {}^1 \\) In these graphics, we are assuming that the attention matrix is symmetric **i.e.** \\(\mathbf{A}_{ij} = \mathbf{A}_{ji}\\) since in a graph if some token **A** attends **B**, then **B** will also attend **A**. You can see from the figure of the attention matrix shown in the next section that this assumption holds for most tokens in BigBird | Attention Type |global_tokens|sliding_tokens|random_tokens| |-----------------|-------------------|------------------|------------------------------------| |original_full|n| 0 | 0 | |block_sparse| 2 xblock_size| 3 xblock_size|num_random_blocksxblock_size| *original_fullrepresentsBERT's attention whileblock_sparserepresentsBigBird's attention. Wondering what theblock_sizeis? We will cover that in later sections. For now, consider it to be 1 for simplicity*
[ 0.008437985554337502, -0.015900522470474243, 0.10124151408672333, 0.020014239475131035, 0.05715246498584747, -0.04307343438267708, -0.001244041952304542, 0.09183631837368011, -0.037686388939619064, -0.044861771166324615, -0.038705192506313324, -0.01797783374786377, -0.02260647714138031, 0.017389319837093353, -0.004077595192939043, 0.041221942752599716, 0.07411786168813705, -0.01631087437272072, 0.02941008284687996, 0.004434133879840374, 0.0036671017296612263, -0.09202760457992554, 0.07712794095277786, -0.07912108302116394, -0.04038728028535843, -0.013917098753154278, -0.05530425161123276, 0.02400941215455532, -0.05255942791700363, 0.04723804444074631, -0.0870392769575119, 0.0988573357462883, 0.03870739787817001, -0.026255367323756218, 0.04460066929459572, -0.05542295053601265, -0.06767687946557999, 0.03435905650258064, 0.05303095653653145, -0.0741867944598198, 0.055675867944955826, -0.0058339377865195274, -0.03409124165773392, 0.025430848821997643, -0.0199604369699955, -0.07524473965167999, -0.12920089066028595, 0.09140249341726303, -0.024051766842603683, -0.003478832310065627, -0.08278074860572815, 0.0046013277024030685, 0.05073193833231926, 0.031120987609028816, 0.011322582140564919, -0.01868000626564026, 0.030252188444137573, -0.039749450981616974, 0.038668349385261536, -0.046378910541534424, 0.07700073719024658, -0.045058540999889374, -0.03409549593925476, 0.0964205339550972, 0.017853261902928352, 0.009105217643082142, 0.07967719435691833, 0.059744421392679214, -0.00018989905947819352, 0.0189234409481287, 0.09278027713298798, -0.007172366138547659, 0.0018659867346286774, -0.03020191378891468, -0.0009442176669836044, 0.03754996135830879, -0.000005523223080672324, 0.035838548094034195, -0.00496187899261713, -0.03052208572626114, 0.07373955845832825, 0.044379331171512604, 0.007169385440647602, 0.015094110742211342, 0.022302845492959023, 0.03455810248851776, 0.03173019737005234, -0.03447204828262329, -0.0853540226817131, -0.0037139221094548702, -0.06277207285165787, -0.15841303765773773, -0.026796195656061172, -0.034196652472019196, 0.008589421398937702, -0.05140317603945732, -0.009390108287334442, -0.01287275180220604, 0.0024295980110764503, -0.01697031781077385, -0.01611524447798729, -0.010935279540717602, 0.03800399973988533, -0.043951258063316345, -0.027560818940401077, 0.07027126848697662, -0.06121731922030449, -0.02384813129901886, -0.050872936844825745, 0.01035977527499199, -0.02734350599348545, 0.028512436896562576, 0.009936325252056122, -0.0025821712333709, -0.00012090525706298649, -0.028323134407401085, -0.037375371903181076, -0.004395569674670696, -0.04311484843492508, 0.028598224744200706, -0.011675766669213772, 0.037430357187986374, 0.10861925035715103, 0.0017948568565770984, 0.02010624296963215, -0.0215058084577322, 0.008321830071508884, 0.034372325986623764, -0.05537426471710205, -0.019966229796409607, 0.0973501205444336, 0.02447194792330265, 0.03327328711748123, -0.008757165633141994, 0.02657499723136425, -0.08035299926996231, -0.018591007217764854, 0.04149169847369194, 0.050319381058216095, -0.08344346284866333, 0.033896319568157196, -0.060866691172122955, -0.008686164394021034, -0.012339574284851551, 0.025876209139823914, -0.024994604289531708, -0.0762871652841568, -0.03515056520700455, 0.03688110411167145, 0.045062530785799026, 0.0352289043366909, 0.0929391086101532, -0.02861650101840496, -0.04739970713853836, -0.02771887741982937, 0.07805557548999786, -0.013585539534687996, -0.04930649697780609, -0.028426753357052803, 0.016295084729790688, -0.009430121630430222, 0.03454957529902458, -0.059962570667266846, 0.03054739348590374, 0.006896371487528086, 0.016200345009565353, 0.03628149628639221, 0.01599537953734398, 0.014117456041276455, 0.0347408726811409, 0.004108057823032141, 0.04859766364097595, -0.039869822561740875, -0.027921414002776146, -0.032993629574775696, 0.07212577015161514, -0.029971573501825333, 0.002877511316910386, 0.03765721246600151, -0.007367377169430256, -0.09221851825714111, -0.0751226544380188, 0.034881096333265305, 0.006510728504508734, -0.008829007856547832, -0.09364848583936691, 0.06897550821304321, -0.00460547162219882, -0.062333475798368454, 0.001244411221705377, -0.062093157321214676, 0.03662519156932831, 0.038305409252643585, -0.09576420485973358, -0.005964545998722315, -0.04430977627635002, -0.012542915530502796, 0.019260317087173462, 0.0884498879313469, 0.05317525193095207, 0.0007004778599366546, -0.02597307413816452, -0.0424773283302784, -0.029491182416677475, -0.030338982120156288, 0.013470008969306946, -0.03971480578184128, -0.04204327240586281, 0.032245174050331116, -0.026807516813278198, -0.046910397708415985, -0.06046095862984657, 0.007935350760817528, 0.008456626906991005, -0.03264949470758438, -0.020826736465096474, 0.04144321382045746, 0.01212674006819725, 0.013750013895332813, 0.024490484967827797, 0.12892310321331024, 0.04302838444709778, -0.06391333788633347, 0.0375107079744339, -0.009691009297966957, 0.012140181846916676, 0.036273326724767685, 0.017292335629463196, 0.09681354463100433, -0.02342201955616474, 0.061056654900312424, 0.01452961191534996, 0.04591013863682747, -0.007944547571241856, -0.007804614957422018, 0.011436081491410732, -0.03207821398973465, 0.03477371484041214, 0.006853809114545584, -0.06137453392148018, -0.026625415310263634, -0.0308212973177433, -0.010698007419705391, 0.03688124939799309, -0.0037943206261843443, 0.01534964144229889, 0.09479936212301254, -0.027116455137729645, -0.05907442420721054, -0.010376231744885445, -0.09179259836673737, 0.04127104952931404, -0.01373352948576212, -0.033125340938568115, -0.02242993377149105, 0.016640981659293175, 0.03180530667304993, -0.05706852674484253, -0.0017428662395104766, -0.014930644072592258, 0.04240523651242256, -0.025037728250026703, -0.014281383715569973, -0.006703106686472893, -0.03864939883351326, -0.058595210313797, 0.006974932737648487, -0.023788368329405785, 0.007181831635534763, 0.028040822595357895, 0.0020336490124464035, -0.013211081735789776, -0.007690298371016979, -0.024759182706475258, -0.02270982414484024, -0.03906785324215889, 0.011380720883607864, -0.00708143413066864, 0.019449660554528236, -0.01988929510116577, -0.0033683411311358213, -0.0007079190691001713, 0.058830562978982925, -0.015734877437353134, 0.01668376848101616, -0.0026823885273188353, -0.003659716108813882, -0.004597153980284929, 0.0039448789320886135, -0.02812446653842926, 0.027371011674404144, 0.033318474888801575, -0.017078151926398277, 0.013476950116455555, -0.042465317994356155, 0.0497572086751461, -0.025747789070010185, -0.0036832510959357023, -0.014859502203762531, -0.0015633594011887908, -0.011194933205842972, -0.027926236391067505, -0.004687377717345953, -0.03679833188652992, -0.02759561501443386, 0.03097597323358059, -0.04694795981049538, 0.07290343940258026, -0.09275691211223602, 0.005768583156168461, 0.002836311934515834, -0.009928883984684944, -0.0337589867413044, -0.04460012540221214, 0.07687129080295563, 0.0062141078524291515, -0.0038895700126886368, -0.010281222872436047, -0.006023030262440443, -0.021390236914157867, -0.016612760722637177, 0.018563510850071907, 0.050787925720214844, 0.05404168367385864, 0.0157553069293499, 0.014189387671649456, 0.04173445329070091, -0.028308860957622528, -0.010864685289561749, 0.005371130537241697, -0.001930341706611216, -0.03282943367958069, 0.017140498384833336, -0.025429347530007362, 0.04158003255724907, -0.01201105210930109, 0.04204756021499634, 0.005611432250589132, -0.05540177971124649, -0.021264847368001938, 0.026274818927049637, 0.04414016753435135, -0.04509088397026062, 0.04909581318497658, 0.037129901349544525, -0.04411643370985985, 0.009854434058070183, 0.040607765316963196, -0.0056693293154239655, -0.01105240173637867, 0.006363025866448879, -0.013204027898609638, 0.07226864248514175, 0.01288621500134468, 0.0035314408596605062, -0.027914144098758698, -0.0006617731996811926, -0.05238991603255272, -0.025569848716259003, -0.010376364924013615, 0.04820994287729263, -0.00634715985506773, -0.01567479409277439, -0.012243983335793018, -0.013514278456568718, -0.006587708368897438, -0.014638751745223999, -0.02857367880642414, 0.00937772635370493, 0.008498121984302998, -0.012919045053422451, 0.00956906657665968, 0.006657674442976713, 0.05684521794319153, 0.020790070295333862, 0.04709630832076073, -0.009432107210159302, 0.0007267989567480981, -0.02746545523405075, -0.007666050456464291, 0.012705019675195217, 0.002934723859652877, -0.014406582340598106, -0.0027709316927939653, -0.008016424253582954, 0.009564131498336792, 0.051854997873306274, -0.0025519728660583496, 0.018326113000512123, -0.03416312113404274, 0.00017562297580298036, -0.0012890276266261935, -0.006146369967609644, 0.002174520865082741, 0.027659540995955467, -0.051320720463991165, 0.014147212728857994, -0.03253583982586861, 0.004490269348025322, -0.0036774908658117056, 0.003540770849213004, -0.005983387585729361, -0.028912067413330078, 0.05224744230508804, 0.03320395573973656, 0.006475725211203098, 0.023738572373986244, -0.009882284328341484, 0.09322652965784073, -0.04520346224308014, 0.04940789192914963, 0.020774811506271362, -0.00993975717574358, 0.02575058676302433, -0.016945181414484978, -0.00010356854909332469, 0.02283491939306259, 0.0002824629773385823, -0.016438590362668037, -0.0009523850167170167, 0.01627860963344574, 0.0030557725112885237, 0.023753324523568153, 0.0016382975736632943, -0.03750024363398552, -0.022127607837319374, 0.01135222427546978, -0.01359781064093113, -0.042747050523757935, 0.022934183478355408, 0.016755307093262672, 0.025854919105768204, 0.004924085456877947, 0.02162056416273117, -0.003366795601323247, -0.007313484791666269, -0.002429486718028784, 0.00838829018175602, 0.0011995494132861495, -0.026382338255643845, -0.0036596055142581463, 0.01411154493689537, 0.007372348569333553, 0.007443150971084833, -0.0293237566947937, 0.041240394115448, -0.02140468917787075, -0.09325094521045685, 0.001811565482057631, 0.00628433795645833, 0.03217202425003052, -0.01098951417952776, -0.007896248251199722, 0.01776079647243023, -0.008294022642076015, 0.020173972472548485, -0.02119414508342743, 0.041750967502593994, 0.022224055603146553, -0.05161069333553314, 0.0068534258753061295, 0.0560409352183342, 0.05214143171906471, -0.0358724370598793, 0.009179776534438133, -0.04838181659579277, -0.05380359664559364, 0.03491726517677307, -0.003912132699042559, -0.0229108277708292, -0.06506836414337158, 0.04988103732466698, -0.043864209204912186, -0.039898134768009186, 0.009340796619653702, -0.06668511033058167, 0.005101487506181002, -0.001488412730395794, 0.0012985297944396734, -0.008328424766659737, -0.03573562204837799, -0.01585809327661991, -0.00909644365310669, -0.007882838137447834, -0.052403949201107025, 0.07404967397451401, 0.06823331862688065, -0.037715282291173935, -0.03584699705243111, 0.0066906241700053215, 0.04554499313235283, 0.042526669800281525, 0.04391056299209595, -0.012007913552224636, 0.023998549208045006, 0.04414794594049454, -0.009351598098874092, 0.04183945432305336, 0.009843669831752777, 0.02168930321931839, 0.009657059796154499, -0.007274797186255455, 0.04749073460698128, -0.004566380754113197, 0.0031599325593560934, 0.008216590620577335, -0.01709161512553692, 0.002852578880265355, 0.007152634672820568, 0.02245781384408474, -0.014659851789474487, -0.024204131215810776, -0.016648532822728157, 0.05000042915344238, -0.03184865787625313, 0.022188391536474228, -0.02085210382938385, -0.04104599729180336, -0.0014638188295066357, -0.024233443662524223, -0.04373113811016083, -0.014180031605064869, 0.0387100987136364, -0.05520232766866684, -0.03508903831243515, 0.009335610084235668, -0.002998565323650837, 0.08625540882349014, 0.016785699874162674, -0.00046069142990745604, -0.047708846628665924, 0.03342141956090927, 0.009525339119136333, -0.02540629915893078, -0.011389713734388351, 0.022952435538172722, -0.019882386550307274, 0.04076096788048744, 0.020451948046684265, -0.01481676660478115, 0.024519799277186394, 0.028430692851543427, -0.014791600406169891, 0.016463279724121094, -0.0138855604454875, 0.01632162369787693, 0.061651479452848434, 0.004789176397025585, 0.00893766712397337, -0.0006689885631203651, -0.06210632249712944, 0.007274013943970203, -0.03185643255710602, 0.0008896515937522054, 0.08386428654193878, 0.006878566928207874, 0.03812270611524582, -0.034565020352602005, -0.02210044674575329, -0.016219036653637886, -0.00046555823064409196, 0.0021281966473907232, 0.019681887701153755, 0.032108623534440994, 0.0014337834436446428, -0.004999294877052307, 0.03176359087228775, 0.05129840970039368, -0.03190239146351814, -0.039041053503751755, -0.00233925087377429, 0.05157287046313286, 0.019404688850045204, -0.0015146516961976886, 0.018122078850865364, -0.027744045481085777, -0.018677616491913795, 0.0064128609374165535, 0.03641105815768242, 0.02475753240287304, -0.016568511724472046, 0.007093184161931276, -0.01363362930715084, 0.007151564117521048, -0.005537860561162233, -0.011057631112635136, 0.012862401083111763, 0.005108539015054703, 0.0005768301198258996, 0.00676279840990901, 0.04433930292725563, 0.024479633197188377, 0.02786976844072342, -0.0010452495189383626, -0.01956121250987053, 0.011794384568929672, 0.020259685814380646, -0.03596917912364006, 0.015121560543775558, 0.01634695567190647, -0.0033554807305336, -0.014026449993252754, -0.04779510572552681, 0.05261758342385292, 0.02015853114426136, 0.022278297692537308, 0.019881002604961395, 0.003374560736119747, -0.02243121899664402, 0.006379587110131979, 0.008816643618047237, 0.024974238127470016, 0.005101494491100311, 0.005619289353489876, 0.010133471339941025, -0.009877773001790047, 0.025207754224538803, 0.026044074445962906, -0.028009505942463875, 0.041683826595544815, -0.020458564162254333, 0.03896274045109749, 0.022878853604197502, 0.005482562817633152, 0.015981148928403854, -0.019214170053601265, -0.03963556885719299, -0.013100069016218185, 0.009112964384257793, 0.016448669135570526, -0.01449844054877758, -0.012544665485620499, -0.03998100757598877, 0.01354319229722023, 0.02468930184841156, -0.013160312548279762, -0.037442442029714584, 0.02349783666431904, 0.0026835990138351917, 0.0344357006251812, 0.036565784364938736, 0.008806190453469753, -0.02040688693523407, 0.03189804032444954, 0.032506104558706284, 0.012785134837031364, -0.03301078453660011, -0.06951427459716797, -0.06463419646024704, -0.001966097392141819, -0.005591371096670628, 0.04388812929391861, 0.010476994328200817, -0.057416949421167374, 0.07913126051425934, 0.0044226511381566525, -0.0074075148440897465, 0.0568155013024807, -0.02866695635020733, 0.022704318165779114, -0.05309693142771721, 0.02407524734735489, 0.029705917462706566, -0.016887115314602852, 0.009041275829076767, 0.020405258983373642, -0.004679520148783922, -0.04015300050377846, 0.036880578845739365, 0.018724173307418823, 0.016262277960777283, 0.02353617735207081, -0.018828045576810837, -0.02034057304263115, -0.0425078347325325, 0.027654176577925682, 0.0056403400376439095, 0.013600475154817104, 0.005492537748068571, -0.06209078058600426, -0.049939144402742386, 0.026067757979035378, -0.030983177945017815, 0.02889404632151127, 0.006290464662015438, 0.03735054284334183, 0.004732418339699507, 0.038498811423778534, -0.0027254640590399504, 0.04652978479862213, 0.06562208384275436, 0.04229658097028732, -0.011607615277171135, -0.008407418616116047, 0.010904976166784763, 0.03761358559131622, 0.03600829839706421, 0.05320966988801956, -0.03523029386997223, 0.000444507080828771, -0.010866551660001278, 0.019660012796521187, 0.012466629967093468, -0.030592747032642365, -0.0406334213912487, -0.005455004516988993, -0.009637231938540936, -0.0020891197491437197, -0.04761746898293495, -0.015277590602636337, 0.01932300627231598, -0.011740574613213539, 0.024050060659646988, -0.007175045553594828, -0.03581150248646736, -0.020052729174494743, -0.019251806661486626, 0.03250783309340477, 0.015804968774318695, -0.01533600129187107, 0.025606947019696236, 0.03886440768837929, -0.025232501327991486, -0.0280553437769413, -0.06204259395599365, 0.01591249741613865, 0.057367920875549316, -0.006300029810518026, -0.004973552655428648, 0.008084828965365887, 0.025995196774601936, -0.027401192113757133, 0.01965966634452343, 0.03844418376684189, 0.01732778176665306, 0.01356126181781292, 0.019852150231599808, -0.014479581266641617, -0.033792030066251755, -0.05046270042657852, 0.01965177059173584, 0.04428752511739731, -0.009995435364544392, -0.01837281696498394, -0.008069432340562344, 0.04243132472038269, 0.03735519200563431, 0.01699988543987274, -0.009564009495079517, -0.04552718251943588, 0.031006062403321266, -0.022498590871691704, -0.025176923722028732, -0.03634996339678764, 0.03175422549247742, 0.019877813756465912, 0.003887173952534795, -0.016119563952088356, 0.05496276542544365, -0.008034402504563332, -0.011878025718033314, 0.0008105164160951972, -0.030587704852223396, 0.036425311118364334, 0.022603198885917664, 0.02895587496459484, -0.02239025942981243, 0.02924741432070732 ]
Understanding BigBird's Block Sparse Attention
vasudevgupta
March 31, 2021
big-bird
community, research, nlp
https://huggingface.co/blog/big-bird
Time & Memory complexity | Attention Type | Sequence length | Time & Memory Complexity | |-----------------|-----------------|--------------------------| |original_full| 512 |T| | | 1024 | 4 xT| | | 4096 | 64 xT| |block_sparse| 1024 | 2 xT| | | 4096 | 8 xT| *Comparison of time & space complexity of BERT attention and BigBird block sparse attention.* <details> <summary>Expand this snippet in case you wanna see the calculations</summary> ```md BigBird time complexity = O(w x n + r x n + g x n) BERT time complexity = O(n^2) Assumptions: w = 3 x 64 r = 3 x 64 g = 2 x 64 When seqlen = 512 => **time complexity in BERT = 512^2** When seqlen = 1024 => time complexity in BERT = (2 x 512)^2 => **time complexity in BERT = 4 x 512^2** => time complexity in BigBird = (8 x 64) x (2 x 512) => **time complexity in BigBird = 2 x 512^2** When seqlen = 4096 => time complexity in BERT = (8 x 512)^2 => **time complexity in BERT = 64 x 512^2** => compute in BigBird = (8 x 64) x (8 x 512) => compute in BigBird = 8 x (512 x 512) => **time complexity in BigBird = 8 x 512^2** ``` </details>
[ 0.008654831908643246, 0.03576230630278587, 0.031219137832522392, -0.011010023765265942, -0.007851898670196533, 0.0007530862931162119, 0.07405700534582138, 0.046659890562295914, -0.024161329492926598, -0.006486258935183287, -0.021426333114504814, 0.03515570983290672, -0.0535346195101738, -0.02594125084578991, 0.002828394528478384, 0.05661623179912567, 0.0891454666852951, -0.0537269189953804, -0.012994433753192425, -0.04675697162747383, 0.01658969186246395, -0.008474924601614475, 0.09088615328073502, -0.06125330924987793, 0.056300558149814606, 0.04395254701375961, -0.049320172518491745, -0.02723841182887554, -0.02333356812596321, 0.028229769319295883, -0.11596984416246414, 0.005848181899636984, 0.07015268504619598, -0.07337543368339539, -0.013293647207319736, -0.035418253391981125, -0.06192246451973915, 0.08394785225391388, 0.026070574298501015, -0.03225481137633324, -0.03384670615196228, -0.029045796021819115, -0.0988977700471878, -0.008215153589844704, -0.08641541004180908, 0.0078116231597959995, -0.09520767629146576, 0.06969401985406876, -0.0003438286075834185, -0.011286761611700058, -0.021466441452503204, 0.06791575253009796, -0.007720263674855232, 0.08722618967294693, 0.0014461243990808725, 0.014871789142489433, -0.02724676951766014, 0.012480545789003372, -0.00047082826495170593, -0.06415025144815445, 0.0025797896087169647, -0.07849771529436111, 0.02260947972536087, 0.04976830631494522, 0.05115963891148567, 0.02693260833621025, 0.07023412734270096, 0.0013953535817563534, -0.04801185056567192, 0.07429706305265427, 0.04968273267149925, -0.023808585479855537, 0.004948738031089306, 0.03456144034862518, -0.07057329267263412, -0.0293441042304039, 0.00911867804825306, 0.03852340206503868, -0.00200934917666018, 0.008604037575423717, 0.04582074657082558, 0.07027111202478409, 0.021358292549848557, 0.02617873065173626, 0.00005240893369773403, -0.026450688019394875, 0.049960698932409286, -0.03822111710906029, -0.09615983814001083, 0.05702640488743782, -0.037040140479803085, -0.14278075098991394, -0.04485691711306572, 0.021733012050390244, -0.04624742642045021, -0.053662318736314774, -0.03809289634227753, 0.02901560813188553, -0.02799195796251297, 0.01361916121095419, -0.0195565577596426, -0.015930866822600365, 0.08755549788475037, -0.0031478425953537226, -0.08900364488363266, 0.024030396714806557, -0.036381494253873825, -0.141463965177536, -0.009710467420518398, -0.07546356320381165, -0.015865683555603027, 0.03008057177066803, -0.009555748663842678, 0.0025103758089244366, -0.09164690971374512, 0.027312234044075012, 0.00432294188067317, 0.031167401000857353, -0.027509119361639023, 0.06067059561610222, -0.07804234325885773, 0.03223302215337753, 0.0762753039598465, -0.054067231714725494, 0.01717795804142952, -0.01323792990297079, -0.02061350829899311, 0.014388046227395535, 0.014184072613716125, -0.057085659354925156, 0.049099113792181015, -0.037459973245859146, 0.057693012058734894, -0.02034437656402588, -0.0055191051214933395, -0.011442459188401699, -0.011988911777734756, -0.08199688792228699, -0.03404094651341438, -0.06670980900526047, -0.04913805425167084, 0.059361424297094345, 0.001156622776761651, 0.026589946821331978, 0.08978399634361267, -0.04856858402490616, -0.086622454226017, 0.034358665347099304, 0.03267332911491394, 0.00687020318582654, -0.032985616475343704, 0.010388601571321487, -0.06759223341941833, -0.02740228734910488, -0.002162809483706951, 0.026917312294244766, -0.027788691222667694, -0.06805675476789474, -0.08735842257738113, 0.01379863265901804, -0.0019316616235300899, 0.044633571058511734, -0.010236159898340702, 0.01101427711546421, 0.02673475630581379, -0.07901056855916977, 0.06499051302671432, 0.05558321252465248, -0.023457825183868408, 0.021408408880233765, -0.010804813355207443, 0.04274024814367294, 0.09037663787603378, 0.03102896176278591, -0.07997549325227737, 0.04437550902366638, 0.02113497443497181, 0.027120962738990784, -0.020563624799251556, -0.03316861391067505, -0.011543713510036469, -0.02900579757988453, 0.01979903131723404, 0.004144271370023489, 0.027387524023652077, -0.019139841198921204, 0.07049724459648132, -0.011366006918251514, -0.022622713819146156, -0.02062845788896084, 0.007095895241945982, -0.043513692915439606, 0.009753040038049221, -0.010155677795410156, 0.02227826416492462, -0.017985107377171516, -0.03812947869300842, 0.03660910204052925, 0.06136554107069969, 0.08682196587324142, -0.020178843289613724, 0.014780727215111256, 0.034217070788145065, 0.041440293192863464, -0.02988874912261963, 0.021166324615478516, -0.038978222757577896, -0.05888752266764641, 0.0328008271753788, -0.03747415542602539, 0.03386104479432106, -0.06938699632883072, -0.03570414334535599, -0.08493249118328094, -0.025321554392576218, -0.00783379003405571, 0.052633918821811676, 0.02127945050597191, 0.06500368565320969, -0.05181244760751724, 0.14592960476875305, -0.017132239416241646, -0.08804456889629364, -0.004604101646691561, -0.02476796880364418, -0.041333604604005814, 0.04421934485435486, -0.02535358816385269, 0.023117249831557274, -0.004512278363108635, 0.0002218844456365332, 0.0002821772650349885, 0.019048910588026047, 0.00032878806814551353, -0.017311247065663338, -0.03831516206264496, -0.07319587469100952, 0.03863232582807541, -0.02274876832962036, -0.06833821535110474, -0.07740282267332077, -0.009337205439805984, 0.062382329255342484, 0.02300107479095459, -0.018245624378323555, -0.005665066186338663, -0.009061278775334358, -0.017757488414645195, 0.0032669114880263805, 0.035780783742666245, -0.012857875786721706, 0.061261165887117386, 0.021428074687719345, -0.04160281643271446, 0.02031273953616619, 0.015175731852650642, 0.014599655754864216, -0.03381267562508583, 0.015056214295327663, -0.0030888926703482866, 0.007285568863153458, -0.024109410122036934, 0.016533032059669495, 0.012323515489697456, -0.03477390855550766, -0.0411662720143795, -0.031294140964746475, -0.021290283650159836, 0.027951953932642937, 0.02918175235390663, -0.009534425102174282, 0.040817633271217346, 0.004374563694000244, 0.013402947224676609, 0.008683523163199425, -0.021249357610940933, 0.016902564093470573, -0.05249997600913048, -0.02799283340573311, -0.0014291906263679266, -0.019570859149098396, -0.010590245947241783, 0.042866408824920654, -0.008746948093175888, 0.026785708963871002, 0.032646212726831436, 0.013300461694598198, -0.01957542449235916, 0.014798566699028015, 0.012358390726149082, -0.03374198451638222, 0.022667262703180313, -0.013547400943934917, -0.0069461390376091, -0.003368488047271967, 0.05699440464377403, -0.03244383633136749, 0.01572950929403305, -0.021757103502750397, -0.005278223194181919, 0.04580576345324516, 0.03489566221833229, -0.016529271379113197, -0.010981188155710697, -0.030483556911349297, 0.020407335832715034, 0.03635939955711365, 0.022304102778434753, -0.09034733474254608, 0.004264012444764376, -0.01926354691386223, 0.005087196361273527, -0.03889048844575882, 0.006252738181501627, -0.008945409208536148, 0.010562079027295113, 0.018560877069830894, 0.01593317650258541, 0.028485221788287163, -0.041836366057395935, 0.003681108821183443, 0.051193468272686005, 0.03565432131290436, 0.0022200073581188917, 0.02014065906405449, 0.010057815350592136, 0.021519003435969353, -0.0025705054868012667, 0.03927018120884895, 0.011252556927502155, -0.003128897165879607, -0.0374685563147068, -0.03286456689238548, -0.02278974838554859, 0.011517291888594627, 0.02425331436097622, 0.03932671621441841, 0.007341304328292608, -0.02930622734129429, -0.01039101928472519, -0.008321830071508884, -0.0003712949401233345, -0.04408372566103935, 0.03750882297754288, -0.013211032375693321, 0.005756452213972807, 0.01721063069999218, 0.028262682259082794, 0.0439523421227932, -0.054575271904468536, 0.008328169584274292, -0.009306743741035461, 0.028258193284273148, -0.030648939311504364, -0.010602044872939587, -0.03392614424228668, 0.005667547229677439, -0.03953620418906212, -0.006403664592653513, -0.024039139971137047, 0.020771576091647148, 0.032449837774038315, 0.0007990080048330128, -0.0009294265764765441, -0.0015405981102958322, -0.008299387991428375, 0.021473314613103867, -0.009754936210811138, -0.010063709691166878, 0.06197335198521614, -0.03294026479125023, -0.02475016564130783, 0.0342697948217392, 0.006888268049806356, 0.006554059684276581, 0.00962927658110857, -0.014905817806720734, 0.02159770578145981, 0.039155151695013046, 0.007512496318668127, 0.025577416643500328, 0.0085539435967803, 0.010149376466870308, 0.02049676515161991, -0.05414087325334549, 0.011544515378773212, 0.05343995243310928, 0.01415087841451168, -0.04146086424589157, -0.009105931036174297, -0.050704244524240494, 0.015054861083626747, 0.03525820001959801, 0.008789606392383575, 0.00919155590236187, 0.01574992947280407, 0.011492504738271236, -0.0311556626111269, -0.010067757219076157, -0.046616509556770325, -0.0222674198448658, -0.02133004553616047, 0.005089388228952885, -0.03472626954317093, 0.021574173122644424, -0.02934342436492443, 0.0525394007563591, 0.020364562049508095, 0.007024457678198814, -0.05298709124326706, 0.03600602224469185, 0.0005934708751738071, 0.01385129988193512, 0.026789797469973564, -0.020131368190050125, 0.0445421077311039, 0.04530942812561989, 0.018335489556193352, 0.010532347485423088, -0.06260445713996887, -0.01556024793535471, 0.02434893697500229, 0.025872353464365005, 0.017552563920617104, -0.022685851901769638, -0.08151742815971375, -0.015857888385653496, 0.0373484343290329, -0.04168875142931938, 0.0014871456660330296, -0.02259947918355465, 0.028969518840312958, 0.010233516804873943, 0.013570616021752357, 0.014910303056240082, -0.007247735280543566, 0.0027347628492861986, -0.036048926413059235, -0.024531878530979156, -0.017907777801156044, 0.01161621231585741, 0.010968884453177452, 0.02516828291118145, 0.028524817898869514, -0.028242619708180428, 0.01100700069218874, -0.006424644496291876, -0.07838311791419983, -0.008707343600690365, -0.00317453034222126, 0.04374222084879875, -0.04440779238939285, -0.009845223277807236, 0.0413375087082386, -0.029417946934700012, -0.0059553408063948154, -0.02327960729598999, -0.00913551077246666, 0.032320085912942886, -0.06097789108753204, -0.049327027052640915, 0.01556179579347372, 0.014333181083202362, -0.042399805039167404, 0.013840587809681892, -0.012257630936801434, 0.03542463481426239, 0.02066032402217388, -0.061993274837732315, -0.0133818956092, -0.06470536440610886, 0.0009556646691635251, 0.04352513328194618, -0.011563740670681, 0.0004625671135727316, -0.06680494546890259, 0.0503232479095459, -0.02270476706326008, -0.0038425789680331945, -0.04372834414243698, -0.01253325305879116, -0.000006378845682775136, 0.02896726503968239, 0.015983564779162407, 0.027084872126579285, 0.021905245259404182, 0.02042466402053833, 0.004779437091201544, -0.052143607288599014, 0.02349458634853363, 0.0048881275579333305, 0.044557686895132065, 0.01647919788956642, 0.027998561039566994, 0.02851637452840805, 0.07782498747110367, -0.037002068012952805, 0.05869533494114876, 0.03552445396780968, 0.016901720315217972, 0.012875760905444622, -0.0041236067190766335, -0.007692417129874229, -0.02841559424996376, -0.006643732078373432, -0.0013584507396444678, 0.002383874263614416, 0.0076230913400650024, 0.014117659069597721, 0.0007840913021937013, -0.014176573604345322, 0.016539497300982475, 0.013801163993775845, 0.037036746740341187, 0.010393896140158176, -0.062266089022159576, -0.006922603119164705, -0.02019321918487549, -0.004025827161967754, 0.002757944632321596, -0.046595633029937744, 0.02565421164035797, 0.03430642932653427, -0.025228021666407585, 0.003727586707100272, 0.056672997772693634, 0.034878816455602646, 0.038226671516895294, 0.04989045858383179, 0.009859282523393631, -0.01082801166921854, 0.012181968428194523, -0.02167830988764763, -0.03047521971166134, -0.03322189301252365, 0.04600973799824715, 0.05154692754149437, 0.035789795219898224, 0.03457663953304291, -0.01928786188364029, -0.005526894703507423, 0.07217920571565628, -0.02845064550638199, 0.017070012167096138, -0.026639308780431747, -0.01616157405078411, 0.044463906437158585, -0.01799350418150425, -0.01610391214489937, -0.01811489276587963, 0.01657635159790516, 0.03620099648833275, -0.033071089535951614, -0.012694964185357094, 0.08396060019731522, -0.027766000479459763, 0.016650937497615814, -0.03813360258936882, 0.023841597139835358, 0.009137711487710476, 0.04904346540570259, 0.01036568358540535, 0.0008953944779932499, 0.04968024790287018, -0.044942814856767654, -0.04491972550749779, 0.041356928646564484, 0.03654821217060089, 0.017591053619980812, 0.01042827870696783, 0.014324629679322243, 0.016026390716433525, -0.020457660779356956, 0.030824391171336174, 0.009680445306003094, -0.007345663383603096, 0.03203672915697098, 0.06759890913963318, 0.021427767351269722, 0.009630955755710602, -0.022148575633764267, 0.015083319507539272, -0.01812293753027916, 0.023412972688674927, -0.017678070813417435, 0.02151048555970192, -0.0019079477060586214, 0.05528108775615692, 0.022718874737620354, 0.020718470215797424, 0.0012097206199541688, -0.00535766314715147, -0.009317254647612572, -0.0012604015646502376, 0.031684789806604385, -0.028815429657697678, 0.007759434171020985, -0.01953774131834507, -0.014056405052542686, 0.022387472912669182, -0.030998630449175835, 0.0160704106092453, -0.08626435697078705, -0.0011909494642168283, 0.010665416717529297, -0.018426980823278427, 0.032414887100458145, -0.035046931356191635, 0.008026573807001114, -0.01231727097183466, 0.031333111226558685, -0.01488767471164465, 0.0002108849585056305, -0.010470908135175705, 0.020649336278438568, 0.025282680988311768, 0.004383520223200321, -0.002152930246666074, -0.014141961932182312, 0.059193119406700134, 0.0458311066031456, 0.048512205481529236, 0.02259131707251072, -0.0755646824836731, 0.013824467547237873, 0.02288040705025196, -0.022290511056780815, 0.0385068841278553, 0.019033236429095268, -0.01919136382639408, 0.028978070244193077, 0.031221065670251846, -0.014095211401581764, 0.03979618474841118, 0.0035605577286332846, 0.014669819734990597, 0.005013912450522184, -0.018114546313881874, 0.017874378710985184, 0.03236626461148262, -0.04788423329591751, -0.039705194532871246, -0.00003342963464092463, 0.01950572058558464, 0.029934382066130638, 0.0073769125156104565, -0.03579673543572426, -0.009663248434662819, 0.011134822852909565, 0.0418478362262249, -0.047440655529499054, 0.02294163592159748, -0.027923179790377617, 0.020542245358228683, 0.04540235921740532, -0.017849590629339218, -0.006935850717127323, 0.06926093995571136, 0.0443677194416523, 0.0368119478225708, -0.031352847814559937, 0.008163939230144024, -0.002571876160800457, 0.006548598874360323, -0.0050186049193143845, 0.006883602123707533, 0.0046708849258720875, 0.007274812553077936, 0.018079975619912148, 0.009031716734170914, 0.01875966042280197, 0.03321893885731697, 0.023580871522426605, -0.0065004159696400166, -0.030434804037213326, -0.01860792376101017, 0.0017309286631643772, 0.040554676204919815, 0.032035473734140396, 0.021286966279149055, -0.03937691077589989, -0.046316180378198624, -0.026921944692730904, 0.029922787100076675, 0.03556413576006889, -0.011126409284770489, 0.006983601022511721, -0.025611022487282753, 0.01685837283730507, 0.021960489451885223, -0.00578757468611002, 0.07857880741357803, -0.032478369772434235, 0.026735788211226463, -0.06559848040342331, -0.0019922221545130014, 0.018002230674028397, -0.026236627250909805, -0.02307424321770668, -0.02239449881017208, -0.02650689333677292, 0.01872742921113968, 0.035119425505399704, -0.023607583716511726, -0.03493517264723778, 0.01539754681289196, -0.006823577918112278, -0.013501393608748913, 0.0015358405653387308, 0.023727810010313988, 0.020036272704601288, 0.0037649415899068117, 0.07436590641736984, -0.033886365592479706, -0.01134363655000925, -0.03365905582904816, -0.009977865032851696, -0.01061411201953888, -0.018479103222489357, 0.004928584210574627, 0.019300291314721107, -0.01823599264025688, -0.02667464129626751, -0.01902046613395214, 0.009816746227443218, -0.015604044310748577, 0.016672540456056595, 0.01143910177052021, 0.008302298374474049, -0.0015160045586526394, -0.015983566641807556, -0.009760038927197456, 0.037066735327243805, 0.014219051226973534, -0.011097706854343414, -0.007613840512931347, 0.02021353878080845, -0.0010542653035372496, -0.04482315853238106, 0.06502346694469452, 0.024746909737586975, 0.06723099201917648, 0.04208443686366081, 0.008099119178950787, 0.02858780138194561, -0.012059866450726986, 0.032996125519275665, -0.012013288214802742, -0.039169955998659134, -0.018364911898970604, 0.003342563519254327, 0.03204812481999397, -0.034554507583379745, -0.006446199957281351, 0.03303065523505211, -0.016050605103373528, -0.006306532304733992, -0.009109821170568466, 0.005588838830590248, -0.03164568170905113, 0.0074622449465096, 0.025123387575149536, -0.03805853798985481, 0.01163438893854618, -0.013597436249256134, 0.09495880454778671, 0.05483939126133919, 0.03006569854915142 ]
Understanding BigBird's Block Sparse Attention
vasudevgupta
March 31, 2021
big-bird
community, research, nlp
https://huggingface.co/blog/big-bird
What's next? @patrickvonplaten has made a really cool notebook on how to evaluate BigBirdForQuestionAnswering on the trivia-qa dataset. Feel free to play with BigBird using that notebook. You will soon find BigBird Pegasus-like model in the library for long document summarization💥.
[ 0.06316210329532623, -0.045195553451776505, 0.0116611672565341, -0.011284932494163513, 0.10421036183834076, -0.031528692692518234, -0.023101918399333954, 0.03610386326909065, -0.013993517495691776, -0.02132202871143818, -0.03163799270987511, 0.013157983310520649, -0.024385930970311165, -0.05009142681956291, 0.04372558742761612, 0.009338678792119026, 0.06442466378211975, -0.025784416124224663, 0.025606408715248108, -0.03056960366666317, -0.0019906165543943644, -0.019927429035305977, 0.027020078152418137, -0.05754893273115158, -0.05933375284075737, -0.0364815779030323, 0.047606490552425385, 0.024867476895451546, -0.04819720238447189, 0.027073103934526443, -0.07002215087413788, -0.0415811762213707, 0.04283979535102844, -0.056639961898326874, -0.04043641686439514, 0.0007670714985579252, -0.06627730280160904, 0.08122037351131439, 0.011826124042272568, -0.0693955346941948, 0.026164863258600235, -0.07933221757411957, 0.02775493450462818, 0.03631242737174034, -0.015144984237849712, -0.005114212166517973, -0.12226641178131104, 0.06341579556465149, -0.04677380621433258, -0.019252944737672806, -0.04937070235610008, 0.1296725869178772, -0.006577500607818365, 0.006450217217206955, 0.04716067388653755, 0.005934644490480423, 0.01615777425467968, -0.03573337197303772, 0.006627942901104689, -0.0194455124437809, 0.06868843734264374, -0.030602870509028435, 0.01814110390841961, -0.001885867677628994, -0.0031126237008720636, 0.009261064231395721, 0.02910204976797104, 0.0676499530673027, -0.05214664712548256, 0.05020352825522423, 0.011097364127635956, -0.05474407970905304, 0.04193056747317314, 0.041299279779195786, 0.02754928357899189, -0.022888237610459328, -0.01646498590707779, 0.05675450712442398, 0.029150107875466347, 0.0013790985103696585, -0.004577504470944405, -0.00423512514680624, 0.08603281527757645, -0.0030583387706428766, -0.04805440828204155, 0.007207277696579695, 0.028800539672374725, -0.06826096028089523, -0.05834152176976204, 0.0031742998398840427, -0.025083569809794426, -0.15660405158996582, -0.008992469869554043, 0.036897409707307816, 0.012947231531143188, -0.10520081967115402, -0.006983189377933741, 0.004995397757738829, -0.012932696379721165, -0.008831375278532505, -0.03733538091182709, -0.029385721310973167, 0.02948717400431633, -0.07536593824625015, -0.03649872913956642, 0.015819953754544258, -0.019278312101960182, -0.130264014005661, -0.08581192791461945, 0.0357949435710907, -0.006138976663351059, 0.0228505227714777, -0.04911399632692337, 0.07314682006835938, -0.09145990014076233, 0.07131797820329666, 0.009592829272150993, 0.004989871755242348, -0.04511217772960663, 0.04695197567343712, -0.01264383178204298, 0.05390956997871399, 0.05355042591691017, -0.013114582747220993, 0.009806671179831028, 0.014772740192711353, 0.05703136324882507, -0.02667277306318283, -0.05754011869430542, -0.06345430761575699, 0.006615744903683662, 0.001192761119455099, -0.01939764805138111, 0.03573586046695709, 0.0089897895231843, -0.030016494914889336, -0.05844404920935631, 0.015522404573857784, 0.03483422100543976, 0.050445739179849625, -0.02856963500380516, 0.008114014752209187, 0.05905816704034805, 0.07356917858123779, 0.022736014798283577, 0.010729318484663963, -0.010445451363921165, 0.001460099359974265, -0.018818074837327003, 0.005552907474339008, -0.004700419958680868, 0.021117402240633965, 0.005798086058348417, -0.07631326466798782, 0.005284867715090513, -0.002929573878645897, -0.013367117382586002, -0.03111920692026615, -0.06071038171648979, 0.004749692045152187, 0.06279165297746658, -0.01798885129392147, -0.01953156292438507, 0.04372420534491539, 0.03382279351353645, -0.012103683315217495, 0.03599964454770088, 0.033299051225185394, 0.007984048686921597, -0.015355918556451797, 0.003385651856660843, -0.050523366779088974, 0.10290957242250443, -0.026799730956554413, -0.05212238430976868, 0.07388424873352051, 0.048781171441078186, -0.08458801358938217, 0.036612071096897125, 0.080267034471035, -0.04603832960128784, -0.03229490667581558, -0.022772716358304024, -0.0016035479493439198, 0.019512033089995384, -0.001255468581803143, 0.09187831729650497, -0.04492057487368584, 0.008099989034235477, -0.03638526052236557, -0.09754497557878494, -0.026593875139951706, 0.10592000931501389, 0.013689382001757622, 0.05224350094795227, -0.048851095139980316, 0.0008896221406757832, 0.10748836398124695, 0.025927653536200523, 0.02952156588435173, 0.02411072701215744, 0.08282379060983658, 0.08774159848690033, -0.05463256686925888, -0.026972496882081032, 0.01696850173175335, 0.016823193058371544, 0.0007621648255735636, 0.01964453235268593, -0.04385067895054817, 0.0419214628636837, -0.07401801645755768, 0.07371959835290909, -0.02838575281202793, -0.04043199494481087, -0.018046151846647263, 0.021061046048998833, -0.003102754708379507, -0.060639962553977966, -0.03963564336299896, 0.1321035921573639, -0.0028478268068283796, 0.02091447450220585, -0.07488081604242325, 0.02064223401248455, 0.04893719404935837, 0.09523598104715347, 0.03482070565223694, -0.006658636964857578, -0.0686924085021019, -0.007418926805257797, -0.0054475353099405766, -0.04984622821211815, 0.05096161365509033, 0.0590442456305027, -0.029905080795288086, 0.004385222215205431, -0.06013680621981621, 0.05555030331015587, -0.018514109775424004, 0.00016168193542398512, -0.04624148830771446, 0.01519849058240652, 0.09780868887901306, -0.025715498253703117, -0.015731846913695335, 0.04337410256266594, -0.009581189602613449, -0.022084899246692657, -0.04549911245703697, -0.05125484615564346, 0.0813693255186081, 0.00022722463472746313, 0.012491252273321152, 0.023512234911322594, 0.026709873229265213, -0.011145418509840965, -0.008014017716050148, -0.034619178622961044, -0.026319103315472603, -0.033245012164115906, -0.015461946837604046, -0.0016676000086590648, 0.01701960898935795, 0.038038045167922974, -0.04248178377747536, -0.03729584813117981, -0.061303284019231796, 0.014670122414827347, 0.006740777287632227, 0.00805711094290018, -0.02808435633778572, 0.005701818969100714, -0.005317649804055691, -0.05730167403817177, 0.018552089110016823, 0.0023156891111284494, -0.0303419828414917, -0.019122043624520302, -0.024400077760219574, 0.041768573224544525, -0.02145560272037983, 0.04216157644987106, -0.02445346489548683, 0.06033264845609665, -0.0073036146350204945, 0.03831448405981064, -0.008951403200626373, -0.002593372482806444, 0.02395769953727722, 0.004413101356476545, 0.012246224097907543, -0.024724304676055908, -0.02833748050034046, 0.009593216702342033, -0.017045248299837112, 0.04589664563536644, 0.023709028959274292, -0.012884397059679031, 0.014419621787965298, 0.018615350127220154, 0.01701970398426056, 0.003268300788477063, 0.0013884908985346556, 0.01734563335776329, 0.06919683516025543, 0.006900003645569086, 0.03213930130004883, -0.1124328076839447, 0.01965601183474064, 0.0326484777033329, -0.0028779017738997936, -0.029348846524953842, -0.020755480974912643, 0.029466651380062103, -0.017879469320178032, 0.010380648076534271, -0.00628194585442543, 0.01615159772336483, -0.024423986673355103, 0.008917116560041904, 0.020739730447530746, -0.01834598183631897, 0.043368954211473465, -0.030570220202207565, 0.0009907727362588048, -0.013591775670647621, 0.038638532161712646, 0.008942661806941032, 0.0488896481692791, -0.006624576169997454, -0.017513003200292587, -0.0465272031724453, 0.00547843286767602, 0.041945286095142365, 0.0468890406191349, 0.03210802003741264, 0.006174223031848669, 0.0034653095062822104, -0.031698763370513916, -0.01737927831709385, 0.015250912867486477, -0.049075447022914886, 0.005555149633437395, -0.007606604602187872, 0.016709426417946815, 0.017942963168025017, 0.05382398143410683, 0.0031947048846632242, -0.04650383070111275, 0.01386039424687624, -0.012048091739416122, -0.00891653262078762, 0.003218098310753703, 0.0022888868115842342, 0.0020739987958222628, 0.030415063723921776, -0.03964633122086525, -0.005725327879190445, 0.04293401166796684, -0.01632237620651722, 0.07615987211465836, -0.0517471507191658, -0.031060244888067245, 0.037838973104953766, -0.030524324625730515, 0.04083222523331642, -0.05344141274690628, 0.025629723444581032, -0.0025854341220110655, 0.02275785803794861, 0.007313943933695555, -0.033417098224163055, 0.032829295843839645, -0.002914953278377652, 0.0006984457140788436, -0.03836387023329735, 0.035417478531599045, 0.014161541126668453, 0.05763420835137367, -0.0008929865434765816, 0.003864610567688942, 0.00016758499259594828, 0.005851925816386938, -0.0054590459913015366, -0.017230670899152756, 0.04663502052426338, 0.04917570948600769, -0.00727086141705513, -0.06523145735263824, -0.023805847391486168, -0.03376539424061775, 0.01981419324874878, -0.005879891570657492, -0.007043024990707636, -0.010286012664437294, -0.03810226172208786, 0.03142179921269417, 0.03677435964345932, 0.012665534391999245, 0.01744067668914795, 0.018109608441591263, -0.014304101467132568, -0.015523059293627739, 0.038909804075956345, -0.011594240553677082, 0.03571221977472305, 0.004968426655977964, 0.04838956519961357, -0.0647951290011406, -0.0030677146278321743, 0.006694409996271133, -0.014479794539511204, 0.04082518443465233, -0.053229548037052155, -0.04782969504594803, -0.017621295526623726, 0.013276172801852226, 0.013651596382260323, -0.07479123771190643, -0.02531496435403824, -0.0233503095805645, 0.009545045904815197, -0.0034970815759152174, 0.009794620797038078, -0.00028199792723171413, -0.017168542370200157, 0.014497162774205208, -0.0282195582985878, -0.002656961092725396, -0.034697432070970535, -0.029422931373119354, -0.008770845830440521, 0.0007680797716602683, -0.0033454184886068106, -0.03366466239094734, -0.006850749254226685, -0.028285028412938118, -0.018893547356128693, -0.03312565013766289, -0.03870858997106552, -0.0004938855418004096, 0.0054651121608912945, 0.03737794607877731, -0.05879596248269081, 0.048425182700157166, 0.0007560155936516821, -0.051078829914331436, -0.01202073972672224, -0.03854772076010704, -0.0014379746280610561, 0.0008100191480480134, 0.008389506489038467, -0.0116525674238801, -0.010085119865834713, -0.024076512083411217, -0.0028553043957799673, 0.05859575420618057, 0.010113967582583427, 0.03201025724411011, -0.029024723917245865, -0.027491487562656403, 0.030763065442442894, -0.014592540450394154, 0.02140091173350811, -0.010979429818689823, 0.02447226643562317, 0.05470141023397446, 0.022817669436335564, 0.024492092430591583, -0.020658869296312332, 0.017849689349532127, -0.007023152895271778, 0.02466273121535778, -0.030653202906250954, -0.042672183364629745, 0.025994135066866875, 0.019363541156053543, -0.034867651760578156, 0.01614905148744583, -0.00898226723074913, -0.006529415026307106, 0.03332662582397461, 0.0038604852743446827, 0.012959446758031845, 0.07372140884399414, -0.006435363087803125, 0.002500958973541856, -0.05088414251804352, 0.01869790442287922, 0.05162891373038292, 0.007039832882583141, -0.012732993811368942, 0.02427457645535469, 0.06066460162401199, 0.062156859785318375, 0.013941284269094467, 0.04826278239488602, 0.04469233378767967, 0.009859452024102211, -0.010212424211204052, -0.02848370000720024, 0.010686647146940231, 0.014019053429365158, -0.010465460829436779, -0.0492311492562294, -0.04258906468749046, 0.013208297081291676, 0.00016723402950447053, 0.003622783347964287, -0.005873001180589199, -0.007658177055418491, 0.023634761571884155, 0.02699916623532772, -0.009128021076321602, -0.004982366692274809, 0.042883217334747314, -0.037887170910835266, -0.006346079986542463, -0.02306087128818035, -0.03275713324546814, 0.023156730458140373, 0.05914764478802681, -0.06000450626015663, -0.01620049588382244, 0.01088668406009674, -0.004312269855290651, 0.035633377730846405, -0.018591230735182762, 0.010461811907589436, -0.0011570113711059093, -0.028594238683581352, 0.0406377799808979, 0.00391825195401907, 0.015158823691308498, -0.004724583122879267, 0.0019129089778289199, -0.004980816971510649, 0.03125590831041336, 0.022152306511998177, 0.018450630828738213, 0.0004517788183875382, 0.013974140398204327, -0.0012021282454952598, -0.06086285412311554, 0.021919462829828262, 0.04453139379620552, -0.023688580840826035, -0.019363561645150185, -0.025434527546167374, 0.014467093162238598, 0.00952497124671936, -0.062355972826480865, 0.03602176904678345, 0.05797092616558075, -0.008109934628009796, 0.014484560117125511, -0.016194358468055725, 0.013448689132928848, 0.042128078639507294, 0.018983596935868263, 0.030683156102895737, -0.0036093543749302626, 0.03768055513501167, 0.05591638758778572, -0.022122858092188835, -0.036408379673957825, 0.027452919632196426, 0.018673334270715714, -0.029042083770036697, -0.0073880478739738464, 0.025219349190592766, -0.027552487328648567, 0.011858005076646805, 0.03519537299871445, -0.01062926184386015, -0.0056189741007983685, -0.0012840668205171824, 0.009397847577929497, 0.03275403380393982, 0.026540154591202736, 0.010658998973667622, 0.02832091972231865, -0.01697566919028759, 0.03595738112926483, 0.051561348140239716, 0.02192196622490883, -0.00044168057502247393, -0.0266067236661911, 0.04255629703402519, 0.00036098563577979803, 0.07015065848827362, -0.06275620311498642, 0.02564127929508686, 0.030714746564626694, -0.006169514264911413, 0.06332964450120926, 0.010933208279311657, 0.015245484188199043, 0.031091904267668724, -0.032342080026865005, -0.03520648181438446, -0.013828733004629612, 0.04031459614634514, 0.035759586840867996, 0.010194677859544754, 0.020257296040654182, -0.07531392574310303, -0.00666840048506856, 0.003916406072676182, -0.011874986812472343, -0.028227753937244415, -0.010548166930675507, 0.03343123942613602, -0.00747361546382308, -0.029329685494303703, -0.003386818803846836, -0.006132453214377165, -0.0032642220612615347, 0.0351821593940258, -0.030049219727516174, 0.00790449045598507, 0.0062057399190962315, 0.0005533054936677217, -0.0221850648522377, 0.028282927349209785, 0.010221158154308796, 0.01560306642204523, 0.013296124525368214, 0.004054541699588299, -0.006347247865051031, -0.009475644677877426, -0.02749929577112198, -0.030970832332968712, 0.00919212494045496, -0.020633893087506294, -0.018498795107007027, -0.032851431518793106, 0.02511795237660408, 0.05030565336346626, 0.004314615856856108, -0.0032590932678431273, 0.01588624343276024, 0.02379610575735569, -0.011204620823264122, 0.012167555280029774, -0.03015834093093872, 0.01989656686782837, -0.003643440781161189, 0.02107442542910576, 0.05857802927494049, 0.019838538020849228, -0.008638622239232063, 0.00621036859229207, 0.029260504990816116, 0.01769135147333145, -0.034601613879203796, 0.02657315880060196, 0.00019083580991718918, 0.05498964339494705, -0.011649586260318756, 0.07163958996534348, 0.030411284416913986, -0.061429720371961594, -0.04294799268245697, -0.004607726354151964, 0.03167961537837982, -0.026780985295772552, 0.0008186011109501123, 0.04811203479766846, 0.018757188692688942, 0.017495544627308846, -0.01486414484679699, -0.017438722774386406, -0.022296465933322906, 0.035383325070142746, 0.024627624079585075, 0.017631012946367264, 0.007340917829424143, -0.028523117303848267, 0.0017145335441455245, 0.021592076867818832, -0.03899246081709862, -0.01924765482544899, -0.00987874437123537, -0.020895734429359436, -0.010574094951152802, -0.016743360087275505, 0.018297921866178513, 0.008401206694543362, 0.043627288192510605, 0.0027991151437163353, 0.04508808255195618, 0.010025247000157833, -0.02319183386862278, 0.02971714735031128, -0.003760538762435317, -0.00682032248005271, -0.0651870146393776, -0.04165469482541084, -0.05741574242711067, 0.013311590068042278, 0.016833601519465446, 0.000628827081527561, 0.01580994576215744, -0.012123128399252892, 0.025154830887913704, 0.0014173530507832766, -0.05412624031305313, -0.00954083725810051, 0.03566722199320793, -0.04394036903977394, 0.025169963017106056, -0.020640797913074493, -0.002333827083930373, -0.004305210895836353, -0.03419770672917366, 0.015610099770128727, 0.00981587078422308, 0.026151999831199646, 0.0010329467477276921, 0.005337139591574669, 0.013384883292019367, -0.013038335368037224, -0.07690081000328064, -0.004782423377037048, 0.010834481567144394, -0.012048047035932541, -0.009626337327063084, 0.004945864900946617, 0.026509622111916542, 0.03321028873324394, 0.02510727569460869, 0.016088228672742844, -0.01390739344060421, -0.005760359112173319, 0.02014450542628765, -0.05382278189063072, 0.011633169837296009, -0.002973440568894148, -0.045533258467912674, 0.03346078097820282, 0.021421510726213455, -0.011280768550932407, 0.007216433994472027, -0.027289943769574165, -0.002731194719672203, -0.015502245165407658, -0.05331707373261452, 0.011180096305906773, 0.00831653457134962, 0.00710741151124239, -0.02519640326499939, -0.036493994295597076, 0.0531599298119545, -0.00678159948438406, -0.03534303233027458, -0.0590931661427021, 0.018291309475898743, 0.05906190350651741, -0.0054283482022583485, 0.0007441307534463704, -0.05364621803164482, 0.020201770588755608, 0.027031440287828445, -0.013421804644167423, 0.019547538831830025, 0.042322032153606415 ]
Understanding BigBird's Block Sparse Attention
vasudevgupta
March 31, 2021
big-bird
community, research, nlp
https://huggingface.co/blog/big-bird
# Understanding BigBird's Block Sparse Attention
[ 0.06267933547496796, -0.006103602237999439, 0.04086240753531456, -0.023257434368133545, 0.07462511956691742, -0.01892821490764618, 0.011614187620580196, 0.060461483895778656, -0.05404461547732353, -0.04990198463201523, -0.0011156682157889009, 0.031804125756025314, -0.040823888033628464, -0.02562379464507103, -0.01491194125264883, 0.07986973971128464, 0.10047508031129837, -0.07139366120100021, 0.02509656548500061, -0.01675068400800228, 0.007614062167704105, -0.04056967794895172, 0.077721007168293, -0.017170561477541924, 0.03012160211801529, 0.019845129922032356, -0.008719922043383121, -0.005039301235228777, -0.07666811347007751, 0.024599021300673485, -0.08982626348733902, 0.004887583665549755, 0.05827619507908821, -0.024128513410687447, -0.04281170293688774, -0.015753356739878654, -0.07373665273189545, 0.04252299293875694, 0.007879544049501419, -0.07389985024929047, -0.0110965920612216, -0.056551773101091385, -0.04563179984688759, 0.022193437442183495, -0.06558455526828766, -0.03113672323524952, -0.2574285566806793, 0.1345311999320984, -0.03311515972018242, -0.035486187785863876, -0.07336342334747314, 0.06130056083202362, 0.022905390709638596, 0.04645407572388649, 0.016100727021694183, -0.019894756376743317, -0.020167475566267967, -0.03153196722269058, 0.04507872089743614, -0.08354266732931137, 0.06485778093338013, -0.001271877670660615, -0.0020545676816254854, 0.05255134776234627, 0.016904368996620178, 0.04598768800497055, 0.0600404255092144, 0.046834398061037064, -0.07532888650894165, 0.05600866302847862, 0.06389725208282471, -0.04134497791528702, -0.01451845932751894, 0.022534683346748352, -0.023428570479154587, 0.006575042847543955, -0.0017301446059718728, 0.06591802090406418, 0.02416914515197277, 0.06387626379728317, 0.03576217219233513, 0.03413088247179985, 0.06755438446998596, 0.06629225611686707, -0.026342036202549934, -0.053634434938430786, 0.05484064668416977, -0.022411154583096504, -0.025640001520514488, 0.0378577783703804, -0.032433874905109406, -0.1267305612564087, 0.0009229460265487432, 0.05719983950257301, -0.014975306577980518, -0.047695599496364594, 0.05324605479836464, 0.005156024359166622, 0.007606069557368755, 0.023453863337635994, -0.03009028732776642, 0.006381516810506582, 0.0933002308011055, -0.0414431132376194, -0.051898736506700516, 0.0207394789904356, -0.021279748529195786, -0.09456714242696762, -0.06402651220560074, -0.0016033034771680832, -0.06514645367860794, 0.01688549853861332, -0.01370412576943636, -0.0240927767008543, -0.07729867845773697, 0.06623256206512451, -0.009408783167600632, 0.023656828328967094, -0.018649891018867493, 0.04454689845442772, -0.036564331501722336, 0.12194108217954636, 0.10753650218248367, -0.01573016867041588, 0.028341760858893394, -0.010509253479540348, 0.02334333397448063, 0.018328173086047173, -0.02393385022878647, -0.048848215490579605, -0.0173838771879673, 0.008675361052155495, 0.05437464639544487, -0.024746378883719444, -0.010432064533233643, -0.057739678770303726, 0.009681882336735725, -0.030559759587049484, 0.0027128993533551693, 0.0013433704152703285, -0.03618711978197098, 0.0014235652051866055, 0.01595643348991871, 0.05554398149251938, 0.07415468245744705, -0.0205039344727993, -0.038041915744543076, -0.0049231573939323425, -0.00912781897932291, 0.0062804799526929855, 0.04824192821979523, 0.04533360153436661, -0.03769109398126602, -0.0344943106174469, -0.02064577117562294, 0.006365999113768339, 0.025896016508340836, -0.036162685602903366, -0.07182562351226807, 0.00888746790587902, -0.007373976055532694, -0.018547412008047104, 0.03714403510093689, 0.005771499592810869, 0.05039462819695473, -0.03114342875778675, 0.05305318534374237, -0.018245447427034378, -0.012239710427820683, -0.02338511310517788, -0.012100787833333015, 0.015198702923953533, 0.04841501638293266, -0.02695421315729618, -0.07523438334465027, 0.02420402131974697, 0.02805202454328537, 0.029921889305114746, 0.0039552683010697365, 0.05875511094927788, -0.04448682814836502, -0.03190219774842262, -0.001535027171485126, 0.024119731038808823, 0.01496219728142023, -0.01504369918256998, 0.08730681240558624, 0.02519099973142147, -0.017309946939349174, -0.012513239867985249, -0.0764193907380104, 0.000515779189299792, 0.011639163829386234, -0.010090149939060211, 0.049860045313835144, -0.0862957015633583, -0.06259621679782867, 0.07350011169910431, 0.08039464056491852, 0.07653740793466568, 0.004084104672074318, 0.010954351164400578, -0.0043024965561926365, 0.012693067081272602, -0.04089393839240074, 0.05512845888733864, 0.033603113144636154, -0.004472977947443724, 0.047421522438526154, -0.017895489931106567, -0.01391944382339716, -0.08206000179052353, 0.015250763855874538, -0.08670251071453094, -0.02811545878648758, 0.009598677977919579, 0.07574339210987091, -0.005925843026489019, -0.0290529727935791, -0.020191740244627, 0.07152392715215683, -0.0072709075175225735, -0.006351192481815815, 0.0018417885294184089, -0.020922334864735603, 0.03708479925990105, 0.09976349025964737, -0.030202006921172142, 0.05491417646408081, -0.04127928614616394, 0.00047748073120601475, -0.0064681898802518845, -0.010184355080127716, 0.07313074916601181, 0.027424326166510582, -0.007436465937644243, -0.007830696180462837, 0.04076121002435684, 0.019991030916571617, -0.06851951032876968, -0.03694290295243263, -0.04611951485276222, 0.00755813205614686, 0.036957837641239166, -0.05297892540693283, -0.05087992176413536, 0.06045364588499069, -0.02441490814089775, -0.08644174039363861, 0.0451042614877224, -0.035309817641973495, 0.061140332370996475, -0.001781818107701838, -0.05891990289092064, 0.06167875975370407, -0.035028766840696335, 0.014632564038038254, -0.04337448626756668, 0.010858465917408466, 0.0028450889512896538, 0.030177181586623192, 0.0011920285178348422, 0.011727649718523026, -0.03377382084727287, -0.03375731408596039, -0.025699930265545845, 0.02253071591258049, 0.015237877145409584, 0.03616749495267868, 0.06185654550790787, -0.008321567438542843, -0.025934670120477676, 0.02916727587580681, -0.014835752546787262, -0.04805875942111015, -0.007701462600380182, 0.027941521257162094, -0.051873981952667236, -0.005179005675017834, -0.008992389775812626, 0.0064150020480155945, 0.013016573153436184, 0.02560972422361374, -0.0006589835393242538, 0.04758286476135254, -0.010249806568026543, 0.02588454633951187, 0.015508394688367844, 0.0014476055512204766, -0.01654920168220997, -0.02523575723171234, 0.00937142875045538, -0.005955156404525042, -0.019606927409768105, 0.01858915388584137, 0.013240577653050423, -0.02363395132124424, -0.0027080283034592867, -0.01409181673079729, -0.03642657399177551, 0.05654829367995262, 0.029004190117120743, -0.032189033925533295, -0.01663096994161606, -0.038929056376218796, 0.02199406549334526, 0.005159289110451937, 0.0765407457947731, -0.1382269263267517, -0.04433252289891243, 0.02443632110953331, 0.015003216452896595, -0.03544821962714195, -0.04694545641541481, 0.055858541280031204, 0.0010191062465310097, 0.009160103276371956, -0.023691536858677864, 0.014297728426754475, -0.020221903920173645, -0.009650038555264473, -0.0029437809716910124, -0.01681683212518692, -0.011815302073955536, -0.0109971659258008, 0.03246622160077095, 0.00355795887298882, -0.013022607192397118, -0.013807051815092564, 0.061689991503953934, 0.011655407026410103, -0.007293226197361946, -0.019487133249640465, 0.017228245735168457, 0.0352986715734005, 0.03967307135462761, 0.022751910611987114, 0.025506049394607544, -0.03258897736668587, 0.026135094463825226, -0.026440490037202835, 0.008715865202248096, -0.022524241358041763, 0.029261454939842224, -0.004956441465765238, -0.033162061125040054, 0.01775296777486801, 0.03043833002448082, 0.021861866116523743, -0.010758107528090477, 0.04576682671904564, -0.007698110304772854, -0.0006846353062428534, -0.005101446993649006, -0.012943810783326626, -0.010965526103973389, 0.03575505316257477, -0.052327681332826614, -0.03414253145456314, -0.012657169252634048, 0.009717927314341068, 0.04773186519742012, -0.0026314917486160994, -0.015286608599126339, 0.007095831912010908, -0.017638878896832466, 0.05557714030146599, -0.02589533105492592, -0.02545829676091671, 0.022922804579138756, 0.018571188673377037, 0.010780352167785168, -0.030331114307045937, 0.05321519076824188, -0.005301991011947393, 0.0481453537940979, 0.003193680429831147, 0.03213588148355484, 0.024428026750683784, -0.03222253546118736, -0.009669672697782516, 0.021000871434807777, 0.002551889047026634, 0.051062945276498795, -0.0031842023599892855, -0.0028364062309265137, 0.05376199632883072, 0.006322852801531553, -0.022958116605877876, -0.02068963646888733, -0.005169366952031851, 0.010426988825201988, 0.002173157874494791, 0.023497717455029488, 0.0030579399317502975, 0.02194126881659031, 0.0000912070318008773, 0.050065699964761734, 0.006780544761568308, -0.004728927277028561, -0.007297108881175518, -0.025001809000968933, 0.02449062466621399, 0.03573434054851532, 0.023439090698957443, -0.015085910446941853, 0.026593148708343506, -0.0007772352546453476, 0.08895815163850784, -0.0430145338177681, 0.009272809140384197, 0.011182138696312904, 0.02828759141266346, 0.005478126462548971, -0.05585530027747154, -0.007751099765300751, 0.011970937252044678, 0.017196832224726677, 0.021244773641228676, -0.04036067798733711, -0.009411588311195374, -0.003941039554774761, -0.0173678956925869, 0.007206503301858902, -0.02915947511792183, -0.0442928671836853, 0.0021642616484314203, 0.00318312318995595, -0.06308215856552124, 0.00734027661383152, -0.019708869978785515, -0.038711100816726685, -0.02435295470058918, 0.0055520846508443356, -0.01978003792464733, -0.02694803848862648, -0.015255064703524113, -0.022589389234781265, -0.020134640857577324, -0.035424306988716125, 0.03694635257124901, -0.015541310422122478, 0.03059668466448784, 0.030058762058615685, -0.014225616119801998, 0.04720809683203697, 0.06633581221103668, -0.10144373774528503, -0.003531521186232567, -0.011985253542661667, 0.033346179872751236, -0.02575986459851265, 0.02500901371240616, -0.00462730647996068, -0.050274576991796494, -0.012515349313616753, -0.025103211402893066, 0.03776416555047035, 0.044466130435466766, -0.049581706523895264, -0.03246467560529709, 0.01080230064690113, 0.015447065234184265, -0.002268326934427023, 0.0071727922186255455, -0.028368353843688965, -0.01306995376944542, 0.05295541509985924, -0.014552097767591476, -0.024537963792681694, -0.061205245554447174, 0.003291340311989188, -0.014408736489713192, -0.039613544940948486, -0.006720339879393578, -0.06687282025814056, 0.013287612237036228, 0.007772931829094887, -0.0025047215167433023, -0.014164532534778118, 0.013797089457511902, 0.016330229118466377, 0.04051966220140457, -0.014287024736404419, 0.0038370045367628336, 0.012142826803028584, 0.008982798084616661, -0.01112021878361702, -0.0007251176284626126, 0.007471648044884205, 0.026041753590106964, 0.03771570324897766, -0.0015041744336485863, 0.00021001601999159902, 0.040646158158779144, 0.01882658340036869, -0.020461170002818108, 0.0520242303609848, 0.0336107574403286, -0.0032109038438647985, 0.006890280172228813, -0.006867690943181515, 0.005153803154826164, 0.03366211801767349, 0.01966092921793461, -0.04628593847155571, -0.020139463245868683, 0.01880728080868721, 0.009671472944319248, 0.011396137997508049, -0.01428707130253315, 0.010494565591216087, 0.010960042476654053, 0.03977162018418312, -0.015784356743097305, -0.009573554620146751, -0.041377171874046326, -0.027836592867970467, -0.011150704696774483, -0.015278583392500877, -0.05207235366106033, -0.03314787521958351, 0.03049919195473194, -0.040580470114946365, -0.052888404577970505, 0.016709420830011368, 0.005645578261464834, 0.025250155478715897, 0.03765197470784187, -0.006969686597585678, -0.02916061319410801, 0.020100660622119904, 0.023248447105288506, -0.0034981099888682365, -0.014134781435132027, 0.02904818207025528, 0.027698073536157608, 0.06912044435739517, 0.024348976090550423, 0.00027575736748985946, 0.008958552032709122, 0.025005942210555077, 0.005194918252527714, 0.0007396162836812437, -0.04520026594400406, 0.036264292895793915, 0.01611483283340931, 0.018267353996634483, -0.007214380428195, 0.0028032879345119, -0.010410630144178867, 0.029569389298558235, -0.04807160049676895, -0.014106139540672302, 0.04711413010954857, -0.0029684233013540506, 0.026840215548872948, 0.0029806948732584715, 0.03422848880290985, 0.002398998010903597, 0.038324110209941864, 0.009529502131044865, 0.01570320688188076, 0.03561881184577942, -0.007078148890286684, -0.04711560904979706, -0.002661885228008032, -0.010240151546895504, 0.037971124053001404, -0.009823604486882687, 0.015564735047519207, -0.011081662029027939, -0.03188636526465416, 0.028121814131736755, -0.00007040295167826116, -0.012564162723720074, 0.03577526658773422, 0.02291129343211651, 0.0185357928276062, -0.0087408646941185, -0.006194045767188072, -0.01180287916213274, -0.0012281798990443349, -0.010473011992871761, 0.015153555199503899, 0.04396500810980797, 0.0007026562816463411, 0.0239899680018425, -0.0002013079938478768, 0.013790810480713844, 0.05321623012423515, 0.019763769581913948, -0.012367039918899536, -0.012276860885322094, 0.01852770708501339, -0.009505923837423325, 0.03819124400615692, 0.0024092954117804766, 0.001652088831178844, 0.024471942335367203, -0.016538163647055626, -0.018463490530848503, -0.026123711839318275, 0.05537986010313034, 0.02686106413602829, -0.0129799023270607, 0.053749989718198776, -0.07078655064105988, -0.0065531255677342415, 0.01562781259417534, -0.007444128859788179, -0.020956702530384064, -0.030579285696148872, 0.00564756290987134, 0.009186777286231518, -0.0049580601043999195, 0.006543839816004038, -0.0264278631657362, -0.008485202677547932, 0.05501934885978699, -0.005277952644973993, 0.05516195297241211, -0.011876095086336136, -0.051822252571582794, 0.032255515456199646, -0.004148813895881176, -0.014912685379385948, 0.01808939129114151, 0.028377680107951164, -0.02391289360821247, 0.023000169545412064, -0.013405745849013329, -0.051068924367427826, -0.016882536932826042, 0.030570443719625473, -0.0051699248142540455, -0.005276069510728121, -0.020269641652703285, 0.026245716959238052, 0.03241459280252457, -0.002835349878296256, 0.005473624914884567, 0.025490403175354004, 0.027683477848768234, 0.04996909946203232, 0.04205824434757233, -0.04007759317755699, -0.03319893032312393, 0.01264052651822567, 0.018844222649931908, 0.02400137670338154, 0.015429763123393059, -0.007699537090957165, -0.016819553449749947, 0.028888868167996407, -0.011392108164727688, -0.02878470905125141, 0.05341525003314018, 0.04500974342226982, 0.00753782456740737, -0.0150753790512681, 0.02247568964958191, -0.03048519603908062, -0.01152950432151556, -0.03483406826853752, 0.024817626923322678, -0.015974031761288643, -0.0016274439403787255, 0.01189559418708086, 0.05647110193967819, -0.0009421075810678303, -0.01324671134352684, 0.00248909555375576, 0.00898679532110691, -0.033769574016332626, -0.027501340955495834, 0.00498094130307436, 0.02746751345694065, -0.011285742744803429, -0.015047088265419006, 0.009265739470720291, -0.006433300673961639, -0.03210954740643501, 0.0027694611344486475, -0.005231543444097042, -0.007603930309414864, 0.0074488078244030476, -0.05477581545710564, 0.044468753039836884, 0.03619109094142914, 0.023561010137200356, 0.03355970233678818, 0.04591430723667145, 0.022562921047210693, -0.04582715779542923, 0.017218681052327156, -0.015714140608906746, 0.0018336892826482654, -0.054378069937229156, -0.02209520898759365, -0.036612920463085175, -0.021166475489735603, 0.00976351834833622, -0.0017494399799034, -0.023228149861097336, 0.005053768865764141, -0.009737588465213776, 0.015250379219651222, -0.07862453907728195, 0.01605159044265747, 0.015273052267730236, 0.009500589221715927, 0.026462005451321602, -0.024293070659041405, 0.004281813744455576, -0.02532530389726162, -0.006917792372405529, -0.006815905217081308, 0.016188163310289383, 0.01223329920321703, 0.013369856402277946, -0.023612523451447487, 0.012502619996666908, -0.031572375446558, -0.04823896661400795, -0.010945680551230907, 0.030229149386286736, 0.0015224808594211936, -0.03711932897567749, -0.009587920270860195, 0.03517366573214531, 0.01694268360733986, 0.023401563987135887, 0.013034830801188946, -0.04603414237499237, 0.008106439374387264, 0.028082305565476418, -0.009500084444880486, -0.008522199466824532, 0.004141263198107481, 0.03534034639596939, 0.06272004544734955, 0.05855448171496391, -0.021461626514792442, -0.00970258004963398, -0.021058976650238037, 0.01596601866185665, 0.007141448091715574, -0.02393239550292492, -0.01930239610373974, -0.003058398375287652, 0.008276605047285557, -0.02815597876906395, -0.054885122925043106, 0.017490770667791367, 0.015039361082017422, -0.01377867441624403, -0.005810564383864403, 0.011803915724158287, 0.013006509281694889, -0.012582365423440933, 0.014725398272275925, -0.01263467501848936, 0.049056705087423325, 0.015476291067898273, 0.03454604372382164, 0.04093179479241371, 0.02475503645837307 ]
Understanding BigBird's Block Sparse Attention
vasudevgupta
March 31, 2021
big-bird
community, research, nlp
https://huggingface.co/blog/big-bird
Random Attention Random attention is ensuring that each query token will attend a few random tokens as well. For the actual implementation, this means that the model gathers some tokens randomly and computes their attention score. ```python # r1, r2, r are some random indices; Note: r1, r2, r3 are different for each row 👇 Q[1] x [Q[r1], Q[r2], ......, Q[r]] . . . Q[n-2] x [Q[r1], Q[r2], ......, Q[r]] # leaving 0th & (n-1)th token since they are already global ``` **Note:** The current implementation further divides sequence into blocks & each notation is defined w.r.to block instead of tokens. Let's discuss this in more detail in the next section.
[ 0.04491748288273811, 0.03556923568248749, 0.02483449876308441, 0.0040784310549497604, 0.01141048688441515, 0.04483327642083168, -0.0174101535230875, 0.056551553308963776, -0.054694533348083496, 0.010963757522404194, -0.08976966142654419, 0.00009860817226581275, -0.0486932136118412, 0.02353730984032154, 0.0022672617342323065, 0.10732882469892502, 0.06346836686134338, 0.012446447275578976, 0.013951919972896576, -0.03215012326836586, 0.07926074415445328, -0.018388886004686356, 0.07927900552749634, -0.06084809824824333, -0.016354253515601158, 0.010939665138721466, 0.009202711284160614, -0.011570549570024014, -0.03505714237689972, 0.008918780833482742, -0.12777718901634216, 0.04087982699275017, 0.047608911991119385, -0.019466804340481758, 0.03311909735202789, -0.036528561264276505, -0.14012494683265686, 0.045299313962459564, 0.041837725788354874, -0.04374128207564354, -0.005386628210544586, -0.0408998504281044, -0.08998818695545197, 0.05125714838504791, -0.09531847387552261, -0.055966634303331375, -0.16035020351409912, 0.07388144731521606, -0.027791788801550865, -0.040271975100040436, -0.052678268402814865, 0.012418652884662151, -0.03896773234009743, 0.02848437801003456, 0.009184518828988075, -0.03650804981589317, -0.0191253162920475, -0.004460065625607967, 0.07579412311315536, 0.001914509921334684, 0.038350630551576614, -0.008395811542868614, 0.026955414563417435, 0.04700198397040367, 0.05275579169392586, -0.006025081500411034, 0.06317820399999619, 0.02507494017481804, 0.004430809058248997, 0.014540751464664936, 0.032818231731653214, -0.019572511315345764, -0.033331580460071564, 0.027219727635383606, -0.02669067494571209, -0.04101453721523285, 0.020190590992569923, 0.03579923138022423, 0.005326063837856054, 0.060492902994155884, 0.06557108461856842, 0.002749475184828043, 0.08748843520879745, 0.05262836068868637, 0.01402291189879179, -0.00023090705508366227, 0.014104094356298447, -0.06815876811742783, -0.05536031350493431, -0.04034946858882904, -0.06135204806923866, -0.1120193600654602, 0.004615009296685457, -0.008441868238151073, -0.003490063827484846, -0.05105455964803696, 0.014366411603987217, -0.03553241118788719, -0.056960489600896835, -0.019359391182661057, 0.032545603811740875, -0.0551079697906971, 0.09958221763372421, -0.024544628337025642, -0.052097808569669724, 0.0704907551407814, 0.04334131255745888, -0.06925526261329651, -0.06817785650491714, 0.0066026546992361546, -0.028366636484861374, 0.02586141973733902, -0.00835791602730751, 0.02803162857890129, -0.014248223975300789, -0.001728438655845821, -0.06340990960597992, 0.024836350232362747, -0.021026739850640297, 0.007140693254768848, -0.0611494742333889, 0.02262473851442337, 0.12510018050670624, -0.007165988441556692, -0.004032628145068884, 0.017574382945895195, 0.006785535253584385, 0.04336315020918846, -0.018786679953336716, -0.052122194319963455, 0.043676555156707764, 0.046521008014678955, 0.0255260169506073, 0.06226830556988716, -0.016664577648043633, -0.02786320261657238, -0.014390113763511181, -0.0058020600117743015, 0.051461465656757355, -0.03652752563357353, -0.01951320841908455, -0.031836628913879395, -0.02641543745994568, 0.00840323232114315, -0.0009111671824939549, 0.02596435323357582, -0.08856842666864395, -0.02480950392782688, 0.044154610484838486, 0.03150317445397377, -0.00402730330824852, 0.04509902000427246, -0.05805671960115433, -0.04807431623339653, -0.0075506605207920074, 0.041426751762628555, -0.007240473758429289, -0.049919456243515015, -0.022180840373039246, 0.010213960893452168, 0.007607797160744667, 0.06993118673563004, -0.05644678324460983, 0.03128823637962341, 0.04866090416908264, -0.020694410428404808, 0.05297303944826126, 0.06611234694719315, 0.016812743619084358, 0.03525938093662262, 0.009350701235234737, 0.001895722933113575, 0.031691666692495346, -0.021889718249440193, -0.030437473207712173, 0.03419516608119011, 0.022493015974760056, 0.023887382820248604, 0.023099862039089203, 0.02038762904703617, -0.05406971648335457, -0.06041407585144043, -0.028728757053613663, 0.016329994425177574, -0.0016724334564059973, -0.05698293820023537, 0.06458980590105057, 0.002143447520211339, -0.03278183192014694, 0.02928983047604561, -0.06223726272583008, 0.04404270276427269, 0.034477028995752335, -0.01901036500930786, 0.06838691234588623, -0.09534106403589249, -0.016713427379727364, 0.05027972161769867, 0.0443473756313324, 0.05602686479687691, -0.03146348148584366, 0.020902983844280243, -0.019084522500634193, -0.054574981331825256, -0.024049006402492523, -0.010750281624495983, -0.01748635433614254, -0.06853380054235458, 0.023203391581773758, 0.024618089199066162, -0.03502168878912926, -0.0671374574303627, -0.04088456556200981, -0.06837959587574005, -0.0025836408603936434, 0.03361310437321663, 0.04306589439511299, 0.021544184535741806, -0.034513525664806366, -0.006572345271706581, 0.19845923781394958, 0.0031791068613529205, 0.04352565109729767, 0.010598205029964447, -0.05607602000236511, 0.03277195617556572, 0.02930227480828762, 0.0267067588865757, 0.08917193114757538, -0.05311096832156181, -0.008113455958664417, 0.01308450847864151, 0.05976623669266701, 0.002399616176262498, -0.06785993278026581, 0.003110940335318446, 0.02163398079574108, 0.0914379134774208, -0.005929502658545971, -0.07977703958749771, 0.023905010893940926, 0.0024136798456311226, -0.03626865893602371, 0.04399976506829262, 0.025178739801049232, 0.003814627882093191, 0.03388174623250961, -0.06138073280453682, -0.06979812681674957, -0.029104040935635567, -0.058434367179870605, 0.007423786446452141, 0.011004719883203506, -0.04481753334403038, 0.022502955049276352, 0.009186026640236378, 0.01277720183134079, -0.024049537256360054, 0.018879787996411324, -0.013768045231699944, 0.0277402400970459, 0.016706589609384537, -0.026137597858905792, -0.035361118614673615, -0.030152732506394386, -0.02109162136912346, 0.02769169770181179, 0.002114674774929881, 0.012994430027902126, 0.018561825156211853, 0.015151981264352798, 0.019751252606511116, -0.007789246737957001, 0.009413794614374638, -0.025223972275853157, 0.02107161469757557, 0.01430116780102253, -0.06117461249232292, -0.020113499835133553, -0.0555795282125473, -0.028690164908766747, -0.028456522151827812, 0.04690901190042496, 0.021459493786096573, 0.012820102274417877, 0.0070112054236233234, 0.02617962285876274, 0.043347857892513275, -0.03382537141442299, -0.0121961310505867, -0.0006139460019767284, 0.025968989357352257, 0.010899853892624378, -0.0074725584127008915, 0.00395727576687932, 0.02310861460864544, -0.052238982170820236, 0.025346606969833374, -0.0253301914781332, -0.005535774398595095, 0.0034115787129849195, 0.0445583276450634, -0.016885986551642418, -0.015768103301525116, -0.02635100670158863, 0.009017479605972767, -0.025141535326838493, 0.05585845559835434, -0.09623488783836365, -0.026422744616866112, 0.0215065386146307, 0.014875601977109909, -0.01206145528703928, -0.01901785470545292, 0.08245621621608734, 0.03543255850672722, -0.01241055503487587, 0.009775450453162193, 0.01670781709253788, -0.011342283338308334, -0.008634824305772781, 0.016523977741599083, 0.008672836236655712, 0.01518678292632103, 0.01367996260523796, 0.009272092022001743, 0.040771957486867905, 0.0017150683561339974, 0.03786458820104599, 0.05408918857574463, -0.03315326198935509, -0.03364981338381767, -0.010656790807843208, 0.004008916672319174, 0.02078293263912201, 0.036308009177446365, 0.013788111507892609, -0.004395296331495047, -0.03215169906616211, -0.0017872629687190056, 0.03373479098081589, 0.005751295480877161, -0.04755431413650513, -0.012057830579578876, 0.054137665778398514, -0.0257852915674448, 0.016193879768252373, 0.04044739902019501, -0.0009568415698595345, -0.010537768714129925, 0.00827840156853199, -0.004527631215751171, 0.06344512104988098, -0.010507836006581783, -0.012149120680987835, -0.0038988736923784018, -0.0009147183736786246, -0.0650089681148529, -0.027276795357465744, -0.04444542154669762, 0.0037405742332339287, 0.015562162734568119, -0.017583465203642845, -0.012281076051294804, -0.018341626971960068, 0.03463529422879219, 0.02398870140314102, -0.012846412137150764, -0.03771775960922241, -0.01269303634762764, 0.004022375680506229, -0.00899637769907713, -0.048942822962999344, 0.046946458518505096, 0.026381293311715126, 0.02518175169825554, -0.027506807819008827, 0.029339544475078583, 0.009140524081885815, 0.01765575259923935, 0.03578905016183853, 0.004933860152959824, -0.04746035486459732, -0.0040040817111730576, -0.027805157005786896, 0.0018932884559035301, 0.06374699622392654, 0.021450988948345184, -0.03195302560925484, -0.003623413620516658, -0.005939333233982325, 0.023597296327352524, -0.004729444161057472, -0.037302132695913315, 0.024731198325753212, -0.019526349380612373, 0.012047779746353626, 0.002177612157538533, -0.009377583861351013, -0.03459794819355011, 0.018820542842149734, 0.01798684149980545, -0.010165444575250149, 0.033202577382326126, 0.014628584496676922, 0.007209946401417255, 0.028403811156749725, -0.00766801880672574, 0.0318814218044281, -0.011763655580580235, -0.014345906674861908, -0.004546844866126776, -0.02789118140935898, -0.013803080655634403, -0.070777028799057, -0.020883282646536827, 0.00932727474719286, -0.011925280094146729, 0.005630858242511749, -0.0035415454767644405, 0.010541344061493874, -0.005128420423716307, 0.02018083445727825, 0.015953894704580307, 0.003768322290852666, -0.028183508664369583, -0.007824957370758057, -0.042757052928209305, -0.07798811793327332, 0.015377025119960308, 0.01146103534847498, -0.014901358634233475, 0.016781257465481758, -0.026440666988492012, 0.06195063516497612, -0.04101528599858284, -0.0037423090543597937, -0.01654736138880253, -0.029883984476327896, -0.001188830123282969, -0.014010630548000336, 0.005612354725599289, 0.018616000190377235, 0.020193636417388916, -0.012074027210474014, 0.0036529137287288904, 0.045564036816358566, -0.061498794704675674, -0.026216069236397743, -0.048476442694664, 0.04657909274101257, -0.019864780828356743, 0.00393955921754241, 0.009642343036830425, -0.03369876369833946, -0.0030725912656635046, -0.04393595829606056, 0.004686856176704168, 0.035225410014390945, -0.016896838322281837, -0.005610992666333914, 0.022350672632455826, 0.007623755838721991, -0.03568475693464279, 0.021643102169036865, -0.01348008681088686, 0.01734825409948826, 0.05615270137786865, 0.005011118482798338, -0.018708476796746254, -0.04297763109207153, -0.004076134879142046, 0.018204493448138237, -0.020086918026208878, -0.013142998330295086, -0.057972002774477005, 0.003717284882441163, 0.011331435292959213, 0.013641457073390484, 0.0077939871698617935, -0.016925832256674767, -0.01506487000733614, 0.01767747662961483, 0.015546659007668495, 0.010903935879468918, 0.04757818579673767, 0.0014184860046952963, -0.011751595884561539, -0.04751183092594147, 0.025097131729125977, -0.00009668196435086429, -0.0014705507783219218, 0.05358729511499405, 0.03617369011044502, 0.03181690350174904, 0.0285831019282341, -0.01770815998315811, 0.045629218220710754, 0.011801058426499367, 0.034787751734256744, -0.01202867180109024, -0.01822790317237377, 0.03403038531541824, 0.011741905473172665, -0.013368825428187847, -0.00495050847530365, -0.06075124070048332, -0.03422226384282112, 0.025716129690408707, 0.017115898430347443, 0.01363594550639391, 0.011616244912147522, 0.04096907377243042, 0.025275982916355133, -0.03692399337887764, -0.009403593838214874, -0.000001266708864022803, -0.005532198119908571, 0.010605214163661003, -0.0184745192527771, -0.04734416678547859, -0.012513597495853901, -0.007964488118886948, -0.02186131849884987, -0.035676728934049606, -0.026146618649363518, 0.00143055256921798, 0.052186015993356705, -0.015631094574928284, 0.0036716449540108442, -0.03348814323544502, 0.001786013483069837, 0.010111210867762566, -0.023628119379281998, -0.03679492697119713, 0.03629671037197113, 0.006591981276869774, 0.04803575947880745, 0.03761978819966316, 0.011021006852388382, 0.024660557508468628, -0.0159698948264122, -0.006992752198129892, -0.035811617970466614, -0.053928524255752563, 0.05321309342980385, 0.047558609396219254, 0.016156218945980072, 0.004754126071929932, 0.01123151183128357, -0.06686285883188248, 0.016133740544319153, -0.04954249784350395, -0.002857564017176628, 0.07806754857301712, -0.025627335533499718, 0.01958369091153145, -0.023301180452108383, -0.016249066218733788, 0.02913838066160679, -0.02171032316982746, 0.04319113865494728, 0.007223628461360931, 0.0352230966091156, 0.05296808108687401, -0.05058721825480461, 0.05287999287247658, 0.012043246068060398, -0.014639327302575111, 0.011404331773519516, 0.04357784613966942, 0.006969471927732229, -0.01913178339600563, 0.05603151023387909, 0.04903006553649902, -0.0194806307554245, 0.02782130427658558, 0.023129215463995934, 0.029964422807097435, 0.010129119269549847, -0.016254642978310585, 0.013603447005152702, 0.002955528674647212, 0.0025530403945595026, -0.056237827986478806, 0.042818792164325714, 0.0026160557754337788, 0.06305624544620514, -0.005515128839761019, 0.03178378939628601, 0.02554897964000702, 0.046048980206251144, 0.04701003432273865, -0.00968655664473772, 0.020306719467043877, 0.04588797688484192, 0.022505365312099457, -0.04339010640978813, 0.02690521441400051, 0.012909112498164177, -0.02446155622601509, -0.0019768080674111843, 0.0011907563311979175, 0.03106338158249855, 0.030928753316402435, -0.0010053843725472689, 0.03608522191643715, -0.029101187363266945, 0.00549247395247221, -0.0025134473107755184, 0.03430617228150368, 0.025749824941158295, 0.0017070092726498842, 0.0076288701966404915, 0.014420967549085617, 0.02184547483921051, 0.033337004482746124, -0.01890568621456623, 0.005029507912695408, 0.03769674524664879, 0.027572136372327805, 0.01655716821551323, 0.02435857243835926, -0.02882859855890274, 0.008906963281333447, -0.05740957707166672, -0.049941275268793106, 0.017737193033099174, 0.019121505320072174, 0.008542475290596485, 0.00584338279440999, -0.01394373644143343, -0.02111334353685379, 0.009045209735631943, -0.03193000704050064, -0.041755642741918564, -0.0019429527455940843, -0.02110782451927662, -0.0022633590269833803, 0.0382365919649601, 0.014494651928544044, -0.05661158636212349, -0.030539924278855324, 0.01638086326420307, 0.02223927713930607, -0.00037271485780365765, -0.04544074088335037, -0.05632428079843521, -0.04851676523685455, 0.01576254516839981, -0.03213337063789368, 0.03506257012486458, 0.0016742161242291331, -0.0032858585473150015, 0.03075491450726986, 0.006412932183593512, -0.06726177781820297, 0.07431230694055557, -0.010533894412219524, 0.0471554659307003, -0.04639894887804985, 0.003289246466010809, -0.005766385234892368, -0.0025922053027898073, 0.004048612434417009, 0.011795797385275364, -0.03795740380883217, -0.0014996553072705865, 0.046963322907686234, 0.026699906215071678, 0.016484826803207397, -0.00020855155889876187, 0.024690693244338036, 0.01676708273589611, -0.03582758456468582, -0.02751435525715351, -0.0008648972143419087, 0.0381433367729187, -0.027411889284849167, -0.017471909523010254, -0.030656397342681885, -0.039555665105581284, -0.04123054817318916, 0.017653431743383408, 0.022015802562236786, 0.023468120023608208, -0.01998319663107395, -0.005459052976220846, 0.021474536508321762, 0.04169836267828941, 0.03612721338868141, 0.06161746382713318, -0.021506046876311302, 0.045332156121730804, -0.02930169366300106, 0.02211456187069416, -0.001036492525599897, 0.037175536155700684, -0.016490513458848, -0.004868028219789267, -0.004816571716219187, 0.011302861385047436, 0.03960235416889191, 0.021940583363175392, -0.04684970900416374, 0.058021530508995056, -0.017602717503905296, 0.004106083419173956, -0.016788342967629433, -0.028452616184949875, 0.051584165543317795, 0.012572284787893295, -0.0037078075110912323, 0.023403087630867958, -0.04270746186375618, -0.041618891060352325, 0.002786637283861637, -0.01789083518087864, 0.011330601759254932, -0.001488215522840619, -0.003397019812837243, -0.041185420006513596, -0.007159416563808918, -0.07271654158830643, -0.07592974603176117, 0.03954536095261574, 0.06291988492012024, -0.025816721841692924, -0.01149802841246128, 0.00397035526111722, 0.01599232107400894, -0.030278855934739113, 0.03590498864650726, 0.013815668411552906, 0.009980512782931328, -0.016389476135373116, 0.016856005415320396, -0.023030661046504974, -0.023496927693486214, -0.01364405918866396, 0.004319133702665567, 0.028404660522937775, 0.02301318757236004, -0.018680235370993614, 0.021255308762192726, 0.05248657241463661, 0.030732164159417152, 0.03422548249363899, -0.034297578036785126, -0.05219873785972595, 0.007139778696000576, -0.012017075903713703, -0.020831618458032608, -0.007030804175883532, -0.017700498923659325, -0.004070096183568239, -0.019938699901103973, 0.011900568380951881, 0.02981075644493103, 0.011367850936949253, -0.03392133116722107, 0.0005296856979839504, -0.03299834206700325, 0.06572635471820831, 0.003807057160884142, 0.023208128288388252, 0.03878649324178696, 0.012053137645125389 ]
Distributed Training: Train BART/T5 for Summarization using 🤗 Transformers and Amazon SageMaker
philschmid
April 8, 2021
sagemaker-distributed-training-seq2seq
guide, partnerships, aws, nlp
https://huggingface.co/blog/sagemaker-distributed-training-seq2seq
Set up a development environment and install sagemaker After our SageMaker Notebook Instance is running we can select either 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 transformers "datasets[s3]" sagemaker --upgrade install git-lfs for model upload. bash !curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.rpm.sh | sudo bash !sudo yum install git-lfs -y !git lfs install 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() role = sagemaker.get_execution_role() print(f"IAM role arn used for running training: {role}") print(f"S3 bucket used for storing artifacts: {sess.default_bucket()}") --- # Choose 🤗 Transformers examples/ script The 🤗 Transformers repository contains several examples/scripts for fine-tuning models on tasks from language-modeling to token-classification. In our case, we are using the run_summarization.py from the seq2seq/ examples. Note: you can use this tutorial as-is to train your model on a different examples script. Since the HuggingFace Estimator has git support built-in, we can specify a training script stored in a GitHub repository as entry_point and source_dir. We are going to use the transformers 4.4.2 DLC which means we need to configure the v4.4.2 as the branch to pull the compatible example scripts. python #git_config = {'repo': 'https://github.com/huggingface/transformers.git','branch': 'v4.4.2'} # v4.4.2 is referring to the `transformers_version you use in the estimator. # used due an missing package in v4.4.2 git_config = {'repo': 'https://github.com/philschmid/transformers.git','branch': 'master'} # v4.4.2 is referring to the `transformers_version you use in the estimator. ---
[ 0.03232080116868019, -0.01069828774780035, -0.013063431717455387, 0.028199059888720512, 0.029115911573171616, 0.0601457916200161, -0.02797015570104122, 0.035297293215990067, -0.00027574715204536915, -0.021096481010317802, -0.03561415895819664, 0.06650081276893616, 0.0023674636613577604, 0.08125010132789612, -0.0008714265422895551, -0.06751000881195068, 0.008812908083200455, -0.008407754823565483, -0.014092501252889633, 0.016091488301753998, 0.03175051882863045, -0.021237347275018692, -0.05331405624747276, 0.03893676772713661, -0.006221350282430649, -0.04962117224931717, 0.05938240513205528, 0.015618915669620037, -0.01357404887676239, 0.03438931331038475, -0.09264272451400757, 0.012410295195877552, 0.009521513245999813, -0.05280127376317978, 0.014284801669418812, 0.05068180337548256, -0.10942495614290237, 0.047215722501277924, 0.10487847775220871, -0.03299855813384056, -0.0036554913967847824, -0.004640943370759487, -0.05087801814079285, 0.02346298098564148, -0.01736259087920189, -0.015595215372741222, -0.15384212136268616, 0.028721380978822708, 0.007173231802880764, -0.013758623972535133, -0.11612099409103394, 0.10614753514528275, 0.011898544616997242, -0.07410307228565216, 0.02129363641142845, 0.024392399936914444, 0.05145884305238724, -0.021112892776727676, -0.0045196968130767345, -0.011289811693131924, -0.005267095286399126, -0.05286790803074837, -0.062103237956762314, 0.01934260129928589, 0.01766328513622284, -0.029035203158855438, 0.023514391854405403, -0.034732699394226074, -0.05050281807780266, -0.06750395894050598, -0.00202585244551301, -0.062094610184431076, 0.006346250884234905, -0.012761925347149372, -0.04019841179251671, -0.10140088945627213, 0.0032454354222863913, 0.020515941083431244, 0.017952751368284225, 0.09636905044317245, -0.013918263837695122, 0.0065544783137738705, -0.03554832935333252, 0.03235263749957085, 0.044595323503017426, 0.0008753283182159066, 0.007599271833896637, -0.08184558153152466, -0.03828399255871773, 0.06010667607188225, 0.04416969045996666, -0.06887070834636688, -0.02843661792576313, 0.02886938489973545, 0.0351257398724556, -0.01199657004326582, 0.011114096269011497, -0.014984951354563236, -0.015570923686027527, -0.05569436401128769, 0.04083968698978424, -0.05528052896261215, -0.011560899205505848, -0.06937330216169357, 0.0036654616706073284, 0.05880386009812355, 0.005416391417384148, -0.1013740822672844, 0.020660707727074623, 0.0067922333255410194, 0.037162549793720245, -0.04613206535577774, -0.0005673608393408358, 0.09165731072425842, -0.09598170965909958, 0.08350661396980286, 0.006989032495766878, -0.06544192880392075, 0.0028299042023718357, -0.00947750173509121, 0.027270982041954994, 0.05622140318155289, 0.03771637752652168, 0.034268781542778015, -0.014353509992361069, 0.09223885834217072, -0.0008668747032061219, -0.02346336841583252, 0.013220639899373055, -0.08866535872220993, 0.06029963120818138, -0.05909337103366852, 0.08135038614273071, -0.0040523395873606205, 0.019691985100507736, -0.011926268227398396, -0.00162226939573884, -0.05900123342871666, 0.019994225353002548, 0.04038321599364281, 0.006572788115590811, 0.11224415898323059, 0.022612012922763824, 0.06675748527050018, 0.04988082870841026, 0.03294675797224045, -0.0446205660700798, 0.033168643712997437, -0.0022823491599410772, 0.05395806208252907, -0.07759862393140793, 0.045780811458826065, -0.06399664282798767, -0.07133188098669052, 0.0016966302646324039, 0.06258923560380936, -0.03894339129328728, 0.00011931813787668943, -0.02801881730556488, -0.03661753982305527, -0.02056751772761345, -0.0037623345851898193, -0.05347239598631859, -0.03327422961592674, -0.01762719452381134, -0.0699722170829773, 0.04125095158815384, -0.02165728434920311, 0.06548265367746353, -0.011468419805169106, 0.024677550420165062, -0.05280391126871109, 0.06063549593091011, -0.004146699793636799, 0.054621029645204544, 0.027097441256046295, 0.044582758098840714, 0.06330841779708862, 0.001496245851740241, -0.015530306845903397, -0.05718367546796799, 0.062434304505586624, -0.041180096566677094, 0.03542141988873482, 0.08998866379261017, -0.06592338532209396, 0.0632854625582695, 0.009825164452195168, 0.026897722855210304, 0.009757979772984982, -0.03490066155791283, -0.021971875801682472, 0.04979736730456352, 0.0028149415738880634, 0.03499066084623337, 0.01803186535835266, 0.013787884265184402, 0.1092323288321495, 0.02604341320693493, 0.043850842863321304, -0.01255876012146473, -0.00002742291871982161, 0.018727581948041916, 0.05598640814423561, -0.00816280860453844, 0.08635076135396957, -0.002349774120375514, -0.05041525140404701, 0.08705416321754456, -0.039203301072120667, -0.01276756264269352, -0.10661336779594421, 0.0451580211520195, -0.054614368826150894, -0.0013401935575529933, 0.006911077536642551, -0.0937516987323761, 0.0039324150420725346, 0.048641182482242584, 0.03867913782596588, 0.12531621754169464, -0.02768091857433319, 0.03238238766789436, -0.03596360236406326, 0.004111521411687136, 0.0007661862764507532, 0.07611177861690521, 0.06097722798585892, 0.04916033893823624, -0.0710790753364563, -0.02526138909161091, -0.05834747850894928, -0.025211339816451073, 0.0034769116900861263, -0.01652534119784832, -0.02149461768567562, -0.012728891335427761, -0.035835593938827515, 0.001369951292872429, 0.028339559212327003, 0.07899877429008484, 0.03626235947012901, 0.002392766997218132, -0.007694043219089508, 0.02253345586359501, -0.02267913892865181, 0.0569186732172966, -0.0025515796151012182, 0.0001959912187885493, -0.0699901208281517, -0.09801222383975983, 0.011209779419004917, 0.0036697075702250004, 0.011158582754433155, 0.022069239988923073, 0.03398331627249718, -0.007244054693728685, 0.007365039549767971, 0.04352564737200737, 0.07020096480846405, 0.004815001040697098, 0.0242561474442482, -0.01974714919924736, -0.025460200384259224, -0.015660930424928665, -0.027146022766828537, 0.004540872294455767, -0.04706776514649391, 0.00021690881112590432, -0.02732783369719982, 0.06455633044242859, -0.03089105151593685, 0.015619080513715744, 0.010223082266747952, -0.016392270103096962, 0.030153531581163406, 0.03865455463528633, 0.008582011796534061, -0.007474179845303297, 0.0010812686523422599, 0.02923506684601307, -0.0453927107155323, -0.017523236572742462, -0.0054268972016870975, 0.022240029647946358, 0.01791568100452423, 0.0029250076040625572, -0.02327338047325611, -0.020242860540747643, -0.0042716278694570065, 0.022283323109149933, 0.041891127824783325, 0.015885688364505768, -0.012432731688022614, 0.012879529967904091, 0.0044620283879339695, 0.005562958773225546, -0.02930694818496704, -0.0012184892548248172, 0.06680089235305786, -0.008506255224347115, -0.012892920523881912, 0.00465342728421092, -0.019797246903181076, -0.05253062769770622, -0.006275427993386984, 0.032576367259025574, -0.013649707660079002, -0.08614205569028854, -0.013495290651917458, -0.023455971851944923, 0.0063182334415614605, 0.028829503804445267, -0.02325284667313099, 0.09025640785694122, 0.008328278549015522, -0.01672319695353508, -0.0007829845999367535, -0.0291004478931427, 0.01572387106716633, -0.001642786432057619, -0.01852559484541416, -0.02819136530160904, 0.019581928849220276, -0.021718105301260948, -0.005568097811192274, 0.003563298610970378, 0.02370023913681507, -0.03980476036667824, 0.04512476548552513, 0.00014827171980869025, -0.030531495809555054, -0.005745519418269396, 0.017321111634373665, 0.03210625797510147, 0.04026154801249504, 0.018630381673574448, -0.050482090562582016, -0.007697241380810738, -0.014956045895814896, 0.009349620901048183, 0.008289076387882233, -0.037550732493400574, -0.018376709893345833, 0.020771078765392303, 0.039284609258174896, 0.044955186545848846, 0.018430447205901146, 0.02432996965944767, -0.02788321115076542, -0.001244490616954863, 0.006433094386011362, 0.050177354365587234, -0.001177638303488493, 0.0073187039233744144, -0.0021518387366086245, 0.021931514143943787, -0.0059670452028512955, -0.02387497015297413, 0.01901143230497837, 0.005107751116156578, 0.013627235777676105, -0.007209695875644684, 0.003363480558618903, 0.007768914103507996, 0.04789872467517853, 0.04181599244475365, -0.027856817469000816, -0.039553504437208176, 0.02128295786678791, -0.012428009882569313, -0.02106599323451519, -0.004776209592819214, 0.034484922885894775, 0.02474442683160305, -0.0015390783082693815, -0.0007188818417489529, 0.012821214273571968, -0.011004081927239895, 0.03835240751504898, -0.008133160881698132, 0.012490072287619114, -0.033458199352025986, -0.016595853492617607, -0.02138654701411724, -0.04106483235955238, 0.04064735397696495, 0.037846796214580536, 0.013625633902847767, -0.004413300659507513, -0.0009089686791412532, -0.03908427059650421, 0.010005789808928967, 0.013570723123848438, 0.018469225615262985, -0.057948507368564606, 0.07536986470222473, 0.05895347148180008, 0.027623530477285385, -0.04098382592201233, 0.030618995428085327, -0.04125513508915901, -0.0006257439963519573, -0.03225310146808624, 0.026080945506691933, -0.014261504635214806, -0.03309154137969017, 0.008276283740997314, 0.008892109617590904, -0.0354611836373806, 0.006984639912843704, -0.01955486461520195, -0.02262921817600727, 0.016018452122807503, -0.04061322659254074, -0.039060063660144806, -0.04046371951699257, 0.002320557599887252, 0.036342963576316833, -0.003101648762822151, -0.001537258387543261, -0.03692607581615448, 0.023257320746779442, 0.06103743612766266, 0.0074988179840147495, -0.03852071985602379, -0.0014972011558711529, 0.082240030169487, -0.036331042647361755, -0.005770890973508358, -0.007221676409244537, -0.03361686319112778, -0.011218562722206116, -0.007407620083540678, 0.024460844695568085, 0.06287980079650879, -0.0461752787232399, -0.03807907551527023, -0.014793286100029945, -0.01747901365160942, 0.03399164229631424, -0.0010362151078879833, 0.018161766231060028, 0.01979922130703926, 0.0014126196037977934, 0.009035334922373295, -0.009708220139145851, 0.014604463241994381, -0.042409032583236694, 0.022025803104043007, 0.058894384652376175, -0.04521797597408295, 0.010014066472649574, 0.02397465705871582, -0.05650187283754349, -0.0069863987155258656, -0.04596439376473427, 0.03793403133749962, 0.023169981315732002, 0.009171928279101849, -0.0244767889380455, 0.021587390452623367, 0.030575156211853027, -0.012657889164984226, -0.027132609859108925, 0.007105558644980192, 0.037562839686870575, 0.06964007019996643, -0.025736304000020027, 0.0009993202984333038, -0.0023550589103251696, -0.00487667229026556, 0.029976479709148407, 0.019988147541880608, -0.03190062195062637, -0.039355456829071045, -0.011766561307013035, 0.011545291170477867, -0.022175371646881104, -0.03081858716905117, 0.0020212822128087282, -0.04288777709007263, -0.0006241978844627738, 0.045656703412532806, 0.056554459035396576, 0.016373218968510628, -0.03784946724772453, 0.012567481957376003, -0.006892178673297167, -0.03033577837049961, -0.029517685994505882, -0.034841157495975494, -0.025096045807003975, 0.004793175496160984, 0.06172901764512062, 0.044451937079429626, 0.001680611982010305, 0.02356792613863945, -0.0007052571745589375, -0.011423136107623577, 0.05893987789750099, -0.03679720684885979, -0.020649781450629234, -0.00940192025154829, -0.0012672253651544452, 0.014420047402381897, -0.025994133204221725, -0.03599924594163895, 0.021554866805672646, 0.05194418877363205, -0.043257445096969604, -0.04707473888993263, 0.054921142756938934, -0.015506284311413765, -0.021610980853438377, 0.005942199844866991, 0.015190767124295235, -0.006366476882249117, 0.012262132950127125, -0.0006594877922907472, 0.009484425187110901, -0.02133140340447426, -0.009354504756629467, -0.0362652987241745, -0.0002401676756562665, 0.03900936245918274, 0.021020865067839622, 0.008476020768284798, -0.02465946227312088, -0.026321981102228165, 0.030915403738617897, -0.0062975334003567696, -0.0034609579015523195, -0.046290796250104904, -0.012781322933733463, -0.0014288299717009068, -0.008857384324073792, 0.009332108311355114, 0.0318138562142849, 0.031116126105189323, -0.014813398942351341, -0.011094902642071247, -0.0003539346798788756, -0.0326973982155323, 0.0055176736786961555, 0.02526056207716465, 0.013707096688449383, -0.0392623096704483, -0.020212702453136444, -0.02826598472893238, -0.02352485992014408, -0.03346550837159157, -0.047571782022714615, 0.03328138589859009, 0.05787251144647598, 0.009070482105016708, 0.026928365230560303, 0.0017807846888899803, 0.008734629489481449, 0.03197968378663063, 0.05128522217273712, -0.006529894191771746, 0.01357668824493885, 0.021719500422477722, -0.013158968649804592, 0.02260567806661129, 0.0011515660444274545, -0.012925426475703716, 0.00648060766980052, -0.04953647404909134, 0.010203525424003601, 0.01668117567896843, -0.013532049022614956, -0.016994498670101166, -0.012308351695537567, -0.034398745745420456, -0.001025865669362247, -0.012000912800431252, 0.04421796649694443, 0.03519181162118912, 0.019410748034715652, -0.025161217898130417, 0.008715588599443436, -0.0244732778519392, 0.012238885276019573, 0.038090430200099945, -0.04226880520582199, 0.016636328771710396, -0.008505776524543762, 0.04222998023033142, 0.020600685849785805, -0.007181941065937281, 0.006121520884335041, -0.006545423995703459, 0.0684521421790123, 0.0021070833317935467, 0.021681293845176697, 0.04692734032869339, -0.0023782639764249325, -0.03901360183954239, -0.03279973194003105, 0.0062314048409461975, -0.032091498374938965, -0.004520277958363295, 0.012596352957189083, 0.0063094161450862885, -0.005981238558888435, -0.011704877950251102, 0.06385618448257446, 0.08453930914402008, 0.06383249163627625, 0.02193455584347248, 0.020038006827235222, 0.057262059301137924, -0.009500556625425816, -0.016579020768404007, 0.03479617461562157, 0.011919839307665825, 0.030809033662080765, -0.01295413263142109, 0.0038862498477101326, 0.03723635897040367, -0.0023334668949246407, -0.009633412584662437, -0.036195527762174606, -0.015798049047589302, -0.013357044197618961, -0.0004973070463165641, 0.014923455193638802, -0.04910891503095627, -0.03828085958957672, -0.0064467196352779865, -0.017721254378557205, 0.05384677276015282, -0.010389242321252823, -0.0007336720009334385, -0.019863668829202652, -0.03526269644498825, -0.008573268540203571, 0.015868645161390305, 0.008722454309463501, -0.027119208127260208, -0.02315192110836506, 0.016524212434887886, -0.007619056385010481, -0.02178006060421467, -0.007070121355354786, -0.040633056312799454, -0.008136820048093796, -0.005702766589820385, -0.008447706699371338, 0.03957478329539299, -0.03050062619149685, -0.02862282656133175, -0.0018919633002951741, 0.026502175256609917, 0.010661979205906391, 0.03313211351633072, 0.02215353585779667, 0.024902161210775375, -0.026822658255696297, 0.03140323609113693, 0.01028900220990181, -0.05519653111696243, 0.04005327448248863, -0.04767680540680885, 0.0636424645781517, -0.0187765471637249, 0.0282707829028368, -0.002750461222603917, 0.014364495873451233, 0.025500424206256866, 0.017965903505682945, 0.00124654162209481, 0.027080174535512924, -0.04468599706888199, 0.04256443679332733, -0.00642664497718215, 0.0055795274674892426, 0.021834220737218857, -0.02249363251030445, 0.000033407341106794775, 0.01843496970832348, -0.011655514128506184, 0.026197800412774086, -0.00952733214944601, -0.001532517489977181, -0.0019134444883093238, 0.0310836024582386, 0.014534751884639263, 0.033150117844343185, 0.005782855208963156, 0.015229634009301662, 0.0017643427709117532, -0.02407696843147278, 0.013785814866423607, -0.043036215007305145, -0.017227323725819588, -0.05868665501475334, -0.07002606987953186, -0.03185409680008888, -0.01989963836967945, -0.0269829872995615, 0.03125577047467232, -0.04138608276844025, 0.006383486092090607, -0.020519884303212166, 0.0002671137044671923, -0.007287739310413599, 0.00016135470650624484, 0.049618981778621674, 0.05702587589621544, 0.025623543187975883, -0.019276374951004982, -0.04920449107885361, -0.004083818756043911, 0.018986646085977554, 0.01420037541538477, 0.04241417348384857, -0.009255903773009777, 0.0033551915548741817, 0.0039474498480558395, 0.03901217132806778, 0.014814014546573162, -0.028835270553827286, 0.03247810900211334, 0.001900809700600803, -0.012482930906116962, -0.025510823354125023, 0.005734877195209265, 0.02682349644601345, 0.01742834970355034, 0.05665392056107521, -0.02166314423084259, -0.01814224012196064, -0.0005926734884269536, 0.004547453951090574, -0.03955557569861412, -0.0076229083351790905, 0.00006176253373268992, -0.04738765209913254, -0.002548882970586419, -0.011662350036203861, -0.01593015529215336, -0.04591548815369606, -0.03221394866704941, -0.02282726764678955, -0.008885463699698448, -0.06519632041454315, -0.049666497856378555, 0.013017922639846802, 0.05078002065420151, -0.02874782122671604, -0.03191301226615906, -0.030461827293038368, -0.03852909058332443, -0.031303104013204575, 0.014612480998039246, -0.0044656856916844845, 0.011632570065557957, -0.05144588276743889, 0.0492713563144207, 0.0031902138143777847, 0.022104691714048386, 0.045040976256132126, -0.012308644130825996, -0.016666941344738007, -0.007431007456034422 ]
Distributed Training: Train BART/T5 for Summarization using 🤗 Transformers and Amazon SageMaker
philschmid
April 8, 2021
sagemaker-distributed-training-seq2seq
guide, partnerships, aws, nlp
https://huggingface.co/blog/sagemaker-distributed-training-seq2seq
Create a HuggingFace estimator and start training The last step before training is creating a HuggingFace estimator. The Estimator handles the end-to-end Amazon SageMaker training. We define which fine-tuning script should be used as entry_point, which instance_type should be used, and which hyperparameters are passed in. python from sagemaker.huggingface import HuggingFace # create the Estimator huggingface_estimator = HuggingFace( entry_point='run_summarization.py', # script source_dir='./examples/seq2seq', # relative path to example git_config=git_config, instance_type='ml.p3dn.24xlarge', instance_count=2, transformers_version='4.4.2', pytorch_version='1.6.0', py_version='py36', role=role, hyperparameters = hyperparameters, distribution = distribution ) As instance_type we are using ml.p3dn.24xlarge, which contains 8x NVIDIA A100 with an instance_count of 2. This means we are going to run training on 16 GPUs and a total_batch_size of 16*4=64. We are going to train a 400 Million Parameter model with a total_batch_size of 64, which is just wow. To start our training we call the .fit() method. python # starting the training job huggingface_estimator.fit() bash 2021-04-01 13:00:35 Starting - Starting the training job... 2021-04-01 13:01:03 Starting - Launching requested ML instancesProfilerReport-1617282031: InProgress 2021-04-01 13:02:23 Starting - Preparing the instances for training...... 2021-04-01 13:03:25 Downloading - Downloading input data... 2021-04-01 13:04:04 Training - Downloading the training image............... 2021-04-01 13:06:33 Training - Training image download completed. Training in progress .... .... 2021-04-01 13:16:47 Uploading - Uploading generated training model 2021-04-01 13:27:49 Completed - Training job completed Training seconds: 2882 Billable seconds: 2882 The training seconds are 2882 because they are multiplied by the number of instances. If we calculate 2882/2=1441 is it the duration from "Downloading the training image" to "Training job completed". Converted to real money, our training on 16 NVIDIA Tesla V100-GPU for a State-of-the-Art summarization model comes down to ~28$. ---
[ -0.01762048713862896, -0.010426284745335579, -0.023954147472977638, -0.02023361250758171, 0.01743641495704651, 0.05127540975809097, 0.05180414766073227, -0.03570687398314476, -0.06463740766048431, -0.033857397735118866, -0.062398944050073624, 0.06581853330135345, 0.016918104141950607, 0.10887473821640015, 0.010378466919064522, -0.0733862966299057, 0.012942424975335598, -0.021719839423894882, -0.021286338567733765, 0.007982251234352589, -0.007324547506868839, -0.01867857202887535, 0.0017239192966371775, 0.008856847882270813, -0.013666345737874508, -0.07595346868038177, 0.0319187305867672, 0.010137497447431087, 0.024683652445673943, 0.02152119390666485, -0.08634127676486969, 0.004012284800410271, -0.016379397362470627, -0.08195271342992783, 0.044744059443473816, 0.055817004293203354, -0.12679359316825867, 0.020547978579998016, 0.08516714721918106, 0.015369979664683342, -0.008182992227375507, -0.012235104106366634, -0.07460044324398041, 0.04058635234832764, -0.008101311512291431, -0.04833099991083145, -0.1585393100976944, 0.029305309057235718, -0.007588474545627832, -0.011214335449039936, -0.03359633684158325, 0.12183622270822525, -0.009415317326784134, -0.0035463024396449327, -0.021621376276016235, -0.014603063464164734, 0.04476267471909523, -0.0691688060760498, -0.03870445117354393, -0.020311452448368073, 0.019126184284687042, -0.007041191682219505, -0.037666015326976776, 0.06631555408239365, 0.004694856237620115, 0.019502289593219757, 0.0001446513633709401, -0.02496112510561943, -0.07017858326435089, -0.053146474063396454, -0.0012414263328537345, -0.06296317279338837, 0.01642439141869545, 0.035847343504428864, -0.08612105250358582, -0.06418216228485107, 0.060476016253232956, -0.02099979668855667, 0.04934926703572273, 0.0794961154460907, -0.057386402040719986, 0.01389862596988678, 0.01912185363471508, 0.011894584633409977, 0.03625445067882538, 0.06820396333932877, -0.008465375751256943, -0.061959829181432724, -0.036375608295202255, 0.05936836823821068, 0.03601336106657982, -0.07091442495584488, -0.005423033144325018, 0.03049645386636257, -0.006279670633375645, -0.018742647022008896, -0.013705783523619175, -0.003850051434710622, 0.03564601019024849, -0.0487472265958786, 0.041543539613485336, -0.07062405347824097, -0.006344722118228674, -0.08517953008413315, -0.04243255406618118, 0.09955359250307083, -0.006625338923186064, -0.08639000356197357, -0.019668877124786377, 0.008378086611628532, 0.020138906314969063, -0.00972474180161953, -0.03895969316363335, 0.1059829592704773, -0.09994839876890182, 0.035285428166389465, 0.008179753087460995, -0.05739381164312363, -0.006832747720181942, -0.0261880774050951, 0.006319181527942419, 0.09146299213171005, 0.026033001020550728, -0.004913596902042627, -0.0818648561835289, 0.0722392126917839, -0.009454026818275452, -0.0066308812238276005, 0.015458831563591957, -0.019818611443042755, 0.0236459132283926, -0.04441254958510399, 0.053997669368982315, -0.04086547717452049, 0.02971772290766239, -0.05827711522579193, -0.007335936184972525, -0.048730749636888504, 0.00018606138473842293, 0.0445939376950264, -0.02772020362317562, 0.10337678343057632, 0.02660118229687214, -0.008261437527835369, 0.03433873876929283, 0.028542624786496162, -0.027244143187999725, -0.005135511979460716, 0.03383222594857216, 0.07141454517841339, -0.14664970338344574, 0.08970051258802414, -0.02306767739355564, -0.05620679259300232, 0.07063259184360504, 0.026989106088876724, -0.01940196380019188, -0.03300873935222626, -0.0552184171974659, -0.013152023777365685, 0.036270882934331894, 0.021183138713240623, -0.04093614220619202, -0.011568817310035229, -0.006916979793459177, -0.01641995459794998, 0.026946421712636948, 0.051853034645318985, 0.028186989948153496, -0.04237419739365578, -0.008356036618351936, -0.005609045270830393, 0.004389503039419651, -0.011978833936154842, 0.04429037123918533, 0.029130933806300163, 0.03217035531997681, 0.05727409943938255, -0.022054841741919518, 0.009423432871699333, -0.055566318333148956, 0.04930909723043442, -0.02052369900047779, 0.04903080314397812, 0.07695970684289932, -0.10328724980354309, 0.0031559031922370195, -0.0038995137438178062, 0.013707377947866917, 0.02343679778277874, 0.012516074813902378, -0.017755446955561638, 0.05411354824900627, -0.01873045414686203, 0.06752023845911026, -0.020549481734633446, 0.0006135029252618551, 0.09356682002544403, 0.031012073159217834, 0.041813403367996216, 0.022467510774731636, -0.002596330363303423, 0.010912107303738594, 0.04966793581843376, -0.023227831348776817, 0.05075835809111595, -0.015181068331003189, -0.0358445942401886, 0.05297400429844856, 0.0006504734046757221, 0.0037514115683734417, -0.11452319473028183, 0.002051844960078597, -0.0814807340502739, 0.023993346840143204, -0.0006928677903488278, -0.014898899011313915, -0.0312986895442009, 0.01754148304462433, 0.019323870539665222, 0.14084964990615845, -0.015478798188269138, 0.0247349813580513, -0.05958367511630058, -0.04235753044486046, -0.011266568675637245, 0.07103601098060608, 0.060312822461128235, 0.040957044810056686, -0.08873577415943146, -0.01625547744333744, -0.060998495668172836, -0.007824672386050224, 0.04766427353024483, 0.006715630181133747, -0.06916007399559021, 0.014092427678406239, -0.030697226524353027, -0.02509949542582035, 0.00021038278646301478, 0.03486362844705582, 0.019599735736846924, 0.024257531389594078, -0.00189976766705513, 0.027085408568382263, -0.009690377861261368, 0.07073994725942612, -0.007980783469974995, -0.0573374442756176, -0.06644273549318314, -0.050913140177726746, 0.07149150222539902, 0.018048370257019997, -0.023851320147514343, -0.007854171097278595, 0.05576922744512558, -0.024564793333411217, -0.007865730673074722, -0.013237548060715199, 0.09302513301372528, 0.013369066640734673, 0.022158870473504066, -0.022069139406085014, 0.014954344369471073, -0.026563726365566254, -0.055055614560842514, -0.018835069611668587, -0.00908234529197216, -0.004048563074320555, -0.0027691887225955725, 0.04668530449271202, 0.004015276674181223, 0.0008841435774229467, 0.040420498698949814, 0.023142460733652115, -0.0017098045209422708, 0.05964883044362068, -0.01816304586827755, -0.018715213984251022, -0.014559516683220863, 0.016911227256059647, -0.01126097422093153, -0.02805756777524948, 0.04433707892894745, 0.007371268700808287, -0.002780902897939086, -0.010620995424687862, -0.01068129576742649, -0.03332028165459633, 0.017425909638404846, 0.02553536742925644, 0.05248626694083214, 0.04250822216272354, 0.015469511039555073, 0.007527345325797796, 0.04416067153215408, -0.0072687542997300625, -0.01799790747463703, 0.004793659318238497, 0.05667918175458908, -0.03626639395952225, 0.011962879449129105, -0.007857460528612137, -0.0001170217219623737, -0.046533044427633286, -0.0052665118128061295, 0.018511049449443817, 0.02150658331811428, -0.08364926278591156, -0.032203640788793564, -0.04199322685599327, -0.0025196766946464777, -0.013928296975791454, -0.00766601599752903, 0.04112643003463745, -0.020690202713012695, -0.01932215690612793, -0.013708013109862804, -0.00046336781815625727, 0.06412718445062637, -0.009789571166038513, 0.002898488426581025, -0.010725889354944229, 0.0014054876519367099, 0.007535882759839296, -0.009389758110046387, 0.012643714435398579, 0.038162246346473694, -0.028556669130921364, 0.03394291177392006, 0.017806293442845345, -0.029405774548649788, -0.009732269681990147, 0.0031559504568576813, 0.027889059856534004, -0.004576875362545252, 0.023450054228305817, -0.04267797991633415, -0.003423689166083932, -0.023687021806836128, -0.011511805467307568, 0.002595330821350217, -0.045612264424562454, -0.025322770699858665, 0.050824038684368134, 0.019178787246346474, 0.013397214002907276, 0.011788205243647099, 0.009756355546414852, -0.02629275433719158, 0.00547273363918066, 0.001958015840500593, 0.04113670065999031, -0.01326707936823368, -0.003787016961723566, -0.01327106449753046, 0.003466611495241523, -0.0071247355081140995, 0.011050721630454063, 0.005432962439954281, 0.01593584567308426, 0.00973172951489687, -0.01078123226761818, 0.011323096230626106, 0.008434436284005642, 0.047481968998909, 0.04311173036694527, -0.02417895756661892, -0.06114532798528671, 0.024697506800293922, -0.02604111284017563, -0.03310195356607437, -0.0011515823425725102, 0.028767675161361694, 0.016056878492236137, -0.0075430492870509624, 0.005572784226387739, 0.020480670034885406, -0.021999185904860497, 0.013302553445100784, 0.001981745008379221, 0.013610906898975372, -0.06693832576274872, -0.0013906530803069472, -0.05335169658064842, -0.015089239925146103, 0.04739730432629585, 0.021003780886530876, -0.021027622744441032, 0.022183088585734367, -0.021882399916648865, -0.046354375779628754, 0.0280604287981987, 0.03301340714097023, 0.035126570612192154, -0.054417986422777176, 0.050195373594760895, 0.0543677918612957, -0.004725275095552206, -0.0281366053968668, 0.008554509840905666, 0.005941794719547033, 0.0004102255043108016, -0.006746478844434023, 0.004309421870857477, 0.014177919365465641, 0.0048021841794252396, -0.0008646655478514731, 0.023837290704250336, -0.026724981144070625, 0.009357546456158161, -0.009907586500048637, -0.0035626974422484636, 0.0008974269730970263, -0.03422745689749718, -0.04190104827284813, 0.024165987968444824, -0.005496895872056484, 0.01119549386203289, -0.03599673882126808, -0.014646339230239391, -0.02799990586936474, 0.042207278311252594, 0.053706299513578415, 0.012107298709452152, -0.008793031796813011, 0.006554804742336273, 0.05215785279870033, -0.02791650965809822, 0.03545517101883888, 0.005718962289392948, -0.028042325749993324, 0.04088194668292999, -0.008054434321820736, 0.022243613377213478, 0.04349387064576149, 0.01192623469978571, -0.0461006686091423, -0.028227079659700394, -0.003361790208145976, -0.016141435131430626, -0.007609175983816385, -0.0046595740132033825, 0.008093724958598614, -0.019105948507785797, -0.0014489737804979086, 0.01073402352631092, -0.006348238792270422, -0.01865331642329693, 0.04849877581000328, 0.006447110325098038, -0.0038546686992049217, 0.02438267506659031, 0.0296415314078331, -0.04211664944887161, -0.009001610800623894, -0.019869176670908928, 0.0400925949215889, -0.02075762301683426, 0.016383884474635124, -0.03162572532892227, 0.0005781415966339409, 0.02364880032837391, -0.01944989524781704, -0.00028618628857657313, 0.02658325433731079, 0.028384769335389137, 0.02852986752986908, -0.017874466255307198, 0.0051581598818302155, 0.001405569026246667, -0.004014821723103523, 0.012041077949106693, -0.00011845589324366301, -0.0250330101698637, -0.048996079713106155, -0.010684695094823837, 0.05386923998594284, 0.001613408443517983, -0.008875475265085697, 0.004495537374168634, -0.04775760695338249, 0.005761668551713228, 0.061539750546216965, 0.05342058464884758, 0.003657165914773941, -0.04946741461753845, 0.011228179559111595, 0.00828669685870409, -0.027952585369348526, -0.0075060417875647545, -0.05815402418375015, 0.00021345322602428496, -0.001439664512872696, 0.06891106069087982, 0.044976022094488144, 0.004435548093169928, 0.014362785965204239, 0.011052871122956276, -0.012016459368169308, 0.019225437194108963, -0.042359527200460434, -0.022145390510559082, -0.013895176351070404, 0.03372732549905777, 0.022224878892302513, -0.018649475648999214, -0.03179969638586044, 0.06778859347105026, 0.05249326676130295, -0.018108436837792397, -0.037765275686979294, 0.024264715611934662, 0.019709166139364243, -0.02430516667664051, -0.02724478580057621, 0.017273562029004097, -0.019176989793777466, 0.0015628038672730327, -0.01853039301931858, -0.009576946496963501, -0.012910503894090652, -0.012658309191465378, -0.016068004071712494, -0.00691253412514925, 0.06903855502605438, 0.011141377501189709, 0.027710067108273506, -0.022788411006331444, -0.012125423178076744, 0.02961157262325287, -0.042511895298957825, -0.0037436627317219973, -0.05659322068095207, -0.010871697217226028, -0.009837891906499863, -0.030547071248292923, 0.03825370594859123, -0.015703508630394936, -0.002941546496003866, -0.02790779620409012, -0.0000811124118627049, 0.02948134019970894, -0.015086529776453972, -0.014616155065596104, 0.07381237298250198, 0.02766401134431362, -0.008859371766448021, -0.01814083941280842, -0.026247462257742882, 0.015342841856181622, -0.016429800540208817, -0.06096800044178963, 0.029571427032351494, 0.060373418033123016, 0.012064515613019466, 0.021046873182058334, -0.023365715518593788, 0.022785451263189316, 0.027347508817911148, 0.007254032418131828, 0.016751546412706375, 0.0097234807908535, 0.024499211460351944, -0.036706890910863876, 0.015276200138032436, -0.003413630649447441, 0.016729900613427162, -0.0009284366387873888, -0.0552382692694664, 0.028443237766623497, 0.04123980179429054, -0.039918527007102966, 0.012561401352286339, -0.021127212792634964, -0.02714291773736477, 0.016071181744337082, -0.014203283935785294, 0.044451646506786346, 0.017085645347833633, -0.025307608768343925, 0.013581347651779652, 0.02417551726102829, -0.009074320085346699, 0.023201487958431244, 0.058717358857393265, -0.02316725067794323, 0.013318656012415886, -0.0024444786831736565, 0.017925703898072243, 0.02390742115676403, 0.004373546224087477, 0.005199677310883999, -0.0003520442987792194, 0.08870779722929001, 0.020289918407797813, 0.01157436054199934, 0.08436072617769241, -0.0222783163189888, -0.012286677956581116, -0.023735618218779564, -0.01875709369778633, -0.022355640307068825, -0.007150968071073294, 0.03327041491866112, 0.004688031505793333, 0.0006323899142444134, -0.011410694569349289, 0.05205089971423149, 0.07592359185218811, 0.03633609041571617, 0.029127316549420357, 0.014337325468659401, 0.05217929184436798, -0.010769516229629517, -0.03520125895738602, 0.055921800434589386, 0.01065827440470457, -0.015197630040347576, 0.025409337133169174, 0.043019842356443405, 0.006155974697321653, 0.01843431033194065, -0.009770020842552185, -0.010104065760970116, -0.015695845708251, -0.021797673776745796, -0.0014103212160989642, 0.011426185257732868, -0.031121009960770607, -0.02035207860171795, 0.018299689516425133, -0.029708726331591606, 0.07083509117364883, -0.03139994665980339, 0.008348139002919197, -0.009752696380019188, -0.0047011710703372955, -0.003072728170081973, 0.010433398187160492, 0.0038314382545650005, -0.03649190440773964, -0.000989384832791984, 0.012496018782258034, 0.003941945731639862, -0.0012168330140411854, -0.028959233313798904, -0.03583934158086777, -0.024677956476807594, -0.017041055485606194, -0.009703585878014565, 0.02577347867190838, -0.04689153656363487, -0.015495792962610722, 0.011780794709920883, -0.00005705796502297744, 0.021216152235865593, 0.047731004655361176, 0.05392059311270714, 0.02179289609193802, -0.01794273406267166, -0.0036319931969046593, -0.01868256740272045, -0.016208590939641, 0.04566258192062378, -0.030015038326382637, 0.030881695449352264, -0.007479880470782518, 0.033187370747327805, -0.008131181821227074, 0.007673361338675022, -0.009718633256852627, -0.03604792430996895, -0.012334953062236309, -0.0284576453268528, -0.006739572621881962, 0.03880537673830986, -0.00928652472794056, 0.0016122900415211916, 0.04474307969212532, -0.007292186841368675, -0.01020786166191101, 0.019923193380236626, -0.0171674694865942, 0.038660842925310135, -0.04306882619857788, -0.010148406028747559, 0.0324413925409317, 0.024647295475006104, 0.006412243936210871, 0.007747243158519268, 0.027483712881803513, 0.004412360489368439, 0.026842426508665085, -0.01667575165629387, -0.013235614635050297, -0.045800644904375076, -0.03113524802029133, -0.04767217859625816, -0.06431572884321213, -0.03201952576637268, -0.014393113553524017, -0.06302323192358017, 0.0407109297811985, -0.029092054814100266, -0.01514708437025547, -0.04690958559513092, -0.0020177671685814857, -0.028799448162317276, -0.011369233019649982, 0.05236997827887535, 0.047860536724328995, 0.03425411134958267, 0.010770588181912899, -0.07626670598983765, 0.035770777612924576, -0.008755234070122242, 0.034234028309583664, 0.07717353105545044, 0.024818042293190956, -0.006927975453436375, -0.019365055486559868, 0.0060712965205311775, 0.034138500690460205, -0.04410538449883461, 0.023221038281917572, -0.014340165071189404, -0.013122287578880787, -0.017113730311393738, 0.008981114253401756, 0.0032913177274167538, 0.013823962770402431, 0.03340204060077667, -0.04504359886050224, -0.01571834459900856, -0.018334757536649704, 0.05096433311700821, -0.02087140642106533, 0.028554487973451614, -0.004246331285685301, -0.007011724170297384, 0.008845712058246136, -0.015477431938052177, 0.05560791492462158, -0.010524913668632507, -0.020256098359823227, -0.0069654881954193115, 0.023579560220241547, -0.07099852710962296, -0.03842620179057121, 0.04867269843816757, 0.03214249387383461, -0.007425155024975538, -0.03741728514432907, -0.015544894151389599, -0.02024577371776104, -0.008113299496471882, 0.03737425431609154, -0.0084279989823699, 0.010837690904736519, -0.015143693424761295, 0.011721491813659668, -0.00991485919803381, 0.032879263162612915, 0.025700774043798447, -0.014797859825193882, -0.01568998023867607, -0.004565088078379631 ]
Distributed Training: Train BART/T5 for Summarization using 🤗 Transformers and Amazon SageMaker
philschmid
April 8, 2021
sagemaker-distributed-training-seq2seq
guide, partnerships, aws, nlp
https://huggingface.co/blog/sagemaker-distributed-training-seq2seq
Usage from transformers import pipeline summarizer = pipeline("summarization", model="philschmid/{model_name}") conversation = '''Jeff: Can I train a 🤗 Transformers model on Amazon SageMaker? Philipp: Sure you can use the new Hugging Face Deep Learning Container. Jeff: ok. Jeff: and how can I get started? Jeff: where can I find documentation? Philipp: ok, ok you can find everything here. https://huggingface.co/blog/the-partnership-amazon-sagemaker-and-hugging-face ''' nlp(conversation)
[ -0.020066702738404274, -0.007804482709616423, -0.00934920646250248, -0.030818715691566467, 0.024362465366721153, 0.07064325362443924, 0.03363891690969467, 0.07898372411727905, -0.009092962369322777, -0.005685674957931042, -0.09585856646299362, 0.05732133612036705, -0.030625004321336746, 0.086750328540802, -0.020571252331137657, -0.030746327713131905, 0.030222740024328232, 0.037769775837659836, -0.02917683683335781, 0.060971323400735855, -0.018265584483742714, -0.07970722764730453, 0.03566671535372734, -0.012973370961844921, 0.028183476999402046, -0.05693123862147331, 0.026696886867284775, 0.008414694108068943, -0.06577791273593903, 0.09109416604042053, -0.07705123722553253, -0.0005082120769657195, 0.011573429219424725, -0.020374378189444542, 0.010032637976109982, 0.02599078044295311, -0.1352846473455429, 0.02908451110124588, 0.023208975791931152, -0.008214988745748997, -0.010168815962970257, 0.007002181839197874, -0.053222108632326126, -0.037471603602170944, -0.002444384852424264, -0.023539358749985695, -0.18751150369644165, 0.03934832289814949, -0.012210171669721603, -0.011050344444811344, -0.07972699403762817, 0.0997970923781395, -0.009281715378165245, -0.02069789171218872, 0.006897313520312309, 0.016624240204691887, -0.006868856027722359, -0.08936851471662521, -0.004793190397322178, -0.009989490732550621, -0.007748626638203859, 0.017025109380483627, -0.013088597916066647, 0.04728511720895767, 0.014355351217091084, 0.004326994996517897, -0.011945576407015324, -0.020286202430725098, -0.03980613872408867, -0.034310758113861084, 0.009320216253399849, -0.0490943118929863, -0.025594770908355713, -0.017269043251872063, -0.04925592616200447, -0.021808426827192307, 0.008716377429664135, 0.003852039109915495, 0.01384755503386259, 0.09324831515550613, -0.03306787088513374, 0.011374830268323421, 0.006832752376794815, 0.05857497826218605, 0.03534706309437752, 0.027814071625471115, 0.07190357893705368, -0.03763078898191452, -0.0972369834780693, 0.050806086510419846, -0.015965159982442856, -0.09722257405519485, -0.033332459628582, -0.029529733583331108, 0.0572364516556263, -0.010867014527320862, 0.015191847458481789, 0.012761237099766731, -0.037080325186252594, -0.023413365706801414, 0.0004598358937073499, -0.08189501613378525, 0.03786056116223335, -0.04668422415852547, -0.036368560045957565, 0.02891114354133606, 0.02676945924758911, -0.10226238518953323, 0.037645161151885986, -0.021012544631958008, 0.0440959669649601, -0.02250831201672554, 0.014211679808795452, 0.11257154494524002, -0.06569982320070267, 0.023554347455501556, 0.009443874470889568, -0.046829525381326675, -0.0092896968126297, 0.01651042513549328, 0.044788043946027756, 0.06251110881567001, 0.07380033284425735, 0.030004527419805527, -0.030971374362707138, 0.04368703439831734, -0.02113538607954979, -0.02751540206372738, 0.027032064273953438, 0.013416706584393978, 0.018241459503769875, -0.026693249121308327, 0.09468597918748856, 0.018819408491253853, -0.029620468616485596, -0.08591710031032562, 0.0622907318174839, -0.07750438898801804, 0.020228315144777298, 0.040768492966890335, 0.032799992710351944, 0.1082557737827301, 0.00823913048952818, 0.03084411285817623, 0.021630574017763138, 0.053310904651880264, -0.05749915540218353, 0.047785595059394836, 0.006673409603536129, 0.022594671696424484, -0.06379158794879913, 0.08300349861383438, -0.020508170127868652, -0.08529455959796906, -0.010235398076474667, 0.07377781718969345, -0.005333387292921543, -0.038042739033699036, -0.013331460766494274, -0.05583295598626137, 0.02420208230614662, 0.017920169979333878, -0.008552656508982182, -0.020608603954315186, 0.010490154847502708, -0.01701282151043415, 0.003937153145670891, -0.009345968253910542, 0.019967636093497276, -0.0238678976893425, 0.02425144799053669, -0.042128030210733414, 0.006684773601591587, -0.03795614466071129, 0.015886375680565834, 0.03873085603117943, 0.028779495507478714, 0.045377183705568314, -0.0025921850465238094, -0.03447995334863663, -0.059590548276901245, 0.07148142158985138, -0.005890537519007921, 0.011318688280880451, 0.08194106817245483, -0.05548124015331268, 0.04573911428451538, 0.01441126223653555, 0.017119592055678368, 0.002613101387396455, -0.009543688036501408, -0.018859155476093292, 0.034843284636735916, 0.042424287647008896, 0.04170820489525795, -0.031234847381711006, 0.009377190843224525, 0.08177272975444794, -0.012264656834304333, 0.06254950910806656, 0.03216955438256264, -0.019540324807167053, -0.028684770688414574, -0.02842463180422783, 0.021015731617808342, 0.0531739816069603, -0.018015550449490547, -0.0110455472022295, 0.04656499624252319, 0.013521518558263779, 0.037304848432540894, -0.10449188202619553, 0.048698678612709045, -0.09921884536743164, -0.003345606615766883, -0.08807855099439621, -0.07400166988372803, 0.02578549273312092, 0.05591951310634613, 0.05142401531338692, 0.10944059491157532, -0.05313641577959061, -0.007781727705150843, -0.0784459337592125, -0.045864228159189224, 0.04801764711737633, 0.0836426168680191, 0.05042974278330803, 0.028242506086826324, -0.05018831044435501, -0.04525400698184967, -0.008144566789269447, -0.018442315980792046, 0.05526812747120857, -0.04772130772471428, -0.07414480298757553, 0.012582406401634216, 0.019263947382569313, 0.02026662603020668, 0.011412890627980232, 0.06694512069225311, 0.02137068286538124, 0.025231633335351944, 0.016770992428064346, 0.010633144527673721, 0.035966966301202774, 0.05518671125173569, -0.028043601661920547, -0.010722564533352852, 0.02448565885424614, -0.07211918383836746, 0.04707002639770508, -0.004393581300973892, -0.06486517935991287, 0.03540950268507004, 0.05581309273838997, -0.02058486081659794, 0.007281182333827019, 0.0016990816220641136, 0.06228996068239212, -0.011335641145706177, 0.02068944275379181, -0.04998445510864258, -0.04002955183386803, -0.027692757546901703, -0.0418919138610363, -0.002183009870350361, 0.006294085644185543, 0.014619098976254463, 0.006024972070008516, 0.028007889166474342, -0.003083215095102787, 0.0004622475535143167, -0.006745848339051008, 0.02023426443338394, 0.027847997844219208, 0.03204147890210152, 0.0238965917378664, 0.007454236038029194, -0.02823030762374401, 0.011797955259680748, -0.01655229553580284, -0.003185433568432927, 0.06653996556997299, 0.012271986342966557, -0.014865115284919739, -0.01195941399782896, -0.035667940974235535, -0.009154547937214375, -0.009940932504832745, 0.015752900391817093, 0.03760705515742302, 0.039379049092531204, 0.007487926632165909, -0.021040452644228935, 0.03584453463554382, 0.017246466130018234, -0.01451968401670456, 0.005697636865079403, 0.04983872175216675, -0.02532796375453472, -0.023885361850261688, -0.0132803525775671, 0.018044721335172653, -0.006536813918501139, 0.013496438041329384, 0.005525438115000725, 0.0068805464543402195, -0.09094876050949097, -0.030966268852353096, -0.014159451238811016, -0.016572533175349236, 0.025664540007710457, -0.007658823858946562, 0.045415788888931274, -0.01420672982931137, -0.02359672263264656, 0.014999340288341045, -0.03319013491272926, 0.01138888020068407, 0.0048514786176383495, 0.006439974997192621, -0.0053236037492752075, -0.025590647011995316, -0.020892992615699768, 0.00406983494758606, 0.027431270107626915, 0.032509271055459976, -0.013981367461383343, 0.02282991074025631, 0.031497400254011154, -0.019158843904733658, 0.023179564625024796, -0.025938857346773148, 0.03232897073030472, -0.011330058798193932, 0.05460337921977043, -0.03076343424618244, 0.005808539222925901, -0.02124042436480522, -0.03329544886946678, 0.020037498325109482, -0.00823940895497799, -0.011591670103371143, -0.03296308219432831, -0.00980311818420887, 0.05841568484902382, 0.051959384232759476, 0.026436420157551765, -0.013728341087698936, -0.00012811586202587932, -0.042686983942985535, 0.03417286276817322, -0.023681320250034332, -0.017460452392697334, -0.010199257172644138, 0.02613971009850502, -0.02856440097093582, -0.020754331722855568, -0.03060184419155121, 0.013436288572847843, 0.0202078465372324, 0.012941941618919373, -0.013419671915471554, -0.006047015078365803, 0.020579634234309196, 0.026381442323327065, -0.004612254910171032, -0.06799804419279099, 0.025835314765572548, -0.045866258442401886, -0.026368996128439903, -0.029779020696878433, 0.07102541625499725, -0.023396681994199753, 0.017323317006230354, 0.05325808748602867, 0.013665422797203064, -0.014617553912103176, 0.026759089902043343, 0.01067929994314909, 0.012441251426935196, -0.05546700954437256, 0.046981219202280045, -0.009398157708346844, -0.04784625023603439, 0.025153519585728645, 0.022286588326096535, -0.052215080708265305, -0.014914284460246563, -0.02508646808564663, -0.01777263544499874, 0.009693079628050327, 0.028570620343089104, 0.043900489807128906, -0.055862728506326675, 0.035875774919986725, 0.020283345133066177, -0.0012610950507223606, -0.04397040605545044, 0.02405283972620964, -0.007816403172910213, -0.04387151822447777, -0.04019362851977348, 0.010981637984514236, -0.008511112071573734, -0.004998363554477692, 0.009052230976521969, 0.027771996334195137, -0.055717919021844864, -0.029436612501740456, 0.010258669964969158, -0.0033954561222344637, 0.002261355286464095, -0.04593139514327049, -0.040469247847795486, -0.02205268107354641, -0.03684883564710617, 0.026608547195792198, -0.021560531109571457, -0.0152245182543993, -0.013625020161271095, 0.015078279189765453, 0.06273600459098816, 0.03002612665295601, -0.01776452176272869, -0.012161771766841412, 0.04711055010557175, -0.03762580826878548, 0.012556496076285839, -0.019026948139071465, -0.009359297342598438, 0.026494445279240608, 0.0146303940564394, 0.061375297605991364, 0.05694146454334259, -0.026167266070842743, -0.023054398596286774, -0.004635538440197706, -0.006600744090974331, 0.017225356772542, 0.009264587424695492, 0.029032528400421143, 0.027303582057356834, -0.01794022135436535, 0.011733852326869965, -0.0363880917429924, -0.006207055877894163, -0.035328809171915054, -0.01033342070877552, 0.03612367436289787, -0.02127907983958721, 0.045513078570365906, -0.018158916383981705, -0.0556158646941185, -0.021491913124918938, -0.005583365447819233, 0.03365049138665199, 0.06099437177181244, 0.026933344081044197, -0.042734552174806595, 0.00544298579916358, 0.04210474342107773, -0.021075185388326645, -0.017424043267965317, 0.025233518332242966, 0.007178640458732843, 0.0694771260023117, -0.02931860089302063, 0.004762145224958658, -0.0021664404775947332, 0.047157928347587585, 0.04561580345034599, 0.02892383188009262, -0.024712832644581795, -0.06257805228233337, 0.0025912877172231674, 0.030884098261594772, -0.00015530924429185688, -0.007623022422194481, 0.01013467088341713, -0.0096206683665514, 0.005545289255678654, 0.05945802479982376, 0.05157482996582985, 0.025845855474472046, -0.03891349211335182, -0.005711675155907869, -0.017415355890989304, -0.042379673570394516, -0.009893441572785378, -0.010008653625845909, 0.009199433960020542, -0.025577053427696228, 0.046871986240148544, 0.07063067704439163, -0.025146177038550377, 0.049658168107271194, -0.02827715128660202, -0.04914795234799385, -0.02248380333185196, -0.025185242295265198, -0.021632857620716095, -0.02866331674158573, -0.005479170009493828, 0.005673040635883808, 0.0016553904861211777, 0.020055754110217094, 0.04933574050664902, 0.07294443994760513, -0.007657175417989492, -0.031994469463825226, 0.012302353046834469, -0.009256836026906967, -0.01737850345671177, -0.002427566098049283, 0.003242563921958208, -0.0524444542825222, 0.003734813304618001, -0.018726302310824394, 0.006541765760630369, -0.006509303580969572, 0.011135414242744446, -0.002912091324105859, 0.007219365797936916, 0.0033065478783100843, 0.040700580924749374, 0.02571123279631138, -0.020200587809085846, -0.01653207466006279, 0.0020270966924726963, 0.023379191756248474, 0.05019504204392433, -0.02585591748356819, 0.030729176476597786, 0.011654432862997055, 0.01385662890970707, 0.028053592890501022, 0.0008929679752327502, 0.003855440067127347, -0.01135528739541769, 0.033444661647081375, -0.009892047382891178, -0.0053916750475764275, -0.057557813823223114, 0.01885032281279564, 0.03004436567425728, -0.025643398985266685, 0.035476259887218475, -0.034198228269815445, -0.023593779653310776, -0.0069343773648142815, -0.022018836811184883, 0.04145187884569168, 0.06543077528476715, -0.007686571218073368, 0.005429479293525219, -0.010706210508942604, 0.0027218221221119165, -0.004719566088169813, 0.021021747961640358, -0.0024929537903517485, 0.02594609558582306, -0.007484871428459883, 0.002787042874842882, 0.026996644213795662, 0.020988313481211662, 0.0258127860724926, 0.0035698406863957644, -0.039365943521261215, -0.004490974359214306, 0.021834565326571465, -0.02470405027270317, 0.052599143236875534, -0.013171951286494732, -0.06475324183702469, 0.0005224382621236145, -0.004451925400644541, 0.000057234425185015425, 0.059859465807676315, 0.014315362088382244, -0.01634776033461094, 0.008068782277405262, 0.002028883434832096, 0.014556526206433773, 0.07680454850196838, -0.04144778475165367, 0.02427174523472786, 0.002342360792681575, 0.011292262934148312, 0.01919914036989212, 0.022979075089097023, 0.0053171138279139996, -0.03431515023112297, 0.05453699082136154, 0.007105664350092411, 0.011652151122689247, 0.03823030740022659, -0.029933081939816475, -0.042486440390348434, -0.021267786622047424, -0.017165308818221092, -0.011482255533337593, -0.008582690730690956, 0.05535130947828293, 0.048542290925979614, 0.026440229266881943, -0.018043894320726395, 0.027814822271466255, 0.049525100737810135, 0.012549410574138165, 0.009337950497865677, 0.02535528689622879, 0.0730133205652237, 0.004655918572098017, 0.03472462296485901, 0.06910458952188492, -0.002365591237321496, -0.009366534650325775, 0.03965143859386444, 0.024242321029305458, 0.010856750421226025, -0.024253811687231064, -0.01369511429220438, -0.020392954349517822, -0.025672227144241333, -0.033737387508153915, 0.007060726173222065, 0.030808191746473312, -0.06632161140441895, -0.04062919691205025, 0.023144042119383812, -0.0010677885729819536, 0.03166721761226654, -0.011227504350244999, -0.006223729345947504, -0.005670442245900631, -0.011093736626207829, 0.011452699080109596, 0.03666258230805397, 0.004536532796919346, -0.0131330331787467, 0.01114893052726984, 0.008034197613596916, 0.030144214630126953, 0.0088650556281209, -0.013086489401757717, -0.022901151329278946, -0.018561813980340958, -0.04044638201594353, -0.04435396566987038, 0.041322603821754456, -0.03455616906285286, -0.026291826739907265, 0.009956845082342625, 0.018801644444465637, -0.004053056705743074, 0.020544592291116714, -0.00029899325454607606, 0.04187055304646492, -0.03755026310682297, -0.008671030402183533, -0.0217488631606102, 0.006115264724940062, 0.023072311654686928, -0.06255829334259033, 0.03570554405450821, 0.008877183310687542, 0.005325199104845524, 0.007473764009773731, -0.006322621367871761, -0.02365165576338768, -0.006432350259274244, -0.012701088562607765, -0.00438375910744071, -0.04853004217147827, 0.020050162449479103, -0.011344047263264656, -0.05549628660082817, 0.028997361660003662, -0.023600058630108833, 0.03168273717164993, 0.012052187696099281, 0.038895685225725174, 0.015632426366209984, 0.01978910341858864, -0.0014060421381145716, -0.0041469186544418335, 0.006216281559318304, 0.015810459852218628, 0.02155303955078125, 0.015816286206245422, -0.00272993091493845, 0.027145106345415115, -0.0333268903195858, -0.0017778599867597222, -0.05574330687522888, -0.022020643576979637, -0.03753168508410454, -0.046768125146627426, -0.03270895779132843, 0.018248964101076126, -0.027789926156401634, 0.03736723214387894, -0.05968957394361496, -0.028529688715934753, -0.06186920776963234, -0.002939716214314103, 0.006011433433741331, 0.007162672933191061, 0.0607440359890461, 0.06034266948699951, 0.04467582330107689, -0.00083727395394817, -0.04638519138097763, -0.012889229692518711, -0.012279844842851162, 0.01036507822573185, 0.06545127183198929, -0.000128939253045246, -0.023547209799289703, -0.03246866911649704, 0.015949580818414688, -0.011002139188349247, -0.08237901329994202, 0.006482867058366537, -0.008985279127955437, -0.007030411157757044, -0.03126286342740059, -0.008456092327833176, 0.025281205773353577, -0.01720086671411991, 0.035908833146095276, -0.011997604742646217, -0.008751033805310726, -0.002394803101196885, 0.009341935627162457, -0.04617748036980629, 0.019100984558463097, -0.03503084182739258, -0.011301764287054539, 0.032793041318655014, 0.021266866475343704, 0.0291880052536726, -0.003550560912117362, -0.014264058321714401, -0.020511940121650696, -0.018556388095021248, -0.035829730331897736, -0.06395617872476578, 0.020376909524202347, 0.012984596192836761, -0.039014771580696106, -0.024023454636335373, 0.006323149893432856, -0.010355924256145954, 0.0005934860673733056, -0.0066466983407735825, 0.02973126992583275, -0.019065428525209427, -0.01771874725818634, 0.003968037199229002, -0.015977393835783005, 0.01937299780547619, 0.04927767440676689, -0.023425310850143433, -0.015359875746071339, 0.030504850670695305 ]
Distributed Training: Train BART/T5 for Summarization using 🤗 Transformers and Amazon SageMaker
philschmid
April 8, 2021
sagemaker-distributed-training-seq2seq
guide, partnerships, aws, nlp
https://huggingface.co/blog/sagemaker-distributed-training-seq2seq
`{model_name}` This model was trained using Amazon SageMaker and the new Hugging Face Deep Learning container. For more information look at: - [🤗 Transformers Documentation: Amazon SageMaker](https://huggingface.co/transformers/sagemaker.html) - [Example Notebooks](https://github.com/huggingface/notebooks/tree/master/sagemaker) - [Amazon SageMaker documentation for Hugging Face](https://docs.aws.amazon.com/sagemaker/latest/dg/hugging-face.html) - [Python SDK SageMaker documentation for Hugging Face](https://sagemaker.readthedocs.io/en/stable/frameworks/huggingface/index.html) - [Deep Learning Container](https://github.com/aws/deep-learning-containers/blob/master/available_images.md#huggingface-training-containers)
[ -0.020189346745610237, -0.03179972991347313, 0.026597531512379646, -0.0007519123028032482, 0.06557825952768326, 0.09778068959712982, 0.023101819679141045, 0.05713248625397682, -0.07351120561361313, -0.04536498337984085, -0.06214336305856705, 0.04238813742995262, 0.0025234816130250692, 0.08455176651477814, 0.007150712888687849, -0.010617864318192005, 0.016517236828804016, 0.0430891253054142, -0.013298600912094116, 0.042280830442905426, -0.0221029594540596, -0.07917989790439606, 0.04725250229239464, -0.0329098142683506, -0.020805340260267258, -0.032236337661743164, 0.03149484843015671, -0.0058209835551679134, -0.03889116272330284, 0.03733071684837341, -0.06636488437652588, -0.004174031317234039, 0.061131007969379425, -0.027869245037436485, -0.009211706928908825, 0.021607516333460808, -0.16310572624206543, 0.04465818405151367, -0.046113815158605576, -0.034963905811309814, -0.04757639020681381, -0.017768574878573418, -0.05203570798039436, 0.06784293800592422, -0.0009125844808295369, -0.02899746038019657, -0.19140642881393433, 0.07655953615903854, 0.0372469536960125, -0.03438061848282814, -0.07214142382144928, 0.04108455404639244, -0.005279846955090761, -0.004487825091928244, 0.019282367080450058, -0.022162338718771935, -0.01874450221657753, -0.036063164472579956, 0.03620867431163788, -0.06423161923885345, 0.008505012840032578, -0.0019753575325012207, -0.010940776206552982, -0.010755594819784164, 0.018417075276374817, 0.03083977848291397, 0.005081104580312967, -0.027266565710306168, -0.018599117174744606, -0.022862451151013374, 0.004254112485796213, -0.037816088646650314, 0.015525269322097301, -0.01735854521393776, -0.01701248064637184, -0.0672779530286789, -0.01694227010011673, 0.055456966161727905, 0.04506775736808777, 0.05390648543834686, -0.0355631522834301, -0.004059425089508295, 0.013269416056573391, 0.07700257003307343, 0.01644032448530197, -0.0046545290388166904, 0.06560869514942169, -0.007066349498927593, -0.02661065012216568, 0.05213521420955658, 0.0022169933654367924, -0.0888470858335495, -0.01869477517902851, 0.026494460180401802, 0.01193577703088522, -0.052623845636844635, 0.013064847327768803, -0.02033490128815174, 0.010661754757165909, -0.024279899895191193, 0.01692349836230278, -0.019610758870840073, 0.017563315108418465, -0.029436001554131508, -0.04142823815345764, 0.034799713641405106, -0.024382859468460083, -0.09017541259527206, -0.009440205991268158, -0.026656711474061012, 0.024621816352009773, 0.004958286415785551, 0.003915252164006233, 0.06537031382322311, -0.08659090101718903, 0.08697483688592911, -0.0022051739506423473, -0.04227970913052559, 0.03337572142481804, 0.0006560671026818454, -0.005963264033198357, 0.10813196748495102, 0.0514177605509758, 0.003405158407986164, 0.019411645829677582, 0.035171497613191605, 0.005827991291880608, 0.0028761804569512606, -0.038880132138729095, -0.03165396302938461, 0.021113714203238487, -0.04684547707438469, 0.05230291560292244, 0.03317411616444588, 0.019647106528282166, -0.0404144823551178, 0.004864094313234091, -0.030128145590424538, -0.005526108201593161, 0.05902636796236038, -0.0260383989661932, 0.10011386126279831, -0.040539033710956573, 0.07863790541887283, 0.08708203583955765, 0.015027500689029694, -0.022300543263554573, 0.03530929982662201, 0.023877829313278198, 0.036167748272418976, -0.05283591151237488, 0.048147689551115036, -0.029202330857515335, -0.08319541066884995, 0.04339676722884178, 0.06262578070163727, -0.014993150718510151, -0.04407478868961334, -0.050562016665935516, -0.07016527652740479, 0.005981197115033865, 0.020207274705171585, -0.050359878689050674, 0.03425825387239456, 0.03851234167814255, -0.046791788190603256, 0.014517530798912048, 0.007324040401726961, 0.02955612912774086, -0.073026642203331, 0.0009990083053708076, -0.07442893087863922, 0.05487029626965523, 0.01978488080203533, -0.06883477419614792, 0.05983052775263786, 0.047150760889053345, 0.03218919783830643, -0.008020815439522266, -0.003150027710944414, -0.07219021022319794, 0.05773197114467621, -0.0247354693710804, -0.00910374615341425, 0.06427463889122009, -0.05698052793741226, 0.025990597903728485, 0.02978847548365593, 0.013132527470588684, 0.04267312213778496, -0.06136354058980942, -0.04165394976735115, 0.09930172562599182, 0.0579354353249073, 0.033736519515514374, -0.10714613646268845, -0.026807911694049835, 0.10879240930080414, 0.032056376338005066, 0.06262599676847458, 0.06198279932141304, -0.0014959495747461915, -0.019497504457831383, -0.02740515023469925, -0.00777460029348731, 0.03044593706727028, 0.03453656658530235, -0.04130777344107628, 0.06537129729986191, 0.010752215050160885, 0.03171633556485176, -0.13620124757289886, 0.04342471435666084, -0.0800422728061676, 0.0350339338183403, -0.03440844640135765, -0.05811527371406555, -0.02880018949508667, 0.02718964032828808, 0.024423610419034958, 0.15231157839298248, 0.004374849144369364, -0.014023949392139912, -0.026363641023635864, -0.05351592227816582, 0.0718405470252037, 0.0698617696762085, 0.030079450458288193, 0.07979770004749298, -0.10546452552080154, -0.012932726182043552, -0.0507911741733551, 0.009485096670687199, 0.03555341064929962, 0.0013570390874519944, -0.041610218584537506, 0.042438093572854996, -0.007378355599939823, 0.022060498595237732, -0.00869924109429121, 0.04166959598660469, -0.003738046856597066, 0.014555440284311771, 0.03559514880180359, -0.023658674210309982, -0.06247994676232338, 0.03921445086598396, 0.037226125597953796, -0.08397115767002106, -0.03482150658965111, -0.084868423640728, 0.0702788457274437, 0.014477706514298916, -0.02709248848259449, 0.05443701148033142, 0.015115603804588318, -0.009037117473781109, 0.016125719994306564, 0.0029615010134875774, 0.057235583662986755, -0.006492012180387974, 0.011634962633252144, -0.021162349730730057, -0.03078450821340084, -0.010330419056117535, -0.020973699167370796, -0.026917949318885803, -0.0034213762264698744, 0.025744209066033363, 0.04258284345269203, 0.017974205315113068, -0.041826535016298294, 0.011703514494001865, 0.026238616555929184, 0.029471516609191895, 0.032030995935201645, 0.021693523973226547, -0.009396418929100037, -0.009283927269279957, -0.029519962146878242, 0.008087552152574062, -0.024295762181282043, 0.009184815920889378, 0.03674577176570892, 0.06358392536640167, -0.027951031923294067, 0.026503361761569977, -0.02561134472489357, -0.013643861748278141, 0.010554981417953968, 0.003500086022540927, 0.05236823484301567, 0.017214156687259674, -0.009257256984710693, 0.009077687747776508, -0.01921289600431919, 0.015727529302239418, -0.0060960655100643635, -0.010708645917475224, 0.047670911997556686, -0.006970285903662443, 0.00611170195043087, -0.028914831578731537, 0.02285800315439701, -0.013176608830690384, 0.019072601571679115, 0.011895925737917423, 0.04099823161959648, -0.12318506836891174, -0.038360439240932465, 0.016594422981142998, 0.013503063470125198, 0.00802575796842575, -0.015385480597615242, 0.03882867470383644, 0.005664055701345205, -0.008285623043775558, 0.042095549404621124, 0.001556458417326212, 0.03918831795454025, 0.013246506452560425, -0.029797082766890526, -0.050278790295124054, 0.012961127795279026, -0.01142120361328125, -0.0087995994836092, 0.016816342249512672, 0.011609083972871304, -0.028830695897340775, 0.04252566769719124, -0.008294947445392609, -0.02265038527548313, -0.03310061991214752, 0.013002662919461727, 0.010764038190245628, 0.023973310366272926, 0.030657829716801643, -0.04521763324737549, -0.017820091918110847, -0.008486742153763771, -0.038838088512420654, 0.04866483807563782, -0.05053211376070976, 0.027158277109265327, -0.012700428254902363, 0.019354676827788353, 0.01447263453155756, 0.029105685651302338, 0.007743027992546558, 0.017247971147298813, 0.004335276782512665, 0.01210002787411213, 0.028464917093515396, 0.00934914592653513, -0.016438869759440422, -0.007473266217857599, 0.03317159041762352, -0.03186490759253502, -0.03944629058241844, -0.005887538194656372, 0.00919085182249546, 0.05774326249957085, 0.018470078706741333, 0.017632290720939636, 0.01461112592369318, 0.020884539932012558, 0.04635005071759224, -0.01571958139538765, -0.03962097689509392, 0.0334179513156414, -0.029331780970096588, -0.02113182283937931, -0.014280020259320736, 0.038937799632549286, -0.0011197244748473167, 0.04419682174921036, -0.00634746253490448, 0.030057623982429504, 0.0000963197453529574, 0.03034629486501217, -0.03157709538936615, 0.0024001956917345524, -0.039311472326517105, -0.02164669707417488, -0.02975306287407875, -0.006969879847019911, 0.06530029326677322, -0.009934277273714542, -0.030825043097138405, -0.005901477765291929, -0.030296163633465767, -0.034796085208654404, 0.024965669959783554, 0.011242793872952461, 0.0069037871435284615, -0.030343785881996155, 0.055399682372808456, 0.057810280472040176, -0.026185844093561172, 0.0014025071868672967, 0.015370997600257397, 0.011466030031442642, 0.00871659629046917, 0.015531588345766068, 0.0280741099268198, 0.0005031361361034214, -0.015015391632914543, 0.017669495195150375, 0.01804283820092678, -0.016776997596025467, -0.025152381509542465, -0.006498286034911871, 0.011784248985350132, 0.02487466298043728, -0.04282122850418091, -0.0634041279554367, -0.02181185968220234, -0.05276351422071457, 0.04567599296569824, -0.04895496740937233, -0.004495666828006506, -0.024765493348240852, 0.024955494329333305, 0.03509245067834854, -0.011201431043446064, -0.03523312509059906, -0.023657960817217827, 0.03766996040940285, -0.030240636318922043, 0.035732451826334, -0.03681309521198273, -0.021705256775021553, -0.013518786057829857, -0.01286028977483511, 0.02749539166688919, 0.028163263574242592, -0.011384162120521069, -0.017138270661234856, -0.03495226427912712, -0.03112352266907692, 0.028583668172359467, -0.0016066126991063356, 0.046363405883312225, 0.010035339742898941, -0.0005669790552929044, 0.009640077129006386, -0.004877807572484016, -0.03730224445462227, -0.016152044758200645, 0.008540398441255093, 0.039084237068891525, -0.011846358887851238, 0.03595827519893646, -0.014479981735348701, -0.038532476872205734, -0.028879158198833466, 0.009351943619549274, 0.03726070374250412, 0.032613810151815414, -0.002221083967015147, -0.04456581920385361, 0.041746560484170914, -0.004524951800704002, -0.008957319892942905, 0.01123114489018917, 0.01919853501021862, -0.011066527105867863, 0.0869709774851799, -0.005132851656526327, -0.005160875618457794, -0.03397083654999733, 0.04011885076761246, 0.02335483580827713, 0.025787411257624626, 0.008593508042395115, -0.055852510035037994, 0.001967751421034336, 0.04264902323484421, -0.029968712478876114, -0.06951412558555603, 0.008053851313889027, -0.03718581795692444, 0.023166410624980927, 0.055597927421331406, 0.02036030776798725, 0.0031029863748699427, -0.004137109965085983, 0.04025327414274216, -0.028550999239087105, 0.011614722199738026, -0.001537573873065412, 0.018693871796131134, -0.009618165902793407, 0.007670124527066946, 0.03351762890815735, 0.02402336895465851, 0.01624041236937046, 0.030037283897399902, -0.024066314101219177, -0.022885797545313835, -0.0012852656655013561, -0.005227179266512394, -0.008111715316772461, 0.015296677127480507, 0.02936900220811367, 0.024805478751659393, 0.016509590670466423, 0.010038327425718307, 0.022013984620571136, 0.08320070803165436, -0.012405790388584137, -0.008492201566696167, 0.031015295535326004, 0.007323831785470247, -0.011833136901259422, -0.01881415769457817, -0.007842594757676125, -0.04355309158563614, 0.0018434550147503614, -0.008061709813773632, -0.021603573113679886, -0.009088000282645226, -0.01973808743059635, -0.026255853474140167, -0.008647873066365719, 0.019115367904305458, 0.01810006983578205, 0.043465327471494675, -0.021671434864401817, 0.0031957565806806087, 0.023126987740397453, -0.010194577276706696, 0.028928225859999657, -0.0296616293489933, 0.006590830162167549, 0.03759637102484703, -0.0162714384496212, 0.03734013810753822, 0.02429724670946598, 0.009005757048726082, -0.015907756984233856, 0.012396582402288914, 0.0017153217922896147, -0.02376576140522957, -0.03495873138308525, 0.025995315983891487, 0.012299868278205395, 0.0017749801045283675, -0.004064625129103661, 0.005301015451550484, -0.032031718641519547, 0.015490962192416191, -0.053922463208436966, 0.02614866942167282, 0.0497889518737793, -0.010380305349826813, 0.003179138293489814, 0.0003740888787433505, 0.03662988170981407, 0.039365023374557495, 0.05147845670580864, -0.0023312505800276995, 0.0216950885951519, 0.01801534928381443, 0.0015486772172152996, 0.02106238715350628, 0.009973259642720222, -0.0364329069852829, 0.0058447979390621185, -0.02129295840859413, 0.037552788853645325, 0.05918358638882637, -0.03770658001303673, 0.03128008544445038, 0.002441021613776684, -0.05268199369311333, 0.01761026307940483, 0.023151330649852753, 0.004819152411073446, 0.028839940205216408, 0.0030775871127843857, -0.028457848355174065, -0.007004431448876858, -0.021528393030166626, 0.02251586504280567, 0.05152006074786186, -0.026371439918875694, 0.034821439534425735, -0.006513544823974371, 0.01754635199904442, 0.029433634132146835, 0.021135153248906136, 0.007133288308978081, 0.009645448997616768, 0.054239433258771896, -0.015118494629859924, 0.0086080776527524, 0.015143738128244877, -0.009666984900832176, -0.026833852753043175, -0.05303876847028732, 0.004500340670347214, -0.018689898774027824, -0.003969359211623669, 0.03962894529104233, -0.006961437873542309, 0.04411044344305992, -0.039213016629219055, 0.0308839101344347, 0.028866278007626534, 0.023907992988824844, -0.0028638287913054228, -0.004269965458661318, 0.06445103138685226, 0.020227771252393723, -0.01711343042552471, 0.063258096575737, -0.027047423645853996, 0.01999647542834282, 0.03828350827097893, 0.001631103572435677, 0.0180107019841671, 0.021210432052612305, -0.029276426881551743, -0.020136525854468346, -0.016394007951021194, -0.020899726077914238, 0.017511306330561638, 0.020725125446915627, -0.028551939874887466, -0.01178156677633524, -0.00275893765501678, -0.029146820306777954, -0.010573090985417366, -0.015248063951730728, 0.014349342323839664, -0.0404268279671669, -0.0012175972806289792, 0.007886061444878578, 0.029401365667581558, -0.0021123290061950684, -0.04630712419748306, -0.0039695873856544495, 0.010595220141112804, 0.007984994910657406, 0.014705725945532322, -0.006042598281055689, -0.034289851784706116, -0.0038371230475604534, -0.0244255680590868, -0.0034217913635075092, 0.03766618296504021, -0.031342145055532455, -0.00755263539031148, -0.00632763234898448, 0.030115440487861633, -0.01597103290259838, 0.012722378596663475, 0.0007141409441828728, -0.013033360242843628, -0.015484250150620937, 0.0012714089825749397, -0.02318102866411209, 0.01671038568019867, -0.02311367355287075, -0.068077452480793, 0.023396166041493416, -0.025894654914736748, 0.01712672784924507, 0.023650716990232468, 0.020084621384739876, -0.004128752741962671, -0.04141860455274582, -0.030252249911427498, -0.026692453771829605, 0.004746380727738142, 0.018352042883634567, 0.0037803295999765396, -0.057768791913986206, 0.002423756057396531, -0.015651119872927666, 0.005696293897926807, -0.03965085744857788, 0.04643472284078598, 0.034015875309705734, -0.04576829820871353, -0.014857743866741657, -0.002681335201486945, 0.05751044675707817, 0.01401412021368742, 0.01745855063199997, 0.04170586168766022, 0.026671674102544785, 0.010862479917705059, -0.03878407925367355, 0.00508375559002161, -0.02895299717783928, 0.01441186387091875, -0.03451219201087952, -0.05741716921329498, -0.021942658349871635, -0.02809997834265232, -0.0016854688292369246, 0.020615290850400925, -0.064249187707901, -0.017513541504740715, -0.02203812636435032, -0.0006688098073936999, -0.025389214977622032, 0.03408960625529289, 0.07470592111349106, 0.03055679239332676, 0.012250789441168308, -0.006182271987199783, -0.02893754467368126, 0.0035308345686644316, 0.012240489013493061, 0.020674435421824455, 0.07110613584518433, -0.012965084053575993, -0.0021221761126071215, -0.04376496747136116, -0.0057731070555746555, -0.018318921327590942, -0.0629277303814888, -0.004105206113308668, 0.04178490489721298, -0.01973981037735939, -0.024394022300839424, -0.010188920423388481, 0.03004438988864422, 0.020289121195673943, 0.037505414336919785, -0.011478662490844727, -0.005463832523673773, -0.024781053885817528, 0.026789378374814987, -0.06006169319152832, 0.0036952183581888676, -0.030803732573986053, 0.009521475993096828, 0.04034799709916115, 0.00955932680517435, 0.01624072529375553, 0.004826099146157503, -0.018859542906284332, 0.0060121710412204266, -0.02330152504146099, -0.033888719975948334, -0.038262974470853806, 0.006751495413482189, -0.02735281176865101, -0.009523718617856503, -0.030670758336782455, 0.007151821628212929, 0.011858375743031502, -0.02840825729072094, -0.02506266161799431, -0.0049990941770374775, -0.0029467176645994186, -0.030672507360577583, 0.018701501190662384, 0.004530652891844511, 0.04716316983103752, 0.029124902561306953, -0.011430950835347176, 0.013887245208024979, 0.02976284921169281 ]
Distributed Training: Train BART/T5 for Summarization using 🤗 Transformers and Amazon SageMaker
philschmid
April 8, 2021
sagemaker-distributed-training-seq2seq
guide, partnerships, aws, nlp
https://huggingface.co/blog/sagemaker-distributed-training-seq2seq
Hyperparameters {hyperparameters}
[ 0.0457133874297142, 0.0559273362159729, 0.08756585419178009, 0.04312913492321968, 0.07363805919885635, 0.0874568447470665, 0.037041012197732925, 0.029721157625317574, -0.02566653862595558, -0.03669370338320732, -0.04772907495498657, 0.022704293951392174, -0.016040164977312088, 0.03653223440051079, 0.04265967011451721, 0.02192569337785244, 0.025445396080613136, -0.012584029696881771, 0.01095070131123066, 0.012056265957653522, -0.004495764616876841, -0.006080703344196081, 0.07231679558753967, -0.03144173324108124, 0.014027474448084831, 0.011739537119865417, -0.027057593688368797, -0.018084201961755753, -0.012950184755027294, 0.04543561115860939, -0.06947962939739227, -0.009426368400454521, 0.007002503145486116, -0.021383343264460564, 0.009451696649193764, 0.015018806792795658, -0.09214068204164505, -0.004627744667232037, 0.014301009476184845, -0.06933639943599701, -0.043506793677806854, -0.04586239904165268, -0.021174632012844086, 0.034236494451761246, -0.00858283881098032, 0.02938247099518776, -0.24433359503746033, 0.07414369285106659, 0.0010660269763320684, -0.030949831008911133, -0.04303078353404999, 0.04384710639715195, 0.007967054843902588, 0.02762964554131031, -0.0007729257340542972, 0.0021805381402373314, 0.04492996633052826, -0.047634970396757126, 0.0214226171374321, -0.05955959111452103, 0.07440929859876633, 0.0006966873188503087, 0.012078176252543926, 0.020824119448661804, 0.07165565341711044, 0.07011628895998001, -0.029337255284190178, 0.0392240434885025, -0.039534565061330795, -0.03330111503601074, 0.014906282536685467, -0.024498943239450455, -0.003275250317528844, 0.0028292504139244556, 0.014297978952527046, -0.07413764297962189, -0.060856979340314865, -0.003401355352252722, 0.030879557132720947, 0.11286921799182892, -0.0070127276703715324, -0.028810875490307808, 0.0937129482626915, 0.08489370346069336, 0.002259186701849103, -0.02259768173098564, 0.04871499538421631, -0.02729397639632225, 0.028264688327908516, 0.03242158889770508, -0.012303564697504044, -0.10160127282142639, -0.007626890204846859, 0.005531758069992065, -0.012282844632863998, -0.06602665781974792, 0.05052006244659424, -0.04270283877849579, 0.0008359447820112109, 0.06506304442882538, -0.00027470439090393484, 0.036907974630594254, -0.0005830877344124019, -0.05726615712046623, -0.0750829428434372, -0.010241677053272724, -0.0019885203801095486, -0.08881764113903046, -0.08470824360847473, 0.04309718310832977, -0.057838838547468185, 0.08441344648599625, 0.04925461858510971, 0.02915286459028721, -0.04953625798225403, 0.0492606982588768, -0.007269442081451416, 0.017711391672492027, 0.02685188315808773, 0.015318295918405056, -0.02905731461942196, 0.11400222778320312, 0.08501671999692917, 0.017398357391357422, 0.02740151807665825, 0.029137972742319107, 0.07834167778491974, 0.06290885806083679, -0.048582956194877625, -0.009979416616261005, 0.006239845417439938, 0.013263339176774025, 0.024327537044882774, 0.004881126340478659, -0.0330415777862072, -0.09883520007133484, -0.02799740619957447, 0.005560672841966152, 0.01376089546829462, 0.016777096316218376, 0.00009413065708940849, 0.013795120641589165, -0.00896366499364376, 0.03954624384641647, 0.044937603175640106, -0.039417073130607605, -0.003825775347650051, 0.02626028284430504, -0.013175216503441334, 0.018231207504868507, 0.025926727801561356, 0.10471508651971817, 0.006423003040254116, -0.031639616936445236, 0.038844894617795944, 0.04811343923211098, 0.032072048634290695, 0.014211815781891346, -0.080172598361969, 0.010821058414876461, 0.029762912541627884, 0.014898686669766903, -0.009698397479951382, -0.010311318561434746, 0.06500871479511261, -0.01588798686861992, -0.006615394726395607, 0.021623685956001282, -0.04075280949473381, -0.062307216227054596, -0.0331103689968586, -0.00464468402788043, 0.042819149792194366, -0.021662062034010887, -0.04559672996401787, 0.011923854239284992, 0.04587849974632263, 0.030689086765050888, 0.048009663820266724, 0.004541939124464989, -0.03089749999344349, 0.05211399495601654, -0.050222765654325485, 0.027613243088126183, 0.016561219468712807, -0.019848372787237167, 0.013286111876368523, -0.03776395693421364, 0.021569151431322098, 0.04878782853484154, -0.10858777165412903, -0.06277327984571457, 0.07796945422887802, 0.013948407024145126, 0.03998300060629845, -0.09935882687568665, -0.027858799323439598, 0.10531072318553925, 0.05296928063035011, 0.0638003945350647, 0.04597710818052292, 0.019188033416867256, 0.05055620148777962, -0.032431717962026596, -0.0036536247935146093, 0.037515945732593536, 0.06434543430805206, -0.019523056223988533, 0.052804578095674515, 0.009419463574886322, -0.0021441695280373096, -0.07028349488973618, 0.0243249349296093, -0.09560532867908478, -0.0038232493679970503, 0.023087799549102783, -0.004113286267966032, -0.05365317687392235, 0.03940308094024658, -0.05079260095953941, 0.14258553087711334, -0.015750372782349586, -0.04518745467066765, 0.020315343514084816, -0.004996051546186209, 0.06894272565841675, 0.10471602529287338, 0.026335053145885468, 0.051200464367866516, -0.09277412295341492, -0.013895056210458279, -0.01512860506772995, 0.034534797072410583, 0.10572884231805801, 0.03636419400572777, 0.031340256333351135, 0.004543999210000038, -0.01396224182099104, 0.05335584655404091, -0.08757656812667847, 0.03997688740491867, 0.03479663282632828, -0.00544399581849575, 0.0495295375585556, -0.03810758516192436, -0.053856249898672104, 0.07502437382936478, 0.0021948537323623896, -0.06562817841768265, -0.019427558407187462, -0.0648137629032135, 0.03840752691030502, 0.02471289597451687, -0.08796821534633636, 0.022570759057998657, -0.0187058225274086, -0.01701696217060089, -0.010173358023166656, -0.0024539832957088947, 0.03466771915555, 0.0267231073230505, 0.012751172296702862, -0.0015934467082843184, -0.047775112092494965, 0.010778379626572132, -0.012688010931015015, 0.01399345975369215, 0.03506997972726822, -0.021432863548398018, 0.03872482106089592, -0.029692713171243668, -0.027391936630010605, 0.04333511367440224, 0.001783885178156197, -0.00001962143687705975, -0.016977733001112938, 0.0387769415974617, 0.0015728147700428963, -0.03240865841507912, -0.023604385554790497, -0.024175824597477913, -0.034750062972307205, 0.017760297283530235, 0.012013941071927547, 0.023112062364816666, -0.02872992679476738, 0.012180966325104237, -0.013410654850304127, 0.007391844876110554, 0.01873498596251011, -0.016144804656505585, 0.02405034750699997, -0.01616852730512619, -0.030811214819550514, 0.029401041567325592, -0.030331866815686226, -0.024266039952635765, 0.005233447998762131, -0.02581026963889599, -0.004630483221262693, 0.004450370091944933, 0.016634833067655563, -0.006177348550409079, 0.020748471841216087, -0.044110674411058426, 0.055573720484972, -0.023969542235136032, 0.06594446301460266, -0.15464407205581665, -0.028831053525209427, 0.01262841559946537, 0.014028028585016727, -0.004283816087990999, 0.0005312848370522261, 0.049899760633707047, -0.054884761571884155, -0.020185358822345734, -0.020525934174656868, 0.01527459267526865, 0.015487211756408215, -0.01779060997068882, 0.016496671363711357, -0.018192632123827934, -0.01944361813366413, -0.01580689288675785, 0.016302889212965965, -0.0022759779822081327, -0.005813274998217821, -0.02016879804432392, 0.06631124764680862, -0.007680188398808241, 0.01215148065239191, -0.003137941937893629, 0.04418272525072098, 0.02770175226032734, 0.025094961747527122, 0.0012581321643665433, -0.006877500098198652, -0.020012134686112404, 0.021754803135991096, -0.05276065319776535, 0.028289085254073143, -0.006782128941267729, -0.005475582554936409, -0.02289430983364582, -0.02623119205236435, -0.013992191292345524, 0.05664917826652527, 0.00733975088223815, 0.011605313047766685, 0.031483858823776245, -0.008885844610631466, -0.052890174090862274, 0.0006876550032757223, -0.011778132058680058, -0.006744763348251581, 0.046145886182785034, -0.05094218626618385, -0.05558336526155472, -0.011611922644078732, 0.03059202805161476, 0.017073120921850204, -0.0028166689444333315, -0.016487564891576767, 0.0011187248164787889, 0.016998473554849625, 0.04985232651233673, -0.01270399708300829, -0.00903228111565113, 0.01717851497232914, 0.00735852774232626, 0.0009283034014515579, -0.0777091309428215, 0.05419544130563736, -0.008496688678860664, 0.03966888412833214, -0.036434356123209, 0.0477147251367569, 0.011093512177467346, 0.010547643527388573, -0.030646800994873047, 0.02648887224495411, -0.002387336688116193, 0.007575109601020813, -0.011179320514202118, -0.040086086839437485, 0.051572151482105255, -0.0007781077874824405, -0.021862845867872238, -0.017215026542544365, -0.015300924889743328, -0.0054533532820641994, -0.01138037908822298, 0.034145962446928024, -0.010945980437099934, -0.005398389883339405, 0.020924458280205727, 0.038976531475782394, 0.005587598774582148, 0.006501975003629923, -0.0015577521407976747, -0.01350534800440073, 0.009851088747382164, 0.028173169121146202, 0.051450058817863464, 0.0018275476759299636, 0.0036251978017389774, 0.020094024017453194, 0.018029503524303436, -0.022181404754519463, -0.0059007382951676846, 0.002004709094762802, -0.01181226409971714, 0.020534247159957886, -0.019806118682026863, -0.045279379934072495, -0.01299621257930994, -0.0007493652519769967, 0.014170043170452118, -0.042161621153354645, -0.010860206559300423, -0.0467056930065155, 0.01563912257552147, -0.005205965600907803, -0.02888910099864006, -0.01703033782541752, -0.015700889751315117, 0.03434406965970993, -0.02977023459970951, 0.030391456559300423, 0.0017869315342977643, -0.03533049300312996, -0.012460471130907536, -0.02086191065609455, 0.015103168785572052, 0.019580744206905365, -0.009080195799469948, 0.029386889189481735, -0.0529693104326725, -0.03307763487100601, 0.01715545356273651, -0.01936838962137699, 0.012089941650629044, 0.005203444976359606, -0.023254092782735825, 0.04386343061923981, 0.015234699472784996, -0.08068020641803741, 0.005200458690524101, 0.03184139356017113, 0.0004948909627273679, -0.013334601186215878, 0.06638006120920181, 0.002120474586263299, -0.027791183441877365, -0.021693209186196327, -0.018879428505897522, 0.018272360786795616, 0.03080294281244278, -0.02158055454492569, -0.02868018113076687, -0.020496916025877, -0.008660102263092995, -0.013400748372077942, 0.024112870916724205, -0.007936373353004456, -0.008654461242258549, 0.06232600659132004, -0.002968770684674382, -0.024520574137568474, -0.05032830312848091, 0.0038405340164899826, -0.011881470680236816, 0.002693319693207741, 0.013215167447924614, -0.01610487513244152, -0.03422136977314949, -0.00311064044944942, -0.015409903600811958, -0.013946843333542347, 0.04790392890572548, -0.02686222828924656, -0.0023440427612513304, 0.015948032960295677, 0.014837871305644512, 0.03394681587815285, -0.004532420076429844, -0.0008240336901508272, -0.015539485961198807, -0.006705011241137981, 0.03308800235390663, -0.008012192323803902, -0.021886110305786133, 0.005608734674751759, 0.02791507914662361, 0.017201267182826996, 0.0003985620860476047, 0.04982404038310051, -0.019215650856494904, -0.013222313486039639, -0.00149063509888947, -0.026664873585104942, -0.0048690480180084705, 0.008916663937270641, 0.015172942541539669, -0.022785428911447525, -0.0056532216258347034, -0.035816892981529236, 0.033784665167331696, 0.0370606929063797, -0.0019494950538501143, -0.01647878624498844, 0.004382472950965166, 0.03217734768986702, 0.0115860216319561, -0.0036403625272214413, 0.010129385627806187, -0.01788603514432907, -0.014520815573632717, -0.024545136839151382, -0.04760304465889931, -0.018476279452443123, -0.019581720232963562, -0.03675014153122902, -0.05199962481856346, 0.0189259871840477, -0.006172021850943565, 0.026420261710882187, 0.021526766940951347, -0.008674233220517635, 0.0052269017323851585, 0.026911498978734016, 0.07716826349496841, -0.013778084889054298, -0.007178687024861574, 0.023362940177321434, 0.00984138622879982, 0.05839608237147331, 0.01960180141031742, -0.015199501067399979, -0.03486381098628044, 0.0068231988698244095, 0.02833031676709652, -0.010713854804635048, -0.0690486952662468, 0.03881935775279999, 0.006868594326078892, 0.008018760941922665, -0.04575970396399498, -0.0001764291519066319, -0.0141672994941473, 0.005995964631438255, -0.011716929264366627, 0.002794703235849738, 0.04297998175024986, -0.021587442606687546, 0.013045129366219044, 0.002899420214816928, 0.028008652850985527, -0.01520812138915062, 0.02523656189441681, -0.005404806695878506, 0.022784702479839325, 0.03447425365447998, 0.0038085656706243753, -0.026368435472249985, 0.034542035311460495, -0.0168784037232399, 0.041577864438295364, -0.021562885493040085, 0.039020877331495285, 0.01412204559892416, -0.04290970787405968, 0.03590938076376915, 0.00037820744910277426, 0.0045087579637765884, 0.010107344016432762, 0.007057791110128164, -0.010768787004053593, 0.02066565863788128, 0.008794923312962055, 0.0013061447534710169, 0.009741930291056633, -0.002178735099732876, -0.021035969257354736, 0.03714766725897789, -0.008173259906470776, 0.021840032190084457, 0.009303702041506767, 0.022929156199097633, 0.02306276559829712, -0.01615736447274685, -0.021084649488329887, 0.02123177982866764, 0.043058622628450394, -0.0035158474929630756, 0.03149436041712761, 0.011403725482523441, -0.0005455673672258854, 0.0026510015595704317, -0.033098094165325165, 0.022439392283558846, -0.055301643908023834, 0.020181210711598396, 0.013268425129354, -0.02035442367196083, 0.0106726149097085, -0.02333439141511917, 0.05466737970709801, 0.0023604382295161486, 0.0008515945519320667, 0.02678454853594303, -0.04676148667931557, 0.022049881517887115, 0.014407849870622158, -0.017625324428081512, 0.024712951853871346, -0.05150296166539192, -0.011421906761825085, 0.048073768615722656, -0.012203728780150414, -0.025283465161919594, 0.008398092351853848, -0.05069546401500702, 0.02201608382165432, -0.04227861389517784, -0.04341326281428337, 0.013340609148144722, 0.06612175703048706, -0.015049954876303673, 0.0152698690071702, -0.0125432088971138, -0.07290932536125183, -0.03886605054140091, 0.006319862324744463, 0.014352265745401382, -0.03938179835677147, -0.009703094139695168, -0.010123815387487411, 0.00379951111972332, -0.019021831452846527, -0.027443675324320793, -0.015470605343580246, 0.03577512130141258, 0.02425215393304825, 0.06005754694342613, -0.018465755507349968, -0.018493058159947395, -0.017558878287672997, 0.015245407819747925, 0.013898911885917187, 0.0013251432683318853, -0.014810699038207531, 0.018417736515402794, -0.012117129750549793, 0.01616671495139599, -0.014127848669886589, 0.028303811326622963, 0.035713184624910355, 0.021792346611618996, -0.028500881046056747, 0.029632369056344032, -0.05155134201049805, -0.00005742315261159092, -0.0030662468634545803, 0.0033084626775234938, 0.0008806686382740736, 0.0017942219274118543, 0.01939050666987896, 0.003536383155733347, 0.021344944834709167, -0.04841214790940285, -0.011555314064025879, -0.003145586233586073, -0.07932935655117035, 0.000485290220240131, 0.011611864902079105, 0.01131327822804451, -0.04164567217230797, -0.012415996752679348, 0.01841902732849121, -0.019944651052355766, -0.03889486566185951, -0.012308475561439991, 0.0033175917342305183, -0.010814310051500797, -0.021628523245453835, -0.018538326025009155, 0.05414484068751335, 0.015034450218081474, 0.017557023093104362, 0.025363123044371605, 0.02981158159673214, 0.0024813564959913492, -0.019866202026605606, 0.012851979583501816, 0.007355901412665844, 0.0318366102874279, -0.0064347549341619015, -0.014032759703695774, -0.026488550007343292, -0.006736770737916231, -0.013756980188190937, 0.011223566718399525, -0.04658406972885132, -0.03045903705060482, 0.007604786194860935, -0.0038679034914821386, -0.05888950452208519, 0.05879376828670502, 0.05188148841261864, 0.019085243344306946, 0.046627361327409744, 0.003955393098294735, -0.01141422800719738, 0.003309320891276002, 0.020380167290568352, 0.009251464158296585, 0.02755402773618698, 0.020592443645000458, -0.014189343899488449, -0.04952302947640419, 0.05635124072432518, -0.028850048780441284, -0.06021185964345932, -0.007561615202575922, 0.027449537068605423, -0.043675005435943604, -0.019937630742788315, -0.02946069836616516, -0.013763241469860077, 0.04198016971349716, 0.014092438854277134, 0.0058562844060361385, 0.012723264284431934, -0.022602595388889313, 0.007017315365374088, -0.06318191438913345, 0.007303642109036446, 0.0030716373585164547, -0.00026389979757368565, 0.035834599286317825, 0.030743492767214775, 0.007659062743186951, -0.009484292939305305, -0.04558614268898964, 0.010974152944982052, -0.01558687910437584, -0.00907044392079115, -0.0014882363611832261, -0.002283688634634018, -0.01223699375987053, -0.03575458750128746, -0.03927065432071686, 0.017856979742646217, 0.01393957994878292, -0.03824452683329582, -0.0034271583426743746, 0.0015817803796380758, 0.003090964863076806, 0.005916684400290251, 0.032061927020549774, -0.008111785165965557, 0.047345686703920364, 0.03536693751811981, -0.0022477195598185062, 0.021513812243938446, 0.02886326052248478 ]
Distributed Training: Train BART/T5 for Summarization using 🤗 Transformers and Amazon SageMaker
philschmid
April 8, 2021
sagemaker-distributed-training-seq2seq
guide, partnerships, aws, nlp
https://huggingface.co/blog/sagemaker-distributed-training-seq2seq
Configure distributed training and hyperparameters Next, we will define our hyperparameters and configure our distributed training strategy. As hyperparameter, we can define any Seq2SeqTrainingArguments and the ones defined in run_summarization.py. python # hyperparameters, which are passed into the training job hyperparameters={ 'per_device_train_batch_size': 4, 'per_device_eval_batch_size': 4, 'model_name_or_path':'facebook/bart-large-cnn', 'dataset_name':'samsum', 'do_train':True, 'do_predict': True, 'predict_with_generate': True, 'output_dir':'/opt/ml/model', 'num_train_epochs': 3, 'learning_rate': 5e-5, 'seed': 7, 'fp16': True, } # configuration for running training on smdistributed Data Parallel distribution = {'smdistributed':{'dataparallel':{ 'enabled': True }}} Since, we are using SageMaker Data Parallelism our total_batch_size will be per_device_train_batch_size * n_gpus. ---
[ 0.05833284929394722, 0.062414128333330154, -0.015486130490899086, 0.012499544769525528, 0.01649467460811138, 0.06592904776334763, -0.02142033539712429, 0.03567710146307945, -0.047531403601169586, -0.028195995837450027, -0.08674880117177963, -0.03609783202409744, 0.0461808480322361, 0.10720338672399521, -0.03382667526602745, -0.05838801711797714, 0.017274955287575722, -0.004494200926274061, 0.005082579795271158, 0.037675414234399796, 0.01259036734700203, 0.018882518634200096, 0.010241315700113773, 0.007459278218448162, -0.025019267573952675, -0.009951471351087093, 0.018721189349889755, 0.031156186014413834, 0.01985226571559906, -0.007915101945400238, -0.1000756248831749, -0.0017326384549960494, -0.014560941606760025, -0.001485595479607582, 0.034449491649866104, 0.022006522864103317, -0.099221371114254, 0.047316744923591614, 0.03316282480955124, 0.011199519038200378, 0.01827996037900448, -0.04810797795653343, -0.09826277196407318, 0.055176232010126114, 0.020640484988689423, 0.008767783641815186, -0.04354465380311012, -0.0023461163509637117, 0.023409966379404068, -0.007927708327770233, -0.0801505297422409, 0.059806130826473236, 0.01342276856303215, -0.02218555472791195, 0.022843122482299805, 0.0034352366346865892, -0.002411317778751254, -0.013129561208188534, -0.010127045214176178, -0.020607970654964447, -0.013444583863019943, 0.011557679623365402, -0.01112851221114397, 0.06935489177703857, 0.015165148302912712, -0.011031700298190117, -0.000031393214158015326, 0.012194053269922733, -0.032352957874536514, -0.07656914740800858, -0.004455444402992725, -0.051365505903959274, -0.018122488632798195, -0.013297775760293007, -0.05603281036019325, -0.05614452064037323, -0.009424248710274696, -0.03916453197598457, 0.04153238981962204, 0.10141854733228683, -0.059473536908626556, 0.04039732739329338, 0.01015466172248125, 0.027693018317222595, -0.0010322901653125882, 0.027827154844999313, -0.019670655950903893, -0.06107183173298836, 0.002976963995024562, 0.02834954857826233, -0.004330112133175135, -0.044217195361852646, 0.01190673466771841, -0.0045042941346764565, 0.015430350787937641, -0.014131584204733372, -0.01030463445931673, -0.054583773016929626, -0.049295373260974884, 0.010712826624512672, 0.020239073783159256, -0.04601750150322914, 0.04681207984685898, -0.06008552014827728, -0.03079294227063656, 0.08604436367750168, -0.0014634543331339955, -0.09874656796455383, -0.09214271605014801, 0.0018619186012074351, -0.0358622670173645, -0.024159738793969154, -0.07578308135271072, 0.07063763588666916, -0.08759515732526779, 0.009615587070584297, -0.013753596693277359, -0.040699392557144165, -0.014194211922585964, -0.035452015697956085, -0.03490207716822624, 0.11506613343954086, 0.057618290185928345, 0.03105408139526844, -0.06644883751869202, 0.026162615045905113, 0.012886849232017994, -0.0022141055669635534, 0.024481112137436867, -0.013129503466188908, -0.005559252109378576, -0.030152004212141037, 0.026555940508842468, 0.004861162044107914, 0.016554776579141617, -0.09782937169075012, -0.02276824414730072, -0.013944527134299278, 0.04048725590109825, 0.044706348329782486, -0.031810563057661057, 0.08440909534692764, 0.008622521534562111, 0.03885351121425629, 0.020925622433423996, 0.01095858495682478, 0.007384376134723425, 0.003891254309564829, 0.0041944971308112144, 0.005621188785880804, -0.08975765109062195, 0.12643074989318848, -0.01693119667470455, -0.061854805797338486, 0.10653538256883621, 0.06515590846538544, -0.02155473455786705, -0.03644761070609093, -0.0622769333422184, 0.013645628467202187, 0.00914947222918272, 0.031346045434474945, -0.05665447190403938, -0.008877086453139782, -0.024524200707674026, -0.008860333822667599, 0.031192200258374214, 0.016915464773774147, 0.04365144670009613, -0.0222682636231184, -0.03214319422841072, 0.02628343179821968, 0.018776029348373413, 0.003941766917705536, 0.07200859487056732, 0.02238040417432785, 0.0039636604487895966, 0.13685686886310577, -0.023250898346304893, 0.021168969571590424, -0.0601472444832325, 0.03209611400961876, -0.031178131699562073, 0.007336907088756561, 0.0292510986328125, -0.08623751997947693, 0.045925915241241455, -0.023300526663661003, 0.021810289472341537, 0.0451761819422245, -0.01451599970459938, -0.06323670595884323, 0.027426082640886307, -0.02701306715607643, 0.0813005194067955, -0.08452140539884567, 0.017797449603676796, 0.05183754116296768, 0.047608621418476105, 0.08658953011035919, 0.0410950630903244, -0.01855562999844551, -0.03305291756987572, 0.027955178171396255, 0.013815535232424736, 0.07179813832044601, -0.0374751053750515, -0.09096913784742355, 0.06435281038284302, -0.024802589789032936, -0.042043618857860565, -0.08893916755914688, -0.002657131291925907, -0.06649483740329742, 0.03476502373814583, 0.03963653743267059, -0.007130256853997707, -0.027704110369086266, 0.045444127172231674, 0.03138291835784912, 0.1666194498538971, -0.025567855685949326, 0.021638065576553345, 0.004741315729916096, 0.0001107830903492868, 0.009378420189023018, 0.054644618183374405, 0.08793125301599503, 0.04280457645654678, -0.047812290489673615, -0.03102274425327778, -0.03517669811844826, 0.02694077417254448, 0.07575599104166031, 0.0329156294465065, -0.0031886559445410967, -0.05346660688519478, -0.027454935014247894, 0.053565170615911484, -0.08556471019983292, 0.05934927985072136, 0.06280718743801117, -0.014877915382385254, 0.020779820159077644, -0.0377788282930851, -0.014618977904319763, 0.08266021311283112, -0.011162817478179932, -0.07586288452148438, -0.03708922117948532, -0.05197819694876671, 0.005287781823426485, 0.04358680546283722, -0.08182606846094131, 0.02780194766819477, 0.014085582457482815, 0.003613035660237074, 0.0014656087150797248, -0.007978416047990322, 0.021903907880187035, 0.0415685772895813, 0.048216983675956726, -0.03157171234488487, -0.0020351435523480177, -0.009176011197268963, -0.03463256359100342, 0.03625548258423805, -0.02590845339000225, -0.011716035194694996, 0.00019406963838264346, 0.03001113049685955, -0.008619554340839386, 0.0088124955072999, -0.0008528878097422421, 0.008977064862847328, -0.0160825178027153, 0.04808814451098442, -0.016786623746156693, -0.017502956092357635, -0.019144034013152122, 0.008990575559437275, -0.008078806102275848, -0.03015284426510334, 0.038806989789009094, -0.04230376332998276, -0.014957125298678875, -0.032297056168317795, -0.020215125754475594, -0.03329751640558243, -0.010388345457613468, 0.017326029017567635, 0.04296867549419403, 0.04929294064640999, -0.012489652261137962, -0.007019426673650742, 0.039076875895261765, 0.0002777127083390951, -0.022873546928167343, 0.01993023231625557, 0.006740658078342676, -0.01619117520749569, 0.029540808871388435, -0.007921137847006321, -0.005151644349098206, -0.030350614339113235, -0.005398262292146683, -0.024798966944217682, 0.038409292697906494, -0.08668306469917297, -0.00804467499256134, -0.004594838246703148, 0.036892760545015335, -0.027507247403264046, 0.025309797376394272, 0.049388591200113297, -0.04059809818863869, 0.029630668461322784, -0.01659034751355648, -0.003529103472828865, 0.022580215707421303, -0.023962801322340965, -0.024523494765162468, -0.0073427725583314896, 0.0120131466537714, -0.014042838476598263, -0.042290396988391876, 0.0354020930826664, 0.021323926746845245, -0.03493683412671089, 0.017512476071715355, 0.016427798196673393, 0.02072528377175331, -0.000988093321211636, 0.028813177719712257, 0.04426887631416321, 0.032818280160427094, -0.017173953354358673, -0.04012418910861015, -0.011622809804975986, -0.04369674623012543, -0.036592770367860794, -0.022473851218819618, 0.005038847681134939, -0.000500775407999754, 0.03288566321134567, 0.005955842323601246, 0.007376838009804487, 0.02180132083594799, 0.007872892543673515, -0.029785864055156708, 0.034532271325588226, -0.04101616516709328, 0.048188794404268265, 0.014483513310551643, -0.015807807445526123, -0.00925023015588522, 0.037245552986860275, -0.009879788383841515, 0.0012415761593729258, -0.018488368019461632, 0.0047463346272706985, 0.010110009461641312, -0.025993134826421738, 0.008997099474072456, 0.024812787771224976, 0.059592824429273605, 0.04410407319664955, -0.007140636444091797, -0.03444977477192879, 0.010062504559755325, -0.02068004384636879, -0.026267334818840027, -0.02237567864358425, 0.02857011742889881, 0.035977721214294434, 0.011112588457763195, -0.03859688714146614, 0.03195514529943466, -0.00011395145702408627, 0.035724423825740814, -0.008379513397812843, 0.009346849285066128, -0.042092759162187576, -0.015761572867631912, -0.03894255310297012, -0.019972333684563637, 0.03215145692229271, 0.061099179089069366, 0.03421002998948097, 0.00457000033929944, -0.027027687057852745, -0.03939061984419823, 0.019892089068889618, 0.005650356411933899, 0.04320697858929634, -0.06357340514659882, 0.046905986964702606, 0.029608579352498055, -0.016092510893940926, -0.024257928133010864, 0.040067169815301895, 0.009517744183540344, -0.006851715501397848, -0.01152915507555008, 0.05429597571492195, 0.028017409145832062, -0.019761288538575172, -0.0029205852188169956, 0.005283324513584375, -0.05481519177556038, 0.009795851074159145, -0.014259477145969868, -0.023598041385412216, 0.018833214417099953, -0.03364069387316704, -0.030801959335803986, -0.041055433452129364, -0.013275585137307644, 0.04441774636507034, -0.004617912694811821, 0.00655012670904398, -0.03340122103691101, 0.024244509637355804, 0.04418517276644707, -0.047074515372514725, -0.005194175057113171, 0.02516932040452957, 0.055109553039073944, -0.0302935391664505, 0.0370757132768631, 0.00283226789906621, -0.034279271960258484, 0.011473284102976322, 0.011761211790144444, 0.02309124916791916, 0.01936970092356205, -0.01316481176763773, -0.05933522433042526, -0.033451639115810394, -0.01548957359045744, -0.028916703537106514, -0.005306655075401068, -0.03480525687336922, 0.028086967766284943, -0.027568109333515167, 0.028612466529011726, 0.027985746040940285, -0.022001951932907104, -0.008951215073466301, 0.05210661515593529, 0.02046012319624424, 0.012807735241949558, 0.021688498556613922, -0.0076111298985779285, -0.07668399810791016, -0.022585509344935417, -0.043698813766241074, -0.0077288225293159485, 0.013559511862695217, 0.020973296836018562, -0.04766634479165077, -0.001054793014191091, 0.03427954390645027, -0.017966384068131447, -0.010104156099259853, 0.04521295055747032, 0.002816251013427973, 0.046503424644470215, -0.011031528003513813, -0.033056870102882385, -0.006680638529360294, -0.004046134650707245, 0.00824692565947771, 0.0336146354675293, 0.006874418817460537, -0.05956035852432251, -0.0007327672792598605, 0.005159482359886169, -0.0026672908570617437, 0.013203799724578857, 0.007153613027185202, -0.043983813375234604, 0.024899214506149292, 0.02048570290207863, 0.02164442650973797, 0.05725362151861191, -0.06016559153795242, -0.025265756994485855, -0.005231798160821199, -0.042384278029203415, -0.014072147198021412, -0.03653813898563385, -0.043740786612033844, 0.032600630074739456, 0.020581305027008057, 0.009336734190583229, 0.0062541477382183075, 0.045685820281505585, 0.014428411610424519, -0.027184687554836273, 0.028384268283843994, -0.032855790108442307, 0.009295296855270863, 0.04237932339310646, 0.01613466441631317, 0.01510190311819315, -0.016300160437822342, -0.0261203832924366, 0.04250963032245636, 0.03926893696188927, -0.014672146178781986, -0.06432151049375534, 0.016262244433164597, 0.012934345752000809, 0.005913907196372747, -0.017441963776946068, -0.012293453328311443, 0.010802973061800003, -0.007586299441754818, -0.012428074143826962, -0.03523198142647743, 0.005713471211493015, 0.015309388749301434, -0.028603078797459602, -0.04762234538793564, 0.036744147539138794, 0.003597090719267726, 0.003630764316767454, -0.04739322140812874, -0.025965876877307892, 0.001623694784939289, -0.022806957364082336, -0.021806880831718445, -0.028911223635077477, 0.011472731828689575, 0.01235737930983305, 0.03286980465054512, 0.06991413235664368, -0.005173488985747099, -0.016021376475691795, -0.0632181316614151, 0.011372181586921215, 0.02011966146528721, -0.004092610906809568, -0.014297658577561378, 0.06260675936937332, 0.022896235808730125, -0.04415038228034973, -0.0492786169052124, -0.0006328723975457251, -0.009461099281907082, 0.02242613211274147, -0.042625125497579575, 0.0167043786495924, 0.03890826180577278, -0.04576300457119942, 0.03607909753918648, -0.054196350276470184, 0.006186846178025007, 0.0260123610496521, 0.022557450458407402, 0.010678065940737724, -0.001427549053914845, 0.02948758937418461, -0.021957814693450928, -0.006091596558690071, 0.03563087061047554, 0.0073723942041397095, -0.0025034446734935045, -0.05704379826784134, 0.03070232830941677, -0.015285193920135498, -0.0207394827157259, 0.012296593748033047, -0.005282342899590731, -0.03393658995628357, 0.0038903888780623674, 0.011897848919034004, 0.02208695374429226, 0.05483431741595268, -0.017683707177639008, 0.004112115129828453, 0.005634141620248556, 0.012545065023005009, -0.04041081666946411, 0.047965921461582184, -0.04086589813232422, 0.016963206231594086, -0.006974183954298496, 0.0537271574139595, 0.028096139430999756, 0.011120536364614964, -0.008975960314273834, -0.01618741825222969, 0.07070835679769516, 0.008839876390993595, 0.009290855377912521, 0.014970858581364155, 0.013606050051748753, -0.03368770703673363, -0.03223656490445137, -0.018895156681537628, -0.021622397005558014, 0.01600504107773304, 0.022664587944746017, 0.014914370141923428, 0.013850520364940166, 0.021579645574092865, 0.060587380081415176, 0.06710255146026611, 0.0009050916414707899, 0.019584743306040764, -0.02199753373861313, 0.05391944572329521, -0.005971020553261042, -0.025615990161895752, 0.07302277535200119, -0.01741959899663925, 0.0024364222772419453, 0.003358022775501013, 0.014326363801956177, 0.02645183354616165, -0.012231803499162197, 0.008521916344761848, -0.037386562675237656, -0.04340386390686035, -0.02915562316775322, -0.0026996899396181107, 0.028049636632204056, -0.017308171838521957, 0.007705708034336567, 0.007493481505662203, -0.018469879403710365, 0.05974829941987991, -0.03512713685631752, 0.028710417449474335, -0.0013473581057041883, -0.01542811468243599, -0.04776745289564133, 0.021222280338406563, -0.017859984189271927, -0.034101031720638275, 0.0011962978169322014, -0.015187956392765045, -0.009220588020980358, 0.05616898462176323, -0.001215523574501276, -0.015107392333447933, 0.00027463005972094834, 0.005814655683934689, -0.00459023704752326, 0.052856821566820145, -0.021417157724499702, 0.03357447683811188, 0.02482881210744381, 0.0010010699043050408, 0.0052226390689611435, 0.0355079360306263, 0.005351163912564516, 0.018861331045627594, -0.006483546458184719, 0.01757482811808586, -0.011430065147578716, -0.04062791168689728, 0.0672042965888977, -0.003941722214221954, 0.06680930405855179, 0.003457076149061322, 0.05219288542866707, 0.01217078696936369, -0.002072342438623309, 0.003282270859926939, -0.023391257971525192, -0.007429771590977907, -0.016027793288230896, -0.023974601179361343, 0.03654118627309799, -0.0022293890360742807, -0.012281161732971668, 0.018815988674759865, 0.024242235347628593, -0.016699351370334625, -0.010582135990262032, 0.01247531920671463, 0.036123279482126236, -0.024263650178909302, 0.04330548271536827, 0.02800389938056469, 0.035445909947156906, 0.004156905226409435, 0.016460571438074112, -0.005852723494172096, -0.002372181508690119, 0.03662615641951561, -0.0019983043894171715, -0.009053013287484646, -0.03838777169585228, 0.03988473862409592, -0.024698475375771523, -0.051326215267181396, -0.026804935187101364, 0.00992671214044094, -0.0731462687253952, 0.04511610418558121, -0.04730827733874321, -0.007822251878678799, 0.009866435080766678, 0.004551518242806196, -0.0455753430724144, 0.012456769123673439, 0.07002374529838562, 0.05667293071746826, 0.03744050860404968, 0.02818228304386139, -0.05241893604397774, -0.017985418438911438, -0.020407073199748993, 0.0063714925199747086, 0.07394824922084808, 0.03223537653684616, -0.026076948270201683, 0.000502224313095212, 0.034732457250356674, 0.016067693009972572, -0.040441155433654785, -0.05290551856160164, -0.01594209298491478, -0.022611936554312706, -0.036323241889476776, -0.0015039579011499882, 0.03728996589779854, -0.00655425013974309, 0.058249060064554214, -0.017111241817474365, 0.020817020907998085, -0.01220887340605259, 0.004853926133364439, -0.0299341082572937, 0.02496386505663395, -0.01685073971748352, -0.06957177072763443, 0.027074022218585014, -0.009503182955086231, 0.026347240433096886, -0.0363788865506649, -0.012037518434226513, -0.021435143426060677, -0.026600657030940056, -0.004952880088239908, -0.06551522761583328, 0.019559096544981003, 0.011753413826227188, -0.04282213747501373, 0.0018237695330753922, -0.019282888621091843, 0.003245753701776266, -0.04467684403061867, 0.005704901181161404, 0.0037604435347020626, 0.015826739370822906, -0.004553698934614658, 0.025072850286960602, 0.024052204564213753, 0.03442743048071861, 0.035260919481515884, 0.010520339012145996, 0.027128631249070168, 0.029096661135554314 ]
Distributed Training: Train BART/T5 for Summarization using 🤗 Transformers and Amazon SageMaker
philschmid
April 8, 2021
sagemaker-distributed-training-seq2seq
guide, partnerships, aws, nlp
https://huggingface.co/blog/sagemaker-distributed-training-seq2seq
Upload the fine-tuned model to huggingface.co Since our model achieved a pretty good score we are going to upload it to huggingface.co, create a model_card and test it with the Hosted Inference widget. To upload a model you need to create an account here. We can download our model from Amazon S3 and unzip it using the following snippet. python import os import tarfile from sagemaker.s3 import S3Downloader local_path = 'my_bart_model' os.makedirs(local_path, exist_ok = True) # download model from S3 S3Downloader.download( s3_uri=huggingface_estimator.model_data, # s3 uri where the trained model is located local_path=local_path, # local path where *.tar.gz will be saved sagemaker_session=sess # sagemaker session used for training the model ) # unzip model tar = tarfile.open(f"{local_path}/model.tar.gz", "r:gz") tar.extractall(path=local_path) tar.close() os.remove(f"{local_path}/model.tar.gz") Before we are going to upload our model to huggingface.co we need to create a model_card. The model_card describes the model and includes hyperparameters, results, and specifies which dataset was used for training. To create a model_card we create a README.md in our local_path python # read eval and test results with open(f"{local_path}/eval_results.json") as f: eval_results_raw = json.load(f) eval_results={} eval_results["eval_rouge1"] = eval_results_raw["eval_rouge1"] eval_results["eval_rouge2"] = eval_results_raw["eval_rouge2"] eval_results["eval_rougeL"] = eval_results_raw["eval_rougeL"] eval_results["eval_rougeLsum"] = eval_results_raw["eval_rougeLsum"] with open(f"{local_path}/test_results.json") as f: test_results_raw = json.load(f) test_results={} test_results["test_rouge1"] = test_results_raw["test_rouge1"] test_results["test_rouge2"] = test_results_raw["test_rouge2"] test_results["test_rougeL"] = test_results_raw["test_rougeL"] test_results["test_rougeLsum"] = test_results_raw["test_rougeLsum"] After we extract all the metrics we want to include we are going to create our README.md. Additionally to the automated generation of the results table we add the metrics manually to the metadata of our model card under model-index python import json MODEL_CARD_TEMPLATE = """ --- language: en tags: - sagemaker - bart - summarization license: apache-2.0 datasets: - samsum model-index: - name: {model_name} results: - task: name: Abstractive Text Summarization type: abstractive-text-summarization dataset: name: "SAMSum Corpus: A Human-annotated Dialogue Dataset for Abstractive Summarization" type: samsum metrics: - name: Validation ROGUE-1 type: rogue-1 value: 42.621 - name: Validation ROGUE-2 type: rogue-2 value: 21.9825 - name: Validation ROGUE-L type: rogue-l value: 33.034 - name: Test ROGUE-1 type: rogue-1 value: 41.3174 - name: Test ROGUE-2 type: rogue-2 value: 20.8716 - name: Test ROGUE-L type: rogue-l value: 32.1337 widget: - text: | Jeff: Can I train a 🤗 Transformers model on Amazon SageMaker? Philipp: Sure you can use the new Hugging Face Deep Learning Container. Jeff: ok. Jeff: and how can I get started? Jeff: where can I find documentation? Philipp: ok, ok you can find everything here. https://huggingface.co/blog/the-partnership-amazon-sagemaker-and-hugging-face ---
[ 0.028516553342342377, -0.022416293621063232, -0.025956658646464348, 0.06436232477426529, 0.025848152115941048, 0.062412433326244354, 0.044938843697309494, 0.050343722105026245, -0.03083556890487671, 0.02069191075861454, -0.03291761875152588, -0.004023367539048195, 0.0253438763320446, 0.055898912250995636, -0.009769488126039505, -0.09734389930963516, 0.05564507469534874, 0.016764381900429726, -0.02686920389533043, 0.0008905804716050625, -0.03531995788216591, -0.0788128450512886, -0.033175867050886154, 0.0014501281548291445, -0.03823598474264145, -0.01784069463610649, 0.04603099822998047, 0.02734200470149517, 0.02889658883213997, 0.007530420087277889, -0.028200378641486168, 0.010015685111284256, -0.02545892260968685, -0.052203916013240814, 0.00875100214034319, 0.07458378374576569, -0.1313742697238922, 0.016043366864323616, -0.02949392795562744, -0.052848994731903076, 0.011247494257986546, 0.00828663632273674, -0.02507358230650425, 0.06854157894849777, 0.054143570363521576, -0.1113908514380455, -0.10787606984376907, 0.029879966750741005, -0.0098488200455904, -0.0036511404905468225, -0.023906534537672997, 0.10305066406726837, 0.011747356504201889, -0.01783362776041031, 0.03094254806637764, 0.016046257689595222, 0.0005178695428185165, -0.030741116032004356, -0.009567632339894772, -0.008135869167745113, 0.023503649979829788, -0.024542709812521935, 0.005468643736094236, 0.013879820704460144, -0.04593417048454285, 0.0421409048140049, -0.016767369583249092, -0.015431168489158154, -0.06125711649656296, -0.019691191613674164, 0.006438620388507843, -0.0648382157087326, 0.03404386714100838, -0.03958936408162117, -0.08075132220983505, -0.04136762022972107, 0.020352376624941826, 0.03872426971793175, 0.056147415190935135, 0.049145158380270004, -0.008169371634721756, -0.05026978626847267, -0.022025760263204575, 0.06381060928106308, 0.0312165729701519, 0.00028189466684125364, 0.0004236981912981719, -0.04317929968237877, -0.07198803126811981, 0.024337738752365112, 0.0107364971190691, -0.0690779983997345, -0.02820887230336666, 0.02304728329181671, 0.057628437876701355, -0.0020718672312796116, 0.0018301313975825906, -0.003834841540083289, 0.003610131563618779, 0.01443182211369276, 0.021948451176285744, -0.06121421977877617, 0.004067915957421064, -0.04586222395300865, -0.02122686617076397, 0.0722840428352356, 0.005396222695708275, -0.11339832097291946, 0.013207695446908474, 0.02214493602514267, 0.07107216864824295, -0.020744554698467255, -0.032935768365859985, 0.0461047887802124, -0.13899566233158112, 0.02016313746571541, 0.013529397547245026, -0.052328094840049744, 0.012202264741063118, 0.003394628409296274, 0.010261948220431805, 0.07630185782909393, 0.02547336183488369, -0.04503607749938965, 0.036726370453834534, 0.06609006971120834, 0.038447584956884384, 0.030908502638339996, 0.020734591409564018, -0.043189987540245056, 0.07953441888093948, -0.02301514521241188, 0.03298872709274292, 0.0077746836468577385, 0.01684817671775818, -0.03816908225417137, -0.03287162631750107, -0.0764063149690628, -0.01510612666606903, -0.0018356089713051915, -0.011334761045873165, 0.0781053826212883, -0.048597585409879684, 0.002086211461573839, 0.04152701795101166, 0.013230636715888977, -0.0216426569968462, 0.10092046111822128, 0.02457376942038536, 0.03859502449631691, -0.06689389795064926, 0.08000461012125015, 0.0029740119352936745, -0.0538952611386776, 0.018233036622405052, 0.0885547623038292, -0.03866152465343475, -0.014395938254892826, -0.045703765004873276, -0.01685428060591221, 0.011151724494993687, -0.03139067441225052, -0.023313729092478752, -0.011114219203591347, 0.003525570034980774, 0.004015382844954729, 0.07929989695549011, 0.012300475500524044, 0.05047718435525894, -0.0788908526301384, 0.038615286350250244, -0.06174212694168091, 0.14250969886779785, 0.0021748479921370745, 0.024778006598353386, 0.05062850937247276, 0.044689565896987915, 0.08246684074401855, -0.04691605269908905, 0.040537938475608826, -0.03658214211463928, 0.043306853622198105, -0.015339266508817673, 0.035490673035383224, 0.06077471375465393, -0.058282189071178436, -0.017630288377404213, -0.014072190038859844, 0.04968230053782463, -0.021618004888296127, -0.005976162385195494, -0.0246188472956419, 0.1125807985663414, -0.02237834595143795, 0.03381296992301941, -0.04270748421549797, -0.036751531064510345, 0.06981033831834793, 0.04644771292805672, -0.0037635741755366325, 0.00721246562898159, 0.02759426273405552, 0.015230201184749603, 0.027086351066827774, -0.02102511376142502, 0.026838721707463264, -0.006822369061410427, -0.06057438626885414, 0.018938902765512466, 0.002506721531972289, 0.026786739006638527, -0.13963565230369568, 0.0459018237888813, -0.08754774183034897, -0.007281629368662834, -0.02600729838013649, -0.03013528324663639, 0.008078894577920437, -0.03330270200967789, -0.008860945701599121, 0.18385598063468933, 0.03274032846093178, 0.07839878648519516, -0.06038838252425194, -0.04846285283565521, -0.014443470165133476, 0.04528145119547844, 0.0784614086151123, 0.07155772298574448, -0.04364964738488197, -0.017372263595461845, -0.0655272901058197, -0.02809598483145237, -0.013065388426184654, 0.01990075781941414, -0.05451993644237518, 0.02056022919714451, -0.05666910111904144, -0.016018584370613098, -0.017110921442508698, 0.06430194526910782, -0.012745670042932034, 0.01587202027440071, -0.0014261036412790418, -0.013023074716329575, -0.022326121106743813, 0.03593726456165314, 0.032843347638845444, -0.027657348662614822, -0.03292100131511688, -0.045762546360492706, 0.06786298006772995, 0.029369376599788666, 0.05297036096453667, 0.03665880113840103, -0.0013304443564265966, -0.016077594831585884, 0.024594269692897797, 0.014512265101075172, 0.07833115011453629, 0.043043479323387146, 0.014405827969312668, -0.006462255958467722, -0.01725034788250923, 0.02305348590016365, -0.04978202283382416, -0.01501909177750349, -0.006848542485386133, -0.016389071941375732, -0.03462489694356918, 0.042175568640232086, -0.027411585673689842, -0.016378415748476982, 0.012654420919716358, 0.01354994997382164, 0.10508096218109131, 0.02440633811056614, -0.025007883086800575, -0.018965860828757286, 0.003339670831337571, 0.002033637370914221, -0.014677422121167183, -0.02929069846868515, 0.0009207363473251462, 0.022038569673895836, -0.018044443801045418, -0.0061104269698262215, -0.0177316814661026, -0.04512294381856918, 0.03377252817153931, 0.02267944999039173, 0.03182005509734154, 0.020770136266946793, -0.008720236830413342, 0.009964167140424252, -0.0030294933822005987, 0.012144260108470917, -0.03795529901981354, 0.017109697684645653, 0.03857853263616562, -0.010077297687530518, -0.013311050832271576, -0.0006635414902120829, -0.03528127074241638, -0.043228041380643845, -0.007623771205544472, 0.02079213224351406, 0.013690091669559479, -0.08865565806627274, -0.04690170660614967, -0.006590971257537603, 0.00933170411735773, -0.016377314925193787, 0.0034985654056072235, 0.02715175412595272, -0.010204363614320755, -0.003681599162518978, 0.03358028829097748, 0.015790652483701706, 0.01161952130496502, 0.008081330917775631, 0.019409170374274254, -0.01290046889334917, 0.03998653590679169, 0.00928455125540495, 0.0023918726947158575, 0.016221148893237114, 0.041974492371082306, -0.036862798035144806, 0.045547276735305786, -0.03619407117366791, -0.013757513836026192, 0.008224907331168652, 0.0015383042627945542, 0.013529115356504917, 0.023126080632209778, -0.004461887292563915, -0.04078061878681183, -0.005702132824808359, -0.0643630400300026, 0.000815630133729428, -0.01593933440744877, -0.05014338716864586, -0.0026261499151587486, 0.004780857358127832, 0.013431205414235592, 0.01037087943404913, 0.0032453094609081745, -0.010192884132266045, -0.012219825759530067, -0.0000870431904331781, 0.03359701484441757, 0.03551620990037918, 0.021440958604216576, -0.010373077355325222, 0.0032580378465354443, 0.0023939437232911587, 0.007050675339996815, -0.023113396018743515, 0.03324604406952858, 0.014520462602376938, 0.05476725473999977, -0.03369315713644028, 0.044602904468774796, 0.01662544719874859, 0.006971313152462244, 0.015606041997671127, -0.0252497810870409, -0.07991016656160355, 0.002198263769969344, -0.05081099644303322, -0.000980942277237773, 0.021303456276655197, 0.03473402187228203, 0.015755075961351395, -0.02992440201342106, -0.042306650429964066, 0.01582387089729309, 0.008554920554161072, 0.040108442306518555, -0.038578834384679794, 0.01029788888990879, -0.027205469086766243, -0.02981008216738701, -0.030110033228993416, -0.025225242599844933, 0.04382744058966637, 0.04008576646447182, -0.023868320509791374, 0.014728985726833344, -0.011991484090685844, -0.020647529512643814, 0.009564787149429321, -0.009263101033866405, 0.011179806664586067, -0.07895272970199585, 0.045732613652944565, 0.043680932372808456, 0.010436967946588993, -0.010159626603126526, 0.02044326812028885, 0.002507885219529271, -0.012583434581756592, -0.02865825593471527, 0.03067808225750923, 0.0017252446850761771, -0.015057068318128586, 0.002993814181536436, 0.001407050178386271, -0.04921388626098633, -0.025340458378195763, 0.012292949482798576, -0.009072376415133476, 0.007468085270375013, -0.037197358906269073, -0.039552658796310425, 0.0008597440901212394, -0.017636267468333244, 0.016900544986128807, -0.0006906597991473973, -0.028597800061106682, -0.00134267657995224, 0.024353858083486557, 0.012737787328660488, -0.01525640394538641, -0.014878627844154835, -0.011174391955137253, 0.04702642932534218, -0.024774957448244095, 0.03159864619374275, 0.021580105647444725, -0.06833598762750626, 0.016547922044992447, 0.041463255882263184, 0.01662134751677513, 0.051490046083927155, -0.018766218796372414, -0.02223709225654602, -0.02651783637702465, 0.000023939077436807565, 0.009793954901397228, -0.00638064369559288, 0.020584329962730408, 0.00016281241551041603, -0.011852597817778587, 0.019567245617508888, 0.06202057749032974, 0.006136948708444834, 0.0029619112610816956, 0.03471411019563675, 0.015769872814416885, -0.03330536186695099, 0.030959058552980423, 0.02639479748904705, -0.03204473853111267, 0.016332920640707016, -0.009785990230739117, 0.016714496538043022, -0.002472731750458479, 0.003212215378880501, -0.06401663273572922, 0.004293263889849186, 0.009699217975139618, -0.013892428018152714, 0.000024736598788877018, 0.013387249782681465, 0.00011668670776998624, 0.07261539995670319, 0.011559887789189816, 0.06479877978563309, -0.019230205565690994, 0.01874399185180664, 0.019264239817857742, 0.03183041140437126, -0.03091489151120186, -0.04749215021729469, -0.02709835022687912, 0.008399863727390766, -0.029877841472625732, 0.011002386920154095, 0.021753989160060883, -0.06525525450706482, -0.0007274840027093887, 0.04780463129281998, 0.021781353279948235, -0.020245036110281944, -0.030715212225914, 0.04469824954867363, -0.02833833359181881, -0.026278415694832802, -0.022543292492628098, -0.035947978496551514, 0.011552738957107067, -0.01706666499376297, 0.08710847049951553, 0.07995875924825668, -0.01724829152226448, 0.006312697194516659, 0.0017086988082155585, -0.003517444944009185, 0.0233279000967741, -0.0510227233171463, -0.020881004631519318, -0.017806164920330048, 0.03085113875567913, -0.0037456408608704805, -0.004426049068570137, -0.020577123388648033, 0.03270602598786354, 0.03752393275499344, -0.02693786658346653, 0.007954482920467854, 0.027324851602315903, -0.03225580230355263, -0.0024673771113157272, 0.014960031025111675, 0.02596439979970455, -0.02248549461364746, -0.002029500901699066, 0.019469667226076126, 0.012944616377353668, -0.001378280227072537, -0.0014727870002388954, -0.06465902179479599, -0.0325167253613472, 0.036354467272758484, 0.023811068385839462, 0.03214661404490471, 0.004525976721197367, -0.005549825262278318, 0.02289932779967785, -0.02261298894882202, 0.010992736555635929, 0.005595608614385128, 0.03401634469628334, -0.015169898048043251, -0.02208782732486725, 0.03664794936776161, -0.013379828073084354, -0.022124256938695908, 0.004706548061221838, 0.0015230254502967, 0.04332377761602402, -0.026863647624850273, -0.021853609010577202, 0.04358018934726715, 0.03421986848115921, -0.028233876451849937, -0.010795895010232925, -0.0029040167573839426, -0.026590831577777863, 0.005876186769455671, -0.09276529401540756, -0.009441317059099674, 0.048760101199150085, 0.011982662603259087, 0.03228045627474785, 0.0004394662391860038, 0.0022975720930844545, 0.0564865842461586, 0.030303113162517548, 0.0036725772079080343, -0.016552982851862907, -0.02817491441965103, -0.0136689692735672, 0.008097217418253422, -0.01189402211457491, -0.007362142205238342, 0.016825765371322632, -0.012827606871724129, 0.017225852236151695, 0.05901293456554413, -0.0158671997487545, 0.007786376867443323, 0.02544906735420227, -0.040423255413770676, -0.0005186095950193703, -0.010553836822509766, 0.02750415913760662, 0.017864661291241646, -0.0029078491497784853, 0.004978710785508156, 0.014638666063547134, 0.028455227613449097, 0.030707063153386116, 0.06429737061262131, -0.022250985726714134, 0.025787942111492157, -0.00011384291428839788, 0.03587888926267624, 0.039749931544065475, -0.009834649972617626, 0.01544119231402874, 0.002545670373365283, 0.057187847793102264, -0.029696714133024216, 0.05790014564990997, 0.017565574496984482, 0.004087814595550299, -0.01530863530933857, -0.030259031802415848, -0.009060989134013653, -0.005839741788804531, -0.002256810199469328, 0.07305896282196045, -0.02617478556931019, 0.014378044754266739, -0.0155702019110322, 0.06157112494111061, 0.02431901916861534, 0.06822773069143295, 0.01703893393278122, 0.015087967738509178, 0.0456404834985733, -0.015163681469857693, -0.018480686470866203, 0.007463077083230019, 0.010154752992093563, 0.004083649255335331, 0.038340672850608826, -0.008269266225397587, 0.023041540756821632, -0.000587516522500664, 0.03161444887518883, 0.020005863159894943, -0.01767777092754841, -0.022340819239616394, 0.045648712664842606, 0.028062857687473297, 0.00681357691064477, -0.009891338646411896, 0.021304244175553322, -0.015193140134215355, 0.03097679279744625, -0.036365434527397156, -0.006237732246518135, -0.028992876410484314, -0.022497810423374176, 0.017784040421247482, 0.039220936596393585, 0.02368052862584591, -0.03863828256726265, -0.018506690859794617, 0.013412127271294594, -0.00867998506873846, 0.007121728733181953, -0.016811301931738853, -0.038093019276857376, -0.04308704659342766, -0.030766082927584648, -0.04180300608277321, 0.034686729311943054, 0.004714068956673145, 0.002450216095894575, 0.008023364469408989, 0.01340868417173624, -0.00830172747373581, 0.019039995968341827, 0.021767858415842056, -0.001272801891900599, -0.004437370225787163, 0.008337823674082756, 0.03153334558010101, -0.0147293945774436, 0.009446628391742706, -0.02680175006389618, -0.0019035269506275654, 0.004999225959181786, 0.08206725865602493, -0.0037236104253679514, 0.016941362991929054, -0.000493296014610678, -0.015479263849556446, 0.007668850012123585, 0.00509810633957386, -0.007673447486013174, 0.00892677716910839, -0.021047960966825485, -0.02292242832481861, -0.00020480774401221424, 0.010220874100923538, 0.014442335814237595, 0.031172575429081917, 0.010581156238913536, 0.03031139075756073, -0.03998829051852226, -0.0058549270033836365, -0.04427000880241394, 0.03495001792907715, 0.009757349267601967, 0.003637353191152215, 0.02621474303305149, 0.03731926903128624, -0.020891230553388596, -0.002164713805541396, -0.0039682150818407536, -0.049743834882974625, -0.039913177490234375, -0.0634508803486824, -0.10465764254331589, -0.009082427248358727, -0.030764140188694, -0.035474151372909546, 0.0038267280906438828, -0.07377311587333679, -0.06756220012903214, -0.028570301830768585, -0.043365009129047394, -0.002905654488131404, -0.006868403404951096, 0.06388184428215027, 0.02720791846513748, -0.020889580249786377, 0.00464964983984828, -0.023248307406902313, -0.002512622158974409, -0.0012863274896517396, 0.006255389656871557, 0.024516332894563675, -0.003097123233601451, 0.0033248646650463343, -0.006631196476519108, 0.036837659776210785, 0.022498199716210365, -0.055427104234695435, 0.028791289776563644, 0.019581060856580734, -0.02040993981063366, -0.03245912492275238, -0.011916947551071644, 0.04268962889909744, -0.02644130401313305, 0.03378206491470337, 0.006146947853267193, -0.020742125809192657, -0.03584105148911476, 0.024794483557343483, -0.058623190969228745, 0.019431937485933304, -0.04718933254480362, -0.012074090540409088, 0.024592064321041107, -0.022267373278737068, 0.0012405768502503633, 0.005807699169963598, -0.022760359570384026, 0.004593182820826769, -0.002931953174993396, -0.07185442000627518, -0.03427988290786743, 0.03886587917804718, 0.0364389643073082, -0.010415280237793922, -0.026806997135281563, -0.0374126136302948, -0.0058628045953810215, -0.027537936344742775, 0.004751323256641626, 0.0018862206488847733, 0.008726019412279129, -0.039087820798158646, -0.021038200706243515, -0.017528537660837173, -0.003411733079701662, -0.012429207563400269, -0.027455832809209824, -0.025476356968283653, 0.034893304109573364 ]
Distributed Training: Train BART/T5 for Summarization using 🤗 Transformers and Amazon SageMaker
philschmid
April 8, 2021
sagemaker-distributed-training-seq2seq
guide, partnerships, aws, nlp
https://huggingface.co/blog/sagemaker-distributed-training-seq2seq
Model and Dataset We are going to fine-tune facebook/bart-large-cnn on the samsum dataset. "BART is sequence-to-sequence model trained with denoising as pretraining objective." [REF] The samsum dataset contains about 16k messenger-like conversations with summaries. json {"id": "13818513", "summary": "Amanda baked cookies and will bring Jerry some tomorrow.", "dialogue": "Amanda: I baked cookies. Do you want some?\r\nJerry: Sure!\r\nAmanda: I'll bring you tomorrow :-)"} ---
[ -0.06306435167789459, -0.004353444091975689, -0.005170109216123819, -0.021318567916750908, 0.009103288874030113, 0.019625572487711906, 0.038438547402620316, 0.09845493733882904, -0.018239345401525497, -0.08024957031011581, -0.07649920135736465, -0.013550393283367157, -0.016934208571910858, -0.048006150871515274, -0.04061339423060417, -0.0707436129450798, 0.06205412372946739, 0.004719212651252747, 0.01107910554856062, 0.00805919524282217, -0.01372690312564373, -0.024913884699344635, -0.0072525059804320335, -0.034369681030511856, 0.013640986755490303, -0.011207937262952328, -0.004627466667443514, 0.0038964550476521254, -0.03959523141384125, -0.005588495172560215, -0.063807412981987, 0.0023693866096436977, 0.0013768624048680067, -0.025414202362298965, 0.0200290996581316, 0.03471372276544571, -0.05876488983631134, 0.06101708486676216, -0.008030479773879051, -0.025435741990804672, -0.038163572549819946, -0.06225261092185974, -0.06347990781068802, 0.07316946983337402, 0.02275063842535019, -0.019417135044932365, -0.09288232773542404, 0.02031775377690792, -0.05295431986451149, -0.04374994710087776, -0.08545112609863281, 0.08771675825119019, -0.002263919450342655, -0.021882088854908943, 0.029409650713205338, -0.009730598889291286, 0.03600764274597168, -0.09208613634109497, 0.00504594761878252, 0.0076651377603411674, 0.018313689157366753, 0.015050241723656654, 0.00516423350200057, -0.008017122745513916, 0.056495990604162216, -0.009719748981297016, 0.01825658604502678, -0.004265171010047197, -0.04655369743704796, -0.03657759353518486, 0.06852518767118454, -0.05008918046951294, -0.05509379133582115, 0.010860203765332699, -0.034383200109004974, 0.0033301743678748608, -0.013618062250316143, 0.02886132523417473, -0.015127561055123806, -0.014649691991508007, -0.08793189376592636, 0.05868762731552124, 0.106209397315979, 0.030822789296507835, 0.0003654522297438234, 0.05730177089571953, 0.09624507278203964, -0.005924890749156475, -0.03470463678240776, -0.01841621845960617, -0.045021701604127884, -0.05361954867839813, 0.04736894369125366, -0.021173277869820595, 0.02494249865412712, 0.03586609661579132, -0.012280930764973164, -0.01837342232465744, 0.03470525145530701, 0.00860851351171732, -0.10659266263246536, -0.03489742428064346, 0.05918723717331886, -0.08497464656829834, -0.049173254519701004, 0.01344314031302929, -0.05751267075538635, -0.05364295840263367, -0.0007284542662091553, -0.01878770999610424, 0.04680883511900902, 0.02938312105834484, -0.01457276288419962, 0.08032725006341934, -0.14192050695419312, 0.03152865171432495, 0.016225650906562805, -0.0859745517373085, 0.006927304435521364, -0.04945017769932747, -0.04325007274746895, 0.06783812493085861, 0.10682977735996246, -0.0564301572740078, 0.01037653349339962, 0.012191995047032833, -0.05726702883839607, 0.011206611059606075, 0.0014577172696590424, 0.06788460165262222, -0.003994190599769354, -0.010890036821365356, 0.050139881670475006, 0.0288343895226717, 0.032176800072193146, -0.05965844914317131, -0.06748102605342865, 0.0010905080707743764, 0.039207231253385544, 0.01392031367868185, -0.0033008975442498922, 0.0231760386377573, 0.00011668583465507254, 0.025348419323563576, 0.06416990607976913, -0.04562131315469742, -0.03715018928050995, 0.06577995419502258, -0.017442775890231133, 0.019747909158468246, -0.07404262572526932, 0.02276560477912426, -0.025595638900995255, -0.05855901911854744, 0.027030035853385925, 0.0606185682117939, 0.032018598169088364, -0.06369686871767044, -0.02543465979397297, 0.026222657412290573, 0.061725255101919174, 0.006495029665529728, -0.05775773152709007, -0.025858601555228233, -0.003592696273699403, -0.04638851806521416, -0.02001660130918026, 0.05280458182096481, -0.018503528088331223, -0.020761854946613312, -0.0021285489201545715, 0.0166142750531435, 0.07715677469968796, -0.04535774514079094, -0.014307738281786442, 0.05608835443854332, 0.04124407097697258, 0.03743882477283478, -0.04737457260489464, 0.04975349083542824, -0.012176903896033764, -0.0546678751707077, 0.04470835253596306, -0.03329004347324371, 0.09040173143148422, -0.048823948949575424, 0.023529289290308952, 0.0059369574300944805, -0.04018644243478775, 0.009495392441749573, 0.039349086582660675, -0.022122710943222046, 0.0975366160273552, -0.0038932329043745995, 0.015246317721903324, -0.0691746398806572, 0.040060076862573624, 0.014347324147820473, 0.0974845141172409, 0.13302555680274963, 0.04302859678864479, 0.018171487376093864, 0.015741907060146332, -0.013673471286892891, 0.00374062592163682, 0.03254179283976555, -0.003818962024524808, -0.04358875751495361, 0.03241939842700958, -0.028942834585905075, -0.0029087625443935394, -0.13867498934268951, 0.006563069764524698, -0.02666284516453743, -0.062274713069200516, -0.05690401419997215, -0.003003473626449704, 0.043559182435274124, 0.007734712213277817, -0.0406118705868721, 0.09610825031995773, -0.006034649442881346, -0.04158319905400276, -0.03775960952043533, -0.04652244970202446, 0.019356269389390945, 0.11290349811315536, 0.06561291962862015, 0.04349968209862709, 0.030509859323501587, 0.03140079975128174, 0.011479627341032028, 0.04766639322042465, -0.011945368722081184, -0.06008301302790642, 0.01075910683721304, 0.008120839484035969, 0.0015071569941937923, 0.025863779708743095, -0.04139045253396034, 0.11512139439582825, 0.019269417971372604, -0.012828301638364792, 0.00796554610133171, -0.02956216223537922, -0.04668771103024483, 0.0268221627920866, -0.008711951784789562, -0.04918074980378151, 0.015198136679828167, -0.058789562433958054, 0.05315452441573143, 0.007931722328066826, -0.02160676382482052, -0.018917476758360863, -0.00143986486364156, -0.00865180604159832, 0.025587523356080055, -0.04387909546494484, 0.0477803498506546, 0.059023868292570114, 0.0054495567455887794, -0.0201934352517128, 0.004849118180572987, 0.003287371015176177, -0.05254438892006874, 0.03404832258820534, -0.017985893413424492, 0.01810513250529766, 0.005256474018096924, 0.019564490765333176, -0.017360931262373924, 0.009513203985989094, 0.04265478625893593, 0.01603170670568943, 0.04552396014332771, 0.03946720436215401, -0.010791897773742676, 0.0031322967261075974, -0.03731211647391319, -0.03902316093444824, 0.03726978972554207, 0.043488189578056335, 0.033876143395900726, 0.005336029455065727, -0.0432538166642189, -0.009949363768100739, -0.009053931571543217, -0.009676382876932621, 0.021768389269709587, 0.029261570423841476, -0.0006570174591615796, 0.009020845405757427, 0.006219757255166769, 0.04221619665622711, 0.007186484057456255, -0.010268841870129108, 0.01669982634484768, -0.010347726754844189, 0.014107603579759598, 0.001246604835614562, 0.01869354397058487, -0.029657462611794472, -0.010199258103966713, 0.04312227666378021, 0.03970317542552948, 0.0032953389454632998, -0.013918252661824226, -0.08858485519886017, 0.029322538524866104, 0.028488855808973312, 0.007380445953458548, -0.057987410575151443, -0.00811036303639412, 0.05229629948735237, -0.06733337044715881, 0.012162852101027966, 0.05325765535235405, -0.03181096166372299, 0.022091485559940338, 0.00977371260523796, -0.021580519154667854, -0.0037803445011377335, -0.01823802851140499, -0.02591365948319435, -0.02719922736287117, 0.04397229105234146, 0.005794536788016558, -0.0050651258789002895, -0.007311474531888962, 0.027034787461161613, 0.027415242046117783, -0.06007281318306923, -0.03698594123125076, 0.03583420440554619, -0.014370699413120747, 0.028170444071292877, -0.02258903719484806, 0.02736084721982479, -0.050479255616664886, -0.04138653352856636, 0.045744091272354126, -0.03765486925840378, 0.05459222197532654, -0.024811208248138428, 0.05517229437828064, 0.024022674188017845, 0.046782236546278, 0.05285216495394707, -0.03973344340920448, -0.0033323972020298243, -0.04420143738389015, 0.056059304624795914, 0.028661059215664864, -0.03760775551199913, 0.022625532001256943, 0.01923191547393799, -0.05578729137778282, -0.05890779197216034, 0.030293188989162445, -0.05267886817455292, 0.0656980499625206, -0.01955988258123398, 0.009342879056930542, 0.037281543016433716, -0.010713886469602585, 0.030352715402841568, -0.05748276039958, -0.03807149454951286, 0.050524335354566574, -0.03268152475357056, 0.02452486753463745, 0.007266371976584196, 0.04928141459822655, -0.0014893936458975077, 0.012493631802499294, 0.0062571982853114605, -0.0017006108537316322, -0.0021977717988193035, 0.03480512648820877, 0.017497198656201363, -0.0019225802971050143, -0.011582848615944386, 0.020721934735774994, 0.0012600464979186654, -0.019761111587285995, 0.011865712702274323, 0.0372837595641613, 0.0037090324331074953, 0.0036437564995139837, -0.07197341322898865, -0.0414726547896862, 0.01877354271709919, -0.004784613382071257, 0.041536346077919006, -0.052643612027168274, 0.03223249688744545, -0.04034148156642914, 0.016476379707455635, 0.02361925132572651, 0.053165264427661896, -0.002344733802601695, 0.035686977207660675, 0.017637060955166817, 0.028687402606010437, 0.03042355179786682, 0.006839929148554802, -0.05519004538655281, -0.0062184580601751804, -0.010593338869512081, -0.020998721942305565, -0.031083576381206512, -0.04101480171084404, 0.020538434386253357, -0.05003395304083824, -0.006263265386223793, -0.02669236809015274, 0.03190948814153671, -0.04201655834913254, 0.0289500430226326, 0.023564716801047325, -0.028411854058504105, 0.06995729357004166, 0.07865329831838608, -0.04312983527779579, 0.0043500675819814205, 0.0009848270565271378, 0.024492694064974785, 0.018784303218126297, 0.008430765010416508, -0.004502426367253065, -0.0002522568975109607, 0.050884734839200974, -0.019111165776848793, -0.04535149037837982, 0.017451034858822823, -0.0026110433973371983, -0.0135100232437253, -0.01223476231098175, -0.04535914584994316, 0.012843407690525055, 0.011289981193840504, 0.00836504902690649, -0.002037260215729475, -0.06059219688177109, -0.00819470640271902, -0.011888248845934868, -0.04283285513520241, 0.046712253242731094, 0.003813604125753045, 0.019400835037231445, -0.013049762696027756, 0.01133918110281229, -0.022106442600488663, -0.0015950098168104887, -0.018728414550423622, -0.01588544249534607, -0.033112913370132446, 0.01053565926849842, -0.0002959159610327333, -0.05793040245771408, -0.0056679584085941315, 0.026482384651899338, -0.03665446862578392, 0.037286195904016495, 0.05364803969860077, -0.03417123854160309, 0.07076168060302734, 0.016676729544997215, 0.003778450656682253, -0.0307021364569664, 0.01977943256497383, 0.008861077018082142, -0.016512250527739525, 0.0011662881588563323, -0.009830617345869541, -0.013202949427068233, 0.01983601413667202, -0.03740633279085159, 0.021456344053149223, 0.016881801187992096, -0.002529611112549901, 0.0489690788090229, -0.02411004528403282, 0.013002756051719189, 0.03160478547215462, -0.07140732556581497, -0.0023341551423072815, -0.03906828165054321, -0.049176525324583054, -0.00023572632926516235, 0.02789139375090599, 0.013772963546216488, -0.02668585255742073, 0.04290458932518959, 0.039318688213825226, -0.025967802852392197, 0.024418063461780548, -0.015620233491063118, -0.011079882271587849, -0.012030605226755142, -0.028867928311228752, 0.009174284525215626, 0.03899344429373741, 0.01683294028043747, 0.011846194975078106, 0.023748543113470078, -0.006512757390737534, 0.017565622925758362, 0.029314378276467323, -0.014310097321867943, -0.014351682737469673, 0.0169044379144907, -0.003307224251329899, -0.03152438998222351, -0.036853693425655365, 0.02395201474428177, -0.029847150668501854, -0.032415661960840225, 0.006255920510739088, 0.008517839014530182, -0.010083957575261593, 0.00944994855672121, -0.00399729935452342, -0.04380779713392258, -0.006123887374997139, 0.01547707337886095, 0.05751050263643265, 0.002680863719433546, -0.029136357828974724, -0.025134636089205742, 0.03422916308045387, -0.012568745762109756, -0.0006302766851149499, 0.006700517609715462, 0.0276950616389513, 0.007775972597301006, 0.028249353170394897, -0.003636830486357212, -0.009139481000602245, -0.005734669975936413, 0.049621015787124634, -0.01619020104408264, 0.0195643100887537, 0.0007916876347735524, -0.028286034241318703, 0.06913566589355469, -0.0003754256176762283, 0.04782341793179512, -0.029134156182408333, -0.014469681307673454, -0.017063172534108162, -0.05152060091495514, 0.03333542123436928, 0.038114819675683975, 0.020010866224765778, 0.07888108491897583, -0.02794763445854187, 0.03701359033584595, -0.014387172646820545, 0.012811414897441864, 0.0007755273836664855, 0.007685923483222723, 0.008289138786494732, 0.005670994054526091, -0.004918757360428572, 0.015565041452646255, 0.003648065961897373, -0.04345476254820824, -0.02885490469634533, 0.05658823996782303, 0.02464750036597252, -0.013047040440142155, 0.007873885333538055, 0.05833446606993675, -0.011715139262378216, 0.020936261862516403, 0.04195326939225197, 0.0026919785887002945, -0.011748085729777813, 0.004308322910219431, 0.013981861993670464, -0.03640154004096985, 0.02079167030751705, 0.008173525333404541, 0.0896102637052536, -0.02545084059238434, 0.011557877995073795, 0.007884647697210312, 0.0017049346351996064, 0.019261127337813377, 0.03128141537308693, -0.03042875975370407, -0.004751540720462799, 0.028773633763194084, 0.008325704373419285, 0.0003666419943328947, -0.002420030767098069, -0.0008872972102835774, -0.0042289556004107, -0.044847942888736725, -0.008698184974491596, 0.02636372298002243, 0.005739722400903702, 0.05910408869385719, -0.0009225791436620057, 0.016646791249513626, -0.018280429765582085, 0.01965763419866562, 0.06029224768280983, -0.01882864348590374, 0.025968343019485474, 0.002653422998264432, 0.008723157458007336, -0.000012681422958848998, 0.0013022607890889049, 0.030093543231487274, -0.013511990197002888, -0.03425852209329605, 0.006732005625963211, 0.008903710171580315, 0.018610097467899323, 0.011476986110210419, -0.012586034834384918, 0.01293629128485918, -0.019079672172665596, -0.014959355816245079, 0.002453017048537731, 0.0006602465873584151, -0.039483267813920975, 0.0016499855555593967, 0.008907889015972614, -0.026853295043110847, 0.012128309346735477, 0.010988512076437473, 0.011885704472661018, -0.024537649005651474, 0.026091841980814934, -0.0170255359262228, 0.04498635232448578, -0.02170129120349884, 0.010018747299909592, -0.010807990096509457, -0.04935646429657936, -0.013569695875048637, 0.005235231947153807, -0.00016951578436419368, -0.007300201803445816, -0.016184447333216667, -0.02843400277197361, -0.0013418805319815874, 0.05289166048169136, -0.01673436164855957, -0.018091071397066116, -0.005849448963999748, -0.0063589285127818584, 0.02076907828450203, 0.012341666966676712, -0.024360351264476776, 0.04292481392621994, -0.013168047182261944, -0.006185638252645731, -0.023806899785995483, -0.051489152014255524, -0.016218330711126328, 0.014260808005928993, 0.031157394871115685, 0.0010884618386626244, 0.03703070059418678, 0.029696108773350716, 0.01149679534137249, -0.008974556811153889, -0.03737398982048035, -0.03114013373851776, -0.00785121414810419, -0.003822021884843707, 0.010932469740509987, 0.001144391717389226, -0.03175851330161095, -0.019811434671282768, -0.037010107189416885, 0.009144317358732224, -0.038077063858509064, -0.0026912777684628963, 0.011536939069628716, 0.014280074276030064, -0.011584295891225338, -0.005274742841720581, 0.02716316469013691, 0.0459926575422287, -0.043705012649297714, -0.0031332012731581926, -0.019054220989346504, 0.05581993982195854, -0.015749827027320862, 0.010977434925734997, -0.04198231175541878, 0.03225455805659294, -0.05820787698030472, -0.05300946161150932, -0.010294449515640736, 0.00429226690903306, -0.0383751355111599, -0.023319736123085022, -0.032188646495342255, -0.028039006516337395, -0.01636623404920101, -0.026020746678113937, -0.02400302141904831, 0.052320145070552826, 0.07090441137552261, -0.008960627019405365, 0.05365854874253273, 0.024985311552882195, 0.020744439214468002, -0.03653234243392944, 0.008558373898267746, -0.012732270173728466, 0.019227435812354088, 0.03597814962267876, -0.03235931694507599, -0.02909078262746334, 0.027627671137452126, -0.0026438299100846052, -0.07475040853023529, -0.014377953484654427, 0.057612087577581406, -0.003986547235399485, -0.013985014520585537, 0.010704617016017437, -0.02020922489464283, 0.010192791000008583, 0.058654651045799255, 0.016513003036379814, -0.01192041952162981, -0.007727997377514839, 0.028948232531547546, -0.006931333336979151, 0.024369744583964348, 0.02688501961529255, -0.00826385710388422, 0.03995070978999138, -0.016610832884907722, -0.007799314800649881, 0.06959984451532364, 0.03554099053144455, 0.006796498782932758, 0.03522230312228203, -0.004168814513832331, -0.006177828647196293, 0.017391040921211243, -0.004183824639767408, -0.046338748186826706, 0.0027264696545898914, 0.027144145220518112, 0.00948287919163704, -0.03570770099759102, -0.035344794392585754, 0.030679093673825264, 0.007085558958351612, -0.01738009788095951, -0.011957556940615177, -0.018153667449951172, 0.009812168776988983, 0.06634671986103058, 0.014717048034071922, 0.022822629660367966, 0.04100562259554863 ]
Distributed Training: Train BART/T5 for Summarization using 🤗 Transformers and Amazon SageMaker
philschmid
April 8, 2021
sagemaker-distributed-training-seq2seq
guide, partnerships, aws, nlp
https://huggingface.co/blog/sagemaker-distributed-training-seq2seq
Results | key | value | | --- | ----- | {eval_table} {test_table} """ # Generate model card (todo: add more data from Trainer) model_card = MODEL_CARD_TEMPLATE.format( model_name=f"{hyperparameters['model_name_or_path'].split('/')[1]}-{hyperparameters['dataset_name']}", hyperparameters=json.dumps(hyperparameters, indent=4, sort_keys=True), eval_table="\n".join(f"| {k} | {v} |" for k, v in eval_results.items()), test_table="\n".join(f"| {k} | {v} |" for k, v in test_results.items()), ) with open(f"{local_path}/README.md", "w") as f: f.write(model_card) After we have our unzipped model and model card located in my_bart_model we can use the either huggingface_hub SDK to create a repository and upload it to huggingface.co – or just to https://huggingface.co/new an create a new repository and upload it. python from getpass import getpass from huggingface_hub import HfApi, Repository hf_username = "philschmid" # your username on huggingface.co hf_email = "[email protected]" # email used for commit repository_name = f"{hyperparameters['model_name_or_path'].split('/')[1]}-{hyperparameters['dataset_name']}" # repository name on huggingface.co password = getpass("Enter your password:") # creates a prompt for entering password # get hf token token = HfApi().login(username=hf_username, password=password) # create repository repo_url = HfApi().create_repo(token=token, name=repository_name, exist_ok=True) # create a Repository instance model_repo = Repository(use_auth_token=token, clone_from=repo_url, local_dir=local_path, git_user=hf_username, git_email=hf_email) # push model to the hub model_repo.push_to_hub() ---
[ 0.0199551060795784, 0.021171480417251587, 0.001650551101192832, -0.007686708588153124, 0.01218490581959486, 0.05936068668961525, 0.05968162417411804, 0.00952338520437479, -0.005869764368981123, 0.006522363517433405, -0.1006789579987526, -0.014823202043771744, -0.015852557495236397, 0.028958698734641075, -0.03698573634028435, -0.09827229380607605, 0.06127585470676422, -0.0039090621285140514, -0.003221563994884491, 0.05075095221400261, -0.015055524185299873, -0.0496349036693573, 0.020633749663829803, 0.009874672628939152, -0.00846152100712061, -0.019555512815713882, 0.03723948821425438, -0.016063738614320755, 0.026743590831756592, 0.015368332155048847, -0.08184876292943954, 0.0173784289509058, -0.03709261864423752, -0.017681291326880455, 0.060394804924726486, 0.06219064071774483, -0.0983392745256424, 0.05221503600478172, 0.07353871315717697, -0.037182752043008804, 0.0183932613581419, 0.03136924281716347, -0.016600769013166428, 0.04799185320734978, -0.001868948806077242, -0.003449717303737998, -0.16585321724414825, 0.04008883610367775, 0.02764209918677807, 0.0016402526525780559, -0.044341862201690674, 0.05370955914258957, -0.0010483198566362262, 0.018331633880734444, 0.010798279196023941, 0.04014914855360985, -0.007862606085836887, -0.06530771404504776, 0.02433493360877037, 0.03229716420173645, 0.033939652144908905, 0.03318721428513527, 0.0006617154576815665, 0.06326724588871002, -0.004288187716156244, 0.031194010749459267, -0.00018824037397280335, 0.005240991245955229, -0.06055014580488205, -0.07279881089925766, 0.03432147577404976, -0.002658075885847211, -0.01379840262234211, -0.042508453130722046, 0.009877989999949932, -0.08449912071228027, 0.02312561124563217, 0.0723242536187172, 0.09286119043827057, 0.054927971214056015, 0.0076112267561256886, -0.005776725709438324, 0.018808364868164062, 0.07768866419792175, 0.04592382535338402, -0.012903808616101742, -0.01348933856934309, -0.06018851324915886, -0.09228595346212387, 0.04189711809158325, -0.028042973950505257, -0.060827866196632385, -0.0054357051849365234, 0.01858558878302574, 0.0390668623149395, -0.03160526230931282, -0.01821053773164749, 0.04775463417172432, -0.06643012911081314, 0.04885885491967201, 0.014854486100375652, -0.04916836693882942, -0.030210809782147408, -0.05532655119895935, -0.0038473946042358875, 0.021530739963054657, -0.023103559389710426, -0.07773832231760025, -0.025549571961164474, -0.02625095471739769, 0.013018148951232433, -0.04038720205426216, -0.01088416576385498, 0.052364155650138855, -0.05795316770672798, 0.021705640479922295, -0.0017939996905624866, -0.04425607994198799, -0.07653739303350449, -0.00889135804027319, 0.009277013130486012, 0.04489818960428238, 0.010738926939666271, -0.01815631426870823, 0.025578666478395462, 0.03740919753909111, 0.0031026408541947603, 0.04327172785997391, 0.027990050613880157, -0.026626551523804665, 0.02848573587834835, -0.0253029465675354, 0.08559539914131165, 0.052241429686546326, -0.02067343145608902, -0.012370208278298378, -0.030932100489735603, -0.09348524361848831, 0.027209697291254997, -0.012759535573422909, 0.05775012448430061, 0.07458314299583435, -0.0003683685208670795, 0.03183823078870773, -0.009742873720824718, 0.021814757958054543, -0.06152736023068428, 0.06582297384738922, 0.04291201010346413, -0.009478600695729256, -0.025898052379488945, 0.059618134051561356, 0.0675884410738945, 0.0054298099130392075, 0.009188174270093441, 0.01999053731560707, -0.02919110655784607, 0.029596958309412003, -0.031039489433169365, 0.003300022566691041, 0.018859146162867546, 0.042563296854496, -0.12646806240081787, -0.0042022401466965675, -0.022109195590019226, 0.012797396630048752, 0.02213933691382408, -0.02161012403666973, 0.07312105596065521, -0.04627753421664238, 0.013275234028697014, -0.06938015669584274, 0.04011322930455208, -0.0335652120411396, 0.06418923288583755, 0.07149547338485718, 0.040192265063524246, 0.014715018682181835, 0.053448453545570374, 0.014225353486835957, -0.06177757307887077, 0.10636208206415176, -0.0470154844224453, 0.029155487194657326, 0.08368317037820816, -0.05668967589735985, -0.02311890572309494, -0.017959605902433395, 0.011143920011818409, 0.04416594281792641, -0.048874013125896454, -0.06714466959238052, 0.08078174293041229, -0.0697701945900917, 0.07832108438014984, -0.052561625838279724, 0.010372214950621128, 0.07612591981887817, 0.05952871963381767, 0.048390187323093414, 0.009925417602062225, 0.048433247953653336, -0.0010387840447947383, -0.062404125928878784, -0.015706535428762436, -0.023452388122677803, -0.002943391213193536, -0.0839109942317009, 0.023868581280112267, -0.02284133806824684, -0.0029329569078981876, -0.06731927394866943, 0.10976878553628922, -0.07047679275274277, -0.024199247360229492, -0.03326874226331711, -0.01955236680805683, 0.022981351241469383, 0.024282654747366905, 0.03809960186481476, 0.1890588402748108, -0.0367390401661396, 0.08300682157278061, -0.02853129617869854, 0.020281242206692696, 0.051810603588819504, 0.03005444072186947, 0.10516357421875, 0.045138292014598846, -0.10009640455245972, -0.020661165937781334, -0.08660950511693954, -0.04028930142521858, 0.016562970355153084, 0.02607978880405426, -0.03133486583828926, 0.05351661518216133, -0.04378326237201691, -0.021608997136354446, 0.0030808704905211926, 0.037373218685388565, 0.0104433074593544, -0.007421564776450396, -0.016040975227952003, 0.03130725398659706, -0.024003831669688225, 0.03682655468583107, 0.03976583108305931, -0.04571400582790375, -0.06385913491249084, -0.06239060312509537, 0.061481039971113205, -0.0021516582928597927, -0.007916110567748547, 0.03981825336813927, -0.033755239099264145, 0.004640451166778803, 0.013230030424892902, -0.03738963231444359, 0.06976549327373505, 0.01118858065456152, -0.011818054132163525, -0.07945919781923294, -0.04791807383298874, -0.00872405432164669, -0.02217227593064308, -0.012521288357675076, 0.006839008070528507, -0.006738193333148956, 0.01921604573726654, 0.06791656464338303, -0.02881070226430893, 0.005080700386315584, 0.01845150627195835, -0.025976039469242096, 0.06425371021032333, 0.03848215937614441, -0.003762071253731847, 0.023046668618917465, 0.008348937146365643, -0.013548925518989563, -0.05401606112718582, -0.01640060730278492, 0.008845482021570206, 0.009451890364289284, -0.004224373493343592, 0.007666350342333317, -0.0263714287430048, -0.027310142293572426, 0.029751857742667198, 0.005781069397926331, 0.06240736320614815, -0.00920096505433321, -0.048816706985235214, 0.002749146893620491, 0.005169996991753578, 0.01820751093327999, -0.013443902134895325, -0.011714417487382889, 0.042965713888406754, -0.021850287914276123, -0.00536634586751461, -0.009757096879184246, -0.03307389095425606, 0.003986930940300226, 0.004672142211347818, -0.008999805897474289, -0.021277839317917824, -0.08774720132350922, 0.020455647259950638, -0.05296512693166733, -0.011213954538106918, 0.005835000425577164, 0.01389639638364315, 0.058645036071538925, 0.002702782629057765, -0.014768259599804878, 0.0127624636515975, 0.0011767514515668154, 0.012963227927684784, -0.020515479147434235, -0.01801147125661373, -0.023882733657956123, -0.0045316182076931, -0.006685218773782253, 0.0042052483186125755, 0.03746877610683441, -0.002920943545177579, -0.023912042379379272, -0.011706540361046791, -0.016555940732359886, 0.001822635647840798, -0.020981399342417717, -0.06058838218450546, 0.04793768376111984, 0.02968013472855091, -0.021375760436058044, -0.03683045133948326, 0.041548483073711395, -0.048077307641506195, 0.023907644674181938, 0.007262169849127531, -0.03938781097531319, -0.0012838076800107956, 0.01960001513361931, 0.00836277101188898, -0.019200028851628304, -0.00020444394613150507, -0.008212259970605373, -0.00800408236682415, 0.029126841574907303, -0.03861382231116295, 0.0453324131667614, -0.0012859120033681393, -0.009493716061115265, -0.013623983599245548, -0.030915765091776848, -0.022747866809368134, -0.027902275323867798, 0.012135786935687065, 0.04412594065070152, 0.05780362710356712, -0.025665368884801865, 0.035000625997781754, -0.006670651491731405, 0.016626577824354172, 0.004353159572929144, -0.01164757739752531, -0.059098612517118454, -0.03288451209664345, -0.05742992088198662, -0.03164127096533775, -0.02140180952847004, 0.03132055699825287, 0.008478173986077309, 0.010458889417350292, -0.05192307010293007, 0.07025275379419327, -0.04712080955505371, 0.006636535283178091, -0.003997152671217918, 0.008766409941017628, -0.00903391558676958, -0.00853344239294529, -0.019812816753983498, -0.030261529609560966, 0.07901032269001007, -0.00047340794117189944, -0.010620899498462677, 0.005488540045917034, -0.03087760880589485, 0.0035609574988484383, -0.01122303120791912, -0.009860147722065449, 0.03104408085346222, -0.030690183863043785, 0.017453327775001526, 0.022468099370598793, -0.031143086031079292, -0.0496935099363327, 0.03833508864045143, -0.01872115768492222, -0.03224296122789383, -0.0014296466251835227, 0.012372912839055061, 0.01875772513449192, -0.0074462080374360085, 0.04485144466161728, 0.004253819119185209, -0.032945141196250916, -0.03277768939733505, -0.009074111469089985, 0.02782224863767624, 0.043513745069503784, -0.057912010699510574, -0.03894481435418129, 0.00036205784999765456, 0.0030279613565653563, -0.016193337738513947, -0.0069453599862754345, -0.02635013684630394, -0.009236849844455719, 0.010467540472745895, 0.04834059998393059, 0.007426925003528595, -0.030344977974891663, -0.0027921919245272875, 0.05239931493997574, -0.04753758758306503, 0.010310431942343712, 0.023838046938180923, -0.046122509986162186, 0.00284195295535028, 0.003055400215089321, 0.06196971610188484, 0.027990441769361496, -0.01508619636297226, 0.0063572595827281475, 0.0187765434384346, 0.0009244291577488184, -0.021629542112350464, 0.002253700280562043, -0.011295357719063759, 0.027977105230093002, 0.026805700734257698, -0.008119202218949795, 0.02055015042424202, -0.00422051502391696, -0.002117941854521632, 0.001336565357632935, 0.018612036481499672, -0.03024139627814293, 0.0020246654748916626, 0.051859866827726364, -0.04118027538061142, -0.007249492220580578, -0.024116629734635353, 0.012477708049118519, -0.00716773048043251, 0.005736693274229765, -0.05849715322256088, 0.02107856050133705, 0.034201305359601974, 0.020856449380517006, -0.010176753625273705, -0.012625264003872871, 0.015114299021661282, 0.046422407031059265, -0.01677689701318741, 0.013021831400692463, -0.024856632575392723, 0.007821337319910526, -0.02688736282289028, 0.0160689577460289, -0.008751011453568935, -0.05781516805291176, 0.02811311185359955, -0.025280660018324852, -0.03271687775850296, 0.015259676612913609, 0.01315219048410654, -0.04527829959988594, -0.03701147064566612, 0.006892480421811342, 0.03340371698141098, 0.04392417520284653, -0.03587324544787407, -0.003963594790548086, -0.01901852712035179, -0.004605326801538467, 0.035058826208114624, -0.02787567675113678, 0.0030014743097126484, 0.000014509747416013852, 0.05305708944797516, 0.046952009201049805, 0.02293327823281288, 0.018491268157958984, -0.031083300709724426, -0.023161426186561584, 0.0039279828779399395, -0.046193238347768784, -0.025063887238502502, -0.016353020444512367, -0.004354103468358517, -0.022021282464265823, 0.013817401602864265, -0.018976539373397827, 0.041060253977775574, 0.047515321522951126, -0.01114867813885212, 0.004893616307526827, 0.03918589651584625, -0.01387453731149435, 0.014401564374566078, 0.024679578840732574, 0.02227550931274891, -0.022252174094319344, -0.022232936695218086, -0.001966607291251421, -0.014175464399158955, 0.016281675547361374, -0.0027262079529464245, -0.01692335307598114, -0.021041106432676315, 0.04840822145342827, 0.005008440464735031, 0.05724255368113518, 0.009270090609788895, -0.03860260173678398, -0.00035006387042813003, -0.040672365576028824, 0.030983049422502518, -0.01179310493171215, 0.04386971890926361, 0.013922551646828651, -0.003659144276753068, 0.021881194785237312, 0.013717503286898136, -0.03168740123510361, -0.024089980870485306, 0.015433345921337605, 0.011185080744326115, 0.007559662684798241, -0.046652812510728836, 0.030627217143774033, -0.005880492273718119, -0.023663712665438652, -0.029082490131258965, 0.004775923676788807, -0.011740055866539478, 0.026563264429569244, -0.03458129242062569, 0.059200432151556015, 0.057396888732910156, 0.023573732003569603, 0.03800933063030243, 0.039840683341026306, -0.01751706935465336, 0.020776694640517235, -0.009359655901789665, 0.007633799221366644, -0.012948429211974144, -0.007975580170750618, 0.00787803903222084, 0.010702133178710938, 0.020552918314933777, 0.04799429327249527, 0.0185095202177763, -0.0378844179213047, -0.017937524244189262, 0.0220430176705122, 0.005161477718502283, 0.009947160258889198, -0.015690989792346954, -0.03466755524277687, 0.018755218014121056, 0.01079634390771389, 0.003140259999781847, 0.04607649892568588, 0.007725364062935114, -0.00642150454223156, 0.0013037672033533454, 0.0029533866327255964, -0.009400748647749424, 0.03932756185531616, -0.018590105697512627, 0.058275070041418076, 0.021847954019904137, 0.06475424021482468, 0.019165007397532463, 0.01655878685414791, -0.019241049885749817, 0.01954771764576435, 0.028471875935792923, -0.00817470159381628, 0.025133416056632996, 0.015107673592865467, 0.009275092743337154, -0.015184395015239716, -0.026657339185476303, -0.01304370816797018, 0.016236169263720512, 0.020702868700027466, 0.027357108891010284, -0.007702372036874294, 0.018435465171933174, -0.017741212621331215, 0.0451589971780777, 0.02546818181872368, 0.033197905868291855, 0.013180945068597794, 0.004594277590513229, 0.07152508944272995, -0.010709221474826336, -0.01486410666257143, 0.030786804854869843, -0.03128637373447418, -0.001142067019827664, -0.0009635286405682564, -0.005102683790028095, -0.018292108550667763, 0.009328260086476803, 0.03601771593093872, 0.041630376130342484, -0.03755492344498634, -0.030867421999573708, 0.002446286380290985, 0.0370095930993557, -0.025714509189128876, -0.021282194182276726, -0.008614355698227882, -0.02533312328159809, 0.02567058987915516, -0.013045303523540497, -0.02114265225827694, -0.022845443338155746, -0.024821307510137558, 0.01842424087226391, 0.009709359146654606, 0.03894590958952904, -0.02027306891977787, -0.0013077410403639078, 0.01435212790966034, 0.01724533922970295, 0.011352362111210823, -0.015028365887701511, -0.013179196044802666, -0.04868442937731743, -0.013635209761559963, -0.014992638491094112, 0.027619777247309685, 0.003424226539209485, -0.006578807719051838, -0.02121649868786335, 0.053955066949129105, 0.009720622561872005, 0.03818994387984276, 0.005240240599960089, 0.03786918520927429, -0.0010207535233348608, 0.014390424825251102, 0.0134626105427742, -0.02634332701563835, 0.020075833424925804, -0.01525086909532547, 0.0299244187772274, 0.0005526039167307317, 0.058689773082733154, -0.001564664882607758, 0.05054203048348427, -0.023687249049544334, -0.03939414396882057, -0.0011222632601857185, -0.023706188425421715, -0.046165596693754196, 0.047515299171209335, -0.015595199540257454, -0.006007523741573095, 0.030840329825878143, -0.004366400185972452, -0.016307935118675232, 0.0303355623036623, -0.017316067591309547, 0.04124375432729721, -0.011581339873373508, -0.034716151654720306, -0.009122810326516628, 0.024927636608481407, 0.044086262583732605, 0.02036992646753788, 0.021463489159941673, 0.01954461820423603, 0.03327909857034683, -0.0011211276287212968, 0.05176479369401932, -0.0317833311855793, -0.02055264078080654, -0.011204172857105732, -0.06521232426166534, -0.003943705465644598, -0.04138324037194252, -0.00439135218039155, -0.022842487320303917, -0.11666376143693924, -0.01133993361145258, 0.04527107626199722, -0.0116726690903306, -0.020369753241539, -0.019513988867402077, 0.0303838811814785, 0.05572287365794182, -0.002094950992614031, 0.021958187222480774, -0.060344040393829346, 0.01522777322679758, -0.025645114481449127, 0.0069085946306586266, 0.016936881467700005, 0.035167720168828964, -0.021428734064102173, 0.005930433981120586, 0.03877513110637665, 0.016375191509723663, -0.047062378376722336, 0.04830723628401756, -0.010343044996261597, -0.013309489004313946, -0.056945931166410446, -0.018452612683176994, 0.01833813078701496, 0.0004192205087747425, 0.015626801177859306, -0.019098995253443718, -0.02494746632874012, -0.014416908845305443, 0.023487506434321404, -0.07919250428676605, 0.022782770916819572, -0.04343799501657486, -0.013112432323396206, 0.014216194860637188, 0.003353430889546871, 0.00031178825884126127, -0.0004880593332927674, -0.03844783455133438, 0.00831762608140707, -0.03334251418709755, -0.022775370627641678, -0.009816511534154415, -0.00779353454709053, 0.03646073117852211, -0.026430627331137657, 0.006264328490942717, 0.0024027538020163774, -0.016855983063578606, -0.0639164075255394, -0.004485695157200098, -0.002031942130997777, 0.00013246902381069958, 0.032171957194805145, -0.008816004730761051, -0.0416036993265152, 0.03579280525445938, -0.008176105096936226, -0.051965877413749695, -0.05167026445269585, 0.025509018450975418 ]
Distributed Training: Train BART/T5 for Summarization using 🤗 Transformers and Amazon SageMaker
philschmid
April 8, 2021
sagemaker-distributed-training-seq2seq
guide, partnerships, aws, nlp
https://huggingface.co/blog/sagemaker-distributed-training-seq2seq
# Distributed Training: Train BART/T5 for Summarization using 🤗 Transformers and Amazon SageMaker In case you missed it: on March 25th we announced a collaboration with Amazon SageMaker to make it easier to create State-of-the-Art Machine Learning models, and ship cutting-edge NLP features faster. Together with the SageMaker team, we built 🤗 Transformers optimized Deep Learning Containers to accelerate training of Transformers-based models. Thanks AWS friends!🤗 🚀 With the new HuggingFace estimator in the SageMaker Python SDK, you can start training with a single line of code. The announcement blog post provides all the information you need to know about the integration, including a "Getting Started" example and links to documentation, examples, and features. listed again here: - 🤗 Transformers Documentation: Amazon SageMaker - Example Notebooks - Amazon SageMaker documentation for Hugging Face - Python SDK SageMaker documentation for Hugging Face - Deep Learning Container If you're not familiar with Amazon SageMaker: "Amazon SageMaker is a fully managed service that provides every developer and data scientist with the ability to build, train, and deploy machine learning (ML) models quickly. SageMaker removes the heavy lifting from each step of the machine learning process to make it easier to develop high quality models." [REF] --- # Tutorial We will use the new Hugging Face DLCs and Amazon SageMaker extension to train a distributed Seq2Seq-transformer model on the summarization task using the transformers and datasets libraries, and then upload the model to huggingface.co and test it. As distributed training strategy we are going to use SageMaker Data Parallelism, which has been built into the Trainer API. To use data-parallelism we only have to define the distribution parameter in our HuggingFace estimator. python # configuration for running training on smdistributed Data Parallel distribution = {'smdistributed':{'dataparallel':{ 'enabled': True }}} In this tutorial, we will use an Amazon SageMaker Notebook Instance for running our training job. 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 - Choose 🤗 Transformers examples/ script - Configure distributed training and hyperparameters - Create a HuggingFace estimator and start training - Upload the fine-tuned model to huggingface.co - Test inference
[ 0.030538717284798622, -0.017448311671614647, -0.01685449294745922, 0.02510751411318779, -0.007199062034487724, 0.05202483385801315, 0.01182569656521082, 0.03557199239730835, 0.0048447889275848866, -0.004497455433011055, -0.05338212102651596, 0.0602702833712101, 0.03202980384230614, 0.08316745609045029, 0.0023355423472821712, -0.03664564713835716, 0.012821326963603497, -0.015112997964024544, -0.060534607619047165, 0.027595216408371925, 0.004583787638694048, -0.026433981955051422, -0.0015029609203338623, 0.007978985086083412, -0.02709946595132351, -0.013972022570669651, 0.06136799976229668, 0.04378175362944603, 0.014197656884789467, 0.046058349311351776, -0.052058544009923935, 0.015228495933115482, 0.03595789894461632, -0.01693812757730484, -0.01661696657538414, 0.020557638257741928, -0.1388332098722458, 0.019814983010292053, 0.030153222382068634, 0.02193434350192547, 0.025015464052557945, -0.014106040820479393, -0.06286366283893585, 0.0038221401628106833, 0.018748609349131584, -0.004146895371377468, -0.060702867805957794, -0.020445356145501137, -0.006697942037135363, -0.008745268918573856, -0.07669038325548172, 0.07135976850986481, 0.012692718766629696, -0.016467534005641937, 0.053735241293907166, 0.028006911277770996, -0.0047546373680233955, -0.0736011415719986, -0.02843945100903511, -0.006191904190927744, -0.0149894580245018, -0.0278276726603508, -0.01652415096759796, 0.02356354333460331, -0.004598116502165794, 0.016132919117808342, -0.009294016286730766, -0.020519448444247246, -0.059300217777490616, -0.058923736214637756, 0.010995594784617424, -0.06887853145599365, -0.05064810439944267, 0.00701915193349123, -0.038194604218006134, -0.014318582601845264, -0.008572797290980816, -0.025819841772317886, 0.06277047842741013, 0.039633430540561676, -0.08700355887413025, 0.032153934240341187, 0.002532817190513015, 0.03419111669063568, 0.03530161455273628, 0.022686028853058815, 0.007628676947206259, -0.07927099615335464, -0.09841104596853256, 0.04156821593642235, 0.013575203716754913, -0.07531757652759552, -0.02934640273451805, 0.017576495185494423, 0.05151510611176491, 0.0167688000947237, -0.006943921558558941, -0.05166362226009369, -0.04050168767571449, -0.05567227676510811, 0.001784716616384685, -0.05296022817492485, 0.061664216220378876, -0.06665165722370148, 0.012534959241747856, 0.033394865691661835, -0.014303270727396011, -0.11490805447101593, 0.007361969910562038, 0.027042265981435776, 0.03447824716567993, -0.07294301688671112, -0.039054710417985916, 0.09312131255865097, -0.11536362022161484, 0.07168327271938324, 0.04256181791424751, -0.05920187383890152, -0.03472393751144409, -0.017361953854560852, -0.01921573095023632, 0.052470311522483826, 0.054106712341308594, -0.0411105751991272, -0.08040529489517212, 0.05225694924592972, -0.037857938557863235, -0.036170896142721176, 0.0336456336081028, 0.00888000801205635, 0.020069923251867294, -0.04456998407840729, 0.06626416742801666, -0.024894151836633682, -0.03600066900253296, -0.046032410115003586, -0.03047480434179306, -0.022626331076025963, -0.011903077363967896, 0.051079005002975464, 0.006586422212421894, 0.12212318181991577, 0.03211226686835289, 0.024114014580845833, -0.004300032742321491, 0.008784892037510872, -0.08273474127054214, 0.012570098042488098, 0.027445083484053612, 0.021054191514849663, -0.11192933470010757, 0.04782133176922798, -0.05009249970316887, -0.06205663084983826, 0.09393039345741272, 0.08303255587816238, 0.01741546392440796, -0.022360311821103096, -0.052350617945194244, -0.03915390372276306, 0.00901102740317583, -0.02312089316546917, -0.024746572598814964, -0.006403014063835144, -0.05347923934459686, -0.004985510837286711, 0.03039458952844143, -0.0041219196282327175, 0.05749383568763733, -0.03039759024977684, 0.000016335898180841468, 0.005885579623281956, 0.012165122665464878, 0.0018042908050119877, 0.026490280404686928, 0.019151432439684868, 0.010587301105260849, 0.14039449393749237, -0.009067544713616371, 0.022977201268076897, -0.04135292023420334, 0.07354549318552017, 0.007210623472929001, 0.012478591874241829, 0.06611237674951553, -0.04054407775402069, 0.07504691928625107, 0.0004956865450367332, 0.006136971991509199, 0.034169651567935944, -0.03304032236337662, 0.010795354843139648, 0.0638594999909401, -0.012044752947986126, 0.048447851091623306, -0.05241527035832405, -0.020615778863430023, 0.05869034677743912, 0.03328365087509155, 0.06195345148444176, 0.04100039228796959, -0.08202236145734787, -0.04089467599987984, 0.059654101729393005, 0.015716152265667915, 0.041377101093530655, -0.06923385709524155, -0.009380069561302662, 0.052334170788526535, -0.02601790800690651, -0.016301989555358887, -0.13344736397266388, -0.011802880093455315, -0.03276970982551575, -0.012418556027114391, -0.02203613705933094, -0.01704128459095955, 0.026660874485969543, 0.05166426673531532, 0.05020876228809357, 0.11063849925994873, -0.02602454461157322, 0.0341670848429203, -0.030708102509379387, 0.001984365750104189, 0.006237540859729052, 0.07210952043533325, 0.0893336832523346, 0.08403182029724121, -0.03861849382519722, -0.012122612446546555, -0.0029152731876820326, -0.014145612716674805, 0.019501566886901855, 0.011186951771378517, 0.0026667173951864243, -0.00756963063031435, -0.01847299188375473, 0.00741000147536397, -0.042777691036462784, 0.04191379249095917, 0.055444687604904175, 0.03524801880121231, 0.019330225884914398, 0.047748252749443054, 0.017327990382909775, 0.05577816441655159, -0.025725148618221283, -0.019972261041402817, -0.048562001436948776, -0.08128193020820618, 0.08960126340389252, 0.007994407787919044, -0.08369927108287811, 0.026791220530867577, 0.0002636261924635619, 0.012579208239912987, 0.02312646433711052, -0.000028865782951470464, 0.04592333361506462, -0.007920959033071995, 0.045373138040304184, -0.05088955536484718, -0.03625123202800751, -0.028513101860880852, -0.05558603256940842, 0.0189297404140234, -0.004869629628956318, -0.0144800478592515, -0.017507268115878105, 0.031570710241794586, -0.02449745312333107, -0.003968775272369385, -0.012859785929322243, 0.00376852392219007, 0.01612238958477974, 0.030145270749926567, -0.024036895483732224, 0.0068137263879179955, -0.02841959148645401, -0.019716447219252586, -0.014781628735363483, -0.04651263728737831, 0.03740108758211136, 0.0035766051150858402, -0.03494909778237343, -0.03340207412838936, -0.012075659818947315, -0.04120460897684097, -0.02763552963733673, 0.06273998320102692, 0.027032148092985153, 0.02041146531701088, -0.001969284610822797, 0.011952489614486694, 0.030750185251235962, -0.01076581422239542, -0.029583526775240898, -0.002397857839241624, 0.04838185012340546, -0.0006684710388071835, 0.013214129023253918, 0.010124263353645802, 0.020756365731358528, -0.022847360000014305, -0.05074845254421234, -0.01072737667709589, 0.050185587257146835, -0.06357418745756149, -0.03594550862908363, -0.052908848971128464, -0.0127332778647542, -0.0037788087502121925, -0.015536119230091572, 0.056080304086208344, -0.046812571585178375, -0.010367530398070812, 0.013516555540263653, 0.008462664671242237, 0.03473716229200363, -0.02807045169174671, -0.03961842134594917, 0.01914740912616253, -0.023766111582517624, -0.04086747020483017, -0.06598460674285889, 0.01613304577767849, 0.04578271508216858, -0.0298264492303133, -0.007984090596437454, 0.029930053278803825, -0.0243022870272398, -0.005388401914387941, -0.0047024451196193695, 0.04449991509318352, 0.010808703489601612, 0.03916718065738678, -0.03004569746553898, -0.005846759770065546, -0.002341683255508542, -0.02664576657116413, 0.013273106887936592, 0.007753120269626379, 0.011188218370079994, 0.010557706467807293, 0.03309525549411774, 0.043113600462675095, 0.01975628361105919, 0.031402021646499634, -0.04212440922856331, 0.04043563827872276, 0.0020501557737588882, 0.07772454619407654, 0.017487024888396263, -0.010178109630942345, -0.01750759780406952, 0.03827669471502304, -0.018152372911572456, -0.011801552027463913, -0.009525804780423641, -0.01529941987246275, -0.004653380252420902, -0.00927951093763113, 0.009599879384040833, -0.0013893202412873507, 0.003251551417633891, 0.014851734973490238, -0.03233444318175316, -0.05397997796535492, 0.05073615536093712, -0.04616539552807808, -0.018236055970191956, 0.011406614445149899, 0.05691395327448845, -0.00552684161812067, -0.03095913864672184, -0.002228635363280773, 0.013424576260149479, -0.013893640600144863, 0.03515271842479706, -0.01440141536295414, -0.0009946234058588743, -0.0572197400033474, 0.025600602850317955, -0.016303064301609993, -0.01672491990029812, 0.04210132732987404, 0.0104351956397295, 0.006059127859771252, -0.022208048030734062, -0.04418239742517471, -0.02972901239991188, 0.034828174859285355, 0.01771686039865017, 0.05293988808989525, -0.08300597220659256, 0.06688670068979263, 0.03723161667585373, 0.008927005343139172, -0.04029319807887077, 0.023971613496541977, -0.014510158449411392, 0.01355174370110035, -0.032647885382175446, -0.00042905128793790936, 0.0390198677778244, -0.030893871560692787, 0.0017560165142640471, 0.004230789374560118, -0.031947437673807144, -0.016476063057780266, -0.004806761164218187, -0.04650820046663284, 0.006448631174862385, -0.005927658174186945, -0.020306028425693512, -0.03133039548993111, 0.0006470761727541685, 0.04897588863968849, 0.006756321061402559, -0.028760651126503944, 0.007869715802371502, 0.021826934069395065, 0.05636947602033615, 0.006335647776722908, 0.0018267096020281315, -0.0016240538097918034, 0.031291812658309937, -0.022932976484298706, 0.033212028443813324, 0.03390903025865555, -0.0020409973803907633, 0.006403439212590456, 0.035428646951913834, 0.017710458487272263, 0.04569397121667862, 0.003950450103729963, -0.03623272106051445, -0.02749902941286564, -0.009924761950969696, -0.01605072245001793, -0.010702639818191528, 0.00495615229010582, -0.0031167606357485056, -0.02726823277771473, 0.02900688908994198, 0.0030642293859273195, 0.01921917498111725, -0.02521948516368866, 0.0306349229067564, 0.06447508931159973, -0.002983612474054098, 0.009490961208939552, -0.010072034783661366, -0.03446820750832558, -0.007564066909253597, -0.042603056877851486, 0.003309844760224223, -0.021843209862709045, 0.011133936233818531, -0.045589741319417953, 0.013904293067753315, 0.052543845027685165, -0.01884046383202076, 0.006728150881826878, 0.0551428385078907, 0.02699633687734604, 0.05500267446041107, -0.0350053533911705, 0.03045988455414772, -0.03819330036640167, -0.03342786058783531, 0.01845637895166874, 0.022402755916118622, -0.03356502577662468, -0.043327368795871735, -0.0034640775993466377, 0.030671795830130577, -0.028709596022963524, -0.004105885047465563, 0.031170710921287537, -0.010125943459570408, 0.008494436740875244, 0.032528314739465714, 0.04823845997452736, 0.03263828158378601, -0.05270024389028549, 0.007962013594806194, -0.045787960290908813, -0.045846905559301376, -0.06107374280691147, -0.01748490519821644, -0.009177873842418194, -0.007907063700258732, 0.051866017282009125, 0.03397633507847786, -0.03378463163971901, 0.009476649574935436, 0.0021615505684167147, -0.060700513422489166, -0.007036995142698288, -0.01007113978266716, 0.006479022093117237, -0.014261367730796337, 0.044488079845905304, 0.03144418075680733, -0.011651185341179371, -0.01464184932410717, 0.045039985328912735, 0.047330815345048904, -0.020231913775205612, -0.03947068378329277, 0.03831272944808006, 0.0000908725633053109, -0.011647738516330719, -0.03370077908039093, -0.009839288890361786, -0.023545557633042336, 0.03680625930428505, -0.014863739721477032, -0.030897609889507294, -0.006918163038790226, -0.002183976350352168, -0.03085208497941494, -0.010456460528075695, 0.023193445056676865, 0.008783059194684029, -0.005389181897044182, -0.041147466748952866, -0.006205272860825062, 0.019632583484053612, -0.006380164064466953, -0.007709697354584932, -0.03924066945910454, 0.01609266735613346, 0.018748853355646133, -0.0032592585776001215, 0.03410637006163597, 0.0007175207720138133, 0.04174938052892685, -0.07465865463018417, 0.007595642004162073, 0.026673251762986183, -0.007901201024651527, -0.021069247275590897, 0.03297234699130058, 0.009209228679537773, -0.05097586289048195, -0.013310426846146584, -0.03892700374126434, 0.009399021975696087, -0.006615581922233105, -0.04090338200330734, 0.05002392828464508, 0.0638764277100563, -0.03651002049446106, 0.01306280866265297, -0.06463811546564102, -0.006043205037713051, 0.028216984122991562, 0.027055615559220314, -0.0036279847845435143, 0.031897466629743576, 0.006766207050532103, -0.02044563554227352, 0.0077879843302071095, 0.0243825800716877, -0.000016253383364528418, -0.011104843579232693, -0.04896574094891548, 0.04158651828765869, -0.011634711176156998, -0.014366053976118565, -0.008334328420460224, -0.0020435326732695103, -0.026234161108732224, 0.009764861315488815, -0.015028262510895729, 0.024462485685944557, 0.012713872827589512, 0.017073307186365128, 0.000045480610424419865, 0.007553508970886469, -0.00841567199677229, 0.00445487629622221, 0.06121353060007095, -0.02294543758034706, -0.012154420837759972, 0.0190728772431612, 0.039471037685871124, 0.01697702333331108, 0.014611654914915562, 0.03828908130526543, -0.022727012634277344, 0.02472403645515442, -0.03311917185783386, 0.013395651243627071, 0.05568946525454521, -0.009218917228281498, -0.056624047458171844, 0.014806874096393585, -0.019691383466124535, -0.020441433414816856, 0.00012026837794110179, 0.02630441263318062, -0.0127472635358572, 0.004616520367562771, 0.01634395495057106, 0.03392382711172104, 0.09449378401041031, 0.05287940427660942, -0.005653448402881622, 0.05113336443901062, 0.0511033795773983, -0.01677815057337284, 0.010563146322965622, 0.05544114112854004, 0.004832970444113016, 0.019929373636841774, 0.01144322007894516, 0.02897460013628006, 0.04825560748577118, -0.02295267954468727, -0.0028091752901673317, -0.032014742493629456, -0.0031205422710627317, -0.030772162601351738, 0.03010646067559719, 0.00004025769521831535, -0.049227211624383926, 0.006322380155324936, 0.001326379831880331, 0.0014064081478863955, 0.066792793571949, -0.009405937977135181, 0.03786356374621391, -0.024046005681157112, 0.01923331618309021, 0.005111320409923792, 0.020568830892443657, 0.0007606968283653259, -0.017899999395012856, 0.013526921160519123, -0.00439241249114275, 0.016055651009082794, 0.015390186570584774, 0.022402869537472725, 0.0005369994323700666, -0.0017578699626028538, -0.017859209328889847, -0.022890832275152206, 0.03460519760847092, -0.01701808162033558, -0.028568539768457413, 0.013761316426098347, -0.003168663242831826, 0.04217039793729782, 0.04089521989226341, -0.000046514305722666904, 0.022969339042901993, -0.03941132500767708, 0.011756813153624535, 0.017332743853330612, -0.022396095097064972, 0.04903343692421913, -0.04332767799496651, 0.05852751061320305, -0.010913223028182983, 0.030876867473125458, 0.0029120384715497494, 0.037485163658857346, 0.017475606873631477, -0.01789489947259426, 0.012136632576584816, 0.020696213468909264, -0.0026201708242297173, 0.03578693047165871, -0.003057511057704687, -0.038937270641326904, 0.02996721677482128, 0.00799967534840107, 0.014438698999583721, 0.017648283392190933, 0.04197046905755997, 0.07076217234134674, -0.042982134968042374, 0.04892832413315773, 0.024038132280111313, 0.01368448231369257, 0.031068436801433563, 0.002222624374553561, -0.009464092552661896, -0.006111330818384886, 0.04253052547574043, -0.014916842803359032, -0.032887883484363556, -0.037984415888786316, -0.010177447460591793, -0.054210107773542404, -0.06936700642108917, -0.021752867847681046, -0.008362767286598682, -0.06419705599546432, 0.05578208342194557, -0.04453633725643158, -0.0015835544327273965, -0.005097611807286739, -0.02646579034626484, -0.025165097787976265, 0.0022373003885149956, 0.05748988315463066, 0.01786942407488823, 0.03736952692270279, -0.007770772557705641, -0.06522392481565475, -0.015954546630382538, -0.027965573593974113, 0.021475329995155334, 0.07817767560482025, 0.01267350185662508, -0.0023563066497445107, -0.034554339945316315, -0.01838279515504837, 0.0007286980981007218, -0.06775838136672974, -0.022333446890115738, 0.005920276045799255, 0.025581421330571175, -0.0264765415340662, -0.011164617724716663, 0.04380118101835251, -0.026436472311615944, 0.03636486083269119, -0.025780122727155685, -0.016911879181861877, -0.023886632174253464, -0.01375560276210308, -0.0305266585201025, 0.0536351315677166, -0.006889538373798132, -0.014217635616660118, -0.0026519400998950005, -0.010388950817286968, 0.012563374824821949, -0.01831292174756527, 0.019514121115207672, -0.025177566334605217, 0.0012824255973100662, 0.009725949726998806, -0.0660194456577301, 0.04683405160903931, 0.022831937298178673, -0.04574301466345787, -0.015522297471761703, 0.017195234075188637, 0.007567652966827154, -0.03961489722132683, -0.02515142224729061, 0.003791387192904949, 0.019184118136763573, -0.03292524814605713, 0.01400757022202015, 0.03886500746011734, 0.014316418208181858, 0.05157661810517311, -0.011286395601928234, -0.033424556255340576, -0.010306612588465214 ]
Distributed Training: Train BART/T5 for Summarization using 🤗 Transformers and Amazon SageMaker
philschmid
April 8, 2021
sagemaker-distributed-training-seq2seq
guide, partnerships, aws, nlp
https://huggingface.co/blog/sagemaker-distributed-training-seq2seq
Test inference After we uploaded our model we can access it at https://huggingface.co/{hf_username}/{repository_name} python print(f"https://huggingface.co/{hf_username}/{repository_name}") And use the "Hosted Inference API" widget to test it. https://huggingface.co/philschmid/bart-large-cnn-samsum
[ 0.03528312221169472, -0.036239143460989, 0.03749489039182663, 0.014684842899441719, 0.05223287269473076, 0.04398656263947487, 0.048131220042705536, 0.05192537233233452, -0.02938677743077278, -0.017118582502007484, -0.0511489063501358, 0.02912411466240883, 0.036744050681591034, 0.06243167445063591, 0.00270398473367095, -0.07229092717170715, 0.040273938328027725, -0.029388008639216423, -0.01865776628255844, 0.04231443628668785, -0.014851017855107784, -0.05566328763961792, -0.017248230054974556, -0.043543364852666855, -0.053715985268354416, -0.04764992371201515, 0.036504775285720825, 0.02187434956431389, -0.013858738355338573, -0.01997678354382515, -0.11395452916622162, -0.022528544068336487, 0.026093948632478714, -0.07205642759799957, 0.006225192453712225, 0.0801684632897377, -0.14474526047706604, 0.030140593647956848, 0.015876449644565582, 0.010265009477734566, 0.015012585557997227, -0.06117068976163864, -0.037781331688165665, 0.02988617867231369, -0.017955133691430092, -0.025472991168498993, -0.1754542887210846, 0.06385096162557602, 0.009096403606235981, -0.001591528533026576, -0.0364353209733963, 0.07267450541257858, -0.0498458556830883, -0.021400243043899536, 0.022110121324658394, 0.0038653872907161713, -0.037887271493673325, -0.06864042580127716, 0.06270410120487213, -0.010715021751821041, 0.04250321164727211, 0.03412015363574028, 0.0296595711261034, 0.057310551404953, 0.017627788707613945, 0.05386030301451683, 0.04494014009833336, -0.02806873619556427, -0.04393753409385681, 0.004328672308474779, -0.027284223586320877, -0.009432011283934116, -0.00633219862356782, -0.04016825556755066, 0.020534740760922432, -0.0038362767081707716, -0.04127775877714157, 0.08691897988319397, 0.045411888509988785, 0.0323493555188179, -0.021782176569104195, -0.06170506402850151, 0.0006792800850234926, 0.03898739814758301, 0.04673956334590912, 0.06147349253296852, -0.006004976108670235, -0.02179434709250927, -0.019172606989741325, 0.05253523215651512, 0.013366746716201305, -0.08962041884660721, -0.044709462672472, 0.014771515503525734, 0.011360285803675652, -0.0337069034576416, 0.022329147905111313, 0.061000075191259384, 0.001307929866015911, -0.03207959979772568, -0.012220794335007668, -0.09169667959213257, -0.021529709920287132, -0.04344699904322624, -0.018844621255993843, 0.016740815714001656, -0.018600715324282646, -0.08990221470594406, -0.05127520114183426, -0.0030052270740270615, 0.011058533564209938, -0.022431371733546257, -0.010725216940045357, 0.08505313843488693, -0.09876784682273865, 0.02770725078880787, -0.04074356332421303, -0.020940404385328293, -0.004717670381069183, 0.036334775388240814, 0.012199304066598415, 0.07012291997671127, 0.038800761103630066, 0.04445592686533928, 0.03996547311544418, 0.07259993255138397, 0.0025601156521588564, 0.031045112758874893, -0.029568787664175034, -0.017559869214892387, 0.0019100714707747102, -0.05290735885500908, 0.03498170152306557, 0.017782194539904594, 0.037679385393857956, -0.02889113500714302, -0.030635138973593712, -0.06079217419028282, 0.04626086726784706, 0.010415162891149521, 0.004690532106906176, 0.023273922502994537, -0.018230972811579704, 0.030332228168845177, 0.07912617176771164, 0.038256414234638214, -0.052602436393499374, 0.019759155809879303, 0.017715416848659515, 0.054350852966308594, -0.09698651731014252, 0.08677522838115692, 0.015330236405134201, 0.0007832070114091039, 0.0024003498256206512, 0.04440972954034805, 0.006315899547189474, -0.0019704492297023535, -0.06467690318822861, -0.0006811798084527254, 0.004639795050024986, -0.06393077969551086, -0.04034584388136864, -0.02301766537129879, 0.00941365584731102, 0.019008614122867584, 0.006005282048135996, -0.017978372052311897, 0.036331906914711, -0.048049479722976685, 0.018867507576942444, -0.0605631060898304, 0.0829944983124733, -0.0014643168542534113, 0.030278701335191727, 0.03116919845342636, 0.0012951167300343513, -0.004923847038298845, 0.009653096087276936, 0.04395291954278946, -0.05470965430140495, 0.08395188301801682, -0.02353803627192974, -0.00024651043349877, 0.05662210285663605, -0.06535647064447403, 0.0046373400837183, -0.004306284710764885, 0.049565836787223816, -0.03602712228894234, -0.030246106907725334, -0.10183387994766235, 0.0811968743801117, -0.025052588433027267, 0.05649410933256149, -0.031430065631866455, -0.018278438597917557, 0.08826970309019089, 0.02736975997686386, 0.019199203699827194, -0.010102652944624424, 0.024953415617346764, 0.028416471555829048, -0.044570453464984894, -0.0015894847456365824, 0.06015164032578468, 0.03461146354675293, -0.07311812043190002, 0.004386029206216335, 0.04293857887387276, 0.04256480932235718, -0.06603625416755676, 0.04948732256889343, -0.03163251280784607, -0.0076123508624732494, -0.052115198224782944, -0.049398306757211685, 0.012891799211502075, 0.015278561040759087, -0.018618520349264145, 0.23569339513778687, -0.013185463845729828, 0.05442451313138008, -0.0465930700302124, -0.060291700065135956, 0.021180206909775734, 0.02484619989991188, 0.08423818647861481, 0.08472409099340439, -0.07554884999990463, -0.027458157390356064, -0.06783609837293625, -0.015927866101264954, 0.054452672600746155, 0.014012807048857212, -0.062137432396411896, 0.03238383308053017, -0.050281722098588943, 0.008168690837919712, -0.014038859866559505, 0.09168724715709686, 0.010060979053378105, 0.020870214328169823, 0.04851461946964264, -0.04409177973866463, -0.02621324732899666, 0.04050014540553093, 0.04771381616592407, -0.07665155827999115, -0.01610397920012474, -0.014643004164099693, 0.007070327643305063, 0.00395860243588686, 0.00064153439598158, 0.08676572144031525, -0.020392248407006264, -0.011503394693136215, 0.022837070748209953, -0.024557052180171013, 0.0823807641863823, 0.024593079462647438, 0.0066735814325511456, -0.032529402524232864, -0.019230522215366364, -0.008187348954379559, -0.0440540611743927, -0.0392388254404068, 0.0029360076878219843, -0.005303326994180679, -0.0008521011914126575, 0.030013319104909897, -0.016518762335181236, 0.0065153795294463634, 0.0228978730738163, 0.011545736342668533, 0.04128360375761986, 0.03211500868201256, 0.005954008083790541, -0.0033674766309559345, 0.00698664179071784, -0.010889030061662197, -0.03914275020360947, 0.010899397544562817, 0.02925051376223564, 0.035972658544778824, -0.024795953184366226, -0.008973064832389355, -0.03838351368904114, -0.03202629089355469, 0.019214335829019547, 0.008299369364976883, 0.03388088941574097, 0.023775918409228325, -0.007069068029522896, -0.015389923937618732, 0.013358628377318382, 0.05320366099476814, -0.00725181819871068, 0.004194675944745541, 0.03206093981862068, -0.0039509995840489864, -0.00948747992515564, -0.01504148356616497, -0.0297122560441494, -0.026770977303385735, 0.05732584372162819, 0.0113042201846838, -0.021490683779120445, -0.10777950286865234, -0.02237694524228573, 0.013946469873189926, 0.018506867811083794, 0.013338101096451283, -0.008299552835524082, 0.05837586149573326, -0.006081894971430302, 0.006761179305613041, 0.04095905274152756, -0.02758416160941124, -0.007687519304454327, 0.03465195372700691, -0.0016660288674756885, -0.05123484134674072, 0.004486285615712404, 0.012395822443068027, 0.00760493753477931, 0.032966211438179016, 0.038138195872306824, -0.04120587930083275, 0.03904183208942413, 0.002764585893601179, 0.000292834360152483, 0.012246635742485523, -0.0030500642023980618, 0.014940924011170864, 0.03997242823243141, 0.0379672572016716, -0.04515007138252258, 0.026459790766239166, -0.05783071368932724, -0.030414823442697525, 0.004569257143884897, -0.050445783883333206, 0.0117385508492589, -0.02905917726457119, -0.013935203664004803, 0.0011677817674353719, -0.0061209434643387794, 0.0022300940472632647, 0.009686035104095936, 0.006596776191145182, -0.007383081130683422, 0.013210478238761425, 0.004772193729877472, -0.005025640595704317, 0.012716083787381649, 0.0398234985768795, -0.014539435505867004, -0.028278248384594917, 0.0006941849715076387, 0.03665606677532196, 0.06760506331920624, -0.0014601770089939237, 0.01240431610494852, 0.020674467086791992, 0.019218191504478455, 0.02312077395617962, -0.0023852833546698093, -0.07164717465639114, -0.02337896078824997, 0.0204459298402071, -0.04216424375772476, -0.07621651887893677, 0.012901365756988525, 0.0023084303829818964, 0.017894115298986435, -0.00854747835546732, 0.038677141070365906, 0.010122238658368587, 0.043347910046577454, -0.019726421684026718, 0.01270025409758091, -0.021080104634165764, -0.030093690380454063, -0.009752074256539345, -0.0721445083618164, 0.07410198450088501, 0.016737965866923332, -0.016996892169117928, 0.024887412786483765, -0.0052841659635305405, -0.0026595070958137512, 0.03513297811150551, 0.0053924978710711, 0.034636806696653366, -0.04715261608362198, 0.01252586767077446, 0.04107052460312843, -0.028598032891750336, -0.015925206243991852, 0.020073585212230682, 0.010682059451937675, -0.02532591111958027, 0.027772851288318634, 0.04747439920902252, 0.01397048681974411, 0.003083467949181795, 0.03203384950757027, 0.02397114969789982, -0.029975002631545067, -0.024888459593057632, 0.015314159914851189, 0.017663108184933662, 0.017324455082416534, -0.01666034385561943, -0.04807499051094055, -0.011087947525084019, -0.01748562417924404, -0.0041134837083518505, -0.026641791686415672, -0.0069899489171803, -0.026093855500221252, 0.0028460256289690733, 0.02307651750743389, 0.0003299317613709718, 0.012367220595479012, -0.03628113865852356, 0.0576365627348423, -0.02519993670284748, 0.03554093465209007, -0.014694961719214916, -0.028831826522946358, 0.008279063738882542, 0.01646285690367222, 0.012396096251904964, 0.006749906577169895, -0.002574025420472026, -0.027819450944662094, -0.020389173179864883, 0.022428570315241814, 0.016768744215369225, 0.003785804845392704, 0.009120052680373192, -0.00855738203972578, -0.03264126554131508, -0.009160072542726994, 0.03216666355729103, -0.016586583107709885, 0.003001179313287139, 0.01947706565260887, -0.00004123531107325107, -0.05004864186048508, 0.007289786823093891, -0.0001891161227831617, -0.0698557198047638, -0.024997040629386902, -0.061618246138095856, 0.014494170434772968, 0.02773473598062992, -0.00986119732260704, -0.04327819123864174, 0.023460619151592255, 0.06122546270489693, 0.006456734146922827, -0.007064921781420708, 0.019395945593714714, 0.0216287299990654, 0.05029362440109253, 0.005318104289472103, 0.025984473526477814, 0.011484961025416851, 0.029690220952033997, -0.02308848313987255, -0.018953323364257812, -0.031090108677744865, -0.08460146188735962, -0.023318113759160042, 0.015700234100222588, -0.03537050634622574, 0.025419224053621292, -0.0056855627335608006, -0.03468870744109154, 0.005013291724026203, 0.048363763839006424, 0.060530904680490494, 0.005033522844314575, 0.010804462246596813, -0.0024817411322146654, -0.01926783099770546, -0.0032237402629107237, 0.045032698661088943, -0.023485973477363586, 0.0007095648907124996, 0.017333025112748146, 0.056203581392765045, 0.04756498709321022, 0.002058429643511772, 0.024948520585894585, -0.003434839891269803, -0.002726310398429632, 0.018844597041606903, -0.05564962327480316, 0.012551738880574703, -0.012384743429720402, 0.015992404893040657, 0.0022524928208440542, 0.035476602613925934, -0.03888239338994026, 0.0005722573841921985, 0.06487718969583511, -0.030748901888728142, -0.011865301989018917, 0.03591228649020195, -0.011101668700575829, 0.01618867740035057, 0.008323069661855698, 0.05735507979989052, -0.01906357705593109, 0.021304920315742493, -0.02664821408689022, -0.00891928467899561, 0.0005335645982995629, 0.029125666245818138, -0.04709846153855324, -0.024851806461811066, -0.0027157911099493504, 0.0383065901696682, 0.056851740926504135, -0.036878008395433426, 0.0012650813441723585, 0.014675872400403023, -0.022051023319363594, 0.050127338618040085, -0.010499713011085987, 0.014413750730454922, 0.012693826109170914, 0.013948790729045868, 0.05337684601545334, 0.019151797518134117, -0.01862403377890587, 0.020256388932466507, 0.013637588359415531, 0.02395833283662796, 0.0144395362585783, -0.03522069379687309, 0.023129679262638092, 0.022950364276766777, -0.025255056098103523, -0.0038763403426855803, -0.017388813197612762, -0.016756074503064156, -0.000022226917280931957, -0.04358948394656181, 0.02394663169980049, 0.07316696643829346, 0.009059729985892773, 0.005423747934401035, 0.014922221191227436, -0.018941480666399002, 0.025388512760400772, 0.012835048139095306, 0.01570979692041874, -0.002096799435093999, 0.011912723071873188, -0.013102480210363865, 0.009456771425902843, -0.0162031389772892, 0.028664859011769295, 0.03896966204047203, -0.03803747519850731, 0.007678491994738579, 0.010983973741531372, -0.025692610070109367, 0.008782832883298397, -0.009920244105160236, -0.03616459667682648, -0.029497740790247917, 0.007659399416297674, 0.01108019333332777, 0.012230081483721733, 0.02023199573159218, -0.04307802766561508, -0.01756065897643566, -0.016352901235222816, 0.01616412214934826, 0.06945367157459259, -0.020698407664895058, 0.059743303805589676, 0.008512149564921856, 0.03606834262609482, 0.028889158740639687, 0.012475921772420406, 0.019023161381483078, -0.013659881427884102, 0.05472353845834732, -0.000829460856039077, 0.03921832516789436, -0.003647427773103118, -0.03300848603248596, -0.015369722619652748, -0.01619773544371128, -0.02462351694703102, -0.0028684218414127827, 0.03047015517950058, -0.002205688739195466, -0.005397414322942495, 0.03829948231577873, -0.057549849152565, 0.03981390595436096, -0.0021601759362965822, 0.03315431624650955, -0.0028286550659686327, -0.00933023914694786, 0.0536622479557991, -0.015583963133394718, -0.041485656052827835, 0.04950442165136337, -0.01097032893449068, -0.0050462535582482815, 0.04678749665617943, -0.00862929504364729, 0.0048047578893601894, -0.013205320574343204, 0.02305550128221512, 0.00020761118503287435, -0.02217266894876957, -0.043974749743938446, -0.0056609418243169785, 0.010753985494375229, -0.00789478700608015, 0.0020880023948848248, 0.031341325491666794, -0.015398802235722542, -0.018646204844117165, -0.021069353446364403, 0.015071259811520576, 0.013176226057112217, -0.051363199949264526, 0.00601263577118516, 0.04491874575614929, 0.025756219401955605, -0.024891896173357964, -0.003085887059569359, 0.00635278457775712, 0.023715414106845856, -0.029722848907113075, -0.020250454545021057, 0.024759791791439056, -0.0021120975725352764, -0.005961350165307522, -0.010656672529876232, 0.03727038949728012, -0.04230506718158722, 0.016626430675387383, 0.010030541568994522, 0.034131716936826706, -0.004940249025821686, 0.016345283016562462, 0.037463270127773285, 0.0069391909055411816, -0.007207243703305721, 0.008951670490205288, 0.011639031581580639, -0.012977614998817444, -0.01861490122973919, -0.03151708096265793, -0.03547166660428047, 0.017154358327388763, 0.014032036997377872, 0.003701633308082819, 0.026085101068019867, -0.012936418876051903, -0.04866882786154747, 0.020873121917247772, -0.01757335104048252, -0.016872212290763855, -0.011290105059742928, -0.016479959711432457, -0.006586751434952021, -0.01682196371257305, 0.03230641782283783, 0.00831207912415266, -0.011456100270152092, 0.013613675720989704, 0.04988822713494301, -0.03206963464617729, -0.044123973697423935, -0.002795909298583865, 0.03678668290376663, -0.01801573485136032, 0.033117134124040604, 0.02950316108763218, 0.010463540442287922, -0.007723253220319748, -0.023060670122504234, 0.03226295858621597, -0.05503791198134422, -0.005191143602132797, -0.05223740637302399, -0.06420554965734482, -0.01786654070019722, 0.001564173260703683, -0.03526651859283447, -0.006057349033653736, -0.05785355344414711, -0.04128236696124077, 0.00034370459616184235, -0.007181558758020401, -0.02846149541437626, 0.005686839111149311, 0.08450023829936981, 0.02662316896021366, 0.02363688498735428, 0.006869341246783733, -0.01992526650428772, 0.018195034936070442, -0.012071667239069939, 0.009704374708235264, -0.004142222926020622, 0.04982593283057213, -0.018568793311715126, 0.014596239663660526, 0.022239305078983307, 0.0007544123800471425, -0.046935148537158966, 0.035753145813941956, 0.028349649161100388, -0.01805545575916767, -0.04871264472603798, 0.006421578116714954, 0.008686759509146214, -0.00049483438488096, 0.0599847137928009, 0.00221617566421628, -0.011028056032955647, -0.027062853798270226, 0.010436623357236385, -0.08620285987854004, -0.036882996559143066, -0.02071789838373661, -0.005798663944005966, 0.028888873755931854, 0.006383121944963932, 0.02571442350745201, -0.007125443313270807, -0.010673146694898605, -0.024727020412683487, -0.0016275565139949322, -0.045115645974874496, -0.04950572922825813, -0.018347181379795074, 0.0178573876619339, -0.026808254420757294, -0.03832538053393364, -0.02352689951658249, -0.029558395966887474, -0.04241536930203438, 0.020005425438284874, 0.019470110535621643, 0.02373420260846615, -0.014407018199563026, 0.019097285345196724, -0.033336091786623, 0.038871731609106064, 0.024477964267134666, -0.019591493532061577, -0.027867037802934647, 0.0035262824967503548 ]
Introducing 🤗 Accelerate
sgugger
April 16, 2021
accelerate-library
guide
https://huggingface.co/blog/accelerate-library
Optimizer The optimizer is also wrapped in a special container that will perform the necessary operations in the step to make mixed precision work. It will also properly handle device placement of the state dict if its non-empty or loaded from a checkpoint.
[ 0.0062589640729129314, 0.001793881761841476, 0.002057538367807865, 0.017453251406550407, 0.07481628656387329, -0.0358746312558651, -0.022702716290950775, 0.01999136060476303, -0.062369249761104584, -0.057451482862234116, -0.01962996833026409, -0.08916804939508438, 0.020799923688173294, 0.010454755276441574, 0.03710826858878136, 0.030457764863967896, 0.10211710631847382, -0.10172487050294876, 0.02455374412238598, 0.030463477596640587, -0.042877472937107086, -0.0521978884935379, 0.06622583419084549, -0.03298038989305496, 0.036492399871349335, -0.03944982588291168, -0.06389648467302322, -0.008227945305407047, -0.0022418061271309853, 0.06192895025014877, -0.05329335853457451, -0.0025370423682034016, -0.004465755540877581, -0.0686100646853447, 0.05993979051709175, 0.0029771749395877123, -0.0970621183514595, 0.019590916112065315, 0.034975845366716385, -0.012041423469781876, -0.03870491683483124, -0.06477441638708115, -0.07636646181344986, -0.012878388166427612, -0.020472370088100433, -0.012902157381176949, -0.1883784830570221, 0.05462910234928131, -0.02226843312382698, -0.09765152633190155, -0.05418066307902336, 0.051369380205869675, -0.015567278489470482, 0.04784095287322998, -0.01744244247674942, -0.009774767793715, -0.026657644659280777, -0.011039682663977146, 0.019699569791555405, -0.03765667974948883, 0.005831106100231409, 0.009938129223883152, -0.0038909767754375935, -0.0022488837130367756, 0.05740693211555481, 0.03371857479214668, 0.033776432275772095, -0.01861388236284256, -0.02755921147763729, -0.04901225119829178, 0.00002761154610197991, 0.058726806193590164, -0.01534056756645441, 0.04835795611143112, -0.006315954960882664, -0.06963430345058441, -0.06001295521855354, 0.012761975638568401, 0.010825862176716328, 0.08714468032121658, 0.024866141378879547, -0.06302881240844727, 0.03347741439938545, 0.07679016143083572, 0.03249889239668846, 0.019655641168355942, 0.009846090339124203, -0.0272960402071476, -0.08088676631450653, 0.06894740462303162, 0.010123387910425663, -0.06652161478996277, 0.02641288936138153, 0.015093798749148846, 0.01761513762176037, -0.03132705017924309, 0.030328458175063133, 0.034002188593149185, 0.004658413585275412, 0.08357217907905579, 0.05409260466694832, -0.006103460676968098, -0.009676067158579826, -0.001041052513755858, -0.004466651007533073, 0.07990293204784393, -0.009435189887881279, -0.04376829043030739, 0.008566364645957947, 0.0747438296675682, -0.022646676748991013, -0.020624900236725807, -0.018016090616583824, 0.0627698078751564, -0.08127645403146744, 0.1141793504357338, -0.0020223043393343687, -0.000042275016312487423, 0.03969478979706764, -0.008225071243941784, 0.08846566826105118, 0.0772131085395813, 0.0671703889966011, 0.02193170227110386, -0.020853400230407715, -0.0011477016378194094, 0.004920345265418291, -0.02163025364279747, 0.03003496304154396, -0.03322042524814606, -0.00428439024835825, 0.05507894605398178, 0.014117895625531673, 0.016131799668073654, 0.021755876019597054, -0.10616588592529297, 0.02913934737443924, 0.004826821852475405, -0.013612071983516216, -0.03482668101787567, -0.04002624750137329, 0.026914147660136223, 0.0017020561499521136, -0.033349569886922836, -0.040268346667289734, -0.030878037214279175, -0.0023348722606897354, 0.07839446514844894, 0.037851519882678986, 0.11071890592575073, 0.009768971242010593, 0.03031681850552559, -0.025485649704933167, -0.05309540033340454, 0.02544793300330639, 0.07027069479227066, -0.023326795548200607, -0.025069762021303177, -0.09933576732873917, -0.020515404641628265, -0.013731024228036404, 0.016945410519838333, -0.04974694922566414, -0.07042958587408066, 0.006851271726191044, 0.022488702088594437, 0.07148780673742294, 0.06394745409488678, 0.043446071445941925, -0.026124080643057823, -0.01286990661174059, -0.0028312918730080128, 0.061571910977363586, -0.014778339304029942, 0.008226042613387108, 0.043718770146369934, 0.03905390948057175, 0.061972372233867645, 0.007422945462167263, -0.035556383430957794, -0.02762151136994362, 0.08190199732780457, -0.06137239933013916, 0.025443393737077713, -0.03547726571559906, -0.10260965675115585, 0.040572501718997955, -0.04246709868311882, -0.04682028293609619, 0.008175844326615334, -0.08082742989063263, 0.0039091939106583595, 0.002578231506049633, -0.06912368535995483, -0.017891619354486465, -0.030369840562343597, -0.03002087213099003, 0.11198179423809052, 0.06086130067706108, -0.0026156087405979633, 0.07963930815458298, 0.029874620959162712, 0.005881390068680048, -0.03356695920228958, 0.006021345965564251, 0.06200345605611801, 0.055694811046123505, -0.049762796610593796, 0.04115856811404228, 0.06445389986038208, 0.01196359470486641, -0.11022964119911194, -0.034876395016908646, -0.08052074909210205, 0.011728019453585148, 0.03806893154978752, -0.02581414021551609, -0.01823311299085617, -0.02507478930056095, -0.007462698966264725, 0.05933587625622749, -0.00640361662954092, 0.0200456865131855, 0.02616226114332676, -0.060362815856933594, 0.03099437616765499, 0.03765188902616501, -0.01777620241045952, 0.001679766341112554, -0.056032486259937286, -0.046333104372024536, -0.0999673455953598, -0.04109504818916321, 0.06789089739322662, 0.023414678871631622, 0.029457945376634598, -0.004195561632514, 0.0515143908560276, 0.09254208952188492, -0.013949432410299778, -0.0042215511202812195, -0.03186379000544548, 0.004277805797755718, 0.03762204572558403, 0.03362789750099182, 0.033464230597019196, 0.062170885503292084, -0.022636989131569862, -0.11073946952819824, -0.02078167535364628, 0.0019333845702931285, 0.003543263301253319, -0.01715872809290886, -0.038014356046915054, 0.1087561845779419, -0.04376703128218651, -0.019504325464367867, -0.03501060977578163, -0.023061849176883698, 0.012315300293266773, 0.009550191462039948, -0.02542889304459095, -0.02734975889325142, -0.009371913969516754, 0.016230443492531776, -0.02085247077047825, 0.040443580597639084, 0.022208834066987038, -0.0008100316044874489, 0.026537243276834488, -0.011156422086060047, -0.02694890834391117, 0.017093194648623466, -0.03137407824397087, 0.016688352450728416, -0.026376280933618546, -0.002130564535036683, 0.015099739655852318, -0.039638008922338486, 0.02569206990301609, -0.014224420301616192, -0.04415850713849068, 0.012722905725240707, 0.021185245364904404, 0.0055284323170781136, -0.0019119690405204892, 0.023741407319903374, 0.02053608000278473, 0.001484345062635839, 0.03622690960764885, 0.010475896298885345, -0.007850886322557926, -0.00013652957568410784, 0.008194814436137676, -0.0189653392881155, 0.018955299630761147, -0.0015643042279407382, -0.01624738611280918, 0.0005386610864661634, 0.014680905267596245, -0.019199121743440628, 0.03356751799583435, 0.014306091703474522, -0.022424954921007156, -0.04827402904629707, 0.006485284771770239, 0.013557681813836098, 0.03689665347337723, -0.10478268563747406, -0.025049453601241112, 0.013796119019389153, 0.041894346475601196, -0.004961161408573389, -0.017704645171761513, 0.014991185627877712, 0.012486917898058891, -0.020974840968847275, -0.013103700242936611, 0.04234728217124939, 0.04905681684613228, 0.03228345513343811, 0.0005630605155602098, -0.03973503038287163, -0.013113562949001789, 0.023529885336756706, 0.016735864803195, 0.008317182771861553, 0.007400915026664734, -0.02398013323545456, 0.01201372779905796, 0.033088985830545425, -0.0502205453813076, -0.0030656263697892427, -0.03644958510994911, 0.02350817620754242, 0.027382347732782364, -0.041121043264865875, 0.006339067593216896, -0.05297137051820755, 0.026365475729107857, -0.008418746292591095, -0.004492624197155237, 0.025601262226700783, -0.024707749485969543, -0.024265388026833534, 0.012362447567284107, -0.017060501500964165, -0.0033148792572319508, 0.030338115990161896, 0.008685785345733166, -0.004608131479471922, 0.017071589827537537, 0.011201844550669193, -0.012031016871333122, 0.04527123644948006, -0.0509481318295002, 0.022763853892683983, -0.05145394057035446, 0.007590906694531441, -0.05589563772082329, 0.021150603890419006, 0.03909654915332794, -0.028301922604441643, -0.01641610637307167, -0.037918440997600555, 0.041074518114328384, 0.05430327355861664, 0.00206832867115736, -0.04761137440800667, -0.05834246426820755, 0.005586525890976191, -0.016641885042190552, -0.002404345665127039, 0.021352466195821762, 0.023007076233625412, 0.01276696752756834, 0.004450383596122265, 0.05249982327222824, 0.005494003649801016, 0.01808762177824974, 0.0016320636495947838, 0.010813450440764427, -0.037547770887613297, 0.03247811645269394, 0.018913591280579567, -0.0029168494511395693, 0.06194969639182091, -0.004352107644081116, -0.032985132187604904, 0.006099181715399027, -0.013482908718287945, 0.013160034082829952, 0.021039621904492378, 0.02298886887729168, 0.026774531230330467, -0.005679983180016279, -0.0038419768679887056, 0.0648665502667427, 0.0231427401304245, -0.04675315320491791, 0.0020286054350435734, -0.016887927427887917, -0.032793208956718445, 0.03620760515332222, 0.013158192858099937, 0.0134227704256773, 0.0050145480781793594, -0.016609659418463707, 0.04380229860544205, -0.012325895018875599, -0.00041914472240023315, -0.012489985674619675, -0.0032090817112475634, -0.019968798384070396, -0.05592936649918556, -0.007694612257182598, 0.013002117164433002, -0.007897789590060711, 0.033786337822675705, -0.003090689890086651, 0.047389861196279526, -0.04139036312699318, 0.06518607586622238, 0.006874426268041134, 0.01802254095673561, -0.002056388882920146, -0.0035910061560571194, 0.025678357109427452, -0.05051134154200554, 0.004471877124160528, -0.015819620341062546, 0.03130802884697914, -0.013001132756471634, 0.01867031492292881, 0.005486402660608292, 0.020212814211845398, 0.03041900135576725, -0.02723544090986252, -0.0058572180569171906, 0.033516354858875275, 0.02936876006424427, -0.00889483094215393, -0.013224659487605095, -0.030868282541632652, 0.00444139214232564, 0.03277047351002693, -0.004906774498522282, -0.08090803027153015, 0.012732110917568207, -0.03470712900161743, 0.02187982015311718, -0.05641111731529236, 0.07874832302331924, 0.009071054868400097, -0.02916540764272213, 0.02636045776307583, 0.00007613458001287654, 0.044819071888923645, 0.007280732970684767, 0.0009270011214539409, -0.03123399429023266, -0.008258146233856678, 0.04077940061688423, -0.018002500757575035, 0.0064479885622859, -0.039517972618341446, 0.05113382264971733, 0.04407770186662674, 0.03153710812330246, 0.002321943873539567, -0.03778882324695587, 0.006408986169844866, -0.009170396253466606, -0.020267069339752197, -0.009788506664335728, -0.015165511518716812, -0.013424370437860489, 0.02591918781399727, -0.03752510994672775, -0.03207923471927643, -0.03251184895634651, -0.014487178064882755, 0.06676309555768967, 0.017170263454318047, -0.01798507198691368, -0.005758348852396011, -0.008198617026209831, -0.009394659660756588, 0.02024785615503788, 0.01765349879860878, 0.0018872979562729597, 0.012300990521907806, -0.03641384840011597, 0.001320701907388866, 0.016382256522774696, 0.011929024942219257, -0.008860872127115726, 0.031534794718027115, 0.03151370584964752, -0.01797378808259964, 0.012884678319096565, -0.044862423092126846, 0.00817034114152193, -0.009441433474421501, 0.006092095281928778, 0.022511830553412437, -0.003254758892580867, -0.022821128368377686, 0.03761008381843567, 0.013132085092365742, -0.013289135880768299, -0.003024457721039653, -0.004538934677839279, 0.022288432344794273, 0.02890973724424839, 0.01499822735786438, 0.02721029706299305, -0.006320647895336151, -0.028721848502755165, 0.00916571170091629, -0.023903245106339455, -0.012868712656199932, 0.003727414645254612, -0.029995471239089966, -0.015555944293737411, 0.06195802614092827, -0.0016662784619256854, 0.07122363895177841, 0.030129745602607727, 0.02118537202477455, -0.0033401898108422756, 0.019425129517912865, 0.018890423700213432, -0.04049183055758476, 0.0626605823636055, 0.011389856226742268, 0.004223213996738195, 0.020380550995469093, 0.011053942143917084, -0.022430753335356712, 0.020148051902651787, 0.016491807997226715, 0.042939890176057816, 0.010194370523095131, -0.01881016418337822, 0.035456907004117966, 0.020856013521552086, -0.007904141210019588, -0.02194407768547535, -0.036521244794130325, -0.022996501997113228, 0.0050577400252223015, -0.046301841735839844, -0.017108257859945297, 0.02502983622252941, -0.011663257144391537, 0.011270617134869099, 0.044622644782066345, 0.037773650139570236, -0.015228074043989182, 0.0020668485667556524, 0.0018524357583373785, 0.03998060151934624, 0.03227969631552696, -0.028330694884061813, -0.02321019396185875, 0.014901172369718552, -0.03609173372387886, -0.0013382286997511983, -0.05455763638019562, 0.012890912592411041, 0.003746102564036846, -0.009661433286964893, -0.0007437894819304347, -0.0009171368437819183, -0.042695771902799606, 0.0013048755936324596, -0.02532869763672352, -0.03332702815532684, 0.05539851635694504, 0.02121294103562832, 0.0483519621193409, -0.03495001420378685, -0.003715410130098462, 0.040594376623630524, 0.09016045182943344, -0.021652236580848694, -0.011850478127598763, 0.011105461977422237, 0.03232410177588463, 0.007395635358989239, 0.035395070910453796, -0.017914308235049248, -0.008320845663547516, 0.00968879647552967, 0.043335817754268646, 0.003564187092706561, -0.001438738196156919, 0.01993282325565815, -0.01881871186196804, 0.010288487188518047, -0.028012121096253395, -0.028279462829232216, -0.008440998382866383, 0.006642100866883993, -0.032809700816869736, 0.02922225371003151, -0.04508810490369797, 0.030302656814455986, 0.02964496798813343, 0.019967952743172646, -0.03143142908811569, -0.033305179327726364, 0.03089241497218609, 0.018586711958050728, 0.02218753844499588, 0.023198304697871208, -0.05613074451684952, -0.0019631406757980585, 0.07360341399908066, 0.000819109845906496, 0.021778032183647156, 0.039528943598270416, 0.02337551675736904, 0.04184035584330559, -0.014584094285964966, -0.02425200119614601, 0.026811508461833, 0.009519336745142937, -0.0564769022166729, 0.021970110014081, 0.004320000763982534, -0.09364509582519531, -0.010827307589352131, -0.02253354713320732, -0.02386512979865074, 0.0003575820301193744, 0.01744997315108776, -0.025921054184436798, 0.077021025121212, 0.0052323779091238976, -0.052799198776483536, -0.00017799540364649147, 0.020372362807393074, 0.012636782601475716, -0.0006860479479655623, -0.04802417382597923, -0.003177646081894636, -0.028080739080905914, 0.00484070647507906, 0.024187471717596054, 0.05847535282373428, 0.02663414180278778, 0.022570908069610596, 0.04164019227027893, 0.0215773843228817, -0.007363546639680862, -0.01593857817351818, 0.015359196811914444, 0.035701654851436615, -0.04424525797367096, -0.02351907081902027, -0.023966364562511444, -0.023651057854294777, 0.030299579724669456, -0.015851570293307304, -0.004148724023252726, 0.010125942528247833, 0.017716186121106148, -0.0009080861927941442, 0.0051146941259503365, 0.002352154580876231, -0.01517798937857151, -0.000714869936928153, -0.042168088257312775, 0.016384020447731018, 0.020314693450927734, -0.004642839077860117, -0.014724312350153923, -0.023581143468618393, -0.010560320690274239, 0.01401677168905735, -0.025756467133760452, -0.0013844743371009827, 0.04483805596828461, -0.0043086884543299675, -0.030695829540491104, -0.0030397723894566298, 0.012766611762344837, -0.0183370653539896, 0.011041228659451008, 0.013850496150553226, -0.004504556301981211, -0.0038434281013906, -0.026621488854289055, 0.006271736696362495, -0.011734112165868282, 0.0533260814845562, -0.007887099869549274, -0.011818654835224152, 0.006931707728654146, -0.04817447438836098, 0.0041999826207757, 0.005905493162572384, 0.008113966323435307, 0.005398229230195284, -0.0016543641686439514, -0.003646759083494544, -0.03606867417693138, 0.027817193418741226, 0.06962014734745026, 0.02261366881430149, 0.027727236971259117, 0.03898739069700241, 0.01381626259535551, 0.0015212263679131866, 0.03469117730855942, -0.00479911221191287, 0.04327481612563133, -0.019682692363858223, -0.009801962412893772, -0.04470708966255188, 0.01222301460802555, -0.007940868847072124, -0.06766752153635025, 0.01997114159166813, 0.03867053985595703, -0.05900093913078308, -0.02732306905090809, -0.017390968278050423, 0.02737974002957344, 0.016645701602101326, 0.008769901469349861, -0.05858724191784859, -0.005846696440130472, 0.034187834709882736, 0.023861467838287354, -0.033743225038051605, -0.05679972842335701, -0.035057101398706436, 0.029568426311016083, 0.018921269103884697, 0.01436652708798647, 0.004353498574346304, -0.02322530746459961, -0.03769633546471596, -0.027852335944771767, -0.048436399549245834, 0.01310630515217781, -0.009134095162153244, -0.02492261491715908, -0.014004401862621307, -0.024501079693436623, -0.06563109904527664, -0.019668983295559883, -0.02617419883608818, 0.006012652534991503, 0.024369046092033386, 0.006693272385746241, 0.009402121417224407, 0.01137807872146368, 0.006968789733946323, 0.02982100285589695, 0.062163665890693665, 0.02751174196600914, 0.013303580693900585, -0.007531237788498402, -0.012294796295464039 ]
Introducing 🤗 Accelerate
sgugger
April 16, 2021
accelerate-library
guide
https://huggingface.co/blog/accelerate-library
One launcher to rule them all The scripts using Accelerate will be completely compatible with your traditional launchers, such as torch.distributed.launch. But remembering all the arguments to them is a bit annoying and when you've setup your instance with 4 GPUs, you'll run most of your trainings using them all. Accelerate comes with a handy CLI that works in two steps: bash accelerate config This will trigger a little questionnaire about your setup, which will create a config file you can edit with all the defaults for your training commands. Then bash accelerate launch path_to_script.py --args_to_the_script will launch your training script using those default. The only thing you have to do is provide all the arguments needed by your training script. To make this launcher even more awesome, you can use it to spawn an AWS instance using SageMaker. Look at this guide to discover how!
[ 0.0453387126326561, 0.055984362959861755, -0.011490813456475735, 0.02153826504945755, -0.008734951727092266, 0.029848715290427208, -0.0023516628425568342, -0.021720251068472862, -0.007466662209481001, -0.12786895036697388, -0.057887569069862366, 0.043915387243032455, -0.03779378533363342, 0.04804927110671997, 0.044881582260131836, -0.043275877833366394, -0.027448322623968124, -0.05271762236952782, -0.05327713117003441, 0.015970099717378616, 0.030015576630830765, -0.02450704574584961, 0.011995676904916763, 0.03891300782561302, -0.05575857684016228, 0.0007726336480118334, 0.0024420754052698612, 0.003284751670435071, -0.016817258670926094, 0.047129515558481216, -0.033663973212242126, 0.025542907416820526, 0.002451325301080942, -0.03481042757630348, 0.03361508622765541, 0.02823122777044773, -0.09346591681241989, 0.07468140870332718, 0.04087670519948006, -0.02696407027542591, -0.011229692958295345, -0.050534117966890335, -0.03998907282948494, 0.005198231432586908, 0.008539619855582714, 0.032025132328271866, -0.10925350338220596, 0.012540090829133987, -0.0686771348118782, -0.025792578235268593, -0.055367108434438705, 0.062016528099775314, -0.033246368169784546, -0.057547297328710556, 0.0601850301027298, 0.02789890393614769, 0.028102649375796318, -0.035029079765081406, 0.01861686445772648, 0.010802710428833961, -0.02331545203924179, 0.014415843412280083, -0.02373865433037281, 0.06191519275307655, 0.04130129516124725, -0.08131527155637741, -0.05945921316742897, -0.019503166899085045, -0.01904706470668316, -0.06372720748186111, 0.048194508999586105, -0.0019465758232399821, -0.03793491795659065, -0.024623122066259384, -0.01936255395412445, -0.12113804370164871, 0.021331023424863815, 0.0021179458126425743, -0.0011305328225716949, 0.03648286312818527, -0.0679774060845375, 0.015782352536916733, -0.018015628680586815, 0.06462331116199493, 0.023994315415620804, 0.0017094770446419716, -0.04393388703465462, -0.06939240545034409, -0.031757041811943054, -0.002319611608982086, 0.038010794669389725, -0.11260171979665756, 0.005774150602519512, 0.06335260719060898, 0.08133962750434875, 0.024228304624557495, 0.0013586042914539576, -0.07516103237867355, 0.038053400814533234, -0.03561379760503769, 0.027606459334492683, -0.1036066859960556, 0.012477238662540913, -0.0070032463409006596, -0.05347997322678566, 0.06289969384670258, -0.06593150645494461, -0.0739240050315857, -0.06183205917477608, 0.024408705532550812, -0.03585462644696236, -0.03629958629608154, 0.01245917659252882, 0.023811444640159607, 0.005242960527539253, -0.06335286051034927, 0.01667012833058834, 0.025543324649333954, 0.031811680644750595, -0.07835989445447922, -0.024912647902965546, 0.05325330048799515, 0.029657486826181412, 0.023412585258483887, -0.025563742965459824, 0.11127253621816635, 0.04335673153400421, -0.024052195250988007, -0.022021574899554253, -0.07317046076059341, 0.05815740302205086, -0.03590426966547966, 0.0662507638335228, 0.00508084986358881, -0.024054229259490967, -0.02590538188815117, -0.007108043879270554, -0.024376338347792625, 0.02018006518483162, 0.016837134957313538, -0.027644630521535873, 0.08204767107963562, 0.06129683554172516, 0.006222652271389961, -0.010973958298563957, -0.012913181446492672, -0.00853171106427908, -0.0027760746888816357, -0.05903687700629234, 0.08175862580537796, -0.0849933922290802, 0.1174468845129013, 0.02096956968307495, -0.012171421200037003, 0.0374390110373497, 0.10076729208230972, -0.06657418608665466, 0.04302079603075981, -0.05598176270723343, -0.004213388543576002, -0.000033102460292866454, -0.046251241117715836, -0.058719322085380554, -0.043636005371809006, -0.05678463727235794, -0.006562958005815744, 0.014279002323746681, -0.009032400324940681, 0.05313759297132492, -0.043152544647455215, -0.0007430576370097697, 0.030496710911393166, 0.005689695943146944, -0.0006302542751654983, -0.003596758469939232, 0.03839212656021118, 0.02021646499633789, 0.10341168940067291, 0.026157649233937263, -0.016087591648101807, -0.033864397555589676, 0.03750649094581604, -0.048621516674757004, 0.07072926312685013, 0.05430746078491211, -0.08382672816514969, 0.027575524523854256, -0.06904464215040207, 0.04661816358566284, 0.0711430013179779, -0.010823648422956467, 0.0675378143787384, 0.08922700583934784, 0.040666382759809494, 0.040134496986866, -0.05589059367775917, -0.06758861988782883, 0.09450927376747131, 0.09069237112998962, 0.029798418283462524, -0.03433294966816902, -0.02806197479367256, -0.020045742392539978, -0.029625743627548218, -0.03207089379429817, 0.03769809380173683, -0.019893066957592964, -0.12051303684711456, 0.028085162863135338, 0.0345664881169796, 0.014909287914633751, -0.08474212139844894, -0.01633274368941784, -0.06390395760536194, -0.0020553553476929665, 0.033224161714315414, -0.02438637614250183, 0.000011230946256546304, 0.023903436958789825, 0.07757843285799026, 0.09063408523797989, -0.052850689738988876, -0.03128458186984062, -0.03613986819982529, -0.00005339963172446005, 0.013592337258160114, 0.016846299171447754, -0.0027021998539566994, 0.017247898504137993, -0.06521372497081757, 0.034840188920497894, -0.03609386086463928, -0.0921650305390358, 0.08617358654737473, 0.004084786865860224, 0.003426362294703722, 0.026082046329975128, -0.015213711187243462, -0.017976000905036926, -0.03444702923297882, 0.008970484137535095, 0.05303376913070679, -0.019922509789466858, 0.04858650639653206, 0.012052148580551147, 0.014762713573873043, 0.06721659004688263, -0.009608780965209007, -0.005842144601047039, -0.015632446855306625, -0.044403523206710815, 0.021103592589497566, -0.019795572385191917, -0.05212073028087616, 0.03268566355109215, 0.035537660121917725, -0.01768679916858673, -0.011940358206629753, -0.02045864798128605, 0.022748436778783798, -0.011457273736596107, 0.0242074653506279, -0.028871478512883186, -0.0006032013334333897, -0.013271418400108814, -0.05575870722532272, 0.02608587220311165, -0.024887029081583023, -0.023863760754466057, -0.025735313072800636, -0.017443852499127388, 0.009196368046104908, 0.03199796751141548, 0.0041912817396223545, -0.014297150075435638, 0.025097819045186043, 0.035180702805519104, -0.005259636789560318, -0.029012681916356087, 0.006932427641004324, -0.0022893876302987337, -0.039807938039302826, -0.022553935647010803, 0.032968126237392426, -0.0049600545316934586, 0.023729292675852776, 0.004442474339157343, 0.015260085463523865, -0.014423455111682415, 0.013501232489943504, 0.01913340948522091, 0.03766073286533356, 0.05469737574458122, 0.04005325213074684, -0.02885196916759014, 0.025005275383591652, 0.0091346250846982, -0.02792147547006607, 0.007427401375025511, 0.004568982403725386, 0.010321514680981636, 0.020592523738741875, 0.004429021384567022, 0.01272530760616064, 0.01999826543033123, -0.03841875120997429, -0.008419320918619633, 0.006801253650337458, -0.07401614636182785, -0.007650809362530708, -0.04145249351859093, 0.016078753396868706, -0.0004688290355261415, -0.013571335934102535, 0.005289013963192701, -0.01692153699696064, 0.013699311763048172, 0.01633971557021141, -0.030104756355285645, 0.0029312821570783854, 0.0014641281450167298, -0.03144383057951927, 0.007548557128757238, 0.0048178695142269135, -0.011564726941287518, -0.012557866983115673, -0.009041479788720608, 0.019299225881695747, 0.013838037848472595, 0.007353194057941437, -0.0010378739098086953, -0.016757477074861526, -0.010548550635576248, 0.028698939830064774, 0.05302228033542633, 0.04235381260514259, -0.01512494869530201, -0.08130650967359543, 0.0006653802120126784, -0.022122953087091446, -0.03234191611409187, -0.009454787708818913, -0.029478199779987335, -0.02154519595205784, 0.0073813581839203835, -0.007784964982420206, 0.02151629887521267, 0.005581564269959927, 0.03366539999842644, 0.020028134807944298, 0.06961117684841156, -0.03387168422341347, 0.021659746766090393, -0.02010306343436241, 0.01449132151901722, 0.006418646313250065, 0.034849196672439575, -0.05747951939702034, -0.049277301877737045, -0.03501017391681671, -0.009353105910122395, -0.02400544099509716, 0.005433410406112671, -0.014286186546087265, -0.014030794613063335, 0.05441159009933472, 0.040745172649621964, -0.0061910864897072315, -0.02878608927130699, 0.010158983990550041, 0.017818232998251915, -0.00557285500690341, 0.01187861431390047, 0.0073640113696455956, 0.006226907949894667, -0.04974065348505974, -0.010251007974147797, 0.014199540950357914, -0.04263485595583916, 0.032266080379486084, -0.010273904539644718, 0.0018311493331566453, -0.009157837368547916, -0.014705503359436989, -0.04706704616546631, -0.02218543365597725, 0.026296766474843025, 0.042066026479005814, 0.019150210544466972, -0.015118185430765152, -0.031109211966395378, -0.0711468756198883, 0.02630777470767498, -0.004886699840426445, -0.03592969849705696, -0.07459083199501038, 0.0722830668091774, 0.03721531108021736, -0.0014768618857488036, -0.03787748143076897, 0.06289393454790115, 0.01783694699406624, -0.0016937700565904379, 0.003457076381891966, -0.009979416616261005, 0.025563115254044533, -0.03344862163066864, -0.0043536024168133736, -0.010191056877374649, -0.05168448016047478, 0.023393400013446808, 0.004801726434379816, -0.05234982818365097, 0.04348301887512207, 0.032149914652109146, -0.012668573297560215, 0.015756400302052498, 0.006970901042222977, 0.03391635790467262, 0.01544938888400793, 0.0019117634510621428, -0.020547715947031975, 0.020907768979668617, 0.04980551078915596, -0.00018375623039901257, 0.03232315927743912, -0.027142319828271866, 0.049581486731767654, -0.054918404668569565, 0.061837147921323776, 0.0302797369658947, -0.062010716646909714, 0.0055041140876710415, -0.024871859699487686, -0.00413848739117384, 0.002559650456532836, -0.017950471490621567, -0.024208655580878258, -0.06220649555325508, -0.025709467008709908, 0.03301415592432022, 0.05064673721790314, 0.011677651666104794, -0.012209554202854633, -0.01794527657330036, 0.0032918329816311598, -0.014413108117878437, 0.015451706945896149, -0.05853913351893425, 0.023550016805529594, 0.020363232120871544, -0.01640935428440571, 0.0386916883289814, 0.01625671237707138, 0.0012467547785490751, 0.04277634248137474, -0.05055394396185875, 0.06428468972444534, 0.00880428310483694, 0.03726858273148537, -0.03769802302122116, -0.011001242324709892, 0.03756801784038544, -0.014503509737551212, -0.005743504036217928, -0.006725475657731295, 0.05953725427389145, 0.06137698143720627, -0.011236977763473988, -0.012428873218595982, -0.006209305487573147, -0.006714880932122469, -0.008924593217670918, -0.0025231020990759134, -0.01487006340175867, -0.03917405381798744, -0.03566111996769905, 0.026849692687392235, -0.009601480327546597, -0.02065449208021164, -0.012259318493306637, -0.030431972816586494, 0.0204355139285326, 0.029260896146297455, 0.04815628379583359, 0.023286987096071243, -0.03733871132135391, -0.011022137477993965, -0.0383395180106163, -0.02330847829580307, -0.022007035091519356, -0.03154817968606949, -0.026513900607824326, -0.022683754563331604, 0.0038361449260264635, 0.0024696143809705973, 0.04731842502951622, 0.025013579055666924, 0.040783148258924484, 0.01957870088517666, 0.0208805613219738, -0.03847558796405792, -0.004907592665404081, 0.018848348408937454, 0.016136016696691513, 0.06414750218391418, 0.012884770520031452, -0.024062849581241608, 0.039441172033548355, 0.0075585488229990005, -0.01341510470956564, -0.04451332241296768, 0.011455831117928028, -0.015118912793695927, -0.003475240198895335, -0.021156005561351776, -0.020690415054559708, -0.024240579456090927, -0.0023907902650535107, 0.004777759779244661, 0.015698131173849106, -0.04440482333302498, 0.017920900136232376, 0.014348427765071392, 0.014436492696404457, 0.04129594564437866, 0.014143440872430801, 0.020584123209118843, -0.039871696382761, -0.010590637102723122, -0.007783106528222561, 0.039371710270643234, -0.0006817972753196955, -0.03972923755645752, -0.0083249406889081, 0.024867145344614983, -0.0038352226838469505, 0.02297375723719597, 0.04434654489159584, 0.04335778206586838, -0.04663899168372154, 0.013020056299865246, -0.013761748559772968, -0.01627960614860058, -0.01558367908000946, 0.029689274728298187, -0.014383724890649319, -0.046499986201524734, -0.010382070206105709, -0.027609100565314293, -0.022828953340649605, -0.02166203409433365, 0.012123296968638897, 0.017937449738383293, 0.053250666707754135, 0.019797567278146744, 0.019208889454603195, 0.004989705979824066, 0.04052266478538513, 0.016347501426935196, 0.018117493018507957, 0.014299659058451653, 0.005047916900366545, -0.015466991811990738, -0.026999283581972122, -0.020332112908363342, -0.011611046269536018, 0.009020759724080563, 0.05198243260383606, -0.040327612310647964, 0.024040237069129944, 0.010282628238201141, -0.0024292091839015484, -0.01232173666357994, 0.02446839027106762, -0.03792797774076462, -0.02480744756758213, 0.012457053177058697, 0.03174018859863281, 0.031788263469934464, -0.017134951427578926, 0.024548202753067017, 0.05872467905282974, 0.032735563814640045, 0.06306636333465576, 0.014962437562644482, -0.001646004500798881, 0.009084297344088554, 0.03274913132190704, 0.0642228052020073, 0.008886103518307209, -0.018183575943112373, -0.008396727032959461, -0.002194053027778864, 0.07022447139024734, -0.006354405544698238, 0.015096873044967651, 0.05360756069421768, -0.005556343588978052, -0.03187982738018036, -0.036314062774181366, -0.025821344926953316, -0.012256378307938576, -0.005350340623408556, 0.043274637311697006, 0.00006658474740106612, 0.0020253306720405817, -0.023737609386444092, 0.06871742010116577, 0.06768454611301422, 0.04972533881664276, 0.006524782162159681, 0.009413550607860088, -0.01760941743850708, 0.01399365346878767, 0.014048995450139046, 0.03677355870604515, 0.014894855208694935, -0.007479180581867695, 0.000052770723414141685, 0.020480705425143242, 0.005327567923814058, 0.03718870133161545, 0.021601276472210884, 0.02704373002052307, -0.036766450852155685, 0.04482487589120865, 0.020008184015750885, 0.014677135273814201, -0.0017033517360687256, -0.061709657311439514, 0.006170373409986496, 0.003564785700291395, 0.010898427106440067, -0.022763390094041824, 0.02213750034570694, -0.012631185352802277, 0.02763938531279564, -0.03651411086320877, -0.01845887303352356, 0.011190298944711685, -0.05193782597780228, -0.02969667874276638, 0.00836275052279234, 0.02121700346469879, 0.028474383056163788, -0.0330485962331295, -0.029805034399032593, -0.024196119979023933, 0.023334190249443054, 0.027597717940807343, 0.04159910976886749, -0.0019577571656554937, 0.010157119482755661, 0.03152569383382797, 0.0014123943401500583, 0.035729750990867615, 0.03528135269880295, 0.035054005682468414, -0.021420789882540703, -0.01404254138469696, 0.0051985313184559345, -0.025875983759760857, -0.08559133857488632, 0.05716691166162491, -0.036977797746658325, 0.022432565689086914, 0.00503007136285305, 0.04085124656558037, 0.033019937574863434, 0.0018099782755598426, -0.019920650869607925, -0.015192174352705479, 0.02415299415588379, 0.003389414632692933, -0.022705741226673126, 0.05598323419690132, 0.009979913011193275, -0.0223543643951416, 0.010128766298294067, -0.03991629183292389, -0.0058450158685445786, -0.010950788855552673, -0.010033915750682354, -0.012382004410028458, 0.017515787854790688, -0.0050134011544287205, 0.026295984163880348, 0.04056258499622345, 0.02769784815609455, 0.034225814044475555, 0.006938088685274124, -0.009720313362777233, -0.005400985945016146, 0.0076535907573997974, -0.014894110150635242, 0.013310213573276997, 0.056535329669713974, -0.015047946944832802, -0.0681382417678833, -0.019678853452205658, -0.015027337707579136, -0.04693318530917168, 0.03696664795279503, -0.051487524062395096, 0.025419607758522034, -0.011418722569942474, -0.0054538194090127945, -0.0432608462870121, 0.033714279532432556, 0.05269560590386391, 0.02540169470012188, 0.015966219827532768, -0.027971109375357628, -0.05092955753207207, 0.01522480882704258, -0.003423150395974517, 0.0140735674649477, 0.05811190605163574, 0.005331994500011206, -0.019902272149920464, -0.01890319027006626, 0.045900844037532806, 0.018456175923347473, -0.0009185540839098394, -0.012887767516076565, 0.01460974756628275, 0.03609316796064377, -0.03727935999631882, 0.04416041076183319, 0.03715302422642708, -0.02575494721531868, -0.009573545306921005, -0.012512617744505405, -0.0013377019204199314, -0.013795138336718082, 0.014725903980433941, -0.04156250134110451, 0.0393960066139698, -0.020798711106181145, -0.0019705116283148527, 0.011499440297484398, -0.03471309319138527, -0.002103680046275258, -0.014732744544744492, -0.03964918851852417, -0.0006534385029226542, -0.03799239173531532, -0.0047086854465305805, -0.0279703289270401, -0.016920777037739754, 0.0584380067884922, -0.02109691873192787, 0.012837059795856476, 0.03248303011059761, 0.013034507632255554, 0.012849909253418446, 0.02773585543036461, -0.0356769822537899, -0.03561735525727272, 0.031736329197883606, 0.06822293251752853, 0.026252208277583122, 0.02041415497660637, 0.03901992738246918, -0.02409530244767666, -0.011646561324596405, 0.025993140414357185 ]
Introducing 🤗 Accelerate
sgugger
April 16, 2021
accelerate-library
guide
https://huggingface.co/blog/accelerate-library
Easy integration! Let's first have a look at an example: diff import torch import torch.nn.functional as F from datasets import load_dataset + from accelerate import Accelerator + accelerator = Accelerator() - device = 'cpu' + device = accelerator.device model = torch.nn.Transformer().to(device) optim = torch.optim.Adam(model.parameters()) dataset = load_dataset('my_dataset') data = torch.utils.data.DataLoader(dataset, shuffle=True) + model, optim, data = accelerator.prepare(model, optim, data) model.train() for epoch in range(10): for source, targets in data: source = source.to(device) targets = targets.to(device) optimizer.zero_grad() output = model(source) loss = F.cross_entropy(output, targets) - loss.backward() + accelerator.backward(loss) optimizer.step() By just adding five lines of code to any standard PyTorch training script, you can now run said script on any kind of distributed setting, as well as with or without mixed precision. 🤗 Accelerate even handles the device placement for you, so you can simplify the training loop above even further: diff import torch import torch.nn.functional as F from datasets import load_dataset + from accelerate import Accelerator + accelerator = Accelerator() - device = 'cpu' - model = torch.nn.Transformer().to(device) + model = torch.nn.Transformer() optim = torch.optim.Adam(model.parameters()) dataset = load_dataset('my_dataset') data = torch.utils.data.DataLoader(dataset, shuffle=True) + model, optim, data = accelerator.prepare(model, optim, data) model.train() for epoch in range(10): for source, targets in data: - source = source.to(device) - targets = targets.to(device) optimizer.zero_grad() output = model(source) loss = F.cross_entropy(output, targets) - loss.backward() + accelerator.backward(loss) optimizer.step() In contrast, here are the changes needed to have this code run with distributed training are the followings: diff + import os import torch import torch.nn.functional as F from datasets import load_dataset + from torch.utils.data import DistributedSampler + from torch.nn.parallel import DistributedDataParallel + local_rank = int(os.environ.get("LOCAL_RANK", -1)) - device = 'cpu' + device = device = torch.device("cuda", local_rank) model = torch.nn.Transformer().to(device) + model = DistributedDataParallel(model) optim = torch.optim.Adam(model.parameters()) dataset = load_dataset('my_dataset') + sampler = DistributedSampler(dataset) - data = torch.utils.data.DataLoader(dataset, shuffle=True) + data = torch.utils.data.DataLoader(dataset, sampler=sampler) model.train() for epoch in range(10): + sampler.set_epoch(epoch) for source, targets in data: source = source.to(device) targets = targets.to(device) optimizer.zero_grad() output = model(source) loss = F.cross_entropy(output, targets) loss.backward() optimizer.step() These changes will make your training script work for multiple GPUs, but your script will then stop working on CPU or one GPU (unless you start adding if statements everywhere). Even more annoying, if you wanted to test your script on TPUs you would need to change different lines of codes. Same for mixed precision training. The promise of 🤗 Accelerate is: - to keep the changes to your training loop to the bare minimum so you have to learn as little as possible. - to have the same functions work for any distributed setup, so only have to learn one API.
[ 0.018021998926997185, 0.012587187811732292, -0.02040635235607624, 0.013200098648667336, 0.04222700372338295, 0.05559871345758438, 0.0012931878445670009, -0.04864268749952316, -0.05594329908490181, -0.0779031291604042, -0.09324484318494797, 0.028380483388900757, 0.014832205139100552, 0.07204882055521011, 0.01165488176047802, 0.0006952007533982396, 0.04832188040018082, -0.06584600359201431, 0.023466356098651886, 0.08932768553495407, 0.03521445393562317, -0.030028993263840675, -0.008285537362098694, 0.008592880330979824, -0.08268201351165771, -0.05636180192232132, -0.021048925817012787, 0.007909240201115608, -0.04804561659693718, 0.06207781657576561, -0.10786530375480652, -0.020069582387804985, 0.03153916075825691, -0.025921888649463654, 0.020129727199673653, 0.01151222363114357, -0.08238186687231064, 0.029751237481832504, 0.07485032826662064, -0.04621285945177078, 0.006643758621066809, -0.0310212392359972, -0.08171767741441727, 0.03128112480044365, 0.010538133792579174, -0.02057746611535549, -0.14244712889194489, 0.017133483663201332, -0.013568773865699768, -0.08324743807315826, -0.08237766474485397, 0.03720758482813835, -0.036049358546733856, -0.014246305450797081, -0.03137591853737831, 0.054981932044029236, 0.006669150665402412, -0.03327127918601036, 0.012745054438710213, 0.02122441492974758, 0.024539660662412643, 0.07203739881515503, 0.028197510167956352, 0.0302604828029871, 0.05571860447525978, 0.032649505883455276, -0.009608492255210876, 0.047581810504198074, -0.07215337455272675, -0.04143986850976944, 0.03364190831780434, -0.04571046680212021, -0.026920629665255547, -0.02552848681807518, -0.011283664032816887, -0.06485488265752792, -0.027477437630295753, -0.07305847108364105, 0.10569096356630325, 0.04553010314702988, -0.013619566336274147, -0.020435383543372154, 0.03223850205540657, 0.0616452656686306, 0.07739109545946121, -0.01839202642440796, -0.008475317619740963, -0.04840764403343201, -0.003061111783608794, 0.037155698984861374, -0.007459407206624746, -0.06843826174736023, 0.019353149458765984, -0.0032025007531046867, 0.0630030408501625, 0.00014127735630609095, -0.03640377148985863, -0.020546916872262955, -0.009158269502222538, -0.015261813066899776, 0.010485167615115643, -0.06624601036310196, 0.018034104257822037, -0.018846742808818817, -0.003780137514695525, 0.08618766814470291, -0.04932459071278572, -0.11705926805734634, -0.04537034407258034, 0.012180053628981113, -0.10625999420881271, -0.006624516099691391, -0.020238135010004044, 0.048364005982875824, -0.03787554055452347, -0.054267991334199905, -0.006285033188760281, 0.02411963976919651, 0.013612193986773491, -0.051189739257097244, -0.008465231396257877, 0.05714986473321915, 0.06068078801035881, 0.05100543797016144, -0.026572950184345245, 0.08130230754613876, 0.03575039282441139, -0.0018111071549355984, 0.01489089336246252, -0.01735507883131504, -0.0003346656740177423, -0.008053497411310673, 0.08476734906435013, -0.026307405903935432, -0.015257676132023335, -0.056276239454746246, -0.037958934903144836, 0.008333689533174038, -0.010286085307598114, -0.005042435601353645, -0.029600363224744797, 0.02695741318166256, 0.030094536021351814, 0.009751476347446442, 0.015457354485988617, -0.045456644147634506, -0.047901928424835205, 0.03113703988492489, 0.022072717547416687, 0.06613656133413315, -0.07396186143159866, 0.07920663058757782, -0.023155605420470238, -0.041036155074834824, -0.025560462847352028, 0.0942889004945755, -0.058355722576379776, -0.03862527385354042, -0.07457693666219711, -0.030981862917542458, -0.013612690381705761, 0.0006510615348815918, -0.03617766126990318, -0.03246116265654564, -0.05287010595202446, -0.02266324684023857, 0.02808455191552639, 0.012992099858820438, 0.01647420972585678, -0.00543774850666523, 0.0017293563578277826, -0.02460373565554619, 0.013426829129457474, -0.010158127173781395, -0.01155885774642229, 0.04376475140452385, -0.0016568639548495412, 0.11473456025123596, -0.011082538403570652, 0.014102263376116753, -0.04540889710187912, 0.06681103259325027, 0.003979843109846115, 0.04079814627766609, 0.03417615965008736, -0.06867959350347519, 0.019069397822022438, -0.0782233402132988, -0.0046114493161439896, 0.08946583420038223, -0.011725795455276966, 0.0056868488900363445, 0.07807732373476028, -0.0753476619720459, 0.026424294337630272, -0.11331366002559662, -0.03360966965556145, 0.10935866832733154, -0.01079084537923336, 0.03625044599175453, 0.03412739187479019, -0.04059635475277901, -0.017718615010380745, 0.00785067118704319, 0.03450001776218414, 0.011088541708886623, 0.006656574551016092, -0.04569688439369202, -0.019457997754216194, -0.02066352777183056, -0.0081870686262846, -0.10585010051727295, 0.03258342295885086, -0.0579930804669857, -0.01761842891573906, 0.049000103026628494, -0.041205994784832, 0.012422924861311913, 0.053948428481817245, 0.02981659024953842, 0.14536315202713013, -0.04392474144697189, 0.03519824147224426, -0.048248495906591415, -0.016461709514260292, 0.02102160081267357, 0.09837228804826736, 0.013098512776196003, 0.046949099749326706, -0.0733485296368599, -0.057263098657131195, -0.09212996065616608, -0.06040817126631737, 0.11424650996923447, 0.03196117654442787, -0.023307207971811295, -0.018576303496956825, 0.0425700880587101, 0.012249779887497425, -0.0364839993417263, 0.0270629171282053, 0.01217386033385992, -0.03672114014625549, 0.041240986436605453, 0.012473970651626587, -0.012412972748279572, 0.0661892220377922, -0.01839132234454155, 0.003565792925655842, -0.009710791520774364, -0.03943735361099243, -0.014605463482439518, 0.040468476712703705, -0.055304475128650665, 0.019713742658495903, 0.04105478152632713, -0.003485160181298852, -0.019463298842310905, -0.018325001001358032, 0.06338606774806976, 0.018134385347366333, 0.00246432819403708, -0.04771430417895317, -0.032974131405353546, -0.02063140459358692, -0.04874694347381592, 0.0051882038824260235, 0.007456018589437008, -0.0012722678948193789, -0.02382551319897175, 0.02276141569018364, 0.006140976212918758, 0.032195333391427994, 0.007841037586331367, 0.005588809959590435, 0.025378677994012833, 0.04358930140733719, -0.006842080503702164, -0.06149566173553467, -0.013994819484651089, -0.027287255972623825, -0.03443264961242676, 0.034995172172784805, 0.019766613841056824, -0.004970770329236984, 0.012085664086043835, 0.010608630254864693, 0.007101238705217838, -0.01788785494863987, 0.03827878087759018, 0.032763395458459854, 0.018120938912034035, 0.041976798325777054, -0.019245484843850136, 0.008224211633205414, 0.031475767493247986, -0.007481161970645189, -0.03735489398241043, -0.017967496067285538, 0.022208048030734062, -0.02383953332901001, 0.011768398806452751, -0.0016567419515922666, -0.018828673288226128, -0.025391239672899246, -0.026911871507763863, 0.012417575344443321, 0.03747914358973503, -0.09911223500967026, 0.020763710141181946, 0.017040692269802094, 0.020975952968001366, -0.00029476432246156037, -0.03689384460449219, 0.010921529494225979, -0.02167830616235733, -0.007179653272032738, 0.006021847017109394, 0.005780851002782583, 0.010285923257470131, 0.01938481628894806, 0.0011273996206000447, 0.0013990569859743118, -0.012972123920917511, 0.023771679028868675, -0.025923263281583786, 0.0005092914798296988, 0.045554615557193756, -0.02392960526049137, 0.03514551743865013, 0.0007673186482861638, -0.0024809117894619703, -0.03748536854982376, 0.01929527521133423, 0.04789980500936508, -0.009363465011119843, -0.03642118722200394, -0.031048335134983063, -0.014446757733821869, 0.006263915915042162, -0.041960541158914566, 0.0049415333196520805, 0.002252029487863183, 0.008173574693500996, -0.011757604777812958, -0.015219755470752716, 0.025243327021598816, 0.00473439134657383, 0.017359253019094467, 0.012700160965323448, 0.030474456027150154, -0.02397710643708706, 0.038827214390039444, -0.030312784016132355, -0.03571048378944397, -0.01123567670583725, 0.04917556419968605, -0.05146827548742294, -0.003171976888552308, -0.008890405297279358, 0.03229900449514389, 0.020038291811943054, -0.01965455338358879, -0.018569251522421837, -0.020382244139909744, 0.05657265707850456, 0.06706289947032928, 0.004880442749708891, -0.01290187519043684, 0.006664603017270565, 0.05356023833155632, -0.03569856658577919, -0.016494497656822205, 0.015529987402260303, 0.009241767227649689, -0.0413578525185585, -0.0264308899641037, 0.03775820508599281, -0.02520451322197914, 0.040920086205005646, -0.011464424431324005, 0.005845146719366312, -0.05440175533294678, 0.03421139717102051, -0.024838941171765327, -0.01609836518764496, 0.04026317223906517, 0.03579256311058998, -0.04429195821285248, -0.05566393584012985, -0.005655620247125626, -0.04080091416835785, -0.0012740610400214791, 0.01694837026298046, 0.006510643288493156, -0.04716638848185539, 0.042749181389808655, -0.0015328334411606193, -0.011168605647981167, -0.0027658650651574135, 0.025084976106882095, -0.031091365963220596, -0.03017868846654892, 0.006921909283846617, 0.003413444384932518, 0.045783691108226776, -0.014465530402958393, 0.006904706358909607, -0.0012345027644187212, -0.06814194470643997, 0.0002873145858757198, 0.02225474826991558, -0.014457181096076965, 0.017697397619485855, -0.00401297677308321, -0.020460927858948708, 0.008109556511044502, -0.016458461061120033, 0.00696921069175005, 0.012126590125262737, -0.002879595849663019, -0.03311055898666382, 0.04734969139099121, 0.04995449259877205, -0.0027530179359018803, -0.02115079015493393, -0.032263338565826416, 0.0005602666642516851, -0.03866613283753395, 0.03526212275028229, -0.018871113657951355, -0.0376105010509491, 0.037592120468616486, -0.01827838644385338, 0.055569421499967575, 0.00706513924524188, 0.024849532172083855, -0.03374360501766205, -0.05562281608581543, -0.00794199388474226, -0.000999529380351305, 0.027961676940321922, -0.028442060574889183, 0.006274187471717596, 0.01319943182170391, 0.05764556676149368, -0.002778401831164956, -0.03298719599843025, -0.023827306926250458, 0.009523756802082062, 0.01141489390283823, -0.03866074979305267, 0.0006345752626657486, 0.043564874678850174, -0.026920508593320847, 0.038341034203767776, -0.04517549276351929, 0.03529369458556175, 0.028339408338069916, 0.0204431414604187, -0.051966581493616104, -0.008132072165608406, 0.03276871517300606, -0.0018941248999908566, 0.026909122243523598, 0.02087067998945713, 0.029858287423849106, 0.01983056403696537, -0.01973380520939827, 0.003177716163918376, -0.03042464330792427, 0.02836184948682785, 0.01616651378571987, -0.006686234846711159, -0.0352892242372036, -0.04200103133916855, 0.007083035074174404, 0.0330488421022892, -0.024528974667191505, -0.024699388071894646, 0.008627103641629219, -0.030547454953193665, 0.0283594261854887, 0.048996973782777786, 0.008543564938008785, 0.03816376253962517, -0.024850968271493912, 0.016830479726195335, 0.027733078226447105, -0.0319027453660965, 0.012000556103885174, 0.00182311050593853, -0.028584279119968414, -0.023592893034219742, 0.01598110981285572, 0.015391182154417038, 0.05715223774313927, -0.009179823100566864, 0.004029714968055487, -0.027516022324562073, 0.017091054469347, -0.026528239250183105, 0.010699148289859295, -0.013939055614173412, -0.01218049693852663, 0.033483270555734634, -0.019724320620298386, -0.033654648810625076, 0.011512874625623226, 0.02593315578997135, 0.03530961275100708, -0.05569189041852951, 0.024740278720855713, 0.005267730914056301, -0.015019138343632221, -0.05292103812098503, 0.017757000401616096, -0.018506279215216637, 0.026382170617580414, -0.006261243484914303, 0.024291912093758583, 0.026678526774048805, 0.024739043787121773, 0.0017829745775088668, -0.029145630076527596, 0.027652224525809288, 0.027881231158971786, 0.012718199752271175, 0.0010067974217236042, -0.03931059688329697, -0.010263399221003056, 0.03706972301006317, 0.050520941615104675, -0.042071159929037094, 0.004413268994539976, 0.057146504521369934, 0.004813876003026962, 0.021678732708096504, 0.030971629545092583, 0.015175217762589455, -0.017427437007427216, 0.053647931665182114, 0.017788665369153023, -0.009217525832355022, -0.0009929565712809563, 0.051702797412872314, 0.02024555765092373, -0.030087647959589958, -0.041767094284296036, -0.007379361893981695, -0.0321783684194088, 0.04518607258796692, -0.03453855589032173, 0.006001364439725876, 0.06485933810472488, -0.005002674646675587, 0.035115696489810944, -0.006715359631925821, 0.014620729722082615, -0.016221582889556885, 0.00019251249614171684, -0.003972475882619619, 0.00788329727947712, 0.020374765619635582, 0.01625393144786358, -0.03612349182367325, 0.024151485413312912, 0.02318093366920948, 0.062186915427446365, -0.030177028849720955, -0.0008252942934632301, -0.020502224564552307, -0.008447819389402866, 0.015081868506968021, -0.011388751678168774, -0.009469044394791126, 0.006333983037620783, 0.002074148738756776, 0.023522429168224335, 0.06034870073199272, 0.016049835830926895, 0.08514375239610672, 0.025619320571422577, 0.006052711978554726, -0.015806840732693672, 0.07971228659152985, -0.0334816500544548, 0.022615574300289154, 0.020002685487270355, 0.08097642660140991, 0.0026518586091697216, -0.0024061978328973055, 0.003747720504179597, 0.007610163185745478, 0.05576290190219879, -0.000353856710717082, 0.025623861700296402, 0.06684485077857971, 0.04999907314777374, 0.004020018968731165, -0.017946938052773476, -0.015871739014983177, -0.0010876198066398501, 0.023876603692770004, 0.05515836924314499, 0.006213867571204901, 0.004423846490681171, -0.012237622402608395, 0.026773527264595032, 0.04638303071260452, 0.032875120639801025, -0.0035267951898276806, 0.02878856658935547, 0.017758354544639587, 0.032147035002708435, -0.015510017052292824, 0.03716690465807915, 0.020622622221708298, -0.014279250986874104, 0.029077308252453804, -0.010170303285121918, 0.02719956450164318, -0.030950041487812996, -0.006687256973236799, 0.042268987745046616, -0.008581804111599922, 0.018392570316791534, 0.01111751887947321, 0.014413094148039818, 0.0017101585399359465, -0.0261915884912014, -0.002278544707223773, -0.040149666368961334, 0.0166150089353323, -0.031071264296770096, 0.01740790158510208, -0.0032622774597257376, -0.0030376010108739138, -0.02259661629796028, 0.018487973138689995, 0.019616227596998215, -0.02053254283964634, -0.024730581790208817, 0.0029500892851501703, 0.017921753227710724, 0.032430559396743774, -0.017755188047885895, -0.0003378041728865355, -0.007065515499562025, -0.0010219913674518466, 0.02200951799750328, 0.0015041559236124158, -0.005903792101889849, 0.00044084052206017077, 0.01335306465625763, 0.009403068572282791, -0.0009693027241155505, 0.027547286823391914, 0.0031035488937050104, 0.00656970776617527, -0.018355898559093475, -0.020081669092178345, -0.010820710100233555, -0.014042706228792667, 0.08233901113271713, -0.005323281977325678, 0.018592989072203636, -0.008940979838371277, 0.050762053579092026, 0.017282435670495033, 0.004223495721817017, 0.0014177795965224504, -0.06064913794398308, -0.014215399511158466, -0.008595243096351624, -0.03011881187558174, -0.002898755017668009, 0.008413379080593586, -0.0062726386822760105, 0.02679307386279106, -0.029324760660529137, -0.010212465189397335, 0.010353023186326027, -0.05517592653632164, 0.028988048434257507, -0.0025007729418575764, 0.0283595472574234, -0.022076744586229324, 0.07440527528524399, 0.036022596061229706, 0.005782132036983967, 0.022551309317350388, -0.0027755890041589737, 0.017750369384884834, -0.007963172160089016, -0.0009305371204391122, -0.0018028740305453539, 0.06912750005722046, 0.01590467244386673, -0.03240448236465454, 0.0059922379441559315, -0.01247871108353138, -0.016106141731142998, 0.018272368237376213, -0.033699166029691696, 0.0023631008807569742, -0.0006523850024677813, -0.016327209770679474, -0.031453926116228104, -0.018939221277832985, 0.04882409796118736, 0.040334563702344894, 0.018526000902056694, 0.05971410125494003, -0.051413971930742264, 0.027668582275509834, -0.025999601930379868, 0.02328489162027836, 0.07046384364366531, 0.008880666457116604, -0.011095852591097355, -0.04345916956663132, 0.024860959500074387, 0.027133269235491753, -0.008813475258648396, -0.00971426721662283, 0.002537601860240102, 0.005846308544278145, -0.054257869720458984, 0.0011194932740181684, 0.007791723590344191, 0.002638980047777295, 0.017883172258734703, -0.04993344098329544, -0.02987818419933319, -0.013363849371671677, -0.015370182693004608, -0.03275403752923012, 0.021899545565247536, -0.04109518975019455, -0.038227275013923645, 0.02612302452325821, 0.03866368904709816, 0.06023826077580452, 0.0012696735793724656, -0.03541062772274017, -0.016182469204068184, -0.045089032500982285, 0.0014690394746139646, -0.07140707224607468, -0.023434704169631004, 0.05443880334496498, -0.022430507466197014, -0.0047433036379516125, -0.026742812246084213, 0.004769149236381054, -0.008303873240947723, 0.022093448787927628, -0.00420802365988493, 0.014965676702558994, 0.0025159036740660667, 0.019383719190955162, 0.0221723560243845, 0.07287664711475372, 0.027364226058125496, -0.03214295580983162, -0.013181710615754128, 0.0030885417945683002 ]
Introducing 🤗 Accelerate
sgugger
April 16, 2021
accelerate-library
guide
https://huggingface.co/blog/accelerate-library
DataLoader This is where most of the magic is hidden. As you have seen in the code example, the library does not rely on a DistributedSampler, it will actually work with any sampler you might pass to your dataloader (if you ever had to write a distributed version of your custom sampler, there is no more need for that!). The dataloader is wrapped in a container that will only grab the indices relevant to the current process in the sampler (or skip the batches for the other processes if you use an IterableDataset) and put the batches on the proper device. For this to work, Accelerate provides a utility function that will synchronize the random number generators on each of the processes run during distributed training. By default, it only synchronizes the generator of your sampler, so your data augmentation will be different on each process, but the random shuffling will be the same. You can of course use this utility to synchronize more RNGs if you need it. python accelerator.backward(loss) This last line adds the necessary steps for the backward pass (mostly for mixed precision but other integrations will require some custom behavior here).
[ 0.0916324332356453, -0.004661322571337223, -0.003597889095544815, 0.032036568969488144, 0.05355464294552803, 0.033850766718387604, -0.017791150137782097, -0.00883003231137991, -0.028519589453935623, -0.11474501341581345, -0.028326261788606644, -0.012880934402346611, -0.0005684977513737977, 0.08183004707098007, 0.010085074231028557, 0.021071532741189003, 0.05969084054231644, -0.091428741812706, 0.06748685985803604, 0.05851391330361366, 0.03064410388469696, -0.07517065852880478, 0.03232894465327263, 0.00015548954252153635, -0.09698773920536041, -0.00002437745570205152, 0.008513234555721283, 0.02904386632144451, -0.061409689486026764, -0.005793963558971882, -0.11463431268930435, 0.04090818762779236, 0.09085861593484879, -0.007290440611541271, 0.012379338964819908, -0.03231462091207504, -0.12227974086999893, 0.01528883632272482, 0.050176896154880524, -0.041294876486063004, -0.008683091029524803, 0.013763467781245708, -0.1059945598244667, 0.024860884994268417, -0.022801775485277176, -0.10019905865192413, -0.13276277482509613, 0.01119973137974739, -0.04576878622174263, -0.01512528583407402, -0.08677326142787933, 0.0640639215707779, -0.05832654610276222, 0.02290293760597706, 0.06624707579612732, -0.035945311188697815, 0.000497948145493865, -0.0351889505982399, 0.053465522825717926, 0.018047483637928963, 0.03110954537987709, 0.008578794077038765, 0.036416422575712204, 0.031417399644851685, 0.044689979404211044, 0.01577608473598957, 0.06941641867160797, 0.010232253931462765, 0.013051014393568039, -0.08500150591135025, 0.002912084572017193, -0.06617339700460434, -0.03705614432692528, 0.004146959632635117, 0.01592586375772953, -0.04495519399642944, -0.0024993293918669224, 0.01029509212821722, 0.05891051143407822, 0.04250621050596237, 0.01102783065289259, -0.024308139458298683, 0.046214599162340164, 0.04048389196395874, 0.07019072771072388, 0.003667414654046297, -0.011080379597842693, -0.06824339926242828, -0.005131648853421211, 0.015433012507855892, -0.004159472417086363, -0.07196943461894989, -0.015022506937384605, -0.007421580143272877, 0.026813505217432976, -0.047450609505176544, -0.01018113549798727, 0.008531061932444572, 0.032322198152542114, 0.032692763954401016, -0.04689453914761543, -0.10883779078722, -0.009531640447676182, -0.05278809741139412, 0.01608586125075817, 0.09406153857707977, -0.015015173703432083, -0.09224990010261536, -0.03394719958305359, 0.07270776480436325, -0.03876953944563866, 0.01076901238411665, -0.06227102875709534, 0.06204834580421448, -0.048582375049591064, -0.02779531478881836, 0.006620359141379595, 0.054888784885406494, -0.01477004773914814, -0.04410316050052643, -0.03448205441236496, 0.08973801881074905, -0.00033492970396764576, 0.027825331315398216, -0.029791736975312233, 0.11766264587640762, 0.02557767741382122, -0.032223522663116455, 0.0009020654833875597, 0.005398536566644907, 0.027177495881915092, 0.016325190663337708, 0.03483163192868233, -0.02348395623266697, -0.04083525761961937, -0.045078448951244354, -0.04113024100661278, 0.04602321609854698, 0.005159431137144566, 0.03597414493560791, -0.08214692771434784, 0.01879601739346981, -0.009673373773694038, -0.017734503373503685, -0.008899900130927563, -0.03974134102463722, -0.04557451978325844, -0.013333293609321117, -0.04646706581115723, 0.03193720802664757, -0.07374211400747299, 0.10697759687900543, -0.004043086431920528, -0.06105046719312668, 0.026332782581448555, 0.051562950015068054, -0.021819477900862694, -0.02365453541278839, -0.07139597088098526, 0.020894324406981468, -0.01935211755335331, -0.0073731206357479095, -0.00006201974611030892, -0.019152633845806122, -0.027721336111426353, 0.052679166197776794, 0.07027965784072876, 0.045246612280607224, -0.0048675076104700565, -0.008976082317531109, -0.004620547406375408, -0.02835213579237461, -0.0366721972823143, 0.012216261588037014, 0.03232433274388313, 0.054214052855968475, 0.02159188501536846, 0.0648023784160614, -0.02743973769247532, -0.01587425358593464, -0.05333064869046211, -0.005580642726272345, 0.0006923031760379672, 0.06437727063894272, -0.013978357426822186, -0.00563298724591732, 0.019030481576919556, -0.0575704500079155, 0.0008056029328145087, 0.07493657618761063, -0.03177827224135399, 0.013477155938744545, 0.048326220363378525, -0.05372381582856178, 0.02143549732863903, -0.09172069281339645, 0.01438521221280098, 0.08598188310861588, 0.0589185394346714, 0.02280450239777565, 0.017182260751724243, -0.031172366812825203, -0.059441570192575455, -0.024201225489377975, 0.01786569133400917, -0.02227458357810974, 0.014690934680402279, -0.09024258702993393, 0.0356542132794857, -0.0049421959556639194, -0.03040834702551365, -0.10344300419092178, -0.02806975319981575, -0.04895256087183952, 0.04733816161751747, 0.1058470606803894, -0.013820184394717216, -0.013617509976029396, 0.03517797589302063, 0.03953459486365318, 0.13849328458309174, -0.0791550725698471, 0.06375280767679214, 0.0024999850429594517, -0.040724463760852814, 0.08084183931350708, 0.05373663082718849, -0.01717621646821499, 0.03543312847614288, -0.05999782308936119, 0.020530611276626587, -0.07298590242862701, -0.05122199282050133, 0.07208540290594101, -0.02426235005259514, -0.018412521108984947, -0.026847634464502335, 0.0021714381873607635, -0.02113647572696209, -0.03804468736052513, 0.010980401188135147, 0.021705443039536476, -0.06548299640417099, 0.027197208255529404, -0.015483052469789982, -0.0021714759059250355, 0.051710691303014755, -0.043223943561315536, -0.08343725651502609, -0.019873498007655144, -0.016878150403499603, 0.0012847528560087085, -0.005640487652271986, -0.026616118848323822, 0.03731361776590347, 0.05066834017634392, -0.023090440779924393, -0.020661920309066772, 0.027516992762684822, 0.018341151997447014, 0.007856883108615875, -0.026782171800732613, -0.024729128926992416, -0.02063159830868244, -0.015611016191542149, -0.04954560101032257, 0.022693874314427376, 0.03649798780679703, 0.020579563453793526, 0.008201772347092628, 0.015617630444467068, -0.006983856204897165, 0.007780332118272781, 0.0073849353939294815, 0.007506007328629494, -0.0012549969833344221, 0.02971905656158924, 0.006983789149671793, -0.03317499905824661, 0.004150089342147112, -0.002548650838434696, -0.06034060940146446, 0.03740328550338745, 0.03188908100128174, 0.0008216918213292956, -0.00020664461771957576, 0.019020745530724525, 0.04244418814778328, -0.016812678426504135, 0.01004473865032196, 0.04066624864935875, 0.01926669292151928, 0.027373647317290306, -0.03320033848285675, -0.022631311789155006, 0.011491199024021626, 0.006084113381803036, -0.009046304039657116, 0.005711878649890423, -0.021184196695685387, -0.010579672642052174, 0.026705512776970863, 0.0016551907174289227, 0.0003450030926615, -0.05885428935289383, -0.024663157761096954, 0.003492761868983507, 0.036827318370342255, -0.09586414694786072, -0.015890730544924736, 0.024063002318143845, 0.0032127569429576397, -0.003503961255773902, -0.03870432823896408, 0.02724583074450493, -0.006253275088965893, 0.013149627484381199, -0.0032069641165435314, 0.0273186806589365, 0.011485354043543339, 0.011643585748970509, -0.04549555480480194, -0.02090393379330635, -0.03346313163638115, 0.041789114475250244, -0.006424994673579931, 0.0332108736038208, 0.012586685828864574, 0.009355788119137287, 0.02899901755154133, 0.011313213035464287, 0.004337592516094446, -0.04557782784104347, 0.022048642858862877, 0.03847943991422653, -0.002005332615226507, -0.03075398877263069, -0.025153210386633873, -0.03519901633262634, -0.019112495705485344, -0.007109716068953276, -0.027933623641729355, -0.006668493617326021, 0.012240305542945862, -0.040214527398347855, -0.015252117067575455, 0.007310848217457533, -0.01775733008980751, 0.015397030860185623, 0.008055965416133404, 0.034426525235176086, -0.024386996403336525, 0.05058521404862404, -0.00571367098018527, -0.027933388948440552, -0.0063877045176923275, 0.06088652461767197, -0.045040618628263474, 0.014026024378836155, -0.05298599973320961, 0.008118820376694202, -0.019151022657752037, -0.010204429738223553, -0.01909589394927025, -0.008290493860840797, 0.06298035383224487, 0.05834413319826126, 0.011765170842409134, -0.0012003022711724043, 0.0002119949640473351, 0.029874958097934723, 0.005253802519291639, -0.026004765182733536, 0.01893453486263752, 0.04258627071976662, -0.01399983186274767, -0.03864268213510513, 0.003469708375632763, -0.015586172230541706, 0.049139656126499176, 0.015538710169494152, 0.008647986687719822, -0.013643553480505943, 0.021231120452284813, 0.0012056769337505102, -0.018794991075992584, 0.011439667083323002, 0.04520348459482193, -0.018697166815400124, -0.022623101249337196, -0.001987367169931531, -0.05939631164073944, 0.010183068923652172, -0.003794853575527668, -0.03546265512704849, -0.06490739434957504, 0.018224505707621574, 0.03213874623179436, 0.017438480630517006, -0.0357959009706974, 0.04333203285932541, -0.009470028802752495, -0.003955898806452751, 0.05871986970305443, 0.028852876275777817, 0.047905515879392624, -0.012945810332894325, 0.020095832645893097, 0.03236718848347664, -0.0291131641715765, -0.026457050815224648, -0.0010472869034856558, -0.006772397551685572, 0.01073022186756134, -0.038525041192770004, -0.013677689246833324, 0.015096533112227917, -0.04305281490087509, 0.03548387065529823, 0.01545511931180954, 0.003741552121937275, -0.0035731131210923195, 0.06942133605480194, 0.031204093247652054, -0.0004454148293007165, 0.009358108974993229, -0.02599107287824154, 0.01041953545063734, -0.03742733597755432, 0.04244173690676689, -0.014518870040774345, -0.003866136074066162, 0.00783495418727398, -0.013766666874289513, 0.013891130685806274, -0.03814775124192238, -0.017576269805431366, -0.07196863740682602, -0.02405463345348835, -0.01688750833272934, -0.014747712761163712, 0.009049179963767529, -0.032579172402620316, -0.006437122821807861, 0.010695647448301315, 0.03602921590209007, 0.023930905386805534, -0.042157817631959915, -0.01093711331486702, -0.00392657658085227, 0.052825503051280975, -0.000355529977241531, 0.027450086548924446, -0.006198493298143148, 0.010630949400365353, 0.02185671590268612, -0.05872541666030884, -0.0340176559984684, 0.025409936904907227, -0.001473614713177085, -0.036615196615457535, 0.025894038379192352, 0.04517596587538719, -0.03522874042391777, 0.00364540982991457, 0.03173685446381569, 0.003243459155783057, 0.0017921042162925005, 0.023939067497849464, 0.013148090802133083, -0.02422255091369152, 0.0004499421047512442, -0.020128559321165085, -0.0071769412606954575, -0.05038400739431381, -0.06907052546739578, -0.00841551087796688, 0.014277842827141285, -0.00007659608672838658, 0.014656291343271732, 0.008060146123170853, -0.005354215390980244, 0.010215125046670437, 0.021847641095519066, 0.009854616597294807, -0.019925769418478012, -0.046723105013370514, 0.02244236133992672, -0.04153163358569145, -0.021514832973480225, 0.014403061009943485, -0.019336335361003876, 0.0005100991693325341, 0.03458252549171448, 0.032260287553071976, 0.022810114547610283, 0.0037975271698087454, 0.027708353474736214, 0.006415704730898142, 0.0021212222054600716, 0.013303669169545174, -0.03444577381014824, 0.05222735181450844, -0.03758919984102249, -0.019378406926989555, 0.039567023515701294, -0.04590221494436264, -0.04405616223812103, 0.013197326101362705, 0.01788184978067875, 0.005230496171861887, -0.023903291672468185, -0.010710693895816803, 0.011152257211506367, -0.00382442120462656, -0.0063157151453197, 0.014136326499283314, 0.001786774955689907, 0.002911078277975321, -0.024247219786047935, -0.036150019615888596, 0.005437805317342281, -0.0032830918207764626, -0.006666997447609901, -0.025685526430606842, 0.006719280034303665, 0.02935999073088169, 0.048972129821777344, -0.04259420186281204, 0.014288454316556454, -0.031843170523643494, 0.030167872086167336, 0.02137749269604683, -0.040339212864637375, -0.008497023954987526, -0.007562493905425072, 0.01391300093382597, 0.07503702491521835, 0.02376779541373253, 0.011283879168331623, -0.03784008324146271, -0.021464237943291664, -0.006913003511726856, -0.028953947126865387, 0.008703908883035183, 0.06676610559225082, 0.006804680451750755, -0.022043440490961075, -0.009329959750175476, -0.008669535629451275, -0.024426231160759926, 0.043203823268413544, -0.016818992793560028, -0.022654946893453598, 0.048439253121614456, -0.011905873194336891, 0.015092290937900543, -0.03951388597488403, 0.009140610694885254, -0.0071693239733576775, 0.026155391708016396, 0.04932572692632675, 0.008000767789781094, -0.0030157133005559444, -0.023885339498519897, -0.0308411605656147, 0.019568445160984993, 0.00013023566862102598, 0.007943827658891678, -0.021684013307094574, 0.03309742733836174, -0.00036747194826602936, -0.013006255961954594, 0.03314676135778427, 0.012246799655258656, -0.04434889182448387, 0.016897626221179962, -0.040972694754600525, 0.0057186344638466835, 0.0587829127907753, -0.011377662420272827, -0.02057509310543537, 0.008105949498713017, 0.00518794683739543, 0.012464848347008228, 0.0565999373793602, -0.01073361374437809, 0.024705100804567337, 0.018311219289898872, 0.06328443437814713, 0.050178490579128265, -0.019254960119724274, 0.012013477273285389, 0.021181736141443253, 0.03465377539396286, 0.010829607956111431, 0.05917685106396675, 0.027378764003515244, -0.00792772602289915, 0.0007297104457393289, 0.009931451641023159, 0.006958128418773413, 0.005698621738702059, 0.032064612954854965, 0.060616523027420044, 0.025692302733659744, 0.03441452234983444, -0.025867192074656487, 0.01883138343691826, 0.04540547356009483, 0.04492359608411789, -0.010008609853684902, -0.01129980105906725, 0.02834625169634819, 0.03243379667401314, 0.002855238039046526, 0.03315629065036774, 0.016068805009126663, -0.0012812247732654214, 0.02000345103442669, 0.01694670133292675, -0.0026864279061555862, 0.011348623782396317, -0.027407895773649216, 0.02864561602473259, -0.005459481384605169, 0.005153241101652384, -0.007099386770278215, 0.01840050145983696, -0.0059266770258545876, -0.005642879754304886, -0.01415289007127285, -0.046010296791791916, 0.03370288386940956, -0.02160501293838024, 0.013087227940559387, 0.001901996205560863, 0.012417352758347988, 0.005531031172722578, 0.053455136716365814, 0.0288082305341959, -0.03157150000333786, -0.0022826222702860832, -0.00416576350107789, -0.005037963856011629, 0.004891690332442522, -0.044599659740924835, -0.012845460325479507, -0.02352341078221798, 0.03930829092860222, 0.03115527704358101, 0.03347330167889595, 0.010958823375403881, -0.02441096492111683, 0.045899562537670135, -0.015231112949550152, 0.003707514377310872, 0.019457023590803146, -0.014945491217076778, -0.0005338771734386683, -0.034342411905527115, 0.008232355117797852, 0.010663037188351154, -0.020742906257510185, 0.05252853408455849, 0.0040076798759400845, 0.03358662500977516, -0.028158359229564667, 0.017601558938622475, 0.0260750874876976, -0.0005732660065405071, 0.007686793804168701, -0.042647432535886765, 0.006868950556963682, 0.002100807847455144, -0.0464128814637661, 0.025088675320148468, 0.01788466051220894, -0.013506913557648659, -0.022407639771699905, -0.021563861519098282, 0.020916370674967766, 0.02553195133805275, 0.00983689446002245, 0.026416320353746414, 0.005173999350517988, 0.027561860159039497, 0.009121823124587536, 0.07166904211044312, 0.0019762327428907156, 0.05704231932759285, 0.04636165872216225, 0.02993674762547016, -0.017761262133717537, -0.036108970642089844, 0.005729936994612217, -0.02853773906826973, 0.048652373254299164, -0.009060441516339779, -0.057884424924850464, -0.003736073849722743, -0.029314497485756874, -0.029224781319499016, 0.03376134857535362, -0.013447212986648083, 0.009506821632385254, 0.023732861503958702, 0.02364935353398323, -0.042183879762887955, -0.02523515559732914, 0.07813325524330139, 0.0048758345656096935, 0.006297364365309477, 0.03989580646157265, -0.05756988003849983, 0.024799689650535583, -0.01891680434346199, 0.0649891272187233, 0.07479334622621536, -0.02182990126311779, -0.009037709794938564, 0.00692632794380188, 0.024229733273386955, 0.008372251875698566, -0.01837736926972866, -0.009925332851707935, -0.006275990046560764, -0.0005840571247972548, -0.04941964149475098, 0.0062694544903934, 0.042907197028398514, 0.0016366898780688643, 0.03274630755186081, -0.003250210080295801, 0.015807928517460823, 0.0072052315808832645, 0.05059408023953438, -0.05722436308860779, -0.013279229402542114, -0.04536022990942001, -0.02577926404774189, -0.018402185291051865, -0.016672590747475624, 0.024391265586018562, 0.01133005041629076, -0.025969834998250008, 0.035541824996471405, 0.020556824281811714, 0.02254588156938553, -0.062281109392642975, -0.01649545505642891, 0.02838240936398506, -0.008728168904781342, -0.04917621985077858, -0.004838574677705765, 0.024211227893829346, -0.009886076673865318, 0.025907156988978386, -0.012277623638510704, 0.028457704931497574, -0.004806638695299625, 0.020076122134923935, 0.037513021379709244, 0.08521440625190735, 0.02752690017223358, 0.006346089765429497, -0.03639759123325348, 0.022427475079894066 ]
Introducing 🤗 Accelerate
sgugger
April 16, 2021
accelerate-library
guide
https://huggingface.co/blog/accelerate-library
What about evaluation? Evaluation can either be run normally on all processes, or if you just want it to run on the main process, you can use the handy test: python if accelerator.is_main_process(): # Evaluation loop But you can also very easily run a distributed evaluation using Accelerate, here is what you would need to add to your evaluation loop: diff + eval_dataloader = accelerator.prepare(eval_dataloader) predictions, labels = [], [] for source, targets in eval_dataloader: with torch.no_grad(): output = model(source) - predictions.append(output.cpu().numpy()) - labels.append(targets.cpu().numpy()) + predictions.append(accelerator.gather(output).cpu().numpy()) + labels.append(accelerator.gather(targets).cpu().numpy()) predictions = np.concatenate(predictions) labels = np.concatenate(labels) + predictions = predictions[:len(eval_dataloader.dataset)] + labels = label[:len(eval_dataloader.dataset)] metric_compute(predictions, labels) Like for the training, you need to add one line to prepare your evaluation dataloader. Then you can just use accelerator.gather to gather across processes the tensors of predictions and labels. The last line to add truncates the predictions and labels to the number of examples in your dataset because the prepared evaluation dataloader will return a few more elements to make sure batches all have the same size on each process.
[ 0.051400844007730484, 0.015921827405691147, -0.01000420656055212, -0.03593960404396057, -0.016165517270565033, 0.008165395818650723, 0.03429233655333519, -0.06286895275115967, -0.04781687259674072, -0.06249336153268814, -0.061686497181653976, 0.06685936450958252, 0.02915864624083042, 0.0906243547797203, 0.00919303297996521, -0.04375147446990013, 0.05306702479720116, -0.05116252228617668, -0.03762422874569893, 0.08788982778787613, 0.013135031796991825, -0.053937479853630066, 0.004895622376352549, 0.056466978043317795, -0.10258279740810394, -0.03433988615870476, -0.0027143312618136406, 0.0266755148768425, -0.08109039068222046, 0.02748982422053814, -0.0945880189538002, 0.0219387449324131, 0.05406525358557701, 0.00024705741088837385, 0.01337138656526804, 0.05130797252058983, -0.045464612543582916, 0.06315362453460693, 0.06288257986307144, -0.06792952865362167, 0.017518458887934685, -0.016757046803832054, -0.10152982175350189, -0.003307690378278494, -0.009903181344270706, -0.059861890971660614, -0.1345643401145935, 0.022998668253421783, -0.01011931523680687, 0.010209321044385433, -0.0967242494225502, 0.06517971307039261, -0.01757078804075718, -0.00016464015061501414, -0.01641974225640297, 0.04884844645857811, 0.0017767178360372782, -0.03382352367043495, 0.0000807085816632025, 0.02638770081102848, 0.0017481878167018294, 0.04807398468255997, 0.0286801066249609, 0.05686653405427933, 0.05831465125083923, 0.01082765031605959, 0.03372669219970703, 0.05283742398023605, -0.06897521764039993, -0.04242962598800659, -0.02860584296286106, -0.03678711876273155, -0.05406741425395012, 0.0054221730679273605, 0.05947386100888252, -0.05996004864573479, -0.02285672537982464, -0.06730285286903381, 0.04368804395198822, 0.04136909916996956, 0.008995970711112022, 0.026426756754517555, -0.0011263263877481222, 0.036770157516002655, 0.07167291641235352, 0.041603222489356995, -0.0746060460805893, -0.10691957175731659, -0.02491898275911808, 0.018003197386860847, 0.0009854058735072613, -0.053839195519685745, 0.023956961929798126, 0.027753261849284172, 0.017946837469935417, -0.0003882175369653851, -0.004788088146597147, -0.03519883751869202, -0.0472932793200016, -0.009635931812226772, 0.014960512518882751, -0.10221274197101593, -0.02027098834514618, -0.006176745984703302, -0.03229299560189247, 0.04498615860939026, -0.04183545336127281, -0.09196251630783081, -0.08110462129116058, 0.004079279489815235, 0.004790309816598892, 0.023927150294184685, -0.08420512080192566, 0.023094655945897102, -0.036209769546985626, -0.0537681058049202, -0.023372523486614227, 0.07118159532546997, 0.011500295251607895, -0.02796941064298153, 0.06774673610925674, 0.05582140013575554, 0.07611759006977081, 0.006937536410987377, -0.04827697575092316, 0.0671924501657486, 0.0327465757727623, 0.018438924103975296, 0.02492019534111023, -0.02377980388700962, -0.03059176355600357, -0.013748505152761936, 0.05938209220767021, -0.019898392260074615, 0.019209474325180054, -0.05513836443424225, -0.022103285416960716, 0.034701406955718994, -0.0059166960418224335, 0.009953553788363934, -0.06045816093683243, 0.02430867590010166, -0.027409004047513008, 0.039498988538980484, -0.0038591912016272545, -0.016599776223301888, -0.05008314177393913, 0.013444822281599045, 0.01048553641885519, 0.03253358229994774, -0.09936176985502243, 0.10634180903434753, -0.033770520240068436, 0.0010630703764036298, 0.03245580568909645, 0.09610956162214279, -0.06519102305173874, -0.02788495272397995, -0.0710206925868988, 0.03472226858139038, -0.030426040291786194, -0.03487526252865791, -0.04178711026906967, -0.03947969898581505, -0.011386732570827007, 0.053568318486213684, 0.02678847499191761, -0.049678221344947815, 0.03575138375163078, -0.002340802690014243, 0.03551566228270531, -0.020729701966047287, 0.010244361124932766, 0.00006039028085069731, 0.026052121073007584, -0.0037451169919222593, -0.01107881125062704, 0.05878792703151703, 0.03587913140654564, 0.023536326363682747, -0.05700920149683952, 0.05314389243721962, -0.0526665560901165, 0.06796246767044067, 0.03963988646864891, -0.05929595232009888, 0.024275168776512146, -0.11552818864583969, -0.018635760992765427, 0.07436656951904297, -0.06645436584949493, 0.01470238994807005, 0.05840727686882019, -0.043980736285448074, 0.0185756366699934, -0.06422090530395508, -0.05034570395946503, 0.06655976176261902, -0.0020939516834914684, 0.040975168347358704, -0.0004348323855083436, -0.014897096902132034, 0.02772819995880127, -0.048431504517793655, 0.012283772230148315, 0.012977578677237034, 0.04462314397096634, -0.06217556074261665, 0.008573872037231922, 0.02400306798517704, -0.01072478387504816, -0.09439816325902939, -0.002668155822902918, -0.040078047662973404, -0.014040783978998661, 0.04403301328420639, -0.04577413573861122, 0.027850672602653503, 0.008546053431928158, 0.021574437618255615, 0.12468972057104111, -0.0766867846250534, 0.044940151274204254, -0.04953882098197937, -0.022217581048607826, 0.015313586220145226, 0.05393064767122269, 0.06928054243326187, -0.008930535055696964, -0.05933311954140663, 0.0029730384703725576, -0.060670316219329834, -0.0736365094780922, 0.11125322431325912, -0.023070788010954857, -0.012927691452205181, -0.013258291408419609, 0.04230979457497597, 0.03175177797675133, -0.07863899320363998, 0.0032262508757412434, 0.010640463791787624, -0.030451903119683266, 0.05048602074384689, -0.01032325904816389, 0.008329715579748154, 0.03855879604816437, -0.05005444213747978, 0.01023093517869711, -0.036287713795900345, -0.009769667871296406, 0.024752357974648476, 0.015101145021617413, -0.033651359379291534, 0.03866628184914589, -0.026318205520510674, -0.02700539492070675, 0.02121339738368988, -0.009739196859300137, 0.036875445395708084, 0.03911633789539337, 0.0029257277492433786, -0.021044012159109116, -0.0337526760995388, -0.0021290278527885675, -0.03165574371814728, 0.04546297341585159, -0.011910469271242619, -0.006775356363505125, -0.03658635541796684, 0.004980111960321665, -0.008403966203331947, 0.03205094113945961, -0.030505657196044922, 0.02414773404598236, 0.028226476162672043, 0.01154831051826477, 0.0010554060572758317, -0.0001291368098463863, -0.009532424621284008, -0.02974286489188671, -0.018051842227578163, -0.004337559454143047, 0.02495146542787552, -0.002265030751004815, 0.019927743822336197, 0.02925819531083107, 0.03333056718111038, -0.018890388309955597, 0.028425687924027443, 0.014271950349211693, 0.040491245687007904, 0.009655281901359558, -0.01961529813706875, 0.020131783559918404, 0.03600503131747246, -0.003766099689528346, -0.013295897282660007, 0.0024695354513823986, 0.006250172853469849, -0.04954344779253006, 0.0071947043761610985, -0.009948489256203175, -0.016572095453739166, -0.06443015486001968, 0.0044952682219445705, 0.009152727201581001, -0.016487207263708115, -0.08812735229730606, 0.02620917372405529, 0.01800519786775112, 0.012126254849135876, 0.015467382036149502, 0.0043543544597923756, 0.015534215606749058, -0.013459078036248684, 0.020465843379497528, 0.028870072215795517, -0.029430152848362923, -0.03130847215652466, 0.008864962495863438, 0.012259510345757008, 0.020691268146038055, -0.02112695388495922, 0.006626889109611511, -0.0019034947035834193, 0.010460782796144485, 0.02249717153608799, 0.015699539333581924, 0.03224503621459007, 0.0026833631563931704, 0.00656298128888011, -0.038646310567855835, 0.017972223460674286, 0.031074950471520424, 0.0210826825350523, 0.030737044289708138, -0.02715972624719143, -0.029682839289307594, -0.024258287623524666, -0.05027011036872864, -0.03228645771741867, -0.008897477760910988, 0.0012539159506559372, -0.02708332985639572, -0.03775689750909805, 0.0017208526842296124, 0.01261819712817669, 0.02142229862511158, 0.03955397009849548, 0.026175884529948235, -0.040805477648973465, 0.032014984637498856, -0.017679883167147636, 0.0052209896966814995, -0.03250198811292648, 0.047448597848415375, -0.04583977907896042, -0.006505421828478575, 0.009210605174303055, 0.007410808932036161, 0.015616025775671005, -0.036888349801301956, -0.018147345632314682, -0.024039244279265404, 0.05466984584927559, 0.058464717119932175, 0.00868590921163559, -0.022596275433897972, -0.004475864116102457, 0.02580742910504341, -0.0052938312292099, -0.04127896577119827, 0.010843362659215927, 0.018258968368172646, -0.0357775054872036, -0.03514295071363449, 0.03717420622706413, -0.012080010026693344, 0.03554355725646019, -0.03285130113363266, 0.00661621754989028, -0.04382169246673584, 0.05994774401187897, 0.005704652983695269, -0.0359373614192009, 0.032902445644140244, 0.005256191827356815, 0.002806465607136488, -0.05389650911092758, 0.013752029277384281, -0.07241689413785934, 0.022004414349794388, 0.03199172765016556, 0.034091681241989136, 0.0022992396261543036, 0.04063817486166954, -0.01087908074259758, -0.0048342011868953705, -0.020474836230278015, 0.02399435080587864, 0.0022489174734801054, -0.003979410044848919, -0.013097145594656467, 0.008027921430766582, 0.048946838825941086, -0.03483879938721657, -0.0109182707965374, -0.00029356250888668, -0.10283153504133224, 0.01825176551938057, 0.020601216703653336, -0.008346152491867542, 0.031611718237400055, -0.010575775057077408, -0.02685563452541828, 0.010436683893203735, -0.045760709792375565, -0.024462923407554626, 0.02842608094215393, 0.012721518985927105, 0.011049236170947552, 0.023941874504089355, 0.03676185384392738, 0.018622415140271187, 0.008575957268476486, -0.016958124935626984, 0.04075389727950096, -0.023552337661385536, 0.034790731966495514, 0.0001012467619148083, -0.021062113344669342, 0.02726227045059204, -0.009718422777950764, 0.02916429378092289, -0.018269630149006844, -0.0016025565564632416, -0.026961907744407654, -0.0749223455786705, 0.015264051035046577, 0.011343004181981087, 0.020547520369291306, -0.016078677028417587, -0.04082714393734932, -0.012592801824212074, 0.038993190973997116, 0.005805801600217819, 0.003299511969089508, -0.025240039452910423, 0.007910748943686485, 0.030161241069436073, -0.04477594420313835, 0.004407167434692383, 0.04187610372900963, -0.03746870905160904, 0.026543259620666504, -0.07271308451890945, 0.03479689732193947, 0.027040328830480576, 0.03177411109209061, -0.04308677464723587, 0.005888234358280897, 0.06264156848192215, -0.004878058098256588, 0.011350725777447224, 0.0204006377607584, 0.04485981538891792, 0.050429943948984146, -0.043161969631910324, -0.012124265544116497, -0.005386597942560911, -0.02649560570716858, -0.01229501236230135, -0.039327286183834076, -0.0318368524312973, -0.04577895626425743, 0.02865668013691902, 0.0008624776965007186, -0.04714493453502655, 0.035255201160907745, -0.031367961317300797, -0.02529599331319332, 0.06045977771282196, 0.024320296943187714, 0.023026153445243835, 0.030096059665083885, -0.02257363311946392, 0.009338557720184326, 0.01598075032234192, -0.008959530852735043, 0.014319874346256256, -0.02896551974117756, -0.029090410098433495, 0.01675441861152649, 0.025122107937932014, 0.015370325185358524, 0.02926722727715969, 0.02845323085784912, 0.025926828384399414, -0.025361156091094017, 0.018690058961510658, -0.02605212666094303, 0.05521164834499359, 0.018747039139270782, -0.02551083452999592, 0.03161049261689186, -0.05462009832262993, -0.04007488861680031, -0.010773492977023125, 0.009173865430057049, 0.02375706098973751, -0.059052661061286926, 0.04187615588307381, -0.013706794939935207, -0.028730249032378197, -0.034485917538404465, 0.0291444044560194, -0.017559239640831947, -0.012961635366082191, -0.009407195262610912, -0.02600618079304695, 0.039605796337127686, 0.026600530371069908, 0.007191635202616453, -0.006380729842931032, 0.04863336682319641, -0.0021903382148593664, 0.004361825995147228, -0.03483567759394646, -0.010387761518359184, -0.0065031955018639565, 0.027333490550518036, 0.03934315964579582, -0.0470365472137928, -0.025377830490469933, 0.038427915424108505, 0.032026782631874084, 0.04125406593084335, 0.017710920423269272, 0.017127199098467827, -0.008675016462802887, 0.021753106266260147, 0.030490819364786148, 0.007563912309706211, -0.02543582208454609, 0.07206351310014725, 0.022094767540693283, -0.05365517735481262, -0.014089575037360191, -0.013921277597546577, -0.033787552267313004, 0.04617536440491676, 0.000476703280583024, 0.03310229629278183, 0.03805622458457947, 0.013160182163119316, 0.014677772298455238, -0.022101255133748055, 0.019746799021959305, 0.012395985424518585, -0.025279423221945763, -0.039350882172584534, 0.018557388335466385, -0.001397332875058055, -0.02313542738556862, -0.024836743250489235, 0.030225124210119247, 0.026575380936264992, 0.07485783100128174, -0.01952078752219677, 0.003242180682718754, 0.0006867050542496145, -0.014044737443327904, 0.015095141716301441, 0.00022907365928404033, -0.020593702793121338, -0.021030673757195473, 0.009754247032105923, 0.025623152032494545, 0.04275789111852646, 0.019608791917562485, 0.05329965800046921, 0.047215450555086136, -0.020712118595838547, -0.0343484953045845, 0.04470597952604294, 0.001930326223373413, 0.023032668977975845, 0.012801432982087135, 0.06309299170970917, 0.005380305461585522, -0.004760360810905695, 0.03489651158452034, -0.023569727316498756, 0.06955007463693619, 0.02488996461033821, 0.01693703979253769, 0.047918785363435745, 0.04451515153050423, 0.005380550865083933, -0.0010924118105322123, -0.033643513917922974, 0.02532970905303955, -0.006820435635745525, 0.03469464182853699, 0.018493957817554474, -0.0008211677777580917, 0.01088057179003954, 0.013162987306714058, 0.06207595393061638, 0.00708504393696785, 0.0029545100405812263, 0.002222397830337286, 0.03256328031420708, 0.031072000041604042, 0.00025703987921588123, -0.009314296767115593, -0.007508325856178999, -0.018707895651459694, 0.022363552823662758, -0.00457016984000802, 0.0028537861071527004, -0.017349176108837128, -0.0029402903746813536, 0.012611395679414272, -0.014704897999763489, 0.0046756514348089695, 0.004913018550723791, -0.0027673663571476936, 0.00019490648992359638, -0.03314033895730972, 0.040826860815286636, -0.017871180549263954, 0.014931521378457546, -0.045549359172582626, 0.018473057076334953, -0.012923046015202999, 0.003422373905777931, -0.010195677168667316, 0.032713718712329865, 0.015323287807404995, -0.03785161301493645, 0.012880345806479454, 0.004028129857033491, 0.06042580306529999, 0.04843183606863022, -0.057808272540569305, 0.024180281907320023, -0.027529753744602203, 0.01770903915166855, 0.002904820255935192, 0.046285148710012436, -0.016465704888105392, 0.02244424819946289, 0.036047421395778656, 0.021194998174905777, 0.0015562275657430291, 0.03658389300107956, 0.039885424077510834, -0.021959297358989716, -0.0338909737765789, 0.014015006832778454, -0.005890305154025555, -0.04964197427034378, 0.03307656943798065, 0.01486052293330431, 0.018197763711214066, -0.004254776053130627, 0.02248111180961132, -0.0062826103530824184, -0.010778370313346386, 0.006560817360877991, -0.028159113600850105, 0.005679875612258911, -0.00226673879660666, -0.0337873250246048, -0.010205550119280815, -0.010124552994966507, 0.015173420310020447, 0.01199834980070591, -0.03984683379530907, -0.0025989345740526915, 0.024167967960238457, -0.015080515295267105, 0.030467327684164047, -0.013093901798129082, 0.02893514186143875, -0.0035593362990766764, 0.05516538769006729, 0.04358602687716484, 0.05226125940680504, 0.003454514080658555, -0.022169990465044975, 0.00896134227514267, -0.02086446061730385, 0.005077853798866272, -0.03114277310669422, 0.0027028978802263737, 0.005115627311170101, 0.000535120430868119, 0.018382258713245392, -0.0003057116991840303, -0.05430318042635918, 0.00807512179017067, -0.03555113077163696, 0.02351883426308632, -0.00012697589409071952, -0.028109585866332054, -0.04593212157487869, -0.03215601295232773, 0.08165187388658524, 0.060237228870391846, 0.03106108494102955, 0.020878976210951805, -0.08347528427839279, 0.019613027572631836, -0.030466528609395027, 0.04300098121166229, 0.03555610775947571, 0.018293777480721474, -0.02117347903549671, 0.03111388348042965, 0.04594738036394119, 0.029338829219341278, -0.025100350379943848, -0.001107909600250423, -0.019649041816592216, 0.012985504232347012, -0.041620884090662, 0.01673782989382744, 0.035368919372558594, -0.005482790060341358, 0.014743590727448463, -0.022641072049736977, -0.0213070809841156, 0.009169763885438442, 0.015586593188345432, -0.08855867385864258, -0.010310918092727661, -0.03361683338880539, -0.01986576057970524, -0.010019269771873951, 0.009817652404308319, 0.05737648904323578, 0.004299328662455082, 0.0016738618724048138, -0.03426013141870499, -0.037953585386276245, -0.018933329731225967, -0.04045387730002403, 0.00005904453792027198, 0.005404363851994276, 0.000089157787442673, -0.01789124496281147, 0.00360296037979424, 0.029130805283784866, -0.014851967804133892, 0.014374008402228355, -0.011651507578790188, 0.02059115469455719, 0.04450150579214096, 0.021127348765730858, 0.004798179492354393, 0.06892001628875732, 0.05378815904259682, -0.03194214403629303, -0.007874436676502228, 0.017327936366200447 ]
Introducing 🤗 Accelerate
sgugger
April 16, 2021
accelerate-library
guide
https://huggingface.co/blog/accelerate-library
How does it work? To see how the library works in practice, let's have a look at each line of code we need to add to a training loop. python accelerator = Accelerator() On top of giving the main object that you will use, this line will analyze from the environment the type of distributed training run and perform the necessary initialization. You can force a training on CPU or a mixed precision training by passing cpu=True or fp16=True to this init. Both of those options can also be set using the launcher for your script. python model, optim, data = accelerator.prepare(model, optim, data) This is the main bulk of the API and will prepare the three main type of objects: models (torch.nn.Module), optimizers (torch.optim.Optimizer) and dataloaders (torch.data.dataloader.DataLoader).
[ 0.0737164095044136, 0.02956761047244072, 0.015707427635788918, -0.0025879249442368746, 0.037819940596818924, 0.04601835086941719, -0.026716509833931923, 0.020754074677824974, -0.022364724427461624, -0.033754944801330566, -0.07473554462194443, 0.04081020876765251, -0.014492452144622803, 0.038383860141038895, 0.014617600478231907, -0.021079178899526596, 0.06467054784297943, -0.08964680135250092, -0.0701068639755249, 0.10859818756580353, 0.013695926405489445, -0.047118306159973145, 0.023141099140048027, 0.027412056922912598, -0.06061388924717903, -0.05603233724832535, 0.004899082239717245, 0.02792849950492382, -0.031875960528850555, -0.010961542837321758, -0.10944806039333344, -0.015810895711183548, 0.03735195845365524, -0.035928066819906235, 0.001390109769999981, 0.019823141396045685, -0.10147720575332642, 0.05378691852092743, 0.05023415386676788, -0.03757539018988609, 0.00782177597284317, 0.005604222416877747, -0.1053071916103363, 0.027763351798057556, -0.03854803368449211, -0.03693271055817604, -0.15868881344795227, 0.04430977255105972, 0.006535745225846767, -0.053218208253383636, -0.1368936002254486, 0.025793014094233513, -0.032947707921266556, 0.012896144762635231, -0.005046051926910877, 0.016188420355319977, 0.016325756907463074, 0.012133657932281494, 0.04238991439342499, 0.007019557058811188, 0.03832818567752838, 0.04985769838094711, 0.03179086744785309, 0.019399989396333694, 0.048269256949424744, -0.023909861221909523, -0.0019293335499241948, 0.0004905510577373207, -0.0032227931078523397, -0.0639135017991066, -0.03487765043973923, 0.001463895314373076, -0.03109549917280674, -0.013959001749753952, -0.025088155642151833, -0.07263102382421494, 0.01910710334777832, -0.0016560163348913193, 0.06681299954652786, 0.07809910923242569, -0.026889540255069733, 0.05707235261797905, -0.0017373677110299468, 0.0708962008357048, 0.0454384908080101, 0.006833186373114586, 0.001075060572475195, -0.03485465422272682, -0.01100020669400692, 0.01886100322008133, 0.020025281235575676, -0.0726502314209938, 0.03549104928970337, -0.0011142260627821088, 0.04479372501373291, -0.042840417474508286, 0.004658177029341459, 0.02316242642700672, -0.0032181499991565943, -0.003352147527039051, 0.028603514656424522, -0.06268155574798584, 0.005120077636092901, 0.0017296889564022422, -0.04057693853974342, 0.11772403866052628, -0.03875191882252693, -0.09003624320030212, -0.06948418915271759, 0.033969130367040634, -0.060980670154094696, -0.005223499611020088, -0.07689666002988815, 0.04248320311307907, -0.04995204508304596, -0.03161044791340828, 0.005832976195961237, 0.024754591286182404, -0.03144722059369087, -0.036333512514829636, -0.005452205426990986, 0.09197231382131577, 0.039742372930049896, 0.03435511142015457, -0.04613277688622475, 0.11411410570144653, 0.025302676483988762, 0.0038834000006318092, 0.0052230460569262505, -0.02053862437605858, 0.062129512429237366, 0.0034338152036070824, 0.08351060748100281, -0.01741611585021019, 0.02055196650326252, -0.020121565088629723, -0.048043347895145416, -0.047873321920633316, -0.03251419961452484, 0.012171820737421513, -0.04554906487464905, 0.03789509832859039, -0.018171990290284157, 0.0066510275937616825, 0.019687270745635033, -0.03142140805721283, -0.03717536851763725, 0.07564005255699158, -0.019952749833464622, 0.0764671042561531, -0.09483355283737183, 0.09633780270814896, -0.028445390984416008, -0.02526422217488289, 0.0021717834752053022, 0.07964462786912918, -0.058362022042274475, -0.037106141448020935, -0.07020621001720428, -0.028821444138884544, 0.0038894338067620993, -0.02796485275030136, -0.06070178747177124, -0.01615563966333866, 0.01337000634521246, 0.03832106664776802, 0.042396947741508484, 0.03131067380309105, 0.040552396327257156, -0.0005178677965886891, -0.056720513850450516, -0.018240705132484436, 0.05793163925409317, 0.029960084706544876, 0.01236126571893692, 0.018273308873176575, 0.03782883286476135, 0.08259987831115723, -0.0068589565344154835, 0.011660182848572731, -0.020990189164876938, 0.025949077680706978, -0.04798353463411331, 0.05668085440993309, 0.01795872300863266, -0.056926481425762177, 0.025887195020914078, -0.03445985168218613, -0.04321867600083351, 0.04093830659985542, 0.026411529630422592, 0.03138723596930504, 0.05372373014688492, -0.05550948157906532, 0.03954220563173294, -0.11206764727830887, -0.0281488299369812, 0.07925882935523987, -0.015530066564679146, 0.03861254081130028, 0.04145469889044762, -0.047660741955041885, -0.010826466605067253, -0.022973084822297096, -0.030654912814497948, -0.011572969146072865, 0.0211356058716774, -0.02928948402404785, 0.0461433082818985, 0.00007158261723816395, 0.009168380871415138, -0.09585770219564438, -0.03983175382018089, -0.07245410978794098, 0.03383216634392738, 0.061422161757946014, -0.024676837027072906, 0.02962019108235836, 0.013744938187301159, 0.034795280545949936, 0.15243983268737793, -0.06780173629522324, 0.03586454689502716, -0.028254667297005653, -0.060139063745737076, 0.04949365183711052, 0.060086388140916824, -0.0019607297144830227, 0.05331685021519661, -0.06620681285858154, 0.012708913534879684, -0.03808686509728432, -0.07843746244907379, 0.07734759896993637, -0.030215151607990265, -0.06006580591201782, 0.03122888319194317, 0.08909046649932861, 0.012297257781028748, -0.06268519908189774, 0.04297127574682236, 0.014636545442044735, -0.04159608855843544, 0.024161536246538162, 0.02498994953930378, 0.03721465915441513, 0.03819618374109268, -0.05736076831817627, -0.04173528403043747, -0.027991725131869316, -0.010566995479166508, 0.00991008523851633, -0.004076605662703514, -0.022775931283831596, 0.013719182461500168, 0.05373702570796013, 0.0010277562541887164, -0.029407324269413948, 0.03085527941584587, 0.03907420486211777, -0.002501840004697442, 0.015836039558053017, -0.062253184616565704, -0.025891665369272232, -0.0177772156894207, -0.05447874963283539, 0.028776021674275398, 0.0039384253323078156, 0.005486952606588602, -0.008565351366996765, -0.0028868955560028553, -0.019799772650003433, 0.020698988810181618, -0.016132736578583717, -0.004845890682190657, 0.04852881282567978, 0.009946437552571297, -0.02085549756884575, -0.04317547008395195, -0.03448714315891266, -0.024586262181401253, -0.02561008185148239, 0.03559418022632599, 0.04546724259853363, -0.00243217870593071, 0.0060368734411895275, 0.014136518351733685, 0.006121709942817688, -0.04323108494281769, 0.0509728342294693, -0.0266041848808527, 0.016211193054914474, 0.031670838594436646, 0.006901171524077654, 0.00039809016743674874, 0.03641977906227112, 0.016032928600907326, -0.004642110783606768, -0.03916337341070175, 0.0009016054682433605, -0.01640450954437256, -0.00007959891809150577, 0.009924309328198433, -0.012289904057979584, -0.06934922933578491, -0.006670501548796892, 0.019186103716492653, 0.018089812248945236, -0.09637674689292908, 0.017354071140289307, 0.022392624989151955, 0.025380879640579224, 0.019393116235733032, -0.017679855227470398, 0.00003205577013432048, 0.009319811128079891, 0.0070835379883646965, 0.008338212966918945, -0.01140415295958519, -0.010357655584812164, 0.006316992454230785, 0.014689412899315357, -0.0060821170918643475, 0.01536399032920599, 0.01107720285654068, 0.028940223157405853, 0.01462597493082285, 0.011531377211213112, -0.007307516876608133, 0.0230144914239645, -0.00905018299818039, 0.002453757915645838, -0.04343731328845024, 0.005165026057511568, 0.019150741398334503, 0.03144963085651398, -0.025922898203134537, -0.011473407037556171, -0.022507064044475555, -0.02131819725036621, -0.010559775866568089, -0.006076061632484198, -0.00015833869110792875, -0.0013682522112503648, 0.0066428398713469505, -0.01727977581322193, 0.004208521917462349, 0.01609017141163349, -0.017867350950837135, 0.0073886439204216, -0.00000758476426199195, -0.03202923759818077, 0.06389354914426804, 0.009475084953010082, -0.03850281611084938, -0.007937067188322544, 0.029911411926150322, -0.030157815665006638, -0.013780994340777397, -0.025322187691926956, -0.002642457839101553, 0.03655490651726723, -0.014435007236897945, -0.02565242350101471, -0.0032050623558461666, 0.06409298628568649, 0.05947839841246605, 0.02433280646800995, -0.0475081168115139, 0.009102179668843746, 0.03064781427383423, -0.006745872087776661, -0.028821924701333046, 0.011178062297403812, 0.034537121653556824, -0.023003265261650085, -0.009342556819319725, 0.0035931996535509825, -0.022799262776970863, 0.07370008528232574, 0.010418104007840157, 0.0033282642252743244, -0.046335455030202866, 0.01061961054801941, -0.011889475397765636, -0.02088831178843975, 0.05828256905078888, 0.05253520607948303, -0.0101590221747756, -0.03900083154439926, -0.010217584669589996, -0.060791704803705215, -0.010727809742093086, -0.0026719295419752598, 0.007814855314791203, -0.04009634256362915, 0.025632508099079132, 0.010708116926252842, 0.004016905557364225, -0.036174625158309937, 0.04122239351272583, 0.010583783499896526, -0.005516653414815664, 0.006260452326387167, 0.010599627159535885, 0.03895130380988121, 0.0005256014410406351, 0.02174370549619198, 0.004702998325228691, -0.05337042361497879, -0.030463380739092827, 0.011032290756702423, -0.005054268520325422, 0.0008758642361499369, -0.026876121759414673, -0.02329885959625244, 0.008030871860682964, -0.021502215415239334, -0.013349869288504124, -0.003758719889447093, 0.023698575794696808, 0.00512778852134943, 0.023962700739502907, 0.02002701908349991, -0.0016628843732178211, -0.029821835458278656, -0.002063262742012739, 0.003028984647244215, -0.06039184704422951, 0.06058891490101814, -0.017396055161952972, -0.05226849019527435, -0.014764274470508099, -0.014726996421813965, 0.015630293637514114, 0.01574845239520073, 0.02440563775599003, -0.035239823162555695, -0.04994715005159378, 0.00581676559522748, 0.010747604072093964, 0.004978163167834282, -0.043952230364084244, 0.003953475505113602, 0.0045789857394993305, 0.006338793784379959, 0.03798462450504303, -0.028758326545357704, -0.009167713113129139, 0.012468747794628143, 0.020348310470581055, -0.022794723510742188, 0.03566904738545418, 0.026976021006703377, -0.01937894895672798, -0.0012788043823093176, -0.05518331006169319, 0.011138265952467918, 0.024539140984416008, 0.030372824519872665, -0.03875639662146568, -0.026126425713300705, 0.04646749794483185, -0.015657715499401093, 0.016390131786465645, 0.032858699560165405, 0.013725382275879383, 0.05031660944223404, -0.011173201724886894, -0.0030996736604720354, -0.03449583053588867, 0.009838994592428207, 0.015174977481365204, -0.025817938148975372, -0.04064733162522316, -0.059065885841846466, 0.009064513258635998, 0.019631898030638695, 0.01604064367711544, -0.012165727093815804, -0.06646895408630371, -0.0320163257420063, 0.038249243050813675, 0.030188225209712982, 0.05134900286793709, 0.019536932930350304, -0.04117944464087486, 0.017426416277885437, 0.0023536423686891794, -0.010398462414741516, 0.014364161528646946, -0.008589498698711395, -0.01163626741617918, 0.01844869554042816, 0.03728713467717171, 0.01078406535089016, 0.04433373361825943, 0.042829181998968124, 0.0361018180847168, -0.014942217618227005, 0.04122605919837952, 0.005628734827041626, -0.005085178185254335, -0.016382886096835136, -0.02634245902299881, 0.04378455504775047, -0.02341662161052227, -0.035546962171792984, 0.01604175753891468, 0.015084121376276016, -0.007987488992512226, -0.04759369045495987, 0.03663712367415428, -0.013943818397819996, -0.018539387732744217, -0.044514864683151245, 0.02315937727689743, -0.02312685362994671, -0.005624597892165184, -0.015282579697668552, -0.009163705632090569, 0.038027193397283554, 0.005882193334400654, 0.01107084657996893, -0.008641297928988934, -0.0031692252960056067, 0.02705262042582035, 0.04371320828795433, -0.041307464241981506, 0.007573822047561407, -0.02062542364001274, 0.014306420460343361, 0.01229429803788662, -0.02857653796672821, 0.019490549340844154, 0.004891012795269489, 0.015734702348709106, 0.04604877904057503, 0.04824095964431763, 0.0007513747550547123, -0.029716214165091515, 0.017431890591979027, 0.024006212130188942, -0.03419386222958565, -0.006676500663161278, 0.03003660775721073, 0.01571168750524521, -0.01913345418870449, -0.026597606018185616, -0.03228515759110451, -0.0449846051633358, 0.028662845492362976, -0.028873682022094727, 0.0061339158564805984, 0.0473201759159565, -0.0015165925724431872, 0.029062896966934204, -0.02496655471622944, 0.036562249064445496, -0.0023496474605053663, -0.0010971579467877746, -0.01539880596101284, -0.019343815743923187, 0.012251059524714947, -0.006291180849075317, -0.016552448272705078, 0.03992543742060661, 0.017431631684303284, 0.0484076552093029, -0.01099623367190361, 0.007639977615326643, 0.015708647668361664, -0.003013459499925375, 0.04089531674981117, -0.0019059012411162257, -0.0279375109821558, 0.023745562881231308, 0.02549206279218197, -0.003814846044406295, 0.06690572202205658, 0.023562394082546234, 0.022141052410006523, 0.0007344766636379063, -0.04309713467955589, -0.030538350343704224, 0.08728796988725662, -0.02040627971291542, 0.02621864154934883, 0.0360780730843544, 0.06526205688714981, 0.021552924066781998, -0.0018877139082178473, 0.012749984860420227, 0.01673084683716297, 0.06915917992591858, 0.051657188683748245, 0.01945008523762226, 0.03898272290825844, 0.0012722439132630825, 0.010387667454779148, -0.0051758927293121815, -0.042613495141267776, -0.013715573586523533, -0.002549532800912857, 0.057754866778850555, -0.004071520175784826, -0.0024509949143975973, -0.045114416629076004, 0.008508614264428616, 0.06475133448839188, 0.03554736077785492, 0.003681028727442026, 0.022629788145422935, -0.024671992287039757, -0.010212430730462074, -0.00637088855728507, 0.02554805390536785, 0.0015711614396423101, -0.021308371797204018, 0.05282985046505928, 0.03438251465559006, 0.04943143576383591, 0.003617048729211092, -0.0035579134710133076, 0.05349621921777725, 0.00012197363685118034, 0.007050937972962856, -0.015523731708526611, 0.0004648314497899264, -0.012584972195327282, -0.022830722853541374, -0.004261208698153496, -0.05668129399418831, 0.013737117871642113, -0.05911562591791153, -0.02139398083090782, -0.011902845464646816, 0.002786925993859768, -0.005012828391045332, 0.02828124165534973, 0.016722602769732475, -0.027664709836244583, -0.0025129197165369987, 0.011696947738528252, -0.010074428282678127, 0.027148088440299034, -0.017750872299075127, 0.00855847168713808, -0.03955841064453125, 0.019282076507806778, 0.016599860042333603, 0.03627381846308708, 0.003039455506950617, 0.025708012282848358, 0.03114214539527893, -0.003316669026389718, -0.018911490216851234, 0.003615369787439704, 0.032702378928661346, 0.00601370120421052, -0.030634460970759392, -0.0070340982638299465, -0.003631365252658725, -0.03096616454422474, 0.0468151830136776, 0.009055033326148987, 0.03653411567211151, -0.004228648729622364, 0.038471587002277374, 0.002799409441649914, 0.033268436789512634, -0.017168382182717323, -0.060998037457466125, -0.018156355246901512, -0.04470274969935417, -0.04678047075867653, 0.04449842497706413, 0.016513090580701828, -0.031035831198096275, 0.01939387060701847, 0.0016353611135855317, -0.02319929003715515, -0.016456909477710724, 0.015249875374138355, 0.03057340532541275, -0.01859719678759575, 0.009570141322910786, 0.00569996377453208, 0.057797230780124664, 0.011263839900493622, 0.03573083132505417, 0.05899353325366974, 0.02581711672246456, 0.02271253801882267, -0.009724597446620464, 0.017093226313591003, -0.036928579211235046, 0.05928650498390198, -0.013023295439779758, -0.0349062941968441, -0.006987616885453463, 0.001721878768876195, -0.038092296570539474, -0.019733471795916557, -0.024576900526881218, -0.006066093221306801, -0.0056554460898041725, -0.01911664940416813, -0.014563244767487049, -0.0035378430038690567, 0.05959145352244377, 0.07785399258136749, 0.017246844246983528, 0.0321463905274868, -0.09322560578584671, -0.0017805758398026228, -0.018515322357416153, 0.027295351028442383, 0.08141468465328217, -0.0027793182525783777, -0.002345762215554714, -0.021864227950572968, 0.03012246824800968, 0.01926080510020256, -0.04412604495882988, -0.014316339045763016, -0.013937798328697681, -0.00820466224104166, -0.04986140877008438, 0.013950898312032223, 0.004338201135396957, 0.0058143832720816135, 0.028774479404091835, -0.026140393689274788, -0.015427809208631516, -0.008971262723207474, -0.02843509614467621, -0.059552788734436035, 0.0005079592810943723, -0.03969895839691162, -0.01424641814082861, 0.011895638890564442, -0.0026705418713390827, 0.04351583495736122, -0.00014763402577955276, -0.007125694304704666, -0.00029432395240291953, -0.019234545528888702, -0.02536444365978241, -0.06664818525314331, -0.04190472140908241, 0.05177120119333267, 0.0049590738490223885, -0.03360317647457123, 0.0035499592777341604, -0.004671374335885048, 0.018399953842163086, 0.028196079656481743, -0.028355911374092102, -0.003000193042680621, 0.011086728423833847, 0.011632189154624939, -0.01600959338247776, 0.06567015498876572, 0.03266433626413345, -0.030752219259738922, 0.002172540407627821, 0.01628011092543602 ]
Introducing 🤗 Accelerate
sgugger
April 16, 2021
accelerate-library
guide
https://huggingface.co/blog/accelerate-library
🤗 Accelerate Run your raw PyTorch training scripts on any kind of device. Most high-level libraries above PyTorch provide support for distributed training and mixed precision, but the abstraction they introduce require a user to learn a new API if they want to customize the underlying training loop. 🤗 Accelerate was created for PyTorch users who like to have full control over their training loops but are reluctant to write (and maintain) the boilerplate code needed to use distributed training (for multi-GPU on one or several nodes, TPUs, ...) or mixed precision training. Plans forward include support for fairscale, deepseed, AWS SageMaker specific data-parallelism and model parallelism. It provides two things: a simple and consistent API that abstracts that boilerplate code and a launcher command to easily run those scripts on various setups.
[ 0.08760847896337509, 0.01595374569296837, 0.021276619285345078, -0.015505288727581501, 0.00837401207536459, -0.010976358316838741, -0.0169223565608263, -0.01414505485445261, 0.004717550706118345, -0.07159096002578735, -0.07669784873723984, 0.00857090950012207, -0.002383679151535034, 0.03615866228938103, 0.06862830370664597, -0.027832619845867157, 0.028411302715539932, -0.07541777193546295, -0.07292906939983368, 0.07782800495624542, -0.01942410133779049, -0.0005749881966039538, -0.0031527248211205006, 0.009309971705079079, -0.06854914873838425, -0.009189942851662636, 0.006306250113993883, -0.005327588878571987, -0.016792159527540207, 0.029737627133727074, -0.06726379692554474, 0.018230898305773735, 0.003096640342846513, -0.03152497485280037, -0.009748161770403385, 0.03890148177742958, -0.05851981043815613, 0.05122113972902298, 0.029361411929130554, -0.038193851709365845, -0.04305335879325867, 0.00021928292699158192, -0.08083104342222214, 0.041473645716905594, 0.02275834232568741, 0.0028456314466893673, -0.09720346331596375, -0.003199227387085557, -0.05068863928318024, -0.044842515140771866, -0.11039387434720993, 0.09037807583808899, -0.0536624938249588, 0.00792735069990158, 0.05439313128590584, 0.0748237669467926, -0.02088172920048237, -0.05024365708231926, 0.03730849176645279, 0.03192460164427757, 0.01892029121518135, 0.0628432184457779, -0.01115126721560955, 0.009929086081683636, 0.02244935929775238, -0.05659157410264015, -0.007259523496031761, -0.014878681860864162, -0.03360193222761154, -0.04494572803378105, 0.02595195733010769, -0.023374438285827637, -0.057375792413949966, -0.017678484320640564, 0.00903591699898243, -0.09140406548976898, -0.00233789486810565, 0.004243252333253622, 0.08675967156887054, 0.052669353783130646, -0.07265152037143707, -0.02660992182791233, 0.03164815902709961, 0.056452590972185135, 0.015235044062137604, 0.00023810176935512573, -0.06317956000566483, -0.060735464096069336, -0.004594470839947462, 0.007943756878376007, 0.0327373705804348, -0.07168485224246979, 0.01833048090338707, -0.002596538746729493, 0.01792515628039837, 0.0312604121863842, -0.04136121645569801, -0.026879288256168365, 0.013116452842950821, 0.009738581255078316, 0.009548724628984928, -0.07877161353826523, 0.005985588300973177, -0.027767160907387733, -0.0365351065993309, 0.0838124081492424, -0.04616297408938408, -0.0904553234577179, -0.06409403681755066, 0.002109095687046647, -0.010397021658718586, -0.004844184964895248, -0.05589287728071213, 0.024400992318987846, 0.023025214672088623, -0.0081554614007473, 0.007881153374910355, 0.027854330837726593, -0.004259551875293255, -0.05396096780896187, -0.006123000755906105, 0.04829764366149902, 0.02767527475953102, 0.023771323263645172, -0.006043753121048212, 0.13913653790950775, 0.008090968243777752, -0.04515218734741211, 0.0013652561465278268, -0.03811533376574516, 0.04992643743753433, -0.005613759160041809, 0.05044858157634735, -0.015451441518962383, 0.0549953393638134, -0.002801173599436879, -0.018855080008506775, -0.04013354703783989, 0.008770143613219261, 0.01318360399454832, -0.04237682744860649, 0.04563506692647934, 0.07354715466499329, 0.016658002510666847, -0.032295458018779755, 0.0008426640997640789, -0.025835514068603516, 0.06761378049850464, -0.03725176677107811, 0.04733513295650482, -0.09166528284549713, 0.1228557750582695, -0.028393637388944626, -0.02896345593035221, 0.03134859353303909, 0.08191017061471939, -0.02945101447403431, -0.03777826204895973, -0.02933601289987564, -0.02473108470439911, -0.06200350448489189, -0.01085369847714901, -0.04450703412294388, -0.07511293888092041, -0.0459662564098835, 0.02614019252359867, 0.02878972887992859, -0.0154486782848835, 0.03329281508922577, -0.010059726424515247, -0.029844487085938454, -0.040521781891584396, 0.012545749545097351, 0.025570783764123917, 0.011675944551825523, 0.025565432384610176, 0.01313574519008398, 0.12999753654003143, 0.0425652340054512, -0.016932347789406776, -0.04744471609592438, 0.07857094705104828, 0.010849853977560997, 0.03387695178389549, 0.01546271238476038, -0.08964668959379196, 0.04716740921139717, -0.017757369205355644, -0.006636021193116903, 0.05435952916741371, -0.07000219821929932, 0.06976103037595749, 0.05582275986671448, -0.0033005347941070795, 0.02895883284509182, -0.055717937648296356, -0.004701818805187941, 0.11800285428762436, 0.030411813408136368, 0.06464843451976776, 0.015794523060321808, -0.06217215955257416, -0.0037065313663333654, -0.024053841829299927, 0.008361287415027618, 0.009734947234392166, 0.031303711235523224, -0.08846680819988251, 0.05203470215201378, -0.017830178141593933, 0.008018792606890202, -0.10112602263689041, -0.0008243242045864463, -0.09993904829025269, -0.005051789805293083, 0.05402796342968941, -0.02933097817003727, 0.02042519859969616, 0.030454594641923904, 0.0770765095949173, 0.13717609643936157, -0.06886425614356995, 0.03310919925570488, 0.018283028155565262, -0.02205079421401024, 0.028606249019503593, 0.016013771295547485, 0.007809087634086609, 0.021225115284323692, -0.05811063200235367, 0.034578412771224976, -0.042718589305877686, -0.1303163468837738, 0.07400307059288025, 0.007426157593727112, -0.016486244276165962, 0.02952352911233902, -0.02176668494939804, 0.010120907798409462, -0.054807715117931366, 0.05131981894373894, 0.05977228656411171, -0.041488248854875565, 0.019940106198191643, 0.06819049268960953, -0.016453968361020088, 0.06889982521533966, -0.007242981344461441, 0.028263447806239128, -0.002754656597971916, -0.019511092454195023, 0.025555813685059547, 0.01620224490761757, -0.020189037546515465, -0.010841798968613148, 0.08990898728370667, 0.014014572836458683, -0.03538411483168602, 0.0053867315873503685, 0.04915740713477135, 0.026182739064097404, -0.0037099970504641533, -0.02762448415160179, -0.014677689410746098, -0.03716689348220825, -0.0366743728518486, 0.027854757383465767, -0.0030906759202480316, -0.023763369768857956, -0.015831956639885902, 0.030169012024998665, -0.03801611810922623, -0.016191694885492325, -0.020427066832780838, 0.009987284429371357, 0.030765078961849213, 0.0562622994184494, -0.02648431994020939, -0.041079048067331314, -0.03227192163467407, -0.02622832916676998, -0.025383686646819115, 0.028474586084485054, 0.044019293040037155, 0.008742027916014194, 0.005642627831548452, 0.008196231909096241, 0.03614981845021248, -0.03733808174729347, 0.0027465824969112873, -0.017399726435542107, 0.022487666457891464, 0.05691304802894592, 0.020027076825499535, -0.002851006342098117, -0.011663424782454967, 0.009521450847387314, -0.035785187035799026, -0.006027041003108025, -0.004121569916605949, -0.005571040790528059, 0.0038869844283908606, -0.013642068020999432, 0.01649971678853035, -0.0020242861937731504, -0.017934439703822136, -0.004112556576728821, 0.01835501380264759, -0.08345726877450943, 0.03617725148797035, -0.03205133602023125, 0.03404131531715393, -0.003379915375262499, -0.012535669840872288, -0.036386821419000626, 0.037038881331682205, 0.015033472329378128, 0.051982659846544266, -0.00284692388959229, 0.02294480986893177, 0.0127596789970994, -0.0022378205321729183, 0.005123385228216648, 0.006664356216788292, -0.03730005398392677, 0.0025296970270574093, -0.0006963461637496948, 0.031016720458865166, -0.008997941389679909, 0.012055059894919395, 0.032865010201931, 0.005032928194850683, -0.025023203343153, 0.007379461079835892, 0.02972649224102497, 0.013671078719198704, -0.05788654088973999, -0.026782074943184853, -0.012996072880923748, -0.029416238889098167, -0.017081480473279953, -0.02396003156900406, 0.0073020244017243385, -0.017889751121401787, 0.0012458227574825287, 0.01318165473639965, 0.004661432933062315, 0.019619449973106384, 0.026567798107862473, 0.016541969031095505, 0.03118300624191761, -0.03664711117744446, 0.0459294393658638, -0.02236180752515793, -0.012342408299446106, -0.022742971777915955, 0.006432230118662119, -0.03659290820360184, -0.035081956535577774, 0.016633572056889534, 0.003327468642964959, 0.034015387296676636, -0.012396461330354214, -0.025544356554746628, -0.05989370122551918, 0.055529095232486725, 0.06877201050519943, 0.015724165365099907, -0.027217712253332138, -0.014738369733095169, 0.008345943875610828, -0.03369532525539398, -0.016844676807522774, 0.014954892918467522, 0.05663933604955673, -0.04206999018788338, -0.024060890078544617, 0.017144450917840004, -0.03141934052109718, 0.019349271431565285, -0.024012986570596695, 0.00987932551652193, -0.05296453833580017, -0.0026405840180814266, 0.011125401593744755, -0.005897157359868288, 0.02340489812195301, 0.028883598744869232, -0.016471920534968376, -0.020882463082671165, -0.05812821164727211, -0.05515257641673088, 0.033261239528656006, 0.011763748712837696, -0.0145369628444314, -0.05195819213986397, 0.05905827879905701, 0.06903800368309021, 0.008963148109614849, -0.03829535096883774, 0.06607877463102341, 0.02051180973649025, 0.012098562903702259, 0.014797735027968884, 0.03264686465263367, 0.061140622943639755, -0.02144043520092964, 0.007342282682657242, 0.0085635120049119, -0.06527964770793915, -0.0013091608416289091, -0.00205982755869627, -0.014608758501708508, -0.00963205099105835, 0.012141763232648373, 0.0045981151051819324, -0.002425351645797491, 0.011679913848638535, 0.017736786976456642, 0.017301378771662712, 0.0343286357820034, 0.00918481033295393, -0.0058534820564091206, 0.027393925935029984, 0.00281550083309412, 0.028705237433314323, -0.027648909017443657, 0.03812907263636589, -0.0563499853014946, 0.039970215409994125, 0.028661051765084267, -0.0290099885314703, -0.005839171819388866, -0.020879358053207397, -0.0109946820884943, 0.0026377199683338404, -0.008153598755598068, -0.03569794446229935, -0.03903704881668091, -0.011542393825948238, -0.027505874633789062, 0.03373308852314949, 0.013271822594106197, -0.022125061601400375, -0.00980603788048029, 0.0029471858870238066, -0.020281167700886726, 0.00478787487372756, -0.018850412219762802, 0.020721813663840294, 0.020717445760965347, -0.009284479543566704, 0.043186403810977936, 0.009456259198486805, -0.03212054446339607, 0.009697056375443935, -0.07432815432548523, 0.021938523277640343, 0.005682242568582296, 0.024532563984394073, -0.05900668725371361, -0.006886417046189308, 0.03747103735804558, -0.008492682129144669, 0.005243613850325346, 0.034108441323041916, 0.03052794188261032, 0.03855234384536743, -0.03172913193702698, -0.020982841029763222, -0.013972645625472069, -0.011342939920723438, 0.004498679656535387, 0.017509905621409416, -0.011845182627439499, -0.06729498505592346, -0.008228741586208344, 0.014875411987304688, -0.007895008660852909, -0.03356267884373665, -0.0448821596801281, -0.02677801623940468, 0.035787321627140045, 0.04097689688205719, 0.06521359831094742, 0.029307039454579353, -0.05082303658127785, -0.011252236552536488, -0.00003666126212920062, -0.000850557116791606, 0.0256879311054945, -0.010271160863339901, -0.020510749891400337, -0.006753862369805574, 0.030715461820364, 0.01536188367754221, -0.01784532144665718, 0.033783406019210815, 0.029757555574178696, -0.020058343186974525, 0.03830549120903015, -0.020292706787586212, 0.013902446255087852, -0.017965780571103096, -0.02566397562623024, 0.03156593069434166, 0.012636682018637657, -0.04074675589799881, 0.023464063182473183, -0.00032532724435441196, 0.011764226481318474, -0.04623153805732727, 0.08338912576436996, -0.004406320862472057, -0.015150830149650574, -0.015363745391368866, -0.039547692984342575, -0.020877936854958534, 0.013274798169732094, 0.02204027958214283, 0.00728168711066246, -0.03148171678185463, -0.035786449909210205, -0.01747630350291729, 0.011547223664820194, 0.033072181046009064, 0.0016001331387087703, -0.003932473249733448, -0.028784820809960365, -0.019028685986995697, 0.010086886584758759, 0.0314459502696991, 0.014177843928337097, -0.03782336786389351, 0.011038440279662609, 0.014065246097743511, 0.01644938625395298, 0.030491087585687637, 0.06354530900716782, 0.02105807326734066, -0.017955323681235313, -0.0006970273097977042, 0.005107202101498842, -0.02241607941687107, -0.01942836120724678, 0.06356459856033325, 0.0009891671361401677, -0.02861093543469906, -0.04490114375948906, -0.049110814929008484, -0.04798870533704758, -0.009339622221887112, -0.04111051931977272, 0.012896931730210781, 0.039359789341688156, 0.0020309709943830967, 0.03470400348305702, -0.013132903724908829, 0.01497705839574337, 0.0014054779894649982, -0.004364404361695051, -0.0159927811473608, -0.0063174101524055, -0.018650976940989494, -0.0054655615240335464, -0.031117640435695648, -0.00601107208058238, 0.007055193185806274, 0.06379202008247375, -0.01836724579334259, 0.006939129903912544, -0.02022348903119564, -0.029868705198168755, 0.01844056509435177, 0.010979396291077137, -0.019190635532140732, -0.004131976515054703, -0.018817570060491562, 0.020465480163693428, 0.05935606360435486, 0.014148075133562088, 0.009949464350938797, 0.02511455863714218, 0.00043450656812638044, 0.016794351860880852, 0.04312305897474289, -0.014621102251112461, 0.028887080028653145, 0.012611322104930878, 0.04237939789891243, 0.01872420497238636, -0.026734696701169014, 0.005175999831408262, 0.017244981601834297, 0.05567631125450134, -0.014915712177753448, 0.040800224989652634, 0.07938661426305771, -0.0014379669446498156, -0.04768107831478119, -0.036161232739686966, -0.04372972249984741, -0.022631676867604256, 0.004478731192648411, 0.04610539972782135, -0.01280506607145071, 0.010146972723305225, -0.02574275992810726, 0.058865003287792206, 0.04529452323913574, 0.06691545248031616, 0.026190944015979767, 0.0606837198138237, 0.01078092958778143, 0.013864973559975624, 0.024701127782464027, 0.034936998039484024, 0.030028989538550377, 0.005604445468634367, 0.016359487548470497, 0.036346908658742905, -0.005458547733724117, 0.024839602410793304, 0.021738462150096893, 0.049857307225465775, -0.02261376939713955, 0.030981598421931267, -0.006662509869784117, 0.009664158336818218, -0.003516444005072117, -0.021639451384544373, -0.005475725047290325, 0.004412466194480658, -0.00023583702568430454, -0.01337488740682602, -0.015328924171626568, -0.025152025744318962, 0.015238248743116856, -0.03867477551102638, -0.006109958980232477, 0.007611449807882309, -0.009629316627979279, -0.011631803587079048, 0.013733196072280407, 0.01418147049844265, 0.026238583028316498, -0.04607817158102989, -0.024311229586601257, -0.04022344574332237, 0.005249800626188517, 0.026215460151433945, 0.03220253437757492, -0.008689145557582378, 0.0033520180732011795, 0.03852938115596771, 0.025811120867729187, 0.03643253073096275, -0.002584765199571848, 0.006963792722672224, 0.02299545705318451, -0.024490969255566597, 0.02005147747695446, -0.02599903754889965, -0.07991944998502731, 0.060248326510190964, -0.021643340587615967, 0.055586911737918854, -0.007209956180304289, 0.019190222024917603, 0.012439809739589691, 0.02373197302222252, -0.01285631861537695, -0.02862289734184742, 0.02556917630136013, 0.00668172724545002, 0.000046621258661616594, 0.037071455270051956, 0.03527068346738815, -0.011905945837497711, -0.0008882882539182901, -0.02938161976635456, 0.017772924154996872, -0.004798683803528547, -0.0018144594505429268, 0.01619667559862137, 0.015076722949743271, 0.010904877446591854, -0.011366499587893486, 0.03478401154279709, 0.017007069662213326, 0.029288673773407936, 0.014584061689674854, -0.012843675911426544, -0.019212249666452408, -0.005239452235400677, -0.03420543298125267, -0.03023228794336319, 0.04408469423651695, -0.02079765312373638, -0.06905204802751541, 0.0019360430305823684, -0.007835982367396355, -0.04660067334771156, 0.00883884634822607, -0.018192632123827934, 0.0172380693256855, -0.010528014972805977, -0.022139040753245354, -0.01837342232465744, 0.015397874638438225, 0.06530304998159409, 0.04133892059326172, 0.002066300017759204, 0.0023680701851844788, -0.03629215806722641, 0.008497120812535286, -0.04360261559486389, 0.020524928346276283, 0.0733656957745552, -0.015984976664185524, -0.016802942380309105, 0.02807035855948925, 0.03907344862818718, 0.03870077058672905, -0.026101883500814438, -0.043526917695999146, -0.020045267418026924, 0.022749904543161392, -0.0866718590259552, 0.03923145309090614, 0.01666080579161644, -0.01894441619515419, 0.033673424273729324, -0.025752920657396317, -0.004102330654859543, -0.018082452937960625, -0.02244487591087818, -0.048350829631090164, 0.021230556070804596, -0.0614643320441246, -0.02566656470298767, 0.019368860870599747, -0.04752422496676445, 0.0018219453049823642, -0.015498886816203594, -0.009753290563821793, -0.017744600772857666, -0.035932742059230804, -0.002322962274774909, -0.024963321164250374, -0.03955938667058945, 0.030012743547558784, -0.019238470122218132, -0.0011853734031319618, 0.023072216659784317, -0.024085821583867073, 0.028189510107040405, 0.030510393902659416, -0.00016383103502448648, 0.013566441833972931, 0.018225571140646935, 0.04853878915309906, 0.02572484314441681, 0.05220166593790054, 0.052031852304935455, -0.03893336281180382, -0.03376217558979988, -0.003723213216289878 ]
Introducing 🤗 Accelerate
sgugger
April 16, 2021
accelerate-library
guide
https://huggingface.co/blog/accelerate-library
# Introducing 🤗 Accelerate
[ 0.0422913022339344, -0.004522520583122969, 0.12313839793205261, -0.0163450725376606, 0.0465359091758728, 0.018210940062999725, 0.015009385533630848, 0.04283832013607025, -0.036500297486782074, -0.10506030917167664, -0.02678675390779972, 0.021631041541695595, -0.025680268183350563, 0.01072620041668415, 0.044254012405872345, 0.005716762505471706, 0.04443296045064926, -0.05030817538499832, 0.011403505690395832, 0.01836264505982399, -0.040559329092502594, 0.0015754690393805504, 0.07232348620891571, -0.022108575329184532, -0.03005954436957836, 0.00937514565885067, 0.028214648365974426, 0.015268976800143719, -0.04107435792684555, 0.005038104485720396, -0.02232975699007511, 0.015041224658489227, 0.03351146727800369, -0.006047595292329788, -0.013389806263148785, 0.011180862784385681, -0.061732031404972076, 0.0008886333089321852, 0.018950236961245537, -0.030105717480182648, -0.0027238570619374514, -0.06711055338382721, 0.00807097740471363, 0.0593438521027565, 0.005069103557616472, -0.019125979393720627, -0.2884979844093323, 0.04890700429677963, -0.052627816796302795, -0.0484011285007, -0.03280773013830185, 0.03832538053393364, -0.03472362458705902, 0.0038393442519009113, 0.014136919751763344, 0.03700435534119606, -0.028739994391798973, -0.06118573620915413, -0.02005515992641449, -0.0549919418990612, 0.12332067638635635, 0.02807251363992691, 0.0021097755525261164, -0.0023747000377625227, 0.04420013725757599, 0.03783794119954109, -0.01265669520944357, 0.017322121188044548, -0.07724963873624802, 0.00032595641096122563, 0.05458512529730797, -0.024371281266212463, -0.05567755550146103, -0.026946600526571274, 0.052490074187517166, -0.09956549108028412, -0.02191183902323246, 0.08130265772342682, 0.09183821082115173, 0.06482619792222977, -0.008835796266794205, -0.045392297208309174, 0.11201735585927963, 0.1274970918893814, -0.004149176180362701, -0.020803898572921753, 0.016485828906297684, -0.04150950163602829, -0.00005102435534354299, 0.048143934458494186, -0.01814195327460766, -0.1214582771062851, 0.03223942965269089, 0.01789957843720913, 0.025041595101356506, -0.03733546659350395, 0.04391573369503021, -0.015590582974255085, 0.059088852256536484, -0.013710761442780495, -0.020820749923586845, 0.009089152328670025, -0.00240020127967, -0.02776503935456276, -0.02551637962460518, -0.0050350879319012165, -0.03210700675845146, -0.0773153230547905, -0.03852333873510361, 0.03169656917452812, -0.026263633742928505, 0.047364551573991776, 0.030224081128835678, 0.00424598203971982, -0.012747162021696568, 0.03419313207268715, 0.008034629747271538, -0.0009496799320913851, 0.003172867698594928, 0.016524260863661766, -0.014245142228901386, 0.08672241121530533, 0.08385170251131058, 0.04952332377433777, 0.045323848724365234, 0.048592709004879, 0.04067019000649452, 0.04162506014108658, -0.05096589773893356, -0.03898676857352257, 0.0370248407125473, -0.02701243944466114, 0.0489332489669323, -0.013499639928340912, 0.01255051139742136, -0.03400252386927605, -0.017746195197105408, -0.01809769496321678, 0.014952709898352623, 0.002583493944257498, -0.02327459491789341, 0.009516834281384945, 0.008278724737465382, 0.06082501262426376, -0.005841268692165613, -0.02774924226105213, -0.0870075672864914, -0.014795486815273762, -0.05048621818423271, 0.015544568188488483, -0.027607938274741173, 0.06868163496255875, -0.04481956362724304, -0.05874691903591156, -0.015123948454856873, 0.09395386278629303, 0.009427974000573158, 0.023263784125447273, -0.06554324179887772, -0.010114395059645176, 0.006688930094242096, -0.04216117784380913, -0.027956489473581314, -0.046192578971385956, 0.024046795442700386, -0.019167980179190636, 0.025551576167345047, -0.025503002107143402, -0.0004934525350108743, -0.10893554240465164, -0.027308810502290726, -0.01971047930419445, 0.019492989405989647, -0.001929799560457468, -0.0647447481751442, 0.06911714375019073, 0.046842060983181, 0.06041083484888077, -0.001161474036052823, 0.021157655864953995, -0.05199602246284485, 0.05844498798251152, -0.00255450583063066, 0.053900960832834244, 0.046374283730983734, -0.05942758917808533, 0.06516680866479874, 0.03696971759200096, 0.01620403490960598, 0.024994410574436188, -0.12384413927793503, -0.022086456418037415, 0.10410463064908981, -0.017545951530337334, -0.0015211555873975158, -0.09545379132032394, 0.0017510141478851438, 0.10943436622619629, 0.0385461263358593, 0.08807778358459473, 0.032328344881534576, 0.002725362777709961, 0.0691935196518898, -0.030180202797055244, -0.02849079854786396, 0.030171984806656837, 0.08084823191165924, -0.02174600400030613, 0.029419535771012306, -0.012171173468232155, -0.033564433455467224, -0.06845083832740784, 0.03580661863088608, -0.08630293607711792, 0.008379124104976654, -0.02350517362356186, 0.012921130284667015, -0.00869127456098795, -0.019528644159436226, -0.015021523460745811, 0.08078301697969437, -0.012455710209906101, -0.016661427915096283, 0.029400581493973732, -0.02848251909017563, 0.06603728234767914, 0.0818958505988121, -0.022096123546361923, 0.040796875953674316, -0.07756921648979187, -0.01632298342883587, -0.01584835723042488, -0.0408012680709362, 0.09279002994298935, 0.04851503297686577, 0.06490790843963623, 0.029540130868554115, -0.04207632690668106, 0.020975366234779358, -0.04935938119888306, -0.004784089047461748, -0.010144392028450966, 0.0016132979653775692, 0.03436049073934555, -0.012795659713447094, -0.007886591367423534, 0.06015142798423767, -0.01032989751547575, -0.061612386256456375, -0.024067075923085213, -0.04957050085067749, 0.037576112896203995, 0.01963173598051071, 0.005394715815782547, 0.021084321662783623, 0.0100199393928051, -0.00018838784308172762, -0.01935860887169838, -0.019425172358751297, 0.005556429736316204, 0.023767011240124702, -0.02707083337008953, 0.01882847025990486, -0.05603666976094246, -0.041681185364723206, -0.012495244853198528, 0.001510993461124599, 0.026167340576648712, 0.0031559295020997524, 0.00015490360965486616, -0.009100302122533321, -0.04343501105904579, 0.06487664580345154, 0.01995006576180458, -0.008692348375916481, 0.0002815881452988833, 0.05631978064775467, -0.027443518862128258, -0.026683645322918892, -0.02698476053774357, -0.020852526649832726, -0.0034752346109598875, 0.023777008056640625, 0.008127131499350071, 0.045410286635160446, -0.02428053319454193, 0.007903698831796646, 0.021552525460720062, -0.014514056965708733, 0.008841290138661861, 0.0024788151495158672, 0.029089711606502533, 0.009363841265439987, -0.018095895648002625, 0.04996418580412865, -0.016685836017131805, 0.014680889435112476, -0.010234588757157326, 0.001487339730374515, -0.00020457599021028727, 0.015910744667053223, 0.00748872896656394, -0.00847422331571579, 0.022911032661795616, -0.02220676653087139, 0.026480678468942642, -0.0023641258012503386, 0.02312786690890789, -0.15465092658996582, -0.048911623656749725, 0.019863098859786987, 0.01716833934187889, -0.0016483439831063151, -0.011182150803506374, 0.03960821405053139, -0.01436145044863224, -0.019613739103078842, -0.002606913447380066, 0.022107264026999474, 0.005760314874351025, 0.011239448562264442, -0.03883782774209976, -0.0433613583445549, 0.02867763303220272, -0.035214439034461975, 0.02046297863125801, -0.007516182027757168, 0.014841238968074322, -0.02753271721303463, 0.039166223257780075, 0.00999424047768116, 0.0030873112846165895, 0.02122325822710991, 0.03533054515719414, 0.02719201147556305, 0.024775225669145584, -0.0018683886155486107, -0.015989093109965324, -0.01516818068921566, 0.0432516373693943, -0.04004227742552757, 0.017127899453043938, -0.01893767900764942, 0.015164325013756752, -0.005700139328837395, -0.013941243290901184, -0.007651244755834341, 0.019243143498897552, 0.02513900212943554, -0.003956340719014406, 0.03664182126522064, -0.006129562854766846, -0.027496041730046272, -0.015191040933132172, 0.0069701229222118855, 0.01980571821331978, 0.050768375396728516, -0.041598014533519745, -0.05195789039134979, -0.01574813388288021, -0.008499233052134514, 0.031025268137454987, 0.006342137698084116, 0.03612164407968521, -0.057938408106565475, 0.022573821246623993, 0.06299123913049698, -0.04243103787302971, -0.011556260287761688, 0.0031394795514643192, 0.036633823066949844, -0.00487655121833086, -0.04068003594875336, 0.03176804259419441, 0.018223842605948448, 0.009321601130068302, -0.025989269837737083, 0.04401790350675583, -0.01577269285917282, -0.017448896542191505, -0.01393782440572977, 0.022773463279008865, -0.0011674418346956372, 0.035500966012477875, -0.028628069907426834, -0.03847790136933327, 0.047507692128419876, 0.001821802114136517, -0.01568005420267582, 0.0004516155458986759, -0.01882975734770298, -0.0116918059065938, -0.014551868662238121, 0.014016895554959774, 0.02163722738623619, -0.02347116731107235, 0.00514612440019846, 0.06495459377765656, 0.012310557067394257, -0.01304588746279478, 0.020262617617845535, -0.0053675007075071335, 0.00495549850165844, 0.036775968968868256, 0.05378231033682823, 0.014981400221586227, 0.009379242546856403, -0.017271390184760094, 0.04313632473349571, -0.017745358869433403, 0.0017220962326973677, 0.01629442721605301, -0.014447546564042568, 0.04446588084101677, -0.0005113218212500215, -0.022587589919567108, -0.005513220094144344, 0.005618985742330551, 0.027562957257032394, -0.0509263351559639, -0.013878987170755863, -0.025766700506210327, -0.0066087436862289906, 0.0021305235568434, -0.02548336423933506, -0.04144515469670296, -0.06717478483915329, 0.03343697637319565, -0.021959511563181877, 0.03828148543834686, 0.027708858251571655, -0.03219469264149666, -0.00035107898293063045, 0.0005537072429433465, -0.016956206411123276, -0.00742365000769496, -0.007632800843566656, -0.0072670369409024715, -0.04144773632287979, -0.041334111243486404, 0.03569868206977844, 0.0010520524810999632, 0.02202194184064865, -0.005757431033998728, -0.013024237006902695, 0.013347557745873928, -0.026829907670617104, -0.05889426916837692, 0.0033320842776447535, 0.01694219745695591, 0.043231070041656494, -0.004524521064013243, 0.03802058473229408, -0.006412346847355366, -0.017317209392786026, 0.03414974734187126, -0.016356008127331734, 0.02268705889582634, 0.026979690417647362, -0.03489358350634575, -0.029529482126235962, 0.007840430364012718, 0.01581682823598385, 0.021058259531855583, 0.00921160914003849, -0.025913003832101822, -0.03209623694419861, 0.052088361233472824, -0.001362378359772265, 0.001388915115967393, -0.038110747933387756, 0.022073786705732346, -0.03661726042628288, -0.013513770885765553, 0.006507471203804016, -0.02155325748026371, -0.0008761085337027907, -0.0009713822510093451, -0.009528636001050472, 0.005618977826088667, -0.004310877062380314, -0.022231383249163628, 0.011063208803534508, 0.001884971628896892, 0.017012888565659523, 0.022296631708741188, -0.013799645937979221, 0.004844368901103735, -0.021335268393158913, 0.0052274963818490505, 0.02063993364572525, 0.017279954627156258, -0.02900845743715763, -0.027962736785411835, 0.029770715162158012, 0.007920602336525917, 0.017200695350766182, 0.03277241066098213, -0.025600673630833626, 0.008167901076376438, -0.018787004053592682, -0.036320701241493225, 0.015761826187372208, -0.032021597027778625, 0.016359014436602592, -0.01088047120720148, -0.018120231106877327, -0.011335635557770729, 0.02875957265496254, 0.008201963268220425, 0.00048535590758547187, -0.03427392989397049, 0.038165319710969925, 0.022626126185059547, 0.002787401434034109, -0.011674555018544197, -0.022506682202219963, -0.0308443084359169, 0.01281740888953209, 0.02227039821445942, -0.01760757341980934, -0.06434665620326996, -0.021509751677513123, -0.03498564660549164, -0.014434811659157276, 0.020047137513756752, -0.0018360092071816325, 0.0060945251025259495, 0.03161681070923805, 0.008739044889807701, -0.024403570219874382, 0.011433038860559464, 0.04044462740421295, -0.04797676205635071, -0.0015916660195216537, 0.03299156203866005, 0.006199680268764496, 0.03261929005384445, 0.024086011573672295, 0.02436242252588272, 0.004678886849433184, 0.022498149424791336, 0.029690340161323547, 0.025307606905698776, -0.06289036571979523, 0.0515761636197567, 0.008516154251992702, 0.013292110525071621, -0.03545791655778885, -0.023911023512482643, -0.028958307579159737, -0.03722706064581871, -0.03586062416434288, 0.011701690964400768, 0.05670924857258797, 0.012636607512831688, 0.022544676437973976, 0.01952897198498249, 0.03086169995367527, 0.00008543222793377936, -0.018840624019503593, 0.00025116067263297737, 0.009881967678666115, 0.005026733037084341, -0.021294288337230682, -0.03924626111984253, 0.0022249803878366947, -0.013661160133779049, 0.04764377325773239, -0.0038079849909991026, 0.05165764316916466, 0.03192118927836418, -0.017209099605679512, 0.05251637473702431, 0.009312496520578861, -0.01907576061785221, -0.013446918688714504, 0.028658665716648102, -0.023865213617682457, 0.008254525251686573, 0.020339956507086754, -0.007299400400370359, 0.020777883008122444, -0.012230033986270428, 0.03790375590324402, 0.03672585263848305, -0.009411945007741451, 0.02230577915906906, 0.044954340904951096, 0.02744811773300171, 0.015713969245553017, -0.004769334569573402, -0.01986558735370636, 0.050047315657138824, 0.03946126624941826, -0.007346090395003557, 0.033091951161623, 0.05167316272854805, 0.010958913713693619, -0.02413763292133808, -0.0002746606769505888, 0.01306831743568182, -0.014094583690166473, 0.006130494177341461, 0.0224147941917181, -0.03287777304649353, 0.036894772201776505, -0.050811830908060074, 0.04806550592184067, 0.010319177061319351, -0.0025757947005331516, -0.0037663814146071672, -0.001747593516483903, 0.013206353411078453, 0.03172289580106735, 0.00480267871171236, 0.01970660500228405, 0.015467326156795025, 0.008604738861322403, 0.06244159862399101, -0.03256521746516228, -0.009867819957435131, 0.03196971118450165, -0.04452147334814072, 0.03228391706943512, -0.017321428284049034, 0.0012753187911584973, -0.023324182257056236, 0.039976272732019424, -0.005912849213927984, -0.01201714389026165, -0.0003262125246692449, -0.04621099308133125, -0.08172363042831421, 0.01441143173724413, 0.026776930317282677, -0.01344098150730133, 0.01720154657959938, -0.0117801483720541, 0.015030747279524803, -0.024180227890610695, 0.010994596406817436, -0.005474820267409086, 0.019930625334382057, 0.018928829580545425, 0.021041184663772583, -0.022899683564901352, 0.005298130214214325, -0.03296832740306854, -0.016415486112236977, -0.017056019976735115, 0.0054642981849610806, 0.03812820464372635, -0.022845493629574776, -0.00934771727770567, 0.0018790747271850705, -0.016264554113149643, 0.04015167057514191, 0.03559253364801407, 0.026405520737171173, 0.00031932161073200405, 0.0003285415004938841, -0.03543289005756378, -0.011202989146113396, -0.0037206276319921017, -0.030508676543831825, 0.019971957430243492, 0.008109383285045624, 0.015022935345768929, 0.03574740141630173, 0.028237132355570793, -0.04997124895453453, -0.04225325584411621, 0.017366666346788406, -0.023757204413414, 0.014404178597033024, 0.023316271603107452, 0.02403811737895012, -0.024611396715044975, -0.013926874846220016, 0.001201051753014326, 0.031213069334626198, -0.011717047542333603, 0.022226402536034584, -0.017677487805485725, -0.022352615371346474, -0.002297964645549655, -0.030743548646569252, 0.06292643398046494, 0.016774462535977364, 0.03386371210217476, 0.030896684154868126, 0.043241217732429504, -0.004002890549600124, -0.04979785904288292, -0.004354256670922041, -0.011552916839718819, 0.053975511342287064, -0.02248021587729454, -0.01758207194507122, -0.019045347347855568, -0.07584827393293381, -0.014423895627260208, 0.003239477751776576, -0.04320957139134407, -0.019807888194918633, 0.014400126412510872, 0.014620067551732063, -0.03564760833978653, 0.0381595641374588, 0.05074435845017433, 0.003781344275921583, 0.02719603292644024, -0.013829008676111698, -0.01014634408056736, 0.0013394833076745272, -0.02003336511552334, -0.00031535516609437764, 0.03215523809194565, 0.001501358114182949, -0.017962681129574776, 0.0023770208936184645, 0.039956480264663696, -0.03742579370737076, -0.052426841109991074, 0.014111465774476528, 0.04004983231425285, -0.017856206744909286, -0.08213672041893005, 0.001066626631654799, -0.0014098470564931631, 0.01274111121892929, 0.013729983940720558, 0.010137597098946571, -0.06288323551416397, 0.02546447142958641, 0.024607699364423752, -0.04004863649606705, 0.023984352126717567, -0.03517528250813484, 0.004886835813522339, 0.04302253946661949, 0.007016845978796482, -0.011511913500726223, 0.024796994403004646, -0.04602310433983803, 0.006707117892801762, 0.01188373938202858, -0.01584617607295513, -0.013644630089402199, -0.009733770042657852, 0.008755953051149845, -0.027494234964251518, -0.04041785001754761, 0.05185193195939064, 0.026277853175997734, -0.02200276404619217, 0.0037903827615082264, 0.0024135643616318703, 0.002561963861808181, 0.018056420609354973, 0.04964357241988182, 0.019096611067652702, 0.038014356046915054, 0.058059658855199814, -0.0139218894764781, 0.005524493288248777, 0.010465405881404877 ]
Introducing 🤗 Accelerate
sgugger
April 16, 2021
accelerate-library
guide
https://huggingface.co/blog/accelerate-library
How to get involved? To get started, just pip install accelerate or see the documentation for more install options. Accelerate is a fully open-sourced project, you can find it on GitHub, have a look at its documentation or skim through our basic examples. Please let us know if you have any issue or feature you would like the library to support. For all questions, the forums is the place to check! For more complex examples in situation, you can look at the official Transformers examples. Each folder contains a run_task_no_trainer.py that leverages the Accelerate library!
[ 0.07718632370233536, -0.04287072271108627, 0.08373793214559555, -0.029213063418865204, 0.04164627566933632, 0.037014883011579514, 0.022195536643266678, 0.03585401549935341, -0.01698482036590576, -0.0775827094912529, -0.09055119752883911, 0.0648222416639328, -0.057986870408058167, 0.040164701640605927, 0.03753652051091194, -0.022207004949450493, 0.05808278173208237, -0.03772813081741333, -0.01535159070044756, 0.07834824919700623, -0.05287082865834236, -0.03040451370179653, 0.05155637860298157, 0.023478949442505836, 0.010172544047236443, 0.009406221099197865, 0.02287342958152294, 0.014533234760165215, -0.0664232075214386, 0.05733627825975418, -0.07707634568214417, 0.017612101510167122, 0.0031274212524294853, -0.05743081867694855, -0.005651708226650953, 0.05077698454260826, -0.06180190667510033, 0.042223308235406876, 0.059490419924259186, -0.07605752348899841, 0.02183583192527294, 0.01066074799746275, -0.08018263429403305, 0.023015281185507774, -0.006792230065912008, -0.017855877056717873, -0.19060203433036804, 0.0442449189722538, -0.04145721346139908, -0.030951637774705887, -0.059791721403598785, 0.08431793749332428, -0.007573705166578293, -0.0168187003582716, 0.039653029292821884, 0.042823921889066696, -0.026590444147586823, -0.08186740428209305, -0.0015359383542090654, 0.006935585755854845, 0.04219750314950943, 0.04365964233875275, -0.02592325210571289, 0.018666066229343414, 0.05378255620598793, -0.007340969983488321, -0.00611973786726594, 0.020798824727535248, -0.05063612014055252, -0.04954047501087189, -0.001060096314176917, -0.05363653227686882, -0.043637990951538086, 0.004243651404976845, 0.02438490092754364, -0.11935953050851822, 0.019808003678917885, 0.04291693493723869, 0.0860443040728569, 0.042950864881277084, 0.005858245305716991, -0.012615756131708622, 0.07114272564649582, 0.09446261823177338, 0.032734066247940063, -0.04273202270269394, 0.005556738004088402, -0.027831390500068665, -0.009181899018585682, 0.06058918312191963, -0.004512548912316561, -0.10914149880409241, -0.04040590301156044, -0.019203785806894302, 0.03206097334623337, -0.03270918130874634, -0.012249533087015152, -0.011643124744296074, -0.012736965902149677, -0.031828686594963074, -0.021647313609719276, -0.05208525061607361, -0.02084820717573166, -0.019929828122258186, 0.020099744200706482, 0.05427001416683197, -0.032285094261169434, -0.04821213707327843, -0.038150206208229065, 0.04269783943891525, -0.004650958813726902, 0.008427164517343044, -0.02993108704686165, 0.04641628637909889, 0.00045103635056875646, 0.01419154740869999, -0.006772670429199934, 0.03289018198847771, -0.03308062255382538, -0.013300006277859211, -0.015644120052456856, 0.07941653579473495, 0.04695125296711922, 0.008956489153206348, -0.0020009262952953577, 0.12460634857416153, 0.009661572985351086, -0.0058060078881680965, -0.04810669273138046, -0.022117866203188896, 0.06039178743958473, -0.032548706978559494, 0.020433777943253517, -0.0328667089343071, 0.014450869522988796, -0.011761774308979511, -0.004658942576497793, -0.011307891458272934, 0.0046440474689006805, 0.013377025723457336, -0.0004623552958946675, 0.05879201367497444, 0.031017964705824852, 0.04864794760942459, -0.013262518681585789, -0.03957289829850197, -0.10839381068944931, 0.06997326016426086, -0.031015336513519287, 0.02905300073325634, -0.057397518306970596, 0.09116894751787186, -0.050794411450624466, -0.0019446382066234946, -0.016283826902508736, 0.08635663986206055, -0.012083652429282665, 0.00018241361249238253, -0.08606079965829849, -0.047360628843307495, 0.019994324073195457, -0.01649731956422329, -0.06004692241549492, -0.030166778713464737, 0.045121416449546814, -0.0015863836742937565, -0.0016876119188964367, -0.020613761618733406, 0.033889301121234894, -0.03577384352684021, -0.028375862166285515, -0.01659444160759449, 0.02218068391084671, 0.027124397456645966, -0.050605177879333496, 0.04583266004920006, 0.03147485479712486, 0.07390715181827545, 0.049636110663414, -0.055025916546583176, -0.06511861830949783, 0.09754924476146698, -0.028891485184431076, 0.051534585654735565, 0.08453014492988586, -0.04468592256307602, 0.07820438593626022, -0.01723414659500122, 0.002026998670771718, -0.008632216602563858, -0.07026689499616623, -0.045917902141809464, 0.09095991402864456, 0.0059445202350616455, 0.015228765085339546, -0.06090426817536354, 0.008178171701729298, 0.09662703424692154, 0.008560150861740112, 0.061055220663547516, 0.011933772824704647, -0.024170812219381332, 0.05598420649766922, -0.04700925946235657, -0.0015208860859274864, 0.022389601916074753, 0.04315061494708061, -0.09879249334335327, 0.04781180992722511, 0.012681142427027225, -0.05109371617436409, -0.08941551297903061, 0.05348823219537735, -0.10554690659046173, 0.0008573090890422463, -0.009856607764959335, -0.0038493305910378695, 0.006054110825061798, 0.02445574477314949, 0.01578054204583168, 0.11717328429222107, -0.027031762525439262, -0.0010863548377528787, -0.005480920430272818, -0.05260246619582176, 0.053161852061748505, 0.08314959704875946, -0.001857691677287221, 0.03726711496710777, -0.08743534237146378, -0.010124132968485355, -0.029833156615495682, -0.1293688714504242, 0.09025415033102036, 0.009863500483334064, 0.006773988716304302, 0.03003470040857792, -0.029256779700517654, 0.014948646537959576, 0.006348492112010717, 0.019287358969449997, 0.026194510981440544, -0.06296376883983612, 0.011174725368618965, 0.019805273041129112, -0.0011422357056289911, 0.0556819811463356, 0.047411154955625534, -0.02381383627653122, -0.022868063300848007, -0.03601682186126709, 0.037187300622463226, 0.012346701696515083, -0.05241801589727402, -0.001922118361108005, 0.0633346289396286, -0.0034892642870545387, -0.02779151126742363, 0.007061292417347431, 0.02299881912767887, -0.009641695767641068, -0.01016110647469759, -0.024899661540985107, -0.04213699325919151, -0.022911453619599342, -0.035569146275520325, -0.014438198879361153, 0.021047400310635567, 0.010768846608698368, -0.007963831536471844, 0.024585025385022163, -0.045851558446884155, 0.007141261361539364, 0.008940604515373707, 0.014259141869843006, 0.021204153075814247, 0.05764452740550041, 0.0085837934166193, 0.006982893217355013, -0.018194712698459625, -0.03167972341179848, -0.018430791795253754, 0.03913430497050285, 0.06436086446046829, 0.0275945533066988, 0.0083104083314538, -0.004184081219136715, -0.01224505715072155, 0.007632900960743427, 0.015261386521160603, -0.031986698508262634, 0.007423133589327335, 0.015244459733366966, -0.009011327289044857, 0.01498658861964941, -0.0011132583022117615, 0.02355606108903885, -0.0260282251983881, 0.012294326908886433, -0.015469489619135857, 0.011355200782418251, -0.008922852575778961, 0.016056066378951073, 0.0026066151913255453, -0.01408917736262083, 0.014202871359884739, -0.006862112320959568, -0.02952289953827858, -0.11538293212652206, -0.01435107085853815, -0.0026193244848400354, 0.02230554260313511, 0.014949558302760124, -0.03501095622777939, 0.009264925494790077, 0.0006255301996134222, -0.031570520251989365, 0.01882164180278778, -0.008532578125596046, 0.02906005270779133, 0.015311675146222115, -0.01474505104124546, 0.02408669888973236, 0.002645382657647133, 0.005693722981959581, 0.020005570724606514, 0.04932725429534912, 0.022451015189290047, -0.006835656240582466, 0.027791887521743774, 0.03733975067734718, -0.009596909396350384, -0.016960691660642624, 0.01819390058517456, 0.028140509501099586, 0.03549777343869209, 0.010069590993225574, -0.05597277730703354, -0.034045156091451645, -0.025601526722311974, -0.028687022626399994, 0.012904759496450424, -0.019497709348797798, 0.01464349590241909, -0.04364360123872757, -0.008929247036576271, 0.0031599015928804874, 0.02454826608300209, 0.010475228540599346, 0.010589518584311008, 0.024629386141896248, -0.04298478364944458, 0.007050221785902977, -0.01292372401803732, 0.007050642278045416, -0.014565801247954369, 0.037058789283037186, 0.001667477423325181, -0.03537385165691376, -0.008597975596785545, 0.014644673094153404, 0.0206749364733696, 0.014379887841641903, 0.024931950494647026, -0.028471320867538452, 0.050916485488414764, 0.08703746646642685, 0.023047184571623802, -0.03169436752796173, 0.009762349538505077, 0.02303363010287285, -0.02854655124247074, -0.03343157097697258, 0.05557607114315033, 0.03999575227499008, -0.011447804979979992, -0.020396694540977478, 0.019950874149799347, -0.054207541048526764, 0.009516248479485512, -0.008156739175319672, 0.01457298919558525, -0.03101816028356552, 0.037201832979917526, -0.011554710566997528, -0.004021839238703251, 0.06699560582637787, 0.04314878210425377, -0.018469268456101418, -0.03624103218317032, -0.07471659779548645, -0.02607783116400242, 0.010840345174074173, 0.002842748537659645, 0.020668698474764824, -0.0422782376408577, 0.03258178383111954, 0.05828522890806198, 0.02094484120607376, -0.023764457553625107, 0.0250883549451828, -0.025955265387892723, 0.0002502595307305455, 0.03106221929192543, 0.02301843650639057, 0.01847166009247303, -0.019809311255812645, 0.011732436716556549, 0.021713485941290855, -0.029858162626624107, 0.0014517651870846748, 0.015021008439362049, -0.02549336664378643, 0.002532352926209569, 0.003341802628710866, -0.02372017316520214, 0.01267690397799015, -0.016304679214954376, 0.020232107490301132, -0.031608693301677704, -0.014964734204113483, -0.015043145976960659, -0.02813529223203659, 0.046769700944423676, 0.0013886995147913694, -0.030743354931473732, -0.046062368899583817, 0.04716669023036957, -0.03538891300559044, 0.0395449660718441, 0.00887501984834671, -0.03631085529923439, -0.018755916506052017, -0.025301894173026085, 0.011677375063300133, 0.008505871519446373, -0.017574751749634743, -0.00803949125111103, -0.02604048326611519, -0.035601627081632614, -0.02348749153316021, 0.0074677132070064545, 0.027823833748698235, -0.00842183269560337, 0.004823239054530859, 0.02560384012758732, -0.02215494029223919, -0.008951314724981785, -0.012179955840110779, -0.01091793179512024, 0.05165328085422516, -0.022866031154990196, 0.041949424892663956, -0.005598493851721287, -0.022627990692853928, 0.013871736824512482, -0.010338272899389267, -0.0014736956218257546, 0.02429462969303131, 0.0004865147639065981, -0.046118710190057755, 0.00543567119166255, 0.02651854231953621, -0.005431191995739937, 0.002316561760380864, 0.013659377582371235, 0.011066793464124203, 0.0547984279692173, -0.006428812630474567, 0.004785193130373955, -0.03284688666462898, 0.014727668836712837, -0.007736580446362495, -0.010644768364727497, -0.027857817709445953, -0.06794220209121704, 0.00976789090782404, 0.005874784663319588, -0.04329579696059227, -0.010112389922142029, -0.008819813840091228, -0.04254201054573059, -0.007662730757147074, 0.018188169226050377, 0.04737985134124756, 0.016196252778172493, -0.0210295170545578, 0.002763679949566722, -0.015324661508202553, -0.025878243148326874, 0.02586827427148819, -0.002600868931040168, -0.037095751613378525, -0.00044742843601852655, 0.028115900233387947, 0.0185658261179924, -0.006869733799248934, 0.0342189259827137, -0.011404157616198063, -0.026390625163912773, -0.007555027026683092, -0.03762965649366379, -0.0020367016550153494, -0.023201053962111473, -0.03212982043623924, 0.005939648021012545, -0.019883232191205025, -0.028580330312252045, 0.022372018545866013, 0.05192636325955391, -0.009376862086355686, -0.055564284324645996, 0.05321604013442993, 0.018041474744677544, 0.0023613078519701958, -0.01720643974840641, 0.005033103749155998, -0.05113600194454193, 0.007094017695635557, 0.004615589044988155, -0.01169914286583662, -0.027999239042401314, -0.04821392148733139, -0.021763630211353302, -0.0012174311559647322, 0.026217397302389145, 0.020540539175271988, 0.0014029373414814472, -0.018121160566806793, 0.0016797997523099184, 0.0018342105904594064, 0.014647644013166428, 0.05350477993488312, -0.05096587538719177, -0.0040091476403176785, 0.028301769867539406, 0.013311374932527542, 0.029503555968403816, 0.038775645196437836, 0.025926878675818443, -0.00782196968793869, 0.021872740238904953, 0.03181647136807442, -0.0076643782667815685, -0.05261760205030441, 0.05961981043219566, 0.021447420120239258, -0.004638310521841049, -0.014854077249765396, -0.035868771374225616, -0.03780098631978035, -0.0074976105242967606, 0.007762372959405184, 0.04277466982603073, 0.08991702646017075, -0.0063760667107999325, -0.012861681170761585, -0.03229807689785957, 0.031229566782712936, 0.024906039237976074, -0.012024224735796452, -0.0026967560406774282, 0.003517445642501116, -0.02853790484368801, -0.010869419202208519, -0.02468142658472061, 0.012889982201159, 0.013191672042012215, 0.067855603992939, -0.03703903779387474, 0.03135739639401436, 0.015094040893018246, -0.026598403230309486, 0.02844006009399891, 0.028671469539403915, -0.00924576073884964, 0.023809362202882767, 0.005191082134842873, 0.00751935550943017, 0.05207906290888786, 0.035534102469682693, -0.0185660719871521, 0.024393687024712563, -0.010022682137787342, 0.05078622326254845, 0.020662859082221985, -0.015433690510690212, 0.021615197882056236, 0.03502269089221954, 0.030652184039354324, 0.004082284402102232, -0.008615521714091301, 0.03114658035337925, 0.009751124307513237, 0.0660918802022934, -0.009749672375619411, 0.009351126849651337, 0.03494810312986374, -0.023350927978754044, -0.04410720616579056, -0.02214353159070015, 0.01662438176572323, -0.02236291766166687, -0.008783498778939247, 0.023790718987584114, 0.012874042615294456, 0.009861118160188198, -0.03826962411403656, 0.03247580677270889, 0.03341607376933098, 0.01357350405305624, 0.008822614327073097, 0.0057960133999586105, 0.059378281235694885, 0.02456493303179741, 0.0012517800787463784, 0.021720800548791885, 0.006880615837872028, 0.005471235606819391, 0.04232325404882431, 0.0030410722829401493, 0.0029498154763132334, 0.024976884946227074, -0.012534579262137413, 0.040407437831163406, -0.030175162479281425, -0.0012899442808702588, 0.018718883395195007, 0.0030357115902006626, -0.035761818289756775, -0.016253022477030754, 0.01602846384048462, -0.05076418071985245, -0.061297643929719925, -0.006828334182500839, -0.012266228906810284, -0.006963452324271202, -0.002054504817351699, -0.02440638653934002, 0.04439753666520119, 0.0076839132234454155, -0.007520698476582766, 0.01782268099486828, 0.02678670547902584, 0.002721661003306508, 0.013588596135377884, -0.012659566476941109, -0.018895946443080902, -0.050002191215753555, -0.008293777704238892, -0.014316059648990631, 0.023594416677951813, -0.010466143488883972, -0.03752311319112778, 0.009026588872075081, 0.020387068390846252, 0.008018518798053265, 0.03790675848722458, 0.04100538790225983, 0.03656578063964844, -0.04756665229797363, 0.02401495724916458, -0.018997572362422943, -0.028654124587774277, 0.03757627680897713, -0.016491567716002464, 0.034738071262836456, -0.010243913158774376, 0.006177601870149374, 0.012360376305878162, 0.035386085510253906, -0.02096349000930786, -0.06395024061203003, 0.010362498462200165, -0.01275572832673788, 0.018722400069236755, 0.026661310344934464, 0.03168724849820137, -0.013252087868750095, 0.000783123483415693, -0.010843093506991863, 0.0559377484023571, 0.011059215292334557, 0.004080674611032009, -0.008399446494877338, -0.008013308048248291, 0.0015098737785592675, -0.01103101298213005, 0.05043811723589897, 0.02301674149930477, 0.04082457348704338, 0.046551868319511414, -0.00698866369202733, -0.006425549276173115, -0.013901007361710072, -0.014104298315942287, -0.004579029977321625, 0.02530115284025669, -0.05678727850317955, -0.05180356279015541, -0.013154960237443447, -0.013865550048649311, -0.03168037533760071, 0.0028907456435263157, -0.042947281152009964, -0.0019048929680138826, -0.02045902982354164, -0.0037624540273100138, 0.014501888304948807, 0.008666516281664371, 0.03313116729259491, 0.0362834632396698, 0.030913852155208588, -0.006407932378351688, -0.022213511168956757, 0.005632838234305382, 0.012325746938586235, 0.017683206126093864, 0.04400947317481041, 0.033388424664735794, 0.009803070686757565, -0.022147472947835922, 0.05869683623313904, -0.0022203417029231787, -0.09211985021829605, -0.02330676279962063, -0.001043659751303494, -0.01664103753864765, -0.06494855880737305, 0.011889638379216194, 0.02844404987990856, 0.00321666500531137, 0.020234335213899612, -0.028413807973265648, -0.036484915763139725, 0.012944040820002556, -0.0009224056266248226, -0.07216791063547134, 0.0060265338979661465, -0.02412845566868782, -0.006483275908976793, -0.012305189855396748, -0.013822616077959538, -0.021312372758984566, 0.02448507770895958, -0.017357749864459038, -0.006634215824306011, 0.007174003403633833, -0.011346280574798584, -0.030826712027192116, -0.003079374087974429, 0.0544191375374794, -0.01915654167532921, -0.04668587073683739, 0.06530459970235825, 0.02422739937901497, -0.01322199683636427, -0.027018917724490166, -0.01244925893843174, 0.015896404162049294, 0.017912907525897026, 0.06092425063252449, 0.000525362032931298, 0.05560242384672165, 0.04282677546143532, -0.04130256175994873, -0.041687801480293274, 0.02467869035899639 ]
Introducing 🤗 Accelerate
sgugger
April 16, 2021
accelerate-library
guide
https://huggingface.co/blog/accelerate-library
Model Model preparation include wrapping it in the proper container (for instance DistributedDataParallel) and putting it on the proper device. Like with a regular distributed training, you will need to unwrap your model for saving, or to access its specific methods, which can be done with accelerator.unwrap_model(model).
[ 0.031622499227523804, 0.03330688178539276, 0.005687561351805925, 0.052591726183891296, 0.09999442845582962, 0.002355343895033002, 0.02250228077173233, -0.028920745477080345, -0.052752673625946045, -0.03322957456111908, -0.05397946760058403, 0.0076871151104569435, -0.0021925731562078, 0.02464536763727665, 0.00033270352287217975, -0.03552943840622902, 0.055207692086696625, -0.03915965557098389, -0.013963625766336918, 0.008855889551341534, -0.019220693036913872, -0.08114435523748398, -0.01675320230424404, 0.029926374554634094, -0.028369462117552757, -0.0774175226688385, 0.08492084592580795, 0.06711286306381226, 0.026192404329776764, -0.015205400995910168, -0.08137695491313934, -0.004236605949699879, 0.014809022657573223, -0.030460486188530922, 0.011690192855894566, -0.020631056278944016, -0.08439122885465622, 0.05372876301407814, -0.0018274604808539152, -0.036754101514816284, 0.024819647893309593, 0.03750338777899742, -0.07858732342720032, 0.07707472145557404, 0.0031128856353461742, -0.04712129384279251, -0.19038701057434082, 0.03236301988363266, 0.007716468069702387, -0.013047312386333942, -0.084749236702919, 0.025021100416779518, 0.0024165459908545017, 0.02869516611099243, 0.00514106685295701, -0.017396122217178345, -0.06429696828126907, -0.0291812215000391, -0.0005576465628109872, -0.017669914290308952, 0.017715241760015488, 0.045146796852350235, -0.011152257211506367, 0.05892578139901161, -0.009106476791203022, -0.015489897690713406, 0.03840995579957962, -0.04360749199986458, -0.021137693896889687, -0.060201771557331085, -0.018159642815589905, -0.014939854852855206, -0.0001924169046105817, -0.019793372601270676, 0.012802334502339363, -0.06237795203924179, -0.014124758541584015, 0.01399344950914383, 0.07846687734127045, 0.04472276195883751, -0.012826369144022465, -0.025615079328417778, 0.010700149461627007, 0.0738176703453064, 0.07583162933588028, -0.03392936289310455, -0.004882015287876129, -0.07070404291152954, -0.032222311943769455, 0.049766357988119125, 0.01317251194268465, -0.09514803439378738, -0.02045341022312641, 0.034669820219278336, 0.020745065063238144, -0.05228019133210182, -0.003230865579098463, -0.0005488242604769766, -0.024340573698282242, -0.005374564789235592, -0.014242067001760006, -0.07134006917476654, 0.01005464605987072, 0.008197407238185406, -0.029596207663416862, 0.04696067050099373, -0.0433652363717556, -0.1336776316165924, -0.06091545894742012, 0.043714191764593124, -0.002702272729948163, 0.04281602427363396, -0.04825396463274956, 0.03820358216762543, -0.08685635030269623, 0.033473704010248184, 0.05494417995214462, -0.002688478911295533, -0.005875729490071535, 0.030546514317393303, 0.007445693947374821, 0.10180076211690903, 0.02919541671872139, -0.0018614196451380849, -0.02329963631927967, 0.06465225666761398, 0.027970993891358376, -0.006582286674529314, 0.020467223599553108, 0.026085583493113518, 0.019006121903657913, 0.006034248974174261, 0.06591244786977768, 0.011485609225928783, 0.03165024146437645, -0.07733507454395294, -0.046667229384183884, -0.04526400566101074, 0.034313686192035675, -0.004532370250672102, -0.06564215570688248, 0.052658017724752426, 0.0068606846034526825, 0.013914823532104492, 0.024674763903021812, 0.01650616154074669, -0.042960841208696365, 0.06321954727172852, -0.03307344391942024, 0.045336659997701645, -0.06811068952083588, 0.06578369438648224, -0.028189199045300484, -0.04613369703292847, 0.03962085396051407, 0.08991400897502899, -0.0641632229089737, 0.05579936131834984, -0.06001852825284004, 0.014780200086534023, 0.045213732868433, -0.0016838248120620847, -0.05306807905435562, 0.028466299176216125, 0.05493593215942383, 0.008591847494244576, 0.04521287977695465, -0.003785356879234314, 0.09642903506755829, -0.031197676435112953, -0.023250607773661613, -0.025469133630394936, 0.054803136736154556, 0.045587532222270966, -0.00005441493703983724, 0.011030708439648151, 0.0006472987006418407, 0.09223680943250656, -0.005510405637323856, 0.013994096778333187, -0.013772743754088879, 0.017879342660307884, -0.07281403988599777, 0.02875574864447117, 0.01921585574746132, -0.04035763069987297, 0.022728241980075836, -0.04025118798017502, -0.06547679752111435, 0.05987655371427536, -0.05607687681913376, -0.023549886420369148, 0.06774367392063141, -0.05796988680958748, 0.034334417432546616, -0.09886980056762695, -0.03075169213116169, 0.09850968420505524, 0.010711767710745335, 0.04837701469659805, 0.05137588456273079, 0.03304283693432808, -0.056758273392915726, -0.03803281858563423, 0.011567474342882633, 0.013829088769853115, 0.061419159173965454, -0.07130599766969681, 0.010362595319747925, -0.015895217657089233, 0.018888553604483604, -0.12368101626634598, 0.001754893222823739, -0.1551596075296402, 0.005092133767902851, -0.022232649847865105, -0.028896283358335495, -0.001991840312257409, -0.03599339351058006, -0.00429368345066905, 0.1438431292772293, -0.04023852199316025, 0.026188984513282776, 0.027107568457722664, -0.04263707250356674, 0.06739287823438644, 0.035518478602170944, 0.07448126375675201, 0.08483195304870605, -0.06369510293006897, 0.02572372928261757, -0.04148860275745392, -0.03174785524606705, 0.05999978259205818, 0.031109705567359924, 0.007119698449969292, -0.012920740060508251, 0.06821059435606003, -0.004181608557701111, -0.06572999060153961, 0.01747249811887741, -0.024474898353219032, -0.00228427373804152, 0.038583628833293915, -0.006495995447039604, 0.02680368907749653, 0.0551363006234169, -0.022210070863366127, -0.05966509133577347, -0.011334930546581745, -0.0450248084962368, 0.008087062276899815, -0.006789800710976124, -0.028509486466646194, 0.0495455265045166, -0.008304640650749207, 0.00413881428539753, -0.006832288112491369, 0.014057326130568981, 0.02465224266052246, 0.002510067308321595, -0.00913616456091404, -0.01399808656424284, -0.06070276349782944, -0.019449062645435333, -0.04780527576804161, 0.014569946564733982, 0.003712246660143137, 0.02293114922940731, 0.03835286945104599, 0.002733434084802866, -0.05573143810033798, 0.013501940295100212, 0.005415087100118399, 0.023191913962364197, 0.014137952588498592, 0.005535408388823271, -0.038157496601343155, -0.02421555109322071, -0.004951129667460918, -0.015151291154325008, -0.03035508282482624, 0.008156727999448776, 0.005893174093216658, 0.03586791828274727, -0.009778483770787716, 0.039543624967336655, 0.021555356681346893, -0.010221314616501331, 0.011702488176524639, 0.012259391136467457, 0.056219372898340225, 0.006813426967710257, 0.003303773934021592, -0.0029932649340480566, 0.005745348520576954, 0.0009619260090403259, -0.006034191697835922, 0.010873958468437195, -0.006579810753464699, -0.028771303594112396, 0.0325607992708683, 0.0303341057151556, 0.005422500427812338, -0.059188783168792725, -0.0232278723269701, 0.02385765127837658, 0.012702705338597298, -0.11194609105587006, -0.01989840157330036, 0.03421445190906525, 0.02198091335594654, -0.0010050081182271242, -0.0017576769459992647, 0.0131748728454113, -0.011704309843480587, 0.005799722857773304, 0.027150189504027367, 0.002970661036670208, -0.021112289279699326, 0.01595316082239151, 0.001528848079033196, -0.013142268173396587, -0.0017382362857460976, 0.006736685521900654, 0.00016098972992040217, 0.036804236471652985, 0.02842617966234684, -0.019713224843144417, 0.045391883701086044, -0.016011087223887444, 0.007143077906221151, -0.003114701947197318, -0.006805140059441328, 0.03250384330749512, 0.0508279874920845, -0.007609738036990166, -0.02837383933365345, -0.012237537652254105, -0.05862255021929741, -0.053956955671310425, -0.010638120584189892, -0.02558867074549198, -0.002593589248135686, -0.02291947416961193, 0.02691134624183178, 0.02053883671760559, 0.01882314868271351, -0.009212617762386799, -0.011109656654298306, 0.00931768398731947, -0.0023895036429166794, -0.012020096182823181, 0.03337324410676956, -0.01438168715685606, 0.04268038645386696, 0.012324392795562744, 0.0006580411572940648, -0.006174031179398298, -0.039822157472372055, 0.028040168806910515, 0.03261754661798477, -0.01577712409198284, 0.013412236236035824, 0.012183892540633678, 0.055049676448106766, 0.022420423105359077, -0.02027071639895439, -0.05174994096159935, -0.020186293870210648, 0.005536118056625128, -0.023528164252638817, -0.025855369865894318, 0.048926789313554764, 0.03287975490093231, 0.037274736911058426, -0.019123682752251625, 0.06060027703642845, -0.03747272863984108, 0.01310896035283804, -0.002027943730354309, 0.014615793712437153, -0.03315657749772072, 0.026955991983413696, 0.005911740940064192, -0.019374467432498932, 0.08796469867229462, 0.02003270573914051, -0.02086867205798626, -0.02665616013109684, -0.03434376046061516, -0.0516606904566288, 0.007927742786705494, -0.00780280539765954, 0.0059073492884635925, -0.027105534449219704, 0.01054407563060522, 0.046030156314373016, 0.00474088080227375, -0.03690764680504799, 0.01455564796924591, 0.03151828423142433, 0.014571473002433777, -0.003206569468602538, 0.04113200306892395, 0.009430323727428913, 0.0011221268214285374, 0.0021206378005445004, -0.002949114190414548, -0.03120606765151024, -0.010384217835962772, -0.012331327423453331, -0.01280419621616602, 0.01464416179805994, -0.01643967814743519, -0.03855116292834282, -0.000374356925021857, -0.06936091184616089, -0.01615772396326065, -0.009400121867656708, 0.03510512784123421, 0.006851310841739178, -0.017318319529294968, 0.033736273646354675, -0.022944731637835503, 0.005300553049892187, -0.014597559347748756, 0.03019452653825283, -0.032537415623664856, 0.014783857390284538, -0.000694496848154813, -0.024285241961479187, -0.010087260976433754, -0.01640971377491951, 0.022213684394955635, -0.007222610525786877, 0.009011720307171345, 0.02274542674422264, -0.03417111188173294, 0.003994299564510584, 0.022688664495944977, 0.009225628338754177, -0.025858409702777863, -0.029612554237246513, -0.0021842799615114927, 0.0542767196893692, 0.034581057727336884, -0.053743574768304825, 0.01278006937354803, -0.01425960473716259, 0.025779683142900467, -0.024175114929676056, 0.05655263364315033, -0.0190478153526783, -0.040359579026699066, 0.030824944376945496, -0.027338722720742226, 0.010814430192112923, -0.011211437173187733, 0.026583248749375343, -0.05045429989695549, -0.0069932639598846436, 0.020318370312452316, -0.000013115790352458134, 0.00020575802773237228, 0.008568615652620792, 0.028751464560627937, 0.042137738317251205, -0.015685120597481728, -0.010008765384554863, -0.04743146523833275, 0.019532103091478348, 0.0041746399365365505, 0.012736095115542412, -0.0035153180360794067, -0.07534989714622498, -0.012717005796730518, -0.00605424027889967, -0.007548673544079065, -0.014457355253398418, 0.003976982086896896, -0.036433909088373184, 0.062226634472608566, 0.024987708777189255, 0.021692993119359016, 0.004247523844242096, -0.021225403994321823, -0.001830036984756589, -0.013502544723451138, -0.01424318365752697, -0.006901112850755453, -0.016318881884217262, -0.019139420241117477, 0.02849162369966507, 0.07936716079711914, 0.018468596041202545, 0.042344268411397934, 0.049500055611133575, 0.02077013999223709, 0.013921410776674747, 0.047103818506002426, -0.01721123419702053, 0.0013687905156984925, 0.004652887582778931, 0.012187776155769825, 0.015995759516954422, -0.038716454058885574, -0.004735532682389021, -0.0003529662499204278, 0.06019885092973709, -0.019446922466158867, -0.008822447620332241, 0.036202821880578995, -0.00876947958022356, -0.014301015995442867, -0.00518768560141325, 0.031670231372117996, -0.0034301187843084335, -0.0153369614854455, 0.004248583689332008, -0.011643394827842712, 0.015858381986618042, -0.007436302490532398, -0.009951841086149216, -0.05726980045437813, 0.03906242921948433, 0.011372150853276253, 0.04994824528694153, 0.000256482744589448, -0.00637693190947175, -0.024342969059944153, 0.002546602627262473, 0.012512607499957085, -0.05688010901212692, 0.00717162573710084, 0.029340047389268875, -0.003072112100198865, 0.05579478293657303, 0.00386120961047709, 0.013613950461149216, -0.004949058406054974, 0.03065226413309574, 0.04001738131046295, -0.0013825935311615467, -0.05045953020453453, 0.05225569009780884, 0.0051321168430149555, -0.038053374737501144, -0.02007906697690487, -0.025225235149264336, -0.041000816971063614, 0.02683168277144432, -0.026856407523155212, 0.007542066741734743, 0.0595385804772377, 0.010743506252765656, -0.012712527066469193, -0.01379852369427681, 0.03341805189847946, -0.025321345776319504, 0.01804688759148121, -0.007992546074092388, 0.009664300829172134, -0.00532684288918972, -0.012635940685868263, 0.015338961035013199, 0.0072210547514259815, 0.0062867142260074615, 0.03962216526269913, -0.03685365617275238, 0.03428597003221512, 0.004054079297930002, -0.008820814080536366, 0.0029452412854880095, 0.012404458597302437, -0.07078194618225098, -0.006302014924585819, 0.01796235889196396, 0.046623773872852325, 0.06453607231378555, -0.012011829763650894, 0.03113468550145626, -0.006686599459499121, -0.010932469740509987, 0.011351827532052994, 0.02797088399529457, -0.02234858088195324, 0.04517674818634987, 0.010960415937006474, 0.06370029598474503, 0.019912153482437134, 0.008756735362112522, 0.00906349066644907, 0.024381419643759727, 0.05444611608982086, 0.015124008990824223, 0.016788026317954063, 0.017259588465094566, 0.010767410509288311, -0.015667151659727097, -0.006408085580915213, -0.03687448054552078, -0.0230607558041811, 0.022416938096284866, 0.0072392746806144714, -0.00643975380808115, -0.008608677424490452, -0.03900692239403725, 0.04443134367465973, 0.06228279322385788, 0.0009890906512737274, -0.05608487129211426, 0.03325324133038521, 0.016254087910056114, 0.03129930421710014, 0.016267381608486176, 0.037386443465948105, 0.0192782711237669, 0.005001815035939217, 0.027789035812020302, 0.008675308898091316, 0.04249395430088043, 0.023819057270884514, 0.041853100061416626, 0.03552161157131195, 0.005572047550231218, -0.02246071770787239, 0.017013169825077057, -0.007070387247949839, -0.02338813804090023, -0.01240679994225502, 0.016087479889392853, -0.06345301866531372, 0.010252058506011963, -0.044589657336473465, -0.02488575130701065, -0.021195460110902786, -0.004727173130959272, 0.004333425313234329, 0.04119338467717171, -0.007831994444131851, -0.049614593386650085, -0.022759635001420975, 0.025509396567940712, 0.02521761879324913, 0.021475866436958313, -0.033746376633644104, -0.029917219653725624, -0.058325476944446564, 0.017142532393336296, -0.006061081774532795, 0.045496679842472076, 0.012475220486521721, 0.04500968009233475, 0.05122411996126175, 0.02392636612057686, -0.016294077038764954, 0.046626485884189606, 0.02083086036145687, 0.004982268903404474, -0.0007193524506874382, 0.009165334515273571, -0.03658347576856613, -0.0506262443959713, -0.0037183333188295364, -0.00038817766471765935, -0.019692258909344673, 0.01851215586066246, 0.03448466956615448, 0.021903932094573975, 0.007481350097805262, 0.0035605640150606632, -0.02273368090391159, -0.010797926224768162, -0.026170801371335983, -0.010523558594286442, 0.04763482138514519, -0.009120330214500427, -0.010290014557540417, -0.014310451224446297, 0.00768439332023263, -0.030580518767237663, -0.016133511438965797, 0.0364217646420002, 0.03855975717306137, -0.060144174844026566, 0.018516914919018745, -0.019609982147812843, 0.06870365887880325, 0.006768153980374336, 0.008451273664832115, 0.014286375604569912, 0.03276624530553818, -0.01761000230908394, -0.04236963763833046, 0.013960432261228561, -0.02691616676747799, 0.01086853351444006, 0.00015412253560498357, -0.04406500607728958, -0.011719371192157269, -0.01989826373755932, -0.017909890040755272, 0.01346608530730009, -0.03809180110692978, -0.03712873533368111, 0.029758144170045853, -0.0015708411810919642, -0.06302822381258011, 0.013806577771902084, 0.10517668724060059, 0.04250385984778404, 0.02722303941845894, 0.03783803805708885, -0.038971055299043655, 0.005095004569739103, 0.008883719332516193, 0.05308838188648224, 0.026553919538855553, 0.002743543591350317, -0.03299899026751518, 0.028656871989369392, 0.02088678441941738, 0.017763420939445496, -0.06919382512569427, -0.0010011401027441025, 0.013640347868204117, 0.004964085761457682, -0.06046249717473984, -0.014963630586862564, 0.05133301764726639, 0.014553666114807129, 0.02363073080778122, 0.03098282776772976, -0.014412635937333107, 0.013393796980381012, -0.018659016117453575, -0.04830321669578552, 0.018555985763669014, -0.045880578458309174, 0.01282481849193573, 0.008253838866949081, 0.00529708294197917, -0.005569397006183863, -0.0013444670476019382, -0.0451396144926548, 0.004127287305891514, 0.004933495074510574, -0.022806577384471893, -0.03461728245019913, -0.013166832737624645, 0.008489720523357391, -0.029579835012555122, -0.03234405815601349, 0.012712257914245129, 0.0231095589697361, -0.040129464119672775, -0.007265309803187847, -0.0028485837392508984, 0.06819889694452286, 0.01649465039372444, -0.01406298577785492, -0.01626032590866089, 0.036558110266923904, 0.03359859436750412, -0.041222091764211655, -0.014730708673596382, 0.019550131633877754 ]
Scaling-up BERT Inference on CPU (Part 1)
mfuntowicz
April 20, 2021
bert-cpu-scaling-part-1
guide, nlp, partnerships, intel
https://huggingface.co/blog/bert-cpu-scaling-part-1
9. Conclusion Through this blog post, we covered out-of-box BERT inference performance one can expect for PyTorch and TensorFlow, from a simple PyPi install and without further tuning. It is important to highlight results provided here reflects out-of-the-box framework setup hence, they might not provide the absolute best performances. We decided to not include optimizations as part of this blog post to focus on hardware and efficiency. Optimizations will be discussed in the second part! 🚀 Then, we covered and detailed the impact, and the importance of setting the thread affinity along with the trade-off between the target problem size, and the number of cores required for achieving the task. Also, it is important to define which criteria (i.e. latency vs throughput) to use when optimizing your deployment as the resulting setups might be totally different. On a more general note, small problem sizes (short sequences and/or small batches) might require much fewer cores to achieve the best possible latency than big problems (very long sequences and/or big batches). It is interesting to cover all these aspects when thinking about the final deployment platform as it might cut the cost of the infrastructure drastically. For instance, our 48 cores machine charges 4.848\$/h whereas a smaller instances with only 8 cores lowers the cost to 0.808\$/h, leading to a 6x cost reduction. Last but not least, many of the knobs discussed along this blog post can be automatically tuned through a launcher script highly inspired from the original script made by Intel and available here. The launcher script is able to automatically starts your python process(es) with the correct thread affinity, effectively splitting resources across instances along with many other performances tips! We will detail many of this tips in the second part 🧐. In the follow-up blog post, more advanced settings and tuning techniques to decrease model latency even further will be involved, such as: - Launcher script walk-through - Tuning the memory allocation library - Using Linux's Transparent Huge Pages mechanisms - Using vendor-specific Math/Parallel libraries Stay tuned! 🤗
[ 0.04048066586256027, 0.008054292760789394, 0.0206399355083704, 0.06054959073662758, -0.005352433305233717, 0.06018105894327164, 0.06155452877283096, 0.08872008323669434, -0.018034642562270164, -0.09632796794176102, -0.05731569975614548, 0.04651403799653053, 0.02970186434686184, 0.058979280292987823, 0.014420517720282078, -0.016023974865674973, 0.0656605139374733, -0.0649857223033905, -0.0182352215051651, 0.027977649122476578, 0.04261453449726105, -0.04607692360877991, 0.051313892006874084, 0.0451011136174202, -0.001530001638457179, -0.04280727356672287, -0.037237659096717834, 0.002372310496866703, -0.07174329459667206, 0.04435514286160469, -0.1215316653251648, -0.015964727848768234, -0.009378706105053425, -0.046670056879520416, -0.03469283878803253, -0.020237861201167107, -0.11567684262990952, 0.10201205313205719, 0.031887322664260864, -0.018057897686958313, 0.01055518351495266, -0.06353092938661575, -0.04627617821097374, 0.010230444371700287, -0.009669622406363487, -0.01030456181615591, -0.09165557473897934, 0.06858569383621216, 0.007119218353182077, -0.02701920084655285, -0.08176755160093307, 0.05401588976383209, -0.012951136566698551, 0.014910772442817688, 0.01704615354537964, 0.017021292820572853, 0.0006654004682786763, -0.06684008985757828, 0.011603138409554958, 0.03149532899260521, 0.0265525933355093, -0.022812221199274063, 0.003624614328145981, -0.008209162391722202, 0.013379170559346676, 0.02004464715719223, -0.031003236770629883, 0.021537071093916893, -0.04102908447384834, 0.005003613885492086, -0.03415082395076752, -0.026005525141954422, -0.06069670245051384, 0.0020264782942831516, -0.015561898238956928, -0.012051534838974476, 0.01829323172569275, -0.001050471910275519, 0.02067606709897518, 0.011797945015132427, -0.036553651094436646, 0.04263930022716522, 0.02559663914144039, 0.045153845101594925, 0.06427735835313797, 0.03442588075995445, 0.046833109110593796, -0.017242269590497017, -0.04016288369894028, 0.012565390206873417, -0.021843256428837776, -0.13429662585258484, 0.0328972153365612, 0.009169727563858032, 0.010233601555228233, -0.03806355223059654, 0.026340864598751068, -0.0017353235743939877, -0.01192144863307476, -0.013547946698963642, 0.01886712945997715, -0.08793426305055618, -0.015408585779368877, -0.021549299359321594, -0.08713030815124512, 0.08082102984189987, 0.006011463701725006, -0.08702402561903, -0.04757840186357498, 0.05812319368124008, -0.03810006380081177, 0.017093045637011528, -0.014443743973970413, 0.023139556869864464, -0.09640174359083176, -0.017988435924053192, -0.05844499543309212, 0.01311049796640873, 0.013700121082365513, 0.0026518614031374454, 0.0012943156762048602, 0.09342113137245178, 0.046904582530260086, -0.03018680401146412, -0.020697275176644325, 0.06533734500408173, 0.005847738590091467, 0.025512952357530594, -0.009976767003536224, -0.010337520390748978, 0.056972164660692215, -0.05633694306015968, 0.05398723483085632, -0.05680978670716286, -0.044695351272821426, -0.05212350934743881, -0.014851431362330914, -0.03924664482474327, -0.00335135986097157, -0.04318905994296074, -0.06948362290859222, 0.049167267978191376, 0.027889283373951912, 0.04920843988656998, 0.048494063317775726, -0.0015120997559279203, -0.07888446003198624, 0.04202725738286972, 0.004251244943588972, -0.0033161663450300694, -0.09569747745990753, 0.047386739403009415, -0.047291941940784454, -0.015656817704439163, 0.018770160153508186, 0.0667998343706131, -0.0024381286930292845, -0.046324651688337326, -0.07736329734325409, -0.06221973896026611, -0.01211554929614067, -0.013698427937924862, -0.059556446969509125, -0.05128096416592598, -0.011716931127011776, -0.03636321797966957, 0.09545373916625977, -0.015351381152868271, -0.016528956592082977, -0.0042788987047970295, -0.0010190241737291217, 0.032811444252729416, 0.08658795058727264, -0.0015869071939960122, -0.02951400727033615, 0.02057359740138054, 0.04843556880950928, 0.06334841996431351, -0.008088604547083378, -0.02459768019616604, -0.03260842338204384, 0.07672368735074997, -0.003412838326767087, 0.05269799381494522, 0.025235403329133987, -0.09784575551748276, 0.035158440470695496, -0.03370026499032974, -0.026253975927829742, 0.0005000942037440836, -0.02331310138106346, -0.02963404916226864, 0.10063911974430084, -0.011225332506000996, 0.027154868468642235, -0.0322132334113121, -0.035053689032793045, 0.11427038908004761, 0.07183901220560074, 0.026386961340904236, 0.05882686376571655, 0.02090998739004135, 0.013922357000410557, -0.008237580768764019, -0.0554543100297451, 0.007958113215863705, -0.01663106307387352, -0.08379453420639038, -0.003528713248670101, 0.02346865087747574, -0.012962869368493557, -0.1417096108198166, -0.045745279639959335, -0.0875677615404129, -0.0018463794840499759, -0.0432671420276165, 0.023037753999233246, 0.035992663353681564, 0.03849893808364868, -0.021196750923991203, 0.1440015733242035, -0.08690140396356583, 0.0014250989770516753, 0.005286313593387604, -0.018701154738664627, 0.0007553116302005947, 0.03400980308651924, -0.04501247778534889, 0.10528083890676498, -0.06532742083072662, -0.04866316542029381, -0.07440111041069031, -0.03593245521187782, 0.10066854953765869, 0.009046639315783978, 0.01799510046839714, -0.08358323574066162, 0.02330516092479229, 0.022624466568231583, -0.05159792676568031, -0.021878156810998917, 0.07137357443571091, 0.021668691188097, 0.06666363775730133, -0.011463901028037071, -0.0517512671649456, 0.05544264614582062, 0.011552196927368641, -0.014321258291602135, -0.05410819500684738, -0.03943759202957153, -0.020206265151500702, -0.0214499831199646, -0.02609131671488285, 0.050844915211200714, 0.009461946785449982, -0.014245809055864811, -0.007985602132976055, -0.02576601877808571, 0.02658437192440033, 0.023457970470190048, -0.007834321819245815, 0.019048379734158516, -0.02412904053926468, 0.01786525920033455, -0.03887130692601204, -0.012544108554720879, -0.021920669823884964, 0.009200051426887512, -0.004028176888823509, -0.0026261203456670046, 0.002077502431347966, 0.045942578464746475, -0.0039353324100375175, -0.0011747977696359158, 0.03154894709587097, 0.05668874830007553, -0.00631118007004261, -0.00001024529046844691, -0.015266474336385727, 0.007293444126844406, -0.04985361546278, 0.021278660744428635, 0.018602749332785606, -0.0038997929077595472, -0.006203334778547287, 0.013625117018818855, -0.017401201650500298, -0.0266625564545393, -0.006471374072134495, -0.005741859320551157, 0.01850520633161068, 0.012309445068240166, -0.03022683411836624, 0.014709927141666412, 0.054649483412504196, -0.025514991953969002, -0.01814175397157669, 0.007323187310248613, -0.029663927853107452, -0.01856382004916668, 0.007600976154208183, -0.014349604956805706, 0.013111758045852184, -0.015173172578215599, 0.026020009070634842, 0.014139094389975071, 0.024045120924711227, -0.10623126477003098, -0.00640133349224925, -0.006167540792375803, 0.01660349778831005, -0.03554878383874893, -0.01040230505168438, 0.04234566166996956, 0.002266346476972103, -0.043457992374897, -0.011253776960074902, -0.0011096475645899773, 0.03354185074567795, 0.012983781285583973, -0.029091903939843178, 0.009227761998772621, 0.022783664986491203, 0.005008278414607048, 0.0015276741469278932, 0.020312316715717316, 0.0181523859500885, 0.006690455134958029, -0.011912542395293713, 0.0032529584132134914, -0.010508524253964424, -0.0043935286812484264, 0.032654475420713425, 0.0052289231680333614, 0.046709802001714706, 0.004206375684589148, -0.02533421851694584, -0.04581109806895256, -0.02426561340689659, -0.011249584145843983, -0.028655754402279854, -0.010891315527260303, -0.010453368537127972, -0.023090586066246033, 0.025662176311016083, 0.04117237776517868, 0.051407743245363235, 0.011470016092061996, 0.039771683514118195, 0.05569303408265114, -0.021816838532686234, 0.00131738290656358, -0.012178760021924973, 0.029814328998327255, -0.027464913204312325, 0.027297714725136757, -0.04044831544160843, -0.05442493408918381, -0.028917472809553146, -0.025498244911432266, 0.041900649666786194, 0.028925670310854912, 0.0028716865926980972, -0.037926144897937775, 0.021171238273382187, 0.039906516671180725, 0.005381649360060692, -0.053842943161726, 0.06135205551981926, 0.040710728615522385, -0.02046307362616062, -0.004954618401825428, 0.03892916813492775, 0.05833641439676285, -0.014532378874719143, -0.027827933430671692, 0.02004515565931797, -0.03245963901281357, 0.0529148168861866, 0.011899738572537899, 0.0007923759985715151, 0.008980784565210342, 0.024911880493164062, -0.02734636329114437, -0.0031493790447711945, 0.037206266075372696, 0.032121628522872925, -0.03854362294077873, -0.0306182112544775, -0.013897281140089035, -0.00838489644229412, 0.02405945025384426, 0.06473176926374435, -0.017988212406635284, -0.04155784845352173, 0.00865942146629095, 0.04040214791893959, -0.0034661556128412485, 0.000526141666341573, 0.027100134640932083, 0.001780673861503601, -0.021903429180383682, 0.000047277728299377486, 0.020411349833011627, 0.018117399886250496, -0.008806717582046986, 0.033090729266405106, 0.018863847479224205, -0.04330480843782425, -0.009582499973475933, 0.029959022998809814, -0.01557482685893774, 0.048546694219112396, -0.004724528640508652, 0.004504702985286713, 0.040252070873975754, 0.007481049280613661, 0.009567671455442905, 0.025396279990673065, 0.02250906452536583, -0.0004493005108088255, 0.052930910140275955, 0.02998191863298416, 0.009136232547461987, -0.00686626648530364, -0.034199099987745285, 0.025830132886767387, -0.031085005030035973, 0.026804272085428238, 0.014235641807317734, -0.009516337886452675, 0.051673997193574905, -0.0011996200773864985, 0.016319025307893753, 0.024459294974803925, 0.03292303532361984, -0.031556662172079086, -0.05854404717683792, -0.01200318243354559, 0.0411553680896759, 0.0010814766865223646, 0.01758212223649025, 0.026436418294906616, 0.007400470785796642, -0.0022907136008143425, -0.0013978114584460855, -0.03920567035675049, -0.007170146331191063, 0.00976112112402916, -0.0000475615743198432, -0.02751329354941845, -0.0013796596322208643, 0.05267937108874321, -0.0135607635602355, -0.015920015051960945, -0.02706383913755417, 0.037520650774240494, 0.020016515627503395, 0.008894066326320171, -0.016087695956230164, 0.02206435240805149, 0.03259744122624397, -0.008945516310632229, -0.0019434763817116618, 0.04976734146475792, 0.046208567917346954, 0.06216380000114441, 0.008172228001058102, 0.005811353679746389, -0.025106212124228477, 0.031347934156656265, 0.011691894382238388, 0.009774903766810894, 0.021103858947753906, -0.05111056566238403, 0.0062630670145154, -0.0370742566883564, -0.00853483285754919, 0.02197701297700405, 0.007900065742433071, -0.013002253137528896, 0.04467061907052994, 0.060399945825338364, 0.014875107444822788, -0.0028262161649763584, 0.020419331267476082, 0.010075164027512074, -0.017025519162416458, -0.023569876328110695, -0.0007139022345654666, -0.0009327061125077307, 0.0020407827105373144, 0.0257737934589386, 0.053502827882766724, 0.0398738756775856, -0.016306914389133453, 0.04243145510554314, 0.02990933135151863, 0.011656214483082294, 0.00964262057095766, -0.032969653606414795, -0.024569984525442123, -0.01149166189134121, -0.003979687578976154, 0.04216400161385536, 0.00585962412878871, -0.017972342669963837, 0.0004377900913823396, 0.013390829786658287, -0.03045707195997238, -0.02152106538414955, 0.06119244173169136, 0.015544957481324673, 0.008315564133226871, -0.058804042637348175, 0.0332488976418972, -0.007435280364006758, 0.020023180171847343, 0.012489733286201954, -0.018143728375434875, 0.023931320756673813, 0.029261797666549683, -0.05449380353093147, -0.04792526364326477, 0.04778866842389107, 0.055842217057943344, 0.056774821132421494, -0.00506229605525732, -0.03449203819036484, 0.0023293818812817335, 0.015799833461642265, -0.01744433492422104, -0.05326339974999428, -0.0044553508050739765, -0.015726104378700256, -0.02710561826825142, 0.031908825039863586, 0.026318376883864403, -0.030064484104514122, -0.010702136904001236, 0.07522457838058472, 0.005684612784534693, -0.026376063004136086, 0.03085341677069664, 0.018995312973856926, 0.015657640993595123, -0.01479466911405325, -0.00879688747227192, -0.02927183173596859, 0.0029261771123856306, 0.0015692849410697818, -0.07086950540542603, 0.03838702291250229, 0.06871490180492401, -0.019480673596262932, -0.001489505055360496, -0.00858926773071289, 0.02494313195347786, 0.00533408485352993, -0.006707329303026199, -0.004362314939498901, 0.007595254573971033, 0.016851551830768585, 0.020747944712638855, 0.010707532055675983, 0.04249335080385208, 0.024925436824560165, 0.012104980647563934, -0.053478505462408066, 0.022664282470941544, 0.006306726019829512, -0.06342974305152893, 0.029920903965830803, -0.002860513748601079, -0.05850489065051079, 0.006761623080819845, 0.035575371235609055, -0.021964875981211662, 0.023417029529809952, -0.005529936868697405, 0.008897327817976475, 0.008623704314231873, 0.008417094126343727, 0.013226338662207127, 0.041189294308423996, 0.006030418910086155, 0.007007885724306107, 0.017488451674580574, 0.04353886470198631, 0.033085282891988754, -0.004613765049725771, -0.006206875201314688, 0.01770949549973011, 0.07382915914058685, -0.003723155939951539, 0.006970936898142099, 0.027721749618649483, -0.027325160801410675, 0.02831459417939186, -0.02056582272052765, -0.02734387293457985, -0.0426970012485981, -0.007048682775348425, 0.031445518136024475, -0.03055030293762684, 0.005060197785496712, -0.015714459121227264, 0.003940437454730272, 0.02665431797504425, 0.04140639677643776, 0.005075546447187662, 0.007447320036590099, -0.011813806369900703, 0.007875189185142517, -0.02740056999027729, 0.014787368476390839, 0.02098066918551922, -0.018733398988842964, 0.0516049861907959, 0.03283708170056343, 0.05429598689079285, -0.005956445820629597, -0.04099508747458458, 0.011366319842636585, -0.008567996323108673, -0.004781736992299557, 0.011317855678498745, 0.011642900295555592, 0.012303953990340233, -0.00108096853364259, 0.017076890915632248, -0.04157428443431854, 0.025359313935041428, -0.014819281175732613, -0.029047124087810516, 0.013247554190456867, -0.011014864780008793, -0.008749105036258698, 0.03585685417056084, 0.008087683469057083, -0.037304043769836426, 0.022742433473467827, 0.017921874299645424, 0.002830210607498884, 0.03491043299436569, -0.01584227941930294, -0.009670950472354889, 0.007551671005785465, 0.02665918879210949, -0.006700881291180849, 0.013912388123571873, -0.0330887995660305, -0.008192422799766064, 0.03345825895667076, -0.0009469132055528462, -0.007487899623811245, 0.016866911202669144, -0.0013057964388281107, 0.007070951629430056, -0.06059937924146652, 0.0309654101729393, 0.009605051949620247, -0.05739131569862366, 0.03979235887527466, -0.005331430118530989, -0.004985375329852104, -0.01145604345947504, 0.039793726056814194, 0.014691421762108803, 0.04419361427426338, -0.02458822727203369, -0.019656775519251823, 0.02491491287946701, 0.013032468967139721, -0.04130016267299652, 0.03640832006931305, 0.041579291224479675, 0.03372436761856079, 0.025341792032122612, -0.009329319931566715, -0.031115135177969933, -0.035052280873060226, -0.026040660217404366, 0.03483510762453079, 0.00009802914428291842, -0.006891830358654261, -0.019666729494929314, 0.05281967669725418, 0.0013582853134721518, 0.04102462902665138, 0.05875417962670326, -0.022991562262177467, 0.01884130947291851, -0.041916608810424805, 0.004575727041810751, -0.009608464315533638, -0.007393397390842438, -0.05365414544939995, -0.02585180290043354, -0.01427903026342392, 0.017965123057365417, -0.015381771139800549, -0.02278064750134945, -0.0676579400897026, -0.0020801089704036713, -0.06447462737560272, -0.011193351820111275, -0.023171842098236084, -0.01910099945962429, 0.04530632868409157, 0.054469019174575806, -0.002708601066842675, 0.015460800379514694, -0.04049788787961006, -0.01746620237827301, -0.01923067681491375, 0.009087982587516308, 0.03141378238797188, 0.033822908997535706, -0.015109683386981487, -0.04280093312263489, -0.007944343611598015, 0.004196772351861, -0.009820637293159962, -0.012568007223308086, 0.03099050745368004, -0.020984185859560966, -0.00022359406284522265, 0.022558363154530525, 0.025497792288661003, -0.03483004868030548, 0.04865369573235512, 0.0004580452514346689, 0.013960597105324268, 0.005821811966598034, -0.03171312436461449, -0.060493599623441696, -0.028083709999918938, 0.02929050102829933, -0.0035653114318847656, 0.065195731818676, -0.010471714660525322, 0.03360551968216896, -0.024439815431833267, -0.042775724083185196, -0.00748501718044281, -0.03370807692408562, -0.04230374097824097, -0.04737395793199539, 0.00767878582701087, 0.022977430373430252, -0.038845352828502655, -0.0316084548830986, 0.011031956411898136, 0.018700532615184784, 0.003726654453203082, 0.009189584292471409, -0.010705825872719288, 0.021891336888074875, -0.013499579392373562, 0.05022341385483742, 0.014291487634181976, 0.056403204798698425, 0.045769087970256805, 0.021427886560559273, 0.004638297017663717, 0.013769559562206268 ]
Scaling-up BERT Inference on CPU (Part 1)
mfuntowicz
April 20, 2021
bert-cpu-scaling-part-1
guide, nlp, partnerships, intel
https://huggingface.co/blog/bert-cpu-scaling-part-1
5.1. Introduction There are multiple ways to improve the latency and throughput for tasks such as BERT inference. Improvements and tuning can be performed at various levels from enabling Operating System features, swapping dependent libraries with more performant ones, carefully tuning framework properties and, last but not least, using parallelization logic leveraging all the cores on the CPU(s). For the remainder of this blog post we will focus on the latter, also known as Multiple Inference Stream. The idea is simple: Allocate multiple instances of the same model and assign the execution of each instance to a dedicated, non-overlapping subset of the CPU cores in order to have truly parallel instances.
[ 0.07128187268972397, 0.004292550031095743, 0.013537404127418995, 0.027443474158644676, 0.05389250069856644, 0.051946476101875305, 0.055325478315353394, 0.06069955229759216, -0.03353056311607361, -0.09138935059309006, -0.0333838164806366, 0.005748231895267963, 0.0068092443980276585, 0.06875544041395187, -0.021765299141407013, -0.02478162571787834, 0.04689584672451019, -0.08966836333274841, -0.0034420129377394915, -0.0011630890658125281, 0.0747208371758461, -0.061665091663599014, 0.05115541070699692, 0.04358074069023132, 0.003249171655625105, -0.0007730278302915394, -0.032907623797655106, -0.002722677541896701, -0.06213328242301941, 0.056165389716625214, -0.09194687008857727, 0.007051334250718355, 0.025981420651078224, 0.024492723867297173, -0.06315531581640244, -0.043958887457847595, -0.09567737579345703, 0.033716268837451935, 0.03888484090566635, -0.03798578307032585, 0.014184893108904362, -0.03690316900610924, 0.008832762017846107, 0.022394102066755295, 0.012637235224246979, -0.0022711839992552996, -0.06665357202291489, 0.0420617051422596, 0.0030483356676995754, -0.022575855255126953, -0.11461404711008072, 0.07092573493719101, -0.0025810599327087402, 0.02133857272565365, 0.0184528399258852, -0.001971988705918193, -0.013238303363323212, -0.12137603759765625, 0.021369030699133873, 0.0647183284163475, 0.042417123913764954, -0.025282936170697212, 0.008672771044075489, 0.027015715837478638, 0.03705909848213196, 0.016878003254532814, -0.012029738165438175, -0.04282199591398239, -0.03667343035340309, 0.011924085207283497, -0.009363002143800259, -0.00943487137556076, -0.03406919166445732, 0.030328255146741867, 0.03241222724318504, -0.004997034091502428, 0.026896625757217407, -0.02141987532377243, -0.009499158710241318, 0.02452782914042473, -0.03302055969834328, 0.00885043479502201, -0.01797969825565815, 0.06761935353279114, 0.01876227557659149, 0.022477110847830772, 0.06409519165754318, -0.0115900794044137, -0.03396264836192131, 0.02241947501897812, -0.018113698810338974, -0.13620491325855255, 0.004641351755708456, -0.0031838584691286087, 0.03455755487084389, -0.009595501236617565, 0.06790673732757568, 0.033370669931173325, -0.009790085256099701, -0.004909583367407322, -0.006245672702789307, -0.0920657217502594, 0.029041046276688576, 0.0022756564430892467, -0.06774625182151794, 0.0524994321167469, 0.029231538996100426, -0.13474780321121216, -0.05561784282326698, 0.07209417968988419, -0.0009431915241293609, 0.019429296255111694, -0.007664719130843878, 0.0872555673122406, -0.1392214596271515, 0.017690138891339302, -0.045773543417453766, 0.04953717067837715, 0.028797702863812447, -0.019136901944875717, -0.005681725684553385, 0.05124364420771599, 0.06715574115514755, -0.005772073287516832, -0.02796224132180214, 0.047923170030117035, 0.03948216885328293, -0.023784806951880455, 0.029572058469057083, 0.010462047532200813, 0.06808128207921982, -0.04412929341197014, 0.037780072540044785, 0.0146720502525568, 0.03773847594857216, -0.01239711232483387, -0.04462689906358719, -0.09251336008310318, -0.003607114078477025, -0.00010651420598151162, -0.030309587717056274, -0.01043049804866314, 0.0059972405433654785, -0.042485352605581284, 0.04686602205038071, 0.08472302556037903, -0.11453477293252945, 0.05651640146970749, 0.028220508247613907, 0.027201171964406967, -0.11252108216285706, 0.03293076530098915, -0.10049336403608322, -0.06388343125581741, 0.03021927922964096, 0.10048159956932068, 0.05548657476902008, -0.023250911384820938, -0.08958100527524948, -0.04589415714144707, 0.015777600929141045, -0.07684483379125595, -0.017027975991368294, -0.02028210088610649, -0.002137234900146723, -0.045393072068691254, 0.04003667086362839, 0.02246825210750103, 0.006217605900019407, 0.022920219227671623, -0.022394252941012383, 0.03716796264052391, 0.06264419108629227, -0.027385089546442032, -0.009316304698586464, 0.008481241762638092, 0.03134364262223244, 0.0627782940864563, 0.015302805230021477, -0.02498493529856205, -0.015054652467370033, 0.02896684966981411, 0.007495718542486429, 0.05009820684790611, 0.020237766206264496, -0.06442654877901077, 0.037010930478572845, -0.055546022951602936, -0.02779046632349491, 0.007619773503392935, -0.007395111955702305, -0.04720655083656311, 0.05837136507034302, -0.0240691676735878, 0.019383396953344345, -0.021049292758107185, -0.11088614165782928, 0.08654381334781647, 0.0632585808634758, 0.04934297129511833, 0.03417818993330002, -0.0006181796779856086, 0.02375141717493534, 0.024992894381284714, -0.027287058532238007, 0.008674753829836845, 0.001114915357902646, -0.032379258424043655, 0.006163171958178282, 0.012668977491557598, -0.027102170512080193, -0.11813809722661972, -0.04334646090865135, -0.046775467693805695, -0.0025646009016782045, -0.06943716108798981, 0.021428339183330536, -0.010842802934348583, 0.03343190625309944, -0.04237408936023712, 0.12631869316101074, -0.10066085308790207, 0.0033284793607890606, 0.027285460382699966, 0.0028645778074860573, -0.01642831787467003, 0.042065877467393875, -0.022585732862353325, 0.10082702338695526, -0.04027620330452919, 0.01725648157298565, -0.039551254361867905, 0.005787681322544813, 0.03718898445367813, 0.023701099678874016, 0.03655039891600609, -0.06475380063056946, 0.024407513439655304, -0.00509648909792304, -0.08371499180793762, -0.006621924694627523, 0.04204041138291359, -0.013212697580456734, 0.0524151436984539, 0.03700077161192894, -0.024475043639540672, 0.05374166741967201, 0.016677366569638252, 0.019260205328464508, -0.048904307186603546, -0.02733701653778553, -0.02575676701962948, 0.009393833577632904, -0.0968281626701355, 0.030114632099866867, 0.0458027645945549, -0.011909722350537777, -0.009907163679599762, 0.018509546294808388, 0.03619247302412987, 0.01166674867272377, -0.005498665384948254, -0.01696222834289074, -0.022855205461382866, -0.004550280049443245, -0.04175497218966484, 0.0007841336773708463, 0.00029294929117895663, 0.004701686091721058, -0.02767016366124153, 0.011577441357076168, -0.04303106665611267, 0.040555283427238464, -0.014166077598929405, 0.033554695546627045, 0.023027079179883003, 0.04108482971787453, 0.00457005063071847, -0.002925256034359336, -0.007273478899151087, -0.038387078791856766, -0.07682059705257416, 0.025986863300204277, 0.022607171908020973, -0.0009062453173100948, -0.029487529769539833, -0.004837119486182928, -0.023033998906612396, -0.05054318532347679, -0.002258764347061515, 0.0016490878770127892, 0.019437655806541443, -0.013600001111626625, -0.02092662826180458, 0.0058103688061237335, 0.061034560203552246, 0.010507840663194656, -0.031411390751600266, -0.025564955547451973, -0.0481395497918129, 0.007976161316037178, -0.005947056692093611, -0.016124209389090538, 0.004023129586130381, -0.034235160797834396, 0.034034620970487595, 0.00238595949485898, 0.01110982894897461, -0.09387765824794769, -0.02791903167963028, 0.0025168282445520163, 0.0027603318449109793, -0.019881311804056168, -0.04665832966566086, 0.07111167162656784, -0.028465814888477325, -0.039118628948926926, 0.02451208233833313, 0.02856600098311901, 0.01064678281545639, 0.012036724016070366, -0.013919939287006855, 0.03677312657237053, -0.023163268342614174, -0.007433382794260979, 0.008699983358383179, -0.01903354749083519, 0.02637116052210331, 0.015294102020561695, -0.0068077025935053825, -0.0024483168963342905, -0.0016770762158557773, 0.020192261785268784, 0.022220272570848465, -0.02230668067932129, 0.03345130756497383, 0.029259899631142616, -0.006342419423162937, -0.046757038682699203, -0.02225716970860958, -0.002470683539286256, -0.03561682254076004, 0.010559860616922379, -0.020985359326004982, -0.02243872731924057, 0.02094637230038643, 0.04882115125656128, 0.03696056827902794, 0.048229921609163284, -0.0005911548505537212, 0.043116118758916855, -0.026767507195472717, -0.022748451679944992, 0.0203761775046587, 0.04337885230779648, -0.010457870550453663, 0.007934985682368279, -0.021406888961791992, -0.020350588485598564, -0.008261044509708881, -0.00661802850663662, 0.013087965548038483, -0.009527568705379963, -0.01980370283126831, -0.021986063569784164, -0.012005467899143696, 0.03443672135472298, -0.0031321437563747168, -0.013023069128394127, 0.03770153596997261, 0.025932785123586655, -0.011440767906606197, -0.018682656809687614, 0.03772754222154617, 0.03823355212807655, 0.03641628846526146, 0.014163369312882423, 0.03246306627988815, 0.0021649689879268408, 0.06074123457074165, 0.014305969700217247, 0.0025455402210354805, -0.009080557152628899, 0.02741570584475994, -0.0217752642929554, -0.04482853040099144, 0.07436487823724747, -0.011718052439391613, -0.009077711962163448, 0.01947486773133278, -0.03064044937491417, 0.0008184610051102936, 0.06288538128137589, 0.024683048948645592, -0.013680807314813137, -0.014330437406897545, 0.023122934624552727, 0.02656770683825016, -0.023116551339626312, -0.02972961962223053, 0.025985654443502426, -0.04585857316851616, -0.014757145196199417, -0.007983230985701084, 0.01919742114841938, 0.04233765974640846, -0.016598740592598915, 0.007269998546689749, 0.02861146442592144, -0.02172427624464035, 0.011529210023581982, 0.039659738540649414, 0.004673514980822802, 0.03539285808801651, 0.04351527616381645, -0.005057221278548241, 0.008127639070153236, 0.010961447842419147, -0.011439151130616665, -0.0002822718524839729, 0.019332773983478546, 0.010899633169174194, 0.03346186876296997, 0.00529223820194602, -0.02213534153997898, 0.012766266241669655, -0.005176480859518051, 0.007753603160381317, -0.037138473242521286, 0.04296083748340607, 0.02904881350696087, 0.0014240143354982138, 0.0371309258043766, -0.003402278758585453, 0.02632630616426468, 0.011386461555957794, 0.015468190424144268, -0.032876431941986084, 0.0024777385406196117, 0.024973183870315552, 0.06215918809175491, 0.021409496665000916, 0.02549651637673378, -0.009572462178766727, -0.027861077338457108, 0.0034543746151030064, 0.033095795661211014, -0.038288261741399765, -0.013699328526854515, 0.03994077071547508, -0.0007526627741754055, -0.05489623174071312, 0.005616252310574055, 0.02027224563062191, -0.016109904274344444, -0.01712602563202381, -0.02210499718785286, 0.05300023406744003, 0.04835017770528793, 0.003931775689125061, -0.03560565039515495, 0.018704179674386978, 0.03827441856265068, -0.015969760715961456, -0.003308142302557826, 0.06045800447463989, 0.04057975113391876, 0.08910124748945236, 0.033040739595890045, 0.009391586296260357, -0.047660283744335175, -0.015023297630250454, 0.02986031211912632, -0.015502511523663998, -0.018335839733481407, -0.006837473716586828, -0.00949174351990223, -0.020168593153357506, -0.02282175049185753, -0.0069933864288032055, -0.0061565120704472065, -0.0336478054523468, 0.03598669171333313, 0.026603974401950836, 0.04263997822999954, -0.013346153311431408, 0.018697500228881836, 0.00968561414629221, -0.027308303862810135, -0.020571378991007805, -0.010091288015246391, -0.0067238640040159225, 0.005733513738960028, 0.010322388261556625, 0.05202294513583183, 0.04395762458443642, 0.007615648675709963, 0.017687618732452393, 0.029734354466199875, 0.010047337040305138, 0.001637796638533473, -0.033998116850852966, -0.013800802640616894, -0.04492535442113876, 0.007464713882654905, 0.0030131100211292505, -0.039706695824861526, -0.017972778528928757, -0.012637408450245857, 0.029293697327375412, -0.01100858673453331, -0.009934955276548862, 0.05996366962790489, -0.00894548837095499, 0.022613076493144035, -0.06213080510497093, -0.003457015147432685, 0.011776970699429512, 0.007654139306396246, 0.006094870623201132, -0.038927797228097916, 0.0513908714056015, 0.012390238232910633, -0.031787823885679245, -0.03680521622300148, 0.03336144611239433, 0.017970237880945206, 0.04099033772945404, -0.010314473882317543, -0.046661943197250366, -0.0017819588538259268, -0.02397061139345169, -0.039612073451280594, -0.02641795203089714, -0.0019552656449377537, -0.0091794952750206, -0.02306012250483036, 0.05589151009917259, 0.032221198081970215, -0.02140110172331333, -0.021382134407758713, 0.0694577693939209, 0.01791100949048996, 0.016365187242627144, 0.008224443532526493, 0.02098691090941429, 0.05831959471106529, -0.007439676206558943, 0.015771906822919846, -0.027445361018180847, -0.0337948352098465, -0.007630561012774706, -0.0534619465470314, 0.002406888408586383, 0.05183450132608414, -0.024108951911330223, -0.0036700291093438864, 0.013263615779578686, 0.04282156005501747, -0.022350091487169266, -0.005432408768683672, 0.01342360582202673, -0.02885976992547512, -0.00033222028287127614, 0.03140212967991829, -0.00956725887954235, 0.01464933343231678, 0.024609914049506187, 0.013749253004789352, -0.07039645314216614, -0.0014710001414641738, -0.033079009503126144, -0.06065468117594719, 0.02204456739127636, -0.010197648778557777, -0.03718296438455582, -0.0025395334232598543, 0.014176187105476856, 0.03733258321881294, -0.008732734248042107, 0.01340730395168066, 0.0124637670814991, -0.004320645704865456, 0.011188806965947151, 0.005346396472305059, 0.05813369154930115, 0.010442589409649372, -0.0018900131108239293, 0.03179163113236427, 0.023897631093859673, 0.027638029307127, -0.022225698456168175, 0.0060377237387001514, 0.0013975459150969982, 0.0660560131072998, -0.015574907884001732, 0.026112094521522522, 0.005199127830564976, 0.004442048259079456, -0.001629189937375486, 0.015787038952112198, -0.0007951915031298995, -0.019061200320720673, -0.04556073993444443, 0.017190610989928246, -0.03308970108628273, 0.012354966253042221, -0.019530288875102997, 0.015516944229602814, 0.04190238565206528, 0.03413105383515358, 0.008290073834359646, -0.021389681845903397, 0.0005567798507399857, 0.011621242389082909, -0.014407742768526077, -0.014914868399500847, 0.05551768094301224, -0.03046336956322193, 0.03162970021367073, 0.044596485793590546, 0.01381988450884819, -0.001711726188659668, -0.031001320108771324, -0.011522341519594193, -0.014842608943581581, -0.0060715158469974995, -0.010087767615914345, -0.013584628701210022, 0.005255271214991808, 0.05057854950428009, -0.020021921023726463, -0.06945978850126266, 0.02456149086356163, 0.0000339238322339952, -0.04802194982767105, -0.0012113184202462435, 0.006437694188207388, 0.015779759734869003, 0.03449990600347519, 0.007301354315131903, -0.04813924431800842, -0.023332547396421432, 0.0014714878052473068, -0.011024223640561104, 0.012331806123256683, -0.04539009928703308, -0.02206183224916458, -0.018078550696372986, 0.023373471572995186, 0.01235404796898365, 0.018575679510831833, -0.012331567704677582, -0.0021008120384067297, 0.032725464552640915, 0.020750628784298897, -0.0022190548479557037, 0.013028910383582115, -0.0088415015488863, 0.010629112832248211, -0.05641285330057144, -0.003676742548123002, 0.03219415247440338, -0.07962092757225037, 0.04831678792834282, 0.009041772224009037, 0.0016962577356025577, -0.000031930863769957796, 0.05185339227318764, -0.006853254046291113, 0.027341211214661598, -0.0377172976732254, 0.008231180720031261, -0.007243679836392403, -0.008129172027111053, -0.040209509432315826, 0.027189813554286957, 0.019804246723651886, -0.015201415866613388, 0.010507418774068356, -0.0027042191941291094, -0.04630351811647415, -0.029370775446295738, 0.02178812399506569, 0.0357854962348938, -0.02550198882818222, -0.03655591979622841, -0.022844843566417694, 0.02228122390806675, -0.015225253067910671, 0.050355926156044006, 0.03281835839152336, 0.0010226645972579718, 0.026259910315275192, -0.00474036019295454, 0.004461261909455061, 0.007000302895903587, 0.027436723932623863, -0.05401080101728439, -0.016127122566103935, -0.014331352896988392, 0.039022546261548996, -0.031543392688035965, 0.025873467326164246, -0.05371555685997009, -0.025713859125971794, -0.0411716029047966, -0.004358076024800539, -0.04776538535952568, -0.023215463384985924, 0.06656678766012192, 0.008105157874524593, 0.028395261615514755, 0.019487470388412476, -0.01649381034076214, -0.03315837308764458, -0.028621818870306015, 0.04198380187153816, 0.02942579612135887, 0.0200516190379858, -0.034672096371650696, -0.01758347824215889, -0.02138255536556244, 0.006224609911441803, -0.048926323652267456, 0.02391049824655056, 0.004692499991506338, -0.009643825702369213, -0.01000528410077095, 0.021049126982688904, 0.05647847428917885, -0.01730753481388092, 0.034657981246709824, 0.033946868032217026, -0.014015842229127884, -0.03883131220936775, -0.04315780848264694, -0.026378510519862175, -0.04522717744112015, 0.04705465957522392, -0.003611088264733553, 0.06902928650379181, 0.007337694056332111, 0.0124351279810071, -0.000364154257113114, -0.010274244472384453, 0.014254393987357616, -0.003934457898139954, -0.020176909863948822, -0.05405133590102196, -0.010330275632441044, 0.006865340750664473, -0.03266066685318947, -0.03562763333320618, 0.012190370820462704, 0.03222118690609932, 0.0038964878767728806, 0.004156062845140696, 0.01630529761314392, 0.014001568779349327, -0.04754192382097244, 0.046448055654764175, -0.021610895171761513, 0.04384849965572357, 0.06767016649246216, 0.022523747757077217, -0.01135780569165945, -0.01986800506711006 ]
Scaling-up BERT Inference on CPU (Part 1)
mfuntowicz
April 20, 2021
bert-cpu-scaling-part-1
guide, nlp, partnerships, intel
https://huggingface.co/blog/bert-cpu-scaling-part-1
5.2. Cores and Threads on Modern CPUs On our way towards optimizing CPU inference for better usage of the CPU cores you might have already seen -at least for the past 20 years- modern CPUs specifications report "cores" and "hardware threads" or "physical" and "logical" numbers. These notions refer to a mechanism called Simultaneous Multi-Threading (SMT) or Hyper-Threading on Intel's platforms. To illustrate this, imagine two tasks A and B, executing in parallel, each on its own software thread. At some point, there is a high probability these two tasks will have to wait for some resources to be fetched from main memory, SSD, HDD or even the network. If the threads are scheduled on different physical cores, with no hyper-threading, during these periods the core executing the task is in an Idle state waiting for the resources to arrive, and effectively doing nothing... and hence not getting fully utilized Now, with SMT, the two software threads for task A and B can be scheduled on the same physical core, such that their execution is interleaved on that physical core: Task A and Task B will execute simultaneously on the physical core and when one task is halted, the other task can still continue execution on the core thereby increasing the utilization of that core. Figure 3. Illustration of Intel Hyper Threading technology (SMT) The figure 3. above simplifies the situation by assuming single core setup. If you want some more details on how SMT works on multi-cores CPUs, please refer to these two articles with very deep technical explanations of the behavior: - Intel® Hyper-Threading Technology - Technical User Guide (12) - Introduction to Hyper-Threading Technology (13) Back to our model inference workload... If you think about it, in a perfect world with a fully optimized setup, computations take the majority of time. In this context, using the logical cores shouldn't bring us any performance benefit because both logical cores (hardware threads) compete for the core’s execution resources. As a result, the tasks being a majority of general matrix multiplications (gemms (14)), they are inherently CPU bounds and does not benefits from SMT.
[ 0.10649976879358292, 0.03553144633769989, 0.004899033345282078, 0.06514041125774384, 0.00854696799069643, -0.02767256833612919, 0.003498462960124016, 0.019974004477262497, -0.08438452333211899, 0.003722658148035407, 0.007616743445396423, 0.011342181824147701, -0.0030431144405156374, 0.013361575081944466, -0.04239474982023239, 0.020514806732535362, 0.07311061769723892, -0.07923982292413712, 0.03733130916953087, 0.06477399170398712, 0.039819974452257156, -0.01572694256901741, 0.10865374654531479, 0.03596491366624832, -0.013767127878963947, 0.011073442175984383, -0.035740237683057785, -0.01987450383603573, -0.04895729199051857, -0.0016257751267403364, -0.1533699631690979, 0.004725323989987373, 0.024159099906682968, 0.005084875039756298, -0.009085418656468391, 0.016288530081510544, -0.0526856891810894, 0.0486951619386673, 0.018583359196782112, -0.05730627477169037, 0.018855858594179153, -0.036211736500263214, -0.01741483248770237, 0.0027496288530528545, -0.002385971834883094, 0.007805838715285063, -0.1148354560136795, -0.002261699642986059, 0.010115105658769608, -0.03834149241447449, -0.03689887374639511, 0.031219054013490677, 0.040712665766477585, 0.04665180295705795, 0.022225363180041313, 0.07780307531356812, -0.019821058958768845, -0.022928982973098755, 0.027190757915377617, 0.025822680443525314, 0.0753023624420166, -0.030437737703323364, -0.004566522780805826, -0.011528760194778442, -0.038620539009571075, -0.056114938110113144, -0.013256491161882877, -0.07662905007600784, -0.06824538856744766, 0.023083969950675964, -0.021263087168335915, -0.028836000710725784, -0.014601102098822594, 0.02719798870384693, 0.0031237888615578413, -0.00018658445333130658, -0.013668373227119446, 0.04162425920367241, 0.0258063692599535, -0.03605804964900017, -0.036033470183610916, 0.057482387870550156, 0.06118934229016304, 0.0526064969599247, 0.02110227197408676, 0.00749536557123065, 0.00354576762765646, 0.10012642294168472, 0.01831844262778759, 0.09650056064128876, 0.006123297847807407, -0.04145883396267891, 0.07651887834072113, -0.02159132808446884, -0.03208011016249657, -0.006843219976872206, 0.025766197592020035, 0.01759086549282074, -0.003995168954133987, 0.030494211241602898, 0.014885847456753254, 0.0130068464204669, 0.04764971882104874, 0.009787514805793762, -0.03298596292734146, -0.020807631313800812, 0.015308062545955181, -0.03154848888516426, -0.05318983271718025, 0.08655722439289093, -0.06409870088100433, 0.016820093616843224, -0.019314002245664597, -0.009713864885270596, -0.08218434453010559, 0.03106769360601902, 0.016083398833870888, 0.00950418971478939, 0.0058861421421170235, -0.017010310664772987, 0.0334220752120018, 0.06557140499353409, 0.0763319581747055, -0.003927599173039198, 0.009071922861039639, 0.0075844405218958855, 0.08215387910604477, -0.04134310781955719, 0.06312169879674911, -0.07956621050834656, 0.006576577667146921, 0.03159065172076225, 0.03274491801857948, -0.0769098773598671, 0.010076848790049553, -0.07558897882699966, -0.013658885844051838, -0.07779515534639359, -0.009590914472937584, 0.011484185233712196, -0.041672784835100174, -0.052964307367801666, 0.08045653998851776, -0.012852095998823643, 0.05123109370470047, -0.046037234365940094, -0.05922752246260643, -0.029388466849923134, 0.01660485565662384, -0.03387456759810448, -0.07049503922462463, 0.025299828499555588, -0.04420566186308861, -0.06254084408283234, 0.039997439831495285, 0.04249002784490585, 0.06972550600767136, -0.044323112815618515, -0.05999847874045372, -0.08829526603221893, -0.054672159254550934, -0.031712066382169724, -0.03859350085258484, -0.03230903670191765, 0.03546682000160217, 0.045716822147369385, 0.038079485297203064, -0.004989177454262972, 0.07220645993947983, -0.00702740577980876, -0.047534551471471786, -0.030237551778554916, 0.07546603679656982, -0.06322061270475388, 0.0032124409917742014, 0.030153000727295876, 0.02252855710685253, 0.10606514662504196, 0.040087565779685974, 0.0012915300903841853, -0.03146163746714592, -0.0003575519076548517, -0.02168157510459423, 0.08522377908229828, 0.027742480859160423, -0.016966087743639946, -0.002622895408421755, -0.05736888572573662, -0.008889727294445038, 0.018739819526672363, -0.01564844138920307, -0.03295131027698517, 0.05882657319307327, 0.015808966010808945, 0.036716166883707047, 0.019200390204787254, -0.06830450147390366, 0.10715702921152115, 0.028947802260518074, 0.09331810474395752, 0.10076901316642761, -0.042249951511621475, -0.00894884206354618, -0.012765910476446152, -0.0784505233168602, 0.03086177259683609, -0.014927846379578114, -0.047358233481645584, -0.02517162263393402, 0.0016728127375245094, -0.026853160932660103, -0.09355081617832184, -0.004246203228831291, 0.007946541532874107, -0.017057327553629875, -0.02880728617310524, 0.002534648170694709, 0.01839936524629593, 0.02207854576408863, -0.13451842963695526, 0.1118299588561058, -0.08631490170955658, 0.022371867671608925, 0.015788210555911064, -0.036095861345529556, -0.022921347990632057, 0.04988831281661987, -0.01718529872596264, -0.06964651495218277, -0.025231393054127693, 0.019298112019896507, -0.013780701905488968, -0.016043435782194138, 0.053221531212329865, 0.08269241452217102, 0.03932155668735504, -0.0342223234474659, 0.09893707185983658, 0.03987324237823486, -0.10224033892154694, 0.0024087915662676096, 0.04665551334619522, -0.04307868704199791, 0.039767272770404816, -0.022844938561320305, -0.05869968235492706, 0.06913633644580841, -0.04361642897129059, -0.023685896769165993, -0.0799994245171547, -0.06681928038597107, -0.05970786511898041, -0.018171777948737144, -0.04082932323217392, 0.02322474867105484, -0.05487510561943054, 0.022799121215939522, -0.00048299445188604295, -0.029890339821577072, 0.015059642493724823, 0.00014005127013660967, -0.042308259755373, -0.026524124667048454, -0.06048779562115669, -0.005909836385399103, -0.04150763899087906, -0.00667563546448946, 0.019012970849871635, 0.02918843924999237, 0.012498283758759499, -0.024915793910622597, -0.05107493698596954, 0.020581889897584915, -0.04816832020878792, 0.014692998491227627, 0.013193698599934578, 0.0058471160009503365, -0.013533447869122028, 0.02839685045182705, 0.005322724115103483, 0.022988460958003998, 0.02132558450102806, 0.03499511629343033, 0.0213796254247427, -0.04339032247662544, -0.01478764321655035, 0.012687066569924355, -0.009913884103298187, -0.05173109471797943, -0.0042312731966376305, -0.007847974076867104, -0.04596763104200363, -0.013665072619915009, -0.05779329314827919, 0.0428030826151371, 0.03271615505218506, -0.03253878653049469, -0.03294758126139641, -0.06067059561610222, 0.0019626407884061337, 0.00514662591740489, 0.01687275804579258, 0.0028971366118639708, 0.016622444614768028, -0.05382065102458, 0.023446543142199516, 0.021823184564709663, 0.04742566868662834, -0.10028132051229477, -0.027180487290024757, -0.03632550686597824, 0.0031703030690550804, -0.025894802063703537, 0.019296972081065178, 0.011466147378087044, -0.006438859738409519, 0.05948260426521301, -0.0048369839787483215, -0.0009123751660808921, 0.019448624923825264, 0.002900061197578907, -0.00656973198056221, 0.01920437067747116, 0.042294979095458984, 0.08641398698091507, -0.017168045043945312, -0.011924528516829014, 0.008484763093292713, 0.04320530965924263, 0.033678121864795685, -0.013783402740955353, 0.02849794365465641, 0.007931484840810299, 0.03731211647391319, 0.009475930593907833, 0.04441826790571213, 0.037331558763980865, -0.0018550649983808398, -0.04456079751253128, -0.02884271927177906, -0.014489460736513138, 0.008871291764080524, 0.023721326142549515, -0.012323210947215557, -0.012509318068623543, 0.026591788977384567, 0.055301863700151443, 0.04214569926261902, -0.0031038697343319654, 0.03416430205106735, 0.05883911997079849, -0.06451307982206345, -0.022363409399986267, 0.026275547221302986, 0.013465948402881622, -0.04352528229355812, -0.0307770948857069, -0.038591839373111725, -0.006079651415348053, -0.01960538700222969, 0.02682371996343136, -0.0033130557276308537, -0.059229619801044464, 0.019359903410077095, -0.03771330788731575, 0.0032745141070336103, 0.034592155367136, -0.021679559722542763, -0.07849124073982239, 0.046524327248334885, 0.05971614271402359, 0.003981189802289009, -0.04570687189698219, -0.008704252541065216, 0.021674590185284615, 0.02657127194106579, 0.023751279339194298, 0.000008861543392413296, -0.008659509010612965, 0.059292420744895935, 0.01046181470155716, 0.008942975662648678, 0.004774107597768307, 0.05275898054242134, -0.007544961292296648, 0.013625009916722775, 0.03970647603273392, 0.01725388690829277, -0.01173537690192461, -0.003919980023056269, -0.008471192792057991, 0.002784761367365718, -0.00836402177810669, -0.007307083811610937, 0.016454506665468216, -0.014982112683355808, 0.011213659308850765, 0.07132511585950851, -0.012430038303136826, -0.03197787329554558, 0.03721221908926964, -0.008802053518593311, 0.0014219203731045127, 0.022675178945064545, 0.05031055957078934, 0.014837064780294895, 0.03916752710938454, -0.01161523349583149, 0.04795491322875023, 0.007029780186712742, 0.03819568455219269, -0.01100219413638115, 0.018926825374364853, 0.018797198310494423, -0.02086559310555458, 0.001596170011907816, 0.010493321344256401, 0.023870766162872314, -0.016261912882328033, -0.040639977902173996, 0.015566565096378326, 0.018578926101326942, 0.018853282555937767, -0.0180673785507679, -0.033983632922172546, -0.014878197573125362, 0.0026357832830399275, 0.026316331699490547, -0.03236863389611244, 0.024570923298597336, 0.006991185247898102, 0.0036131632514297962, 0.0226522795855999, -0.008833321742713451, 0.00966422539204359, -0.0065479283221066, 0.003208999987691641, 0.014174973592162132, -0.029536288231611252, 0.008286336436867714, -0.0028538110200315714, 0.007156305946409702, 0.02556990459561348, -0.0013550978619605303, -0.0002774568274617195, 0.04854634404182434, -0.014304271899163723, -0.02340245433151722, 0.03437385335564613, 0.05668211728334427, -0.007863573729991913, -0.003839803859591484, 0.019259382039308548, 0.036714933812618256, -0.057175781577825546, -0.02446139045059681, -0.008958244696259499, 0.04005724564194679, 0.042234111577272415, -0.021583067253232002, -0.029351864010095596, 0.037228986620903015, -0.0016970161814242601, -0.034005966037511826, 0.03398316726088524, -0.00599312037229538, -0.0028654970228672028, 0.05442078784108162, 0.01567540504038334, 0.005417320411652327, -0.0060785929672420025, -0.018567757681012154, 0.019320013001561165, -0.015926361083984375, 0.0314280167222023, -0.029868127778172493, -0.02775687724351883, -0.029007472097873688, 0.0031868508085608482, -0.010093344375491142, -0.017522752285003662, 0.005307207815349102, 0.01845131628215313, -0.008250739425420761, 0.034018177539110184, -0.002351132221519947, 0.06694614887237549, 0.0011140325805172324, 0.05505840852856636, -0.0629417672753334, -0.0006837665569037199, 0.00013317038246896118, 0.004653278272598982, 0.027342835441231728, 0.04889655485749245, 0.034220125526189804, 0.0031843490432947874, -0.023839488625526428, 0.06981305778026581, -0.05062036216259003, 0.016304705291986465, -0.04048538953065872, 0.03498294577002525, -0.03112211264669895, 0.002237799810245633, 0.02755061723291874, -0.008810590952634811, -0.03954272344708443, 0.034894611686468124, 0.04657032713294029, -0.013696854002773762, -0.029827138409018517, 0.044785987585783005, 0.021428441628813744, 0.0082393204793334, -0.012033778242766857, -0.0023042126558721066, -0.009723356924951077, -0.014417271129786968, 0.009176778607070446, -0.03321494907140732, 0.03967578709125519, 0.0008446213905699551, -0.0322115533053875, -0.0611872598528862, 0.052087679505348206, 0.012799049727618694, 0.013041540049016476, -0.010334457270801067, -0.004162638448178768, 0.015358253382146358, -0.009896382689476013, 0.003913369029760361, -0.010956015437841415, 0.03252286836504936, -0.028492232784628868, 0.030739756301045418, 0.015765449032187462, 0.008476085029542446, -0.05290445685386658, 0.005182798020541668, 0.02505095861852169, 0.04588362202048302, -0.0031985114328563213, 0.012166507542133331, -0.017603229731321335, 0.016761500388383865, -0.007783358450978994, -0.028346601873636246, -0.025986578315496445, -0.0017634527757763863, 0.0052229561842978, -0.032635483890771866, 0.018032746389508247, 0.03209694102406502, -0.026869332417845726, -0.027147449553012848, 0.005555720534175634, 0.0016822005854919553, -0.023546447977423668, 0.004026020411401987, -0.021946584805846214, -0.024508802220225334, -0.003229130757972598, -0.002896705875173211, -0.03011356107890606, -0.005352712702006102, -0.001921838615089655, 0.009929366409778595, -0.04006917029619217, -0.0021492044907063246, -0.03735392540693283, -0.0324847549200058, 0.057254210114479065, -0.006135920062661171, 0.005789231974631548, 0.008406475186347961, 0.011982160620391369, 0.02381867542862892, -0.011461195535957813, -0.009942380711436272, 0.006197948940098286, 0.004357796628028154, 0.027535216882824898, -0.010936602018773556, 0.08739583939313889, -0.012217484414577484, 0.038510020822286606, 0.014429979026317596, 0.028108829632401466, 0.06309223920106888, -0.01785264164209366, -0.015032457187771797, -0.0007647675229236484, 0.061769258230924606, -0.018683524802327156, 0.020617932081222534, 0.027865584939718246, -0.014632166363298893, -0.026926010847091675, 0.0134119326248765, 0.008786208927631378, -0.02320033311843872, 0.009119641035795212, 0.013082929886877537, -0.007578461896628141, 0.02385740913450718, -0.02760748192667961, 0.03157709911465645, 0.007033300586044788, -0.03666878864169121, 0.019719894975423813, -0.010566284880042076, -0.025359349325299263, -0.015546579845249653, -0.019204627722501755, -0.0422106496989727, -0.006372151430696249, 0.008613432757556438, 0.02418239787220955, 0.04094444215297699, 0.06440955400466919, -0.021797023713588715, -0.007907739840447903, 0.010091892443597317, -0.00011601939331740141, -0.02415657974779606, 0.0020026592537760735, 0.028964877128601074, 0.005639863666146994, 0.06427200138568878, -0.003565541934221983, -0.04741048067808151, 0.03389320895075798, 0.009790719486773014, -0.030767321586608887, -0.018579989671707153, -0.005635433364659548, 0.0005949268816038966, 0.01212204061448574, 0.02053508162498474, -0.024012500420212746, 0.012802098877727985, -0.05140674114227295, -0.01046763639897108, 0.0028688234742730856, -0.017810776829719543, 0.0077084992080926895, 0.023117370903491974, 0.010707520879805088, 0.0016415792051702738, 0.06464609503746033, -0.002827191259711981, 0.020317230373620987, 0.027363207191228867, 0.00345449591986835, -0.02477921172976494, 0.008822323754429817, -0.01058015413582325, 0.0029678891878575087, -0.02456747740507126, 0.05294368416070938, -0.0028423937037587166, -0.0523291677236557, 0.000380857614800334, -0.04954119771718979, 0.06480637937784195, -0.017805730924010277, 0.01715303584933281, 0.0063566346652805805, 0.011430349200963974, -0.028252726420760155, -0.018773458898067474, -0.0044057369232177734, -0.07274104654788971, -0.008144843392074108, -0.003770005190744996, -0.029260413721203804, -0.010158712975680828, 0.02387792244553566, 0.013995734043419361, -0.02929738163948059, -0.004911279305815697, 0.01965036243200302, 0.05813148617744446, -0.011504588648676872, 0.0436372347176075, -0.02190348692238331, 0.013644390739500523, 0.01341665256768465, 0.06412027776241302, -0.01889648102223873, 0.016941171139478683, 0.017179502174258232, -0.021403197199106216, 0.010514569468796253, 0.02065911330282688, 0.0451156422495842, 0.020444141700863838, 0.016338935121893883, 0.007749741431325674, -0.02024225704371929, -0.019679225981235504, 0.0034380287397652864, -0.012742938473820686, -0.0009058520663529634, -0.0008239944581873715, 0.010729078203439713, -0.01883811317384243, -0.04416585713624954, 0.008297234773635864, 0.04269371181726456, -0.03519881144165993, -0.03687560558319092, -0.030634557828307152, -0.06666655093431473, -0.03455326333642006, 0.05273817479610443, -0.019556695595383644, -0.002833162434399128, -0.0005231210379861295, -0.039131008088588715, -0.018676897510886192, -0.019927332177758217, 0.01891874521970749, 0.010579603724181652, 0.006260124500840902, -0.029910027980804443, -0.02834756299853325, 0.012872446328401566, 0.005994049366563559, -0.015120157971978188, 0.032948706299066544, -0.004680423531681299, 0.003763994202017784, -0.005230987444519997, -0.0010867869714275002, -0.018240585923194885, -0.039875518530607224, 0.016455326229333878, 0.030979566276073456, 0.02289270982146263, -0.0005326089449226856, 0.019746381789445877, -0.019171882420778275, 0.005813330411911011, 0.03436378762125969, -0.03800179064273834, 0.002330994000658393, -0.03087959624826908, -0.04849034175276756, 0.04448525235056877, -0.02061433531343937, -0.05570249259471893, 0.012889032252132893, 0.018654460087418556, -0.004915860015898943, 0.020117921754717827, 0.014560780487954617, -0.03475123271346092, -0.0031193261966109276, 0.03887803480029106, -0.0028027493972331285, 0.0017870392184704542, 0.03938586637377739, 0.0338728129863739, -0.006059413775801659, -0.033074457198381424 ]
Scaling-up BERT Inference on CPU (Part 1)
mfuntowicz
April 20, 2021
bert-cpu-scaling-part-1
guide, nlp, partnerships, intel
https://huggingface.co/blog/bert-cpu-scaling-part-1
5.3. Leveraging Multi-Socket servers and CPU affinity Nowadays servers bring many cores, some of them even support multi-socket setups (i.e. multiple CPUs on the motherboard). On Linux, the command lscpu reports all the specifications and topology of the CPUs present on the system: shell ubuntu@some-ec2-machine:~$ lscpu Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian Address sizes: 46 bits physical, 48 bits virtual CPU(s): 96 On-line CPU(s) list: 0-95 Thread(s) per core: 2 Core(s) per socket: 24 Socket(s): 2 NUMA node(s): 2 Vendor ID: GenuineIntel CPU family: 6 Model: 85 Model name: Intel(R) Xeon(R) Platinum 8275CL CPU @ 3.00GHz Stepping: 7 CPU MHz: 1200.577 CPU max MHz: 3900.0000 CPU min MHz: 1200.0000 BogoMIPS: 6000.00 Virtualization: VT-x L1d cache: 1.5 MiB L1i cache: 1.5 MiB L2 cache: 48 MiB L3 cache: 71.5 MiB NUMA node0 CPU(s): 0-23,48-71 NUMA node1 CPU(s): 24-47,72-95 In our case we have a machine with 2 sockets, each socket providing 24 physical cores with 2 threads per cores (SMT). Another interesting characteristic is the notion of NUMA node (0, 1) which represents how cores and memory are being mapped on the system. Non-Uniform Memory Access (NUMA) is the opposite of Uniform Memory Access (UMA) where the whole memory pool is accessible by all the cores through a single unified bus between sockets and the main memory. NUMA on the other hand splits the memory pool and each CPU socket is responsible to address a subset of the memory, reducing the congestion on the bus. Figure 5. Difference illustration of UMA and NUMA architectures (source (15)) In order to fully utilize the potential of such a beefy machine, we need to ensure our model instances are correctly dispatched across all the physical cores on all sockets along with enforcing memory allocation to be "NUMA-aware". On Linux, NUMA's process configuration can be tuned through numactl which provides an interface to bind a process to a set of CPU cores (referred as Thread Affinity). Also, it allows tuning the memory allocation policy, making sure the memory allocated for the process is as close as possible to the cores' memory pool (referred as Explicit Memory Allocation Directives). Note: Setting both cores and memory affinities is important here. Having computations done on socket 0 and memory allocated on socket 1 would ask the system to go over the sockets shared bus to exchange memory, thus leading to an undesired overhead.
[ 0.0470106266438961, 0.037955790758132935, 0.03597920015454292, -0.036934491246938705, 0.025694523006677628, -0.03943471610546112, 0.01820322871208191, 0.09927942603826523, -0.04680945351719856, -0.07443343102931976, -0.001992324599996209, 0.06979008764028549, 0.0013704253360629082, 0.013871923089027405, -0.021267948672175407, -0.034117355942726135, 0.029009545221924782, -0.005213667638599873, 0.030109496787190437, 0.04447181895375252, 0.099330835044384, 0.037340015172958374, 0.03280411660671234, 0.01746668666601181, -0.009943671524524689, 0.034054819494485855, -0.030394297093153, 0.012848474085330963, -0.02104398049414158, -0.0036590120289474726, -0.09463518112897873, 0.036982301622629166, -0.012085530906915665, -0.033377714455127716, 0.03744116425514221, -0.0016782135935500264, -0.06075844541192055, 0.09642314165830612, 0.02024012990295887, -0.06428759545087814, 0.006782853044569492, -0.08326923847198486, -0.009835340082645416, 0.060801684856414795, -0.012198971584439278, -0.0017742208437994123, -0.0532381534576416, 0.024262581020593643, -0.04499833285808563, 0.022359002381563187, -0.06845306605100632, -0.018985159695148468, 0.005392381921410561, 0.032687731087207794, 0.003619528841227293, 0.03137654438614845, -0.014586244709789753, 0.004191245883703232, 0.07549547404050827, 0.029240157455205917, 0.06238182261586189, 0.02063022181391716, 0.014621434733271599, -0.008164922706782818, -0.03484842926263809, 0.0017097381642088294, -0.04890146851539612, -0.04824582114815712, -0.0473765954375267, 0.022617999464273453, 0.020641816779971123, -0.0017584592569619417, -0.032633353024721146, -0.027777450159192085, 0.038038093596696854, -0.061136577278375626, -0.024220183491706848, -0.007807635236531496, 0.049037620425224304, 0.04811806604266167, -0.0581490620970726, 0.06950860470533371, 0.04528310149908066, -0.0010814206907525659, 0.05802111327648163, -0.08408590406179428, 0.022463370114564896, 0.08453642576932907, 0.0065752314403653145, 0.0228982325643301, 0.02243800275027752, -0.03532199189066887, 0.019149810075759888, 0.014879160560667515, -0.014589688740670681, -0.009581604041159153, 0.03466619551181793, 0.029487524181604385, 0.0822283923625946, 0.029036113992333412, 0.02755528874695301, 0.006764428690075874, 0.06025933846831322, -0.006421876139938831, -0.04059716314077377, -0.018156716600060463, -0.0005332076689228415, -0.022544972598552704, -0.08825211226940155, 0.01774883270263672, -0.07123024016618729, -0.05915144830942154, 0.012930359691381454, 0.05254058539867401, -0.0637931227684021, 0.027184436097741127, -0.006383211817592382, -0.07046344876289368, 0.015909122303128242, -0.054111890494823456, -0.01078018732368946, 0.0670001283288002, 0.07269014418125153, 0.02722812071442604, 0.014241909608244896, -0.009431464597582817, 0.0493752546608448, -0.022005697712302208, 0.002947788452729583, -0.07041098922491074, 0.02171596884727478, 0.037663403898477554, 0.022328970953822136, -0.015252715907990932, -0.02517642453312874, -0.03324860706925392, -0.038557764142751694, 0.0014917326625436544, -0.0015402031131088734, 0.006422009319067001, -0.049058180302381516, -0.041349396109580994, 0.02337489277124405, 0.01612449623644352, 0.02885618433356285, 0.006371161434799433, -0.035242870450019836, -0.039918575435876846, 0.015210242010653019, -0.04265190660953522, -0.0707157626748085, 0.026309948414564133, 0.013828150928020477, -0.04275364428758621, 0.07862187922000885, 0.055116329342126846, 0.027685893699526787, -0.0272284597158432, -0.1405017226934433, -0.02027692086994648, -0.02089640125632286, -0.059504054486751556, -0.06582330912351608, 0.027133291587233543, -0.01509567815810442, 0.052838996052742004, 0.011004186235368252, -0.018074939027428627, 0.08465375751256943, 0.07867202162742615, -0.01672353595495224, 0.04633927717804909, 0.03185515105724335, 0.024053629487752914, 0.019812682643532753, -0.004262516275048256, 0.09678828716278076, 0.055917609483003616, 0.0056930105201900005, -0.019443826749920845, 0.0041886246763169765, -0.02142970822751522, -0.009739152155816555, 0.13557392358779907, -0.017544137313961983, -0.05120766535401344, 0.004246592056006193, -0.03976280242204666, 0.0338224396109581, 0.07129096239805222, 0.03629448637366295, -0.039506349712610245, 0.020722100511193275, 0.02785542979836464, 0.05809181556105614, 0.022806990891695023, -0.07809421420097351, 0.07345311343669891, 0.0720725730061531, 0.03134375065565109, 0.026982435956597328, -0.023368069902062416, 0.0026905627455562353, 0.06397032737731934, -0.11244373768568039, -0.021131642162799835, -0.04117373004555702, -0.08548762649297714, 0.054926030337810516, -0.01818801835179329, -0.04588347673416138, -0.07895718514919281, -0.06119171902537346, 0.020115291699767113, -0.00510855158790946, -0.0011952356435358524, 0.03256094828248024, -0.04883403331041336, 0.036251865327358246, -0.08464426547288895, 0.11176195740699768, -0.005354787223041058, 0.011075016111135483, 0.04155699163675308, -0.004964251536875963, 0.026519397273659706, 0.06432444602251053, -0.00659519899636507, 0.03847828507423401, -0.02171242982149124, 0.039483506232500076, 0.0015167228411883116, -0.05303850397467613, 0.07075132429599762, 0.06704588979482651, 0.06952966004610062, -0.027063816785812378, 0.13222336769104004, 0.0735841691493988, -0.10588626563549042, 0.0009596236050128937, 0.012555998750030994, -0.032021645456552505, 0.019359463825821877, 0.014173460192978382, -0.06390485167503357, 0.011110383085906506, -0.051399558782577515, -0.019385553896427155, 0.012307590804994106, -0.044798679649829865, -0.07439707964658737, -0.015209587290883064, -0.01748560182750225, 0.058766499161720276, -0.1011633649468422, -0.008660506457090378, -0.0063768713735044, -0.03531991317868233, 0.01845771260559559, -0.004975350107997656, -0.013757826760411263, -0.020453406497836113, -0.05508141592144966, 0.008157736621797085, 0.014991243369877338, 0.010185868479311466, -0.021616404876112938, 0.046295687556266785, 0.006932075601071119, -0.03060147725045681, -0.03646424785256386, 0.039037492126226425, -0.011790916323661804, -0.007511653937399387, -0.035497575998306274, -0.015830092132091522, 0.010013175196945667, 0.018777640536427498, 0.009827316738665104, -0.011613310314714909, -0.009945138357579708, 0.04232307896018028, -0.025652773678302765, -0.05867255479097366, 0.015399882569909096, 0.004093768075108528, -0.013514968566596508, -0.04161877930164337, -0.03314567357301712, -0.003498669480904937, 0.0012706315610557795, -0.002822359325364232, -0.02041584812104702, 0.014961158856749535, -0.007339448668062687, -0.024065742269158363, -0.006719481199979782, -0.053164612501859665, -0.04144895076751709, 0.011182039976119995, -0.00456105824559927, -0.011843550018966198, 0.0033835896756500006, -0.048925358802080154, 0.02763921022415161, 0.01120783295482397, 0.05353301763534546, -0.09112486988306046, -0.0019249699544161558, 0.029118601232767105, 0.014026756398379803, -0.009483259171247482, -0.008742242120206356, 0.02663065679371357, -0.00048150020302273333, 0.06676267832517624, 0.005471087526530027, 0.0070856474339962006, 0.033068884164094925, 0.004628496244549751, -0.009101901203393936, 0.020877037197351456, 0.0662899762392044, 0.02565939724445343, -0.0036330160219222307, -0.02628442272543907, -0.053644198924303055, 0.004838669206947088, -0.0031939989421516657, -0.02675500698387623, 0.02522125095129013, -0.040514472872018814, 0.03620661050081253, 0.02134070359170437, 0.03830087184906006, 0.043487194925546646, -0.07025041431188583, -0.06937503814697266, 0.01806105673313141, -0.012617611326277256, -0.031236330047249794, -0.0281673576682806, -0.04660337045788765, 0.025014054030179977, -0.003725990653038025, 0.054901618510484695, 0.0016542768571525812, -0.035819027572870255, 0.007468546740710735, 0.08211849629878998, -0.06403645873069763, -0.005669946316629648, 0.016971610486507416, -0.021641412749886513, -0.02575671300292015, -0.0012272691819816828, -0.022045617923140526, -0.00974002294242382, -0.013597163371741772, -0.004889366216957569, 0.021919870749115944, -0.05025717243552208, -0.0072358050383627415, -0.0495934933423996, 0.040171071887016296, 0.02658199518918991, -0.025921443477272987, -0.07460256665945053, -0.021091777831315994, 0.044652704149484634, 0.02113346941769123, -0.04914505034685135, 0.02258879877626896, 0.00928143784403801, 0.0012095115380361676, 0.0024981831666082144, 0.0360148623585701, -0.0036432347260415554, 0.011152580380439758, 0.026197614148259163, 0.0012659941567108035, -0.019152360036969185, -0.005768998526036739, -0.024461211636662483, 0.040310874581336975, 0.02489347569644451, 0.01801498606801033, 0.010218152776360512, 0.006874431390315294, -0.031578194350004196, -0.02405102364718914, 0.0022876833099871874, -0.01587815210223198, -0.028037752956151962, -0.0008365935645997524, -0.009333943948149681, 0.03998267278075218, -0.03572780266404152, -0.0554395355284214, 0.011653043329715729, -0.0005374079919420183, 0.0006119108875282109, 0.05179396644234657, -0.01728654094040394, 0.01804405078291893, -0.007434844970703125, 0.002754178363829851, 0.054386187344789505, 0.020525658503174782, 0.030316805467009544, -0.011252348311245441, 0.03262026607990265, 0.015887754037976265, 0.0002669172245077789, -0.0027376748621463776, 0.0242279265075922, 0.02650589495897293, 0.005330842919647694, 0.012088049203157425, 0.029781825840473175, -0.009276170283555984, 0.028868824243545532, 0.04386111721396446, -0.0550447553396225, 0.013214712962508202, 0.03245674446225166, 0.02291416935622692, -0.006894733291119337, 0.018187200650572777, 0.012489676475524902, -0.018546583130955696, -0.015693850815296173, -0.04892542585730553, 0.0011853753821924329, -0.016333863139152527, -0.005667577031999826, 0.024571454152464867, -0.01933782920241356, -0.007075941655784845, 0.03928236663341522, 0.03583307936787605, -0.004736996255815029, -0.00800375547260046, -0.02196870557963848, 0.03589615225791931, 0.0444212332367897, -0.02148004062473774, -0.004027926828712225, 0.0906701534986496, 0.021174972876906395, -0.023724855855107307, -0.02747943252325058, 0.04093974083662033, -0.01818162202835083, -0.019081739708781242, 0.013591775670647621, 0.032411448657512665, 0.03239576518535614, -0.008326075971126556, -0.0011687156511470675, 0.023158369585871696, 0.022490134462714195, 0.008576175197958946, 0.02294723317027092, 0.01745036244392395, -0.0016216258518397808, 0.03772304579615593, -0.007898444309830666, -0.04622625187039375, -0.015423586592078209, -0.02493109554052353, -0.006377126555889845, -0.017815886065363884, 0.031179456040263176, -0.04216744750738144, -0.03190875053405762, 0.00042445873259566724, -0.030102910473942757, 0.04058085381984711, 0.0034907793160527945, 0.0027684224769473076, 0.06798170506954193, 0.026697339490056038, 0.04475390911102295, 0.01998097077012062, 0.043378520756959915, -0.01690324954688549, 0.008397521451115608, 0.0043898387812078, -0.00766519270837307, 0.006377239711582661, 0.008666092529892921, 0.018746329471468925, 0.039519306272268295, -0.0018814430804923177, 0.042789701372385025, -0.031753044575452805, 0.02071346528828144, -0.0149959372356534, 0.03916570916771889, -0.01035910751670599, 0.023020002990961075, -0.029095912352204323, -0.023785274475812912, 0.037824977189302444, 0.013688185252249241, -0.01691504940390587, 0.017405761405825615, 0.0256512388586998, -0.025999929755926132, 0.0045154704712331295, -0.00857812911272049, 0.018156085163354874, 0.03035403974354267, -0.0573340579867363, -0.014578516595065594, -0.009471951983869076, -0.013426457531750202, -0.011452113278210163, -0.04080716893076897, 0.015157048590481281, 0.04666309431195259, -0.02272859588265419, -0.051534172147512436, -0.02129938267171383, -0.000609689683187753, -0.02483431063592434, 0.01853206567466259, 0.0037259275559335947, 0.010076337493956089, 0.021330079063773155, 0.0010809417581185699, -0.018793318420648575, -0.04480715095996857, -0.03950779139995575, 0.01022912748157978, 0.002611571690067649, 0.06836530566215515, -0.044081684201955795, -0.012523342855274677, 0.03437523543834686, 0.04201873764395714, 0.019399583339691162, 0.012140534818172455, -0.04398474097251892, 0.0003874179965350777, 0.017897168174386024, -0.008828702382743359, -0.0475667379796505, 0.02472183294594288, -0.015729835256934166, -0.0658329501748085, -0.038664281368255615, 0.05390249565243721, 0.06251269578933716, -0.01991841569542885, -0.01534164696931839, -0.051466647535562515, -0.037782832980155945, -0.026323946192860603, 0.014136851765215397, -0.004261891357600689, -0.004035094287246466, -0.021864186972379684, -0.025998689234256744, 0.0012543649645522237, -0.04748139902949333, 0.014197896234691143, -0.02950478531420231, 0.0382000170648098, -0.007439365144819021, -0.015614436939358711, 0.004279961343854666, -0.021428991109132767, -0.02039734646677971, -0.006325834430754185, 0.019834104925394058, -0.023976285010576248, -0.023057570680975914, -0.025397054851055145, 0.011534392833709717, -0.018486008048057556, 0.025098014622926712, 0.003508784342557192, 0.06115268915891647, -0.015613069757819176, 0.04252556711435318, 0.0008732333080843091, 0.04525133967399597, 0.04556959122419357, 0.003576964372768998, -0.026911992579698563, 0.03237740322947502, 0.028468400239944458, 0.007317465264350176, 0.0405484177172184, -0.009419232606887817, -0.03296744450926781, -0.022410890087485313, -0.02568170800805092, 0.019298318773508072, -0.0384550467133522, 0.06499999016523361, 0.0031773147638887167, 0.0014584377640858293, 0.005909105762839317, -0.0037753607612103224, 0.04880833998322487, 0.04367651045322418, -0.023631131276488304, 0.014151684008538723, 0.0029089022427797318, -0.07728899270296097, -0.03434109687805176, 0.02598997950553894, -0.02959371544420719, -0.0006745604332536459, 0.012158884666860104, 0.037892766296863556, 0.0035089808516204357, 0.05117826536297798, 0.01508014090359211, -0.02627450041472912, 0.0026009895373135805, -0.02422182634472847, -0.02432321384549141, -0.014747297391295433, 0.022341523319482803, -0.002133985748514533, 0.03862740471959114, 0.004270278383046389, -0.023461496457457542, 0.006752672605216503, -0.01688006892800331, -0.04241522029042244, -0.00210402300581336, 0.0076094395481050014, -0.011251760646700859, -0.00044958919170312583, -0.011102949269115925, -0.05181184783577919, -0.0003213929303456098, -0.05131687596440315, -0.022439396008849144, 0.008905710652470589, -0.0522833876311779, 0.0016456447774544358, 0.017103642225265503, 0.04252219572663307, 0.04124630242586136, 0.06389395147562027, -0.005567074287682772, -0.014984250999987125, 0.05414440855383873, -0.001107325660996139, 0.02697836607694626, 0.010896753519773483, -0.0062763020396232605, -0.010736978612840176, -0.011757627129554749, 0.013061481527984142, -0.01890038140118122, -0.05791527405381203, 0.009528516791760921, -0.03496229276061058, 0.0610220730304718, -0.0302997175604105, 0.003182870103046298, 0.021619223058223724, 0.010676957666873932, -0.007201599422842264, -0.051001083105802536, -0.012202034704387188, -0.017124101519584656, -0.011426432989537716, 0.0373174212872982, -0.042863551527261734, -0.023475484922528267, 0.020721957087516785, 0.026381216943264008, 0.012127104215323925, -0.030523736029863358, 0.05059228837490082, 0.0013029666151851416, 0.024724915623664856, -0.0018384149298071861, -0.03696959465742111, 0.06882888823747635, 0.016442187130451202, 0.012268799357116222, -0.030315419659018517, -0.001620596507564187, 0.009128349833190441, 0.012834546156227589, 0.014552044682204723, -0.0033004332799464464, 0.04334907606244087, 0.00026447969139553607, 0.0014475566567853093, -0.01963651366531849, -0.043845999985933304, 0.012406956404447556, 0.046021584421396255, -0.05567390099167824, 0.015070481225848198, 0.008398056030273438, -0.021905768662691116, -0.008027945645153522, -0.014632589183747768, -0.00825780164450407, 0.04673951119184494, -0.007495029363781214, 0.027198893949389458, -0.06764817982912064, -0.05502776801586151, -0.006792600732296705, 0.006694157142192125, 0.010413444600999355, 0.034103453159332275, 0.01493742223829031, -0.04343179613351822, -0.023060258477926254, 0.014345245435833931, 0.029405368492007256, -0.025199290364980698, -0.008086485788226128, 0.009703287854790688, -0.018361810594797134, -0.033219799399375916, 0.0076554580591619015, -0.02237260900437832, 0.04500875249505043, -0.03131478279829025, 0.02614118531346321, -0.00026629853527992964, -0.00421122508123517, -0.0046967146918177605, -0.0006206557154655457, 0.03387385606765747, 0.008937734179198742, 0.005755579099059105, 0.02487299218773842, -0.012271479703485966, 0.016345279291272163, 0.04272785410284996, 0.05081329122185707, 0.006368850823491812, -0.029037635773420334, -0.010029962286353111, -0.0835326761007309, 0.04802652448415756, -0.048220232129096985, -0.05668915808200836, -0.023467980325222015, 0.005915562156587839, -0.03816797584295273, 0.01589423418045044, -0.02449319325387478, -0.02903003804385662, 0.00012360657274257392, 0.03817112371325493, -0.0031057815067470074, 0.0255841463804245, 0.01601647585630417, 0.04542269930243492, 0.03191118314862251, -0.031886640936136246 ]
Scaling-up BERT Inference on CPU (Part 1)
mfuntowicz
April 20, 2021
bert-cpu-scaling-part-1
guide, nlp, partnerships, intel
https://huggingface.co/blog/bert-cpu-scaling-part-1
5.4. Tuning Thread Affinity & Memory Allocation Policy Now that we have all the knobs required to control the resources' allocation of our model instances we go further and see how to effectively deploy those and see the impact on latency and throughput. Let's go gradually to get a sense of what is the impact of each command and parameter. First, we start by launching our inference model without any tuning, and we observe how the computations are being dispatched on CPU cores (Left). shell python3 src/main.py model=bert-base-cased backend.name=pytorch batch_size=1 sequence_length=128 Then we specify the core and memory affinity through numactl using all the physical cores and only a single thread (thread 0) per core (Right): shell numactl -C 0-47 -m 0,1 python3 src/main.py model=bert-base-cased backend.name=pytorch batch_size=1 sequence_length=128 Figure 6. Linux htop command side-by-side results without & with Thread Affinity set As you can see, without any specific tuning, PyTorch and TensorFlow dispatch the work on a single socket, using all the logical cores in that socket (both threads on 24 cores). Also, as we highlighted earlier, we do not want to leverage the SMT feature in our case, so we set the process' thread affinity to target only 1 hardware thread. Note, this is specific to this run and can vary depending on individual setups. Hence, it is recommended to check thread affinity settings for each specific use-case. Let's take sometime from here to highlight what we did with numactl: - -C 0-47 indicates to numactl what is the thread affinity (cores 0 to 47). - -m 0,1 indicates to numactl to allocate memory on both CPU sockets If you wonder why we are binding the process to cores [0...47], you need to go back to look at the output of lscpu. From there you will find the section NUMA node0 and NUMA node1 which has the form NUMA node<X> <logical ids> In our case, each socket is one NUMA node and there are 2 NUMA nodes. Each socket or each NUMA node has 24 physical cores and 2 hardware threads per core, so 48 logical cores. For NUMA node 0, 0-23 are hardware thread 0 and 24-47 are hardware thread 1 on the 24 physical cores in socket 0. Likewise, for NUMA node 1, 48-71 are hardware thread 0 and 72-95 are hardware thread 1 on the 24 physical cores in socket 1. As we are targeting just 1 thread per physical core, as explained earlier, we pick only thread 0 on each core and hence logical processors 0-47. Since we are using both sockets, we need to also bind the memory allocations accordingly (0,1). Please note that using both sockets may not always give the best results, particularly for small problem sizes. The benefit of using compute resources across both sockets might be reduced or even negated by cross-socket communication overhead.
[ 0.03679041564464569, 0.020722320303320885, -0.035103294998407364, 0.01265809964388609, -0.018757939338684082, 0.0025545377284288406, 0.026300564408302307, 0.04052993282675743, -0.019936084747314453, -0.04292871430516243, -0.055419694632291794, 0.026463676244020462, 0.012076050974428654, 0.028402211144566536, -0.017762238159775734, -0.01389042753726244, 0.04648110643029213, -0.03140606731176376, -0.014150839298963547, 0.07578932493925095, 0.11309989541769028, -0.019789284095168114, 0.04675154760479927, 0.035594917833805084, 0.002757473848760128, -0.018126271665096283, -0.02046462893486023, 0.04266602173447609, -0.03723747283220291, 0.029056288301944733, -0.14416611194610596, -0.010742462240159512, -0.008444586768746376, -0.0040404582396149635, 0.01924530789256096, 0.013539108447730541, -0.06983533501625061, 0.07118983566761017, 0.03718340024352074, -0.02064359001815319, -0.0019866423681378365, -0.08609335869550705, -0.04455912858247757, 0.02420181967318058, 0.020967068150639534, -0.011625098064541817, 0.03163131698966026, 0.028955474495887756, 0.010489556938409805, -0.01860111765563488, -0.11466051638126373, -0.0018049912760034204, 0.045748528093099594, 0.0019036107696592808, -0.0038322426844388247, 0.04312149062752724, -0.035968393087387085, -0.044770948588848114, 0.01315231341868639, 0.03974026441574097, 0.023785334080457687, -0.021364200860261917, 0.02825588919222355, 0.0685516744852066, -0.0077084265649318695, 0.0024435557425022125, -0.040061499923467636, -0.025727754458785057, -0.0357496403157711, 0.028475968167185783, 0.013698779046535492, -0.006300393026322126, -0.0035166912712156773, -0.00527977105230093, -0.048654090613126755, -0.01768486388027668, -0.04452085867524147, 0.015018806792795658, 0.044337864965200424, 0.07136128842830658, -0.02995467744767666, 0.08038648962974548, 0.02892720326781273, 0.019998012110590935, 0.07570050656795502, 0.004975378513336182, 0.01856185868382454, 0.017691997811198235, -0.00042336483602412045, 0.01126938033849001, -0.04251764342188835, -0.07044710963964462, 0.05056289955973625, -0.010526858270168304, 0.02118459716439247, -0.03541065379977226, 0.03418920934200287, 0.007876625284552574, 0.011833015829324722, -0.000366391206625849, 0.055331431329250336, -0.042834941297769547, 0.010931262746453285, 0.01386996079236269, -0.08323770016431808, 0.08067057281732559, 0.029394326731562614, -0.06799472868442535, -0.06305470317602158, 0.03639969974756241, -0.04652121290564537, -0.026101021096110344, -0.026217643171548843, 0.009965835139155388, -0.06296658515930176, -0.06423409283161163, -0.03341565281152725, -0.02667592652142048, 0.023978842422366142, 0.03450196236371994, -0.011061572469770908, 0.09252122789621353, 0.032617583870887756, -0.028093308210372925, -0.03484184667468071, 0.044244956225156784, 0.0328507199883461, -0.0020888426806777716, 0.05943171679973602, -0.03527294099330902, 0.05970808118581772, -0.010162421502172947, 0.0572635754942894, -0.04852290078997612, -0.025661993771791458, -0.05647341161966324, -0.03065207414329052, -0.04831966757774353, 0.009018391370773315, -0.01649113930761814, -0.025748055428266525, -0.002732630120590329, 0.015707945451140404, -0.002826506970450282, 0.04744575172662735, 0.0038295157719403505, -0.07285119593143463, 0.029321322217583656, 0.011188521049916744, 0.0029300381429493427, -0.1356954276561737, 0.062143903225660324, 0.01041455753147602, -0.0317317396402359, 0.03396106883883476, 0.08529196679592133, -0.01587124541401863, -0.0025550031568855047, -0.10577327013015747, -0.01560985017567873, -0.03177342936396599, -0.01916012167930603, -0.03654831647872925, -0.030412012711167336, 0.01130047906190157, 0.04222716763615608, 0.0643189325928688, -0.027135852724313736, -0.02281254529953003, 0.0034834742546081543, 0.029784904792904854, 0.030847450718283653, 0.04496283829212189, -0.06913740187883377, 0.009419210255146027, 0.01877651736140251, 0.018519625067710876, 0.03737263008952141, -0.027138449251651764, -0.02685055136680603, -0.03212360665202141, 0.06488250195980072, -0.06089765951037407, 0.09995011985301971, 0.006447860039770603, -0.07962976396083832, 0.04746643453836441, -0.056886225938797, -0.04633583500981331, 0.03645763173699379, -0.008158428594470024, -0.01671086810529232, 0.09785964339971542, -0.020893946290016174, 0.056830789893865585, 0.01724288798868656, -0.06305461376905441, 0.0885174348950386, 0.09311032295227051, 0.018369602039456367, 0.03666726499795914, 0.015166027471423149, 0.007941102609038353, 0.03290669247508049, -0.05247560143470764, -0.02065395563840866, -0.07604926824569702, -0.10862427204847336, 0.02286948449909687, 0.04307197779417038, 0.0021062111482024193, -0.09471512585878372, -0.052734553813934326, -0.03495350852608681, 0.04296935349702835, -0.03539087250828743, 0.041034262627363205, -0.06101776659488678, 0.033074751496315, -0.05544643476605415, 0.12650790810585022, -0.06482840329408646, 0.013728814199566841, 0.004080727230757475, -0.025311244651675224, -0.0443507619202137, 0.014374487102031708, 0.023337898775935173, 0.042480241507291794, -0.05448833107948303, 0.028208959847688675, 0.003696988569572568, -0.039682015776634216, 0.11598305404186249, -0.005904277786612511, 0.013831793330609798, -0.060804884880781174, 0.13562679290771484, 0.023703668266534805, -0.1250714212656021, -0.04338015243411064, 0.07874733954668045, -0.013417473062872887, 0.03644736483693123, -0.050254080444574356, 0.012427198700606823, 0.024389810860157013, -0.055258117616176605, -0.019062496721744537, -0.026822827756404877, -0.0789240300655365, -0.05444620922207832, 0.008985031396150589, -0.07300794124603271, 0.056575097143650055, -0.036255910992622375, 0.0025057147722691298, -0.022070875391364098, -0.02778596803545952, 0.02772624045610428, 0.023274926468729973, 0.00999332033097744, -0.01754896156489849, -0.02065894939005375, 0.00971927959471941, -0.042373351752758026, 0.02956574410200119, -0.04761574789881706, 0.014227394945919514, 0.0038423689547926188, -0.03131914883852005, -0.03772649168968201, 0.058076951652765274, -0.012819616124033928, 0.0124381547793746, 0.026462189853191376, 0.04587581008672714, -0.016993379220366478, -0.016651727259159088, 0.002344575710594654, -0.02542993798851967, -0.02250402234494686, -0.0021507483907043934, -0.002474268199875951, -0.06350448727607727, 0.04040117934346199, -0.00598791753873229, 0.006743296980857849, -0.02785683423280716, 0.018309736624360085, 0.025528451427817345, -0.022459179162979126, 0.009428095072507858, -0.026273036375641823, 0.021144742146134377, 0.04434678703546524, -0.028981324285268784, -0.01608322188258171, 0.002870804164558649, -0.035358551889657974, -0.020803872495889664, 0.026513388380408287, -0.03419193625450134, 0.019537419080734253, -0.04166029393672943, 0.01991921477019787, 0.023538406938314438, 0.033880334347486496, -0.07713575661182404, -0.003514786483719945, -0.011037669144570827, -0.001977090025320649, -0.021538428962230682, -0.003222518367692828, 0.026737729087471962, 0.007905879989266396, 0.010665299370884895, 0.018081912770867348, -0.013995316810905933, 0.025032537057995796, -0.007193153724074364, -0.010149954818189144, 0.015801360830664635, 0.03149125352501869, 0.010108867660164833, -0.030272075906395912, -0.02052372694015503, -0.02529134228825569, 0.013776296749711037, 0.003365417243912816, -0.005061022937297821, 0.03631513565778732, 0.029532162472605705, 0.03737623244524002, -0.037400852888822556, 0.039555903524160385, 0.0401320718228817, -0.043592095375061035, -0.05095358192920685, -0.018277598544955254, 0.001651770668104291, -0.04733801260590553, 0.006900288164615631, -0.042300064116716385, -0.005045281257480383, 0.021666966378688812, 0.01927575282752514, 0.04088733345270157, -0.020248237997293472, 0.022534433752298355, 0.03892318531870842, -0.000777624489273876, 0.014064074493944645, -0.012115013785660267, -0.011513951234519482, -0.013973763212561607, 0.008988848887383938, -0.025691797956824303, -0.036244578659534454, -0.039741575717926025, -0.0009961045579984784, 0.01295686885714531, -0.004640092141926289, -0.01770315133035183, -0.01104828156530857, 0.0045589255169034, 0.013314992189407349, -0.027790836989879608, -0.08417324721813202, 0.020363394170999527, 0.02497897483408451, 0.014894124120473862, -0.011607236228883266, 0.0383894145488739, 0.0674881562590599, 0.033878132700920105, -0.03536325693130493, 0.02365945093333721, -0.018704628571867943, 0.04965125024318695, 0.009214505553245544, 0.00397550780326128, -0.0053928871639072895, 0.015469033271074295, -0.0436963215470314, -0.0030187529046088457, 0.007029822561889887, 0.0014645808842033148, -0.02692882902920246, 0.0020627290941774845, -0.040072232484817505, -0.04326473921537399, 0.025217436254024506, -0.009380429983139038, 0.0058581712655723095, -0.03023068793118, 0.018518716096878052, -0.0033991672098636627, -0.02098849229514599, -0.022803885862231255, -0.0008998944540508091, -0.01896296814084053, -0.044084690511226654, -0.009093389846384525, 0.013465071097016335, 0.03371654450893402, -0.020287826657295227, 0.03511586785316467, 0.023078463971614838, -0.027381302788853645, 0.0067333802580833435, -0.0032996409572660923, 0.0024031822104007006, 0.03708616644144058, -0.02673015184700489, 0.0034034589771181345, 0.02199104055762291, 0.0012278385693207383, -0.02648053877055645, 0.015719948336482048, 0.0021726309787482023, -0.0002954101364593953, 0.04348031058907509, 0.01997189223766327, -0.030927831307053566, -0.0008404032560065389, -0.0038155540823936462, 0.03647303208708763, -0.022538602352142334, 0.007712939754128456, 0.027237745001912117, -0.041027847677469254, 0.058748554438352585, -0.022792290896177292, 0.005903235636651516, 0.015612422488629818, 0.0013682004064321518, -0.0405622161924839, -0.056206438690423965, 0.002466581529006362, 0.05741094797849655, 0.034114595502614975, -0.013427338562905788, 0.002589103067293763, -0.042729053646326065, 0.018246883526444435, 0.05363064631819725, -0.03698468580842018, -0.018623989075422287, 0.04473657160997391, -0.006199305411428213, 0.00003779238249990158, -0.0011438432848080993, 0.047231487929821014, -0.008525802753865719, 0.0017195228720083833, -0.0203509833663702, 0.03575865179300308, 0.05058578774333, 0.0030203447677195072, -0.006011721212416887, 0.04348309338092804, 0.014622923918068409, -0.008552785962820053, 0.014718824997544289, 0.030009564012289047, 0.04063721001148224, 0.05655519664287567, -0.022064246237277985, -0.01044150348752737, -0.039116308093070984, -0.0035662392619997263, 0.013602029532194138, 0.011015340685844421, 0.00875928159803152, -0.06183192506432533, -0.006630372256040573, -0.03548706695437431, -0.04475478082895279, 0.01226284820586443, -0.002677283016964793, -0.023129569366574287, 0.02947017177939415, 0.04085135459899902, 0.0702395886182785, -0.010508078150451183, 0.013989797793328762, 0.016055064275860786, 0.005535027012228966, -0.038068581372499466, -0.0027777834329754114, -0.003435266437008977, 0.01896243914961815, 0.05426443740725517, 0.07961530983448029, 0.032623399049043655, 0.016079233959317207, 0.005303672980517149, 0.029956595972180367, -0.007328754756599665, 0.04591658338904381, -0.01909690909087658, -0.0036266904789954424, -0.002898755017668009, -0.0029599680565297604, 0.04976986348628998, -0.01674853265285492, -0.03369404748082161, 0.028737220913171768, 0.05305199697613716, -0.02913811430335045, -0.01328335702419281, 0.028902124613523483, -0.001755751552991569, 0.012164409272372723, -0.020385868847370148, -0.029529249295592308, -0.009589409455657005, 0.022125620394945145, -0.010623237118124962, -0.018270038068294525, 0.03417162224650383, 0.03860316053032875, -0.03904714807868004, -0.05672968551516533, 0.04132719710469246, 0.034933801740407944, 0.023958822712302208, -0.01574067398905754, -0.02098495326936245, 0.00900986883789301, 0.01860007271170616, -0.038541145622730255, -0.02809223346412182, 0.02655341662466526, -0.014108111150562763, 0.028054839000105858, 0.04245130717754364, 0.04542023688554764, -0.06321050226688385, 0.016122518107295036, 0.07022128999233246, 0.029362812638282776, 0.0009457588894292712, 0.01834704354405403, 0.0052957357838749886, 0.01885218918323517, -0.02463717572391033, -0.006295404862612486, -0.031745102256536484, -0.0010540550574660301, 0.01738564483821392, -0.06988650560379028, 0.0011690037790685892, 0.05683987960219383, -0.016744477674365044, -0.016963837668299675, -0.03612656518816948, -0.004053502343595028, -0.0019948252011090517, -0.019273666664958, -0.010532387532293797, 0.007892141118645668, 0.013208606280386448, 0.013724995777010918, -0.009579704143106937, 0.05252689868211746, 0.015713244676589966, 0.010547269135713577, -0.04776691645383835, 0.0340765118598938, -0.026454653590917587, -0.05213324725627899, 0.0648215040564537, 0.001589939114637673, -0.038691598922014236, -0.0037290030159056187, -0.0003000177093781531, -0.010067210532724857, -0.0038251217920333147, -0.022309716790914536, -0.002745741745457053, -0.001228064065799117, 0.0037665627896785736, -0.02481997385621071, 0.03173747658729553, -0.012204015627503395, 0.03288114070892334, 0.011332755908370018, 0.06281258910894394, 0.04420072212815285, 0.0011107844766229391, 0.01532934233546257, -0.0025420328602194786, 0.09336671978235245, 0.0029384607914835215, 0.006028627511113882, 0.015105378814041615, 0.006962657440453768, 0.03166605532169342, -0.021977385506033897, -0.019076017662882805, -0.0206251610070467, 0.01456208061426878, 0.02926815114915371, 0.004155280534178019, 0.03102448768913746, 0.006083473563194275, 0.030124245211482048, 0.010134286247193813, -0.0005189464427530766, 0.015151632949709892, -0.012158461846411228, -0.07299268990755081, -0.03051348216831684, -0.00926904659718275, -0.02138476073741913, 0.030680155381560326, -0.04110945016145706, 0.028473952785134315, 0.024802956730127335, 0.03310241550207138, 0.0005675524589605629, -0.027363356202840805, -0.00819521676748991, -0.04293127357959747, -0.015614503994584084, -0.030426379293203354, 0.02715359814465046, 0.06255815923213959, 0.010210742242634296, 0.025315025821328163, -0.022492531687021255, 0.038209933787584305, -0.043747540563344955, -0.030944278463721275, 0.027272600680589676, -0.019010620191693306, -0.03407225385308266, 0.021825801581144333, 0.009662236087024212, -0.036259621381759644, 0.044238947331905365, 0.004609344527125359, -0.014305135235190392, 0.05454098805785179, -0.04284020885825157, -0.014894618652760983, -0.006252846214920282, 0.02375997230410576, -0.005193316377699375, 0.05006059631705284, -0.012585134245455265, 0.01196183729916811, 0.02441740222275257, -0.007631703279912472, 0.02760915271937847, 0.026796123012900352, 0.011214448139071465, -0.0013065205421298742, -0.07191868871450424, -0.002182557713240385, 0.01075375359505415, -0.08100487291812897, 0.03138142079114914, 0.01745687797665596, -0.001768580754287541, -0.006290478631854057, 0.0498274527490139, 0.004152695648372173, 0.015525877475738525, 0.0015819068066775799, 0.008982743136584759, 0.0011023703264072537, -0.00785483792424202, -0.03963474929332733, 0.030025724321603775, 0.010299808345735073, 0.05062444880604744, 0.040357135236263275, -0.026141606271266937, -0.035314105451107025, -0.013021637685596943, 0.0067769852466881275, 0.05108162760734558, 0.022754572331905365, 0.010292586870491505, -0.0367424301803112, 0.048759691417217255, 0.004950574599206448, 0.04011918976902962, 0.016106275841593742, -0.041735175997018814, 0.009317289106547832, -0.016986992210149765, 0.0037827971391379833, -0.0072558242827653885, 0.008987028151750565, 0.016018463298678398, 0.02283552661538124, -0.0060930703766644, 0.010543948039412498, -0.01524148415774107, 0.019098719581961632, -0.04929390177130699, 0.005252764094620943, -0.04018906503915787, -0.0066307177767157555, -0.02342924103140831, -0.02996731549501419, 0.029361171647906303, 0.0958707183599472, -0.008415576070547104, 0.028853846713900566, -0.09687686711549759, -0.03307466208934784, -0.035232063382864, 0.0051505486480891705, 0.0026904845144599676, -0.0030199862085282803, 0.004903649445623159, -0.024360766634345055, -0.001483263447880745, 0.04108688235282898, 0.004056695383042097, -0.02147676609456539, -0.0030161498580127954, -0.007359324023127556, 0.00528433732688427, -0.0037965630181133747, 0.04251229390501976, -0.0036827309522777796, 0.0480445958673954, -0.01823679730296135, 0.025525392964482307, -0.0007863249629735947, 0.0006566043011844158, -0.036935869604349136, -0.016199061647057533, 0.008433065377175808, -0.025199860334396362, 0.05686429888010025, -0.03127741441130638, 0.026936443522572517, -0.01775519736111164, 0.010308139957487583, 0.022318603470921516, -0.04554114490747452, -0.01952512189745903, -0.049604933708906174, -0.02598191425204277, 0.04018730670213699, -0.04121130704879761, -0.034509867429733276, -0.029065148904919624, 0.046941835433244705, -0.002988399239256978, 0.01300484873354435, -0.030506502836942673, -0.0070473263040184975, 0.011485898867249489, 0.004287647549062967, -0.01195534784346819, 0.01839444786310196, 0.05572089925408363, 0.040884971618652344, 0.026337409391999245, 0.004141504876315594 ]
Scaling-up BERT Inference on CPU (Part 1)
mfuntowicz
April 20, 2021
bert-cpu-scaling-part-1
guide, nlp, partnerships, intel
https://huggingface.co/blog/bert-cpu-scaling-part-1
# Scaling up BERT-like model Inference on modern CPU - Part 1
[ 0.00469264155253768, -0.004937691614031792, 0.05092436820268631, 0.00031945627415552735, 0.03008914366364479, 0.02798263169825077, 0.05129844695329666, 0.036722972989082336, -0.006576631683856249, -0.05233854055404663, -0.032246071845293045, 0.03866500407457352, -0.023994596675038338, 0.06627244502305984, 0.03477271646261215, -0.008469367399811745, 0.047956716269254684, -0.040031787008047104, 0.027585485950112343, 0.0002591257216408849, 0.006567573640495539, -0.08310860395431519, 0.10877955704927444, 0.024869797751307487, -0.004223847296088934, -0.029229795560240746, 0.0021612595301121473, 0.006271612364798784, -0.08188818395137787, 0.025582684203982353, -0.12186205387115479, 0.025255002081394196, 0.0302333515137434, -0.01804075576364994, -0.0498017854988575, 0.0023193645756691694, -0.13277380168437958, 0.05994339659810066, -0.030778685584664345, -0.01844509318470955, -0.028282249346375465, -0.03806520253419876, -0.021034669131040573, 0.055891722440719604, -0.010956552810966969, -0.02134079858660698, -0.20668844878673553, 0.08044543117284775, -0.004670985508710146, -0.03836492821574211, -0.05323950573801994, 0.07882347702980042, -0.062246840447187424, -0.007098538335412741, -0.007883644662797451, -0.001941103138960898, 0.016332698985934258, -0.08920936286449432, 0.05291781574487686, -0.010979591868817806, 0.05904215946793556, -0.025257190689444542, 0.006681076716631651, -0.012404127046465874, 0.023206699639558792, 0.026996608823537827, -0.004172408953309059, -0.04387908801436424, -0.06804659962654114, 0.05015638470649719, 0.022137699648737907, -0.06348083913326263, -0.028504513204097748, -0.005858216900378466, 0.016588570550084114, -0.03433733806014061, 0.03271947428584099, 0.029271338135004044, 0.06187618523836136, 0.05053561553359032, -0.0415467768907547, -0.010117732919752598, 0.06050420179963112, 0.053990624845027924, 0.04266777262091637, 0.0358775332570076, 0.06755831837654114, -0.052567314356565475, -0.04157504439353943, 0.030445586889982224, -0.005056838039308786, -0.1538919061422348, -0.04200427606701851, 0.0047417073510587215, 0.02022378519177437, -0.01312100701034069, 0.0018983103800565004, 0.046462807804346085, 0.001975814113393426, -0.00724579393863678, 0.017022879794239998, -0.040172357112169266, 0.061537161469459534, -0.029819583520293236, -0.05475705862045288, 0.014705372974276543, 0.011305488646030426, -0.09682510793209076, -0.05165623128414154, 0.041098542511463165, -0.03228391706943512, 0.004208620637655258, 0.0218521635979414, 0.04002227261662483, -0.08507566154003143, 0.018998300656676292, -0.0031316354870796204, -0.0018328671576455235, 0.054002176970243454, 0.014317424967885017, -0.0146176777780056, 0.06907790154218674, 0.08359801769256592, -0.028609300032258034, 0.027445022016763687, 0.04234374687075615, 0.03793220594525337, 0.007254458498209715, 0.020267542451620102, -0.02763037569820881, 0.037370819598436356, 0.0056013865396380424, 0.05555761232972145, -0.03715798258781433, 0.013810597360134125, -0.016850033774971962, -0.014495579525828362, -0.06038127467036247, -0.021583663299679756, -0.009681074880063534, -0.031677089631557465, 0.002835156861692667, 0.012212458066642284, 0.05344967171549797, 0.061822254210710526, 0.006690104026347399, -0.08808857202529907, 0.036904118955135345, -0.01024075597524643, 0.007486814167350531, -0.10161162912845612, 0.012870937585830688, -0.06445979326963425, -0.06774608045816422, 0.045815981924533844, 0.05037999898195267, 0.016233617439866066, -0.05706433206796646, -0.056470442563295364, -0.04043949022889137, -0.007259936071932316, -0.027333566918969154, -0.02173282392323017, -0.03178247809410095, 0.028326425701379776, -0.041142843663692474, 0.003432811936363578, 0.013214806094765663, 0.02022775448858738, -0.004196236375719309, -0.012948905117809772, 0.016631847247481346, 0.11361064016819, -0.008117054589092731, -0.03551771119236946, 0.0416506826877594, 0.06395126134157181, 0.07223980873823166, -0.034768953919410706, 0.009558352641761303, -0.051072560250759125, 0.01783916726708412, 0.010576372966170311, 0.05886387825012207, 0.014743790030479431, -0.06557836383581161, 0.03762379288673401, -0.05651472508907318, -0.017099488526582718, 0.022245680913329124, -0.014372231438755989, -0.04183439165353775, 0.09488171339035034, 0.007760419510304928, 0.04061398282647133, -0.029904905706644058, -0.05866198241710663, 0.10568606108427048, 0.04955717548727989, 0.06055601313710213, 0.0330464132130146, 0.0006209744606167078, 0.05159248411655426, -0.008281264454126358, -0.031170399859547615, 0.00045800936641171575, 0.035923466086387634, -0.03384097293019295, 0.020001616328954697, 0.039201006293296814, 0.005725677125155926, -0.14200086891651154, -0.007028550375252962, -0.08539853990077972, -0.060271888971328735, -0.05117953196167946, -0.011945405974984169, -0.007773231714963913, 0.02807329222559929, -0.07859407365322113, 0.1231539249420166, -0.05396003648638725, -0.018872255459427834, 0.011125806719064713, -0.03212890028953552, 0.03989017382264137, 0.10691013932228088, -0.029783887788653374, 0.09722675383090973, -0.0428130216896534, -0.041824523359537125, -0.030826805159449577, 0.03858039900660515, 0.05076703056693077, 0.005308920983225107, 0.0348983071744442, -0.04218616709113121, 0.001456344616599381, 0.050815582275390625, -0.10745314508676529, 0.003300020471215248, 0.03161945939064026, -0.030325332656502724, 0.051948223263025284, -0.018468186259269714, -0.04037705063819885, 0.047795094549655914, 0.04932345822453499, -0.03456360474228859, -0.008482861332595348, -0.04414474219083786, 0.04955660179257393, -0.004052081145346165, -0.045071329921483994, 0.050423335283994675, 0.019031083211302757, -0.007687406148761511, -0.0056642587296664715, -0.03224392235279083, 0.024684015661478043, 0.05203620344400406, -0.026524493470788002, 0.02423449046909809, -0.04371621087193489, 0.0023737577721476555, -0.06786984205245972, -0.026496512815356255, 0.004089262802153826, -0.01351687777787447, 0.04484148323535919, -0.0054247938096523285, -0.039277948439121246, 0.0446014329791069, 0.0017602168954908848, 0.04136607423424721, 0.017093246802687645, 0.07680200040340424, -0.02022343873977661, -0.006331636104732752, -0.016973543912172318, -0.004418764729052782, -0.021732579916715622, 0.018607787787914276, 0.010814102366566658, 0.017355091869831085, -0.015498921275138855, 0.0129751181229949, 0.0049494062550365925, 0.006489300634711981, 0.022199444472789764, -0.0013267184840515256, 0.028501570224761963, -0.033043231815099716, -0.021023603156208992, 0.0302400141954422, 0.022637683898210526, 0.00817487295717001, -0.0031549835111945868, -0.015278520062565804, -0.022987231612205505, 0.02161676622927189, 0.03727300837635994, -0.033517513424158096, 0.0003082195180468261, -0.052858732640743256, 0.05156843364238739, -0.0026800790801644325, 0.02819434367120266, -0.12247268110513687, -0.02924186922609806, 0.01694149523973465, 0.008986376225948334, 0.0040877098217606544, -0.024829071015119553, 0.03421596810221672, -0.027881847694516182, -0.024744557216763496, 0.02257627807557583, 0.03792300075292587, 0.030694909393787384, 0.03638330474495888, 0.0024730449076741934, -0.003624371252954006, -0.016788996756076813, -0.013902160339057446, 0.0054925880394876, -0.0003643775708042085, 0.021126188337802887, -0.0035293824039399624, 0.06498727947473526, -0.022623319178819656, -0.0005217865109443665, 0.02547762542963028, 0.051471952348947525, 0.01653270423412323, 0.028451040387153625, 0.039970025420188904, -0.01241980493068695, -0.0318392738699913, -0.01251955982297659, -0.0010098640341311693, 0.019376611337065697, -0.002845996292307973, 0.018113063648343086, -0.012621628120541573, 0.009721500799059868, 0.039383236318826675, 0.03194212540984154, 0.017602119594812393, 0.010341638699173927, 0.0278969407081604, -0.033992186188697815, -0.004469418898224831, 0.006463407538831234, 0.0163288414478302, 0.005114682484418154, 0.027683036401867867, -0.05220108479261398, -0.008093386888504028, -0.03865393251180649, 0.006137521471828222, 0.03985349461436272, 0.01374807022511959, -0.002295109676197171, -0.050677236169576645, -0.000634433701634407, 0.0515679270029068, -0.021301021799445152, -0.033431120216846466, 0.02504587732255459, 0.022637989372015, 0.0005053564091213048, -0.049124639481306076, 0.05249880999326706, 0.03860979899764061, 0.01720956526696682, 0.0029403825756162405, 0.0277932770550251, 0.022516600787639618, 0.04909256100654602, 0.008955469354987144, 0.019132018089294434, 0.002748998813331127, 0.04128106310963631, 0.007908754982054234, -0.015251942910254002, 0.07619358599185944, -0.007253938354551792, -0.043404530733823776, 0.0001994808844756335, -0.009557170793414116, -0.022995827719569206, 0.019176766276359558, 0.001314071356318891, -0.009869378060102463, -0.012347273528575897, 0.03522610664367676, 0.052131880074739456, -0.006956764031201601, -0.014957956969738007, 0.011152359656989574, -0.0054465713910758495, 0.01753520593047142, 0.016910536214709282, 0.04791192710399628, 0.010816270485520363, 0.006407548673450947, -0.0016543298261240125, 0.0232708677649498, -0.05689200386404991, 0.0074135921895504, 0.027169493958353996, 0.02640087530016899, 0.050579700618982315, -0.012087714858353138, -0.01830213889479637, -0.0011429786682128906, 0.009439969435334206, -0.02207268215715885, -0.00862750131636858, 0.01161134522408247, -0.009492474608123302, 0.0220579095184803, 0.0014305562945082784, -0.042656298726797104, -0.024586455896496773, -0.040440719574689865, 0.010096692480146885, -0.012368995696306229, 0.0361735075712204, 0.004698130767792463, -0.0026689444202929735, 0.033592984080314636, -0.009819402359426022, 0.01641240529716015, 0.02304060384631157, -0.03550274297595024, -0.017266402021050453, -0.049792852252721786, -0.0210723839700222, 0.06235649064183235, -0.0137794753536582, 0.03458752483129501, 0.03324969485402107, -0.0077280281111598015, 0.002628549002110958, 0.003263802733272314, -0.043444424867630005, -0.020370161160826683, 0.041551511734724045, 0.022051116451621056, -0.05544662848114967, 0.03447117656469345, 0.0001570098102092743, -0.018258078023791313, -0.020122189074754715, -0.006445259787142277, 0.028914757072925568, 0.0376330129802227, -0.01653151959180832, -0.03198592737317085, 0.02055724896490574, 0.04649684205651283, -0.0002111673675244674, 0.004114228766411543, 0.03930818289518356, 0.017509590834379196, 0.08054997026920319, 0.032809894531965256, 0.015529165975749493, -0.03998597711324692, 0.01498982310295105, -0.002647917252033949, -0.0452365018427372, 0.013012075796723366, -0.034109167754650116, 0.001826728112064302, 0.0073904902674257755, -0.019872453063726425, 0.015461510047316551, 0.0036571475211530924, -0.0360058955848217, 0.013983596116304398, 0.03196366876363754, 0.024798566475510597, 0.02730589546263218, -0.009201760403811932, 0.008891281671822071, -0.012438522651791573, -0.030922746285796165, -0.0059020062908530235, 0.027369052171707153, -0.006677572149783373, 0.01357149425894022, 0.04705542325973511, 0.05523940548300743, -0.014495777897536755, 0.01024571992456913, 0.018526464700698853, 0.0017811635043472052, 0.009282928891479969, -0.013945351354777813, 0.019696952775120735, -0.02449055016040802, 0.01541249081492424, 0.005928554572165012, -0.005415776744484901, -0.0053895157761871815, 0.005118225235491991, 0.025675445795059204, 0.008988875895738602, -0.024638760834932327, 0.0546206496655941, -0.00645021116361022, 0.009849712252616882, -0.058916881680488586, 0.03077027015388012, -0.006861514877527952, -0.004431428387761116, 0.012141682207584381, -0.03150833770632744, 0.0004259411070961505, 0.009088053368031979, -0.027359433472156525, -0.0300704725086689, 0.04826449975371361, 0.0025441532488912344, 0.030126499012112617, 0.0062728882767260075, -0.009465127252042294, -0.024439547210931778, 0.0100536635145545, 0.0047282874584198, -0.05259028077125549, -0.013135711662471294, 0.010509065352380276, 0.008100982755422592, 0.06082585081458092, 0.04067668691277504, -0.0012814716901630163, -0.006549425423145294, 0.062154754996299744, 0.01850603148341179, -0.047828372567892075, -0.028390489518642426, 0.04586045816540718, 0.023879075422883034, 0.002013715449720621, 0.004466069396585226, -0.02749195322394371, -0.025360750034451485, -0.003553367219865322, -0.04324691370129585, -0.02916456200182438, 0.07545769214630127, -0.0020288885571062565, 0.0028996551409363747, -0.007823185995221138, 0.012366017326712608, -0.00635611591860652, -0.00546750333160162, 0.022938188165426254, 0.0027745107654482126, 0.040993548929691315, 0.025206945836544037, -0.03558379411697388, 0.006938666105270386, 0.010249639861285686, 0.006723147351294756, -0.04453655704855919, 0.035103701055049896, 0.008574597537517548, -0.03424760699272156, 0.05112176388502121, -0.0001627477176953107, -0.02236095443367958, 0.014392239041626453, 0.041041478514671326, 0.011665335856378078, 0.0003262193640694022, -0.001530325971543789, 0.006098034791648388, 0.0050489529967308044, 0.007000655401498079, 0.03388884663581848, 0.06458812952041626, 0.02649495005607605, 0.012182271108031273, 0.019988205283880234, 0.038415875285863876, 0.03323019668459892, -0.029332315549254417, -0.048626579344272614, 0.01729084737598896, 0.08207415789365768, -0.012421908788383007, 0.01434919610619545, 0.029282154515385628, 0.009793063625693321, 0.008085411973297596, -0.017525779083371162, -0.001026162295602262, -0.002679272089153528, -0.01862231269478798, 0.03782429173588753, -0.03744402527809143, 0.025041211396455765, -0.03153879940509796, 0.055813390761613846, 0.02803579717874527, 0.030760878697037697, -0.018641456961631775, 0.001637553097680211, -0.008936496451497078, -0.003094810526818037, -0.024010060355067253, -0.0044212331995368, 0.004482528194785118, -0.004545486997812986, 0.032809194177389145, 0.0038871231954544783, 0.0414530374109745, 0.010438958182930946, -0.05769110098481178, 0.019110852852463722, -0.008045930415391922, -0.014111360535025597, -0.010593805462121964, 0.014099854044616222, -0.026984896510839462, 0.015080146491527557, 0.0069970726035535336, -0.060976434499025345, -0.002559175482019782, -0.016742706298828125, -0.004145580809563398, -0.006702023092657328, -0.016763847321271896, -0.02009529620409012, 0.009820016101002693, 0.0024409324396401644, -0.025771820917725563, 0.01623726263642311, -0.018517160788178444, 0.036801040172576904, 0.03126776963472366, -0.0043246010318398476, -0.007137821521610022, -0.02257547341287136, -0.0004268729535397142, -0.0320194773375988, -0.007604612968862057, -0.02959706075489521, -0.01555567141622305, 0.03672640025615692, 0.001289205509237945, -0.007101085502654314, 0.016897307708859444, 0.018018439412117004, -0.0009895648108795285, -0.033312637358903885, 0.022876570001244545, -0.009085179306566715, -0.046512339264154434, -0.03892681375145912, -0.030734311789274216, -0.011018410325050354, 0.0016711914213374257, 0.0017120441189035773, 0.013402901589870453, 0.047105345875024796, -0.024574728682637215, -0.05078066885471344, 0.007812280673533678, -0.025618936866521835, -0.027975033968687057, 0.03696179389953613, 0.020790327340364456, 0.00013053578732069582, -0.007094151806086302, 0.00943197775632143, -0.018392836675047874, -0.027893632650375366, -0.011512409895658493, 0.06450465321540833, -0.011936395429074764, -0.05145390331745148, -0.04298724606633186, 0.03459616377949715, -0.0027668336406350136, 0.03417608141899109, 0.044829633086919785, 0.01831359975039959, 0.024426942691206932, -0.03180180862545967, -0.0051995269022881985, -0.0027550694067031145, 0.019733058288693428, -0.04636295139789581, -0.04266906902194023, -0.027913445606827736, -0.007840573787689209, -0.014363438822329044, 0.005989184137433767, -0.019895704463124275, -0.020574986934661865, -0.052739016711711884, -0.0008850344456732273, -0.0391920730471611, 0.011166654527187347, 0.04886821657419205, 0.019541369751095772, 0.019510971382260323, -0.0031724253203719854, -0.023659491911530495, -0.03269793465733528, 0.000008364923814951908, 0.029810242354869843, 0.01705942675471306, 0.023305334150791168, -0.03846493363380432, -0.03232740983366966, -0.015196191146969795, -0.016937589272856712, -0.05472499132156372, 0.012130131945014, 0.01868537813425064, -0.019984060898423195, -0.032823678106069565, 0.012221344746649265, 0.021863587200641632, -0.027682814747095108, 0.05855885148048401, 0.0258097555488348, -0.024431131780147552, -0.0020507173612713814, -0.005572769325226545, -0.051014773547649384, -0.028209911659359932, 0.020884672179818153, -0.026629818603396416, 0.047786470502614975, 0.027873802930116653, 0.013433888554573059, 0.0005005084676668048, -0.05439683794975281, 0.024516943842172623, 0.007601375225931406, -0.042203497141599655, -0.03490274399518967, 0.003930920269340277, 0.008365383371710777, -0.04855141043663025, -0.05502668395638466, 0.026059841737151146, 0.019296806305646896, -0.008139806799590588, 0.0132211372256279, -0.008714951574802399, 0.0005428757867775857, -0.03401420637965202, 0.010474604554474354, 0.008264029398560524, 0.03590047359466553, 0.03239418938755989, -0.010134577751159668, 0.03728466480970383, -0.011247701942920685 ]
Scaling-up BERT Inference on CPU (Part 1)
mfuntowicz
April 20, 2021
bert-cpu-scaling-part-1
guide, nlp, partnerships, intel
https://huggingface.co/blog/bert-cpu-scaling-part-1
3. Baselines All the results below were run on Amazon Web Services (AWS) c5.metal instance leveraging an Intel Xeon Platinum 8275 CPU (48 cores/96 threads). The choice of this instance provides all the useful CPU features to speedup Deep Learning workloads such as: - AVX512 instructions set (which might not be leveraged out-of-the-box by the various frameworks) - Intel Deep Learning Boost (also known as Vector Neural Network Instruction - VNNI) which provides specialized CPU instructions for running quantized networks (using int8 data type) The choice of using metal instance is to avoid any virtualization issue which can arise when using cloud providers. This gives us full control of the hardware, especially while targeting the NUMA (Non-Unified Memory Architecture) controller, which we will cover later in this post. The operating system was Ubuntu 20.04 (LTS) and all the experiments were conducted using Hugging Face transformers version 4.5.0, PyTorch 1.8.1 & Google TensorFlow 2.4.0
[ 0.004521752241998911, -0.04457637667655945, -0.008296853862702847, 0.05773293972015381, -0.024366803467273712, 0.037509117275476456, 0.04790041223168373, 0.07156728953123093, -0.049468569457530975, -0.05951914191246033, -0.03132232278585434, 0.07203932851552963, 0.013728375546634197, 0.02472233958542347, 0.05036049708724022, -0.0802948996424675, 0.0851680338382721, 0.0027572219260036945, -0.050916314125061035, 0.06856061518192291, 0.0052425311878323555, -0.08486294001340866, 0.08260639011859894, 0.0688958689570427, -0.05435788258910179, -0.004182237200438976, -0.002548838034272194, -0.046519387513399124, -0.029559489339590073, 0.016555240377783775, -0.11117539554834366, -0.0004258555709384382, -0.02943315915763378, -0.025090152397751808, -0.000990354805253446, -0.00516824284568429, -0.07555165141820908, 0.08206120878458023, 0.03880203142762184, -0.04216368496417999, 0.0007693574298173189, -0.027836596593260765, -0.08500804007053375, 0.09241708368062973, -0.02958040125668049, 0.00599815184250474, -0.05928424373269081, -0.003815101459622383, -0.02123517356812954, 0.006848613731563091, -0.0768490806221962, -0.020552143454551697, 0.002246250631287694, -0.02750789187848568, 0.06726454198360443, 0.03784280642867088, -0.05002185329794884, -0.029249578714370728, 0.07167086005210876, -0.013451043516397476, 0.07613315433263779, -0.028446901589632034, -0.05126466974616051, -0.04596595838665962, 0.007541058585047722, -0.03922444209456444, -0.03926699236035347, 0.055920034646987915, -0.01179769542068243, 0.02007148787379265, 0.012208613567054272, 0.03475731611251831, 0.07249780744314194, 0.004124187398701906, -0.01706317625939846, -0.06210923567414284, -0.005657695233821869, 0.012983327731490135, 0.04274144768714905, 0.05688900128006935, -0.033987537026405334, 0.11758819222450256, 0.05574064329266548, 0.03157162293791771, 0.08011003583669662, 0.020453639328479767, 0.03961998224258423, 0.038339149206876755, 0.0013134779874235392, 0.0373106375336647, 0.019047949463129044, -0.03404343128204346, 0.07368797063827515, 0.04404491186141968, -0.05247743800282478, -0.04241292178630829, 0.016792265698313713, -0.0571708157658577, 0.025771763175725937, 0.01623239368200302, 0.04582586884498596, -0.0635722354054451, -0.05248513072729111, -0.06356190890073776, -0.06805165112018585, 0.04778572916984558, -0.0596260167658329, -0.080082967877388, -0.077573761343956, -0.06378129124641418, -0.04118196293711662, -0.019351374357938766, -0.01339178066700697, 0.041151415556669235, -0.08958539366722107, 0.010677854530513287, -0.001556350034661591, -0.020467737689614296, 0.08672599494457245, -0.027814414352178574, 0.04106834903359413, 0.12657521665096283, 0.028785282745957375, -0.007442474830895662, 0.014414326287806034, 0.0851723849773407, -0.012618333101272583, -0.01477591972798109, 0.08175748586654663, -0.019681043922901154, 0.05897972360253334, -0.03110121376812458, 0.09965894371271133, -0.07080655544996262, -0.023265291005373, -0.025272993370890617, -0.013267691247165203, -0.048880841583013535, -0.09119042009115219, 0.03660222887992859, -0.01151740737259388, 0.014587204903364182, 0.013937578536570072, -0.041287217289209366, 0.019389603286981583, 0.029815921559929848, 0.04084409400820732, 0.02344238944351673, 0.019473308697342873, 0.020642489194869995, -0.07662294805049896, 0.019242966547608376, -0.08607041835784912, -0.004140640143305063, 0.0371500588953495, 0.04049307852983475, 0.023295922204852104, -0.010184388607740402, -0.07141465693712234, -0.0716099962592125, 0.005070434417575598, 0.011850803159177303, -0.10002248734235764, -0.0007126255659386516, 0.0008583046728745103, -0.023215413093566895, 0.020885907113552094, 0.043179385364055634, 0.01716114953160286, -0.002139598596841097, -0.010427854023873806, -0.029381774365901947, 0.028969308361411095, 0.018700389191508293, -0.0013313315575942397, 0.03214792162179947, -0.001542343758046627, 0.04761713370680809, 0.0026474958285689354, -0.05637897551059723, -0.07821663469076157, 0.0062767681665718555, 0.021252764388918877, 0.07210804522037506, 0.03180479630827904, -0.04771227389574051, 0.04709959775209427, -0.001756355632096529, -0.019998585805296898, 0.019922882318496704, -0.018133526667952538, 0.037154167890548706, 0.056496087461709976, 0.039848752319812775, 0.0420752689242363, 0.016934940591454506, -0.026685714721679688, 0.058468639850616455, 0.024675102904438972, 0.019522788003087044, -0.0005859683151356876, 0.004388636909425259, 0.04389925301074982, 0.03470231965184212, -0.06137600168585777, -0.006616533733904362, -0.008106440305709839, -0.09840790182352066, -0.04938514530658722, 0.060794103890657425, -0.013399704359471798, -0.16960838437080383, -0.06694711744785309, -0.01824326440691948, -0.02371424064040184, -0.00657073687762022, -0.04153730347752571, -0.03807852789759636, 0.0028155986219644547, 0.004439663607627153, 0.12268078327178955, -0.07438061386346817, 0.04745616763830185, 0.009130550548434258, -0.009573045186698437, 0.01829918473958969, 0.037091214209795, 0.04325290769338608, 0.02693941630423069, 0.006822385359555483, 0.012904864735901356, -0.055701762437820435, -0.07199204713106155, 0.047368694096803665, 0.04504663497209549, 0.01430153101682663, 0.06313540041446686, 0.05217423662543297, 0.043730106204748154, -0.04729277640581131, -0.04844873398542404, -0.016856787726283073, -0.005784474313259125, 0.004350865259766579, -0.0022440922912210226, -0.027203086763620377, 0.028571035712957382, -0.030443020164966583, -0.03804068639874458, -0.015688203275203705, 0.0030807966832071543, 0.0017190149519592524, -0.049959056079387665, 0.002765264129266143, 0.03490009158849716, 0.025375859811902046, 0.014737624675035477, -0.018749559298157692, -0.04501490667462349, 0.04801642522215843, 0.008414724841713905, -0.010033778846263885, -0.03948879987001419, -0.038329366594552994, -0.00786506850272417, -0.041520457714796066, 0.015494497492909431, -0.03939836472272873, 0.06654819846153259, -0.016905805096030235, -0.02590666525065899, -0.041464559733867645, 0.010831331834197044, -0.016082588583230972, 0.02144252508878708, -0.01262833271175623, -0.042627282440662384, 0.009102903306484222, -0.011710908263921738, -0.08276941627264023, -0.017732130363583565, -0.030891990289092064, 0.021909961476922035, 0.016279207542538643, -0.032885897904634476, 0.010191957466304302, 0.018550381064414978, -0.03096124716103077, -0.03629766032099724, -0.01570168137550354, 0.0133057851344347, 0.045588720589876175, 0.01013818196952343, 0.015029145404696465, 0.02343163825571537, -0.004548033233731985, 0.004058694001287222, 0.009538881480693817, -0.01608750782907009, 0.0036155665293335915, -0.012341844849288464, -0.012010116130113602, -0.019364008679986, 0.004733783658593893, 0.026201678439974785, -0.010372990742325783, 0.0014220646116882563, 0.02699182741343975, -0.07342834025621414, 0.01637391559779644, -0.025562221184372902, 0.02030855230987072, -0.01350466813892126, 0.0030540963634848595, 0.010626498609781265, 0.0541510283946991, 0.00869777426123619, 0.019668731838464737, -0.009190921671688557, 0.02052103541791439, 0.003775145160034299, -0.03290719538927078, -0.0008253341075032949, -0.0025512694846838713, 0.023388462141156197, -0.05110082030296326, -0.024052252992987633, -0.038431666791439056, 0.0009984510252252221, 0.015944840386509895, 0.02060745283961296, -0.00015343936684075743, -0.016935203224420547, -0.024481872096657753, 0.010380983352661133, 0.021763073280453682, -0.03492458909749985, -0.027314262464642525, -0.01818867400288582, -0.017071306705474854, -0.032761815935373306, 0.004471967928111553, -0.010336916893720627, -0.008357938379049301, -0.023569079115986824, 0.022498076781630516, 0.029318248853087425, 0.04754718393087387, 0.0164647176861763, -0.027428142726421356, 0.048004891723394394, 0.00415864959359169, 0.03680412098765373, 0.024681031703948975, 0.03186008706688881, -0.02631503902375698, 0.015683768317103386, -0.02589476853609085, -0.04639569669961929, 0.016027862206101418, -0.03728950768709183, 0.03147396072745323, -0.006822935305535793, 0.005514839664101601, -0.06972288340330124, 0.04617961868643761, 0.011108467355370522, 0.0071023390628397465, -0.0757453665137291, 0.02711532823741436, 0.011574957519769669, 0.03446430340409279, -0.029561040922999382, 0.0183634664863348, 0.029196906834840775, 0.008327488787472248, -0.031148742884397507, -0.0256436038762331, 0.028039857745170593, 0.0577479787170887, 0.019455179572105408, 0.0006397579563781619, -0.010291834361851215, -0.037592772394418716, 0.02067575417459011, 0.005394061096012592, 0.024451136589050293, 0.0160426776856184, -0.049513883888721466, -0.061843182891607285, -0.030795058235526085, -0.03352231904864311, 0.011018439196050167, 0.00184898532461375, -0.027530502527952194, -0.0539977066218853, 0.04488304629921913, 0.05060749873518944, 0.004690256435424089, -0.07620125263929367, 0.032607823610305786, -0.04096588119864464, -0.013820515014231205, -0.03155851364135742, 0.021057728677988052, 0.029081998392939568, -0.015431507490575314, 0.046220261603593826, -0.0014090872136875987, -0.046837251633405685, 0.011401521041989326, -0.003073761472478509, 0.0005826830747537315, -0.013024356216192245, 0.02007284387946129, -0.045849818736314774, -0.012426355853676796, 0.01655329018831253, -0.003463534638285637, -0.027460800483822823, 0.01907549425959587, 0.00444493955001235, 0.04947551339864731, 0.030975066125392914, -0.025395169854164124, -0.03837491199374199, -0.009576723910868168, -0.0055315494537353516, -0.016042403876781464, 0.037604548037052155, -0.011657566763460636, -0.04434865340590477, 0.031906913965940475, -0.030438920482993126, 0.016431612893939018, 0.00348887057043612, -0.023385439068078995, -0.03243212401866913, -0.0635753720998764, 0.011123619973659515, 0.05627121403813362, 0.02586943283677101, -0.01762094907462597, -0.010515392757952213, -0.009975643828511238, 0.004258749075233936, -0.009038310497999191, -0.020284954458475113, -0.017055075615644455, 0.03260241448879242, 0.03506509214639664, 0.002847101306542754, 0.01357207726687193, 0.046690262854099274, 0.019154729321599007, 0.0015057075070217252, 0.0164177343249321, 0.02196674235165119, 0.011815395206212997, -0.004328557755798101, -0.007948851212859154, 0.03892345726490021, 0.04251335933804512, 0.03109884448349476, 0.009597127325832844, 0.011245953850448132, 0.028510773554444313, 0.028524747118353844, -0.030053043738007545, 0.012327359057962894, -0.004802253562957048, -0.004276062827557325, 0.019486786797642708, -0.0005075383232906461, 0.017266279086470604, -0.02688063681125641, -0.009494325146079063, 0.007621253374963999, 0.022160787135362625, 0.03990016505122185, 0.013452257961034775, -0.04692577198147774, 0.03576062247157097, 0.01319278683513403, 0.026561610400676727, -0.025368409231305122, 0.008929773233830929, 0.03160066157579422, 0.0011711776023730636, -0.03534628078341484, -0.0042513394728302956, -0.0073829712346196175, 0.0033076805993914604, 0.017856445163488388, 0.04116664454340935, 0.053597092628479004, -0.009664964862167835, 0.01198171079158783, 0.019001755863428116, -0.04247702285647392, 0.014722046442329884, 0.007878197357058525, -0.006375447381287813, -0.040440648794174194, 0.0008883069385774434, 0.031381022185087204, 0.01679232530295849, -0.0015825667651370168, 0.0025281815323978662, 0.026718799024820328, -0.0164323877543211, 0.024548359215259552, 0.014417222701013088, 0.020901337265968323, 0.006303852424025536, -0.0005459406529553235, 0.004122512880712748, -0.03437776118516922, -0.011140366084873676, 0.03431113064289093, -0.0010756454430520535, -0.016570813953876495, 0.0075127119198441505, -0.018454093486070633, -0.035431407392024994, 0.05008089169859886, -0.008137385360896587, -0.0012439554557204247, -0.060377735644578934, 0.025477800518274307, 0.010006217285990715, -0.04428430274128914, -0.03591366112232208, 0.014149215072393417, 0.01692556031048298, -0.013432275503873825, 0.01303886342793703, -0.0030429926700890064, 0.02310192957520485, 0.008556523360311985, -0.027618903666734695, 0.011406196281313896, 0.025530872866511345, -0.010515693575143814, 0.0243840254843235, -0.00352215557359159, 0.016956666484475136, -0.021422961726784706, -0.030369145795702934, -0.005545528139919043, -0.015118774957954884, -0.011596203781664371, -0.04534268379211426, 0.028148021548986435, 0.035367678850889206, -0.017104387283325195, -0.008273052051663399, -0.0024929933715611696, 0.02941056527197361, -0.02515251934528351, -0.006277038715779781, -0.05887850746512413, 0.006801690440624952, -0.01676161214709282, -0.030031202360987663, -0.05583430081605911, 0.010621022433042526, -0.01197133306413889, -0.057370129972696304, -0.04035279527306557, 0.050403445959091187, 0.0562601201236248, -0.07095194607973099, 0.006834095343947411, -0.021496782079339027, -0.04548640549182892, 0.008335160091519356, 0.02865373156964779, -0.014524789527058601, -0.016083937138319016, -0.004880072548985481, -0.04078523442149162, -0.022833997383713722, 0.029430193826556206, 0.0005130438366904855, 0.08405190706253052, -0.005588428117334843, -0.021424192935228348, -0.0015234932070598006, 0.017237748950719833, 0.0552423894405365, 0.012080108746886253, -0.014906258322298527, -0.0538741871714592, 0.077630415558815, -0.023496579378843307, 0.034677669405937195, 0.047581035643815994, -0.005192094016820192, 0.03275895491242409, 0.03974587470293045, -0.033545397222042084, -0.011277081444859505, -0.005349059589207172, 0.008844850584864616, 0.011178882792592049, 0.0661926344037056, -0.05032225325703621, 0.05278394743800163, 0.06503316760063171, 0.007788709364831448, 0.028585853055119514, 0.011348375119268894, 0.005402525421231985, 0.0053068483248353004, 0.03448053449392319, 0.03894111141562462, -0.023535242304205894, -0.03477972745895386, 0.04085417464375496, 0.023215852677822113, 0.0737278088927269, -0.008444801904261112, -0.025059744715690613, 0.023095078766345978, -0.0010714350501075387, -0.007202133070677519, 0.015605763532221317, -0.0154270576313138, -0.007976039312779903, 0.0522005669772625, -0.013420830480754375, -0.018473563715815544, 0.04319610074162483, -0.06678130477666855, -0.008600221946835518, -0.01568804308772087, 0.008344816975295544, -0.011920248158276081, 0.03375568613409996, 0.01884165219962597, -0.008220409043133259, 0.005526979453861713, -0.0002465725701767951, 0.002951393835246563, 0.009440397843718529, -0.04302862286567688, 0.0032183656003326178, 0.00783594697713852, 0.004434499423950911, 0.006436163559556007, 0.046152882277965546, -0.030497485771775246, -0.004532918334007263, -0.005505967885255814, 0.015917759388685226, 0.030043015256524086, 0.007079406641423702, 0.020365599542856216, -0.008488859981298447, 0.0015354397473856807, 0.006157982628792524, -0.018275411799550056, 0.009476400911808014, -0.02602389082312584, 0.007287633139640093, 0.020128268748521805, -0.009579584002494812, 0.04657602310180664, 0.028207162395119667, 0.03803090378642082, -0.005398768000304699, -0.035952720791101456, 0.006211448460817337, -0.006867158692330122, -0.0016183541156351566, 0.0580124631524086, -0.006434422917664051, -0.040941983461380005, -0.02961117960512638, 0.01418327633291483, -0.006776149850338697, 0.02905585989356041, 0.011668406426906586, 0.032015252858400345, -0.030859626829624176, -0.0169867891818285, 0.009811085648834705, 0.002414015121757984, 0.015210205689072609, 0.04354671388864517, 0.03262493759393692, 0.025829393416643143, 0.0187216829508543, 0.007807123940438032, 0.029133422300219536, -0.02891695685684681, 0.022674018517136574, -0.016359644010663033, -0.009881104342639446, 0.007006736472249031, 0.023544570431113243, 0.028711913153529167, 0.02059178054332733, -0.058357540518045425, 0.0255955271422863, -0.055793534964323044, -0.02388784848153591, -0.05413632094860077, -0.01870913803577423, 0.046983275562524796, 0.08053400367498398, -0.0124626774340868, -0.00839706975966692, -0.03938748314976692, 0.021860478445887566, -0.01631578616797924, 0.03955952823162079, 0.05661127716302872, -0.022500798106193542, 0.014450493268668652, -0.072682224214077, 0.014881367795169353, 0.019365550950169563, -0.019427156075835228, -0.0028346304316073656, -0.010406248271465302, 0.034105267375707626, 0.0030483738519251347, -0.012999793514609337, 0.017183341085910797, 0.0006519989692606032, 0.026812028139829636, -0.004705379251390696, -0.01713329739868641, 0.025487273931503296, -0.0010843859054148197, -0.05222548916935921, -0.04222908988595009, 0.051088135689496994, -0.005633458495140076, 0.0023851788137108088, 0.0014926049625501037, 0.028410114347934723, -0.005796336103230715, 0.005635963752865791, 0.03143739327788353, -0.0036749760620296, -0.04582764953374863, 0.0243939608335495, -0.06490250676870346, 0.04274939000606537, 0.026404334232211113, -0.020820779725909233, 0.010613854043185711, -0.010507002472877502, -0.02670055814087391, -0.001313172047957778, -0.022777464240789413, -0.0099508510902524, 0.006930933799594641, 0.04911855608224869, 0.0210629440844059, 0.030268564820289612, 0.0806831419467926, -0.014058815315365791, 0.0070307450369000435, 0.00553155317902565 ]
Scaling-up BERT Inference on CPU (Part 1)
mfuntowicz
April 20, 2021
bert-cpu-scaling-part-1
guide, nlp, partnerships, intel
https://huggingface.co/blog/bert-cpu-scaling-part-1
4. Out of the box results Figure 1. PyTorch (1.8.1) vs Google TensorFlow (2.4.1) out of the box Figure 2. PyTorch (1.8.1) vs Google TensorFlow (2.4.1) out of the box - (Bigger Batch Size) Straigh to the point, out-of-the-box, PyTorch shows better inference results over TensorFlow for all the configurations tested here. It is important to note the results out-of-the-box might not reflect the "optimal" setup for both PyTorch and TensorFlow and thus it can look deceiving here. One possible way to explain such difference between the two frameworks might be the underlying technology to execute parallel sections within operators. PyTorch internally uses OpenMP (10) along with Intel MKL (now oneDNN) (11) for efficient linear algebra computations whereas TensorFlow relies on Eigen and its own threading implementation.
[ 0.06680570542812347, -0.040430791676044464, 0.01815623790025711, 0.03857922554016113, -0.0328943096101284, 0.07879951596260071, -0.017469368875026703, 0.04066605120897293, -0.056072793900966644, -0.03163214400410652, -0.03193071112036705, 0.03429647535085678, -0.003835800103843212, 0.06834033131599426, 0.009918047115206718, -0.009549250826239586, 0.040974609553813934, -0.039241958409547806, 0.05072079226374626, 0.03045623004436493, -0.002615197328850627, -0.026653412729501724, 0.032423440366983414, -0.00747894961386919, -0.03858757019042969, -0.01681061089038849, -0.05292399227619171, -0.02928791381418705, -0.09207170456647873, 0.039962053298950195, -0.12933915853500366, -0.018883243203163147, 0.003938982728868723, -0.04100863263010979, 0.017952462658286095, -0.01000961847603321, -0.06215716153383255, 0.05520590394735336, 0.025745324790477753, -0.019960766658186913, 0.014166731387376785, -0.008570093661546707, -0.16367188096046448, 0.051741451025009155, -0.05684882402420044, 0.020288262516260147, -0.12981142103672028, 0.05032717064023018, 0.01490758266299963, -0.004740721546113491, -0.11264011263847351, 0.030633743852376938, -0.027601344510912895, 0.018389452248811722, -0.01926274038851261, 0.03714556619524956, 0.006336481776088476, -0.014695987105369568, 0.010381633415818214, -0.04870079830288887, 0.06255746632814407, 0.030680496245622635, 0.023279158398509026, 0.02496732398867607, -0.04806013032793999, -0.03198226913809776, 0.013357695192098618, 0.0015753483166918159, -0.0740727037191391, 0.0250332560390234, -0.009307900443673134, -0.012823308818042278, 0.008049109019339085, 0.008108307607471943, -0.037416063249111176, -0.017368832603096962, 0.019400211051106453, 0.0047255526296794415, 0.03799453005194664, -0.010783248580992222, -0.03808710724115372, 0.031441010534763336, 0.03703927993774414, 0.03534063696861267, 0.04097916930913925, 0.010383973829448223, -0.02198709174990654, -0.014583742246031761, 0.03626761585474014, 0.08260589838027954, 0.027190668508410454, -0.11388275772333145, 0.0383739247918129, 0.019097428768873215, -0.017085334286093712, -0.015340101905167103, -0.014305062592029572, 0.000856935337651521, -0.035203173756599426, -0.04038279503583908, -0.02452181652188301, -0.07677587866783142, -0.017237575724720955, -0.013808581978082657, -0.060645606368780136, -0.004309617914259434, -0.03328002989292145, -0.055228445678949356, -0.00004983597682439722, 0.025481056421995163, -0.023708190768957138, 0.041228294372558594, 0.020927270874381065, 0.005282456986606121, -0.05653311312198639, -0.02856314741075039, -0.06733032315969467, 0.019609015434980392, -0.018863271921873093, 0.0042984504252672195, 0.013385730795562267, 0.13021467626094818, 0.04645014554262161, 0.012733670882880688, 0.05872258171439171, 0.07737766206264496, 0.060218989849090576, 0.07181215286254883, 0.009538916870951653, -0.03515671566128731, 0.06667669862508774, -0.01068489532917738, 0.07477647066116333, -0.029439637437462807, 0.005451413337141275, -0.04762027785181999, 0.0047219726257026196, -0.07503131031990051, -0.03536256030201912, -0.04895619675517082, -0.07999386638402939, 0.04241626709699631, 0.002445258665829897, 0.09446966648101807, 0.00487614655867219, -0.04825472831726074, -0.01605330780148506, 0.04256938770413399, 0.014484968967735767, -0.040936071425676346, -0.09274601936340332, 0.04717155173420906, -0.0714295357465744, -0.03280667960643768, 0.02564166858792305, 0.007812318857759237, 0.005136774852871895, -0.04510575905442238, -0.025631751865148544, -0.06316190958023071, -0.014598353765904903, 0.0009844197193160653, -0.0418311171233654, -0.06335428357124329, -0.06548605114221573, -0.028051095083355904, 0.08618217706680298, -0.0248210821300745, -0.023529797792434692, 0.013455843552947044, 0.0033990584779530764, -0.03681706264615059, 0.058270979672670364, 0.0028492382261902094, -0.013742957264184952, 0.024678867310285568, -0.01380945835262537, 0.0712365135550499, 0.03389177471399307, -0.05616253614425659, -0.01787823624908924, 0.02720510959625244, -0.023835740983486176, 0.01027477253228426, 0.04972061514854431, -0.11607670038938522, 0.005630786996334791, -0.06668784469366074, 0.020800260826945305, 0.046453807502985, 0.001776281394995749, -0.027123138308525085, 0.04489029571413994, -0.03107738122344017, 0.0986706018447876, -0.05665075033903122, -0.01022792886942625, 0.05065202713012695, 0.05227358266711235, 0.010621786117553711, 0.03946414589881897, -0.04127964749932289, -0.020684683695435524, -0.03292134031653404, 0.015302905812859535, -0.009967665188014507, 0.02769540622830391, -0.10074356198310852, -0.042825642973184586, -0.017487213015556335, 0.042399950325489044, -0.1258535087108612, 0.004873837344348431, -0.011037358082830906, 0.00730461860075593, 0.022205863147974014, -0.007915518246591091, 0.016985706984996796, 0.06573975086212158, 0.014699848368763924, 0.19521071016788483, -0.0797288715839386, 0.029812974855303764, -0.0157609935849905, -0.05374600365757942, 0.013681752607226372, 0.017932919785380363, 0.014695174060761929, 0.05385018512606621, -0.031223639845848083, -0.023884985595941544, -0.07211777567863464, 0.03885147348046303, 0.05486787110567093, -0.0030291820876300335, -0.05948664993047714, -0.017245780676603317, 0.011829320341348648, 0.029759353026747704, -0.09770701825618744, 0.012190080247819424, 0.05258195847272873, -0.02149702049791813, 0.060417577624320984, -0.011601676233112812, -0.0662468820810318, 0.06018366292119026, -0.0125251030549407, 0.055863361805677414, -0.05607841908931732, -0.015114801004529, -0.020394660532474518, 0.02361409366130829, 0.02751363068819046, 0.07675541937351227, 0.03069082275032997, 0.023175518959760666, -0.03742307052016258, 0.011328106746077538, 0.027698034420609474, 0.05159435793757439, 0.0006779688992537558, -0.011957605369389057, -0.0056659453548491, -0.0006573596620000899, -0.020699212327599525, -0.021076681092381477, 0.0011002591345459223, -0.005654531996697187, 0.010546579957008362, 0.035861726850271225, -0.024819936603307724, 0.02477872371673584, 0.0011037674266844988, 0.021004443988204002, 0.03546857088804245, 0.016206029802560806, -0.014638601802289486, -0.01819641888141632, -0.046864572912454605, 0.007163723465055227, -0.00562649080529809, 0.058517489582300186, 0.03126043826341629, -0.007311177905648947, 0.009473714977502823, 0.02503642626106739, -0.0016027298988774419, -0.08736851811408997, 0.021177509799599648, -0.014618820510804653, 0.05048917233943939, 0.04478780925273895, -0.030278963968157768, -0.014298945665359497, 0.045228511095047, -0.027262000367045403, -0.008727975189685822, 0.013735774904489517, 0.048981521278619766, -0.03948557749390602, 0.02525310404598713, -0.004796454217284918, -0.030691873282194138, -0.03172703832387924, 0.0101702231913805, 0.014220727607607841, 0.034047018736600876, -0.09519294649362564, 0.00026587030151858926, -0.0006319992826320231, 0.01956292800605297, -0.022539138793945312, -0.032898303121328354, 0.0024294592440128326, 0.032043810933828354, 0.01975713111460209, -0.0013737017288804054, -0.01009344682097435, 0.010968192480504513, -0.000874349323567003, 0.02122855931520462, -0.0006574052385985851, 0.024027245119214058, -0.029750913381576538, 0.025942740961909294, 0.005606833379715681, 0.011003769002854824, -0.008723162114620209, 0.030952319502830505, -0.017341895028948784, -0.0004132322792429477, -0.036515600979328156, 0.038500163704156876, 0.013846603222191334, 0.04854308068752289, -0.015045701526105404, -0.05885927751660347, -0.033760473132133484, -0.05497342720627785, -0.01593109965324402, 0.015493025071918964, -0.02381082810461521, 0.008805321529507637, 0.018287070095539093, -0.009179893881082535, 0.05265484005212784, 0.028364213183522224, 0.024875573813915253, 0.014002633281052113, 0.03199873864650726, -0.06691685318946838, 0.007768112234771252, 0.002251502824947238, -0.03739669919013977, 0.004613996017724276, 0.02198771759867668, -0.04062417894601822, -0.03727276995778084, -0.005590290296822786, 0.02125384472310543, 0.017471112310886383, -0.008574899286031723, -0.016991322860121727, -0.037409622222185135, 0.016053456813097, 0.03279973939061165, 0.019964372739195824, -0.026073994114995003, 0.03702816367149353, 0.002076049568131566, -0.022799408063292503, -0.0697842612862587, 0.008064545691013336, 0.04786190390586853, 0.007882661186158657, -0.028323015198111534, 0.024664148688316345, -0.029419276863336563, 0.02550315670669079, -0.03524874150753021, 0.006136704236268997, -0.010358954779803753, 0.022565891966223717, 0.028857478871941566, 0.036706067621707916, 0.08943717181682587, 0.008413221687078476, -0.06304492056369781, -0.03873208537697792, -0.003119739471003413, 0.01975211314857006, -0.007120282854884863, 0.04203126206994057, -0.06200101971626282, -0.007896337658166885, -0.004396387841552496, 0.021145552396774292, 0.03810817375779152, -0.0025786871556192636, 0.05268538370728493, 0.021803002804517746, 0.01735563762485981, 0.017085343599319458, 0.026979610323905945, 0.03455996885895729, -0.02289821207523346, 0.047427862882614136, 0.020400216802954674, -0.056550607085227966, -0.02020272985100746, -0.003279765835031867, 0.024283479899168015, 0.014794391579926014, -0.02994847483932972, 0.010466068051755428, 0.019569460302591324, 0.002093433402478695, 0.003584653604775667, -0.004470134153962135, 0.0038874230813235044, -0.003906901925802231, 0.03940565139055252, 0.044860076159238815, -0.015454798936843872, -0.022501066327095032, -0.01683874800801277, 0.02902849204838276, -0.036464910954236984, 0.02867150492966175, -0.006942146923393011, -0.001747590722516179, 0.01749982312321663, 0.011626990512013435, 0.02454562671482563, -0.005079358816146851, 0.017537731677293777, 0.004450065083801746, -0.07503841817378998, 0.022120798006653786, 0.0005051326006650925, 0.01573002338409424, 0.0057168579660356045, -0.0067674401216208935, 0.022522766143083572, 0.013537965714931488, -0.000870780146215111, -0.030369993299245834, -0.017439119517803192, 0.03787751868367195, 0.025536641478538513, -0.055296629667282104, 0.011135391891002655, 0.03246785327792168, -0.04094497859477997, 0.017783576622605324, -0.05658448487520218, -0.002464338205754757, 0.047894831746816635, -0.02425220049917698, -0.03906441852450371, 0.03438505902886391, 0.04371591657400131, -0.004148812964558601, 0.010733713395893574, 0.04844987392425537, -0.003402912989258766, 0.04895509034395218, 0.005658309906721115, -0.009041005745530128, 0.001312991138547659, 0.029094930738210678, 0.00011487423034850508, -0.014590997248888016, 0.04985786974430084, -0.05863213166594505, -0.002833990380167961, -0.01348713506013155, 0.005680359899997711, 0.023071443662047386, -0.035807956010103226, -0.032833531498909, 0.03475023806095123, 0.03079279512166977, 0.0038966627325862646, 0.025982527062296867, -0.005455224774777889, 0.029072169214487076, 0.020481107756495476, -0.01323284488171339, 0.025283919647336006, -0.0042396122589707375, 0.01911240629851818, 0.04653137922286987, 0.005457787774503231, 0.04216806963086128, 0.009982970543205738, 0.03507357835769653, 0.00218036281876266, 0.0040458147414028645, 0.006051926873624325, -0.05014374107122421, 0.032877467572689056, 0.0032608057372272015, -0.014179404824972153, 0.016109704971313477, 0.019738581031560898, -0.024936554953455925, -0.01687479019165039, 0.0044611552730202675, 0.004678586032241583, -0.006982340943068266, 0.0604550763964653, 0.030624326318502426, 0.0037653381004929543, -0.028933027759194374, 0.037176355719566345, -0.01781376637518406, 0.004463020246475935, 0.012813344597816467, 0.017125675454735756, -0.01567830517888069, -0.007323865778744221, -0.040608588606119156, -0.05134429782629013, 0.024024536833167076, 0.012524756602942944, 0.0445425845682621, -0.001330157509073615, 0.006861880421638489, -0.0006920191226527095, -0.007117929868400097, 0.02158225141465664, -0.033949337899684906, 0.012539191171526909, 0.01862793043255806, -0.017454911023378372, 0.031023746356368065, 0.0224738959223032, -0.019689271226525307, -0.035311177372932434, 0.018082771450281143, 0.04108070954680443, -0.0035245679318904877, 0.056543655693531036, 0.043052587658166885, 0.03494371101260185, -0.05033288151025772, -0.04613334313035011, 0.0027256757020950317, -0.007973803207278252, 0.014575373381376266, -0.0031677198130637407, 0.009941001422703266, 0.05557522922754288, -0.02536824904382229, 0.026212545111775398, 0.010365436784923077, 0.027517171576619148, 0.021671531721949577, 0.0337931253015995, -0.03835347667336464, 0.0119243199005723, -0.03753100335597992, 0.02408933825790882, -0.008861239068210125, -0.022872308269143105, 0.05175550654530525, 0.02709447406232357, -0.030455701053142548, -0.005831251386553049, 0.025401754304766655, -0.022436894476413727, 0.024665597826242447, 0.0300043486058712, -0.02106388844549656, -0.0238849688321352, -0.012331539765000343, 0.04081710800528526, 0.05204946920275688, -0.004399861209094524, 0.003956354223191738, 0.01444884855300188, 0.0020648024510592222, -0.011828996241092682, 0.07737436890602112, -0.013674814254045486, 0.06932611763477325, 0.03052675351500511, 0.06430097669363022, 0.023710737004876137, -0.014976310543715954, -0.01381482370197773, -0.002037469297647476, 0.06901691854000092, -0.010145493783056736, 0.02326258085668087, 0.011294841766357422, -0.03294176608324051, -0.0402611568570137, -0.06873765587806702, 0.011432313360273838, -0.023870564997196198, 0.006922055501490831, 0.03622501343488693, 0.011483082547783852, 0.023221079260110855, -0.02097012661397457, 0.04075473174452782, -0.0024809937458485365, 0.01797552779316902, -0.0032489108853042126, 0.008599640801548958, 0.010360014624893665, 0.041582584381103516, -0.0020541746634989977, 0.030382556840777397, 0.010810909792780876, 0.03657793253660202, 0.02797112986445427, 0.023447370156645775, 0.04747328162193298, -0.04736768826842308, -0.027415942400693893, 0.0334601067006588, 0.016285603865981102, -0.020390626043081284, -0.0048217554576694965, 0.029958555474877357, 0.014377620071172714, -0.0036171700339764357, 0.034699104726314545, -0.04267905279994011, 0.032270416617393494, -0.0164000503718853, -0.009626956656575203, 0.020504947751760483, -0.006755448877811432, -0.05595279112458229, 0.040193114429712296, -0.015218385495245457, -0.01043405570089817, -0.004270145669579506, -0.00254829996265471, 0.01380458939820528, 0.002753784414380789, -0.025369152426719666, 0.00041242936276830733, 0.007029980421066284, 0.0025287861935794353, -0.022649914026260376, -0.015314405784010887, -0.06326230615377426, 0.015394775196909904, 0.02650771103799343, 0.026406753808259964, -0.03773517161607742, 0.01107188779860735, 0.006594212260097265, -0.029142487794160843, -0.03282859921455383, 0.057748664170503616, -0.0002831601304933429, -0.06598573923110962, 0.05175047367811203, 0.008005456067621708, -0.02005505934357643, -0.027181727811694145, 0.03981951251626015, 0.004663607571274042, 0.0039944639429450035, -0.016028013080358505, -0.053198590874671936, 0.01317533478140831, -0.022193361073732376, -0.011552209034562111, -0.015079573728144169, 0.03920133411884308, 0.013023185543715954, -0.001563639030791819, -0.017069058492779732, -0.0031322708819061518, -0.01144534070044756, -0.004786803852766752, 0.03457339480519295, 0.0377081073820591, -0.03084651194512844, -0.006954495795071125, 0.045106615871191025, 0.02295408397912979, 0.014125300571322441, 0.0317520834505558, -0.02028043568134308, 0.010067476890981197, -0.02901649661362171, -0.014036842621862888, -0.08213092386722565, 0.010702293366193771, 0.007882760837674141, -0.048559486865997314, -0.022785954177379608, 0.02445751056075096, -0.007857230491936207, -0.014115655794739723, -0.04610135033726692, 0.02349894866347313, -0.024065790697932243, 0.02265101857483387, -0.033249352127313614, -0.011334504000842571, 0.06071031093597412, 0.05441149324178696, -0.032960444688797, -0.041702110320329666, -0.0078123221173882484, -0.011509859003126621, -0.01540621928870678, -0.017065053805708885, -0.005732131656259298, -0.009986513294279575, -0.017128942534327507, -0.000585870526265353, 0.0015072444221004844, 0.008066573180258274, 0.017366720363497734, -0.026221519336104393, -0.007892133668065071, -0.004832267761230469, -0.03811423107981682, -0.0027282750234007835, -0.005109161604195833, -0.009173796512186527, 0.029719408601522446, -0.00005507573951035738, 0.027156325057148933, -0.012388668954372406, -0.017421819269657135, -0.04046086594462395, -0.026293396949768066, 0.03271094337105751, -0.02135118655860424, -0.0008883444825187325, 0.006072418764233589, 0.03620505332946777, 0.006520524621009827, 0.012909634970128536, -0.00899171270430088, 0.00884166918694973, -0.056379858404397964, -0.02925136685371399, -0.0009264809777960181, 0.06587312370538712, -0.02030254900455475, -0.03518103063106537, -0.008635514415800571, -0.020822947844862938, -0.006771195214241743, 0.0008071239572018385, 0.007998134009540081, 0.0336824394762516, -0.007574996445327997, 0.03296089917421341, -0.0032983075361698866, 0.024597227573394775, 0.051384177058935165, -0.0018938803113996983, 0.016660965979099274, -0.0007266213069669902 ]
Scaling-up BERT Inference on CPU (Part 1)
mfuntowicz
April 20, 2021
bert-cpu-scaling-part-1
guide, nlp, partnerships, intel
https://huggingface.co/blog/bert-cpu-scaling-part-1
References 1. Benchmarking Transformers: PyTorch and TensorFlow 2. HuggingFace's Transformers: State-of-the-art Natural Language Processing 3. HuggingFace's Model Hub 4. BERT - Pre-training of Deep Bidirectional Transformers for Language Understanding (Devlin & al. 2018) 5. Illustrated Transformer blogpost from Jay Alammar 6. PyTorch - TorchScript 7. Google Accelerated Linear Algebra (XLA) 8. ONNX Runtime - Optimize and Accelerate Machine Learning Inferencing and Training 9. Q8BERT - Quantized 8Bit BERT (Zafrir & al. 2019) 10. OpenMP 11. Intel oneDNN 12. Intel® Hyper-Threading Technology - Technical User Guide 13. Introduction to Hyper-Threading Technology 14. BLAS (Basic Linear Algebra Subprogram) - Wikipedia 15. Optimizing Applications for NUMA
[ 0.05194215476512909, -0.017537711188197136, 0.016344893723726273, -0.021617723628878593, 0.0042313747107982635, 0.05541501194238663, 0.03089786134660244, 0.10117095708847046, -0.004438451491296291, -0.029383134096860886, -0.05725378543138504, 0.09654960036277771, 0.0017308678943663836, 0.03220571205019951, 0.04979696497321129, -0.015299317426979542, 0.03779461234807968, -0.005257525946944952, -0.02307881787419319, 0.0200303066521883, 0.009866849519312382, -0.02825544960796833, 0.07451725006103516, -0.005107419565320015, -0.00875128898769617, -0.03872280940413475, -0.010544318705797195, -0.009239326231181622, -0.06843261420726776, 0.04051150381565094, -0.12334243953227997, -0.031168779358267784, 0.010851720348000526, -0.028781110420823097, -0.036739058792591095, 0.004278333391994238, -0.08082111179828644, 0.04472275823354721, 0.02087029628455639, -0.04815157502889633, 0.005565795116126537, -0.010393322445452213, -0.05976290628314018, 0.04108330234885216, -0.02290968969464302, 0.007279978599399328, -0.16589303314685822, 0.06931335479021072, -0.010490963235497475, -0.018646875396370888, -0.10592567175626755, 0.024662068113684654, -0.025350287556648254, 0.0487305112183094, 0.02365007810294628, 0.11307894438505173, 0.01909678615629673, -0.08683885633945465, 0.0028130870778113604, 0.010801580734550953, 0.07683082669973373, 0.012362377718091011, -0.007378316018730402, -0.018476136028766632, 0.04433911666274071, -0.0017932833870872855, -0.040688663721084595, 0.003649338847026229, -0.09437886625528336, -0.009516863152384758, 0.014268118888139725, 0.008710435591638088, -0.058280929923057556, -0.014112900011241436, 0.005526807624846697, -0.03834604099392891, -0.00169920374173671, 0.02555204927921295, 0.0751531571149826, 0.03466138243675232, -0.022264374420046806, 0.03239235654473305, 0.036753978580236435, 0.06670378893613815, 0.057120081037282944, 0.03176533430814743, 0.08312071114778519, 0.0009906681952998042, -0.06270147860050201, 0.03823002055287361, -0.028316766023635864, -0.12142296880483627, 0.005658202804625034, -0.017591053619980812, 0.04187353700399399, -0.04847254231572151, 0.03983242064714432, 0.010618043132126331, -0.033272095024585724, -0.06348215043544769, 0.026540454477071762, -0.04764307662844658, 0.03349268436431885, -0.017660465091466904, -0.07388988137245178, 0.02915654145181179, 0.006470218766480684, -0.09034249186515808, -0.027453333139419556, 0.023811100050807, -0.04419459030032158, 0.034101229161024094, 0.016577670350670815, 0.0550655797123909, -0.0833464190363884, 0.04233290255069733, 0.014247526414692402, 0.013160480186343193, -0.018268216401338577, 0.01418444886803627, -0.0016470412956550717, 0.1446254551410675, 0.041996873915195465, -0.009265536442399025, 0.027309346944093704, 0.06864072382450104, 0.031244326382875443, -0.005222210194915533, -0.006304802373051643, -0.0371304489672184, 0.022292017936706543, -0.0763852596282959, 0.06156567111611366, -0.022450396791100502, 0.005174108315259218, -0.03048086166381836, 0.001448384253308177, -0.05023721605539322, -0.04924985393881798, 0.021357335150241852, -0.020985575392842293, 0.07853463292121887, 0.024389047175645828, 0.001958872191607952, 0.05248846113681793, -0.04121467471122742, -0.10670003294944763, 0.07731813937425613, 0.011053415946662426, 0.0025706281885504723, -0.07344865053892136, 0.06459936499595642, -0.09132273495197296, -0.027245959267020226, 0.013221786357462406, 0.0681244507431984, 0.02639973908662796, -0.027858220040798187, -0.08978686481714249, -0.01994580589234829, -0.01305359322577715, 0.0001717092382023111, -0.03516217693686485, -0.012996943667531013, -0.012398902326822281, -0.03873785212635994, 0.04074209928512573, 0.000041358016460435465, -0.03728895261883736, -0.008140326477587223, 0.04065736383199692, -0.01672285422682762, 0.060914937406778336, -0.03507925942540169, -0.059831127524375916, 0.046493709087371826, 0.032197196036577225, 0.03230765461921692, 0.02770651876926422, -0.0008677759324200451, -0.07300679385662079, 0.06280732154846191, 0.025448722764849663, 0.08495369553565979, 0.05645117536187172, -0.05825062468647957, 0.021485988050699234, -0.04271756857633591, -0.04013341665267944, 0.04262017086148262, -0.08109523355960846, -0.0006192658329382539, 0.0926389992237091, -0.0010787718929350376, 0.0268903486430645, -0.04292640835046768, 0.003125719726085663, 0.1298988312482834, 0.03850136697292328, 0.03159843012690544, 0.08758874982595444, 0.010773470625281334, 0.013074085116386414, -0.0387062132358551, 0.006252840626984835, -0.027165917679667473, 0.018200648948550224, -0.0018751728348433971, 0.00477028451859951, -0.007031988352537155, 0.04403432831168175, -0.10034167766571045, -0.012421640567481518, -0.053342439234256744, 0.035099439322948456, -0.042388979345560074, -0.03701116517186165, 0.029918313026428223, 0.026778077706694603, -0.03825586661696434, 0.16856344044208527, -0.09916100651025772, 0.006147238425910473, 0.013993141241371632, -0.015791915357112885, -0.0024681140203028917, 0.08987129479646683, 0.031068308278918266, 0.07000171393156052, -0.035824764519929886, 0.016995476558804512, -0.0737651139497757, -0.012396369129419327, 0.06764169037342072, 0.0029300593305379152, -0.051010556519031525, -0.0212272796779871, 0.004411692265421152, 0.03661095350980759, -0.027060337364673615, -0.030252790078520775, 0.030072778463363647, 0.008733666501939297, 0.06563626229763031, -0.003061738796532154, -0.011924383230507374, 0.04493379592895508, 0.021470768377184868, -0.0029057064093649387, 0.001986730843782425, -0.05318275839090347, 0.03949467092752457, 0.020788468420505524, -0.03674368932843208, 0.035109665244817734, 0.0739821195602417, -0.010271413251757622, 0.0009935280540958047, -0.019241243600845337, 0.02876787632703781, 0.008321646600961685, -0.009336352348327637, -0.019210293889045715, -0.035941414535045624, -0.0061057866550982, -0.040001001209020615, -0.01784946583211422, 0.025367112830281258, -0.016924159601330757, -0.002527364995330572, 0.0037591876462101936, -0.04210507124662399, 0.03126038983464241, 0.004639396909624338, 0.020161252468824387, 0.008749566040933132, 0.029958458617329597, -0.011248051188886166, -0.04918063059449196, -0.0391835942864418, -0.019174322485923767, -0.01971708983182907, 0.029586590826511383, 0.029254186898469925, 0.0006522947805933654, -0.024895962327718735, -0.008420486003160477, -0.04859257489442825, -0.005272271577268839, 0.0049963053315877914, -0.01073508057743311, 0.019685527309775352, -0.012366385199129581, -0.06360593438148499, -0.009100810624659061, 0.004666837863624096, -0.013186062686145306, -0.03060641884803772, -0.037232574075460434, 0.019023766741156578, -0.023999197408556938, -0.0006062867469154298, -0.01592358574271202, 0.014959464780986309, -0.02574744261801243, 0.01722395047545433, -0.011848155409097672, 0.02553432062268257, -0.10962309688329697, 0.011865686625242233, -0.01942174695432186, 0.045456890016794205, -0.010731379501521587, -0.03470221906900406, 0.0012070579687133431, 0.012746822088956833, -0.03874930739402771, -0.006836107932031155, 0.007210500072687864, 0.007279270328581333, 0.010763389989733696, -0.016999760642647743, -0.011812598444521427, -0.014571154490113258, -0.00715017132461071, -0.011282678693532944, 0.009016277268528938, 0.02116365171968937, 0.014173835515975952, 0.05390585958957672, -0.024523187428712845, -0.003231075359508395, -0.023848658427596092, 0.015661288052797318, 0.004210581537336111, 0.03597503900527954, 0.03688301146030426, -0.031034104526042938, -0.01592264510691166, 0.0053750560618937016, -0.03733283653855324, 0.03489769622683525, -0.01915990374982357, -0.014018947258591652, -0.007097683381289244, 0.022957077249884605, 0.02722923271358013, 0.04095873981714249, 0.04423869773745537, 0.00584397790953517, 0.034481339156627655, 0.0049704196862876415, 0.017313232645392418, -0.008444399572908878, 0.0030217301100492477, -0.02516895718872547, 0.010613075457513332, -0.038167089223861694, -0.030860627070069313, -0.022065652534365654, -0.02473599836230278, 0.014476064592599869, -0.012014573439955711, -0.001625180128030479, -0.05380406975746155, -0.0287461020052433, 0.028025342151522636, -0.010577374137938023, -0.02084461599588394, 0.04794768616557121, 0.0058798519894480705, -0.004738875664770603, -0.05078614875674248, 0.025989249348640442, 0.008556806482374668, 0.021001921966671944, -0.038474999368190765, 0.03298387676477432, -0.01359073631465435, 0.04949156939983368, -0.00396460946649313, 0.004070753697305918, -0.04035225138068199, 0.03574570640921593, -0.031863994896411896, -0.006331836339086294, 0.07389172166585922, 0.022853747010231018, -0.07727206498384476, -0.043108947575092316, -0.0445287860929966, -0.017093636095523834, 0.014413828030228615, 0.016852891072630882, 0.020342452451586723, -0.028972607105970383, 0.018051140010356903, 0.04268917441368103, 0.01859988085925579, -0.03410683572292328, 0.03402038291096687, 0.000322716252412647, -0.0029953911434859037, -0.0007797995931468904, 0.04328824207186699, 0.005950760096311569, -0.01269552856683731, 0.035033028572797775, 0.028402701020240784, -0.03732520714402199, -0.01584426313638687, 0.017822416499257088, -0.006901836022734642, 0.04672570526599884, -0.010480113327503204, -0.002862890250980854, 0.01320674642920494, 0.001859417767263949, 0.005753624252974987, -0.02618373930454254, -0.012853964231908321, 0.01750810630619526, 0.024293415248394012, 0.01122466940432787, -0.013939043506979942, -0.013540349900722504, -0.042969491332769394, 0.04304444417357445, -0.03956051915884018, 0.03514935448765755, -0.007653628941625357, 0.0004587765724863857, 0.016898423433303833, -0.015597834251821041, 0.014352635480463505, 0.032902076840400696, -0.0022852695547044277, -0.011282667517662048, -0.05737868696451187, -0.01787913776934147, 0.00813035387545824, 0.03457557410001755, -0.013043832033872604, 0.0031421459279954433, 0.009192478843033314, -0.0028159255161881447, -0.015942992642521858, -0.03878358379006386, -0.00243841833434999, 0.024971960112452507, 0.007304069120436907, -0.030278204008936882, 0.03713737055659294, 0.051503635942935944, -0.011713598854839802, -0.03973707929253578, -0.02577310800552368, 0.04519866779446602, 0.03751317784190178, 0.011089103296399117, -0.02696065790951252, 0.04014851525425911, 0.04726949334144592, 0.004637920763343573, 0.026826215907931328, 0.04560890421271324, 0.001808267435990274, 0.06656640768051147, -0.01449922751635313, 0.027990808710455894, -0.05900874733924866, 0.0040176925249397755, -0.00017499136447440833, 0.015347941778600216, 0.0005809669964946806, -0.05622158572077751, 0.024348706007003784, -0.016636308282613754, 0.005348178092390299, -0.008244309574365616, -0.001941243070177734, -0.045834414660930634, -0.008737421594560146, 0.017849935218691826, 0.008223863318562508, -0.01432158425450325, -0.0010926437098532915, 0.022720206528902054, -0.009259686805307865, -0.020559119060635567, 0.03152613714337349, -0.0032350323162972927, -0.010054036043584347, 0.05033459514379501, 0.05371274799108505, 0.036435697227716446, -0.015186491422355175, 0.014057367108762264, -0.004907944239675999, -0.02119125984609127, 0.007409163285046816, -0.013931048102676868, -0.0020584824960678816, 0.00029235254623927176, -0.021125677973031998, 0.009577051736414433, -0.003987270873039961, -0.010024764575064182, 0.021104535087943077, 0.04202410951256752, -0.028551636263728142, 0.002417616778984666, 0.04176732897758484, 0.01004306972026825, 0.0002472469350323081, -0.061942994594573975, 0.00135461101308465, -0.02286432683467865, 0.002032174961641431, 0.032225627452135086, -0.009044141508638859, -0.005221674218773842, 0.005737418308854103, -0.003978675696998835, -0.02091549150645733, 0.03351832181215286, 0.027759334072470665, 0.030438093468546867, -0.009213874116539955, -0.013102571479976177, 0.01612628996372223, 0.0036926085595041513, 0.019910622388124466, -0.05034530907869339, -0.005353021435439587, 0.0012106078211218119, -0.011066580191254616, -0.0008216482237912714, 0.025200948119163513, -0.0011801710352301598, 0.0006276370259001851, 0.03247612342238426, 0.004143037833273411, -0.023099053651094437, -0.03463062271475792, 0.02498176507651806, 0.015835225582122803, -0.015754180029034615, -0.023216983303427696, -0.030139466747641563, -0.026452410966157913, -0.0032679634168744087, -0.04169066995382309, 0.045671332627534866, 0.06430386751890182, -0.03172619268298149, -0.0018567655934020877, -0.008699994534254074, 0.026736902073025703, -0.034790486097335815, -0.029046304523944855, -0.0056019979529082775, 0.00404349435120821, 0.00468100979924202, 0.020219020545482635, 0.005913681350648403, 0.01225289423018694, 0.014454304240643978, 0.0205629151314497, -0.05039456859230995, 0.014710143208503723, 0.0001579592499183491, -0.05999485403299332, 0.0009050676017068326, 0.00021380704129114747, -0.013543328270316124, 0.030908048152923584, 0.019980359822511673, -0.024283725768327713, -0.006794747430831194, 0.013628077693283558, -0.017760328948497772, 0.016121860593557358, -0.027311021462082863, 0.019013967365026474, 0.08034303784370422, -0.0038617090322077274, 0.04697156697511673, 0.031275633722543716, 0.034745555371046066, 0.0562329962849617, -0.0015360882971435785, 0.0332895927131176, 0.005415945779532194, 0.058890312910079956, -0.01593414507806301, 0.03675659000873566, 0.014439004473388195, -0.04104936867952347, -0.027405833825469017, -0.00045903600403107703, -0.03213510289788246, -0.051665402948856354, -0.001144116627983749, 0.0714392215013504, 0.01562722958624363, 0.016418756917119026, -0.0562666580080986, 0.0437651164829731, 0.016639169305562973, 0.006787074264138937, 0.006511803716421127, 0.025886163115501404, 0.040539659559726715, 0.018747704103589058, -0.0073971315287053585, -0.0003501701867207885, 0.004116460215300322, 0.009289165958762169, 0.05309734866023064, 0.018231749534606934, 0.05162045359611511, 0.013697103597223759, -0.03912995383143425, 0.03565454110503197, 0.0013801855966448784, -0.0039188452064991, 0.0005424917326308787, 0.026455143466591835, -0.016461696475744247, 0.009837828576564789, -0.008948007598519325, -0.049168750643730164, 0.006748811341822147, 0.02263725735247135, -0.006063566077500582, -0.007151554338634014, -0.018442291766405106, 0.008865374140441418, 0.06491730362176895, -0.029118236154317856, -0.02795829065144062, 0.02382880635559559, -0.0018694972386583686, 0.00958651676774025, 0.020889217033982277, -0.019097011536359787, -0.023204807192087173, -0.0023126190062612295, -0.0059904372319579124, -0.015820922330021858, 0.016479138284921646, -0.02381959930062294, -0.012579718604683876, 0.0203847773373127, 0.02827887050807476, -0.03679177910089493, 0.03268501162528992, 0.010705351829528809, 0.005952836479991674, -0.06114936247467995, 0.01066663395613432, -0.013093815185129642, -0.025295130908489227, 0.009580649435520172, -0.05992734059691429, 0.008636685088276863, 0.008699789643287659, -0.0029594572260975838, 0.021146656945347786, 0.07332366704940796, -0.06533477455377579, -0.03291044756770134, -0.013397677801549435, -0.0065826731733977795, -0.019440827891230583, 0.003710908116772771, 0.025636611506342888, -0.011475276201963425, -0.00021714733156841248, -0.017295749858021736, 0.001663671457208693, -0.025859318673610687, 0.006932136602699757, 0.03096047043800354, -0.005227076821029186, -0.013771058060228825, -0.03443529084324837, 0.05244135111570358, 0.044485002756118774, 0.0015588384121656418, 0.04518219083547592, 0.011868314817547798, 0.012474526651203632, -0.06260580569505692, 0.008346693590283394, -0.03490018844604492, -0.029659103602170944, -0.0036301801446825266, -0.051879461854696274, -0.049405474215745926, 0.02301664464175701, 0.011415760964155197, 0.005410571116954088, -0.08364308625459671, 0.00024935894180089235, -0.058327145874500275, -0.01683865115046501, -0.014906193129718304, -0.02776823192834854, 0.06171873211860657, 0.02945646084845066, 0.012760003097355366, -0.008374929428100586, -0.022728657349944115, -0.010365254245698452, -0.000809436256531626, 0.005407072138041258, 0.08442480117082596, 0.020611455664038658, -0.0038040759973227978, -0.023871667683124542, -0.0016873091226443648, 0.018873969092965126, -0.05639180913567543, 0.015788426622748375, -0.006579376757144928, 0.03149178996682167, -0.02085404098033905, 0.005110991653054953, 0.015460658818483353, -0.0032440831419080496, 0.021636150777339935, -0.010198784060776234, -0.01976194977760315, 0.025326069444417953, -0.016568785533308983, -0.05004924535751343, -0.00022965436801314354, 0.005504360422492027, 0.009566547349095345, 0.040759675204753876, 0.01628713868558407, 0.03506335988640785, 0.009222474880516529, -0.004609838128089905, 0.0032452186569571495, -0.000041690705984365195, -0.03308326005935669, -0.012459785677492619, -0.010584138333797455, 0.012003152631223202, -0.02679130993783474, -0.02935766987502575, 0.07018564641475677, 0.030376354232430458, 0.017820414155721664, -0.011019237339496613, -0.015651807188987732, -0.014820976182818413, 0.011469699442386627, 0.03711974620819092, 0.02829797938466072, 0.0366714671254158, 0.05874823033809662, 0.00975281372666359, 0.008407353423535824, 0.002539551118388772 ]
Scaling-up BERT Inference on CPU (Part 1)
mfuntowicz
April 20, 2021
bert-cpu-scaling-part-1
guide, nlp, partnerships, intel
https://huggingface.co/blog/bert-cpu-scaling-part-1
6. Core count scaling - Does using more cores actually improve performance? When thinking about possible ways to improve our model inference performances, the first rational solution might be to throw some more resources to do the same amount of work. Through the rest of this blog series, we will refer to this setup as Core Count Scaling meaning, only the number of cores used on the system to achieve the task will vary. This is also often referred as Strong Scaling in the HPC world. At this stage, you may wonder what is the point of allocating only a subset of the cores rather than throwing all the horses at the task to achieve minimum latency. Indeed, depending on the problem-size, throwing more resources to the task might give better results. It is also possible that for small problems putting more CPU cores at work doesn't improve the final latency. In order to illustrate this, the figure 6. below takes different problem sizes (batch_size = 1, sequence length = {32, 128, 512}) and reports the latencies with respect to the number of CPU cores used for running computations for both PyTorch and TensorFlow. Limiting the number of resources involved in computation is done by limiting the CPU cores involved in intra operations (intra here means inside an operator doing computation, also known as "kernel"). This is achieved through the following APIs: - PyTorch: torch.set_num_threads(x) - TensorFlow: tf.config.threading.set_intra_op_parallelism_threads(x) Figure 7. Latency measurements As you can see, depending on the problem size, the number of threads involved in the computations has a positive impact on the latency measurements. For small-sized problems & medium-sized problems using only one socket would give the best performance. For large-sized problems, the overhead of the cross-socket communication is covered by the computations cost, thus benefiting from using all the cores available on the both sockets.
[ 0.04982953518629074, 0.020284540951251984, -0.026887785643339157, 0.005997352302074432, -0.011788704432547092, 0.042420901358127594, 0.0185422170907259, 0.043869391083717346, -0.03478645905852318, -0.06322100013494492, -0.021040936931967735, 0.009768381714820862, -0.01791263185441494, 0.021463075652718544, 0.007074594032019377, 0.012484722770750523, 0.06048441305756569, -0.045856524258852005, 0.0015086752828210592, 0.05565359443426132, 0.07865714281797409, -0.034016311168670654, 0.07886598259210587, 0.04821595549583435, -0.07672590017318726, -0.020684195682406425, -0.05464649945497513, 0.010017202235758305, -0.0449720099568367, -0.009214366786181927, -0.12149122357368469, 0.015359521843492985, -0.01344082411378622, -0.018668316304683685, -0.022811446338891983, -0.006002550479024649, -0.06485701352357864, 0.07902012020349503, 0.04805605858564377, -0.04886859282851219, 0.0696496069431305, -0.03195255249738693, -0.0643484890460968, -0.03227992728352547, 0.006988207343965769, -0.0024739785585552454, -0.06649205088615417, 0.03842658922076225, -0.00011786977120209485, -0.02826237678527832, -0.06407041847705841, 0.032033294439315796, 0.02061978541314602, 0.049529653042554855, 0.015043077990412712, -0.004684892017394304, -0.028016218915581703, -0.05338210240006447, 0.008154983632266521, 0.01938283070921898, 0.043549127876758575, -0.0005156479892320931, 0.01407837588340044, 0.05029957368969917, -0.06696569174528122, -0.00726900203153491, 0.007385828997939825, -0.009598313830792904, -0.04896576702594757, 0.016256535425782204, -0.00495684240013361, -0.01049868669360876, -0.050956133753061295, 0.007862200029194355, -0.05167895555496216, 0.03028620406985283, 0.022723672911524773, -0.04060164839029312, 0.061221957206726074, 0.009398636408150196, -0.07070688903331757, 0.02451658993959427, 0.06327085196971893, 0.06040022149682045, 0.07596499472856522, 0.03395720571279526, 0.013931402936577797, 0.030267205089330673, -0.011089803650975227, 0.06575389206409454, 0.03875377029180527, -0.08332386612892151, 0.11110062897205353, 0.03211253136396408, -0.0175775159150362, -0.013711838982999325, 0.014384767040610313, 0.039109718054533005, -0.04107899218797684, 0.0029762214981019497, -0.002075006952509284, -0.08713773638010025, 0.0013909314293414354, -0.015212706290185452, -0.09310886263847351, 0.006232752464711666, 0.05838029459118843, -0.09682685136795044, -0.03556583821773529, 0.0715259313583374, -0.07387549430131912, 0.0187382809817791, -0.04249250888824463, 0.03889044374227524, -0.0629742294549942, -0.02371896617114544, -0.03568597882986069, -0.016037974506616592, 0.008829094469547272, -0.017456449568271637, -0.0012735015479847789, 0.07814831286668777, 0.04835563898086548, 0.029102087020874023, -0.055156707763671875, 0.02904297038912773, 0.08489356189966202, -0.014526428654789925, 0.04603732377290726, -0.0593319870531559, 0.012563209049403667, 0.008452716283500195, 0.05774679034948349, -0.029171844944357872, 0.003220422426238656, -0.10315310209989548, -0.02457100711762905, -0.03449487313628197, 0.004587812814861536, -0.009770659729838371, -0.0402718186378479, -0.029468387365341187, 0.041274167597293854, 0.020965300500392914, 0.032481662929058075, -0.005165060982108116, -0.09599137306213379, -0.014719116501510143, 0.051182251423597336, -0.024773690849542618, -0.10306365042924881, 0.0659894049167633, -0.053501322865486145, -0.030527835711836815, 0.05574818700551987, 0.05813673883676529, 0.024448515847325325, -0.09690584987401962, -0.03150935471057892, -0.00034848967334255576, -0.04825204238295555, -0.08157648146152496, 0.023812400177121162, -0.07521552592515945, 0.06572019308805466, 0.012844709679484367, 0.07248221337795258, -0.029673179611563683, 0.01574348844587803, 0.09885790199041367, -0.037982407957315445, -0.0016177832148969173, 0.05281148850917816, -0.008648463524878025, 0.0003667381242848933, 0.04339779540896416, -0.014588076621294022, 0.0973379984498024, -0.016561688855290413, -0.030695240944623947, -0.023418329656124115, 0.020330015569925308, -0.06741796433925629, 0.04400273784995079, 0.025001119822263718, -0.10571103543043137, 0.007074407767504454, -0.07108648121356964, -0.021611278876662254, 0.03720087185502052, -0.004301870707422495, 0.012048028409481049, 0.02795473299920559, 0.014834306202828884, 0.07155004143714905, -0.036048583686351776, -0.05464984104037285, 0.09535373002290726, 0.020486431196331978, 0.03849280998110771, 0.03715794160962105, -0.023505622521042824, 0.027601784095168114, 0.017344092950224876, -0.06168413162231445, 0.03744635730981827, 0.021477047353982925, -0.08029235899448395, 0.027180243283510208, -0.005506101064383984, -0.01809941604733467, -0.09540601819753647, -0.024022210389375687, -0.05941798537969589, -0.001972454134374857, -0.0002229121164418757, 0.004156485665589571, 0.02689550071954727, 0.06778529286384583, -0.04889507219195366, 0.1676338165998459, -0.028292721137404442, -0.016575613990426064, 0.03946154564619064, -0.06563127785921097, 0.010778996162116528, 0.017391007393598557, -0.030045462772250175, 0.04474329575896263, -0.03378314897418022, -0.013688686303794384, -0.02325991541147232, -0.025460824370384216, 0.091569684445858, -0.004202044568955898, 0.023840008303523064, -0.0619654655456543, 0.06540664285421371, -0.0032555311918258667, -0.08055318146944046, -0.04613765329122543, 0.07209917157888412, -0.0438326932489872, 0.048698123544454575, 0.02943016216158867, -0.017943372949957848, 0.04633517563343048, -0.04473869502544403, 0.006340881809592247, -0.06932191550731659, -0.1027889996767044, -0.03436202555894852, -0.022433850914239883, -0.03397125378251076, 0.025482675060629845, -0.012761492282152176, 0.005061406176537275, -0.03090517967939377, -0.032948315143585205, 0.015531022101640701, 0.037558458745479584, -0.010132747702300549, -0.019908323884010315, -0.014759821817278862, 0.030459364876151085, -0.03299489617347717, -0.00956811849027872, -0.03182873874902725, 0.02211720123887062, -0.026859628036618233, 0.023074466735124588, -0.03395193815231323, 0.02648787759244442, -0.026213835924863815, -0.01673073135316372, -0.012280582450330257, 0.03844359517097473, 0.007063165307044983, 0.0031658189836889505, 0.0040436796844005585, -0.03092193976044655, -0.024261843413114548, 0.021777108311653137, 0.03458300232887268, -0.048458635807037354, 0.017209481447935104, 0.002367046196013689, 0.015275227837264538, -0.04602210968732834, -0.015101532451808453, 0.003814652096480131, 0.004278426058590412, 0.0012286577839404345, -0.028028566390275955, 0.023775707930326462, 0.035421669483184814, -0.07170058786869049, -0.016228893771767616, -0.007266760803759098, -0.026376716792583466, -0.0372915044426918, -0.035228461027145386, 0.001263163168914616, 0.01946013793349266, -0.08174370974302292, 0.031357984989881516, 0.02117437869310379, 0.04670116305351257, -0.09593465924263, -0.0049809240736067295, -0.0036161502357572317, 0.02092556841671467, -0.036445897072553635, -0.0015272408491000533, 0.0069721778854727745, 0.009777438826858997, 0.015602544881403446, 0.007115101907402277, 0.004705582745373249, 0.005093882326036692, -0.0026811687275767326, -0.0030150716193020344, 0.022322392091155052, 0.02168644405901432, 0.05499749258160591, -0.0012481111334636807, 0.023213719949126244, 0.024840425699949265, 0.03170724958181381, 0.020375534892082214, -0.024585600942373276, 0.04631217569112778, 0.022718261927366257, 0.057572536170482635, -0.005856555886566639, 0.05976580083370209, 0.009049947373569012, -0.024786537513136864, -0.07283951342105865, -0.027710705995559692, -0.003926273435354233, -0.04109868034720421, 0.018015477806329727, -0.024821234866976738, -0.014841828495264053, 0.0028696111403405666, 0.02799100987613201, 0.05646625906229019, 0.0021383536513894796, 0.031187135726213455, 0.023470235988497734, -0.06555812060832977, -0.0032691778615117073, -0.006528031080961227, 0.0058952211402356625, -0.029880810528993607, 0.007043776568025351, -0.03277813643217087, -0.012941370718181133, -0.011790995486080647, 0.004069054499268532, 0.054654303938150406, -0.01651902124285698, -0.005564568098634481, -0.029551412910223007, 0.014855862595140934, 0.03511691838502884, 0.002430765423923731, -0.05195656046271324, 0.031057247892022133, 0.05523517355322838, -0.009612918831408024, -0.03935154154896736, 0.04469602555036545, 0.010469365864992142, 0.021939091384410858, -0.0008122349972836673, 0.022019091993570328, -0.011874143034219742, 0.03998773545026779, 0.0145340571179986, -0.001895381254144013, -0.01502714492380619, 0.04864870384335518, -0.027695130556821823, 0.0029511332977563143, 0.03447214886546135, 0.022358346730470657, -0.01798645406961441, -0.05054924637079239, -0.015109523199498653, 0.011203502304852009, 0.005021699704229832, 0.035860784351825714, 0.03251057490706444, -0.015744348987936974, -0.007893107831478119, 0.07481345534324646, -0.014804151840507984, -0.03280412033200264, 0.019206281751394272, 0.016266632825136185, -0.014433625154197216, 0.007503640837967396, 0.03798601031303406, 0.023785358294844627, 0.025940751656889915, 0.008393851108849049, 0.005018890835344791, -0.0433962382376194, 0.025035753846168518, -0.015582481399178505, 0.01762578636407852, 0.03351515904068947, 0.02393518015742302, 0.03571505472064018, 0.03918267786502838, 0.0064435964450240135, -0.012517853640019894, -0.005566918291151524, 0.025107035413384438, -0.009783271700143814, 0.03279291093349457, 0.01821466162800789, -0.011656243354082108, 0.01144558098167181, -0.010063478723168373, 0.04031553119421005, -0.03334653005003929, 0.028081223368644714, 0.019101521000266075, -0.0006694874609820545, 0.06093103811144829, 0.02527143619954586, 0.012867527082562447, -0.03819885477423668, -0.03549206256866455, -0.011708454228937626, -0.053587451577186584, 0.044147711247205734, 0.013241237960755825, 0.008423290215432644, 0.005224086344242096, 0.007103190757334232, -0.020720824599266052, -0.00027049423079006374, 0.013393441215157509, -0.02550862357020378, -0.015753604471683502, 0.032121431082487106, 0.0033791230525821447, -0.022007979452610016, 0.05217282474040985, 0.018057679757475853, -0.06309694051742554, -0.0082591213285923, -0.04049418866634369, 0.03953558951616287, 0.021756144240498543, 0.028624000027775764, -0.020740283653140068, 0.027917439118027687, 0.03199300915002823, -0.050823360681533813, 0.012441153638064861, 0.01543212030082941, -0.0047609517350792885, 0.057048045098781586, 0.006614095065742731, -0.031036749482154846, -0.011495239101350307, 0.0026028817519545555, 0.04052403196692467, -0.029175419360399246, -0.0036522694863379, -0.04873121157288551, -0.03295806050300598, -0.02095264196395874, -0.01615835353732109, 0.007580481935292482, -0.027737611904740334, -0.02249978296458721, 0.04614945873618126, 0.013509754091501236, 0.03198334574699402, 0.003043896285817027, 0.032567303627729416, 0.005504491738975048, 0.0023488847073167562, -0.023123618215322495, 0.02575565129518509, 0.011324333027005196, 0.022023214027285576, 0.011879632249474525, 0.04884427413344383, 0.07194346934556961, 0.022587845101952553, 0.025694413110613823, 0.02601310797035694, 0.004568140488117933, 0.041885629296302795, -0.04255294427275658, 0.032596733421087265, -0.047091320157051086, -0.01329321414232254, 0.04389796033501625, 0.003381089773029089, 0.01215243898332119, -0.005252431612461805, 0.023012282326817513, 0.022607896476984024, -0.015364126302301884, 0.017367348074913025, 0.042294345796108246, -0.0009023775928653777, -0.010551962070167065, 0.024911701679229736, -0.018307987600564957, -0.008807618170976639, 0.008601643145084381, -0.031090660020709038, 0.035110440105199814, 0.009755601175129414, -0.021885676309466362, -0.07668144255876541, 0.03274546563625336, 0.046430010348558426, 0.01346631534397602, 0.012222899124026299, -0.016873842105269432, -0.02402820810675621, 0.0017153833759948611, 0.027918869629502296, -0.06051217392086983, -0.024488795548677444, -0.010933520272374153, 0.02640511468052864, 0.00964419823139906, 0.022233810275793076, -0.037457894533872604, -0.026275724172592163, 0.03434539958834648, 0.0680348351597786, -0.0009436608524993062, 0.032788120210170746, 0.02300628088414669, 0.04313613474369049, -0.036206066608428955, -0.02068467251956463, -0.047165241092443466, -0.005372809246182442, 0.004698256962001324, -0.038659192621707916, -0.021567191928625107, 0.0739067941904068, -0.000600733095780015, -0.008513926528394222, 0.0107341930270195, 0.03361709415912628, -0.025845389813184738, -0.0017537594540044665, -0.015290756709873676, -0.01066600251942873, -0.01691734604537487, 0.010117069818079472, -0.02608686126768589, 0.04525759816169739, 0.01108957827091217, 0.032931894063949585, -0.05441834032535553, 0.041018109768629074, -0.0013789011863991618, -0.056995175778865814, 0.06191008910536766, 0.00937780924141407, -0.04784153029322624, 0.03116883896291256, 0.008981654420495033, 0.029316721484065056, 0.027155546471476555, -0.010136164724826813, 0.028894251212477684, -0.007936066947877407, 0.03364997357130051, -0.002012209966778755, 0.04230498522520065, 0.02343025989830494, -0.0022301864810287952, 0.029667437076568604, 0.06425873935222626, 0.07957432419061661, -0.005724760703742504, 0.039756420999765396, -0.02377048134803772, 0.038980405777692795, 0.014410866424441338, 0.02124427631497383, 0.04432518035173416, -0.026471460238099098, -0.029504144564270973, -0.007779991719871759, -0.02997051738202572, 0.012821652926504612, -0.017167605459690094, 0.03155966475605965, 0.0002425966813461855, -0.009150264784693718, -0.009002266451716423, -0.007711512036621571, 0.027438189834356308, 0.008043067529797554, 0.015113668516278267, -0.003660285845398903, -0.004995180293917656, -0.017462261021137238, -0.0036562036257237196, -0.009838424623012543, 0.01955018937587738, -0.01179418247193098, 0.02583674155175686, 0.0063932789489626884, 0.04343241825699806, -0.015571773052215576, 0.022814948111772537, 0.01781371980905533, -0.028757546097040176, -0.022245988249778748, -0.0021349445451050997, -0.009138350374996662, 0.038239773362874985, 0.03075264021754265, 0.014340221881866455, -0.034283872693777084, 0.06312471628189087, -0.01603671722114086, -0.04344148188829422, -0.017272938042879105, -0.0016247942112386227, -0.012803979218006134, 0.023717476055026054, 0.00803793128579855, -0.023118285462260246, 0.02476073056459427, -0.009693657979369164, -0.010467576794326305, 0.017658406868577003, -0.02124214917421341, 0.019750522449612617, -0.010662414133548737, 0.03785759583115578, -0.010078749619424343, 0.038403384387493134, -0.023056775331497192, -0.013424363918602467, 0.05105823278427124, -0.004884327296167612, -0.016563039273023605, -0.01398137304931879, 0.0008483217097818851, 0.009417804889380932, -0.01789790764451027, -0.0016295487293973565, -0.008444691076874733, -0.03168836981058121, 0.01948555000126362, 0.044339463114738464, 0.013318434357643127, -0.032507725059986115, 0.056177183985710144, -0.0017057209042832255, 0.007456285413354635, -0.005387413315474987, -0.02507178485393524, 0.023410994559526443, -0.060705505311489105, -0.0016616216162219644, 0.013782566413283348, 0.007730145938694477, -0.0352158322930336, 0.03857501596212387, -0.013233885169029236, -0.051647257059812546, -0.04344213753938675, -0.012649346143007278, 0.03714057803153992, 0.008550717495381832, -0.01834823563694954, -0.008272510021924973, 0.012704451568424702, 0.01235814206302166, 0.00949249230325222, 0.0049656713381409645, 0.015611778013408184, 0.04586338251829147, -0.03502538427710533, 0.0046640727669000626, -0.008574589155614376, 0.022447161376476288, 0.00014651882520411164, -0.023364586755633354, -0.018937712535262108, 0.014016162604093552, -0.052304163575172424, 0.01272873766720295, -0.023338714614510536, -0.006245478987693787, -0.025292394682765007, 0.020189568400382996, -0.02855999581515789, -0.01912255585193634, 0.02654031477868557, 0.07080459594726562, -0.008746540173888206, -0.019460564479231834, -0.038551170378923416, -0.03493336960673332, -0.02104070596396923, 0.01302467379719019, 0.03594738990068436, -0.0054200016893446445, 0.0014450744492933154, -0.014929693192243576, -0.005948953330516815, -0.017010530456900597, 0.011738560162484646, -0.015450222417712212, 0.009914504364132881, -0.014192785136401653, -0.04101189225912094, 0.014066889882087708, 0.029436856508255005, -0.0416354201734066, 0.06603523343801498, -0.009145398624241352, 0.004484702832996845, -0.02515525370836258, -0.026925746351480484, -0.0008816861663945019, -0.04821433499455452, 0.03904510661959648, -0.007704815361648798, 0.003490279894322157, -0.016104497015476227, 0.015642132610082626, -0.006982690189033747, -0.0033585000783205032, 0.04497338458895683, -0.027750378474593163, -0.032375991344451904, -0.03397499397397041, -0.03454442322254181, 0.054865945130586624, -0.010061020962893963, -0.039382390677928925, -0.004579250235110521, 0.003127865958958864, 0.037461113184690475, 0.039918553084135056, 0.0074908556416630745, -0.009408046491444111, -0.04723640903830528, -0.006867318879812956, -0.02542978711426258, 0.026800967752933502, 0.039758291095495224, 0.029232226312160492, 0.004364483989775181, -0.00408839900046587 ]
Scaling-up BERT Inference on CPU (Part 1)
mfuntowicz
April 20, 2021
bert-cpu-scaling-part-1
guide, nlp, partnerships, intel
https://huggingface.co/blog/bert-cpu-scaling-part-1
5. Scaling BERT Inference to increase overall throughput on modern CPU
[ 0.00306085217744112, 0.030204515904188156, 0.05271340161561966, -0.0018639019690454006, 0.04921631142497063, 0.03572114184498787, 0.046727851033210754, 0.05874251201748848, 0.012099314481019974, -0.09020163118839264, -0.031072918325662613, 0.0329541340470314, -0.013168299570679665, 0.07009454816579819, 0.02561703510582447, -0.01153518445789814, 0.055110279470682144, -0.04064038023352623, 0.018310898914933205, 0.01671607419848442, 0.01535442378371954, -0.08009374886751175, 0.12101157754659653, 0.04987359046936035, 0.016323048621416092, -0.022964926436543465, -0.03232376649975777, 0.00204664608463645, -0.08290410786867142, 0.02185237780213356, -0.1130853071808815, 0.012652893550693989, 0.024952741339802742, -0.0035171799827367067, -0.03020992875099182, -0.0032175248488783836, -0.10269275307655334, 0.06024594604969025, 0.0028049901593476534, -0.0027876298408955336, -0.024709196761250496, -0.036119185388088226, -0.03248661011457443, 0.07380614429712296, -0.026439594104886055, -0.01787722110748291, -0.1657119244337082, 0.08817121386528015, 0.007606446743011475, 0.005929857026785612, -0.0794825479388237, 0.08701726049184799, -0.041744958609342575, -0.014490974135696888, -0.005582565441727638, 0.026320505887269974, -0.007135710213333368, -0.07075512409210205, 0.04941094294190407, -0.007881923578679562, 0.05522872880101204, -0.05052024871110916, 0.013388861902058125, 0.017276087775826454, 0.014196263626217842, 0.020906105637550354, -0.013823218643665314, -0.05935531482100487, -0.05679188668727875, 0.03485902398824692, 0.015682563185691833, -0.05550730228424072, -0.015683500096201897, 0.017712140455842018, -0.0059085809625685215, -0.017186177894473076, 0.0032781893387436867, 0.011510596610605717, 0.07051972299814224, 0.03671376034617424, -0.027305714786052704, 0.015802737325429916, 0.03934459015727043, 0.04190850630402565, 0.05161403864622116, 0.043479517102241516, 0.0983218178153038, -0.025103412568569183, -0.05025038868188858, 0.043366845697164536, 0.003729031654074788, -0.12898968160152435, -0.027679458260536194, -0.0146036297082901, 0.046562086790800095, -0.020551810041069984, 0.02206282876431942, 0.041102416813373566, -0.014419551938772202, 0.0017206361517310143, 0.018259845674037933, -0.040024518966674805, 0.06264123320579529, -0.023536356166005135, -0.07350952923297882, 0.01933816634118557, 0.008149223402142525, -0.10849770158529282, -0.06499271094799042, 0.05475419759750366, -0.01857881434261799, -0.00025971440481953323, 0.007447239477187395, 0.034652985632419586, -0.09258296340703964, 0.03846682608127594, -0.008785794489085674, 0.016009213402867317, 0.06014283746480942, 0.010966655798256397, -0.005033263936638832, 0.08371523767709732, 0.08255112171173096, -0.03708771616220474, 0.009409235790371895, 0.020578917115926743, 0.06231437250971794, -0.006241283379495144, 0.026551416143774986, 0.00555184343829751, 0.03166576474905014, -0.01729346066713333, 0.0324455089867115, -0.007200128864496946, 0.005022423341870308, -0.004766331519931555, -0.033232685178518295, -0.048538632690906525, -0.026771167293190956, 0.0032304765190929174, -0.0345628559589386, -0.009793485514819622, 0.00581932719796896, 0.02714862860739231, 0.04596363380551338, -0.0019108412088826299, -0.10922447592020035, 0.03557775169610977, -0.005626077763736248, -0.0076311929151415825, -0.10373659431934357, 0.02291249856352806, -0.0849003866314888, -0.07010577619075775, 0.04830385372042656, 0.06798478960990906, 0.018867336213588715, -0.059271492063999176, -0.08600491285324097, -0.05673181638121605, 0.0009261735831387341, -0.03018738143146038, -0.01836436241865158, -0.03666394203901291, 0.03552059084177017, -0.04484444856643677, 0.01830917038023472, 0.01588890515267849, 0.012729416601359844, 0.0008307067328132689, -0.023219658061861992, 0.0228924211114645, 0.08571527153253555, -0.02035222202539444, -0.03776508569717407, 0.023547060787677765, 0.04625701159238815, 0.09921012818813324, -0.03718295320868492, -0.002057389123365283, -0.04477517679333687, 0.029297828674316406, 0.005175052676349878, 0.06730851531028748, 0.006889315787702799, -0.09663617610931396, 0.02261512540280819, -0.02241635136306286, 0.012586256489157677, 0.014289735816419125, -0.02301272191107273, -0.027581453323364258, 0.08881784230470657, 0.007769290823489428, 0.017827516421675682, -0.022322673350572586, -0.03030296042561531, 0.11451228708028793, 0.06655061990022659, 0.061150047928094864, 0.04400596767663956, -0.00706962076947093, 0.043813277035951614, 0.0028522778302431107, -0.027071919292211533, -0.008341035805642605, 0.038762327283620834, -0.029190819710493088, 0.006149977911263704, 0.019429607316851616, -0.009293709881603718, -0.12690722942352295, -0.03833254426717758, -0.08236445486545563, -0.0639360100030899, -0.06778079271316528, -0.006868341471999884, 0.0005853759357705712, 0.04342454671859741, -0.07507505267858505, 0.10335592180490494, -0.03516627103090286, 0.006190515123307705, 0.034863974899053574, -0.021379949524998665, 0.04195426404476166, 0.07652169466018677, -0.032455842941999435, 0.07244761288166046, -0.03427257388830185, -0.030071843415498734, -0.049893952906131744, 0.028710493817925453, 0.09122282266616821, 0.008914022706449032, 0.024121003225445747, -0.05393913388252258, -0.004210717510432005, 0.06973396241664886, -0.10781806707382202, -0.006027184892445803, 0.04169582203030586, -0.00011416871711844578, 0.05740092694759369, 0.0052729155868291855, -0.04394879192113876, 0.05288715660572052, 0.04217837005853653, 0.0007510811556130648, -0.016737233847379684, -0.03790275380015373, 0.034889575093984604, 0.011297567747533321, -0.06954053789377213, 0.046668436378240585, 0.0435016043484211, -0.011333569884300232, -0.015001196414232254, -0.018453659489750862, 0.028340933844447136, 0.04263431206345558, -0.030112270265817642, 0.015158787369728088, -0.036492593586444855, 0.014205548912286758, -0.060463253408670425, -0.01891515590250492, 0.0006015736144036055, -0.022944293916225433, 0.028417443856596947, -0.0028848648071289062, -0.0316866934299469, 0.024871552363038063, -0.002667523454874754, 0.036655109375715256, -0.0008828399586491287, 0.05053984373807907, -0.01956409402191639, -0.019240546971559525, -0.02184818871319294, -0.013768712058663368, -0.03425685688853264, 0.024382710456848145, 0.011904215440154076, 0.009447623044252396, -0.005276120267808437, 0.010919637978076935, -0.013305180706083775, 0.01151018775999546, 0.021006474271416664, -0.0029923368711024523, 0.00014483807899523526, -0.029470860958099365, -0.021438108757138252, 0.029301369562745094, 0.013938809745013714, 0.013174977153539658, -0.0013661880511790514, -0.015218988060951233, -0.021038338541984558, 0.011360574513673782, 0.028254754841327667, -0.03214965760707855, -0.005826408974826336, -0.0638202577829361, 0.04864168539643288, -0.0006153698195703328, 0.046893227845430374, -0.11366787552833557, -0.028140151873230934, 0.015047887340188026, 0.02893855795264244, -0.012229442596435547, -0.022460812702775, 0.03341752290725708, -0.032367903739213943, -0.02816462330520153, -0.004360797815024853, 0.028986668214201927, 0.04161550849676132, 0.05018293857574463, -0.013285077176988125, -0.005959141533821821, -0.009111584164202213, -0.0005741305649280548, 0.001210404559969902, -0.002052760450169444, 0.01316911168396473, 0.0064549013040959835, 0.03095763735473156, -0.029808606952428818, -0.01396946795284748, 0.028976162895560265, 0.06505053490400314, -0.010412787087261677, 0.016896922141313553, 0.03251996263861656, -0.022303298115730286, -0.026874540373682976, -0.01087892148643732, -0.006717075128108263, 0.020056171342730522, -0.0156521275639534, 0.0155938770622015, -0.028980586677789688, 0.015587789006531239, 0.032635513693094254, 0.04368079826235771, 0.03962594270706177, 0.0010094884783029556, 0.041865892708301544, -0.038397978991270065, -0.007916712202131748, -0.002539905020967126, 0.018942728638648987, 0.00748403137549758, 0.025143831968307495, -0.03287014737725258, -0.018577992916107178, -0.029318349435925484, -0.005778673104941845, 0.04118839278817177, 0.0025379841681569815, 0.00007594696944579482, -0.03909071162343025, -0.005329401232302189, 0.04080754145979881, -0.011327283456921577, -0.03715398907661438, 0.02072068117558956, 0.015880143269896507, 0.01580703631043434, -0.0428791381418705, 0.06309022009372711, 0.03229983150959015, -0.0029637760017067194, -0.006991800386458635, 0.027890708297491074, 0.013488435186445713, 0.061897095292806625, 0.02305459976196289, 0.016726069152355194, -0.024613860994577408, 0.02140258625149727, -0.012166444212198257, 0.0029933445621281862, 0.06837703287601471, -0.023291494697332382, -0.030707765370607376, 0.00014087746967561543, -0.0011853754986077547, -0.01844680681824684, 0.013966759666800499, 0.003621076699346304, -0.01494608260691166, -0.005142204463481903, 0.019816739484667778, 0.03133654221892357, 0.006901752669364214, -0.026337381452322006, 0.014050024561583996, -0.01893899403512478, 0.013427487574517727, 0.00846632570028305, 0.06136644631624222, 0.020087774842977524, -0.003549042623490095, 0.0015504376497119665, 0.026469988748431206, -0.04052158445119858, 0.00673465384170413, 0.019155099987983704, 0.024664968252182007, 0.04461866617202759, 0.0014964290894567966, -0.021432461217045784, -0.0026376848109066486, 0.018901051953434944, -0.011364433914422989, -0.018114309757947922, 0.0010732078226283193, -0.004061720333993435, 0.028034178540110588, 0.000978092197328806, -0.01692456379532814, -0.00933571346104145, -0.03715359792113304, 0.009863578714430332, -0.013858434744179249, 0.02576005458831787, 0.0080788005143404, 0.0074934279546141624, 0.049490101635456085, -0.010078190825879574, 0.019396016374230385, 0.025280486792325974, -0.029821867123246193, -0.028050370514392853, -0.04223951697349548, -0.031201917678117752, 0.06808878481388092, 0.010696852579712868, 0.03152552992105484, 0.006671962793916464, -0.014526798389852047, -0.002445661462843418, -0.015061935409903526, -0.05695856735110283, -0.005266052205115557, 0.05452658236026764, 0.026727555319666862, -0.04885244742035866, 0.022727936506271362, 0.005276704207062721, -0.022908348590135574, -0.03978119418025017, -0.005807402078062296, 0.02243543043732643, 0.05246288329362869, -0.01594359613955021, -0.047591179609298706, 0.021300671622157097, 0.0385589636862278, -0.006132034119218588, 0.007025346625596285, 0.037545185536146164, 0.019901733845472336, 0.05464325100183487, 0.019079476594924927, -0.007734565995633602, -0.0414583794772625, 0.0027671060524880886, 0.00916650053113699, -0.04318917915225029, 0.004725304432213306, -0.02973818965256214, 0.001797045231796801, -0.006323676556348801, 0.00911008846014738, 0.007051171734929085, 0.003211424220353365, -0.04672250151634216, 0.03461601585149765, 0.012231685221195221, 0.02031671442091465, 0.024282794445753098, -0.001991045428439975, 0.013564514927566051, 0.009018564596772194, -0.040602996945381165, -0.010159178636968136, 0.030122555792331696, -0.021887021139264107, 0.021637912839651108, 0.049053553491830826, 0.04796750098466873, -0.03386217728257179, 0.005196689628064632, 0.03557135909795761, -0.011232826858758926, -0.0015267976559698582, -0.029026776552200317, 0.022817453369498253, -0.04781642556190491, 0.020543575286865234, 0.03455129265785217, 0.005078272894024849, 0.009404834359884262, -0.006535256747156382, 0.032832685858011246, -0.0003547733067534864, -0.013205572962760925, 0.04460615664720535, -0.00664503825828433, -0.00997333973646164, -0.04479397088289261, 0.006489138584583998, -0.0014056650688871741, 0.00466695474460721, 0.013992872089147568, -0.03439375385642052, 0.019553883001208305, -0.010134837590157986, -0.03181326016783714, -0.05335360765457153, 0.057411741465330124, -0.0020572496578097343, 0.012007514014840126, -0.00022776257537771016, -0.030295774340629578, -0.02024124749004841, 0.005264577455818653, -0.008369715884327888, -0.046617090702056885, -0.008535574190318584, -0.016553906723856926, -0.008793500252068043, 0.06948187947273254, 0.029085109010338783, -0.014574521221220493, -0.005369253922253847, 0.07415543496608734, 0.033491916954517365, -0.019005073234438896, -0.026134079322218895, 0.04783467948436737, 0.009837896563112736, 0.006857594940811396, 0.021378347650170326, -0.04040999710559845, -0.028682559728622437, 0.010144977830350399, -0.05212270841002464, -0.025011349469423294, 0.06353254616260529, 0.00470398087054491, 0.006207593251019716, -0.002203191863372922, 0.023991528898477554, -0.030379842966794968, -0.021243296563625336, 0.024248147383332253, -0.010122201405465603, 0.03203378617763519, 0.007755076978355646, -0.03223559260368347, 0.021129900589585304, 0.011342049576342106, 0.020670855417847633, -0.05173098295927048, 0.018876854330301285, 0.0058433180674910545, -0.03968610614538193, 0.05335303768515587, -0.013845724985003471, -0.02398325875401497, 0.03827286511659622, 0.0322207435965538, 0.00968406442552805, 0.009532070718705654, 0.004384991247206926, 0.003426483366638422, -0.017345115542411804, 0.018285298720002174, 0.026679575443267822, 0.06722793728113174, 0.021496474742889404, 0.022380253300070763, 0.007013773545622826, 0.04730445146560669, 0.03726606443524361, -0.024956434965133667, -0.03386526554822922, 0.010975501500070095, 0.08769109100103378, -0.02146678976714611, 0.0196447242051363, 0.035157378762960434, 0.005367827136069536, -0.0040755970403552055, 0.005503028631210327, -0.0017979982076212764, -0.015392760746181011, -0.02486748993396759, 0.037497617304325104, -0.026429032906889915, 0.015527178533375263, -0.03080570511519909, 0.033052194863557816, 0.03338073566555977, 0.030781114473938942, -0.0004827349039260298, -0.010953519493341446, -0.025416528806090355, 0.015202386304736137, -0.02369152568280697, -0.015402917750179768, 0.010021882131695747, 0.007501183543354273, 0.03305137902498245, 0.012919299304485321, 0.03612177446484566, 0.00921738613396883, -0.06875576078891754, 0.01046066451817751, -0.013120046816766262, -0.00022630422608926892, -0.004695768002420664, 0.016899095848202705, -0.01401812955737114, 0.028025493025779724, -0.0033701607026159763, -0.058614134788513184, 0.003514585318043828, -0.01440091896802187, -0.024183886125683784, -0.019323762506246567, -0.02683527208864689, -0.009299885481595993, 0.018630169332027435, 0.0033065052703022957, -0.017247408628463745, 0.013032757677137852, -0.010686613619327545, 0.018580427393317223, 0.03875686973333359, -0.03408815339207649, -0.033785246312618256, -0.003737199818715453, 0.007454389240592718, -0.02877211384475231, 0.018835848197340965, -0.03439868986606598, 0.0030781764071434736, 0.015328922308981419, 0.0008446673746220767, -0.026521801948547363, 0.016865599900484085, 0.02043161354959011, 0.011278364807367325, -0.0443318635225296, 0.02297503687441349, -0.00022555008763447404, -0.04863578453660011, -0.01095161959528923, -0.04247508570551872, -0.019305968657135963, 0.00023741832410451025, 0.011822921223938465, 0.010181772522628307, 0.04836253076791763, -0.011849235743284225, -0.03286045789718628, -0.006117369048297405, -0.03270662575960159, -0.057103198021650314, 0.03994409739971161, 0.030715610831975937, -0.024651041254401207, -0.007022883277386427, 0.009083021432161331, -0.03448020666837692, -0.009202313609421253, -0.0018197261961176991, 0.08138586580753326, 0.0008303537615574896, -0.04129300266504288, -0.035483218729496, 0.02161642350256443, 0.00044876779429614544, 0.03862766548991203, 0.021516377106308937, 0.00433715432882309, 0.018236707895994186, -0.05248697102069855, -0.0011529383482411504, -0.002129145199432969, 0.02285945974290371, -0.03763318806886673, -0.027504974976181984, -0.03245191648602486, 0.0008515316876582801, -0.015154839493334293, 0.023619363084435463, -0.017926543951034546, -0.016225632280111313, -0.05008529871702194, -0.010547652840614319, -0.03595827892422676, 0.007522167172282934, 0.047467395663261414, 0.04134320467710495, 0.04139676317572594, 0.0159535501152277, -0.024616491049528122, -0.026580708101391792, -0.01729375496506691, 0.025932300835847855, 0.048131849616765976, 0.02458968013525009, -0.04843435436487198, -0.043151337653398514, -0.004599828273057938, -0.014373691752552986, -0.05917143076658249, 0.01503631193190813, 0.006969183683395386, -0.007698414847254753, -0.015880359336733818, 0.0008440595702268183, 0.027911972254514694, -0.031406622380018234, 0.065791055560112, 0.02751363441348076, -0.0140517707914114, -0.017959408462047577, -0.01819700002670288, -0.050743043422698975, -0.04758427292108536, 0.021815519779920578, -0.020592667162418365, 0.0698600560426712, 0.022710591554641724, 0.0036333806347101927, -0.017062155529856682, -0.04296661168336868, 0.02600168250501156, -0.009184421971440315, -0.04525380581617355, -0.03143579140305519, 0.0054776170291006565, 0.0025561144575476646, -0.04194188863039017, -0.06243881583213806, 0.022429099306464195, 0.022834019735455513, 0.0024833455681800842, 0.013368550688028336, -0.0023627402260899544, -0.00024417502572759986, -0.030888257548213005, 0.02019486203789711, 0.006453176029026508, 0.050139170140028, 0.03956253454089165, 0.02365422248840332, 0.03208363056182861, -0.012126343324780464 ]
Scaling-up BERT Inference on CPU (Part 1)
mfuntowicz
April 20, 2021
bert-cpu-scaling-part-1
guide, nlp, partnerships, intel
https://huggingface.co/blog/bert-cpu-scaling-part-1
Acknowledgments - Omry Yadan (Facebook FAIR) - Author of OmegaConf & Hydra for all the tips setting up Hydra correctly. - All Intel & Intel Labs' NLP colleagues - For the ongoing optimizations and research efforts they are putting into transformers and more generally in the NLP field. - Hugging Face colleagues - For all the comments and improvements in the reviewing process.
[ 0.03233789652585983, -0.041950736194849014, 0.008500044234097004, 0.0011619790457189083, 0.08162808418273926, 0.02665688656270504, -0.003625736339017749, 0.08517995476722717, 0.009315467439591885, -0.021801091730594635, -0.1022641658782959, 0.04134190455079079, -0.015366842970252037, 0.02438102848827839, 0.004941947292536497, 0.024093108251690865, 0.01708652637898922, 0.04975651204586029, -0.03552909940481186, 0.059691209346055984, 0.015248476527631283, -0.06073366478085518, 0.031266387552022934, 0.015292889438569546, 0.010167237371206284, -0.04852600395679474, -0.034615445882081985, 0.0012618603650480509, -0.05444791167974472, 0.07300356775522232, -0.05551538243889809, -0.017168737947940826, 0.0072770677506923676, -0.0694788247346878, 0.006796874105930328, 0.021988848224282265, -0.08789223432540894, -0.015683624893426895, -0.002508214209228754, 0.007182840723544359, 0.01543990895152092, -0.046397414058446884, -0.09690002351999283, 0.0372888445854187, -0.022445503622293472, -0.01814119517803192, -0.1276680827140808, 0.03912213072180748, -0.012316632084548473, -0.022870657965540886, -0.06193823367357254, 0.018278196454048157, -0.0016841308679431677, 0.01632404699921608, 0.038064081221818924, 0.04017970710992813, -0.02019771933555603, -0.02289068140089512, 0.005783527158200741, 0.01878124661743641, 0.07191533595323563, 0.01596861332654953, -0.022227484732866287, 0.024184273555874825, 0.03039986453950405, 0.031837690621614456, -0.0064359731040894985, -0.03481532260775566, -0.12011738121509552, 0.03883960098028183, 0.02987985499203205, 0.06802356243133545, -0.048380810767412186, -0.0016491403803229332, 0.03495485708117485, 0.0369466207921505, 0.03831703960895538, 0.03442084416747093, -0.004634912591427565, 0.03101935237646103, -0.0367010198533535, 0.009989380836486816, 0.08440311998128891, 0.0841725543141365, 0.0013543643290176988, 0.006801520008593798, 0.07453087717294693, -0.02302359603345394, -0.05686803162097931, 0.02220051921904087, 0.021278880536556244, -0.12637531757354736, -0.013952254317700863, -0.007628808729350567, 0.05235632136464119, -0.04877142980694771, 0.004638453479856253, 0.015111969783902168, 0.0007127246935851872, -0.0391952320933342, -0.02490130253136158, -0.026451682671904564, -0.05274615436792374, -0.04641513153910637, -0.04243183135986328, -0.05674995854496956, -0.020414741709828377, -0.059769269078969955, -0.0038508749566972256, 0.08121979236602783, -0.05289049446582794, 0.05443732440471649, 0.05132075771689415, 0.059444211423397064, -0.10393347591161728, 0.05021137371659279, -0.009296505711972713, -0.020515549927949905, 0.030794981867074966, -0.0043191611766815186, 0.0390145480632782, 0.09251037985086441, 0.0466093048453331, 0.006677898112684488, 0.039297863841056824, 0.026715191081166267, -0.028547940775752068, 0.01970391720533371, -0.005379116628319025, -0.04014193266630173, -0.01832609437406063, -0.07239873707294464, -0.008286713622510433, -0.011054587550461292, -0.054509058594703674, -0.06409052759408951, 0.04423774033784866, -0.07286490499973297, -0.020622985437512398, 0.04636817052960396, -0.00714998971670866, 0.04224078729748726, -0.005475331097841263, -0.0018664239905774593, 0.08430001139640808, 0.014694029465317726, -0.10464729368686676, 0.0453813411295414, 0.026576736941933632, -0.04819575324654579, -0.03715457022190094, -0.032675713300704956, -0.008298369124531746, -0.03975662961602211, 0.08936969190835953, 0.07197561860084534, 0.013093804009258747, 0.005641797091811895, -0.02841511368751526, -0.049351755529642105, 0.01169948186725378, 0.008727602660655975, -0.07971982657909393, 0.008322669193148613, 0.007928933016955853, -0.026010708883404732, 0.006230047903954983, 0.0049759093672037125, -0.014572111889719963, 0.037707190960645676, 0.0212005116045475, -0.004979460965842009, 0.05320858955383301, 0.01985045149922371, -0.0045279753394424915, 0.019606510177254677, 0.016246726736426353, 0.06423944979906082, -0.00799797847867012, -0.020587798207998276, -0.05581413954496384, 0.04555028676986694, 0.00362749258056283, 0.1176816001534462, 0.08509258925914764, -0.046896226704120636, 0.015737198293209076, -0.006865539122372866, -0.0045562186278402805, 0.041315726935863495, -0.043493594974279404, 0.04248471185564995, 0.12443733960390091, -0.03224535658955574, 0.02690216153860092, -0.06893007457256317, -0.05411592125892639, 0.083511583507061, 0.06966256350278854, 0.05461684241890907, 0.07934261858463287, -0.0207972452044487, 0.048793233931064606, -0.022600263357162476, -0.043746594339609146, -0.018689140677452087, 0.017651574686169624, -0.0871109664440155, -0.04152070730924606, 0.037983402609825134, -0.005859587341547012, -0.09231265634298325, 0.020989377051591873, -0.017663072794675827, 0.0031899786554276943, -0.049726177006959915, 0.014989254996180534, 0.06427545845508575, -0.014457065612077713, -0.015718242153525352, 0.1339765191078186, 0.00733219413086772, 0.018484313040971756, -0.011818956583738327, 0.06531205773353577, 0.023236460983753204, 0.07261382043361664, 0.06652101129293442, 0.01087762787938118, -0.0450003482401371, -0.0072476621717214584, -0.05958615615963936, -0.00023518205853179097, 0.0994115099310875, 0.005174493417143822, -0.03224187344312668, -0.01753940060734749, 0.0005463454290293157, 0.05808870866894722, -0.00017013857723213732, -0.01925966516137123, 0.0003045162302441895, 0.00698835076764226, 0.022171681746840477, 0.017983322963118553, 0.0017526214942336082, 0.010616513900458813, -0.01979736052453518, 0.030551480129361153, -0.0009674072498455644, -0.1494661420583725, 0.07917133718729019, 0.04911205172538757, -0.04073265567421913, 0.0403357669711113, -0.013507626950740814, 0.03692367672920227, 0.004391727969050407, 0.00759213836863637, 0.013248707167804241, 0.02603200264275074, -0.021459825336933136, -0.013536256738007069, -0.0059524220414459705, -0.010388042777776718, -0.02385360561311245, -0.01856905408203602, 0.03862015902996063, 0.0005911642219871283, 0.04467464238405228, -0.00332262902520597, 0.0074483840726315975, 0.02933264710009098, -0.007064696401357651, 0.00718173012137413, -0.03659822791814804, -0.004265387076884508, -0.030980145558714867, 0.004571827128529549, -0.06613436341285706, 0.02415032684803009, 0.014474724419414997, 0.018790295347571373, 0.026465030387043953, -0.03420095145702362, -0.04506777226924896, -0.047623440623283386, -0.05600528046488762, -0.06673797965049744, 0.013155937194824219, -0.01752692274749279, 0.01905539259314537, -0.011699698865413666, 0.010006084106862545, 0.0251315925270319, -0.010033110156655312, -0.043350644409656525, 0.022767510265111923, -0.03957240656018257, 0.04681967943906784, -0.003339504823088646, 0.006645943503826857, 0.011638079769909382, 0.018780766054987907, 0.017365025356411934, 0.0269167423248291, 0.030965175479650497, 0.021634140983223915, -0.09357549250125885, -0.03647409379482269, 0.054932452738285065, 0.03448036313056946, -0.03361799195408821, -0.053033746778964996, 0.04668094962835312, -0.02471024915575981, -0.02761918120086193, -0.011381850577890873, -0.020828431472182274, 0.011825448833405972, 0.041409626603126526, 0.008527255617082119, -0.005244803614914417, 0.002483267104253173, 0.00995730608701706, -0.025096409022808075, 0.04931625351309776, -0.0035262114834040403, -0.038097549229860306, 0.01721237599849701, -0.012355073355138302, -0.029286354780197144, 0.0007499503553844988, 0.035682935267686844, 0.037759944796562195, 0.02819463238120079, 0.0030048340559005737, -0.06583753228187561, -0.030924513936042786, -0.005548956338316202, -0.03734055534005165, 0.04549938440322876, -0.001814811141230166, 0.009232713840901852, -0.02770262025296688, 0.03763367235660553, -0.0018118855077773333, 0.04119747132062912, 0.03284003958106041, 0.0031767748296260834, 0.03628072515130043, -0.03471815213561058, 0.00006551670958288014, -0.0051429541781544685, -0.032246075570583344, -0.030515138059854507, -0.04031142592430115, -0.04384260252118111, -0.03583376854658127, -0.015814872458577156, -0.00589262880384922, 0.04739127308130264, -0.03275710344314575, 0.021026769652962685, -0.029002012684941292, -0.03934787958860397, 0.017155975103378296, -0.04000338166952133, -0.0576152503490448, 0.02578115463256836, -0.04384472593665123, -0.026980075985193253, -0.004167668987065554, 0.09408684074878693, 0.024910641834139824, -0.04071815311908722, -0.03866288438439369, 0.019750108942389488, 0.00039637545705772936, 0.027123484760522842, -0.03860558569431305, -0.009667365811765194, 0.032885901629924774, -0.008136874064803123, -0.003988373558968306, -0.010693888179957867, 0.024852342903614044, -0.03133046627044678, -0.06027255579829216, -0.06252559274435043, -0.06636973470449448, -0.005782548803836107, -0.013163143768906593, 0.038489993661642075, 0.018924655392766, -0.04156557098031044, 0.021471701562404633, -0.007346185389906168, 0.015103643760085106, -0.008988672867417336, -0.019344868138432503, -0.03740040585398674, -0.016659924760460854, -0.03283878043293953, -0.014422274194657803, 0.00026232984964735806, 0.03254513442516327, 0.0018331775208935142, 0.007501705549657345, -0.02132241427898407, 0.01681581325829029, -0.017323851585388184, 0.004033577162772417, 0.038297075778245926, 0.011956620961427689, -0.04395239055156708, -0.013906687498092651, 0.018672853708267212, 0.03136999160051346, -0.013747199438512325, 0.005123579408973455, -0.009651475585997105, 0.021333640441298485, 0.018446600064635277, -0.016552262008190155, 0.027660148218274117, -0.04407273232936859, 0.018873702734708786, -0.039433371275663376, 0.01834721863269806, 0.014563396573066711, -0.030401797965168953, 0.040025319904088974, -0.03662779554724693, 0.0021863533183932304, 0.02621275745332241, 0.0039062038995325565, -0.017590653151273727, -0.03235375136137009, -0.0018597397720441222, 0.08141693472862244, 0.017492353916168213, -0.005639748182147741, 0.005729928612709045, -0.016452211886644363, 0.0479162335395813, -0.024897294119000435, -0.015246800146996975, 0.057688675820827484, 0.03403981029987335, 0.041528116911649704, -0.058142710477113724, 0.015453910455107689, 0.010021480731666088, 0.005715746432542801, 0.019410207867622375, 0.028283659368753433, 0.043078646063804626, 0.007989340461790562, 0.01740788109600544, 0.023071113973855972, 0.046873629093170166, 0.03803423419594765, -0.004551760386675596, 0.006747317500412464, -0.01631581038236618, -0.008424916304647923, 0.04642102122306824, -0.009464841336011887, 0.002607156988233328, -0.0699479952454567, 0.015452326275408268, 0.030492102727293968, 0.010743285529315472, 0.0006431422079913318, -0.07078191637992859, -0.004507377743721008, 0.0023935697972774506, -0.032133519649505615, 0.023952452465891838, -0.01838083006441593, -0.0017389674903824925, 0.01034724060446024, 0.020579956471920013, 0.048976413905620575, 0.03829852119088173, -0.0014691287651658058, 0.01287800632417202, -0.011863872408866882, 0.0006108942325226963, 0.035501882433891296, -0.008060739375650883, 0.030609378591179848, 0.019012901932001114, 0.06803979724645615, 0.026179708540439606, -0.020223012194037437, -0.001892891013994813, -0.013295304961502552, -0.03986319899559021, -0.0445048063993454, -0.018841467797756195, 0.04662793129682541, 0.0032957985531538725, -0.014182393439114094, 0.05055955797433853, -0.029521843418478966, -0.006307237781584263, 0.0430794358253479, 0.02310771681368351, -0.021530618891119957, 0.026277564465999603, 0.033641692250967026, 0.012637896463274956, 0.008892644196748734, -0.011883364990353584, 0.012283101677894592, -0.016283314675092697, -0.0003471205127425492, 0.010467569343745708, 0.015622253529727459, -0.010316608473658562, 0.00865990575402975, -0.053928062319755554, -0.02879265882074833, 0.030480511486530304, 0.021692201495170593, 0.032644182443618774, -0.013186643831431866, -0.03233519569039345, 0.004441356286406517, 0.01496351882815361, 0.0538397952914238, 0.004153554793447256, 0.007034864276647568, 0.015375206246972084, -0.010310767218470573, 0.028451789170503616, 0.03015749529004097, 0.0030490290373563766, -0.033973995596170425, 0.042249660938978195, 0.04783423990011215, -0.004484333097934723, -0.011119522154331207, 0.011520188301801682, 0.028431283310055733, -0.05688517540693283, 0.03247927501797676, -0.027321795001626015, -0.001496030017733574, -0.03918963670730591, -0.025355704128742218, 0.04372907429933548, 0.06054673343896866, 0.0008210625383071601, 0.0005931623163633049, -0.017233122140169144, 0.013093676418066025, -0.0228080116212368, -0.041304394602775574, -0.007896004244685173, 0.014292052015662193, -0.02462741546332836, 0.04748052358627319, 0.05873444303870201, -0.010098055005073547, 0.02233419567346573, 0.003331379499286413, -0.02693779766559601, -0.02347416803240776, -0.007094537373632193, -0.029895920306444168, -0.0011519030667841434, 0.0066748131066560745, -0.006674535572528839, 0.004480983596295118, -0.01078540738672018, 0.0031463969498872757, 0.0026415016036480665, 0.03579959645867348, 0.03066427633166313, -0.025464631617069244, -0.002547435462474823, 0.05667100101709366, 0.039552874863147736, 0.014519879594445229, -0.05899003893136978, 0.05410141125321388, 0.03988365828990936, 0.038792114704847336, 0.016102585941553116, -0.021904733031988144, 0.001689346507191658, 0.022255927324295044, -0.02127808891236782, 0.01728961430490017, 0.020772729068994522, -0.043358419090509415, -0.016358325257897377, -0.015987208113074303, -0.04977953061461449, -0.01929929479956627, 0.04304099455475807, 0.04067198559641838, -0.02404121309518814, -0.0328742191195488, -0.029032906517386436, 0.04424116760492325, 0.011701849289238453, -0.01666402816772461, 0.03794917091727257, -0.012174349278211594, -0.0002037596277659759, -0.0023675982374697924, 0.01945279724895954, -0.008775909431278706, -0.020026465877890587, -0.006023954600095749, 0.06811049580574036, -0.016282331198453903, 0.026811229065060616, -0.010281275026500225, -0.006255757994949818, 0.0119050657376647, -0.02149566449224949, -0.0032419259659945965, 0.0026941660325974226, 0.019175130873918533, 0.02452036738395691, -0.023095041513442993, -0.011055069975554943, -0.03703482449054718, 0.007443869486451149, 0.005273502320051193, 0.02716701664030552, 0.014651375822722912, 0.021472634747624397, -0.0010004525538533926, 0.04640701040625572, -0.011044648475944996, -0.015669699758291245, 0.03778483718633652, -0.021416278555989265, -0.008729473687708378, 0.02629677951335907, -0.03481341525912285, -0.026491759344935417, -0.04234063997864723, -0.008917950093746185, -0.007786538917571306, 0.01898369751870632, -0.007259630598127842, -0.058186572045087814, -0.005427144467830658, 0.08269350230693817, -0.012709238566458225, -0.003972208593040705, 0.014927851036190987, -0.028421366587281227, -0.026704108342528343, -0.004019706975668669, -0.028766877949237823, -0.007514059077948332, -0.016395628452301025, -0.03970756381750107, 0.018035465851426125, -0.01615826226770878, -0.015120196156203747, 0.004362811800092459, 0.058002639561891556, -0.026787858456373215, -0.01541491411626339, 0.015410112217068672, 0.007854487746953964, -0.056412145495414734, 0.022365476936101913, -0.0012666145339608192, 0.02263670414686203, 0.009570644237101078, -0.030679382383823395, -0.018556956201791763, -0.03030615672469139, 0.008069518953561783, 0.044486626982688904, -0.005818320903927088, -0.015888232737779617, 0.004936663433909416, 0.03549859672784805, 0.02914590947329998, -0.011992393061518669, 0.03178082033991814, 0.024310549721121788, 0.016827616840600967, -0.037345875054597855, -0.02453169785439968, 0.009422656148672104, -0.033071037381887436, -0.013499340042471886, -0.012469583190977573, -0.018413251265883446, 0.03401694819331169, 0.036070194095373154, 0.00823017954826355, -0.05276995524764061, 0.003510779934003949, -0.03885268792510033, -0.026589058339595795, -0.018636487424373627, -0.008402932435274124, 0.07754657417535782, 0.034806184470653534, 0.019838497042655945, 0.022409852594137192, 0.023935511708259583, -0.04777785763144493, -0.036853183060884476, 0.016238003969192505, 0.044043540954589844, 0.024332234635949135, -0.01194383017718792, -0.048986248672008514, 0.014966560527682304, -0.02201356552541256, -0.05090557411313057, 0.006216918118298054, 0.015455728396773338, 0.005825695116072893, -0.04514170438051224, -0.008959940634667873, 0.015159651637077332, 0.00020252232206985354, 0.016300395131111145, -0.018785404041409492, -0.014361757785081863, -0.014040241949260235, -0.01762852445244789, -0.05843064934015274, -0.0012386986054480076, -0.012610605917870998, 0.043076205998659134, -0.02362915873527527, -0.006816714070737362, -0.008289382793009281, -0.00935112964361906, 0.007868756540119648, 0.03100426122546196, 0.011667970567941666, -0.048159159719944, -0.011696345172822475, 0.0022332731168717146, 0.019224485382437706, -0.018902841955423355, -0.07196427136659622, 0.010178054682910442, 0.0028602092061191797, -0.02652476169168949, 0.007154745515435934, -0.012035893276333809, 0.017775369808077812, -0.021109681576490402, 0.005652079824358225, 0.040770746767520905, 0.06330902874469757, 0.040209487080574036, -0.018642514944076538, 0.007391584571450949, -0.024255434051156044 ]
Scaling-up BERT Inference on CPU (Part 1)
mfuntowicz
April 20, 2021
bert-cpu-scaling-part-1
guide, nlp, partnerships, intel
https://huggingface.co/blog/bert-cpu-scaling-part-1
2. Benchmarking methodology When it comes to leveraging BERT-like models from Hugging Face's model hub, there are many knobs which can be tuned to make things faster. Also, in order to quantify what "faster" means, we will rely on widely adopted metrics: - Latency: Time it takes for a single execution of the model (i.e. forward call) - Throughput: Number of executions performed in a fixed amount of time These two metrics will help us understand the benefits and tradeoffs along this blog post. The benchmarking methodology was reimplemented from scratch in order to integrate the latest features provided by transformers and also to let the community run and share benchmarks in an hopefully easier way. The whole framework is now based on Facebook AI & Research's Hydra configuration library allowing us to easily report and track all the items involved while running the benchmark, hence increasing the overall reproducibility. You can find the whole structure of the project here On the 2021 version, we kept the ability to run inference workloads through PyTorch and Tensorflow as in the previous blog (1) along with their traced counterpart TorchScript (6), Google Accelerated Linear Algebra (XLA) (7). Also, we decided to include support for ONNX Runtime (8) as it provides many optimizations specifically targeting transformers based models which makes it a strong candidate to consider when discussing performance. Last but not least, this new unified benchmarking environment will allow us to easily run inference for different scenarios such as Quantized Models (Zafrir & al.) (9) using less precise number representations (float16, int8, int4). This method known as quantization has seen an increased adoption among all major hardware providers. In the near future, we would like to integrate additional methods we are actively working on at Hugging Face, namely Distillation, Pruning & Sparsificaton.
[ -0.02516729198396206, -0.009265994653105736, 0.0167047381401062, -0.0029997408855706453, -0.008436138741672039, 0.04262854531407356, 0.051198601722717285, 0.04679373651742935, -0.02928340807557106, -0.045926567167043686, -0.07552995532751083, 0.0875883549451828, -0.024907751008868217, 0.031104950234293938, 0.0322357639670372, -0.049544718116521835, 0.04896343871951103, 0.004775354638695717, 0.027936631813645363, 0.01143602468073368, -0.011243801563978195, -0.06118541583418846, 0.07727091014385223, -0.01316948514431715, -0.019198602065443993, -0.06024546921253204, 0.026647241786122322, -0.03390049561858177, -0.02997741289436817, 0.04396815225481987, -0.10147536545991898, 0.000982973026111722, 0.014994335360825062, -0.04247848689556122, 0.003290461841970682, -0.009224290028214455, -0.1114925965666771, 0.05750284343957901, 0.03681957721710205, -0.001757254940457642, 0.02934213913977146, -0.01557152345776558, -0.02751716785132885, 0.016493482515215874, 0.006453715730458498, -0.0034675465431064367, -0.13845905661582947, 0.05375317111611366, 0.012820584699511528, 0.005056637804955244, -0.11712898313999176, 0.06991559267044067, -0.04103388637304306, 0.00922830868512392, 0.02100715972483158, 0.02417590282857418, -0.006951820570975542, -0.09610394388437271, 0.010061036795377731, 0.041768353432416916, 0.043875616043806076, -0.04622673615813255, 0.02778022363781929, 0.020080691203475, 0.021662481129169464, 0.044099800288677216, -0.008839499205350876, 0.01940751075744629, -0.06760238856077194, 0.021748095750808716, 0.018230969086289406, 0.020696917548775673, -0.03719032183289528, 0.015429068356752396, 0.004405943676829338, 0.020545974373817444, 0.0022364147007465363, 0.02662712335586548, 0.06585429608821869, 0.017141375690698624, -0.026094911620020866, -0.027460584416985512, 0.027946650981903076, 0.027996385470032692, 0.04488048329949379, 0.04952838644385338, 0.0730799213051796, -0.03745441138744354, -0.051066651940345764, 0.06474956125020981, -0.023031773045659065, -0.11343804746866226, 0.008716218173503876, -0.02276063896715641, 0.011040693148970604, -0.020423127338290215, 0.006670577917248011, 0.008423262275755405, -0.031411685049533844, -0.05453716963529587, 0.01690756157040596, -0.07001575082540512, 0.0252840518951416, -0.0299574825912714, -0.01933199353516102, 0.020444339141249657, -0.0636824294924736, -0.12107978016138077, -0.023618988692760468, -0.008231936022639275, -0.0327419713139534, 0.010358257219195366, 0.020069491118192673, 0.0876813530921936, -0.06938713788986206, 0.02170497179031372, -0.029997557401657104, -0.0017411126755177975, -0.005432442296296358, 0.006756589747965336, 0.03420243039727211, 0.06803245097398758, 0.044676996767520905, -0.04712825268507004, 0.0011701839976012707, 0.10416305065155029, 0.043478649109601974, 0.03049030527472496, 0.013793617486953735, -0.0164650846272707, 0.034160297363996506, -0.07750952988862991, 0.05283498764038086, -0.0055267056450247765, -0.012565474025905132, -0.06859389692544937, 0.0029298141598701477, -0.04120970517396927, -0.020721884444355965, -0.004177196882665157, -0.019672494381666183, 0.032359492033720016, 0.021875377744436264, -0.027776092290878296, 0.07790946960449219, -0.06659771502017975, -0.06069198250770569, 0.02533736266195774, 0.010934103280305862, -0.027834909036755562, -0.1325177401304245, 0.014714665710926056, -0.05596933513879776, -0.018156159669160843, 0.0018025630852207541, 0.06902837008237839, -0.04075578600168228, -0.0614735372364521, -0.06134319305419922, -0.02990044467151165, -0.04316050186753273, -0.02490682154893875, -0.04264377802610397, -0.03504185006022453, 0.026874972507357597, 0.0016753062373027205, 0.007128666155040264, 0.01567952148616314, -0.06269092112779617, -0.0012365825241431594, -0.0027065512258559465, 0.020839106291532516, 0.08348923921585083, -0.04923413321375847, -0.04537633806467056, 0.08459172397851944, 0.037368252873420715, 0.0635596215724945, -0.0003858907730318606, 0.020525244995951653, -0.07208278775215149, 0.09245117008686066, 0.05194713547825813, 0.10867449641227722, 0.052883293479681015, -0.09521985799074173, 0.028806155547499657, -0.0322992280125618, -0.011390219442546368, 0.056140027940273285, -0.016358543187379837, 0.0004892414435744286, 0.10240211337804794, -0.03882351517677307, -0.0015932148089632392, -0.05939830094575882, -0.015894422307610512, 0.09295806288719177, 0.0022920025512576103, -0.025052905082702637, 0.0493437685072422, 0.020651910454034805, 0.037982769310474396, -0.055308748036623, -0.026604384183883667, -0.012537512928247452, 0.006753462832421064, -0.06946781277656555, -0.017672210931777954, 0.009657712653279305, 0.04193221777677536, -0.1313747763633728, -0.004682227503508329, -0.03642420470714569, -0.012795568443834782, -0.07951556146144867, -0.008545147255063057, 0.013373428955674171, -0.003599888877943158, 0.009285002946853638, 0.1732669323682785, -0.07021129131317139, 0.002419964177533984, -0.005967964418232441, -0.019386572763323784, -0.004567655269056559, 0.036476980894804, 0.05556148290634155, 0.0841224417090416, -0.025560488924384117, -0.054225776344537735, -0.10407493263483047, 0.008949403651058674, 0.0595957487821579, -0.042589809745550156, -0.06579024344682693, -0.004856741987168789, 0.028801945969462395, 0.005812774412333965, -0.02566777914762497, -0.015623411163687706, -0.010737351141870022, 0.08387303352355957, 0.06768309324979782, 0.01721755415201187, 0.009826354682445526, 0.027707571163773537, 0.0003760590625461191, -0.016484012827277184, 0.019040729850530624, -0.0956345647573471, 0.011758025735616684, 0.0035451482981443405, -0.04119311645627022, 0.04909680038690567, 0.08135446906089783, 0.0006912990938872099, 0.02594185061752796, -0.0376548208296299, 0.023334460332989693, 0.010059144347906113, -0.028567379340529442, -0.033035941421985626, -0.006642801687121391, 0.001133842277340591, -0.052258383482694626, -0.030228588730096817, 0.025633497163653374, -0.018755629658699036, 0.018935615196824074, 0.036639172583818436, -0.021185370162129402, 0.023749414831399918, 0.005233844742178917, 0.03167899698019028, 0.009717192500829697, 0.04076743498444557, -0.019920997321605682, -0.03424113243818283, -0.008593122474849224, -0.013879675418138504, -0.0119547164067626, 0.0379435159265995, 0.020540447905659676, -0.0013934173621237278, 0.0058588907122612, 0.016088873147964478, -0.0472140870988369, -0.02713203802704811, -0.0033235601149499416, 0.025238124653697014, 0.012732677161693573, 0.0005394555628299713, -0.019806403666734695, 0.010484987869858742, -0.0023660382721573114, -0.0028850466478616, -0.015009155496954918, -0.01620611548423767, -0.0026826069224625826, -0.03437218815088272, -0.0033600006718188524, -0.05659247189760208, 0.008795558474957943, -0.015129280276596546, 0.028140587732195854, -0.008812986314296722, 0.03524015098810196, -0.09554219990968704, -0.006256673950701952, -0.007818477228283882, 0.06992911547422409, -0.03653215989470482, -0.06369262933731079, 0.04224780201911926, -0.006360218394547701, 0.001805613050237298, 0.05213727056980133, 0.015314023941755295, -0.007668067701160908, 0.010378166101872921, -0.009082003496587276, -0.014308852143585682, -0.018019257113337517, 0.0018818497192114592, -0.0038091728929430246, 0.012825117446482182, 0.023251505568623543, -0.012358524836599827, -0.00012649997370317578, 0.005431743338704109, -0.002766901394352317, -0.005858172196894884, 0.0036144214682281017, 0.0347430557012558, -0.0021094968542456627, 0.036410827189683914, -0.012637777253985405, -0.016998291015625, -0.020788777619600296, -0.035774245858192444, 0.02146773599088192, -0.031052976846694946, -0.007411707658320665, -0.019094299525022507, 0.023794110864400864, 0.057207342237234116, 0.025741877034306526, 0.017774609848856926, 0.020499439910054207, 0.004837315995246172, 0.03874499350786209, 0.024710239842534065, 0.03521668165922165, 0.03144914284348488, -0.025575127452611923, 0.021509353071451187, -0.037458717823028564, -0.03789057955145836, -0.0014895544154569507, -0.00044489052379503846, 0.017819879576563835, 0.002307176124304533, 0.020294809713959694, -0.03188653662800789, -0.003460702719166875, 0.04076121002435684, -0.015166664496064186, -0.050435688346624374, 0.05465922877192497, -0.00877179205417633, -0.020421825349330902, -0.04024513438344002, 0.020457832142710686, 0.011978995986282825, -0.015293603762984276, -0.02678137645125389, 0.028723720461130142, -0.0018055923283100128, 0.05328940227627754, -0.002102961065247655, 0.01334746740758419, -0.0447910912334919, 0.0026790685951709747, -0.018023688346147537, -0.025948600843548775, 0.05915551632642746, 0.016638945788145065, -0.04843877628445625, -0.023641783744096756, -0.014300898648798466, -0.013651165179908276, 0.03089500218629837, 0.01334981806576252, 0.05445723608136177, -0.038719937205314636, 0.029031366109848022, 0.037488918751478195, 0.015712257474660873, -0.020877890288829803, -0.021905556321144104, -0.012634821236133575, -0.006676390301436186, -0.0398748442530632, 0.060067690908908844, -0.00040619593346491456, -0.004509834572672844, 0.041510824114084244, 0.009617430157959461, -0.027422387152910233, 0.009662549011409283, 0.01948218233883381, 0.02236487716436386, 0.05588840693235397, -0.015238403342664242, -0.02293390780687332, 0.021390674635767937, 0.008498186245560646, 0.006752044893801212, 0.037313852459192276, 0.011033930815756321, 0.003725258866325021, 0.05549345538020134, -0.005953063257038593, -0.005035805981606245, 0.006005518604069948, -0.040428534150123596, 0.047536395490169525, -0.02003537490963936, 0.041130200028419495, -0.025841953232884407, 0.01367583405226469, 0.0518423356115818, -0.014488961547613144, -0.005629817955195904, 0.03466418758034706, -0.005873055662959814, -0.03488434851169586, -0.038936641067266464, -0.0019822095055133104, 0.04025113582611084, 0.013636297546327114, 0.015421447344124317, 0.00800908450037241, -0.01133300457149744, -0.01807793788611889, -0.039905399084091187, -0.03727975860238075, 0.011089282110333443, 0.03073086403310299, 0.008913901634514332, -0.031946830451488495, 0.0032275274861603975, 0.025223834440112114, -0.02264169603586197, -0.04590717703104019, -0.02588975802063942, 0.0481126643717289, 0.02992878668010235, -0.010578449815511703, -0.03311033919453621, 0.023255204781889915, 0.06960989534854889, 0.0046591381542384624, -0.027829714119434357, 0.01805683597922325, 0.008071831427514553, 0.029491588473320007, 0.01546962559223175, 0.010860625654459, -0.009904158301651478, 0.017561260610818863, 0.0009478175197727978, 0.020616551861166954, -0.04283252730965614, -0.03935963660478592, 0.022216780111193657, -0.001295069931074977, -0.0352795384824276, -0.003909950610250235, -0.014974123798310757, -0.029866747558116913, 0.009592544287443161, 0.03841663897037506, 0.004760540556162596, -0.018410883843898773, 0.03640854358673096, 0.034508492797613144, -0.048406679183244705, -0.0129012456163764, 0.0009150271071121097, 0.022839022800326347, 0.03265373781323433, 0.025592966005206108, 0.05390084534883499, 0.07565927505493164, 0.008911470882594585, 0.011061899363994598, 0.00967599917203188, -0.004134725779294968, 0.01661750115454197, -0.05149952322244644, 0.01601521112024784, -0.011609856970608234, -0.017381537705659866, 0.011542445048689842, -0.006460800301283598, 0.02568860910832882, 0.023191843181848526, 0.029676111415028572, -0.036894410848617554, -0.009058410301804543, 0.05331367254257202, -0.01757965236902237, 0.000645880529191345, -0.03619545325636864, 0.01841035671532154, -0.03475414961576462, 0.014129329472780228, -0.0014824062818661332, -0.05060359090566635, 0.010088399983942509, 0.028280291706323624, -0.002663710154592991, -0.016789356246590614, 0.03220413252711296, 0.021370787173509598, 0.04862171411514282, -0.04549611732363701, -0.033378973603248596, -0.02749018929898739, -0.02975279837846756, 0.008403042331337929, -0.034417472779750824, -0.025861822068691254, -0.022376514971256256, -0.0016400847816839814, 0.01248619519174099, 0.015191528014838696, 0.02670278586447239, -0.020249566063284874, 0.03536389768123627, 0.020857086405158043, 0.006649227347224951, -0.015560228377580643, 0.025731725618243217, 0.027429500594735146, -0.03912053629755974, -0.037811554968357086, 0.022915402427315712, -0.04965918883681297, -0.021934498101472855, -0.04834515228867531, 0.02816775254905224, 0.07979129254817963, -0.01889142394065857, -0.007913618348538876, 0.016442587599158287, -0.003581319935619831, 0.010477433912456036, 0.020807184278964996, -0.003903329372406006, 0.01321837306022644, -0.01882021874189377, 0.012600850313901901, 0.026135988533496857, 0.021275673061609268, 0.0414273776113987, 0.025947479531168938, -0.051503296941518784, 0.017918456345796585, 0.026679784059524536, -0.06682061403989792, 0.06531823426485062, -0.0015381003031507134, -0.046565886586904526, 0.024835409596562386, 0.039248283952474594, -0.0370718315243721, 0.014307369478046894, 0.0028231970500200987, 0.011587287299335003, -0.00756160169839859, -0.014818078838288784, 0.010874028317630291, 0.0779954269528389, 0.00011528245522640646, 0.012545311823487282, 0.05985891446471214, 0.060848530381917953, 0.07871206849813461, 0.012514361180365086, 0.03882981836795807, 0.010157155804336071, 0.06823485344648361, -0.011783112771809101, 0.025511309504508972, 0.017840169370174408, -0.05963694676756859, 0.02970184199512005, 0.012514796108007431, -0.02002895064651966, -0.033767588436603546, -0.010926148854196072, 0.02136620506644249, 0.0017773638246580958, 0.02162388525903225, -0.03236750513315201, 0.03752663731575012, 0.004392864182591438, 0.01296540629118681, 0.006055002566426992, 0.020334994420409203, 0.02533203922212124, 0.00822095014154911, -0.0016746938927099109, 0.023198770359158516, 0.009998254477977753, -0.002363623585551977, 0.051796380430459976, 0.018677668645977974, 0.046212051063776016, -0.03046358935534954, -0.01707576960325241, 0.007397197652608156, -0.0035480342339724302, -0.0013759215362370014, 0.02412104234099388, 0.00832874421030283, 0.03364167734980583, -0.01634179800748825, 0.0080520985648036, -0.03257159888744354, 0.0010624233400449157, -0.013721649535000324, 0.020628752186894417, 0.006361675448715687, 0.01884227804839611, 0.012773142196238041, 0.04000012204051018, -0.014576034620404243, -0.04648173600435257, 0.027754414826631546, -0.01495845802128315, 0.007875083945691586, 0.029183484613895416, -0.023754945024847984, -0.020124418660998344, 0.007869262248277664, -0.019087912514805794, -0.021795444190502167, 0.009888199158012867, -0.02279694192111492, -0.021808544173836708, -0.0013806051574647427, 0.0002870368189178407, 0.015518203377723694, 0.010184133425354958, 0.016518542543053627, 0.0069719902239739895, -0.037988822907209396, 0.005258503369987011, -0.0044210259802639484, -0.027143411338329315, 0.041410382837057114, -0.010030100122094154, -0.022411208599805832, 0.0011063494021072984, 0.043147265911102295, 0.012692728079855442, 0.034554190933704376, -0.031087791547179222, -0.029459133744239807, -0.009629837237298489, -0.001989400712773204, -0.020573468878865242, 0.02921781875193119, 0.0171054657548666, -0.010722271166741848, 0.022127699106931686, -0.01936519145965576, 0.0019004283240064979, -0.028865555301308632, 0.027222735807299614, 0.05578037351369858, -0.04093609005212784, -0.06036825105547905, -0.040149591863155365, 0.02505270577967167, 0.025876611471176147, 0.034855131059885025, 0.06029887869954109, -0.022434858605265617, 0.021462732926011086, -0.04242073744535446, 0.026513803750276566, -0.017437180504202843, -0.01758759468793869, -0.012958789244294167, 0.0047371648252010345, -0.05130978673696518, 0.027604974806308746, 0.021973764523863792, 0.021657457575201988, -0.029399706050753593, -0.001725145848467946, -0.03483099490404129, -0.0197675172239542, -0.007627799641340971, -0.006840426474809647, 0.04052809625864029, 0.036856990307569504, 0.01119166798889637, -0.002256778534501791, -0.033183373510837555, 0.00687077222391963, -0.02866814285516739, 0.03647710010409355, 0.05857355147600174, 0.00552208861336112, -0.011850223876535892, -0.01804443821310997, -0.03908191993832588, 0.02621356211602688, -0.06861598044633865, 0.03313220664858818, 0.013938822783529758, 0.012323609553277493, -0.012330419383943081, 0.007334811147302389, 0.02364611066877842, -0.01551551278680563, 0.05271939933300018, -0.005159697961062193, -0.0414576381444931, -0.026018425822257996, -0.005981529131531715, -0.04497106745839119, -0.025964045897126198, 0.015786906704306602, -0.0031790786888450384, 0.03826620802283287, -0.008660494349896908, 0.058971453458070755, 0.0055415634997189045, 0.00885453075170517, 0.0072312732227146626, -0.017257843166589737, -0.052242547273635864, -0.034243859350681305, -0.006650509778410196, 0.01568099670112133, -0.02185351774096489, -0.02947813645005226, 0.04693617299199104, -0.0004716940748039633, 0.0000904129192349501, -0.00493955472484231, -0.011809690855443478, 0.0029285720083862543, -0.00688142841681838, 0.007181808818131685, -0.011450793594121933, 0.02413092739880085, 0.007240206003189087, 0.018570393323898315, -0.004404465667903423, 0.016997696831822395 ]
Scaling-up BERT Inference on CPU (Part 1)
mfuntowicz
April 20, 2021
bert-cpu-scaling-part-1
guide, nlp, partnerships, intel
https://huggingface.co/blog/bert-cpu-scaling-part-1
7.1. How-to allocate multiple independent instances Let's start simple, if we want to spawn 2 instances, one on each socket with 24 cores assigned: shell numactl -C 0-23 -m 0 python3 src/main.py model=bert-base-cased batch_size=1 sequence_length=128 backend.name=pytorch backend.num_threads=24 numactl -C 24-47 -m 1 python3 src/main.py model=bert-base-cased batch_size=1 sequence_length=128 backend.name=pytorch backend.num_threads=24 Starting from here, each instance does not share any resource with the other, and everything is operating at maximum efficiency from a hardware perspective. The latency measurements are identical to what a single instance would achieve, but throughput is actually 2x higher as the two instances operate in a truly parallel way. We can further increase the number of instances, lowering the number of cores assigned for each instance. Let's run 4 independent instances, each of them effectively bound to 12 CPU cores. shell numactl -C 0-11 -m 0 python3 src/main.py model=bert-base-cased batch_size=1 sequence_length=128 backend.name=pytorch backend.num_threads=12 numactl -C 12-23 -m 0 python3 src/main.py model=bert-base-cased batch_size=1 sequence_length=128 backend.name=pytorch backend.num_threads=12 numactl -C 24-35 -m 1 python3 src/main.py model=bert-base-cased batch_size=1 sequence_length=128 backend.name=pytorch backend.num_threads=12 numactl -C 36-47 -m 1 python3 src/main.py model=bert-base-cased batch_size=1 sequence_length=128 backend.name=pytorch backend.num_threads=12 The outcomes remain the same, our 4 instances are effectively running in a truly parallel manner. The latency will be slightly higher than the example before (2x less cores being used), but the throughput will be again 2x higher.
[ 0.04203125834465027, 0.045819543302059174, 0.002117304829880595, -0.0018695889739319682, 0.017307855188846588, 0.06212258338928223, 0.0545303151011467, 0.025120101869106293, -0.04627922922372818, -0.10474437475204468, -0.06703439354896545, 0.059905435889959335, -0.015484669245779514, 0.06536004692316055, 0.0013387198559939861, -0.04297386482357979, 0.041400112211704254, -0.05582178011536598, -0.018791040405631065, 0.009723548777401447, 0.0469016432762146, 0.018414251506328583, 0.04343536123633385, 0.042140454053878784, 0.018998026847839355, 0.012786166742444038, -0.07787377387285233, 0.011376987211406231, -0.03584485128521919, 0.01521286554634571, -0.0981251448392868, 0.000988177489489317, 0.04768044501543045, -0.019238268956542015, 0.007055915426462889, -0.023145031183958054, -0.04367884248495102, 0.0814165472984314, 0.03639800474047661, -0.06577469408512115, 0.031269799917936325, -0.04406037926673889, -0.0509563647210598, -0.001757118385285139, -0.04920991510152817, 0.016047954559326172, -0.07744278013706207, 0.04917902126908302, -0.00030867240275256336, 0.021944662556052208, -0.1191740483045578, 0.017996808513998985, 0.008279099129140377, -0.009813317097723484, -0.016448499634861946, 0.031013792380690575, 0.0022967082913964987, -0.08795571327209473, 0.0073905037716031075, 0.04089627042412758, 0.07051541656255722, 0.01932026818394661, 0.010443654842674732, 0.05711151286959648, -0.01842142641544342, 0.036594174802303314, 0.02057904191315174, -0.03000812418758869, -0.033708248287439346, 0.006532278843224049, 0.02740648202598095, -0.03637940436601639, -0.043457359075546265, -0.00799874123185873, 0.00041191960917785764, -0.037236470729112625, -0.017081035301089287, -0.022164948284626007, 0.06614372134208679, 0.10296760499477386, -0.004272805526852608, 0.035700008273124695, 0.01908046379685402, -0.027304979041218758, 0.028276139870285988, -0.012727348133921623, -0.03286220133304596, 0.028680315241217613, -0.005691719241440296, 0.05295039713382721, 0.00512844230979681, -0.07000014185905457, 0.05385170876979828, 0.028839007019996643, 0.009073411114513874, 0.003793071722611785, 0.02106129750609398, -0.0011481504188850522, 0.05858670920133591, 0.04730870574712753, 0.04798562079668045, -0.04462730512022972, 0.01645725965499878, 0.0077404179610311985, -0.05846454203128815, 0.07308007031679153, 0.002541962079703808, -0.10502896457910538, -0.06068219989538193, 0.03417624160647392, -0.08508235961198807, -0.014750385656952858, -0.00040779219125397503, 0.06816858053207397, -0.07942195236682892, -0.03863317891955376, -0.03860434517264366, -0.03866684436798096, 0.0032887207344174385, -0.05153532698750496, -0.03268088027834892, 0.020300623029470444, 0.049078140407800674, 0.021360671147704124, -0.011162088252604008, 0.010375349782407284, 0.03395237773656845, -0.035691142082214355, -0.0021621647756546736, -0.05406777188181877, 0.06771485507488251, 0.045011259615421295, 0.09743236005306244, -0.026377299800515175, 0.031771548092365265, -0.052813027054071426, -0.028109852224588394, -0.011997467838227749, 0.016667211428284645, -0.00957207940518856, -0.03738187253475189, 0.03233315423130989, 0.008435854688286781, 0.04219205304980278, 0.074945829808712, 0.06862913817167282, -0.13540448248386383, -0.0030667243991047144, -0.0038256447296589613, 0.028431132435798645, -0.08379634469747543, 0.021330125629901886, -0.07242904603481293, -0.03364681079983711, 0.024444319307804108, 0.07152039557695389, 0.018001409247517586, -0.004815093241631985, -0.10946941375732422, -0.016946064308285713, 0.042854711413383484, -0.00634950865060091, -0.061365798115730286, -0.047897323966026306, -0.017058121040463448, 0.01639106497168541, 0.05875498801469803, -0.01276102103292942, 0.009289276786148548, 0.00357485911808908, -0.04458923637866974, 0.07138723134994507, 0.019735807552933693, 0.0013976083137094975, -0.006189419887959957, 0.008316664025187492, 0.08336015790700912, 0.027393406257033348, -0.017615634948015213, -0.023975426331162453, -0.04165777191519737, 0.007274391129612923, -0.03546051308512688, 0.08924724161624908, 0.02413114160299301, -0.06380467861890793, 0.006023127119988203, -0.05308924987912178, -0.03499825671315193, 0.08071640133857727, -0.016169274225831032, -0.025932421907782555, 0.025545211508870125, 0.005533251911401749, 0.030499670654535294, -0.03480056673288345, -0.11291442811489105, 0.053277309983968735, 0.06352396309375763, 0.05757172033190727, -0.005471867974847555, 0.017212748527526855, -0.0010202823905274272, -0.0013427553931251168, -0.08610288053750992, 0.025860674679279327, -0.02506425976753235, -0.07682973891496658, 0.05627211928367615, -0.028981216251850128, -0.009917359799146652, -0.09436893463134766, -0.03135484829545021, -0.0761350616812706, 0.036226194351911545, 0.0008738467586226761, 0.050250083208084106, -0.030414599925279617, 0.07184593379497528, -0.0014492216287180781, 0.15854200720787048, -0.0353173092007637, 0.029442070052027702, 0.0006290688761509955, -0.003111411351710558, 0.021803736686706543, 0.005890490021556616, 0.014843396842479706, 0.08917444199323654, -0.0638003945350647, 0.026837429031729698, -0.003405645489692688, -0.04343435913324356, 0.08521737158298492, 0.03129512444138527, 0.03738795220851898, -0.06394916772842407, 0.0907108336687088, 0.012820578180253506, -0.08586935698986053, -0.06497012823820114, 0.04802968353033066, -0.04326031729578972, -0.0013927753316238523, -0.023733368143439293, 0.024481914937496185, 0.05204392969608307, -0.04940182343125343, -0.00503409281373024, -0.049747586250305176, -0.0649036392569542, -0.03986622765660286, -0.03234786167740822, -0.06397370249032974, 0.08257085829973221, -0.015426508150994778, -0.012595250271260738, -0.012000386603176594, -0.014080693013966084, 0.02358204498887062, 0.02821166440844536, 0.007432537153363228, 0.011896228417754173, -0.04105481505393982, -0.017998941242694855, -0.030939240008592606, 0.009148082695901394, -0.013066407293081284, 0.0414348803460598, -0.025271272286772728, -0.023315848782658577, -0.051742248237133026, 0.05092775076627731, -0.017226453870534897, -0.013798459433019161, 0.0028838219586759806, 0.04050590842962265, 0.007404825650155544, 0.011583097279071808, 0.00930067989975214, -0.004278561566025019, -0.05308683216571808, 0.003246922278776765, 0.004531139507889748, 0.007679672446101904, 0.02278244122862816, -0.019724829122424126, -0.008603167720139027, -0.013717127963900566, -0.03273499384522438, 0.003435565624386072, 0.008076460100710392, 0.018426330760121346, -0.009703379124403, 0.017653657123446465, 0.04564424604177475, -0.03351914510130882, -0.03972427919507027, 0.011445095762610435, -0.03647351264953613, 0.008914032019674778, 0.007091118488460779, -0.04548783600330353, 0.0070998333394527435, -0.06595484912395477, 0.002960999496281147, -0.013152419589459896, 0.009466545656323433, -0.10838231444358826, -0.010057627223432064, -0.012204873375594616, -0.012689604423940182, -0.008531632833182812, -0.006804654374718666, 0.06994450837373734, -0.0031492526177316904, 0.006230649072676897, 0.0398714579641819, 0.02331869676709175, 0.011752024292945862, -0.013519738800823689, -0.0372924879193306, 0.03212615102529526, 0.030090216547250748, 0.015631264075636864, 0.009035984985530376, -0.03522787615656853, -0.0032679305877536535, 0.018874406814575195, 0.018715666607022285, -0.011068773455917835, -0.01093326322734356, 0.007065245881676674, 0.015747230499982834, -0.03364475071430206, 0.046613659709692, 0.03744768723845482, -0.03674030676484108, -0.06386403739452362, 0.01458517275750637, 0.00628653122112155, -0.045763202011585236, -0.016022056341171265, -0.030869606882333755, 0.008113617077469826, 0.0010097858030349016, 0.023031363263726234, 0.013380840420722961, 0.0032173413783311844, 0.009799513965845108, 0.020054223015904427, -0.04348525032401085, 0.01077057234942913, -0.01587076298892498, 0.01098106149584055, -0.02692875824868679, 0.02665995992720127, -0.026441212743520737, -0.02838529460132122, -0.03751091659069061, 0.007113025989383459, 0.022359425202012062, -0.01646769419312477, -0.037947215139865875, -0.05047427862882614, 0.04107446223497391, 0.055244334042072296, -0.014478057622909546, -0.035151269286870956, 0.01687907613813877, 0.007215908262878656, -0.024956518784165382, -0.0007744226604700089, 0.0326780267059803, 0.007909349165856838, 0.030647892504930496, 0.01150275394320488, 0.043440502136945724, -0.020826829597353935, 0.008605621755123138, 0.0056731970980763435, 0.010091040283441544, -0.02267920970916748, 0.04331478103995323, -0.045935600996017456, 0.005782215390354395, 0.0574985109269619, 0.01230560801923275, -0.020605597645044327, -0.007751043885946274, -0.03253190591931343, -0.04735409468412399, 0.023523254320025444, 0.03718371316790581, 0.024494580924510956, -0.01814417354762554, 0.027357835322618484, 0.01679866760969162, -0.01605244353413582, -0.0583350732922554, 0.044990990310907364, 0.0049966550432145596, 0.01884401962161064, -0.030102603137493134, 0.010009766556322575, 0.028296343982219696, 0.007420094683766365, 0.014548894949257374, 0.05140528082847595, -0.04041580110788345, 0.005196175538003445, 0.01983272284269333, 0.012312392704188824, 0.04028703272342682, -0.01552357617765665, -0.010093752294778824, -0.021697571501135826, 0.0031633249018341303, -0.0009880358120426536, 0.0031946345698088408, -0.008934525772929192, -0.03706815093755722, 0.019880900159478188, 0.009977948851883411, -0.00945946667343378, 0.00007580524834338576, 0.0098840007558465, 0.02860333025455475, -0.04581255465745926, 0.015577135607600212, 0.03406957909464836, -0.03491733968257904, 0.03782161325216293, -0.027329081669449806, 0.06352180242538452, -0.016455255448818207, 0.013650746084749699, -0.011109629645943642, -0.017963720485568047, 0.03244604915380478, 0.009310475550591946, 0.025525368750095367, -0.013727240264415741, 0.003911186940968037, -0.022809617221355438, -0.010954058729112148, 0.054477013647556305, -0.0319918617606163, -0.014057225547730923, 0.040273021906614304, 0.02368880622088909, -0.030688917264342308, 0.007396189961582422, 0.0559970997273922, -0.011558176018297672, -0.010919732972979546, -0.004639013204723597, 0.016030818223953247, 0.016879025846719742, -0.02574877254664898, -0.023723341524600983, 0.034162964671850204, 0.03367050737142563, 0.002193368971347809, 0.03053533099591732, 0.026846246793866158, 0.023798255249857903, 0.07011877000331879, -0.014412645250558853, -0.04804328829050064, -0.02080976404249668, -0.015079761855304241, 0.02080463618040085, -0.002964329207316041, 0.010670654475688934, -0.06563026458024979, 0.02181820571422577, 0.00020934581698384136, -0.04646417498588562, 0.029578737914562225, -0.021048618480563164, -0.03241821378469467, 0.05443207919597626, 0.03905778005719185, 0.05900866538286209, 0.016534961760044098, 0.016002122312784195, 0.022196413949131966, -0.006803757976740599, 0.014379607513546944, 0.0028834061231464148, -0.030066924169659615, -0.009400514885783195, 0.008416149765253067, 0.04184535890817642, 0.018035169690847397, 0.025747476145625114, 0.02838210016489029, -0.013977806083858013, -0.007562000770121813, 0.0337124727666378, -0.03318743407726288, 0.024395611137151718, -0.019802818074822426, -0.02824033610522747, 0.042315710335969925, -0.026982996612787247, -0.027136631309986115, 0.035673756152391434, 0.02529689483344555, -0.044819507747888565, -0.03307906538248062, 0.04799618199467659, 0.0367693193256855, 0.014309903606772423, -0.040475666522979736, -0.022417208179831505, -0.012217634357511997, 0.01096146460622549, 0.013919347897171974, -0.07087089121341705, 0.05396491661667824, 0.0157658401876688, -0.012826872058212757, -0.03643181174993515, 0.015439731068909168, 0.018440313637256622, 0.04194329306483269, -0.01238004956394434, -0.04805520921945572, 0.004048706963658333, 0.009168609045445919, -0.02631600946187973, -0.012426851317286491, -0.009705334901809692, 0.008470534346997738, 0.010622544214129448, 0.03705095499753952, 0.07510878145694733, -0.05207610875368118, -0.0011384716490283608, 0.036479707807302475, 0.035875897854566574, 0.014083381742238998, 0.01917189359664917, 0.0012240755604580045, -0.011108411476016045, -0.00038351176772266626, -0.04229575768113136, -0.017686182633042336, 0.012709339149296284, 0.030388396233320236, -0.03798460587859154, -0.0342232808470726, 0.08079370856285095, -0.0027091545052826405, 0.02795623056590557, -0.03994397819042206, 0.0014924780698493123, -0.003705642418935895, -0.007424006704241037, -0.02700309082865715, -0.014749420806765556, 0.01455344446003437, 0.020098065957427025, -0.013192386366426945, 0.01081448420882225, 0.008891507983207703, 0.03700695559382439, -0.06614020466804504, -0.0036262255162000656, -0.04181327298283577, -0.0446450375020504, 0.029430139809846878, -0.01620115153491497, -0.040866442024707794, -0.020842479541897774, -0.00428790133446455, 0.03482278063893318, 0.02990371361374855, -0.021168949082493782, -0.011413034982979298, -0.0016256464878097177, 0.008705222979187965, 0.010410334914922714, 0.004323943052440882, -0.004626433365046978, 0.04990819841623306, 0.011951973661780357, 0.05809849128127098, 0.027126897126436234, 0.0022511431016027927, -0.0018507969798520207, 0.0038468048442155123, 0.062339045107364655, -0.016719723120331764, 0.03534960001707077, 0.03991995379328728, 0.006948974449187517, 0.024222085252404213, 0.003237375756725669, 0.000775496126152575, -0.014293486252427101, 0.008884229697287083, 0.009244044311344624, -0.04464462772011757, 0.02494250051677227, -0.019344445317983627, 0.00947509240359068, 0.05896728113293648, 0.0007273732917383313, 0.004387443885207176, 0.016441917046904564, 0.003035993315279484, -0.0307576023042202, 0.011619668453931808, 0.007664107251912355, 0.05554402619600296, -0.031924113631248474, 0.06076865643262863, 0.006302593741565943, -0.016101690009236336, 0.007764738518744707, -0.05423998087644577, -0.005143126007169485, -0.042995862662792206, -0.027551300823688507, -0.0023576172534376383, 0.002728259190917015, -0.004658364690840244, 0.013784452341496944, 0.015775544568896294, -0.02491534687578678, 0.05539481341838837, -0.005807156674563885, -0.022005219012498856, -0.006370020564645529, 0.002887697657570243, -0.028720537200570107, 0.021924542263150215, 0.006411553826183081, -0.05844052881002426, 0.009284359402954578, 0.0012522551696747541, 0.003014941932633519, 0.04315989837050438, -0.04603201150894165, -0.01654886081814766, -0.0182742178440094, 0.04901576787233353, 0.013742467388510704, 0.042570292949676514, -0.025059998035430908, 0.028096146881580353, 0.03910627216100693, 0.011562644504010677, 0.03825651481747627, 0.0012680802028626204, 0.03723578900098801, 0.022776488214731216, -0.02761342190206051, 0.010461430065333843, -0.022742493078112602, -0.05089578777551651, 0.036359816789627075, 0.026153312996029854, 0.005752572324126959, -0.04545598104596138, 0.07232891768217087, 0.024071048945188522, -0.01838502287864685, 0.012534243054687977, -0.00839871633797884, 0.014166363514959812, -0.031001688912510872, -0.036526236683130264, 0.03324050083756447, 0.024256683886051178, 0.014704281464219093, 0.06014540046453476, 0.017722487449645996, -0.012023277580738068, -0.04723445326089859, -0.005862395744770765, -0.007968135178089142, 0.018142255023121834, 0.002002608496695757, -0.0010057069594040513, 0.07249008864164352, 0.01340644434094429, 0.03621464595198631, 0.015291686169803143, -0.03048539161682129, 0.01627776026725769, 0.006885575596243143, 0.0021051857620477676, -0.028487984091043472, 0.04411442205309868, -0.002589161042124033, 0.007108410354703665, -0.03164467215538025, 0.009958760812878609, -0.0288544911891222, 0.012273264117538929, -0.05968520790338516, -0.001135545433498919, -0.030064180493354797, 0.004506050143390894, -0.054216790944337845, -0.04646771401166916, 0.034603118896484375, 0.026345914229750633, 0.029592983424663544, 0.037382710725069046, -0.05444176867604256, -0.007622437085956335, -0.01998365856707096, -0.0025622446555644274, 0.013406796380877495, -0.007255074568092823, -0.007258319295942783, -0.02062062732875347, -0.0054443529807031155, 0.006741031538695097, -0.022705405950546265, -0.01774996891617775, -0.015545591711997986, -0.010373559780418873, 0.0067976354621350765, 0.0041228062473237514, 0.0025896660517901182, -0.0067710853181779385, 0.06594619899988174, -0.017958270385861397, -0.02214358188211918, 0.01788382977247238, -0.013679510913789272, 0.010488234460353851, -0.0006450078799389303, 0.015407643280923367, -0.012349705211818218, 0.05781427398324013, 0.011411516927182674, 0.010866383090615273, -0.023003706708550453, 0.0033666850067675114, 0.04629814624786377, 0.02114349789917469, -0.015489108860492706, -0.03950241208076477, -0.027332322672009468, 0.014048689976334572, -0.043008606880903244, -0.031932272017002106, -0.011890490539371967, 0.02165142074227333, 0.00566686550155282, 0.031468164175748825, -0.010178323835134506, -0.017267538234591484, -0.03106973133981228, 0.01747734844684601, -0.011681625619530678, 0.04651118442416191, 0.043054498732089996, 0.060518715530633926, 0.04566492512822151, 0.023628370836377144 ]
Scaling-up BERT Inference on CPU (Part 1)
mfuntowicz
April 20, 2021
bert-cpu-scaling-part-1
guide, nlp, partnerships, intel
https://huggingface.co/blog/bert-cpu-scaling-part-1
7. Multi-Stream Inference - Using multiple instances in parallel If you're still reading this, you should now be in good shape to set up parallel inference workloads on CPU. Now, we are going to highlight some possibilities offered by the powerful hardware we have, and tuning the knobs described before, to scale our inference as linearly as possible. In the following section we will explore another possible scaling solution Batch Size Scaling, but before diving into this, let's take a look at how we can leverage Linux tools in order to assign Thread Affinity allowing effective model instance parallelism. Instead of throwing more cores to the task as you would do in the core count scaling setup, now we will be using more model instances. Each instance will run independently on its own subset of the hardware resources in a truly parallel fashion on a subset of the CPU cores.
[ 0.05821546912193298, -0.02645012177526951, 0.0055474769324064255, 0.04203375428915024, 0.06713176518678665, 0.03785767778754234, 0.03866184875369072, 0.006261409725993872, -0.04536601901054382, -0.08030093461275101, -0.03872368112206459, 0.021440383046865463, -0.0063658589497208595, 0.06864579021930695, 0.018341680988669395, -0.029399415478110313, 0.03676988556981087, -0.03900066763162613, 0.017643999308347702, -0.0022455567959696054, 0.045713331550359726, -0.03588723763823509, 0.05845692381262779, 0.04877175763249397, -0.06593335419893265, 0.014114269986748695, -0.008120079524815083, -0.011100823991000652, -0.048208486288785934, 0.016805512830615044, -0.13163131475448608, 0.03560413047671318, -0.01110505685210228, -0.007313711103051901, 0.018978161737322807, -0.02029796689748764, -0.1186184287071228, 0.05239242687821388, 0.05948469415307045, -0.013133612461388111, 0.021233506500720978, -0.045437783002853394, -0.01824488304555416, -0.018638314679265022, 0.0043965051881968975, -0.0001529824367025867, -0.10296762734651566, 0.02294406108558178, -0.013925105333328247, 0.013421420939266682, -0.07628922164440155, 0.08686410635709763, 0.006322489585727453, 0.01286027766764164, 0.028495462611317635, 0.0108866011723876, -0.03111119568347931, -0.06504247337579727, 0.05121814087033272, 0.050978850573301315, 0.05721508711576462, -0.026486309245228767, -0.018679894506931305, 0.05260353907942772, 0.006970338989049196, 0.011347522959113121, 0.021980030462145805, -0.0487154945731163, -0.06167102977633476, 0.037834346294403076, 0.043959252536296844, -0.028025086969137192, 0.0022230136673897505, 0.040213972330093384, 0.00035895727341994643, -0.06887310743331909, 0.002908900612965226, 0.004847139120101929, 0.07032015919685364, 0.01871493272483349, -0.034896835684776306, -0.007520771585404873, 0.03822645545005798, 0.03855341672897339, 0.018497737124562263, 0.01862643100321293, 0.03733144700527191, -0.0182462390512228, -0.008735399693250656, 0.03486109524965286, 0.010375683195888996, -0.11792576313018799, 0.010759317316114902, 0.03320365026593208, -0.010293660685420036, 0.0030838397797197104, 0.026176679879426956, 0.033285923302173615, 0.0228681992739439, -0.006238608621060848, -0.00797633919864893, -0.0639132410287857, 0.04631809517741203, 0.006074170581996441, -0.03649838641285896, 0.05870484560728073, 0.0049615600146353245, -0.1466652750968933, -0.040639929473400116, 0.06629304587841034, 0.00209994544275105, 0.05064837634563446, -0.0049689351581037045, 0.03978542611002922, -0.08727150410413742, -0.013496147468686104, 0.00655768159776926, -0.014799698255956173, 0.052640870213508606, 0.003991226200014353, 0.022162964567542076, 0.10285370796918869, 0.09376350790262222, 0.04201723635196686, -0.017637720331549644, 0.016138935461640358, 0.08045149594545364, -0.02047860063612461, -0.018919814378023148, -0.05083610862493515, 0.031732216477394104, -0.014114421792328358, 0.04201509803533554, -0.02723664976656437, 0.04824219271540642, -0.09115025401115417, -0.02941781096160412, -0.04341056942939758, 0.0038063516840338707, 0.017861822620034218, -0.07754985243082047, -0.0009270370937883854, 0.023209454491734505, 0.024775082245469093, 0.08186110109090805, 0.09528310596942902, -0.08314336836338043, 0.004424833692610264, 0.016945233568549156, 0.02961653470993042, -0.12055959552526474, 0.09074350446462631, -0.07637757807970047, -0.10426047444343567, 0.047320615500211716, 0.07460445165634155, 0.019668130204081535, -0.013357027433812618, -0.07608737796545029, -0.027670791372656822, 0.0014140373095870018, -0.06061287596821785, -0.019974762573838234, -0.0032612248323857784, -0.023226246237754822, 0.0015269999857991934, -0.0045480807311832905, -0.0009286268032155931, 0.002494310261681676, 0.011231928132474422, -0.015811529010534286, 0.030097421258687973, 0.026609938591718674, 0.004502563737332821, 0.006167239509522915, 0.004411570727825165, 0.03966371715068817, 0.07375167310237885, 0.010884313844144344, -0.009920608252286911, -0.005412620026618242, 0.016825975850224495, -0.03627360984683037, 0.05223305523395538, 0.003166006878018379, -0.07447382062673569, 0.03967800736427307, -0.0714234709739685, -0.030230237171053886, 0.0018457021797075868, -0.016319066286087036, -0.04946023225784302, 0.055863164365291595, 0.009566796943545341, 0.04785584658384323, -0.04353460296988487, -0.09915678948163986, 0.02717147022485733, 0.060836419463157654, 0.04309547692537308, 0.052970804274082184, 0.02006532810628414, 0.02425544336438179, 0.007390929851680994, -0.05263878405094147, 0.05042343959212303, -0.009038122370839119, -0.06644317507743835, 0.03754517436027527, 0.02801412343978882, -0.038846809417009354, -0.12176946550607681, -0.028293147683143616, -0.044494159519672394, -0.023103216663002968, -0.008952607400715351, 0.009407340548932552, -0.011064300313591957, 0.03809909150004387, -0.05314779281616211, 0.18061423301696777, -0.04940389096736908, 0.012173733673989773, 0.021872714161872864, -0.02478748746216297, -0.014003889635205269, 0.025896752253174782, -0.009961700066924095, 0.06064961105585098, -0.05916858837008476, 0.06308586895465851, -0.007085148710757494, 0.012813102453947067, 0.0752263069152832, 0.04788808897137642, 0.07542622834444046, -0.03445771709084511, 0.04728129506111145, 0.009577479213476181, -0.09990833699703217, 0.017159540206193924, 0.035138167440891266, -0.045642007142305374, 0.015724128112196922, 0.02392677776515484, -0.027943991124629974, 0.08329606056213379, 0.006114688701927662, -0.02679373510181904, -0.11764851957559586, -0.03285131976008415, -0.002317362232133746, -0.020759692415595055, -0.0725688636302948, 0.046839892864227295, -0.034171346575021744, -0.014565846882760525, -0.04213356599211693, -0.006989787798374891, 0.02274707704782486, 0.017582718282938004, -0.0026844111271202564, 0.005192154087126255, -0.03206142783164978, 0.011603250168263912, -0.05800248682498932, -0.006080637685954571, -0.016872525215148926, 0.01032195333391428, -0.02821798250079155, -0.009816033765673637, -0.02746059000492096, 0.04406992718577385, -0.0044628046452999115, 0.008833419531583786, -0.010331608355045319, 0.04149315878748894, 0.012170334346592426, 0.01986381784081459, -0.018832599744200706, -0.017636381089687347, -0.052225273102521896, -0.0009452732047066092, 0.003687590826302767, -0.006490590516477823, -0.02020091935992241, 0.011097962036728859, -0.00275419931858778, -0.04980478063225746, 0.012317652814090252, 0.018358364701271057, 0.016641536727547646, -0.005247956607490778, -0.012708775699138641, 0.011212607845664024, 0.04748347029089928, -0.03425724431872368, -0.01645434834063053, -0.039143141359090805, -0.008747333660721779, -0.004562141839414835, 0.014356683939695358, -0.021056611090898514, 0.009062260389328003, -0.06125325337052345, 0.03021644614636898, -0.018461089581251144, 0.0269435066729784, -0.10370281338691711, -0.024164754897356033, -0.04046444594860077, 0.030899470672011375, -0.015401618555188179, -0.01944306679069996, 0.06653869897127151, -0.018082858994603157, 0.016858534887433052, 0.043468207120895386, -0.012545337900519371, 0.0244488175958395, 0.034495145082473755, -0.03281676396727562, -0.0052901809103786945, 0.016282817348837852, 0.030971473082900047, -0.005694390274584293, 0.013271038420498371, 0.027747860178351402, 0.015450678765773773, 0.04699092358350754, -0.008327285759150982, 0.01937749609351158, -0.0005438781809061766, -0.016615774482488632, 0.0024020415730774403, 0.047682154923677444, 0.038083430379629135, -0.06403177231550217, -0.07602643966674805, -0.03141407668590546, -0.01781020313501358, -0.0031846798956394196, -0.01345217227935791, -0.02873665653169155, -0.040396884083747864, 0.00789555348455906, 0.03520617261528969, 0.008469851687550545, 0.03371670842170715, 0.006404359359294176, 0.051916446536779404, -0.035731617361307144, -0.028536494821310043, 0.030202116817235947, 0.039576537907123566, -0.005024195183068514, 0.03015904873609543, -0.027093002572655678, -0.023792138323187828, -0.021002361550927162, 0.030037356540560722, 0.032058313488960266, -0.025492727756500244, -0.017337743192911148, -0.044652264565229416, 0.03466857597231865, 0.06644987314939499, -0.026529110968112946, -0.030862705782055855, 0.003140510292723775, 0.011625909246504307, 0.007977833040058613, -0.023886004462838173, 0.033529315143823624, 0.04449641332030296, 0.029411207884550095, 0.00032703837496228516, 0.04053156450390816, 0.015329995192587376, 0.06865952908992767, 0.0299429539591074, 0.003692339174449444, -0.010870262049138546, 0.03547465801239014, -0.007804038934409618, -0.03263617679476738, 0.05361559987068176, 0.0326012559235096, -0.015108657069504261, 0.02043778821825981, -0.035806745290756226, -0.03513185307383537, 0.04033276066184044, 0.010315422900021076, 0.002914388431236148, -0.00433525862172246, 0.01755242422223091, 0.04370078444480896, -0.030194822698831558, -0.037516381591558456, 0.035057879984378815, -0.009954538196325302, 0.03929470106959343, 0.008027451112866402, 0.0376984104514122, 0.04707007110118866, 0.018272828310728073, -0.013165573589503765, 0.02703230269253254, -0.021208837628364563, 0.027125634253025055, 0.014943884685635567, 0.013192837126553059, 0.027810797095298767, 0.02067197673022747, 0.007975539192557335, -0.005685407668352127, -0.01612524501979351, -0.013138612732291222, -0.019315045326948166, 0.005639856215566397, -0.0071921516209840775, 0.011081239208579063, 0.030792236328125, -0.055736906826496124, 0.035997744649648666, -0.009064748883247375, 0.017984677106142044, -0.048084210604429245, 0.030603377148509026, 0.00423019751906395, -0.027499759569764137, 0.017421863973140717, 0.005886555649340153, 0.033951472491025925, -0.016290465369820595, -0.020540757104754448, -0.007504062727093697, -0.012193683534860611, 0.0049865287728607655, 0.020601481199264526, 0.012526498176157475, 0.017347928136587143, -0.015112328343093395, -0.03160225600004196, 0.016224106773734093, 0.021964265033602715, -0.019952230155467987, -0.053423166275024414, 0.039583902806043625, 0.01919550634920597, -0.024117210879921913, 0.028740188106894493, 0.014228394255042076, -0.02675248496234417, -0.00029979413375258446, -0.03127438947558403, 0.043608374893665314, 0.0039113182574510574, -0.0035788414534181356, -0.03730401024222374, 0.047292232513427734, 0.0166116114705801, -0.024811556562781334, -0.013470764271914959, 0.019078217446804047, 0.02958863042294979, 0.07959388941526413, -0.012736187316477299, 0.008401106111705303, -0.02424534782767296, -0.012925393879413605, -0.01254476048052311, 0.00020495765784289688, -0.0024632406421005726, -0.04670777916908264, -0.03830161690711975, 0.004695153329521418, -0.05017297342419624, 0.0050862981006503105, 0.008712440729141235, -0.04435864835977554, 0.02906610816717148, 0.02942638471722603, 0.03899487107992172, 0.029361199587583542, 0.011958192102611065, 0.0026650014333426952, -0.012779710814356804, -0.019074078649282455, -0.018259475007653236, -0.013952571898698807, 0.0011847257846966386, 0.021593669429421425, 0.05599142983555794, 0.05991429463028908, 0.04470714181661606, 0.023265046998858452, 0.025292810052633286, 0.00804574228823185, 0.04648489132523537, -0.035021066665649414, 0.01409565657377243, -0.03384656086564064, 0.015745680779218674, 0.013906196691095829, -0.03154771402478218, -0.025398802012205124, -0.003935580141842365, 0.04250054433941841, -0.005690881051123142, -0.03222798556089401, 0.00684095174074173, 0.024190753698349, -0.008147499524056911, -0.04205703362822533, 0.006621035281568766, -0.04150622338056564, 0.00598328560590744, -0.01035165973007679, -0.048104286193847656, 0.019328957423567772, 0.04026953503489494, -0.015612474642693996, -0.06820052862167358, 0.023373641073703766, 0.0024264873936772346, 0.05405636504292488, 0.00007519713108194992, -0.020086737349629402, -0.0028521076310425997, -0.00790992472320795, -0.0012600222835317254, 0.0018407513853162527, -0.00991583988070488, 0.033072762191295624, -0.007973254658281803, 0.016780871897935867, 0.026890618726611137, -0.0032254518009722233, -0.014965130016207695, 0.04508072882890701, 0.08015505224466324, 0.0026510152965784073, 0.007609528489410877, 0.051464058458805084, 0.03378554433584213, -0.01463374588638544, -0.02723544090986252, -0.061004579067230225, 0.011022872291505337, -0.009000588208436966, -0.02382533811032772, -0.02932373620569706, 0.04421096667647362, -0.017191041260957718, -0.028961418196558952, 0.024057621136307716, 0.040055569261312485, -0.03357207775115967, 0.00660467054694891, 0.006290969904512167, 0.0074800183065235615, -0.008824124932289124, 0.026022693142294884, -0.030332118272781372, 0.03685136139392853, 0.024018334224820137, 0.02162463590502739, -0.05817577242851257, 0.01834907941520214, -0.0016851327382028103, -0.026603514328598976, 0.014710677787661552, -0.010964825749397278, -0.026132740080356598, -0.0052180509082973, 0.021732743829488754, 0.046796202659606934, -0.0038639388512820005, -0.036703165620565414, 0.0024206694215536118, -0.03213484585285187, 0.040128983557224274, 0.0008285732474178076, 0.06297177076339722, 0.03117205575108528, -0.0022460955660790205, 0.012919086031615734, 0.026674913242459297, 0.019795415922999382, 0.01454001571983099, -0.009934064000844955, 0.022445887327194214, 0.060099586844444275, 0.0009798194514587522, 0.019817423075437546, 0.0017008791910484433, 0.0013222236884757876, -0.029482193291187286, 0.01810341328382492, 0.013383575715124607, -0.008154899813234806, -0.00435553677380085, 0.0036117956042289734, -0.019592372700572014, 0.03366061672568321, -0.01213924027979374, 0.02215956337749958, 0.029627347365021706, 0.006863379385322332, 0.001955163199454546, -0.027046192437410355, 0.0024528009817004204, 0.009024892002344131, -0.00982314720749855, 0.019872939214110374, 0.018903227522969246, -0.0015768235316500068, 0.019927114248275757, 0.01141352578997612, 0.045491527765989304, -0.012691931799054146, -0.014833815395832062, -0.02325614169239998, -0.025144021958112717, -0.009744202718138695, -0.005426803138107061, 0.010020310990512371, -0.02077566646039486, 0.034831080585718155, -0.017498528584837914, -0.07327336817979813, 0.0015026851324364543, -0.009171681478619576, -0.02119625173509121, 0.007678753696382046, -0.021447600796818733, -0.0037558097392320633, 0.0038174071814864874, -0.014588816091418266, -0.057022009044885635, -0.04338759928941727, -0.016578227281570435, -0.01219872198998928, -0.004202817566692829, -0.03461315110325813, -0.00209692120552063, -0.016138948500156403, 0.028606167063117027, 0.00031984414090402424, 0.03658647462725639, -0.020106172189116478, -0.004202770534902811, 0.04669592157006264, 0.0012541906908154488, -0.019589144736528397, 0.02142545022070408, 0.0164155513048172, -0.022538255900144577, -0.039477694779634476, -0.00758808059617877, 0.016737835481762886, -0.06096097454428673, 0.024508977308869362, -0.006364329252392054, -0.003965683747082949, -0.015354499220848083, 0.020266566425561905, 0.007493734359741211, -0.0052473279647529125, 0.008094396442174911, -0.01462935097515583, -0.008330627344548702, -0.04759562015533447, 0.00864657573401928, 0.02324371412396431, 0.016985615715384483, -0.028467902913689613, 0.008658566512167454, -0.000512746802996844, -0.026932241395115852, -0.00019997839990537614, 0.01016006525605917, 0.047143325209617615, -0.03035062551498413, -0.022214487195014954, -0.023006653413176537, 0.027334293350577354, -0.004393063951283693, 0.06916627287864685, 0.009376834146678448, -0.019837383180856705, 0.02047220803797245, -0.020439160987734795, -0.010907641611993313, 0.008100700564682484, 0.05093032866716385, -0.011463621631264687, -0.050367213785648346, -0.024997467175126076, 0.01489665824919939, -0.03618423640727997, 0.013435432687401772, -0.024513402953743935, -0.008985060267150402, -0.040216539055109024, -0.0005872410838492215, -0.06377633661031723, -0.01524364948272705, 0.05912571772933006, 0.028285222128033638, 0.05354248732328415, -0.014643990434706211, -0.0522497221827507, -0.019228622317314148, -0.009205217473208904, 0.05990615114569664, -0.002046407898887992, -0.011671732179820538, -0.004947752226144075, 0.0170796737074852, 0.0035177799873054028, -0.021079406142234802, -0.06143241003155708, 0.0032600027043372393, 0.026077430695295334, -0.010963311418890953, -0.02871515601873398, 0.008885713294148445, 0.04219512641429901, 0.01913849078118801, 0.0752767026424408, 0.016055623069405556, -0.0017970871413126588, -0.003954097628593445, -0.015243909321725368, -0.021439170464873314, -0.031055979430675507, 0.005215873010456562, -0.01213038805872202, 0.024515442550182343, 0.031815700232982635, 0.0009883824968710542, -0.00971051212400198, -0.031670913100242615, 0.011385415680706501, -0.011679931543767452, -0.022925157099962234, -0.03685629367828369, -0.012871860526502132, 0.022197818383574486, -0.02149355039000511, -0.06546599417924881, 0.008061757311224937, -0.015123710036277771, -0.005317621398717165, 0.016327034682035446, 0.010242440737783909, 0.00814854446798563, -0.04755537211894989, 0.03440266475081444, -0.025863604620099068, 0.04684661328792572, 0.08157750219106674, 0.015505529008805752, 0.0010771533707156777, -0.03312930464744568 ]
Scaling-up BERT Inference on CPU (Part 1)
mfuntowicz
April 20, 2021
bert-cpu-scaling-part-1
guide, nlp, partnerships, intel
https://huggingface.co/blog/bert-cpu-scaling-part-1
7.2. Smart dispatching - Allocating different model instances for different problem sizes One another possibility offered by this setup is to have multiple instances carefully tuned for various problem sizes. With a smart dispatching approach, one can redirect incoming requests to the right configuration giving the best latency depending on the request workload. shell # Small-sized problems (sequence length <= 32) use only 8 cores (on socket 0 - 8/24 cores used) numactl -C 0-7 -m 0 python3 src/main.py model=bert-base-cased batch_size=1 sequence_length=32 backend.name=pytorch backend.num_threads=8 # Medium-sized problems (32 > sequence <= 384) use remaining 16 cores (on socket 0 - (8+16)/24 cores used) numactl -C 8-23 -m 0 python3 src/main.py model=bert-base-cased batch_size=1 sequence_length=128 backend.name=pytorch backend.num_threads=16 # Large sized problems (sequence >= 384) use the entire CPU (on socket 1 - 24/24 cores used) numactl -C 24-37 -m 1 python3 src/main.py model=bert-base-cased batch_size=1 sequence_length=384 backend.name=pytorch backend.num_threads=24
[ 0.022196002304553986, -0.013632404617965221, -0.04343825578689575, 0.004180470015853643, 0.006418257020413876, 0.08080136030912399, 0.07596389949321747, 0.011165682226419449, -0.009486970491707325, -0.058409444987773895, -0.07290572673082352, -0.012509437277913094, -0.01336270198225975, 0.03846001252532005, -0.031148016452789307, -0.04982424154877663, 0.07543905824422836, -0.041781600564718246, 0.0004707083571702242, 0.00735003175213933, 0.06458401679992676, -0.07493725419044495, 0.09728807210922241, 0.06564267724752426, 0.012061304412782192, -0.03337986022233963, -0.08718670159578323, 0.054728083312511444, -0.06725519150495529, 0.03484930470585823, -0.05810834839940071, -0.03327237814664841, 0.018719758838415146, -0.012794068083167076, 0.005686784628778696, -0.02385920286178589, -0.025869065895676613, 0.06763650476932526, 0.002489183098077774, -0.07906485348939896, 0.012988940812647343, -0.04463096335530281, -0.05278162658214569, -0.031037449836730957, 0.03410334885120392, -0.008056512102484703, -0.07079645246267319, 0.018837006762623787, -0.016460226848721504, -0.026329219341278076, -0.0942421481013298, 0.049973029643297195, 0.026133084669709206, 0.01935366913676262, -0.02251356840133667, 0.01857113651931286, -0.016262074932456017, -0.10555568337440491, 0.016571423038840294, 0.007692743558436632, 0.0482666939496994, -0.021158134564757347, 0.003591252490878105, 0.03751213103532791, -0.03522622957825661, 0.0010080346837639809, -0.04217309504747391, -0.028207292780280113, -0.01448516920208931, 0.023484565317630768, -0.00010396337165730074, -0.022298824042081833, -0.049664877355098724, 0.022340791299939156, -0.029904760420322418, -0.027907326817512512, -0.0422833152115345, -0.03756839409470558, 0.004929714370518923, 0.07130616158246994, 0.012396388687193394, 0.036652617156505585, 0.016946254298090935, -0.010728278197348118, 0.059959039092063904, 0.008134625852108002, 0.004852668382227421, -0.035624224692583084, -0.00026723448536358774, 0.03084985911846161, -0.01911761239171028, -0.08732396364212036, 0.06228309124708176, -0.009339422918856144, 0.06027761101722717, 0.02482764795422554, 0.02076777070760727, -0.026189003139734268, 0.03622403368353844, 0.02473422884941101, 0.04297769069671631, -0.05789748206734657, 0.0461793951690197, 0.024317437782883644, -0.08252551406621933, 0.062200065702199936, 0.01194725651293993, -0.1384296864271164, -0.04200977832078934, 0.02381797879934311, -0.059511736035346985, -0.03168707713484764, -0.018906572833657265, 0.05362509936094284, -0.06281191855669022, -0.05980217829346657, -0.03311862796545029, 0.007888466119766235, 0.05410805717110634, -0.02050245925784111, -0.026575079187750816, 0.0639641135931015, 0.03780348598957062, -0.020131397992372513, -0.011914467439055443, 0.024993782863020897, 0.031146753579378128, -0.013656518422067165, 0.07342839241027832, -0.05378485843539238, 0.06219278648495674, -0.02530710957944393, 0.07283477485179901, -0.026757804676890373, 0.0712699219584465, -0.03016975335776806, -0.04116663709282875, -0.013758313842117786, -0.0007894731825217605, -0.024282578378915787, -0.014686968177556992, -0.008195274509489536, 0.007836093194782734, 0.017436571419239044, 0.08893973380327225, 0.03544637933373451, -0.06909332424402237, 0.00492155272513628, 0.029830465093255043, 0.01856604963541031, -0.09771183133125305, 0.04078594595193863, -0.06611646711826324, -0.005188180133700371, -0.0376359224319458, 0.08778423070907593, -0.02070614881813526, -0.044696252793073654, -0.06440334022045135, -0.009298178367316723, -0.014342028647661209, 0.018168944865465164, -0.07376060634851456, -0.03262873739004135, -0.025098418816924095, -0.05041064694523811, 0.009448758326470852, -0.0018888633931055665, 0.0741741806268692, 0.024310441687703133, -0.010875033214688301, 0.09234160929918289, 0.0771981030702591, -0.000053446296078618616, 0.0006329966709017754, 0.016189925372600555, 0.07079879939556122, 0.01880490593612194, -0.027659088373184204, -0.0160637479275465, -0.007191719487309456, 0.02941836044192314, -0.026184847578406334, 0.0869232788681984, 0.03891485184431076, -0.042522188276052475, 0.06335236132144928, -0.02982957847416401, -0.0914439931511879, 0.06632315367460251, 0.0060202558524906635, -0.003140251152217388, 0.09421182423830032, 0.010365903377532959, 0.024035265669226646, 0.01884668692946434, -0.07050196826457977, 0.06835523247718811, 0.08686283975839615, 0.015530327335000038, 0.04206638038158417, -0.0016223723068833351, 0.04335954785346985, -0.008299308829009533, -0.052953824400901794, 0.00875706598162651, -0.0408320277929306, -0.08579350262880325, 0.008773401379585266, 0.04629378393292427, 0.03353499621152878, -0.11656332015991211, -0.031725767999887466, -0.09946905821561813, -0.014471546746790409, -0.0622464120388031, -0.004373112227767706, -0.02493557520210743, 0.02541618049144745, -0.060716528445482254, 0.1388769894838333, -0.02512797899544239, -0.03725516051054001, -0.012401136569678783, -0.022553717717528343, 0.002242351183667779, 0.010551679879426956, 0.019418271258473396, 0.09776518493890762, -0.08847001940011978, 0.0022868511732667685, -0.00004182418342679739, 0.00030763846007175744, 0.05392284318804741, -0.02153744176030159, 0.020753776654601097, -0.10579956322908401, 0.08509692549705505, 0.026139045134186745, -0.07022601366043091, -0.07854704558849335, 0.1029466763138771, -0.05024312436580658, 0.027028763666749, 0.019971560686826706, 0.017902642488479614, 0.022333262488245964, -0.0018242363585159183, -0.02697649598121643, -0.0550883524119854, -0.07211750000715256, -0.017558544874191284, -0.006786945275962353, -0.04736575856804848, 0.05738995969295502, 0.0037812322843819857, -0.027441704645752907, 0.02072918601334095, -0.01307953055948019, 0.0412224642932415, 0.04280560091137886, 0.007963038049638271, 0.006015146616846323, -0.028441624715924263, 0.008525434881448746, -0.0665285512804985, 0.0046004438772797585, -0.059158530086278915, 0.012005154974758625, -0.04867057874798775, -0.008792620152235031, -0.028788799419999123, 0.05392878130078316, 0.006420526187866926, -0.010568750090897083, 0.01850457489490509, 0.04050282761454582, 0.03436311334371567, -0.001992045436054468, -0.0008279235917143524, -0.036544300615787506, -0.023648740723729134, 0.03348499536514282, 0.021266719326376915, -0.027363114058971405, 0.013150249607861042, 0.003439674386754632, -0.027958545833826065, -0.02250446192920208, 0.012457385659217834, -0.004812132567167282, -0.013426924124360085, 0.002841681707650423, -0.010237544775009155, 0.028418049216270447, 0.04926758259534836, -0.008208338171243668, -0.017247740179300308, -0.009161329828202724, -0.03869784250855446, -0.007346905302256346, 0.041550878435373306, -0.04270482063293457, 0.010339864529669285, -0.03721678629517555, 0.006861397996544838, 0.000538884662091732, 0.012218044139444828, -0.08842484652996063, -0.018300702795386314, -0.005048925522714853, 0.03194591775536537, -0.008795162662863731, -0.005801020190119743, 0.04615169018507004, 0.017481056973338127, -0.023087961599230766, 0.037890415638685226, 0.016143741086125374, 0.00453396188095212, 0.02478858456015587, -0.03125287964940071, 0.04560357332229614, -0.005809927824884653, -0.018254542723298073, -0.02241421304643154, 0.007749474141746759, -0.025790071114897728, 0.031101152300834656, -0.007887269370257854, 0.009376492351293564, 0.005873721092939377, 0.014309157617390156, 0.0040528494864702225, -0.03125257417559624, -0.0005894743371754885, 0.026165198534727097, -0.023787088692188263, -0.03612280637025833, 0.01589967869222164, 0.00006639573985012248, -0.005065201781690121, -0.00037014586268924177, -0.020187944173812866, 0.005882580298930407, 0.03981250897049904, 0.05016364902257919, 0.03977019712328911, -0.008977175690233707, -0.01644226349890232, 0.012663974426686764, -0.021263444796204567, 0.023621726781129837, -0.013407057151198387, 0.03177575394511223, -0.020990267395973206, 0.01407401543110609, -0.016284693032503128, -0.022290296852588654, -0.03393542394042015, -0.03156198561191559, -0.004257298074662685, -0.006168746389448643, -0.05109690502285957, -0.00821281224489212, 0.025060690939426422, 0.038331929594278336, -0.009833110496401787, -0.021853813901543617, 0.02540748193860054, 0.0013714092783629894, -0.015301729552447796, -0.0034127412363886833, 0.03448990359902382, 0.03452664986252785, 0.03465336561203003, 0.005831622518599033, 0.023974180221557617, 0.00637198006734252, 0.023345964029431343, 0.030743032693862915, 0.0020427205599844456, 0.010383897460997105, 0.03391462191939354, -0.018476778641343117, -0.023404812440276146, 0.04208027198910713, -0.007615046575665474, 0.0028707992751151323, -0.010498195886611938, -0.07580877840518951, -0.026516901329159737, 0.03695693239569664, 0.024320116266608238, 0.019058680161833763, -0.020117349922657013, 0.005392682272940874, 0.044260408729314804, 0.0033225829247385263, -0.03902590647339821, 0.020175473764538765, 0.019880924373865128, -0.020630843937397003, -0.020507436245679855, -0.004713528789579868, 0.009144965559244156, -0.0220837090164423, -0.005442813970148563, 0.0066052586771547794, -0.0282637570053339, -0.016915850341320038, 0.035168346017599106, 0.008921134285628796, 0.02120719850063324, -0.022141998633742332, 0.008681058883666992, 0.005407608579844236, 0.005207067355513573, -0.027684470638632774, 0.03051365539431572, -0.011194589547812939, -0.011207454837858677, 0.024316323921084404, 0.03046519309282303, -0.015885882079601288, 0.032013900578022, -0.01530924066901207, 0.04774991050362587, -0.03442147374153137, 0.018909843638539314, 0.02233756147325039, -0.05654195696115494, 0.07776922732591629, -0.019783955067396164, 0.028055332601070404, 0.020410291850566864, 0.009590945206582546, -0.06014037877321243, -0.0477752722799778, 0.007490929216146469, 0.0543050654232502, 0.0028069298714399338, -0.0019703449215739965, -0.014172300696372986, -0.01275625079870224, 0.013564195483922958, 0.06703788042068481, -0.03095933049917221, 0.005708047654479742, 0.04270293936133385, 0.014291566796600819, -0.04880436509847641, 0.016444718465209007, 0.029914936050772667, 0.010422100313007832, 0.010658081620931625, -0.019757112488150597, 0.018901001662015915, 0.018886275589466095, -0.012177009135484695, -0.06640298664569855, 0.023327786475419998, 0.028020475059747696, -0.04325050115585327, 0.028427913784980774, 0.018046021461486816, 0.01594494841992855, 0.08121051639318466, -0.013260440900921822, -0.03137877956032753, -0.04006496071815491, 0.020363766700029373, 0.010327601805329323, 0.0008571033831685781, 0.020108234137296677, -0.07560326904058456, -0.0003358595131430775, 0.002801804803311825, -0.029731789603829384, 0.014297766610980034, -0.005346892401576042, -0.010612733662128448, 0.025049056857824326, 0.043361831456422806, 0.007575938478112221, -0.008589099161326885, 0.024987388402223587, -0.0057818107306957245, -0.014567309059202671, -0.011044236831367016, 0.025208812206983566, -0.006122296676039696, 0.01201513409614563, 0.028112195432186127, 0.07255819439888, 0.06307059526443481, 0.031366415321826935, 0.0006031508091837168, 0.014774280600249767, 0.016518360003829002, 0.019972098991274834, -0.004223626106977463, 0.01488320529460907, -0.02052180841565132, -0.024461422115564346, 0.03067367896437645, -0.010078699328005314, -0.017779480665922165, 0.02895231544971466, 0.008521152660250664, -0.021139414981007576, -0.03314150124788284, 0.019852323457598686, 0.015785066410899162, 0.01582317054271698, -0.022473778575658798, -0.012393311597406864, -0.006809984799474478, -0.020179927349090576, 0.0068734316155314445, -0.023382993414998055, 0.031999338418245316, 0.034118492156267166, -0.04217147082090378, -0.005868938751518726, 0.025433894246816635, 0.06857220083475113, 0.023635463789105415, -0.026078056544065475, -0.0371471606194973, -0.013592232950031757, -0.0008615438127890229, -0.034482914954423904, -0.029533032327890396, 0.007133054547011852, 0.010964441113173962, 0.009629902429878712, 0.04069655388593674, 0.04369810223579407, -0.02889775112271309, 0.016616353765130043, 0.07229942828416824, 0.006773064844310284, -0.025994308292865753, 0.02074294164776802, 0.021204745396971703, 0.016198452562093735, -0.024560116231441498, -0.00036536611150950193, -0.03319896385073662, -0.001046147313900292, -0.007537172641605139, -0.03750113025307655, -0.019366158172488213, 0.058647748082876205, -0.007001461461186409, 0.026426346972584724, 0.0025165402330458164, 0.01078399084508419, -0.012075934559106827, -0.012883865274488926, -0.009228041395545006, -0.0111607126891613, 0.02803955227136612, 0.014552564360201359, -0.010548850521445274, 0.03852704167366028, 0.006138702854514122, 0.009157555177807808, -0.021909864619374275, 0.010221402160823345, 0.01383199356496334, -0.028137028217315674, 0.0034990389831364155, -0.02049136906862259, -0.04442695900797844, -0.013842621818184853, -0.02256120555102825, 0.014991744421422482, 0.013138903304934502, -0.01454803254455328, 0.027702951803803444, 0.025616927072405815, 0.008492081426084042, -0.02164468541741371, 0.021514005959033966, 0.036253686994314194, 0.039670415222644806, 0.04045727103948593, 0.0493476539850235, 0.04895006865262985, 0.017003081738948822, 0.029928389936685562, -0.011920147575438023, 0.06659795343875885, -0.01783546432852745, 0.010549326427280903, 0.053248003125190735, -0.006436350289732218, 0.03909987956285477, -0.011915246024727821, -0.001898264861665666, -0.013964610174298286, -0.021822789683938026, 0.03549371287226677, -0.040981728583574295, -0.0002369722496950999, 0.004727515857666731, 0.00868474505841732, 0.01894054003059864, -0.021479666233062744, -0.0009429371566511691, 0.01986347883939743, -0.004707622807472944, -0.03233680501580238, -0.004704300779849291, -0.011485684663057327, 0.0493101105093956, -0.02029450610280037, 0.08259492367506027, -0.01150362566113472, 0.010621762834489346, 0.009811836294829845, -0.014872744679450989, 0.0027632236015051603, -0.07954715192317963, -0.04944583773612976, -0.010464735329151154, -0.013978107832372189, 0.009295881725847721, 0.006965218111872673, 0.03567080944776535, -0.08181843161582947, 0.04426752030849457, -0.005513686686754227, -0.018452748656272888, -0.0020575637463480234, 0.022091306746006012, -0.031998615711927414, 0.027340231463313103, -0.010703647509217262, -0.05892932415008545, 0.03338605910539627, 0.004374444950371981, -0.005957877729088068, 0.056004785001277924, -0.01364446897059679, 0.01071840152144432, -0.00648560980334878, 0.025065381079912186, -0.012070582248270512, 0.05046812817454338, -0.035704027861356735, 0.023415131494402885, 0.02836264856159687, 0.007518226746469736, 0.0010306715266779065, 0.04250161722302437, 0.005692144390195608, 0.012526975013315678, -0.021471068263053894, -0.0016353297978639603, -0.042723700404167175, -0.04987000301480293, 0.0451408289372921, -0.0029537377413362265, -0.002558767097070813, 0.005231190472841263, 0.05683009326457977, 0.028686022385954857, 0.011120994575321674, -0.03163288161158562, -0.0029739351011812687, 0.02124883607029915, -0.025056596845388412, -0.02353150211274624, 0.03704870119690895, 0.02471858263015747, 0.007076062727719545, 0.0475166030228138, -0.020597197115421295, -0.0499495193362236, -0.026263970881700516, -0.02459092251956463, 0.039070192724466324, 0.03497903048992157, -0.001984436996281147, -0.0033125963527709246, 0.05015945062041283, 0.0270690880715847, 0.032048095017671585, 0.023729529231786728, -0.01587592251598835, 0.004396348726004362, -0.005940351635217667, -0.02530042827129364, -0.005641299765557051, 0.030564751476049423, -0.018409978598356247, 0.022410349920392036, -0.0072551388293504715, 0.027671974152326584, -0.023074902594089508, 0.02209438942372799, -0.040319886058568954, 0.010810683481395245, -0.01708751730620861, -0.017093872651457787, -0.058751899749040604, -0.03992593660950661, 0.0245173592120409, 0.05033427104353905, 0.033542562276124954, -0.006696086842566729, -0.05979429557919502, -0.02242569997906685, -0.02125907875597477, 0.0034432029351592064, 0.03125213086605072, 0.001808555913157761, -0.018406575545668602, -0.027384430170059204, -0.007401042617857456, 0.035174936056137085, -0.007490754127502441, 0.009677444584667683, -0.006190221756696701, -0.033822692930698395, 0.014501256868243217, 0.009703313000500202, 0.04692502319812775, -0.010784127749502659, 0.058886997401714325, 0.006056464277207851, 0.004117087926715612, -0.007231616880744696, 0.0006067269132472575, -0.023408889770507812, -0.05295420438051224, 0.031698960810899734, -0.03943799063563347, 0.06812218576669693, -0.048663172870874405, 0.012021331116557121, -0.027943024411797523, 0.0009179257322102785, 0.06335707753896713, -0.031173506751656532, -0.027870506048202515, -0.02465115487575531, -0.0014529821928590536, 0.04473769664764404, -0.008987258188426495, -0.020406434312462807, -0.03959422931075096, 0.04619348421692848, -0.006515838671475649, 0.01394337322562933, -0.012598604895174503, -0.037001773715019226, -0.050009727478027344, -0.023103784769773483, -0.043363168835639954, 0.03505871444940567, 0.02479744702577591, 0.03747115656733513, 0.03469260782003403, 0.009638204239308834 ]
Scaling-up BERT Inference on CPU (Part 1)
mfuntowicz
April 20, 2021
bert-cpu-scaling-part-1
guide, nlp, partnerships, intel
https://huggingface.co/blog/bert-cpu-scaling-part-1
8. Batch size scaling - Improving throughput and latency with multiple parallel & independent model instances One another very interesting direction for scaling up inference is to actually put some more model instances into the pool along with reducing the actual workload each instance receives proportionally. This method actually changes both the size of the problem (batch size), and the resources involved in the computation (cores). To illustrate, imagine you have a server with C CPU cores, and you want to run a workload containing B samples with S tokens. You can represent this workload as a tensor of shape [B, S], B being the size of the batch and S being the maximum sequence length within the B samples. For all the instances (N), each of them executes on C / N cores and would receive a subset of the task [B / N, S]. Each instance doesn't receive the global batch but instead, they all receive a subset of it [B / N, S] thus the name Batch Size Scaling. In order to highlight the benefits of such scaling method, the charts below reports both the latencies when scaling up model instances along with the effects on the throughput. When looking at the results, let's focus on the latency and the throughput aspects: On one hand, we are taking the maximum latency over the pool of instances to reflect the time it takes to process all the samples in the batch. Putting it differently, as instances operate in a truly parallel fashion, the time it takes to gather all the batch chunks from all the instances is driven by the longest time it takes for individual instance in the pool to get their chunk done. As you can see below on Figure 7., the actual latency gain when increasing the number of instances is really dependent of the problem size. In all cases, we can find an optimal resource allocation (batch size & number of instances) to minimize our latency but, there is no specific pattern on the number of cores to involve in the computation. Also, it is important to notice the results might look totally different on another system (i.e. Operating System, Kernel Version, Framework version, etc.) Figure 8. sums up the best multi-instance configuration when targeting minimum latency by taking the minimum over the number of instances involved. For instance, for {batch = 8, sequence length = 128} using 4 instances (each with {batch = 2} and 12 cores) gives the best latency measurements. The Figure 9. reports all the setups minimizing latency for both PyTorch and TensorFlow for various problem-sizes. Spoiler: There are numerous other optimizations we will discuss in a follow-up blog post which will substantially impact this chart. Figure 8. Max latency evolution with respect to number of instances for a total batch size of 8 Figure 9. Optimal number of instance minimizing overall latency for a total batch size of 8 On a second hand, we observe the throughput as the sum of all the model instance executing in parallel. It allows us to visualize the scalability of the system when adding more and more instances each of them with fewer resources but also proportional workload. Here, the results show almost linear scalability and thus an optimal hardware usage. Figure 10. Sum throughput with respect to number of instances for a total batch size of 8
[ 0.022972585633397102, -0.0038710276130586863, -0.016406605020165443, 0.028533365577459335, 0.023122945800423622, 0.06823961436748505, -0.0028337661642581224, 0.017168909311294556, -0.06286729127168655, -0.06754324585199356, -0.046118080615997314, 0.01849851943552494, 0.014981130138039589, 0.08129274845123291, 0.004539551679044962, -0.005895675625652075, 0.037463851273059845, -0.04663432389497757, 0.005575213115662336, 0.006270660553127527, 0.07070765644311905, -0.018770642578601837, 0.08468377590179443, 0.09653262794017792, -0.06350862234830856, 0.033195916563272476, -0.04718916490674019, -0.0005734639125876129, -0.006319562438875437, 0.00017141825810540468, -0.11864890158176422, -0.032582711428403854, -0.0323142446577549, 0.00864611566066742, 0.022564930841326714, -0.058606814593076706, -0.08161447942256927, 0.07637739926576614, 0.0360480397939682, -0.04229312390089035, 0.06884144991636276, -0.04491382837295532, -0.0244508758187294, -0.022676831111311913, -0.011365534737706184, 0.023452255874872208, -0.060708072036504745, 0.04782351478934288, -0.022853847593069077, 0.007049662992358208, -0.07166323065757751, 0.07215705513954163, 0.017586883157491684, 0.004585782065987587, 0.014010543935000896, 0.007373745087534189, 0.015752825886011124, -0.05811462551355362, 0.03713233023881912, -0.0055712866596877575, 0.07892341911792755, -0.02092711813747883, 0.01616314798593521, 0.05479217693209648, -0.023623056709766388, 0.034686584025621414, 0.029996369034051895, -0.01020187046378851, -0.031998246908187866, -0.0033819626551121473, 0.017778784036636353, -0.0448434017598629, 0.028663357719779015, 0.03039902076125145, -0.032773859798908234, -0.0022464324720203876, 0.00739139411598444, -0.049806125462055206, 0.045882124453783035, 0.026628846302628517, -0.06642568856477737, -0.007479414809495211, -0.001475165830925107, 0.01833130419254303, 0.04388224333524704, 0.03191203996539116, 0.01214493066072464, -0.03332361951470375, -0.05341595783829689, 0.059939656406641006, 0.0048980917781591415, -0.10582507401704788, 0.08067235350608826, 0.016470925882458687, 0.011484146118164062, -0.027045441791415215, 0.027190541848540306, -0.007448346354067326, 0.007158411666750908, -0.0035517276264727116, 0.019636347889900208, -0.07572933286428452, 0.017171243205666542, 0.0272871982306242, -0.0644029974937439, 0.08344129472970963, -0.015500565059483051, -0.14099963009357452, -0.03254641219973564, 0.06215638667345047, -0.0336049422621727, 0.06698310375213623, -0.031164119020104408, 0.05330202728509903, -0.07450837641954422, -0.036905672401189804, -0.0723051130771637, 0.026141216978430748, 0.014983328059315681, -0.016122836619615555, 0.011253062635660172, 0.06528688967227936, 0.08792570978403091, -0.028894400224089622, -0.058160364627838135, 0.02492479793727398, 0.08890776336193085, 0.007716719526797533, -0.006891441065818071, -0.022384511306881905, 0.017399368807673454, -0.03602173551917076, 0.04018628969788551, 0.007746062707155943, 0.08053953945636749, -0.07942571491003036, -0.010634459555149078, -0.04090379551053047, 0.010911344550549984, 0.000633513554930687, -0.046593379229307175, -0.005444117356091738, 0.00244837231002748, 0.008040235377848148, 0.06994567066431046, 0.0489882193505764, -0.09471674263477325, -0.038658421486616135, -0.0148247005417943, 0.024580571800470352, -0.08931168168783188, 0.04005294293165207, -0.0609922893345356, -0.04249690845608711, 0.04202049970626831, 0.05452871695160866, 0.03454926982522011, -0.09948588907718658, -0.06858138740062714, -0.0542767159640789, -0.06382584571838379, -0.03513815253973007, 0.03020666539669037, -0.04376443102955818, 0.016545521095395088, -0.015904469415545464, 0.05399696156382561, -0.021885009482502937, -0.023412475362420082, 0.04281529411673546, -0.06887993216514587, 0.05881963297724724, 0.04978429153561592, -0.022130491212010384, -0.0036915934178978205, -0.0007277496042661369, -0.006891952827572823, 0.06184421107172966, 0.01976199448108673, -0.028080660849809647, -0.05809900537133217, -0.0012216030154377222, -0.02103939838707447, 0.04915964975953102, 0.048166919499635696, -0.1352308988571167, 0.012426823377609253, -0.02322627790272236, -0.04823619872331619, 0.00712071405723691, -0.027997978031635284, -0.007326237857341766, 0.04091973602771759, -0.028718307614326477, 0.056746404618024826, -0.04681133106350899, -0.055168118327856064, 0.06727205961942673, 0.038705576211214066, 0.02234494499862194, 0.051194868981838226, 0.02429896779358387, 0.007984982803463936, 0.012958954088389874, -0.0173904150724411, 0.019114067777991295, 0.021264012902975082, -0.051746632903814316, 0.0025020111352205276, 0.04115285351872444, -0.04305192455649376, -0.09795834124088287, -0.04529176279902458, -0.04586097225546837, -0.024759823456406593, 0.03277833014726639, 0.007189719472080469, -0.021589282900094986, 0.04968942329287529, -0.054482538253068924, 0.19707238674163818, -0.021604351699352264, -0.013349815271794796, 0.0023527941666543484, -0.029609398916363716, -0.007417847868055105, 0.02932579815387726, -0.020281730219721794, 0.07301647961139679, -0.026406781747937202, 0.05191675201058388, -0.05755964294075966, -0.0002832433092407882, 0.08109796047210693, 0.0191669799387455, 0.03830898925662041, -0.0948304757475853, 0.04475681483745575, -0.03520546853542328, -0.09311860799789429, -0.04097885638475418, 0.03046448901295662, -0.007849365472793579, 0.01936560496687889, 0.05724049359560013, 0.01687455363571644, 0.05592649057507515, -0.0352853499352932, -0.025456435978412628, -0.07528960704803467, -0.04916057363152504, 0.019486449658870697, 0.03645043820142746, -0.0714750736951828, 0.027145501226186752, 0.010888244025409222, -0.021192308515310287, -0.01024922076612711, -0.004267997574061155, 0.0037556879688054323, 0.007327822502702475, 0.0004467929538805038, 0.007994710467755795, -0.005527889356017113, 0.0370703786611557, -0.027894286438822746, -0.004729822278022766, -0.03762156888842583, -0.005913214758038521, -0.03494861349463463, 0.00569161819294095, -0.016232596710324287, 0.013063974678516388, 0.018783533945679665, -0.018259290605783463, -0.014160938560962677, -0.00940494704991579, 0.012047967873513699, -0.006682998966425657, -0.007443936541676521, -0.009085142984986305, -0.04224593937397003, 0.01875380054116249, 0.038696371018886566, -0.010737186297774315, -0.019842492416501045, 0.0050555081106722355, -0.0048210155218839645, -0.04825329780578613, -0.007694167550653219, 0.0145908547565341, 0.0026942514814436436, 0.013689062558114529, -0.015266473405063152, 0.025220336392521858, 0.0412059910595417, -0.026287319138646126, -0.04625140503048897, -0.0022712743375450373, 0.0010284989839419723, -0.012800213880836964, -0.015747008845210075, -0.04639376327395439, 0.005913848523050547, -0.06012798100709915, 0.0001684549788478762, -0.0009531528339721262, 0.07119151949882507, -0.09194191545248032, -0.020513271912932396, -0.019708409905433655, 0.028590822592377663, -0.024345627054572105, -0.02915637381374836, 0.05710146576166153, 0.002555420156568289, -0.016797121614217758, 0.04462527483701706, 0.01618724875152111, -0.00010248470061924309, 0.004417612217366695, 0.0054362923838198185, 0.021377522498369217, 0.04151828959584236, 0.001575830508954823, -0.01213543489575386, 0.013789210468530655, 0.04252098873257637, 0.04409397020936012, 0.0288797989487648, -0.0010916107567027211, 0.016062056645751, 0.01367731112986803, 0.02049771323800087, -0.000054951844504103065, 0.006957179866731167, 0.01399136707186699, -0.006162888370454311, -0.07193850725889206, -0.02708941325545311, -0.010680264793336391, -0.02346799522638321, -0.022945424541831017, -0.008522683754563332, -0.02794879861176014, -0.003350514220073819, 0.007450111676007509, 0.03901269659399986, 0.014679975807666779, -0.024805577471852303, 0.044182006269693375, -0.03789307922124863, 0.010029975324869156, 0.010671161115169525, 0.018505366519093513, -0.01341540552675724, 0.043753255158662796, -0.013653124682605267, -0.02343551628291607, -0.013530011288821697, 0.02670148015022278, 0.03770071640610695, -0.010018414817750454, -0.004583369009196758, -0.05501978471875191, 0.03136753663420677, 0.054419614374637604, -0.019157662987709045, -0.03066384047269821, 0.02639033831655979, 0.012955724261701107, 0.02190619520843029, -0.010807542130351067, 0.059285759925842285, 0.018270408734679222, 0.005458163563162088, -0.013994949869811535, 0.03035842254757881, -0.0045132883824408054, 0.04401157796382904, -0.008082164451479912, -0.0025780252180993557, -0.01752517931163311, 0.014203717932105064, -0.011478881351649761, -0.03389941155910492, 0.016315853223204613, 0.056617338210344315, -0.010106613859534264, 0.011714305728673935, -0.030244002118706703, -0.01860794797539711, 0.03250102698802948, 0.025081979110836983, 0.05776451900601387, 0.005668220110237598, -0.0036546026822179556, 0.021260397508740425, 0.007684254553169012, -0.02524283155798912, 0.04164835065603256, -0.01306984480470419, 0.006505219265818596, -0.007596013136208057, 0.05168654024600983, 0.0481673888862133, 0.03162144497036934, 0.002489923033863306, 0.01959233731031418, -0.018266767263412476, 0.03158189356327057, 0.023857584223151207, 0.01076248474419117, 0.031152524054050446, 0.019993728026747704, -0.0017727294471114874, 0.007063951808959246, 0.005431993864476681, 0.0027972282841801643, -0.017572900280356407, 0.0065790582448244095, -0.025185540318489075, 0.024316331371665, 0.013143794611096382, -0.03460787981748581, 0.04741859436035156, 0.004110779147595167, 0.033547911792993546, -0.025896091014146805, 0.04593021795153618, -0.009526506997644901, -0.000587785616517067, 0.047984976321458817, -0.008577199652791023, 0.034238457679748535, -0.026441318914294243, -0.01833074539899826, -0.0486740916967392, -0.03929528221487999, 0.028970124199986458, 0.025526922196149826, 0.0061372569762170315, 0.013528709299862385, -0.013563551008701324, -0.04359545186161995, -0.0009690026054158807, -0.013939344324171543, -0.019000409170985222, 0.02242024429142475, 0.024299122393131256, 0.013819670304656029, -0.033587679266929626, 0.035589803010225296, 0.04245759919285774, -0.010142144747078419, -0.005403917282819748, 0.011375099420547485, 0.053355347365140915, 0.0298086479306221, -0.008315807208418846, -0.07835904508829117, 0.02693820931017399, 0.01658639870584011, -0.03300134465098381, -0.0008052543853409588, 0.013472245074808598, 0.008631845004856586, 0.041163668036460876, -0.012241761200129986, -0.01545333955436945, -0.05120376497507095, 0.0016930998535826802, 0.01703384518623352, -0.024001596495509148, -0.07134774327278137, -0.022969597950577736, -0.0007283826125785708, -0.009357106871902943, -0.016538597643375397, -0.001861981232650578, -0.02576364390552044, -0.04912774637341499, 0.0563056655228138, 0.023209329694509506, 0.03310934081673622, 0.004755282308906317, 0.006416183430701494, 0.014841589145362377, -0.03454092517495155, -0.008279599249362946, 0.007259843870997429, -0.004367152228951454, 0.006581419613212347, 0.03497884422540665, 0.041307926177978516, 0.08115316182374954, -0.012872926890850067, 0.02547531947493553, 0.04971247911453247, 0.01250153873115778, 0.059640876948833466, -0.034500617533922195, 0.002487196121364832, -0.01672348752617836, 0.012567101046442986, 0.011260905303061008, -0.005804445594549179, -0.015339482575654984, -0.004751572851091623, 0.026265254244208336, -0.011843265034258366, -0.019260600209236145, 0.009158836677670479, 0.0065873474813997746, -0.020809365436434746, -0.014185534790158272, -0.017519980669021606, -0.026965029537677765, 0.02107282541692257, 0.0006389442132785916, -0.05914999544620514, 0.03852098435163498, 0.01438728254288435, -0.01957111991941929, -0.056731704622507095, 0.030168786644935608, 0.029038172215223312, 0.03390108793973923, -0.002913949079811573, -0.026659972965717316, -0.03070993162691593, -0.006171786226332188, -0.04865645244717598, -0.03188519552350044, -0.010878253728151321, -0.010677386075258255, -0.026941491290926933, 0.03856493532657623, 0.021615782752633095, -0.008570266887545586, -0.0331619456410408, 0.019606493413448334, 0.060157500207424164, -0.01506619993597269, 0.03231830894947052, 0.0567183680832386, 0.04902881011366844, -0.032821331173181534, -0.028905082494020462, -0.010871689766645432, 0.007224635221064091, 0.005780295003205538, -0.05189575254917145, -0.04891718551516533, 0.058989524841308594, -0.010023637674748898, -0.0075127240270376205, 0.03592108562588692, 0.03770063817501068, -0.030758872628211975, 0.012063924223184586, 0.01597653143107891, 0.011624391190707684, 0.01892562210559845, 0.017530126497149467, -0.0040320102125406265, 0.02517024055123329, 0.020876163616776466, 0.04438447952270508, -0.0353078693151474, 0.047017041593790054, -0.009946019388735294, -0.02557714283466339, 0.04495254158973694, -0.023309722542762756, -0.07451560348272324, 0.04411143809556961, 0.001898178132250905, 0.03618369251489639, 0.01634896919131279, -0.032438356429338455, 0.01154747698456049, -0.007034343667328358, 0.03877602890133858, -0.003171181073412299, 0.03647223860025406, 0.02876817248761654, 0.01269995141774416, 0.010988195426762104, 0.058059364557266235, 0.04861083999276161, -0.0021775909699499607, 0.021697480231523514, -0.018933812156319618, 0.05088956281542778, -0.0009724433184601367, 0.035780567675828934, 0.035045139491558075, 0.036595769226551056, -0.010952389799058437, 0.010007086209952831, -0.016819048672914505, -0.021553946658968925, -0.04041088744997978, 0.024203671142458916, -0.03057262860238552, -0.009006529115140438, 0.015512075275182724, -0.02524447627365589, 0.0407177098095417, -0.02630857564508915, 0.0028222298715263605, -0.029366785660386086, -0.0007904047961346805, -0.0033057036343961954, -0.017869718372821808, 0.03270384669303894, 0.019286422058939934, 0.005290692672133446, 0.0262282844632864, 0.00891994871199131, 0.024675797671079636, -0.015904532745480537, -0.025453446432948112, -0.021777573972940445, -0.05688793212175369, -0.0015442585572600365, -0.02209727093577385, 0.012470331974327564, 0.02486514300107956, 0.032779209315776825, -0.019826170057058334, -0.05690918490290642, 0.04179973527789116, -0.029660236090421677, -0.03606272116303444, 0.008562236092984676, 0.006807966157793999, -0.0012523723999038339, 0.03334028273820877, -0.02180931717157364, -0.06636297702789307, -0.023475773632526398, -0.002981838770210743, -0.000971259200014174, 0.011457829736173153, -0.017823858186602592, -0.023225441575050354, -0.033235013484954834, 0.048916567116975784, 0.0012009816709905863, 0.02063821256160736, -0.055482517927885056, 0.01144536305218935, 0.061804015189409256, 0.0010155393974855542, -0.017645619809627533, 0.010812756605446339, 0.032605405896902084, 0.001074821688234806, -0.058491937816143036, 0.03058541938662529, 0.012888173572719097, -0.031970083713531494, 0.06107635423541069, 0.005311391316354275, -0.01283931266516447, -0.04580378159880638, 0.05931388959288597, -0.0037285233847796917, 0.026890061795711517, 0.0022972100414335728, -0.0014895747881382704, 0.0050101992674171925, -0.06931847333908081, -0.00775112584233284, -0.000243698843405582, 0.03026193380355835, -0.018212543800473213, 0.033700503408908844, -0.010536115616559982, -0.005855256225913763, -0.023293642327189445, -0.00515227485448122, 0.04429255798459053, 0.009755282662808895, -0.014361477456986904, -0.016812151297926903, 0.048493269830942154, 0.014714597724378109, 0.05136621370911598, 0.02994019165635109, -0.0022996796760708094, 0.03982001543045044, -0.020101750269532204, 0.00018643691146280617, -0.0008847065037116408, 0.03780819848179817, -0.011955007910728455, -0.01333965640515089, -0.03013499267399311, 0.03674637898802757, -0.04399741441011429, 0.018147235736250877, -0.03563909977674484, -0.003253726987168193, -0.032731764018535614, 0.020410452038049698, -0.047196317464113235, -0.012998669408261776, 0.04772385582327843, 0.014308043755590916, 0.05086209252476692, 0.006686725653707981, -0.05123212933540344, -0.010213594883680344, -0.02720973640680313, 0.03324779123067856, 0.017627675086259842, -0.028119932860136032, -0.016127584502100945, 0.0032907137647271156, 0.009938283823430538, 0.016735048964619637, -0.029405420646071434, 0.007057631853967905, 0.047357238829135895, 0.035488635301589966, -0.02852325700223446, 0.03738672286272049, 0.03761344403028488, 0.005026674829423428, 0.03925687074661255, 0.01844394952058792, -0.02314193733036518, -0.018763210624456406, -0.01067420281469822, -0.009954445995390415, -0.03674900531768799, 0.029176758602261543, 0.027239453047513962, 0.03427877277135849, -0.0038722376339137554, 0.023849736899137497, -0.05530361831188202, -0.019062276929616928, 0.016463197767734528, -0.02386963926255703, -0.03709614276885986, -0.030478624626994133, -0.024805935099720955, 0.024056443944573402, -0.02764962799847126, -0.03190160542726517, -0.00461168959736824, 0.005986586678773165, 0.02602427266538143, 0.027087222784757614, 0.006119293160736561, 0.007589846383780241, -0.0508287213742733, -0.02417794242501259, -0.031151099130511284, 0.026814987882971764, 0.05128229409456253, 0.04209897294640541, -0.012521378695964813, 0.008890656754374504 ]
Scaling-up BERT Inference on CPU (Part 1)
mfuntowicz
April 20, 2021
bert-cpu-scaling-part-1
guide, nlp, partnerships, intel
https://huggingface.co/blog/bert-cpu-scaling-part-1
1. Context and Motivations Back in October 2019, my colleague Lysandre Debut published a comprehensive (at the time) inference performance benchmarking blog (1). Since then, 🤗 transformers (2) welcomed a tremendous number of new architectures and thousands of new models were added to the 🤗 hub (3) which now counts more than 9,000 of them as of first quarter of 2021. As the NLP landscape keeps trending towards more and more BERT-like models being used in production, it remains challenging to efficiently deploy and run these architectures at scale. This is why we recently introduced our 🤗 Inference API: to let you focus on building value for your users and customers, rather than digging into all the highly technical aspects of running such models. This blog post is the first part of a series which will cover most of the hardware and software optimizations to better leverage CPUs for BERT model inference. For this initial blog post, we will cover the hardware part: - Setting up a baseline - Out of the box results - Practical & technical considerations when leveraging modern CPUs for CPU-bound tasks - Core count scaling - Does increasing the number of cores actually give better performance? - Batch size scaling - Increasing throughput with multiple parallel & independent model instances We decided to focus on the most famous Transformer model architecture, BERT (Delvin & al. 2018) (4). While we focus this blog post on BERT-like models to keep the article concise, all the described techniques can be applied to any architecture on the Hugging Face model hub. In this blog post we will not describe in detail the Transformer architecture - to learn about that I can't recommend enough the Illustrated Transformer blogpost from Jay Alammar (5). Today's goals are to give you an idea of where we are from an Open Source perspective using BERT-like models for inference on PyTorch and TensorFlow, and also what you can easily leverage to speedup inference.
[ 0.027842465788125992, 0.03492935001850128, -0.006748459301888943, 0.0007886133389547467, -0.041474711149930954, 0.07506035268306732, 0.07414402812719345, 0.05468102544546127, -0.006390530616044998, -0.051104940474033356, -0.013393132947385311, 0.07163910567760468, 0.015474766492843628, 0.07365443557500839, 0.024361515417695045, -0.0596458837389946, 0.08261607587337494, -0.028455644845962524, 0.025473572313785553, 0.025333384051918983, 0.04160294681787491, -0.10776234418153763, 0.08861374109983444, 0.023541972041130066, -0.01933169923722744, -0.0697077289223671, -0.005601499229669571, 0.0006278168875724077, -0.043846242129802704, 0.032005634158849716, -0.11814244836568832, 0.034530144184827805, 0.011046585626900196, -0.06300590187311172, -0.011238093487918377, -0.002475644461810589, -0.1308460682630539, 0.0432620570063591, 0.03627856448292732, 0.03217119351029396, -0.0009635632741264999, -0.012667933478951454, -0.07727193087339401, -0.0005535000236704946, 0.019109973683953285, -0.005270570516586304, -0.09664752334356308, 0.04850893095135689, -0.0014218296855688095, -0.0219914298504591, -0.07119383662939072, 0.06934390217065811, -0.04353819414973259, 0.0044262525625526905, 0.009073955938220024, -0.014070014469325542, -0.031656332314014435, -0.10589828342199326, 0.020266063511371613, 0.035594403743743896, 0.024277912452816963, -0.022399362176656723, 0.015461311675608158, -0.004613158758729696, -0.010502250865101814, 0.002211549784988165, -0.0538504533469677, -0.02235492691397667, -0.05052868276834488, 0.019767431542277336, 0.00569495651870966, -0.029831664636731148, -0.03405539318919182, -0.004213142208755016, -0.004481133539229631, -0.016297001391649246, 0.06064262241125107, 0.01622171700000763, 0.07912395894527435, 0.019797805696725845, -0.07801025360822678, 0.010930082760751247, 0.010708626359701157, 0.030924327671527863, 0.05651800334453583, 0.06549898535013199, 0.051775477826595306, -0.010973206721246243, -0.047835834324359894, 0.046614233404397964, -0.023286988958716393, -0.13424062728881836, -0.043752167373895645, -0.013913128525018692, -0.013438757508993149, -0.024998482316732407, -0.0020117941312491894, 0.05735424533486366, -0.025279952213168144, -0.027279242873191833, 0.05094725638628006, -0.03756513446569443, 0.03454463556408882, -0.05253640562295914, -0.03831787407398224, 0.026820247992873192, 0.02234121598303318, -0.09165485948324203, -0.023656943812966347, 0.030455032363533974, -0.05272229388356209, -0.03285869583487511, -0.04625280946493149, 0.05524662137031555, -0.06467614322900772, -0.009785450994968414, -0.010731024667620659, -0.009652208536863327, 0.015374168753623962, -0.03416528180241585, 0.05331995338201523, 0.09215731173753738, 0.0703921914100647, -0.057844262570142746, -0.005574753507971764, 0.08099112659692764, 0.024294661357998848, -0.0023736783768981695, 0.050183556973934174, -0.04495424032211304, 0.042185813188552856, -0.06428563594818115, 0.05883467197418213, -0.06573833525180817, -0.007369027007371187, -0.04212290421128273, -0.0306452177464962, -0.06473245471715927, -0.025628596544265747, 0.017218809574842453, -0.034397371113300323, -0.013414621353149414, 0.022546421736478806, -0.02362125739455223, 0.07079722732305527, -0.005522130988538265, -0.1108526960015297, 0.0303584486246109, 0.01627872698009014, -0.008246172219514847, -0.12386680394411087, 0.03725108131766319, -0.06218568980693817, -0.06448130309581757, 0.06274418532848358, 0.045217860490083694, 0.021653706207871437, -0.06715646386146545, -0.09487488120794296, -0.053883858025074005, -0.025594664737582207, -0.05831386521458626, -0.02197352983057499, 0.002849073149263859, 0.005007372237741947, -0.017654281109571457, 0.026452021673321724, -0.00909484177827835, 0.009697288274765015, 0.029733896255493164, -0.012391177006065845, 0.0402013435959816, 0.0808815285563469, -0.0028226401191204786, -0.01377144642174244, 0.05966256186366081, 0.0318591333925724, 0.06173180788755417, -0.03525112196803093, 0.015978096053004265, -0.04975268989801407, 0.05106666684150696, 0.018248042091727257, 0.09854351729154587, 0.051672641187906265, -0.07037308067083359, 0.013148781843483448, -0.056947335600852966, -0.04457094892859459, 0.01142161525785923, -0.00929336342960596, -0.037394486367702484, 0.07987559586763382, 0.016697507351636887, 0.0009282056707888842, -0.011156503111124039, -0.05208936333656311, 0.09034048020839691, 0.03757287561893463, 0.03318637236952782, 0.033881183713674545, 0.008650477044284344, 0.030521545559167862, 0.03194709122180939, -0.05762965977191925, -0.02664043754339218, -0.01180117204785347, -0.05856376513838768, 0.02056919038295746, 0.04732583463191986, 0.006215870380401611, -0.11456073075532913, -0.015775002539157867, -0.04085646942257881, -0.011611919850111008, -0.07687978446483612, 0.0011913975467905402, 0.006638874765485525, 0.07431118190288544, -0.05142991244792938, 0.1394324004650116, -0.07040797919034958, 0.006471915170550346, 0.024420160800218582, -0.013011522591114044, 0.01831812784075737, 0.06368986517190933, 0.005186206661164761, 0.07912421226501465, -0.02391081675887108, -0.04254119470715523, -0.06417639553546906, -0.0027292862068861723, 0.017086364328861237, -0.023659251630306244, -0.018012918531894684, -0.013765878975391388, 0.005265913903713226, 0.021145883947610855, -0.06084321811795235, -0.020917724817991257, 0.022166358307003975, 0.01007296796888113, 0.037703465670347214, 0.0021541372407227755, -0.02989029325544834, 0.04184158146381378, 0.0480588935315609, 0.0038109717424958944, -0.049920350313186646, -0.08523506671190262, 0.01464721467345953, -0.018213873729109764, -0.05146035552024841, 0.024991977959871292, 0.05027123540639877, -0.018793312832713127, 0.005845335312187672, -0.028304774314165115, 0.03422313928604126, 0.023185839876532555, -0.02021380141377449, -0.018707556650042534, -0.03144446015357971, 0.002081013983115554, -0.067159004509449, -0.05210535600781441, 0.011373784393072128, 0.0073231239803135395, -0.010057002305984497, -0.006919047329574823, -0.04790949821472168, 0.034649815410375595, 0.0035737105645239353, 0.031342361122369766, 0.01866310089826584, 0.05322574824094772, -0.03260122612118721, -0.01088427472859621, -0.002980235032737255, -0.028210250660777092, -0.03692805767059326, 0.008010489866137505, 0.011489265598356724, -0.026149168610572815, -0.004237305838614702, 0.007765857968479395, -0.022683395072817802, -0.018670016899704933, -0.026046819984912872, 0.019003650173544884, 0.012775173410773277, -0.006537472363561392, -0.0526110902428627, -0.007547725457698107, 0.03728906065225601, 0.00588410347700119, -0.020180195569992065, -0.03637760877609253, -0.025132646784186363, -0.01033295039087534, 0.004004223272204399, -0.01797546073794365, 0.02803727425634861, -0.033032484352588654, 0.02053665556013584, -0.000021513835235964507, 0.04640986770391464, -0.08897808939218521, -0.009291241876780987, -0.01451306976377964, 0.014818054623901844, -0.01784357987344265, -0.02854539081454277, 0.0352511890232563, -0.025406107306480408, 0.006114424206316471, 0.027589591220021248, -0.010507923550903797, 0.019022967666387558, 0.005743539892137051, -0.024755246937274933, -0.003958456218242645, -0.010175401344895363, 0.029755666851997375, -0.017553001642227173, 0.014363441616296768, 0.0018261877121403813, 0.0028725252486765385, 0.0020392369478940964, -0.0006586768431589007, -0.005002147983759642, 0.023505091667175293, 0.023841137066483498, 0.02274731919169426, 0.014799843542277813, 0.049785252660512924, -0.025630436837673187, -0.028602294623851776, -0.018519343808293343, -0.008344484493136406, -0.014561769552528858, -0.0138615807518363, 0.001118966145440936, -0.008340512402355671, 0.016204798594117165, 0.026083990931510925, 0.033550869673490524, 0.01725386455655098, 0.011522188782691956, 0.01765311136841774, 0.01167121808975935, 0.022408200427889824, 0.0009789974428713322, 0.028733301907777786, -0.03698025271296501, -0.004935001954436302, -0.014254768379032612, -0.021858341991901398, -0.006947240326553583, 0.0025026733055710793, 0.010348270647227764, 0.023943796753883362, 0.0004852442361880094, -0.027461398392915726, 0.0007198987877927721, 0.034772250801324844, 0.0021641117054969072, -0.07677645236253738, 0.0591084249317646, -0.0006716487114317715, 0.009387832134962082, -0.032557163387537, 0.037199825048446655, 0.0635824128985405, 0.007703808601945639, -0.011124242097139359, 0.024492088705301285, 0.007474844343960285, 0.053946781903505325, 0.006738340016454458, 0.006686969194561243, -0.040708452463150024, 0.02107013575732708, -0.004217619076371193, -0.005385426804423332, 0.0646127387881279, 0.017777150496840477, -0.04872141405940056, -0.017337040975689888, -0.024814389646053314, -0.022988252341747284, 0.03591644763946533, -0.0010764801409095526, 0.009549499489367008, -0.01769298128783703, 0.03354597091674805, 0.05483289435505867, -0.02521476335823536, -0.011498778127133846, 0.015305877663195133, -0.031907010823488235, 0.01449495367705822, -0.018511753529310226, 0.04736385494470596, 0.013073544949293137, 0.022827109321951866, 0.0027573166880756617, 0.030936483293771744, -0.03478590026497841, 0.02414965070784092, 0.025557391345500946, 0.009637194685637951, 0.05577936768531799, 0.0006305279093794525, -0.006952241528779268, 0.026344142854213715, -0.000019020390027435496, -0.00528341019526124, 0.0033760289661586285, 0.0037424350157380104, 0.028981178998947144, 0.0238278079777956, 0.01383970770984888, -0.021141204982995987, 0.01159144751727581, -0.018873976543545723, 0.031488969922065735, -0.013793425634503365, 0.0237006526440382, -0.00451022619381547, 0.002167180646210909, 0.05978255346417427, 0.016096359118819237, 0.03815935179591179, 0.017265047878026962, -0.004028498660773039, -0.010117841884493828, -0.04896600916981697, 0.0016925791278481483, 0.05668232962489128, 0.008073953911662102, 0.008644413203001022, 0.0485897921025753, -0.015765128657221794, -0.027224242687225342, -0.011318021453917027, 0.009869841858744621, -0.012588437646627426, 0.0417892150580883, 0.0508616678416729, -0.032895710319280624, 0.006500159855931997, 0.03830312192440033, -0.030285079032182693, -0.056512780487537384, -0.028754929080605507, 0.046592533588409424, 0.044887810945510864, -0.004500025883316994, -0.019590774551033974, 0.04290623217821121, 0.05558352172374725, 0.008834111504256725, -0.0066662984900176525, 0.039329733699560165, 0.04693770036101341, 0.04805855080485344, 0.023530304431915283, 0.018815308809280396, -0.015576685778796673, -0.010205268859863281, 0.00866795890033245, -0.012858349829912186, -0.008408240973949432, -0.05282938480377197, 0.004753771238029003, 0.013262052088975906, -0.013991969637572765, 0.010084671899676323, 0.012551154009997845, -0.03460758179426193, 0.01082787849009037, 0.057758357375860214, 0.034970298409461975, 0.024453366175293922, 0.018289092928171158, -0.0031870754901319742, -0.014401515014469624, -0.04038601741194725, -0.004632474854588509, 0.020427478477358818, 0.010462134145200253, 0.015483872964978218, 0.05538592487573624, 0.07367207854986191, -0.01730857975780964, 0.003915060311555862, 0.0016617445508018136, -0.023831108585000038, 0.03467998281121254, -0.025437358766794205, -0.0009561264305375516, -0.06044718250632286, 0.0074365464970469475, 0.053392328321933746, 0.010280921123921871, -0.007430199068039656, 0.00009247048001270741, 0.03079546056687832, 0.0007708967314101756, 0.003697016043588519, 0.07279198616743088, -0.0019186402205377817, 0.03056499920785427, -0.049777645617723465, 0.034579869359731674, -0.012922373600304127, -0.0003926461795344949, -0.009558903984725475, -0.019423140212893486, 0.02936418168246746, 0.03315885737538338, -0.023000262677669525, -0.03535090386867523, 0.05208893492817879, 0.022367723286151886, 0.03044762648642063, -0.022183848544955254, -0.03344559296965599, -0.030443809926509857, -0.006946590729057789, -0.028935948386788368, -0.040697239339351654, -0.0045956275425851345, -0.03531910106539726, 0.036283738911151886, 0.02326308935880661, 0.008779214695096016, -0.018339037895202637, -0.02643742971122265, 0.09358502179384232, 0.02342025376856327, -0.02769029140472412, -0.002116262214258313, 0.029073121026158333, 0.0367291085422039, 0.007878873497247696, -0.02911660261452198, -0.017665261402726173, -0.022360412403941154, 0.03489091619849205, -0.0670478418469429, 0.02298366092145443, 0.046129241585731506, -0.0194000992923975, -0.02451045997440815, 0.010740609839558601, 0.020927298814058304, 0.005185097921639681, -0.0032230603974312544, 0.015382295474410057, -0.009613832458853722, 0.0205190759152174, 0.0058445921167731285, -0.005914387293159962, 0.039201464504003525, 0.04498104006052017, -0.0031421466264873743, -0.05713203176856041, 0.038017794489860535, 0.02008628472685814, -0.061587441712617874, 0.04638567939400673, -0.006251316051930189, -0.01960003562271595, 0.006789275445044041, 0.02580108307301998, -0.018786828964948654, 0.015473880805075169, 0.01884167082607746, -0.006082665640860796, -0.002531599486246705, -0.012074162252247334, 0.032281141728162766, 0.07605579495429993, 0.01912226341664791, -0.010151505470275879, 0.05479881539940834, 0.0652226060628891, 0.05796823650598526, 0.0005748288822360337, 0.0022285226732492447, 0.020092707127332687, 0.08330780267715454, -0.01308157853782177, 0.0011322533246129751, 0.009556209668517113, -0.02309497818350792, 0.008668303489685059, 0.012438898906111717, -0.00534856365993619, -0.003907700534909964, -0.047293636947870255, 0.028546040877699852, -0.035145990550518036, 0.010707600973546505, -0.033557385206222534, 0.038175005465745926, 0.016248229891061783, 0.02418500930070877, -0.005256951786577702, 0.03335011005401611, -0.012579633854329586, -0.0026332002598792315, -0.007578047923743725, -0.010352217592298985, 0.04663962870836258, -0.04564553499221802, 0.009336014278233051, 0.03943336382508278, 0.06794485449790955, 0.006627495866268873, -0.04380952939391136, 0.019964834675192833, -0.030290983617305756, -0.022829169407486916, 0.003589622676372528, 0.003020279109477997, -0.013210037723183632, 0.012351627461612225, 0.0011021860409528017, -0.04621884599328041, 0.04186120629310608, -0.017252935096621513, -0.011662830598652363, 0.0010870645055547357, -0.0061667622067034245, -0.003915920853614807, 0.03368954733014107, 0.019373949617147446, -0.024449866265058517, 0.04816180467605591, -0.011115503497421741, -0.00961755309253931, 0.018369078636169434, -0.009425289928913116, 0.0040633585304021835, -0.015115621499717236, 0.0007187233422882855, -0.022648349404335022, 0.03130095824599266, -0.028376759961247444, -0.027600133791565895, 0.04243721067905426, 0.01954045705497265, 0.017645299434661865, 0.024431297555565834, -0.0048857275396585464, 0.0013289996422827244, -0.027242299169301987, 0.009322920814156532, 0.027561871334910393, -0.044859275221824646, -0.00776925403624773, -0.040808890014886856, -0.002653473522514105, -0.02842312678694725, 0.0310946237295866, 0.01984943263232708, 0.04364898055791855, -0.029533348977565765, -0.046591904014348984, 0.01571173593401909, -0.010313759557902813, -0.033761486411094666, 0.0031936473678797483, 0.00429341197013855, -0.021509874612092972, 0.007291346322745085, -0.0006630439311265945, -0.01102252583950758, -0.0032930150628089905, -0.021474989131093025, 0.06983279436826706, -0.025844290852546692, -0.03888528794050217, -0.045629654079675674, 0.02803553268313408, 0.010114075616002083, 0.03317732736468315, 0.049602046608924866, -0.0209958516061306, 0.05223871022462845, -0.016673462465405464, -0.014803605154156685, -0.009383055381476879, -0.014020479284226894, -0.04010137543082237, -0.024603161960840225, -0.0005057086236774921, 0.014217611402273178, -0.02578941360116005, 0.015633605420589447, -0.017301330342888832, -0.021191244944930077, -0.04270680248737335, -0.00971611775457859, -0.004257008899003267, -0.02486984059214592, 0.05683533847332001, 0.05795641615986824, 0.023775313049554825, -0.001145065645687282, -0.034810762852430344, -0.011695881374180317, -0.020738797262310982, 0.022466061636805534, 0.04557260870933533, 0.010244098491966724, -0.01471252553164959, -0.017880115658044815, -0.04072567820549011, 0.014788612723350525, -0.035898301750421524, 0.019900379702448845, 0.00324244168587029, -0.010381094180047512, -0.014504468068480492, 0.022338639944791794, 0.0376938059926033, -0.024141522124409676, 0.08025170117616653, -0.02730877697467804, 0.006821651477366686, -0.010562929324805737, -0.0066054221242666245, -0.0608038567006588, -0.04759467393159866, 0.019387736916542053, -0.026557140052318573, 0.03611915558576584, -0.005803061183542013, 0.017836950719356537, 0.01697893813252449, -0.013904809951782227, 0.011716177687048912, -0.017068790271878242, -0.03379971534013748, -0.05208205431699753, 0.0055312481708824635, 0.056548185646533966, -0.034886252135038376, -0.034137576818466187, 0.030471738427877426, 0.00001144779071182711, 0.0061287530697882175, 0.023067720234394073, -0.021541833877563477, -0.0032790638506412506, -0.029100071638822556, 0.022273235023021698, -0.007609494496136904, 0.03843777999281883, 0.035205382853746414, 0.014548049308359623, 0.01607207953929901, -0.021874159574508667 ]
Using & Mixing Hugging Face Models with Gradio 2.0
abidlabs
May 25, 2021
gradio
open-source-collab, guide
https://huggingface.co/blog/gradio
# Using & Mixing Hugging Face Models with Gradio 2.0 >
[ -0.03368688002228737, -0.037921469658613205, 0.05713387951254845, -0.007362969219684601, 0.05807245150208473, 0.05982498079538345, 0.02644927054643631, 0.0430385060608387, -0.07118741422891617, -0.06506285071372986, -0.10457473248243332, 0.05673366039991379, -0.030535250902175903, 0.10079780220985413, 0.018630264326930046, 0.013588527217507362, 0.027436405420303345, -0.026644432917237282, 0.004674974828958511, 0.0031388606876134872, 0.0016290334751829505, -0.0881047397851944, 0.016955541446805, -0.018111035227775574, -0.015711555257439613, -0.08468931168317795, 0.01269265916198492, 0.008108004927635193, -0.027380887418985367, 0.04590845853090286, -0.07184241712093353, -0.05022001266479492, 0.03491909056901932, -0.07053790986537933, 0.021348265931010246, 0.05117816850543022, -0.12379743903875351, 0.047139350324869156, 0.0239365603774786, -0.018492113798856735, 0.021027008071541786, -0.026823977008461952, -0.08377978205680847, 0.021952442824840546, -0.015912218019366264, -0.0020847865380346775, -0.21887049078941345, 0.03813757747411728, 0.000157664850121364, -0.008644431829452515, -0.044045958667993546, 0.06044347956776619, -0.043177057057619095, -0.009822489693760872, -0.035669323056936264, -0.0006202596705406904, 0.018484363332390785, -0.057339347898960114, 0.01569235324859619, -0.03877296671271324, 0.00184526143129915, 0.004959093406796455, -0.053398504853248596, 0.039224445819854736, -0.01098824292421341, 0.03954894095659256, -0.031114017590880394, -0.05249767750501633, -0.0843631848692894, 0.029613565653562546, 0.00934875849634409, 0.01349316630512476, -0.010884527117013931, -0.04399847611784935, 0.0248304083943367, -0.0442962683737278, -0.0473412349820137, -0.01603408344089985, 0.07730204612016678, 0.07502789050340652, 0.005823242478072643, -0.04038446024060249, 0.08085066825151443, 0.0600280836224556, 0.04101928323507309, 0.024760816246271133, 0.05406351760029793, -0.060935452580451965, -0.00003466242560534738, 0.09156867116689682, -0.08011844009160995, -0.11501888185739517, -0.03441423550248146, 0.002752382308244705, 0.08219251036643982, -0.018479732796549797, 0.018549228087067604, -0.003374398685991764, 0.04530293494462967, 0.029443219304084778, -0.02274591661989689, -0.016197891905903816, -0.013912513852119446, -0.05598342418670654, -0.021986575797200203, -0.04407684504985809, -0.04179655387997627, -0.06882798671722412, -0.03892838954925537, 0.01956326700747013, -0.015154133550822735, 0.0016408258816227317, 0.05582543462514877, 0.03676396235823631, -0.079659104347229, 0.06207127496600151, 0.00828803051263094, 0.00867654848843813, -0.009472670033574104, 0.019970688968896866, -0.002894565463066101, 0.11421951651573181, 0.04082493111491203, 0.044981442391872406, 0.044120851904153824, 0.1055278331041336, 0.018175337463617325, -0.018381601199507713, -0.01706809736788273, -0.027777595445513725, -0.024468183517456055, 0.030804388225078583, 0.02395477145910263, 0.015094674192368984, -0.005740823689848185, -0.09650545567274094, 0.009316660463809967, -0.0184790026396513, 0.016109546646475792, -0.012940289452672005, 0.01479880791157484, 0.06440012156963348, -0.011499741114675999, 0.05775192007422447, 0.029581213369965553, -0.05008997023105621, -0.029755724593997, 0.07326967269182205, -0.005536223296076059, 0.0033268576953560114, -0.03791292756795883, 0.05663343891501427, -0.04144323617219925, -0.029995907098054886, -0.037458062171936035, 0.04905971139669418, -0.05697295814752579, -0.01568213663995266, -0.02652582712471485, -0.020498579367995262, 0.045037996023893356, -0.014538249932229519, -0.028787832707166672, -0.04802057892084122, 0.11185334622859955, 0.02683471515774727, -0.030826639384031296, 0.03900653496384621, 0.04446232691407204, -0.025991149246692657, -0.023568622767925262, -0.01844779960811138, 0.027181996032595634, 0.008963595144450665, -0.06120824068784714, 0.07057518512010574, 0.05148477479815483, 0.07783707231283188, -0.026730874553322792, 0.003831455484032631, -0.054313138127326965, 0.03142080828547478, -0.014055056497454643, 0.020779233425855637, 0.02619168348610401, -0.026745779439806938, -0.011045819148421288, -0.02718726359307766, 0.029463030397892, 0.04148834943771362, -0.016774088144302368, -0.011439326219260693, 0.046398572623729706, -0.04414110258221626, 0.040635183453559875, -0.04538494721055031, -0.018583621829748154, 0.09349582344293594, 0.043841637670993805, 0.048247676342725754, 0.08374286442995071, -0.03621410205960274, 0.05838813632726669, 0.019412262365221977, -0.0016736843390390277, 0.041546907275915146, 0.013061783276498318, -0.04919344186782837, 0.010566819459199905, 0.019809583202004433, 0.002827534219250083, -0.09298131614923477, 0.07401053607463837, -0.052723951637744904, 0.007200096268206835, 0.04208534583449364, 0.04744445160031319, -0.006874152459204197, -0.030554503202438354, -0.004127623979002237, 0.1397068053483963, -0.018655765801668167, -0.028643852099776268, -0.010408022440969944, -0.010351832956075668, 0.08095231652259827, 0.08723357319831848, 0.012566874735057354, 0.08409769088029861, -0.10154207795858383, -0.008473604917526245, -0.026095882058143616, -0.004441436845809221, 0.0921773910522461, 0.00681846309453249, -0.022412922233343124, 0.03092879243195057, -0.02249213121831417, 0.06240566819906235, -0.050401441752910614, -0.009299679659307003, -0.033389605581760406, 0.0032359566539525986, 0.03012258931994438, -0.039582762867212296, -0.05642442777752876, 0.02154797501862049, 0.031449925154447556, -0.07069505751132965, -0.044225063174963, -0.021097075194120407, 0.05316919833421707, 0.022991077974438667, 0.02729855850338936, 0.07428964227437973, 0.009584796614944935, -0.0026913888286799192, -0.029731331393122673, -0.03286556899547577, 0.064786396920681, 0.009873283095657825, -0.027537578716874123, 0.010347713716328144, -0.05042522773146629, -0.018155451864004135, -0.01914663054049015, 0.0021826529409736395, 0.04258415848016739, 0.008492991328239441, 0.036427851766347885, 0.03431824967265129, -0.02649172954261303, 0.035143934190273285, -0.00961382407695055, 0.0034440928138792515, 0.0013660754775628448, 0.0005714730941690505, 0.00966118834912777, -0.032278697937726974, -0.028024621307849884, 0.0030095684342086315, -0.022358138114213943, 0.013636359013617039, 0.028228409588336945, 0.014254193753004074, -0.013124389573931694, 0.026785369962453842, -0.04258561134338379, -0.018290068954229355, 0.04500534012913704, 0.03222360089421272, 0.05024385079741478, 0.014056110754609108, -0.03689814358949661, 0.010105411522090435, 0.002625217894092202, 0.04927139729261398, 0.017403287813067436, -0.027958087623119354, 0.008571358397603035, -0.0015112876426428556, 0.025607150048017502, -0.012392932549118996, -0.008832636289298534, -0.027830172330141068, 0.003836497198790312, 0.05880321189761162, 0.0029880544170737267, -0.11910458654165268, -0.06196058541536331, 0.019312964752316475, 0.0543857179582119, -0.047852642834186554, -0.005179362837225199, 0.04287268966436386, -0.036682773381471634, -0.005564548075199127, -0.007057746406644583, 0.011974443681538105, 0.0018276236951351166, 0.03411904722452164, 0.003679609391838312, -0.046440690755844116, -0.035217806696891785, -0.0061378395184874535, 0.014457156881690025, 0.029048381373286247, 0.005174118094146252, -0.022767523303627968, 0.050324276089668274, -0.004153020214289427, -0.027410415932536125, -0.0113306175917387, 0.008698261342942715, 0.013562379404902458, -0.007853779941797256, 0.015930434688925743, -0.04774349927902222, 0.005680611357092857, 0.01221483200788498, -0.04268759861588478, 0.039163555949926376, -0.018429923802614212, -0.004578777588903904, -0.018701327964663506, 0.005542476195842028, 0.04486497491598129, -0.0045120143331587315, 0.014519837684929371, 0.0034090096596628428, 0.012933648191392422, -0.006351467687636614, -0.028506912291049957, -0.009229449555277824, -0.019818630069494247, 0.007642714306712151, 0.06579269468784332, -0.026818772777915, -0.01819452829658985, 0.011154075153172016, 0.024141136556863785, 0.08144474774599075, 0.01650826260447502, 0.008197720162570477, -0.007772204000502825, 0.05037536099553108, 0.033526353538036346, -0.013124414719641209, -0.03852880001068115, -0.0013983647804707289, -0.01639382913708687, -0.028819581493735313, -0.04919547587633133, 0.03775127977132797, 0.015622026287019253, 0.030773967504501343, -0.009859529323875904, 0.006106646731495857, -0.004129661712795496, -0.005252464208751917, -0.003961085807532072, 0.02265453338623047, -0.005519730504602194, 0.01770585961639881, -0.02053659036755562, -0.02246127836406231, 0.08047645539045334, -0.03399898111820221, -0.009574150666594505, -0.030393270775675774, 0.009197200648486614, -0.010751965455710888, -0.02645176835358143, -0.004713281523436308, 0.011190365068614483, -0.02777194045484066, 0.007922527380287647, 0.04092325270175934, -0.010776390321552753, -0.0170123390853405, 0.014667082577943802, -0.017462797462940216, -0.008291846141219139, 0.0007239016122184694, 0.05417325347661972, 0.019683798775076866, 0.01732012815773487, 0.008378112688660622, -0.00416230596601963, -0.05414903163909912, 0.02955606020987034, -0.012582020834088326, 0.023365886881947517, 0.053039081394672394, -0.028415845707058907, -0.04014088585972786, 0.02287156507372856, -0.01904340833425522, 0.031496111303567886, -0.029904795810580254, -0.018043048679828644, -0.019453130662441254, 0.020263250917196274, 0.0013103204546496272, -0.04794559255242348, -0.044357091188430786, -0.021173618733882904, 0.026812976226210594, -0.02061680145561695, 0.006531750783324242, -0.008619959466159344, -0.0327812060713768, 0.009903991594910622, 0.0003082319162786007, 0.01759536750614643, -0.019654545933008194, -0.011225586757063866, 0.003288813168182969, -0.044282201677560806, -0.031155100092291832, 0.04110749810934067, -0.0032671738881617785, 0.03129960596561432, 0.00002091319765895605, -0.007301530800759792, 0.032314036041498184, -0.014011206105351448, -0.07141267508268356, -0.010787833482027054, -0.0032806885428726673, 0.03169522061944008, -0.04339980334043503, 0.05024963989853859, -0.032158393412828445, -0.043924953788518906, 0.0017776399618014693, -0.037637971341609955, 0.015877818688750267, 0.04197317361831665, -0.032292090356349945, -0.007847013883292675, 0.045552149415016174, 0.036069996654987335, 0.007553354371339083, 0.03151286020874977, 0.044141385704278946, 0.013738363981246948, 0.022726472467184067, 0.0008233918342739344, -0.04460151866078377, -0.04732101410627365, 0.03427087888121605, 0.019074345007538795, -0.002960809739306569, -0.016519399359822273, -0.05748598650097847, -0.00542037608101964, -0.0007440372137352824, -0.023854929953813553, 0.007588434033095837, 0.010966832749545574, -0.028418516740202904, -0.014225227758288383, 0.011885508894920349, 0.046069685369729996, 0.0015506489435210824, 0.017998719587922096, 0.04407483711838722, -0.004323790315538645, -0.0005144757451489568, 0.029476772993803024, 0.00022252807684708387, 0.0036762389354407787, 0.0066221654415130615, 0.013879449106752872, 0.04617077112197876, 0.02417902648448944, 0.014347425661981106, 0.005158167332410812, -0.020215852186083794, 0.01988600566983223, -0.013803419657051563, -0.00048154659452848136, -0.01568690873682499, -0.018956869840621948, 0.00018126616487279534, 0.0033013068605214357, -0.02420664392411709, -0.010468987748026848, -0.0028093194123357534, -0.005661492235958576, -0.020917600020766258, 0.02287568524479866, 0.012857094407081604, -0.019265135750174522, -0.042563896626234055, 0.04383360594511032, -0.016706177964806557, 0.022712428122758865, -0.014426562003791332, -0.01185488048940897, -0.02409958280622959, 0.008806520141661167, -0.024887513369321823, -0.04047733172774315, 0.003961513284593821, -0.025655770674347878, 0.04717479646205902, -0.021475346758961678, -0.03659781813621521, -0.01822550967335701, -0.012425484135746956, 0.03838733583688736, -0.010034055449068546, 0.005508811213076115, 0.016548333689570427, -0.047148603945970535, 0.07106094807386398, 0.032019272446632385, -0.004833986982703209, 0.0162696223706007, 0.025088664144277573, 0.02107970044016838, 0.044688303023576736, -0.048424459993839264, 0.03825214132666588, 0.009982606396079063, 0.002451943000778556, 0.03940092399716377, 0.010299298912286758, -0.0357060432434082, -0.003910134080797434, -0.049007825553417206, -0.015656854957342148, 0.08058151602745056, 0.007495158351957798, -0.0007762370514683425, -0.011923238635063171, 0.045988813042640686, 0.005730642005801201, 0.04277178645133972, -0.013335894793272018, 0.016461336985230446, 0.030476117506623268, 0.016517335548996925, -0.02670998126268387, -0.008929886855185032, 0.006174255162477493, 0.055766768753528595, -0.04405224695801735, -0.005147621035575867, 0.029671739786863327, -0.015919800847768784, 0.03612711280584335, 0.002687691478058696, -0.020301852375268936, 0.012446964159607887, 0.0450749397277832, 0.016993509605526924, 0.054825346916913986, 0.029483556747436523, 0.019896185025572777, -0.006195565219968557, -0.015567399561405182, 0.026342103257775307, 0.07121623307466507, 0.0024480607826262712, -0.00823424756526947, 0.011162267066538334, 0.02400738000869751, 0.001699000713415444, 0.014950689859688282, 0.005062497686594725, 0.015147305093705654, 0.06574587523937225, 0.007052434142678976, 0.043095361441373825, 0.019289128482341766, -0.03494660183787346, 0.01442712638527155, -0.051291268318891525, -0.023220263421535492, 0.010307623073458672, 0.023863891139626503, 0.009892533533275127, 0.0005637141293846071, 0.008475388400256634, -0.014083579182624817, 0.06840381771326065, 0.04503641277551651, 0.01539777871221304, 0.004722255747765303, 0.012250330299139023, 0.029312174767255783, 0.023005032911896706, 0.002473639091476798, 0.03363080695271492, -0.0017939031822606921, 0.014577408321201801, 0.06818128377199173, 0.005135522224009037, 0.02304498665034771, 0.007425264921039343, -0.04529086872935295, 0.04569121077656746, -0.017064161598682404, -0.011411111801862717, -0.007963592186570168, 0.04950815439224243, -0.002282083733007312, 0.003925782162696123, -0.004383408930152655, -0.03220401704311371, -0.00012263884127605706, -0.027567923069000244, 0.025107165798544884, -0.011461982503533363, 0.006338145118206739, -0.004653115291148424, -0.005798768252134323, 0.015131155960261822, -0.010838087648153305, 0.009525461122393608, -0.0006579565233550966, 0.032023172825574875, 0.019956694915890694, -0.016482636332511902, -0.009949798695743084, -0.009199809283018112, -0.03469129279255867, -0.014398373663425446, -0.005251084454357624, -0.021641725674271584, 0.011265586130321026, -0.018515605479478836, 0.01957562193274498, -0.017527375370264053, 0.015889694914221764, 0.01457392331212759, 0.002739995950832963, -0.043141935020685196, 0.03263062611222267, -0.019930126145482063, 0.003969729412347078, -0.010896014049649239, -0.052754104137420654, -0.007063004188239574, -0.017018459737300873, 0.0020822363439947367, 0.019417963922023773, -0.009873921982944012, -0.017763838171958923, -0.041931647807359695, -0.03917090594768524, -0.022810880094766617, 0.016763590276241302, 0.02664331905543804, 0.01331989374011755, -0.014083519577980042, -0.007445197552442551, 0.0024540266022086143, -0.002692348090931773, 0.0007366508943960071, 0.006778278388082981, 0.0255677979439497, -0.01914062350988388, -0.04787128418684006, -0.004722851328551769, 0.05715032294392586, 0.037479761987924576, 0.014465813525021076, 0.04919324442744255, 0.05081094428896904, -0.02084093727171421, -0.01261338870972395, 0.01586882770061493, -0.0038471363950520754, -0.006748079787939787, -0.02716110646724701, -0.01897071860730648, -0.004980783443897963, -0.039495982229709625, 0.0115737933665514, 0.00896107591688633, -0.014269270934164524, -0.03006795234978199, -0.032205019146203995, -0.0031760064885020256, -0.0440421886742115, 0.030646754428744316, 0.03760440647602081, 0.04616105556488037, 0.019925640895962715, -0.027854368090629578, 0.00674162432551384, -0.006736057344824076, 0.03645812347531319, 0.001267242943868041, 0.03759641945362091, -0.009257707744836807, -0.02650381810963154, -0.04201257973909378, 0.012522529810667038, -0.022062288597226143, -0.05709029361605644, 0.0026133547071367502, 0.014881882816553116, -0.036963675171136856, -0.03610752150416374, -0.020570052787661552, 0.024129636585712433, 0.0004936344339512289, 0.028396200388669968, -0.02418687753379345, -0.05319849029183388, -0.006582205183804035, 0.05174275487661362, -0.03694523125886917, 0.047626275569200516, -0.010951047763228416, 0.01909695938229561, 0.007256089709699154, -0.019606759771704674, 0.011548195965588093, -0.03611798584461212, -0.03061470203101635, 0.01712622679769993, 0.0008527698810212314, -0.04370087385177612, -0.02848230116069317, -0.02320707030594349, 0.03406430035829544, -0.03492090478539467, -0.044881585985422134, 0.002047980669885874, 0.016419023275375366, -0.030801095068454742, -0.011747464537620544, -0.019095884636044502, 0.012027264572679996, 0.0025901899207383394, 0.012335735373198986, 0.005041506141424179, 0.04313182458281517, -0.019201550632715225, -0.05425385758280754, -0.010601745918393135, 0.05590862035751343 ]
Using & Mixing Hugging Face Models with Gradio 2.0
abidlabs
May 25, 2021
gradio
open-source-collab, guide
https://huggingface.co/blog/gradio
Cross-posted from the Gradio blog. The Hugging Face Model Hub has more than 10,000 machine learning models submitted by users. You’ll find all kinds of natural language processing models that, for example, translate between Finnish and English or recognize Chinese speech. More recently, the Hub has expanded to even include models for image classification and audio processing. Hugging Face has always worked to make models accessible and easy to use. The transformers library makes it possible to load a model in a few lines of code. After a model is loaded, it can be used to make predictions on new data programmatically. But it’s not just programmers that are using machine learning models! An increasingly common scenario in machine learning is demoing models to interdisciplinary teams or letting non-programmers use models (to help discover biases, failure points, etc.). The Gradio library lets machine learning developers create demos and GUIs from machine learning models very easily, and share them for free with your collaborators as easily as sharing a Google docs link. Now, we’re excited to share that the Gradio 2.0 library lets you load and use almost any Hugging Face model with a GUI in just 1 line of code. Here’s an example: By default, this uses HuggingFace’s hosted Inference API (you can supply your own API key or use the public access without an API key), or you can also run pip install transformers and run the model computations locally if you’d like. Do you want to customize the demo? You can override any of the default parameters of the Interface class by passing in your own parameters: But wait, there’s more! With 10,000 models already on Model Hub, we see models not just as standalone pieces of code, but as lego pieces that can be composed and mixed to create more sophisticated applications and demos. For example, Gradio lets you load multiple models in parallel (imagine you want to compare 4 different text generation models from Hugging Face to see which one is the best for your use case): Or put your models in series. This makes it easy to build complex applications built from multiple machine learning models. For example, here we can build an application to translate and summarize Finnish news articles in 3 lines of code: You can even mix multiple models in series compared to each other in parallel (we’ll let you try that yourself!). To try any of this out, just install Gradio (pip install gradio) and pick a Hugging Face model you want to try. Start building with Gradio and Hugging Face 🧱⛏️
[ -0.015561387874186039, -0.018721453845500946, -0.009417480789124966, -0.02938874065876007, 0.0552319660782814, 0.10377482324838638, 0.06329251825809479, 0.06531041860580444, -0.06968387961387634, -0.018298864364624023, -0.11822235584259033, 0.08389454334974289, -0.016370197758078575, 0.10805854201316833, 0.024865655228495598, -0.0903419628739357, 0.04717174544930458, -0.04701346904039383, -0.03346018120646477, 0.05044277384877205, 0.038966283202171326, -0.060208700597286224, 0.015080508776009083, 0.0009688076097518206, -0.09671494364738464, -0.05938905477523804, 0.04594498500227928, -0.00945435930043459, 0.017055174335837364, 0.002570290118455887, -0.11494613438844681, -0.024208862334489822, -0.0061881993897259235, -0.060696788132190704, 0.01005822978913784, 0.028744034469127655, -0.12012165039777756, 0.05621616542339325, 0.050806090235710144, 0.03271791711449623, 0.06102007254958153, -0.018206119537353516, -0.10352380573749542, 0.056005898863077164, 0.004621294792741537, 0.010746152140200138, -0.13857705891132355, 0.0027542042080312967, -0.012492658570408821, -0.006821020506322384, -0.10947351157665253, 0.03869827091693878, -0.012262369506061077, -0.05563057214021683, 0.010522113181650639, -0.0022842478938400745, 0.0389457643032074, -0.10946589708328247, 0.014175109565258026, 0.05794134736061096, -0.008325614035129547, 0.009588681161403656, -0.010449646972119808, 0.014141645282506943, -0.019939394667744637, -0.007223493419587612, -0.06098027899861336, 0.004922084975987673, -0.039170004427433014, -0.02608957141637802, -0.01314085815101862, 0.006315615028142929, -0.038912151008844376, -0.048389557749032974, 0.051038697361946106, -0.050396308302879333, -0.04886823147535324, -0.017593735828995705, 0.05209236219525337, -0.02860679104924202, 0.017750544473528862, 0.0040490897372365, 0.02720336988568306, -0.03342989832162857, 0.04536446928977966, 0.02185465767979622, 0.01230230275541544, -0.07659941166639328, -0.038700953125953674, 0.0731499046087265, -0.05676642432808876, -0.1273394376039505, -0.018662765622138977, -0.017499107867479324, 0.07834024727344513, 0.01518215611577034, 0.013250279240310192, 0.02336749993264675, -0.013585086911916733, -0.002713460475206375, -0.011613772250711918, -0.04363102465867996, 0.002282101660966873, -0.06779514253139496, -0.014951850287616253, -0.03294897824525833, 0.005614753812551498, -0.09926939755678177, -0.02769147790968418, 0.03163658827543259, 0.03626386076211929, -0.059179872274398804, 0.0002985204046126455, 0.0680355504155159, -0.08446674048900604, 0.028857693076133728, 0.017110586166381836, 0.025364603847265244, -0.01811336725950241, -0.009751790203154087, -0.007261357735842466, 0.027141662314534187, -0.022628525272011757, 0.05237724632024765, 0.017879433929920197, 0.10155238211154938, -0.03882076218724251, -0.0024182451888918877, 0.03079092502593994, -0.04526401683688164, 0.005178977735340595, 0.02479330636560917, 0.054490599781274796, -0.01687728241086006, 0.023212669417262077, -0.06677499413490295, 0.01596604473888874, -0.04593443125486374, 0.01472198311239481, -0.02421734295785427, 0.03269487991929054, 0.06592827290296555, -0.047237932682037354, -0.035148266702890396, 0.031441427767276764, 0.01962210237979889, -0.046050600707530975, 0.05349751189351082, -0.03369893133640289, 0.00890310201793909, -0.1107412800192833, 0.0904645100235939, -0.013460283167660236, 0.0033729244023561478, -0.016660843044519424, 0.06584957987070084, -0.017571091651916504, -0.019895484670996666, -0.015375449322164059, -0.018662163987755775, 0.01193997822701931, -0.035332731902599335, -0.06699607521295547, -0.03258064389228821, 0.004219566937536001, 0.06496348977088928, -0.010863296687602997, 0.013105018064379692, 0.04877505078911781, 0.0113543551415205, -0.045112576335668564, -0.021894916892051697, 0.02995447628200054, 0.007244789972901344, -0.05059376358985901, 0.032156988978385925, 0.051853079348802567, 0.04055654630064964, 0.03610899671912193, 0.012494171969592571, -0.04447750374674797, 0.06478419154882431, 0.004209836479276419, 0.03692919388413429, 0.0662522092461586, -0.03307095915079117, 0.0010781873716041446, -0.01991865038871765, -0.0023064010310918093, -0.015418443828821182, 0.025853093713521957, 0.023428048938512802, 0.06802169978618622, -0.02435791678726673, 0.03428969904780388, -0.034133996814489365, -0.012735157273709774, 0.03115863911807537, 0.03341962397098541, 0.046889349818229675, 0.08509056270122528, -0.04245449975132942, 0.06020735204219818, -0.04064604267477989, -0.01317682582885027, -0.004456462804228067, -0.06890047341585159, -0.03248782828450203, 0.0043786619789898396, 0.020683206617832184, 0.02383553609251976, -0.10450075566768646, 0.08364074677228928, -0.023929137736558914, -0.022289156913757324, 0.027630364522337914, -0.012576413340866566, 0.06136355549097061, -0.023447740823030472, 0.012166016735136509, 0.18786674737930298, -0.057672567665576935, -0.02396613359451294, -0.011405210010707378, 0.017803292721509933, 0.039983734488487244, 0.06123899295926094, 0.0576636865735054, 0.038105208426713943, -0.06875184178352356, -0.04256097599864006, -0.021167201921343803, -0.07356124371290207, 0.00913072656840086, -0.025485023856163025, -0.05079971253871918, 0.0424688421189785, -0.0028275379445403814, 0.008278642781078815, 0.012312470935285091, 0.008859673514962196, -0.026998622342944145, -0.03886893391609192, 0.003362179733812809, 0.01480199582874775, -0.03685673698782921, 0.027016516774892807, 0.049660101532936096, -0.024617740884423256, -0.018057608976960182, -0.035165611654520035, 0.03244267776608467, -0.009976084344089031, 0.035762276500463486, 0.010322706773877144, 0.02433876320719719, 0.03362789750099182, -0.014095526188611984, -0.016614697873592377, 0.061979990452528, 0.019282527267932892, -0.014636588282883167, -0.036154989153146744, -0.06234721839427948, -0.0052764019928872585, -0.032738592475652695, -0.01988939754664898, 0.02664003148674965, 0.023575453087687492, -0.027190426364541054, 0.030376022681593895, -0.008269212208688259, 0.011590504087507725, -0.020519519224762917, 0.013553005643188953, 0.051970645785331726, -0.024196580052375793, 0.02409491315484047, -0.010729460045695305, -0.03650529310107231, -0.013695321045815945, -0.05134577676653862, 0.0035761650651693344, 0.05531136319041252, 0.0044938912615180016, -0.004533512517809868, -0.022465942427515984, -0.07259878516197205, -0.017704594880342484, 0.0280320942401886, 0.04404187574982643, 0.04953155666589737, 0.0034464721102267504, -0.05797811597585678, -0.030980871990323067, 0.0013432559790089726, 0.048948898911476135, -0.012191356159746647, -0.029661402106285095, 0.009855476208031178, 0.0018826588056981564, -0.002571837045252323, 0.0015030212234705687, -0.00183425925206393, -0.01377694122493267, 0.03622334077954292, 0.04171642288565636, -0.014275764115154743, -0.07737220078706741, -0.012600509449839592, -0.0245317704975605, 0.007818588055670261, -0.010798000730574131, 0.0032298159785568714, 0.038179896771907806, -0.002116840099915862, 0.011231000535190105, 0.05187787860631943, -0.023186499252915382, -0.01753019541501999, 0.01178375631570816, -0.014484316110610962, -0.026438171043992043, -0.017327647656202316, -0.020073194056749344, 0.012011135928332806, 0.07331312447786331, 0.02424219250679016, -0.024130167439579964, 0.004175298847258091, 0.0031507296953350306, -0.028356553986668587, -0.03017943538725376, -0.023508692160248756, 0.043022334575653076, -0.04185592755675316, 0.035521455109119415, -0.046126626431941986, -0.0054954662919044495, -0.028667237609624863, -0.038251932710409164, 0.02735697105526924, -0.022012127563357353, -0.015227138064801693, -0.010485700331628323, 0.023506321012973785, 0.04459778219461441, 0.005520196631550789, 0.028302757069468498, -0.0029707110952585936, 0.02214265801012516, -0.012784343212842941, 0.04792627692222595, -0.002543400740250945, -0.01916348934173584, 0.013893052004277706, 0.00421102624386549, -0.010272529907524586, -0.008459124714136124, 0.034524861723184586, 0.020801721140742302, 0.06505127996206284, 0.005612378939986229, 0.002155189635232091, 0.023237545043230057, 0.029630817472934723, -0.006191959138959646, 0.0008289898978546262, -0.034844305366277695, -0.002987801795825362, -0.030046330764889717, -0.015334546566009521, -0.029887158423662186, 0.011343329213559628, 0.026156596839427948, -0.022168075665831566, -0.00567662576213479, -0.005656252149492502, 0.0037724545691162348, 0.038838550448417664, 0.024112923070788383, 0.003568676533177495, -0.04479345679283142, -0.0025468484964221716, -0.012721599079668522, -0.04792143404483795, 0.06975764036178589, 0.024493182078003883, 0.0033833393827080727, -0.013998840004205704, -0.026349017396569252, -0.008189062587916851, 0.005130975041538477, -0.012760043144226074, 0.012455875054001808, -0.051776520907878876, 0.03744209185242653, 0.04325658082962036, -0.015508565120398998, -0.04496339336037636, 0.029722757637500763, -0.006224554963409901, 0.002715162467211485, -0.004711763001978397, 0.03334654122591019, 0.06562945991754532, 0.015829257667064667, -0.03644600510597229, -0.004611590877175331, -0.07141316682100296, 0.010166026651859283, -0.005606179125607014, -0.025814754888415337, 0.028433728963136673, -0.022908413782715797, -0.03919629752635956, 0.026909414678812027, -0.015442987903952599, -0.01086717564612627, 0.0057512857019901276, 0.0010517037007957697, 0.014977223239839077, 0.042319439351558685, 0.031330857425928116, -0.007668077480047941, 0.004351205192506313, -0.02079499140381813, -0.004944213200360537, -0.013970090076327324, -0.011651616543531418, 0.013997139409184456, -0.045145805925130844, 0.015343550592660904, 0.006923490669578314, -0.0001429999538231641, -0.019309744238853455, 0.01736432872712612, 0.009920336306095123, -0.010674268938601017, -0.03365859016776085, 0.005245426669716835, 0.014658878557384014, 0.0032052721362560987, 0.00007898481999291107, -0.010676777921617031, 0.0019234201172366738, -0.005843705963343382, 0.009031355381011963, -0.009958331473171711, -0.005728818476200104, 0.014992451295256615, -0.03567511960864067, 0.0332537516951561, -0.019835717976093292, -0.03341515362262726, -0.025568580254912376, -0.05476215109229088, -0.02916794829070568, 0.005794421304017305, -0.01254363264888525, 0.0028563407249748707, 0.04200073331594467, 0.03449990227818489, 0.012624678201973438, -0.009886950254440308, 0.05108735337853432, 0.008077532052993774, 0.02342062257230282, -0.0008178298594430089, -0.007637926377356052, -0.027064086869359016, 0.036056216806173325, 0.0005680500180460513, 0.037221331149339676, -0.03675367683172226, -0.023091647773981094, -0.01993071660399437, 0.020105117931962013, -0.021160686388611794, 0.028606407344341278, -0.005253173410892487, -0.02866428904235363, -0.03818310797214508, 0.06282347440719604, 0.025641202926635742, 0.01749713532626629, 0.014249596744775772, 0.038900427520275116, -0.020598024129867554, -0.030857589095830917, 0.030143575742840767, -0.024497102946043015, 0.01770346611738205, 0.0021698258351534605, 0.031188076362013817, 0.05518848076462746, 0.0284865852445364, -0.012154608964920044, -0.010343371890485287, -0.01460703369230032, 0.025294627994298935, -0.0065209874883294106, 0.020304277539253235, -0.07320983707904816, -0.01666237600147724, 0.014188927598297596, -0.02704051323235035, -0.019290229305624962, -0.02715378813445568, 0.0069448319263756275, -0.054739803075790405, -0.029477983713150024, 0.04147583991289139, 0.007277458906173706, -0.010583478026092052, -0.05336570739746094, 0.04692801460623741, -0.03054126910865307, -0.007081056013703346, -0.025726977735757828, -0.01646837592124939, 0.0011357549810782075, 0.0011637521674856544, 0.0006327608716674149, -0.024032078683376312, 0.00019835213606711477, 0.002349219052121043, 0.041366953402757645, -0.03938049450516701, -0.043852753937244415, -0.026433398947119713, -0.042514145374298096, 0.03807167708873749, -0.045487165451049805, 0.008193425834178925, 0.005558362230658531, -0.023812049999833107, 0.018771391361951828, 0.04957615211606026, 0.021502060815691948, 0.0319191999733448, 0.04475637152791023, 0.04566207528114319, 0.010224939323961735, -0.026171192526817322, 0.003422357840463519, 0.011224489659070969, 0.010514883324503899, 0.018781650811433792, 0.021446729078888893, -0.02625509351491928, 0.029016969725489616, -0.03615202009677887, 0.02986987493932247, 0.07155957072973251, 0.016980646178126335, -0.0065147727727890015, -0.001538516371510923, 0.04393288493156433, 0.0270084235817194, 0.018282676115632057, -0.028297357261180878, -0.010229850187897682, 0.01661704294383526, 0.02332918345928192, -0.008340051397681236, 0.023817943409085274, 0.03396318480372429, 0.03221185505390167, -0.046882156282663345, 0.0024286278057843447, 0.0450846366584301, 0.0007237402023747563, -0.0008917790255509317, -0.005700751673430204, -0.014441832900047302, -0.009390071965754032, 0.020701179280877113, 0.014440135098993778, 0.04076419770717621, 0.02168378420174122, 0.012853538617491722, -0.013014508411288261, -0.03375674784183502, 0.015010861679911613, 0.08683313429355621, 0.012632552534341812, -0.025291990488767624, 0.04607722535729408, 0.0347466915845871, 0.019448978826403618, 0.015601057559251785, 0.04518471658229828, 0.016635604202747345, 0.07123972475528717, 0.04053473845124245, 0.05068046227097511, 0.024378422647714615, -0.03939295560121536, -0.03321719169616699, -0.02654685638844967, 0.0021199090406298637, 0.0020967242307960987, 0.019184686243534088, 0.035941094160079956, 0.0164434053003788, -0.0031502183992415667, 0.004599149338901043, 0.07591582089662552, 0.05424324423074722, 0.026781469583511353, 0.02631426975131035, 0.031841911375522614, 0.0444190576672554, 0.012420709244906902, 0.024319937452673912, 0.011292664334177971, 0.01570669375360012, -0.012622753158211708, 0.03653912991285324, 0.034859735518693924, 0.03863774612545967, -0.0017664701445028186, -0.00720572005957365, 0.01513188611716032, -0.03449954465031624, -0.03999318182468414, 0.04657132923603058, -0.0027451636269688606, 0.004480583593249321, -0.025547409430146217, -0.03435538336634636, -0.025481080636382103, 0.01920747011899948, -0.0034079605247825384, 0.007828707806766033, -0.0034784257877618074, 0.003045126562938094, 0.012324411422014236, 0.018611520528793335, -0.0016040479531511664, -0.026486480608582497, -0.004353739321231842, -0.03106212243437767, 0.04946576803922653, -0.0031657700892537832, -0.009458650834858418, -0.0009395379456691444, -0.007765730377286673, -0.05581041797995567, 0.021654639393091202, 0.018883483484387398, -0.0024749068543314934, 0.0022674165666103363, -0.018213562667369843, 0.04624132812023163, 0.019904641434550285, 0.02825455740094185, -0.013697069138288498, -0.003238439792767167, -0.018882930278778076, 0.03902442753314972, -0.006341046188026667, -0.024515846744179726, 0.012881307862699032, -0.035347212105989456, -0.013835945166647434, -0.02136765792965889, 0.00896319281309843, 0.01784658059477806, 0.03712942823767662, -0.041610438376665115, -0.023764587938785553, 0.03228195384144783, 0.019802583381533623, -0.01538019347935915, 0.05472016707062721, 0.006155205424875021, -0.006835796404629946, -0.014201800338923931, 0.00464839581400156, -0.007875676266849041, 0.009570594877004623, -0.018825119361281395, 0.04955799877643585, -0.022076496854424477, -0.02972010150551796, 0.03224910795688629, 0.010599952191114426, 0.07542739063501358, 0.051055632531642914, 0.04110338166356087, 0.011584102176129818, 0.019653916358947754, 0.0069932336919009686, 0.03354869782924652, -0.03540407493710518, 0.0038083253894001245, -0.04578820988535881, -0.03187209740281105, -0.009829259477555752, 0.00913258921355009, 0.0006880834698677063, -0.01108746137470007, -0.03449169918894768, -0.03650440275669098, -0.048480790108442307, -0.009635953232645988, -0.02633228339254856, -0.02616949938237667, 0.023760726675391197, 0.06385395675897598, 0.021711979061365128, -0.00940578430891037, 0.0044830613769590855, -0.013144483789801598, -0.01265030913054943, 0.009077330119907856, 0.04888691008090973, -0.026390720158815384, -0.01108487881720066, -0.042754340916872025, -0.013383308425545692, 0.046338096261024475, -0.057237595319747925, 0.03423274680972099, 0.049972254782915115, 0.01834811083972454, -0.03975250944495201, 0.0026198402047157288, 0.018129393458366394, -0.021724585443735123, 0.029061490669846535, -0.018165983259677887, -0.0016744803870096803, -0.015208764001727104, 0.006952973548322916, -0.0509210005402565, 0.012153763324022293, -0.020757131278514862, 0.004628429654985666, 0.023469798266887665, -0.04137799143791199, 0.019228674471378326, -0.021418515592813492, -0.006423002574592829, 0.030303170904517174, -0.01153366919606924, -0.015412431210279465, -0.021029304713010788, -0.03909417614340782, 0.09932396560907364, -0.0183918084949255, -0.008620956912636757, 0.004637228325009346, 0.034671079367399216, -0.016785209998488426, 0.006269138306379318, 0.003994707018136978, 0.00802425853908062, -0.014785691164433956, 0.010956077836453915, 0.005299401469528675, 0.06518527120351791, 0.008975500240921974, -0.057178713381290436, -0.0587746761739254, 0.027190612629055977 ]
Few-shot learning in practice: GPT-NEO and the 🤗 Accelerated Inference API
philschmid
June 3, 2021
few-shot-learning-gpt-neo-and-inference-api
guide, nlp
https://huggingface.co/blog/few-shot-learning-gpt-neo-and-inference-api
# Few-shot learning in practice: GPT-Neo and the 🤗 Accelerated Inference API In many Machine Learning applications, the amount of available labeled data is a barrier to producing a high-performing model. The latest developments in NLP show that you can overcome this limitation by providing a few examples at inference time with a large language model - a technique known as Few-Shot Learning. In this blog post, we'll explain what Few-Shot Learning is, and explore how a large language model called GPT-Neo, and the 🤗 Accelerated Inference API, can be used to generate your own predictions.
[ 0.0630260780453682, -0.03432036563754082, 0.04196220636367798, -0.018087133765220642, 0.03409816324710846, 0.06490319222211838, -0.019611960276961327, 0.053727418184280396, 0.02119329944252968, 0.06019999459385872, -0.057935986667871475, -0.028117544949054718, -0.02498619072139263, 0.05030999705195427, 0.032946567982435226, -0.06207810714840889, 0.006152385380119085, -0.0700141191482544, -0.0021274967584758997, -0.009090598672628403, -0.029228292405605316, -0.07520419359207153, 0.02484459988772869, 0.006676232907921076, 0.013200966641306877, -0.015955621376633644, 0.011211872100830078, -0.022567352280020714, -0.07181218266487122, 0.05028892681002617, -0.09141892939805984, 0.005661291535943747, -0.018610239028930664, 0.06606094539165497, 0.022572841495275497, 0.022099290043115616, -0.07191773504018784, 0.05367390811443329, 0.0385257862508297, -0.02069815993309021, -0.029184071347117424, -0.023498469963669777, -0.0007640926050953567, 0.0384250171482563, 0.033297087997198105, -0.031255435198545456, -0.13961593806743622, 0.05472848564386368, -0.05245239660143852, -0.10355725884437561, -0.08170825988054276, 0.03914881497621536, -0.049079544842243195, -0.016599223017692566, 0.043040625751018524, 0.01765325851738453, 0.015292583033442497, -0.1584039330482483, 0.010255365632474422, 0.034594256430864334, 0.007191567216068506, -0.0157623291015625, 0.009969179518520832, -0.0010213355999439955, -0.023592492565512657, -0.06553265452384949, 0.003941386938095093, 0.052473947405815125, -0.028022058308124542, 0.007559231482446194, -0.0076902820728719234, -0.05996883660554886, -0.03632541373372078, 0.01869705133140087, -0.03644493967294693, -0.04870237782597542, 0.021565254777669907, 0.015448999591171741, 0.009859994985163212, -0.04309357702732086, -0.03218139708042145, -0.054664384573698044, 0.021060824394226074, 0.02643398754298687, 0.00007094028114806861, 0.04069393500685692, 0.03178133815526962, -0.02654138207435608, -0.03938351571559906, 0.004429173190146685, 0.018426422029733658, -0.15459956228733063, 0.007856322452425957, -0.009910089895129204, 0.03817027062177658, 0.021337497979402542, 0.060455311089754105, 0.07796796411275864, -0.016131648793816566, -0.04928671568632126, 0.012237008661031723, -0.08348949998617172, -0.017511704936623573, -0.02918531373143196, -0.06880582869052887, 0.040421951562166214, -0.020281068980693817, -0.01084944885224104, -0.04978153109550476, 0.05487189441919327, -0.005245131906121969, 0.02185090072453022, -0.05066373199224472, 0.018081706017255783, -0.1015072613954544, -0.008211872540414333, 0.00970455352216959, 0.06393372267484665, -0.022100722417235374, 0.010832594707608223, -0.05068716034293175, -0.016690632328391075, 0.09500560909509659, -0.002491990104317665, -0.04428679123520851, 0.03993678092956543, 0.042185451835393906, 0.0018492407398298383, 0.03497553616762161, -0.03736816719174385, 0.01618865318596363, -0.020244760438799858, -0.010055800899863243, 0.03565332666039467, 0.06705272197723389, 0.008736624382436275, 0.0053962296806275845, -0.06862390786409378, -0.0169247817248106, -0.008980938233435154, -0.033969081938266754, -0.020167876034975052, 0.023173177614808083, -0.03531060367822647, 0.04959007352590561, -0.0063618263229727745, -0.022772638127207756, -0.0946359783411026, 0.005132698453962803, 0.02547989971935749, -0.1552973985671997, 0.09471586346626282, 0.0031766854226589203, -0.014694695360958576, 0.070126473903656, 0.06927420943975449, -0.04804323986172676, 0.005415481049567461, -0.06174943968653679, -0.050574567168951035, -0.005020647309720516, -0.04077159985899925, 0.1004902720451355, -0.028601866215467453, 0.010222924873232841, -0.00834765937179327, -0.018200146034359932, 0.0608743280172348, 0.007216933183372021, 0.06543321162462234, -0.007767460308969021, -0.029827477410435677, 0.031549856066703796, -0.044301748275756836, 0.008369374088943005, -0.02167472615838051, 0.0050674425438046455, 0.03613082319498062, 0.03350626677274704, -0.0038914447650313377, -0.03666553273797035, 0.019917728379368782, 0.04411035776138306, 0.06662429869174957, 0.008540601469576359, -0.06742822378873825, 0.08167516440153122, -0.01796913705766201, 0.02429586462676525, -0.03685011342167854, -0.03247734531760216, 0.016456900164484978, 0.07831216603517532, 0.013890371657907963, 0.0487673357129097, -0.05796973779797554, -0.03164557367563248, 0.12947171926498413, 0.08170250803232193, 0.015177586115896702, 0.03456087410449982, -0.010061085224151611, 0.028236350044608116, -0.037360504269599915, -0.00041112894541583955, -0.002607654081657529, 0.007712092250585556, 0.025075560435652733, 0.0008985892636701465, 0.00494384253397584, -0.00003991022822447121, -0.05819931998848915, -0.010869927704334259, -0.078360415995121, 0.005770690739154816, 0.0019430301617830992, 0.0325128510594368, 0.04362265020608902, -0.02467404678463936, -0.020698295906186104, 0.16577859222888947, -0.037934619933366776, 0.00844652857631445, -0.028764531016349792, 0.030373217537999153, 0.04555690661072731, 0.056026801466941833, -0.0277414508163929, 0.03175056353211403, -0.029685843735933304, 0.02715773694217205, -0.09917593002319336, 0.018451059237122536, 0.029348822310566902, -0.006480415351688862, -0.0016528407577425241, 0.0020423345267772675, -0.013219350017607212, -0.018235841765999794, -0.10276760905981064, 0.010209249332547188, 0.07394996285438538, -0.06879616528749466, 0.08817604929208755, 0.057971879839897156, 0.013533046469092369, 0.11097798496484756, 0.007827721536159515, 0.05209844931960106, -0.012667542323470116, -0.05537569895386696, 0.07156708091497421, 0.0063273170962929726, -0.024349143728613853, 0.009275845251977444, 0.010829297825694084, 0.016443150117993355, -0.04322190210223198, 0.00924234464764595, 0.017488503828644753, 0.03824887052178383, 0.005302188917994499, -0.039500460028648376, 0.0003625523822847754, -0.01985911838710308, -0.03691592812538147, -0.009423420764505863, -0.005800689570605755, 0.041170764714479446, -0.03638288006186485, -0.028971819207072258, -0.04358748346567154, 0.009025857783854008, 0.013628865592181683, -0.004124972969293594, 0.014794791117310524, 0.028713390231132507, -0.00886902678757906, 0.008108912967145443, -0.001783345709554851, -0.012758318334817886, -0.027563968673348427, -0.012390716932713985, 0.04087359458208084, -0.01606656424701214, -0.009464777074754238, 0.003219746984541416, -0.013971684500575066, -0.010122890584170818, 0.029436444863677025, -0.009587379172444344, 0.016479846090078354, -0.017253201454877853, -0.039206746965646744, 0.018836718052625656, 0.014831049367785454, 0.012651837430894375, -0.03489531949162483, 0.004179519135504961, 0.0017456363420933485, -0.01588776335120201, 0.031227102503180504, 0.013377528637647629, -0.016018876805901527, 0.009314433671534061, 0.041551101952791214, 0.004342407453805208, 0.04540056362748146, -0.07579432427883148, -0.021462231874465942, 0.034064777195453644, -0.033330973237752914, -0.00588199170306325, -0.026315364986658096, 0.05927786976099014, 0.019014978781342506, 0.005356202833354473, -0.0054216147400438786, -0.00279760523699224, 0.039025794714689255, 0.04990454763174057, -0.022808680310845375, 0.03153212368488312, 0.01907878741621971, -0.042242638766765594, -0.01354309543967247, 0.030532900243997574, 0.03013123944401741, 0.0036579712759703398, 0.021911170333623886, 0.019729360938072205, 0.02880552038550377, -0.016502685844898224, 0.021551908925175667, 0.0024228431284427643, 0.027272269129753113, 0.05494173243641853, 0.012531938962638378, -0.020172446966171265, -0.037664152681827545, -0.016392067074775696, 0.06836330890655518, -0.03524963557720184, 0.02114081010222435, -0.0012044351315125823, 0.035185735672712326, 0.04825091361999512, 0.00022065508528612554, 0.00035662800655700266, -0.05602699890732765, -0.0120714595541358, -0.03647901862859726, 0.01437921542674303, 0.012754417955875397, 0.005471156910061836, 0.013591119088232517, 0.02399461902678013, -0.050884637981653214, -0.038138147443532944, 0.015035952441394329, -0.040859729051589966, 0.011299094185233116, 0.0418708473443985, -0.0310613252222538, 0.006779614835977554, -0.026538381353020668, 0.016048744320869446, -0.007760986220091581, -0.023901356384158134, 0.027324331924319267, 0.035504378378391266, -0.03810121864080429, -0.03360936418175697, 0.0036807823926210403, 0.011851849034428596, 0.006404896266758442, 0.021059172227978706, 0.030639830976724625, -0.015113985165953636, 0.028744736686348915, 0.009317160584032536, 0.0013301747385412455, -0.020496495068073273, 0.03290942311286926, -0.04185396432876587, -0.011684932745993137, 0.036153603345155716, 0.0437486432492733, 0.007321768440306187, -0.03141258656978607, -0.004199471790343523, -0.0009791571646928787, -0.001572181936353445, -0.04044818505644798, 0.00927237793803215, -0.05195174366235733, 0.007927598431706429, 0.039129436016082764, 0.03181416168808937, 0.0007341409800574183, 0.01735609397292137, 0.034997086971998215, 0.014121348038315773, 0.025334417819976807, 0.03361281007528305, 0.03601207211613655, 0.03400048613548279, -0.02317667193710804, 0.017529049888253212, -0.04074591025710106, -0.033254411071538925, -0.030547544360160828, -0.05237880349159241, 0.03627273067831993, 0.012812705710530281, 0.009386572986841202, 0.02988726831972599, 0.009997560642659664, -0.015295720659196377, 0.02947504259645939, -0.007912522181868553, -0.008592885918915272, 0.009829982183873653, 0.024457909166812897, 0.013859674334526062, 0.0269895289093256, -0.017078032717108727, 0.021157337352633476, -0.020562883466482162, 0.02010682225227356, -0.00893777422606945, 0.0017074684146791697, 0.019685756415128708, -0.007243049796670675, -0.027390582486987114, -0.01576235331594944, 0.00865946989506483, -0.027303380891680717, 0.022557467222213745, -0.0018119491869583726, 0.03529218211770058, -0.009716656059026718, -0.013811051845550537, -0.00335519528016448, -0.035323794931173325, -0.015620722435414791, -0.004723253659904003, -0.00023254968982655555, 0.012311195023357868, -0.003207411151379347, -0.00023241985763888806, -0.022625448182225227, 0.030301816761493683, -0.052274204790592194, -0.016418999060988426, -0.020676665008068085, -0.06418613344430923, 0.037703048437833786, 0.05578797310590744, 0.040342096239328384, -0.06345656514167786, -0.04823557287454605, 0.050544608384370804, 0.02186034806072712, -0.007406491786241531, 0.01945345290005207, -0.011137190274894238, 0.04602862149477005, 0.046973541378974915, -0.006843549199402332, -0.030721958726644516, -0.02227485179901123, -0.033763252198696136, -0.024229994043707848, 0.0000440289695688989, 0.017782971262931824, -0.009260966442525387, 0.011895926669239998, -0.012295106425881386, 0.015818456187844276, -0.013166787102818489, 0.011026930995285511, 0.0025578688364475965, 0.023744681850075722, 0.0577540285885334, 0.0016101801302284002, -0.01742243766784668, 0.027531078085303307, -0.014445088803768158, -0.07667580246925354, 0.013393659144639969, 0.014627264812588692, -0.009848902933299541, 0.011288975365459919, 0.025403758510947227, 0.043451081961393356, 0.003805915592238307, 0.03831179812550545, 0.014089633710682392, 0.020828528329730034, 0.0004188223974779248, -0.03566252067685127, 0.048617176711559296, -0.019413230940699577, -0.023440856486558914, 0.01985500194132328, -0.04363948479294777, -0.00007461343193426728, 0.026121700182557106, 0.02352106012403965, -0.013641459867358208, -0.006827396806329489, 0.028419924899935722, 0.007446318864822388, -0.04697271063923836, -0.0018784527201205492, 0.014313039369881153, -0.014672393910586834, -0.04586368426680565, -0.025791076943278313, -0.0037459733430296183, -0.020963599905371666, -0.0265228059142828, -0.01416526548564434, 0.00016475660959258676, 0.04966919124126434, 0.008163616061210632, 0.041312359273433685, -0.012173489667475224, -0.012220745906233788, -0.041642215102910995, -0.0320744663476944, 0.03767739236354828, 0.002400510711595416, -0.03286595270037651, -0.011584385298192501, -0.01035262644290924, 0.039730384945869446, 0.005713840946555138, -0.0049055153504014015, -0.018987270072102547, 0.029648054391145706, 0.00013026889064349234, -0.019137397408485413, -0.05107221379876137, 0.06420711427927017, 0.04298185184597969, -0.029756110161542892, -0.04116832837462425, -0.033333804458379745, -0.019417691975831985, -0.018018042668700218, -0.060720574110746384, -0.022697754204273224, 0.0036707574035972357, 0.00008266549411928281, -0.013169283047318459, 0.0018755305791273713, 0.004387850873172283, -0.009479918517172337, 0.00879993848502636, 0.029121454805135727, -0.004237003158777952, 0.038383062928915024, 0.08770786225795746, -0.04976043105125427, -0.004156543407589197, 0.025348486378788948, 0.05015857145190239, -0.01103148888796568, 0.017276156693696976, 0.04799561947584152, -0.012290195561945438, 0.006338262930512428, 0.018777675926685333, -0.0655127689242363, 0.034245554357767105, 0.03244040161371231, 0.04558157920837402, -0.0035897772759199142, -0.038172218948602676, 0.0374453105032444, 0.022321034222841263, 0.016909511759877205, -0.02848593331873417, 0.04598456248641014, 0.013917803764343262, -0.006393202114850283, -0.0007797192665748298, 0.013573681004345417, 0.05122314766049385, 0.015316391363739967, -0.01476255152374506, -0.006775436922907829, 0.035630762577056885, -0.004046560265123844, 0.03124306909739971, -0.004309707786887884, 0.009475011378526688, -0.008656433783471584, 0.004795357584953308, 0.015331237576901913, -0.014735679142177105, 0.03170851618051529, 0.0472712367773056, -0.02090868167579174, 0.017767101526260376, -0.010454264469444752, 0.04561059549450874, 0.025336656719446182, 0.005656341556459665, 0.006213358603417873, 0.03357147052884102, 0.017124786972999573, -0.005276791751384735, -0.01421845518052578, 0.044894203543663025, -0.015838485211133957, -0.02642706222832203, 0.032960500568151474, 0.023028142750263214, 0.018520643934607506, 0.018771158531308174, 0.05375529080629349, 0.03205757960677147, -0.04430289939045906, 0.010696050710976124, 0.008295226842164993, 0.007283714134246111, 0.013674600049853325, 0.015544470399618149, -0.03556249290704727, -0.05029528588056564, -0.014200509525835514, 0.01476594340056181, -0.015873096883296967, 0.008028578944504261, -0.01624724082648754, 0.006434016395360231, 0.005199809558689594, 0.04890085756778717, -0.045263439416885376, -0.03376580774784088, -0.004232015926390886, 0.01642671227455139, -0.0008665075292810798, -0.05183372646570206, -0.03785056993365288, -0.0034575634635984898, -0.0007232993957586586, -0.040335606783628464, 0.04119345173239708, -0.009848661720752716, -0.034013476222753525, 0.04544757679104805, 0.009093005210161209, -0.012668033130466938, 0.042897216975688934, 0.038903675973415375, 0.014635992236435413, -0.06910715997219086, -0.00039870041655376554, -0.03665380924940109, -0.051502667367458344, -0.005171974189579487, -0.038962963968515396, -0.04472220689058304, 0.0005613393732346594, -0.00924624688923359, 0.016194654628634453, 0.07343755662441254, -0.04231048375368118, 0.004425599239766598, 0.03700466826558113, 0.01405343133956194, -0.03306866064667702, 0.015341280959546566, 0.00634735869243741, -0.042738523334264755, 0.01432875543832779, -0.018801763653755188, -0.03256265074014664, -0.016770971938967705, -0.009835696779191494, 0.025404583662748337, 0.0031207187566906214, -0.02102857083082199, -0.04427211359143257, -0.028764015063643456, -0.0017029063310474157, 0.03655741736292839, 0.020212387666106224, -0.012004438787698746, 0.015828045085072517, -0.030228272080421448, -0.008007197640836239, -0.029284218326210976, 0.05862029641866684, -0.01970166340470314, -0.0367012619972229, -0.04658912122249603, 0.07496144622564316, -0.02764054387807846, 0.05140595883131027, -0.027302321046590805, -0.015601931139826775, -0.03370349481701851, 0.03925854712724686, -0.01221432350575924, -0.010016833432018757, 0.03529924899339676, -0.018027834594249725, 0.018082497641444206, -0.02726702205836773, 0.013426091521978378, -0.013298850506544113, -0.014991618692874908, 0.02011026442050934, 0.03670656308531761, -0.028018470853567123, -0.023563535884022713, -0.02561817318201065, 0.04311143234372139, -0.02355959080159664, -0.0160741675645113, 0.02873833291232586, -0.012130601331591606, -0.010060586966574192, -0.03862980753183365, 0.04300682246685028, 0.022096170112490654, -0.03654293343424797, -0.016209034249186516, 0.027759892866015434, 0.003376332577317953, -0.0029251950327306986, -0.0037910137325525284, -0.04029129445552826, -0.020512713119387627, 0.012561756186187267, -0.04154999181628227, -0.009305698797106743, -0.0006403453298844397, 0.037880998104810715, -0.00916591752320528, 0.005873482674360275, 0.013444697484374046, 0.035510990768671036, -0.035733506083488464, -0.030523698776960373, 0.03649213910102844, 0.041642773896455765, 0.014208500273525715, 0.013133269734680653, 0.0447918064892292, 0.030719900503754616, -0.009595031850039959, -0.006959599908441305, 0.019854430109262466, 0.00877418927848339, 0.006583716720342636, 0.051557064056396484, -0.039320312440395355, 0.053734976798295975, 0.06692454218864441, 0.0051666926592588425, -0.0616956502199173, -0.008693080395460129 ]
Few-shot learning in practice: GPT-NEO and the 🤗 Accelerated Inference API
philschmid
June 3, 2021
few-shot-learning-gpt-neo-and-inference-api
guide, nlp
https://huggingface.co/blog/few-shot-learning-gpt-neo-and-inference-api
Responsible Use Few-Shot Learning is a powerful technique but also presents unique pitfalls that need to be taken into account when designing uses cases. To illustrate this, let's consider the default Sentiment Analysis setting provided in the widget. After seeing three examples of sentiment classification, the model makes the following predictions 4 times out of 5, with temperature set to 0.1: >
[ 0.07879839092493057, -0.054677996784448624, -0.016100438311696053, 0.005047306884080172, 0.08991172909736633, 0.056788574904203415, -0.03438837453722954, 0.005407215096056461, 0.022531025111675262, -0.0028393000829964876, -0.10616067051887512, -0.003260808065533638, -0.060040246695280075, 0.04980837553739548, -0.004563224967569113, -0.03340386599302292, 0.07286267727613449, 0.023741796612739563, -0.024385854601860046, -0.02538720890879631, -0.031080491840839386, -0.09733934700489044, 0.022118939086794853, -0.014983012340962887, 0.02973100356757641, -0.0495578832924366, 0.09351956844329834, -0.008188844658434391, -0.08751827478408813, 0.05063275992870331, -0.0490633100271225, 0.031478431075811386, -0.061816491186618805, -0.022944841533899307, -0.011589113622903824, -0.0029082871042191982, -0.10561827570199966, 0.11097028106451035, 0.02664238214492798, -0.018833879381418228, -0.008338673040270805, -0.06604431569576263, -0.007446654606610537, -0.03273583948612213, 0.02281632274389267, -0.08086290210485458, -0.18828026950359344, 0.03325590118765831, -0.07757869362831116, -0.019607773050665855, -0.094935841858387, 0.040114086121320724, -0.008788255043327808, 0.020657436922192574, 0.010056895203888416, -0.031213263049721718, 0.0439172238111496, -0.08280208706855774, 0.036067694425582886, -0.009670590981841087, -0.04673411697149277, -0.020983366295695305, 0.022352434694767, 0.02836538851261139, -0.02190697193145752, -0.019541872665286064, 0.03596040606498718, 0.041956666857004166, -0.06008995696902275, -0.013124260120093822, -0.020577939227223396, -0.03247758373618126, -0.04692348837852478, -0.0001934473984874785, -0.04140612483024597, -0.04208555445075035, -0.002077070763334632, -0.0005273910937830806, -0.0287985410541296, 0.025900520384311676, 0.04511689767241478, -0.031932514160871506, 0.06248357892036438, 0.051612552255392075, 0.011676792986690998, -0.010126510635018349, 0.05686987563967705, 0.046798061579465866, -0.024496495723724365, 0.03923119232058525, -0.032459184527397156, -0.09140931814908981, 0.09215731918811798, -0.01740564964711666, 0.05355145409703255, -0.02508533000946045, 0.026865154504776, 0.004964151885360479, 0.07949534058570862, -0.0007349032093770802, 0.010494563728570938, -0.04440635070204735, 0.00704545620828867, -0.025998862460255623, -0.009597261436283588, 0.03032115288078785, -0.03516986221075058, -0.03452024236321449, -0.04059354588389397, 0.0632343590259552, 0.005979600828140974, -0.015742197632789612, -0.034342437982559204, 0.061826419085264206, -0.0910046324133873, 0.05029825493693352, 0.037358276546001434, 0.05022025853395462, 0.03539500758051872, -0.010586676187813282, -0.03771022707223892, 0.07060635089874268, 0.023111142218112946, -0.025649823248386383, -0.03168357536196709, 0.008961991406977177, 0.0416828878223896, -0.006219314876943827, 0.022329678758978844, -0.06671345233917236, 0.018347391858696938, 0.08489558100700378, -0.024547046050429344, -0.010889886878430843, -0.003580705961212516, -0.03228192403912544, 0.020983412861824036, -0.018819095566868782, 0.004297726321965456, 0.024020373821258545, -0.03771856054663658, 0.03397491201758385, -0.013568511232733727, 0.011350315995514393, 0.08232579380273819, -0.01730327121913433, -0.015437904745340347, -0.025915564969182014, 0.08758560568094254, 0.033274441957473755, -0.054768193513154984, 0.0546988807618618, -0.021640323102474213, -0.03217759355902672, -0.0195139292627573, 0.06806335598230362, -0.07980675250291824, -0.029595158994197845, -0.0314156748354435, 0.02365213632583618, 0.012580277398228645, 0.011479977518320084, 0.010431732051074505, -0.00453588180243969, 0.08895465731620789, -0.028893638402223587, -0.04546758532524109, -0.017640184611082077, 0.051820989698171616, 0.0026129151228815317, 0.018987391144037247, -0.03633179888129234, 0.07617059350013733, -0.10304765403270721, 0.0047607035376131535, 0.061477188020944595, -0.0376676507294178, 0.04254629835486412, -0.03460577130317688, 0.03211062401533127, -0.03688650578260422, 0.018471475690603256, 0.02569141425192356, 0.015451580286026001, -0.004988148808479309, -0.10763543099164963, 0.050250157713890076, -0.03170199319720268, -0.00864739902317524, 0.012343994341790676, -0.05244002118706703, 0.04499317705631256, 0.06641613692045212, 0.0337211899459362, 0.025233877822756767, -0.04172077029943466, -0.04434473067522049, 0.11172054708003998, 0.04758400842547417, -0.043572500348091125, 0.017892420291900635, 0.019405193626880646, -0.011319021694362164, 0.016539622098207474, -0.02410205826163292, 0.04544663056731224, 0.0382293239235878, 0.0357973538339138, 0.01600821316242218, 0.03916774317622185, -0.005686331074684858, -0.059236250817775726, -0.05705175921320915, -0.0481770858168602, 0.049612805247306824, -0.03159599378705025, 0.07170435786247253, 0.07191208004951477, 0.01454326044768095, -0.01700238510966301, 0.1074407547712326, 0.010007335804402828, 0.03986569121479988, 0.052964501082897186, -0.032798413187265396, 0.0007015053415670991, 0.08676475286483765, 0.04505421221256256, 0.09518487006425858, -0.10390670597553253, -0.006406333297491074, -0.06584963202476501, 0.0027593804989010096, 0.021366044878959656, -0.03701315447688103, 0.04286042973399162, 0.046372972428798676, 0.05785733461380005, 0.029531799256801605, -0.0661582425236702, -0.04931836202740669, 0.06351888179779053, -0.06286469101905823, 0.07206395268440247, -0.03920159116387367, -0.08052501082420349, 0.026184948161244392, 0.007840690203011036, -0.027573181316256523, -0.05508562922477722, -0.028583958745002747, 0.03434634953737259, -0.0058797914534807205, -0.025580570101737976, 0.02621232345700264, 0.020285790786147118, 0.026359427720308304, -0.012320335954427719, -0.03712495043873787, 0.010320790112018585, 0.019405411556363106, 0.0016141029773280025, -0.014836913906037807, -0.03341139107942581, 0.008219785988330841, -0.03368765115737915, 0.020708655938506126, -0.002221910748630762, 0.06447534263134003, -0.011109137907624245, 0.0024947153870016336, -0.011079863645136356, 0.023852599784731865, 0.009996726177632809, -0.03903696686029434, 0.023021819069981575, 0.03446199372410774, 0.013619893230497837, -0.009845823980867863, -0.010647778399288654, -0.011704044416546822, -0.02009286917746067, 0.010433061979711056, -0.02740025892853737, 0.026670638471841812, 0.03005021996796131, 0.017010698094964027, -0.016803225502371788, -0.009388584643602371, 0.015767497941851616, 0.010779807344079018, -0.015620422549545765, 0.038551829755306244, -0.003787474473938346, 0.007022805977612734, 0.023702846840023994, -0.02513778768479824, -0.00883294828236103, 0.00259809079580009, -0.032311975955963135, -0.03051851876080036, 0.013320312835276127, -0.004875213373452425, -0.012501377612352371, -0.015663109719753265, 0.008801539428532124, 0.04103299602866173, -0.025261063128709793, -0.10070228576660156, -0.04435903578996658, 0.056747984141111374, 0.01862998679280281, -0.032650306820869446, -0.029379043728113174, 0.0697038546204567, -0.015594488941133022, 0.012081650085747242, -0.004358198493719101, 0.00844529364258051, 0.026531681418418884, 0.04432550072669983, -0.01718052104115486, 0.0036798235960304737, -0.03013557754456997, -0.012788754887878895, 0.0010000498732551932, -0.006070766597986221, -0.006436522118747234, 0.02491018921136856, 0.057212263345718384, -0.03905490040779114, 0.023749686777591705, -0.021128859370946884, 0.02450304850935936, 0.008962740190327168, 0.02123592421412468, 0.034563422203063965, -0.045790497213602066, 0.025697801262140274, -0.027041619643568993, -0.059851597994565964, 0.020333146676421165, -0.0296782273799181, -0.036871377378702164, 0.016764020547270775, 0.011074029840528965, 0.002777486341074109, 0.007360244169831276, -0.02116050012409687, 0.007936588488519192, 0.010451409965753555, 0.025322342291474342, 0.0059496378526091576, 0.02175440452992916, 0.010533980093896389, -0.0231510940939188, 0.008213895373046398, -0.0418185256421566, -0.024902429431676865, -0.03617110103368759, -0.03501059114933014, 0.07961591333150864, -0.01377199962735176, 0.008740668185055256, -0.0040235635824501514, 0.017731867730617523, 0.007833347655832767, -0.020456574857234955, -0.04382718726992607, 0.040299445390701294, 0.021516449749469757, -0.01869148388504982, -0.03380688652396202, -0.028397219255566597, -0.003181885229423642, 0.05275040119886398, -0.01637670025229454, 0.02164287306368351, -0.000058877394621958956, 0.030160414054989815, 0.01929517276585102, 0.0017436194466426969, 0.012500212527811527, 0.040967684239149094, -0.00728409131988883, -0.005418692249804735, 0.07611202448606491, 0.022861411795020103, 0.018915848806500435, -0.045810516923666, -0.013612454757094383, -0.01313741970807314, 0.007735700812190771, -0.028149891644716263, 0.035039253532886505, 0.0014616732951253653, 0.03242466226220131, 0.06546681374311447, 0.016727682203054428, -0.024009987711906433, 0.0025872893165796995, -0.003992342855781317, -0.019824057817459106, 0.02948649413883686, 0.022677645087242126, 0.016708139330148697, 0.023684518411755562, -0.01978658325970173, 0.03332711383700371, -0.010872593149542809, -0.043022215366363525, -0.016351357102394104, 0.01936427317559719, 0.004038738552480936, -0.028796439990401268, 0.013204658403992653, 0.00647586677223444, -0.020553946495056152, -0.0088610565289855, 0.04782688990235329, 0.02114546112716198, -0.034835346043109894, 0.03997056931257248, 0.007854701951146126, -0.004147011321038008, 0.019794799387454987, -0.038128167390823364, 0.0060514844954013824, -0.009842000901699066, -0.015586082823574543, -0.0198933407664299, -0.03402411937713623, 0.01621091365814209, -0.014870473183691502, 0.007281092926859856, -0.013363768346607685, 0.002960519166663289, -0.02040819637477398, 0.004190359730273485, -0.0039954460225999355, 0.03484899550676346, -0.013079578056931496, 0.023416901007294655, -0.00012294879707042128, -0.008638321422040462, 0.018973687663674355, 0.01078476756811142, -0.054390206933021545, -0.0018527074716985226, -0.012001888826489449, 0.007101225666701794, -0.033044446259737015, 0.07881735265254974, -0.040053825825452805, -0.035324107855558395, 0.020591918379068375, -0.015107895247638226, 0.008260536007583141, 0.03242724761366844, 0.068292535841465, -0.05931372195482254, 0.011295977048575878, 0.03367885947227478, -0.040137019008398056, -0.005264563951641321, 0.00027513992972671986, -0.0022139272186905146, 0.05751601979136467, 0.04340064898133278, 0.00978461466729641, -0.023960739374160767, -0.009824875742197037, 0.007323169615119696, 0.006104885134845972, 0.016303522512316704, -0.0076265293173491955, -0.0391714908182621, 0.016692575067281723, -0.004655133467167616, -0.018448954448103905, 0.02278556115925312, -0.01883774995803833, -0.011199665255844593, -0.0023683521430939436, -0.0028941016644239426, -0.020013296976685524, -0.018732666969299316, 0.06195540353655815, -0.029658500105142593, 0.0026890505105257034, 0.01063997857272625, 0.02649189904332161, 0.025387348607182503, -0.010477698408067226, 0.014314713887870312, 0.038806334137916565, 0.02485787495970726, 0.031186135485768318, -0.0003903369652107358, -0.00568272452801466, 0.07069449871778488, -0.019802875816822052, -0.015886133536696434, 0.010845514945685863, 0.015509277582168579, 0.04797304421663284, -0.03841907158493996, 0.008057480677962303, 0.012299313209950924, 0.015578974969685078, -0.041217461228370667, 0.01924966461956501, -0.024544939398765564, -0.021175993606448174, -0.019721342250704765, -0.03455047681927681, 0.029534507542848587, -0.05165340006351471, -0.04136538878083229, -0.05102472007274628, 0.022921832278370857, -0.03228459507226944, -0.014465326443314552, -0.03397452086210251, -0.06404933333396912, 0.04136686027050018, 0.003936870954930782, 0.02222749963402748, -0.00047393221757374704, -0.0070716808550059795, -0.06121141463518143, -0.045365702360868454, 0.003478235797956586, 0.02407541498541832, -0.00014189930516295135, 0.0027771613094955683, -0.00910858903080225, 0.009546421468257904, 0.02556983008980751, 0.02127460204064846, 0.0369097925722599, 0.028347749263048172, 0.017543036490678787, -0.003129339311271906, -0.08119140565395355, 0.04682062566280365, 0.02744544856250286, -0.03167148306965828, -0.03254670649766922, -0.011235109530389309, -0.026682084426283836, -0.03158169984817505, -0.05607963725924492, -0.0005872007459402084, 0.001139856525696814, -0.028254352509975433, -0.008165034465491772, 0.02658890187740326, 0.010652166791260242, 0.022960973903536797, -0.0052119106985628605, -0.0032511530444025993, 0.021094439551234245, 0.03872724249958992, 0.07854996621608734, -0.002146541140973568, 0.017674976959824562, -0.014438997954130173, 0.0029683131724596024, -0.04889354854822159, 0.004311291966587305, 0.031981032341718674, -0.04821953922510147, 0.03264998644590378, 0.009813299402594566, -0.040701430290937424, 0.011748245917260647, 0.04421675577759743, 0.10052017122507095, 0.023946885019540787, -0.0020307430531829596, 0.031859077513217926, -0.004946565721184015, 0.028636189177632332, -0.01435992680490017, 0.052089791744947433, -0.019261211156845093, -0.01053862739354372, -0.02358083426952362, 0.011836586520075798, 0.05312277004122734, 0.010202072560787201, 0.004247436765581369, 0.004407057538628578, 0.08796766400337219, 0.017382368445396423, -0.007234728895127773, -0.026838893070816994, -0.012746964581310749, 0.013238686136901379, -0.041493888944387436, -0.02278287522494793, -0.010065155103802681, -0.011990477330982685, 0.03804400563240051, -0.0424075722694397, 0.0029577261302620173, -0.013799729757010937, 0.02169329673051834, 0.016954559832811356, 0.0211628507822752, 0.02859417535364628, 0.04059828072786331, 0.03609663248062134, 0.006944769527763128, 0.000522187037859112, 0.02684057503938675, -0.04443985968828201, -0.02529432252049446, 0.03441872075200081, 0.023342525586485863, 0.005379420705139637, -0.016208821907639503, 0.020425213500857353, -0.0016389786032959819, -0.007918797433376312, 0.0295780710875988, 0.020754382014274597, -0.0032942353282123804, -0.02019536681473255, 0.007314217276871204, -0.02823573164641857, -0.015380497090518475, -0.014829528518021107, 0.04070195183157921, -0.0004595192731358111, 0.01933182030916214, 0.013899744488298893, -0.031859688460826874, 0.02813064306974411, 0.03988615423440933, -0.010668874718248844, -0.027608588337898254, 0.016907379031181335, 0.000683322548866272, 0.0031886829528957605, -0.020866289734840393, -0.06425786763429642, 0.0035419445484876633, 0.0015848011244088411, 0.0013180116657167673, 0.018531112000346184, -0.0035030136350542307, -0.0351828932762146, 0.039964135736227036, -0.032192837446928024, -0.028076494112610817, 0.04812498390674591, -0.013645540922880173, 0.0057056802324950695, -0.02593245916068554, -0.00005022837649448775, -0.046297427266836166, -0.012659423984587193, -0.017514662817120552, -0.02261793613433838, -0.058552294969558716, 0.025361008942127228, 0.011054945178329945, -0.02089896984398365, 0.044812604784965515, -0.01711910031735897, 0.0409526489675045, -0.005654922220855951, 0.00353375100530684, -0.018900087103247643, 0.0005411856109276414, 0.027719631791114807, -0.02345600724220276, 0.036236125975847244, -0.04707092419266701, -0.06861548870801926, -0.030918659642338753, 0.015424422919750214, 0.04944109916687012, 0.002410569228231907, -0.021963762119412422, 0.001315532368607819, 0.01059744879603386, 0.0026863100938498974, 0.035282161086797714, 0.020222170278429985, 0.04136097803711891, -0.0004820477042812854, -0.015445074997842312, 0.027518030256032944, -0.02964487113058567, 0.0295033510774374, -0.025242779403924942, -0.05521078407764435, -0.022225074470043182, 0.021388333290815353, -0.017259424552321434, 0.03327448293566704, -0.03214648365974426, 0.014606986194849014, -0.0062874602153897285, -0.0067681316286325455, -0.02561434544622898, 0.005801346153020859, 0.03232291713356972, -0.0056633614003658295, 0.026260854676365852, -0.021084964275360107, -0.02868914045393467, 0.028540365397930145, 0.009722739458084106, 0.005575417075306177, 0.02605004608631134, -0.00039560176082886755, 0.0040345690213143826, 0.0032235290855169296, 0.030726321041584015, -0.04937657713890076, -0.030901815742254257, -0.01637437380850315, 0.053296852856874466, -0.05450217053294182, 0.007396253291517496, -0.014849175699055195, 0.04307634383440018, -0.03917163237929344, 0.0015675376635044813, 0.007376287132501602, -0.048815254122018814, 0.034538909792900085, 0.029550064355134964, -0.016339875757694244, 0.008863507770001888, 0.004184569697827101, -0.0040888432413339615, -0.0002039202954620123, 0.025495735928416252, 0.011076489463448524, -0.020571734756231308, -0.027846824377775192, 0.010608614422380924, 0.006476423237472773, -0.03228672221302986, -0.02148362621665001, 0.014593277126550674, 0.017417628318071365, 0.02808958850800991, -0.024675317108631134, -0.008810545317828655, 0.020725436508655548, 0.01396139245480299, -0.0022078193724155426, -0.0037412841338664293, 0.00842149369418621, 0.011151724494993687, 0.008433820679783821, -0.036367204040288925, 0.09028571844100952, 0.0325547456741333, 0.01841958798468113, -0.056462861597537994, 0.0556940883398056 ]
Few-shot learning in practice: GPT-NEO and the 🤗 Accelerated Inference API
philschmid
June 3, 2021
few-shot-learning-gpt-neo-and-inference-api
guide, nlp
https://huggingface.co/blog/few-shot-learning-gpt-neo-and-inference-api
🤗 Accelerated Inference API The Accelerated Inference API is our hosted service to run inference on any of the 10,000+ models publicly available on the 🤗 Model Hub, or your own private models, via simple API calls. The API includes acceleration on CPU and GPU with up to 100x speedup compared to out of the box deployment of Transformers. To integrate Few-Shot Learning predictions with GPT-Neo in your own apps, you can use the 🤗 Accelerated Inference API with the code snippet below. You can find your API Token here, if you don't have an account you can get started here. python import json import requests API_TOKEN = "" def query(payload='',parameters=None,options={'use_cache': False}): API_URL = "https://api-inference.huggingface.co/models/EleutherAI/gpt-neo-2.7B" headers = {"Authorization": f"Bearer {API_TOKEN}"} body = {"inputs":payload,'parameters':parameters,'options':options} response = requests.request("POST", API_URL, headers=headers, data= json.dumps(body)) try: response.raise_for_status() except requests.exceptions.HTTPError: return "Error:"+" ".join(response.json()['error']) else: return response.json()[0]['generated_text'] parameters = { 'max_new_tokens':25, # number of generated tokens 'temperature': 0.5, # controlling the randomness of generations 'end_sequence': "###" # stopping sequence for generation } prompt="...." # few-shot prompt data = query(prompt,parameters,options) ---
[ 0.04616614431142807, 0.006405423395335674, 0.09269928187131882, -0.019979262724518776, -0.007068323902785778, 0.009529296308755875, 0.03127318248152733, 0.07424847036600113, 0.018617963418364525, 0.001837130868807435, -0.08781284838914871, -0.0002663593622855842, 0.006158103700727224, 0.0811476856470108, 0.027054859325289726, -0.0786832720041275, 0.02809181995689869, -0.039236560463905334, -0.020627683028578758, -0.005035157315433025, -0.003236054442822933, -0.049418576061725616, 0.013893211260437965, 0.010564387775957584, -0.02809715084731579, -0.0854092463850975, -0.02499883994460106, -0.008250881917774677, -0.06215490400791168, 0.028533123433589935, -0.07099054753780365, 0.010178540833294392, -0.004605066031217575, -0.01776665635406971, 0.03589395061135292, 0.022394655272364616, -0.14250898361206055, 0.04037006199359894, 0.0629732757806778, 0.032367996871471405, -0.0008856579661369324, -0.027382496744394302, -0.045997150242328644, 0.029091544449329376, 0.038195472210645676, -0.026369279250502586, -0.13454261422157288, 0.08333411812782288, -0.027823999524116516, -0.09906838089227676, -0.057055771350860596, 0.045128561556339264, -0.006882558576762676, -0.020067444071173668, 0.0629037395119667, 0.025866098701953888, -0.010782930999994278, -0.10857796669006348, 0.03616586700081825, 0.0029382745269685984, 0.03602660819888115, 0.009959958493709564, 0.022838303819298744, 0.05688900500535965, 0.027249930426478386, -0.017508279532194138, -0.026712574064731598, 0.026701614260673523, -0.020019665360450745, -0.017109693959355354, 0.028701014816761017, -0.03470337390899658, -0.02445553056895733, -0.006901080254465342, -0.007490488700568676, -0.05802236869931221, 0.015373475849628448, 0.01587245613336563, 0.10195978730916977, 0.007611567620187998, -0.02985125035047531, -0.08105756342411041, 0.02337586134672165, 0.022066013887524605, 0.013271675445139408, 0.07548972219228745, 0.025360550731420517, -0.012490824796259403, -0.012291807681322098, -0.030989184975624084, 0.001415287726558745, -0.1236557886004448, 0.0262014027684927, 0.0029817649628967047, -0.0064107091166079044, 0.06099528446793556, 0.025065438821911812, 0.04069427400827408, -0.021163858473300934, -0.04372226819396019, 0.009534602984786034, -0.09285983443260193, -0.07160264998674393, -0.02134031616151333, -0.03230254724621773, 0.038718923926353455, -0.010600455105304718, -0.08631404489278793, -0.05003948509693146, 0.014603025279939175, 0.01922128163278103, -0.009345121681690216, -0.033808156847953796, 0.03560127690434456, -0.0666157528758049, -0.002028153045102954, -0.007766021881252527, 0.01727942004799843, -0.012063172645866871, 0.019557874649763107, 0.007398658897727728, 0.03373290225863457, 0.06184684485197067, 0.00956321507692337, 0.002790703671053052, 0.10219985991716385, 0.08879166841506958, -0.014116687700152397, 0.011915139853954315, 0.005613531451672316, 0.029579686000943184, -0.026728782802820206, 0.011037257499992847, -0.011310993693768978, 0.03839338570833206, -0.005648779682815075, -0.03342210501432419, -0.07270537316799164, 0.010860891081392765, -0.009408993646502495, -0.03460483253002167, -0.03421724587678909, 0.0009871157817542553, -0.02905210293829441, 0.02035771869122982, 0.027916966006159782, -0.039735011756420135, -0.02778741903603077, 0.005280537996441126, 0.038598593324422836, -0.13227872550487518, 0.11498630046844482, -0.028870485723018646, 0.020300524309277534, 0.02776242606341839, 0.04322513937950134, -0.01662752591073513, -0.029822640120983124, -0.08869586884975433, -0.06737887859344482, -0.02666020207107067, -0.05887935310602188, 0.008455784060060978, 0.0024509599898010492, 0.004894580692052841, 0.013081549666821957, 0.0023649162612855434, -0.01833011768758297, 0.037212859839200974, 0.01658756285905838, -0.012060129083693027, -0.05651918798685074, 0.024572279304265976, -0.011820759624242783, 0.027929188683629036, 0.02482577972114086, 0.026435570791363716, 0.010087009519338608, 0.02048642933368683, -0.0021460370626300573, -0.08377105742692947, 0.08268207311630249, 0.009340020827949047, 0.08379506319761276, 0.03953828290104866, -0.06630659103393555, 0.04374004527926445, 0.01782790757715702, 0.023414133116602898, 0.005910095293074846, 0.004571398254483938, -0.022583767771720886, 0.08890736848115921, -0.004747411701828241, 0.009185124188661575, -0.09250875562429428, -0.005765391048043966, 0.09857302904129028, 0.040481362491846085, 0.032224349677562714, -0.016048161312937737, 0.0020793844014406204, 0.08949146419763565, -0.05981217324733734, -0.045410748571157455, -0.022060174494981766, -0.0022262991406023502, -0.08177971094846725, 0.010406074114143848, 0.03505772724747658, -0.03193395957350731, -0.08977888524532318, 0.0061529288068413734, -0.073042131960392, 0.018234122544527054, -0.0175938718020916, -0.010353083722293377, 0.008687703870236874, -0.003797033801674843, -0.02646964229643345, 0.16870993375778198, -0.046350594609975815, 0.01920202188193798, -0.057494960725307465, -0.02757341042160988, 0.03622021526098251, 0.04019952937960625, -0.004934371914714575, 0.0217294804751873, -0.03910944238305092, -0.018353218212723732, -0.1005057841539383, -0.06959407776594162, 0.04115937277674675, -0.013088446110486984, -0.03185919299721718, 0.006296505220234394, -0.02688886970281601, 0.0018719659419730306, -0.052938416600227356, 0.030002053827047348, 0.04824383556842804, -0.00985162053257227, -0.00918497983366251, 0.060434550046920776, 0.012462320737540722, 0.08713657408952713, 0.030700070783495903, -0.0064091868698596954, -0.04594344645738602, -0.06902393698692322, 0.07544249296188354, 0.03818212449550629, 0.0031553939916193485, 0.0224258191883564, 0.046075765043497086, -0.008256472647190094, -0.0034283893182873726, 0.000989525462500751, 0.038050636649131775, 0.018574759364128113, 0.00333438185043633, -0.01290692575275898, -0.01534694992005825, -0.009383105672895908, -0.028040215373039246, -0.012375910766422749, 0.006750311236828566, 0.01060089748352766, -0.020001143217086792, 0.01618102192878723, -0.040801338851451874, 0.0274568609893322, 0.03878038004040718, 0.00229190313257277, 0.04034948721528053, 0.07011803239583969, 0.0023970589973032475, 0.017118167132139206, -0.009862042963504791, 0.0013691938947886229, -0.0480969063937664, 0.0007138897781260312, 0.07369768619537354, -0.016258973628282547, 0.0034666636493057013, 0.03534143045544624, -0.05254668369889259, -0.016594255343079567, 0.02085096389055252, -0.00709858862683177, 0.01826784573495388, 0.032132428139448166, -0.04557096213102341, -0.03360631316900253, -0.0025444538332521915, 0.017244676128029823, -0.014837521128356457, -0.003229162422940135, 0.0295919980853796, -0.0019106499385088682, -0.022018183022737503, 0.005068663042038679, -0.01278629805892706, -0.0061135380528867245, 0.041751787066459656, -0.004925576504319906, 0.03306407481431961, -0.09380560368299484, -0.019184866920113564, -0.010991615243256092, 0.0030141188763082027, -0.007785100024193525, -0.015060841105878353, 0.03347838297486305, 0.027216758579015732, 0.030981071293354034, 0.010041317902505398, 0.0026084757409989834, 0.010325880721211433, 0.04030207172036171, -0.03820546716451645, 0.0029179872944951057, 0.004527789540588856, -0.007223783526569605, -0.015139044262468815, 0.04341016337275505, 0.028287623077630997, -0.012741979211568832, 0.009999324567615986, 0.022578544914722443, 0.010416715405881405, 0.01120804250240326, -0.022278176620602608, 0.019676081836223602, 0.026140812784433365, 0.010440878570079803, -0.05591309443116188, -0.0011799170169979334, -0.04585376754403114, 0.01131806056946516, 0.07184983044862747, -0.03623537719249725, 0.0349622406065464, 0.0035873851738870144, -0.011916330084204674, 0.006128638982772827, 0.003997864667326212, 0.0030408473685383797, -0.04668280854821205, -0.013795929960906506, -0.014732815325260162, 0.03882864862680435, 0.014808437786996365, 0.03921324759721756, 0.007842564955353737, 0.01596060022711754, -0.021125299856066704, -0.03310779854655266, 0.03828411549329758, -0.011140579357743263, 0.015285799279808998, 0.03891536593437195, 0.000799745146650821, -0.01780684106051922, 0.041779447346925735, 0.023018326610326767, -0.009311686269938946, -0.05386403203010559, -0.0034062634222209454, 0.03714749589562416, -0.016552286222577095, -0.021081505343317986, 0.018141740933060646, 0.030531475320458412, -0.009202061221003532, -0.0249016173183918, 0.02917504869401455, -0.034262046217918396, 0.05267199128866196, 0.021402111276984215, 0.006653272081166506, -0.018918370828032494, 0.012751585803925991, -0.042700644582509995, -0.02612200193107128, 0.04006706550717354, 0.02776383049786091, -0.0024893921799957752, -0.023764541372656822, -0.042697980999946594, -0.000015006314242782537, -0.007568249013274908, -0.017632877454161644, 0.010734820738434792, -0.05526675656437874, 0.043747562915086746, 0.06806716322898865, 0.001760247745551169, 0.00470006326213479, 0.030776547268033028, -0.02643943391740322, -0.011673773638904095, 0.05855182930827141, 0.029732663184404373, 0.06280187517404556, 0.05299297347664833, 0.017921889200806618, 0.00877287145704031, -0.03333019092679024, -0.010311220772564411, -0.006516980938613415, -0.04563320428133011, 0.011075244285166264, 0.026082506403326988, -0.0031774151138961315, 0.03312771022319794, 0.014849384315311909, 0.013659557327628136, 0.0142911896109581, -0.015634916722774506, 0.0014475330244749784, 0.008535249158740044, 0.036028146743774414, 0.038036372512578964, -0.01428851205855608, -0.04973416402935982, -0.00800095871090889, -0.0356108658015728, 0.0116554144769907, -0.01760956272482872, -0.012318451888859272, 0.031193483620882034, 0.020620936527848244, -0.004827397875487804, 0.0040948837995529175, -0.015522538684308529, 0.02503460831940174, -0.005183361936360598, 0.00486611807718873, 0.010475663468241692, -0.008836328983306885, 0.02545626275241375, 0.014554840512573719, -0.033366210758686066, -0.05268533527851105, 0.010843463242053986, 0.029253436252474785, 0.014576549641788006, 0.006747152656316757, 0.0019017672166228294, -0.018193816766142845, -0.008926338516175747, 0.019441161304712296, -0.02640398219227791, -0.014177766628563404, -0.07427719235420227, 0.005347049795091152, 0.02988753840327263, 0.0004599707608576864, -0.05784991383552551, -0.006977597717195749, 0.07038800418376923, 0.02567150443792343, 0.012372080236673355, 0.013301518745720387, 0.0131605239585042, 0.04073438048362732, 0.023884765803813934, 0.0036658169701695442, -0.027192169800400734, 0.03306850418448448, 0.018431179225444794, -0.02092088758945465, -0.014413055032491684, -0.04665229097008705, -0.028312694281339645, 0.01059394795447588, -0.02722659893333912, 0.01954568363726139, -0.013126848265528679, -0.020815344527363777, 0.019798563793301582, 0.055534347891807556, 0.019208379089832306, 0.004263869021087885, -0.019612764939665794, 0.03296436369419098, -0.008580810390412807, -0.04807328060269356, 0.05131376162171364, -0.002314580837264657, -0.028797999024391174, 0.026854241266846657, 0.027287231758236885, 0.057680655270814896, 0.044355835765600204, 0.050634052604436874, 0.0035921307280659676, -0.017102723941206932, -0.0018819024553522468, -0.03578765317797661, 0.03421509638428688, -0.047282736748456955, -0.03402657434344292, 0.03245704621076584, -0.03947729617357254, -0.04504386708140373, 0.04613311216235161, 0.03830579295754433, -0.028577104210853577, -0.036400046199560165, 0.04292433336377144, 0.011058792471885681, -0.009320877492427826, -0.01739000342786312, 0.027343040332198143, -0.009920892305672169, -0.0007976003689691424, -0.025031527504324913, 0.013237260282039642, -0.016321254894137383, -0.0027022550348192453, -0.007325734011828899, 0.027009345591068268, 0.04791932553052902, 0.04515885189175606, 0.04786127060651779, -0.04844802990555763, -0.01388173270970583, -0.023342709988355637, -0.05112074315547943, 0.0393860787153244, -0.002976571675390005, -0.010461868718266487, -0.0025370181538164616, -0.004813969600945711, 0.049724701792001724, 0.015764789655804634, 0.012107430025935173, -0.01780771277844906, 0.03163361921906471, 0.03269825503230095, 0.026012087240815163, -0.06671266257762909, 0.012033953331410885, 0.053417276591062546, 0.022712407633662224, -0.025166556239128113, -0.023833533748984337, -0.03739422932267189, -0.0317666232585907, -0.024426693096756935, -0.003510662354528904, 0.03921451419591904, -0.011183193884789944, 0.003332865424454212, -0.017877817153930664, -0.0021757278591394424, 0.006764098070561886, -0.00005181545566301793, -0.00930912233889103, 0.012267005629837513, 0.015246269293129444, 0.04492838308215141, -0.025073576718568802, 0.014751560986042023, 0.019922856241464615, 0.041082508862018585, -0.015888163819909096, 0.0037102969363331795, 0.05322599038481712, -0.007183568086475134, 0.0015172782586887479, -0.006160345394164324, -0.021243201568722725, 0.029995333403348923, 0.026714542880654335, -0.0043808999471366405, 0.006925511173903942, -0.020558854565024376, 0.031753603368997574, -0.000269552314421162, 0.015117461793124676, -0.010427121073007584, 0.05412592738866806, -0.007106737699359655, 0.00914758536964655, 0.014484972693026066, 0.03366730734705925, 0.03860824927687645, 0.03202296048402786, 0.02706754021346569, -0.04769003391265869, 0.06185062602162361, 0.0461464449763298, 0.04581203684210777, 0.011678868904709816, -0.017897460609674454, -0.0000660794394207187, -0.006257159169763327, 0.026066003367304802, 0.006049687042832375, -0.017007501795887947, 0.02890115976333618, -0.009871568530797958, 0.053548574447631836, -0.042588602751493454, 0.0336756594479084, 0.0395401194691658, 0.051384057849645615, -0.026160674169659615, 0.03945967182517052, 0.03553188219666481, 0.015000930987298489, -0.007957189343869686, 0.03505163639783859, -0.005747569724917412, -0.03636576607823372, 0.02340376377105713, 0.011492466554045677, 0.03612292557954788, -0.008286315947771072, 0.03922206535935402, 0.010036802850663662, -0.034018803387880325, -0.03240730240941048, 0.009243250824511051, 0.013582378625869751, 0.030333487316966057, 0.014103692024946213, -0.017794504761695862, -0.03210316225886345, -0.014766917563974857, 0.025759940966963768, -0.0017910595051944256, -0.009189102798700333, -0.010304628871381283, -0.000589126197155565, 0.011711825616657734, 0.056190136820077896, -0.039358191192150116, 0.007770284544676542, -0.00046670521260239184, 0.00822293572127819, 0.005210165400058031, -0.06382247060537338, -0.006440142169594765, 0.006778061855584383, -0.0350847952067852, -0.03586854785680771, 0.023002589121460915, 0.002508586272597313, -0.0235818549990654, 0.01776394434273243, 0.025553666055202484, 0.021097825840115547, 0.02001458778977394, 0.010217755101621151, 0.039992690086364746, -0.0485956184566021, -0.030596964061260223, -0.0008454870549030602, -0.038090381771326065, 0.0165285374969244, -0.008307913318276405, -0.027559857815504074, -0.02545052580535412, 0.012871993705630302, 0.041785068809986115, 0.033865924924612045, -0.05003129318356514, -0.04390731453895569, 0.04760286584496498, -0.008344138972461224, -0.028111910447478294, 0.030293436720967293, 0.012117757461965084, -0.022452902048826218, -0.04359470680356026, 0.021144511178135872, -0.016181742772459984, 0.0035224254243075848, -0.0002659404999576509, 0.03398212045431137, -0.014447301626205444, -0.03945513814687729, -0.014722091145813465, -0.012051833793520927, 0.010286170989274979, 0.03848688304424286, 0.04681139811873436, -0.039265308529138565, -0.005586632993072271, -0.018003588542342186, -0.025941209867596626, -0.06509319692850113, 0.0045494805090129375, -0.020961612462997437, -0.018202029168605804, -0.03641389682888985, 0.03469294309616089, -0.03200404345989227, 0.04047485068440437, -0.035299498587846756, -0.04897637665271759, -0.045464929193258286, 0.007550987880676985, -0.023681271821260452, 0.022069433704018593, 0.05383189022541046, 0.014915321953594685, -0.0006403110455721617, 0.00010028462565969676, -0.02571350894868374, -0.010643135756254196, -0.011984601616859436, 0.029632823541760445, 0.05045095831155777, -0.026350507512688637, -0.03635655716061592, -0.056673578917980194, 0.07418911904096603, -0.025476176291704178, -0.03472208231687546, 0.030465606600046158, -0.007714311126619577, 0.013422113843262196, -0.057187557220458984, 0.0364266075193882, 0.05363984778523445, -0.0018559775780886412, 0.03534359484910965, -0.005679541267454624, 0.03492247313261032, -0.02805803157389164, 0.015062203630805016, -0.07029268145561218, -0.027707988396286964, -0.017647873610258102, -0.03839978203177452, -0.006050296127796173, -0.012752097100019455, 0.024348022416234016, 0.005639251321554184, -0.01260046660900116, 0.014557764865458012, -0.004649540409445763, -0.053184833377599716, -0.017807407304644585, 0.009453356266021729, 0.04875976964831352, -0.022128351032733917, -0.029829584062099457, 0.04539533331990242, 0.015033474192023277, -0.03602888807654381, 0.015254613012075424, -0.00789441168308258, 0.02799133211374283, 0.01774446666240692, 0.011204741895198822, -0.02697758376598358, 0.05217942222952843, 0.05733989551663399, -0.06252146512269974, -0.05835725739598274, -0.01705166883766651 ]
Few-shot learning in practice: GPT-NEO and the 🤗 Accelerated Inference API
philschmid
June 3, 2021
few-shot-learning-gpt-neo-and-inference-api
guide, nlp
https://huggingface.co/blog/few-shot-learning-gpt-neo-and-inference-api
Best practices for responsible use - Make sure people know which parts of their user experience depend on the outputs of the ML system - If possible, give users the ability to opt-out - Provide a mechanism for users to give feedback on the model decision, and to override it - Monitor feedback, especially model failures, for groups of users that may be disproportionately affected What needs most to be avoided is to use the model to automatically make decisions for, or about, a user, without opportunity for a human to provide input or correct the output. Several regulations, such as GDPR in Europe, require that users be provided an explanation for automatic decisions made about them. --- To use GPT-Neo or any Hugging Face model in your own application, you can start a free trial of the 🤗 Accelerated Inference API. If you need help mitigating bias in models and AI systems, or leveraging Few-Shot Learning, the 🤗 Expert Acceleration Program can offer your team direct premium support from the Hugging Face team.
[ 0.01805507205426693, -0.05395027995109558, 0.04260699078440666, 0.01996336504817009, 0.035383790731430054, 0.04981886222958565, -0.03997863829135895, -0.02771461196243763, -0.02190973050892353, -0.036496274173259735, -0.147965207695961, 0.05853801593184471, -0.052890196442604065, 0.039636578410863876, -0.032677218317985535, -0.11382398754358292, 0.06656894087791443, -0.02426871471107006, -0.03713807091116905, 0.028387440368533134, 0.024084564298391342, -0.07244883477687836, 0.010427611880004406, 0.0004920034552924335, 0.03027547150850296, -0.12348414957523346, 0.022521376609802246, -0.019725220277905464, -0.04610392451286316, 0.05750881880521774, -0.01823374256491661, -0.004568141419440508, -0.0414309948682785, 0.005233765114098787, 0.035200733691453934, 0.03165922313928604, -0.11610493063926697, 0.031034845858812332, 0.031591251492500305, 0.03194272145628929, 0.04730847105383873, -0.06179000809788704, -0.08138033002614975, 0.012020955793559551, 0.01950988546013832, -0.06761027872562408, -0.13428884744644165, 0.057793498039245605, -0.042321186512708664, -0.05911770462989807, -0.07614920288324356, 0.08148730546236038, -0.003827946027740836, -0.010427110828459263, 0.04239669069647789, 0.005852926522493362, 0.0029025764670222998, -0.10431283712387085, -0.0035949740558862686, -0.00447578402236104, 0.05130154639482498, -0.02153833769261837, 0.02167429029941559, 0.038758762180805206, 0.0010161028476431966, -0.06718534231185913, -0.006407007575035095, 0.00915797334164381, -0.057791560888290405, -0.02996760606765747, -0.01784500479698181, -0.04124945029616356, -0.07803226262331009, -0.031762074679136276, -0.02673161029815674, -0.0896763876080513, 0.008624229580163956, -0.0232772845774889, 0.010124129243195057, -0.003780726809054613, -0.0032888087444007397, -0.028933104127645493, 0.06081654876470566, 0.010655620135366917, 0.03730151802301407, 0.07071778923273087, 0.025023091584444046, -0.013777549378573895, -0.01693066582083702, 0.04977847635746002, 0.00019750234787352383, -0.0740898847579956, 0.0780877023935318, -0.038695257157087326, 0.05660909041762352, -0.029942648485302925, -0.011326029896736145, 0.010189197026193142, 0.02028783969581127, -0.04542425647377968, -0.048276908695697784, -0.05543341860175133, -0.04715665802359581, -0.023746702820062637, -0.037938233464956284, -0.02633814886212349, -0.008502150885760784, -0.08933862298727036, -0.022837219759821892, 0.05608276650309563, 0.016383327543735504, -0.0033435968216508627, -0.05415138974785805, 0.03851347789168358, -0.08401791751384735, 0.05057975649833679, -0.01833368092775345, 0.03847915306687355, 0.05161317437887192, 0.06423746049404144, 0.0717153400182724, 0.015877950936555862, -0.012433131225407124, 0.02504240907728672, -0.0043878923170268536, 0.02728361450135708, 0.0737997442483902, -0.010413279756903648, -0.004286009352654219, -0.0680289939045906, 0.015485902316868305, -0.017857683822512627, -0.06263446062803268, -0.013924275524914265, 0.04649195075035095, -0.01621370203793049, 0.056283481419086456, -0.1036524623632431, 0.0034001413732767105, 0.004068484529852867, -0.032404541969299316, -0.017206663265824318, -0.004358920268714428, -0.020525015890598297, 0.04914216324687004, 0.01867254637181759, -0.07097052782773972, 0.06147945672273636, -0.0039029826875776052, 0.04231330752372742, -0.07847665250301361, 0.10268498957157135, 0.026444869115948677, -0.024607738479971886, 0.0089064110070467, 0.05322654917836189, -0.06027946248650551, -0.029657265171408653, -0.05011237412691116, -0.05790656432509422, -0.0077348146587610245, -0.022800451144576073, -0.047999750822782516, 0.024943606927990913, 0.02268831618130207, 0.02168712206184864, -0.05453244224190712, -0.017371181398630142, 0.014455302618443966, 0.04419631510972977, -0.026926780119538307, -0.04366428777575493, 0.030935652554035187, -0.07545726001262665, 0.05534559488296509, 0.016396690160036087, -0.02817317470908165, 0.0004960094229318202, -0.05495135486125946, -0.01285120751708746, -0.0935545489192009, 0.07433267682790756, 0.04787122830748558, 0.0350816547870636, 0.03712049126625061, -0.09055182337760925, 0.027915824204683304, -0.04450167343020439, -0.005152271129190922, -0.033270206302404404, 0.00062378472648561, 0.02202443964779377, 0.07223052531480789, -0.02922162227332592, 0.028774889186024666, -0.02643147110939026, -0.03356748819351196, 0.16625356674194336, 0.01456877589225769, 0.017933504655957222, 0.007129398174583912, -0.03304651379585266, 0.055917464196681976, -0.07630781829357147, -0.017446955665946007, -0.01568150706589222, 0.031416069716215134, -0.04705410078167915, 0.007778164930641651, 0.03739522024989128, -0.00455806078389287, -0.046394139528274536, 0.0006104582571424544, -0.05289400368928909, -0.008935175836086273, -0.05219794064760208, 0.009915008209645748, 0.040540315210819244, -0.04416835308074951, 0.008054747246205807, 0.15574951469898224, -0.029962997883558273, 0.01596219092607498, -0.030575580894947052, 0.007525700144469738, 0.0047972132451832294, 0.058972831815481186, 0.11081468313932419, 0.05617736279964447, -0.05907033011317253, -0.03543059900403023, -0.0746457427740097, 0.026577895507216454, 0.020309416577219963, 0.008317182771861553, -0.012444394640624523, 0.028727468103170395, 0.000048003090341808274, 0.023625582456588745, -0.03045031800866127, -0.00852520577609539, -0.00667394557967782, -0.052232205867767334, 0.05695260688662529, -0.00540274940431118, -0.017184333875775337, 0.023307442665100098, 0.009259797632694244, -0.027663039043545723, -0.007346014492213726, -0.07791870087385178, 0.06396175175905228, 0.020523685961961746, 0.029610583558678627, 0.022843580693006516, 0.025187812745571136, -0.004790343344211578, 0.024870382621884346, -0.047606758773326874, 0.02601020596921444, 0.051649294793605804, 0.009996216744184494, -0.024391742423176765, -0.022912222892045975, -0.0019737582188099623, -0.011684195138514042, -0.0030130064114928246, 0.0014119945699349046, -0.003851638175547123, -0.006700662896037102, 0.0024906934704631567, -0.03469672426581383, 0.05163515731692314, 0.03601568192243576, 0.007127236574888229, 0.030034780502319336, 0.03675560653209686, 0.018150852993130684, -0.003806506749242544, -0.0186301339417696, 0.010167409665882587, -0.00004132576214033179, 0.01874569244682789, 0.03478527441620827, 0.005310453474521637, 0.023673655465245247, -0.01446579210460186, -0.020416412502527237, -0.043814703822135925, 0.023867813870310783, 0.004657364916056395, -0.001713000936433673, -0.024688174948096275, -0.06565770506858826, -0.02972158044576645, 0.04914137348532677, -0.013232833705842495, 0.004710880108177662, 0.007171498145908117, 0.0382172167301178, -0.01873026229441166, -0.026698565110564232, 0.03600623458623886, -0.015639999881386757, 0.014534630812704563, 0.06727416068315506, 0.032904788851737976, 0.0055094691924750805, -0.08654814213514328, -0.006236649584025145, -0.001214776188135147, 0.021127719432115555, -0.01160898245871067, -0.023720331490039825, 0.05264042317867279, 0.03253602609038353, -0.004297806415706873, -0.002980651333928108, -0.014587050303816795, 0.014514642767608166, 0.05121023952960968, 0.011647544801235199, -0.011481436900794506, -0.03705244138836861, -0.005430740304291248, -0.023555779829621315, 0.05148734897375107, 0.030341755598783493, -0.019412843510508537, 0.0486011803150177, -0.015130460262298584, 0.02042955346405506, -0.007307387888431549, -0.009392214007675648, 0.0036111229564994574, 0.013664915226399899, 0.01567392237484455, -0.0025090768467634916, 0.0033825766295194626, -0.039828233420848846, -0.0270682480186224, 0.037182603031396866, -0.014564198441803455, 0.007184992078691721, 0.008106297813355923, 0.026511235162615776, 0.04255792498588562, 0.021411506459116936, 0.004456630442291498, 0.0020842915400862694, 0.0220896415412426, -0.021583765745162964, 0.0361267551779747, 0.036369990557432175, -0.015932876616716385, -0.009087889455258846, 0.005090417340397835, 0.0035650471691042185, 0.003464215202257037, 0.008316645398736, -0.01072685793042183, 0.043265342712402344, 0.02447277493774891, 0.007276719901710749, 0.010296424850821495, 0.036574866622686386, -0.020795101299881935, 0.03380025550723076, -0.03235888108611107, 0.01451184879988432, 0.020977972075343132, -0.03141491860151291, -0.032376065850257874, 0.006418201606720686, 0.014204458333551884, -0.03918922692537308, -0.011493921279907227, 0.025955703109502792, 0.0024495841935276985, 0.051055908203125, 0.035300638526678085, -0.003598713781684637, 0.004711449611932039, 0.02225516550242901, 0.0031010503880679607, 0.017674177885055542, 0.060492537915706635, 0.010870271362364292, -0.005701869260519743, -0.0049857450649142265, -0.022124649956822395, -0.03099527582526207, 0.0071979546919465065, -0.024691080674529076, 0.055462125688791275, 0.01906617544591427, 0.021944167092442513, 0.044662654399871826, 0.02671172469854355, -0.06013946980237961, 0.013861063867807388, -0.02838277816772461, -0.036258798092603683, 0.0379384346306324, 0.01754903420805931, 0.044454485177993774, 0.029179535806179047, 0.0021653801668435335, -0.0011755537707358599, -0.003658825997263193, 0.02355625480413437, -0.015396354719996452, -0.00811578519642353, 0.08168122917413712, 0.002426966791972518, -0.01749006286263466, 0.06072370335459709, 0.010675421915948391, 0.00422038696706295, 0.024611491709947586, 0.001966525800526142, -0.015935534611344337, 0.04760085046291351, 0.032687533646821976, -0.005167420022189617, 0.007650050800293684, -0.04682882875204086, 0.0004601207037921995, 0.0021361657418310642, 0.030693916603922844, -0.008764425292611122, -0.025541381910443306, 0.03842365741729736, 0.019209597259759903, -0.010972230695188046, 0.0010380070889368653, -0.00043012434616684914, 0.003012928180396557, 0.007692954037338495, -0.010541658848524094, 0.04019945114850998, -0.034701429307460785, 0.05376797169446945, 0.018961407244205475, -0.04987936094403267, 0.0379764661192894, -0.02076583169400692, -0.009899886325001717, 0.05268188565969467, 0.027586689218878746, 0.0179684367030859, -0.038058582693338394, 0.02229289710521698, 0.0068724374286830425, -0.03841935843229294, 0.02331261895596981, -0.036791931837797165, 0.023116642609238625, 0.024003034457564354, 0.020917434245347977, -0.03858523443341255, 0.006529818754643202, 0.06042362004518509, -0.046330031007528305, 0.015947945415973663, 0.022843383252620697, 0.03230281546711922, 0.04275692626833916, 0.014596703462302685, 0.000471651554107666, -0.026896635070443153, 0.013705081306397915, 0.044515129178762436, 0.014038624241948128, 0.01846131682395935, -0.0076142274774611, -0.03340352699160576, -0.009864751249551773, -0.02942723035812378, 0.03137816861271858, 0.008219442330300808, -0.018671119585633278, 0.019743580371141434, 0.043369196355342865, 0.015926996245980263, 0.02933119237422943, -0.042783837765455246, 0.04416390508413315, -0.02825876697897911, -0.00791621208190918, 0.03222745656967163, -0.02427547797560692, 0.028821365907788277, 0.00319594400934875, 0.04227757826447487, 0.06223830208182335, 0.0062737069092690945, 0.010664550587534904, -0.0057411203160882, -0.004697085823863745, 0.041632942855358124, -0.04320349916815758, 0.036998458206653595, 0.01710367761552334, -0.0014352326979860663, 0.03704134002327919, -0.0244299229234457, 0.0002210462262155488, 0.01637258380651474, 0.03674285486340523, -0.04175223037600517, 0.012227896600961685, 0.012162272818386555, -0.03678160160779953, 0.014235934242606163, -0.024980604648590088, 0.031656671315431595, -0.007113021798431873, -0.0016416723374277353, -0.03215403854846954, 0.016763407737016678, -0.038136076182127, -0.005993313156068325, 0.001631513936445117, -0.014682088978588581, 0.06889475882053375, 0.005782820750027895, 0.03822306543588638, -0.034621842205524445, 0.006274234037846327, -0.030561169609427452, -0.048357944935560226, 0.06515032052993774, 0.0024224508088082075, -0.0010773608228191733, 0.000632285256870091, 0.02819696068763733, 0.004160748794674873, -0.0014547233004122972, 0.026005784049630165, 0.02551054209470749, 0.026398202404379845, 0.0351005420088768, -0.006531208287924528, -0.05790316313505173, 0.05000556632876396, 0.027265677228569984, -0.03378666192293167, 0.004059282131493092, -0.03742380067706108, -0.07220567762851715, -0.04549628123641014, -0.021341392770409584, 0.014020678587257862, 0.016821036115288734, 0.011382854543626308, 0.00007897086470620707, 0.00993172638118267, -0.006235921289771795, 0.00590254133567214, -0.01177504938095808, 0.005212468560785055, -0.002276832703500986, 0.01469397358596325, 0.02780892141163349, 0.013526135124266148, -0.03556298092007637, 0.013808096759021282, 0.008468015119433403, -0.05944306030869484, -0.03594792261719704, 0.02248396910727024, -0.02097678929567337, 0.015695396810770035, -0.01412412989884615, -0.008485489524900913, 0.009607701562345028, -0.010816003195941448, 0.04984607174992561, 0.04469260945916176, 0.005924794357270002, 0.02518361806869507, 0.0030754925683140755, -0.00855028536170721, -0.004381927661597729, 0.036785759031772614, 0.0004286486655473709, -0.009357737377285957, 0.0022431493271142244, 0.04430798441171646, 0.005314746871590614, 0.007423565723001957, 0.021297629922628403, -0.03831697627902031, 0.09922219812870026, 0.020985973998904228, 0.019157225266098976, -0.004190563224256039, -0.056460242718458176, -0.008833096362650394, 0.005372907035052776, -0.029053963720798492, -0.02122696302831173, -0.011554773896932602, 0.029613399878144264, -0.03484433889389038, -0.012290609069168568, -0.02525370754301548, 0.022755306214094162, 0.044271886348724365, 0.022953342646360397, 0.006838338449597359, 0.03349311277270317, 0.027982382103800774, 0.03313624486327171, 0.01150033064186573, 0.012858381494879723, 0.010070757940411568, -0.035326216369867325, 0.03329900652170181, 0.004547775257378817, 0.04238243028521538, -0.00004770565283251926, 0.0462685152888298, 0.0009916903218254447, -0.029781771823763847, -0.009397073648869991, -0.001595417968928814, 0.000206101278308779, 0.02051355503499508, -0.00433569448068738, -0.016002463176846504, -0.010363784618675709, -0.0020515075884759426, 0.011030119843780994, 0.014133618213236332, 0.024730749428272247, 0.019022397696971893, -0.007389988750219345, 0.06660550087690353, 0.04785748943686485, -0.014330444857478142, 0.026771804317831993, 0.02158915437757969, 0.019043106585741043, -0.004623053129762411, -0.04834810271859169, -0.053302399814128876, -0.029350433498620987, -0.040783725678920746, -0.016250401735305786, 0.0070312549360096455, -0.00258261919952929, -0.012455059215426445, 0.003688893048092723, 0.02990756742656231, -0.009104765020310879, 0.016990110278129578, 0.0422862283885479, -0.0230540968477726, -0.02956358715891838, -0.0004991189343854785, -0.02352979965507984, -0.017615579068660736, -0.02769072726368904, -0.08411851525306702, 0.015184786170721054, -0.011726347729563713, 0.015545006841421127, 0.03996828570961952, 0.04682251438498497, -0.04119201377034187, -0.01877019740641117, 0.03229982778429985, 0.0234727431088686, -0.020040296018123627, 0.03476986661553383, 0.014059211127460003, 0.001285684178583324, -0.012228865176439285, -0.022980162873864174, -0.008173661306500435, 0.0005258148885332048, -0.011141529306769371, -0.0016111120348796248, -0.030170371755957603, -0.05225885286927223, -0.0058557032607495785, 0.048597462475299835, 0.019366025924682617, 0.070442333817482, 0.003062810515984893, 0.0014366675168275833, -0.01281646452844143, -0.02599622681736946, -0.005049466621130705, -0.05671127140522003, 0.04833030328154564, -0.027296897023916245, -0.013009199872612953, 0.015605821274220943, 0.015659503638744354, -0.016646718606352806, -0.006535667460411787, -0.022771714255213737, -0.0008282219059765339, -0.01953498274087906, -0.012167340144515038, -0.042616743594408035, -0.003357083071023226, 0.053866174072027206, -0.000646165746729821, 0.031390007585287094, -0.009865466505289078, -0.015794625505805016, -0.015376659110188484, 0.016023995354771614, 0.015111089684069157, 0.03634655103087425, -0.0008248460944741964, 0.0054487185552716255, -0.032778188586235046, 0.047828394919633865, 0.024107545614242554, -0.03921060264110565, 0.062334123998880386, 0.023269277065992355, 0.018672676756978035, -0.0021152752451598644, 0.011146962642669678, 0.013819409534335136, -0.021766236051917076, -0.028955824673175812, -0.026526378467679024, 0.008664123713970184, -0.03234867379069328, 0.0270248930901289, -0.031177792698144913, -0.0024944704491645098, -0.03541717678308487, -0.002439410425722599, 0.0011668443912640214, -0.03833959624171257, -0.014190536923706532, -0.014825052581727505, 0.005609074607491493, -0.020909786224365234, 0.02138422429561615, -0.05693419650197029, -0.06300356239080429, 0.026729488745331764, 0.020535731688141823, 0.012704910710453987, -0.041808053851127625, 0.006101367063820362, -0.0015053183306008577, -0.020186465233564377, -0.004711429122835398, -0.010820168070495129, 0.0009264813270419836, 0.04682745039463043, -0.019840599969029427, -0.01610543765127659, 0.09192698448896408, 0.03995733708143234, -0.037606678903102875, -0.05013004317879677, 0.0012829701881855726 ]
Few-shot learning in practice: GPT-NEO and the 🤗 Accelerated Inference API
philschmid
June 3, 2021
few-shot-learning-gpt-neo-and-inference-api
guide, nlp
https://huggingface.co/blog/few-shot-learning-gpt-neo-and-inference-api
Practical Insights Here are some practical insights, which help you get started using GPT-Neo and the 🤗 Accelerated Inference API. Since GPT-Neo (2.7B) is about 60x smaller than GPT-3 (175B), it does not generalize as well to zero-shot problems and needs 3-4 examples to achieve good results. When you provide more examples GPT-Neo understands the task and takes the end_sequence into account, which allows us to control the generated text pretty well. The hyperparameter End Sequence, Token Length & Temperature can be used to control the text-generation of the model and you can use this to your advantage to solve the task you need. The Temperature controlls the randomness of your generations, lower temperature results in less random generations and higher temperature results in more random generations. In the example, you can see how important it is to define your hyperparameter. These can make the difference between solving your task or failing miserably. ---
[ 0.04147098585963249, -0.0030524153262376785, 0.07310520112514496, 0.01578455977141857, 0.07929572463035583, 0.04432301968336105, 0.0018603677162900567, 0.027952436357736588, -0.0034957770258188248, -0.04390868917107582, -0.07625456154346466, -0.004519973881542683, 0.042603749781847, 0.08682024478912354, 0.005468294024467468, -0.013540276326239109, 0.054281700402498245, -0.03365607559680939, -0.02648484706878662, -0.024589771404862404, 0.012108552269637585, -0.004663905594497919, -0.009094156324863434, 0.008536774665117264, 0.04274051636457443, -0.058278001844882965, -0.0060644978657364845, -0.010992656461894512, -0.042181555181741714, 0.051469989120960236, -0.1206357553601265, -0.016698390245437622, -0.03293131664395332, -0.01709410734474659, 0.08390679955482483, -0.0071704937145113945, -0.12996147572994232, 0.04516302049160004, 0.07424306124448776, 0.03478527069091797, 0.001966033596545458, -0.014878086745738983, -0.041527148336172104, 0.022958386689424515, 0.03263157606124878, 0.026108602061867714, -0.13397133350372314, 0.060199856758117676, -0.03719586133956909, -0.08074951171875, -0.0677979439496994, 0.03595979884266853, -0.044076159596443176, -0.01954159513115883, 0.009075252339243889, 0.06421342492103577, 0.006023576948791742, -0.08517265319824219, 0.05468267202377319, 0.007780374959111214, 0.06366638839244843, 0.024210356175899506, 0.013337956741452217, 0.04389715567231178, 0.0055433171801269054, -0.05075236037373543, -0.05144155025482178, 0.06762305647134781, -0.03954571485519409, 0.01764606684446335, -0.02181047387421131, -0.0491163395345211, -0.061870839446783066, 0.004316174890846014, -0.023002509027719498, -0.04556465893983841, 0.03394119068980217, 0.019695784896612167, 0.04755941033363342, -0.015466331504285336, -0.03248681128025055, -0.03391379490494728, 0.02956991270184517, 0.035259541124105453, 0.010891660116612911, 0.034767039120197296, 0.06070753186941147, 0.01112540066242218, -0.025589071214199066, 0.005463048815727234, 0.003202105639502406, -0.15444450080394745, 0.015768615528941154, -0.0043309759348630905, -0.030712030827999115, 0.005778184160590172, -0.004700095858424902, 0.06460609287023544, 0.029128484427928925, -0.04085758700966835, 0.002676707226783037, -0.023814693093299866, -0.018186107277870178, -0.043781667947769165, -0.06690401583909988, -0.009050732478499413, -0.02462068386375904, -0.0655762106180191, -0.02167479135096073, 0.031247835606336594, -0.061737608164548874, 0.03764227405190468, -0.01575445756316185, 0.06052958592772484, -0.10188697278499603, 0.021872006356716156, -0.012002972885966301, 0.04717624559998512, -0.01400431152433157, 0.004704359453171492, -0.0006820825510658324, 0.022399988025426865, 0.07104824483394623, 0.016399577260017395, -0.046933915466070175, 0.03350082039833069, 0.07231846451759338, 0.01928839460015297, -0.014952616766095161, -0.05453100800514221, 0.000048777183110360056, -0.0211188904941082, -0.008422622457146645, -0.014184370636940002, 0.024957215413451195, -0.04725300893187523, -0.022563626989722252, -0.06972018629312515, -0.018419580534100533, -0.01963409222662449, -0.028613481670618057, -0.03350210189819336, 0.04070059210062027, 0.003820546204224229, 0.022886084392666817, 0.050827756524086, -0.027353748679161072, -0.09658501297235489, 0.010202762670814991, 0.039569783955812454, -0.04032333567738533, 0.10450178384780884, 0.010905023664236069, -0.020024843513965607, 0.06013571843504906, 0.03801406919956207, -0.030410179868340492, 0.010719524696469307, -0.0885419026017189, -0.052189964801073074, 0.01870737597346306, -0.042198676615953445, 0.03226751461625099, -0.012708158232271671, 0.03686065971851349, -0.031070392578840256, 0.024497225880622864, 0.05658486485481262, -0.00802195630967617, 0.05942440405488014, 0.002819925546646118, -0.031176291406154633, 0.03512198105454445, 0.005051461514085531, 0.0019007344963029027, 0.030471963807940483, 0.023052878677845, 0.003630670253187418, 0.04634251073002815, -0.01621074043214321, -0.02191152609884739, 0.057807277888059616, 0.022278934717178345, 0.08995326608419418, 0.0037202085368335247, -0.13197307288646698, 0.018285667523741722, 0.017139343544840813, -0.02029646560549736, -0.05972342565655708, -0.010434241034090519, -0.026285912841558456, 0.09677351266145706, 0.0018146067159250379, -0.03904721513390541, -0.04443017765879631, 0.031223855912685394, 0.12220106273889542, 0.0645613968372345, 0.022128207609057426, 0.052637241780757904, 0.026068320497870445, 0.06582976877689362, -0.061697881668806076, -0.03594033420085907, -0.013678694143891335, 0.05378264561295509, -0.010000847280025482, -0.0105925677344203, 0.018523188307881355, 0.026568593457341194, -0.07201322913169861, 0.013448912650346756, -0.08486983925104141, -0.0025835686828941107, 0.006884162779897451, 0.038328565657138824, 0.027965739369392395, -0.003399193286895752, -0.04307045042514801, 0.14568038284778595, -0.05281977355480194, -0.007307092659175396, -0.015819907188415527, -0.0042566596530377865, 0.06696781516075134, 0.0747598186135292, 0.006657458376139402, 0.005395415239036083, -0.05425289645791054, 0.042542651295661926, -0.09193567931652069, 0.018783915787935257, 0.05594264715909958, -0.007793140131980181, -0.01079943124204874, -0.04348544031381607, -0.04929180443286896, 0.02214706316590309, -0.11878464370965958, -0.0049768052995204926, 0.054281167685985565, -0.0788458064198494, 0.04825464263558388, -0.011059120297431946, 0.005002576392143965, 0.11078518629074097, 0.016940196976065636, -0.007819060236215591, -0.021630221977829933, -0.09962667524814606, 0.07737210392951965, 0.037441037595272064, -0.034745313227176666, -0.004502795170992613, 0.023342205211520195, -0.006651334930211306, -0.028484556823968887, -0.015002582222223282, 0.011251267977058887, -0.02024613320827484, 0.015004519373178482, -0.06013567000627518, -0.0330197699368, 0.0054320828057825565, 0.005965225864201784, -0.04805736243724823, -0.027604222297668457, -0.025297537446022034, -0.0004961714148521423, -0.021005360409617424, -0.03486629202961922, 0.03063124604523182, 0.028013262897729874, -0.011378221213817596, -0.044374652206897736, 0.021358974277973175, -0.0169642586261034, -0.007736047729849815, 0.008874899707734585, -0.0029346831142902374, -0.006027629133313894, -0.007647278252989054, 0.012073495425283909, 0.0032382055651396513, 0.03360436484217644, 0.0035023665986955166, -0.013510414399206638, 0.005109904333949089, 0.013817483559250832, -0.026679478585720062, 0.00011889035522472113, 0.02424214594066143, -0.04744521155953407, -0.0005929346079938114, 0.018410101532936096, 0.0012640245258808136, -0.008970838040113449, -0.013796823099255562, 0.03979792818427086, 0.025595011189579964, -0.0030543070752173662, 0.005730297416448593, -0.026489678770303726, -0.022760692983865738, 0.046908434480428696, 0.02194279432296753, 0.05189550668001175, -0.09943073987960815, -0.003474211087450385, -0.008383326232433319, -0.02263709343969822, 0.002657419303432107, -0.025348691269755363, 0.03290526941418648, -0.001098711509257555, -0.007681723218411207, -0.03218108415603638, -0.013325321488082409, 0.039514582604169846, 0.040187884122133255, -0.004480676259845495, 0.006297014653682709, 0.006949413567781448, -0.011219078674912453, -0.023131638765335083, 0.03534658998250961, 0.03575662523508072, 0.012975038960576057, 0.016035212203860283, 0.007269586436450481, -0.016235273331403732, -0.022442637011408806, -0.0003013300593011081, -0.0012542417971417308, 0.044224563986063004, 0.0071956622414290905, -0.024708667770028114, 0.005458412691950798, -0.03919592499732971, -0.006608774419873953, 0.0852707102894783, -0.02585633285343647, 0.0053874230943620205, -0.0029727602377533913, -0.003222151892259717, 0.02054576389491558, 0.021957550197839737, 0.01089255791157484, -0.047126173973083496, 0.014149107970297337, -0.047085653990507126, 0.024030178785324097, -0.01073409803211689, 0.03592463210225105, 0.014822516590356827, 0.03473809361457825, -0.016187310218811035, -0.010133549571037292, -0.008449549786746502, -0.028818821534514427, -0.007902730256319046, 0.025681357830762863, -0.015360437333583832, -0.004491450265049934, 0.028863439336419106, 0.018947508186101913, -0.015789035707712173, -0.0854359045624733, -0.0012488974025472999, 0.05043424293398857, 0.004862959496676922, -0.03599787876009941, 0.04084540531039238, 0.036714307963848114, -0.023898573592305183, -0.027111247181892395, 0.055087510496377945, -0.03348398953676224, 0.026297811418771744, 0.02499597705900669, -0.002552341902628541, 0.007388404570519924, -0.0015149273676797748, -0.04478757828474045, 0.011711704544723034, 0.05173727869987488, 0.021847965195775032, -0.00011886594438692555, -0.030339064076542854, -0.05569963902235031, -0.001783476211130619, -0.001446358161047101, 0.016466721892356873, 0.011505805887281895, -0.0436401292681694, 0.000001267464767806814, 0.025130506604909897, 0.03832858428359032, 0.002335722791031003, 0.04169793426990509, -0.03280973806977272, -0.012793210335075855, 0.03156767785549164, 0.02413938380777836, 0.040051162242889404, 0.07352935522794724, 0.007580169942229986, 0.008722659200429916, -0.04323205724358559, 0.003408594988286495, -0.007528627756983042, -0.01534892525523901, 0.04239295423030853, -0.00786744337528944, 0.011510592885315418, 0.0015903557650744915, 0.01587587222456932, -0.008979866281151772, -0.0015891491202637553, 0.012135080061852932, -0.002224699594080448, 0.0354190394282341, 0.03293902426958084, 0.015935726463794708, 0.017615851014852524, -0.03796282038092613, 0.004634666256606579, -0.040537454187870026, -0.01136688981205225, -0.024869222193956375, -0.011367437429726124, 0.007893383502960205, -0.010325632058084011, -0.017200106754899025, 0.0015410106861963868, 0.0033299194183200598, -0.014803525991737843, 0.0008973090443760157, -0.017115488648414612, -0.006814063526690006, -0.01005673035979271, -0.00024351091997232288, 0.02522909827530384, -0.05026225373148918, 0.011385014280676842, -0.02146853879094124, -0.03249846398830414, 0.025395188480615616, 0.008966786786913872, 0.007071834057569504, -0.03216012567281723, 0.00629573967307806, 0.00012725514534395188, 0.0033994694240391254, -0.00647278968244791, -0.00867605023086071, 0.03316308930516243, 0.04039798304438591, 0.003940634895116091, -0.044931162148714066, -0.015119421295821667, 0.022773249074816704, -0.0071812402456998825, 0.002497164998203516, -0.022124705836176872, -0.02351216785609722, 0.03847184404730797, 0.009546400979161263, -0.02484573982656002, -0.06523618847131729, 0.018881620839238167, -0.027903415262699127, -0.001070288592018187, 0.009586116299033165, -0.024971431121230125, -0.013271359726786613, 0.01879306323826313, -0.0135023333132267, -0.004007869400084019, -0.004584884736686945, -0.026495009660720825, 0.04517564922571182, 0.04104653000831604, 0.025391606613993645, 0.053126078099012375, -0.005793560296297073, 0.010245629586279392, -0.0029920570086687803, -0.0292950551956892, 0.03579988330602646, -0.031454991549253464, -0.015074122697114944, 0.010951525531709194, 0.05463491007685661, 0.03905938193202019, 0.024420881643891335, 0.02796068787574768, -0.0049285804852843285, -0.03089868649840355, 0.028178146108984947, -0.00945254135876894, 0.02667052671313286, 0.003864873433485627, -0.00496786879375577, 0.02901742048561573, -0.02514227107167244, -0.0160774365067482, 0.03391311690211296, -0.003934564534574747, -0.011823637410998344, -0.010277768597006798, 0.023762233555316925, 0.026702815666794777, -0.010856741108000278, -0.035017259418964386, 0.024326004087924957, -0.035490792244672775, -0.010403621010482311, -0.046658020466566086, -0.02256055362522602, -0.04729533568024635, -0.022467412054538727, -0.012065200135111809, -0.04231354966759682, 0.09206888824701309, 0.031046075746417046, 0.0547964833676815, -0.010610425844788551, -0.008947964757680893, -0.028148427605628967, 0.008120032027363777, 0.07687962055206299, 0.0053408523090183735, -0.030901474878191948, -0.018285946920514107, -0.02696743793785572, 0.003009964246302843, 0.01993853785097599, -0.024299858137965202, 0.018717262893915176, 0.05240996927022934, 0.004247148521244526, -0.03444290906190872, -0.02982804737985134, 0.0505046471953392, 0.03143158182501793, -0.005659517832100391, -0.039257947355508804, -0.045129794627428055, -0.0025716053787618876, -0.048111848533153534, -0.05707333981990814, 0.023610008880496025, 0.019048349931836128, -0.0087027158588171, -0.031420547515153885, -0.01045873574912548, 0.015245466493070126, -0.04043550044298172, 0.009510514326393604, 0.0488903671503067, 0.014565536752343178, 0.020580988377332687, 0.050534527748823166, -0.029121337458491325, -0.0020029691513627768, 0.024861449375748634, 0.02255411073565483, -0.047313787043094635, 0.0337870791554451, 0.012866728939116001, -0.007561366073787212, -0.008915907703340054, 0.0217379629611969, -0.03313952684402466, 0.01763450913131237, 0.03280530124902725, 0.018033215776085854, 0.013304241001605988, -0.006750236265361309, 0.035936012864112854, -0.024316666647791862, 0.01705493964254856, -0.03916911780834198, 0.03430532291531563, 0.011714677326381207, 0.002339617582038045, 0.023998139426112175, 0.05650678277015686, 0.05178429186344147, 0.02608320116996765, -0.026248477399349213, -0.016547001898288727, 0.04722575470805168, 0.015099351294338703, 0.025593208149075508, -0.03606315329670906, -0.014062561094760895, -0.016315223649144173, -0.024963252246379852, -0.02222299948334694, -0.03925248235464096, 0.007593738846480846, 0.03820996731519699, -0.008074157871305943, 0.006531836930662394, 0.0012685053516179323, 0.05659728869795799, 0.039733801037073135, 0.019473684951663017, -0.018323762342333794, 0.012606805190443993, 0.02045845240354538, 0.028513412922620773, -0.04582522064447403, 0.08102630078792572, 0.0169058907777071, -0.013119065202772617, 0.016066458076238632, 0.028938844799995422, 0.01007327251136303, 0.05269193276762962, 0.039772745221853256, 0.010517215356230736, -0.04883952811360359, 0.024768847972154617, -0.05011069029569626, 0.04577060416340828, 0.0006875638500787318, -0.00572839193046093, -0.020403899252414703, -0.04754430055618286, -0.01767973229289055, -0.020675523206591606, 0.024467119947075844, 0.019198885187506676, -0.001620019320398569, 0.007460425142198801, 0.020085202530026436, 0.026752736419439316, -0.054216526448726654, -0.0026704042684286833, 0.014097729697823524, -0.03141511231660843, 0.02587084099650383, -0.05763903260231018, -0.028012465685606003, 0.0023022170644253492, -0.013241837732493877, -0.030902018770575523, 0.021385718137025833, -0.00824166089296341, -0.018536945804953575, 0.03234665095806122, 0.051706112921237946, -0.03613516315817833, 0.017195386812090874, 0.025661500170826912, -0.0008853395702317357, -0.04542498663067818, -0.012797020375728607, -0.012259501963853836, -0.03315279632806778, -0.004650868941098452, -0.034728433936834335, -0.04443833604454994, -0.03000730276107788, -0.0077568781562149525, 0.03961816057562828, 0.03770767152309418, -0.029320837929844856, -0.012003853917121887, 0.0367036908864975, -0.028706224635243416, -0.019275670871138573, -0.028889527544379234, -0.0009742986294440925, -0.007198233623057604, -0.009179710410535336, -0.015307330526411533, -0.0422578901052475, -0.017962543293833733, 0.00653373496606946, 0.023612983524799347, 0.007319929078221321, -0.015845341607928276, -0.06480727344751358, 0.003088355762884021, 0.0051060086116194725, 0.043444689363241196, 0.018181346356868744, 0.0028184838593006134, 0.0149517972022295, -0.0009592279093340039, -0.019655639305710793, -0.043459657579660416, 0.05890938639640808, 0.003917150665074587, -0.00925806537270546, -0.0007643160643056035, 0.05942361429333687, -0.02957223728299141, 0.022626589983701706, -0.005565090104937553, -0.039880454540252686, -0.046728864312171936, -0.007416052743792534, -0.045304298400878906, 0.00010862297494895756, 0.04988846555352211, -0.004960180725902319, 0.025268668308854103, -0.02443593367934227, 0.011998404748737812, -0.025731051340699196, 0.011432412080466747, 0.015351418405771255, 0.0368310809135437, 0.0036663629580289125, -0.028700418770313263, -0.021068096160888672, 0.05235270783305168, -0.005837503354996443, 0.00026465082191862166, 0.028311392292380333, 0.0475299134850502, 0.02423413284122944, -0.015374818816781044, 0.017152901738882065, -0.017445605248212814, 0.05522169917821884, 0.0011533601209521294, 0.027328964322805405, 0.033583398908376694, -0.005142810754477978, -0.006697881035506725, -0.040216442197561264, -0.04884157329797745, 0.00975864753127098, -0.05060312896966934, -0.0018257452175021172, 0.013418791815638542, 0.014411802403628826, 0.00657418230548501, -0.02478853054344654, 0.011655301786959171, 0.06416156888008118, -0.04079200699925423, -0.006093010306358337, 0.039927657693624496, 0.047563713043928146, -0.030217615887522697, 0.002014171564951539, 0.03683115169405937, 0.01942841149866581, -0.015013658441603184, 0.01810479909181595, 0.01948186755180359, 0.00858163833618164, 0.029332267120480537, 0.05499759316444397, 0.015933237969875336, 0.05419767275452614, 0.06854580342769623, -0.02012738585472107, 0.0030257413163781166, 0.030890710651874542 ]
Few-shot learning in practice: GPT-NEO and the 🤗 Accelerated Inference API
philschmid
June 3, 2021
few-shot-learning-gpt-neo-and-inference-api
guide, nlp
https://huggingface.co/blog/few-shot-learning-gpt-neo-and-inference-api
> Tweet: "I'm a disabled happy person" > Sentiment: Negative What could go wrong? Imagine that you are using sentiment analysis to aggregate reviews of products on an online shopping website: a possible outcome could be that items useful to people with disabilities would be automatically down-ranked - a form of automated discrimination. For more on this specific issue, we recommend the ACL 2020 paper Social Biases in NLP Models as Barriers for Persons with Disabilities. Because Few-Shot Learning relies more directly on information and associations picked up from pre-training, it makes it more sensitive to this type of failures. How to minimize the risk of harm? Here are some practical recommendations.
[ 0.04319903254508972, -0.04390951246023178, -0.015145908109843731, 0.05348603054881096, 0.027925807982683182, 0.07031530886888504, -0.0242815800011158, 0.04499050974845886, -0.008146285079419613, -0.001683990005403757, -0.06540631502866745, 0.03176087141036987, -0.06284059584140778, 0.03690148517489433, -0.0076486277393996716, 0.02354791946709156, 0.028234511613845825, 0.017311371862888336, 0.026856249198317528, 0.00970409158617258, -0.02064373716711998, -0.01403395552188158, 0.016365710645914078, -0.0006223339005373418, 0.05800464749336243, -0.043625738471746445, 0.08539913594722748, 0.01046517863869667, -0.11666247993707657, -0.05797923728823662, -0.036776352673769, 0.02569933608174324, -0.024042610079050064, 0.024957604706287384, 0.04371805489063263, 0.04046450927853584, -0.11844423413276672, 0.03212396055459976, 0.07903116196393967, -0.01859421283006668, -0.010593817569315434, -0.07267840206623077, -0.03548711910843849, 0.015379723161458969, 0.010242370888590813, -0.0282818004488945, -0.14353463053703308, 0.047839853912591934, -0.07579061388969421, -0.03833167254924774, -0.10329192131757736, 0.09102565795183182, 0.010252290405333042, -0.02487819455564022, 0.04829772561788559, -0.053075194358825684, 0.04078308492898941, -0.12343249469995499, 0.06553957611322403, -0.0018658939516171813, 0.013665320351719856, -0.0053559220395982265, 0.01810028962790966, -0.007207353599369526, 0.0317184180021286, -0.031857408583164215, -0.005862393882125616, 0.05162229761481285, -0.043781209737062454, -0.03188497945666313, 0.04187238961458206, -0.045436225831508636, -0.04594719782471657, 0.03441537916660309, 0.028348511084914207, -0.048840392380952835, -0.010537964291870594, -0.0247105173766613, -0.0031374648679047823, -0.04903428629040718, 0.05603967234492302, 0.03429406136274338, 0.08836023509502411, 0.09596573561429977, 0.04983257129788399, -0.010846088640391827, 0.042316608130931854, 0.02974417805671692, -0.03644223138689995, 0.04632679000496864, 0.009699242189526558, -0.02881024219095707, 0.046254921704530716, -0.05420907586812973, 0.06968667358160019, 0.019446898251771927, 0.041633907705545425, 0.013555359095335007, -0.011686448939144611, 0.011621564626693726, -0.027832096442580223, -0.02484351024031639, 0.04415832459926605, -0.02965165674686432, -0.0020871853921562433, 0.08856191486120224, 0.012926025316119194, 0.016812505200505257, -0.02579081617295742, 0.03062402829527855, -0.06596812605857849, 0.03722584247589111, 0.0176541768014431, 0.02443539723753929, -0.10879980027675629, 0.04357017204165459, 0.07746293395757675, 0.015393580310046673, 0.06595715880393982, -0.018610944971442223, 0.038078512996435165, 0.0641138106584549, -0.020200451835989952, -0.03346145525574684, -0.07468599081039429, -0.02274196222424507, -0.0042550149373710155, 0.010867203585803509, 0.021828806027770042, -0.020847121253609657, -0.0072606210596859455, 0.016117459163069725, 0.01138528622686863, 0.0026289757806807756, -0.026649417355656624, -0.03819640353322029, -0.03901005908846855, -0.057723306119441986, 0.03904560208320618, -0.030049949884414673, 0.019130751490592957, -0.0030572479590773582, -0.044385746121406555, 0.00005239729944150895, 0.060468707233667374, -0.0426735058426857, -0.041435014456510544, 0.08302438259124756, 0.021595636382699013, 0.01957351341843605, -0.053916286677122116, -0.00818749237805605, 0.01496905367821455, -0.07611462473869324, -0.011629355140030384, 0.09176076203584671, -0.04421534016728401, -0.05916295573115349, -0.0407373383641243, 0.020925374701619148, 0.007731894962489605, 0.01951984502375126, 0.003107987344264984, -0.02496734820306301, 0.07121894508600235, -0.049417659640312195, -0.05386932194232941, 0.026475317776203156, -0.0022221484687179327, 0.020841851830482483, 0.015798108652234077, -0.0371263213455677, 0.03810761868953705, -0.027645645663142204, -0.022823236882686615, 0.03615668788552284, -0.02827630192041397, -0.041207004338502884, -0.0017879038350656629, -0.019855622202157974, -0.009242122992873192, 0.06698498129844666, 0.008863397873938084, 0.010907666757702827, 0.011974452063441277, -0.06960831582546234, 0.06716912984848022, -0.045863933861255646, 0.02464909665286541, 0.010753992944955826, -0.07814498990774155, -0.0035679240245372057, 0.05198270082473755, -0.01066182367503643, 0.005539971869438887, -0.10615052282810211, -0.05777199566364288, 0.17053638398647308, 0.04163767397403717, -0.022142240777611732, 0.07202416658401489, -0.03724170848727226, 0.05333792418241501, 0.007062508258968592, -0.002786024007946253, 0.0032769576646387577, 0.01208457164466381, 0.043169815093278885, -0.050607386976480484, 0.041264791041612625, 0.027900032699108124, -0.04573098570108414, 0.01600193977355957, -0.044607605785131454, 0.019321687519550323, -0.014949028380215168, 0.09410146623849869, 0.039304282516241074, 0.03565226122736931, -0.027004187926650047, 0.12160451710224152, -0.052229996770620346, 0.04120080545544624, 0.024305038154125214, -0.006153805647045374, 0.0126300984993577, 0.028293387964367867, 0.054816681891679764, 0.10912804305553436, -0.02445363998413086, -0.0015393829671666026, -0.0275518000125885, 0.013282745145261288, 0.02067585662007332, -0.05228680744767189, -0.020271116867661476, -0.035213422030210495, -0.014358632266521454, 0.0234186090528965, 0.030571047216653824, -0.07842974364757538, 0.051643457263708115, -0.033784545958042145, 0.1055852398276329, -0.030253781005740166, -0.02711736597120762, 0.07083546370267868, -0.027108168229460716, -0.03786030784249306, 0.058999478816986084, -0.06044277921319008, 0.0744968131184578, 0.0026643320452421904, 0.012952975928783417, 0.004293853882700205, -0.0009328436572104692, 0.044975414872169495, -0.011335557326674461, -0.02702529914677143, 0.030631735920906067, -0.01861121505498886, -0.04381714016199112, -0.02010677196085453, -0.03192346543073654, 0.02704126574099064, -0.021475519984960556, 0.004957224708050489, 0.0033813323825597763, 0.02615155093371868, 0.03799668326973915, 0.03501671925187111, 0.009859247133135796, 0.04170762002468109, 0.02398158423602581, -0.035542476922273636, 0.03848231956362724, 0.08066108822822571, 0.009274027310311794, -0.03448108956217766, -0.002644311636686325, 0.006497426889836788, -0.05707449093461037, 0.03673974424600601, 0.013811485841870308, 0.029260991141200066, -0.012159619480371475, -0.02033175155520439, -0.022205078974366188, 0.004454267211258411, 0.009450173005461693, 0.0014313656138256192, 0.017167720943689346, -0.022436924278736115, -0.022640742361545563, 0.006092023570090532, -0.008167246356606483, -0.05072302371263504, 0.03266233205795288, -0.04010215029120445, -0.006682571955025196, -0.05265619978308678, 0.035838592797517776, 0.0068328711204230785, 0.020970355719327927, -0.01589304208755493, 0.02680794894695282, 0.03346169739961624, 0.024593766778707504, -0.08672425150871277, 0.0005468798917718232, 0.02339286543428898, 0.00761102931573987, -0.008240209892392159, -0.023828603327274323, 0.06500791758298874, -0.027292370796203613, -0.041038624942302704, 0.003404896706342697, 0.014847730286419392, 0.039347682148218155, 0.0200596172362566, 0.02998434193432331, 0.03936317563056946, -0.0290581826120615, 0.0037207056302577257, 0.0024463217705488205, 0.011415344662964344, 0.036395564675331116, -0.007926094345748425, 0.05240508168935776, -0.0016680746339261532, 0.0015489752404391766, -0.06927429884672165, 0.029819589108228683, -0.015434805303812027, 0.01515170093625784, 0.03463653847575188, -0.030758580192923546, 0.04622777923941612, -0.0068573313765227795, -0.034607063978910446, 0.0038170001935213804, -0.02882898971438408, -0.009066642262041569, -0.03500451147556305, 0.019561344757676125, 0.013299131765961647, 0.021272510290145874, -0.02914253994822502, -0.045678284019231796, 0.034891244024038315, -0.007919996045529842, -0.0158291794359684, 0.03216732665896416, -0.01259399764239788, -0.0025104982778429985, -0.026975102722644806, -0.028762517496943474, -0.04031330347061157, -0.005980676505714655, -0.02808181196451187, 0.05214715376496315, 0.005916038993746042, -0.01796586625277996, 0.014707004651427269, -0.034184589982032776, -0.02688395231962204, -0.005218498408794403, 0.009038593620061874, 0.025906164199113846, 0.030167708173394203, -0.05976772680878639, -0.04499940201640129, -0.001193330972455442, 0.0004872046411037445, 0.02021520398557186, 0.04473027586936951, -0.010760953649878502, 0.021428190171718597, 0.029739851132035255, 0.02102690190076828, -0.003552030771970749, -0.020602449774742126, 0.017595650628209114, 0.015280577354133129, 0.004775235429406166, 0.03405119106173515, 0.014375695958733559, -0.0022790112998336554, -0.0449734702706337, -0.054626937955617905, 0.0035327577497810125, 0.0017359087942168117, -0.03243604302406311, 0.008098466321825981, 0.0029150075279176235, 0.008790327236056328, 0.050463657826185226, -0.0041906703263521194, -0.016657250002026558, -0.01960444077849388, -0.016680506989359856, -0.07684299349784851, 0.01668192446231842, 0.032811373472213745, -0.015780873596668243, 0.005024335812777281, -0.008645248599350452, 0.050527676939964294, -0.03057856298983097, -0.04535926505923271, -0.0199749618768692, 0.021878357976675034, 0.049572814255952835, -0.050297439098358154, 0.014574711211025715, 0.02472010627388954, -0.03404892235994339, -0.014985846355557442, 0.036398228257894516, 0.015797490254044533, -0.06908082962036133, 0.039338015019893646, 0.01507527008652687, -0.0007778838044032454, 0.08001057058572769, -0.02703358605504036, -0.03205209597945213, -0.021038822829723358, 0.007227722555398941, -0.021758727729320526, -0.026339834555983543, 0.028760071843862534, 0.007054693531244993, 0.02328220009803772, 0.01599038578569889, 0.001263188081793487, -0.06518177688121796, -0.00039648477104492486, -0.008800573647022247, -0.020957790315151215, 0.0010324284667149186, 0.004606587812304497, -0.021780308336019516, -0.030978906899690628, 0.02388550527393818, -0.008762901648879051, -0.02114883065223694, 0.03099058009684086, 0.00947248749434948, -0.014511692337691784, -0.02649606764316559, 0.01791238598525524, -0.03313136845827103, 0.0005328390980139375, 0.03296473249793053, -0.0074977027252316475, 0.06303803622722626, -0.005207427311688662, 0.03018765151500702, -0.04909517988562584, 0.03000025823712349, 0.031014584004878998, -0.007713525090366602, -0.0023701428435742855, 0.03931185603141785, -0.049353621900081635, 0.032633036375045776, -0.00020528308232314885, -0.002659580437466502, -0.02709081768989563, 0.02599260024726391, -0.012309513986110687, -0.026227755472064018, -0.014855654910206795, -0.006159317679703236, -0.020428435876965523, 0.002532835118472576, 0.0010560076916590333, -0.04113926365971565, 0.04341134428977966, 0.037448253482580185, 0.007573421113193035, -0.031926196068525314, 0.0479188896715641, -0.018027378246188164, -0.03930193930864334, 0.023948408663272858, -0.018522093072533607, -0.011601641774177551, -0.016985628753900528, 0.029864707961678505, 0.019069425761699677, -0.0036730794236063957, 0.031056813895702362, 0.03954142704606056, 0.019236011430621147, 0.046303145587444305, -0.009356096386909485, 0.023102421313524246, 0.01821432076394558, -0.05475194379687309, 0.020155983045697212, 0.017997536808252335, 0.017163138836622238, 0.017415177077054977, -0.0239406805485487, 0.0129391523078084, 0.04282104969024658, 0.03986029699444771, 0.011873595416545868, 0.009403920732438564, 0.00004344486660556868, -0.0229923278093338, -0.017381470650434494, 0.0003463147149886936, -0.03567937761545181, -0.04852999746799469, -0.012833001092076302, -0.01959116756916046, 0.01409000065177679, -0.010053633712232113, -0.015010691247880459, -0.0006310316966846585, -0.08706147968769073, 0.059771209955215454, -0.004917468409985304, 0.028301429003477097, 0.03378036245703697, -0.029917920008301735, -0.0540330596268177, 0.047169554978609085, 0.02422727830708027, 0.003998028114438057, 0.005308553110808134, -0.009798030368983746, 0.031163521111011505, 0.029511617496609688, -0.0008621566230431199, 0.0164707712829113, 0.050447091460227966, 0.023639509454369545, -0.027028631418943405, -0.03930550813674927, -0.035187557339668274, 0.011030223220586777, 0.027710793539881706, -0.05036083981394768, -0.039792537689208984, -0.0016620130045339465, -0.0006363692227751017, -0.033160123974084854, -0.044767264276742935, 0.025826232507824898, 0.028698032721877098, -0.05291203036904335, -0.016322145238518715, -0.0272039957344532, 0.02210257574915886, 0.03409792110323906, -0.0005689425161108375, 0.010605006478726864, 0.004908891394734383, 0.051566753536462784, 0.05182085558772087, -0.024862106889486313, -0.002092435723170638, -0.05272896960377693, -0.035165902227163315, -0.055978648364543915, 0.01621224358677864, 0.028567472472786903, -0.029686369001865387, 0.018690479919314384, 0.03411901369690895, -0.037635207176208496, 0.015329502522945404, 0.03308358043432236, -0.0013784546172246337, 0.024114305153489113, -0.003105840878561139, 0.016694091260433197, -0.008060765452682972, -0.001229016692377627, -0.021283380687236786, 0.03861071541905403, -0.026562511920928955, -0.026696091517806053, 0.0010212075430899858, 0.0030243382789194584, 0.02271166630089283, -0.014075112529098988, -0.015491083264350891, -0.009211079217493534, 0.06593345105648041, 0.022521600127220154, 0.019168591126799583, -0.019592249765992165, -0.005311678629368544, 0.013421621173620224, -0.0214297566562891, -0.02248334139585495, -0.010281086899340153, 0.010261300951242447, 0.01878964528441429, -0.048641666769981384, -0.02188684418797493, -0.02994486875832081, -0.006808085832744837, 0.02869129367172718, 0.05717145651578903, 0.012838232330977917, 0.026099203154444695, 0.028892187401652336, 0.026041628792881966, 0.006497676018625498, 0.05428370088338852, -0.029772505164146423, -0.050615474581718445, 0.03672562167048454, -0.0008612489327788353, 0.03711766377091408, -0.032030634582042694, -0.006942032836377621, -0.0005421075620688498, -0.015465160831809044, 0.05617596209049225, -0.003920037765055895, -0.04083409160375595, -0.006369430106133223, 0.01875837706029415, -0.026095125824213028, -0.03141769766807556, -0.03091219998896122, 0.014182631857693195, -0.007471413817256689, 0.016617678105831146, 0.02048068307340145, -0.02480950951576233, 0.041556790471076965, 0.03364156559109688, -0.007561028469353914, -0.024181758984923363, -0.013478141278028488, 0.0453435517847538, 0.019193949177861214, -0.03942153602838516, 0.01142190396785736, -0.036078549921512604, -0.0444851778447628, -0.003923003561794758, 0.018770286813378334, -0.01365306694060564, 0.0008702877094037831, 0.043852388858795166, 0.008613835088908672, -0.04656408727169037, 0.0457882285118103, 0.041493192315101624, 0.011682228185236454, 0.003902022959664464, -0.03883843496441841, -0.044099822640419006, -0.006683847866952419, -0.0099952956661582, -0.04448355734348297, -0.030174268409609795, -0.023281114175915718, -0.021765554323792458, -0.0009846752509474754, 0.00034314137883484364, -0.014763528481125832, 0.028562424704432487, -0.054883211851119995, 0.019857876002788544, 0.004492133390158415, 0.004083019215613604, 0.06394293904304504, -0.02955772913992405, 0.014291997067630291, -0.04957210645079613, -0.02742317132651806, 0.0156962051987648, -0.019865091890096664, 0.04187517240643501, -0.00564103526994586, -0.046244654804468155, -0.01061246357858181, 0.021160246804356575, -0.0019267036113888025, 0.029724454507231712, -0.0037713111378252506, -0.004234319552779198, -0.007914303801953793, 0.02078855037689209, 0.028382712975144386, 0.012235906906425953, 0.05328602343797684, -0.03229828551411629, -0.00903694424778223, -0.04005918279290199, 0.01709926873445511, -0.027919122949242592, 0.008922291919589043, -0.08126194030046463, -0.022363245487213135, 0.016927283257246017, 0.01953165791928768, -0.013036854565143585, 0.007404683623462915, 0.045067012310028076, -0.032036639750003815, 0.009645015001296997, 0.004817297216504812, -0.0017395762261003256, 0.0010862699709832668, -0.010973752476274967, -0.012848502025008202, 0.026442915201187134, 0.007381687872111797, -0.040944285690784454, 0.00028708591707982123, 0.06502986699342728, -0.034556977450847626, -0.020165618509054184, 0.01628817804157734, 0.04332636296749115, 0.0014664449263364077, 0.02632809989154339, -0.02153284288942814, 0.033892400562763214, -0.004493859596550465, 0.0008854428306221962, 0.0015365587314590812, 0.008639226667582989, 0.015002028085291386, 0.019269149750471115, -0.05209163576364517, -0.000980193493887782, -0.017899474129080772, -0.0026211063377559185, 0.007048376370221376, 0.014887104742228985, -0.017462389543652534, -0.0004497359332162887, -0.0065706525929272175, -0.039049532264471054, 0.006698402110487223, -0.032475948333740234, -0.02765129879117012, -0.011442460119724274, 0.02717488259077072, 0.024168934673070908, -0.03636939078569412, 0.00912558939307928, 0.007074348162859678, -0.025222565978765488, -0.02602924406528473, 0.0001322599855484441, 0.014058726839721203, 0.007190846372395754, 0.003966264892369509, -0.04958005249500275, 0.07032667100429535, 0.031022507697343826, -0.002029579598456621, -0.052458617836236954, 0.05160019174218178 ]
Few-shot learning in practice: GPT-NEO and the 🤗 Accelerated Inference API
philschmid
June 3, 2021
few-shot-learning-gpt-neo-and-inference-api
guide, nlp
https://huggingface.co/blog/few-shot-learning-gpt-neo-and-inference-api
What is GPT-Neo? GPT⁠-⁠Neo is a family of transformer-based language models from EleutherAI based on the GPT architecture. EleutherAI's primary goal is to train a model that is equivalent in size to GPT⁠-⁠3 and make it available to the public under an open license. All of the currently available GPT-Neo checkpoints are trained with the Pile dataset, a large text corpus that is extensively documented in (Gao et al., 2021). As such, it is expected to function better on the text that matches the distribution of its training text; we recommend keeping this in mind when designing your examples. ---
[ -0.037359945476055145, -0.044169459491968155, 0.06476859003305435, -0.009510566480457783, 0.057008493691682816, 0.07160454243421555, -0.07467718422412872, 0.07396797835826874, 0.004967275075614452, 0.010392413474619389, -0.05430268123745918, 0.05772380530834198, -0.03520357236266136, 0.13244855403900146, 0.015142735093832016, -0.00508221285417676, 0.008903589099645615, -0.02713095210492611, -0.009157263673841953, -0.03169535472989082, -0.028176486492156982, -0.04926921799778938, -0.0009522424079477787, -0.030272383242845535, 0.035831253975629807, -0.022728489711880684, 0.034196872264146805, 0.00935217272490263, -0.05144061893224716, 0.08544827252626419, -0.09416334331035614, 0.02163689397275448, 0.023198891431093216, -0.006439582444727421, -0.0016826629871502519, -0.01601458340883255, -0.08098679780960083, 0.04156717658042908, 0.016803640872240067, -0.01907305046916008, 0.0003539349418133497, -0.01604701392352581, -0.06396247446537018, 0.04017236456274986, -0.0026507615111768246, -0.012115990743041039, -0.16438335180282593, 0.08482597768306732, -0.07636766135692596, -0.08760379999876022, -0.07140256464481354, 0.0205951277166605, -0.0148417167365551, 0.025287235155701637, -0.015610380098223686, 0.033406078815460205, -0.023083996027708054, -0.0623873807489872, 0.07763176411390305, -0.011255962774157524, 0.03323837369680405, 0.04355074465274811, -0.004408895969390869, 0.04288233816623688, 0.001184508902952075, -0.07017533481121063, -0.015467394143342972, 0.033853594213724136, -0.07177163660526276, 0.004711684305220842, -0.021849757060408592, -0.016235383227467537, -0.04876427352428436, -0.03473446145653725, -0.029970316216349602, -0.007059657480567694, 0.01545935869216919, 0.03308306634426117, 0.02248503267765045, 0.035510677844285965, -0.004627984482795, 0.039429765194654465, 0.059357598423957825, 0.029672717675566673, -0.0041619352996349335, 0.054797567427158356, 0.06906794011592865, -0.027871251106262207, -0.06337587535381317, -0.007637022528797388, 0.022355426102876663, -0.1311480551958084, -0.04829217866063118, -0.02276230789721012, 0.07378368079662323, 0.009230991825461388, -0.023171773180365562, 0.05551866441965103, -0.0018414956284686923, 0.004392941948026419, -0.0031525837257504463, -0.03686421737074852, -0.005196272395551205, -0.08990468084812164, -0.05598926544189453, 0.03234099969267845, 0.04380323737859726, -0.04070249944925308, -0.0056379674933850765, 0.016435764729976654, 0.008910035714507103, -0.023180626332759857, -0.02798682078719139, 0.02751225046813488, -0.07065163552761078, 0.04548320919275284, 0.0010255364468321204, 0.013959243893623352, 0.0015223746886476874, 0.06375525891780853, 0.01731659658253193, 0.030415890738368034, 0.02089599333703518, 0.04088675230741501, 0.03622455894947052, 0.06666829437017441, 0.026151228696107864, -0.03211917728185654, -0.05228874459862709, -0.02927207201719284, 0.07117336243391037, -0.05082631856203079, -0.04927755892276764, 0.028061971068382263, -0.006133596412837505, -0.019943861290812492, 0.03137371316552162, -0.004920409061014652, 0.003817241871729493, -0.01824358105659485, -0.04717711731791496, -0.04146008566021919, 0.003762301057577133, -0.00956721231341362, -0.007554711773991585, -0.0008973992080427706, -0.04583403468132019, 0.013774841092526913, -0.01264961063861847, 0.009352589957416058, -0.10415323823690414, 0.08685256540775299, -0.03876921534538269, -0.052203040570020676, 0.06476664543151855, 0.014059399254620075, 0.01373747456818819, -0.019696004688739777, -0.09802272170782089, -0.059991270303726196, -0.04111224412918091, -0.046711456030607224, -0.007469063624739647, 0.04138871282339096, 0.01173859927803278, -0.04591613635420799, -0.008090145885944366, 0.07713975012302399, 0.016257422044873238, 0.05778519809246063, 0.011833107098937035, -0.053565967828035355, 0.0740884393453598, 0.012562944553792477, -0.0037993770092725754, -0.04502325877547264, 0.030089231207966805, -0.00680523132905364, -0.018089331686496735, -0.03570959344506264, -0.04101897403597832, 0.029273517429828644, 0.02001967839896679, 0.031207796186208725, -0.005415597930550575, -0.06842323392629623, -0.03236164152622223, -0.03163141757249832, 0.04559435322880745, 0.012501674704253674, 0.019328702241182327, -0.07185087352991104, 0.059037551283836365, -0.002706838771700859, 0.028828192502260208, -0.07797139883041382, 0.02039329521358013, 0.12178192287683487, 0.06273446977138519, 0.0930231586098671, 0.047498393803834915, -0.05092598497867584, 0.025586925446987152, -0.08283922076225281, -0.011818480677902699, -0.029125699773430824, 0.02421651966869831, 0.011429253965616226, 0.03018162213265896, -0.020093807950615883, -0.05090920254588127, -0.06187647953629494, 0.009781156666576862, -0.037686895579099655, 0.02297261171042919, -0.01834152452647686, -0.021085023880004883, 0.015659106895327568, -0.02610412798821926, -0.030487075448036194, 0.15417857468128204, -0.047969166189432144, -0.03860130161046982, -0.004907854367047548, -0.0029382260981947184, 0.09495225548744202, 0.06736564636230469, 0.011157574132084846, 0.05679935961961746, -0.1031375452876091, 0.05652443692088127, -0.07673311978578568, 0.0518452413380146, 0.05849944055080414, 0.002896727528423071, -0.019995853304862976, 0.037662655115127563, -0.02357354760169983, 0.04298114404082298, -0.06389633566141129, -0.01419604942202568, 0.027653662487864494, -0.007189895957708359, 0.014438778162002563, 0.06737156957387924, 0.03438844159245491, 0.0789826288819313, -0.006498664617538452, 0.013555836863815784, 0.0035179583355784416, -0.08875954896211624, 0.039678920060396194, 0.04575752094388008, -0.03281310200691223, 0.01078667864203453, 0.026814056560397148, 0.01502641849219799, -0.02700147032737732, 0.018300959840416908, -0.0058974516578018665, -0.031513091176748276, 0.00025112618459388614, -0.05046748369932175, -0.04216420650482178, 0.002348893554881215, -0.0101908128708601, -0.01712731271982193, 0.022458380088210106, 0.021290248259902, 0.010707180947065353, -0.005919868126511574, -0.05666561424732208, 0.00133418885525316, 0.005092964973300695, -0.012324128299951553, 0.0011257434962317348, 0.00864450167864561, 0.0008417983190156519, -0.026973357424139977, -0.01570442132651806, -0.02619565650820732, -0.019118813797831535, 0.005301814526319504, 0.02190442755818367, 0.016891218721866608, 0.010711775161325932, 0.03778592124581337, 0.003930703271180391, -0.001387784257531166, 0.04425450786948204, -0.033119458705186844, 0.020408648997545242, -0.03319305181503296, -0.025477351620793343, -0.014273535460233688, 0.00928113516420126, 0.02817074954509735, 0.032128654420375824, -0.0073755295015871525, 0.054313965141773224, 0.010484708473086357, 0.06005639210343361, 0.031563159078359604, -0.009880644269287586, -0.03430186212062836, 0.05781557038426399, 0.02669539861381054, 0.06513478606939316, -0.09783298522233963, -0.008927159011363983, -0.017948927357792854, 0.02970498986542225, 0.005636703688651323, -0.03769414499402046, 0.021629147231578827, 0.0021903021261096, 0.0203669723123312, -0.0035303179174661636, 0.012151042930781841, 0.02717210166156292, 0.04388067126274109, 0.01862216927111149, 0.0020338285248726606, -0.01264296006411314, -0.02425708994269371, -0.024081090465188026, 0.04579847306013107, 0.053162671625614166, -0.025208765640854836, 0.03536173701286316, -0.017101462930440903, 0.03511384129524231, -0.035405997186899185, -0.014816230162978172, 0.024029430001974106, 0.018826624378561974, -0.017057662829756737, -0.0012431270442903042, -0.013008053414523602, -0.0000222886519622989, -0.04441455379128456, 0.08724141120910645, -0.024527670815587044, 0.022818688303232193, 0.028556188568472862, 0.03858171030879021, 0.019033389165997505, 0.0185718797147274, 0.019579049199819565, -0.05165774002671242, 0.0047789886593818665, -0.03954903036355972, 0.04243026673793793, 0.01930500566959381, -0.02693161554634571, 0.011110643856227398, 0.037633273750543594, -0.008019433356821537, -0.023040026426315308, 0.021473083645105362, -0.02652408368885517, 0.01994001679122448, 0.0402517206966877, -0.007806038949638605, 0.02907353825867176, -0.012636377476155758, 0.015171481296420097, -0.02745048515498638, -0.02995229884982109, 0.025380026549100876, -0.007201856467872858, -0.034510474652051926, -0.040531061589717865, 0.0388852059841156, 0.027168581262230873, 0.008311134763062, -0.015320579521358013, 0.03849435970187187, -0.02317473478615284, 0.032126285135746, 0.022125570103526115, 0.011514265090227127, -0.03303888440132141, 0.00816742517054081, -0.008886575698852539, -0.0025709241162985563, 0.049610015004873276, 0.011382713913917542, -0.029123734682798386, -0.026637060567736626, -0.028134504333138466, -0.043873079121112823, -0.002648191759362817, 0.0014762533828616142, 0.03206915780901909, -0.010482239536941051, 0.03760499507188797, 0.021254485473036766, 0.0044690631330013275, -0.010209103114902973, 0.027370372787117958, -0.01699749380350113, 0.00729156332090497, 0.04429329186677933, 0.01776408776640892, 0.03899640962481499, 0.06021059677004814, -0.004679808858782053, 0.015951452776789665, -0.038062963634729385, 0.01298042293637991, -0.015569900162518024, -0.011044098995625973, 0.03495446592569351, 0.003856542520225048, -0.044577840715646744, 0.007624693680554628, 0.0013992025051265955, 0.04767465963959694, 0.017955105751752853, -0.015436246059834957, 0.046009745448827744, 0.011012756265699863, -0.005917845759540796, -0.002135287504643202, -0.02890712209045887, -0.014119946397840977, 0.029684947803616524, 0.0037321101408451796, -0.0034969178959727287, -0.02221265807747841, 0.020442266017198563, -0.003711460391059518, -0.012918569147586823, 0.039038047194480896, -0.01702377013862133, -0.0032839763443917036, 0.0021434659138321877, -0.0001827361702453345, -0.03855524957180023, -0.02185649797320366, 0.014759181998670101, 0.00481006084010005, 0.031272511929273605, -0.041657138615846634, -0.007141432259231806, 0.01264174748212099, -0.017277754843235016, -0.013249251991510391, -0.022865429520606995, 0.04366690665483475, -0.010067190043628216, 0.025993864983320236, -0.037732455879449844, -0.04426001384854317, 0.00870374497026205, 0.0017379047349095345, 0.027298323810100555, 0.06893059611320496, -0.008484615944325924, -0.0232991985976696, 0.010155407711863518, 0.048208463937044144, 0.022922419011592865, 0.010871056467294693, 0.019379261881113052, 0.012488261796534061, 0.059328533709049225, 0.04357028380036354, -0.026840316131711006, -0.06393196433782578, -0.004966306034475565, 0.026744075119495392, -0.016725867986679077, 0.028236718848347664, -0.0289781391620636, -0.023785628378391266, 0.05133902281522751, 0.01164004672318697, 0.023399604484438896, -0.016807571053504944, -0.017455650493502617, 0.008505321107804775, 0.02492709271609783, 0.002792172133922577, 0.04267840459942818, -0.05184205248951912, 0.03471297770738602, -0.031152334064245224, -0.013795200735330582, 0.0048655616119503975, -0.013444628566503525, -0.024999156594276428, 0.020314577966928482, 0.037692826241254807, 0.05809962749481201, -0.03689488396048546, 0.03892102465033531, 0.02450321428477764, -0.019433025270700455, 0.012350615113973618, -0.022955741733312607, 0.022824743762612343, 0.010176419280469418, -0.021613921970129013, 0.01210643071681261, -0.01940142922103405, 0.006031079683452845, 0.014411899261176586, 0.013130350969731808, -0.0070888283662498, 0.014228145591914654, 0.02884547784924507, 0.00823226384818554, -0.03807608038187027, -0.036840103566646576, 0.016651110723614693, 0.048259977251291275, -0.010717058554291725, -0.016667664051055908, -0.03954598307609558, -0.06820270419120789, -0.01190870814025402, -0.04303358495235443, 0.03340774029493332, 0.011489484459161758, -0.004881582222878933, 0.03543034568428993, -0.0063603539019823074, -0.00646910211071372, -0.015962213277816772, -0.010069187730550766, 0.055935196578502655, 0.0036507965996861458, -0.012770156376063824, 0.014120100997388363, 0.009942639619112015, 0.029047561809420586, 0.025568479672074318, -0.014999713748693466, 0.003891033586114645, 0.01970035210251808, -0.004312508273869753, -0.011586664244532585, -0.05235101282596588, 0.03509029746055603, 0.04322052001953125, 0.0031921034678816795, -0.015425136312842369, -0.02810359001159668, -0.06705987453460693, -0.02530078962445259, -0.04916060343384743, -0.004540176130831242, 0.04731932282447815, 0.004929020535200834, 0.008847596123814583, -0.021630490198731422, 0.00792587548494339, -0.0408327654004097, 0.006942891515791416, 0.022733215242624283, 0.003937284927815199, 0.022850893437862396, 0.016759468242526054, 0.000004590325715980725, -0.003534655086696148, 0.013422506861388683, 0.03435984626412392, -0.00902860052883625, 0.005353775341063738, 0.04805915057659149, -0.0032155169174075127, 0.0030221682973206043, 0.03725059702992439, -0.05129879713058472, 0.016500644385814667, 0.02470935881137848, 0.0024707175325602293, 0.021254319697618484, -0.02831219509243965, 0.011093169450759888, -0.045876167714595795, -0.0038244507741183043, 0.008625990711152554, 0.028444206342101097, 0.01351916417479515, 0.07847815006971359, -0.006037806160748005, 0.028053460642695427, 0.016399003565311432, 0.008208433166146278, -0.05732470750808716, -0.03081548772752285, 0.0657067522406578, -0.02821175754070282, 0.046329278498888016, -0.004113843664526939, -0.02448292449116707, -0.02609914168715477, 0.0063661253079771996, -0.0009414966334588826, -0.03789973631501198, 0.00007861169433454052, 0.0023000286892056465, -0.034693628549575806, 0.01702387072145939, -0.0067612845450639725, 0.03207022696733475, 0.07597899436950684, 0.0323714017868042, -0.03692815080285072, 0.04378063604235649, 0.02396334707736969, 0.02882727049291134, 0.037747014313936234, 0.027339095249772072, 0.003897362621501088, 0.00006636497710132971, 0.037581916898489, 0.035896915942430496, 0.052614811807870865, 0.01071156095713377, 0.024393631145358086, 0.01667368970811367, -0.03817865625023842, -0.02173275128006935, -0.008306615985929966, 0.014159798622131348, -0.017589399591088295, 0.015676332637667656, 0.009234558790922165, -0.010729992762207985, 0.007302924059331417, -0.0009949308587238193, 0.02230517752468586, -0.00752389756962657, -0.048809923231601715, -0.016851793974637985, 0.02559356577694416, 0.01312759518623352, -0.006160896737128496, -0.02556050941348076, -0.008029761724174023, -0.01169638056308031, 0.040838275104761124, -0.04989123344421387, -0.03296506777405739, -0.02530989982187748, -0.009035343304276466, -0.045433543622493744, 0.018503570929169655, 0.0034480623435229063, -0.029821695759892464, 0.01564728282392025, 0.036272790282964706, -0.02635682374238968, 0.02933533489704132, 0.04374682903289795, 0.0001988614967558533, -0.07296847552061081, 0.0012291788589209318, -0.011924761347472668, -0.050253976136446, -0.037540826946496964, -0.07609371095895767, 0.011333507485687733, -0.032442282885313034, 0.03816715255379677, 0.049976423382759094, 0.05222579464316368, -0.00995966698974371, -0.047166015952825546, 0.014171862043440342, -0.010438603349030018, -0.02157859317958355, -0.018854836001992226, 0.004613779950886965, -0.019115326926112175, -0.016590647399425507, -0.026812124997377396, 0.03563714772462845, -0.024347636848688126, 0.01485490333288908, 0.010910513810813427, 0.016265008598566055, -0.0019024279899895191, -0.00858645886182785, 0.03117186389863491, 0.008934653364121914, 0.007512778975069523, 0.05579075589776039, 0.016870703548192978, -0.016790874302387238, 0.015178404748439789, 0.0014759538462385535, -0.029796043410897255, 0.03464015945792198, 0.006194025743752718, -0.033670902252197266, -0.019582239910960197, 0.041939619928598404, 0.01646825298666954, 0.04354921355843544, -0.03245433792471886, -0.017403708770871162, -0.02146536484360695, 0.01656235009431839, -0.017784181982278824, 0.0379936657845974, 0.03465285152196884, -0.008015619590878487, 0.010439851321280003, -0.0446723997592926, 0.004937845282256603, -0.008423268795013428, -0.024550674483180046, 0.024778826162219048, 0.0387912392616272, -0.028710713610053062, -0.013093525543808937, -0.07217492163181305, 0.007592289708554745, -0.04888436570763588, -0.039504341781139374, 0.008023818023502827, 0.011208459734916687, 0.024690451100468636, -0.016415223479270935, 0.011720985174179077, -0.035263895988464355, -0.02669334039092064, 0.0034460441675037146, -0.016979776322841644, 0.026255890727043152, -0.02329386956989765, -0.023132963106036186, -0.07546279579401016, -0.03229858726263046, -0.017546316608786583, -0.06384621560573578, 0.0097277807071805, 0.024994725361466408, 0.009130352176725864, -0.01055592019110918, -0.0008086802554316819, 0.020001135766506195, 0.03949756175279617, -0.04003963619470596, -0.0716501772403717, 0.04254206269979477, 0.009690086357295513, -0.052920401096343994, -0.03987857326865196, 0.036160457879304886, 0.0422741174697876, 0.016466226428747177, -0.0038016156759113073, 0.007852901704609394, 0.05567054823040962, 0.007459539920091629, 0.06326156109571457, 0.0018220704514533281, 0.05792638659477234, 0.013304885476827621, -0.037520430982112885, 0.009046795777976513, -0.012324417009949684 ]
Few-shot learning in practice: GPT-NEO and the 🤗 Accelerated Inference API
philschmid
June 3, 2021
few-shot-learning-gpt-neo-and-inference-api
guide, nlp
https://huggingface.co/blog/few-shot-learning-gpt-neo-and-inference-api
What is Few-Shot Learning? Few-Shot Learning refers to the practice of feeding a machine learning model with a very small amount of training data to guide its predictions, like a few examples at inference time, as opposed to standard fine-tuning techniques which require a relatively large amount of training data for the pre-trained model to adapt to the desired task with accuracy. This technique has been mostly used in computer vision, but with some of the latest Language Models, like EleutherAI GPT-Neo and OpenAI GPT-3, we can now use it in Natural Language Processing (NLP). In NLP, Few-Shot Learning can be used with Large Language Models, which have learned to perform a wide number of tasks implicitly during their pre-training on large text datasets. This enables the model to generalize, that is to understand related but previously unseen tasks, with just a few examples. Few-Shot NLP examples consist of three main components: - Task Description: A short description of what the model should do, e.g. "Translate English to French" - Examples: A few examples showing the model what it is expected to predict, e.g. "sea otter => loutre de mer" - Prompt: The beginning of a new example, which the model should complete by generating the missing text, e.g. "cheese => " Image from Language Models are Few-Shot Learners Creating these few-shot examples can be tricky, since you need to articulate the “task” you want the model to perform through them. A common issue is that models, especially smaller ones, are very sensitive to the way the examples are written. An approach to optimize Few-Shot Learning in production is to learn a common representation for a task and then train task-specific classifiers on top of this representation. OpenAI showed in the GPT-3 Paper that the few-shot prompting ability improves with the number of language model parameters. Image from Language Models are Few-Shot Learners Let's now take a look at how at how GPT-Neo and the 🤗 Accelerated Inference API can be used to generate your own Few-Shot Learning predictions! ---
[ 0.08123915642499924, -0.0487930029630661, 0.006406712811440229, 0.0011194741819053888, 0.07057240605354309, 0.08466220647096634, -0.008496882393956184, 0.07048574090003967, -0.022526569664478302, 0.07267025858163834, -0.09258848428726196, -0.013237602077424526, -0.035949595272541046, 0.030531710013747215, 0.011504735797643661, -0.027122626081109047, 0.029245074838399887, -0.01856548897922039, -0.008824174292385578, 0.0026075439527630806, -0.06207707151770592, -0.06781376898288727, 0.04114540293812752, -0.011232227087020874, 0.03975803777575493, -0.024090340360999107, 0.03585422784090042, 0.007816691882908344, -0.0834137350320816, 0.03127819672226906, -0.15000532567501068, -0.016567708924412727, -0.059991590678691864, -0.003903023200109601, -0.01960027404129505, -0.000293880351819098, -0.07180853933095932, 0.08663102239370346, 0.028788775205612183, -0.022186288610100746, -0.04697488993406296, -0.019272251054644585, -0.01223901566118002, 0.011530891992151737, -0.0008557848632335663, -0.07722867280244827, -0.17815974354743958, 0.05548008158802986, -0.06019607558846474, -0.06001952663064003, -0.08766451478004456, 0.04913588613271713, -0.008558952249586582, -0.005121536087244749, 0.0025169893633574247, -0.00468104425817728, 0.028779346495866776, -0.13256818056106567, 0.04202422872185707, 0.03157411143183708, 0.0015816763043403625, -0.001540064811706543, 0.0019078620243817568, 0.03459956496953964, -0.002855246886610985, -0.040001314133405685, 0.038762036710977554, 0.05660915747284889, -0.03815952315926552, 0.006828830111771822, -0.007702264469116926, -0.05352616682648659, 0.0019346718909218907, 0.031129121780395508, -0.02877138927578926, -0.051055192947387695, 0.03764355182647705, 0.0009386965539306402, 0.0004889530246146023, 0.008818667382001877, 0.012430176138877869, -0.044401854276657104, 0.024673491716384888, 0.026620235294103622, 0.0018965019844472408, 0.019972268491983414, 0.059439074248075485, 0.047976233065128326, -0.051135316491127014, 0.04565612971782684, -0.013408483006060123, -0.16692626476287842, -0.014920580200850964, 0.0019055726006627083, 0.04106495901942253, -0.013028183951973915, 0.0678306370973587, 0.045668523758649826, 0.013452640734612942, -0.028231246396899223, 0.02416607178747654, -0.07636554539203644, 0.06012189760804176, -0.025658290833234787, -0.07543127983808517, 0.05770806595683098, -0.027618084102869034, -0.019054634496569633, -0.039126984775066376, 0.036962904036045074, -0.005043543875217438, -0.010276631452143192, -0.03393649309873581, 0.029943397268652916, -0.08290503174066544, -0.01754993200302124, 0.017174845561385155, 0.04872224107384682, -0.01825214922428131, 0.001608600257895887, -0.0592515766620636, 0.024989154189825058, 0.09346280992031097, -0.02751229517161846, -0.029442541301250458, 0.05622916296124458, 0.052242211997509, -0.009389628656208515, 0.053040940314531326, -0.05325350537896156, 0.023649809882044792, 0.0001812298723962158, -0.011208264157176018, 0.04663905128836632, 0.027202557772397995, 0.020400172099471092, 0.019319655373692513, -0.05394177511334419, 0.03484714403748512, 0.01679615117609501, -0.038777533918619156, 0.022798100486397743, 0.019576650112867355, -0.005591659341007471, 0.06688236445188522, -0.013007823377847672, -0.015951137989759445, -0.07535552978515625, 0.036096058785915375, 0.025159481912851334, -0.11158177256584167, 0.08712569624185562, -0.007235673256218433, -0.038058046251535416, 0.05361293628811836, 0.0643339529633522, -0.06409024447202682, -0.04018311947584152, -0.028704272583127022, -0.0626668706536293, -0.02815122902393341, 0.0007603100966662169, 0.07206244021654129, -0.022792866453528404, 0.008426036685705185, -0.053581856191158295, -0.024268193170428276, 0.048851676285266876, 0.05851912125945091, 0.037745147943496704, -0.001271403394639492, -0.03185917064547539, 0.06565668433904648, -0.029847636818885803, 0.011618667282164097, -0.0009453559760004282, 0.010920426808297634, 0.048617541790008545, 0.04522251337766647, 0.01748698204755783, -0.04180115833878517, 0.03836773708462715, 0.017144594341516495, 0.02899235486984253, 0.02212422341108322, -0.08052249252796173, 0.03968185931444168, -0.014770014211535454, 0.002655502874404192, -0.0001781650207703933, -0.044705312699079514, 0.03178274258971214, 0.07428660243749619, 0.013283664360642433, 0.05776910483837128, -0.11253485828638077, -0.056507911533117294, 0.1215997040271759, 0.056174516677856445, 0.02991463989019394, 0.025055209174752235, -0.02637539431452751, -0.008415218442678452, -0.0019931914284825325, -0.014814232476055622, 0.036335114389657974, 0.033452581614255905, 0.03588275983929634, 0.028612064197659492, 0.045977622270584106, -0.03323547914624214, -0.07777046412229538, 0.015217335894703865, -0.06727016717195511, 0.05086054652929306, 0.016202984377741814, 0.030802160501480103, 0.005681677721440792, 0.018202554434537888, -0.009128165431320667, 0.14552830159664154, -0.014540386386215687, 0.003021647222340107, 0.020097944885492325, -0.00418668519705534, 0.00010092130105476826, 0.06568163633346558, -0.009662277065217495, 0.0726252868771553, -0.062493227422237396, 0.004942096769809723, -0.08079200983047485, 0.017590466886758804, 0.030628511682152748, 0.008841733448207378, -0.016570214182138443, 0.009279022924602032, 0.012909055687487125, 0.011158483102917671, -0.044173527508974075, -0.012231914326548576, 0.050182174891233444, -0.04240008071064949, 0.057393644005060196, 0.01609363593161106, -0.010776770301163197, 0.08594129979610443, 0.026440119370818138, 0.03461162745952606, -0.03582179546356201, -0.042269811034202576, 0.03126361221075058, -0.004545373842120171, -0.07264658808708191, 0.009950759820640087, 0.016318703070282936, 0.021641699597239494, -0.03617516905069351, 0.019002392888069153, 0.019342472776770592, 0.008767998777329922, -0.012877017259597778, -0.02756464295089245, -0.026408081874251366, 0.013275566510856152, -0.04472975432872772, -0.0027726273983716965, 0.01790321245789528, 0.04757183417677879, -0.00952086690813303, 0.01817564107477665, -0.012475775554776192, 0.010943368077278137, 0.003906832542270422, -0.01952550932765007, 0.02399205043911934, 0.03162134438753128, 0.0036078053526580334, -0.011942687444388866, -0.002272837795317173, -0.010248587466776371, -0.009970203973352909, -0.012377648614346981, 0.05458856001496315, 0.014300595037639141, -0.004995628725737333, 0.02217712812125683, -0.0270095057785511, -0.02950047142803669, -0.003977322019636631, -0.007956546731293201, 0.004299519583582878, -0.006999308243393898, 0.0011387759586796165, 0.01540226861834526, 0.013657670468091965, -0.010988873429596424, -0.02956891804933548, 0.008917304687201977, -0.01623624376952648, -0.008595563471317291, 0.009614354930818081, -0.0037431323435157537, 0.002805710071697831, -0.018475957214832306, 0.03269055858254433, 0.024714559316635132, 0.02926028147339821, -0.09176946431398392, -0.037645719945430756, 0.059249941259622574, -0.00940025132149458, -0.004614191595464945, -0.021095851436257362, 0.059570927172899246, 0.005071296822279692, -0.005906297359615564, 0.002686609048396349, -0.0025602737441658974, 0.03754495829343796, 0.03785264492034912, -0.0040595438331365585, 0.018306616693735123, -0.00010437920718686655, -0.015283381566405296, 0.0057209935039281845, 0.02586914226412773, 0.030567586421966553, -0.02068164199590683, 0.03201210871338844, 0.02641141042113304, 0.0680513009428978, 0.0059038931503891945, 0.01460950169712305, 0.02117535099387169, -0.00478705856949091, 0.03587503731250763, 0.005070059560239315, -0.014386282302439213, -0.010656654834747314, -0.03908681496977806, 0.04743604362010956, -0.018533911556005478, 0.019742228090763092, 0.018996022641658783, 0.05382569879293442, 0.01949388161301613, -0.004243212286382914, -0.023540887981653214, -0.03617239370942116, -0.013596925884485245, 0.004451455548405647, 0.004638372920453548, -0.01380695216357708, -0.013565930537879467, -0.0185200497508049, 0.007721800357103348, -0.05627940595149994, -0.03986366465687752, -0.003506067208945751, -0.03667393699288368, 0.05264760181307793, 0.04037460312247276, 0.008221621625125408, 0.01052648015320301, -0.003388396929949522, 0.017918817698955536, -0.018886296078562737, -0.03949308022856712, 0.04922903701663017, 0.026446692645549774, -0.040972258895635605, -0.02131696417927742, 0.022747458890080452, -0.007053923327475786, 0.04774666205048561, 0.0070394910871982574, 0.03361967206001282, -0.021031469106674194, 0.037523653358221054, 0.002749402541667223, 0.010771344415843487, -0.02383841760456562, 0.006036949343979359, -0.03104368783533573, 0.01387493684887886, 0.052323732525110245, 0.03254333883523941, -0.0018133021658286452, -0.008819361217319965, -0.004902756307274103, -0.004800883587449789, 0.008648190647363663, -0.04124023765325546, 0.03362402692437172, -0.04337892308831215, 0.025808274745941162, 0.045055896043777466, 0.004750988446176052, -0.005032060202211142, 0.039198894053697586, 0.02413187362253666, 0.010038230568170547, 0.003596348688006401, 0.0004983635735698044, 0.00021100921730976552, 0.01618628203868866, -0.009073995985090733, 0.034826699644327164, -0.04338531196117401, -0.02838985249400139, -0.03176596015691757, -0.022841280326247215, 0.009714141488075256, -0.00501486798748374, -0.008877287618815899, 0.005860887933522463, -0.007033536676317453, -0.026503007858991623, 0.030550848692655563, 0.013558411970734596, 0.009729614481329918, 0.00872951839119196, 0.034345827996730804, 0.0071968198753893375, 0.00841513741761446, 0.0022217382211238146, 0.013931442983448505, -0.05063892528414726, 0.014724060893058777, -0.03334558382630348, 0.00891211349517107, 0.01396225020289421, -0.029467610642313957, 0.004101681523025036, -0.014140818268060684, 0.006120097357779741, -0.01693786308169365, 0.01054791733622551, 0.012537173926830292, 0.027402793988585472, -0.00980926863849163, -0.014579610899090767, -0.023502711206674576, -0.025685269385576248, -0.028550514951348305, 0.026304446160793304, -0.011322999373078346, 0.006763169076293707, -0.01751742884516716, 0.0390828400850296, -0.012119670398533344, 0.0722370445728302, -0.025021256878972054, -0.060288697481155396, -0.014786816202104092, -0.04164765030145645, 0.035528428852558136, 0.05439700186252594, 0.01992095820605755, -0.0758654773235321, -0.01862371154129505, 0.039657436311244965, -0.030883261933922768, -0.020344840362668037, 0.008707262575626373, -0.02714054472744465, 0.0400514081120491, 0.025124043226242065, -0.030080435797572136, -0.04067308455705643, -0.0013362939935177565, -0.025239907205104828, -0.02080000378191471, -0.0014998333062976599, -0.00026845652610063553, -0.03853683918714523, 0.019673388451337814, 0.011986793950200081, -0.032995063811540604, -0.0017293572891503572, -0.015534844249486923, 0.0181372482329607, 0.009266432374715805, 0.03755628317594528, -0.0062528494745492935, -0.004595592152327299, 0.037632521241903305, -0.008456964045763016, -0.02671913430094719, -0.00235966918990016, 0.03393105790019035, -0.01535575371235609, -0.011148248799145222, 0.03213487192988396, 0.0555318146944046, 0.009101576171815395, 0.04105108976364136, 0.03759593889117241, 0.016344966366887093, 0.04916301369667053, -0.014212389476597309, 0.002478383481502533, 0.011286033317446709, -0.02105574496090412, 0.007164143957197666, -0.037880413234233856, 0.017295988276600838, 0.026463495567440987, 0.02643706649541855, -0.0032689631916582584, 0.015080921351909637, 0.009468692354857922, -0.011803642846643925, -0.05290856212377548, -0.023670045658946037, 0.0003688120923470706, -0.02827424742281437, -0.053199224174022675, -0.025981081649661064, 0.011326994746923447, -0.01775854453444481, -0.011722712777554989, -0.0458504818379879, -0.020734135061502457, 0.03211047127842903, 0.021975964307785034, 0.041695915162563324, 0.009881697595119476, -0.020320763811469078, -0.06496399641036987, -0.050551414489746094, 0.020913293585181236, -0.017315758392214775, -0.00020097708329558372, 0.004073305055499077, 0.01927180215716362, 0.03425002098083496, 0.009462655521929264, 0.007729595992714167, -0.02253161370754242, 0.029894055798649788, 0.022422969341278076, -0.030613137409090996, -0.05154203623533249, 0.05071293190121651, 0.04466208815574646, 0.009408327750861645, -0.048494987189769745, -0.031853657215833664, -0.05395432189106941, -0.0005680537433363497, -0.07644426822662354, -0.03550274297595024, 0.04257730767130852, -0.027901390567421913, 0.007844917476177216, 0.009924664162099361, 0.005451718810945749, 0.021121393889188766, 0.003463468514382839, 0.014071754179894924, 0.010632998310029507, 0.03968300670385361, 0.06262261420488358, -0.016000308096408844, 0.010060393251478672, -0.0024173941928893328, 0.04537448659539223, -0.05631926655769348, 0.0132673354819417, 0.03254462406039238, -0.03862076252698898, -0.0010495801689103246, 0.017291449010372162, -0.050943318754434586, 0.03371826931834221, 0.03166976198554039, 0.06902407854795456, 0.020593134686350822, -0.027810148894786835, 0.04715726524591446, 0.024571996182203293, 0.01584446057677269, -0.033069442957639694, 0.06759882718324661, -0.0137083875015378, 0.015789393335580826, 0.002603064989671111, -0.000017835309336078353, 0.04673468694090843, -0.017831845209002495, 0.013867628760635853, -0.0006961415056139231, 0.073557049036026, 0.006647450849413872, 0.04102225601673126, -0.0010996975470334291, 0.03521457687020302, -0.011342829093337059, -0.005305839702486992, -0.00296972063370049, -0.022331686690449715, 0.03238096833229065, 0.055983565747737885, -0.015828276053071022, 0.02933136560022831, -0.009756713174283504, 0.015348357148468494, 0.015612766146659851, 0.010169029235839844, -0.01340331882238388, 0.05335714668035507, 0.038227759301662445, 0.0012650646967813373, -0.01892668567597866, 0.052443455904722214, -0.016500497236847878, -0.010707426816225052, 0.06587176024913788, 0.028182704001665115, 0.025819214060902596, 0.011802294291555882, 0.024602271616458893, 0.043129511177539825, -0.029685452580451965, -0.004354339092969894, 0.027902783825993538, 0.00435602618381381, -0.007475864142179489, -0.0017363012302666903, -0.037696752697229385, -0.05478529632091522, 0.00437680771574378, -0.004797279369086027, -0.027504734694957733, 0.011449913494288921, -0.041063856333494186, -0.02304651401937008, 0.018480733036994934, 0.022914301604032516, -0.04931338503956795, -0.05622398480772972, -0.02341841533780098, -0.0015161747578531504, -0.021611686795949936, -0.023000435903668404, -0.04914485663175583, -0.00524397287517786, 0.008943183347582817, -0.046032559126615524, 0.018070919439196587, 0.0016203396953642368, -0.0570407472550869, 0.03164355456829071, -0.01893722079694271, -0.023334302008152008, 0.03869292140007019, 0.03571227937936783, 0.009355850517749786, -0.05050422251224518, -0.015595297329127789, -0.03326045349240303, -0.029383234679698944, 0.00604203762486577, -0.03464890271425247, -0.03751225769519806, -0.020825665444135666, 0.014398626051843166, -0.01571795716881752, 0.05981764942407608, -0.019833818078041077, 0.002711249515414238, 0.015354721806943417, -0.037876393646001816, -0.013398402370512486, 0.006963849067687988, 0.020200233906507492, -0.03871208429336548, 0.03745868429541588, -0.029961630702018738, -0.05422636494040489, -0.031553834676742554, 0.0029719562735408545, 0.021907715126872063, 0.011774018406867981, -0.02891862392425537, -0.025553880259394646, -0.026812607422471046, 0.014010369777679443, 0.0419640950858593, 0.029427744448184967, 0.01678074710071087, 0.02510826848447323, -0.014124542474746704, 0.016657162457704544, -0.015505367890000343, 0.031241673976182938, -0.03558402135968208, -0.07105421274900436, -0.04494659602642059, 0.06928400695323944, -0.028775395825505257, 0.05401930958032608, -0.025435352697968483, 0.012258951552212238, -0.032026659697294235, 0.029419053345918655, -0.032983068376779556, 0.0010264151496812701, 0.021397506818175316, -0.008559947833418846, 0.019829271361231804, -0.02710215374827385, 0.017678113654255867, -0.004059335216879845, -0.036573804914951324, -0.0029690442606806755, 0.043753597885370255, -0.030246570706367493, -0.002773652318865061, -0.036431267857551575, 0.05035930499434471, -0.04458557069301605, -0.010319975204765797, -0.012388243339955807, 0.014711713418364525, -0.02980704791843891, -0.027711329981684685, 0.018561087548732758, 0.04676051810383797, -0.031530335545539856, 0.016999416053295135, 0.01269458420574665, 0.00024811032926663756, 0.008401674218475819, -0.006522071082144976, -0.03817996010184288, -0.018253836780786514, 0.02202734909951687, -0.024752125144004822, -0.01665700599551201, 0.032879896461963654, 0.034651532769203186, -0.0216768067330122, -0.016125131398439407, 0.03757891058921814, 0.01821621134877205, -0.02258378639817238, -0.038927119225263596, 0.021156400442123413, 0.044459931552410126, 0.0031552277505397797, -0.012364515103399754, 0.022901225835084915, 0.02803133986890316, -0.006060387473553419, -0.0152159184217453, 0.0260105412453413, 0.014681615866720676, -0.023655865341424942, 0.02194475755095482, -0.0674355998635292, 0.06532562524080276, 0.02196500636637211, 0.005352319218218327, -0.05783151835203171, 0.023686585947871208 ]
Sentence Transformers in the 🤗 Hub
nreimers
June 28, 2021
sentence-transformers-in-the-hub
open-source-collab, nlp
https://huggingface.co/blog/sentence-transformers-in-the-hub
What's next? Moving forward, we want to make this integration even more useful. In our roadmap, we expect training and evaluation data to be included in the automatically created model card, like is the case in transformers from version v4.8. And what's next for you? We're very excited to see your contributions! If you already have a Sentence Transformer repo in the Hub, you can now enable the widget and Inference API by changing the model card metadata. yaml --- tags: - sentence-transformers - sentence-similarity # Or feature-extraction! --- If you don't have any model in the Hub and want to learn more about Sentence Transformers, head to www.SBERT.net!
[ 0.024394523352384567, -0.0559847466647625, 0.02823852002620697, 0.010132001712918282, 0.06834328174591064, 0.0600646510720253, 0.005970308557152748, 0.06778902560472488, -0.010656408034265041, -0.011230450123548508, -0.05545825883746147, 0.03992731496691704, 0.013209647499024868, 0.09912373870611191, 0.006626802962273359, -0.009980003349483013, 0.024888627231121063, 0.01693829894065857, -0.03663105517625809, 0.0063899909146130085, 0.00819561816751957, -0.03807147219777107, 0.06758542358875275, -0.020264925435185432, 0.05882629007101059, -0.06313192844390869, 0.06317256391048431, -0.007044482976198196, -0.031079253181815147, 0.07008423656225204, -0.09406882524490356, 0.006300123408436775, -0.0023561567068099976, -0.05886395275592804, -0.043347954750061035, 0.030439572408795357, -0.10413264483213425, 0.02430414967238903, -0.0047378139570355415, -0.04624280706048012, -0.004097866825759411, -0.012708666734397411, -0.07241576164960861, -0.005567144136875868, 0.009057917632162571, -0.03422679007053375, -0.17065446078777313, 0.06310698390007019, -0.040020816028118134, -0.023696506395936012, -0.03364773094654083, 0.11091356724500656, -0.017756016924977303, -0.019615888595581055, 0.0648048147559166, 0.01673644408583641, -0.04068871960043907, -0.1029522642493248, 0.04470252990722656, 0.04139545559883118, -0.03345214203000069, -0.02056420035660267, 0.029422011226415634, 0.029762443155050278, 0.031030267477035522, -0.0019489600090309978, 0.008344555273652077, 0.046540357172489166, -0.045577965676784515, -0.010552376508712769, 0.024319589138031006, -0.033012233674526215, 0.017509080469608307, -0.0130790239199996, 0.032674528658390045, -0.04404152184724808, -0.019791826605796814, 0.10168443620204926, 0.019626371562480927, -0.023592380806803703, -0.010974803939461708, -0.017772391438484192, 0.03211574628949165, 0.019973143935203552, 0.027006447315216064, -0.02485981024801731, 0.05078257992863655, -0.059661462903022766, -0.06766088306903839, 0.05065040662884712, -0.006730642635375261, -0.12581036984920502, -0.057331863790750504, 0.07592441886663437, 0.019308438524603844, 0.0023624917957931757, 0.01922837644815445, 0.019380485638976097, -0.049698568880558014, -0.033174317330121994, 0.004532112739980221, -0.01767868362367153, 0.04704070836305618, -0.050527408719062805, -0.014303125441074371, -0.013655499555170536, -0.013105194084346294, -0.08528172224760056, 0.041977737098932266, 0.07588329911231995, 0.03548962250351906, -0.007525304332375526, 0.042599037289619446, 0.1254161149263382, -0.011140692047774792, 0.03182913362979889, 0.03428168222308159, -0.020841125398874283, -0.0054991706274449825, -0.029449790716171265, 0.008277196437120438, -0.005624143872410059, 0.041891876608133316, 0.010236868634819984, 0.012580623850226402, 0.056743524968624115, -0.027435488998889923, 0.04071122035384178, -0.018470831215381622, -0.002862095832824707, 0.06111232191324234, -0.06068684160709381, 0.04749531298875809, 0.016359323635697365, -0.023921841755509377, -0.06270680576562881, -0.024764137342572212, -0.11506596952676773, 0.01792697049677372, -0.01585208810865879, -0.017291748896241188, 0.03758830204606056, 0.011346148326992989, 0.01914144679903984, 0.061784546822309494, 0.01392620149999857, -0.06785093247890472, 0.032492078840732574, 0.004443369805812836, 0.02621280588209629, -0.04991006478667259, 0.056728020310401917, -0.05693921446800232, -0.03838908672332764, 0.00997055321931839, 0.02012483775615692, -0.008862035349011421, 0.014089883305132389, -0.06681886315345764, -0.02889889106154442, -0.013743367046117783, -0.005182051565498114, -0.037336938083171844, 0.024700647220015526, -0.013654896058142185, -0.01742079108953476, -0.0004512728482950479, -0.0071458821184933186, 0.0644426941871643, -0.02220647782087326, 0.05169228836894035, -0.0770009458065033, 0.0731969103217125, -0.06232232600450516, -0.010119752958416939, 0.08951035887002945, 0.010724468156695366, 0.054730843752622604, -0.013779524713754654, 0.00005776136094937101, -0.018273593857884407, 0.05365176126360893, -0.04997439682483673, 0.014874073676764965, 0.06717748939990997, -0.08475681394338608, 0.0256855059415102, -0.027085497975349426, -0.0057134986855089664, -0.008323529735207558, -0.04752973094582558, -0.04694519191980362, 0.0730368047952652, 0.02677435614168644, 0.06684095412492752, -0.04994603991508484, -0.02360675111413002, 0.11132115125656128, 0.031131131574511528, 0.06535638123750687, 0.04063345491886139, 0.0278102345764637, 0.016275696456432343, -0.025758743286132812, 0.013126198202371597, 0.034923870116472244, 0.0075383842922747135, -0.016087323427200317, -0.013094323687255383, -0.0016612997278571129, -0.002343373838812113, -0.11426948755979538, 0.03520307317376137, -0.08253349363803864, -0.021436195820569992, -0.05227012187242508, 0.019127707928419113, 0.038581229746341705, 0.01300237886607647, -0.02647593803703785, 0.1533796638250351, -0.030802730470895767, 0.0014920623507350683, -0.05280228704214096, -0.012582514435052872, 0.04695407673716545, 0.0602240189909935, 0.06852313131093979, 0.02470523677766323, -0.041723817586898804, -0.001986905699595809, -0.09441260993480682, -0.025707170367240906, 0.044197872281074524, -0.02306131273508072, 0.016161594539880753, 0.003954150248318911, -0.0025007608346641064, 0.043132394552230835, -0.00985447783023119, 0.014524598605930805, 0.014731861650943756, 0.04201355576515198, 0.06348095834255219, 0.02467283420264721, 0.05891184136271477, 0.0903468057513237, 0.05512750521302223, -0.03650432825088501, -0.016777746379375458, -0.1058492362499237, 0.03812388330698013, 0.011483700945973396, -0.08267823606729507, 0.05957038328051567, 0.020464077591896057, -0.00754183204844594, -0.012794357724487782, -0.028186317533254623, 0.05250540375709534, -0.0029976663645356894, -0.02793484553694725, 0.00687717879191041, -0.03696166351437569, 0.016160715371370316, -0.04862739145755768, -0.005613457411527634, 0.0029218774288892746, -0.020969782024621964, 0.007332819048315287, 0.01486157439649105, -0.03390654921531677, 0.017839400097727776, 0.00840170681476593, 0.01885499805212021, 0.06531429290771484, 0.06007210537791252, 0.0015841707354411483, 0.009636963717639446, 0.01445521879941225, -0.016577845439314842, -0.025220833718776703, 0.023421622812747955, 0.023902934044599533, 0.04417923092842102, -0.00804863590747118, 0.0021591619588434696, -0.0296669639647007, -0.013406140729784966, -0.05087847635149956, -0.0036206126678735018, 0.03101952187716961, -0.024332670494914055, -0.0258839912712574, -0.01798270270228386, 0.022671358659863472, -0.008833954110741615, -0.0038503066170960665, -0.026389794424176216, -0.0005415651830844581, 0.011752992868423462, 0.027095412835478783, 0.007352781016379595, -0.020036950707435608, -0.011264651082456112, 0.017513353377580643, -0.0022116489708423615, 0.02639593370258808, -0.0981934666633606, -0.011928508058190346, 0.013134832493960857, 0.010634486563503742, -0.03093704767525196, -0.02650219015777111, 0.03446481376886368, 0.012028690427541733, -0.009686397388577461, -0.0017590379575267434, -0.04097050428390503, -0.01851663738489151, 0.012280472554266453, 0.02476266212761402, -0.04320327937602997, 0.011687771417200565, -0.046128399670124054, -0.01848301663994789, -0.009831426665186882, 0.04819678142666817, -0.008449614979326725, 0.02371121011674404, -0.01195940189063549, 0.00025937595637515187, 0.0050148386508226395, 0.02228590101003647, 0.048070911318063736, 0.002970120171085, 0.0563458688557148, -0.055531058460474014, 0.000053496260079555213, -0.015175984241068363, -0.026622192934155464, 0.016563655808568, -0.050303228199481964, 0.005931241437792778, -0.014043965376913548, 0.016528625041246414, 0.034890592098236084, 0.02440054900944233, 0.006368674803525209, 0.004675047006458044, 0.022705281153321266, -0.03199821710586548, 0.02743103727698326, -0.024827396497130394, -0.0023056096397340298, 0.01571703515946865, 0.023711465299129486, -0.040279779583215714, 0.0030684934463351965, 0.008851294405758381, 0.010316291823983192, 0.03148346766829491, -0.0008160786237567663, 0.0008070967742241919, 0.00930856354534626, -0.0006697071366943419, 0.019709717482328415, -0.04962814599275589, -0.0569385401904583, 0.01136773545295, -0.008996746502816677, 0.0012108414666727185, -0.008421927690505981, 0.08087123930454254, 0.022540703415870667, 0.028306955471634865, -0.0036127872299402952, 0.024800123646855354, -0.0015288505237549543, 0.03341343626379967, 0.015389102511107922, 0.006164799444377422, -0.0004757796414196491, -0.00022749841446056962, 0.007386803161352873, -0.04085187241435051, 0.05215650796890259, 0.005670628510415554, -0.060023002326488495, -0.03165518864989281, -0.029040366411209106, -0.015736298635601997, 0.02318551205098629, 0.029438329860568047, 0.031304098665714264, -0.0174616277217865, 0.041210420429706573, 0.021577192470431328, 0.02074931561946869, -0.04553086683154106, 0.016632944345474243, -0.02152559533715248, 0.004279087297618389, 0.016382502391934395, 0.010816059075295925, 0.004028903786092997, 0.002238078275695443, 0.01980094239115715, 0.018555670976638794, -0.038109149783849716, -0.0015335200587287545, 0.005948400124907494, -0.02482917159795761, 0.04197296127676964, -0.056608714163303375, -0.04627653583884239, -0.0040747313760221004, -0.03190893307328224, 0.03560273349285126, -0.0027209389954805374, -0.038979578763246536, -0.03809276595711708, -0.009464094415307045, 0.03852224722504616, -0.0171084925532341, 0.005378744564950466, -0.05233164504170418, 0.07531975954771042, 0.0007645434816367924, -0.0028400621376931667, -0.0027898375410586596, -0.004370777402073145, 0.007056418806314468, -0.01777339167892933, 0.006544879171997309, 0.035970818251371384, -0.01994326524436474, -0.010883561335504055, -0.004623458720743656, -0.014224606566131115, 0.01618163287639618, -0.03676106780767441, 0.0030633676797151566, 0.027546733617782593, -0.03349830210208893, 0.01885061338543892, -0.036458857357501984, 0.019864175468683243, -0.026475651189684868, -0.03042304515838623, 0.047092538326978683, -0.01753014326095581, 0.040142226964235306, -0.054403383284807205, -0.05951594561338425, -0.02294451929628849, -0.011606177315115929, 0.012773694470524788, 0.004532924387603998, 0.015414923429489136, -0.04683147743344307, 0.014416921883821487, 0.02748894691467285, -0.014598723500967026, -0.010613566264510155, 0.03565369173884392, 0.01314963586628437, 0.06610439717769623, 0.00657634437084198, 0.028986498713493347, -0.04789254069328308, 0.0005198735161684453, 0.019086886197328568, 0.029892640188336372, -0.017869381234049797, -0.05477890744805336, 0.03241949528455734, 0.04657818749547005, -0.036005713045597076, -0.04401475563645363, 0.019875312224030495, -0.00030131282983347774, -0.008527343161404133, 0.024071769788861275, -0.014854434877634048, 0.03798403963446617, -0.01845240779221058, 0.004532611463218927, -0.03416454419493675, -0.029219001531600952, 0.006389537826180458, 0.03136994317173958, -0.007896170020103455, 0.006824638694524765, 0.07236430794000626, 0.05220029503107071, -0.015336372889578342, 0.01464665587991476, 0.020475178956985474, -0.0473763681948185, 0.0030400953255593777, -0.027118751779198647, -0.013841299340128899, -0.06802123039960861, 0.03124714270234108, 0.029558667913079262, -0.023473205044865608, 0.023620758205652237, 0.0312875434756279, 0.057969558984041214, -0.037783246487379074, -0.01433590054512024, 0.056588999927043915, 0.01785721816122532, 0.0019382595783099532, -0.021496446803212166, 0.007543038111180067, -0.04176049679517746, -0.0020497795194387436, -0.009726207703351974, -0.04649047926068306, -0.006661738734692335, -0.004836066160351038, -0.055550962686538696, -0.00032457028282806277, -0.006017726380378008, -0.023428505286574364, 0.058899588882923126, -0.025297848507761955, -0.027064507827162743, -0.03393268585205078, 0.004073142074048519, 0.03419877961277962, -0.01426940318197012, 0.023331915959715843, 0.007051174994558096, -0.004165132995694876, -0.018765462562441826, 0.014606517739593983, -0.008309850469231606, 0.0031606240663677454, 0.03187399357557297, -0.01179778017103672, 0.029159216210246086, -0.059655025601387024, 0.028898831456899643, 0.03150562196969986, -0.013842211104929447, -0.03770457208156586, -0.035892922431230545, -0.037536438554525375, -0.001965654781088233, -0.052444763481616974, 0.04642932862043381, 0.08303765207529068, -0.02773674950003624, 0.005228073336184025, 0.02090359479188919, 0.02280467376112938, 0.022954823449254036, -0.015358327887952328, 0.03241611644625664, -0.0007980203372426331, -0.024110859259963036, 0.007181660272181034, 0.020333491265773773, -0.023909492418169975, 0.016566138714551926, 0.022796623408794403, -0.04385019466280937, 0.004785437136888504, 0.026532582938671112, -0.033369794487953186, -0.0021550599485635757, 0.030101053416728973, -0.02715410105884075, -0.004593387246131897, 0.012523702345788479, 0.0040532685816287994, 0.014991638250648975, 0.013810211792588234, 0.012205774895846844, -0.007899095304310322, -0.018024101853370667, 0.026960458606481552, 0.03054237924516201, -0.0015452220104634762, 0.03604286536574364, 0.04235276207327843, 0.080544114112854, 0.0557156503200531, 0.015454994514584541, -0.0398387536406517, 0.008268018253147602, 0.05142733454704285, -0.029341476038098335, 0.02103498950600624, 0.023224733769893646, 0.043904151767492294, -0.02694486826658249, 0.004570066928863525, -0.015277760103344917, -0.01386579405516386, -0.02465211972594261, 0.04073401167988777, 0.03000601753592491, -0.0028901458717882633, 0.008030862547457218, 0.05040178820490837, 0.029613133519887924, 0.00039967268821783364, -0.03833659365773201, -0.0017029697773978114, 0.037817176431417465, 0.020039556547999382, 0.033719487488269806, 0.02706335484981537, -0.01250847615301609, -0.01940939947962761, 0.0333496518433094, 0.024605311453342438, 0.011594691313803196, -0.006799367256462574, 0.007687222212553024, -0.004109494853764772, -0.03882506117224693, -0.03145289421081543, 0.03888726606965065, -0.029574962332844734, -0.013822278007864952, -0.025483477860689163, 0.03673728555440903, -0.04916089400649071, -0.017368001863360405, 0.014459366910159588, 0.011559023521840572, -0.004118737298995256, -0.0323839969933033, -0.010614966973662376, 0.08447010815143585, 0.00018793961498886347, -0.014662855304777622, -0.025900250300765038, 0.013545061461627483, 0.010722532868385315, 0.017264431342482567, -0.027083314955234528, -0.022743340581655502, -0.018605098128318787, -0.013090663589537144, 0.009433161467313766, 0.03252565488219261, -0.013653132133185863, -0.030613498762249947, 0.04027485102415085, 0.02083180844783783, -0.011002002283930779, 0.030338769778609276, -0.004025380127131939, 0.011235513724386692, -0.06345915794372559, -0.012302394025027752, -0.0003843873564619571, -0.01905692368745804, 0.007841718383133411, -0.05845904350280762, -0.004148612264543772, -0.02913741022348404, -0.0017898583319038153, 0.0427137054502964, 0.038318052887916565, -0.0389539860188961, 0.024154165759682655, -0.008323240093886852, -0.008233508095145226, 0.04384951293468475, 0.011375900357961655, -0.014274179004132748, -0.023751771077513695, 0.00702747842296958, -0.02338343858718872, 0.02457997389137745, 0.0008954256190918386, -0.0005955552915111184, 0.04145196080207825, -0.02374476008117199, -0.022045904770493507, -0.005591666325926781, 0.028234241530299187, 0.0008552776416763663, 0.03859459236264229, 0.019409971311688423, -0.006886185146868229, 0.00592486746609211, -0.01046011596918106, 0.014965562149882317, -0.012099388055503368, 0.0014659137232229114, -0.032127752900123596, -0.06178968772292137, -0.03919310122728348, 0.02522747404873371, 0.0024679778143763542, 0.030938230454921722, -0.04730845242738724, -0.0035840696655213833, -0.018447332084178925, -0.028085850179195404, -0.0031008487567305565, -0.0028253155760467052, 0.07297644764184952, 0.006104015279561281, 0.04536417871713638, -0.0005677166045643389, 0.022352438420057297, -0.010796841233968735, 0.008802689611911774, 0.006393416319042444, 0.011997015215456486, 0.0193993728607893, -0.014866741374135017, -0.03957659751176834, -0.0013353941030800343, 0.003283511148765683, -0.04702684283256531, 0.011600947007536888, 0.06211968883872032, -0.002526907017454505, -0.025924650952219963, -0.002987167565152049, 0.008309823460876942, 0.02402479201555252, 0.029498683288693428, 0.02797050029039383, -0.009214532561600208, 0.0235736146569252, -0.004944265354424715, -0.08293356001377106, 0.010326046496629715, -0.06284452974796295, -0.009759165346622467, 0.019883373752236366, 0.0496542826294899, 0.018116896972060204, 0.0059450771659612656, -0.02902860939502716, 0.008082132786512375, -0.042935874313116074, -0.0570245124399662, -0.05214908346533775, 0.01320055965334177, 0.009407173842191696, -0.03605592995882034, 0.0029304164927452803, 0.026677895337343216, -0.007783057168126106, -0.04211398586630821, -0.03514573350548744, -0.0008630144875496626, -0.00041064678225666285, -0.00788083951920271, 0.033458173274993896, 0.011425438337028027, 0.012934919446706772, 0.05906345695257187, -0.045001085847616196, -0.009156369604170322, -0.026621278375387192 ]
Sentence Transformers in the 🤗 Hub
nreimers
June 28, 2021
sentence-transformers-in-the-hub
open-source-collab, nlp
https://huggingface.co/blog/sentence-transformers-in-the-hub
Would you like to integrate your library to the Hub? This integration is possible thanks to the huggingface_hub library which has all our widgets and the API for all our supported libraries. If you would like to integrate your library to the Hub, we have a guide for you!
[ 0.00773274339735508, -0.004455060698091984, 0.05732233077287674, -0.026709115132689476, 0.09012823551893234, 0.00267598289065063, -0.010353254154324532, 0.08259749412536621, 0.002751291263848543, -0.06676017493009567, -0.053188759833574295, 0.029708381742239, 0.004094921052455902, 0.09832841157913208, 0.015536590479314327, -0.030895031988620758, 0.04677584767341614, -0.001701044850051403, 0.005010685883462429, 0.0333847813308239, 0.013505008071660995, -0.07205364108085632, 0.029956426471471786, -0.014128586277365685, -0.006784079130738974, -0.08979959040880203, 0.04273788258433342, 0.029398703947663307, 0.022779876366257668, 0.0013641351833939552, -0.06416990607976913, -0.008825862780213356, 0.025230297818779945, -0.06388954818248749, 0.03194137290120125, 0.03240617737174034, -0.14906790852546692, 0.059410691261291504, 0.05919070541858673, 0.012937581166625023, -0.014030327089130878, -0.017602574080228806, -0.05353381484746933, 0.029996609315276146, 0.019053606316447258, -0.06208685040473938, -0.2186860889196396, 0.09841582179069519, 0.01731126755475998, -0.007839638739824295, -0.08594001829624176, 0.06585630029439926, 0.0169225987046957, 0.005398760084062815, 0.044509097933769226, -0.011238176375627518, -0.018611926585435867, -0.08178725093603134, 0.006857836619019508, 0.002351226983591914, 0.0603032112121582, 0.010301165282726288, -0.0018798758974298835, 0.06176523491740227, 0.005475365091115236, 0.04327184334397316, -0.010900882072746754, 0.002739530522376299, -0.041457947343587875, 0.008687336929142475, 0.016590172424912453, -0.02347952499985695, -0.02133692055940628, -0.032554447650909424, 0.03411426395177841, -0.0385197289288044, -0.03362903743982315, 0.026612013578414917, 0.061375897377729416, 0.0034781326539814472, 0.012569409795105457, -0.028949465602636337, 0.03942236304283142, 0.04802742227911949, 0.03645125404000282, 0.04374498873949051, -0.0023044913541525602, -0.07723426073789597, -0.05586254596710205, 0.0583801195025444, -0.025533532723784447, -0.14261968433856964, -0.017536450177431107, 0.022861095145344734, 0.08350443094968796, -0.010719280689954758, 0.020085930824279785, 0.01956517994403839, 0.012678790837526321, 0.01808490790426731, -0.022608280181884766, -0.05400589108467102, 0.003463363740593195, -0.05474626645445824, -0.025209365412592888, 0.014435655437409878, 0.01332852616906166, -0.10617581754922867, -0.033643413335084915, 0.0037463370244950056, 0.024638913571834564, -0.0582229420542717, 0.00830360222607851, 0.061574846506118774, -0.01830400340259075, 0.05921833962202072, 0.009182048961520195, 0.002387214684858918, -0.021893717348575592, 0.03597157448530197, 0.005360671319067478, 0.10753267258405685, -0.009643650613725185, 0.024090630933642387, 0.06277164071798325, 0.09584119915962219, -0.0031880498863756657, -0.002111230045557022, -0.02278011664748192, -0.06317616254091263, 0.03935539349913597, 0.02174947038292885, 0.057070836424827576, -0.041626669466495514, -0.01733989268541336, -0.03927421197295189, -0.014990333467721939, -0.06486134231090546, 0.026205457746982574, -0.025097040459513664, -0.001190122333355248, 0.08108358830213547, -0.029274482280015945, 0.024639885872602463, 0.031491052359342575, 0.0040446738712489605, -0.05007001385092735, 0.06939452886581421, -0.045575663447380066, -0.022708438336849213, -0.03691548481583595, 0.05593659728765488, -0.017541443929076195, 0.00382747920230031, -0.09307768940925598, 0.05090394616127014, -0.006830453407019377, -0.011690518818795681, -0.052238453179597855, 0.020002644509077072, -0.026480354368686676, 0.012073123827576637, -0.07337699085474014, -0.02748309262096882, 0.01177187729626894, 0.0013768798671662807, 0.0068763624876737595, -0.04608168825507164, 0.03704959526658058, -0.08801217377185822, 0.014753736555576324, -0.07200422137975693, -0.013830958865582943, -0.005127912387251854, -0.018034683540463448, 0.036017950624227524, 0.0799701139330864, 0.060890499502420425, -0.051107197999954224, 0.0278711449354887, -0.03024240769445896, 0.04705241322517395, -0.016530120745301247, 0.038238439708948135, 0.022580817341804504, -0.035936158150434494, -0.010216228663921356, 0.040392037481069565, -0.0001442668872186914, -0.014729860238730907, -0.0027524998877197504, -0.06149118021130562, 0.048220861703157425, 0.022966796532273293, 0.040731362998485565, -0.00914591085165739, -0.0337713323533535, 0.12664513289928436, 0.02734185755252838, 0.0664280354976654, 0.050859395414590836, 0.010298981331288815, 0.022680621594190598, -0.017663579434156418, -0.002142485696822405, -0.01563701033592224, 0.005007422994822264, -0.019803335890173912, 0.0038719335570931435, -0.005204471759498119, 0.02762734331190586, -0.10820015519857407, 0.07152972370386124, -0.06157882139086723, 0.011102030985057354, -0.04819797724485397, -0.01715594157576561, 0.009013433940708637, 0.01018638163805008, -0.01834709197282791, 0.1884472370147705, -0.02658756822347641, 0.03415515273809433, 0.028613492846488953, -0.020167965441942215, 0.03212357684969902, 0.07461893558502197, 0.07354234904050827, 0.0716872587800026, -0.07389869540929794, -0.046690646559000015, -0.06786438077688217, -0.07042811065912247, 0.015403099358081818, -0.041169848293066025, -0.019865240901708603, 0.06323368847370148, -0.027120189741253853, 0.02161642722785473, 0.008303430862724781, 0.00023719163436908275, -0.06152033060789108, -0.031782183796167374, 0.03204506263136864, 0.038374874740839005, -0.014184365049004555, 0.030884454026818275, 0.008484017103910446, -0.025160474702715874, -0.012248198501765728, -0.05025186389684677, 0.03076336719095707, 0.04602467641234398, -0.02906278893351555, 0.06341150403022766, 0.04504868760704994, 0.007453437428921461, -0.03629319742321968, -0.018411723896861076, 0.05566177889704704, 0.010671918280422688, -0.029778260737657547, -0.043714333325624466, -0.06698017567396164, -0.03155813738703728, -0.03645467013120651, -0.016422608867287636, 0.026303960010409355, -0.021178599447011948, 0.017911363393068314, 0.037014786154031754, -0.030630547553300858, 0.03951677307486534, 0.002934827469289303, 0.0012008054181933403, 0.021168390288949013, 0.03286024555563927, -0.010797742754220963, -0.030885765329003334, -0.011092578060925007, 0.016740061342716217, -0.05513932183384895, 0.040744099766016006, 0.027225583791732788, 0.018234416842460632, 0.009097106754779816, -0.003071599407121539, -0.04122026264667511, -0.03842388466000557, 0.034213028848171234, -0.0020278573501855135, 0.03032085858285427, 0.027924085035920143, -0.0243860874325037, -0.0019076885655522346, -0.0010829297825694084, 0.02570212073624134, 0.0075456262566149235, -0.02767120487987995, 0.007614837493747473, -0.006974811665713787, 0.02223583124577999, 0.0005539038684219122, -0.019437260925769806, -0.0440511554479599, 0.03817354142665863, 0.01896742172539234, -0.009307285770773888, -0.11205951869487762, -0.05555455759167671, -0.02019074745476246, 0.0266121793538332, -0.04357346519827843, -0.0204219538718462, 0.0024158074520528316, -0.032917264848947525, 0.02218874916434288, 0.01545493584126234, 0.02334737405180931, 0.0141018470749259, 0.026834122836589813, -0.022955670952796936, 0.004487958271056414, -0.015482805669307709, -0.015872376039624214, 0.026193441823124886, 0.05261171981692314, 0.03511809930205345, -0.06101751700043678, 0.015366172417998314, 0.004289973061531782, -0.01577761396765709, -0.020299941301345825, -0.061087291687726974, 0.054887764155864716, -0.00941070169210434, 0.0184142105281353, -0.04733128845691681, 0.019933555275201797, -0.011328439228236675, -0.035861480981111526, -0.010026048868894577, -0.06513357907533646, -0.005332530941814184, -0.009185118600726128, -0.010075202211737633, 0.04445628449320793, 0.017409302294254303, 0.013298283331096172, 0.01627962477505207, 0.024159321561455727, -0.014648980461061, 0.014231517910957336, -0.0029060884844511747, -0.015261802822351456, 0.03273614123463631, 0.027824224904179573, -0.011492983438074589, -0.030234934762120247, -0.000636895711068064, 0.013676012866199017, 0.03644886985421181, 0.007394151296466589, 0.015622438862919807, -0.008417394012212753, 0.03895627334713936, 0.006630642805248499, -0.040237873792648315, -0.04682149365544319, -0.008350313641130924, -0.025228159502148628, -0.025656672194600105, -0.04442505165934563, 0.03553248196840286, -0.021828768774867058, 0.02316056750714779, -0.014662732370197773, 0.009459417313337326, 0.002138877520337701, 0.025835836306214333, 0.012249925173819065, 0.018866730853915215, 0.004019457846879959, -0.000652200891636312, -0.002579780761152506, -0.03542742878198624, 0.06794577836990356, 0.016353314742445946, -0.024213096126914024, -0.004237242508679628, -0.01401055883616209, 0.0008290079422295094, -0.0378941111266613, 0.004165003076195717, 0.03301644325256348, -0.0018457781989127398, 0.01707128807902336, 0.039005398750305176, 0.004166622646152973, -0.020559608936309814, 0.0020286657381802797, -0.019748065620660782, -0.0027709919959306717, 0.011916999705135822, 0.03629739210009575, 0.027616165578365326, 0.00047779257874935865, 0.03394027426838875, 0.031860001385211945, -0.013536189682781696, -0.03410534933209419, 0.0211783517152071, 0.015177098102867603, 0.0560811385512352, -0.02213592641055584, -0.05085134133696556, 0.048398878425359726, -0.015576841309666634, 0.030272141098976135, -0.03920421004295349, -0.018374236300587654, -0.012283716350793839, 0.03241534158587456, -0.008212724700570107, 0.006227349396795034, -0.02527201548218727, -0.047554124146699905, 0.0368351973593235, -0.021792681887745857, 0.029519757255911827, -0.023035021498799324, -0.040533147752285004, -0.011947639286518097, -0.003725593676790595, 0.034557655453681946, -0.017801005393266678, 0.001109556877054274, -0.002805655123665929, -0.0012919168220832944, -0.02462012879550457, 0.021784290671348572, 0.001239424804225564, 0.0014062152476981282, 0.007189857307821512, -0.002982502803206444, 0.022899581119418144, 0.02134506031870842, -0.04630380868911743, -0.027526916936039925, -0.01052769087255001, 0.03697504848241806, -0.03202054277062416, 0.045797113329172134, -0.0023574132937937975, -0.06726294010877609, 0.011938896030187607, -0.043055854737758636, 0.016465699300169945, 0.02241472899913788, -0.02602687105536461, -0.02438058704137802, 0.03267131745815277, 0.026340143755078316, -0.009909535758197308, 0.011078478768467903, 0.009254137054085732, -0.003996961284428835, 0.05247719585895538, -0.004679627250880003, -0.006574038881808519, -0.01133844256401062, 0.027810128405690193, 0.004157089162617922, 0.007087201811373234, -0.0011757181491702795, -0.055721331387758255, -0.00161839765496552, -0.00005350441642804071, -0.004210967104882002, 0.00873936153948307, 0.007516136392951012, -0.03319929540157318, -0.012408668175339699, 0.0667625144124031, 0.039837438613176346, -0.006333810277283192, 0.016783714294433594, 0.014520874246954918, -0.053567349910736084, 0.004345076158642769, 0.041252363473176956, -0.003655593376606703, -0.002805138938128948, 0.013117202557623386, 0.05365845933556557, 0.04582822322845459, -0.00507361488416791, 0.02403983101248741, -0.014197241514921188, -0.02987123467028141, 0.007343836594372988, -0.021915433928370476, 0.01779060810804367, -0.03950544819235802, -0.0002575333055574447, -0.01955713890492916, -0.002939697355031967, -0.01833297871053219, 0.0027127983048558235, 0.04795162379741669, -0.04470568895339966, 0.005092475563287735, 0.02115892805159092, -0.000010540939911152236, 0.02536957524716854, -0.02922508493065834, 0.028542429208755493, -0.03290729597210884, -0.017819182947278023, 0.0028302513528615236, 0.009829630143940449, -0.01369612105190754, 0.01720449887216091, -0.002458807546645403, -0.0428246408700943, -0.004975349176675081, 0.009237948805093765, 0.04238259047269821, -0.005998610053211451, 0.005226694047451019, -0.02665008045732975, -0.0270537119358778, 0.035020433366298676, -0.02082996256649494, 0.001711565419100225, -0.005252253729850054, -0.018216779455542564, 0.03227391839027405, 0.04084436595439911, -0.031210092827677727, 0.010838693007826805, 0.03256145864725113, 0.026780767366290092, 0.019600894302129745, -0.060132723301649094, 0.020067568868398666, 0.04141615703701973, -0.004174534231424332, 0.02844478189945221, -0.005506220739334822, -0.05163785442709923, -0.0008523000869899988, -0.043461378663778305, 0.00804948341101408, 0.10204055160284042, 0.021056663244962692, -0.0019607774447649717, 0.002626200905069709, 0.03647834062576294, -0.003757304046303034, 0.008310727775096893, -0.023846779018640518, 0.007966370321810246, 0.028425637632608414, 0.019242526963353157, -0.009485781192779541, 0.0025814760010689497, -0.017954524606466293, 0.001704191556200385, -0.047488436102867126, 0.011128713376820087, 0.019529396668076515, -0.0436130166053772, 0.000032682019082130864, -0.01503810379654169, -0.06945661455392838, -0.014890048652887344, 0.02132134512066841, 0.01881253719329834, 0.0649496465921402, 0.005872368812561035, 0.0017389488639310002, -0.020870089530944824, -0.03941457346081734, 0.018474329262971878, 0.05525118485093117, -0.02297559753060341, 0.04029597342014313, 0.03261270001530647, 0.058751896023750305, 0.023983333259820938, 0.013246691785752773, 0.02788461372256279, 0.035447921603918076, 0.06131412461400032, -0.007345839869230986, 0.078177310526371, 0.026043036952614784, -0.010069534182548523, 0.0019273551879450679, -0.029134251177310944, 0.0054383953101933, 0.004722150508314371, 0.0016529096756130457, 0.015792418271303177, 0.005955406464636326, -0.012493105605244637, -0.017883827909827232, 0.019496988505125046, 0.006698210258036852, 0.03186895325779915, 0.0027057472616434097, 0.008256811648607254, 0.053095173090696335, 0.004631035029888153, 0.023856617510318756, 0.008723082020878792, -0.009832426905632019, 0.0020320138428360224, 0.06146872043609619, 0.014115736819803715, 0.015211313962936401, -0.04400377348065376, -0.0030135433189570904, 0.04346919432282448, -0.01634369045495987, -0.0231936052441597, -0.004906033631414175, 0.0028902292251586914, -0.046585578471422195, -0.03967834636569023, 0.012773917987942696, -0.02495402656495571, -0.01921646110713482, 0.006497042253613472, 0.01515556313097477, -0.020074833184480667, -0.01657700724899769, 0.0019843392074108124, 0.03442089632153511, -0.0031591164879500866, 0.013055502437055111, 0.011915299110114574, 0.05843578651547432, 0.03321364149451256, 0.005433641839772463, -0.03102000802755356, -0.02193470112979412, -0.031138908118009567, -0.004120065830647945, -0.015082617290318012, -0.01898077316582203, 0.009646828286349773, -0.029081951826810837, -0.02507651224732399, 0.035881832242012024, 0.0007734012906439602, 0.034687746316194534, 0.014898903667926788, 0.03830188140273094, -0.03513142839074135, 0.01726890727877617, 0.011111614294350147, 0.009013528004288673, 0.00405952800065279, -0.022292623296380043, 0.016641836613416672, -0.0010409974493086338, 0.00031854803091846406, 0.030519535765051842, 0.009373383596539497, -0.03348918631672859, -0.03669505566358566, 0.0031867390498518944, -0.016523372381925583, -0.0037667579017579556, 0.0691564753651619, -0.0015105013735592365, -0.01448961440473795, 0.025041429325938225, -0.019802061840891838, 0.01765470951795578, -0.004505034536123276, 0.01906678080558777, 0.06390322744846344, -0.0189561415463686, -0.010960809886455536, -0.00011239926243433729, 0.049310196191072464, 0.0331529937684536, 0.0033176166471093893, 0.03598682954907417, 0.03111635521054268, 0.007389280013740063, -0.027673134580254555, 0.032971665263175964, -0.030218016356229782, -0.01775805838406086, -0.020881328731775284, -0.031331535428762436, -0.0023247699718922377, -0.042812127619981766, -0.006856565363705158, -0.005388536490499973, -0.04238131642341614, 0.0015745374839752913, -0.00571600254625082, -0.025365153327584267, -0.02592766471207142, 0.014119896106421947, 0.02292492426931858, 0.04770173132419586, 0.04756711423397064, 0.0071389153599739075, -0.016656918451189995, 0.026545235887169838, 0.004452836699783802, 0.018169626593589783, 0.036654774099588394, 0.03265312686562538, -0.02565193548798561, -0.031984973698854446, 0.011486929841339588, -0.002563633257523179, -0.03482970967888832, 0.05816136673092842, 0.004422637168318033, -0.012339347042143345, -0.04652457684278488, -0.000052273364417487755, 0.03640860319137573, 0.008474237285554409, 0.05294802412390709, -0.02972237579524517, -0.03281286731362343, 0.006012913770973682, -0.008310847915709019, -0.031538091599941254, -0.0020703852642327547, -0.070342518389225, -0.020245378836989403, 0.028596952557563782, -0.011769410222768784, 0.004582507535815239, 0.0013781305169686675, -0.02042279951274395, 0.028731292113661766, -0.002696068026125431, -0.03690718114376068, -0.047616541385650635, 0.0012896308908239007, 0.04804446920752525, -0.029510250315070152, -0.027247697114944458, 0.029342448338866234, 0.023161130025982857, -0.03314927965402603, 0.006733758375048637, -0.011360078118741512, -0.010926207527518272, 0.0005664747441187501, 0.014673898927867413, -0.022727301344275475, 0.06964656710624695, -0.005700128618627787, -0.06137530505657196, -0.033595599234104156, -0.008796639740467072 ]
Sentence Transformers in the 🤗 Hub
nreimers
June 28, 2021
sentence-transformers-in-the-hub
open-source-collab, nlp
https://huggingface.co/blog/sentence-transformers-in-the-hub
References 1. Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks. https://arxiv.org/abs/1908.10084
[ 0.022776661440730095, -0.0043501718901097775, 0.0647883489727974, -0.019252130761742592, 0.07645928114652634, 0.057345546782016754, -0.015995105728507042, 0.0689772367477417, -0.06122652441263199, -0.05106569826602936, -0.062253162264823914, 0.026718908920884132, -0.03353109955787659, 0.013503704220056534, -0.023124825209379196, 0.016754763200879097, 0.030362240970134735, -0.016506584361195564, 0.03304091840982437, -0.03558078035712242, -0.029726412147283554, -0.01814405620098114, 0.07834655046463013, -0.0025164990220218897, 0.07158706337213516, -0.008184331469237804, -0.001951521378941834, 0.0340920127928257, -0.0860169306397438, 0.03769797831773758, -0.06699498742818832, 0.003889539046213031, 0.055820319801568985, -0.0106858154758811, -0.05365222692489624, -0.013468969613313675, -0.10802006721496582, 0.05954353138804436, -0.03393687307834625, -0.04124974459409714, -0.015533729456365108, -0.01787242479622364, -0.013070219196379185, 0.023618334904313087, -0.010622591711580753, -0.04897988960146904, -0.18965569138526917, 0.13310980796813965, 0.007848493754863739, -0.026363693177700043, -0.10120793431997299, 0.04875464737415314, -0.017714548856019974, 0.004366419278085232, -0.04181692376732826, 0.07442784309387207, 0.004894568119198084, -0.09893370419740677, 0.10095620900392532, -0.011838904581964016, 0.04116524010896683, -0.011931070126593113, 0.018696099519729614, 0.00399002293124795, 0.03735017776489258, 0.08117038011550903, -0.025207338854670525, 0.012432830408215523, -0.0379507876932621, 0.027594270184636116, 0.023650744929909706, 0.0015604934887960553, -0.05896458774805069, -0.005388645920902491, 0.03841223195195198, -0.08905066549777985, -0.025088023394346237, -0.006311169825494289, 0.029495969414711, 0.025195855647325516, 0.007514777593314648, 0.00266264914534986, 0.0394824743270874, 0.06936334073543549, 0.04204506799578667, 0.019570572301745415, 0.0757102444767952, -0.02125009149312973, -0.06388246268033981, 0.016931872814893723, -0.03545863926410675, -0.14289046823978424, -0.08245882391929626, 0.02185847982764244, 0.031746815890073776, -0.06046514958143234, 0.03249749913811684, 0.042615119367837906, -0.004350150469690561, -0.00592322601005435, 0.0020787781104445457, -0.031373441219329834, 0.0819803848862648, -0.028926221653819084, -0.07673771679401398, 0.01675930805504322, -0.002792794955894351, -0.057525381445884705, -0.043329086154699326, -0.010186119936406612, -0.0052903504110872746, 0.015242224559187889, 0.05920130014419556, 0.06192483752965927, -0.07393071800470352, 0.04034975916147232, 0.01993056945502758, 0.013803074136376381, 0.02486676163971424, 0.004427547100931406, -0.03692266345024109, 0.060502491891384125, 0.07810107618570328, 0.03206653520464897, 0.041198499500751495, 0.03174692019820213, 0.007469088304787874, 0.014605133794248104, -0.025666235014796257, -0.0002512784849386662, 0.04458555579185486, 0.009425707161426544, 0.09907353669404984, -0.003939975518733263, 0.017013652250170708, -0.02908695861697197, -0.005157169885933399, -0.027917150408029556, -0.02787775732576847, 0.00019818120927084237, -0.01402795035392046, 0.046007029712200165, -0.00902243796736002, 0.07224559783935547, 0.06694886833429337, -0.02584811858832836, -0.09490659087896347, 0.087980717420578, -0.02239268645644188, 0.0039549777284264565, -0.04135722294449806, 0.006314652971923351, -0.033057745546102524, -0.02937876433134079, 0.01882355473935604, 0.041404832154512405, 0.024162419140338898, 0.02370886690914631, -0.08142776787281036, -0.019418375566601753, 0.026082808151841164, 0.007274854462593794, -0.04147268086671829, -0.01183257531374693, 0.033532556146383286, -0.0659434050321579, -0.006839972920715809, 0.04224703460931778, -0.02165799029171467, -0.014504456892609596, -0.0004020279156975448, -0.045670539140701294, 0.08696597814559937, -0.020734770223498344, -0.07390058040618896, 0.05733473226428032, 0.061036452651023865, 0.06613975018262863, -0.00267618615180254, -0.016896305605769157, -0.04422689229249954, 0.0016109318239614367, 0.011661285534501076, 0.032387979328632355, -0.004460412077605724, 0.0020877330098301172, 0.023873647674918175, -0.03955282270908356, 0.0038750821258872747, 0.023323481902480125, -0.08173643052577972, -0.03146160766482353, 0.06328395009040833, -0.0011246056528761983, 0.010316192172467709, -0.04547445848584175, -0.04309813678264618, 0.11726575344800949, 0.042893484234809875, 0.042409032583236694, 0.06595311313867569, 0.012500499375164509, 0.03766152262687683, -0.012404142878949642, -0.018229153007268906, -0.000031388874049298465, 0.010011090897023678, -0.012640506960451603, 0.03334846720099449, -0.03219510614871979, 0.025934651494026184, -0.09928891062736511, 0.02563530206680298, -0.09578913450241089, -0.03721925988793373, -0.0758805200457573, 0.02126103639602661, 0.01666516624391079, 0.0005719160544686019, -0.025333043187856674, 0.1472630798816681, 0.00031140839564614, -0.010152843780815601, 0.0068473112769424915, -0.018420111387968063, 0.08379334211349487, 0.034089259803295135, 0.02530101127922535, 0.10521889477968216, -0.05206385254859924, -0.018585454672574997, -0.05046603083610535, 0.1102641150355339, 0.09023263305425644, -0.01366359181702137, 0.02179908938705921, -0.001524800551123917, 0.011160220019519329, 0.031097812578082085, -0.05632229521870613, 0.022521307691931725, 0.012398522347211838, 0.024489587172865868, 0.06687938421964645, -0.06640955805778503, -0.015889370813965797, 0.03793983906507492, 0.02354372665286064, -0.03355398401618004, 0.0152335986495018, -0.08177897334098816, 0.01639513485133648, -0.0064180451445281506, -0.04131549596786499, 0.06336130201816559, 0.05532170459628105, -0.0031346329487860203, -0.024022940546274185, -0.018725449219346046, 0.014373629353940487, -0.007759810425341129, -0.04395638778805733, 0.0033149970695376396, -0.05332544818520546, -0.01148900669068098, -0.025029437616467476, 0.01578758843243122, -0.0042899721302092075, 0.009985918179154396, 0.03780148923397064, 0.008087178692221642, -0.02067362330853939, 0.027735978364944458, 0.020616590976715088, 0.05113145336508751, 0.020287727937102318, 0.0273625236004591, -0.020194323733448982, -0.03517394885420799, -0.012064212001860142, -0.029705194756388664, -0.039378732442855835, 0.03566701337695122, 0.015843821689486504, 0.015725646167993546, -0.008050385862588882, -0.001996310893446207, -0.03199218586087227, 0.02718220464885235, 0.02380944974720478, -0.007901319302618504, 0.027867918834090233, -0.034333933144807816, -0.01686723157763481, 0.002369280206039548, 0.001889983075670898, -0.00732602272182703, 0.006195517722517252, -0.020770715549588203, -0.014091860502958298, 0.03730091452598572, 0.025393972173333168, -0.020553695037961006, -0.008207680657505989, -0.026000799611210823, 0.02029522694647312, 0.0205187126994133, 0.05730605870485306, -0.12192755937576294, -0.020246194675564766, 0.059500209987163544, 0.021923841908574104, 0.010146115906536579, -0.011475810781121254, 0.05788448080420494, -0.03392748907208443, -0.04028267785906792, -0.009391479194164276, 0.028788762167096138, -0.002523822244256735, 0.0225118026137352, -0.016648417338728905, -0.004948727786540985, -0.027588188648223877, -0.05141092464327812, 0.008505655452609062, 0.00944527704268694, -0.0035095238126814365, -0.024886954575777054, 0.03498324751853943, -0.027191046625375748, -0.009093216620385647, -0.01693137362599373, 0.035963792353868484, -0.006761559750884771, 0.02197996713221073, 0.041844770312309265, -0.04440741240978241, -0.026168417185544968, -0.005780537612736225, -0.02327045053243637, 0.008296547457575798, -0.05627691373229027, -0.002768421545624733, -0.01680862344801426, 0.00221529440023005, 0.03297290578484535, 0.01197755429893732, 0.010517878457903862, 0.007954295724630356, 0.0203002467751503, -0.021482186391949654, -0.023693589493632317, -0.0007218471146188676, 0.0035258724819868803, 0.01985546201467514, 0.04394984245300293, -0.04293355345726013, -0.0028552620206028223, -0.02044307440519333, 0.004900624509900808, 0.03326238691806793, 0.006565658375620842, -0.022349437698721886, -0.01264975406229496, -0.012600871734321117, 0.025636306032538414, -0.021380607038736343, -0.03205741196870804, 0.032646216452121735, -0.018978388980031013, -0.006510366685688496, -0.029362447559833527, 0.07096448540687561, -0.0022412484977394342, 0.05072459951043129, 0.009320181794464588, 0.05919943377375603, 0.01903197541832924, -0.00047607719898223877, -0.005043983459472656, 0.012231672182679176, -0.02039761282503605, 0.031477149575948715, -0.005241645034402609, -0.023239348083734512, 0.09352564066648483, -0.02969711273908615, -0.03403043746948242, 0.016885818913578987, -0.030461164191365242, -0.006258661858737469, -0.004894593730568886, 0.009179404005408287, -0.01859729364514351, 0.006156477145850658, -0.005953359417617321, 0.010435457341372967, 0.03567712381482124, -0.018710114061832428, 0.019051408395171165, 0.01599186658859253, -0.01382246520370245, 0.014403220266103745, 0.03630739077925682, -0.01553722657263279, -0.0014469746965914965, 0.015977319329977036, 0.017705373466014862, -0.03471403568983078, -0.02997964434325695, -0.004791435319930315, -0.001118889544159174, 0.041656650602817535, -0.0488688088953495, -0.00389529624953866, -0.01711864396929741, -0.02697014808654785, 0.003920599818229675, -0.020446419715881348, 0.005068873520940542, -0.009519298560917377, 0.023244541138410568, -0.01660674810409546, -0.023683913052082062, -0.0496002621948719, -0.06882449984550476, 0.0013782578753307462, -0.03597395867109299, 0.0313321053981781, 0.015498293563723564, 0.018265489488840103, -0.012466205283999443, -0.011387626640498638, 0.0032629987690597773, 0.034258004277944565, -0.04458652809262276, -0.017364028841257095, -0.06451629102230072, -0.013674289919435978, 0.015672262758016586, -0.0003914217813871801, 0.016120273619890213, 0.0024063969030976295, -0.008919949643313885, 0.033462852239608765, -0.03505073860287666, -0.07814575731754303, -0.0023079810198396444, -0.002576034516096115, 0.016620740294456482, -0.04378919675946236, 0.04651844501495361, 0.0030171803664416075, -0.018909748643636703, -0.030398348346352577, 0.008825507946312428, 0.056737273931503296, 0.06527965515851974, -0.0015558896120637655, -0.03830890357494354, 0.0182245634496212, 0.022595074027776718, 0.002127902815118432, 0.015920905396342278, 0.02878762222826481, 0.011921674944460392, 0.10038851201534271, 0.009599928744137287, -0.005170626565814018, -0.05182395502924919, 0.024082999676465988, -0.009504184126853943, 0.006468720268458128, 0.02090400643646717, -0.050412390381097794, 0.009646887890994549, -0.0012810906628146768, -0.011173500679433346, -0.044389378279447556, 0.047082964330911636, -0.02394022047519684, 0.009627987630665302, 0.02930315025150776, -0.023446008563041687, 0.01994802989065647, -0.008968236856162548, 0.030506938695907593, -0.016019532456994057, -0.007325070444494486, -0.00513415364548564, 0.006252045277506113, -0.006902004592120647, 0.012342923320829868, 0.02590782195329666, 0.033498454838991165, -0.00823990348726511, 0.02639116905629635, 0.002326482441276312, -0.004639045335352421, 0.02106153964996338, 0.000012883305316790938, 0.018490789458155632, -0.018346939235925674, -0.015393869020044804, -0.028403567150235176, -0.007785197347402573, 0.007137123961001635, 0.03648936748504639, 0.02821667678654194, -0.04438234865665436, -0.01772564835846424, 0.023856813088059425, -0.024814128875732422, 0.01861642859876156, -0.0511896014213562, 0.03824891522526741, -0.03782980516552925, -0.0006102726329118013, 0.0008909940370358527, -0.02344028651714325, 0.009097390808165073, 0.00558719364926219, -0.01111222431063652, -0.02599497325718403, -0.003651050152257085, 0.006944025866687298, 0.03587900847196579, 0.022613372653722763, -0.014644455164670944, -0.033696986734867096, 0.06125012785196304, 0.02823859639465809, -0.018858090043067932, -0.006105238571763039, 0.018310928717255592, 0.030618570744991302, 0.039313387125730515, 0.040078818798065186, 0.002458675531670451, 0.0024493434466421604, 0.03289062902331352, -0.01843593269586563, -0.0001287159975618124, -0.0276547409594059, 0.022764410823583603, 0.021900644525885582, -0.010288819670677185, 0.019768714904785156, -0.013839141465723515, -0.016279758885502815, 0.0266842283308506, -0.015317984856665134, -0.003566551487892866, 0.08148100227117538, -0.0036084437742829323, 0.01718072034418583, 0.01095569133758545, 0.014489339664578438, -0.016401562839746475, -0.029101932421326637, 0.005550638306885958, 0.01542072556912899, 0.03044603019952774, 0.022429149597883224, 0.017057685181498528, 0.007261417340487242, 0.022324780002236366, 0.036225199699401855, -0.05226447805762291, 0.014614137820899487, 0.028463089838624, -0.05125695466995239, 0.02840200439095497, 0.011050575412809849, -0.012910222634673119, 0.013987313024699688, 0.01037272997200489, -0.02123868465423584, 0.02905886620283127, 0.0005140788271091878, -0.0052420818246901035, 0.016167322173714638, 0.0036000104155391455, 0.01969924010336399, 0.054607659578323364, -0.020505724474787712, 0.0341486893594265, 0.04236697033047676, -0.0036113716196268797, 0.013178924098610878, -0.012824290432035923, -0.04519011825323105, 0.01664859801530838, 0.047996584326028824, -0.010505768470466137, 0.029759814962744713, 0.005123337265104055, -0.02896900288760662, 0.0014907193835824728, -0.010299754329025745, -0.0053208814933896065, -0.048601843416690826, 0.029828373342752457, 0.046273574233055115, -0.031514644622802734, 0.00009654194582253695, -0.051613450050354004, 0.04590770602226257, 0.029470067471265793, 0.01846536062657833, -0.028992878273129463, 0.021085064858198166, 0.031121008098125458, 0.02549617551267147, 0.0038303853943943977, 0.014254075475037098, 0.0018427025061100721, 0.017127448692917824, 0.05833885446190834, 0.010493854060769081, 0.012358437292277813, 0.006630111951380968, -0.03641717880964279, 0.01977154053747654, -0.01561459619551897, -0.02041403204202652, 0.007751517929136753, 0.05346238240599632, -0.02378244511783123, 0.003975134342908859, 0.006765890866518021, -0.02503240667283535, -0.001224155304953456, 0.006973035167902708, 0.010301812551915646, -0.0078070866875350475, -0.0025874534621834755, -0.010278095491230488, 0.049214672297239304, 0.010927149094641209, -0.007154129445552826, -0.0025230038445442915, 0.011076335795223713, 0.014667592942714691, 0.04645140841603279, -0.028299231082201004, -0.02888638712465763, -0.059638891369104385, -0.011959715746343136, -0.03156755492091179, -0.013883518055081367, 0.0052862754091620445, -0.02434532344341278, 0.007531356066465378, 0.026784978806972504, -0.04788797348737717, 0.015885960310697556, 0.0179520882666111, 0.022192250937223434, 0.005335654132068157, 0.04073650762438774, -0.023070186376571655, -0.01857532560825348, -0.02318030223250389, -0.06017782539129257, -0.012692112475633621, -0.01508576050400734, 0.0011102056596428156, 0.03835378214716911, 0.03264768049120903, -0.028580930083990097, -0.03503591939806938, 0.018545495346188545, -0.005447811912745237, -0.04361287131905556, 0.010322950780391693, 0.03515275567770004, -0.021777119487524033, -0.0275187436491251, 0.00504806125536561, -0.010997847653925419, -0.032045893371105194, 0.0009124528151005507, 0.03052409365773201, -0.005891422741115093, -0.03814749792218208, -0.04407990351319313, 0.03424545004963875, 0.005615489557385445, 0.03076329454779625, 0.03830551356077194, 0.011568120680749416, 0.006328235846012831, -0.02746863290667534, 0.0011260943720117211, -0.027583882212638855, -0.005071442574262619, -0.017372293397784233, -0.06141369789838791, -0.03695560619235039, 0.0049224309623241425, 0.007062970194965601, 0.030887141823768616, -0.052468180656433105, 0.028860490769147873, -0.010316072031855583, -0.018222147598862648, -0.022146016359329224, 0.028372492641210556, 0.07250148057937622, 0.009301256388425827, 0.04319608211517334, 0.004029526375234127, 0.0045946212485432625, -0.03103908710181713, -0.00429261289536953, -0.008189012296497822, 0.021514756605029106, 0.03230930492281914, -0.0018703609239310026, -0.04910873994231224, -0.013805334456264973, -0.03926553204655647, -0.05086618289351463, -0.007083316333591938, 0.00955200009047985, 0.024291720241308212, -0.034298449754714966, -0.020761480554938316, -0.007974468171596527, 0.006449501495808363, 0.02612234093248844, 0.019413229078054428, -0.026193993166089058, -0.009634769521653652, -0.004845012445002794, -0.02034212276339531, -0.005893235094845295, -0.0016226544976234436, -0.0214823130518198, 0.06581589579582214, 0.03480340540409088, -0.008050632663071156, -0.017075028270483017, -0.03935708850622177, 0.007591793779283762, -0.0034752185456454754, -0.05792786180973053, -0.02591640129685402, 0.002269512042403221, -0.014194279909133911, -0.04823359102010727, -0.056506045162677765, 0.04371573030948639, 0.02584885247051716, -0.016200358048081398, -0.016840700060129166, 0.006166158709675074, 0.010288984514772892, -0.02583141252398491, 0.0061706239357590675, 0.025566477328538895, 0.06187782809138298, 0.0284735094755888, -0.006686564069241285, 0.027348652482032776, 0.01590985246002674 ]
Sentence Transformers in the 🤗 Hub
nreimers
June 28, 2021
sentence-transformers-in-the-hub
open-source-collab, nlp
https://huggingface.co/blog/sentence-transformers-in-the-hub
Unleashing the Power of Sharing So why is this powerful? In a matter of minutes, you can share your trained models with the whole community. python from sentence_transformers import SentenceTransformer # Load or train a model model.save_to_hub("my_new_model") Now you will have a repository in the Hub which hosts your model. A model card was automatically created. It describes the architecture by listing the layers and shows how to use the model with both Sentence Transformers and 🤗 Transformers. You can also try out the widget and use the Inference API straight away! If this was not exciting enough, your models will also be easily discoverable by filtering for all Sentence Transformers models.
[ 0.039578720927238464, -0.015780877321958542, 0.0017768257530406117, 0.02431371808052063, 0.05289080739021301, 0.04549489542841911, 0.005495517980307341, 0.05549459159374237, -0.05449454113841057, 0.008692339062690735, -0.030047832056879997, 0.024143019691109657, 0.035345859825611115, 0.08309273421764374, -0.018932273611426353, -0.08559450507164001, 0.03492925316095352, -0.024520164355635643, -0.03131374344229698, 0.010397642850875854, 0.0007223885040730238, -0.07581157237291336, 0.029078176245093346, -0.047690778970718384, 0.00957857258617878, -0.029540695250034332, 0.07795025408267975, 0.007587030064314604, -0.027670303359627724, 0.026574552059173584, -0.07365259528160095, 0.028078749775886536, 0.008381321094930172, -0.03557097166776657, -0.005280995741486549, -0.00728582451120019, -0.11151665449142456, 0.030476994812488556, -0.007700635585933924, -0.04138340801000595, 0.04032672569155693, 0.01803901232779026, -0.05527351424098015, -0.00925555918365717, -0.014285678043961525, -0.03209489583969116, -0.15576627850532532, 0.07636620104312897, -0.03605112433433533, -0.047611385583877563, -0.08120240271091461, 0.07000856101512909, -0.029935268685221672, 0.0035014613531529903, 0.022961463779211044, 0.0578739307820797, -0.029399683699011803, -0.10797771066427231, -0.013661707751452923, 0.04223394766449928, -0.002730804495513439, 0.013589434325695038, 0.04092542082071304, 0.0869825929403305, 0.010778956115245819, 0.025826502591371536, -0.018591953441500664, 0.002637418918311596, -0.03711967542767525, -0.06498701125383377, -0.013520510867238045, -0.03929770737886429, -0.06296484917402267, -0.03866659477353096, 0.005959479603916407, -0.04050485044717789, -0.011540194973349571, 0.05012095347046852, 0.09018585830926895, -0.03409604728221893, 0.024590974673628807, 0.021583354100584984, 0.012878553941845894, -0.0011561405844986439, 0.09515929222106934, -0.018705381080508232, -0.015447149984538555, -0.05083097890019417, -0.043919119983911514, -0.017175134271383286, -0.037474945187568665, -0.10967781394720078, -0.01662283204495907, 0.02326933853328228, 0.0815490260720253, 0.0163434986025095, -0.005387722514569759, 0.017800843343138695, -0.03672691434621811, -0.05173490196466446, -0.039956554770469666, -0.08871224522590637, 0.028960276395082474, -0.04926084727048874, -0.023508314043283463, 0.03215932473540306, 0.015427611768245697, -0.1258954107761383, 0.0021745243575423956, 0.015541967004537582, 0.00560166547074914, -0.005893779452890158, -0.08869598060846329, 0.09072280675172806, 0.004399166442453861, 0.009481540881097317, 0.02846253663301468, -0.014827527105808258, -0.013011605478823185, 0.015517540276050568, 0.012751970440149307, 0.026170050725340843, 0.025201639160513878, 0.03917637839913368, 0.019076703116297722, 0.054400574415922165, -0.02998669259250164, 0.0022217226214706898, 0.0015441427240148187, -0.021911827847361565, 0.05447209253907204, 0.020488951355218887, 0.02506116032600403, -0.00732635660097003, 0.036175377666950226, -0.04690379649400711, 0.02287597395479679, -0.03281866014003754, 0.030249563977122307, -0.006997331045567989, -0.0361444465816021, 0.08144623786211014, 0.006787565071135759, -0.0201095063239336, 0.041891008615493774, 0.05566457286477089, -0.09410714358091354, 0.05647747591137886, 0.040411677211523056, -0.027546009048819542, -0.11651180684566498, 0.058830730617046356, -0.004018502309918404, -0.06047670915722847, -0.006132372189313173, 0.0966983437538147, -0.01209454145282507, -0.006757052149623632, -0.017778391018509865, -0.008212574757635593, 0.007185181137174368, -0.042022641748189926, -0.03281541168689728, -0.01805834285914898, -0.04304854944348335, -0.010630586184561253, -0.008291943930089474, -0.037851087749004364, 0.0750867947936058, -0.01564621366560459, -0.005753525532782078, -0.019079480320215225, 0.026081275194883347, -0.06619007885456085, -0.015673357993364334, 0.07062891870737076, 0.011363345198333263, 0.03558105602860451, 0.014134308323264122, -0.032042186707258224, -0.03513104468584061, 0.04745500534772873, -0.0783456414937973, -0.008699269965291023, 0.06825508177280426, -0.05806168541312218, 0.036335624754428864, -0.020850179716944695, 0.00928595382720232, 0.026813441887497902, -0.0401545874774456, -0.02640117146074772, 0.07558029145002365, 0.011607230640947819, 0.03922932595014572, -0.06968465447425842, -0.026791827753186226, 0.05321963503956795, 0.04681474715471268, 0.06020387262105942, 0.04981020465493202, -0.015797769650816917, -0.005469211842864752, -0.056180261075496674, 0.0012530377134680748, 0.00870520155876875, -0.040338367223739624, -0.07437732070684433, 0.008016287349164486, 0.007932977750897408, -0.006804633419960737, -0.09589364379644394, 0.046661265194416046, -0.09557382017374039, -0.017930690199136734, -0.0558810755610466, -0.0458868034183979, 0.07556865364313126, -0.04028749465942383, 0.009411702863872051, 0.21465852856636047, -0.013825499452650547, -0.013194282539188862, -0.0032992686610668898, -0.030705919489264488, 0.04759220406413078, 0.005732244346290827, 0.057734593749046326, 0.03601165488362312, -0.07740060240030289, -0.04849667102098465, -0.021231723949313164, -0.006982811726629734, -0.001050377730280161, 0.01900670677423477, -0.017220234498381615, 0.010232103057205677, 0.008607042953372002, -0.027893587946891785, -0.036722712218761444, -0.01268176268786192, 0.013054516166448593, 0.01935083232820034, 0.005705708637833595, -0.006871973630040884, 0.027506781741976738, 0.06697294861078262, 0.04912171512842178, -0.023731853812932968, -0.0017829597927629948, -0.07175751775503159, -0.010939822532236576, 0.05025633051991463, 0.00002129374843207188, 0.06568058580160141, -0.0028643221594393253, 0.018329232931137085, -0.010037588886916637, 0.009167793206870556, 0.04378991574048996, 0.008178262040019035, 0.0022065555676817894, -0.03712903708219528, -0.044062450528144836, -0.003768891328945756, -0.03826724737882614, 0.008049861527979374, -0.015937449410557747, 0.0210801362991333, -0.0216708742082119, 0.006320511922240257, -0.06542724370956421, 0.014370426535606384, 0.015181884169578552, 0.019917963072657585, 0.0322243794798851, 0.005689730867743492, -0.01987573876976967, -0.019509069621562958, -0.011756675317883492, -0.02599158324301243, -0.03979893773794174, 0.019163765013217926, 0.014546230435371399, 0.002345278626307845, -0.0024169757962226868, -0.010770698077976704, -0.0214436873793602, -0.004250270314514637, 0.027723323553800583, 0.038621339946985245, 0.04129651188850403, 0.01819765754044056, -0.013345791958272457, -0.01261766254901886, -0.007890179753303528, -0.004149078391492367, -0.019505009055137634, 0.01096430979669094, 0.004831832833588123, 0.03136539086699486, 0.001093024155125022, 0.03972752019762993, -0.0036184058990329504, -0.005363298114389181, 0.01711561530828476, 0.003978119231760502, -0.016621805727481842, -0.091626837849617, -0.007853154093027115, -0.01676630601286888, 0.0165995005518198, 0.020224373787641525, 0.01321128848940134, 0.046089693903923035, -0.015704244375228882, -0.00828790944069624, 0.03275643661618233, -0.0314805768430233, -0.008812399581074715, -0.006616276688873768, 0.0216462854295969, -0.03181632235646248, 0.019853902980685234, -0.039102111011743546, 0.02624223567545414, 0.045759331434965134, 0.06939371675252914, -0.0013528960989788175, 0.020843710750341415, -0.008114853873848915, 0.006140520796179771, -0.007029836997389793, -0.0457037128508091, 0.0293949656188488, 0.012132953852415085, 0.02372998744249344, -0.048209164291620255, 0.00034069159300997853, -0.03147517144680023, -0.041313864290714264, -0.020805737003684044, -0.03159520402550697, 0.022692326456308365, -0.014587564393877983, 0.03434818610548973, 0.027305757626891136, 0.020165108144283295, -0.007869746536016464, -0.018180949613451958, 0.04883139953017235, -0.0005593300447799265, 0.02086067572236061, -0.017338993027806282, 0.026483135297894478, 0.013326621614396572, -0.024936622008681297, -0.03864089772105217, 0.020658260211348534, -0.018976295366883278, 0.06976820528507233, 0.03262609243392944, -0.003353622741997242, -0.0039000785909593105, 0.04062117263674736, 0.023500293493270874, -0.02681698463857174, -0.04555601626634598, -0.03816637396812439, -0.021170973777770996, 0.002774906577542424, -0.03759590536355972, -0.01304710190743208, 0.06891708076000214, 0.009203802794218063, 0.0017339937621727586, -0.0047368742525577545, 0.04888533055782318, -0.015253514051437378, 0.01984812133014202, 0.0076302834786474705, 0.012409457936882973, -0.058413825929164886, 0.05564788356423378, -0.015046615153551102, -0.046967193484306335, 0.08156175911426544, 0.04079800099134445, -0.025599678978323936, -0.02668728306889534, -0.07269136607646942, -0.034142155200242996, -0.000005775117188022705, 0.020988330245018005, 0.0404854491353035, -0.005041657481342554, 0.02287611924111843, 0.03723807632923126, 0.010337566956877708, -0.03014763630926609, 0.03130028024315834, 0.0415799506008625, 0.01777670718729496, -0.002455553039908409, 0.01072646677494049, 0.04370862990617752, -0.006236886139959097, -0.04504561424255371, 0.031001482158899307, -0.032480381429195404, -0.026936156675219536, 0.022636136040091515, -0.021090103313326836, 0.03149503469467163, -0.03616085648536682, 0.002374463016167283, -0.03614944964647293, -0.06096430867910385, -0.006202660035341978, 0.03520772606134415, -0.025638645514845848, -0.005952359177172184, 0.00449797511100769, 0.039977382868528366, -0.00996117852628231, 0.012497274205088615, -0.04758951812982559, 0.016446780413389206, -0.0008787661208771169, 0.05386025458574295, 0.03152822330594063, -0.016284460201859474, -0.012855948880314827, 0.005031120032072067, 0.030353572219610214, -0.01667017862200737, -0.03344963490962982, -0.014107569120824337, -0.0360352024435997, -0.013673900626599789, 0.02052144519984722, -0.0030032380018383265, -0.0016589740989729762, 0.020232325419783592, -0.010262061841785908, 0.009491969831287861, 0.018304139375686646, 0.011814420111477375, -0.0075158001855015755, 0.009473714977502823, 0.05001251772046089, -0.03234591707587242, 0.03691037371754646, -0.004325386136770248, -0.05741322413086891, 0.020777041092514992, -0.033908311277627945, -0.001603356096893549, 0.016395321115851402, 0.04243505001068115, -0.05257262662053108, -0.015938369557261467, 0.049152128398418427, -0.006026146933436394, 0.010260744951665401, 0.010223648510873318, 0.0374685674905777, 0.05625668168067932, -0.013753432780504227, 0.006620203144848347, -0.004762816708534956, 0.03231353312730789, 0.01070807408541441, 0.02296937070786953, -0.030985819175839424, -0.07234315574169159, 0.0278383269906044, 0.04803523048758507, -0.007251298986375332, 0.01935068890452385, 0.02993437834084034, -0.006120998412370682, -0.003141752677038312, 0.07395530492067337, -0.01024610735476017, 0.01573510281741619, -0.0124751515686512, -0.0037548979744315147, -0.027120960876345634, -0.01074568647891283, 0.014920394867658615, 0.006559950765222311, 0.007863289676606655, -0.02189067006111145, 0.087542325258255, 0.07946345955133438, -0.003410523757338524, 0.012023634277284145, -0.012229567393660545, 0.0024201846681535244, 0.01340272556990385, -0.020738178864121437, -0.0196028184145689, -0.05062690004706383, 0.011707891710102558, -0.004824780859053135, -0.0243081022053957, -0.0034066918306052685, 0.025090856477618217, 0.06218710541725159, -0.02452092431485653, -0.027718214318156242, 0.04271571710705757, -0.020356081426143646, -0.002724834019318223, 0.004578242544084787, 0.011733954772353172, -0.028418565168976784, 0.02989894524216652, -0.0075426846742630005, -0.013126364909112453, 0.006895565893501043, 0.003984633833169937, 0.006030539516359568, -0.007829979062080383, 0.011335252784192562, -0.013150815851986408, 0.04718763381242752, 0.0010105663677677512, -0.01784368045628071, -0.0251422431319952, -0.0015821767738088965, 0.025060277432203293, -0.0376400500535965, 0.0005796760669909418, 0.038372039794921875, 0.018662532791495323, -0.007785673253238201, 0.032717522233724594, 0.002338855294510722, 0.0512901209294796, 0.031014110893011093, 0.0015693764435127378, 0.030191892758011818, -0.0524754673242569, 0.03322801738977432, 0.006837419234216213, -0.04230589047074318, -0.011275705881416798, -0.041989684104919434, -0.032801926136016846, 0.02678532525897026, -0.03856300562620163, 0.05591995641589165, 0.05918632075190544, -0.008206806145608425, 0.015281935222446918, 0.008532911539077759, 0.014144749380648136, 0.03121871128678322, -0.02055017650127411, 0.00890671368688345, -0.02883249893784523, -0.033540528267621994, -0.0005200172308832407, 0.014183176681399345, 0.02000025473535061, 0.020869484171271324, 0.015643710270524025, -0.048207491636276245, 0.011826402507722378, -0.001119359047152102, -0.035718321800231934, 0.009774947538971901, 0.015697576105594635, -0.038213007152080536, 0.005539764184504747, -0.01064342726022005, 0.012399433180689812, 0.018515150994062424, -0.003304624930024147, 0.015039644204080105, -0.012004159390926361, 0.007326305843889713, 0.04915092885494232, 0.033315058797597885, -0.02036338485777378, 0.07759160548448563, 0.0561956949532032, 0.07845662534236908, 0.027671029791235924, -0.008505398407578468, 0.019313186407089233, 0.03897886350750923, 0.058233533054590225, -0.002931946190074086, -0.011140086688101292, 0.012636384926736355, 0.005004257895052433, -0.04860159009695053, -0.0017222246387973428, 0.009065128862857819, -0.007000374142080545, 0.04274565726518631, 0.03425446152687073, -0.014181403443217278, 0.02027316205203533, -0.0060699437744915485, 0.03087141178548336, 0.021614328026771545, 0.023821983486413956, -0.033381663262844086, -0.012377489358186722, 0.031397197395563126, 0.010795862413942814, 0.02799813821911812, 0.010438932105898857, 0.027016256004571915, -0.017136340960860252, 0.01608986034989357, 0.03339889273047447, 0.010775682516396046, -0.016915855929255486, 0.016846414655447006, -0.008300893008708954, -0.052058350294828415, -0.0303523950278759, 0.011289625428617, -0.004129376262426376, 0.01236425619572401, -0.036639466881752014, 0.022320376709103584, -0.0477096289396286, -0.002814795356243849, -0.02129209414124489, 0.003626910038292408, 0.011350857093930244, -0.03237435594201088, -0.036547768861055374, 0.04897075146436691, 0.0047707450576126575, 0.013782471418380737, 0.015622367151081562, -0.01800619624555111, 0.03356250002980232, 0.026572873815894127, -0.00347143248654902, -0.025618210434913635, -0.02348620630800724, -0.004590967670083046, 0.00002676410076674074, 0.028004605323076248, -0.019125286489725113, 0.001957092434167862, 0.0270906500518322, 0.03588578850030899, 0.016168206930160522, 0.08172058314085007, 0.011410464532673359, 0.050586000084877014, -0.01822700910270214, -0.006363990716636181, -0.028538508340716362, -0.03426539525389671, 0.023644737899303436, -0.04308405891060829, 0.007723559625446796, -0.0038283418398350477, 0.028888236731290817, 0.0474972166121006, 0.026636656373739243, -0.015915807336568832, -0.03329991549253464, 0.02733771875500679, 0.009795637801289558, -0.01870773546397686, 0.0177712794393301, 0.01526658795773983, 0.01360512524843216, 0.0187564454972744, 0.014715516939759254, 0.045053791254758835, -0.0008420978556387126, 0.010068943724036217, 0.06016862764954567, -0.0030998324509710073, 0.02697758749127388, 0.006849602796137333, 0.034721117466688156, 0.021085983142256737, 0.018767070025205612, 0.03752550855278969, 0.019906435161828995, 0.004443117417395115, -0.02146235853433609, -0.025198299437761307, -0.026783403009176254, 0.005317418836057186, 0.00819738395512104, -0.05933389067649841, -0.026574643328785896, 0.008274411782622337, -0.02593681961297989, 0.018546121194958687, -0.08046849817037582, -0.025097308680415154, -0.026283511891961098, -0.008081945590674877, 0.008409133180975914, -0.02208234742283821, 0.04225536435842514, 0.015538251958787441, 0.03099745512008667, 0.025336911901831627, -0.01168388593941927, -0.042541541159152985, -0.0506400540471077, 0.05313705652952194, 0.03214745968580246, -0.020379269495606422, -0.023596161976456642, -0.032037343829870224, -0.005368857178837061, -0.015746278688311577, -0.07226306200027466, 0.02322634495794773, 0.058534909039735794, 0.0025642993859946728, -0.053706709295511246, -0.016689404845237732, 0.04197069630026817, -0.045735735446214676, 0.013709722086787224, 0.01783815026283264, -0.026392875239253044, 0.00919875968247652, 0.00460311071947217, -0.052969351410865784, -0.014333909377455711, -0.05524635687470436, -0.005463254638016224, 0.015388958156108856, 0.014430790208280087, 0.01150012481957674, 0.013274331577122211, 0.00016031615086831152, 0.017276860773563385, -0.0295720137655735, -0.047036025673151016, -0.07779975980520248, -0.012222716584801674, 0.033697500824928284, -0.011147183366119862, -0.03192642331123352, 0.011902764439582825, 0.012396048754453659, -0.01733587495982647, -0.004274443257600069, 0.014920325949788094, 0.009532356634736061, 0.014856649562716484, 0.006203096359968185, 0.01661418005824089, 0.06241936981678009, 0.04751788452267647, -0.05991871654987335, -0.04980475828051567, 0.02464386634528637 ]
Sentence Transformers in the 🤗 Hub
nreimers
June 28, 2021
sentence-transformers-in-the-hub
open-source-collab, nlp
https://huggingface.co/blog/sentence-transformers-in-the-hub
# Sentence Transformers in the Hugging Face Hub Over the past few weeks, we've built collaborations with many Open Source frameworks in the machine learning ecosystem. One that gets us particularly excited is Sentence Transformers. Sentence Transformers is a framework for sentence, paragraph and image embeddings. This allows to derive semantically meaningful embeddings (1) which is useful for applications such as semantic search or multi-lingual zero shot classification. As part of Sentence Transformers v2 release, there are a lot of cool new features: - Sharing your models in the Hub easily. - Widgets and Inference API for sentence embeddings and sentence similarity. - Better sentence-embeddings models available (benchmark and models in the Hub). With over 90 pretrained Sentence Transformers models for more than 100 languages in the Hub, anyone can benefit from them and easily use them. Pre-trained models can be loaded and used directly with few lines of code: python from sentence_transformers import SentenceTransformer sentences = ["Hello World", "Hallo Welt"] model = SentenceTransformer('sentence-transformers/paraphrase-MiniLM-L6-v2') embeddings = model.encode(sentences) print(embeddings) But not only this. People will probably want to either demo their models or play with other models easily, so we're happy to announce the release of two new widgets in the Hub! The first one is the feature-extraction widget which shows the sentence embedding. sentence-transformers/distilbert-base-nli-max-tokens Hosted inference API Feature Extraction Compute This model is currently loaded and running on the Inference API. JSON Output Maximize But seeing a bunch of numbers might not be very useful to you (unless you're able to understand the embeddings from a quick look, which would be impressive!). We're also introducing a new widget for a common use case of Sentence Transformers: computing sentence similarity. sentence-transformers/paraphrase-MiniLM-L6-v2 Hosted inference API Sentence Similarity Source Sentence Sentences to compare to Add Sentence Compute This model can be loaded on the Inference API on-demand. JSON Output Maximize Of course, on top of the widgets, we also provide API endpoints in our Inference API that you can use to programmatically call your models! python import json import requests API_URL = "https://api-inference.huggingface.co/models/sentence-transformers/paraphrase-MiniLM-L6-v2" headers = {"Authorization": "Bearer YOUR_TOKEN"} def query(payload): response = requests.post(API_URL, headers=headers, json=payload) return response.json() data = query( { "inputs": { "source_sentence": "That is a happy person", "sentences": [ "That is a happy dog", "That is a very happy person", "Today is a sunny day" ] } } )
[ 0.0020891278982162476, -0.020957114174962044, 0.024683527648448944, -0.02264358475804329, 0.038069531321525574, 0.08414889872074127, 0.031070448458194733, 0.07509742677211761, -0.03622468188405037, 0.019602881744503975, -0.05702418088912964, 0.06483597308397293, 0.024295376613736153, 0.05136909708380699, 0.013262299820780754, -0.04021446034312248, 0.0011717870365828276, 0.03635260462760925, -0.0023911832831799984, 0.01790192909538746, 0.02227865159511566, -0.04235604777932167, 0.0287423525005579, -0.01902449131011963, 0.04242740198969841, -0.03558499738574028, 0.030004102736711502, -0.0032502608373761177, -0.024179212749004364, 0.057005301117897034, -0.1272769272327423, -0.0036123222671449184, -0.0020423843525350094, -0.05371159315109253, 0.02682613953948021, -0.003427990013733506, -0.13854527473449707, 0.07009056210517883, -0.012577755376696587, 0.009678410366177559, -0.006154750008136034, -0.020799219608306885, -0.030530573800206184, -0.04234888404607773, -0.002615686971694231, -0.05693725124001503, -0.13632699847221375, 0.072486013174057, -0.03607970476150513, -0.048298172652721405, -0.12002976983785629, 0.04547824338078499, 0.009110543876886368, 0.0065591116435825825, 0.025542566552758217, 0.015365010127425194, -0.010686295107007027, -0.14133837819099426, 0.06353731453418732, 0.050540316849946976, -0.022537780925631523, -0.023380814120173454, 0.0300955381244421, 0.037256594747304916, -0.011920551769435406, 0.029701534658670425, -0.048308391124010086, 0.04274910315871239, -0.05555577203631401, -0.020891733467578888, 0.01448226161301136, 0.004181503783911467, -0.01739720068871975, -0.016490895301103592, 0.032165396958589554, -0.047247521579265594, -0.047690246254205704, 0.04005691036581993, 0.04119556397199631, -0.02566777914762497, -0.021805057302117348, 0.02741268277168274, 0.02171686664223671, 0.008884335868060589, 0.03965979814529419, 0.08271324634552002, 0.019874362275004387, -0.045403026044368744, -0.08045867085456848, 0.058012865483760834, -0.01065631490200758, -0.1471608281135559, -0.06040718033909798, 0.06322845816612244, 0.011104369536042213, 0.001604764023795724, 0.008293832652270794, 0.01999739184975624, -0.03697818145155907, -0.0407889150083065, 0.03730200231075287, -0.06605260074138641, 0.06117404252290726, -0.02060593292117119, -0.03185110539197922, -0.008193761110305786, -0.017991991713643074, -0.07723641395568848, 0.005076219793409109, -0.0009196805767714977, 0.023393219336867332, -0.04326744005084038, 0.007982376031577587, 0.1246100664138794, -0.07748869806528091, 0.03828652948141098, 0.000754683162085712, -0.012301528826355934, -0.013321701437234879, -0.005799012258648872, 0.008854204788804054, 0.021597405895590782, 0.058856457471847534, 0.02561894990503788, 0.016801828518509865, 0.07224396616220474, -0.05697492137551308, 0.034884076565504074, 0.01980389840900898, 0.004320694599300623, 0.025606272742152214, -0.02964594215154648, 0.10146729648113251, -0.014552895911037922, 0.04626200348138809, -0.05414581298828125, 0.031185612082481384, -0.0892367735505104, 0.010813464410603046, -0.06222424656152725, 0.024535445496439934, 0.0332418829202652, 0.013133919797837734, 0.0038600373081862926, 0.05382215976715088, 0.032232265919446945, -0.08557382225990295, 0.040260180830955505, 0.019290704280138016, 0.00018181382620241493, -0.08711077272891998, 0.017696287482976913, -0.037584733217954636, -0.010892758145928383, -0.01589842326939106, 0.05963516980409622, 0.0265086330473423, -0.01927606575191021, -0.03098093345761299, -0.0575910359621048, -0.02931501902639866, -0.012967645190656185, -0.02587404102087021, -0.01536137517541647, -0.0030920468270778656, 0.019667448475956917, -0.018275724723935127, 0.014569571241736412, 0.046483952552080154, 0.03118963912129402, 0.034949835389852524, -0.03590379282832146, 0.05436635762453079, -0.05596943572163582, -0.016769886016845703, 0.03838614001870155, 0.038446731865406036, 0.07708551734685898, -0.0002490449114702642, 0.005606270860880613, -0.0417194589972496, 0.05621049925684929, -0.00838184729218483, 0.02015131711959839, 0.07876656204462051, -0.06015792116522789, 0.02564985305070877, -0.0031397535931319, -0.00954965129494667, -0.014026662334799767, -0.048067741096019745, -0.015226458199322224, 0.05250446870923042, 0.03825194016098976, 0.05892668291926384, -0.025046279653906822, -0.0418957844376564, 0.09599320590496063, 0.05556006729602814, 0.08852117508649826, 0.01749691367149353, -0.00925502646714449, 0.023772818967700005, -0.05910332500934601, -0.02132575586438179, 0.003533759852871299, -0.029121406376361847, 0.01141506340354681, -0.022518036887049675, 0.017053751274943352, 0.06330560892820358, -0.11443949490785599, 0.020236581563949585, -0.0809483677148819, -0.008073865436017513, -0.05940897390246391, -0.03451614826917648, 0.05725256726145744, -0.0009330912725999951, 0.00878120493143797, 0.15317778289318085, -0.013481903821229935, 0.0035174409858882427, -0.025677498430013657, 0.033909302204847336, 0.009110860526561737, 0.031990308314561844, 0.05666420981287956, 0.03418928012251854, -0.03492216393351555, -0.05193530395627022, -0.09056968986988068, -0.025309545919299126, 0.015272441320121288, -0.035994186997413635, -0.03115023300051689, 0.03717450052499771, 0.03581157326698303, -0.0016645946307107806, -0.0012940617743879557, 0.04882846400141716, -0.018195049837231636, 0.033835697919130325, 0.049518268555402756, 0.015165137127041817, 0.027327336370944977, 0.05766325816512108, 0.04384541139006615, 0.009132235310971737, -0.004303093533962965, -0.11180177330970764, 0.020733963698148727, 0.00701764365658164, -0.025976989418268204, 0.04388628527522087, 0.03606394678354263, 0.02156214416027069, 0.010084896348416805, -0.04134562611579895, 0.06639128923416138, 0.0023892440367490053, -0.013810794800519943, 0.021606985479593277, -0.06534534692764282, -0.017923129722476006, -0.04369175806641579, -0.014041340909898281, 0.027262911200523376, -0.013171273283660412, -0.013932052068412304, 0.027806207537651062, -0.023220444098114967, 0.014953870326280594, 0.0023295062128454447, 0.04286397993564606, 0.019847510382533073, 0.027869299054145813, 0.016213413327932358, -0.029453055933117867, -0.0044052135199308395, -0.002845442621037364, -0.02466745860874653, 0.020783178508281708, 0.03460939973592758, 0.005169176496565342, 0.0063798679038882256, -0.01545298844575882, -0.023565370589494705, -0.022578880190849304, 0.009821124374866486, 0.022266987711191177, 0.005399863235652447, 0.014879148453474045, -0.0386374406516552, -0.029215039685368538, 0.014193527400493622, -0.011564265936613083, -0.032815784215927124, -0.02965736761689186, -0.012809564359486103, 0.02436988800764084, -0.0038829997647553682, 0.0025791171938180923, 0.004633679986000061, 0.004607985261827707, 0.0422343984246254, 0.004387223161756992, 0.03555034101009369, -0.08375613391399384, -0.014115720987319946, 0.0016505239764228463, -0.025437064468860626, -0.02293924242258072, -0.010172167792916298, 0.03969212993979454, -0.006405371706932783, -0.010398490354418755, 0.027138609439134598, -0.02096262201666832, 0.014919407665729523, -0.006442017387598753, -0.010896946303546429, -0.027864301577210426, 0.0014313956489786506, -0.04434870928525925, 0.0022943983785808086, 0.045753613114356995, 0.03708416968584061, -0.00702679855749011, 0.004324409179389477, -0.0011727764504030347, -0.014549913816154003, 0.006275419611483812, -0.036768972873687744, 0.06254558265209198, -0.020499832928180695, 0.07647113502025604, -0.06970977783203125, 0.0051254937425255775, -0.011930013075470924, -0.016738442704081535, 0.024933485314249992, -0.0860251784324646, 0.002856002189218998, -0.004861403722316027, 0.013121798634529114, 0.05537240207195282, 0.018232159316539764, 0.01335927378386259, -0.0036780466325581074, 0.0035701957531273365, -0.03472181037068367, 0.020229093730449677, -0.017885757610201836, -0.01961657591164112, -0.02024928480386734, -0.0016885584918782115, -0.057749733328819275, -0.01906888373196125, 0.0063343713991343975, 0.03063715435564518, 0.04368484020233154, 0.027792073786258698, 0.028905807062983513, -0.00611994368955493, -0.004852051846683025, -0.0031965398229658604, -0.016200928017497063, -0.07888549566268921, 0.011355566792190075, -0.03030972182750702, -0.02031118795275688, 0.011457590386271477, 0.08722355216741562, -0.017428509891033173, 0.027021879330277443, 0.024751977995038033, 0.01536642387509346, 0.012681558728218079, 0.036011841148138046, 0.007071295753121376, 0.006334382575005293, -0.03526629880070686, 0.02414730004966259, 0.02230221964418888, -0.0714530274271965, 0.023499496281147003, 0.016324229538440704, -0.058753833174705505, -0.035562288016080856, -0.013321101665496826, -0.004057679325342178, 0.008143321610987186, -0.013389963656663895, 0.035369422286748886, -0.05245300754904747, 0.08306286484003067, 0.04579519107937813, 0.020633514970541, -0.04862852394580841, 0.0025018537417054176, 0.006978635676205158, -0.020743610337376595, -0.010724568739533424, -0.0007663578726351261, -0.018583236262202263, -0.0096548181027174, -0.026728499680757523, 0.011010061018168926, -0.03659620136022568, -0.005854505114257336, -0.0054301549680531025, -0.032255712896585464, 0.03224822133779526, -0.07269208133220673, -0.01580771431326866, -0.006379798520356417, -0.014725949615240097, 0.026598431169986725, 0.019472064450383186, -0.00774140702560544, -0.01067882776260376, 0.03800666704773903, 0.022907396778464317, -0.006361088249832392, -0.007687903009355068, -0.037697918713092804, 0.002849699929356575, -0.004038582090288401, 0.01680346019566059, 0.021595880389213562, -0.009092356078326702, 0.027687150985002518, 0.02057330682873726, 0.028295282274484634, 0.03825617954134941, -0.04102373868227005, -0.016304967924952507, -0.02413710206747055, 0.03216655179858208, 0.035459280014038086, -0.0035153450444340706, -0.004556053318083286, 0.007189960218966007, 0.010631147772073746, -0.005049947649240494, -0.020642263814806938, 0.029652483761310577, -0.03887799754738808, 0.006413599476218224, 0.04504924267530441, -0.023829152807593346, 0.04415633901953697, -0.012777741067111492, -0.0674503818154335, -0.021887481212615967, 0.005544386338442564, 0.019291380420327187, 0.03550313040614128, 0.013845445588231087, -0.04195011407136917, 0.007756567094475031, 0.04943762719631195, 0.0009714416228234768, -0.005897826980799437, -0.007148946635425091, 0.008606642484664917, 0.06011844053864479, -0.005114167928695679, 0.005747523624449968, -0.020041573792696, 0.005074863787740469, 0.016133710741996765, 0.003472070675343275, -0.01241265144199133, -0.023808620870113373, 0.008222782984375954, 0.018121520057320595, -0.026196494698524475, -0.01448213029652834, 0.019623149186372757, -0.007571393623948097, -0.0371391586959362, 0.08500391989946365, -0.007075012195855379, 0.015138349495828152, -0.02152269519865513, 0.009217462502419949, -0.013752913102507591, -0.03014937974512577, 0.013769133016467094, 0.02129998430609703, -0.01254643127322197, 0.003782576648518443, 0.05725447088479996, 0.06227106600999832, -0.028283273801207542, -0.01874355971813202, 0.022348502650856972, -0.036068033427000046, 0.017309248447418213, 0.002530466066673398, 0.017919057980179787, -0.05062069743871689, -0.0017749504186213017, 0.013950872235000134, -0.005503778345882893, 0.0017475991044193506, 0.030275391414761543, 0.026712533086538315, -0.03662877157330513, -0.0032041475642472506, 0.039065178483724594, -0.03884545713663101, -0.008409842848777771, -0.0232484582811594, 0.03515275940299034, -0.04853671416640282, 0.006040594540536404, -0.0054752700962126255, -0.016085758805274963, 0.0020863674581050873, -0.002244363073259592, 0.0004882224020548165, -0.004794551525264978, -0.03172702714800835, -0.003879540367051959, 0.04509618133306503, -0.016355976462364197, -0.023923806846141815, -0.037502434104681015, -0.01675565354526043, 0.027362890541553497, -0.027568574994802475, 0.004317541141062975, -0.0030088829807937145, 0.013289904221892357, -0.00969467032700777, 0.04388213902711868, -0.0012952270917594433, 0.005912011954933405, 0.0362551249563694, 0.006743934471160173, 0.04273704066872597, -0.05277301371097565, 0.0202640388160944, 0.05111630633473396, -0.0513039156794548, -0.01652001403272152, -0.015079468488693237, -0.010364856570959091, -0.008012739010155201, -0.04111899808049202, 0.04813392460346222, 0.07267797738313675, 0.004950075875967741, -0.005789177026599646, 0.03538540005683899, 0.008784637786448002, -0.00209677591919899, -0.028948457911610603, 0.011480194516479969, 0.030366459861397743, 0.021283823996782303, 0.015862373635172844, 0.019565464928746223, 0.006653533782809973, 0.012309035286307335, 0.026782574132084846, -0.04128342866897583, 0.03412546589970589, 0.03226775303483009, -0.04266160726547241, -0.005702832248061895, -0.013509398326277733, -0.03172669932246208, -0.03446120396256447, 0.011644373647868633, -0.024229012429714203, 0.016649983823299408, 0.009866350330412388, 0.02811475098133087, -0.007811086717993021, -0.01226353831589222, 0.02792193740606308, 0.05514920875430107, -0.015033363364636898, 0.003769724862650037, 0.07674480229616165, 0.039606139063835144, 0.04350064694881439, 0.023048853501677513, -0.025494709610939026, 0.02805119752883911, 0.05285143479704857, -0.003655199659988284, 0.04498262703418732, 0.006746490020304918, 0.0045011923648417, 0.0008387413690797985, 0.0009832116775214672, -0.024458764120936394, -0.004793041851371527, 0.03096373938024044, 0.0671829953789711, -0.01070695836097002, -0.01395965926349163, -0.01177229080349207, 0.04423937946557999, 0.02724859118461609, 0.00506347231566906, -0.02438136376440525, 0.02244691736996174, 0.039642203599214554, 0.027029482647776604, 0.0507817342877388, 0.02636270970106125, 0.009871580637991428, -0.023308172821998596, 0.020407160744071007, 0.02085055224597454, 0.019497539848089218, -0.011782710440456867, 0.005299720447510481, 0.012341753579676151, -0.04943155497312546, -0.05199480801820755, 0.03673481568694115, 0.008877444081008434, -0.006936250254511833, -0.031808897852897644, -0.016471190378069878, -0.031533133238554, 0.007447400130331516, -0.0031544757075607777, 0.011288980022072792, 0.00782239530235529, -0.011325600557029247, -0.024890584871172905, 0.08855940401554108, 0.0003037078131455928, -0.02180340699851513, 0.016333790495991707, -0.0006811921484768391, 0.03904189169406891, 0.004139503929764032, -0.033097848296165466, -0.02213279716670513, -0.011342526413500309, 0.005528705660253763, -0.0274535920470953, 0.013703501783311367, -0.03869214653968811, -0.044927287846803665, 0.01583332009613514, 0.025026818737387657, -0.0007473325822502375, 0.04030228778719902, -0.002362309955060482, 0.03762752562761307, -0.05431459844112396, 0.028868036344647408, -0.000025044895664905198, -0.01179337315261364, 0.002936408156529069, -0.04318397492170334, -0.032071102410554886, -0.0240644421428442, 0.006080190651118755, 0.04324422404170036, 0.07094821333885193, -0.03741487115621567, -0.034364666789770126, 0.03698337450623512, -0.01995387300848961, 0.002434522844851017, 0.015987003222107887, -0.000647196895442903, -0.015485073439776897, -0.0006191976717673242, -0.02248634397983551, 0.010901197791099548, -0.02778523787856102, -0.004487235564738512, 0.062321312725543976, 0.003068578662350774, -0.046122562140226364, -0.01678951270878315, 0.007808249909430742, 0.02598368562757969, 0.02829563058912754, 0.02260529436171055, -0.01926400512456894, 0.04188844561576843, -0.029779095202684402, 0.0281002689152956, -0.05248619616031647, -0.012461974285542965, -0.018748218193650246, -0.03888017684221268, -0.04536065459251404, 0.03872460126876831, -0.0009784236317500472, 0.033695198595523834, -0.04705103859305382, 0.019777225330471992, -0.02198946475982666, -0.020686324685811996, 0.005311627872288227, -0.021367251873016357, 0.04180242866277695, 0.02718248777091503, 0.05324196070432663, 0.01769339106976986, 0.0100857550278306, -0.013900009915232658, -0.03172359988093376, 0.015831345692276955, 0.007681946735829115, -0.006269838660955429, -0.0034271259792149067, -0.0778181329369545, -0.00856117531657219, 0.01541087031364441, -0.047116123139858246, 0.0368131585419178, 0.048145782202482224, -0.017045943066477776, -0.027952851727604866, 0.025163451209664345, 0.023341331630945206, 0.0037407432682812214, 0.03160903975367546, -0.006788607686758041, -0.029095593839883804, 0.018574243411421776, -0.004986328538507223, -0.033323757350444794, -0.0016003239434212446, -0.06275376677513123, -0.012576108798384666, 0.016622215509414673, 0.030238255858421326, 0.023415453732013702, -0.04792701080441475, 0.0266108401119709, 0.011523738503456116, -0.022172121331095695, -0.0667383149266243, -0.06216922774910927, -0.023691482841968536, 0.03929697722196579, -0.03473764285445213, 0.0035308413207530975, 0.03577793017029762, -0.008499781601130962, -0.03328384831547737, -0.018737880513072014, 0.0081302709877491, -0.010868615470826626, -0.029542939737439156, 0.00745024299249053, 0.015092890709638596, 0.0283183753490448, 0.05106412246823311, -0.015111158601939678, -0.04489150643348694, -0.009613951668143272 ]
Deploy Hugging Face models easily with Amazon SageMaker
philschmid
July 8, 2021
deploy-hugging-face-models-easily-with-amazon-sagemaker
guide, partnerships, aws
https://huggingface.co/blog/deploy-hugging-face-models-easily-with-amazon-sagemaker
Deploy one of the 10,000+ Hugging Face Transformers to Amazon SageMaker for Inference To deploy a model directly from the Hugging Face Model Hub to Amazon SageMaker, we need to define two environment variables when creating the HuggingFaceModel. We need to define: * HF_MODEL_ID: defines the model id, which will be automatically loaded from huggingface.co/models when creating or SageMaker Endpoint. The 🤗 Hub provides 10,000+ models all available through this environment variable. * HF_TASK: defines the task for the used 🤗 Transformers pipeline. A full list of tasks can be found here. python from sagemaker.huggingface.model import HuggingFaceModel # Hub Model configuration. <https://huggingface.co/models> hub = { 'HF_MODEL_ID':'distilbert-base-uncased-distilled-squad', # model_id from hf.co/models 'HF_TASK':'question-answering' # NLP task you want to use for predictions } # create Hugging Face Model Class huggingface_model = HuggingFaceModel( env=hub, # configuration for loading model from Hub role=role, # iam role with permissions to create an Endpoint transformers_version="4.6", # transformers version used pytorch_version="1.7", # pytorch version used ) # deploy model to SageMaker Inference predictor = huggingface_model.deploy( initial_instance_count=1, instance_type="ml.m5.xlarge" ) # example request, you always need to define "inputs" data = { "inputs": { "question": "What is used for inference?", "context": "My Name is Philipp and I live in Nuremberg. This model is used with sagemaker for inference." } } # request predictor.predict(data) After we run our request we can delete the endpoint again with. python # delete endpoint predictor.delete_endpoint() --- # FAQ 🎯 You can find the complete Frequently Asked Questions in the documentation. Q: Which models can I deploy for Inference? A: You can deploy: * any 🤗 Transformers model trained in Amazon SageMaker, or other compatible platforms and that can accommodate the SageMaker Hosting design * any of the 10,000+ publicly available Transformer models from the Hugging Face Model Hub, or * your private models hosted in your Hugging Face premium account! Q: Which pipelines, tasks are supported by the Inference Toolkit? A: The Inference Toolkit and DLC support any of the transformers pipelines. You can find the full list here Q: Do I have to use the transformers pipelines when hosting SageMaker endpoints? A: No, you can also write your custom inference code to serve your own models and logic, documented here. Q: Do I have to use the SageMaker Python SDK to use the Hugging Face Deep Learning Containers (DLCs)? A: You can use the Hugging Face DLC without the SageMaker Python SDK and deploy your models to SageMaker with other SDKs, such as the AWS CLI, boto3 or Cloudformation. 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. In particular, our inference DLC comes with a pre-written serving stack, which drastically lowers the technical bar of DL serving. 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 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 teams.
[ -0.022360561415553093, 0.0351802259683609, -0.02530420385301113, 0.006846258416771889, 0.004929916001856327, 0.11099839955568314, 0.03514169156551361, 0.03364592045545578, -0.011664093472063541, 0.03852713108062744, -0.08135693520307541, 0.042971737682819366, 0.00601353170350194, 0.06297532469034195, 0.009114647284150124, -0.07872772961854935, -0.00449955090880394, 0.011368201114237309, -0.05055423453450203, 0.026145437732338905, 0.03551247715950012, -0.04953312501311302, -0.004396950826048851, 0.04677557200193405, -0.02504051849246025, -0.03435776010155678, 0.04697013273835182, -0.02440311200916767, 0.026644378900527954, 0.05122022703289986, -0.0681067705154419, -0.0028457201551645994, 0.025552203878760338, -0.015968045219779015, 0.02469668537378311, 0.0656561478972435, -0.12080022692680359, 0.018125111237168312, 0.041922587901353836, -0.007419493515044451, 0.030467232689261436, -0.05082887038588524, -0.05273168161511421, 0.028851760551333427, 0.03978799656033516, -0.0408702977001667, -0.09395335614681244, 0.06664566695690155, 0.03275175392627716, -0.003775293007493019, -0.08447498828172684, 0.09808365255594254, 0.009635147638618946, -0.056266337633132935, 0.05032263696193695, 0.00926658883690834, -0.036667585372924805, -0.08995210379362106, -0.026094431057572365, 0.026752259582281113, -0.023750897496938705, -0.046020857989788055, -0.00604849262163043, 0.05612577870488167, 0.015133112668991089, 0.031989969313144684, 0.03853302448987961, -0.01974431984126568, -0.021654225885868073, -0.025366513058543205, -0.03716372326016426, -0.042463626712560654, 0.010708963498473167, -0.03921475261449814, -0.05968845263123512, -0.04478859901428223, -0.000037727753806393594, 0.04934694245457649, 0.04024703800678253, 0.05493989586830139, -0.025644924491643906, -0.00992124155163765, 0.00289366627112031, 0.006278309505432844, 0.02306317538022995, 0.014335045590996742, 0.01656509004533291, -0.019009429961442947, -0.08453081548213959, 0.058792293071746826, 0.027938611805438995, -0.06213932856917381, -0.020548492670059204, -0.01656724326312542, 0.05832318961620331, -0.00914183259010315, 0.007399351801723242, -0.017783787101507187, -0.019848888739943504, -0.04504586011171341, 0.007969585247337818, -0.05613335967063904, -0.0008670196984894574, -0.03727757930755615, -0.009000902995467186, 0.05102243646979332, 0.04525207728147507, -0.1094624474644661, 0.011374483816325665, 0.002691784640774131, 0.06347033381462097, -0.07990027964115143, -0.027787547558546066, 0.07706980407238007, -0.06074664741754532, 0.07607758790254593, 0.01894519291818142, -0.04659358784556389, 0.04989808797836304, 0.038912806659936905, 0.07190941274166107, 0.06534571945667267, -0.0002771609870251268, -0.00911136344075203, 0.005167716648429632, 0.08228088170289993, -0.0072128986939787865, -0.022951629012823105, -0.029197635129094124, -0.049159321933984756, 0.030030541121959686, -0.06999866664409637, 0.056680623441934586, -0.025718454271554947, -0.00022724336304236203, -0.0924346074461937, 0.015365236438810825, -0.042630624026060104, 0.03441485017538071, 0.007976788096129894, 0.014861845411360264, 0.10217404365539551, 0.045029524713754654, 0.010245068930089474, 0.0935230404138565, 0.023549867793917656, -0.005225867964327335, 0.004468372091650963, 0.0335686057806015, 0.10493296384811401, -0.07418185472488403, 0.07556583732366562, -0.0074871308170259, -0.08386107534170151, 0.04430658742785454, 0.06415784358978271, -0.05893070995807648, -0.005269250832498074, -0.04139457270503044, -0.04721638560295105, -0.0017184971366077662, -0.016058800742030144, -0.02887756936252117, 0.008564254269003868, -0.03124183602631092, -0.01072089746594429, 0.03313015028834343, -0.008169888518750668, 0.08766103535890579, 0.00021433286019600928, 0.0185462087392807, -0.05763297900557518, 0.04385959357023239, 0.018639717251062393, 0.034148208796978, 0.054535966366529465, 0.03953557461500168, 0.09530266374349594, 0.01051432266831398, 0.02742348052561283, -0.07457167655229568, 0.09039110690355301, -0.026637554168701172, 0.012067743577063084, 0.10497599095106125, -0.05033307522535324, 0.03725961223244667, 0.019083833321928978, 0.0076971352100372314, 0.030184324830770493, -0.01391097903251648, -0.04198882356286049, 0.05237928032875061, 0.025895528495311737, 0.0806691125035286, -0.03102622926235199, -0.0502222403883934, 0.09917104989290237, 0.015353191643953323, 0.05306331813335419, 0.04033689945936203, 0.0451909601688385, -0.021723845973610878, 0.002473577857017517, -0.013744941912591457, 0.03778703510761261, -0.08086711168289185, -0.05128401145339012, 0.05231122672557831, 0.02149326540529728, 0.058657608926296234, -0.1308484822511673, 0.036844197660684586, -0.08457935601472855, -0.006426058243960142, -0.06188399717211723, -0.07074770331382751, -0.024876872077584267, 0.019303198903799057, 0.023494847118854523, 0.15602320432662964, -0.02097034454345703, -0.0002777729241643101, -0.06749188154935837, 0.016193749383091927, -0.00422177417203784, 0.031057128682732582, 0.07947702705860138, 0.05368927866220474, -0.058887261897325516, -0.046965233981609344, -0.06489940732717514, -0.026873180642724037, 0.0016547504346817732, 0.013696517795324326, -0.03168100491166115, 0.008207272738218307, -0.011806895025074482, -0.033271923661231995, 0.02167346328496933, 0.0719299390912056, 0.02095208130776882, 0.015506718307733536, -0.00338233495131135, -0.01225750520825386, -0.018254565075039864, 0.041020628064870834, 0.01753716915845871, -0.02468937635421753, -0.03126028925180435, -0.08600864559412003, 0.03711541369557381, 0.004681942984461784, -0.013990101404488087, 0.04801206663250923, 0.024851741269230843, -0.02618148922920227, 0.031881410628557205, 0.0036608106456696987, 0.06701389700174332, 0.013622520491480827, 0.006724126171320677, -0.03056907095015049, -0.02523368038237095, -0.01263468898832798, -0.027264947071671486, -0.02843969687819481, 0.00040624215034767985, -0.004803991410881281, -0.012753380462527275, 0.005288685206323862, -0.034436196088790894, 0.018528133630752563, 0.01115325279533863, 0.008830351755023003, 0.04811028018593788, 0.04117274656891823, 0.024509314447641373, 0.004339819774031639, 0.006151378620415926, 0.003737670835107565, -0.027155179530382156, -0.033114559948444366, 0.006006244104355574, 0.0008170012733899057, -0.014079784974455833, -0.005475094076246023, -0.03978400304913521, -0.017048044130206108, 0.0068338653072714806, 0.030684713274240494, 0.061654966324567795, 0.04064354673027992, -0.019596250727772713, -0.0384230837225914, 0.023169605061411858, 0.017340295016765594, -0.04329082742333412, -0.013505970127880573, 0.044045355170965195, -0.0030452136415988207, -0.0005182760651223361, 0.00328323757275939, 0.005380580667406321, -0.029996443539857864, 0.02772390842437744, 0.01552402414381504, -0.008621595799922943, -0.08249012380838394, -0.03395222872495651, -0.044890500605106354, 0.011290366761386395, -0.010491644032299519, -0.00016463348583783954, 0.065813347697258, 0.004318745341151953, -0.0024624462239444256, 0.052846986800432205, 0.000452432781457901, 0.013807345181703568, 0.013507488183677197, -0.029873384162783623, -0.029095306992530823, 0.020791390910744667, -0.0012922243913635612, -0.024534529075026512, 0.04063887149095535, 0.036770470440387726, -0.05703872814774513, 0.03072241321206093, 0.007822191342711449, -0.018552584573626518, 0.030075641348958015, 0.0017553514335304499, 0.032091621309518814, 0.0195603147149086, 0.013808094896376133, -0.04216379672288895, 0.010355121456086636, -0.015224489383399487, -0.026811808347702026, -0.008540121838450432, -0.04783458635210991, -0.0019368992652744055, 0.019557198509573936, 0.03410480171442032, 0.007060128729790449, 0.01367000862956047, -0.019316906109452248, -0.007922686636447906, -0.009859048761427402, 0.01609758473932743, 0.062291692942380905, 0.013790815137326717, 0.014153577387332916, -0.0016016752924770117, 0.00682015810161829, -0.029892295598983765, -0.028048906475305557, -0.01469083409756422, 0.02351733110845089, 0.015280158258974552, 0.014207190833985806, 0.02959493175148964, 0.02653530426323414, 0.01660366915166378, 0.01846190169453621, -0.004341473337262869, -0.044406957924366, 0.005709047894924879, -0.027807969599962234, -0.037090741097927094, -0.006864707451313734, 0.02237042784690857, 0.0028630427550524473, -0.015348277986049652, 0.018735665827989578, 0.02566148340702057, -0.010907948948442936, 0.046312279999256134, -0.010992285795509815, 0.010635068640112877, -0.057193171232938766, 0.0035154582001268864, -0.03288290277123451, -0.05404336750507355, 0.029476286843419075, 0.010472207330167294, -0.02935975044965744, -0.006494263652712107, -0.03930655121803284, -0.013823553919792175, 0.016918422654271126, -0.005997065454721451, 0.030169477686285973, -0.035529974848032, 0.05724729225039482, 0.04106825217604637, -0.031353212893009186, -0.05524434521794319, 0.005339272785931826, 0.012962877750396729, -0.019552670419216156, -0.05156196653842926, 0.006939998362213373, -0.00795875396579504, -0.02740722894668579, -0.0005621850723400712, -0.0023692166432738304, -0.027025820687413216, -0.009352908469736576, -0.023962579667568207, -0.04461869224905968, 0.0008371403091587126, -0.029868455603718758, -0.05273590236902237, -0.023364277556538582, -0.017438683658838272, 0.04416956380009651, 0.024537593126296997, -0.023644788190722466, -0.028338728472590446, 0.011388309299945831, 0.043996844440698624, 0.003544592298567295, -0.009215286001563072, -0.03647853806614876, 0.06022080034017563, -0.0569155290722847, 0.019015897065401077, -0.02251337841153145, -0.05212921276688576, -0.002790057798847556, 0.012899902649223804, 0.008882683701813221, 0.041485730558633804, -0.03048758953809738, -0.009064765647053719, -0.012456467375159264, 0.010204717516899109, 0.01711704395711422, 0.0015337025979533792, -0.006782677955925465, 0.0360519103705883, -0.032651081681251526, 0.03413871303200722, 0.015434534288942814, 0.029742954298853874, -0.0066084410063922405, 0.036242060363292694, 0.021733421832323074, -0.022496633231639862, 0.04474521800875664, 0.009572377428412437, -0.05818505212664604, -0.02971084974706173, -0.06208377704024315, 0.024986660107970238, 0.022322161123156548, 0.046916671097278595, -0.026860475540161133, 0.0006014531827531755, 0.03432801738381386, -0.009926384314894676, -0.028642309829592705, -0.00024896152899600565, 0.018750321120023727, 0.041238803416490555, -0.009211987257003784, 0.04030315950512886, -0.0012623080983757973, 0.03229720517992973, 0.04122922569513321, 0.04094693064689636, -0.021867601200938225, -0.06175850331783295, -0.009702973067760468, 0.024984978139400482, -0.04231831803917885, -0.02347494661808014, 0.01698189415037632, -0.042849164456129074, -0.011011526919901371, 0.06150660663843155, 0.03751733899116516, 0.006007238291203976, -0.00686870701611042, 0.004870981443673372, -0.002366201253607869, -0.015208699740469456, -0.029069023206830025, 0.002103747334331274, -0.00008049406460486352, 0.022467805072665215, 0.05309118703007698, 0.06732935458421707, 0.014749749563634396, -0.0003417409607209265, -0.008275182917714119, -0.03244895488023758, 0.027947572991251945, -0.028467213734984398, -0.017251284793019295, -0.007818687707185745, 0.005638163071125746, -0.006870463490486145, -0.011781688779592514, 0.005470025818794966, -0.010756732895970345, 0.07423374056816101, -0.040143340826034546, -0.016320649534463882, 0.04684915766119957, -0.04014555737376213, -0.0012615234591066837, -0.016389483585953712, 0.02481740713119507, -0.008539917878806591, 0.01511580590158701, 0.005163948517292738, -0.011093493551015854, 0.00006849417695775628, 0.01942097768187523, -0.03346185386180878, -0.030024485662579536, 0.029110534116625786, 0.03652608394622803, 0.040411897003650665, -0.04723314940929413, -0.015352620743215084, 0.049369242042303085, -0.007161494344472885, 0.01578933745622635, -0.03235706686973572, 0.008944072760641575, 0.02055349573493004, -0.014297840185463428, 0.014612388797104359, -0.024039607495069504, -0.0070732515305280685, 0.0012239018687978387, 0.03039589151740074, 0.048100780695676804, -0.007774225901812315, -0.050340212881565094, 0.03807255998253822, 0.04458482190966606, -0.04001151770353317, -0.01781969517469406, 0.000076287891715765, -0.0151281813159585, 0.011414188891649246, -0.0474255234003067, 0.05341804772615433, 0.054210126399993896, -0.014868378639221191, -0.012688940390944481, -0.004192317370325327, 0.0023268319200724363, 0.020816419273614883, 0.03292130306363106, -0.03791273012757301, 0.008768451400101185, 0.009202525950968266, -0.013215339742600918, 0.04101483151316643, 0.00031594326719641685, 0.012063744477927685, -0.006437237374484539, -0.03206251561641693, 0.007011094130575657, 0.012951405718922615, -0.019490407779812813, -0.002618628554046154, -0.0049840654246509075, -0.051934633404016495, 0.02251630835235119, 0.01654236763715744, 0.043439820408821106, 0.024309255182743073, 0.0001568195439176634, -0.003317828057333827, 0.015781482681632042, -0.007495515514165163, 0.027673522010445595, 0.050833508372306824, -0.035875119268894196, 0.0033834255300462246, 0.008402819745242596, 0.04373989626765251, 0.05046861246228218, 0.009925229474902153, 0.022090449929237366, -0.025471417233347893, 0.0664677768945694, -0.010199503973126411, 0.015428580343723297, 0.035782791674137115, -0.00003152301360387355, 0.004966416861861944, -0.032827794551849365, 0.010316794738173485, -0.019910715520381927, 0.003364640986546874, 0.011676816269755363, 0.0026103456038981676, 0.04340268298983574, 0.002728925086557865, 0.042883049696683884, 0.05314711108803749, 0.017630035057663918, 0.03215303272008896, 0.02120027132332325, 0.05109652131795883, 0.0005630317027680576, 0.007358115166425705, 0.020341310650110245, -0.00934972520917654, -0.006459569092839956, 0.006137319374829531, 0.0015469896607100964, 0.01258294191211462, -0.007229125592857599, 0.025402573868632317, -0.03432414308190346, -0.03517867997288704, -0.05815594643354416, 0.00811383593827486, 0.016854824498295784, -0.03365835174918175, -0.015085149556398392, 0.021480225026607513, -0.014739926904439926, 0.04040369391441345, -0.022134965285658836, 0.015633301809430122, -0.050841450691223145, -0.0239783376455307, -0.009537489153444767, 0.022673165425658226, 0.013409508392214775, -0.062463391572237015, -0.003702176036313176, -0.00862029753625393, 0.010187823325395584, -0.019947001710534096, -0.040554411709308624, -0.010236595757305622, -0.0131342438980937, -0.028463566675782204, 0.0025462056510150433, 0.02233751118183136, 0.003363300347700715, -0.025882365182042122, 0.00865166261792183, 0.020401718094944954, 0.031134262681007385, 0.027934422716498375, 0.004367931745946407, 0.01738009974360466, 0.012922725640237331, 0.012705075554549694, 0.0019420753233134747, -0.003773852251470089, 0.015828585252165794, -0.028592774644494057, 0.011391369625926018, -0.0019653979688882828, 0.04961123690009117, -0.008616584353148937, 0.028964927420020103, -0.005869005341082811, -0.01676160842180252, -0.0041070422157645226, 0.00991327315568924, -0.03415146470069885, 0.04855508357286453, -0.037119586020708084, -0.007040365133434534, 0.03463413193821907, -0.00787235889583826, -0.015993045642971992, -0.009563063271343708, -0.017435258254408836, 0.06119098141789436, -0.04888254776597023, -0.008381539955735207, 0.003916745539754629, 0.01898363046348095, 0.004491187632083893, 0.03382629156112671, 0.028795799240469933, -0.020831821486353874, 0.00661676237359643, -0.025631707161664963, -0.010738063603639603, -0.04381453990936279, -0.019802257418632507, -0.05346346274018288, -0.08250042796134949, -0.024821436032652855, -0.016372056677937508, -0.017018118873238564, 0.025191407650709152, -0.040077511221170425, -0.02658345364034176, -0.05642413720488548, -0.008992421440780163, -0.010724802501499653, -0.002809445606544614, 0.06367513537406921, 0.06402917206287384, 0.049401625990867615, -0.0054206629283726215, -0.041320208460092545, -0.0054166000336408615, 0.007368628401309252, 0.01953541301190853, 0.032384488731622696, -0.009938779287040234, -0.011311372742056847, -0.016850264742970467, -0.009660027921199799, 0.02595873735845089, -0.07461284101009369, 0.028413502499461174, -0.0006014744867570698, -0.029041599482297897, -0.04399418458342552, 0.0018254525493830442, 0.016312213614583015, -0.022097952663898468, 0.027509478852152824, -0.03598989173769951, 0.0006190450512804091, -0.03023476153612137, 0.003482196247205138, -0.05233720317482948, -0.012258194386959076, -0.020621327683329582, -0.026504870504140854, 0.021417411044239998, -0.0071505713276565075, -0.008123434148728848, -0.03970184549689293, -0.02205284871160984, -0.016887426376342773, -0.026954296976327896, -0.04181097447872162, -0.05364752933382988, -0.004634734708815813, 0.08174806833267212, -0.0313895083963871, -0.03484966233372688, -0.019466981291770935, -0.017855722457170486, -0.008471277542412281, 0.012982500717043877, -0.0006352995405904949, -0.016984548419713974, -0.02854950726032257, 0.005607718601822853, 0.009505541063845158, 0.026873556897044182, 0.027710290625691414, -0.030592935159802437, -0.05153842270374298, 0.020823558792471886 ]
Deploy Hugging Face models easily with Amazon SageMaker
philschmid
July 8, 2021
deploy-hugging-face-models-easily-with-amazon-sagemaker
guide, partnerships, aws
https://huggingface.co/blog/deploy-hugging-face-models-easily-with-amazon-sagemaker
API - Inference Toolkit Description Using thetransformers pipelines, we designed an API, which makes it easy for you to benefit from all pipelines features. The API has a similar interface than the 🤗 Accelerated Inference API, meaning your inputs need to be defined in the inputs key and if you want additional supported pipelines parameters you can add them in the parameters key. Below you can find examples for requests. python # text-classification request body { "inputs": "Camera - You are awarded a SiPix Digital Camera! call 09061221066 fromm landline. Delivery within 28 days." } # question-answering request body { "inputs": { "question": "What is used for inference?", "context": "My Name is Philipp and I live in Nuremberg. This model is used with sagemaker for inference." } } # zero-shot classification request body { "inputs": "Hi, I recently bought a device from your company but it is not working as advertised and I would like to get reimbursed!", "parameters": { "candidate_labels": [ "refund", "legal", "faq" ] } } # Getting started 🧭 In this guide we will use the new Hugging Face Inference DLCs and Amazon SageMaker Python SDK to deploy two transformer models for inference. In the first example, we deploy for inference a Hugging Face Transformer model trained in Amazon SageMaker. In the second example, we directly deploy one of the 10,000+ publicly available Hugging Face Transformers models from the Model Hub to Amazon SageMaker for Inference.
[ 0.025024736300110817, 0.029928233474493027, 0.012681547552347183, -0.002192240208387375, -0.004111185669898987, 0.10520049184560776, 0.021991010755300522, 0.09425728023052216, 0.0321882925927639, 0.007416450418531895, -0.034775666892528534, 0.04677525535225868, 0.0286246370524168, 0.07447624206542969, -0.036077599972486496, -0.08877187222242355, 0.013914253562688828, -0.023422742262482643, -0.018209055066108704, 0.09177538752555847, 0.033217377960681915, -0.04811049997806549, 0.03259950503706932, -0.015973569825291634, 0.005105142947286367, -0.01884555071592331, -0.036240141838788986, -0.019758621230721474, -0.0419745109975338, 0.06733149290084839, -0.07705579698085785, -0.010696729645133018, -0.049809906631708145, -0.0998552218079567, 0.00505094276741147, 0.012092234566807747, -0.15830713510513306, -0.006228204350918531, -0.0027766951825469732, -0.01908741518855095, 0.003926557954400778, -0.016251860186457634, -0.04052531346678734, 0.015808964148163795, 0.03565054386854172, -0.034662652760744095, -0.09704893082380295, 0.018245307728648186, -0.02361534722149372, -0.00483813788741827, -0.046189725399017334, 0.09445761144161224, 0.02017553336918354, 0.0007967579294927418, 0.07115581631660461, -0.017328385263681412, -0.02535003237426281, -0.10227572172880173, 0.004708989057689905, 0.012579315342009068, -0.015225614421069622, -0.0018078807042911649, 0.03687368705868721, -0.013827065005898476, 0.047962456941604614, -0.017537271603941917, -0.05458102375268936, 0.0034681055694818497, -0.014772013761103153, -0.041494522243738174, 0.012662404216825962, -0.06761053949594498, -0.017060745507478714, 0.008507005870342255, -0.004174263682216406, -0.0920540988445282, -0.00541252177208662, 0.018441181629896164, 0.03669571131467819, 0.006170136388391256, -0.04696767404675484, -0.03204909712076187, 0.021479854360222816, 0.03418409451842308, 0.019539033994078636, 0.039176538586616516, 0.05112455412745476, -0.060394082218408585, -0.011237477883696556, 0.003163354704156518, -0.0016342614544555545, -0.10008589178323746, -0.017286526039242744, -0.02984064817428589, 0.009218615479767323, -0.006857674103230238, 0.0368182472884655, 0.01466322597116232, -0.01018026564270258, -0.09024783968925476, 0.0009474955732002854, -0.05788424611091614, -0.007901022210717201, -0.031072305515408516, -0.015179159119725227, 0.024043971672654152, -0.025709131732583046, -0.05615414306521416, -0.05026859790086746, 0.05151437968015671, 0.005162072367966175, -0.01602017506957054, -0.010863423347473145, 0.10829136520624161, -0.06581080704927444, 0.03134622424840927, -0.007089023943990469, -0.01587982475757599, -0.010992614552378654, 0.009581735357642174, 0.03222706913948059, 0.033523738384246826, 0.06676656007766724, 0.009536919184029102, -0.017272135242819786, 0.05340643227100372, 0.04968249425292015, 0.010981772094964981, 0.00865517370402813, 0.02200876921415329, 0.0034091530833393335, -0.03761807456612587, 0.045023441314697266, 0.020130418241024017, 0.010050983168184757, -0.06197647750377655, -0.026214975863695145, -0.10172061622142792, 0.021364979445934296, 0.02485550567507744, 0.021922141313552856, 0.03333990275859833, -0.02013356052339077, -0.030618276447057724, 0.06322463601827621, 0.012815965339541435, -0.05068284273147583, 0.01892733760178089, 0.0005348231643438339, 0.0741673931479454, -0.12207281589508057, 0.08232264220714569, -0.009456736966967583, -0.027776772156357765, -0.010427006520330906, 0.0500619113445282, 0.03628764674067497, -0.0015676739858463407, -0.04923347756266594, -0.061719030141830444, -0.06300953030586243, -0.0015134471468627453, 0.02380138449370861, 0.004108804743736982, -0.006751335225999355, 0.02352505922317505, 0.027224170044064522, -0.0021938509307801723, 0.051752202212810516, 0.03735443577170372, -0.018051445484161377, -0.06700845062732697, 0.02672944776713848, -0.015405765734612942, 0.06490512192249298, 0.014972209930419922, -0.012733612209558487, 0.06434406340122223, 0.030340665951371193, -0.003515841905027628, -0.08933619409799576, 0.0799679234623909, -0.04295888915657997, 0.027421772480010986, 0.03290524333715439, -0.06343378126621246, 0.06442074477672577, -0.006389465648680925, 0.00564969889819622, -0.008317687548696995, -0.041710298508405685, -0.04230096563696861, 0.07738016545772552, 0.015748145058751106, 0.06904839724302292, -0.05036883056163788, -0.050958432257175446, 0.08053500950336456, 0.0145614854991436, 0.04787895083427429, 0.05376628413796425, 0.037144143134355545, 0.02310454100370407, -0.0072770994156599045, -0.008799913339316845, 0.0633217990398407, -0.009555180557072163, -0.059364430606365204, 0.051454685628414154, 0.04995983466506004, 0.017688924446702003, -0.09571345895528793, 0.021211151033639908, -0.08144259452819824, 0.004128686618059874, -0.04102412611246109, -0.03374079614877701, -0.03181198239326477, 0.04611105099320412, -0.01981315203011036, 0.15690167248249054, -0.03479427844285965, 0.011507770046591759, -0.0733489990234375, -0.01660933531820774, -0.028378935530781746, 0.05167056992650032, 0.06485404074192047, 0.03913469240069389, -0.08565664291381836, -0.02782692387700081, -0.004456747323274612, -0.06522052735090256, -0.034837640821933746, -0.027506684884428978, -0.024101411923766136, 0.026244917884469032, -0.04019774869084358, 0.006021634675562382, -0.025309942662715912, 0.07305865734815598, 0.004197903908789158, 0.0010543508687987924, 0.0016265340382233262, 0.013796264305710793, -0.009261439554393291, 0.09822949767112732, 0.07391654700040817, -0.006059336941689253, 0.005804556421935558, -0.07930954545736313, 0.06921665370464325, 0.001932661049067974, -0.055799368768930435, 0.027623260393738747, 0.04926376789808273, 0.002033208729699254, 0.02122531644999981, 0.028711453080177307, 0.07341385632753372, 0.018034035339951515, 0.01702619157731533, -0.012135187163949013, -0.03470136970281601, -0.011675206944346428, -0.06480967998504639, -0.0391787625849247, 0.02359790913760662, 0.020249303430318832, -0.011571933515369892, 0.039406295865774155, -0.018937082961201668, 0.02762359194457531, 0.004516781307756901, 0.05053083226084709, 0.029481280595064163, 0.07201728969812393, 0.0426744781434536, -0.014907636679708958, -0.01949884556233883, 0.0031315917149186134, -0.050729844719171524, -0.0042339712381362915, 0.061542950570583344, -0.005725986789911985, -0.035854872316122055, 0.002711010631173849, -0.029425857588648796, -0.03301483020186424, -0.006337553728371859, 0.031404558569192886, 0.025161780416965485, 0.03072996996343136, -0.04114500805735588, -0.029899602755904198, 0.01729678176343441, 0.02229650504887104, -0.04992697387933731, 0.029550401493906975, -0.0003405007009860128, 0.018599316477775574, -0.032523009926080704, -0.007500363048166037, 0.0025086754467338324, -0.009900442324578762, 0.06703085452318192, -0.034201402217149734, 0.0194888673722744, -0.08450455218553543, -0.0030454478692263365, -0.018202640116214752, -0.0443384163081646, 0.02684575319290161, -0.006997173652052879, 0.03218306601047516, -0.0009653191082179546, 0.008161257952451706, 0.007251455914229155, -0.009533422999083996, 0.03381805121898651, -0.011796727776527405, -0.018380744382739067, 0.006711415946483612, -0.014500482939183712, 0.0009068608051165938, -0.029701391234993935, 0.04011820629239082, 0.009606888517737389, -0.026542553678154945, 0.01123565249145031, 0.02887309528887272, -0.02046327292919159, 0.04260658845305443, 0.023214321583509445, 0.055063873529434204, 0.0009154196595773101, -0.0015002714935690165, -0.0651860237121582, -0.0011100859846919775, -0.04189884290099144, -0.022093743085861206, 0.0040296027436852455, -0.04142364114522934, 0.019762026146054268, 0.01010910328477621, 0.010934424586594105, 0.03516465425491333, -0.014643538743257523, -0.018738288432359695, -0.01731705851852894, 0.015730826184153557, -0.0005557544063776731, 0.05341522395610809, -0.003235627431422472, 0.03296312317252159, 0.00796346552670002, 0.029294542968273163, -0.028934434056282043, -0.024661708623170853, 0.012067532166838646, -0.007970315404236317, 0.03172977641224861, 0.03516010195016861, -0.011498389765620232, -0.006245140917599201, -0.022533543407917023, 0.036499954760074615, 0.004425182472914457, -0.06376604735851288, 0.046100299805402756, -0.004841496702283621, -0.009231300093233585, -0.022486241534352303, 0.009848806075751781, 0.026412028819322586, 0.0021461762953549623, 0.011037849821150303, -0.019556786864995956, -0.026088757440447807, 0.062206707894802094, 0.0022517452016472816, 0.008265845477581024, -0.016049325466156006, -0.005954517051577568, -0.03468781337141991, -0.039146389812231064, 0.0362124964594841, 0.04012453556060791, -0.0027937302365899086, 0.0029997495003044605, -0.020702941343188286, 0.006236249580979347, 0.02706976607441902, 0.0004220950650051236, 0.010965589433908463, -0.05329328030347824, 0.03242286294698715, 0.039491765201091766, -0.00021095112606417388, -0.012720314785838127, -0.002542962785810232, -0.04071410372853279, -0.0171776432543993, -0.0037592172157019377, 0.031083235517144203, 0.036569248884916306, 0.004990536253899336, -0.04837939888238907, 0.00019023950153496116, -0.06410590559244156, -0.0043778084218502045, 0.01942390389740467, -0.05087655782699585, -0.017524579539895058, -0.0356861874461174, -0.026153529062867165, 0.015198430977761745, -0.01851864531636238, 0.04072445631027222, -0.003634918248280883, -0.023928115144371986, -0.011774626560509205, 0.02542741410434246, 0.06248039752244949, -0.010290431790053844, 0.005005736835300922, -0.026326006278395653, 0.01471961010247469, -0.009408353827893734, 0.030734403058886528, 0.0004088361165486276, -0.01620304584503174, 0.027321724221110344, 0.03445585072040558, 0.010222279466688633, 0.03346244618296623, -0.00564016355201602, 0.0014936154475435615, 0.020636774599552155, 0.01494278572499752, 0.03329389914870262, -0.002879395615309477, 0.022116797044873238, 0.027782032266259193, -0.05512493848800659, 0.010751955211162567, -0.005878673400729895, 0.02769862674176693, -0.02141611836850643, -0.02680513635277748, 0.01850852370262146, 0.005851803347468376, 0.03332153707742691, -0.004594911355525255, -0.06562109291553497, -0.030167313292622566, -0.03478015959262848, 0.032219577580690384, 0.02098901756107807, 0.006405557040125132, -0.028349190950393677, -0.021581489592790604, 0.06930936872959137, -0.003908240702003241, 0.018412921577692032, 0.03435993567109108, 0.04723400995135307, 0.08285079151391983, 0.023254916071891785, 0.04612996056675911, -0.0035783033818006516, -0.012190882116556168, 0.05112936347723007, 0.010861729271709919, -0.05186009034514427, -0.04268811643123627, 0.004104872699826956, -0.009728563018143177, -0.02054593712091446, -0.010161243379116058, 0.017516175284981728, -0.028939202427864075, -0.030200758948922157, 0.05277995392680168, 0.04138199985027313, 0.015967296436429024, -0.035145409405231476, 0.00017365763778798282, 0.0017636934062466025, -0.06470723450183868, 0.03883079066872597, -0.01673751138150692, -0.007557174190878868, 0.0175909586250782, 0.07439833879470825, 0.01682433858513832, -0.0025528441183269024, 0.035888154059648514, -0.03236719220876694, -0.01537324022501707, -0.012122389860451221, -0.03761003538966179, 0.02658861130475998, -0.044980429112911224, 0.02014182135462761, 0.034727148711681366, -0.02858789451420307, -0.03861212730407715, 0.04220925644040108, 0.03721374273300171, -0.009040480479598045, -0.02433060295879841, 0.017106598243117332, -0.014388018287718296, 0.024126889184117317, -0.00712952995672822, 0.0037311820778995752, -0.04847251623868942, 0.0031213436741381884, -0.0336638018488884, -0.008447090163826942, 0.02153763175010681, -0.014267505146563053, -0.030379218980669975, -0.000162406824529171, 0.049393076449632645, 0.035882726311683655, 0.029487932100892067, -0.027625134214758873, -0.018229881301522255, 0.01152318250387907, 0.008206701837480068, 0.056776151061058044, -0.03637130931019783, -0.021788334473967552, -0.021652908995747566, 0.0075876181945204735, 0.03604070469737053, 0.0017705935752019286, 0.01527838222682476, -0.013597031123936176, 0.04629378020763397, 0.006784507073462009, 0.020682644098997116, -0.07070444524288177, 0.052654676139354706, 0.034629058092832565, -0.058123961091041565, -0.03292831405997276, -0.004488078411668539, 0.010698296129703522, -0.012014840729534626, 0.0023893953766673803, 0.027988780289888382, 0.027658339589834213, -0.023366419598460197, -0.012122253887355328, 0.022750835865736008, 0.027988916262984276, 0.04109368100762367, 0.01931614615023136, -0.033917780965566635, 0.005661879666149616, -0.031243177130818367, 0.020747311413288116, -0.0022600595839321613, -0.01497892290353775, 0.05026116222143173, 0.017890984192490578, -0.045960985124111176, 0.01709567755460739, 0.012111399322748184, -0.03817182406783104, 0.024731997400522232, 0.009201942943036556, -0.02366444282233715, 0.01084496732801199, 0.005275377072393894, -0.004399515222758055, 0.01514517329633236, 0.01305573433637619, -0.03191050514578819, -0.002464374527335167, -0.02265174500644207, 0.0323655940592289, 0.058140385895967484, -0.014444003812968731, -0.011016522534191608, 0.030093112960457802, 0.06681417673826218, 0.03679430112242699, 0.03749600797891617, 0.05049088969826698, -0.02057606540620327, 0.09061400592327118, -0.01887783221900463, 0.007650303188711405, -0.0175323486328125, -0.016688380390405655, -0.02304442599415779, -0.0059446534141898155, 0.020861387252807617, 0.002507102908566594, -0.005519195459783077, 0.019459709525108337, 0.03864468261599541, 0.048016808927059174, -0.0021757197100669146, 0.053780291229486465, 0.008540435694158077, 0.04930736869573593, 0.022921547293663025, 0.02816600538790226, 0.0840759128332138, -0.018930524587631226, -0.007768619805574417, 0.024832697585225105, -0.008237216621637344, -0.04815364629030228, 0.013700033538043499, -0.008548934943974018, 0.00972991343587637, 0.003971869125962257, -0.01631888933479786, -0.022701088339090347, -0.05413693189620972, -0.019943617284297943, 0.0009906026534736156, 0.004122488666325808, -0.005039225332438946, -0.002875774633139372, -0.020852066576480865, -0.024278420954942703, 0.0032234687823802233, 0.024734703823924065, -0.021465687081217766, -0.01238004956394434, -0.011007187888026237, -0.029673639684915543, 0.0041776918806135654, 0.01160539872944355, -0.07281523942947388, 0.022680535912513733, 0.019691074267029762, 0.011177566833794117, 0.004013522062450647, -0.00282527063973248, 0.024247271940112114, -0.0034827468916773796, -0.0024427997414022684, 0.03221682459115982, 0.029169447720050812, -0.0361897312104702, 0.012296441942453384, -0.0003981828049290925, 0.0265794824808836, 0.014237712137401104, 0.03740100562572479, 0.0032713492400944233, -0.0024673244915902615, -0.02027606964111328, 0.007739424705505371, -0.011206439696252346, -0.010467004030942917, 0.023278111591935158, -0.033048756420612335, 0.01954253576695919, -0.012598230503499508, 0.007772115990519524, 0.013056215830147266, 0.052235499024391174, -0.02994423732161522, -0.03509269282221794, 0.007682255003601313, -0.01849701814353466, 0.00023838545894250274, 0.038561977446079254, -0.011427376419305801, -0.04224110394716263, -0.007373020052909851, -0.01662423647940159, 0.004083993844687939, 0.013741726987063885, 0.023506686091423035, 0.04138544574379921, -0.013419720344245434, -0.04104773700237274, -0.007296380121260881, 0.007263043895363808, -0.006630633492022753, 0.032505474984645844, -0.016484813764691353, -0.0029166850727051497, -0.019202226772904396, -0.015990404412150383, -0.04183477535843849, -0.03406025469303131, 0.003489718772470951, -0.02245437726378441, -0.04050086811184883, -0.03938179835677147, 0.04074087366461754, -0.030570628121495247, 0.046446945518255234, -0.029944492504000664, -0.018248045817017555, -0.04179392009973526, -0.03644179925322533, -0.012635384686291218, -0.00671808049082756, 0.05094869062304497, -0.0017590500647202134, 0.03071478195488453, 0.014611459337174892, -0.0277481097728014, -0.03550373390316963, -0.004248116631060839, 0.021695472300052643, 0.033805083483457565, -0.008938580751419067, 0.003224728163331747, -0.023285653442144394, 0.04069363325834274, -0.007271457929164171, -0.07179177552461624, 0.013337614946067333, 0.04913816228508949, 0.007442747708410025, -0.03908702731132507, 0.014644356444478035, 0.04620625823736191, 0.033357128500938416, 0.01910398155450821, 0.01644778437912464, 0.027439557015895844, -0.029310807585716248, 0.02435588650405407, -0.07207173854112625, 0.0003152019053231925, 0.011140672490000725, -0.03796543553471565, 0.0028618022333830595, -0.01739335060119629, 0.03538722172379494, -0.032945457845926285, 0.027993030846118927, -0.016842365264892578, -0.03218900412321091, -0.035419218242168427, -0.04876602068543434, -0.027778388932347298, 0.053798601031303406, -0.017546668648719788, -0.008879279717803001, -0.021589165553450584, -0.013532552868127823, -0.03270813450217247, -0.010496901348233223, -0.015246103517711163, -0.030560363084077835, -0.01575535722076893, 0.024743998423218727, -0.020847724750638008, 0.04203064739704132, 0.11094021052122116, -0.015614759176969528, -0.03660953417420387, -0.017064182087779045 ]
Deploy Hugging Face models easily with Amazon SageMaker
philschmid
July 8, 2021
deploy-hugging-face-models-easily-with-amazon-sagemaker
guide, partnerships, aws
https://huggingface.co/blog/deploy-hugging-face-models-easily-with-amazon-sagemaker
Samples/Documentation - Hugging Face documentation for Amazon SageMaker - Deploy models to Amazon SageMaker - Amazon SageMaker documentation for Hugging Face - Python SDK SageMaker documentation for Hugging Face - Deep Learning Container - Notebook: Deploy one of the 10 000+ Hugging Face Transformers to Amazon SageMaker for Inference - Notebook: Deploy a Hugging Face Transformer model from S3 to SageMaker for inference --- # SageMaker Hugging Face Inference Toolkit ⚙️ In addition to the Hugging Face Transformers-optimized Deep Learning Containers for inference, we have created a new Inference Toolkit for Amazon SageMaker. This new Inference Toolkit leverages the pipelines from the transformers library to allow zero-code deployments of models without writing any code for pre- or post-processing. In the "Getting Started" section below you find two examples of how to deploy your models to Amazon SageMaker. In addition to the zero-code deployment, the Inference Toolkit supports "bring your own code" methods, where you can override the default methods. You can learn more about "bring your own code" in the documentation here or you can check out the sample notebook "deploy custom inference code to Amazon SageMaker".
[ 0.006961744744330645, 0.013184810988605022, 0.011539940722286701, 0.04167666658759117, 0.03477878123521805, 0.08995469659566879, 0.01550696324557066, 0.03171786665916443, -0.022544628009200096, -0.009279988706111908, -0.05448194220662117, 0.047744788229465485, 0.0026347897946834564, 0.08915220946073532, -0.012921026907861233, -0.04627769812941551, 0.009139662608504295, 0.02256077155470848, -0.006072129122912884, 0.024863209575414658, 0.008659343235194683, -0.07104111462831497, -0.03304439038038254, 0.011551370844244957, 0.0014379447093233466, -0.036827463656663895, 0.04647891968488693, -0.0153910918161273, -0.022780699655413628, 0.07510538399219513, -0.07345564663410187, -0.0219572726637125, 0.01759522221982479, -0.06328236311674118, 0.025704408064484596, 0.01828189380466938, -0.1966753900051117, 0.035519059747457504, 0.01676165871322155, -0.003930892329663038, 0.009688097052276134, -0.00817289762198925, -0.08536417782306671, 0.028653791174292564, 0.033751580864191055, -0.05303265154361725, -0.1621125340461731, 0.06986922770738602, 0.021178677678108215, 0.022862408310174942, -0.047036945819854736, 0.128758043050766, 0.02906625345349312, -0.025205759331583977, 0.01622471585869789, 0.021656887605786324, -0.024568617343902588, -0.07040224224328995, 0.0022405029740184546, -0.01960625872015953, -0.027813369408249855, -0.039976492524147034, 0.016938447952270508, 0.011464531533420086, 0.046553101390600204, 0.033265966922044754, -0.010801045224070549, -0.003839939832687378, -0.039595525711774826, 0.0008240742608904839, -0.0024991994723677635, -0.07933551073074341, 0.007274491712450981, -0.014124896377325058, 0.0007925783284008503, -0.059062812477350235, 0.004334905184805393, -0.017900649458169937, 0.0387113019824028, 0.04238903149962425, -0.02750416472554207, -0.018539533019065857, -0.017420418560504913, 0.028307927772402763, 0.028004523366689682, 0.03308511897921562, 0.0288794357329607, -0.04808351397514343, -0.05066428706049919, 0.0835314393043518, 0.0027657118625938892, -0.10238047689199448, -0.009741755202412605, 0.007345326244831085, 0.03626241534948349, -0.0015576077857986093, 0.016569973900914192, 0.008590031415224075, 0.006799494847655296, -0.05510693043470383, 0.022151190787553787, -0.04522429779171944, -0.003918780945241451, -0.04055453836917877, -0.024066297337412834, 0.03635556250810623, 0.034001436084508896, -0.10630334168672562, 0.007407682482153177, 0.020256033167243004, 0.018986759707331657, -0.039349380880594254, -0.015290208160877228, 0.07515113055706024, -0.12267350405454636, 0.07277122884988785, 0.014259062707424164, -0.05847679078578949, 0.015504056587815285, -0.0007171441102400422, 0.037616536021232605, 0.06908491998910904, 0.08619742095470428, 0.00690102344378829, -0.007901274599134922, 0.06066884472966194, 0.012056435458362103, -0.0037079935427755117, -0.02671208418905735, -0.049915336072444916, 0.02827647514641285, -0.07007327675819397, 0.06312395632266998, -0.030782539397478104, 0.01565586030483246, -0.09018003195524216, 0.008671318180859089, -0.08833697438240051, 0.029481306672096252, 0.04348323866724968, 0.026749415323138237, 0.10659530758857727, 0.019855910912156105, 0.04270411282777786, 0.10570233315229416, 0.027319828048348427, -0.030044158920645714, 0.05993407592177391, -0.025965439155697823, 0.09422160685062408, -0.08397626131772995, 0.052540358155965805, -0.024202605709433556, -0.08274029195308685, -0.006100150290876627, 0.06149465963244438, -0.03352750465273857, 0.003456359962001443, -0.06577390432357788, -0.0686982050538063, -0.02770158089697361, -0.04343927279114723, -0.044486403465270996, -0.021780963987112045, 0.0016913267318159342, -0.01652349717915058, 0.05231253802776337, 0.010618755593895912, 0.07716406136751175, -0.007834367454051971, 0.0007896745810285211, -0.08745761215686798, 0.05171127989888191, -0.0051445020362734795, 0.045159559696912766, 0.03225133195519447, 0.043411433696746826, 0.0850205346941948, 0.012074540369212627, -0.0004936426994390786, -0.061952486634254456, 0.06542520225048065, -0.025634821504354477, -0.018618473783135414, 0.035119444131851196, -0.042643360793590546, 0.024569325149059296, 0.01848614402115345, 0.015469269827008247, 0.0005788799026049674, -0.028520431369543076, -0.01692112162709236, 0.045857984572649, 0.02183777280151844, 0.044097866863012314, -0.02616521343588829, -0.02967882715165615, 0.12300363928079605, 0.027752742171287537, 0.06437748670578003, 0.017808295786380768, 0.021767767146229744, -0.007455520331859589, 0.023386169224977493, -0.002529831836000085, 0.0668439194560051, -0.01119628269225359, -0.007084625773131847, 0.044781915843486786, 0.0030923164449632168, 0.04359118640422821, -0.12141140550374985, 0.01589072309434414, -0.07317860424518585, 0.010431001894176006, -0.023852137848734856, -0.0599791593849659, -0.007845810614526272, 0.011727829463779926, -0.0026047928258776665, 0.17297546565532684, -0.028040198609232903, 0.014792279340326786, -0.0584091879427433, 0.0014339926419779658, -0.004240894224494696, 0.05766991898417473, 0.06734910607337952, 0.09806301444768906, -0.0677012950181961, -0.02307790331542492, -0.0771167129278183, -0.04323195666074753, 0.003769611706957221, 0.007359892129898071, -0.031786344945430756, 0.03502091020345688, -0.035465970635414124, -0.03779558837413788, -0.02041131816804409, 0.077971450984478, -0.022647419944405556, 0.0031538878101855516, -0.018620530143380165, 0.030726050958037376, -0.02044781669974327, 0.05351991951465607, -0.0045457822270691395, 0.0009900645818561316, -0.0018655192106962204, -0.06243468075990677, 0.029647627845406532, 0.011151036247611046, -0.014872696250677109, 0.03473788872361183, 0.028185704723000526, -0.02076907828450203, 0.014850572682917118, 0.0122589822858572, 0.05257284268736839, -0.00010863271745620295, 0.005381210707128048, -0.015426071360707283, -0.023768045008182526, -0.04211609810590744, -0.059057801961898804, -0.04326155036687851, 0.02311263047158718, 0.0005475746002048254, 0.005746754352003336, 0.015912041068077087, -0.039330270141363144, 0.006849146448075771, 0.004694611765444279, 0.025215577334165573, 0.04050973802804947, 0.055389001965522766, 0.02128640003502369, 0.008289972320199013, -0.021937856450676918, 0.004186209756880999, -0.061109431087970734, -0.0004275116079952568, 0.029947249218821526, 0.013547739014029503, -0.01133052445948124, -0.012669270858168602, -0.04060140997171402, -0.02855736017227173, 0.017828319221735, 0.013621852733194828, 0.055132512003183365, 0.03745570406317711, -0.03770918771624565, 0.0017021580133587122, 0.034662846475839615, -0.005301208235323429, -0.03291839733719826, -0.0047295792028307915, 0.06588621437549591, 0.007710176054388285, -0.024826817214488983, 0.009779770858585835, -0.007186334580183029, -0.03174780681729317, 0.04605204612016678, 0.023654377087950706, 0.00922288279980421, -0.09751276671886444, -0.025286220014095306, -0.022434351965785027, 0.006611609365791082, 0.012847265228629112, -0.008809988386929035, 0.047220297157764435, -0.03639116883277893, -0.02416425198316574, 0.053392086178064346, -0.0107214180752635, 0.015762902796268463, 0.05005965009331703, -0.010588208213448524, -0.02084626629948616, 0.018181614577770233, -0.0164879709482193, 0.002985813422128558, 0.024961473420262337, 0.034544993191957474, -0.05614834651350975, 0.02968110889196396, -0.01841462403535843, -0.02151343785226345, 0.01889338344335556, -0.013028353452682495, 0.05442177131772041, 0.004056197591125965, 0.028476886451244354, -0.0249464251101017, -0.009425528347492218, -0.001998096937313676, -0.03837505355477333, -0.027749761939048767, -0.06438899785280228, -0.0035383631475269794, -0.008554582484066486, 0.04068148881196976, 0.02873131074011326, 0.010394659824669361, -0.005841434001922607, 0.0072182100266218185, 0.011392657645046711, 0.00501834973692894, 0.051391489803791046, 0.0035473888274282217, 0.013759712688624859, 0.013268684968352318, 0.014914210885763168, -0.031786948442459106, -0.02049274742603302, 0.012270215898752213, 0.027894550934433937, 0.010261017829179764, 0.015156600624322891, 0.011046978645026684, 0.0065702456049621105, 0.03928316384553909, 0.024316977709531784, -0.006019373890012503, -0.0615350641310215, 0.039094679057598114, -0.010357512161135674, -0.02155342511832714, -0.0020660890731960535, 0.025395728647708893, 0.02304460108280182, -0.0034162162337452173, 0.024521298706531525, 0.022543223574757576, -0.0019187035504728556, 0.05246906355023384, -0.0284822229295969, 0.008970079012215137, -0.046916961669921875, -0.012606733478605747, -0.0258024912327528, -0.02293844148516655, 0.051803894340991974, 0.04023125767707825, -0.02096032164990902, -0.01769922487437725, -0.004996947478502989, -0.0037453575059771538, 0.008611052297055721, 0.005243283696472645, -0.01464250311255455, -0.04839730262756348, 0.038679927587509155, 0.041049644351005554, -0.00961197167634964, -0.04131152108311653, 0.02142498828470707, -0.007724115625023842, -0.011745976284146309, -0.011107895523309708, 0.038533445447683334, 0.006292137783020735, 0.009813454933464527, -0.001751762698404491, 0.014956073835492134, -0.03219591826200485, 0.004899997729808092, -0.014463297091424465, -0.021085098385810852, 0.025150718167424202, -0.029999423772096634, -0.013641507364809513, 0.007914953865110874, -0.027582623064517975, 0.06725644320249557, -0.0032307084184139967, 0.004321343265473843, -0.018948404118418694, 0.039663296192884445, 0.04415517672896385, 0.0028301009442657232, -0.05215683579444885, -0.01185211818665266, 0.03342628479003906, -0.023020921275019646, 0.02755700796842575, -0.033979203552007675, -0.024536481127142906, 0.0010118716163560748, 0.008988521061837673, 0.02113119699060917, 0.03158765286207199, -0.025905761867761612, -0.010731992311775684, -0.020252980291843414, 0.0072838906198740005, 0.03297146409749985, 0.00032215824467130005, 0.011472117155790329, 0.02110791578888893, -0.029698221012949944, 0.03993053734302521, 0.015025903470814228, 0.011226782575249672, -0.02998298965394497, -0.00403217738494277, 0.05548849329352379, -0.008728823624551296, 0.021550225093960762, 0.010331389494240284, -0.055914927273988724, -0.02681342139840126, -0.03875517472624779, 0.054160378873348236, 0.017427528277039528, -0.0033751316368579865, -0.043244052678346634, 0.0005206476198509336, 0.011027893051505089, -0.018095016479492188, -0.006377714220434427, 0.006423939950764179, 0.03817418962717056, 0.05826917663216591, -0.014039802365005016, 0.0440639890730381, -0.0042755515314638615, -0.0005008665029890835, 0.02584417350590229, 0.0304088294506073, -0.05112088844180107, -0.06459328532218933, -0.0037396003026515245, 0.022488120943307877, -0.04640769958496094, -0.010839024558663368, 0.008359413594007492, -0.05205607786774635, 0.004245745483785868, 0.07094993442296982, 0.04958686605095863, 0.022202931344509125, -0.01736661233007908, 0.024122368544340134, -0.01025721151381731, -0.026159584522247314, -0.0247707050293684, -0.009402904659509659, -0.006760717369616032, 0.019056187942624092, 0.0542219877243042, 0.05661153048276901, -0.024067746475338936, 0.023186128586530685, -0.005355373490601778, -0.03414146602153778, 0.015359482727944851, -0.02627546899020672, 0.01664944551885128, -0.02442357689142227, 0.02711436152458191, 0.011675546877086163, -0.012322565540671349, -0.013297279365360737, 0.003225557506084442, 0.0483613945543766, -0.053283367305994034, -0.0007950420258566737, 0.04081553965806961, -0.03862611949443817, -0.01974865421652794, -0.020283762365579605, 0.02399940975010395, -0.028504233807325363, 0.016283227130770683, -0.012468019500374794, 0.005938796326518059, 0.012594579719007015, -0.017090648412704468, -0.020616699010133743, -0.0027930792421102524, 0.022065749391913414, 0.02928740531206131, 0.012447609566152096, -0.016218435019254684, -0.00464429659768939, 0.020408261567354202, -0.004668109584599733, 0.023818373680114746, -0.013117239810526371, 0.002669208450242877, 0.009024607948958874, -0.022263871505856514, 0.007947924546897411, 0.006093558855354786, 0.004550032317638397, -0.009176109917461872, 0.024040639400482178, -0.00008909384632715955, -0.011193330399692059, -0.053335390985012054, 0.044140297919511795, 0.02844722755253315, -0.028680255636572838, -0.01601145975291729, -0.025291502475738525, -0.020763641223311424, -0.0060805948451161385, -0.032582007348537445, 0.03471663221716881, 0.04703856632113457, -0.01603245548903942, 0.0018593997228890657, 0.0164991095662117, 0.005442311521619558, 0.027747105807065964, 0.0521920844912529, -0.020223163068294525, 0.020253511145710945, 0.005700473673641682, 0.000492079823743552, 0.02153126336634159, 0.00017164515156764537, -0.02186918444931507, 0.021383114159107208, -0.06092525273561478, 0.03035825304687023, 0.007898146286606789, -0.03564666211605072, -0.003911537583917379, -0.022271323949098587, -0.035144031047821045, 0.006206756457686424, 0.013841282576322556, 0.04580490663647652, 0.05428391322493553, -0.0009972944390028715, -0.019684573635458946, 0.012317574582993984, 0.004947984125465155, 0.01664353907108307, 0.059610605239868164, -0.029670575633645058, 0.008300434798002243, -0.0035416409373283386, 0.04605488479137421, 0.03393308445811272, 0.017857946455478668, 0.004366730805486441, -0.0068122814409434795, 0.06154815852642059, -0.012427803128957748, 0.03597233444452286, 0.016795961186289787, -0.010374002158641815, -0.009481455199420452, -0.041640978306531906, 0.0037388927303254604, -0.02286832220852375, -0.001932030078023672, 0.03763745725154877, -0.005202998872846365, 0.023422330617904663, -0.004033904056996107, 0.06773561239242554, 0.038864538073539734, 0.03208143264055252, -0.0018584576901048422, 0.019427573308348656, 0.08278872072696686, 0.012843434698879719, 0.0006460006115958095, 0.029462138190865517, 0.017651429399847984, -0.01402397733181715, 0.032404545694589615, -0.0005338456830941141, 0.020862054079771042, -0.013160976581275463, -0.010509157553315163, -0.029604468494653702, -0.006726767867803574, -0.02685282751917839, -0.01681605726480484, 0.007885652594268322, -0.04596972092986107, -0.02249619923532009, -0.00734297838062048, -0.02658024989068508, 0.012314300052821636, -0.02466275915503502, 0.009301862679421902, -0.01961904764175415, -0.010131437331438065, 0.008917777799069881, 0.011349702253937721, 0.011429854668676853, -0.0536796860396862, -0.007632330991327763, 0.02138250134885311, -0.004544294439256191, -0.0317116342484951, -0.016897493973374367, -0.02886021137237549, -0.0314084067940712, -0.022938746958971024, -0.009294631890952587, 0.00013806614151690155, -0.04695068299770355, -0.027248123660683632, 0.01544960681349039, 0.04421140253543854, 0.002705307910218835, 0.024814577773213387, 0.027210822328925133, 0.02069137617945671, -0.032454703003168106, 0.011641738004982471, 0.010464572347700596, -0.004032946657389402, -0.0036171805113554, -0.05923354998230934, 0.00714669656008482, -0.0006740965181961656, 0.009961382485926151, -0.009364808909595013, 0.030311863869428635, -0.0009203603840433061, -0.01603330299258232, -0.009308294393122196, 0.0021206699311733246, -0.006989531219005585, 0.03859485685825348, -0.011831777170300484, -0.023165931925177574, 0.009593901224434376, -0.007818043231964111, -0.0013123027747496963, 0.017183298245072365, 0.021426383405923843, 0.048936061561107635, -0.03578980639576912, -0.01667553372681141, -0.007158888503909111, 0.046598538756370544, 0.007721266709268093, 0.03255518898367882, 0.019517317414283752, 0.009596080519258976, 0.0036176859866827726, -0.040737442672252655, -0.010803494602441788, -0.026005001738667488, 0.004432709887623787, -0.051233693957328796, -0.06515632569789886, -0.03201669454574585, -0.010552437044680119, 0.005024556536227465, 0.02496655285358429, -0.03497595712542534, 0.000983664533123374, -0.036351174116134644, -0.019818859174847603, -0.02515660785138607, -0.00022329490457195789, 0.06863691657781601, 0.03249909356236458, 0.042785704135894775, -0.009496255777776241, -0.0349830724298954, 0.00012556868023239076, -0.00042032613418996334, 0.04617537185549736, 0.03990670293569565, -0.012011229991912842, 0.02467454969882965, -0.03768276423215866, -0.0003127609961666167, -0.0030726660043001175, -0.0442994199693203, 0.03149823099374771, 0.012185875326395035, -0.02043844386935234, -0.020091554149985313, 0.001072357757948339, 0.030092541128396988, 0.0126456618309021, 0.04349656030535698, -0.04054529592394829, 0.0021587021183222532, -0.012686139903962612, 0.011377920396625996, -0.056732624769210815, 0.0002039451792370528, -0.01815834455192089, -0.032038308680057526, 0.00002637919897097163, 0.021988729014992714, 0.014671888202428818, -0.0510442852973938, -0.005147006828337908, -0.015613116323947906, -0.023415232077240944, -0.04845426231622696, -0.0585443489253521, -0.017618777230381966, 0.04852725937962532, -0.026580994948744774, -0.04052118584513664, -0.027551984414458275, -0.031369175761938095, -0.00934683158993721, 0.010820912197232246, 0.008182492107152939, -0.022727105766534805, -0.05018492415547371, 0.01552572101354599, 0.01405046135187149, 0.028961526229977608, 0.050815314054489136, -0.017619574442505836, -0.017314152792096138, 0.0028625198174268007 ]
Deploy Hugging Face models easily with Amazon SageMaker
philschmid
July 8, 2021
deploy-hugging-face-models-easily-with-amazon-sagemaker
guide, partnerships, aws
https://huggingface.co/blog/deploy-hugging-face-models-easily-with-amazon-sagemaker
Blog/Video - Video: Deploy a Hugging Face Transformers Model from S3 to Amazon SageMaker - Video: Deploy a Hugging Face Transformers Model from the Model Hub to Amazon SageMaker
[ -0.029963284730911255, -0.023376544937491417, 0.03759611397981644, 0.016924884170293808, 0.013018300756812096, 0.06438583135604858, -0.021605877205729485, 0.024405021220445633, -0.0007882557692937553, 0.017513949424028397, -0.03023695759475231, 0.050076451152563095, -0.013073465786874294, 0.11753546446561813, -0.0015799974789842963, -0.04721689224243164, -0.03339691460132599, 0.03313705325126648, -0.008894572965800762, 0.02024727873504162, -0.012561262585222721, -0.07264654338359833, -0.004774066153913736, 0.023095933720469475, 0.023453541100025177, -0.04258240386843681, 0.05067862197756767, -0.01724955253303051, 0.018643245100975037, 0.07759744673967361, -0.05708233267068863, -0.02143450640141964, 0.02419581450521946, -0.021434234455227852, 0.0012081742752343416, 0.052896250039339066, -0.1641329973936081, 0.040740642696619034, 0.0009635917958803475, 0.0004682193975895643, -0.009884286671876907, -0.0032142815180122852, -0.039945125579833984, 0.03457212448120117, 0.022101974114775658, -0.026642244309186935, -0.1600266993045807, 0.07868534326553345, 0.007521612104028463, 0.0063920761458575726, -0.050232622772455215, 0.11161889880895615, 0.02715039998292923, -0.03230270370841026, -0.01899862475693226, 0.0261676162481308, -0.021232744678854942, -0.06983555108308792, -0.022540787234902382, -0.01504556555300951, 0.005344875156879425, -0.024896856397390366, -0.0031086597591638565, 0.03179857134819031, -0.024201851338148117, 0.016133682802319527, 0.043571703135967255, -0.026248306035995483, -0.01991823874413967, -0.015227057971060276, 0.0230144914239645, -0.06768253445625305, 0.025416797026991844, -0.050090689212083817, -0.0276787132024765, -0.03616686910390854, 0.038425054401159286, -0.020599152892827988, 0.04095890745520592, 0.06581319123506546, 0.009117014706134796, -0.013918147422373295, -0.024725066497921944, 0.055670201778411865, 0.015347907319664955, 0.04381818324327469, 0.02837592549622059, -0.08627117425203323, -0.07870135456323624, 0.13014276325702667, -0.002322204178199172, -0.06996393948793411, -0.06797461956739426, 0.027082229033112526, 0.07602240890264511, 0.01773718185722828, 0.0032355987932533026, -0.05967509746551514, 0.009382433257997036, -0.01657952554523945, 0.056756407022476196, -0.03634769842028618, 0.050849780440330505, -0.05862199142575264, 0.019105559214949608, 0.021724572405219078, -0.0029572260100394487, -0.13190841674804688, 0.056196946650743484, 0.018330872058868408, 0.049611903727054596, -0.07831090688705444, 0.028812788426876068, 0.04866330698132515, -0.08356624096632004, 0.08091885596513748, 0.017224496230483055, -0.07322628051042557, 0.022255564108490944, 0.050316981971263885, 0.04459183290600777, 0.10847921669483185, 0.024031655862927437, -0.0036640579346567392, 0.017562221735715866, 0.08242084085941315, 0.008842917159199715, -0.052461251616477966, -0.025282789021730423, -0.04125458747148514, 0.01489957980811596, -0.06740230321884155, 0.05762664973735809, -0.029656661674380302, 0.02380147948861122, -0.10546261072158813, 0.049749791622161865, -0.04717954248189926, 0.036364831030368805, 0.025443311780691147, 0.018661683425307274, 0.0997156873345375, 0.04602935537695885, 0.030080029740929604, 0.07033287733793259, -0.0014850528677925467, -0.060477036982774734, 0.05284668132662773, 0.004667623434215784, 0.06411924958229065, -0.08695097267627716, 0.041446130722761154, -0.026180269196629524, -0.10841356217861176, 0.006932437419891357, 0.07650355249643326, 0.017369074746966362, -0.014980655163526535, -0.024144284427165985, -0.05947280675172806, -0.019019566476345062, -0.006881424691528082, -0.046366892755031586, -0.022789793089032173, 0.008057685568928719, -0.020761245861649513, 0.04782328009605408, -0.012279538437724113, 0.08535991609096527, -0.010560180991888046, 0.016478847712278366, -0.03936246782541275, 0.03174120932817459, 0.045819565653800964, 0.016727667301893234, 0.04436792805790901, 0.0813143402338028, 0.09593610465526581, -0.02066861279308796, -0.012695442885160446, -0.03906508907675743, 0.053107988089323044, -0.006058682221919298, 0.013171359896659851, 0.056560344994068146, -0.02440340258181095, 0.03055955469608307, 0.05110694468021393, 0.03879375383257866, 0.02331690490245819, 0.0015067646745592356, -0.04434593766927719, 0.02649364434182644, -0.005693756975233555, 0.030615661293268204, 0.02519361488521099, -0.03763513267040253, 0.08465985208749771, 0.01490645669400692, 0.0888647809624672, -0.006296973209828138, 0.0001712743251118809, -0.02587590366601944, -0.008704002015292645, -0.018249714747071266, 0.05356943979859352, -0.0027258596383035183, -0.000525867217220366, 0.0731923058629036, -0.011599092744290829, 0.039852846413850784, -0.10263931006193161, 0.03815628960728645, -0.08266817033290863, -0.01277969405055046, -0.038549769669771194, -0.07193568348884583, -0.027994699776172638, -0.008574673905968666, 0.020587535575032234, 0.12769798934459686, 0.03814993053674698, 0.008921022526919842, -0.08348003774881363, 0.006489697378128767, 0.0017249733209609985, 0.05413932353258133, 0.06577780097723007, 0.09590576589107513, -0.06539196521043777, -0.03992462903261185, -0.058419205248355865, -0.04603232815861702, -0.027850039303302765, 0.02120058424770832, -0.025251712650060654, 0.01610901765525341, -0.04084474593400955, 0.00400301581248641, 0.0005989395431242883, 0.03661813586950302, -0.002284576650708914, 0.020623382180929184, -0.004047651309520006, 0.018194640055298805, -0.010431458242237568, 0.039936259388923645, -0.014997447840869427, -0.018359685316681862, 0.04229264706373215, -0.11493288725614548, 0.031936340034008026, 0.02516215294599533, -0.013838491402566433, 0.052325405180454254, 0.006703567691147327, -0.013861598446965218, 0.007079738192260265, 0.00004468591578188352, 0.04287939891219139, -0.0034102534409612417, 0.009007341228425503, -0.016038615256547928, -0.022282861173152924, -0.010328548029065132, -0.0212082639336586, -0.04849987477064133, 0.00012770840839948505, -0.0072164698503911495, -0.011325988918542862, 0.024491911754012108, -0.04462241381406784, 0.02125348336994648, 0.0030581760220229626, 0.00236917519941926, 0.004744973499327898, 0.05286609008908272, 0.014587596990168095, -0.0068754409439861774, 0.005364993121474981, 0.030294016003608704, -0.02405300922691822, 0.010072967037558556, 0.006841168738901615, 0.01775502972304821, 0.022095834836363792, 0.015707703307271004, -0.045541830360889435, -0.010501629672944546, 0.008491730317473412, 0.03078649938106537, 0.03892626240849495, 0.005314741749316454, 0.011055031791329384, 0.018708160147070885, 0.031742729246616364, 0.008897501043975353, -0.02658977173268795, -0.01046307198703289, 0.061893071979284286, 0.008553042076528072, 0.009737261570990086, -0.004559536464512348, -0.01098315417766571, -0.042909085750579834, -0.0011260579340159893, 0.040905244648456573, -0.004182256758213043, -0.09606142342090607, -0.04597551375627518, -0.0196321252733469, 0.001622602459974587, 0.01717275381088257, -0.028051840141415596, 0.03456192463636398, -0.019588908180594444, -0.006021387409418821, 0.022775614634156227, 0.030664855614304543, 0.008850560523569584, 0.017804721370339394, 0.0008047730079852045, -0.021905450150370598, 0.0012664617970585823, -0.031270936131477356, 0.0001016814712784253, 0.04628458246588707, 0.04063045233488083, -0.07318636775016785, 0.005682745017111301, 0.0013927846448495984, -0.04141898825764656, 0.03673902153968811, -0.027792464941740036, 0.04220304638147354, -0.01981143094599247, 0.026763103902339935, -0.02302924543619156, 0.014501705765724182, -0.010098782368004322, -0.03894815593957901, -0.0011021604295819998, -0.0399179607629776, 0.004165304824709892, 0.002836776664480567, 0.036969102919101715, 0.043008528649806976, 0.010208462364971638, -0.011154284700751305, -0.00009844236046774313, -0.012898690067231655, 0.0046585057862102985, 0.05858437344431877, -0.003079254413023591, -0.008855044841766357, 0.02387104742228985, 0.039785753935575485, -0.0323559008538723, -0.019336078315973282, -0.00803164578974247, 0.017120979726314545, 0.012915774248540401, 0.014929814264178276, 0.01951308734714985, 0.02723502367734909, 0.02417435124516487, 0.011031035333871841, -0.01735716126859188, -0.0635276660323143, 0.008176960051059723, -0.022487621754407883, -0.011374929919838905, -0.01333061046898365, 0.041164275258779526, 0.00661546690389514, 0.010007042437791824, 0.038250576704740524, 0.02044709026813507, -0.010524306446313858, 0.017059873789548874, -0.04778362065553665, 0.017032552510499954, -0.0607663094997406, -0.0024352746549993753, 0.020625745877623558, -0.013753097504377365, 0.030913539230823517, -0.0034093759022653103, -0.03445395454764366, -0.015161075629293919, 0.008915160782635212, -0.026111703366041183, 0.006024251226335764, 0.006095653399825096, 0.0007132919854484499, -0.026455573737621307, 0.033501867204904556, 0.04128728806972504, -0.019990302622318268, -0.046997033059597015, -0.007755639031529427, -0.023516111075878143, -0.010651412419974804, -0.02664925903081894, 0.019187644124031067, -0.011052730493247509, -0.01572762243449688, -0.028567831963300705, -0.005926371552050114, -0.027070630341768265, 0.00540554104372859, -0.004073691088706255, -0.016772959381341934, 0.02221488021314144, 0.005133264698088169, -0.04402560368180275, -0.01205817237496376, 0.014351122081279755, 0.06628360599279404, -0.008613104932010174, 0.020242949947714806, -0.01006600446999073, 0.026211611926555634, 0.035220950841903687, -0.011901543475687504, -0.04630924016237259, -0.006444341968744993, 0.055842459201812744, -0.03375060111284256, 0.020735125988721848, -0.023016827180981636, -0.02636142447590828, -0.01403691153973341, -0.021537404507398605, 0.012060585431754589, 0.049681130796670914, -0.02304048463702202, -0.027171604335308075, -0.009982260875403881, -0.00542615307494998, 0.04963758587837219, 0.011104042641818523, -0.007819732651114464, 0.030503351241350174, -0.01375444233417511, 0.043925438076257706, 0.026988854631781578, 0.004930355120450258, -0.013920758850872517, -0.0007630758336745203, 0.06512437015771866, -0.00440899608656764, 0.03238743916153908, -0.00606408528983593, -0.06765194237232208, -0.009136736392974854, -0.02913951314985752, 0.0439392626285553, 0.029310554265975952, -0.0015408352483063936, -0.05056513100862503, 0.02101672999560833, 0.020194556564092636, -0.011878998950123787, -0.010067872703075409, -0.007111917715519667, 0.012570662423968315, 0.046141814440488815, 0.0005837330245412886, 0.024767620489001274, -0.04381483420729637, 0.008830521255731583, 0.03524678200483322, 0.03906414285302162, -0.027072878554463387, -0.08282878249883652, 0.028548816218972206, 0.03815757483243942, -0.009417091496288776, -0.015722062438726425, 0.018769074231386185, -0.043819013983011246, 0.007543272338807583, 0.07195794582366943, 0.04417223483324051, -0.003475629026070237, -0.0037025955971330404, 0.022984731942415237, -0.021115489304065704, 0.015318457037210464, -0.04077963903546333, -0.02751285396516323, -0.009259113110601902, 0.023439712822437286, 0.040553074330091476, 0.07356958091259003, -0.03759758546948433, 0.008359427563846111, 0.0017113497015088797, -0.01913868449628353, 0.00752963125705719, -0.03875371068716049, -0.010966330766677856, -0.0002274041617056355, -0.006490313448011875, -0.012343969196081161, -0.004448462277650833, 0.015259744599461555, 0.008258912712335587, 0.05563640967011452, -0.03189340606331825, -0.0003951177350245416, 0.031104931607842445, -0.05583103373646736, 0.002898335922509432, 0.015576089732348919, -0.005112227518111467, -0.002063010586425662, 0.027431106194853783, 0.02545066550374031, 0.008382166735827923, -0.04577495902776718, -0.004998161457479, -0.036615315824747086, -0.0036358730867505074, 0.010134320706129074, 0.02505362406373024, 0.02556128427386284, -0.030486740171909332, -0.002019530860707164, 0.032282739877700806, -0.013878582045435905, 0.018466928973793983, -0.010618933476507664, -0.005900625139474869, 0.028034688904881477, -0.03932749107480049, 0.03735912963747978, 0.0067927236668765545, 0.0003441086446400732, -0.025346193462610245, 0.03069337084889412, 0.0324733629822731, -0.024620991200208664, -0.0328291691839695, 0.046038538217544556, 0.03718823939561844, -0.026269054040312767, 0.01634143851697445, 0.0018920114962384105, -0.04049719497561455, -0.018791010603308678, -0.05471732094883919, 0.019012561067938805, 0.06142382696270943, -0.0009377816459164023, 0.016005555167794228, -0.008343666791915894, 0.008695998229086399, 0.00530428159981966, 0.024935651570558548, 0.018361564725637436, 0.004009210970252752, 0.007758772931993008, -0.004906126763671637, 0.010548458434641361, -0.016764730215072632, -0.053927015513181686, 0.026191148906946182, -0.035375628620386124, 0.02321176417171955, 0.00470698019489646, -0.008108503185212612, 0.00692899152636528, -0.01669958047568798, -0.02268032915890217, 0.0054148463532328606, 0.02618369832634926, 0.035490091890096664, 0.05228053405880928, -0.029702743515372276, -0.004734339192509651, -0.01071785669773817, -0.001808122731745243, 0.059627145528793335, 0.04537342116236687, -0.051337264478206635, 0.0113317696377635, -0.025586679577827454, 0.03597042337059975, 0.03086116909980774, 0.006329857744276524, -0.012311520054936409, -0.0012660977663472295, 0.03811122849583626, -0.03615640476346016, 0.04484624043107033, 0.04694448038935661, -0.005441237241029739, -0.027513688430190086, -0.034932199865579605, -0.019532741978764534, -0.05585316941142082, 0.010092699900269508, -0.005597335286438465, -0.026143936440348625, 0.0014672211837023497, -0.019429737702012062, 0.05653441697359085, 0.027291473001241684, 0.03276047855615616, -0.02834141254425049, 0.033921752125024796, 0.046371277421712875, -0.003297228366136551, 0.02717951312661171, 0.026610257104039192, 0.009913609363138676, 0.021347526460886, 0.01617298647761345, -0.00041722788591869175, 0.03816423937678337, -0.01711145229637623, 0.01976269669830799, -0.014528815634548664, -0.024372456595301628, -0.04840344935655594, -0.005462944507598877, 0.009961605072021484, -0.046125661581754684, -0.006313497666269541, 0.0027968434151262045, 0.016228117048740387, 0.02540193498134613, -0.0011909327004104853, 0.02174382470548153, -0.04773822799324989, -0.02447299286723137, 0.005994115024805069, 0.01862759329378605, -0.007749604992568493, -0.04433254152536392, 0.010525202378630638, -0.0016094991005957127, 0.002065858105197549, -0.002045756671577692, -0.034394241869449615, -0.019362766295671463, -0.008904499933123589, 0.004181832540780306, -0.03522380813956261, -0.001085480093024671, -0.04663199186325073, -0.0054925112053751945, 0.018835868686437607, 0.02535005658864975, 0.0063287243247032166, 0.0496363565325737, 0.025446351617574692, 0.02468162588775158, -0.03195980563759804, -0.00289300293661654, 0.014505439437925816, -0.012771290726959705, 0.0009697431232780218, -0.07755803316831589, 0.015582357533276081, -0.009091184474527836, 0.015077956020832062, 0.007987027987837791, 0.025648921728134155, -0.0019780518487095833, -0.004114890471100807, -0.009518199600279331, -0.011617781594395638, 0.002355223288759589, 0.04271230101585388, -0.021990124136209488, -0.006388935260474682, 0.020568644627928734, 0.012172028422355652, 0.02608364261686802, 0.01728874258697033, 0.0110268360003829, 0.04515128210186958, -0.03762807697057724, 0.010161340236663818, 0.011846873909235, 0.025930654257535934, 0.01859276182949543, 0.007245136424899101, 0.0003989798133261502, 0.005957981571555138, 0.010859568603336811, -0.044287070631980896, 0.017254982143640518, -0.027568556368350983, -0.017620205879211426, -0.045038338750600815, -0.08153662085533142, -0.002645143074914813, -0.039190590381622314, -0.01523964386433363, 0.020941320806741714, -0.04724787175655365, 0.008593169040977955, -0.020845644176006317, 0.0037582211662083864, -0.004975688178092241, 0.025038504973053932, 0.04197091981768608, 0.062137480825185776, 0.04982621222734451, -0.021968409419059753, -0.04502814635634422, -0.01272996049374342, 0.01202359702438116, 0.03729749843478203, 0.017400303855538368, -0.023522555828094482, -0.01131049357354641, -0.048111289739608765, -0.010782469995319843, 0.012426180765032768, -0.047613684087991714, 0.038674525916576385, -0.004086560104042292, -0.02951768971979618, -0.02924732305109501, -0.01647304929792881, 0.005423401948064566, -0.006938375532627106, 0.03589153662323952, -0.02885293960571289, -0.009539254009723663, -0.031998611986637115, 0.015449846163392067, -0.02420290745794773, 0.016481902450323105, -0.012624538503587246, -0.03058057650923729, 0.019981466233730316, 0.020766427740454674, -0.003942880313843489, -0.06272901594638824, -0.026844417676329613, 0.005556897260248661, 0.00169843970797956, -0.05772308632731438, -0.061338502913713455, -0.0046569667756557465, 0.03331928700208664, -0.0441356860101223, -0.06151407212018967, -0.012090128846466541, -0.031996823847293854, 0.0007258980767801404, -0.0038115561474114656, -0.014827251434326172, -0.02971382811665535, -0.04713630676269531, -0.009455488063395023, -0.0016519809141755104, 0.012942640110850334, -0.011765731498599052, -0.03210488334298134, -0.0013351135421544313, -0.0049584913067519665 ]
Deploy Hugging Face models easily with Amazon SageMaker
philschmid
July 8, 2021
deploy-hugging-face-models-easily-with-amazon-sagemaker
guide, partnerships, aws
https://huggingface.co/blog/deploy-hugging-face-models-easily-with-amazon-sagemaker
Deploy a trained Hugging Face Transformer model to SageMaker for inference There are two ways to deploy your SageMaker trained Hugging Face model. You can either deploy it after your training is finished, or you can deploy it later, using the model_data pointing to your saved model on Amazon S3. In addition to the two below-mentioned options, you can also instantiate Hugging Face endpoints with lower-level SDK such as boto3 and AWS CLI, Terraform and with CloudFormation templates.
[ -0.0055304598063230515, -0.023407569155097008, -0.002725692931562662, 0.028518596664071083, 0.005933415610343218, 0.0703074187040329, 0.0053135366179049015, 0.016636960208415985, -0.026232600212097168, 0.009317077696323395, -0.049616988748311996, 0.026523882523179054, 0.008623620495200157, 0.11321309208869934, -0.011747699230909348, -0.10361586511135101, -0.009080921299755573, 0.005874375347048044, -0.029501156881451607, 0.0188885647803545, 0.00899657141417265, -0.07900818437337875, -0.04780633747577667, -0.005764428060501814, -0.007024520076811314, -0.05013713613152504, 0.034524694085121155, -0.007793544791638851, 0.025192007422447205, 0.057272136211395264, -0.07668472081422806, -0.029623137786984444, -0.013009004294872284, -0.03555925935506821, 0.022233787924051285, 0.06460888683795929, -0.1480032205581665, 0.029157299548387527, 0.02632252685725689, -0.027910709381103516, -0.001673379447311163, 0.005678367801010609, -0.06490301340818405, 0.05935295671224594, 0.034034453332424164, -0.05866821110248566, -0.10559684783220291, 0.062405262142419815, 0.027196016162633896, 0.004823655355721712, -0.05063207820057869, 0.12851636111736298, 0.013613373041152954, -0.0372258760035038, 0.034546032547950745, 0.028420330956578255, -0.0159758273512125, -0.05934545397758484, -0.0062900143675506115, 0.0027726120315492153, -0.038558412343263626, -0.019160378724336624, 0.0114563824608922, 0.022389410063624382, 0.013837574981153011, 0.024969682097434998, 0.017013799399137497, -0.05463681370019913, -0.037737518548965454, -0.022874854505062103, -0.002667450811713934, -0.06563998013734818, 0.02566634677350521, -0.000848295574542135, -0.031036628410220146, -0.021639691665768623, 0.02068529650568962, 0.014559336006641388, 0.054074976593256, 0.06103049963712692, -0.015735117718577385, -0.015605156309902668, -0.035171810537576675, 0.008016283623874187, 0.04080233722925186, 0.03172174096107483, 0.012875169515609741, -0.0777471512556076, -0.08249177038669586, 0.07682088017463684, 0.012453568167984486, -0.05780614912509918, -0.04969927668571472, 0.025077464058995247, 0.06215689703822136, 0.012210561893880367, -0.004069140180945396, -0.013980810530483723, 0.0013929285341873765, -0.061153605580329895, 0.024988528341054916, -0.07374723255634308, -0.008915034122765064, -0.0317404642701149, 0.007188391871750355, 0.03846782445907593, -0.0030561925377696753, -0.11154423654079437, 0.02462138421833515, -0.007760423701256514, 0.02342275343835354, -0.06327542662620544, 0.0021867018658667803, 0.06446331739425659, -0.11062370240688324, 0.07062627375125885, 0.012591958977282047, -0.04187431558966637, 0.033390361815690994, 0.009828940033912659, 0.05226851999759674, 0.093528613448143, 0.033961642533540726, -0.005319897085428238, -0.0020894918125122786, 0.08475314825773239, 0.004818153101950884, -0.0070413690991699696, 0.016609491780400276, -0.01942749135196209, 0.03057309240102768, -0.05080524459481239, 0.025341710075736046, -0.008873856626451015, 0.04399348050355911, -0.059638313949108124, 0.030859237536787987, -0.09228406101465225, 0.03575693070888519, 0.0262015201151371, -0.0067300451919436455, 0.14032933115959167, 0.04774121940135956, 0.02847530134022236, 0.08786460012197495, 0.018510647118091583, -0.043846338987350464, 0.047834113240242004, 0.014085156843066216, 0.08976409584283829, -0.10154979676008224, 0.06721851974725723, -0.0218622125685215, -0.07120127230882645, 0.010066067799925804, 0.05150241032242775, -0.03475582227110863, 0.0035265572369098663, -0.046500980854034424, -0.043206606060266495, -0.011565283872187138, 0.007557519245892763, -0.04660956561565399, -0.015683025121688843, 0.03263591229915619, -0.027467412874102592, 0.049145299941301346, -0.010084187611937523, 0.10749980807304382, -0.025304723531007767, -0.0016859910683706403, -0.06240176036953926, 0.0528506338596344, 0.02071721851825714, 0.09005695581436157, 0.043240975588560104, 0.03399303928017616, 0.10356788337230682, -0.01542711816728115, -0.01442474965006113, -0.03467747941613197, 0.0680183544754982, -0.017352230846881866, -0.01825871132314205, 0.032725781202316284, -0.0410129576921463, 0.02198660932481289, -0.022928433492779732, 0.049168724566698074, 0.023621072992682457, 0.015294653363525867, -0.005812513176351786, 0.007815156131982803, -0.02008127234876156, 0.05221066623926163, 0.02180543914437294, -0.04290241748094559, 0.12327142804861069, 0.0077208043076097965, 0.05908763036131859, 0.03451089188456535, -0.005647941026836634, -0.015895111486315727, 0.0221855528652668, -0.01649228297173977, 0.046279825270175934, -0.02523021772503853, -0.02974858693778515, 0.06474296748638153, 0.0018547603394836187, 0.030710207298398018, -0.09747389703989029, 0.02369404211640358, -0.08710595965385437, -0.025301745161414146, -0.03969387337565422, -0.06540671736001968, -0.0268495362251997, -0.0263927411288023, 0.01783040165901184, 0.14619266986846924, -0.008179704658687115, 0.036825668066740036, -0.08175501972436905, 0.0064690373837947845, -0.023110125213861465, 0.039874590933322906, 0.08413410186767578, 0.09524507820606232, -0.078093983232975, -0.026326321065425873, -0.10622428357601166, -0.020549612119793892, -0.0012112886179238558, 0.002611759351566434, -0.038824375718832016, 0.022892143577337265, -0.0750243291258812, -0.011894765309989452, 0.005770926829427481, 0.0796348974108696, 0.0015683441888540983, 0.030192231759428978, -0.009108022786676884, 0.03365931287407875, -0.007693288382142782, 0.01951529271900654, -0.0063789174892008305, -0.02154325693845749, -0.004886120557785034, -0.10903206467628479, 0.02936827950179577, 0.010401331819593906, -0.012903018854558468, 0.04344706982374191, 0.007531517185270786, -0.030614547431468964, 0.004269869532436132, 0.008630496449768543, 0.06386520713567734, -0.004281193017959595, -0.0015225516399368644, -0.017173103988170624, 0.004125029779970646, -0.0016739907441660762, -0.04261460900306702, -0.043470725417137146, -0.019356878474354744, -0.011412651278078556, -0.01753508672118187, 0.028725840151309967, -0.053913284093141556, -0.006117276381701231, 0.01563163287937641, 0.011080714873969555, 0.0006037776474840939, 0.048427700996398926, 0.011086955666542053, -0.010459277778863907, -0.012018396519124508, 0.025872470811009407, -0.02924581803381443, -0.01071549579501152, 0.022819237783551216, 0.008819939568638802, -0.001450441312044859, 0.025352023541927338, -0.0379612110555172, -0.03129168972373009, 0.019000019878149033, 0.022874929010868073, 0.042969267815351486, 0.016507968306541443, 0.004740162752568722, -0.0043420614674687386, 0.026615284383296967, 0.010294645093381405, -0.03027012012898922, -0.010095074772834778, 0.05956769362092018, -0.006761449389159679, 0.009595652110874653, 0.01764882169663906, -0.03948976844549179, -0.037722375243902206, 0.008203319273889065, 0.044835902750492096, -0.017946692183613777, -0.0810205265879631, -0.03241998702287674, -0.03431331738829613, 0.007331660483032465, 0.01543774176388979, -0.0015128261875361204, 0.06520877033472061, -0.027895865961909294, -0.013549095019698143, 0.0423392690718174, 0.01494582649320364, 0.009157688356935978, 0.019861869513988495, 0.010176695883274078, -0.029602525755763054, 0.006277553737163544, -0.011592078022658825, -0.0036072207149118185, 0.022752391174435616, 0.05174066126346588, -0.06279125809669495, 0.022961465641856194, 0.0174249317497015, -0.03323075920343399, 0.018383393064141273, -0.0025664393324404955, 0.051282308995723724, -0.015699269250035286, 0.024168003350496292, -0.04039068520069122, 0.013163343071937561, -0.04330020397901535, -0.010071630589663982, -0.0203083548694849, -0.057574350386857986, 0.006960960570722818, 0.0015103798359632492, 0.05099396035075188, 0.05087590962648392, -0.007380389142781496, -0.012166157364845276, -0.012605207040905952, -0.00631370022892952, -0.004422593861818314, 0.04876650124788284, 0.01581575721502304, 0.008835396729409695, 0.015025674365460873, 0.008977589197456837, -0.027661625295877457, 0.004809216130524874, 0.01412049401551485, 0.0012816329253837466, 0.011989905498921871, 0.0009346720762550831, 0.007667815778404474, 0.035638853907585144, 0.03810178115963936, 0.02238411456346512, 0.0019467229722067714, -0.05295509472489357, 0.00424146605655551, -0.010195443406701088, -0.041185468435287476, -0.0031132050789892673, 0.03845109045505524, 0.016149289906024933, -0.00004084142346982844, 0.02427859790623188, 0.01913348212838173, 0.0016959736822173, 0.049330055713653564, -0.025929274037480354, 0.010519326664507389, -0.025767216458916664, -0.010883336886763573, -0.006991337984800339, -0.020960239693522453, 0.03635691851377487, 0.018510283902287483, -0.015080512501299381, 0.011609024368226528, 0.019776005297899246, -0.013182109221816063, 0.013480649329721928, 0.008044510148465633, 0.012133347801864147, -0.024441029876470566, 0.03671470284461975, 0.05231122672557831, -0.004961381200700998, -0.0560082383453846, 0.02178928628563881, -0.007772365584969521, -0.009938960894942284, -0.03121917136013508, 0.026507606729865074, 0.013000981882214546, 0.00008210980740841478, -0.017857009544968605, -0.03773645684123039, -0.030290748924016953, 0.004540555644780397, -0.01747581735253334, -0.026453936472535133, 0.015728717669844627, -0.0126451151445508, -0.030526846647262573, 0.0039147865027189255, -0.017172489315271378, 0.035508934408426285, 0.010525054298341274, 0.0024268405977636576, -0.02366216666996479, 0.014911421574652195, 0.054239898920059204, -0.006119999103248119, -0.014059724286198616, 0.0020466968417167664, 0.059811536222696304, -0.030217187479138374, 0.0276699960231781, -0.013427392579615116, -0.04059469327330589, 0.001001515076495707, -0.019270118325948715, 0.011603733524680138, 0.052708350121974945, -0.017055463045835495, -0.022522319108247757, -0.014794879592955112, -0.008796845562756062, 0.03654545173048973, 0.018919529393315315, -0.00814341101795435, 0.004559868946671486, -0.020138945430517197, 0.032915860414505005, 0.03402405232191086, 0.016629032790660858, -0.019807161763310432, 0.013555441983044147, 0.03377072885632515, -0.021864959970116615, 0.025744009763002396, 0.0040414901450276375, -0.06991246342658997, 0.0004242516588419676, -0.04923287779092789, 0.03948444500565529, 0.0245069470256567, 0.027264466509222984, -0.03269350901246071, 0.015226185321807861, 0.02093285694718361, -0.007323616649955511, -0.006416641175746918, 0.012513576075434685, 0.05866609886288643, 0.055149901658296585, -0.02308966964483261, 0.012063294649124146, -0.00621845293790102, -0.010834283195436, 0.0315958634018898, 0.024132678285241127, -0.027009956538677216, -0.07510663568973541, 0.004364458378404379, 0.019459806382656097, -0.03064025565981865, -0.030503882095217705, 0.018513202667236328, -0.04738913103938103, -0.002533914055675268, 0.05248342826962471, 0.07546617835760117, 0.0069028763100504875, -0.011852548457682133, 0.014617887325584888, -0.018141722306609154, -0.00922857690602541, -0.021807651966810226, -0.014775792136788368, -0.003934025764465332, -0.0037836479023098946, 0.05928150191903114, 0.06555747240781784, -0.031765226274728775, 0.01643112674355507, 0.009773964062333107, -0.0006862422451376915, 0.029002031311392784, -0.03945273160934448, -0.033883869647979736, -0.006905816495418549, 0.014957500621676445, 0.011967833153903484, -0.005733608268201351, -0.0019484659424051642, 0.004610827192664146, 0.029431942850351334, -0.03351985663175583, 0.011120643466711044, 0.03857619687914848, -0.04115426167845726, -0.005213281139731407, 0.023917922750115395, 0.014916806481778622, -0.010506564751267433, 0.01520412415266037, -0.00645560584962368, -0.007523835636675358, -0.0033450869377702475, -0.006763326935470104, -0.025982126593589783, -0.00455811619758606, 0.035826731473207474, 0.021463382989168167, 0.026858504861593246, -0.021661531180143356, -0.0032402791548520327, 0.02047065831720829, -0.018273787572979927, 0.012865682132542133, -0.02711210772395134, -0.003605274483561516, 0.010489239357411861, -0.037585895508527756, 0.03877481818199158, 0.000045358108764048666, -0.006541013717651367, 0.002201613737270236, 0.009474354796111584, 0.005277303047478199, -0.0031507413368672132, -0.033100906759500504, 0.049916982650756836, 0.023341333493590355, -0.06147611141204834, -0.023788655176758766, -0.02823506109416485, -0.04100979119539261, -0.006207876373082399, -0.047373898327350616, 0.03330625966191292, 0.056297626346349716, -0.021177072077989578, 0.002068194327875972, 0.01733819581568241, 0.0027492360677570105, 0.031224437057971954, 0.04617723077535629, -0.01669115014374256, 0.01143401674926281, -0.0032401627395302057, 0.007825070060789585, 0.02795501798391342, -0.026471447199583054, -0.0028190654702484608, 0.014797422103583813, -0.04100530594587326, -0.00016484534717164934, 0.0037377625703811646, -0.017157187685370445, -0.01959165371954441, -0.019592896103858948, -0.03326186165213585, -0.00584106519818306, 0.011777768842875957, 0.04031684622168541, 0.047384168952703476, -0.01942397654056549, -0.016500474885106087, 0.005857593379914761, -0.005527706351131201, 0.0283224955201149, 0.04789063706994057, -0.04072966054081917, 0.03219103813171387, -0.014105147682130337, 0.032502446323633194, 0.03530537709593773, 0.02455841936171055, 0.018836768344044685, -0.025304757058620453, 0.06150226294994354, -0.025386711582541466, 0.05173647031188011, 0.04947817698121071, -0.022106830030679703, -0.010534443892538548, -0.03395465388894081, -0.0037390843499451876, -0.02518930844962597, 0.010737502947449684, 0.0053629279136657715, -0.011907199397683144, 0.022512812167406082, 0.0042844670824706554, 0.06304487586021423, 0.05622820928692818, 0.04539165273308754, -0.012771369889378548, 0.030572019517421722, 0.06942654401063919, 0.013680165633559227, 0.017033707350492477, 0.027236757799983025, 0.014025780372321606, 0.010255676694214344, 0.019122550264000893, 0.011455241590738297, 0.019866054877638817, -0.0166657492518425, 0.03304452821612358, -0.018503345549106598, -0.012290927581489086, -0.0395631417632103, 0.0038754669949412346, 0.009747393429279327, -0.039857324212789536, -0.015189360827207565, 0.026333346962928772, -0.0041393497958779335, 0.05056135356426239, -0.0440673865377903, 0.014754588715732098, -0.04403764009475708, -0.01742412894964218, 0.0034113721922039986, 0.013428212143480778, 0.016018927097320557, -0.05640014261007309, -0.004069458227604628, -0.0015153635758906603, -0.015464981086552143, -0.0036633857525885105, -0.022658513858914375, -0.028660258278250694, 0.0017570480704307556, -0.02816120907664299, -0.009195779450237751, 0.022699732333421707, -0.03038351610302925, 0.002026596339419484, 0.028403080999851227, 0.038648590445518494, 0.006371254567056894, 0.03381969779729843, 0.0225661750882864, 0.019108641892671585, -0.029681356623768806, -0.0036020686384290457, 0.023380132392048836, -0.023581361398100853, 0.0014154879609122872, -0.08735053241252899, 0.007802619133144617, -0.0021349615417420864, 0.039743345230817795, -0.00426937872543931, 0.03511524200439453, 0.0009985922370105982, -0.006012762431055307, -0.01749803125858307, 0.014363803900778294, -0.008025149814784527, 0.036250270903110504, -0.009809105657041073, -0.011041015386581421, 0.03889298066496849, 0.020253369584679604, 0.005533102434128523, 0.00713015254586935, 0.008810189552605152, 0.038359176367521286, -0.037651993334293365, -0.03322368487715721, -0.012841332703828812, 0.03942647576332092, -0.004584277514368296, 0.013286011293530464, 0.008644440211355686, 0.0077612632885575294, -0.013236249797046185, -0.02820686623454094, 0.013064807280898094, -0.04774858057498932, -0.03668016567826271, -0.05959121137857437, -0.07402167469263077, -0.030643997713923454, -0.03213141858577728, -0.035859063267707825, 0.030352354049682617, -0.024875497445464134, -0.01032774243503809, -0.013845125213265419, 0.0017296979203820229, -0.0022054857108742, 0.017587412148714066, 0.06480390578508377, 0.05805124342441559, 0.022528426721692085, -0.009139612317085266, -0.033056795597076416, -0.0074376314878463745, 0.011701240204274654, 0.02112702839076519, 0.025701571255922318, -0.0035178102552890778, -0.011872188188135624, -0.010595986619591713, -0.010007352568209171, 0.006733671762049198, -0.052420079708099365, 0.044073089957237244, -0.018878011032938957, -0.018666669726371765, -0.048904381692409515, -0.002755349036306143, 0.0391097366809845, -0.010459626093506813, 0.04110611975193024, -0.04556603729724884, -0.006872599013149738, -0.02605479769408703, 0.011712183244526386, -0.04696805030107498, 0.007891597226262093, -0.030226396396756172, -0.02990994043648243, 0.03847908228635788, -0.001518376637250185, 0.015195045620203018, -0.0653407871723175, -0.017215151339769363, 0.019702862948179245, -0.0041372766718268394, -0.06815458089113235, -0.056786201894283295, 0.00044845190132036805, 0.04625187814235687, -0.020193321630358696, -0.042834214866161346, -0.03251238167285919, -0.04678879305720329, -0.01297396793961525, 0.007696447893977165, -0.03291892260313034, -0.014611358754336834, -0.02892930619418621, -0.022605635225772858, 0.006349301431328058, 0.012363954447209835, 0.009901676326990128, -0.020201783627271652, -0.047834187746047974, 0.009866473264992237 ]
Deploy Hugging Face models easily with Amazon SageMaker
philschmid
July 8, 2021
deploy-hugging-face-models-easily-with-amazon-sagemaker
guide, partnerships, aws
https://huggingface.co/blog/deploy-hugging-face-models-easily-with-amazon-sagemaker
pseudo code start
[ 0.07277239859104156, 0.0023311644326895475, 0.09951623529195786, 0.008076080121099949, 0.13008837401866913, 0.06338078528642654, 0.05074968934059143, 0.014888805337250233, -0.02910595014691353, -0.07216571271419525, -0.02560647577047348, 0.054671384394168854, -0.0338728204369545, 0.011794152669608593, -0.004767655394971371, 0.05429584160447121, 0.06218437850475311, -0.05765056982636452, -0.00943933054804802, -0.015717443078756332, -0.041415534913539886, -0.011522285640239716, 0.04420020058751106, 0.004069524817168713, 0.004579590167850256, -0.013967317529022694, 0.015294737182557583, 0.008039041422307491, -0.041803158819675446, 0.059643205255270004, -0.05505768954753876, 0.010281983762979507, 0.06837552040815353, -0.011247505433857441, -0.013227183371782303, 0.024241678416728973, -0.05788914114236832, -0.02179664932191372, 0.03331196308135986, -0.06321809440851212, -0.0399828739464283, -0.07264946401119232, 0.007446750998497009, 0.024544212967157364, -0.023417439311742783, -0.0037255152128636837, -0.34446948766708374, 0.06116333603858948, -0.04813079535961151, -0.0438777394592762, -0.047486018389463425, 0.024083057418465614, 0.024429913610219955, 0.022101998329162598, 0.014924319460988045, 0.018236873671412468, 0.05289840325713158, -0.06188894808292389, -0.009806261397898197, -0.030977381393313408, 0.08730514347553253, -0.009045662358403206, -0.016402436420321465, 0.030824443325400352, 0.07321172952651978, 0.05801130086183548, -0.0030485421884804964, 0.06554104387760162, -0.04717114567756653, 0.007298875600099564, -0.005173339042812586, -0.011768551543354988, -0.027560800313949585, -0.015332480892539024, 0.08647435903549194, -0.052155137062072754, -0.021709131076931953, 0.053364332765340805, 0.05714866518974304, 0.07316744327545166, -0.017154157161712646, 0.0065177432261407375, 0.06010642647743225, 0.044173117727041245, 0.059596262872219086, -0.021071817725896835, 0.010832946747541428, -0.03241740167140961, -0.02292248234152794, 0.009675523266196251, -0.0227203406393528, -0.07896431535482407, 0.03430258482694626, 0.01815793476998806, -0.03241991251707077, -0.036661986261606216, 0.016619117930531502, 0.029292602092027664, 0.027924055233597755, 0.018186070024967194, -0.01791064813733101, 0.009205762296915054, 0.01785598322749138, -0.01945553533732891, -0.039138853549957275, 0.009476907551288605, -0.015414094552397728, -0.052213191986083984, -0.05079794302582741, 0.0018272920278832316, -0.018704894930124283, 0.0244368277490139, 0.04698417708277702, 0.01036739069968462, -0.08062142133712769, 0.012285063043236732, 0.0005283884820528328, -0.000051125287427566946, -0.00016086512187030166, 0.01903199404478073, -0.0031958746258169413, 0.07028664648532867, 0.08389352262020111, 0.05397884547710419, 0.03637540340423584, 0.019481221213936806, 0.04170960932970047, 0.0851246789097786, -0.07612727582454681, -0.02593802660703659, 0.028283104300498962, 0.011633165180683136, 0.04492519795894623, -0.024594031274318695, -0.04339525103569031, -0.04513252526521683, 0.003571777604520321, 0.01578720472753048, 0.02609410136938095, -0.00968264602124691, -0.0019226070726290345, 0.03878362476825714, 0.019055241718888283, 0.0701853483915329, 0.04372915253043175, -0.022444196045398712, -0.0032731180544942617, 0.01604580320417881, -0.023502415046095848, 0.051321420818567276, -0.023091495037078857, 0.04734470322728157, -0.020519718527793884, -0.05808468535542488, 0.003164935391396284, 0.059831537306308746, 0.02548704855144024, 0.012662224471569061, -0.1255316287279129, -0.010603625327348709, 0.051946867257356644, 0.04017153009772301, -0.03757130727171898, -0.012577159330248833, 0.05027331784367561, -0.004609325900673866, 0.03914935886859894, -0.01630251668393612, -0.01238255761563778, -0.0482482835650444, -0.031800005584955215, -0.005306642968207598, 0.03840066120028496, -0.02350647933781147, -0.05934908613562584, 0.01833818480372429, 0.06426239013671875, 0.015434682369232178, 0.04295552149415016, 0.012563926167786121, -0.02843313105404377, 0.05038667842745781, -0.010616057552397251, 0.024962574243545532, 0.010147718712687492, -0.02454705350100994, 0.04737572744488716, -0.007900964468717575, -0.031563229858875275, 0.04560551792383194, -0.13461333513259888, -0.03463967517018318, 0.10561532527208328, -0.02099519595503807, 0.0254971943795681, -0.08708502352237701, -0.03375346586108208, 0.08983711898326874, 0.04375307634472847, 0.07928723096847534, 0.03330559283494949, 0.04803014174103737, 0.10291140526533127, -0.026054734364151955, -0.04460754990577698, 0.0273964311927557, 0.049012087285518646, 0.00607197405770421, 0.04781285673379898, -0.007690815255045891, -0.003043810138478875, -0.049631811678409576, 0.04011906683444977, -0.07131201028823853, 0.028482668101787567, 0.028055472299456596, -0.017964649945497513, -0.018924089148640633, 0.043235816061496735, -0.04505991190671921, 0.08469050377607346, -0.009845010004937649, -0.03481004759669304, 0.07402097433805466, -0.04024335369467735, 0.07999548316001892, 0.08989724516868591, 0.011977693997323513, 0.06754690408706665, -0.11379653215408325, -0.015335016883909702, -0.002977027790620923, -0.011293746531009674, 0.09958811849355698, 0.02061922661960125, 0.07153014838695526, 0.026952991262078285, -0.04252425953745842, 0.060619670897722244, -0.03983182832598686, 0.013630562461912632, 0.019836125895380974, -0.04707290977239609, 0.0038660287391394377, -0.019147800281643867, -0.0544339194893837, 0.05039835348725319, 0.001585767138749361, -0.017086021602153778, -0.025308476760983467, -0.03323613479733467, 0.04663914442062378, 0.019596688449382782, -0.0417301282286644, 0.06810403615236282, -0.00927791092544794, -0.012956637889146805, -0.03660909831523895, -0.013164842501282692, 0.008567983284592628, 0.008779400028288364, -0.01490169856697321, -0.01813824474811554, -0.05747450515627861, -0.027610627934336662, -0.03255898132920265, 0.006417600437998772, 0.02222430147230625, -0.004736995790153742, 0.04285520315170288, -0.01893051154911518, -0.026595039293169975, 0.03723154217004776, -0.01936754398047924, -0.014890981838107109, -0.01359537709504366, 0.048856448382139206, -0.014158486388623714, -0.011706579476594925, -0.0015197931788861752, -0.04884357750415802, -0.046495698392391205, 0.01179222296923399, 0.007144130766391754, 0.04385777935385704, -0.015347669832408428, 0.01507487427443266, 0.021761881187558174, -0.01852436736226082, 0.029927758499979973, -0.02232174202799797, 0.04025108739733696, -0.01203517708927393, -0.011591415852308273, 0.041667111217975616, -0.015122925862669945, -0.02442714013159275, 0.011859655380249023, -0.024897998198866844, -0.01764802448451519, 0.01483931764960289, 0.006645329296588898, -0.027018388733267784, 0.00757784815505147, -0.06685610860586166, 0.03469960018992424, 0.0045798602513968945, 0.02482270635664463, -0.16776256263256073, -0.04468750208616257, 0.010656856000423431, 0.004689350724220276, 0.007454083301126957, -0.015765931457281113, 0.04903220757842064, -0.04332089051604271, -0.05063815042376518, -0.013963903300464153, 0.024984437972307205, -0.0031195380724966526, -0.011724554002285004, -0.005137092899531126, -0.006045197136700153, -0.012634753249585629, -0.019840097054839134, 0.023724280297756195, 0.025614887475967407, -0.018368862569332123, -0.00921664759516716, 0.0664135068655014, -0.004259547684341669, -0.0006079946761019528, -0.00419963663443923, 0.033616989850997925, 0.022321315482258797, 0.04719115421175957, 0.01976100355386734, -0.024044625461101532, -0.03998121991753578, 0.04457981884479523, -0.02518313378095627, 0.021055135875940323, -0.0019805990159511566, 0.0026751384139060974, 0.023756522685289383, -0.013994665816426277, -0.0000955961731960997, 0.03450290486216545, 0.015253507532179356, 0.0028051191475242376, 0.028561852872371674, 0.02803603559732437, -0.01887672021985054, -0.005377231631428003, 0.027487069368362427, -0.03818025812506676, 0.053199008107185364, -0.04359182342886925, -0.04400278627872467, 0.010825923644006252, 0.0025455087888985872, 0.03389396145939827, -0.004465910140424967, -0.00693571986630559, -0.03893738612532616, 0.03899083659052849, 0.06280671805143356, -0.04692855477333069, -0.015571881085634232, 0.0024507050402462482, 0.019430989399552345, -0.021090321242809296, -0.030334774404764175, 0.02155170403420925, -0.0186249241232872, 0.044423602521419525, -0.01675521582365036, 0.06073649972677231, 0.013639932498335838, -0.01318900752812624, -0.0015829463955014944, 0.02073703706264496, -0.0022284456063061953, 0.021750032901763916, -0.010423937812447548, -0.041542042046785355, 0.06498950719833374, -0.009255477227270603, 0.016521774232387543, -0.012367013841867447, -0.012786218896508217, -0.014908687211573124, 0.0056404671631753445, 0.021367618814110756, 0.013212394900619984, -0.005643346346914768, 0.0016902086790651083, 0.023615244776010513, 0.028740225359797478, -0.00143454282078892, -0.003108325647190213, -0.0038977398071438074, -0.003952288534492254, 0.022248458117246628, 0.05996944382786751, -0.009354842826724052, 0.007474337238818407, -0.010570019483566284, 0.015707150101661682, -0.0019053352298215032, -0.019481997936964035, 0.009728624485433102, 0.007633738219738007, 0.03211750090122223, -0.03281298279762268, -0.04016483947634697, -0.028533169999718666, 0.02992803044617176, 0.013737695291638374, -0.03656119480729103, 0.014724094420671463, -0.03057621791958809, -0.008870183490216732, 0.016648391261696815, -0.012869697995483875, -0.05165950208902359, -0.026249097660183907, 0.006201843731105328, -0.02622215636074543, 0.010995299555361271, 0.00828544981777668, -0.03352630138397217, 0.0001062843221006915, -0.030390791594982147, 0.030685964971780777, -0.0006603336078114808, 0.009064886718988419, 0.00577480997890234, -0.03178751468658447, -0.05165255814790726, 0.02069791778922081, -0.013501639477908611, 0.029152916744351387, -0.0015000849962234497, -0.011374405585229397, 0.02602245658636093, 0.011605688370764256, -0.06921401619911194, 0.015295038931071758, -0.01055556908249855, 0.002093878109008074, -0.035485994070768356, 0.03242425620555878, 0.0022847396321594715, 0.00023700488964095712, -0.02736184373497963, 0.00541549501940608, 0.009262976236641407, 0.0063542453572154045, -0.05174923688173294, -0.0163765586912632, 0.0006464707548730075, -0.00880415365099907, -0.006998905912041664, 0.020896516740322113, -0.029173340648412704, -0.014983654953539371, 0.055229753255844116, -0.009235138073563576, -0.02456498332321644, -0.025461584329605103, 0.03093140758574009, -0.03763771802186966, -0.02684260532259941, -0.01230405643582344, -0.006380205973982811, 0.0012606316013261676, 0.004740038421005011, -0.026508212089538574, -0.0061853257939219475, 0.04366273805499077, -0.01733884960412979, 0.03032895177602768, 0.0015914372634142637, 0.013089025393128395, 0.027017641812562943, 0.006689681671559811, 0.020052626729011536, -0.0021374111529439688, -0.01328516285866499, 0.01922830007970333, 0.016149017959833145, -0.020776476711034775, -0.017182260751724243, 0.03971251845359802, 0.002878922736272216, -0.0019519090419635177, 0.054898373782634735, -0.034628257155418396, -0.02040960267186165, 0.005674765445291996, -0.005484363529831171, 0.010936054401099682, -0.022782525047659874, -0.006012987345457077, -0.005064898170530796, -0.023513715714216232, -0.0323982872068882, 0.01869875378906727, 0.039773207157850266, -0.0026710517704486847, -0.006591184064745903, 0.012880392372608185, 0.003048893064260483, 0.004816650878638029, -0.034252531826496124, 0.006951006129384041, -0.020308149978518486, 0.004376986529678106, -0.003117508254945278, -0.02513028308749199, -0.03068528324365616, -0.02000538632273674, -0.016246991232037544, -0.018832450732588768, 0.03299501910805702, 0.018703656271100044, 0.01760582998394966, 0.020662052556872368, -0.0011085113510489464, -0.003559466917067766, 0.051593098789453506, 0.06100348010659218, 0.004160391632467508, 0.005930962506681681, 0.009416526183485985, -0.01083485595881939, 0.04252515733242035, 0.0392279177904129, -0.0004888171679340303, -0.007436045445501804, 0.011130472645163536, 0.020983409136533737, -0.005225958302617073, -0.06486297398805618, 0.023052064701914787, 0.00309929926879704, 0.0015832501230761409, -0.030188631266355515, -0.005699066910892725, 0.0030146935023367405, -0.02958538942039013, -0.023349039256572723, 0.03005114570260048, 0.04328908398747444, -0.014810374937951565, 0.022903311997652054, 0.006911867298185825, 0.014742722734808922, -0.019724441692233086, 0.014290682971477509, -0.030386457219719887, 0.01663457602262497, 0.022433621808886528, -0.01710980013012886, -0.018996113911271095, 0.0034256866201758385, 0.016087209805846214, 0.0054985517635941505, 0.01322368998080492, 0.0377718023955822, 0.022338425740599632, -0.023028800264000893, 0.03507600352168083, -0.009266317822039127, 0.0043807062320411205, -0.002651902614161372, 0.019193924963474274, -0.0060047367587685585, 0.0050855414010584354, 0.04039916396141052, -0.011586256325244904, 0.03053702972829342, -0.03498822823166847, 0.014675898477435112, 0.05368374288082123, -0.000027854719519382343, -0.0002011029573623091, 0.023157859221100807, 0.00733397901058197, -0.0028423634357750416, 0.0016868060920387506, -0.04373965784907341, 0.019425399601459503, 0.03978829085826874, 0.008677422069013119, 0.014704949222505093, 0.016895443201065063, -0.00046305847354233265, 0.00565079040825367, -0.023448357358574867, 0.013863313011825085, -0.04002007469534874, 0.03604103624820709, 0.035272423177957535, -0.03726594150066376, 0.025026200339198112, -0.022921767085790634, 0.05498078465461731, 0.024748515337705612, -0.0036294623278081417, 0.0011374213499948382, -0.014328999444842339, 0.018372677266597748, 0.013391945511102676, -0.015491105616092682, -0.0011806925758719444, -0.028524233028292656, -0.008416158147156239, 0.049676354974508286, -0.04558400437235832, -0.009561491198837757, 0.009710174985229969, -0.053516827523708344, 0.031004222109913826, -0.01585041731595993, -0.034307390451431274, -0.007878828793764114, 0.03193669393658638, -0.03369682654738426, -0.01637842319905758, -0.01215428113937378, -0.05440052971243858, -0.07076140493154526, 0.03359152004122734, 0.006124095991253853, -0.007694329135119915, -0.013267653994262218, 0.01610330305993557, -0.009281965903937817, -0.01667918637394905, -0.002244204981252551, -0.018924258649349213, 0.04279102012515068, 0.015943165868520737, 0.02397129498422146, -0.021476656198501587, -0.032134220004081726, -0.03344878926873207, 0.0045103454031050205, 0.005483119748532772, -0.0027899853885173798, 0.003138825995847583, -0.0078001306392252445, 0.009913666173815727, -0.0008844661642797291, -0.026540599763393402, 0.049121756106615067, 0.028073839843273163, 0.02648370899260044, -0.025825468823313713, 0.03522643819451332, -0.04790530353784561, -0.026223083958029747, -0.02215762622654438, -0.008374419994652271, 0.021154798567295074, 0.0062016029842197895, 0.0008192822569981217, 0.00248746108263731, 0.023942969739437103, -0.0344867929816246, -0.036027420312166214, 0.006001470610499382, -0.021270154044032097, 0.0006848002667538822, 0.032686855643987656, 0.0073603359051048756, -0.0016296145040541887, -0.02747068740427494, 0.015025459229946136, 0.009343292564153671, -0.041520558297634125, -0.0018140277825295925, -0.02453361451625824, -0.0023354236036539078, -0.03372279927134514, 0.00045146889169700444, 0.07057460397481918, 0.01588408090174198, 0.005427996627986431, 0.021900895982980728, 0.006720520555973053, 0.021362053230404854, -0.014824841171503067, -0.007088361773639917, 0.008264714851975441, 0.04377267137169838, -0.02416319027543068, -0.035223834216594696, -0.01941647008061409, -0.041265569627285004, 0.010051739402115345, 0.00024144182680174708, -0.06529903411865234, -0.021554214879870415, 0.0009562083869241178, 0.00007063242810545489, -0.05480597913265228, 0.022852040827274323, 0.033948082476854324, -0.004650770220905542, 0.052643172442913055, 0.00751438969746232, 0.0018894242821261287, 0.018553918227553368, -0.009314797818660736, 0.00851438194513321, 0.017463592812418938, 0.04364250600337982, 0.012220131233334541, -0.03952186182141304, 0.037085507065057755, -0.055052194744348526, -0.02898457832634449, -0.001128121861256659, 0.03238506615161896, -0.015317020937800407, -0.04485967382788658, 0.01542955543845892, -0.010687794536352158, 0.02108876034617424, 0.003105470212176442, 0.01163373701274395, -0.014603212475776672, 0.0014319317415356636, 0.004855307284742594, -0.043705668300390244, -0.008802025578916073, -0.004232299514114857, 0.016323143616318703, 0.025075435638427734, 0.021581532433629036, 0.0008670432725921273, -0.008109121583402157, -0.05184949189424515, 0.009585492312908173, 0.012802274897694588, -0.010295304469764233, -0.010031092911958694, -0.005553748924285173, -0.021042274311184883, -0.02635624073445797, -0.0439482182264328, 0.0497150719165802, 0.017607223242521286, -0.0059302011504769325, -0.021020561456680298, -0.0026818332262337208, 0.019850337877869606, 0.040905505418777466, 0.05234271287918091, -0.00449393829330802, 0.06975928694009781, 0.020990734919905663, -0.023706652224063873, -0.014095493592321873, 0.028206394985318184 ]
Deploy Hugging Face models easily with Amazon SageMaker
philschmid
July 8, 2021
deploy-hugging-face-models-easily-with-amazon-sagemaker
guide, partnerships, aws
https://huggingface.co/blog/deploy-hugging-face-models-easily-with-amazon-sagemaker
# Deploy Hugging Face models easily with Amazon SageMaker 🏎 Earlier this year we announced a strategic collaboration with Amazon to make it easier for companies to use Hugging Face in Amazon SageMaker, and ship cutting-edge Machine Learning features faster. We introduced new Hugging Face Deep Learning Containers (DLCs) to train Hugging Face Transformer models in Amazon SageMaker. Today, we are excited to share a new inference solution with you that makes it easier than ever to deploy Hugging Face Transformers with Amazon SageMaker! With the new Hugging Face Inference DLCs, you can deploy your trained models for inference with just one more line of code, or select any of the 10,000+ publicly available models from the Model Hub, and deploy them with Amazon SageMaker. Deploying models in SageMaker provides you with production-ready endpoints that scale easily within your AWS environment, with built-in monitoring and a ton of enterprise features. It's been an amazing collaboration and we hope you will take advantage of it! Here's how to use the new SageMaker Hugging Face Inference Toolkit to deploy Transformers-based models: python from sagemaker.huggingface import HuggingFaceModel # create Hugging Face Model Class and deploy it as SageMaker Endpoint huggingface_model = HuggingFaceModel(...).deploy() That's it! 🚀 To learn more about accessing and using the new Hugging Face DLCs with the Amazon SageMaker Python SDK, check out the guides and resources below. --- # Resources, Documentation & Samples 📄 Below you can find all the important resources for deploying your models to Amazon SageMaker.
[ -0.007254680618643761, -0.0016423633787781, 0.010160398669540882, 0.029872223734855652, 0.011946730315685272, 0.08232405036687851, 0.014891543425619602, 0.014337452128529549, -0.027271999046206474, 0.004227780271321535, -0.06594443321228027, 0.053759146481752396, 0.00145902787335217, 0.12298692762851715, 0.020855724811553955, -0.0834684669971466, -0.009462629444897175, 0.02460061013698578, -0.02688664011657238, 0.03946792334318161, 0.0031613879837095737, -0.06691046059131622, -0.014516007155179977, 0.0127499895170331, -0.0369303859770298, -0.033797454088926315, 0.056356191635131836, -0.018308939412236214, 0.024369778111577034, 0.05208177864551544, -0.05642721429467201, -0.025455165654420853, 0.02154061198234558, -0.042842406779527664, 0.02243306301534176, 0.04673444479703903, -0.1929054707288742, 0.02385149523615837, 0.023551933467388153, 0.0024073407985270023, -0.0003492234100122005, -0.018097974359989166, -0.07208429276943207, 0.02071554958820343, 0.013650257140398026, -0.060839373618364334, -0.13202941417694092, 0.05427022650837898, 0.03206493705511093, -0.00820453092455864, -0.07524947077035904, 0.1133139580488205, -0.0005080107366666198, -0.04203939065337181, 0.018543418496847153, 0.021965645253658295, -0.019881391897797585, -0.07770434767007828, -0.02245078980922699, -0.021733682602643967, -0.024623600766062737, -0.024251587688922882, -0.006901707500219345, 0.009109570644795895, 0.01479578297585249, 0.04106656089425087, 0.006882644258439541, -0.01840275526046753, -0.03711525350809097, -0.0015625589294359088, 0.022990792989730835, -0.08485729247331619, -0.024436242878437042, -0.0311135184019804, -0.008860272355377674, -0.05132737755775452, -0.01132192462682724, -0.010771999135613441, 0.053443677723407745, 0.054641664028167725, -0.049840569496154785, -0.00037564229569397867, 0.014387678354978561, 0.02201269008219242, 0.03657638654112816, 0.03862292319536209, 0.007920919917523861, -0.056611523032188416, -0.059569668024778366, 0.08997783809900284, 0.01756121963262558, -0.08611537516117096, -0.03643598034977913, 0.0124675203114748, 0.061351414769887924, -0.0007555144256912172, 0.010178299620747566, -0.02237584814429283, 0.002123813610523939, -0.05611169710755348, 0.023423034697771072, -0.07764340937137604, 0.018968457356095314, -0.052825361490249634, -0.01090486440807581, 0.028857596218585968, 0.01186874695122242, -0.10017050802707672, 0.015842387452721596, 0.03956722095608711, 0.031069999560713768, -0.056151844561100006, -0.007514886558055878, 0.07560784369707108, -0.1101604476571083, 0.08788992464542389, 0.003004997270181775, -0.029821226373314857, 0.030906610190868378, 0.018644988536834717, 0.04761141166090965, 0.09736340492963791, 0.05971767008304596, -0.00004179896495770663, -0.0028032667469233274, 0.06196029111742973, 0.007733569946140051, -0.024367179721593857, 0.008318614214658737, -0.03445221483707428, 0.019615808501839638, -0.06740156561136246, 0.037894804030656815, -0.021574920043349266, 0.04511520639061928, -0.08772696554660797, 0.003712648991495371, -0.07664753496646881, 0.030928930267691612, 0.01967553421854973, -0.00988047756254673, 0.11086651682853699, 0.04679321125149727, 0.037140484899282455, 0.08406690508127213, 0.02118879370391369, -0.05446181818842888, 0.007357357069849968, 0.014270367100834846, 0.06449580937623978, -0.09980747848749161, 0.04553888365626335, -0.015179423615336418, -0.09718769043684006, -0.014050270430743694, 0.053739506751298904, -0.027554620057344437, 0.004251115955412388, -0.05892198160290718, -0.07915394008159637, -0.0323086716234684, -0.0475672148168087, -0.038925811648368835, -0.027208739891648293, 0.025310952216386795, 0.01654030568897724, 0.053095363080501556, -0.013027003966271877, 0.07294073700904846, -0.013604298233985901, 0.0012763055274263024, -0.0448465570807457, 0.039158597588539124, 0.010708755813539028, 0.0649731233716011, 0.038940053433179855, 0.0504244789481163, 0.10960479080677032, -0.004040166735649109, -0.0007423060014843941, -0.058293379843235016, 0.08417238295078278, -0.03980979323387146, -0.020673776045441628, 0.05909021571278572, -0.043656352907419205, 0.029011867940425873, 0.008135722950100899, 0.03022051975131035, 0.010630595497786999, -0.0019052327843382955, -0.0023030689917504787, 0.022707292810082436, 0.01705332100391388, 0.03813686594367027, -0.00358586385846138, -0.03875607252120972, 0.12866371870040894, -0.0004308212373871356, 0.05252828821539879, 0.03497263789176941, 0.0024936040863394737, -0.028005843982100487, 0.031071558594703674, -0.02845499850809574, 0.0473695769906044, -0.04171682894229889, -0.014689238741993904, 0.023816024884581566, 0.01351764053106308, 0.0356132797896862, -0.1272868663072586, 0.034365784376859665, -0.062321435660123825, -0.00463921669870615, -0.024800177663564682, -0.061846740543842316, -0.00869959406554699, 0.0029213964007794857, 0.020247118547558784, 0.154961958527565, 0.00208509573712945, 0.005239949561655521, -0.0584200844168663, -0.017807334661483765, -0.0002599768340587616, 0.07149570435285568, 0.07345984876155853, 0.10489944368600845, -0.06697280704975128, -0.03819543123245239, -0.0703323632478714, -0.021527985110878944, -0.0027989684604108334, 0.009787745773792267, -0.016386816278100014, 0.045103684067726135, -0.03924792632460594, -0.016246262937784195, -0.015074427239596844, 0.07468052953481674, -0.01584908552467823, 0.011306916363537312, 0.0056986757554113865, 0.03713412582874298, -0.0261510219424963, 0.06672999262809753, -0.010690176859498024, -0.007389879785478115, -0.0021920176222920418, -0.08992008119821548, 0.04147197678685188, 0.019898217171430588, -0.010498336516320705, 0.03681744262576103, 0.004801682662218809, -0.01369341928511858, 0.02826729230582714, -0.0010614435886964202, 0.060398634523153305, 0.010643187910318375, 0.009106520563364029, -0.0077856965363025665, -0.023861855268478394, -0.022433560341596603, -0.04671626165509224, -0.05115751177072525, -0.0036897645331919193, -0.00761696370318532, -0.017591167241334915, 0.036697134375572205, -0.04746387526392937, 0.007196906954050064, 0.004711609799414873, -0.0003987837699241936, 0.02352139912545681, 0.05082585662603378, 0.0054125054739415646, -0.0019632058683782816, -0.019619673490524292, 0.02153250016272068, -0.03283974155783653, -0.016935935243964195, 0.01951202191412449, 0.014761216007173061, -0.007184575777500868, 0.0019274784717708826, -0.034559622406959534, -0.03806279972195625, 0.01084641832858324, 0.040837518870830536, 0.03787801414728165, 0.02592831663787365, 0.0022289720363914967, -0.0007871593115851283, 0.02167443558573723, 0.002956442767754197, -0.024434683844447136, -0.006524675525724888, 0.06532681733369827, 0.0069301133044064045, -0.017556190490722656, -0.006798963528126478, 0.003349656704813242, -0.037044115364551544, 0.0056032282300293446, 0.041015736758708954, -0.004870967008173466, -0.09110119193792343, -0.052985381335020065, -0.049107782542705536, 0.0006890505901537836, 0.010179868899285793, -0.013238714076578617, 0.05463952198624611, -0.020450163632631302, -0.002645388711243868, 0.04333357512950897, 0.006858090870082378, 0.026428572833538055, 0.012709517031908035, -0.018762685358524323, -0.019907493144273758, 0.011643944308161736, -0.004761160351336002, -0.019018629565835, 0.027330754324793816, 0.04420105740427971, -0.05695059895515442, 0.046670302748680115, 0.019576506689190865, -0.02437588945031166, 0.030076054856181145, -0.014122771099209785, 0.053822796791791916, -0.007946022786200047, 0.025702668353915215, -0.022038200870156288, -0.010062597692012787, -0.02064446546137333, -0.031946875154972076, -0.02008289471268654, -0.05994214862585068, 0.008770105428993702, 0.0025101546198129654, 0.03783303126692772, 0.05317288264632225, 0.009214784018695354, -0.016203172504901886, 0.011158814653754234, 0.009922252967953682, -0.00436662370339036, 0.05291833356022835, -0.004421630874276161, -0.026336008682847023, 0.014326168224215508, 0.03198889642953873, -0.03305988758802414, -0.014734972268342972, 0.024352554231882095, 0.026775715872645378, 0.025121964514255524, 0.012526415288448334, 0.010855155065655708, 0.007398315705358982, 0.022005392238497734, 0.024278433993458748, -0.005041392520070076, -0.06117892265319824, 0.037035901099443436, -0.001393806072883308, -0.00921216793358326, -0.004767072387039661, 0.037164270877838135, 0.013861555606126785, -0.016630016267299652, 0.041018903255462646, 0.025416960939764977, 0.0004352162650320679, 0.0492093488574028, -0.03691493719816208, 0.009386317804455757, -0.03790576010942459, -0.0021806315053254366, -0.004337935708463192, -0.021681148558855057, 0.03612096607685089, 0.022320332005620003, 0.0009549942915327847, -0.01921224780380726, 0.006373525131493807, -0.00961773656308651, 0.021134912967681885, -0.0021366223227232695, 0.00834336131811142, -0.05166391655802727, 0.042207881808280945, 0.058468081057071686, -0.009561961516737938, -0.05485072731971741, 0.0020091987680643797, -0.029358740895986557, 0.0013024626532569528, -0.027946334332227707, 0.029496602714061737, 0.006241132505238056, 0.00047784572234377265, -0.02187284082174301, -0.01502991933375597, -0.03346629440784454, 0.009060343727469444, -0.019033126533031464, -0.029962552711367607, 0.01518747117370367, -0.003315132111310959, -0.01485973410308361, -0.00819975696504116, -0.03495679795742035, 0.05485902726650238, 0.01709558628499508, -0.0072906967252492905, -0.010048954747617245, 0.02719038352370262, 0.05439363420009613, 0.007912424392998219, -0.016974249854683876, 0.002910446375608444, 0.045357100665569305, -0.03398701176047325, 0.03692037984728813, -0.02074238657951355, -0.02844611182808876, 0.0035890243016183376, 0.02107849158346653, 0.021216221153736115, 0.03536418825387955, -0.0169220007956028, -0.01738724671304226, -0.02289675548672676, 0.016578562557697296, 0.03407418355345726, -0.015844272449612617, 0.023468036204576492, 0.007872767746448517, -0.03566962480545044, 0.04405232146382332, 0.0060215541161596775, 0.027109317481517792, -0.01592063531279564, -0.0031590480357408524, 0.0459439791738987, -0.012970110401511192, 0.029246211051940918, -0.010235315188765526, -0.06396764516830444, -0.01964838244020939, -0.04881354421377182, 0.045278701931238174, 0.0019529953133314848, -0.006628899369388819, -0.029759077355265617, 0.035428404808044434, 0.02452416904270649, -0.01633676141500473, -0.0013564776163548231, 0.017229145392775536, 0.04381350427865982, 0.05482900142669678, 0.0010361149907112122, 0.01683625765144825, 0.00046206367551349103, 0.00560029735788703, 0.036884430795907974, 0.03400345519185066, -0.04515240341424942, -0.05697621777653694, -0.0032802289351820946, 0.021839689463377, -0.029640981927514076, 0.00005282695929054171, 0.024871977046132088, -0.043073952198028564, -0.007150092627853155, 0.05960924178361893, 0.045771267265081406, 0.009980244562029839, -0.00864249374717474, 0.0064940061420202255, -0.025188304483890533, -0.015486467629671097, -0.03588593006134033, -0.012545892037451267, -0.023769797757267952, 0.009830983355641365, 0.0579463467001915, 0.06162134185433388, -0.014477318152785301, -0.0009844707092270255, -0.01568363606929779, -0.021792257204651833, 0.02074725367128849, -0.039247993379831314, -0.00046860144357196987, -0.009459204971790314, 0.019197504967451096, 0.001479177619330585, -0.0029031159356236458, -0.003847595304250717, 0.004483458586037159, 0.043319299817085266, -0.029109004884958267, -0.001352839288301766, 0.03393879905343056, -0.021679924800992012, -0.0026496259961277246, -0.022601453587412834, 0.013591482304036617, -0.013665533624589443, 0.03855164721608162, 0.006980269216001034, 0.0008449961896985769, 0.0025868688244372606, -0.020012805238366127, -0.034001611173152924, -0.014850894920527935, 0.02834262140095234, 0.02716412954032421, 0.023775344714522362, -0.029052505269646645, -0.014870562590658665, 0.013330700807273388, -0.017368802800774574, 0.020405076444149017, -0.018395712599158287, -0.002352125011384487, 0.023790812119841576, -0.02826925925910473, 0.021073829382658005, -0.006165982224047184, 0.006271605845540762, -0.0010309958597645164, 0.027155566960573196, 0.013501763343811035, -0.011245646513998508, -0.032398585230112076, 0.04962126910686493, 0.028047719970345497, -0.023403611034154892, -0.011716360226273537, -0.01650516502559185, -0.01990201510488987, 0.00046176707837730646, -0.04646565020084381, 0.03580484539270401, 0.04196604713797569, -0.032093483954668045, -0.00616055354475975, -0.002073851181194186, 0.004370898474007845, 0.03576882928609848, 0.0427137091755867, -0.011947304010391235, 0.04073207825422287, 0.014686943031847477, 0.008653886616230011, 0.0301309023052454, -0.010979782789945602, -0.015493465587496758, 0.006942267529666424, -0.04895522817969322, 0.04310490936040878, 0.00525605957955122, -0.038757674396038055, 0.007399865426123142, -0.01525798812508583, -0.04903891682624817, 0.007535806857049465, 0.03420364484190941, 0.021311921998858452, 0.0413336418569088, -0.0010720513528212905, -0.0034045956563204527, 0.020008478313684464, -0.006490551400929689, 0.028644591569900513, 0.06375449150800705, -0.04711482673883438, 0.005048863124102354, -0.016811106353998184, 0.036611199378967285, 0.014415591955184937, 0.005789272952824831, 0.023062456399202347, -0.008846978656947613, 0.06279707700014114, -0.022098483517766, 0.05032102391123772, 0.03061714395880699, -0.007329857442528009, -0.013639760203659534, -0.02020871452987194, 0.004315064288675785, -0.014803480356931686, -0.005531378090381622, 0.01341231819242239, -0.032070092856884, 0.03463524207472801, 0.011393468827009201, 0.06196632236242294, 0.03947865962982178, 0.04640913009643555, 0.002910738345235586, 0.02739189937710762, 0.06534010171890259, 0.021810943260788918, 0.018783317878842354, 0.02044011652469635, 0.01346531230956316, 0.007124434225261211, 0.026063023135066032, 0.01961335726082325, 0.03840404748916626, -0.025387031957507133, 0.018742352724075317, -0.03372274711728096, -0.015409018844366074, -0.024269282817840576, 0.00006402374856406823, 0.007410179357975721, -0.05137019231915474, -0.011249366216361523, 0.0022232073824852705, -0.029329786077141762, 0.0310834813863039, -0.024822309613227844, 0.03184563294053078, -0.029891055077314377, -0.0004127081483602524, 0.014965001493692398, 0.016569802537560463, 0.01523433718830347, -0.06920881569385529, 0.0016529650893062353, -0.0023140432313084602, 0.010365347377955914, -0.017797840759158134, -0.02669813297688961, -0.019243624061346054, 0.00102211011108011, -0.017983708530664444, -0.005610607098788023, 0.010186430998146534, -0.03703709691762924, -0.009950969368219376, 0.010208776220679283, 0.03839758038520813, 0.013521935790777206, 0.03669194504618645, 0.02176302671432495, 0.017025988548994064, -0.03219969943165779, 0.0019069913541898131, 0.013989054597914219, 0.003209097310900688, -0.0024311551824212074, -0.06707178056240082, 0.009320151060819626, -0.015561357140541077, 0.03125860542058945, -0.002728487132117152, 0.03164595365524292, 0.007837304845452309, -0.016994575038552284, -0.002837494481354952, 0.0037388114724308252, -0.0036316837649792433, 0.030820902436971664, -0.006378617603331804, -0.020711954683065414, 0.020583845674991608, 0.005245605017989874, -0.011506972834467888, 0.012508001178503036, 0.03200243040919304, 0.050852641463279724, -0.031033994629979134, -0.015096410177648067, 0.005796836223453283, 0.03852646052837372, 0.015583215281367302, 0.017452074214816093, 0.0005277491873130202, 0.019849248230457306, -0.00246640807017684, -0.04020171985030174, -0.017369495704770088, -0.03750039264559746, -0.029113471508026123, -0.05410179868340492, -0.0563744455575943, -0.040720127522945404, -0.02054496854543686, -0.01344160083681345, 0.019120406359434128, -0.030964136123657227, 0.00374057749286294, -0.018816765397787094, -0.00582956662401557, -0.013867136090993881, 0.011627289466559887, 0.06506823748350143, 0.04526420310139656, 0.024761758744716644, -0.02723800018429756, -0.04134056344628334, 0.006480986252427101, 0.0020730355754494667, 0.03700799494981766, 0.040476251393556595, -0.02856987528502941, 0.010467393323779106, -0.03782019391655922, -0.04477696865797043, 0.0017279231688007712, -0.056502815335989, 0.026995908468961716, 0.009679362177848816, -0.027180181816220284, -0.0461367592215538, 0.0006396563840098679, 0.037056710571050644, -0.004414332564920187, 0.031976133584976196, -0.0459953248500824, -0.01706751622259617, -0.026510868221521378, 0.005501641426235437, -0.04483965411782265, 0.00019788488862104714, -0.0304307471960783, -0.033279892057180405, 0.02670084685087204, 0.004947141744196415, 0.019300049170851707, -0.047415684908628464, 0.005893551278859377, -0.014308808371424675, -0.024140140041708946, -0.05902600288391113, -0.06936800479888916, -0.010262582451105118, 0.05421599745750427, -0.039663489907979965, -0.03349709138274193, -0.03643140569329262, -0.027073590084910393, -0.00375945633277297, 0.01456507295370102, -0.0034823401365429163, -0.020698213949799538, -0.0414118729531765, 0.011248449794948101, 0.019887026399374008, 0.035643283277750015, 0.022644823417067528, -0.02167971059679985, -0.037157945334911346, 0.002146880840882659 ]
Deploy Hugging Face models easily with Amazon SageMaker
philschmid
July 8, 2021
deploy-hugging-face-models-easily-with-amazon-sagemaker
guide, partnerships, aws
https://huggingface.co/blog/deploy-hugging-face-models-easily-with-amazon-sagemaker
# create HuggingFace estimator for running training huggingface_estimator = HuggingFace(....) # starting the train job with our uploaded datasets as input huggingface_estimator.fit(...)
[ 0.011976116336882114, -0.02191793918609619, 0.029753893613815308, 0.011033858172595501, 0.06784472614526749, 0.0686156302690506, 0.028407694771885872, 0.0035554475616663694, -0.07787682861089706, -0.0650651752948761, -0.08362311124801636, 0.06969942897558212, -0.017485888674855232, 0.070003442466259, 0.002936519915238023, -0.06992979347705841, 0.040394801646471024, -0.052966270595788956, 0.0237381923943758, 0.016381246969103813, -0.02764107659459114, -0.050389379262924194, 0.03986809030175209, -0.027178440243005753, -0.011503280140459538, -0.09239092469215393, 0.014158634468913078, 0.020642023533582687, -0.0005213838303461671, 0.028658892959356308, -0.11506951600313187, 0.022232118993997574, 0.025821559131145477, -0.038622334599494934, 0.011285967193543911, 0.07363758236169815, -0.13504567742347717, 0.029760312288999557, 0.047803327441215515, -0.026446102187037468, -0.03522375598549843, 0.024465234950184822, -0.07473857700824738, 0.04167232662439346, -0.008825029246509075, -0.09779175370931625, -0.24001909792423248, 0.05245210975408554, 0.0026209617499262094, -0.014005415141582489, -0.01893812231719494, 0.10444790124893188, 0.0002937865792773664, 0.015175293199717999, -0.005081459414213896, -0.00976607110351324, 0.017233682796359062, -0.07823649048805237, -0.01029319316148758, -0.010656904429197311, 0.05648883432149887, 0.00875610951334238, -0.00304487650282681, 0.07457266747951508, 0.016744013875722885, 0.06264965236186981, 0.001575702684931457, -0.01809227094054222, -0.07832023501396179, -0.05291774868965149, 0.015764983370900154, -0.04510965943336487, 0.005466873291879892, -0.036389488726854324, -0.017967453226447105, -0.033487968146800995, 0.0327625535428524, -0.0057686264626681805, 0.07340255379676819, 0.06673058867454529, 0.005432857666164637, -0.029398471117019653, 0.049738653004169464, 0.07857746630907059, 0.059839073568582535, 0.06600149720907211, 0.016714388504624367, -0.023204537108540535, -0.034268952906131744, 0.07105978578329086, 0.0048503815196454525, -0.10204232484102249, -0.02639450505375862, 0.02149195596575737, 0.050328198820352554, -0.054847970604896545, -0.005546174012124538, 0.039059270173311234, 0.02436031587421894, 0.0013973305467516184, -0.0348791778087616, -0.04908009245991707, -0.004052865784615278, -0.026688342913985252, -0.03243762254714966, 0.025410419330000877, 0.017474325373768806, -0.09632004797458649, -0.046681713312864304, -0.0038064306136220694, 0.019990328699350357, -0.021387210115790367, 0.003596619935706258, 0.07034586369991302, -0.07642754167318344, 0.029949886724352837, -0.006928688380867243, -0.022695226594805717, 0.00873594917356968, 0.01985691487789154, 0.0008709975518286228, 0.10174168646335602, 0.013502676039934158, 0.01702190935611725, -0.050561822950839996, 0.04253789409995079, 0.01323099434375763, -0.016251493245363235, 0.023596420884132385, -0.014978478662669659, 0.0004378053417894989, -0.01732652820646763, 0.051808230578899384, -0.0015181135386228561, 0.0046247378922998905, -0.07757227122783661, -0.018113650381565094, -0.0362711176276207, 0.022486243396997452, 0.024158375337719917, -0.023951010778546333, 0.08148538321256638, -0.006658910773694515, 0.04971702769398689, 0.037366073578596115, 0.007498112972825766, -0.04704107716679573, 0.03818748518824577, 0.03290461376309395, 0.03618714585900307, -0.09278904646635056, 0.0800279751420021, -0.028744816780090332, -0.030633632093667984, 0.0035276564303785563, 0.04403853416442871, -0.03642784804105759, -0.023371517658233643, -0.033074118196964264, 0.008642442524433136, 0.010978701524436474, 0.039009299129247665, -0.06308892369270325, -0.023320524021983147, 0.032536789774894714, -0.016987966373562813, 0.008416770026087761, 0.008086717687547207, 0.045983217656612396, -0.0644807368516922, -0.007285700179636478, -0.0368693470954895, 0.022799311205744743, -0.007298532873392105, 0.030783558264374733, 0.04309430345892906, 0.024330154061317444, 0.050854697823524475, -0.03154542297124863, 0.012616354040801525, -0.03155772387981415, 0.07468104362487793, -0.015017501078546047, 0.05296725034713745, 0.06259626895189285, -0.08729325979948044, -0.022867761552333832, -0.011211449280381203, 0.009751783683896065, 0.01936817541718483, -0.039007578045129776, -0.045775070786476135, 0.07260812073945999, -0.043888580054044724, 0.059158507734537125, -0.0720965787768364, -0.023154443129897118, 0.13202235102653503, 0.022780530154705048, 0.05810384824872017, 0.0450710654258728, -0.010452810674905777, 0.04261588305234909, -0.012040429748594761, -0.004511868115514517, 0.034860990941524506, 0.01738998107612133, -0.06053974851965904, 0.038743775337934494, -0.01863989606499672, -0.02666306495666504, -0.07452905923128128, 0.03826209157705307, -0.05518544092774391, -0.012697342783212662, -0.01441189181059599, -0.007134775631129742, -0.010437463410198689, 0.024177607148885727, -0.007471033837646246, 0.18441875278949738, -0.010056817904114723, 0.027842525392770767, -0.03777053952217102, -0.04754287749528885, 0.027799174189567566, 0.07152305543422699, 0.044730816036462784, 0.08327221870422363, -0.11039546877145767, -0.0010439811740070581, -0.06392326951026917, -0.02186490222811699, 0.06695904582738876, -0.005346407648175955, -0.02006976678967476, 0.02443024143576622, -0.036442484706640244, 0.0017231799429282546, 0.0010481856297701597, 0.0346117839217186, -0.02424398809671402, -0.002485621953383088, 0.0213889479637146, -0.011780297383666039, -0.021336691454052925, 0.08199930191040039, 0.012292761355638504, -0.06641663610935211, -0.04804104566574097, -0.02387905865907669, 0.04431537911295891, 0.013076488859951496, -0.01866425946354866, 0.021959008648991585, 0.03960706293582916, -0.01020729262381792, -0.02418305166065693, -0.033883124589920044, 0.07181424647569656, 0.006995995994657278, -0.0018787551671266556, -0.011604482308030128, -0.04368721321225166, -0.03403295949101448, -0.0448705293238163, -0.013252737931907177, 0.006334015633910894, 0.011051048524677753, 0.03968079388141632, 0.026238538324832916, -0.02268879860639572, 0.03150002285838127, 0.03575531393289566, 0.006622558459639549, 0.02617255225777626, 0.05409598723053932, -0.029093382880091667, -0.006693058181554079, -0.008188324980437756, 0.001262631849385798, -0.031241172924637794, 0.021730836480855942, 0.04710027948021889, 0.012489914894104004, -0.02132761850953102, 0.001972696278244257, -0.03354865685105324, -0.023905973881483078, 0.033207524567842484, 0.036941032856702805, 0.04858328774571419, 0.0013594352640211582, -0.036827992647886276, 0.011056873016059399, 0.004360831342637539, 0.013468371704220772, -0.005378474947065115, 0.008743491023778915, 0.044169116765260696, -0.03527075797319412, 0.02502695843577385, 0.011945554055273533, -0.022210268303751945, -0.04464241489768028, 0.031875744462013245, 0.020652536302804947, 0.02388576976954937, -0.11984656006097794, -0.03585563972592354, 0.004915138706564903, 0.027684476226568222, -0.02051943726837635, -0.03107464127242565, 0.05140306428074837, -0.02034531906247139, -0.022302158176898956, 0.008011842146515846, 0.001396001665852964, 0.03675149381160736, 0.006522429641336203, 0.010138231329619884, -0.019881894811987877, -0.03135554865002632, 0.008866313844919205, 0.009332333691418171, 0.0260784812271595, 0.0371597521007061, -0.05980958044528961, 0.03205888718366623, 0.017942627891898155, -0.007848583161830902, -0.024465346708893776, 0.022211071103811264, 0.026334142312407494, 0.016934992745518684, 0.01664629764854908, -0.05329487472772598, 0.002663835184648633, -0.036977801471948624, -0.006878752261400223, 0.018211020156741142, -0.03154553100466728, 0.0009789479663595557, 0.03730959817767143, -0.008406813256442547, 0.02118593640625477, 0.00939252506941557, -0.011312894523143768, -0.00245288317091763, 0.0044558607041835785, -0.01914742961525917, -0.0024620341137051582, -0.015227158553898335, 0.004256247077137232, 0.013443625532090664, 0.03136695548892021, -0.030316300690174103, 0.0020275781862437725, 0.008411883376538754, 0.03277815505862236, 0.01311915460973978, 0.0006869987118989229, 0.003498571692034602, 0.004096480086445808, 0.05684506148099899, 0.012877828441560268, 0.00530013395473361, -0.050340019166469574, 0.011063030920922756, 0.005245448090136051, -0.02383669652044773, -0.028145577758550644, 0.012927470728754997, 0.013797507621347904, 0.023514332249760628, -0.006142276804894209, 0.035688597708940506, -0.005445883143693209, 0.01850895956158638, 0.013479805551469326, 0.020187629386782646, -0.03769193962216377, 0.01132191251963377, -0.036497991532087326, -0.015916690230369568, 0.06673214584589005, -0.0023557431995868683, -0.023072734475135803, -0.003066059434786439, 0.00827511865645647, -0.020396912470459938, 0.0043767960742115974, 0.019072821363806725, 0.011997451074421406, -0.03851889818906784, 0.016000278294086456, 0.04591883346438408, -0.0002832203754223883, -0.02076319046318531, 0.010785749182105064, -0.023496925830841064, -0.006186903454363346, 0.017455793917179108, 0.03060487098991871, 0.014847897924482822, 0.005973225459456444, 0.0025483500212430954, 0.020865527912974358, -0.02919941395521164, -0.009092018008232117, 0.017553532496094704, 0.02226865291595459, 0.02869351953268051, -0.030215008184313774, -0.04837222397327423, 0.03976266458630562, -0.023614851757884026, 0.01042894646525383, -0.028310444205999374, -0.011494842357933521, -0.028084831312298775, 0.03038141317665577, 0.027894172817468643, -0.0020656753331422806, -0.0422438308596611, -0.032083719968795776, 0.048999231308698654, -0.02276049368083477, 0.0421922467648983, -0.004289163742214441, -0.010042519308626652, 0.023515313863754272, -0.005236225202679634, 0.037808600813150406, 0.022188743576407433, 0.006950238719582558, -0.021883107721805573, -0.02431144192814827, -0.024080006405711174, 0.023933259770274162, -0.005181633867323399, 0.006685100961476564, 0.00015884751337580383, -0.02479647286236286, 0.021588698029518127, 0.004968891851603985, -0.02821188047528267, -0.015694161877036095, 0.020482195541262627, 0.026493992656469345, -0.029376279562711716, 0.058837875723838806, 0.029842739924788475, -0.07112731039524078, -0.019858090206980705, -0.016717350110411644, -0.0030304286628961563, 0.013999080285429955, -0.013337366282939911, -0.05727733299136162, 0.03481599688529968, 0.018659669905900955, -0.026247544214129448, 0.005135162267833948, 0.005865974351763725, 0.011063381098210812, 0.04517008364200592, -0.005019584205001593, -0.024984469637274742, -0.014686135575175285, 0.012744318693876266, -0.006939523853361607, -0.025793520733714104, -0.00923667661845684, -0.0733717605471611, 0.0011718882014974952, 0.011920193210244179, -0.005424852482974529, -0.01749636046588421, 0.024143332615494728, -0.05453537777066231, -0.006383269559592009, 0.06033959984779358, 0.02343638241291046, 0.0034041344188153744, -0.020422438159585, 0.03126951679587364, -0.009052561596035957, -0.02228998765349388, 0.02018529176712036, -0.02271081507205963, 0.008687063120305538, -0.009226662106812, 0.05076294764876366, 0.042482759803533554, 0.01795935444533825, 0.024343160912394524, -0.017049377784132957, -0.00198165001347661, 0.02144867740571499, -0.054185908287763596, -0.009127226658165455, -0.03405994549393654, 0.0313459113240242, 0.011442752555012703, -0.04459202289581299, -0.01757189817726612, 0.016732344403862953, 0.06388980150222778, -0.0018358618253841996, -0.02425047755241394, 0.01053465623408556, 0.011566814966499805, -0.028064649552106857, -0.019283251836895943, 0.052694518119096756, -0.04069427773356438, -0.02418222464621067, -0.015433019958436489, -0.0009565218351781368, -0.012437744066119194, 0.0010278788395226002, -0.020981257781386375, -0.01683746837079525, 0.03752630949020386, 0.016479240730404854, 0.0322122797369957, -0.024123461917042732, -0.023538872599601746, -0.021299811080098152, -0.0009574808645993471, 0.04575427621603012, -0.04286208376288414, -0.0005759089253842831, 0.024185676127672195, -0.01799938641488552, 0.04497106373310089, 0.016638925299048424, -0.0021917412523180246, 0.010600955225527287, 0.008525670506060123, 0.010208767838776112, 0.013757439330220222, -0.02470129355788231, 0.06288278847932816, 0.03265967220067978, -0.025431938469409943, 0.012104311026632786, -0.018539506942033768, -0.0021447157487273216, 0.01070589292794466, -0.041290104389190674, -0.01413705199956894, 0.0770813450217247, 0.015130161307752132, 0.018657879903912544, 0.0004052358854096383, 0.009740877896547318, 0.025244271382689476, 0.02017843909561634, -0.01178575400263071, 0.028021957725286484, 0.030331963673233986, -0.018985949456691742, 0.009610706940293312, -0.003558531403541565, 0.017999688163399696, 0.019053982570767403, -0.0715983584523201, 0.031102914363145828, 0.032362889498472214, -0.020221732556819916, 0.02508608065545559, -0.006464545149356127, -0.0012158412719145417, 0.0022859207820147276, 0.0029561917763203382, 0.03420169651508331, 0.03005371056497097, -0.01368292048573494, 0.016122207045555115, 0.020181696861982346, 0.002300920197740197, 0.013256263919174671, 0.06677556782960892, -0.012932638637721539, 0.06634856760501862, 0.001249123946763575, 0.01884014904499054, 0.024814968928694725, 0.008854581043124199, 0.00753995543345809, 0.004239345900714397, 0.08763588219881058, 0.018432339653372765, 0.01050460897386074, 0.053977206349372864, -0.0016612191684544086, 0.0004942342638969421, -0.00820575188845396, -0.005176171660423279, -0.006285147275775671, 0.014237964525818825, 0.03564133495092392, -0.017076797783374786, 0.016774246469140053, -0.018154170364141464, 0.03539138287305832, 0.04202006757259369, 0.03577851131558418, -0.01605420745909214, 0.009825977496802807, 0.061475880444049835, 0.003245389321818948, -0.014375023543834686, 0.026767220348119736, 0.00039657443994656205, -0.01887485757470131, 0.0605856254696846, 0.011380858719348907, -0.001339987851679325, 0.01311857346445322, -0.031924087554216385, 0.043958548456430435, -0.03701090067625046, -0.01301321666687727, -0.020330585539340973, 0.02340715378522873, -0.031175820156931877, -0.023740403354167938, 0.025755159556865692, -0.021299852058291435, 0.02488311007618904, -0.0019617255311459303, 0.022562125697731972, -0.03703602775931358, -0.029884720221161842, -0.02089674398303032, 0.033296894282102585, 0.04159468784928322, -0.005483947228640318, -0.01168082095682621, 0.02399759739637375, 0.014035685919225216, -0.008673056028783321, -0.032339680939912796, -0.042767006903886795, -0.02337256819009781, -0.029988175258040428, -0.01912214234471321, 0.020219391211867332, -0.016488833352923393, -0.027953745797276497, -0.012465300969779491, 0.020504627376794815, -0.01479104720056057, 0.037892960011959076, 0.038643937557935715, 0.01510605588555336, -0.030777040868997574, -0.010542592033743858, -0.01603209413588047, -0.016740532591938972, 0.004059384576976299, -0.0340534970164299, 0.02521587163209915, -0.024031979963183403, 0.0005050080362707376, 0.02674650214612484, 0.011503246612846851, -0.02452365681529045, -0.03401179611682892, 0.0012905566254630685, -0.012703762389719486, -0.004591644741594791, 0.03963393718004227, 0.012794233858585358, -0.02155119553208351, 0.01781051978468895, 0.0046474323607981205, -0.018558930605649948, 0.00039811930037103593, 0.010463274084031582, 0.028501277789473534, -0.045266829431056976, -0.04083169624209404, 0.005517932120710611, 0.044566988945007324, 0.0022635769564658403, 0.02528652735054493, 0.03997018560767174, 0.021595973521471024, 0.013650797307491302, -0.048186320811510086, 0.014403961598873138, -0.017570005729794502, -0.011038987897336483, -0.029282400384545326, -0.06507298350334167, -0.01535201445221901, -0.029996952041983604, -0.03141576051712036, 0.0036716675385832787, -0.03436453267931938, -0.029103223234415054, -0.014367938041687012, 0.005844586994498968, -0.0545482411980629, -0.007770802825689316, 0.05596565455198288, 0.049923233687877655, 0.031571727246046066, 0.029465939849615097, -0.04334281384944916, 0.032907985150814056, 0.004615278914570808, 0.03223135322332382, 0.061551980674266815, 0.029412303119897842, -0.021244870498776436, -0.010716404765844345, 0.02664724364876747, -0.012206117622554302, -0.049802880734205246, -0.002888831775635481, -0.0009120141621679068, -0.024165362119674683, -0.04793056100606918, -0.01726863719522953, 0.016405217349529266, -0.0010145962005481124, 0.04750337079167366, -0.02844107523560524, -0.03836312144994736, -0.016508067026734352, 0.05784066766500473, -0.042590007185935974, 0.03666611388325691, -0.03548457846045494, 0.013768068514764309, 0.016949085518717766, 0.004154884722083807, 0.030912192538380623, -0.021898774430155754, -0.04627583548426628, 0.0030252470169216394, 0.005547677632421255, -0.02022288553416729, -0.05241669714450836, 0.00393420597538352, 0.014449331909418106, -0.020716311410069466, -0.03197943791747093, 0.009124383330345154, 0.004909959621727467, -0.03444162756204605, -0.002282066736370325, -0.004086443223059177, -0.0006903151515871286, 0.004277433268725872, 0.013625189661979675, -0.04358798265457153, 0.06897109001874924, 0.03938646614551544, -0.02106240764260292, -0.045322198420763016, 0.002611146541312337 ]
Deploy Hugging Face models easily with Amazon SageMaker
philschmid
July 8, 2021
deploy-hugging-face-models-easily-with-amazon-sagemaker
guide, partnerships, aws
https://huggingface.co/blog/deploy-hugging-face-models-easily-with-amazon-sagemaker
pseudo code end
[ 0.05104919523000717, 0.005719324108213186, 0.10980552434921265, 0.011063640005886555, 0.11976397782564163, 0.04338475689291954, 0.04509604722261429, 0.014495434239506721, -0.03232045844197273, -0.07569702714681625, -0.02162454091012478, 0.03343679755926132, -0.03743930160999298, 0.005216752178966999, -0.010353165678679943, 0.06572721898555756, 0.07013607770204544, -0.03989337757229805, 0.0012887369375675917, -0.0050736372359097, -0.03556886687874794, -0.027049612253904343, 0.058950379490852356, -0.0003538566525094211, -0.007671804632991552, -0.02558642439544201, 0.010104312561452389, 0.005052801687270403, -0.055361680686473846, 0.06327833235263824, -0.037380993366241455, 0.001100620604120195, 0.05982837453484535, -0.009842812083661556, -0.01442304439842701, -0.015009689144790173, -0.07446132600307465, -0.01497206836938858, 0.004786449018865824, -0.047947563230991364, -0.020726533606648445, -0.057957664132118225, -0.004246102180331945, 0.03713451325893402, -0.014914843253791332, -0.0012454887619242072, -0.3229202628135681, 0.06578171998262405, -0.03913835808634758, -0.02123503014445305, -0.04764047637581825, 0.007964183576405048, 0.01537757646292448, 0.03169024735689163, 0.030089760199189186, 0.022882649675011635, 0.058924585580825806, -0.05247274786233902, -0.0032029543071985245, -0.046804897487163544, 0.0867580994963646, -0.0179297998547554, -0.005268959328532219, 0.026504648849368095, 0.06968892365694046, 0.06425151973962784, -0.010760529898107052, 0.05673137307167053, -0.03861522674560547, 0.0004545649862848222, 0.004769880324602127, -0.018617017194628716, -0.025058802217245102, -0.014592516236007214, 0.07365913689136505, -0.04692315310239792, -0.03287353366613388, 0.039015404880046844, 0.06226033344864845, 0.08242650330066681, -0.01609067991375923, -0.009124896489083767, 0.08595547080039978, 0.06806561350822449, 0.032235998660326004, -0.04331080615520477, 0.038979873061180115, -0.0182180218398571, -0.024920955300331116, 0.0033021478448063135, -0.03902510181069374, -0.05433694273233414, 0.006281042005866766, 0.03017544373869896, -0.023752925917506218, -0.04356026649475098, 0.03189225494861603, 0.016385799273848534, 0.047218143939971924, 0.021103626117110252, -0.02341032214462757, 0.012440965510904789, 0.023954996839165688, -0.035974472761154175, -0.05001578852534294, -0.0001753068354446441, -0.024533553048968315, -0.06112663820385933, -0.05439431965351105, 0.013488847762346268, -0.025400221347808838, 0.043605584651231766, 0.0622292198240757, 0.0020597807597368956, -0.07320915162563324, 0.03162870183587074, -0.005995872430503368, 0.018999695777893066, 0.001896957983262837, 0.03264759108424187, 0.010290907695889473, 0.09236405789852142, 0.07715050876140594, 0.028299810364842415, 0.053127601742744446, -0.0037245461717247963, 0.022844605147838593, 0.07620055228471756, -0.0918864905834198, -0.016674555838108063, 0.025770753622055054, 0.015713166445493698, 0.05087101832032204, -0.008143073879182339, -0.057890426367521286, -0.0719849020242691, -0.004990155342966318, 0.023571189492940903, 0.023738237097859383, -0.01713625155389309, 0.013603669591248035, 0.05524871498346329, -0.005241756327450275, 0.08736072480678558, 0.03322567790746689, -0.028963858261704445, -0.0016821917379274964, 0.031922392547130585, -0.021120687946677208, 0.01965595781803131, 0.00392793957144022, 0.04523716866970062, -0.02866438962519169, -0.068198062479496, -0.004208783619105816, 0.05738593265414238, 0.0335436649620533, 0.006890852469950914, -0.11148152500391006, -0.025855502113699913, 0.060098808258771896, 0.04101729020476341, -0.020403876900672913, -0.0050704884342849255, 0.05639457330107689, 0.007738791406154633, 0.045044586062431335, -0.006806458346545696, -0.029726840555667877, -0.05054648965597153, -0.03897462040185928, -0.007324134930968285, 0.04888787865638733, -0.018246455118060112, -0.07059435546398163, 0.01793438196182251, 0.07492855191230774, 0.012871270067989826, 0.028009019792079926, 0.014787105843424797, -0.02866055630147457, 0.037616413086652756, -0.003352771047502756, 0.02373194321990013, 0.006957865785807371, 0.001932299230247736, 0.052082791924476624, -0.017541099339723587, -0.04039604961872101, 0.03700428828597069, -0.14532890915870667, -0.037224020808935165, 0.10549326241016388, -0.03236823529005051, 0.026203211396932602, -0.10742343217134476, -0.03037898987531662, 0.10346140712499619, 0.04961112141609192, 0.06510689854621887, 0.027775544673204422, 0.03738389536738396, 0.1085241511464119, -0.03623657673597336, -0.04633135348558426, 0.02441849745810032, 0.043563708662986755, 0.0015269431751221418, 0.019958719611167908, -0.002988560125231743, -0.018063688650727272, -0.050363585352897644, 0.049182992428541183, -0.08433707803487778, 0.00806547049432993, 0.023076605051755905, -0.025848450139164925, -0.011924873106181622, 0.03163674846291542, -0.06426934897899628, 0.08359143137931824, 0.001437211176380515, -0.04368627443909645, 0.0634525716304779, -0.032643940299749374, 0.10875088721513748, 0.07399670034646988, 0.004709780216217041, 0.0601583831012249, -0.09182336181402206, -0.030490128323435783, -0.03008870594203472, -0.002261559246107936, 0.09310604631900787, 0.019384684041142464, 0.06473830342292786, 0.014671427197754383, -0.03471188247203827, 0.04998254403471947, -0.026088155806064606, 0.0010714009404182434, 0.035038430243730545, -0.029115134850144386, 0.031424976885318756, -0.026493756100535393, -0.06551208347082138, 0.03333745524287224, 0.019301000982522964, -0.038839854300022125, -0.013376947492361069, -0.03049275651574135, 0.0671677365899086, 0.0022191025782376528, -0.04611630737781525, 0.07428152859210968, -0.033065423369407654, -0.009418484754860401, -0.03208453580737114, -0.024406664073467255, 0.014491182751953602, 0.0024926953483372927, -0.010163430124521255, -0.0017385728424414992, -0.06835395842790604, -0.020820988342165947, -0.026163343340158463, 0.0069284294731915, 0.029779795557260513, -0.01028817892074585, 0.053294338285923004, -0.020743489265441895, -0.026252731680870056, 0.0388651043176651, -0.012397884391248226, -0.007308609317988157, 0.0033389385789632797, 0.03990977630019188, -0.007798006292432547, -0.006034581456333399, -0.014384998008608818, -0.025775469839572906, -0.03302433714270592, 0.023072997108101845, 0.007163667120039463, 0.05579221248626709, -0.02884485386312008, 0.01660364866256714, 0.01582014560699463, -0.019541071727871895, 0.03601834177970886, -0.014111747033894062, 0.04041335731744766, -0.0032909594010561705, -0.0319090336561203, 0.03577004373073578, -0.017448250204324722, -0.03067103959619999, 0.027497662231326103, -0.025408923625946045, -0.010969171300530434, 0.014973592013120651, -0.0007768808864057064, -0.022887252271175385, 0.01583625003695488, -0.05837635323405266, 0.03421832248568535, -0.0002361917868256569, 0.03623633831739426, -0.1694774478673935, -0.03303081542253494, 0.01678600162267685, 0.017019780352711678, -0.004084173124283552, -0.0017355603631585836, 0.046571504324674606, -0.04300640895962715, -0.042392440140247345, -0.010412272065877914, 0.042286042124032974, 0.00627128453925252, 0.008185314945876598, -0.015766030177474022, -0.008377213962376118, -0.01037808321416378, -0.008511536754667759, 0.013941651210188866, 0.015032756142318249, -0.013093573041260242, -0.011582464911043644, 0.050124768167734146, -0.006777728442102671, -0.007038332521915436, -0.01627274602651596, 0.03648725524544716, 0.021639276295900345, 0.03446832299232483, 0.0225825235247612, -0.020159438252449036, -0.04262930899858475, 0.038133762776851654, -0.010885010473430157, 0.02289576455950737, -0.004926461260765791, 0.000609939219430089, 0.01764330081641674, -0.017836296930909157, -0.00858342181891203, 0.050208140164613724, 0.027370739728212357, 0.016723599284887314, 0.028200704604387283, 0.031174175441265106, -0.018920116126537323, 0.0031417296268045902, 0.014630087651312351, -0.031843043863773346, 0.05437031015753746, -0.04041384905576706, -0.043169379234313965, 0.01005395408719778, -0.0018089066725224257, 0.04212547466158867, -0.006221709307283163, -0.006534758489578962, -0.03761644288897514, 0.02921854704618454, 0.05731295049190521, -0.03978355973958969, -0.011276494711637497, 0.00502139562740922, 0.011590233072638512, -0.012449742294847965, -0.03015560284256935, 0.04386058822274208, -0.03453867882490158, 0.028244037181138992, -0.029482858255505562, 0.07372372597455978, 0.016930190846323967, -0.01526650507003069, -0.009331665933132172, 0.019171247258782387, 0.004585344810038805, 0.032802216708660126, -0.005830378737300634, -0.03050968609750271, 0.049466464668512344, -0.026927001774311066, 0.012410548515617847, -0.02421436831355095, -0.016711069270968437, 0.0016783633036538959, 0.008591553196310997, 0.02176150307059288, 0.0060459622181952, 0.014465179294347763, 0.0023675861302763224, 0.023140719160437584, 0.03163810446858406, 0.002249588957056403, 0.0003622061340138316, -0.0014326977543532848, -0.0007318720454350114, 0.016148926690220833, 0.055749330669641495, -0.017339186742901802, 0.005831987597048283, -0.004777543246746063, 0.012645055539906025, -0.0003649028658401221, -0.019601628184318542, 0.012648304924368858, -0.0016464152140542865, 0.025884335860610008, -0.03715166822075844, -0.023885637521743774, -0.0331137515604496, 0.029604457318782806, 0.014475175179541111, -0.044336654245853424, 0.009009355679154396, -0.040120821446180344, -0.0030509978532791138, 0.006790607236325741, -0.016461098566651344, -0.041176844388246536, -0.029184699058532715, 0.0003283898695372045, -0.015831951051950455, 0.015704667195677757, 0.013530193828046322, -0.03359219804406166, -0.005064419936388731, -0.009431031532585621, 0.01679443009197712, 0.0011587570188567042, 0.013340717181563377, 0.0029474080074578524, -0.02992340177297592, -0.0447368361055851, 0.03018207848072052, -0.013319983147084713, 0.03283202648162842, 0.0015462558949366212, -0.00954604335129261, 0.04323883727192879, 0.0021837055683135986, -0.06843280047178268, 0.006972325034439564, -0.004927561618387699, 0.0028342134319245815, -0.029932215809822083, 0.02131132408976555, -0.017102470621466637, 0.009881590493023396, -0.025818223133683205, 0.0024050769861787558, 0.006196283735334873, 0.012154921889305115, -0.05693596974015236, -0.029678741469979286, -0.011379488743841648, -0.00833298172801733, 0.012748893350362778, 0.01911815069615841, -0.027214689180254936, -0.024906272068619728, 0.06139128655195236, -0.018965695053339005, -0.027290156111121178, -0.04778898134827614, 0.033050116151571274, -0.03959868475794792, -0.00957459770143032, -0.005940999835729599, 0.004043012857437134, -0.0007684351876378059, -0.015292511321604252, -0.02814270369708538, -0.0035043307580053806, 0.044387202709913254, -0.014211466535925865, 0.02179444581270218, 0.01153032761067152, 0.007025642786175013, 0.008049644529819489, 0.014221587218344212, 0.035785701125860214, 0.00027119723381474614, -0.005853624548763037, 0.024945374578237534, 0.022028909996151924, -0.017235752195119858, -0.01839390955865383, 0.025665869936347008, 0.007052482105791569, -0.009895064868032932, 0.0605398565530777, -0.041623979806900024, -0.025026801973581314, -0.006475111469626427, -0.009744002483785152, 0.010055430233478546, -0.010888916440308094, -0.007448603864759207, -0.0016234618378803134, -0.022223535925149918, -0.025232883170247078, 0.0222594253718853, 0.02826455608010292, -0.002277145627886057, 0.004439692944288254, 0.018161309882998466, 0.014057171531021595, 0.01363696064800024, -0.026620425283908844, 0.008658806793391705, -0.017675939947366714, 0.0024572715628892183, -0.0005320016643963754, -0.041152484714984894, -0.01815962605178356, -0.012286439538002014, -0.030894357711076736, -0.025166917592287064, 0.03150063380599022, 0.011777847073972225, 0.013210616074502468, 0.019801512360572815, 0.0019394798437133431, -0.00591039564460516, 0.06390845775604248, 0.06971804797649384, -0.006114338058978319, 0.008092770352959633, 0.01624099537730217, -0.011738973669707775, 0.04738473519682884, 0.02937576361000538, 0.005683096591383219, -0.025525955483317375, 0.008238386362791061, 0.02688509412109852, 0.0011607058113440871, -0.061017658561468124, 0.005776851903647184, 0.0045195892453193665, 0.015481729060411453, -0.011523238383233547, -0.012955407612025738, 0.006475088652223349, -0.011755608022212982, -0.029865745455026627, 0.035665299743413925, 0.03042980469763279, -0.026319971308112144, 0.018719857558608055, 0.0008502837154082954, 0.022830793634057045, -0.01349557563662529, 0.002866216003894806, -0.018346209079027176, 0.009598956443369389, 0.030302679166197777, -0.012227619998157024, -0.02521650306880474, 0.014067982323467731, 0.012852223590016365, -0.00034476874861866236, 0.012050304561853409, 0.032723668962717056, 0.01885397918522358, -0.024759313091635704, 0.0388677679002285, -0.005377643276005983, -0.0031078082975000143, 0.009572663344442844, 0.01327525544911623, -0.004052975680679083, 0.016307242214679718, 0.05275500565767288, -0.022366028279066086, 0.030562618747353554, -0.03404499962925911, 0.018615443259477615, 0.04516693204641342, 0.005833153612911701, -0.0036693462170660496, 0.015693942084908485, 0.007687606383115053, 0.007547165732830763, 0.0011120327981188893, -0.031231535598635674, 0.02150518260896206, 0.028433388099074364, -0.00016906748351175338, 0.03046882338821888, 0.022010255604982376, 0.0004100085061509162, 0.019544173032045364, -0.01317477598786354, 0.012678244151175022, -0.03519561141729355, 0.02723006345331669, 0.030769122764468193, -0.03072391450405121, 0.01642346940934658, -0.031734589487314224, 0.05286368727684021, 0.007513487711548805, 0.006365661509335041, 0.007302909158170223, -0.0192671287804842, 0.014881438575685024, 0.015213639475405216, -0.011376699432730675, -0.008714904077351093, -0.035355500876903534, -0.0025912525597959757, 0.05457794666290283, -0.04742525517940521, -0.009555856697261333, -0.006644615437835455, -0.06264612823724747, 0.044649336487054825, -0.014600992202758789, -0.03514113649725914, 0.0029780548065900803, 0.04367917403578758, -0.03011307120323181, -0.01486027892678976, -0.017251409590244293, -0.05488516762852669, -0.06335148215293884, 0.01452077180147171, 0.009070360101759434, -0.0164220929145813, -0.005483146291226149, 0.01125093549489975, -0.003562560537829995, -0.01420399360358715, -0.00860440731048584, -0.008891534991562366, 0.04481356218457222, 0.029983896762132645, 0.03971399366855621, -0.006826639641076326, -0.026806598529219627, -0.03653911501169205, 0.007882790639996529, 0.0012320976238697767, -0.011176461353898048, -0.0055560823529958725, -0.004590519238263369, -0.0029741984326392412, -0.005154121667146683, -0.012257685884833336, 0.044178228825330734, 0.019865887239575386, 0.03741531819105148, -0.021673865616321564, 0.03467200696468353, -0.03212554380297661, -0.004386713728308678, -0.027269089594483376, -0.012614624574780464, 0.0062879580073058605, 0.013571390882134438, -0.0010842480696737766, 0.009596751071512699, 0.010084299370646477, -0.026947595179080963, -0.05350780487060547, 0.006605631206184626, -0.010850418359041214, -0.004902913235127926, 0.021167391911149025, 0.01276925578713417, -0.010367373004555702, -0.028979482129216194, 0.02386949025094509, 0.008195379748940468, -0.042271312326192856, -0.006963379681110382, -0.036146681755781174, -0.020048750564455986, -0.025721043348312378, -0.010950151830911636, 0.07513883709907532, 0.019215285778045654, 0.01972535438835621, 0.02826937474310398, 0.021307501941919327, 0.007256053853780031, -0.01812317967414856, 0.006166198756545782, 0.016122575849294662, 0.028578493744134903, -0.014721807092428207, -0.020446954295039177, -0.023855650797486305, -0.03648168593645096, 0.011768120341002941, -0.008886879310011864, -0.06314004957675934, -0.028227055445313454, 0.016169484704732895, 0.0042002443224191666, -0.04233396425843239, 0.03142917528748512, 0.04474521055817604, 0.004093663766980171, 0.02757028117775917, 0.0034351481590420008, -0.0005336545873433352, 0.000196322871488519, 0.002004878129810095, 0.0004019431071355939, 0.016559334471821785, 0.03547980263829231, 0.003045171033591032, -0.05381406471133232, 0.033033307641744614, -0.047532740980386734, -0.03815227746963501, -0.009645582176744938, 0.032872430980205536, -0.011021834798157215, -0.0374392494559288, 0.0012820400297641754, 0.004881851840764284, 0.010454796254634857, 0.00375008094124496, 0.03140028938651085, -0.010751456022262573, 0.0021643303334712982, 0.009482731111347675, -0.043551769107580185, -0.008138117380440235, 0.002663985826075077, 0.029081568121910095, 0.020059572532773018, 0.025466129183769226, -0.012689674273133278, -0.010990014299750328, -0.050831981003284454, 0.01658604107797146, 0.0023844228126108646, -0.008457948453724384, -0.0014445973793044686, 0.006751383654773235, -0.03539707139134407, -0.029169030487537384, -0.04872356727719307, 0.046982280910015106, 0.013659721240401268, -0.0149174053221941, -0.033311281353235245, -0.01621752791106701, 0.02716509997844696, 0.030418289825320244, 0.039465293288230896, -0.007692794315516949, 0.0647488459944725, 0.015358583070337772, -0.019824286922812462, -0.002792755141854286, 0.035812102258205414 ]
Deploy Hugging Face models easily with Amazon SageMaker
philschmid
July 8, 2021
deploy-hugging-face-models-easily-with-amazon-sagemaker
guide, partnerships, aws
https://huggingface.co/blog/deploy-hugging-face-models-easily-with-amazon-sagemaker
# deploy model to SageMaker Inference predictor = hf_estimator.deploy(initial_instance_count=1, instance_type="ml.m5.xlarge") # example request, you always need to define "inputs" data = { "inputs": "Camera - You are awarded a SiPix Digital Camera! call 09061221066 fromm landline. Delivery within 28 days." } # request predictor.predict(data) After we run our request we can delete the endpoint again with. python # delete endpoint predictor.delete_endpoint()
[ -0.01413447130471468, 0.04934248700737953, 0.006125550717115402, -0.010365321300923824, 0.0670633390545845, 0.11404131352901459, 0.03139101713895798, -0.01035089697688818, 0.002986255567520857, 0.017568577080965042, -0.08089423179626465, -0.0011834317119792104, -0.00987367145717144, 0.05017475411295891, 0.000449056999059394, -0.06275247782468796, -0.027069292962551117, -0.020542627200484276, -0.04978582262992859, 0.025911660864949226, 0.03244692459702492, -0.02636648155748844, 0.017220135778188705, 0.008885076269507408, -0.02069743536412716, -0.012916740961372852, -0.01940975710749626, 0.0062905787490308285, 0.002089852001518011, 0.045196134597063065, -0.022844085469841957, 0.02054516226053238, 0.0032006853725761175, -0.010351307690143585, 0.035774633288383484, 0.04198092222213745, -0.07357315719127655, 0.011095934547483921, 0.010170428082346916, -0.0352439247071743, -0.011318722739815712, -0.029084637761116028, -0.07029592245817184, 0.028780853375792503, 0.03738683834671974, -0.06448017060756683, -0.09558764100074768, 0.0345517136156559, 0.028230875730514526, -0.00793865043669939, -0.1074608713388443, 0.11962762475013733, 0.006446240935474634, -0.01761438325047493, 0.024582084268331528, -0.024974621832370758, -0.029831452295184135, -0.08311065286397934, -0.029611289501190186, 0.05047793686389923, -0.02636529691517353, 0.007959139533340931, 0.003767759306356311, 0.03079991787672043, 0.029827438294887543, 0.0012998537858948112, 0.04778579995036125, -0.028960373252630234, 0.006565074436366558, -0.049929820001125336, -0.05416957288980484, -0.007127036806195974, 0.03351632133126259, 0.019194666296243668, -0.005517769604921341, -0.06465021520853043, 0.023724868893623352, 0.035339660942554474, 0.03579599782824516, 0.0717960074543953, -0.0281284898519516, 0.014494359493255615, 0.02418975718319416, -0.04623904079198837, 0.008358047343790531, -0.0031819778960198164, 0.03845086321234703, 0.031622059643268585, -0.059429291635751724, -0.01552844699472189, 0.042197637259960175, -0.05114247649908066, 0.03271770104765892, 0.04647735133767128, -0.016529127955436707, -0.025703970342874527, 0.047246623784303665, -0.005912886466830969, 0.009055549278855324, -0.09956005960702896, -0.019835500046610832, -0.11179855465888977, -0.06879694014787674, -0.023409895598888397, 0.031665097922086716, 0.0634530782699585, 0.012559421360492706, -0.09514915198087692, -0.03148907050490379, 0.005748264025896788, 0.013718513771891594, -0.010510887950658798, -0.047551777213811874, 0.13535095751285553, -0.07425300031900406, 0.01236624177545309, 0.015185737051069736, -0.029856594279408455, 0.007455126382410526, 0.009473093785345554, 0.07001903653144836, 0.0592041090130806, 0.027751581743359566, 0.034129902720451355, -0.0032786899246275425, 0.06516673415899277, 0.0525585301220417, 0.023600641638040543, -0.011140373535454273, -0.00811412837356329, 0.03754880279302597, -0.05664259195327759, 0.049003105610609055, 0.0037179046776145697, 0.024120153859257698, -0.07641627639532089, 0.00429900037124753, -0.041319265961647034, 0.034913815557956696, 0.0251676794141531, -0.0031965812668204308, 0.06817978620529175, 0.011103185825049877, 0.059726618230342865, 0.0831526592373848, 0.06326007843017578, 0.029450848698616028, -0.02321707457304001, 0.08093541860580444, 0.048946332186460495, -0.09205344319343567, 0.09562188386917114, -0.02571728639304638, -0.07946596294641495, 0.04175948724150658, 0.05335592105984688, -0.05029115825891495, 0.04132075607776642, -0.049534864723682404, 0.016212819144129753, 0.02806234546005726, 0.03261367231607437, -0.021178288385272026, -0.016151998192071915, 0.027267588302493095, 0.03915175423026085, 0.06730564683675766, -0.02660403773188591, 0.04018674045801163, -0.023690134286880493, 0.002012441633269191, -0.08257994055747986, 0.08444293588399887, 0.07580436021089554, 0.07396026700735092, 0.029121126979589462, 0.058451078832149506, 0.057104405015707016, -0.003496340475976467, 0.021358691155910492, -0.02769101783633232, 0.07763994485139847, -0.055312398821115494, -0.05022277683019638, 0.09160546958446503, 0.0008814408211037517, 0.03771171346306801, 0.026803314685821533, 0.048290517181158066, -0.03890015557408333, -0.016981791704893112, -0.06907106190919876, 0.06511979550123215, -0.007969274185597897, 0.10887986421585083, -0.0805763453245163, -0.053991176187992096, 0.11035279929637909, -0.0025127127300947905, 0.04730134829878807, 0.05460603907704353, 0.05364514887332916, 0.011329497210681438, -0.004022178705781698, -0.008433878421783447, 0.0247497595846653, -0.05112843215465546, -0.03883283585309982, 0.05236833170056343, 0.04161245748400688, 0.015641724690794945, -0.06597625464200974, 0.021419143304228783, -0.10198798030614853, 0.007459388580173254, -0.0046160174533724785, -0.04634392634034157, -0.033994678407907486, -0.01384702231734991, 0.014943654648959637, 0.1292380839586258, -0.05100368335843086, 0.017303528264164925, -0.04906950145959854, 0.040031105279922485, -0.03354373201727867, 0.06455443799495697, 0.05396529287099838, 0.05402541160583496, -0.00818704441189766, -0.03605378419160843, -0.054342884570360184, -0.030834708362817764, 0.0653245747089386, 0.012349828146398067, 0.010372955352067947, -0.02966393530368805, -0.020290428772568703, -0.048233676701784134, -0.0025702661368995905, 0.09974688291549683, 0.015882086008787155, -0.007755476515740156, 0.013409992679953575, -0.030815379694104195, -0.055249862372875214, 0.07122696191072464, 0.010136678814888, -0.0457768514752388, 0.03171921148896217, -0.06704778969287872, 0.017043204978108406, 0.004615963436663151, 0.002206002129241824, 0.007819992490112782, -0.0168768223375082, -0.034877847880125046, 0.011762217618525028, 0.000975995440967381, 0.07940205186605453, -0.012863356620073318, 0.020540202036499977, -0.010224143974483013, -0.01618143357336521, 0.03306218236684799, -0.026300514116883278, -0.058398012071847916, -0.01567828468978405, 0.018434135243296623, -0.007389153353869915, 0.003783067688345909, -0.04532782733440399, 0.02498137764632702, 0.045878805220127106, 0.030769485980272293, 0.04172006994485855, 0.033262841403484344, 0.0029212338849902153, -0.009631386026740074, -0.01398499310016632, 0.023445239290595055, -0.06439665704965591, 0.0041425758972764015, 0.013575122691690922, 0.03664484620094299, -0.028160598129034042, 0.010171165689826012, -0.025991741567850113, -0.03955145925283432, -0.010789376683533192, -0.03802233189344406, 0.05955448001623154, 0.04543956369161606, 0.005699086934328079, -0.025757890194654465, 0.00878218188881874, -0.002619507722556591, -0.025153527036309242, 0.025073550641536713, 0.022095460444688797, -0.05245969444513321, -0.0015083332546055317, 0.03393121808767319, -0.013190196827054024, -0.0391068272292614, 0.03354261815547943, 0.04243594780564308, -0.012676207348704338, -0.08393904566764832, -0.015241101384162903, -0.01777617819607258, -0.06821785122156143, 0.011124800890684128, -0.015562759712338448, 0.058315105736255646, 0.0019063422223553061, -0.028909489512443542, 0.03569721430540085, 0.0004738133284263313, -0.0005084609147161245, 0.011718221940100193, -0.03754216432571411, -0.012184266932308674, 0.02664772979915142, 0.01483975537121296, -0.02539229951798916, 0.010223321616649628, 0.03621644154191017, -0.03514942154288292, 0.0352654904127121, 0.037737298756837845, -0.005236870143562555, 0.03005504608154297, 0.007633345201611519, 0.03411700576543808, 0.05477593466639519, -0.019587034359574318, -0.03962208330631256, 0.0009095296263694763, -0.055897410959005356, -0.031046343967318535, -0.031050879508256912, -0.03984875604510307, 0.014547303318977356, 0.01035053189843893, 0.01795390620827675, 0.01693481020629406, 0.004377222154289484, -0.02500048466026783, -0.026906317099928856, -0.013313475996255875, -0.0008795624016784132, 0.009665603749454021, 0.028356380760669708, 0.04231613129377365, 0.010401526466012001, 0.02736651711165905, -0.033304620534181595, -0.02311752736568451, -0.005712747108191252, 0.0012783954152837396, 0.01397260557860136, -0.0025607110001146793, 0.01975846476852894, 0.032583918422460556, 0.0319860503077507, 0.033365398645401, -0.014438447542488575, -0.053675875067710876, 0.005252298898994923, 0.014839470386505127, -0.033586855977773666, -0.018009036779403687, -0.023556046187877655, -0.003599718678742647, -0.009060591459274292, -0.01841157302260399, -0.008604397065937519, -0.0005388641729950905, 0.06188569217920303, 0.032062675803899765, 0.015474672429263592, -0.004762590862810612, -0.006184267345815897, -0.01541106402873993, -0.040014252066612244, 0.029400702565908432, 0.008683877065777779, -0.016796253621578217, -0.011930173262953758, -0.03497463837265968, -0.027161061763763428, 0.019547821953892708, 0.01399871613830328, 0.008004596456885338, -0.041574183851480484, 0.01708897575736046, 0.006881067529320717, -0.02972855046391487, -0.05118296295404434, -0.018794652074575424, 0.022342249751091003, -0.05078159272670746, -0.03937371447682381, 0.016000865027308464, 0.006593156140297651, 0.011959569528698921, -0.03379089757800102, -0.029548656195402145, -0.03947945311665535, -0.015406711027026176, -0.009196526370942593, -0.06784749776124954, -0.032759614288806915, -0.013113540597259998, -0.03087358921766281, -0.018818702548742294, -0.036354631185531616, 0.032111793756484985, 0.022200042381882668, -0.0008170288056135178, -0.03519981727004051, -0.019304491579532623, 0.055112287402153015, -0.02114064432680607, 0.004287497140467167, -0.012148987501859665, 0.050033777952194214, -0.064967080950737, -0.012129256501793861, 0.00037361434078775346, -0.08747780323028564, -0.004847622010856867, 0.010887395590543747, 0.015279444865882397, 0.012209444306790829, -0.0029517756775021553, -0.0054148160852491856, -0.002833615057170391, 0.03214025869965553, 0.003119590925052762, -0.021042125299572945, 0.022024326026439667, 0.03392945975065231, -0.010076739825308323, 0.03431836515665054, 0.029331738129258156, 0.02518068440258503, -0.005020547192543745, -0.0011643229518085718, 0.005013149231672287, -0.029593007639050484, 0.0070906286127865314, 0.010654672980308533, -0.06794489175081253, -0.04452696070075035, -0.03659381344914436, -0.0014317542081698775, 0.005298151634633541, 0.01539883017539978, -0.037578050047159195, -0.03416186571121216, 0.008107575587928295, 0.012850252911448479, -0.02018519677221775, -0.005558107979595661, -0.0030779587104916573, 0.045080941170454025, 0.009714082814753056, 0.030947009101510048, -0.01125185377895832, 0.006413443014025688, 0.027183085680007935, 0.020798537880182266, -0.020974328741431236, -0.047527339309453964, 0.012156612239778042, -0.008933179080486298, -0.03171893209218979, -0.011528532952070236, 0.03922230005264282, -0.02179930917918682, 0.012596216052770615, 0.031864095479249954, 0.04098934680223465, 0.030100587755441666, -0.02726363018155098, 0.021625462919473648, -0.0212494395673275, -0.00000860893396747997, -0.007560600060969591, 0.00656413147225976, 0.012829969637095928, 0.020762518048286438, 0.05285578966140747, 0.015734441578388214, 0.06135045364499092, 0.04191111773252487, -0.02496061846613884, -0.016973426565527916, -0.024198392406105995, -0.033281803131103516, -0.004422071855515242, -0.004780445713549852, -0.002552460180595517, 0.00863141193985939, -0.0251641646027565, -0.02727370709180832, 0.00337682431563735, 0.05881280452013016, 0.0234253890812397, -0.016244592145085335, 0.009912865236401558, -0.025432361289858818, 0.023862600326538086, -0.03151360899209976, 0.022127753123641014, 0.0008062650449573994, 0.011421657167375088, 0.00496367784217, 0.005494385026395321, 0.030180132016539574, 0.020782792940735817, -0.0420035719871521, -0.010337138548493385, 0.035863302648067474, 0.024646960198879242, 0.032539140433073044, -0.018247589468955994, -0.016131171956658363, 0.019291607663035393, 0.015630820766091347, 0.009186720475554466, -0.023367587476968765, -0.00881203543394804, 0.045580822974443436, -0.016961494460701942, 0.047083932906389236, -0.011252379044890404, -0.03826642408967018, -0.012667801231145859, -0.0008138450793921947, 0.022932279855012894, 0.03485687077045441, -0.06579441577196121, 0.03694708272814751, 0.0754808634519577, -0.013279678300023079, 0.002359391888603568, -0.01020603347569704, -0.008637474849820137, 0.0022869028616696596, -0.01690744422376156, 0.05560459941625595, 0.03706077113747597, -0.02813556045293808, -0.001967702992260456, -0.0015865268651396036, -0.012936925515532494, 0.008588598109781742, 0.03458927199244499, -0.026507949456572533, -0.006395441479980946, 0.011014414951205254, -0.004033571574836969, 0.030652930960059166, -0.005018939264118671, -0.018322231248021126, 0.01175069622695446, -0.03890637308359146, 0.01567274145781994, 0.026775699108839035, -0.0039087338373064995, 0.021602796390652657, 0.021860042586922646, -0.029991736635565758, 0.01075060199946165, -0.018206045031547546, 0.036013100296258926, 0.0031274131033569574, -0.022224104031920433, -0.009631330147385597, 0.009400722570717335, -0.018788646906614304, 0.003909238614141941, 0.03868546709418297, -0.03534163534641266, 0.018891943618655205, 0.026944223791360855, 0.02514348365366459, 0.024500105530023575, 0.010689291171729565, 0.029473531991243362, -0.009135344997048378, 0.06682293862104416, 0.012655475176870823, 0.005785827990621328, 0.015330737456679344, -0.010023360140621662, 0.05839848518371582, -0.025844009593129158, 0.023303339257836342, -0.006862129550427198, 0.019762158393859863, 0.02722393535077572, 0.011182614602148533, 0.03431800752878189, -0.05622787028551102, 0.012283547781407833, 0.03483401983976364, 0.018024055287241936, 0.008757089264690876, -0.02288047783076763, 0.05337011441588402, -0.0033883575815707445, -0.005630892235785723, 0.06076429411768913, -0.003420933149755001, 0.0032881619408726692, 0.009120357222855091, -0.02367713302373886, -0.027750875800848007, -0.03320414200425148, 0.010983494110405445, -0.038933638483285904, -0.024999910965561867, -0.054562535136938095, 0.0025739804841578007, 0.021923985332250595, -0.05089488998055458, -0.011911813169717789, -0.011082031764090061, -0.025202497839927673, 0.01633804477751255, -0.05732458829879761, 0.008050703443586826, -0.044078532606363297, -0.00816819816827774, 0.01563599705696106, 0.01236352976411581, 0.02183833345770836, -0.05598077178001404, -0.03196632117033005, 0.002799105364829302, 0.019461309537291527, -0.008956020697951317, -0.045519646257162094, 0.0003086353244725615, 0.005194368306547403, -0.011472761631011963, -0.00017335561278741807, -0.00606046337634325, -0.013445191085338593, -0.006258381064981222, 0.024588556960225105, 0.009325983934104443, 0.009340611286461353, 0.028679409995675087, 0.003982985392212868, 0.07481198757886887, 0.000053380350436782464, -0.011848329566419125, -0.0587121956050396, -0.0030164539348334074, 0.010583024471998215, 0.00867446418851614, -0.005332117900252342, 0.000029739689125563018, 0.02889225445687771, -0.02159169688820839, 0.013405803591012955, 0.01666431315243244, 0.011227001436054707, -0.00190541404299438, 0.03796800598502159, -0.03567001223564148, 0.025351332500576973, -0.023578407242894173, 0.011823677457869053, 0.038991689682006836, 0.04415813088417053, -0.013577243313193321, -0.039464037865400314, -0.018191542476415634, 0.029531776905059814, 0.022248288616538048, -0.02302669920027256, 0.026284702122211456, -0.007938271388411522, -0.04031023755669594, 0.03299401327967644, 0.011322688311338425, -0.02391800470650196, 0.01278723869472742, -0.041842322796583176, -0.018903298303484917, -0.01545598916709423, -0.017437295988202095, -0.04163368046283722, -0.0835268571972847, -0.029468078166246414, -0.006653648801147938, -0.027447737753391266, 0.004782861564308405, -0.035196688026189804, -0.037159841507673264, -0.05195184797048569, 0.00488698435947299, -0.023321736603975296, -0.019185731187462807, 0.06832894682884216, 0.08549848943948746, 0.04110689461231232, 0.012818492949008942, -0.033567655831575394, 0.006917491089552641, -0.017087595537304878, 0.025478092953562737, 0.036473240703344345, 0.020497731864452362, -0.01407366618514061, -0.04011981561779976, 0.013058219105005264, -0.004773465450853109, -0.06204099953174591, -0.0013854514108970761, -0.016678843647241592, -0.04040961712598801, -0.019120698794722557, -0.014190547168254852, 0.030125753954052925, 0.000803728005848825, 0.04534313455224037, -0.028399735689163208, 0.0009864106541499496, -0.06352300196886063, 0.005541217979043722, -0.03312642127275467, -0.03505672886967659, -0.014283081516623497, -0.042441628873348236, 0.036644577980041504, 0.019947681576013565, -0.0033029830083251, -0.04356929659843445, -0.027849458158016205, -0.010864232666790485, -0.012309666723012924, -0.04599412530660629, -0.05430062487721443, -0.018544333055615425, 0.05936690792441368, -0.05102033540606499, -0.02076558768749237, -0.02515309303998947, -0.010615089908242226, -0.01735462062060833, 0.027462918311357498, -0.006280642934143543, 0.004707490559667349, 0.02066608890891075, -0.0010703036095947027, 0.003972159698605537, 0.05977519601583481, 0.05619856342673302, -0.021038785576820374, -0.05340803787112236, 0.03468679264187813 ]
Deploy Hugging Face models easily with Amazon SageMaker
philschmid
July 8, 2021
deploy-hugging-face-models-easily-with-amazon-sagemaker
guide, partnerships, aws
https://huggingface.co/blog/deploy-hugging-face-models-easily-with-amazon-sagemaker
Deploy the model directly after training with the Estimator class If you deploy your model directly after training, you need to ensure that all required model artifacts are saved in your training script, including the tokenizer and the model. A benefit of deploying directly after training is that SageMaker model container metadata will contain the source training job, providing lineage from training job to deployed model. python from sagemaker.huggingface import HuggingFace
[ -0.03878287225961685, 0.006414204835891724, -0.02007703110575676, 0.019481422379612923, 0.029468290507793427, 0.03739766404032707, 0.011980639770627022, -0.00785795133560896, -0.04334467649459839, -0.007890469394624233, -0.04936658591032028, 0.022760361433029175, 0.025385821238160133, 0.08213184028863907, -0.03072093054652214, -0.08853931725025177, 0.053201500326395035, -0.004857326857745647, -0.06394985318183899, 0.02892153710126877, 0.01023974921554327, -0.015677560120821, 0.007889890111982822, -0.02666793391108513, -0.008930650539696217, -0.060841888189315796, 0.03052157536149025, 0.010251573286950588, -0.0004853118443861604, 0.012088539078831673, -0.06914403289556503, -0.0195548627525568, 0.015011978335678577, -0.02665795385837555, 0.012498431839048862, 0.0662529468536377, -0.1373031586408615, 0.023367073386907578, 0.03276953473687172, -0.028591245412826538, -0.04135194048285484, -0.002478497102856636, -0.07954564690589905, 0.05269376188516617, 0.008454771712422371, -0.04920773208141327, -0.14617158472537994, 0.022370602935552597, 0.04359784722328186, 0.00025864026974886656, -0.09736217558383942, 0.06746754050254822, -0.024986980482935905, -0.007839817553758621, 0.020878221839666367, -0.013601920567452908, -0.0016832554247230291, -0.06772495061159134, -0.03502563759684563, -0.043867696076631546, -0.009634186513721943, -0.015627263113856316, 0.014090610668063164, 0.019332511350512505, 0.004541222471743822, 0.004154379945248365, 0.029247699305415154, -0.04582490026950836, -0.04465332627296448, -0.053835660219192505, -0.048349227756261826, -0.050530485808849335, 0.008621446788311005, -0.03403030335903168, -0.04419996961951256, 0.01146792247891426, 0.027333227917551994, 0.0013872691197320819, 0.01513745542615652, 0.08344440907239914, 0.009998871013522148, -0.01333277951925993, -0.013792550191283226, 0.017142346128821373, 0.06592170894145966, 0.026163555681705475, 0.0075343600474298, -0.05203532055020332, -0.06815708428621292, 0.03390425816178322, 0.03460016846656799, -0.06035039201378822, -0.01708383299410343, 0.07997345179319382, 0.052987150847911835, 0.016216346994042397, 0.01181561779230833, 0.06441064924001694, 0.004023431334644556, -0.036737848073244095, -0.031051402911543846, -0.10125217586755753, -0.05231940373778343, -0.021713241934776306, 0.005864487029612064, 0.02829935774207115, -0.006520882248878479, -0.07955493032932281, -0.002197926165536046, 0.03435397893190384, 0.021674051880836487, -0.06015307456254959, -0.027643898501992226, 0.04671907797455788, -0.09567238390445709, 0.04520897567272186, 0.021836254745721817, -0.05194312334060669, 0.06468550860881805, 0.04934912174940109, 0.02062968909740448, 0.08520598709583282, 0.07547357678413391, 0.01561431773006916, -0.02801278606057167, 0.08906237781047821, 0.010890737175941467, -0.008919957093894482, -0.01761026680469513, -0.014589378610253334, 0.007651153020560741, -0.009813420474529266, 0.016110137104988098, 0.03400778770446777, 0.022007860243320465, -0.06034814193844795, 0.0070521715097129345, -0.07759778201580048, 0.04228563234210014, -0.011969630606472492, -0.06931118667125702, 0.13217470049858093, 0.010156846605241299, 0.027208123356103897, 0.053643617779016495, 0.014499286189675331, -0.039311811327934265, -0.00995410606265068, 0.015987196937203407, 0.06624735891819, -0.07717021554708481, 0.059439610689878464, -0.03287467733025551, -0.09324851632118225, 0.02887682057917118, 0.06968584656715393, -0.0577714703977108, 0.03820864483714104, -0.02739856019616127, -0.0006825007731094956, -0.021380223333835602, 0.02090107835829258, -0.04067744314670563, -0.04113432765007019, 0.014386254362761974, -0.038934290409088135, 0.05195368081331253, -0.01899453066289425, 0.10048447549343109, -0.023130321875214577, -0.008804582059383392, -0.07778271287679672, 0.02342871204018593, -0.0017913355259224772, 0.06903202086687088, 0.05791311711072922, -0.00867464579641819, 0.06883560866117477, -0.005713530816137791, -0.0023724334314465523, -0.0036807088181376457, 0.05573130026459694, -0.016614284366369247, -0.013761567883193493, 0.06960928440093994, -0.07866038382053375, 0.013736667111515999, -0.004578398074954748, 0.022942591458559036, -0.003955228254199028, -0.038862258195877075, -0.02578938938677311, 0.028298575431108475, -0.060725804418325424, 0.05020584538578987, -0.027636421844363213, 0.007928958162665367, 0.14964719116687775, 0.03668937832117081, 0.0218912772834301, 0.06290410459041595, -0.003174838377162814, -0.04402611032128334, 0.029935816302895546, -0.01528121903538704, 0.04248819500207901, 0.0008754822774790227, -0.05953037366271019, 0.06560105085372925, 0.01583707518875599, -0.03784633055329323, -0.08653870224952698, -0.020725050941109657, -0.09717203676700592, -0.00006270256562856957, -0.016452735289931297, -0.06138833239674568, -0.021325236186385155, 0.009360083378851414, 0.009192860685288906, 0.13337695598602295, -0.040449269115924835, 0.0635741725564003, -0.07535473257303238, -0.03567090258002281, 0.006063820794224739, 0.05588850378990173, 0.038750000298023224, 0.07094582915306091, -0.07411828637123108, -0.045753445476293564, -0.11434761434793472, -0.0313437320291996, 0.02183504030108452, 0.06057528406381607, -0.026624714955687523, 0.014461680315434933, -0.04236956313252449, -0.03312462195754051, 0.008272414095699787, 0.09698345512151718, -0.041065290570259094, 0.030332384631037712, 0.0013951120199635625, 0.023835396394133568, 0.026965221390128136, 0.06189265847206116, -0.02225913666188717, -0.0987439900636673, -0.03518235683441162, -0.04261890798807144, 0.04028748348355293, 0.017790211364626884, -0.06688910722732544, -0.002130430657416582, 0.02246471308171749, -0.04607227072119713, 0.00032707437640056014, 0.01255154050886631, 0.05117781460285187, -0.007979500107467175, 0.026556620374321938, -0.018637435510754585, -0.01894441246986389, -0.01409720629453659, -0.054775696247816086, -0.030237210914492607, -0.014170023612678051, -0.0025623212568461895, 0.02842712588608265, 0.04034894332289696, -0.0422925166785717, 0.01086537167429924, 0.021391578018665314, -0.010966291651129723, 0.038589704781770706, 0.03136279061436653, -0.0294647254049778, -0.0025492741260677576, 0.00778703298419714, 0.02579968236386776, -0.033255189657211304, -0.013781982474029064, 0.04464314505457878, 0.008229099214076996, -0.008047875948250294, 0.03109419159591198, -0.0004236715321894735, -0.029406435787677765, -0.0019262635614722967, -0.0036521826405078173, 0.03253624588251114, 0.01449189055711031, 0.022476954385638237, 0.014503182843327522, 0.018110495060682297, -0.008713816292583942, -0.02429577149450779, 0.048940129578113556, 0.08612167835235596, -0.04951496422290802, 0.019523276016116142, 0.024998052045702934, 0.0005160903674550354, -0.040283333510160446, 0.016390617936849594, 0.02602452225983143, -0.025732917711138725, -0.08791946619749069, -0.01945202797651291, -0.003852866357192397, -0.01335582323372364, 0.015619765967130661, -0.005715072620660067, 0.05417369678616524, -0.008558887988328934, -0.027407729998230934, 0.01852823980152607, 0.04202577471733093, 0.025818299502134323, -0.010788158513605595, 0.02105032280087471, -0.03836772218346596, 0.02306404337286949, -0.011995983310043812, 0.01291500311344862, 0.0018194630974903703, 0.0640183538198471, -0.054882124066352844, 0.009706082753837109, -0.0023730711545795202, -0.03955526277422905, -0.009203845635056496, 0.015257923863828182, 0.025808503851294518, 0.011251152493059635, 0.011257991194725037, -0.036754727363586426, -0.013293466530740261, -0.05205630511045456, -0.019391505047678947, -0.027552708983421326, -0.06138633191585541, 0.016784807667136192, 0.04074379801750183, 0.038079872727394104, 0.0373842678964138, 0.016881661489605904, 0.019095007330179214, -0.028545327484607697, -0.020340420305728912, 0.031545836478471756, 0.05286835879087448, 0.018397681415081024, 0.03288387507200241, 0.01133920717984438, 0.0325680673122406, -0.013244015164673328, 0.0009974670829251409, -0.016826871782541275, 0.030991144478321075, 0.032391034066677094, 0.006081236060708761, -0.0007075931061990559, 0.038379065692424774, 0.031377870589494705, 0.02650044858455658, -0.01726054958999157, -0.050740037113428116, 0.023528264835476875, -0.0014119696570560336, -0.035911157727241516, -0.01661071367561817, 0.036875542253255844, 0.012692601419985294, 0.015572266653180122, 0.015052198432385921, 0.02390633337199688, -0.011018326506018639, 0.05349293723702431, 0.002604534151032567, 0.015852786600589752, -0.0318116694688797, -0.011017609387636185, -0.020158596336841583, -0.020880088210105896, 0.04592893272638321, 0.036276284605264664, 0.004172175657004118, 0.008376700803637505, 0.00678274454548955, -0.007335815578699112, -0.022609975188970566, 0.025689151138067245, 0.028116850182414055, -0.024329379200935364, 0.01476212590932846, 0.04127884283661842, -0.014535226859152317, -0.04248815029859543, 0.012331907637417316, 0.0031251648906618357, -0.024204211309552193, 0.0321883000433445, -0.0030610980466008186, 0.027879001572728157, -0.001003990531899035, -0.0034090119879692793, -0.002849823795258999, -0.019730761647224426, -0.006334475241601467, -0.01108962669968605, -0.008911197073757648, -0.002751849126070738, -0.023956449702382088, -0.020007522776722908, 0.020771436393260956, -0.029780859127640724, 0.030503930523991585, 0.015730436891317368, 0.017023304477334023, -0.03763030096888542, 0.011894872412085533, 0.05661884322762489, -0.0043667638674378395, -0.014776637777686119, -0.027721136808395386, 0.06450114399194717, -0.013461925089359283, 0.0318392738699913, -0.013581602834165096, -0.005379190668463707, -0.021676762029528618, 0.007927988655865192, 0.02712002396583557, 0.021903660148382187, -0.006762306205928326, -0.009312047623097897, -0.020617688074707985, 0.0019187110010534525, 0.03380554914474487, -0.015418383292853832, -0.008549267426133156, -0.00573809165507555, -0.0029371585696935654, 0.021781178191304207, 0.061399251222610474, -0.002912174677476287, 0.0035829488188028336, 0.0009929316584020853, 0.03873825818300247, -0.04757465422153473, 0.03477325290441513, 0.02538548782467842, -0.06806319952011108, -0.0283549465239048, -0.06850925832986832, 0.046968813985586166, 0.018393393605947495, 0.023262664675712585, -0.02663678117096424, 0.03153304383158684, 0.034306690096855164, -0.03316912427544594, -0.020791448652744293, 0.010479588061571121, 0.05170019343495369, 0.048155512660741806, -0.0015650424174964428, 0.032405368983745575, -0.01987491548061371, -0.0068939970806241035, 0.02181066758930683, 0.01774859055876732, -0.05055312067270279, -0.05951613560318947, 0.0021817274391651154, 0.022355787456035614, -0.00703979330137372, -0.01005756575614214, 0.023854417726397514, -0.020778721198439598, 0.03145552799105644, 0.03958743438124657, 0.0831315666437149, 0.02300942875444889, -0.03261631354689598, 0.005073966924101114, -0.022055596113204956, -0.0006133692804723978, 0.000998554634861648, 0.003780121449381113, -0.03342163562774658, 0.005563388578593731, 0.0981663390994072, 0.0388256311416626, -0.02165316231548786, 0.022713011130690575, 0.00008755425369599834, -0.009760668501257896, 0.022912705317139626, -0.026858722791075706, -0.027041109278798103, -0.0065966821275651455, 0.028061017394065857, 0.031922053545713425, -0.008454049937427044, -0.014531209133565426, 0.0411747545003891, 0.05707566440105438, 0.0011784305097535253, -0.018865665420889854, 0.011096145957708359, -0.006478300783783197, -0.027062062174081802, -0.012792936526238918, 0.030822299420833588, -0.010702034458518028, -0.008530465885996819, -0.010199778713285923, -0.01581299491226673, -0.0037685891147702932, -0.002879227278754115, -0.03291091322898865, -0.029197508469223976, 0.0606314092874527, 0.021833380684256554, 0.02194112539291382, -0.01753723807632923, -0.009570850990712643, -0.00050720403669402, -0.01691853441298008, 0.01717272773385048, -0.05786138027906418, 0.0024170672986656427, 0.03786010667681694, -0.035606179386377335, 0.039080649614334106, -0.03510265797376633, -0.005120653193444014, -0.004298123065382242, 0.024169644340872765, -0.004673689603805542, 0.00414389930665493, -0.025919657200574875, 0.03873209282755852, 0.028769388794898987, -0.0426170751452446, 0.008685941807925701, -0.0020236573182046413, -0.04251735657453537, -0.0023901723325252533, -0.06784806400537491, 0.05282899737358093, 0.05204581841826439, -0.00990921352058649, -0.007256730925291777, 0.02827993780374527, -0.017915304750204086, 0.027228623628616333, 0.005446573719382286, 0.01919613778591156, 0.027481870725750923, -0.003822058904916048, -0.022713346406817436, 0.04274129495024681, -0.004782245960086584, -0.0206389632076025, 0.006464228965342045, -0.051068007946014404, 0.02057841420173645, 0.012271957471966743, -0.010175717994570732, -0.0023479475639760494, -0.019677776843309402, -0.046005360782146454, 0.012030771002173424, -0.0030667127575725317, 0.03894265741109848, 0.027959449216723442, -0.018925737589597702, -0.0028496580198407173, 0.028312036767601967, -0.01588437333703041, 0.00436089001595974, 0.057666316628456116, -0.027892697602510452, 0.04506003484129906, -0.028002597391605377, 0.037278369069099426, 0.030238088220357895, -0.007215607911348343, 0.00686793215572834, -0.013816898688673973, 0.023576946929097176, -0.008692045696079731, 0.016787683591246605, 0.05627448856830597, -0.00709275808185339, 0.016030203551054, -0.0225752592086792, -0.023008577525615692, -0.0073885489255189896, 0.011691847816109657, -0.001771904295310378, 0.018548112362623215, 0.022330036386847496, -0.006801140960305929, 0.06336280703544617, 0.0349554605782032, 0.014099388383328915, 0.01776828244328499, 0.020676417276263237, 0.04615538939833641, 0.044128578156232834, 0.0012311396421864629, 0.060225650668144226, -0.014523591846227646, 0.005252505652606487, 0.019636990502476692, 0.03811398521065712, 0.015231839381158352, 0.010788816958665848, 0.013005762360990047, -0.02088991552591324, -0.002690529217943549, -0.008947154507040977, -0.02250521071255207, 0.025131583213806152, -0.06223059445619583, -0.015719011425971985, 0.04353434219956398, -0.02800906077027321, 0.04071425646543503, -0.04152419790625572, 0.01167273335158825, -0.04214728623628616, -0.02207689918577671, 0.009351391345262527, 0.0278420839458704, 0.051411788910627365, -0.056785453110933304, -0.020459569990634918, -0.0008231091778725386, 0.040060024708509445, -0.019860776141285896, -0.017723245546221733, -0.021770400926470757, 0.013717121444642544, -0.014475412666797638, -0.0037408587522804737, 0.0033318849746137857, -0.030803518369793892, -0.0092695914208889, 0.016781209036707878, 0.01755082979798317, 0.006091327406466007, 0.021986104547977448, 0.011631623841822147, 0.033610522747039795, -0.018322208896279335, -0.021813903003931046, -0.02353009395301342, -0.026849329471588135, 0.022433454170823097, -0.045113455504179, -0.012898072600364685, -0.0007471232675015926, 0.04936925694346428, 0.023934708908200264, 0.006599582731723785, -0.004975087475031614, -0.015637129545211792, -0.026368115097284317, 0.02812562882900238, -0.009804167784750462, 0.011233328841626644, 0.01886417157948017, 0.0029746643267571926, 0.007055521942675114, 0.008282202295958996, -0.000029330551114981063, -0.002204188844189048, 0.01273638941347599, 0.030880020931363106, -0.032070502638816833, -0.009266860783100128, 0.0005946708843111992, 0.0436863973736763, -0.008139659650623798, 0.022954760119318962, 0.019171910360455513, 0.015229371376335621, -0.002271038480103016, -0.048299640417099, 0.022984609007835388, -0.046398237347602844, -0.022593891248106956, -0.014506504870951176, -0.055494338274002075, -0.018959978595376015, -0.049856483936309814, -0.023980796337127686, 0.028684567660093307, -0.014266419224441051, 0.00920790247619152, 0.002417387207970023, -0.003180214436724782, -0.02413003146648407, -0.000011682157492032275, 0.07711580395698547, 0.06609666347503662, 0.026778437197208405, 0.025826886296272278, -0.04653973504900932, 0.02571258693933487, 0.01946285180747509, 0.018779726698994637, 0.044077157974243164, 0.006182911805808544, -0.0033442184794694185, 0.00293475273065269, 0.006738082971423864, -0.009987208060920238, -0.04248184710741043, 0.009718176908791065, -0.010847930796444416, -0.03801621124148369, -0.05474616214632988, -0.011178329586982727, 0.04776264354586601, -0.013747245073318481, 0.026447027921676636, -0.010770839639008045, -0.011461425572633743, -0.029506860300898552, 0.037889204919338226, -0.05894883722066879, -0.004206859041005373, -0.023995744064450264, -0.02086026966571808, 0.037501998245716095, 0.026286400854587555, 0.009564334526658058, -0.018916789442300797, -0.031840577721595764, 0.011498992331326008, -0.032040443271398544, -0.050563279539346695, -0.07243931293487549, -0.002892308635637164, 0.01341004017740488, -0.026000244542956352, -0.02981143817305565, -0.02565634623169899, -0.018041983246803284, -0.005834836978465319, 0.01619773358106613, 0.02304038591682911, 0.024743955582380295, 0.015162915922701359, -0.006061073392629623, 0.015059825964272022, 0.015361601486802101, 0.030528582632541656, -0.038913339376449585, -0.053506892174482346, 0.004911262076348066 ]
Deploy Hugging Face models easily with Amazon SageMaker
philschmid
July 8, 2021
deploy-hugging-face-models-easily-with-amazon-sagemaker
guide, partnerships, aws
https://huggingface.co/blog/deploy-hugging-face-models-easily-with-amazon-sagemaker
Setting up the environment We will use an Amazon SageMaker Notebook Instance for the example. You can learn here how to set up a Notebook Instance. To get started, jump into your Jupyter 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 API calls 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.48.0" --upgrade To deploy a model on SageMaker, we need to create a sagemaker Session and provide an IAM role with the right permission. The get_execution_role method is provided by the SageMaker SDK as an optional convenience. You can also specify the role by writing the specific role ARN you want your endpoint to use. This IAM role will be later attached to the Endpoint, e.g. download the model from Amazon S3. python import sagemaker sess = sagemaker.Session() role = sagemaker.get_execution_role() ---
[ 0.040437985211610794, 0.020723050460219383, 0.0012189008994027972, 0.06283821165561676, 0.070991151034832, 0.07342047244310379, -0.004887162242084742, 0.026702741160988808, -0.035681433975696564, -0.019780941307544708, -0.030452044680714607, 0.00982836727052927, -0.007529142778366804, 0.10727832466363907, 0.004442041274160147, -0.0419841930270195, 0.03919358551502228, 0.008238608948886395, -0.010170388966798782, 0.009720631875097752, 0.029956024140119553, -0.027799002826213837, -0.02692980132997036, 0.04503624141216278, 0.012601181864738464, -0.07909633219242096, 0.05219558626413345, 0.04427861049771309, -0.032500315457582474, 0.03264378011226654, -0.0641208067536354, 0.001232325448654592, -0.007634287234395742, -0.028565431013703346, 0.045119352638721466, 0.0500495620071888, -0.10601112991571426, 0.04963585361838341, 0.04008486121892929, -0.06591688096523285, -0.004114392679184675, -0.021648835390806198, -0.04307488352060318, 0.05026737228035927, -0.024348845705389977, -0.03030284121632576, -0.15914969146251678, 0.05457799881696701, 0.037665124982595444, -0.006011673249304295, -0.138808473944664, 0.0898166224360466, 0.013314412906765938, -0.0572982020676136, 0.011175557039678097, 0.029039349406957626, 0.028944717720150948, -0.0448446050286293, 0.000001400522364747303, -0.02309287153184414, 0.020344197750091553, -0.0327891930937767, -0.05058795586228371, -0.014483442530035973, 0.03730390593409538, -0.014036457985639572, 0.029598338529467583, -0.039067406207323074, -0.01981784775853157, -0.03692623972892761, -0.01499389111995697, -0.05750980228185654, -0.013026476837694645, -0.025096487253904343, -0.04608415439724922, -0.1272568255662918, 0.029920948669314384, 0.02023141272366047, 0.04824838042259216, 0.09255148470401764, 0.0253719724714756, 0.005316714756190777, -0.0313907191157341, 0.017454445362091064, 0.04091305285692215, -0.017996778711676598, 0.0067507377825677395, -0.04347983002662659, -0.002116141375154257, 0.04788621887564659, 0.03990112990140915, -0.04862241446971893, 0.03807714581489563, 0.02173304185271263, 0.019811594858765602, -0.0186985582113266, 0.012265564873814583, -0.016600238159298897, 0.009440271183848381, -0.05167415365576744, 0.03132953122258186, -0.0467059388756752, 0.0024861411657184362, -0.03379247710108757, -0.021516500040888786, 0.09097138792276382, 0.038789067417383194, -0.08676433563232422, -0.009245229884982109, 0.014162176288664341, 0.017602216452360153, 0.0031119557097554207, -0.02545962668955326, 0.06827499717473984, -0.06993532925844193, 0.06525484472513199, 0.019004879519343376, -0.023063307628035545, 0.03141748160123825, 0.026051072403788567, 0.062253594398498535, 0.07964926213026047, 0.06960251182317734, 0.023660879582166672, 0.007620607037097216, 0.08111390471458435, 0.023495642468333244, -0.023055320605635643, -0.016888244077563286, -0.0884380117058754, 0.09362118691205978, -0.02469812147319317, 0.08426409214735031, -0.004661393351852894, 0.026050865650177002, -0.016048908233642578, -0.004040555562824011, -0.052775245159864426, 0.0467367060482502, 0.04069682955741882, 0.02574305236339569, 0.06572356075048447, 0.04830222576856613, 0.089508555829525, 0.06976756453514099, 0.03156347572803497, -0.019056404009461403, -0.004347706213593483, 0.00023321596381720155, 0.06891366094350815, -0.055977191776037216, 0.01852029748260975, -0.03877303749322891, -0.061467401683330536, -0.02392716147005558, 0.05619088560342789, -0.02852078713476658, 0.020659511908888817, -0.053266800940036774, -0.02878456376492977, 0.05013608559966087, -0.012545180507004261, -0.04851723089814186, -0.03870493173599243, 0.025305718183517456, -0.01714220643043518, 0.084680937230587, -0.018471691757440567, 0.05076155811548233, -0.07574553787708282, -0.019232233986258507, -0.04717053100466728, 0.05141521617770195, 0.04247421771287918, 0.07150228321552277, 0.0364048033952713, 0.05995788797736168, 0.023791417479515076, 0.021700380370020866, -0.008721411228179932, -0.035643208771944046, 0.0815485268831253, -0.058845143765211105, 0.04372046887874603, 0.07418589293956757, -0.0693577378988266, 0.04372580349445343, -0.014464651234447956, -0.00841379351913929, 0.005508507136255503, -0.05987165495753288, -0.04997909069061279, 0.04820488393306732, 0.004509130958467722, 0.033687058836221695, 0.007763520814478397, 0.003258615033701062, 0.10433510690927505, 0.014850201085209846, 0.05079842358827591, 0.020299343392252922, 0.023388732224702835, 0.01245013065636158, 0.025090014562010765, -0.04066341370344162, 0.07153616100549698, 0.011306164786219597, -0.06280912458896637, 0.0907391905784607, 0.008207463659346104, -0.031191768124699593, -0.12012123316526413, 0.011651049368083477, -0.10003521293401718, -0.02913133054971695, 0.015295279212296009, -0.07776041328907013, 0.004585389979183674, 0.023927373811602592, 0.04044630005955696, 0.1497374176979065, -0.03080899827182293, 0.040113117545843124, -0.013068106956779957, -0.008205246180295944, 0.017764559015631676, 0.06497066468000412, 0.06531545519828796, 0.05994433909654617, -0.043136175721883774, -0.05014174059033394, -0.026015207171440125, -0.012255795300006866, 0.049247849732637405, 0.007225073873996735, 0.010338447988033295, -0.0165408942848444, -0.04785016551613808, 0.020105035975575447, 0.006874407641589642, 0.09301216900348663, 0.020833279937505722, -0.03744267672300339, 0.010031363926827908, 0.016784388571977615, -0.06577792018651962, 0.08537866175174713, -0.009268452413380146, -0.028409363701939583, -0.03450657054781914, -0.0915663093328476, -0.010095912963151932, 0.01185248326510191, 0.018429424613714218, 0.062148574739694595, 0.05031855031847954, -0.027531979605555534, 0.0012342248810455203, 0.038812365382909775, 0.05013632774353027, -0.0015499312430620193, 0.017818203195929527, -0.007904291152954102, -0.04849574342370033, -0.0264047309756279, 0.004199034534394741, 0.0064201620407402515, -0.05809598043560982, 0.007435405161231756, -0.017347197979688644, 0.051158562302589417, -0.06327992677688599, 0.018169213086366653, 0.016139574348926544, -0.026777751743793488, 0.019227683544158936, 0.01901218108832836, 0.010819555260241032, 0.007593084126710892, -0.00636197067797184, 0.00846728216856718, -0.049645181745290756, 0.016273867338895798, 0.01433271262794733, 0.030910616740584373, -0.0016136553604155779, 0.019515525549650192, -0.03217839077115059, -0.040622759610414505, -0.0015994725981727242, 0.00156788423191756, 0.031417299062013626, 0.017351051792502403, 0.0088024428114295, 0.020159652456641197, 0.005823748651891947, -0.0013827970251441002, -0.024375252425670624, -0.0075958166271448135, 0.028820009902119637, -0.03526068851351738, -0.03585732355713844, 0.01146674994379282, -0.016712944954633713, -0.0524187870323658, 0.003898350987583399, 0.0341741144657135, -0.026033615693449974, -0.11082595586776733, -0.014579951763153076, -0.01104761939495802, 0.016048626974225044, 0.015986334532499313, -0.005959575064480305, 0.08494772017002106, 0.019718410447239876, -0.03790830075740814, 0.018197443336248398, -0.027661629021167755, 0.015347639098763466, 0.011795977130532265, -0.02022360824048519, -0.02471797727048397, 0.017393719404935837, 0.0042663449421525, -0.010513246059417725, 0.016230711713433266, 0.006572824437171221, -0.041940782219171524, 0.04265474155545235, -0.0023106681182980537, -0.041178178042173386, 0.007418408524245024, -0.01308373548090458, 0.01638464257121086, 0.031654879450798035, 0.014970364980399609, -0.010519555769860744, -0.018694855272769928, -0.031334687024354935, -0.018713220953941345, -0.016117678955197334, -0.04198937490582466, -0.027633868157863617, -0.006798517890274525, 0.0424904003739357, 0.02703668922185898, 0.02182687446475029, -0.009356803260743618, -0.011328971944749355, 0.0006550184916704893, -0.01134759932756424, 0.015250646509230137, 0.009095502085983753, 0.00462110573425889, 0.012758780270814896, 0.03071957640349865, -0.01049540564417839, -0.020044736564159393, 0.0018402740824967623, 0.0034467019140720367, 0.025299644097685814, 0.00185767759103328, -0.009265029802918434, 0.00254993699491024, 0.06824222207069397, 0.031351760029792786, -0.01602042280137539, -0.01756538636982441, 0.02601061575114727, 0.03307167440652847, -0.0062293969094753265, -0.0017719711177051067, 0.04035164788365364, 0.02247890643775463, 0.025805801153182983, -0.013300483115017414, 0.0297666247934103, -0.02335989475250244, 0.03725123777985573, -0.006644771434366703, 0.01578209362924099, -0.011920728720724583, -0.008277230896055698, 0.0038348701782524586, -0.03340261057019234, 0.04683373123407364, 0.04281361401081085, -0.003099719760939479, -0.03024902008473873, -0.0036037659738212824, -0.021587258204817772, 0.0153950285166502, 0.02529715746641159, 0.017161043360829353, -0.037223026156425476, 0.039136674255132675, 0.06662125885486603, 0.0157039612531662, -0.05952070280909538, 0.03011770360171795, -0.02211577631533146, -0.010033929720520973, -0.029426591470837593, 0.021955439820885658, -0.03688662499189377, -0.0034610286820679903, 0.009240646846592426, -0.009830808266997337, -0.012637456879019737, -0.018255067989230156, 0.010632500983774662, -0.017100485041737556, -0.008852928876876831, -0.05373070761561394, -0.037956953048706055, -0.0493459589779377, -0.02477164939045906, 0.012889011763036251, 0.009482474997639656, 0.01637464575469494, -0.03223112225532532, 0.006316732615232468, 0.05236607417464256, 0.019557088613510132, -0.024436764419078827, -0.0037617110647261143, 0.06184588745236397, -0.04539322480559349, 0.016352560371160507, -0.010102132335305214, -0.0514228418469429, -0.011158582754433155, -0.012847674079239368, 0.011525589041411877, 0.024331973865628242, -0.036923136562108994, -0.02239048480987549, -0.02115866355597973, -0.001974336802959442, 0.025503380224108696, 0.002621309831738472, -0.00020502213737927377, 0.009879682213068008, 0.007216167636215687, 0.03977566957473755, 0.030326414853334427, 0.012145132757723331, 0.009380253963172436, -0.0060376571491360664, 0.040871843695640564, -0.04081365466117859, 0.03646645322442055, 0.017674915492534637, -0.06896427273750305, -0.01201690174639225, -0.04928005859255791, 0.028041046112775803, 0.014141802676022053, 0.029538864269852638, -0.012742698192596436, 0.0017086198786273599, 0.010207541286945343, -0.01163850910961628, 0.014125004410743713, 0.0038646068423986435, 0.017953066155314445, 0.07274655997753143, -0.02105855755507946, -0.01850377582013607, 0.0007432184647768736, -0.012194445356726646, 0.02815522812306881, 0.029965458437800407, -0.017743663862347603, -0.03239407390356064, -0.017507217824459076, 0.018326302990317345, -0.0558527410030365, -0.023804742842912674, 0.01542828232049942, -0.03410039097070694, 0.013913650065660477, 0.038441259413957596, 0.05372766777873039, 0.04115947708487511, -0.009536373429000378, 0.019540023058652878, -0.018850034102797508, -0.018472550436854362, -0.022314727306365967, -0.00464465469121933, -0.022432435303926468, 0.01699659787118435, 0.05039205774664879, 0.02818843349814415, 0.010358643718063831, 0.038753360509872437, -0.02421439066529274, -0.002080513397231698, 0.02851812355220318, -0.052141591906547546, -0.013937906362116337, 0.009468190371990204, -0.008541454561054707, -0.00036255415761843324, -0.011177229695022106, -0.026502270251512527, -0.002002260647714138, 0.05221269652247429, -0.030287887901067734, -0.03746943920850754, 0.04582986608147621, -0.015351570211350918, 0.0030780720990151167, 0.005541038233786821, 0.013994983397424221, -0.004281568340957165, -0.009822087362408638, 0.024131538346409798, 0.009011002257466316, 0.00463625555858016, -0.022360844537615776, -0.019565340131521225, -0.03380575403571129, 0.042515404522418976, 0.028247972950339317, 0.04095900058746338, -0.02096923626959324, -0.02362770587205887, 0.02859771065413952, 0.012688221409916878, -0.014172310009598732, -0.02449251525104046, -0.015996264293789864, 0.021533731371164322, -0.03746257722377777, 0.017329279333353043, 0.02518238127231598, 0.0016901438357308507, -0.01008486095815897, 0.009909538552165031, 0.03613797947764397, -0.050070419907569885, -0.029468214139342308, 0.024801980704069138, 0.010359535925090313, 0.003995145205408335, -0.02710224874317646, -0.036584459245204926, -0.01596260629594326, -0.020595520734786987, -0.05456843227148056, 0.008820435032248497, 0.057467397302389145, -0.014014684595167637, 0.017348608002066612, -0.023273594677448273, -0.010366163216531277, 0.02997874841094017, 0.03833095356822014, -0.021526310592889786, 0.011806193739175797, 0.018731338903307915, 0.005805084481835365, 0.01318147499114275, 0.018594682216644287, -0.027746614068746567, 0.016873467713594437, -0.04599833860993385, -0.002142044948413968, 0.012320430018007755, -0.03294268250465393, 0.012807568535208702, -0.00012412121577654034, -0.05104000121355057, -0.00026208945200778544, -0.007310778833925724, 0.041282929480075836, 0.03797969967126846, 0.0015946137718856335, -0.02553827129304409, 0.00887561310082674, -0.0031424358021467924, 0.021666167303919792, 0.05220246687531471, -0.06466019153594971, 0.019127773120999336, -0.017491884529590607, 0.06415631622076035, 0.01616344228386879, -0.008352011442184448, 0.02106793038547039, 0.015495252795517445, 0.08016346395015717, -0.006549825891852379, 0.02794085443019867, 0.01881367154419422, -0.012698073871433735, -0.023767728358507156, -0.03347503021359444, 0.005509591195732355, -0.03600487485527992, 0.012739225290715694, 0.013171433471143246, -0.04179329797625542, 0.027424335479736328, -0.06048746779561043, 0.05956331267952919, 0.03748703375458717, 0.03126664459705353, 0.03751004487276077, -0.0042068008333444595, 0.035825494676828384, 0.0005432703765109181, -0.02663019485771656, 0.021784117445349693, 0.009868545457720757, 0.014579054899513721, 0.01296177413314581, 0.0009401011629961431, 0.024832913652062416, -0.027421316131949425, -0.03064860589802265, -0.0049667940475046635, -0.0362589992582798, -0.009813191369175911, -0.01789136789739132, 0.037012744694948196, -0.05951353535056114, -0.03207740932703018, 0.009057490155100822, -0.04820225387811661, 0.010246389545500278, -0.03468882665038109, -0.007743400987237692, -0.004814538639038801, -0.04302957281470299, -0.018687358126044273, 0.01026273611932993, 0.007910787127912045, -0.045552849769592285, -0.03521597757935524, 0.05026374012231827, -0.010555128566920757, -0.02538001537322998, -0.032828524708747864, -0.03924992308020592, -0.025262881070375443, -0.007401218172162771, -0.017096275463700294, 0.020921755582094193, -0.031076427549123764, -0.014177030883729458, 0.011165983974933624, 0.02220340631902218, -0.0028625845443457365, 0.03153916448354721, 0.030926575884222984, 0.03475005924701691, -0.004886199254542589, 0.0191920455545187, -0.028864465653896332, -0.04521986469626427, 0.015362599864602089, -0.022045200690627098, 0.029718728736042976, -0.009760385379195213, 0.035333871841430664, -0.014369235374033451, -0.013272479176521301, 0.009289958514273167, 0.0046047428622841835, 0.010242262855172157, 0.018154200166463852, -0.044211938977241516, 0.04627573862671852, 0.019379423931241035, 0.021085714921355247, 0.007615822833031416, -0.01041361503303051, 0.015476452186703682, 0.00618303706869483, -0.0006595158483833075, 0.000018590528270578943, -0.005540802143514156, -0.005569326225668192, -0.025185516104102135, 0.03954935073852539, -0.002540002344176173, 0.053911179304122925, 0.004346734844148159, -0.0065954579040408134, 0.011427289806306362, -0.026340702548623085, -0.01072912011295557, -0.046899210661649704, 0.014464366249740124, -0.054996900260448456, -0.038268499076366425, -0.032283708453178406, -0.025316204875707626, -0.01568199135363102, 0.02223489060997963, -0.043200694024562836, -0.016277432441711426, -0.028661513701081276, 0.008000975474715233, -0.01210055872797966, -0.010567973367869854, 0.05324862524867058, 0.048593226820230484, 0.0025190128944814205, -0.019899815320968628, -0.05923493206501007, 0.011551649309694767, 0.01654835417866707, 0.01447791326791048, 0.03278874605894089, -0.02985183708369732, -0.006606613285839558, -0.009982526302337646, 0.043379560112953186, 0.0013198794331401587, -0.04723266512155533, 0.022726593539118767, 0.020896516740322113, -0.04037097096443176, -0.04915456101298332, 0.00907634012401104, 0.026151388883590698, 0.014914993196725845, 0.02880021743476391, -0.007723197806626558, -0.017139779403805733, 0.009393073618412018, -0.012657378800213337, -0.05610780790448189, -0.033189352601766586, -0.024156570434570312, -0.044443871825933456, 0.03498656302690506, -0.017556851729750633, -0.032696112990379333, -0.039760127663612366, -0.02580682374536991, 0.00013317682896740735, 0.0014996984973549843, -0.06666051596403122, -0.02746129035949707, 0.011483963578939438, 0.06191548705101013, -0.040315479040145874, -0.049308888614177704, -0.03501959517598152, -0.02424984611570835, -0.027842290699481964, -0.0048714326694607735, 0.010706979781389236, 0.02318057045340538, -0.0424579456448555, 0.03015240840613842, -0.007094358094036579, 0.04027944430708885, 0.021944573149085045, -0.015131520107388496, -0.002021791646257043, 0.019642185419797897 ]
Deploy Hugging Face models easily with Amazon SageMaker
philschmid
July 8, 2021
deploy-hugging-face-models-easily-with-amazon-sagemaker
guide, partnerships, aws
https://huggingface.co/blog/deploy-hugging-face-models-easily-with-amazon-sagemaker
Deploy the model from pre-trained checkpoints using the HuggingFaceModel class If you've already trained your model and want to deploy it at some later time, you can use the model_data argument to specify the location of your tokenizer and model weights. python from sagemaker.huggingface.model import HuggingFaceModel # create Hugging Face Model Class huggingface_model = HuggingFaceModel( model_data="s3://models/my-bert-model/model.tar.gz", # path to your trained sagemaker model role=role, # iam role with permissions to create an Endpoint transformers_version="4.6", # transformers version used pytorch_version="1.7", # pytorch version used ) # deploy model to SageMaker Inference predictor = huggingface_model.deploy( initial_instance_count=1, instance_type="ml.m5.xlarge" ) # example request, you always need to define "inputs" data = { "inputs": "Camera - You are awarded a SiPix Digital Camera! call 09061221066 fromm landline. Delivery within 28 days." } # request predictor.predict(data) After we run our request, we can delete the endpoint again with: python # delete endpoint predictor.delete_endpoint()
[ -0.009199921041727066, 0.026271557435393333, -0.018146589398384094, -0.006835750304162502, 0.04367649555206299, 0.14506196975708008, 0.028592875227332115, 0.018887871876358986, 0.010484907776117325, 0.02383418008685112, -0.08598583191633224, 0.009828292764723301, -0.00016360290464945138, 0.07623885571956635, -0.0012886282056570053, -0.06881534308195114, 0.007256064563989639, -0.0019602233078330755, -0.026033461093902588, -0.0028289807960391045, 0.024355294182896614, -0.04819842800498009, 0.018678564578294754, 0.005314273294061422, 0.0006043717730790377, -0.03444848954677582, 0.021554255858063698, 0.04609488695859909, 0.037155814468860626, 0.04696331173181534, -0.038496822118759155, -0.024132991209626198, 0.012315048836171627, -0.00014879247464705259, 0.045686379075050354, 0.0339597649872303, -0.10696063190698624, 0.035738036036491394, 0.019404368475079536, -0.03316892683506012, -0.05396103486418724, 0.03435236215591431, -0.03794562444090843, 0.03333178535103798, 0.019008591771125793, -0.05647411197423935, -0.09505703300237656, 0.0676075667142868, 0.026334788650274277, -0.0002866474096663296, -0.09660892933607101, 0.08104484528303146, -0.00008140339195961133, -0.008710494264960289, 0.0051842257380485535, -0.002944422885775566, -0.00051068514585495, -0.11706814169883728, -0.01302324328571558, -0.004227167926728725, -0.015840381383895874, -0.0008561168215237558, 0.017781002447009087, 0.014985303394496441, 0.023911157622933388, 0.023413430899381638, 0.042820997536182404, -0.035290688276290894, -0.04547223076224327, -0.055285461246967316, -0.006565323565155268, -0.06102002039551735, -0.0024113161489367485, -0.020978089421987534, -0.047292303293943405, -0.02730705589056015, 0.004716754425317049, -0.012434838339686394, 0.004765306133776903, 0.11576569080352783, -0.005826481152325869, -0.000049657519411994144, -0.01150138583034277, -0.0306196678429842, 0.038292739540338516, 0.017091969028115273, 0.04384681582450867, -0.047001954168081284, -0.045054059475660324, 0.014977267943322659, 0.005164645612239838, -0.04267582669854164, -0.012842289172112942, 0.017984546720981598, 0.03874551132321358, -0.010300320573151112, -0.030984556302428246, 0.002252604579553008, 0.020738163962960243, -0.06435395777225494, 0.022371644154191017, -0.09457679837942123, -0.009297238662838936, -0.013354538939893246, -0.007799558341503143, 0.07766120880842209, 0.03433844819664955, -0.08177308738231659, -0.005608607083559036, 0.0018627141835168004, 0.03677007928490639, -0.08706627786159515, -0.02907443605363369, 0.06226109340786934, -0.08672744035720825, 0.008883962407708168, 0.01489681750535965, -0.03005041554570198, 0.0485406368970871, 0.015977345407009125, 0.040863290429115295, 0.09387901425361633, 0.04204397276043892, 0.004952854942530394, -0.0015892848605290055, 0.07865358889102936, 0.01542519312351942, 0.017175311222672462, -0.018966877833008766, -0.028013989329338074, 0.05989077687263489, -0.056358251720666885, 0.049189191311597824, 0.0068610915914177895, 0.058400701731443405, -0.05434861034154892, 0.03686199337244034, -0.06517544388771057, 0.03616657853126526, 0.010761624202132225, -0.02102130465209484, 0.11290335655212402, -0.008786785416305065, 0.03513467311859131, 0.1011064201593399, -0.0018957997672259808, -0.030647778883576393, 0.04451431334018707, 0.023120155557990074, 0.07404699921607971, -0.10308098047971725, 0.03507372736930847, 0.0032839321065694094, -0.08088367432355881, -0.01726371794939041, 0.07193659991025925, -0.05224715545773506, 0.0733175277709961, -0.0622541643679142, -0.013381876982748508, 0.00480574881657958, 0.04293825104832649, -0.04334268718957901, -0.0013148251455277205, -0.0011549672344699502, -0.0024823835119605064, 0.04736322909593582, -0.02951228804886341, 0.06919416040182114, -0.011067763902246952, 0.011278916150331497, -0.08110196888446808, 0.07126548886299133, 0.03773524612188339, 0.05563456937670708, 0.04597676172852516, 0.050617244094610214, 0.06482589244842529, -0.03480454161763191, -0.008307048119604588, -0.02597230114042759, 0.06906688958406448, -0.014161938801407814, 0.0057436078786849976, 0.08196844160556793, -0.03670438751578331, 0.023282404989004135, 0.005072844214737415, -0.014930483885109425, -0.009952195920050144, -0.04362998902797699, -0.03533858060836792, 0.029799934476614, -0.013408483937382698, 0.02924051508307457, -0.03636925667524338, -0.03342471644282341, 0.09894021600484848, -0.004034528508782387, 0.04901838302612305, 0.04885663837194443, -0.004301169887185097, -0.019006451591849327, 0.0039891996420919895, -0.04149339348077774, 0.043920934200286865, -0.039561185985803604, -0.06623055785894394, 0.0652305856347084, 0.04918545112013817, 0.022956756874918938, -0.10119413584470749, -0.005824609659612179, -0.09411202371120453, -0.014901659451425076, -0.04694966971874237, -0.09340749680995941, -0.018440617248415947, -0.03455057367682457, 0.013290858827531338, 0.1530797928571701, -0.04130091518163681, 0.017941899597644806, -0.05976681783795357, -0.0005007396684959531, -0.00885024294257164, 0.026946041733026505, 0.08039163053035736, 0.10770238935947418, -0.05864287540316582, -0.06418581306934357, -0.11039824783802032, -0.024505140259861946, 0.05241330340504646, 0.010866654105484486, 0.019394539296627045, -0.009158623404800892, -0.05773509293794632, -0.011120535433292389, -0.022907715290784836, 0.06891148537397385, -0.011145408265292645, 0.018531547859311104, 0.0031624268740415573, 0.009092134423553944, 0.018039589747786522, 0.0486794151365757, -0.0010217346716672182, -0.06578077375888824, 0.0031437515281140804, -0.06926527619361877, 0.014965455047786236, -0.004618349485099316, -0.03815816715359688, 0.01937161572277546, 0.041440077126026154, -0.034183330833911896, 0.03524787724018097, -0.010189233347773552, 0.07113446295261383, 0.01119169034063816, 0.0013548786519095302, -0.0458691380918026, -0.03242417052388191, -0.02268906682729721, -0.027228133752942085, -0.031169069930911064, -0.02542918175458908, 0.007536706514656544, 0.00823113415390253, 0.05887249484658241, -0.06605261564254761, 0.021228116005659103, 0.049753587692976, 0.00991464126855135, 0.06847555190324783, 0.025198955088853836, 0.017467716708779335, -0.020793341100215912, 0.006869736593216658, 0.0315859355032444, -0.06021812930703163, 0.003393677296116948, 0.029946891590952873, 0.0065688882023096085, 0.006408895831555128, 0.0314892902970314, -0.028572997078299522, -0.037730250507593155, -0.00889941118657589, -0.002623564563691616, 0.063855841755867, 0.021546708419919014, 0.006083108484745026, -0.010331492871046066, 0.01581406034529209, 0.03146433085203171, -0.01898268423974514, 0.03050416335463524, 0.05405180901288986, -0.05421720817685127, 0.019025573506951332, 0.006367452442646027, -0.018657224252820015, -0.03263142704963684, 0.0073004537262022495, 0.03638709336519241, 0.0004681686114054173, -0.0837213546037674, -0.017672136425971985, -0.0038376031443476677, -0.03902169689536095, 0.00860593281686306, -0.016586406156420708, 0.04735051095485687, -0.008717454969882965, -0.05190841108560562, 0.029649823904037476, 0.018688730895519257, 0.017080042511224747, 0.01570947840809822, -0.013233158737421036, -0.015981590375304222, 0.02195640839636326, -0.018285559490323067, -0.029939847066998482, 0.012837382964789867, 0.030810566619038582, -0.04167097061872482, 0.026872416958212852, 0.019045483320951462, -0.04456014186143875, 0.008404967375099659, -0.006194313056766987, 0.01859929785132408, 0.022593948990106583, 0.03139515221118927, -0.04779646545648575, -0.03406262770295143, -0.05933453515172005, -0.00976272951811552, -0.03325267508625984, -0.037783071398735046, -0.01022779755294323, 0.030700039118528366, 0.04115750640630722, 0.011027050204575062, -0.005350531544536352, -0.006907010916620493, -0.009417403489351273, -0.014379327185451984, 0.029679788276553154, 0.055094216018915176, 0.0216499213129282, 0.04061967507004738, -0.002474541310220957, 0.04946774244308472, -0.023623516783118248, -0.005526337772607803, 0.008314549922943115, -0.006934376433491707, 0.026481613516807556, -0.00046354043297469616, -0.013628693297505379, 0.042418621480464935, 0.03359382972121239, 0.0054822866804897785, 0.0070463442243635654, -0.041297394782304764, 0.006735140923410654, -0.026448769494891167, -0.025319766253232956, -0.004880975000560284, 0.017956692725419998, 0.003378139575943351, -0.009726074524223804, 0.0011876069474965334, 0.02596222423017025, -0.013543357141315937, 0.040523286908864975, 0.009082035161554813, 0.01355159841477871, -0.026031481102108955, 0.016941260546445847, -0.023428423330187798, -0.04093433916568756, 0.02572469972074032, 0.02527477964758873, 0.013582500629127026, -0.015391647815704346, -0.021963201463222504, -0.01018615160137415, -0.022104017436504364, -0.017222775146365166, 0.020969826728105545, -0.035332560539245605, 0.030080242082476616, 0.03461744636297226, -0.040288057178258896, -0.05334066227078438, 0.0167680773884058, -0.013029399327933788, -0.021017054095864296, -0.04108850285410881, -0.0042089601047337055, -0.004192685708403587, -0.008254313841462135, -0.03714027628302574, -0.02129480242729187, -0.016038626432418823, -0.020328586921095848, -0.006197336595505476, -0.008226554840803146, -0.0037906344514340162, -0.023724710568785667, -0.02883072756230831, -0.022932520136237144, -0.027787188068032265, 0.020823558792471886, 0.0331864170730114, 0.009664444252848625, -0.027568459510803223, 0.00862609688192606, 0.05480947345495224, -0.020070068538188934, -0.007838080637156963, -0.00877402164041996, 0.03647669032216072, -0.06199673190712929, -0.0018801453988999128, -0.006833069492131472, -0.04964388161897659, 0.00015876661927904934, 0.0015808898024260998, 0.027897143736481667, 0.036142803728580475, -0.0077147698029875755, -0.021694425493478775, -0.031657859683036804, 0.009415369480848312, 0.045812107622623444, 0.0018461410654708743, 0.001875795191153884, 0.04177740961313248, -0.03286756947636604, 0.025191696360707283, 0.04955277219414711, 0.015255890786647797, -0.01372163649648428, 0.012098724022507668, 0.03133872523903847, -0.027864456176757812, 0.027621397748589516, 0.022992800921201706, -0.06184849143028259, -0.02361374907195568, -0.05345245078206062, 0.0035586529411375523, 0.02895442768931389, 0.03685704246163368, -0.03937014192342758, -0.005187956616282463, 0.03433716297149658, -0.01622202806174755, -0.02173609286546707, -0.020742598921060562, 0.05271589756011963, 0.07923178374767303, -0.017237979918718338, 0.01927080936729908, -0.0005612306413240731, -0.011158978566527367, 0.018813244998455048, 0.02650715969502926, -0.01634141430258751, -0.07542286068201065, 0.031771186739206314, 0.03126230835914612, -0.008001514710485935, -0.011672276072204113, 0.031526487320661545, -0.031021060422062874, 0.005884941667318344, 0.04066421091556549, 0.04192759096622467, 0.015498408116400242, -0.030896328389644623, 0.04537149891257286, -0.016560863703489304, 0.007376065943390131, -0.011044216342270374, 0.016562510281801224, -0.006917950697243214, 0.0377357192337513, 0.051191240549087524, 0.04928695037961006, -0.00691651226952672, 0.023883016780018806, -0.03936251625418663, -0.008153713308274746, 0.002459299750626087, -0.027613697573542595, -0.017024241387844086, 0.00005248185698292218, -0.03616107627749443, 0.013627513311803341, -0.03081168234348297, -0.011513492092490196, 0.014489153400063515, 0.06772658973932266, -0.010569200851023197, -0.015668829903006554, 0.00873343925923109, -0.004118404351174831, 0.0016184577252715826, -0.02687373198568821, -0.0013667212333530188, 0.01055890042334795, 0.0071122972294688225, 0.039846789091825485, 0.006167309824377298, 0.009659337811172009, 0.0014057622756808996, -0.021985191851854324, -0.007842703722417355, 0.04919556528329849, 0.0723307728767395, 0.014014770276844501, 0.000563415524084121, -0.0191179271787405, 0.015193614177405834, 0.006469014100730419, 0.0015580145409330726, -0.011351145803928375, 0.01234467513859272, 0.04611736163496971, -0.02310747466981411, 0.025946928188204765, -0.02894459292292595, -0.009122022427618504, 0.012543205171823502, 0.024234376847743988, -0.0004014121077489108, -0.03299393504858017, -0.03318219259381294, 0.03445839136838913, 0.0404646135866642, -0.022516369819641113, 0.028295641764998436, -0.03004373423755169, -0.03434539958834648, 0.01900455914437771, -0.0716685876250267, 0.050788044929504395, 0.032843802124261856, -0.024535896256566048, 0.001702916226349771, 0.01342006679624319, 0.002328454749658704, 0.03140421211719513, 0.004868431482464075, -0.0035106197465211153, 0.008004922419786453, 0.008180436678230762, -0.0013767196796834469, 0.03573840856552124, 0.0006523931515403092, 0.017464395612478256, 0.019679510965943336, -0.05420670658349991, 0.02121616341173649, 0.012171058915555477, -0.016703784465789795, 0.0009851354407146573, -0.02047388255596161, -0.0463343970477581, -0.004062476102262735, -0.0014178496785461903, 0.02734852209687233, 0.02222679741680622, -0.018607011064887047, -0.018077446147799492, -0.009154291823506355, -0.023097625002264977, 0.021369922906160355, 0.0467308908700943, -0.0571792833507061, 0.03967311978340149, -0.023928795009851456, -0.003946192096918821, 0.020075926557183266, 0.012459308840334415, 0.021579094231128693, -0.0190281942486763, 0.0797106921672821, 0.011713368818163872, 0.020464586094021797, 0.0299109797924757, -0.0019736201502382755, 0.024929575622081757, -0.051898449659347534, 0.015613787807524204, -0.02313811331987381, 0.018900010734796524, 0.0066726780496537685, -0.012031955644488335, 0.04790284484624863, 0.006188352592289448, 0.05153505131602287, 0.02271733060479164, 0.04560145363211632, -0.016159553080797195, 0.0030308489222079515, 0.060548361390829086, 0.031955890357494354, -0.008526930585503578, 0.05665725842118263, 0.012805365025997162, -0.008574280887842178, 0.025448277592658997, 0.017684629186987877, -0.005808158777654171, -0.0005029180319979787, 0.004969963803887367, 0.005072475410997868, -0.026683839038014412, -0.05106434226036072, -0.005240284372121096, 0.04204323887825012, -0.032532889395952225, -0.02129148505628109, 0.024903513491153717, -0.052620045840740204, 0.043600209057331085, -0.04596718028187752, 0.020453469827771187, -0.02494967170059681, -0.029149150475859642, 0.008448563516139984, 0.005194599740207195, 0.03530166670680046, -0.0577690564095974, -0.006774751003831625, 0.02680172398686409, 0.01652376912534237, -0.018014810979366302, -0.01867428794503212, -0.033799197524785995, 0.00043465924682095647, -0.026767568662762642, -0.007845613174140453, 0.003084849566221237, -0.010706023313105106, 0.015307260677218437, 0.019748428836464882, 0.02704261615872383, 0.02647153101861477, 0.04803192988038063, 0.024108804762363434, 0.04115612804889679, 0.01969708874821663, -0.013606540858745575, -0.021315546706318855, -0.040121570229530334, 0.008286635391414165, -0.04975477606058121, 0.001821954152546823, 0.008039076812565327, 0.06059485673904419, 0.018207620829343796, 0.02340017631649971, -0.013022528029978275, -0.014344302006065845, -0.006289894692599773, 0.030466541647911072, -0.03220830857753754, 0.04747064784169197, -0.005796652287244797, -0.012530732899904251, 0.06918995827436447, 0.011015035212039948, -0.026189185678958893, -0.009858649224042892, -0.022381316870450974, 0.02237698808312416, 0.003359212540090084, -0.016286637634038925, -0.00666473712772131, 0.03253611922264099, -0.0317867249250412, 0.01967143826186657, 0.0175449438393116, -0.018295394256711006, -0.0000688932923367247, -0.022618571296334267, -0.006766130682080984, -0.041565828025341034, -0.006647573783993721, -0.039246395230293274, -0.07245497405529022, -0.0295008085668087, -0.0294122826308012, -0.02319483458995819, 0.028513390570878983, -0.03996757045388222, -0.014608722180128098, -0.03801417723298073, -0.023553524166345596, -0.009317838586866856, -0.002386996289715171, 0.0590549036860466, 0.05980149656534195, 0.05576099827885628, 0.0025948737747967243, -0.0530652292072773, 0.009776446036994457, -0.012267067097127438, 0.012448672205209732, 0.044681940227746964, 0.0007455936283804476, -0.011745749041438103, -0.02976047620177269, -0.01790756732225418, 0.03350673243403435, -0.06825102120637894, 0.016868149861693382, -0.03122744709253311, -0.020072482526302338, -0.026862360537052155, -0.01666337437927723, 0.018991906195878983, -0.016992509365081787, 0.03336317092180252, -0.03209468722343445, -0.008150865323841572, -0.04405984282493591, 0.013248533010482788, -0.05001310631632805, -0.002885326975956559, -0.025932973250746727, -0.03583771362900734, 0.056858476251363754, 0.010296917520463467, -0.003159342799335718, -0.02250692993402481, -0.03768305853009224, 0.01465514674782753, -0.012890566140413284, -0.04594231769442558, -0.04305930435657501, 0.006135368719696999, 0.047306131571531296, -0.033271610736846924, -0.022273456677794456, -0.03135209158062935, -0.003767560003325343, -0.011344787664711475, 0.014730021357536316, 0.009973234497010708, 0.0035206670872867107, 0.00803722720593214, -0.003358266083523631, 0.005515415687114, 0.04077454283833504, 0.028179161250591278, -0.03139549493789673, -0.04552125558257103, 0.0204558577388525 ]
Welcome spaCy to the 🤗 Hub
osanseviero
July 13, 2021
spacy
open-source-collab, nlp
https://huggingface.co/blog/spacy
Would you like to integrate your library to the Hub? This integration is possible thanks to the huggingface_hub library which has all our widgets and the API for all our supported libraries. If you would like to integrate your library to the Hub, we have a guide for you!
[ 0.00773274339735508, -0.004455060698091984, 0.05732233077287674, -0.026709115132689476, 0.09012823551893234, 0.00267598289065063, -0.010353254154324532, 0.08259749412536621, 0.002751291263848543, -0.06676017493009567, -0.053188759833574295, 0.029708381742239, 0.004094921052455902, 0.09832841157913208, 0.015536590479314327, -0.030895031988620758, 0.04677584767341614, -0.001701044850051403, 0.005010685883462429, 0.0333847813308239, 0.013505008071660995, -0.07205364108085632, 0.029956426471471786, -0.014128586277365685, -0.006784079130738974, -0.08979959040880203, 0.04273788258433342, 0.029398703947663307, 0.022779876366257668, 0.0013641351833939552, -0.06416990607976913, -0.008825862780213356, 0.025230297818779945, -0.06388954818248749, 0.03194137290120125, 0.03240617737174034, -0.14906790852546692, 0.059410691261291504, 0.05919070541858673, 0.012937581166625023, -0.014030327089130878, -0.017602574080228806, -0.05353381484746933, 0.029996609315276146, 0.019053606316447258, -0.06208685040473938, -0.2186860889196396, 0.09841582179069519, 0.01731126755475998, -0.007839638739824295, -0.08594001829624176, 0.06585630029439926, 0.0169225987046957, 0.005398760084062815, 0.044509097933769226, -0.011238176375627518, -0.018611926585435867, -0.08178725093603134, 0.006857836619019508, 0.002351226983591914, 0.0603032112121582, 0.010301165282726288, -0.0018798758974298835, 0.06176523491740227, 0.005475365091115236, 0.04327184334397316, -0.010900882072746754, 0.002739530522376299, -0.041457947343587875, 0.008687336929142475, 0.016590172424912453, -0.02347952499985695, -0.02133692055940628, -0.032554447650909424, 0.03411426395177841, -0.0385197289288044, -0.03362903743982315, 0.026612013578414917, 0.061375897377729416, 0.0034781326539814472, 0.012569409795105457, -0.028949465602636337, 0.03942236304283142, 0.04802742227911949, 0.03645125404000282, 0.04374498873949051, -0.0023044913541525602, -0.07723426073789597, -0.05586254596710205, 0.0583801195025444, -0.025533532723784447, -0.14261968433856964, -0.017536450177431107, 0.022861095145344734, 0.08350443094968796, -0.010719280689954758, 0.020085930824279785, 0.01956517994403839, 0.012678790837526321, 0.01808490790426731, -0.022608280181884766, -0.05400589108467102, 0.003463363740593195, -0.05474626645445824, -0.025209365412592888, 0.014435655437409878, 0.01332852616906166, -0.10617581754922867, -0.033643413335084915, 0.0037463370244950056, 0.024638913571834564, -0.0582229420542717, 0.00830360222607851, 0.061574846506118774, -0.01830400340259075, 0.05921833962202072, 0.009182048961520195, 0.002387214684858918, -0.021893717348575592, 0.03597157448530197, 0.005360671319067478, 0.10753267258405685, -0.009643650613725185, 0.024090630933642387, 0.06277164071798325, 0.09584119915962219, -0.0031880498863756657, -0.002111230045557022, -0.02278011664748192, -0.06317616254091263, 0.03935539349913597, 0.02174947038292885, 0.057070836424827576, -0.041626669466495514, -0.01733989268541336, -0.03927421197295189, -0.014990333467721939, -0.06486134231090546, 0.026205457746982574, -0.025097040459513664, -0.001190122333355248, 0.08108358830213547, -0.029274482280015945, 0.024639885872602463, 0.031491052359342575, 0.0040446738712489605, -0.05007001385092735, 0.06939452886581421, -0.045575663447380066, -0.022708438336849213, -0.03691548481583595, 0.05593659728765488, -0.017541443929076195, 0.00382747920230031, -0.09307768940925598, 0.05090394616127014, -0.006830453407019377, -0.011690518818795681, -0.052238453179597855, 0.020002644509077072, -0.026480354368686676, 0.012073123827576637, -0.07337699085474014, -0.02748309262096882, 0.01177187729626894, 0.0013768798671662807, 0.0068763624876737595, -0.04608168825507164, 0.03704959526658058, -0.08801217377185822, 0.014753736555576324, -0.07200422137975693, -0.013830958865582943, -0.005127912387251854, -0.018034683540463448, 0.036017950624227524, 0.0799701139330864, 0.060890499502420425, -0.051107197999954224, 0.0278711449354887, -0.03024240769445896, 0.04705241322517395, -0.016530120745301247, 0.038238439708948135, 0.022580817341804504, -0.035936158150434494, -0.010216228663921356, 0.040392037481069565, -0.0001442668872186914, -0.014729860238730907, -0.0027524998877197504, -0.06149118021130562, 0.048220861703157425, 0.022966796532273293, 0.040731362998485565, -0.00914591085165739, -0.0337713323533535, 0.12664513289928436, 0.02734185755252838, 0.0664280354976654, 0.050859395414590836, 0.010298981331288815, 0.022680621594190598, -0.017663579434156418, -0.002142485696822405, -0.01563701033592224, 0.005007422994822264, -0.019803335890173912, 0.0038719335570931435, -0.005204471759498119, 0.02762734331190586, -0.10820015519857407, 0.07152972370386124, -0.06157882139086723, 0.011102030985057354, -0.04819797724485397, -0.01715594157576561, 0.009013433940708637, 0.01018638163805008, -0.01834709197282791, 0.1884472370147705, -0.02658756822347641, 0.03415515273809433, 0.028613492846488953, -0.020167965441942215, 0.03212357684969902, 0.07461893558502197, 0.07354234904050827, 0.0716872587800026, -0.07389869540929794, -0.046690646559000015, -0.06786438077688217, -0.07042811065912247, 0.015403099358081818, -0.041169848293066025, -0.019865240901708603, 0.06323368847370148, -0.027120189741253853, 0.02161642722785473, 0.008303430862724781, 0.00023719163436908275, -0.06152033060789108, -0.031782183796167374, 0.03204506263136864, 0.038374874740839005, -0.014184365049004555, 0.030884454026818275, 0.008484017103910446, -0.025160474702715874, -0.012248198501765728, -0.05025186389684677, 0.03076336719095707, 0.04602467641234398, -0.02906278893351555, 0.06341150403022766, 0.04504868760704994, 0.007453437428921461, -0.03629319742321968, -0.018411723896861076, 0.05566177889704704, 0.010671918280422688, -0.029778260737657547, -0.043714333325624466, -0.06698017567396164, -0.03155813738703728, -0.03645467013120651, -0.016422608867287636, 0.026303960010409355, -0.021178599447011948, 0.017911363393068314, 0.037014786154031754, -0.030630547553300858, 0.03951677307486534, 0.002934827469289303, 0.0012008054181933403, 0.021168390288949013, 0.03286024555563927, -0.010797742754220963, -0.030885765329003334, -0.011092578060925007, 0.016740061342716217, -0.05513932183384895, 0.040744099766016006, 0.027225583791732788, 0.018234416842460632, 0.009097106754779816, -0.003071599407121539, -0.04122026264667511, -0.03842388466000557, 0.034213028848171234, -0.0020278573501855135, 0.03032085858285427, 0.027924085035920143, -0.0243860874325037, -0.0019076885655522346, -0.0010829297825694084, 0.02570212073624134, 0.0075456262566149235, -0.02767120487987995, 0.007614837493747473, -0.006974811665713787, 0.02223583124577999, 0.0005539038684219122, -0.019437260925769806, -0.0440511554479599, 0.03817354142665863, 0.01896742172539234, -0.009307285770773888, -0.11205951869487762, -0.05555455759167671, -0.02019074745476246, 0.0266121793538332, -0.04357346519827843, -0.0204219538718462, 0.0024158074520528316, -0.032917264848947525, 0.02218874916434288, 0.01545493584126234, 0.02334737405180931, 0.0141018470749259, 0.026834122836589813, -0.022955670952796936, 0.004487958271056414, -0.015482805669307709, -0.015872376039624214, 0.026193441823124886, 0.05261171981692314, 0.03511809930205345, -0.06101751700043678, 0.015366172417998314, 0.004289973061531782, -0.01577761396765709, -0.020299941301345825, -0.061087291687726974, 0.054887764155864716, -0.00941070169210434, 0.0184142105281353, -0.04733128845691681, 0.019933555275201797, -0.011328439228236675, -0.035861480981111526, -0.010026048868894577, -0.06513357907533646, -0.005332530941814184, -0.009185118600726128, -0.010075202211737633, 0.04445628449320793, 0.017409302294254303, 0.013298283331096172, 0.01627962477505207, 0.024159321561455727, -0.014648980461061, 0.014231517910957336, -0.0029060884844511747, -0.015261802822351456, 0.03273614123463631, 0.027824224904179573, -0.011492983438074589, -0.030234934762120247, -0.000636895711068064, 0.013676012866199017, 0.03644886985421181, 0.007394151296466589, 0.015622438862919807, -0.008417394012212753, 0.03895627334713936, 0.006630642805248499, -0.040237873792648315, -0.04682149365544319, -0.008350313641130924, -0.025228159502148628, -0.025656672194600105, -0.04442505165934563, 0.03553248196840286, -0.021828768774867058, 0.02316056750714779, -0.014662732370197773, 0.009459417313337326, 0.002138877520337701, 0.025835836306214333, 0.012249925173819065, 0.018866730853915215, 0.004019457846879959, -0.000652200891636312, -0.002579780761152506, -0.03542742878198624, 0.06794577836990356, 0.016353314742445946, -0.024213096126914024, -0.004237242508679628, -0.01401055883616209, 0.0008290079422295094, -0.0378941111266613, 0.004165003076195717, 0.03301644325256348, -0.0018457781989127398, 0.01707128807902336, 0.039005398750305176, 0.004166622646152973, -0.020559608936309814, 0.0020286657381802797, -0.019748065620660782, -0.0027709919959306717, 0.011916999705135822, 0.03629739210009575, 0.027616165578365326, 0.00047779257874935865, 0.03394027426838875, 0.031860001385211945, -0.013536189682781696, -0.03410534933209419, 0.0211783517152071, 0.015177098102867603, 0.0560811385512352, -0.02213592641055584, -0.05085134133696556, 0.048398878425359726, -0.015576841309666634, 0.030272141098976135, -0.03920421004295349, -0.018374236300587654, -0.012283716350793839, 0.03241534158587456, -0.008212724700570107, 0.006227349396795034, -0.02527201548218727, -0.047554124146699905, 0.0368351973593235, -0.021792681887745857, 0.029519757255911827, -0.023035021498799324, -0.040533147752285004, -0.011947639286518097, -0.003725593676790595, 0.034557655453681946, -0.017801005393266678, 0.001109556877054274, -0.002805655123665929, -0.0012919168220832944, -0.02462012879550457, 0.021784290671348572, 0.001239424804225564, 0.0014062152476981282, 0.007189857307821512, -0.002982502803206444, 0.022899581119418144, 0.02134506031870842, -0.04630380868911743, -0.027526916936039925, -0.01052769087255001, 0.03697504848241806, -0.03202054277062416, 0.045797113329172134, -0.0023574132937937975, -0.06726294010877609, 0.011938896030187607, -0.043055854737758636, 0.016465699300169945, 0.02241472899913788, -0.02602687105536461, -0.02438058704137802, 0.03267131745815277, 0.026340143755078316, -0.009909535758197308, 0.011078478768467903, 0.009254137054085732, -0.003996961284428835, 0.05247719585895538, -0.004679627250880003, -0.006574038881808519, -0.01133844256401062, 0.027810128405690193, 0.004157089162617922, 0.007087201811373234, -0.0011757181491702795, -0.055721331387758255, -0.00161839765496552, -0.00005350441642804071, -0.004210967104882002, 0.00873936153948307, 0.007516136392951012, -0.03319929540157318, -0.012408668175339699, 0.0667625144124031, 0.039837438613176346, -0.006333810277283192, 0.016783714294433594, 0.014520874246954918, -0.053567349910736084, 0.004345076158642769, 0.041252363473176956, -0.003655593376606703, -0.002805138938128948, 0.013117202557623386, 0.05365845933556557, 0.04582822322845459, -0.00507361488416791, 0.02403983101248741, -0.014197241514921188, -0.02987123467028141, 0.007343836594372988, -0.021915433928370476, 0.01779060810804367, -0.03950544819235802, -0.0002575333055574447, -0.01955713890492916, -0.002939697355031967, -0.01833297871053219, 0.0027127983048558235, 0.04795162379741669, -0.04470568895339966, 0.005092475563287735, 0.02115892805159092, -0.000010540939911152236, 0.02536957524716854, -0.02922508493065834, 0.028542429208755493, -0.03290729597210884, -0.017819182947278023, 0.0028302513528615236, 0.009829630143940449, -0.01369612105190754, 0.01720449887216091, -0.002458807546645403, -0.0428246408700943, -0.004975349176675081, 0.009237948805093765, 0.04238259047269821, -0.005998610053211451, 0.005226694047451019, -0.02665008045732975, -0.0270537119358778, 0.035020433366298676, -0.02082996256649494, 0.001711565419100225, -0.005252253729850054, -0.018216779455542564, 0.03227391839027405, 0.04084436595439911, -0.031210092827677727, 0.010838693007826805, 0.03256145864725113, 0.026780767366290092, 0.019600894302129745, -0.060132723301649094, 0.020067568868398666, 0.04141615703701973, -0.004174534231424332, 0.02844478189945221, -0.005506220739334822, -0.05163785442709923, -0.0008523000869899988, -0.043461378663778305, 0.00804948341101408, 0.10204055160284042, 0.021056663244962692, -0.0019607774447649717, 0.002626200905069709, 0.03647834062576294, -0.003757304046303034, 0.008310727775096893, -0.023846779018640518, 0.007966370321810246, 0.028425637632608414, 0.019242526963353157, -0.009485781192779541, 0.0025814760010689497, -0.017954524606466293, 0.001704191556200385, -0.047488436102867126, 0.011128713376820087, 0.019529396668076515, -0.0436130166053772, 0.000032682019082130864, -0.01503810379654169, -0.06945661455392838, -0.014890048652887344, 0.02132134512066841, 0.01881253719329834, 0.0649496465921402, 0.005872368812561035, 0.0017389488639310002, -0.020870089530944824, -0.03941457346081734, 0.018474329262971878, 0.05525118485093117, -0.02297559753060341, 0.04029597342014313, 0.03261270001530647, 0.058751896023750305, 0.023983333259820938, 0.013246691785752773, 0.02788461372256279, 0.035447921603918076, 0.06131412461400032, -0.007345839869230986, 0.078177310526371, 0.026043036952614784, -0.010069534182548523, 0.0019273551879450679, -0.029134251177310944, 0.0054383953101933, 0.004722150508314371, 0.0016529096756130457, 0.015792418271303177, 0.005955406464636326, -0.012493105605244637, -0.017883827909827232, 0.019496988505125046, 0.006698210258036852, 0.03186895325779915, 0.0027057472616434097, 0.008256811648607254, 0.053095173090696335, 0.004631035029888153, 0.023856617510318756, 0.008723082020878792, -0.009832426905632019, 0.0020320138428360224, 0.06146872043609619, 0.014115736819803715, 0.015211313962936401, -0.04400377348065376, -0.0030135433189570904, 0.04346919432282448, -0.01634369045495987, -0.0231936052441597, -0.004906033631414175, 0.0028902292251586914, -0.046585578471422195, -0.03967834636569023, 0.012773917987942696, -0.02495402656495571, -0.01921646110713482, 0.006497042253613472, 0.01515556313097477, -0.020074833184480667, -0.01657700724899769, 0.0019843392074108124, 0.03442089632153511, -0.0031591164879500866, 0.013055502437055111, 0.011915299110114574, 0.05843578651547432, 0.03321364149451256, 0.005433641839772463, -0.03102000802755356, -0.02193470112979412, -0.031138908118009567, -0.004120065830647945, -0.015082617290318012, -0.01898077316582203, 0.009646828286349773, -0.029081951826810837, -0.02507651224732399, 0.035881832242012024, 0.0007734012906439602, 0.034687746316194534, 0.014898903667926788, 0.03830188140273094, -0.03513142839074135, 0.01726890727877617, 0.011111614294350147, 0.009013528004288673, 0.00405952800065279, -0.022292623296380043, 0.016641836613416672, -0.0010409974493086338, 0.00031854803091846406, 0.030519535765051842, 0.009373383596539497, -0.03348918631672859, -0.03669505566358566, 0.0031867390498518944, -0.016523372381925583, -0.0037667579017579556, 0.0691564753651619, -0.0015105013735592365, -0.01448961440473795, 0.025041429325938225, -0.019802061840891838, 0.01765470951795578, -0.004505034536123276, 0.01906678080558777, 0.06390322744846344, -0.0189561415463686, -0.010960809886455536, -0.00011239926243433729, 0.049310196191072464, 0.0331529937684536, 0.0033176166471093893, 0.03598682954907417, 0.03111635521054268, 0.007389280013740063, -0.027673134580254555, 0.032971665263175964, -0.030218016356229782, -0.01775805838406086, -0.020881328731775284, -0.031331535428762436, -0.0023247699718922377, -0.042812127619981766, -0.006856565363705158, -0.005388536490499973, -0.04238131642341614, 0.0015745374839752913, -0.00571600254625082, -0.025365153327584267, -0.02592766471207142, 0.014119896106421947, 0.02292492426931858, 0.04770173132419586, 0.04756711423397064, 0.0071389153599739075, -0.016656918451189995, 0.026545235887169838, 0.004452836699783802, 0.018169626593589783, 0.036654774099588394, 0.03265312686562538, -0.02565193548798561, -0.031984973698854446, 0.011486929841339588, -0.002563633257523179, -0.03482970967888832, 0.05816136673092842, 0.004422637168318033, -0.012339347042143345, -0.04652457684278488, -0.000052273364417487755, 0.03640860319137573, 0.008474237285554409, 0.05294802412390709, -0.02972237579524517, -0.03281286731362343, 0.006012913770973682, -0.008310847915709019, -0.031538091599941254, -0.0020703852642327547, -0.070342518389225, -0.020245378836989403, 0.028596952557563782, -0.011769410222768784, 0.004582507535815239, 0.0013781305169686675, -0.02042279951274395, 0.028731292113661766, -0.002696068026125431, -0.03690718114376068, -0.047616541385650635, 0.0012896308908239007, 0.04804446920752525, -0.029510250315070152, -0.027247697114944458, 0.029342448338866234, 0.023161130025982857, -0.03314927965402603, 0.006733758375048637, -0.011360078118741512, -0.010926207527518272, 0.0005664747441187501, 0.014673898927867413, -0.022727301344275475, 0.06964656710624695, -0.005700128618627787, -0.06137530505657196, -0.033595599234104156, -0.008796639740467072 ]
Welcome spaCy to the 🤗 Hub
osanseviero
July 13, 2021
spacy
open-source-collab, nlp
https://huggingface.co/blog/spacy
Widgets This integration includes support for NER widgets, so all models with a NER component will have this out of the box! Coming soon there will be support for text classification and POS. spacy/en_core_web_sm Hosted inference API Token Classification Compute This model is currently loaded and running on the Inference API. JSON Output Maximize
[ 0.01836511306464672, -0.05102509632706642, 0.044409073889255524, -0.009975414723157883, 0.060106050223112106, 0.07074873149394989, 0.002950141904875636, 0.10020273923873901, -0.0323588065803051, -0.023558972403407097, -0.0569981187582016, 0.016282344236969948, 0.062418852001428604, 0.07982826232910156, 0.025254346430301666, -0.011547072790563107, 0.02583821676671505, 0.041481420397758484, 0.014927765354514122, -0.004163419362157583, -0.018158506602048874, -0.07182402908802032, 0.03557076305150986, -0.04105885326862335, -0.014406083151698112, -0.025778815150260925, -0.024783944711089134, -0.01511064451187849, -0.046700313687324524, 0.028467101976275444, -0.05421511456370354, 0.0005813712486997247, -0.01096378918737173, -0.0340428501367569, 0.00289886724203825, 0.06765373051166534, -0.1326497346162796, 0.044833190739154816, -0.02233988232910633, -0.024167438969016075, -0.0496302992105484, -0.0528707318007946, -0.057086504995822906, 0.09335524588823318, -0.04053368419408798, -0.07330729812383652, -0.189890056848526, 0.042084451764822006, -0.00366981397382915, -0.06390806287527084, -0.09096501022577286, 0.03939371928572655, -0.07207497954368591, 0.008256700821220875, 0.06360457837581635, -0.005201712250709534, -0.032946694642305374, -0.12076018750667572, 0.01144812349230051, -0.038637012243270874, 0.008342064917087555, 0.00887670461088419, -0.039545852690935135, -0.0022317722905427217, 0.008446215651929379, 0.01498072873800993, -0.022249657660722733, 0.017349490895867348, -0.04728027060627937, 0.07586879283189774, 0.0023314643185585737, 0.02340405248105526, 0.01018088310956955, -0.0611209012567997, 0.028295442461967468, -0.053632527589797974, -0.03533438965678215, 0.05638117715716362, -0.013586713932454586, -0.0036184689961373806, -0.016657091677188873, -0.054153408855199814, 0.08141565322875977, 0.01413010898977518, 0.02138671465218067, 0.002026147907599807, 0.007889346219599247, -0.09356075525283813, -0.048499658703804016, 0.03644142299890518, 0.04107113555073738, -0.10986968874931335, 0.013821751810610294, 0.044350121170282364, 0.03957436978816986, 0.02816794067621231, 0.03189421445131302, 0.03219586983323097, -0.029762547463178635, -0.01490833517163992, -0.015268653631210327, -0.014426609501242638, 0.0071586002595722675, -0.07504090666770935, -0.03240669146180153, 0.03136330097913742, 0.0006340750842355192, -0.0825970247387886, -0.0072848922573029995, 0.06586296111345291, -0.03820846229791641, -0.00813900213688612, 0.043476395308971405, 0.08007211983203888, -0.0834827870130539, 0.02611047402024269, -0.007992425933480263, 0.02568233385682106, 0.015286850742995739, -0.01980462484061718, 0.04588888958096504, 0.031985536217689514, 0.04156613349914551, 0.02866133116185665, 0.07418118417263031, 0.059560906141996384, 0.0804336667060852, -0.0010492344154044986, 0.009409804828464985, -0.004376640077680349, 0.05239854007959366, -0.016507044434547424, 0.034404076635837555, -0.03812268003821373, 0.043369315564632416, -0.037198506295681, -0.05587931349873543, -0.08723367005586624, 0.04378758743405342, -0.025362560525536537, -0.046835534274578094, 0.05562572181224823, -0.02286347933113575, 0.040555208921432495, 0.06655082106590271, -0.032369405031204224, 0.01001481618732214, 0.05862382426857948, -0.055356573313474655, 0.012630789540708065, -0.11714456975460052, 0.005938886199146509, -0.028820643201470375, -0.01537960022687912, -0.04162152111530304, 0.009469643235206604, 0.017956970259547234, 0.021574832499027252, -0.03494666889309883, -0.003234271192923188, -0.05391254648566246, -0.025066375732421875, -0.050199393182992935, -0.00023514511121902615, 0.032136354595422745, -0.026906058192253113, 0.010444797575473785, -0.00887045543640852, 0.05886702984571457, -0.042159464210271835, 0.025017745792865753, -0.04067540541291237, 0.06297001242637634, -0.04257500544190407, -0.03980817645788193, -0.021007435396313667, 0.028480101376771927, 0.034327127039432526, -0.04700784757733345, 0.041404273360967636, -0.03971070051193237, -0.0005078346002846956, -0.030227746814489365, -0.018600184470415115, -0.002939020749181509, -0.10477705299854279, 0.05205094814300537, -0.0597989559173584, 0.05261244997382164, 0.0008671641699038446, -0.014884688891470432, -0.08445844054222107, 0.03903573751449585, 0.06330418586730957, 0.029876261949539185, -0.013763751834630966, -0.03199983760714531, 0.10143578797578812, 0.024944821372628212, 0.03858257457613945, 0.08230634778738022, 0.008211398497223854, 0.05549176037311554, -0.02484998293220997, -0.028154414147138596, -0.02675113081932068, 0.032915107905864716, 0.006317941006273031, 0.024976937100291252, -0.010305146686732769, -0.037885092198848724, -0.0744432657957077, 0.04985066130757332, -0.06334100663661957, 0.02330373227596283, -0.03905006870627403, -0.014161837287247181, 0.03267691284418106, -0.004892066586762667, -0.04792168363928795, 0.21770240366458893, -0.0439014658331871, 0.018261857330799103, 0.011065804399549961, -0.055512312799692154, 0.02868247590959072, 0.11528080701828003, 0.05139804258942604, 0.05523785203695297, -0.03388793393969536, 0.005128363147377968, -0.034304067492485046, -0.007951413281261921, 0.004201945848762989, 0.0008712816052138805, 0.012370968237519264, 0.03362315148115158, 0.007957284338772297, 0.05787235498428345, -0.02398945577442646, 0.01702149212360382, 0.008569828234612942, -0.03757096081972122, 0.044045791029930115, 0.04967512935400009, 0.028968071565032005, 0.07077472656965256, 0.017719436436891556, -0.004000121261924505, -0.03418707847595215, -0.06007865071296692, 0.03953783959150314, 0.03669837489724159, -0.04885181784629822, 0.0890551507472992, 0.017141876742243767, 0.015877440571784973, -0.04771523177623749, 0.02173618972301483, 0.031113628298044205, 0.006496699992567301, -0.012890707701444626, 0.00426560128107667, -0.03538969159126282, 0.00559482304379344, -0.041181400418281555, -0.019999921321868896, -0.010200448334217072, -0.014842642471194267, 0.008549058809876442, 0.0292049590498209, -0.033703744411468506, 0.021579664200544357, -0.018638713285326958, 0.05248996987938881, 0.050657179206609726, 0.017799803987145424, -0.031666647642850876, -0.019751789048314095, -0.02881348878145218, -0.004627889487892389, -0.04738980904221535, 0.061273932456970215, 0.017756478860974312, 0.02495277114212513, -0.0406595803797245, 0.011669887229800224, -0.06251063942909241, -0.011385173536837101, 0.03565184399485588, -0.01761804148554802, 0.003862085985019803, 0.007922823540866375, 0.0056319222785532475, 0.01365594007074833, -0.004233745392411947, 0.022350644692778587, 0.034901175647974014, -0.050013620406389236, -0.005281440448015928, -0.008830462582409382, 0.032576367259025574, -0.01837860979139805, 0.006982767954468727, -0.06036791577935219, 0.05267340689897537, -0.0197011549025774, 0.004918762017041445, -0.10725782066583633, -0.05463457480072975, -0.0018702833913266659, 0.034400444477796555, -0.014625604264438152, -0.01193278469145298, 0.016753755509853363, -0.00011472053301986307, 0.022749364376068115, 0.024624984711408615, 0.020239539444446564, -0.011541713029146194, 0.04095524549484253, -0.0025554168969392776, -0.018002821132540703, 0.03087114915251732, -0.013969199731945992, -0.0003428515628911555, 0.02592732571065426, 0.04255418851971626, -0.015424380078911781, 0.08216272294521332, -0.020685235038399696, 0.005688880570232868, -0.02751513011753559, 0.001705540344119072, 0.029261160641908646, 0.004848483018577099, 0.013431141152977943, -0.06565197557210922, -0.014439665712416172, 0.016484858468174934, -0.036289628595113754, 0.026325706392526627, -0.04859102517366409, -0.0004905184032395482, -0.007904909551143646, 0.009103521704673767, 0.04835498705506325, 0.02746391110122204, 0.003123345086351037, 0.009373731911182404, 0.011158577166497707, -0.016767287626862526, 0.011495580896735191, 0.006475214380770922, -0.0027659337501972914, 0.04140868037939072, 0.01915617845952511, -0.009972965344786644, -0.024537913501262665, -0.008913097903132439, 0.023418447002768517, 0.047138459980487823, -0.006092160474509001, 0.013212425634264946, -0.030211616307497025, 0.017705854028463364, 0.0023730008397251368, -0.034578513354063034, -0.025566359981894493, 0.009525997564196587, 0.03142077475786209, -0.02354907989501953, -0.0711546540260315, 0.05435553938150406, 0.01951076090335846, -0.0019496938912197948, 0.014286791905760765, 0.012235275469720364, 0.012989974580705166, 0.06739243865013123, -0.030370939522981644, 0.014830449596047401, -0.00006638594641117379, 0.008218128234148026, -0.0001680756831774488, -0.030574604868888855, 0.05999567732214928, 0.020886991173028946, -0.0025479409378021955, 0.00038747131475247443, -0.00953788124024868, -0.022370394319295883, -0.012687558308243752, -0.015629639849066734, 0.01733735390007496, -0.03107064589858055, 0.025896470993757248, 0.04746607318520546, 0.027992630377411842, -0.020650139078497887, -0.0006493512773886323, -0.0075658527202904224, -0.0164889357984066, 0.031002748757600784, 0.03898631036281586, -0.011518892832100391, 0.001665906747803092, 0.007185650989413261, 0.011177051812410355, -0.022436853498220444, 0.012518037110567093, 0.02082299441099167, 0.012864047661423683, 0.020360883325338364, -0.014584265649318695, -0.04415421187877655, 0.028627989813685417, -0.003930211998522282, 0.038642652332782745, 0.026270771399140358, -0.01995854638516903, -0.005730464123189449, 0.013905118219554424, 0.012145670130848885, -0.027744855731725693, 0.0018505234038457274, -0.0341268926858902, 0.03753435239195824, 0.0015260715736076236, 0.0021238806657493114, 0.006538502871990204, -0.034148283302783966, -0.015250401571393013, 0.020545387640595436, 0.009701679460704327, -0.018227145075798035, 0.008286524564027786, -0.013210262171924114, -0.01648600585758686, -0.005657745525240898, 0.014193564653396606, 0.020091397687792778, 0.045618221163749695, 0.004446621518582106, 0.016104862093925476, 0.01501661166548729, 0.01571148820221424, -0.025309229269623756, -0.017514964565634727, -0.0070204236544668674, 0.020216036587953568, -0.020473357290029526, -0.008966468274593353, -0.047404803335666656, -0.07718946039676666, -0.013149606063961983, -0.01279492862522602, 0.04461190104484558, 0.004912943579256535, -0.01716826669871807, -0.009073075838387012, 0.011910614557564259, 0.05169852077960968, -0.017831891775131226, -0.0015612856950610876, 0.04049582779407501, -0.008066350594162941, 0.07685781270265579, 0.06292121112346649, 0.018802110105752945, -0.007343003060668707, 0.025364365428686142, 0.019060451537370682, -0.007789344992488623, -0.002359826350584626, 0.0020900326780974865, -0.025330210104584694, 0.05398005619645119, -0.03157733380794525, 0.0019961493089795113, 0.002189388731494546, -0.03424368053674698, -0.028021566569805145, 0.003368936711922288, 0.034557729959487915, 0.014386554248631, -0.034657616168260574, -0.011547338217496872, -0.028047636151313782, -0.013512810692191124, 0.049823373556137085, -0.026985425502061844, -0.018997088074684143, 0.017700200900435448, 0.04971754550933838, 0.051329560577869415, -0.007240013685077429, 0.004186307545751333, 0.006616776809096336, -0.008199213072657585, 0.005487214308232069, -0.03715164214372635, 0.04134294390678406, -0.019350791350007057, 0.0001850482658483088, 0.03442791476845741, -0.011340503580868244, -0.01702282205224037, 0.01716543547809124, 0.008027555420994759, -0.036375220865011215, 0.0036878257524222136, 0.014249345287680626, 0.010552192106842995, 0.0453060120344162, -0.03900013864040375, 0.009540164843201637, -0.014815661124885082, -0.019918818026781082, 0.00999127421528101, -0.004023682791739702, 0.011253847740590572, 0.02030520886182785, -0.03792500123381615, -0.023187411949038506, -0.0052118380554020405, -0.034041836857795715, 0.06366760283708572, 0.013586807996034622, -0.012834183871746063, -0.018044061958789825, -0.010517068207263947, 0.021413784474134445, -0.012445768341422081, 0.02367227151989937, -0.013609299436211586, -0.015208380296826363, 0.02376617304980755, 0.03513125702738762, -0.04430640488862991, 0.021278075873851776, 0.005876893177628517, 0.013766939751803875, 0.004205380566418171, -0.0637248083949089, 0.028314055874943733, 0.05471915006637573, -0.009007594548165798, 0.0006415357929654419, -0.0015318009536713362, -0.05055447295308113, -0.029535310342907906, -0.052684664726257324, 0.01336166262626648, 0.044829968363046646, -0.02004924789071083, 0.016128551214933395, 0.02501385658979416, 0.02895185723900795, -0.012016941793262959, -0.008101273328065872, -0.011344542726874352, 0.016947811469435692, 0.0351245179772377, 0.03367221727967262, -0.015425177291035652, -0.01757308468222618, 0.006197503302246332, 0.005595603957772255, -0.032538920640945435, -0.010028757154941559, 0.05393637344241142, -0.03322455286979675, -0.014164029620587826, -0.012995255179703236, -0.04608606919646263, 0.010828734375536442, 0.022899704053997993, -0.0024929195642471313, 0.018166637048125267, -0.016992568969726562, -0.03881217539310455, -0.015516137704253197, 0.0005239256424829364, 0.002489617560058832, 0.0441654771566391, -0.01812419481575489, 0.024313220754265785, 0.03919777274131775, 0.06801144033670425, 0.0051417178474366665, 0.03932037949562073, -0.03756292909383774, 0.000841120898257941, 0.06553546339273453, -0.02738754265010357, 0.03003573790192604, 0.027910536155104637, 0.019393032416701317, -0.0010217315284535289, -0.026101214811205864, 0.026980163529515266, -0.040058571845293045, 0.013622401282191277, 0.0432971753180027, -0.0016489053377881646, 0.005906226113438606, -0.042026471346616745, 0.08152798563241959, -0.00037306046579033136, 0.05571645498275757, 0.011621298268437386, -0.005324554163962603, 0.04736732318997383, 0.017088064923882484, 0.021375911310315132, -0.0030286144465208054, -0.01263218093663454, -0.01990433596074581, 0.0267162024974823, 0.03537663072347641, 0.018334083259105682, -0.033742401748895645, 0.004636102821677923, 0.014872542582452297, -0.02466573193669319, -0.01757759042084217, 0.02141323685646057, 0.020465707406401634, -0.026534952223300934, 0.006985250394791365, 0.0063189975917339325, -0.026215674355626106, 0.004468567203730345, -0.0031225839629769325, 0.005047756712883711, 0.004982743877917528, -0.021379772573709488, 0.00965917482972145, 0.04950897395610809, 0.00876591820269823, -0.008344893343746662, -0.03716233745217323, -0.003630603663623333, -0.01442820392549038, 0.028876561671495438, -0.02456415444612503, -0.010517973452806473, 0.0015918159624561667, -0.02251175232231617, -0.0037619811482727528, -0.0029485272243618965, -0.02324465475976467, -0.0023789776023477316, -0.016567964106798172, 0.03297007456421852, 0.0027346613351255655, 0.009986701421439648, 0.0038626764435321093, 0.01820405386388302, -0.050005778670310974, -0.0029648400377482176, -0.04904510825872421, -0.033410266041755676, -0.022506194189190865, -0.021242506802082062, -0.004020835738629103, -0.023256566375494003, -0.020103059709072113, 0.03402230888605118, 0.045074962079524994, -0.0348578542470932, -0.020981689915060997, 0.012559155933558941, -0.036750759929418564, 0.02528509311378002, 0.03845448046922684, -0.007971175946295261, -0.0003479140577837825, -0.009110876359045506, 0.024472473189234734, 0.013400831259787083, -0.04020652174949646, 0.04029945284128189, 0.06216983497142792, -0.01634044386446476, -0.04142872616648674, -0.02751837857067585, 0.04078447446227074, -0.014369160868227482, -0.028096241876482964, 0.04242955520749092, 0.00012773512571584433, -0.0034594277385622263, -0.04440750926733017, 0.02391318790614605, -0.018900955095887184, 0.03385944291949272, -0.021879516541957855, -0.04101886600255966, -0.022837430238723755, -0.007998578250408173, 0.005238295998424292, 0.013584818691015244, -0.02930823154747486, -0.011832895688712597, -0.01971478760242462, -0.01812523417174816, -0.0016254597576335073, 0.025217408314347267, 0.060366496443748474, 0.036518681794404984, 0.030550897121429443, 0.013024862855672836, 0.008975540287792683, 0.023101409897208214, 0.016715873032808304, -0.01315580029040575, 0.030321553349494934, 0.036071982234716415, -0.019239265471696854, -0.02221880480647087, 0.027821319177746773, 0.006138385273516178, -0.03940846398472786, 0.034671489149332047, 0.057943470776081085, -0.01440929900854826, -0.04071378707885742, 0.02220362424850464, 0.028127403929829597, -0.022562680765986443, 0.01870143786072731, 0.0010305485920980573, 0.0042183734476566315, 0.005856026895344257, 0.021763242781162262, -0.07846731692552567, -0.014816483482718468, -0.039503347128629684, -0.046433210372924805, 0.026791758835315704, -0.015935955569148064, 0.03992561995983124, -0.01578938215970993, 0.0014274176210165024, 0.023046713322401047, -0.00033233623253181577, -0.04526938498020172, -0.023941868916153908, -0.008787187747657299, 0.011166730895638466, 0.00028400495648384094, 0.0016695307567715645, 0.012775566428899765, 0.0051961978897452354, -0.02752809040248394, 0.006060474552214146, -0.016159098595380783, 0.00058224075473845, 0.000656687596347183, 0.03696298226714134, -0.017085134983062744, 0.048265501856803894, 0.05741940066218376, -0.005042510572820902, -0.014068925753235817, -0.032962970435619354 ]
Welcome spaCy to the 🤗 Hub
osanseviero
July 13, 2021
spacy
open-source-collab, nlp
https://huggingface.co/blog/spacy
# Welcome spaCy to the Hugging Face Hub spaCy is a popular library for advanced Natural Language Processing used widely across industry. spaCy makes it easy to use and train pipelines for tasks like named entity recognition, text classification, part of speech tagging and more, and lets you build powerful applications to process and analyze large volumes of text. Hugging Face makes it really easy to share your spaCy pipelines with the community! With a single command, you can upload any pipeline package, with a pretty model card and all required metadata auto-generated for you. The inference API currently supports NER out-of-the-box, and you can try out your pipeline interactively in your browser. You'll also get a live URL for your package that you can pip install from anywhere for a smooth path from prototype all the way to production!
[ 0.028864623978734016, -0.03750625252723694, 0.051983267068862915, -0.012024813331663609, 0.06171603500843048, 0.028428087010979652, 0.01925545744597912, 0.08018343150615692, -0.04448467493057251, 0.008209818042814732, -0.11127428710460663, 0.02651936374604702, -0.009120154194533825, 0.10349252074956894, 0.03207475692033768, -0.03891851007938385, 0.03624505177140236, 0.007425416260957718, -0.000033575124689377844, 0.038048580288887024, -0.036319926381111145, -0.020462727174162865, 0.08328165113925934, -0.037812184542417526, -0.05074208602309227, -0.008340691216289997, 0.01645146869122982, 0.027635587379336357, -0.05682427063584328, 0.021735994145274162, -0.1055886447429657, -0.019543932750821114, -0.025274448096752167, -0.03258400410413742, 0.06732676923274994, 0.04558778926730156, -0.15845265984535217, 0.03539841249585152, 0.02217099256813526, -0.031093988567590714, -0.02217276208102703, -0.016061285510659218, -0.07677531987428665, 0.003638186724856496, -0.04083895683288574, -0.0605940967798233, -0.1607074737548828, 0.06921406835317612, -0.019242405891418457, -0.04389641061425209, -0.07897321879863739, 0.09026207029819489, -0.02004493772983551, -0.04130614548921585, 0.028408922255039215, -0.010830534622073174, -0.0195471178740263, -0.07302124053239822, 0.000214062980376184, 0.014435064047574997, 0.032082490622997284, -0.01917886547744274, -0.019642841070890427, 0.028764013200998306, 0.006819745060056448, 0.0026532828342169523, -0.012920288369059563, 0.0055822646245360374, -0.08161106705665588, -0.003090424695983529, 0.06830307096242905, -0.04420611262321472, -0.04369129613041878, -0.02145206369459629, 0.017218589782714844, -0.023385552689433098, -0.005225195083767176, 0.008819255977869034, -0.005426077637821436, 0.03461587056517601, 0.030193738639354706, 0.002465498400852084, 0.025594254955649376, 0.07397651672363281, 0.0458972305059433, 0.08007334172725677, -0.012967882677912712, -0.05022592842578888, -0.060259513556957245, 0.017695311456918716, 0.013345785439014435, -0.10363936424255371, -0.0396357960999012, 0.030151495710015297, 0.08553901314735413, 0.05053012818098068, -0.015881679952144623, 0.0017882039537653327, -0.03629022464156151, -0.04170650988817215, -0.05828963965177536, -0.035872191190719604, 0.001789828180335462, -0.07815474271774292, -0.03941003978252411, 0.07103393226861954, -0.008489781990647316, -0.0585959292948246, -0.013045498169958591, -0.002391466172412038, 0.061526764184236526, -0.000251254066824913, 0.016539521515369415, 0.08650265634059906, -0.062447916716337204, 0.05553668737411499, -0.006945885717868805, 0.032237958163022995, 0.006761105731129646, 0.011137351393699646, 0.05030987411737442, 0.011247308924794197, 0.02323072776198387, -0.02105315960943699, 0.0442434698343277, 0.05294094607234001, 0.04404929280281067, 0.015491530299186707, 0.02488541044294834, -0.011424954980611801, 0.04923536255955696, -0.04719353839755058, 0.0370267890393734, -0.009225139394402504, -0.0009758800733834505, -0.06135277450084686, -0.01675722748041153, -0.07793933153152466, 0.03210366889834404, -0.009265275672078133, -0.006070069503039122, 0.09844601154327393, 0.00940463226288557, 0.030837472528219223, 0.06335106492042542, 0.01693490892648697, -0.08449944853782654, 0.04509836435317993, -0.008558443747460842, -0.011651446111500263, -0.08974336087703705, 0.026480121538043022, -0.022152923047542572, -0.0014951282646507025, -0.0024625069927424192, 0.020343419164419174, -0.014261214062571526, -0.01050069835036993, 0.005210908595472574, -0.03851580247282982, -0.06443991512060165, -0.03314907103776932, -0.07660054415464401, -0.022598637267947197, -0.006951134651899338, -0.032010599970817566, 0.01040695235133171, -0.027428817003965378, -0.01018860749900341, -0.0008350642747245729, 0.02724398672580719, -0.030853616073727608, 0.027147965505719185, -0.05037201568484306, 0.04590011015534401, 0.015917014330625534, 0.05726294592022896, 0.07058216631412506, 0.0021570890676230192, 0.031393762677907944, -0.027224620804190636, 0.05012540519237518, -0.027364686131477356, 0.04177425801753998, -0.002182705793529749, -0.07187476009130478, 0.05629498139023781, -0.0006016839761286974, 0.07088671624660492, 0.02909126505255699, -0.008045363239943981, -0.04950554296374321, 0.06434864550828934, -0.02021990343928337, 0.03765067085623741, -0.04704480245709419, -0.0462440550327301, 0.08608657121658325, 0.006114779971539974, 0.040457457304000854, 0.03824382275342941, -0.010028290562331676, 0.022670749574899673, -0.04881522059440613, -0.05674000084400177, -0.028756488114595413, -0.03222730755805969, -0.00567410234361887, 0.03539656475186348, 0.037905070930719376, 0.009455783292651176, -0.09135746210813522, 0.06680960953235626, -0.08749044686555862, -0.017818985506892204, -0.06469087302684784, -0.04641878604888916, 0.012013268657028675, -0.017641767859458923, -0.012249954044818878, 0.24228543043136597, -0.06405195593833923, -0.025081316009163857, -0.002814781153574586, -0.026402467861771584, 0.07825696468353271, 0.07250209897756577, 0.05036882683634758, 0.07883978635072708, -0.06246726214885712, -0.03291931375861168, -0.03301173076033592, -0.04460781812667847, -0.0044424827210605145, 0.0071763768792152405, -0.05713614076375961, 0.0874970331788063, 0.003401282010599971, 0.04209974780678749, -0.008108549751341343, -0.0026738799642771482, -0.02052346244454384, -0.005385949742048979, 0.01768612489104271, 0.016220731660723686, -0.0016845049103721976, 0.09688019007444382, -0.04166508838534355, 0.020102595910429955, 0.003887555794790387, -0.05790653079748154, 0.08533896505832672, 0.011837291531264782, 0.008654840290546417, 0.0755833238363266, 0.022063342854380608, 0.02168145217001438, -0.030943134799599648, 0.011221851222217083, 0.06854607164859772, 0.0014214952243492007, -0.006973078940063715, -0.032189276069402695, -0.050109170377254486, -0.015626920387148857, 0.022106140851974487, 0.022824987769126892, 0.003882076358422637, -0.008344019763171673, 0.0005549397319555283, 0.042476505041122437, -0.020882390439510345, 0.025097845122218132, -0.015171140432357788, 0.012019528076052666, 0.029991229996085167, 0.03324904292821884, -0.010031499899923801, -0.010908183641731739, -0.05509404465556145, -0.002285734284669161, -0.026469919830560684, 0.030754579231142998, 0.055411119014024734, 0.009461984038352966, 0.004334756173193455, -0.009012840688228607, -0.04148712754249573, -0.030083725228905678, 0.021920202299952507, 0.023209813982248306, 0.007447850424796343, -0.016203155741095543, -0.0019646238069981337, -0.0041449847631156445, -0.006163421086966991, 0.023917969316244125, -0.002833915175870061, -0.04368824511766434, 0.04058290645480156, 0.025483986362814903, 0.020699160173535347, -0.020834539085626602, -0.010335022583603859, -0.029800716787576675, 0.02108181267976761, -0.0017419207142665982, -0.0015879377024248242, -0.0988834947347641, -0.039744555950164795, -0.015005487948656082, 0.031043801456689835, 0.010626441799104214, -0.0185757577419281, 0.022860130295157433, -0.005403910297900438, 0.020863452926278114, 0.007461889181286097, -0.007450531702488661, -0.006169851403683424, 0.016416409984230995, -0.007650292944163084, 0.012998487800359726, -0.01269105076789856, -0.034114569425582886, -0.01775016076862812, 0.03391684964299202, 0.03404282033443451, -0.03486200049519539, 0.06005368381738663, 0.020224209874868393, 0.005967078730463982, -0.011441109701991081, -0.05896376818418503, 0.04080478847026825, -0.009527957998216152, 0.009457471780478954, -0.04732933267951012, -0.004150546155869961, 0.02427869476377964, -0.016102507710456848, 0.016879642382264137, -0.050001002848148346, 0.0030384836718440056, -0.007550424430519342, -0.004870384931564331, 0.05046715587377548, 0.03668597713112831, -0.005787610076367855, -0.01502848882228136, 0.007203728426247835, -0.01863074116408825, 0.03273409605026245, -0.04021678864955902, -0.023757703602313995, 0.0243715588003397, 0.0073390561155974865, -0.06748825311660767, -0.0014890443999320269, -0.011759663932025433, 0.014757061377167702, 0.06084902212023735, 0.04561014845967293, 0.003801313228905201, -0.0039720116183161736, 0.004488072358071804, 0.0031948452815413475, -0.01417007576674223, -0.04372066259384155, 0.028289873152971268, -0.008617653511464596, -0.013771070167422295, -0.014436734840273857, 0.06843756884336472, -0.0020922033581882715, -0.024433910846710205, -0.008499275892972946, 0.023520510643720627, 0.01904481276869774, 0.061977073550224304, -0.025010190904140472, 0.001553790527395904, -0.031457845121622086, 0.008222582750022411, 0.009105767123401165, -0.017650345340371132, 0.03759906813502312, 0.04439045861363411, -0.060416653752326965, -0.018540158867836, -0.007972941733896732, -0.00963657908141613, -0.007336827460676432, 0.002063451102003455, 0.02241780422627926, -0.0035673726815730333, 0.046987444162368774, 0.04725053906440735, -0.006895233877003193, -0.005126343108713627, 0.012223372235894203, -0.004933536052703857, -0.00028239269158802927, -0.012683791108429432, -0.01865069940686226, 0.020914560183882713, 0.004014004487544298, -0.035088829696178436, 0.01413794793188572, -0.04143562912940979, -0.016561228781938553, -0.017812777310609818, -0.012741326354444027, 0.045738935470581055, -0.03413112461566925, -0.04632272943854332, 0.027668815106153488, -0.01135223638266325, 0.0025921345222741365, 0.027944844216108322, -0.00688919285312295, -0.01117633655667305, 0.04762176051735878, 0.03190825507044792, -0.01193377748131752, 0.02090960182249546, -0.02990991622209549, 0.03633490949869156, -0.007648713421076536, 0.03736631199717522, -0.024587981402873993, -0.020953183993697166, 0.005910769570618868, 0.0032576262019574642, 0.023891834542155266, 0.014972599223256111, -0.0007762724417261779, -0.004822378512471914, -0.010297889821231365, -0.005881511606276035, 0.006461570039391518, -0.0067550064995884895, 0.02224353328347206, 0.004638383165001869, -0.022060658782720566, 0.017471183091402054, 0.0010215872898697853, 0.004645748063921928, -0.04321349039673805, 0.003565925871953368, 0.013967587612569332, -0.025078201666474342, 0.02984512597322464, -0.0112362802028656, -0.0723610371351242, -0.009898394346237183, -0.007900051772594452, 0.06724957376718521, -0.01798931509256363, -0.011495704762637615, -0.013116300106048584, 0.03359775245189667, 0.039094049483537674, -0.025564389303326607, -0.007498249877244234, 0.012958910316228867, 0.012148983776569366, 0.045446205884218216, -0.004030931740999222, 0.006733810529112816, -0.014677466824650764, -0.0011788203846663237, -0.012371765449643135, -0.0036522336304187775, -0.012937424704432487, -0.03370078280568123, -0.02478657104074955, 0.03737882897257805, -0.00010342452878830954, 0.021293019875884056, 0.005693015642464161, -0.006485353223979473, -0.04336348548531532, 0.04820503294467926, 0.026832586154341698, 0.02204190380871296, -0.048948150128126144, 0.01726173795759678, -0.037151940166950226, -0.011061984114348888, 0.03813645988702774, 0.008455220609903336, 0.02501467429101467, -0.006994722411036491, 0.07096751779317856, 0.0576116107404232, -0.015260867774486542, 0.017369862645864487, -0.016688741743564606, 0.004727841820567846, -0.0004968168213963509, -0.026400817558169365, 0.008894280530512333, -0.03325122967362404, -0.029038649052381516, -0.009058869443833828, 0.007193167693912983, -0.013595829717814922, 0.03498352691531181, 0.0046622250229120255, -0.03861640393733978, -0.02651815488934517, 0.0007997286156751215, 0.01744261011481285, -0.000020552470232360065, -0.021500783041119576, 0.009552855044603348, -0.026545291766524315, 0.002910819835960865, 0.0014894648920744658, -0.011739978566765785, -0.03369343653321266, -0.0008020834065973759, -0.025203494355082512, 0.005772857461124659, -0.0023563283029943705, 0.013611196540296078, 0.03655604273080826, -0.005685355048626661, -0.011350816115736961, -0.0060785007663071156, -0.027382973581552505, 0.037421002984046936, -0.035435955971479416, 0.009758626110851765, 0.0008003530674614012, 0.004263483919203281, 0.0410861112177372, 0.032698359340429306, 0.005090995226055384, 0.017705576494336128, -0.009261230938136578, 0.03608957305550575, 0.003505717497318983, -0.04384250193834305, 0.03712236508727074, 0.03511485084891319, -0.0037603715900331736, -0.010855631902813911, 0.0000018304170907867956, -0.03742465376853943, 0.0013545142719522119, -0.03155384957790375, 0.02000243589282036, 0.06891214847564697, 0.006866302341222763, -0.023556169122457504, 0.024196788668632507, 0.01695518009364605, -0.01629747822880745, 0.0004639948601834476, -0.022919705137610435, 0.025175100192427635, 0.02547621913254261, 0.042799558490514755, 0.005311898421496153, 0.012821079231798649, -0.008348947390913963, 0.03432098776102066, -0.06962697207927704, -0.006882034707814455, 0.035412319004535675, -0.0058081550523638725, -0.00872009713202715, 0.02109299600124359, -0.03694740682840347, 0.016700148582458496, 0.03279022127389908, 0.02918068878352642, 0.029567547142505646, -0.01076060626655817, 0.011033069342374802, -0.010025549679994583, -0.03015957586467266, 0.021709345281124115, 0.05497961863875389, -0.006980612874031067, 0.052434466779232025, 0.02275782637298107, 0.05821358785033226, 0.013936035335063934, 0.010626636445522308, 0.025007329881191254, 0.011434639804065228, 0.08548004925251007, 0.0045644971542060375, 0.05669108405709267, 0.020588383078575134, -0.01371952798217535, -0.01731782779097557, -0.021767111495137215, -0.017540931701660156, -0.016779154539108276, -0.01894824393093586, 0.03516894951462746, -0.0259756650775671, 0.023251136764883995, -0.015376020222902298, 0.06657969206571579, 0.005422727670520544, 0.06089501082897186, -0.013095810078084469, 0.016232214868068695, 0.042255304753780365, 0.02130242809653282, 0.01784607768058777, 0.013690851628780365, -0.014733565971255302, -0.011636222712695599, 0.05647050589323044, 0.04396926984190941, 0.05523024499416351, -0.029492050409317017, 0.010195288807153702, 0.028837313875555992, -0.039756566286087036, -0.015137891285121441, 0.009037182666361332, 0.01363985426723957, -0.010822880081832409, 0.0039109778590500355, 0.0022998221684247255, 0.0011442967224866152, -0.00027416215743869543, -0.005926050245761871, 0.0038799536414444447, -0.004629152361303568, -0.018034372478723526, 0.03567541390657425, 0.03830891475081444, -0.0006065028137527406, 0.0060511184856295586, -0.01197123620659113, -0.022023778408765793, 0.03479103371500969, 0.000903979002032429, -0.04363881051540375, -0.03491077199578285, -0.02202230505645275, -0.030819641426205635, -0.02170714922249317, 0.009396376088261604, -0.002810194855555892, -0.016367821022868156, -0.010457043536007404, 0.04501728340983391, 0.018380453810095787, 0.039884600788354874, 0.02012559212744236, 0.024120114743709564, -0.044027090072631836, 0.003309175604954362, -0.005914885550737381, -0.031276997178792953, 0.008731231093406677, -0.026420440524816513, 0.039190564304590225, -0.024744799360632896, -0.007416234351694584, 0.05312595143914223, 0.04809706658124924, -0.0178801529109478, -0.03343060612678528, 0.008251570165157318, -0.011396006681025028, -0.030917169526219368, 0.053516935557127, -0.010473467409610748, -0.020586514845490456, -0.0067157018929719925, -0.003477242076769471, 0.009405822493135929, -0.0026502248365432024, 0.029868800193071365, 0.07765131443738937, 0.014492230489850044, -0.0418679304420948, 0.01863986812531948, 0.0178701039403677, 0.030005943030118942, 0.01054441463202238, 0.04245007038116455, -0.0005247235530987382, -0.0009543011547066271, -0.05471384897828102, 0.0013034509029239416, -0.03283068537712097, -0.008309264667332172, -0.036389824002981186, -0.03734621778130531, -0.022538114339113235, 0.003946217242628336, -0.004133132752031088, 0.006039796397089958, -0.07034289091825485, 0.003642152063548565, -0.017636841163039207, -0.016262464225292206, 0.02206040360033512, -0.011234697885811329, 0.028581198304891586, 0.04775354266166687, -0.0017138957045972347, 0.011526773683726788, -0.027255114167928696, 0.007077071350067854, -0.005496536381542683, 0.017974942922592163, 0.02410462312400341, 0.018721751868724823, -0.013254719786345959, -0.026884257793426514, -0.017014436423778534, 0.002840750152245164, -0.06344322115182877, 0.00863679964095354, 0.018271148204803467, -0.04320889711380005, -0.039944328367710114, 0.014133449643850327, 0.00543843861669302, -0.04055045172572136, 0.030404290184378624, -0.011487617157399654, 0.0032941391691565514, -0.009097669273614883, -0.01146684493869543, -0.07696899026632309, -0.006120129954069853, 0.006520609837025404, 0.005128951743245125, 0.044366687536239624, 0.0088437395170331, 0.0024432989303022623, -0.02666028030216694, 0.022988488897681236, -0.014043033123016357, -0.0037376689724624157, -0.034985970705747604, -0.0581665001809597, 0.004301943350583315, 0.04107704013586044, -0.00631488673388958, -0.041929710656404495, 0.025614066049456596, -0.00605261093005538, -0.029087921604514122, -0.002930385060608387, -0.001635484048165381, 0.008856064639985561, -0.02774510160088539, 0.012152262963354588, -0.017832422628998756, 0.07633308321237564, 0.03368162736296654, -0.009046642109751701, -0.06467653810977936, 0.0031227010767906904 ]
Welcome spaCy to the 🤗 Hub
osanseviero
July 13, 2021
spacy
open-source-collab, nlp
https://huggingface.co/blog/spacy
Using existing models All models from the Hub can be directly installed using pip install. bash pip install https://huggingface.co/spacy/en_core_web_sm/resolve/main/en_core_web_sm-any-py3-none-any.whl python # Using spacy.load(). import spacy nlp = spacy.load("en_core_web_sm") # Importing as module. import en_core_web_sm nlp = en_core_web_sm.load() When you open a repository, you can click Use in spaCy and you will be given a working snippet that you can use to install and load the model! You can even make HTTP requests to call the models from the Inference API, which is useful in production settings. Here is an example of a simple request: bash curl -X POST --data '{"inputs": "Hello, this is Omar"}' https://api-inference.huggingface.co/models/spacy/en_core_web_sm >>> [{"entity_group":"PERSON","word":"Omar","start":15,"end":19,"score":1.0}] And for larger-scale use cases, you can click "Deploy > Accelerated Inference" and see how to do this with Python.
[ 0.0027182470075786114, 0.011454461142420769, 0.0035055081825703382, 0.01969832554459572, 0.055833179503679276, 0.06411182880401611, 0.05533056706190109, 0.07621918618679047, -0.015849154442548752, -0.02594386227428913, -0.10548955202102661, 0.044777002185583115, -0.006715414114296436, 0.06733103096485138, 0.06220986321568489, -0.05395488068461418, 0.023425601422786713, -0.002773773390799761, -0.048244647681713104, 0.04563622921705246, -0.015702851116657257, 0.0009021948208101094, 0.02760765329003334, 0.011971032246947289, -0.04300013557076454, -0.05423862487077713, 0.0655977874994278, 0.03811110556125641, -0.04247470572590828, 0.006040641572326422, -0.07207290828227997, 0.0037939799949526787, -0.03800107538700104, -0.03006790019571781, 0.04309234395623207, 0.06021878123283386, -0.11677588522434235, 0.04057609662413597, 0.034916214644908905, -0.03481757268309593, -0.009505538269877434, 0.002697148360311985, -0.04035785421729088, 0.020213905721902847, 0.008091236464679241, -0.043169137090444565, -0.13522572815418243, 0.04217294603586197, -0.0002769501879811287, -0.04561951383948326, -0.10355260968208313, 0.054283879697322845, -0.020780811086297035, -0.04472072422504425, 0.010617047548294067, 0.00312635931186378, -0.021590568125247955, -0.081003338098526, 0.009456964209675789, 0.0027651165146380663, 0.023442428559064865, 0.02634653076529503, -0.013362564146518707, 0.015014906413853168, -0.009883824735879898, 0.009337907657027245, -0.021775176748633385, -0.012485344894230366, -0.04467516392469406, -0.017703939229249954, 0.0367077961564064, -0.0298966895788908, -0.029467947781085968, -0.02737114019691944, 0.020197322592139244, -0.07049576193094254, 0.028021248057484627, 0.03649713471531868, 0.033528584986925125, 0.02842283993959427, 0.029593802988529205, -0.00029370217816904187, 0.010249740444123745, 0.046288762241601944, 0.05983462184667587, 0.07497725635766983, 0.0016017118468880653, -0.023950446397066116, -0.050757989287376404, 0.06489395350217819, 0.013334966264665127, -0.0933523029088974, -0.003439808264374733, 0.05725054070353508, 0.08358320593833923, 0.0407298319041729, 0.035285212099552155, 0.04217314347624779, -0.04839235544204712, -0.0480242520570755, -0.033960700035095215, -0.012645972892642021, -0.026942260563373566, -0.03853056952357292, -0.0016336003318428993, 0.03825157508254051, 0.020714476704597473, -0.08582272380590439, -0.03630811721086502, -0.03189026191830635, 0.03595990687608719, -0.06997393071651459, 0.0008173253736458719, 0.08635200560092926, -0.0692412331700325, 0.017726965248584747, 0.0050760000012815, 0.02161945402622223, 0.025938700884580612, 0.030734030529856682, 0.025426097214221954, 0.0361742302775383, 0.01464766077697277, 0.012039805762469769, 0.08740933239459991, 0.06856247782707214, 0.04533533379435539, -0.013876011595129967, -0.010617091320455074, -0.026570800691843033, 0.10203482210636139, -0.02752377837896347, 0.09949079155921936, 0.012512766756117344, 0.012158641591668129, -0.02989429049193859, 0.0017902968684211373, -0.028177812695503235, 0.031341344118118286, -0.0031423617620021105, -0.003208290785551071, 0.09846194088459015, -0.022507410496473312, 0.04907806217670441, 0.0777750238776207, 0.030744604766368866, -0.06911838054656982, 0.03674467280507088, -0.021084647625684738, 0.016046296805143356, -0.09978490322828293, 0.07358702272176743, 0.0084642693400383, -0.04895219951868057, 0.0006106849759817123, 0.03519708290696144, -0.01884547248482704, 0.02493937686085701, -0.013020209036767483, -0.030467648059129715, -0.031622279435396194, -0.02105250209569931, -0.11832858622074127, -0.007777869701385498, 0.009139335714280605, -0.07014003396034241, 0.009573705494403839, -0.027482792735099792, 0.05570481717586517, 0.0008946671732701361, 0.012842006050050259, -0.0067569660022854805, 0.031010683625936508, -0.038319509476423264, 0.05479109659790993, 0.03781043738126755, 0.0288860984146595, 0.0653877928853035, -0.008459233678877354, 0.006201555021107197, -0.05183223634958267, 0.06450171768665314, -0.07248672097921371, 0.052900440990924835, 0.06441531330347061, -0.058934640139341354, 0.019474901258945465, -0.0031705733854323626, 0.02968098782002926, 0.006612343247979879, -0.017005881294608116, -0.0573730394244194, 0.10100613534450531, 0.011635078117251396, 0.0032012690789997578, -0.011871003545820713, -0.021420611068606377, 0.086143359541893, 0.032081812620162964, 0.04181171953678131, 0.01956748776137829, -0.009726152755320072, 0.022396376356482506, -0.039186764508485794, -0.030128326267004013, 0.04081222042441368, -0.050948601216077805, -0.07551349699497223, 0.02818414382636547, 0.03951377794146538, -0.029823383316397667, -0.10817379504442215, 0.07782422006130219, -0.12080930173397064, -0.00427387235686183, -0.07468177378177643, -0.05959856137633324, 0.00784101989120245, -0.044729504734277725, -0.003569680033251643, 0.24240797758102417, -0.006661467719823122, 0.013585525564849377, -0.05763963609933853, -0.03691263869404793, 0.04139355197548866, 0.0514230914413929, 0.05153957009315491, 0.022531915456056595, -0.025759942829608917, -0.00911348033696413, -0.05605399236083031, -0.03436620905995369, 0.022088201716542244, 0.029314689338207245, -0.007753034122288227, 0.0003822432772722095, -0.016543252393603325, -0.026310276240110397, -0.002206602832302451, 0.04896595701575279, -0.0504092276096344, -0.029021253809332848, -0.0017969950567930937, 0.00513656809926033, 0.018633222207427025, 0.08482109755277634, 0.008404585532844067, -0.016441551968455315, -0.016649775207042694, -0.08186335861682892, 0.023033928126096725, 0.0537756085395813, 0.02564769983291626, 0.025057639926671982, 0.03972657769918442, -0.0038635036908090115, -0.03271012380719185, -0.019037296995520592, 0.05342964455485344, 0.005983174778521061, 0.00597823690623045, -0.03561105206608772, -0.0683082789182663, -0.01341561321169138, 0.010177497752010822, -0.01521347463130951, -0.02542078122496605, -0.014774639159440994, -0.049038033932447433, 0.02941088005900383, -0.02581198886036873, 0.019385242834687233, 0.012801830656826496, 0.006954408250749111, 0.023431118577718735, 0.012837421149015427, -0.02905341237783432, -0.007139026653021574, -0.04120541736483574, -0.00513180997222662, -0.0706147626042366, 0.03494910150766373, 0.014508548192679882, 0.017990222200751305, -0.027985619381070137, 0.001181187340989709, -0.06649560481309891, -0.008861182257533073, 0.034672826528549194, 0.0034648904111236334, 0.02034059166908264, 0.01033430453389883, -0.0054990085773169994, -0.025387052446603775, 0.0008902111439965665, 0.018096502870321274, -0.009231187403202057, 0.019387230277061462, 0.027310343459248543, -0.002913640346378088, -0.0047981045208871365, 0.03375966474413872, -0.019912509247660637, -0.022779563441872597, 0.017490047961473465, 0.004698733799159527, -0.028492094948887825, -0.09673231095075607, -0.027213234454393387, -0.04134155064821243, -0.003419770859181881, 0.03804551064968109, -0.010578692890703678, 0.056955959647893906, -0.03444501385092735, 0.0060578156262636185, 0.005864339414983988, -0.022030755877494812, 0.008095253258943558, 0.04171537980437279, 0.002620924497023225, -0.004168366547673941, 0.02070363238453865, -0.012929917313158512, -0.017179379239678383, 0.02536068856716156, 0.02462722733616829, -0.04328116029500961, 0.02578887529671192, 0.001690495410002768, -0.010855195112526417, -0.010504117235541344, -0.019223442301154137, 0.020098522305488586, 0.024638446047902107, 0.009449276141822338, -0.04899650067090988, -0.010711915791034698, -0.026507822796702385, -0.03222780302166939, 0.007575023919343948, -0.0500946119427681, -0.029197322204709053, 0.009652536362409592, 0.02422039769589901, 0.044070176780223846, 0.02950478345155716, -0.014616756699979305, -0.008418029174208641, -0.006335060577839613, -0.020867737010121346, -0.0005583218880929053, -0.008748678490519524, 0.005697866901755333, 0.029828570783138275, -0.006731714121997356, -0.020679745823144913, -0.0472748763859272, -0.02318381704390049, 0.03388797864317894, 0.04278126731514931, 0.014153880998492241, 0.009563933126628399, 0.01358406338840723, 0.0332271084189415, 0.01988859288394451, -0.019311290234327316, -0.041010137647390366, 0.025968534871935844, -0.0046956283040344715, -0.057263996452093124, -0.011088723316788673, 0.03604733571410179, -0.006720630452036858, -0.01003564428538084, -0.021096764132380486, 0.011651147156953812, -0.029533855617046356, 0.06049997732043266, -0.01787927933037281, 0.013211041688919067, 0.00851425901055336, -0.004538426175713539, -0.004151855129748583, -0.029247017577290535, 0.07204946875572205, 0.04784363880753517, -0.016318483278155327, -0.01472651120275259, -0.037896715104579926, -0.02491743676364422, -0.052429575473070145, -0.009354951791465282, 0.03186926618218422, -0.018108155578374863, 0.026598550379276276, 0.00754652451723814, -0.0159792210906744, -0.013664943166077137, 0.02128903567790985, 0.0010178530355915427, -0.03121136873960495, -0.04628395661711693, -0.016002895310521126, 0.020920947194099426, -0.0012619041372090578, -0.008956977166235447, 0.015593991614878178, -0.01367272436618805, -0.028981341049075127, 0.008370449766516685, -0.011595535092055798, 0.010531922802329063, -0.029390646144747734, -0.019956592470407486, 0.004509777296334505, -0.02427198551595211, 0.0055478764697909355, 0.004081252031028271, -0.024383047595620155, -0.03727244958281517, 0.028135061264038086, 0.024506067857146263, -0.002724011894315481, 0.0010009277611970901, -0.03780527040362358, 0.048530757427215576, 0.01373746432363987, 0.005873339716345072, -0.018949009478092194, -0.03257777541875839, -0.01554535049945116, -0.018511248752474785, 0.03420189768075943, 0.024609100073575974, 0.014204694889485836, 0.018248029053211212, -0.014366751536726952, 0.000926338427234441, 0.0030377667862921953, 0.004274207167327404, 0.0017398264026269317, -0.0005536016542464495, 0.02693917602300644, 0.006509401835501194, -0.0006022841553203762, 0.029962893575429916, -0.04906478524208069, -0.005498524755239487, 0.03450664505362511, -0.017565518617630005, 0.01061706617474556, 0.005281121004372835, -0.03751141205430031, -0.02072272077202797, -0.0380333848297596, 0.058130353689193726, 0.023876138031482697, 0.019344693049788475, 0.008864945732057095, 0.01553207915276289, 0.03785184398293495, -0.02913263626396656, 0.006450490094721317, -0.00397460674867034, -0.006174080073833466, 0.05790383368730545, -0.02319263480603695, 0.022442607209086418, -0.00661595119163394, 0.0021754184272140265, 0.011514519341289997, 0.009586418978869915, -0.02332986332476139, -0.07350645214319229, -0.0353882722556591, 0.027167316526174545, -0.01666029915213585, 0.013559048064053059, 0.025897543877363205, -0.04934009164571762, 0.007954107597470284, 0.06694845855236053, 0.04984965920448303, 0.012359421700239182, -0.050141990184783936, 0.025438327342271805, -0.032102249562740326, -0.009740435518324375, 0.033922143280506134, -0.02515188232064247, -0.010433643124997616, 0.03728184103965759, 0.06559329479932785, 0.03556455671787262, 0.032454509288072586, -0.014167961664497852, -0.018147626891732216, 0.014040706679224968, 0.02386287786066532, -0.043821852654218674, -0.0038113677874207497, -0.00955335795879364, -0.02400217577815056, -0.020767265930771828, 0.00010969526192639023, -0.02788497321307659, 0.04231879115104675, 0.04227674379944801, -0.02353033423423767, -0.03289870172739029, 0.03389214351773262, -0.013529179617762566, 0.005490578711032867, 0.004642012529075146, 0.03234538063406944, 0.0074651786126196384, -0.02190352790057659, 0.013084104284644127, -0.01485257875174284, -0.00749619584530592, -0.007821890525519848, -0.02549118734896183, -0.020354095846414566, 0.026337267830967903, 0.013802501372992992, 0.0638761892914772, -0.013065421022474766, -0.039376113563776016, -0.006729027722030878, 0.005799241829663515, 0.022267494350671768, -0.05045924708247185, 0.017852095887064934, 0.03347398713231087, 0.007757431361824274, 0.015598595142364502, 0.03401223197579384, -0.02619440294802189, 0.011372851207852364, 0.01466316357254982, 0.05119683966040611, 0.010506438091397285, -0.024722224101424217, 0.011718813329935074, -0.001815869938582182, -0.02774329110980034, -0.001398486434482038, -0.03748641908168793, -0.06868220865726471, 0.020808055996894836, -0.04091959074139595, 0.028131594881415367, 0.0645088255405426, 0.014180087484419346, -0.0072103217244148254, 0.016590142622590065, 0.004597801715135574, -0.008629308082163334, -0.0034689679741859436, 0.0018311027670279145, -0.0007262982544489205, 0.0385390929877758, 0.027471764013171196, -0.0009970550891011953, -0.004146496299654245, -0.0035484011750668287, 0.048559628427028656, -0.021481556817889214, 0.0013791051460430026, 0.0432102344930172, -0.04777447506785393, -0.009737364016473293, 0.006902556866407394, -0.07605978846549988, -0.029486801475286484, 0.022598376497626305, 0.04505891725420952, 0.061520252376794815, -0.028110956773161888, 0.016071226447820663, -0.0005573361413553357, -0.005807566922158003, 0.036788150668144226, 0.058819763362407684, -0.035425033420324326, 0.048194240778684616, 0.021123772487044334, 0.04223012924194336, -0.002700838493183255, 0.000015114138477656525, -0.0001067740231519565, 0.01706378534436226, 0.07403367012739182, 0.02157290279865265, 0.035348162055015564, 0.05264344438910484, 0.014748912304639816, 0.021078135818243027, -0.049430325627326965, -0.0028358078561723232, -0.016441375017166138, 0.0027434565126895905, 0.009985189884901047, -0.026115715503692627, 0.018430672585964203, -0.012846051715314388, 0.026956889778375626, 0.03463408350944519, 0.057426873594522476, -0.02343326061964035, 0.005691589321941137, 0.025168854743242264, -0.003970114979892969, 0.0025998963974416256, 0.03470698371529579, -0.009049748070538044, -0.010567519813776016, 0.04429667443037033, 0.03773782029747963, 0.03144439682364464, -0.0652632862329483, 0.020339038223028183, 0.023208027705550194, -0.037124715745449066, -0.028231320902705193, 0.028209473937749863, 0.041497599333524704, -0.00930304266512394, -0.030669065192341805, 0.03181453049182892, -0.009784218855202198, -0.011855647899210453, -0.027877971529960632, -0.01605212315917015, -0.022121837362647057, -0.022127805277705193, -0.008132820017635822, 0.03859252855181694, -0.002689969725906849, -0.013133746571838856, -0.01869487762451172, 0.005514589603990316, 0.03043893724679947, -0.006558509077876806, -0.010952604003250599, -0.01663864403963089, -0.035201236605644226, -0.02561744675040245, -0.033642422407865524, 0.016675196588039398, -0.002077976707369089, -0.03681020438671112, -0.019069643691182137, 0.04785478487610817, 0.011647596023976803, 0.024913130328059196, -0.001548876753076911, 0.045264121145009995, -0.033697810024023056, 0.00009620072523830459, -0.021559830754995346, -0.014500456862151623, 0.01714663952589035, -0.013250133022665977, 0.027067190036177635, -0.027089687064290047, 0.021772898733615875, 0.05981644243001938, 0.02651229128241539, -0.01493044849485159, -0.02276402898132801, 0.023282695561647415, 0.013306262902915478, -0.027719495818018913, 0.0796806663274765, -0.0010995229240506887, 0.04955713450908661, 0.01453961618244648, 0.004310073330998421, 0.012174990959465504, 0.0035449531860649586, -0.004791362676769495, 0.03556769713759422, -0.00045516699901781976, -0.01923738792538643, 0.001631684834137559, 0.030289091169834137, 0.02199508436024189, 0.027440527454018593, 0.04495612904429436, 0.013724674470722675, 0.012601339258253574, -0.02567243203520775, 0.005970664322376251, -0.029468387365341187, 0.008397410623729229, -0.039880625903606415, -0.05998801812529564, -0.01999928615987301, -0.0013212828198447824, -0.00975332036614418, 0.00786050595343113, -0.04708551615476608, -0.021132607012987137, -0.043890535831451416, -0.009936767630279064, 0.009342528879642487, 0.007011743262410164, 0.0389806292951107, 0.050335176289081573, -0.005246067885309458, -0.002199264243245125, -0.0457712821662426, 0.020568151026964188, -0.0538240447640419, 0.03363717719912529, 0.025509346276521683, 0.014097796753048897, -0.029308050870895386, -0.008362104184925556, 0.010095488280057907, 0.035159625113010406, -0.07811503112316132, 0.01485099270939827, 0.017390310764312744, -0.025880852714180946, -0.06735363602638245, 0.0228721983730793, 0.009050055406987667, -0.005925064440816641, 0.04247674345970154, 0.0009286276763305068, -0.017395421862602234, 0.004107588902115822, 0.00491378316655755, -0.05906827002763748, -0.041618991643190384, -0.02859826758503914, -0.01419172901660204, 0.004128055181354284, 0.021097546443343163, -0.007540937513113022, -0.009448790922760963, 0.002302244771271944, 0.00583624467253685, 0.006527664605528116, -0.020141394808888435, -0.046829354017972946, -0.0066933888010680676, 0.04953968524932861, -0.023159919306635857, -0.02404356189072132, 0.011619855649769306, -0.00867706723511219, -0.026356138288974762, 0.010854230262339115, 0.03223209083080292, -0.01979450136423111, -0.0024761571548879147, 0.01319711934775114, 0.008409515954554081, 0.03905298933386803, 0.04019126296043396, -0.03802734613418579, -0.06435433775186539, -0.0014707983937114477 ]
Welcome spaCy to the 🤗 Hub
osanseviero
July 13, 2021
spacy
open-source-collab, nlp
https://huggingface.co/blog/spacy
Finding models Over 60 canonical models can be found in the spaCy org. These models are from the latest 3.1 release, so you can try the latest realesed models right now! On top of this, you can find all spaCy models from the community here https://huggingface.co/models?filter=spacy.
[ 0.02922714874148369, -0.032049380242824554, 0.019173143431544304, 0.0034764548763632774, 0.03160584345459938, 0.014788332395255566, 0.050944872200489044, 0.035493381321430206, -0.06125810369849205, 0.025375811383128166, -0.05309173837304115, 0.026111148297786713, 0.006285172887146473, 0.07689031958580017, 0.028744637966156006, -0.051390182226896286, -0.020133038982748985, 0.04642428457736969, 0.0025152876041829586, -0.008304980583488941, 0.0019494259031489491, 0.003481637453660369, 0.033714570105075836, -0.04148436710238457, -0.020352162420749664, -0.0027095754630863667, 0.05089423805475235, 0.03125756233930588, -0.031950414180755615, 0.018441200256347656, -0.11508279293775558, 0.016969142481684685, -0.009382111951708794, -0.06056628003716469, 0.0035574696958065033, 0.030593330040574074, -0.15402764081954956, 0.00357886403799057, 0.017020970582962036, -0.022994663566350937, -0.0472758449614048, -0.042742107063531876, -0.05479677766561508, 0.03268437087535858, 0.049015745520591736, -0.04563689976930618, -0.13144870102405548, 0.02381208725273609, -0.0015505630290135741, -0.02634456194937229, -0.06291276216506958, 0.032914724200963974, -0.06973111629486084, -0.0070855701342225075, -0.01288456842303276, -0.024559510871767998, 0.005274727009236813, -0.04985003545880318, 0.015200714580714703, -0.01473535131663084, -0.013863642700016499, 0.03670629486441612, 0.025125956162810326, 0.017238568514585495, 0.01771385967731476, -0.002296292223036289, 0.0030531829688698053, -0.04300833120942116, -0.03453976660966873, 0.00998370349407196, 0.07184986025094986, 0.01284867338836193, 0.008067143149673939, -0.03941722959280014, -0.014753865078091621, -0.0015630413545295596, -0.021437596529722214, 0.04275844618678093, 0.02280595153570175, 0.035571977496147156, 0.04008980467915535, -0.026982389390468597, 0.03459036722779274, 0.03535102680325508, 0.011345786973834038, 0.03006349690258503, -0.012923597358167171, -0.04905505105853081, -0.013734310865402222, 0.025409003719687462, 0.0022488082759082317, -0.10098249465227127, -0.008853157050907612, -0.011185139417648315, 0.06439603120088577, 0.01390228420495987, 0.018683534115552902, -0.004740526899695396, -0.03936018794775009, -0.0174723993986845, -0.04986041784286499, -0.009003182873129845, 0.005676858592778444, -0.04768666625022888, -0.06978518515825272, -0.017386192455887794, -0.0038452446460723877, -0.061601508408784866, -0.021240925416350365, -0.030928315594792366, 0.009775347076356411, -0.04067953675985336, 0.0020546847954392433, 0.04567764326930046, -0.07396567612886429, 0.07067538052797318, -0.00739554688334465, 0.0245172418653965, 0.0026884633116424084, 0.06543835252523422, -0.022415408864617348, 0.04800171032547951, 0.06166841462254524, 0.00840390007942915, 0.08991793543100357, 0.10504589229822159, 0.04323315992951393, 0.014412102289497852, -0.02585551328957081, -0.05824241787195206, 0.02229241654276848, -0.026963522657752037, -0.029260773211717606, 0.027672791853547096, 0.05929458886384964, -0.08291198313236237, 0.008983335457742214, -0.015293181873857975, 0.02506699599325657, 0.004684390965849161, -0.038657303899526596, 0.05654444545507431, -0.01307382807135582, 0.030842619016766548, 0.09449554979801178, -0.024315156042575836, -0.088194839656353, 0.0465906485915184, -0.06915798783302307, 0.045602262020111084, -0.11123919486999512, 0.04311881959438324, 0.0015068523352965713, -0.04493727535009384, 0.024754216894507408, 0.02461969293653965, -0.04312999173998833, 0.009130660444498062, 0.00563682010397315, -0.037451889365911484, -0.020671119913458824, -0.056441761553287506, -0.0724559873342514, 0.010505097918212414, 0.008355209603905678, -0.05430210381746292, 0.0037181598600000143, 0.08050487190485, -0.027689436450600624, 0.023993905633687973, 0.011163941584527493, -0.01134865079075098, 0.052189771085977554, -0.013408630155026913, -0.009740602225065231, -0.010474621318280697, 0.08192910254001617, 0.03276510536670685, -0.0006089439266361296, 0.019072331488132477, -0.03623570501804352, -0.03735071048140526, -0.063224658370018, 0.046246569603681564, 0.06969569623470306, -0.07244479656219482, 0.04412633180618286, 0.02010537125170231, 0.07136442512273788, 0.0552351139485836, -0.017073994502425194, -0.06877591460943222, 0.043602947145700455, 0.04124922677874565, 0.012848195619881153, 0.014158441685140133, -0.05321565642952919, 0.0657208040356636, 0.045759327709674835, 0.018506113439798355, 0.044059157371520996, -0.018051400780677795, -0.014867561869323254, -0.033020514994859695, -0.059757690876722336, -0.002538540633395314, -0.04714331030845642, -0.020255908370018005, 0.027179161086678505, 0.06343974173069, 0.08652176707983017, -0.08969811350107193, 0.0375310517847538, -0.1299591064453125, -0.01653001829981804, -0.0660453587770462, -0.043043602257966995, 0.046149346977472305, 0.021598314866423607, -0.06275719404220581, 0.2762448489665985, -0.012874424457550049, -0.02625849097967148, -0.03510446473956108, -0.11494022607803345, 0.052052147686481476, 0.09019197523593903, 0.027081958949565887, 0.03771260753273964, -0.05568400397896767, 0.017461448907852173, -0.014885839074850082, -0.01914338394999504, 0.023046910762786865, 0.02080513909459114, -0.020100682973861694, 0.006227624602615833, -0.04839177429676056, 0.016354495659470558, 0.02647666446864605, 0.03452477976679802, -0.0385376513004303, 0.004555230960249901, 0.038344912230968475, 0.003455656347796321, 0.027141671627759933, 0.04648055508732796, 0.014138681814074516, -0.05807414650917053, -0.03012782707810402, -0.053362589329481125, 0.0344134122133255, -0.004817350767552853, -0.04273368418216705, 0.039108313620090485, 0.028683528304100037, -0.017951246351003647, -0.03512793406844139, -0.003871284192427993, 0.03696335107088089, 0.03398004174232483, -0.007197505794465542, -0.060606490820646286, -0.03504946827888489, -0.012229947373270988, -0.005440360866487026, -0.014303481206297874, -0.011461706832051277, -0.020048486068844795, -0.011762142181396484, 0.06587734073400497, -0.011117717251181602, 0.022655533626675606, -0.010834980756044388, -0.004859099630266428, 0.016732383519411087, 0.003872032044455409, -0.030412886291742325, -0.005591602995991707, -0.05432535707950592, 0.007922573946416378, -0.04609552025794983, 0.039350010454654694, 0.02454512193799019, 0.0015264787944033742, -0.007082125172019005, 0.019085697829723358, -0.054693467915058136, -0.009633085690438747, 0.023607835173606873, 0.011444948613643646, 0.03499353677034378, -0.01690731756389141, -0.017789326608181, -0.02571292594075203, -0.007373497821390629, 0.027276435866951942, 0.0221437718719244, -0.01834961585700512, 0.06428790837526321, -0.04117486625909805, 0.01655571535229683, 0.0025783544406294823, 0.01317574642598629, -0.04118046164512634, 0.0378759391605854, 0.010270596481859684, 0.007957961410284042, -0.10070726275444031, -0.03680615499615669, -0.03251899778842926, 0.02178269438445568, 0.013604742474853992, -0.008922620676457882, -0.01270211860537529, -0.02852088212966919, 0.0026362130884081125, 0.03517964482307434, -0.0028338120318949223, 0.023099247366189957, 0.02527613379061222, 0.03736749291419983, -0.05428155139088631, 0.03689156845211983, -0.03189787268638611, 0.011873911134898663, 0.0631416067481041, 0.01577693223953247, -0.016747774556279182, 0.04692479223012924, -0.015748368576169014, -0.021870486438274384, -0.01877846010029316, -0.02790644019842148, -0.0009582308121025562, 0.010692589916288853, 0.04569355770945549, -0.026910660788416862, -0.02768189273774624, 0.0519363097846508, -0.039443738758563995, 0.001037979032844305, -0.05149358883500099, 0.004177730996161699, -0.003669292898848653, 0.020916685461997986, 0.031015045940876007, 0.024587087333202362, 0.010575341992080212, -0.049555689096450806, 0.019051462411880493, -0.021627841517329216, -0.03474675491452217, -0.003968264441937208, 0.0018773943884298205, 0.05543704330921173, -0.002407380612567067, -0.042475149035453796, -0.03966910019516945, -0.029774922877550125, 0.03317553550004959, 0.03796575218439102, 0.049237210303545, -0.0025453860871493816, 0.031962886452674866, 0.005292654503136873, 0.03255133330821991, -0.0279464740306139, -0.03815086558461189, 0.0025100549682974815, -0.004742897115647793, -0.003861270844936371, -0.03238028287887573, 0.04359995946288109, -0.0037674654740840197, -0.00551892165094614, -0.015919923782348633, 0.04019004851579666, 0.004555405117571354, 0.03840422257781029, -0.03570634499192238, 0.00931099895387888, -0.028486918658018112, 0.019204629585146904, -0.004215197172015905, -0.05148014426231384, 0.04478601738810539, 0.02606276422739029, -0.045292675495147705, -0.04986804723739624, -0.04539076238870621, 0.009677179157733917, -0.022653814405202866, -0.04051344469189644, 0.03662583976984024, 0.006413198076188564, 0.03654635697603226, -0.007582376711070538, 0.0008136263350024819, -0.0017679034499451518, 0.031205400824546814, 0.025465460494160652, 0.005496211815625429, -0.0022453751880675554, -0.010675137862563133, 0.01325494609773159, 0.0159952063113451, 0.016670964658260345, 0.014711877331137657, -0.021001243963837624, -0.0026932950131595135, -0.017818422988057137, -0.0175683181732893, 0.005894791334867477, -0.03148931637406349, -0.021800287067890167, 0.0024006804451346397, -0.02427830547094345, -0.024862274527549744, -0.010136990807950497, -0.007841338403522968, -0.01773277297616005, 0.03012472577393055, 0.008794121444225311, -0.024757036939263344, 0.026633011177182198, -0.03676014021039009, 0.030809437856078148, 0.01823258027434349, 0.02663526125252247, -0.029740560799837112, -0.01092890091240406, -0.005842587910592556, -0.02355136349797249, -0.006874674931168556, 0.0244208462536335, -0.0022998640779405832, 0.04785338416695595, 0.034756362438201904, -0.0035072024911642075, 0.006612983997911215, 0.05144452676177025, -0.0052294647321105, 0.0041496590711176395, -0.001210682443343103, 0.013514951802790165, 0.020310021936893463, -0.017720134928822517, -0.02240600809454918, 0.004098203033208847, 0.00766981253400445, 0.0029671292286366224, 0.03532418608665466, -0.040511127561330795, -0.03471225127577782, -0.010379859246313572, -0.03222433477640152, 0.034355975687503815, 0.03981604799628258, -0.0017469560261815786, -0.025143079459667206, 0.031991925090551376, 0.005047992337495089, 0.0022328761406242847, -0.0015628911787644029, 0.020773600786924362, -0.020984888076782227, 0.04132504388689995, 0.0053495303727686405, -0.008057085797190666, -0.016030116006731987, 0.01444297842681408, 0.023175444453954697, 0.011431240476667881, -0.0038443461526185274, -0.07895500957965851, -0.03854282572865486, 0.03153352439403534, 0.009206782095134258, -0.004848743323236704, 0.010884825140237808, -0.01869269460439682, 0.012849714607000351, 0.014687062241137028, 0.08389338105916977, 0.009381001815199852, -0.02458850108087063, -0.0017463858239352703, -0.06733526289463043, 0.010877302847802639, 0.04028460755944252, -0.002644449006766081, 0.005447331350296736, 0.02506161294877529, 0.05640862509608269, 0.061881233006715775, 0.010899451561272144, 0.005468463059514761, 0.009945585392415524, 0.02269561216235161, 0.03637784719467163, -0.05681019276380539, -0.02139301598072052, -0.01918850652873516, 0.02814336121082306, 0.011382339522242546, -0.02823619917035103, -0.009336949326097965, 0.040827006101608276, 0.011991293169558048, -0.042250122874975204, -0.038804035633802414, 0.028451455757021904, 0.00935241486877203, 0.005863421130925417, -0.029334306716918945, 0.04652511328458786, -0.029233433306217194, -0.01107123214751482, 0.01025611162185669, -0.0403231680393219, -0.008697669953107834, -0.00898829661309719, -0.02424679324030876, -0.005772419273853302, -0.028190314769744873, -0.0004937984049320221, 0.06555178016424179, -0.001040860777720809, -0.02233932726085186, 0.011674214154481888, 0.0033178813755512238, 0.03582850471138954, -0.05336526408791542, 0.02250106818974018, 0.04687218368053436, -0.013470516540110111, 0.02250642329454422, -0.00017462910909671336, -0.014746997505426407, 0.03241261467337608, 0.006316650193184614, 0.01809457316994667, -0.019251568242907524, -0.03432564437389374, 0.043737027794122696, 0.027673346921801567, -0.018549352884292603, 0.02431464195251465, -0.001580819021910429, -0.045375607907772064, 0.011788640171289444, -0.04765668883919716, 0.025407616049051285, 0.05652691051363945, 0.015261414460837841, 0.0014594723470509052, 0.0034955900628119707, 0.0031041710171848536, 0.016140036284923553, -0.015629438683390617, 0.04873901233077049, 0.025621535256505013, 0.054325539618730545, 0.014041782356798649, 0.023460492491722107, -0.012369583360850811, 0.007725829258561134, 0.03841964900493622, -0.02843964286148548, 0.012791191227734089, 0.029990719631314278, -0.026654401794075966, -0.0045026205480098724, 0.006849970668554306, -0.05397183075547218, -0.007823154330253601, 0.031169835478067398, 0.04083573445677757, 0.042569927871227264, -0.019454453140497208, 0.0037605788093060255, -0.008487203158438206, -0.01116438303142786, 0.022562194615602493, 0.07817010581493378, -0.021615613251924515, 0.08309199661016464, -0.0069514173083007336, 0.04089166969060898, 0.03506932035088539, 0.028400758281350136, -0.0046778409741818905, 0.037577882409095764, 0.04462235048413277, -0.003777687205001712, 0.03916255757212639, 0.0018181920750066638, -0.03660212829709053, 0.002027370035648346, -0.07910697162151337, -0.014699776656925678, -0.026121152564883232, -0.0037125356029719114, 0.008624504320323467, -0.01666189730167389, 0.03691309690475464, -0.011241786181926727, 0.07721226662397385, -0.01718067191541195, 0.07463293522596359, -0.024502841755747795, 0.03611108288168907, 0.002726164646446705, 0.014712261967360973, 0.015620161779224873, 0.03230629488825798, 0.009419238194823265, 0.023043064400553703, 0.02208731509745121, 0.04516053944826126, 0.029826069250702858, 0.016832362860441208, 0.01579178497195244, -0.018879925832152367, -0.057170867919921875, -0.05114477500319481, -0.014496139250695705, 0.017572039738297462, -0.018710296601057053, 0.0009408065234310925, 0.0515131913125515, -0.04156909137964249, -0.015080679208040237, -0.03779199719429016, 0.017200782895088196, -0.0018357320223003626, -0.0028364399913698435, 0.00644654082134366, 0.030158603563904762, 0.002956438111141324, -0.008467703126370907, 0.02016124688088894, -0.015299207530915737, 0.045446787029504776, 0.018485160544514656, -0.021120145916938782, 0.012021588161587715, -0.008891482837498188, -0.028750397264957428, -0.03664819523692131, 0.016821449622511864, -0.012852934189140797, 0.027231814339756966, -0.006525692064315081, 0.02177812159061432, 0.038194186985492706, 0.03217693790793419, 0.024114053696393967, 0.0256087277084589, 0.005564031656831503, 0.027858160436153412, 0.011041944846510887, 0.0008880426757968962, -0.01192969549447298, -0.01913430169224739, -0.026113664731383324, -0.012827670201659203, 0.024496834725141525, 0.061202272772789, 0.011835645884275436, -0.018510619178414345, -0.011898349970579147, -0.03918340429663658, -0.04594223573803902, 0.016438651829957962, 0.03486635535955429, -0.008550798520445824, 0.02706461027264595, 0.015148861333727837, 0.016313180327415466, 0.020990626886487007, -0.05458686873316765, 0.03990257531404495, 0.04184548184275627, 0.014256250113248825, -0.04041176289319992, -0.021309593692421913, 0.03226209431886673, 0.026073040440678596, 0.0005945482407696545, 0.05630321055650711, 0.05062369257211685, -0.004405828658491373, -0.054172806441783905, 0.00965812522917986, -0.033841829746961594, 0.0037406710907816887, -0.04253878444433212, -0.02190070040524006, -0.006638596765697002, 0.0056898402981460094, 0.009508212096989155, 0.013910815119743347, -0.003102286020293832, -0.021294379606842995, -0.048155445605516434, -0.04874475300312042, -0.011859998106956482, 0.000012369036085146945, 0.019336160272359848, 0.014634479768574238, -0.0005936037050560117, -0.03557168319821358, 0.008444088511168957, 0.011410104110836983, -0.003110607387498021, 0.030362574383616447, -0.007078350987285376, -0.02602034993469715, -0.004777400754392147, 0.017198596149683, -0.015155944041907787, -0.009054389782249928, -0.037018612027168274, 0.02746283821761608, 0.017541291192173958, -0.04257885739207268, -0.044795628637075424, 0.010016471147537231, -0.0036539987195283175, -0.007765134796500206, 0.07312329113483429, 0.013698223978281021, 0.005029078107327223, -0.027594657614827156, 0.020828334614634514, -0.024148650467395782, -0.02126901224255562, 0.02691713720560074, -0.030740447342395782, 0.021827304735779762, 0.011434322223067284, 0.013866418972611427, -0.008617059327661991, 0.01862918771803379, -0.01289750263094902, 0.023404499515891075, -0.014976880513131618, -0.037959665060043335, -0.006237353198230267, 0.024016140028834343, -0.01866276003420353, -0.03776293992996216, 0.019544873386621475, 0.018098244443535805, -0.03704240173101425, 0.0017032693140208721, 0.00041137164225801826, 0.015777472406625748, 0.003763696877285838, 0.01807447336614132, -0.05101510137319565, 0.05371209233999252, 0.008658206090331078, 0.0053918613120913506, -0.023796705529093742, 0.006584759335964918 ]
Welcome spaCy to the 🤗 Hub
osanseviero
July 13, 2021
spacy
open-source-collab, nlp
https://huggingface.co/blog/spacy
Sharing your models But probably the coolest feature is that now you can very easily share your models with the spacy-huggingface-hub library, which extends the spaCy CLI with a new command, huggingface-hub push. bash huggingface-cli login python -m spacy package ./en_ner_fashion ./output --build wheel cd ./output/en_ner_fashion-0.0.0/dist python -m spacy huggingface-hub push en_ner_fashion-0.0.0-py3-none-any.whl In just a minute, you can get your packaged model in the Hub, try it out directly in the browser, and share it with the rest of the community. All the required metadata will be uploaded for you and you even get a cool model card. Try it out and share your models with the community!
[ 0.026594966650009155, -0.010736726224422455, 0.018379492685198784, 0.03997762128710747, 0.07042941451072693, -0.004472068510949612, -0.01764601841568947, 0.05806951969861984, -0.049259498715400696, -0.015496778301894665, -0.09029653668403625, 0.004594777710735798, 0.03833850845694542, 0.13928134739398956, -0.027536889538168907, -0.05760058015584946, 0.007449503522366285, 0.012067181058228016, 0.029776282608509064, 0.019420728087425232, 0.0031233658082783222, -0.07620769739151001, 0.03837249428033829, -0.040191903710365295, -0.002678006188943982, -0.007989698089659214, 0.08092570304870605, 0.049258675426244736, -0.04684681072831154, 0.008303011767566204, -0.06750919669866562, -0.009404417127370834, -0.012286022305488586, -0.031872592866420746, 0.05915647745132446, 0.021069785580039024, -0.1357111632823944, 0.06892409175634384, 0.03151830658316612, -0.0246913880109787, 0.006811057683080435, -0.02975044772028923, -0.08402610570192337, 0.03475337475538254, -0.009818211197853088, -0.048069778829813004, -0.12472330033779144, 0.0595121793448925, -0.004902407061308622, 0.0021992188412696123, -0.059350814670324326, 0.024680327624082565, -0.07463707774877548, -0.0015308430884033442, 0.029982414096593857, 0.022088170051574707, -0.028235431760549545, -0.08892498165369034, -0.0546414740383625, -0.007858228869736195, 0.041241709142923355, 0.016909273341298103, 0.025719938799738884, 0.07179088890552521, -0.01055276207625866, 0.040892601013183594, -0.0009775430662557483, -0.021065598353743553, -0.058279041200876236, -0.009878468699753284, 0.03647686913609505, -0.06600956618785858, -0.014325728639960289, -0.07544203102588654, 0.016391409561038017, -0.03420659899711609, -0.0022723425645381212, -0.0032835067249834538, 0.07252932339906693, 0.038752976804971695, 0.04188697785139084, 0.0018651492428034544, 0.02603250741958618, 0.03375811502337456, 0.06418129056692123, 0.030970821157097816, -0.03925614431500435, -0.033394813537597656, -0.04842729866504669, 0.003526514396071434, -0.006307466421276331, -0.0892089232802391, -0.007353983819484711, 0.07266047596931458, 0.13854849338531494, 0.055017393082380295, -0.003955160267651081, 0.007304849568754435, -0.056426774710416794, -0.0305253304541111, -0.03767139092087746, -0.03438623622059822, -0.05444534868001938, -0.0605805404484272, -0.030768737196922302, 0.013605541549623013, 0.0287957563996315, -0.12337277084589005, 0.01232147216796875, -0.0059190671890974045, 0.029977276921272278, -0.025995377451181412, -0.021302523091435432, 0.02208215929567814, -0.042857371270656586, -0.0032442226074635983, 0.008683315478265285, -0.006200781092047691, -0.006906218361109495, 0.05127813294529915, 0.019695349037647247, 0.0487782321870327, -0.0005769968847744167, 0.016051480546593666, 0.09134683758020401, 0.08064226061105728, 0.06018361076712608, -0.021332135424017906, -0.015605080872774124, -0.06712479889392853, 0.0396842323243618, -0.021569281816482544, 0.01799890585243702, 0.001666983007453382, 0.04715726524591446, -0.09824661910533905, 0.0020654741674661636, -0.012262990698218346, 0.07339143007993698, 0.006273097824305296, -0.05689120665192604, 0.11836669594049454, -0.01964356191456318, 0.0023097919765859842, 0.05683577060699463, 0.031710077077150345, -0.09026718884706497, 0.046306464821100235, -0.026804670691490173, 0.010888701304793358, -0.06621266156435013, 0.044086020439863205, 0.026524653658270836, -0.051177918910980225, -0.010911023244261742, 0.051087286323308945, -0.04129178822040558, 0.021903347223997116, 0.007936549372971058, 0.010869278572499752, -0.034637171775102615, -0.046851254999637604, -0.091713085770607, -0.0158271174877882, -0.008755833841860294, -0.017015516757965088, -0.024546097964048386, -0.010781087912619114, 0.03188606724143028, -0.014084327965974808, 0.01952166110277176, -0.029994869604706764, 0.027868181467056274, -0.0301834587007761, 0.0014383024536073208, 0.08669628947973251, 0.05227154865860939, 0.052201543003320694, 0.020515358075499535, -0.0003105884825345129, -0.023671450093388557, 0.026957586407661438, -0.06223776564002037, 0.017153369262814522, 0.03884164243936539, -0.07884620130062103, 0.013123475946485996, -0.0054716388694942, 0.011705604381859303, 0.0057334597222507, -0.02836136892437935, -0.082063689827919, 0.06637734919786453, -0.005065782926976681, -0.0020450830925256014, -0.031128015369176865, -0.03126242011785507, 0.06016620621085167, 0.027219189330935478, 0.058330461382865906, 0.03845633566379547, -0.03365407511591911, -0.026974063366651535, -0.025149310007691383, -0.0240219347178936, 0.003192111849784851, -0.02279329113662243, -0.06144026666879654, 0.02281375788152218, 0.04848121106624603, -0.012168867513537407, -0.09569912403821945, 0.08675415068864822, -0.08916733413934708, -0.008407797664403915, -0.06729213893413544, -0.03529796004295349, 0.05255340412259102, -0.051669955253601074, 0.020462945103645325, 0.2511475384235382, -0.01928030326962471, -0.015312181785702705, 0.0011122600408270955, -0.02213258482515812, 0.06855003535747528, 0.04484013468027115, 0.04959513992071152, 0.09533318877220154, -0.04113457724452019, -0.021664906293153763, -0.025023464113473892, -0.011132127605378628, 0.03477605804800987, 0.02285762131214142, 0.02066289633512497, 0.015259216539561749, -0.026878414675593376, -0.012901121750473976, -0.049331314861774445, 0.012997589074075222, -0.024763116613030434, 0.002475547371432185, -0.0056031388230621815, -0.007185648195445538, 0.00508147431537509, 0.08475574851036072, -0.014036252163350582, -0.010653386823832989, -0.017344776540994644, -0.06940677016973495, 0.03576504811644554, 0.007485074456781149, -0.015452499501407146, 0.0780142992734909, -0.01270733866840601, 0.010361647233366966, -0.022892799228429794, 0.0011047701118513942, 0.04532907158136368, 0.013241003267467022, 0.00031074509024620056, -0.03992569074034691, -0.03287491202354431, -0.010057538747787476, 0.0010772347450256348, 0.021807894110679626, -0.01308898814022541, -0.003861804259940982, -0.017877107486128807, 0.03236154839396477, -0.03904881328344345, 0.017925366759300232, 0.024534858763217926, -0.0034425188787281513, 0.000779099587816745, -0.00019264474394731224, -0.03743382915854454, -0.018605366349220276, -0.029079152271151543, -0.0005875378847122192, -0.05539520084857941, 0.03807741776108742, 0.02727133221924305, 0.003956291358917952, 0.008588469587266445, -0.0001472431467846036, -0.05116106942296028, -0.013012073934078217, 0.04563943296670914, 0.0272328183054924, 0.01718171127140522, -0.004504686687141657, 0.0009165158262476325, -0.02429536171257496, -0.010248778387904167, 0.013488591648638248, -0.003134633181616664, -0.02042408473789692, 0.03647586703300476, -0.006630961783230305, 0.018484223634004593, 0.010676723904907703, -0.026103977113962173, -0.03817428648471832, 0.013605820015072823, 0.014463144354522228, -0.029868116602301598, -0.10213349759578705, -0.028770972043275833, -0.012830996885895729, 0.05145500227808952, 0.02008816786110401, 0.03223798796534538, 0.031222283840179443, -0.030872860923409462, -0.00024090605438686907, 0.015328587032854557, -0.0057410867884755135, 0.017466546967625618, -0.006891586352139711, 0.005799113307148218, -0.035161085426807404, 0.023514864966273308, -0.021970966830849648, 0.023477738723158836, 0.05140669271349907, 0.06165893375873566, -0.014040157198905945, 0.038972675800323486, -0.011049659922719002, -0.008782755583524704, -0.01595699042081833, -0.03568731248378754, 0.01665986329317093, 0.012437175028026104, 0.011872905306518078, -0.040663983672857285, -0.005428362172096968, 0.007637236267328262, -0.03968610242009163, -0.03424941375851631, -0.050333671271800995, 0.0053596291691064835, 0.00522722490131855, 0.009212998673319817, 0.03574633598327637, 0.035955727100372314, 0.005822489969432354, -0.0012353099882602692, 0.03625548258423805, -0.018974190577864647, 0.011397766880691051, -0.004252682439982891, 0.0065484303049743176, 0.033473994582891464, 0.020239222794771194, -0.034041110426187515, -0.0012626511743292212, -0.01889551617205143, 0.06120743602514267, 0.031042389571666718, 0.006511993706226349, 0.009046745486557484, 0.00642019510269165, 0.03075912594795227, 0.005400674883276224, -0.03692375868558884, -0.03957042843103409, -0.009568019770085812, -0.0030295737087726593, -0.042168308049440384, -0.02637755312025547, 0.07443170249462128, -0.004210228566080332, -0.00684403395280242, -0.01084020733833313, 0.059401366859674454, -0.0031264403369277716, 0.04733375832438469, -0.0366029292345047, 0.007454856298863888, -0.010720033198595047, 0.04148130491375923, 0.0012004207819700241, -0.03888313099741936, 0.0478394478559494, 0.023977747187018394, -0.002372842049226165, -0.009792164899408817, -0.011798384599387646, -0.025061478838324547, -0.04274865984916687, -0.033820949494838715, 0.05942325294017792, 0.006707340944558382, 0.033614788204431534, 0.029133891686797142, -0.0047031184658408165, -0.028960807248950005, 0.043260544538497925, -0.005667529534548521, -0.010875632986426353, -0.04464184492826462, -0.018632840365171432, 0.054833363741636276, 0.00017280425527133048, -0.02932029962539673, 0.007341417949646711, -0.009412244893610477, -0.011247006244957447, 0.03192264214158058, 0.0008988074841909111, 0.05299973115324974, -0.028321025893092155, -0.03547341749072075, 0.01621292531490326, -0.050021424889564514, -0.0064521776512265205, 0.038588207215070724, -0.02645178884267807, -0.02391786314547062, 0.01387279387563467, 0.01817956380546093, -0.024214908480644226, 0.01112065464258194, -0.043698303401470184, 0.05217709392309189, -0.006157491821795702, 0.019195063039660454, -0.01561088114976883, -0.023933013901114464, -0.004957146476954222, -0.004455237649381161, 0.01991739682853222, -0.002987224142998457, -0.03194541484117508, 0.008828647434711456, -0.024454224854707718, 0.00151974824257195, 0.016138862818479538, -0.008338166400790215, 0.01067567989230156, 0.020881909877061844, -0.02249148301780224, 0.027897661551833153, 0.03905479609966278, -0.013402638956904411, -0.032016631215810776, 0.022010082378983498, 0.040712956339120865, 0.00030289182905107737, 0.03219912573695183, 0.017687750980257988, -0.054420895874500275, -0.008477620780467987, -0.03396705910563469, 0.010335954837501049, -0.01778261363506317, 0.0070961955934762955, -0.02408185601234436, 0.040214672684669495, 0.01938352733850479, -0.000930294394493103, -0.009761231951415539, 0.020205004140734673, -0.013193746097385883, 0.03763797879219055, -0.032915979623794556, -0.016719354316592216, -0.005359624978154898, 0.013275785371661186, -0.009605413302779198, 0.007858898490667343, -0.018217066302895546, -0.09116846323013306, -0.01933164894580841, 0.045508548617362976, -0.0039176372811198235, 0.0255916528403759, 0.02634580060839653, -0.018551453948020935, -0.008234440349042416, 0.04708408564329147, 0.03208635747432709, 0.026764733716845512, -0.012780698016285896, 0.020507637411355972, -0.03278380632400513, -0.003977547865360975, 0.00885995663702488, -0.03956161066889763, 0.011305452324450016, 0.01992926374077797, 0.08359085768461227, 0.10057156533002853, -0.02401084266602993, 0.013107284903526306, -0.025554055348038673, 0.0272494088858366, 0.003408000571653247, -0.043287280946969986, -0.00095108657842502, -0.027416571974754333, -0.005386588163673878, -0.0021994574926793575, -0.003524587955325842, -0.01099007111042738, 0.03974653407931328, 0.031020767986774445, -0.04222926124930382, -0.007460821885615587, 0.011289561167359352, -0.002343239728361368, 0.0038411219138652086, -0.024120965972542763, 0.017267214134335518, -0.007436456624418497, -0.0007978150970302522, 0.013771191239356995, 0.0006581576890312135, -0.01606706716120243, 0.010475428774952888, -0.026765601709485054, -0.049474336206912994, -0.002422814955934882, -0.007267278619110584, 0.06479549407958984, 0.024198384955525398, -0.019544804468750954, -0.011183051392436028, 0.004298077896237373, 0.022755764424800873, -0.018725255504250526, 0.01300989743322134, 0.034131139516830444, 0.0008829252328723669, 0.02242659218609333, 0.052293770015239716, -0.039710983633995056, 0.014612040482461452, -0.00009294474875787273, 0.02041669189929962, 0.022869037464261055, -0.040614210069179535, 0.044208139181137085, 0.022102128714323044, -0.023321080952882767, 0.006184194702655077, -0.03645762801170349, -0.05250948667526245, 0.007564907893538475, -0.04587577283382416, 0.03387816995382309, 0.06633719056844711, -0.012625278905034065, -0.004718373995274305, 0.010383444838225842, -0.0011927798623219132, 0.0007565218838863075, -0.005332102067768574, 0.00580098619684577, -0.0035739359445869923, 0.007795186713337898, 0.017739031463861465, 0.02021254599094391, -0.0020281660836189985, -0.02102758176624775, 0.038049641996622086, -0.05091439560055733, 0.0031876934226602316, 0.02293276973068714, -0.007441585883498192, 0.01057442557066679, 0.0032650523353368044, -0.07529983669519424, 0.024169327691197395, -0.0010388355003669858, 0.05921199172735214, 0.055052805691957474, -0.007333279587328434, 0.018365224823355675, -0.031148433685302734, 0.0030243340879678726, 0.04659228026866913, 0.03902482986450195, -0.024676794186234474, 0.06788020581007004, -0.003368878737092018, 0.04288101568818092, 0.0025995809119194746, 0.01171348337084055, 0.012055371887981892, 0.04768986627459526, 0.05417802557349205, -0.0006795299705117941, 0.02586277201771736, 0.034877508878707886, 0.01786312833428383, -0.008444343693554401, -0.04548726975917816, 0.012309931218624115, -0.00999519694596529, 0.028811516240239143, -0.020501336082816124, -0.034401968121528625, 0.019277209416031837, -0.002435265341773629, 0.054848115891218185, 0.021597955375909805, 0.02511800453066826, -0.03402133285999298, 0.006064018700271845, 0.04026300832629204, 0.02768787369132042, 0.0089952377602458, 0.02652287669479847, 0.023336805403232574, -0.0011206070194020867, 0.03151948004961014, 0.03278755769133568, 0.0036013962235301733, -0.024620182812213898, 0.022226624190807343, 0.020972425118088722, -0.03786500543355942, -0.02116975374519825, -0.025816669687628746, 0.02494906261563301, -0.0028121161740273237, -0.029198797419667244, 0.049142371863126755, -0.00882726814597845, 0.014017877168953419, -0.004219208378344774, 0.018653079867362976, 0.013005418702960014, -0.03314264863729477, 0.0066687194630503654, 0.03230404481291771, 0.017765697091817856, 0.010450543835759163, 0.006234725005924702, 0.005652445834130049, 0.03570223227143288, 0.014063711278140545, -0.018148446455597878, -0.020948609337210655, -0.02977827936410904, -0.013863588683307171, -0.025907201692461967, -0.007445698603987694, 0.020353930070996284, -0.010991312563419342, -0.003888592356815934, 0.05663161352276802, 0.02348894067108631, 0.04583142697811127, 0.024429554119706154, 0.017984166741371155, -0.014405488036572933, -0.015616010874509811, -0.014648369513452053, -0.025551144033670425, 0.004002288915216923, -0.03744093328714371, -0.000015209220691758674, -0.0198637917637825, 0.04231751710176468, 0.047641411423683167, 0.003932353109121323, -0.017655761912465096, -0.04151884838938713, 0.025931885465979576, 0.013435597531497478, -0.00383892678655684, 0.028929920867085457, -0.0078758979216218, 0.015922531485557556, 0.014081710949540138, -0.004654766991734505, 0.03364964947104454, -0.020559929311275482, 0.02948511764407158, 0.07505786418914795, -0.009096963331103325, 0.015645746141672134, 0.009710057638585567, 0.05947265028953552, -0.005708645097911358, -0.002306756330654025, 0.020543167367577553, 0.023852914571762085, -0.01387771125882864, -0.03906474635004997, 0.012402537278831005, -0.02198355458676815, 0.026510994881391525, -0.005280748475342989, -0.04415350407361984, -0.015281212516129017, -0.0029594150837510824, -0.011339478194713593, 0.002169538289308548, -0.07476484775543213, -0.016835322603583336, -0.015660956501960754, -0.010108967311680317, -0.020906945690512657, -0.01043819822371006, 0.023100456222891808, 0.02345910854637623, -0.00224725971929729, -0.0006305844290181994, -0.02607749216258526, -0.011012094095349312, -0.01092732883989811, 0.027226846665143967, 0.01118644792586565, -0.01735248602926731, -0.025150276720523834, 0.004610483534634113, 0.0044943466782569885, -0.013800895772874355, -0.05858078598976135, 0.0077925557270646095, 0.014300953596830368, -0.010436597280204296, -0.037464819848537445, -0.012314416468143463, 0.034245628863573074, -0.051107585430145264, 0.03371134027838707, 0.0066724964417517185, -0.008263316005468369, -0.009487739764153957, 0.006524610333144665, -0.062235575169324875, -0.007640551310032606, -0.029846714809536934, -0.019358454272150993, 0.023687390610575676, 0.011984954588115215, -0.020715437829494476, -0.014659509062767029, -0.0023341269697993994, 0.017178865149617195, -0.000617837649770081, -0.018346032127738, -0.06360337138175964, -0.02044549211859703, 0.03217358514666557, -0.010282221250236034, -0.03270301595330238, 0.0057112304493784904, 0.0012859691632911563, -0.04313543811440468, 0.015151962637901306, 0.020614301785826683, 0.010052814148366451, 0.007683648727834225, -0.0028315261006355286, -0.0215919092297554, 0.04970960691571236, 0.02505701407790184, -0.047462739050388336, -0.04386783018708229, 0.008850841782987118 ]
Deep Learning over the Internet: Training Language Models Collaboratively
mryab
July 15, 2021
collaborative-training
research
https://huggingface.co/blog/collaborative-training
Tokenizer The first brick of our model is called a tokenizer and takes care of transforming raw text into vocabulary indices. Because we are training a model for Bengali, which is not very similar to English, we need to implement language-specific preprocessing as a part of our tokenizer. We can view it as a sequence of operations: 1. Normalization: includes all preprocessing operations on raw text data. This was the step at which we have made the most changes, because removing certain details can either change the meaning of the text or leave it the same, depending on the language. For example, the standard ALBERT normalizer removes the accents, while for the Bengali language, we need to keep them, because they contain information about the vowels. As a result, we use the following operations: NMT normalization, NFKC normalization, removal of multiple spaces, homogenization of recurring Unicode characters in the Bengali language, and lowercasing. 2. Pretokenization describes rules for splitting the input (for example, by whitespace) to enforce specific token boundaries. As in the original work, we have chosen to keep the whitespace out of the tokens. Therefore, to distinguish the words from each other and not to have multiple single-space tokens, each token corresponding to the beginning of a word starts with a special character “_” (U+2581). In addition, we isolated all punctuation and digits from other characters to condense our vocabulary. 3. Tokenizer modeling: It is at this level that the text is mapped into a sequence of elements of a vocabulary. There are several algorithms for this, such as Byte-Pair Encoding (BPE) or Unigram, and most of them need to build the vocabulary from a text corpus. Following the setup of ALBERT, we used the Unigram Language Model approach, training a vocabulary of 32k tokens on the deduplicated Bengali part of the OSCAR dataset. 4. Post-processing: After tokenization, we might want to add several special tokens required by the architecture, such as starting the sequence with a special token [CLS] or separating two segments with a special token [SEP]. Since our main architecture is the same as the original ALBERT, we keep the same post-processing: specifically, we add a [CLS] token at the beginning of each example and a [SEP] token both between two segments and at the end. 💡 Read more information about each component in Tokenizers doc You can reuse our tokenizer by running the following code: python from transformers import AutoTokenizer tokenizer = AutoTokenizer.from_pretrained("neuropark/sahajBERT")
[ -0.014054265804588795, -0.037036433815956116, -0.01788654550909996, -0.04080163687467575, 0.09287237375974655, 0.08213675022125244, 0.02942732721567154, -0.005374404136091471, -0.03221309185028076, 0.0052938759326934814, -0.1039476990699768, 0.009635712020099163, -0.0012662310618907213, 0.011435559019446373, 0.011179749853909016, 0.02190564200282097, 0.04504351690411568, -0.06767792999744415, -0.03709333389997482, -0.012549362145364285, -0.01716422475874424, -0.023806599900126457, 0.09878060221672058, 0.011431632563471794, 0.005970788653939962, -0.010279406793415546, 0.02231357991695404, -0.03872944787144661, -0.044013552367687225, 0.02052096091210842, -0.09234648197889328, 0.003283846890553832, -0.021670464426279068, -0.006806707475334406, -0.036102667450904846, -0.022013269364833832, -0.10997534543275833, 0.029102550819516182, 0.008349435403943062, -0.03853708133101463, -0.052381835877895355, 0.0042852191254496574, -0.013233406469225883, 0.047955408692359924, -0.022325685247778893, -0.029870549216866493, -0.18533405661582947, 0.08622366935014725, -0.07425282895565033, -0.023597927764058113, -0.0745038092136383, 0.027419259771704674, -0.015487256459891796, 0.03387177735567093, 0.004297393839806318, -0.014561429619789124, -0.05970032513141632, -0.07180030643939972, 0.04212033003568649, 0.045659761875867844, 0.09269426763057709, -0.007866340689361095, 0.02619936130940914, -0.008859734050929546, 0.031057098880410194, 0.002960427198559046, -0.06997449696063995, -0.008307913318276405, -0.014260291121900082, 0.01382136158645153, 0.026295766234397888, 0.028882861137390137, -0.013622044585645199, -0.0068521942012012005, -0.018071463331580162, -0.05717745050787926, 0.009369609877467155, 0.010267294012010098, -0.02689264714717865, 0.029361587017774582, -0.05137772485613823, 0.05921498313546181, 0.022570395842194557, 0.014485501684248447, 0.052222710102796555, 0.013259470462799072, 0.03677120432257652, -0.020904501900076866, -0.024309074506163597, 0.03608177229762077, -0.03400121256709099, -0.10997762531042099, -0.005556600168347359, 0.060701556503772736, 0.008641661144793034, 0.013478725217282772, 0.0014002544339746237, 0.0029423353262245655, -0.00048003502888605, 0.0351213663816452, -0.038748599588871, -0.04881259426474571, 0.028356919065117836, -0.00031569917337037623, -0.014184187166392803, 0.02608572319149971, -0.05042637884616852, -0.03950462117791176, -0.043544694781303406, 0.022637736052274704, 0.025115977972745895, -0.018324874341487885, 0.02420557290315628, 0.07082287967205048, -0.07824140787124634, 0.01619904302060604, 0.026892879977822304, 0.007027540821582079, -0.040322981774806976, 0.026168227195739746, -0.02392856404185295, 0.0757041797041893, 0.091026671230793, -0.006978201679885387, -0.04333163797855377, 0.010009538382291794, 0.07817460596561432, 0.028881629928946495, -0.06240525841712952, -0.03599303960800171, -0.019544275477528572, -0.011774552054703236, 0.04023556783795357, 0.0037406806368380785, -0.022953277453780174, -0.031211836263537407, -0.018678108230233192, -0.04112900793552399, -0.013344700448215008, -0.04788991063833237, -0.06762203574180603, 0.056169308722019196, -0.061275042593479156, -0.0027688874397426844, 0.000028207308787386864, -0.007654967717826366, -0.03152234107255936, 0.0945720449090004, -0.009269090369343758, 0.004292868543416262, -0.04757127910852432, 0.014161987230181694, 0.01608452759683132, -0.007425717543810606, 0.01346649881452322, 0.04766634479165077, -0.02970907837152481, -0.028212450444698334, -0.07361563295125961, 0.0277040246874094, -0.03254289925098419, -0.04274425283074379, -0.02474967949092388, 0.026111925020813942, -0.0033227973617613316, -0.038896601647138596, 0.05961039289832115, 0.05268130078911781, 0.028790848329663277, 0.02495243214070797, 0.056694917380809784, -0.023803187534213066, 0.07574552297592163, -0.04742966219782829, -0.0294263307005167, 0.01985492743551731, -0.011578879319131374, 0.025826875120401382, 0.0034671614412218332, 0.0000934236086322926, -0.014179346151649952, 0.028608664870262146, 0.03623570129275322, 0.011301491409540176, -0.017851760610938072, -0.06657031923532486, 0.008300707675516605, -0.031126875430345535, -0.04861834645271301, 0.07674772292375565, -0.05300620570778847, 0.006047623697668314, 0.028737133368849754, -0.025026673451066017, -0.016568217426538467, -0.0700497031211853, 0.012142807245254517, 0.11798234283924103, 0.011922751553356647, 0.06635972857475281, 0.0504642017185688, 0.016270168125629425, -0.010904500260949135, 0.006559540517628193, 0.0222857054322958, 0.0039881025440990925, 0.00848401989787817, -0.04570584371685982, 0.06745435297489166, 0.01925361528992653, -0.0072361682541668415, -0.07746421545743942, 0.03182531148195267, -0.11703909188508987, 0.009801373817026615, 0.008214575238525867, -0.03882472589612007, 0.06028299033641815, 0.020403509959578514, -0.09351624548435211, 0.16126544773578644, -0.1507854461669922, 0.008979320526123047, 0.006698817014694214, -0.025322286412119865, 0.06914172321557999, 0.07731671631336212, 0.025694599375128746, 0.06870020925998688, -0.04392946511507034, 0.02207324095070362, -0.11857570707798004, 0.011700456030666828, 0.030149148777127266, -0.04958200454711914, -0.036708682775497437, 0.06674907356500626, 0.04332824796438217, 0.06554225832223892, -0.03781044855713844, -0.05846014246344566, -0.03764858469367027, -0.05671067535877228, -0.05792492628097534, 0.002713174093514681, 0.09811563044786453, 0.0780838131904602, -0.02839062176644802, -0.07537786662578583, 0.008597826585173607, 0.0009978617308661342, 0.046411365270614624, -0.014209037646651268, -0.0939188003540039, 0.04007949307560921, 0.03703905642032623, 0.02263732999563217, -0.021942714229226112, 0.005203500855714083, 0.005833012517541647, -0.03078647516667843, -0.021567130461335182, -0.05652753263711929, -0.07632872462272644, 0.01056754495948553, -0.07193804532289505, 0.03805437311530113, 0.028672032058238983, 0.0033165502827614546, 0.0027232652064412832, 0.03113747201859951, -0.005879509262740612, 0.020641129463911057, 0.007003177423030138, 0.04306471347808838, 0.04677311331033707, 0.032185789197683334, -0.04586721211671829, -0.0432732068002224, 0.004290028940886259, -0.03941293805837631, -0.05261721462011337, 0.012824250385165215, 0.025776922702789307, 0.014609097503125668, -0.010552552528679371, -0.006555077154189348, -0.009213538840413094, 0.013875862583518028, 0.00013413355918601155, -0.01086141262203455, 0.05670135095715523, -0.011439474299550056, 0.0172070674598217, 0.05352773517370224, 0.010041717439889908, -0.050022367388010025, 0.028209064155817032, -0.012092954479157925, 0.027446718886494637, 0.0023176344111561775, 0.007654278539121151, 0.015060885809361935, 0.02348507195711136, -0.04296458512544632, 0.025544701144099236, -0.03274190053343773, 0.01285585854202509, -0.09717757999897003, -0.004960254300385714, -0.0029933240730315447, 0.03063219226896763, -0.037356238812208176, -0.01623491570353508, 0.033458564430475235, 0.012100345455110073, -0.022804157808423042, -0.0011389721184968948, 0.04735508933663368, -0.02095179446041584, 0.03519703447818756, 0.008191308006644249, -0.02727646194398403, -0.0037006221245974302, -0.027408074587583542, -0.01033265981823206, -0.02700076624751091, 0.03355022147297859, -0.013651642948389053, 0.02381947450339794, -0.008275634609162807, 0.015174398198723793, -0.01930011808872223, -0.025932174175977707, 0.03349663317203522, 0.016399499028921127, 0.009235403500497341, 0.01135704293847084, -0.026287464424967766, -0.00011966578313149512, 0.0056449975818395615, 0.010501828044652939, 0.005675845313817263, -0.014933418482542038, -0.011244501918554306, 0.04118423908948898, 0.029400857165455818, 0.04324512556195259, 0.022652968764305115, 0.010877322405576706, 0.026068521663546562, 0.0036556823179125786, 0.0380549356341362, -0.029444241896271706, 0.019190514460206032, -0.04039683938026428, 0.04447774961590767, -0.06239018589258194, 0.0063061839900910854, -0.03561261668801308, 0.008298663422465324, 0.07161823660135269, 0.006507882848381996, -0.03085068054497242, 0.009138875640928745, 0.0026555133517831564, 0.06644845753908157, -0.024737155064940453, -0.0525222010910511, 0.025744710117578506, -0.04252588376402855, -0.013169865123927593, -0.00982093345373869, 0.03735104575753212, 0.02243550680577755, 0.007541333325207233, -0.0014149942435324192, 0.05382732301950455, 0.003679464804008603, 0.05227215215563774, 0.036511920392513275, -0.0016211378388106823, -0.026080865412950516, 0.02875513769686222, -0.010345631279051304, -0.03863124921917915, 0.018417030572891235, 0.043523188680410385, -0.013540295884013176, -0.020465511828660965, -0.01997910439968109, -0.04101942479610443, -0.010391607880592346, -0.021434882655739784, 0.007291033864021301, -0.012142350897192955, 0.00098231656011194, 0.0038560661487281322, 0.005031253676861525, -0.02295323647558689, -0.027114538475871086, 0.025371409952640533, -0.0025715588126331568, 0.016133613884449005, -0.03245163336396217, -0.022771459072828293, 0.04536302760243416, -0.003119257278740406, 0.04851066321134567, -0.07208038866519928, 0.011009525507688522, -0.006346366833895445, 0.03939225524663925, 0.04257030785083771, -0.04372558742761612, -0.01748896762728691, 0.03458119183778763, 0.018875986337661743, 0.02869209460914135, 0.04299500584602356, 0.014894329942762852, 0.012073138728737831, 0.007456787396222353, 0.021351203322410583, -0.01473710685968399, -0.03648039698600769, -0.011835130862891674, -0.011301951482892036, -0.003615383291617036, 0.019735533744096756, 0.016076385974884033, 0.009219761937856674, 0.020556198433041573, -0.01323262881487608, 0.023036804050207138, 0.001532356720417738, 0.025295794010162354, -0.007255097851157188, -0.036852143704891205, 0.0217006616294384, 0.0279685165733099, -0.010005846619606018, 0.020038051530718803, 0.03623625636100769, -0.007133516017347574, 0.009024790488183498, 0.020658712834119797, -0.05579104274511337, -0.01844514161348343, -0.022635439410805702, 0.025962749496102333, -0.02487671747803688, 0.02882952243089676, 0.013109419494867325, 0.0019313462544232607, -0.014426492154598236, -0.009906528517603874, 0.026610566303133965, 0.01275587361305952, -0.011019838973879814, -0.02260056883096695, -0.0048326351679861546, 0.00423521688207984, -0.058255359530448914, 0.006211902014911175, 0.00539802759885788, 0.018800899386405945, 0.061730604618787766, 0.033026039600372314, 0.016902107745409012, -0.048944149166345596, 0.02978382632136345, 0.011045100167393684, -0.042636338621377945, -0.024067005142569542, -0.03235200420022011, 0.00702816154807806, 0.012117989361286163, -0.023231368511915207, 0.012609314173460007, -0.0295976884663105, -0.03050527349114418, 0.057193972170352936, -0.005283899139612913, 0.013466713018715382, 0.028441958129405975, -0.04208354651927948, 0.037855081260204315, -0.03152281418442726, -0.020156875252723694, 0.018618600443005562, 0.036997102200984955, -0.004752088338136673, 0.0590057335793972, 0.05316612124443054, 0.023972121998667717, -0.016645656898617744, 0.031210368499159813, 0.006321995053440332, 0.009248396381735802, 0.052671633660793304, 0.006864156108349562, -0.04400121420621872, -0.043665654957294464, -0.04250681400299072, 0.026214472949504852, -0.022920098155736923, -0.008319495245814323, -0.007018447853624821, 0.06847044825553894, 0.028936278074979782, 0.013657256960868835, -0.016985761001706123, 0.03643813356757164, -0.023221593350172043, -0.040724121034145355, -0.0008902923436835408, -0.04627373442053795, -0.01058789249509573, 0.01425173506140709, -0.03360157087445259, -0.03236214444041252, -0.008670414797961712, -0.029806707054376602, -0.024158569052815437, 0.018427766859531403, -0.0016743429005146027, 0.05404356122016907, -0.02969106286764145, -0.008541898801922798, -0.04894693195819855, 0.039237041026353836, 0.020535869523882866, -0.019018638879060745, 0.02494317851960659, 0.0015984837664291263, 0.007247001864016056, 0.014016029424965382, 0.011233831755816936, -0.034745581448078156, 0.018595995381474495, 0.04301571100950241, -0.038915395736694336, -0.04770716652274132, -0.0018717038910835981, 0.00371927279047668, 0.036590300500392914, 0.015638886019587517, 0.0025214548222720623, -0.021369444206357002, -0.02929829992353916, 0.022428637370467186, -0.03454233333468437, 0.03266890347003937, 0.034275978803634644, -0.009271605871617794, 0.01567358896136284, 0.06819125264883041, 0.03462613746523857, -0.006196457426995039, -0.009524165652692318, 0.005514839664101601, 0.04110901802778244, 0.015531308017671108, 0.012875379994511604, 0.011530773714184761, -0.004075753036886454, 0.00977064948529005, 0.01316932775080204, -0.06253547966480255, 0.02545231580734253, 0.005055507179349661, -0.011405565775930882, -0.0062408712692558765, -0.014283141121268272, -0.051097553223371506, 0.018630998209118843, 0.023768801242113113, 0.019197095185518265, -0.01496865414083004, -0.01536557450890541, 0.04354400560259819, -0.03318013995885849, -0.01253510732203722, 0.016832636669278145, 0.0663362443447113, 0.004358082544058561, 0.049122776836156845, 0.007695754524320364, 0.038173072040081024, 0.040286559611558914, 0.021497758105397224, -0.011027712374925613, 0.051748305559158325, 0.021499302238225937, 0.002521317219361663, 0.00038260032306425273, 0.016235992312431335, 0.027757322415709496, 0.018201911821961403, -0.04467193782329559, -0.01439718808978796, -0.007959922775626183, 0.017147649079561234, 0.014029813930392265, 0.012214002199470997, 0.0056554959155619144, -0.01950683258473873, 0.07016899436712265, 0.018810324370861053, 0.030742846429347992, -0.007613727357238531, 0.024814996868371964, 0.03832400217652321, 0.04470578581094742, 0.04429656267166138, 0.027751246467232704, -0.02028871513903141, -0.014896776527166367, 0.048911795020103455, 0.03163265436887741, 0.02519248239696026, 0.019672658294439316, 0.004090405069291592, 0.03574550896883011, 0.01339721493422985, -0.004498534835875034, -0.0029651920776814222, 0.024799330160021782, -0.010791989043354988, 0.006103103049099445, -0.00786685198545456, -0.0661529153585434, 0.01082210149616003, -0.021862031891942024, -0.009453152306377888, 0.00865286123007536, 0.0007625327561981976, 0.0045658438466489315, 0.02574709616601467, 0.004107499960809946, -0.046515271067619324, -0.007352667860686779, -0.02107461541891098, 0.00042987955384887755, 0.026207175105810165, -0.02376176230609417, -0.020894134417176247, -0.03852299228310585, -0.008863452821969986, 0.022532807663083076, -0.01834876835346222, 0.004343321546912193, -0.009585347026586533, 0.029509257525205612, 0.010788858868181705, -0.025155792012810707, 0.015034454874694347, -0.0038994699716567993, 0.018712801858782768, -0.014531604014337063, 0.009950047358870506, -0.007008083630353212, 0.017300568521022797, 0.0069269235245883465, -0.04756404086947441, 0.026118218898773193, 0.015585517510771751, 0.019903793931007385, 0.05076584219932556, 0.06631127744913101, -0.03670914098620415, -0.04459021985530853, -0.03497034311294556, -0.0513775534927845, 0.003332393476739526, -0.005007126834243536, -0.005726784002035856, -0.008707860484719276, 0.003909270744770765, -0.04104720428586006, -0.06325002759695053, -0.012113778851926327, 0.0327373705804348, 0.028241625055670738, -0.028025511652231216, -0.027891557663679123, -0.06778661906719208, 0.01802978478372097, 0.03982037678360939, -0.010752248577773571, 0.022722570225596428, 0.008645127527415752, -0.009737321175634861, 0.007756921928375959, 0.039979465305805206, -0.02898309752345085, 0.025929197669029236, -0.04437255859375, -0.051725707948207855, -0.03966972231864929, 0.03302125260233879, 0.01919548586010933, 0.007815764285624027, -0.0612177774310112, 0.03810743987560272, -0.028710054233670235, -0.02465132623910904, -0.0424615778028965, -0.01742277853190899, 0.049954891204833984, 0.006493842229247093, 0.021169917657971382, 0.04585288465023041, -0.0148381432518363, 0.025717878714203835, -0.019167598336935043, -0.010243159718811512, 0.03669021278619766, 0.003133941674605012, 0.00214616977609694, 0.01144751813262701, 0.03569015860557556, -0.014679891988635063, -0.03613027557730675, 0.012277472764253616, 0.004948690999299288, 0.010961075313389301, 0.015838470309972763, 0.03875148668885231, -0.004324017558246851, 0.0146607281640172, -0.013276682235300541, 0.029543090611696243, 0.006949375383555889, 0.007056218106299639, 0.000500129594001919, -0.05965694412589073, -0.026546280831098557, -0.01967046968638897, 0.010854930616915226, 0.05712677538394928, 0.009029636159539223, 0.03959757089614868, 0.00611794413998723, -0.03188341110944748, -0.012893670238554478, -0.0080117704346776, 0.0008972538053058088, 0.002680193167179823, -0.006450997665524483, 0.022197529673576355, 0.010307966731488705, -0.02032187394797802, 0.04247405752539635, 0.05683799088001251, -0.013240091502666473, 0.009857983328402042, -0.018747221678495407, 0.016104277223348618, 0.01761772856116295, 0.023742368444800377, 0.032506633549928665, 0.039468809962272644, -0.006054213736206293, 0.007280725985765457, 0.03086242824792862, 0.012737899087369442 ]
Deep Learning over the Internet: Training Language Models Collaboratively
mryab
July 15, 2021
collaborative-training
research
https://huggingface.co/blog/collaborative-training
Adaptive averaging Now that we have discussed the overall training procedure, there remains one more question: how do we actually aggregate the gradients of participants? Most home computers cannot easily accept incoming connections, and the download speed might also become a constraint. Since we rely on volunteer hardware for experiments, a central server is not really a viable option, as it will quickly face overload when scaling to tens of clients and hundreds of millions of parameters. Most data-parallel training runs today don't use this strategy anyway; instead, they rely on All-Reduce — an efficient all-to-all communication primitive. Thanks to clever algorithmic optimizations, each node can compute the global average without sending the entire local gradient to every peer. Because All-Reduce is decentralized, it seems like a good choice; however, we still need to take the diversity of hardware and network setups into account. For example, some volunteers might join from computers that have slow network but powerful GPUs, some might have better connectivity only to a subset of other peers, and some may be firewalled from incoming connections. It turns out we can actually come up with an optimal data transfer strategy on the fly by leveraging this information about performance! On a high level, we split the entire gradient vector into parts depending on the Internet speed of each peer: those with the fastest connection aggregate the largest parts. Also, if some nodes do not accept incoming connections, they simply send their data for aggregation but do not compute the average themselves. Depending on the conditions, this adaptive algorithm can recover well-known distributed DL algorithms and improve on them with a hybrid strategy, as demonstrated below. Examples of different averaging strategies with the adaptive algorithm. 💡 The core techniques for decentralized training are available in Hivemind. Check out the repo and learn how to use this library in your own projects!
[ 0.07075398415327072, -0.0190096627920866, -0.023957282304763794, 0.018108028918504715, 0.07164658606052399, -0.04338601604104042, 0.0030542868189513683, 0.045512452721595764, -0.006461041048169136, -0.14032506942749023, -0.04590138420462608, 0.024874163791537285, -0.06305906921625137, 0.07858967781066895, -0.03587274253368378, -0.015660079196095467, 0.08226490765810013, -0.06721058487892151, 0.009092708118259907, 0.07351791113615036, -0.010157810524106026, -0.008548672311007977, 0.03487785533070564, -0.004219052381813526, -0.04580383002758026, -0.024492500349879265, 0.02679097279906273, 0.013439464382827282, 0.023571379482746124, 0.0532849095761776, -0.010676620528101921, -0.0054987273178994656, 0.07497476041316986, -0.05947889760136604, 0.029857169836759567, -0.04299470782279968, -0.059343449771404266, 0.04377542436122894, -0.00832507386803627, -0.034102827310562134, 0.06002342328429222, 0.01815791055560112, -0.09850074350833893, 0.058692775666713715, -0.005785669665783644, 0.01658921130001545, -0.09171509742736816, 0.07714380323886871, -0.07919774949550629, -0.00877492967993021, -0.11534343659877777, 0.07052277773618698, -0.0007960517541505396, 0.0003759107203222811, -0.0015050162328407168, -0.009151331149041653, 0.004473903216421604, -0.02054104395210743, -0.005875237751752138, -0.005639443174004555, 0.03816036134958267, 0.031704533845186234, -0.023452412337064743, 0.07450415194034576, -0.01062361616641283, -0.006570156197994947, 0.009319715201854706, -0.02677062340080738, -0.12534266710281372, -0.027052145451307297, 0.030187727883458138, -0.03708891198039055, 0.0026653653476387262, 0.018854189664125443, -0.03401600196957588, -0.05323595926165581, 0.03213546797633171, -0.06659138202667236, 0.03137630224227905, -0.028889261186122894, -0.02773597277700901, 0.018279505893588066, 0.055911630392074585, 0.05354363098740578, 0.028796108439564705, -0.010039784014225006, -0.025486433878540993, -0.01422400213778019, -0.04649268835783005, 0.047510385513305664, -0.03701956570148468, -0.052523173391819, 0.03382222354412079, -0.03056829608976841, 0.07795445621013641, -0.06574499607086182, 0.04427866265177727, -0.01724768802523613, 0.024515893310308456, 0.012207419611513615, 0.02893003821372986, -0.05017590522766113, 0.03687290474772453, -0.050433944910764694, -0.00586301414296031, 0.0873040184378624, -0.05350390076637268, -0.14058399200439453, -0.10264439880847931, 0.051479022949934006, -0.0014042933471500874, 0.025925716385245323, 0.035166896879673004, -0.00005499037797562778, 0.004704583436250687, -0.0022165600676089525, -0.0008669611997902393, 0.08072090893983841, -0.015563701279461384, -0.014528810046613216, -0.04447693005204201, 0.15177135169506073, -0.010519055649638176, -0.057414427399635315, -0.022909322753548622, -0.03876788914203644, 0.05675254762172699, -0.054139673709869385, 0.07752805948257446, 0.02838907204568386, 0.019533365964889526, -0.0015001967549324036, 0.026270335540175438, -0.03011476621031761, -0.0073557570576667786, -0.035806506872177124, 0.01229384820908308, 0.01485111191868782, 0.0028329419437795877, 0.01297666784375906, -0.06663274765014648, 0.033077090978622437, -0.0040194373577833176, 0.011804264970123768, 0.05063161253929138, -0.005960702896118164, -0.0419328473508358, -0.025042252615094185, 0.05856286734342575, 0.002238550456240773, -0.08089105039834976, 0.08156252652406693, -0.04863781854510307, -0.06099764630198479, 0.04629317298531532, 0.07774315774440765, 0.03126370161771774, -0.07269785553216934, -0.04579092189669609, 0.01821501925587654, -0.02263682708144188, 0.05812040716409683, 0.02592964842915535, 0.05397283285856247, 0.03589415177702904, 0.008297736756503582, -0.009854741394519806, 0.02310113050043583, -0.04289788752794266, 0.033100515604019165, -0.02103053778409958, -0.01585334911942482, 0.001421830034814775, 0.0249041561037302, -0.00009429667261429131, -0.006811308208853006, -0.02196437679231167, 0.05381856486201286, 0.0008204921032302082, 0.008784900419414043, -0.03284839168190956, 0.030626773834228516, -0.03228360787034035, 0.04143844544887543, -0.0151730477809906, -0.06596747785806656, 0.06035398319363594, 0.0015457735862582922, 0.04855974391102791, 0.04107607156038284, 0.0030784811824560165, 0.10406800359487534, 0.026288039982318878, -0.04863288253545761, 0.028526708483695984, -0.06030512601137161, 0.06553098559379578, 0.04952133446931839, 0.023388443514704704, 0.04556361585855484, 0.04460765793919563, -0.03995464742183685, 0.045523058623075485, -0.03657330945134163, -0.05281326174736023, -0.020208235830068588, 0.0040132286958396435, -0.08367066830396652, -0.04732189700007439, -0.02075718343257904, -0.07494065165519714, -0.07566831260919571, -0.008619913831353188, -0.02108415775001049, -0.04390445724129677, 0.04197955131530762, 0.0019496581517159939, 0.039623014628887177, 0.06661230325698853, -0.004685007967054844, 0.13114802539348602, -0.08617953956127167, 0.014001515693962574, 0.08079839497804642, -0.0008148024207912385, 0.06721378117799759, 0.03239811211824417, 0.0386059433221817, 0.08212506026029587, -0.013489710167050362, -0.005944493692368269, -0.0528377927839756, -0.04874717816710472, 0.036311354488134384, 0.03003006801009178, 0.006550728343427181, -0.032387036830186844, -0.04175996780395508, -0.008458518423140049, -0.005081865470856428, -0.014872157946228981, 0.06868740916252136, 0.01538392435759306, 0.026818426325917244, -0.022797266021370888, 0.05684784799814224, 0.12282133102416992, 0.0018675943138077855, -0.029041260480880737, 0.018082862719893456, -0.06546850502490997, 0.01971111260354519, -0.021493004634976387, -0.022570373490452766, -0.00028450615354813635, 0.00640407670289278, -0.00512635288760066, -0.024739407002925873, -0.026466740295290947, 0.008655384182929993, 0.006087522953748703, -0.015518861822783947, -0.01776869222521782, -0.04436904937028885, 0.019259309396147728, -0.05541757494211197, 0.017376810312271118, 0.009242772124707699, -0.009557347744703293, -0.02496327832341194, 0.02370297722518444, 0.0015474404208362103, 0.02989891543984413, -0.006474737077951431, -0.0185099970549345, -0.047662220895290375, 0.02505834586918354, -0.009073140099644661, -0.0022224802523851395, -0.042542971670627594, -0.014857840724289417, -0.01175838615745306, 0.04205295071005821, 0.023093249648809433, 0.007962842471897602, -0.029398057609796524, -0.015044750645756721, 0.03911934420466423, -0.01970290206372738, 0.023834804072976112, 0.006656451150774956, 0.024235468357801437, -0.012693842872977257, 0.005756671540439129, 0.004097084514796734, -0.019006552174687386, 0.04377622529864311, -0.008732940070331097, -0.015743030235171318, -0.001993717160075903, -0.005624455399811268, -0.05012868717312813, -0.02511349506676197, -0.017237717285752296, 0.018260924145579338, 0.009737863205373287, -0.004445555154234171, 0.03786829859018326, -0.08670736104249954, 0.004832034930586815, -0.017262635752558708, 0.028936441987752914, -0.0016779210418462753, -0.03908418118953705, -0.007702563889324665, -0.0278001856058836, 0.002440017182379961, -0.019457316026091576, -0.022170906886458397, 0.03973746672272682, -0.02673749253153801, -0.029194744303822517, -0.00450725294649601, -0.006845350842922926, -0.0033846443984657526, -0.08872043341398239, 0.023826971650123596, 0.009025860577821732, -0.020949505269527435, 0.005485094618052244, 0.010080908425152302, -0.00007751926750643179, -0.0374780148267746, 0.029319969937205315, 0.05602500960230827, -0.03560387343168259, 0.04417043924331665, -0.03890339657664299, 0.02808437868952751, -0.059366513043642044, -0.026777418330311775, 0.0059618218801915646, 0.0008777063339948654, 0.055848751217126846, 0.01398388296365738, 0.008034598082304, -0.01215059868991375, 0.07728797197341919, -0.008060969412326813, 0.017600959166884422, 0.05590392276644707, -0.04798153415322304, 0.022786682471632957, 0.026123275980353355, 0.003115444676950574, -0.010642433539032936, 0.040512822568416595, -0.010099438950419426, -0.06195618584752083, -0.039094939827919006, 0.06066090241074562, -0.008866933174431324, -0.04884673282504082, -0.02642742544412613, -0.017508767545223236, 0.025905964896082878, 0.0196806862950325, -0.0008918428211472929, 0.016347642987966537, 0.025778254494071007, 0.04341196268796921, -0.041324108839035034, -0.0034976103343069553, 0.01335000991821289, 0.0272027887403965, -0.04290730133652687, -0.0010552391177043319, 0.05949201434850693, -0.017894040793180466, 0.06572102755308151, 0.0034431051462888718, -0.0038211706560105085, -0.04777725413441658, 0.022696373984217644, -0.002316896803677082, 0.007574333343654871, 0.04659837484359741, 0.04330877959728241, -0.031566981226205826, -0.02467142790555954, -0.026845794171094894, -0.053400199860334396, 0.02543546073138714, 0.012525884434580803, 0.02221105992794037, -0.04186383634805679, 0.0020027172286063433, 0.015523720532655716, -0.010030381381511688, -0.009859350509941578, -0.011854021809995174, -0.03605771064758301, 0.004597639665007591, 0.041791047900915146, 0.022118723019957542, 0.018884219229221344, -0.02442122995853424, -0.0015363582642748952, 0.018058624118566513, -0.032902978360652924, -0.017314229160547256, -0.04147276282310486, -0.018648257479071617, 0.019396072253584862, 0.009451356716454029, 0.010986637324094772, 0.023273255676031113, -0.009447027929127216, 0.02006686106324196, 0.0021515616681426764, 0.020285218954086304, -0.028616879135370255, 0.037180736660957336, -0.01352688204497099, -0.061126306653022766, 0.05725881829857826, 0.01227981224656105, 0.031992197036743164, -0.037629254162311554, 0.020032940432429314, 0.052425120025873184, 0.03508174791932106, 0.015507458709180355, 0.017972223460674286, 0.000932142254896462, 0.01652613840997219, 0.05627797916531563, -0.04553842172026634, -0.01174001581966877, 0.004747685510665178, 0.005546228960156441, 0.01907125674188137, -0.006769408006221056, -0.04392942786216736, -0.02885608933866024, 0.024121686816215515, -0.04360784962773323, -0.039391543716192245, -0.0022504583466798067, 0.006090720184147358, 0.04290095344185829, -0.02922259084880352, 0.017750564962625504, 0.027368925511837006, -0.04415823891758919, -0.029131248593330383, -0.026938902214169502, -0.00793307926505804, 0.018362071365118027, 0.02243240922689438, -0.07928234338760376, 0.006581663619726896, 0.04358444735407829, -0.037456732243299484, -0.023720432072877884, 0.022266864776611328, 0.006286410614848137, 0.0370345376431942, -0.05474318563938141, -0.02584371343255043, -0.02107108011841774, 0.03458208218216896, 0.0006730833556503057, -0.02803613431751728, 0.01757551170885563, -0.009166901931166649, -0.012750150635838509, -0.025661969557404518, 0.008897539228200912, 0.04993244260549545, -0.035411540418863297, -0.03867221996188164, 0.04047158360481262, -0.013716301880776882, -0.002888158429414034, -0.0167559664696455, 0.0041829925030469894, -0.0024383869022130966, -0.028399698436260223, -0.03488852456212044, 0.042475566267967224, -0.0216104406863451, 0.04381447657942772, -0.0019374581752344966, 0.02148619294166565, 0.05110366642475128, 0.003368991194292903, 0.04694411903619766, 0.02789086289703846, -0.007737642619758844, 0.026293408125638962, 0.008739108219742775, 0.0515778511762619, 0.0011428209254518151, -0.002096871379762888, 0.04968959838151932, -0.027933595702052116, 0.012161899358034134, 0.010282600298523903, 0.014565505087375641, 0.03648081421852112, -0.01872371882200241, -0.019782904535531998, 0.04826819896697998, 0.008170980028808117, 0.004918665159493685, -0.04085695743560791, -0.04614413529634476, -0.022415755316615105, -0.01887873373925686, -0.033248960971832275, -0.030845852568745613, -0.00196375441737473, -0.05975455045700073, -0.01060777809470892, 0.02949143759906292, 0.027950938791036606, -0.010961722582578659, 0.015897899866104126, 0.022156808525323868, -0.010127194225788116, -0.002974283415824175, -0.00731523847207427, -0.06676538288593292, 0.05326801910996437, 0.0044783130288124084, -0.02744838409125805, 0.03726205602288246, 0.00472097797319293, 0.03712921962141991, -0.08067760616540909, 0.0082577308639884, 0.023416416719555855, -0.02342996746301651, 0.029164515435695648, 0.028999237343668938, -0.00015866862668190151, -0.03524823859333992, -0.04322115331888199, -0.03707757219672203, 0.01188003458082676, 0.01486408431082964, 0.020766351372003555, 0.02590836025774479, 0.046321772038936615, 0.0060067735612392426, 0.03879976645112038, -0.03459710255265236, -0.009265069849789143, -0.005579373333603144, -0.018373338505625725, -0.015300103463232517, -0.02197427861392498, -0.0020789140835404396, 0.005307051353156567, -0.0366799533367157, 0.028407100588083267, 0.020074360072612762, 0.012806514278054237, -0.048096805810928345, 0.005634495057165623, -0.00829792208969593, -0.027229851111769676, 0.019314879551529884, 0.023883214220404625, -0.04247032850980759, 0.013129347003996372, 0.024137744680047035, 0.050515104085206985, 0.03519081696867943, -0.008654294535517693, 0.013268841430544853, -0.06315146386623383, 0.013654968701303005, 0.025131503120064735, 0.022313127294182777, 0.001642744056880474, -0.002315137768164277, 0.0005757182370871305, 0.025195011869072914, 0.01237807422876358, -0.015254153870046139, 0.050120286643505096, 0.03644530847668648, 0.05255753919482231, 0.03352998569607735, 0.02234692871570587, 0.022194648161530495, 0.015676595270633698, -0.009170470759272575, 0.012958475388586521, 0.0008857878274284303, 0.002320765284821391, 0.0022499465849250555, -0.021572556346654892, -0.039450615644454956, -0.011611002497375011, -0.016912207007408142, 0.010372191667556763, 0.03666805475950241, 0.0095121581107378, 0.0042872438207268715, 0.006764377932995558, 0.025118032470345497, 0.03763528913259506, 0.037811048328876495, 0.009434668347239494, -0.01599644310772419, 0.018293753266334534, 0.029744023457169533, 0.026840118691325188, 0.04026639088988304, -0.041047364473342896, -0.02487027458846569, -0.0049855392426252365, -0.049840208142995834, 0.0393877811729908, 0.0378834530711174, 0.003115656552836299, 0.005836476106196642, -0.010449286550283432, 0.005481984466314316, -0.02078009583055973, 0.038038890808820724, -0.018384939059615135, -0.007753296755254269, 0.030301135033369064, 0.028485560789704323, -0.021322833374142647, 0.0008309341501444578, 0.0018302574753761292, -0.0020894662011414766, 0.006799653172492981, 0.01249966211616993, 0.02041606605052948, 0.05426960811018944, -0.06239284947514534, -0.019254451617598534, -0.029508104547858238, 0.003542749211192131, 0.00253808475099504, 0.03164248913526535, -0.03451734036207199, -0.007146094460040331, 0.03415181487798691, 0.009017569944262505, -0.025418000295758247, 0.04813040792942047, 0.016586730256676674, 0.014052458107471466, -0.005011409521102905, -0.008884348906576633, -0.01920889876782894, -0.07288914918899536, 0.02341493032872677, -0.009271766059100628, 0.02822740562260151, -0.00834567379206419, 0.01404146384447813, -0.025779256597161293, -0.015444809570908546, -0.0018501586746424437, -0.029518689960241318, 0.013707566075026989, 0.0029866883996874094, -0.026583943516016006, -0.025048479437828064, 0.013068217784166336, -0.036047209054231644, -0.005896705202758312, 0.045499030500650406, -0.027268992736935616, -0.005439735017716885, 0.009882336482405663, 0.04236438497900963, -0.03097594901919365, -0.0007261094287969172, 0.025657599791884422, 0.03644876554608345, -0.0061713592149317265, 0.006050880067050457, 0.04505127668380737, 0.006720824632793665, -0.0005952892825007439, -0.030289245769381523, 0.021700186654925346, 0.024088088423013687, 0.01143986638635397, 0.013063057325780392, -0.032345496118068695, 0.012552361935377121, 0.02694758027791977, -0.019075723364949226, 0.023412687703967094, -0.0003472440002951771, -0.007884519174695015, 0.0011974311200901866, 0.0013827855000272393, -0.02472660318017006, -0.018555542454123497, 0.024802975356578827, 0.022455353289842606, 0.038101520389318466, 0.0519389808177948, -0.06999067217111588, -0.030188683420419693, -0.042161744087934494, 0.012217747047543526, 0.05420573428273201, -0.009012164548039436, -0.029308568686246872, 0.006815174128860235, -0.022916600108146667, 0.036167584359645844, 0.0048393188044428825, -0.0019286094466224313, -0.02397334948182106, 0.022191138938069344, -0.046636030077934265, -0.013661336153745651, 0.041706543415784836, 0.007600320503115654, 0.02585972286760807, -0.016670819371938705, -0.03616747260093689, 0.004099427256733179, -0.03355676308274269, -0.059944894164800644, 0.011163230054080486, -0.018079381436109543, 0.046605803072452545, 0.007810818497091532, 0.00013697789108846337, -0.011359674856066704, -0.011630484834313393, -0.04495427757501602, -0.006851942744106054, 0.019308676943182945, 0.009442664682865143, -0.031404003500938416, -0.015151469968259335, 0.019141649827361107, -0.06285601109266281, -0.032426271587610245, 0.024732166901230812, 0.04175623878836632, 0.0017473486950621009, 0.028626322746276855, -0.03136874735355377, -0.006225625518709421, 0.012420308776199818, 0.0012055900879204273, -0.05825953558087349, 0.05124933645129204, -0.00026173260994255543, 0.01727103814482689, 0.0050811078399419785, 0.03011990897357464 ]
Deep Learning over the Internet: Training Language Models Collaboratively
mryab
July 15, 2021
collaborative-training
research
https://huggingface.co/blog/collaborative-training
Why should we do it? These days, many highest-quality NLP systems are based on large pretrained Transformers. In general, their quality improves with size: you can achieve unparalleled results in natural language understanding and generation by scaling up the parameter count and leveraging the abundance of unlabeled text data. Unfortunately, we use these pretrained models not only because it's convenient. The hardware resources for training Transformers on large datasets often exceed anything affordable to a single person and even most commercial or research organizations. Take, for example, BERT: its training was estimated to cost about $7,000, and for the largest models like GPT-3, this number can be as high as $12 million! This resource limitation might seem obvious and inevitable, but is there really no alternative to using pretrained models for the broader ML community? However, there might be a way out of this situation: to come up with a solution, we only need to take a look around. It might be the case that the computational resources we're looking for are already there; for example, many of us have powerful computers with gaming or workstation GPUs at home. You might've already guessed that we're going to join their power similarly to Folding@home, Rosetta@home, Leela Chess Zero or different BOINC projects that leverage volunteer computing, but the approach is even more general. For instance, several laboratories can join their smaller clusters to utilize all the available resources, and some might want to join the experiment using inexpensive cloud instances. To a skeptical mind, it might seem that we're missing a key factor here: data transfer in distributed DL is often a bottleneck, since we need to aggregate the gradients from multiple workers. Indeed, any naïve approach to distributed training over the Internet is bound to fail, as most participants don't have gigabit connections and might disconnect from the network at any time. So how on Earth can you train anything with a household data plan? :) As a solution to this problem, we propose a new training algorithm, called Distributed Deep Learning in Open Collaborations (or DeDLOC), which is described in detail in our recently released preprint. Now, let’s find out what are the core ideas behind this algorithm!
[ 0.02924327552318573, 0.01057471614331007, 0.04390064626932144, 0.0716477483510971, 0.05993630737066269, 0.04358886554837227, 0.022885842248797417, 0.09089992940425873, -0.009107149206101894, -0.02912004478275776, -0.05946869030594826, 0.05699827894568443, -0.03895699977874756, 0.06476010382175446, 0.0071390108205378056, -0.04880843311548233, 0.06709086149930954, -0.03476757928729057, -0.013596362434327602, 0.030458882451057434, -0.024686308577656746, -0.034261975437402725, 0.05915648862719536, 0.050022024661302567, -0.0074985274113714695, -0.05087880417704582, 0.06281822174787521, -0.011374406516551971, -0.028252489864826202, 0.018455618992447853, -0.11590339243412018, 0.016366535797715187, 0.021010003983974457, 0.02272585779428482, -0.027794981375336647, -0.03173069283366203, -0.07080540060997009, 0.04773305729031563, -0.04758502542972565, -0.022893372923135757, 0.014381464570760727, 0.02796274423599243, -0.08943862468004227, 0.06030416861176491, -0.021236399188637733, -0.021317681297659874, -0.1586047112941742, 0.09889328479766846, -0.04206385463476181, -0.02159721963107586, -0.1282956749200821, 0.029856376349925995, -0.034803640097379684, 0.03018454648554325, 0.04577699676156044, 0.023091357201337814, 0.0049567753449082375, -0.08655969798564911, -0.007024555001407862, -0.01057612244039774, 0.035225432366132736, 0.008424966596066952, -0.007817241363227367, 0.024493245407938957, -0.013709500432014465, -0.01460923720151186, 0.03202589973807335, -0.017240094020962715, -0.09784407913684845, -0.03555113077163696, 0.012109469622373581, -0.05563218891620636, -0.07570867240428925, -0.015837937593460083, -0.042228683829307556, 0.010341495275497437, -0.0029679876752197742, -0.01753801293671131, 0.08358602970838547, 0.04095137119293213, -0.03532824292778969, 0.06280583888292313, 0.016828035935759544, -0.0038180737756192684, 0.06987344473600388, 0.003544383915141225, 0.0668533593416214, -0.035107892006635666, -0.06102893501520157, 0.04563295468688011, -0.005900698248296976, -0.0803794115781784, -0.03512060269713402, -0.011093169450759888, 0.06188443675637245, -0.007263794541358948, 0.012515067122876644, 0.06045866012573242, -0.07461389154195786, -0.004105366766452789, 0.02702934667468071, -0.026916244998574257, 0.013963728211820126, -0.03890559822320938, -0.043853454291820526, 0.05280563235282898, -0.03349170833826065, -0.09357578307390213, -0.0200666431337595, 0.011423274874687195, -0.011163871735334396, 0.00291247246786952, -0.033149611204862595, 0.006969027686864138, -0.05458447337150574, 0.0062172552570700645, 0.06252365559339523, 0.017558503895998, 0.022484321147203445, -0.003947265446186066, -0.013113615103065968, 0.0674196407198906, 0.01014663279056549, 0.019566155970096588, -0.05304985120892525, 0.054673511534929276, -0.015711644664406776, -0.020208993926644325, 0.008909790776669979, 0.011722593568265438, 0.07092997431755066, -0.007247839588671923, 0.046116217970848083, -0.01983604207634926, -0.007305602543056011, -0.03247026354074478, 0.01450275257229805, -0.03427479788661003, -0.009884046390652657, 0.0013519254280254245, -0.05189664289355278, 0.08145702630281448, -0.01386052742600441, -0.005225263070315123, 0.04952907934784889, 0.011080747470259666, -0.08365071564912796, 0.046171288937330246, -0.00815548375248909, -0.002933755051344633, -0.10564688593149185, 0.08274729549884796, -0.027425426989793777, -0.06747064739465714, 0.03653945028781891, 0.08415514975786209, -0.04485843703150749, -0.05763167515397072, -0.03079717420041561, -0.016028618440032005, -0.05684429407119751, -0.025998538359999657, 0.0028966732788830996, 0.017853423953056335, -0.00590952392667532, -0.0907026007771492, -0.014501006342470646, 0.026498254388570786, -0.01053835079073906, 0.04315923526883125, 0.032182782888412476, 0.029502321034669876, 0.06083553284406662, -0.006231918931007385, -0.003778922138735652, 0.001256095478311181, 0.009513750672340393, 0.053707972168922424, -0.021917685866355896, -0.014863697811961174, -0.07379941642284393, 0.02260686457157135, 0.033248741179704666, 0.05319177359342575, 0.05195165053009987, -0.09091625362634659, 0.015382920391857624, -0.05930806323885918, -0.034811023622751236, -0.000004170619376964169, -0.05457654967904091, -0.002807058161124587, 0.10445721447467804, 0.02040243335068226, 0.050209127366542816, -0.058483000844717026, -0.03584704175591469, 0.15749527513980865, 0.02582225203514099, 0.09332076460123062, 0.07131873071193695, 0.0026558730751276016, 0.00845081266015768, -0.038976557552814484, -0.03325943648815155, -0.023173073306679726, -0.015062550082802773, -0.02569418027997017, 0.04697588086128235, -0.018741434440016747, 0.012844590470194817, -0.13048018515110016, -0.021663295105099678, -0.05653676390647888, -0.03173068165779114, -0.019156398251652718, -0.02341732196509838, 0.02904951386153698, 0.042060256004333496, -0.03774787858128548, 0.14059709012508392, -0.052289966493844986, -0.0352916419506073, 0.03375456854701042, -0.019380616024136543, 0.07182122021913528, 0.06854270398616791, 0.014180046506226063, 0.09216916561126709, -0.07992623746395111, -0.04088658094406128, -0.07426659017801285, -0.013007394038140774, 0.03939994052052498, 0.005322427023202181, 0.020266268402338028, -0.021568143740296364, -0.052872925996780396, 0.007018011994659901, 0.005009950138628483, -0.023631270974874496, 0.015238316729664803, 0.008297608233988285, 0.0788751021027565, 0.02375119924545288, -0.02344426140189171, 0.03539900854229927, 0.022756440564990044, -0.010982675477862358, -0.03652022033929825, -0.10250213742256165, 0.046183958649635315, -0.017410682514309883, -0.04180977866053581, 0.03280262649059296, 0.013041865080595016, 0.0066862087696790695, -0.0033699802588671446, -0.04880722984671593, 0.02547990158200264, -0.022633805871009827, -0.006522531155496836, -0.019958801567554474, -0.05598871409893036, -0.0010566490236669779, -0.04979989677667618, -0.01391497440636158, -0.011373169720172882, 0.02649357169866562, 0.007868503220379353, 0.008617132902145386, -0.026007307693362236, 0.020679600536823273, 0.03847810998558998, 0.0024719885550439358, 0.03107358142733574, 0.01494645420461893, -0.042900536209344864, -0.023240147158503532, -0.03733694553375244, 0.0004877237370237708, -0.05248362198472023, 0.01870986819267273, 0.016910836100578308, 0.016785260289907455, -0.011513644829392433, 0.004153958056122065, -0.0005080116097815335, -0.009837057441473007, 0.009002386592328548, 0.006930977571755648, 0.03742685541510582, -0.03346463292837143, -0.01904558576643467, -0.018772099167108536, -0.011945508420467377, 0.025093398988246918, -0.026656508445739746, -0.01451882254332304, 0.013859167695045471, 0.011900628916919231, -0.030202848836779594, -0.005242909770458937, 0.004288527183234692, -0.028207818046212196, 0.013201634399592876, 0.005880857352167368, 0.03321623429656029, -0.1039343774318695, 0.008091557770967484, 0.0036258965265005827, 0.037341292947530746, -0.00453755259513855, -0.008871901780366898, 0.018116453662514687, -0.04312831908464432, 0.009992757812142372, 0.011539490893483162, -0.01576532982289791, 0.03491787239909172, 0.019857173785567284, -0.0038606824818998575, 0.012318724766373634, -0.02419733814895153, 0.023487664759159088, -0.0019536365289241076, 0.06438606977462769, 0.04198615998029709, -0.021268151700496674, 0.033466193825006485, -0.023504609242081642, 0.008871816098690033, -0.050559576600790024, 0.011224097572267056, 0.012224550358951092, -0.00419953279197216, 0.04521714523434639, -0.011988525278866291, -0.05945228412747383, -0.044118475168943405, -0.025783073157072067, 0.029630053788423538, 0.009713652543723583, -0.005506046116352081, 0.0024235821329057217, 0.07729877531528473, -0.028465764597058296, 0.04010965675115585, 0.019920585677027702, -0.051235657185316086, 0.0058270953595638275, -0.03002803400158882, 0.007750693708658218, 0.027609890326857567, -0.017184073105454445, -0.026167642325162888, 0.039409324526786804, -0.008172078989446163, -0.035595864057540894, -0.020520592108368874, 0.034667372703552246, 0.05252569541335106, -0.0003013411769643426, -0.006138806696981192, -0.006161417346447706, -0.00197964278049767, 0.0297168530523777, 0.00010770763765322044, -0.03039071150124073, 0.06828202307224274, 0.024353813380002975, -0.029960446059703827, -0.020046468824148178, 0.06929565966129303, -0.003805153537541628, -0.0005923452554270625, 0.004548347555100918, 0.04801439866423607, 0.003311955602839589, 0.058743398636579514, 0.03501136600971222, 0.0019762860611081123, 0.002260396024212241, 0.019720835611224174, 0.024715861305594444, 0.003578176023438573, 0.05786988511681557, 0.016256067901849747, -0.019603107124567032, -0.046886153519153595, -0.03992771729826927, -0.05247122421860695, 0.007577099371701479, 0.016788076609373093, 0.03842926025390625, -0.025412263348698616, 0.015082338824868202, 0.01390113029628992, -0.0001334261760348454, -0.030473973602056503, 0.03491152822971344, 0.013736060820519924, 0.020197635516524315, -0.0027182858902961016, 0.039395079016685486, -0.005341879092156887, -0.028864271938800812, -0.03920681029558182, 0.036113180220127106, -0.04667379707098007, -0.01484160590916872, -0.004426560364663601, -0.00768071785569191, 0.05973898619413376, -0.015466698445379734, 0.001132406760007143, 0.02081816829741001, -0.041089847683906555, 0.01144381519407034, 0.017019951716065407, 0.016258694231510162, -0.011187462136149406, 0.013566536828875542, 0.013638915494084358, -0.020065760239958763, 0.03295336291193962, -0.02100563608109951, 0.021089565008878708, -0.03599198907613754, 0.033074699342250824, -0.004389183130115271, -0.02099742740392685, 0.017194783315062523, -0.019146429374814034, 0.04180910065770149, 0.035132911056280136, -0.018587995320558548, -0.027552934363484383, 0.0032997243106365204, -0.023453790694475174, 0.03189738094806671, 0.01960696652531624, -0.031258292496204376, -0.019799837842583656, -0.026466550305485725, 0.006396607495844364, -0.027518298476934433, -0.0023557664826512337, -0.009587744250893593, -0.021271057426929474, 0.02336147613823414, -0.014926652424037457, 0.03105221316218376, -0.019635077565908432, -0.01168237067759037, -0.02199031598865986, -0.014283855445683002, -0.0003791231429204345, 0.01878182776272297, -0.00032469467259943485, -0.05480694770812988, 0.04112440347671509, 0.05276629701256752, -0.02775914967060089, -0.019330419600009918, 0.04351041838526726, 0.017041556537151337, 0.023283883929252625, -0.03283069282770157, 0.0025001144967973232, -0.054786715656518936, 0.026849614456295967, 0.01761157251894474, -0.02324475534260273, 0.0001667427277425304, -0.021888434886932373, 0.016971979290246964, 0.019740456715226173, 0.029034629464149475, -0.016148217022418976, -0.02493651770055294, 0.011633333750069141, 0.012233293615281582, 0.010065698064863682, 0.033976636826992035, 0.02744453214108944, -0.02867765724658966, 0.03942079842090607, -0.010335119441151619, -0.021686097607016563, 0.008885327726602554, 0.01524079404771328, -0.009639807045459747, 0.024981040507555008, 0.05119200423359871, 0.05489576607942581, -0.0044687045738101006, 0.04202262684702873, -0.0267229862511158, 0.011296643875539303, 0.05735500529408455, -0.019859381020069122, 0.02355310134589672, -0.017068546265363693, 0.002504915464669466, 0.036406926810741425, 0.015189209952950478, 0.03294636309146881, 0.0060265446081757545, 0.04187226668000221, -0.011773268692195415, -0.01851724088191986, 0.04414193332195282, 0.03228769823908806, -0.013426755554974079, -0.03719405084848404, -0.01191711239516735, -0.00722845084965229, 0.003805485786870122, 0.02381984144449234, -0.017718791961669922, -0.015859540551900864, -0.0006844171439297497, -0.02501845359802246, -0.022749947383999825, 0.05653894320130348, 0.032594919204711914, 0.016889918595552444, -0.019684534519910812, -0.024632083252072334, -0.007434890605509281, 0.004705841653048992, 0.03443042188882828, -0.039004359394311905, 0.0008208213839679956, 0.01763281598687172, 0.018134484067559242, 0.007971003651618958, 0.020077239722013474, 0.01804514043033123, -0.014913458377122879, 0.03281785547733307, 0.012945577502250671, -0.03811722248792648, -0.010695269331336021, 0.05548957362771034, 0.004355722106993198, -0.025905774906277657, -0.004759242292493582, -0.04693920537829399, -0.032480619847774506, 0.05225512012839317, -0.05683739483356476, 0.015431123785674572, 0.0354742594063282, -0.009381984360516071, -0.007535181939601898, -0.013982048258185387, 0.016537729650735855, -0.03690123185515404, -0.014902040362358093, 0.007923267781734467, 0.014773251488804817, 0.01018630713224411, -0.004878691863268614, 0.03157774358987808, 0.015094653703272343, 0.015766404569149017, 0.02694745548069477, -0.05149271339178085, 0.041296735405921936, 0.04126329347491264, -0.021979959681630135, 0.02215341106057167, 0.015560588799417019, -0.07418927550315857, 0.006933378987014294, 0.010136089287698269, 0.015330692753195763, 0.0017594598466530442, -0.023571224883198738, -0.00025449309032410383, -0.02167421765625477, -0.009556443430483341, 0.040298838168382645, 0.027750473469495773, 0.015791144222021103, 0.02769394777715206, 0.02495276927947998, 0.04506605118513107, 0.03940965235233307, -0.020465930923819542, -0.010631079785525799, 0.01987394504249096, 0.03262829780578613, 0.009726546704769135, 0.02987484820187092, 0.0060842763632535934, 0.0013436251319944859, -0.013763689436018467, -0.010858584195375443, 0.01816638372838497, -0.04843026027083397, -0.01630423590540886, 0.011100662872195244, -0.027332302182912827, 0.010403384454548359, -0.012520466931164265, 0.033571746200323105, 0.05378912761807442, 0.023948444053530693, 0.009699554182589054, 0.022082088515162468, 0.017867209389805794, 0.020855246111750603, 0.03815506026148796, 0.04056238755583763, 0.014933370985090733, 0.020006610080599785, 0.020814649760723114, 0.017110737040638924, 0.06648842245340347, -0.03767639771103859, -0.015818195417523384, 0.0391012504696846, -0.019897976890206337, 0.03151021525263786, 0.03657343238592148, -0.031284626573324203, -0.012771603651344776, 0.0061905826441943645, 0.022629059851169586, -0.025403955951333046, 0.03272131830453873, -0.03438623994588852, -0.01306813396513462, 0.008033104240894318, -0.028690624982118607, -0.004655227996408939, 0.018590809777379036, 0.0003340949770063162, -0.026345478370785713, -0.0024684607051312923, -0.010039634071290493, 0.025030596181750298, 0.03182060271501541, -0.003558809170499444, -0.0010623947018757463, -0.029099518433213234, -0.028823161497712135, 0.0062526497058570385, 0.03597079962491989, -0.013824972324073315, 0.01726924069225788, 0.04503121227025986, 0.013604428619146347, 0.0003653984167613089, 0.005561694968491793, 0.007463091518729925, -0.007187058217823505, -0.04101243242621422, 0.0251143965870142, -0.015293247066438198, -0.0590737909078598, -0.004043946973979473, -0.06082569435238838, 0.013585439883172512, -0.03508496657013893, 0.0022076352033764124, 0.031289827078580856, 0.06273487955331802, -0.02209385298192501, -0.04081154987215996, 0.006873296108096838, 0.01493449043482542, -0.014815003611147404, 0.016838304698467255, 0.0019962184596806765, -0.033677246421575546, 0.008976160548627377, 0.00015762298426125199, 0.00011570392234716564, -0.04510828107595444, -0.021375900134444237, 0.07282712310552597, -0.05240723118185997, -0.022124091163277626, -0.003820834681391716, 0.033172134310007095, 0.0027482211589813232, 0.00962266605347395, 0.058167535811662674, 0.05187687277793884, 0.02552788332104683, -0.04060817137360573, 0.0020351670682430267, -0.03745323792099953, 0.04824578016996384, -0.017499273642897606, -0.05895063653588295, -0.022818149998784065, 0.02830301970243454, -0.013181266374886036, -0.015134387649595737, -0.03883305937051773, -0.007725299336016178, -0.035883963108062744, 0.011768151074647903, -0.0364350751042366, -0.022409899160265923, 0.043582942336797714, 0.0026879901997745037, 0.01126212440431118, 0.019782891497015953, -0.030235180631279945, -0.01502771582454443, -0.02422584407031536, 0.013286315836012363, 0.03169203922152519, 0.0021447069011628628, -0.03221012279391289, -0.03587355464696884, -0.015408426523208618, -0.003083770861849189, -0.047443971037864685, 0.008006369695067406, 0.017072157934308052, 0.005027588922530413, -0.005984572693705559, 0.022605905309319496, 0.01257109921425581, -0.024846486747264862, 0.05077730864286423, -0.014318631030619144, -0.0032562478445470333, 0.026049869135022163, -0.034525565803050995, -0.03819959610700607, 0.042596813291311264, -0.016547583043575287, -0.0018445621244609356, 0.07766450941562653, 0.025869710370898247, 0.015430889092385769, -0.03044898435473442, -0.02655077539384365, 0.010092366486787796, 0.015222468413412571, -0.04624101147055626, -0.04052667319774628, 0.0253849308937788, 0.003185194218531251, -0.01021516602486372, -0.03386905416846275, 0.04459735378623009, 0.03311245143413544, 0.017065491527318954, 0.011326773092150688, 0.014616314321756363, 0.02764156460762024, -0.009026842191815376, 0.01994534768164158, 0.005890485364943743, 0.05668741837143898, 0.04944797232747078, -0.008352980017662048, -0.0301072858273983, -0.024986743927001953 ]
Deep Learning over the Internet: Training Language Models Collaboratively
mryab
July 15, 2021
collaborative-training
research
https://huggingface.co/blog/collaborative-training
sahajBERT As always, having a well-designed algorithmic framework doesn't mean that it will work as intended in practice, because some assumptions may not hold true in actual training runs. To verify the competitive performance of this technology and to showcase its potential, we organized a special collaborative event to pretrain a masked language model for the Bengali language. Even though it is the fifth most spoken native language in the world, it has very few masked language models openly available, which emphasizes the importance of tools that can empower the community, unlocking a plethora of opportunities in the field. We conducted this experiment with real volunteers from the Neuropark community and used openly available datasets (OSCAR and Wikipedia), because we wanted to have a fully reproducible example that might serve as an inspiration for other groups. Below, we describe the detailed setup of our training run and demonstrate its results.
[ 0.023356031626462936, -0.09717341512441635, 0.015405570156872272, 0.057700324803590775, 0.05785606428980827, 0.044058650732040405, 0.02798016183078289, -0.004678469616919756, -0.07926022261381149, -0.033150289207696915, -0.02614588290452957, 0.0317234992980957, -0.013745833188295364, 0.03284842148423195, -0.04772266373038292, -0.008684438653290272, 0.07482480257749557, -0.06256420165300369, -0.011894531548023224, 0.02546270564198494, -0.0387566015124321, 0.008749493397772312, 0.035028424113988876, -0.0027173543348908424, 0.037228118628263474, 0.005183950997889042, 0.05054444074630737, -0.02486571855843067, -0.017445988953113556, -0.015202880837023258, -0.017362290993332863, -0.0035353261046111584, -0.0017686333740130067, -0.012096519581973553, -0.04251663386821747, 0.010719713754951954, -0.1423797309398651, 0.023832647129893303, -0.007047014776617289, -0.032970741391181946, -0.02730756625533104, 0.00777054950594902, -0.033246107399463654, 0.0940830335021019, -0.04443398863077164, -0.007570705376565456, -0.09494264423847198, 0.09138433635234833, -0.052972886711359024, -0.013173144310712814, -0.12972603738307953, 0.026594901457428932, 0.021054094657301903, 0.049698807299137115, -0.010224558413028717, -0.014323950745165348, -0.022311914712190628, -0.046642255038022995, -0.044960614293813705, 0.056150276213884354, -0.030224930495023727, -0.04101504012942314, 0.029792413115501404, 0.010341238230466843, 0.02803736738860607, 0.010898862965404987, -0.005289153661578894, 0.029260702431201935, -0.03141862154006958, -0.015564823523163795, 0.028387097641825676, 0.021797088906168938, -0.04469754919409752, 0.002051950665190816, -0.004434683825820684, -0.05587594956159592, 0.047098249197006226, 0.05411824956536293, -0.013240923173725605, -0.01138155348598957, -0.05707720294594765, 0.05940188094973564, 0.04022425785660744, 0.017685500904917717, 0.044257715344429016, -0.02036486379802227, 0.01119109708815813, -0.08377395570278168, -0.00233104988001287, 0.009165956638753414, 0.004922217223793268, -0.04083165153861046, -0.003585385624319315, 0.029419489204883575, 0.024755934253335, -0.011133335530757904, 0.053887270390987396, 0.0386350043118, -0.055003244429826736, -0.07091569900512695, -0.0169683750718832, -0.030311470851302147, -0.03433266654610634, 0.008497379720211029, -0.072243832051754, 0.058402515947818756, -0.06260398775339127, -0.02419557049870491, -0.016552304849028587, 0.007946903817355633, 0.05267857387661934, -0.033874496817588806, -0.009355091489851475, 0.032202962785959244, -0.028716720640659332, 0.006113579496741295, 0.008029480464756489, 0.040567368268966675, 0.028255457058548927, -0.04368824511766434, -0.020451540127396584, 0.06832834333181381, 0.0025754093658179045, 0.03516209125518799, -0.043764110654592514, 0.022483328357338905, -0.02979228086769581, 0.06875163316726685, -0.018596652895212173, -0.0007346125785261393, -0.01765711046755314, -0.06817898899316788, 0.05306495726108551, 0.01724870875477791, -0.008582348003983498, -0.0322471559047699, -0.0040391581133008, -0.0383664071559906, -0.03784574568271637, 0.005715033505111933, -0.06248420476913452, 0.025686994194984436, -0.047713905572891235, -0.015369979664683342, 0.07963674515485764, 0.025005118921399117, -0.038472674787044525, 0.0891101211309433, 0.04028907045722008, -0.026553450152277946, -0.053944796323776245, 0.042486902326345444, -0.05451767146587372, -0.08127150684595108, -0.006783898454159498, 0.07662966847419739, -0.04764549061655998, -0.05212073773145676, -0.01942785270512104, -0.05315309017896652, 0.02440139278769493, -0.020536957308650017, -0.068949393928051, -0.05205479636788368, -0.019785026088356972, 0.007336969953030348, 0.007315552793443203, -0.047467589378356934, 0.01861868053674698, 0.03924174979329109, -0.011678112670779228, 0.01889398880302906, 0.06356226652860641, -0.06301471590995789, -0.03973423317074776, 0.014830977655947208, -0.04451414942741394, 0.026188455522060394, 0.08799658715724945, 0.0549527183175087, -0.018114842474460602, 0.08731462806463242, 0.062286172062158585, 0.027405699715018272, 0.018283426761627197, -0.07145164161920547, 0.0495736189186573, 0.009067555889487267, 0.010199304670095444, 0.06344635039567947, -0.0703829899430275, 0.06920816004276276, 0.0410405732691288, -0.05798052251338959, -0.024546697735786438, -0.03158947452902794, 0.04148269444704056, 0.10582224279642105, 0.07164164632558823, 0.10147937387228012, 0.08702865242958069, -0.009318890981376171, 0.0048026940785348415, -0.02300991490483284, 0.04068533703684807, -0.005298880860209465, -0.01747003011405468, -0.02507978305220604, 0.01737404800951481, -0.006713538896292448, 0.017092278227210045, -0.06331183761358261, 0.029510490596294403, -0.03748632222414017, 0.01746794767677784, 0.05706122890114784, -0.03546488657593727, 0.08302795141935349, -0.036855682730674744, -0.008469797670841217, 0.10382812470197678, -0.07402392476797104, -0.04797970876097679, 0.01406308077275753, 0.0026993602514266968, 0.058966681361198425, 0.008545409888029099, 0.06350169330835342, 0.13487878441810608, -0.03737955912947655, 0.03345360979437828, -0.019846711307764053, 0.023577025160193443, 0.04331645369529724, -0.08094722777605057, -0.08454049378633499, 0.02208884432911873, 0.005582486279308796, -0.000910121772903949, -0.01819627918303013, -0.02560235932469368, -0.014796977862715721, -0.10126554220914841, 0.026058314368128777, -0.023099079728126526, 0.03338690847158432, 0.06113229691982269, -0.013456523418426514, -0.010104048065841198, 0.028601842001080513, -0.0010340047301724553, -0.006253624334931374, -0.08319968730211258, 0.03126539662480354, 0.07798382639884949, 0.04039013013243675, 0.04554217308759689, -0.035342585295438766, -0.01046556793153286, 0.007386865559965372, 0.007305383216589689, -0.029692267999053, -0.025974266231060028, -0.05035357177257538, 0.0007889482658356428, -0.044839609414339066, 0.06062484532594681, 0.03172367438673973, 0.05436311289668083, -0.0026519508101046085, -0.00014228354848455638, -0.01180533692240715, 0.03210541233420372, 0.0018107949290424585, 0.03962699696421623, 0.0636606216430664, 0.009391970001161098, -0.03473319485783577, -0.015938369557261467, -0.040893372148275375, -0.02378058433532715, -0.05043167620897293, 0.0289317537099123, 0.028350690379738808, 0.006068394985049963, 0.010366208851337433, -0.027158018201589584, 0.0021833404898643494, -0.01336100697517395, 0.03880060464143753, 0.008981537073850632, 0.06224071606993675, 0.03037329949438572, 0.018697375431656837, 0.05088856816291809, -0.027448022738099098, -0.01885276287794113, 0.010345458053052425, -0.04150453209877014, 0.005185185465961695, -0.03527773544192314, -0.031133320182561874, -0.008012693375349045, 0.014460233971476555, -0.005313889589160681, -0.011968758888542652, -0.012327030301094055, -0.0011187463533133268, -0.0682176947593689, 0.04008975252509117, -0.027323788031935692, -0.00507863936945796, -0.042886536568403244, 0.025952786207199097, 0.05328919738531113, 0.008346275426447392, 0.029198583215475082, 0.024831242859363556, -0.053167976438999176, -0.024274762719869614, 0.021447956562042236, 0.006977111101150513, -0.00931349117308855, -0.025616703554987907, -0.02380722388625145, 0.00834570825099945, 0.035345111042261124, 0.027173154056072235, -0.037603091448545456, 0.037958160042762756, -0.00790051743388176, -0.014108745381236076, -0.017171163111925125, -0.003282976569607854, 0.006138052325695753, 0.0010327957570552826, 0.018843874335289, -0.009768306277692318, -0.03874239698052406, -0.020440032705664635, -0.023892128840088844, 0.022924134507775307, -0.0053274063393473625, -0.019286515191197395, -0.032829649746418, 0.04658537358045578, -0.015519749373197556, 0.009184580296278, -0.01842670887708664, -0.0205380879342556, 0.07522030919790268, -0.0106126070022583, 0.011839966289699078, 0.012824691832065582, 0.03462958335876465, -0.005122039932757616, 0.051033444702625275, -0.08526065945625305, -0.02344081737101078, -0.023805463686585426, -0.006304075010120869, 0.07566724717617035, -0.015530997887253761, -0.016460634768009186, 0.06310601532459259, 0.0006484275800175965, 0.025623641908168793, -0.009180182591080666, 0.010470799170434475, 0.056731414049863815, -0.006744377315044403, -0.02176375314593315, 0.013923008926212788, 0.02887444943189621, 0.05853314325213432, -0.001419375534169376, -0.014621500857174397, -0.016757380217313766, 0.04026752710342407, 0.05062229931354523, 0.0079252440482378, -0.006737980991601944, -0.0025130363646894693, 0.043502166867256165, 0.01760515570640564, -0.022012636065483093, 0.024999409914016724, -0.009357347153127193, -0.019157765433192253, -0.0008058924577198923, -0.025672774761915207, -0.010441728867590427, 0.0007541633094660938, 0.006997285410761833, 0.013744833879172802, -0.06852968782186508, -0.008393365889787674, 0.02764289267361164, 0.007104755844920874, 0.007516710553318262, -0.023648541420698166, 0.02356279455125332, 0.01138653326779604, -0.0012483418686315417, 0.022036569193005562, 0.016239933669567108, -0.013892960734665394, -0.044199138879776, 0.03431534394621849, 0.004633566364645958, -0.016177626326680183, -0.017562614753842354, 0.01592687889933586, 0.04327406361699104, -0.06917069852352142, 0.0032452046871185303, 0.061643220484256744, -0.04638718441128731, 0.021398842334747314, 0.05087229609489441, 0.050548769533634186, 0.03310738131403923, 0.031286902725696564, 0.04231303930282593, -0.0053596519865095615, 0.01846638135612011, -0.02933788113296032, -0.04305613040924072, -0.0015086516505107284, -0.003487551584839821, 0.02683354914188385, 0.01799827441573143, 0.017354682087898254, -0.03077114373445511, -0.022819362580776215, -0.0022357231937348843, 0.033850982785224915, -0.014632515609264374, -0.06076913699507713, -0.001506214844994247, 0.026555635035037994, -0.0034955614246428013, 0.022711824625730515, 0.015217659994959831, 0.0016359322471544147, -0.02040177397429943, -0.07307648658752441, -0.013462575152516365, 0.01323715690523386, 0.013036215677857399, 0.04064260423183441, -0.026812411844730377, 0.025537796318531036, -0.027090545743703842, 0.04016399756073952, -0.03985627368092537, -0.0016244336729869246, 0.005797099322080612, -0.012484274804592133, -0.0031050739344209433, -0.05812305584549904, 0.003570551285520196, 0.017833782359957695, -0.01403383444994688, 0.009617796167731285, 0.006380719598382711, 0.049046266824007034, 0.05724867433309555, 0.011642102152109146, -0.019238527864217758, -0.04454566165804863, 0.01612580567598343, 0.00644218223169446, -0.01440795324742794, -0.01302445586770773, -0.01338199432939291, -0.0019642384722828865, 0.02208041213452816, 0.0021256336476653814, -0.04625871777534485, -0.03543746843934059, 0.030809035524725914, 0.013489343225955963, -0.05286126583814621, 0.03754817321896553, -0.0019857818260788918, -0.06033206731081009, 0.06407035142183304, -0.0005720288027077913, -0.009072944521903992, 0.01088347565382719, 0.03877539187669754, 0.021862931549549103, -0.005976496264338493, 0.017326608300209045, 0.034071967005729675, 0.012069698423147202, -0.033662691712379456, 0.013380341231822968, -0.005727140232920647, 0.053825754672288895, -0.03694021329283714, -0.03451966866850853, -0.036964960396289825, -0.05072973668575287, 0.00024285911058541387, -0.015398943796753883, -0.03799678385257721, 0.002363785170018673, -0.00007428181561408564, 0.01657130755484104, 0.012143710628151894, 0.04794570803642273, 0.032981131225824356, -0.03592001646757126, -0.041495081037282944, -0.009764415211975574, -0.04370185360312462, 0.015628159046173096, 0.05112946033477783, -0.022660154849290848, -0.02588135376572609, -0.009453415870666504, -0.04390612244606018, 0.008963027037680149, 0.011653943918645382, -0.007773828227072954, 0.06827135384082794, -0.010542494244873524, -0.01948806829750538, -0.015840433537960052, -0.042655836790800095, 0.009566353633999825, -0.030986757948994637, -0.00025465904036536813, 0.057004716247320175, 0.01910567656159401, -0.019418997690081596, -0.026736710220575333, -0.011642501689493656, 0.04070380702614784, 0.035184718668460846, -0.031244918704032898, -0.022223908454179764, -0.006297128275036812, 0.023502742871642113, -0.012288182973861694, -0.0030511741060763597, -0.014268341474235058, -0.03516180440783501, 0.020948713645339012, -0.015108299441635609, -0.018623927608132362, 0.05475964769721031, -0.0005977441323921084, -0.01301689725369215, 0.03577018529176712, 0.019644351676106453, 0.010101684369146824, 0.015482869930565357, 0.012975090183317661, 0.025116708129644394, -0.00981093104928732, -0.009996223263442516, 0.007805823348462582, -0.0025829162914305925, -0.041876621544361115, -0.029708784073591232, 0.024145424365997314, -0.034951772540807724, -0.0216068048030138, 0.04992162436246872, -0.013658962212502956, 0.026801465079188347, 0.05481782928109169, -0.07828456163406372, 0.010673267766833305, 0.03244124352931976, 0.07026263326406479, -0.015655066817998886, -0.021183045580983162, -0.03816690668463707, -0.04204832762479782, -0.03667896240949631, 0.02312089502811432, 0.06337010115385056, 0.018860751762986183, -0.0024663149379193783, 0.016026420518755913, 0.01741524040699005, -0.0023830803111195564, 0.012057527899742126, 0.0013235606020316482, 0.021302545443177223, 0.01513447891920805, 0.009579278528690338, -0.013300630263984203, -0.03984513878822327, -0.04224753379821777, -0.016805868595838547, 0.0002667447261046618, -0.03956690803170204, -0.04519044980406761, 0.008500607684254646, 0.030993377789855003, 0.03473147377371788, 0.006941082421690226, -0.026897888630628586, 0.04093100130558014, 0.04554831609129906, 0.02401023916900158, -0.018147611990571022, 0.01913374662399292, 0.04378749057650566, 0.0077419704757630825, 0.042624425143003464, 0.05528067424893379, 0.005902336910367012, -0.024685822427272797, -0.004381344188004732, 0.03956785425543785, 0.043499432504177094, -0.03339805454015732, 0.0352308489382267, 0.03924946114420891, -0.04088557884097099, 0.02364841289818287, 0.022848207503557205, -0.0014684568159282207, 0.009857910685241222, -0.0009866139153018594, 0.017094094306230545, 0.013495141640305519, -0.030632080510258675, -0.0316581167280674, -0.04064894840121269, -0.04941684007644653, -0.003928023390471935, -0.016278086230158806, 0.005146287847310305, 0.001221386599354446, -0.03890177607536316, -0.023280249908566475, 0.02120262384414673, 0.0240948423743248, 0.0227601770311594, -0.016738781705498695, -0.043124061077833176, -0.00898266863077879, 0.019339939579367638, 0.022141968831419945, 0.0009376116213388741, -0.0006487358477897942, -0.020787600427865982, 0.017967037856578827, 0.014908352866768837, -0.02168952114880085, 0.04214172810316086, 0.04312942922115326, -0.04519705846905708, -0.031303927302360535, -0.0006741546094417572, 0.012278281152248383, -0.019067173823714256, 0.0371861457824707, -0.03206644952297211, -0.00621555931866169, 0.0126848379150033, -0.0007492253207601607, 0.014082904905080795, 0.04183873534202576, 0.02906038984656334, -0.04519176110625267, -0.03772702440619469, 0.044527795165777206, -0.028699485585093498, 0.01844332180917263, 0.018911616876721382, -0.00727063836529851, -0.022936921566724777, 0.010166775435209274, -0.04310830309987068, 0.01911936141550541, 0.019744280725717545, 0.016542911529541016, -0.019265592098236084, -0.023808756843209267, -0.005203567445278168, 0.03169310465455055, 0.006651087664067745, -0.001663747476413846, 0.02671493962407112, 0.013998421840369701, 0.015189625322818756, -0.03795148804783821, 0.018284616991877556, -0.029125027358531952, 0.0488911010324955, -0.03856906294822693, -0.0781637504696846, -0.07425621151924133, 0.0009679351933300495, 0.017552638426423073, -0.02567553147673607, -0.09876289963722229, -0.01820516213774681, -0.01233025174587965, -0.0012229131534695625, -0.02035263553261757, 0.02675602212548256, 0.03341661021113396, 0.005255525931715965, 0.004802483133971691, 0.01401660405099392, -0.003456441918388009, 0.009040660224854946, -0.025930894538760185, 0.0035592925269156694, 0.04699751362204552, 0.003684827359393239, 0.005895284935832024, 0.053981468081474304, 0.020674217492341995, -0.011777414940297604, -0.044999632984399796, -0.010156724601984024, 0.0006181877688504755, 0.024318717420101166, 0.04043461009860039, 0.035453204065561295, 0.06163087859749794, 0.014950418844819069, -0.02209354005753994, -0.018069980666041374, 0.002091003581881523, 0.0008274951833300292, 0.01759820058941841, -0.01483109500259161, -0.0055586472153663635, -0.01266438327729702, 0.02692435123026371, 0.05883164703845978, -0.02067328803241253, 0.005404201801866293, 0.010131251998245716, -0.057801105082035065, -0.02574075758457184, 0.004137449432164431, -0.022664852440357208, -0.044058285653591156, -0.024910226464271545, -0.008100481703877449, -0.0031359430868178606, -0.029449034482240677, 0.05119989812374115, 0.041884660720825195, 0.0056239767000079155, -0.035224590450525284, -0.004506452940404415, 0.004317338112741709, 0.05815944820642471, 0.01912384107708931, 0.011591014452278614, 0.07618431746959686, -0.016800638288259506, -0.031114237383008003, -0.04634426534175873, 0.027758769690990448 ]
Deep Learning over the Internet: Training Language Models Collaboratively
mryab
July 15, 2021
collaborative-training
research
https://huggingface.co/blog/collaborative-training
Architecture For our experiment, we chose ALBERT (A Lite BERT) — a model for language representations that is pretrained with Masked Language Modeling (MLM) and Sentence Order Prediction (SOP) as objectives. We use this architecture because weight sharing makes it very parameter-efficient: for example, ALBERT-large has ~18M trainable parameters and performs comparably to BERT-base with ~108M weights on the GLUE benchmark. It means that there is less data to exchange between the peers, which is crucial in our setup, as it significantly speeds up each training iteration. 💡 Want to know more about ALBERT? Paper Transformers doc
[ -0.029783183708786964, 0.014611171558499336, 0.013127567246556282, 0.00906442292034626, 0.029691258445382118, 0.03248574212193489, 0.02475718967616558, 0.04131739214062691, -0.024078277871012688, -0.039243146777153015, -0.06942692399024963, 0.01658472791314125, 0.0007843857747502625, 0.021581409499049187, -0.03183324262499809, -0.03295034542679787, 0.05462580546736717, 0.0026847205590456724, 0.02152245119214058, 0.014022504910826683, -0.044765617698431015, -0.0857597142457962, 0.08480074256658554, 0.008979073725640774, 0.07178135216236115, -0.07385317981243134, 0.020213190466165543, -0.014864417724311352, -0.04568299278616905, 0.043463729321956635, -0.0377957746386528, -0.03613945469260216, 0.002459006616845727, -0.0023667030036449432, 0.0009287975262850523, -0.025221800431609154, -0.05144087225198746, 0.05147578567266464, -0.0174886342138052, -0.03952409699559212, 0.007262386381626129, 0.04070151224732399, -0.05892762541770935, 0.05133691430091858, -0.02259267307817936, -0.024138545617461205, -0.08389236778020859, 0.10402363538742065, -0.10042676329612732, -0.033161018043756485, -0.07518590986728668, 0.027912572026252747, -0.04727209731936455, 0.07232189923524857, 0.04505227133631706, 0.006807258818298578, -0.0021733285393565893, -0.06485040485858917, -0.023938333615660667, -0.0015798636013641953, -0.00043624782119877636, -0.024515442550182343, 0.018864989280700684, 0.02784520573914051, -0.01326176431030035, -0.008334510028362274, -0.03041648492217064, -0.027405114844441414, 0.004938745871186256, 0.025757452473044395, 0.0029001147486269474, -0.023828519508242607, -0.06098928302526474, -0.04310065507888794, 0.03220345824956894, -0.009238192811608315, 0.018771683797240257, 0.02905038557946682, 0.021240219473838806, 0.04319104924798012, -0.057691268622875214, 0.04381505772471428, 0.01086440496146679, 0.03973571956157684, 0.053345970809459686, 0.028285395354032516, 0.04015807434916496, -0.04248230159282684, -0.08792303502559662, 0.02063937857747078, -0.045277513563632965, -0.13103093206882477, -0.06551036983728409, -0.0025937024038285017, 0.07368896901607513, 0.01575949415564537, -0.0021356120705604553, 0.07354938983917236, -0.06060423702001572, -0.04210338369011879, 0.0213350560516119, -0.016195612028241158, 0.024706188589334488, -0.024092605337500572, -0.07012725621461868, 0.07788079231977463, -0.002161446027457714, -0.07526987046003342, -0.03337293118238449, -0.02141929790377617, 0.04453200474381447, -0.013112119399011135, -0.08334742486476898, 0.058411434292793274, -0.06954234093427658, 0.021006904542446136, 0.012139048427343369, -0.030009008944034576, 0.027563903480768204, 0.01561592984944582, -0.020005924627184868, 0.1095157042145729, 0.061673715710639954, -0.019837575033307076, -0.01406644657254219, 0.03232075646519661, -0.024947915226221085, -0.028643343597650528, -0.05632493272423744, 0.01293029822409153, 0.13830599188804626, -0.049819305539131165, 0.03925437107682228, -0.05931290611624718, 0.01209853496402502, 0.028424158692359924, 0.007175307255238295, -0.029813537374138832, -0.032066263258457184, -0.027092929929494858, -0.06316319108009338, 0.051824312657117844, 0.008084550499916077, -0.02935771830379963, 0.03797939419746399, -0.029284242540597916, -0.01887834444642067, 0.06990112364292145, -0.03682298958301544, -0.03325077146291733, -0.09828029572963715, -0.02451859973371029, -0.014094221405684948, -0.006986759603023529, 0.0450962632894516, 0.06865495443344116, 0.002571500139310956, -0.051928650587797165, -0.07948807626962662, 0.031114790588617325, -0.008746926672756672, 0.02333379164338112, -0.029466738924384117, 0.053562529385089874, -0.021916011348366737, 0.007197851315140724, -0.05167468637228012, 0.05271310731768608, -0.011558318510651588, 0.011965843848884106, 0.03808337450027466, 0.034744348376989365, 0.08238308876752853, -0.033908531069755554, -0.07515589892864227, 0.015433521009981632, 0.027397193014621735, 0.08269678056240082, 0.04585583508014679, -0.031732670962810516, -0.002644368913024664, 0.0688396617770195, 0.030983440577983856, 0.030252063646912575, 0.05742170661687851, -0.05286053195595741, 0.038671042770147324, -0.042814645916223526, -0.05872368812561035, 0.020309222862124443, -0.023304583504796028, 0.020704930648207664, 0.11763989180326462, -0.004259177017956972, 0.00871855765581131, -0.03864578157663345, -0.028716465458273888, 0.11193615198135376, 0.06620493531227112, -0.024591609835624695, 0.0901263952255249, 0.017828838899731636, 0.02454308606684208, -0.020841248333454132, 0.007812399882823229, -0.07935944199562073, -0.05750969052314758, -0.016765262931585312, 0.03279813751578331, -0.03399813920259476, -0.01383520383387804, -0.0668262243270874, -0.04450790956616402, -0.023822294548153877, 0.011831243522465229, -0.047466032207012177, -0.011974133551120758, 0.04249556362628937, 0.01748201623558998, 0.005326063837856054, 0.12165844440460205, -0.03451072424650192, -0.07805445790290833, -0.014524978585541248, 0.011155917309224606, 0.061667218804359436, 0.06231476739048958, -0.023020349442958832, 0.10122456401586533, -0.012950086034834385, -0.014832246117293835, -0.10292456299066544, 0.09131142497062683, 0.029529141262173653, -0.0006516669527627528, -0.031851876527071, -0.012004721909761429, -0.022727085277438164, 0.022521864622831345, -0.06488294154405594, 0.031707219779491425, 0.03365964815020561, 0.004806529264897108, 0.039119988679885864, -0.042637307196855545, -0.0015476365806534886, 0.0072664073668420315, 0.018853504210710526, -0.03968052193522453, 0.08479121327400208, -0.06148015335202217, 0.004810603801161051, -0.025454765185713768, -0.0018904244061559439, 0.06833003461360931, 0.03956947475671768, -0.04324536770582199, -0.02111055515706539, -0.007759386673569679, -0.00036509110941551626, -0.038608599454164505, -0.01588384434580803, -0.04581697657704353, 0.0020237118005752563, 0.017047535628080368, -0.03992645815014839, 0.010752023197710514, 0.03712191805243492, 0.03586801141500473, -0.008316567167639732, 0.044145457446575165, -0.044883474707603455, 0.01922372728586197, 0.050463899970054626, 0.030540654435753822, 0.030522359535098076, -0.0038100595120340586, -0.05446922779083252, -0.025603925809264183, -0.027739880606532097, 0.0027812898624688387, -0.026218662038445473, 0.029230963438749313, 0.011623070575296879, 0.0036957943812012672, 0.0028902716003358364, 0.0031751564238220453, -0.008007670752704144, 0.02276287041604519, -0.012468263506889343, -0.012664985843002796, 0.036630745977163315, -0.05155114084482193, -0.017039887607097626, -0.003125476883724332, -0.032813720405101776, 0.02489982172846794, 0.008164143189787865, -0.00030513739329762757, -0.006692439317703247, -0.01809740625321865, 0.003040831768885255, 0.021240204572677612, -0.0010530761210247874, 0.002622827887535095, 0.00976357888430357, 0.034820716828107834, 0.048922911286354065, -0.07963894307613373, -0.02454185299575329, 0.01436625700443983, 0.04343775659799576, -0.007017898838967085, -0.011719096451997757, 0.020079486072063446, -0.047171447426080704, 0.016345208510756493, -0.044892825186252594, -0.03394360467791557, -0.0001106134441215545, 0.041652705520391464, -0.006932064425200224, 0.010225789621472359, -0.016057921573519707, -0.01244674064218998, -0.0013625889550894499, 0.028919130563735962, -0.04254785552620888, -0.024514226242899895, 0.007819095626473427, 0.016926199197769165, 0.003101005917415023, -0.0382767952978611, -0.03235602006316185, 0.012895077466964722, 0.014776770025491714, 0.03245578333735466, -0.0029477181378751993, -0.018931426107883453, -0.026819569990038872, 0.01407046802341938, 0.02662942372262478, -0.030597584322094917, 0.00694738095626235, -0.026636436581611633, 0.05899665877223015, 0.029817700386047363, 0.02877410314977169, 0.008806565776467323, -0.021406976506114006, 0.026237020269036293, 0.027638666331768036, 0.059718262404203415, 0.009445578791201115, 0.004642889369279146, 0.004723142832517624, 0.05387265980243683, -0.002106419065967202, -0.004017976578325033, -0.027250662446022034, -0.0028511295095086098, -0.017490040510892868, 0.014471468515694141, -0.011988806538283825, -0.004667791072279215, -0.02873806282877922, -0.008724874816834927, 0.003122128779068589, -0.04799356684088707, 0.04684199020266533, -0.03447173163294792, -0.006384377833455801, 0.006033825688064098, 0.031423985958099365, 0.0205265823751688, 0.003549176501110196, 0.002335679018869996, 0.02059345319867134, 0.04362349212169647, 0.029435982927680016, 0.012440890073776245, -0.004245105665177107, -0.004170964006334543, 0.0227772556245327, 0.018121831119060516, -0.02822325937449932, 0.0789889320731163, 0.0099041061475873, -0.03105197101831436, -0.005768193863332272, -0.03217362239956856, -0.023458680137991905, -0.0075340475887060165, 0.0008756275055930018, -0.03844129294157028, -0.053940288722515106, 0.013101189397275448, 0.022568300366401672, -0.008593321777880192, -0.039426080882549286, -0.03645610436797142, -0.01912643387913704, 0.006457911338657141, 0.004584703594446182, 0.03156360983848572, -0.007479999680072069, -0.018362456932663918, -0.04523582383990288, 0.03298518434166908, -0.006738071795552969, 0.004662876017391682, 0.0005922639975324273, 0.01131091546267271, 0.07347419112920761, -0.04476916790008545, 0.01799035258591175, -0.001128537580370903, -0.01565920002758503, -0.02079658769071102, 0.051868584007024765, 0.01841844990849495, 0.03025261126458645, 0.05724868178367615, 0.01847142167389393, -0.002818585839122534, 0.005421147216111422, -0.06461533159017563, -0.005811143666505814, 0.02808026783168316, 0.007426196243613958, 0.010437112301588058, -0.003418543143197894, 0.03600165620446205, 0.02641136385500431, 0.025357764214277267, 0.030956752598285675, -0.022506432607769966, -0.054722536355257034, -0.04739359766244888, -0.06509275734424591, 0.05027514323592186, -0.023531321436166763, -0.019224656745791435, 0.04177987575531006, -0.03589870035648346, 0.013925925828516483, -0.032637398689985275, -0.033497847616672516, 0.01173864770680666, 0.043332215398550034, 0.03987522050738335, -0.007765999995172024, 0.06616407632827759, -0.011740987189114094, -0.00953271146863699, -0.0141449561342597, -0.056059062480926514, -0.04865482077002525, 0.0033938484266400337, 0.008575710467994213, -0.028110522776842117, 0.0025279223918914795, 0.05476387217640877, -0.011504985392093658, -0.010275004431605339, 0.025976505130529404, 0.017141617834568024, 0.0668850839138031, -0.018570082262158394, -0.006921546533703804, -0.055062633007764816, 0.042380861937999725, -0.011717087589204311, -0.030222460627555847, -0.007993411272764206, 0.025063075125217438, 0.006009713280946016, 0.0010993025498464704, -0.0036910728085786104, -0.0020286652725189924, -0.011654059402644634, 0.016659390181303024, 0.005952052306383848, -0.015695100650191307, -0.033343005925416946, -0.021682461723685265, -0.03142997995018959, 0.006020971108227968, -0.032646533101797104, -0.021747775375843048, -0.013491258025169373, 0.007425572257488966, 0.009908652864396572, 0.02646411955356598, 0.05511195957660675, 0.047489721328020096, 0.0047168731689453125, 0.013202042318880558, 0.005194294266402721, 0.012814455665647984, 0.03828869014978409, -0.003661645809188485, -0.017774900421500206, -0.034153956919908524, -0.022920124232769012, 0.021907290443778038, 0.022483985871076584, 0.04789763316512108, 0.01071631908416748, 0.06669638305902481, -0.041090432554483414, 0.0025384363252669573, 0.029204033315181732, -0.01722179539501667, -0.02735266461968422, -0.0714169442653656, 0.03727525472640991, 0.023688070476055145, 0.007269016467034817, 0.012916157953441143, 0.019352739676833153, 0.0002719123149290681, 0.033065006136894226, -0.05495932325720787, -0.01784580387175083, 0.045204613357782364, 0.04914853349328041, 0.05630115419626236, -0.015408490784466267, -0.04210289195179939, -0.02686271443963051, -0.018513411283493042, 0.02523893676698208, -0.04035473242402077, 0.01884891465306282, 0.00032457601628266275, 0.013996213674545288, -0.006965751759707928, 0.01119990088045597, -0.0007952678133733571, -0.018817031756043434, 0.03218740224838257, -0.031528376042842865, -0.016788767650723457, -0.00567775871604681, -0.03565008193254471, 0.02205227129161358, -0.037034206092357635, -0.007875001057982445, -0.014147026464343071, -0.02118029072880745, 0.01733892224729061, -0.02160969376564026, 0.03657816722989082, 0.04017183557152748, -0.004683856386691332, 0.003583134151995182, -0.02270999178290367, -0.025363612920045853, -0.02108175680041313, -0.008706275373697281, 0.027152840048074722, -0.04027393460273743, 0.02459658309817314, -0.02347419783473015, 0.037722084671258926, 0.04819931834936142, 0.0701056569814682, -0.014328411780297756, -0.01660315692424774, 0.028233695775270462, 0.05971613526344299, -0.038945991545915604, 0.024409517645835876, 0.022712836042046547, -0.0540442056953907, 0.021313805133104324, 0.007364828139543533, -0.03635489195585251, -0.027253640815615654, -0.002801393624395132, -0.010707363486289978, 0.022534608840942383, 0.010642451234161854, 0.046865805983543396, 0.04805637523531914, 0.051825519651174545, 0.019793782383203506, 0.015148469246923923, 0.013973802328109741, 0.03449685499072075, 0.017331715673208237, 0.0006346647860482335, 0.012105082161724567, 0.050668973475694656, -0.001179901766590774, -0.01874801144003868, 0.014086154289543629, -0.015255621634423733, 0.014512068592011929, -0.005989230237901211, -0.028104066848754883, -0.06454779952764511, 0.03249754011631012, 0.004614371806383133, -0.02121930569410324, 0.025473739951848984, -0.040233585983514786, 0.04853525757789612, 0.047631293535232544, 0.011806379072368145, -0.014819017611443996, 0.021761737763881683, -0.01049472950398922, -0.007939974777400494, -0.0020364471711218357, 0.0017278084997087717, -0.00273082940839231, -0.018216779455542564, 0.00782646331936121, -0.005093852058053017, 0.01206069253385067, -0.015985678881406784, -0.054807256907224655, 0.03279367461800575, -0.04618776589632034, 0.04858988896012306, -0.013391463086009026, 0.014915749430656433, -0.008719957433640957, 0.0067854151129722595, -0.0027830793987959623, -0.025215454399585724, 0.046177443116903305, -0.029343681409955025, -0.013152096420526505, -0.028438381850719452, -0.023344576358795166, 0.01266009546816349, 0.028847306966781616, 0.007107132580131292, -0.025082595646381378, -0.017457665875554085, -0.03185271471738815, 0.010196749120950699, 0.020976603031158447, -0.01961311139166355, -0.022991210222244263, -0.0463499054312706, -0.0012696891790255904, -0.05238901823759079, 0.0289967879652977, -0.00395816657692194, -0.008894534781575203, 0.03243597224354744, 0.07043538242578506, -0.015773160383105278, 0.06285715848207474, 0.01854804903268814, 0.015296818688511848, -0.03952135518193245, -0.02009785920381546, -0.012806611135601997, -0.04048975929617882, -0.0004507479025050998, -0.04600973054766655, -0.03850257024168968, 0.016486432403326035, 0.025018464773893356, 0.0580618754029274, 0.0896032527089119, -0.0271401796489954, -0.04944608360528946, 0.0032827146351337433, 0.0203096941113472, -0.011752487160265446, 0.01577349193394184, 0.014379024505615234, -0.03924812376499176, -0.01545932237058878, -0.005781843326985836, 0.015855804085731506, -0.026060694828629494, 0.029820160940289497, 0.040301792323589325, -0.010863046161830425, 0.006145657040178776, -0.0009916957933455706, 0.023494036868214607, 0.007378830574452877, 0.007112211547791958, 0.02810344099998474, 0.021668892353773117, 0.02840406820178032, -0.020100483670830727, 0.0019893574062734842, 0.01638566516339779, 0.02466500736773014, -0.016436951234936714, -0.029231378808617592, -0.034840986132621765, 0.035760995000600815, 0.010409234091639519, 0.046769626438617706, -0.04589749500155449, 0.011072305962443352, -0.06202346086502075, -0.004004906862974167, -0.035251371562480927, -0.002935579977929592, 0.055398132652044296, -0.017627090215682983, 0.010948137380182743, 0.02012123353779316, -0.01263020746409893, -0.05983775109052658, 0.003593161003664136, 0.019930768758058548, 0.06936521828174591, -0.028285732492804527, -0.014913393184542656, -0.024428073316812515, -0.014961098320782185, -0.007812866009771824, -0.07247405499219894, -0.004298381507396698, 0.02341512218117714, 0.023080935701727867, 0.028575066477060318, -0.02464873343706131, 0.018740614876151085, -0.017629889771342278, 0.021035777404904366, 0.006464085541665554, 0.0076306769624352455, 0.005791570991277695, 0.000419750896980986, -0.05603036284446716, -0.0014744619838893414, -0.026685142889618874, -0.01469395775347948, 0.06787138432264328, -0.005450138822197914, 0.013948993757367134, 0.010107560083270073, -0.023630214855074883, 0.03237532451748848, -0.025701919570565224, -0.06101156026124954, -0.003711607540026307, 0.023922448977828026, 0.016012759879231453, -0.012926696799695492, 0.007564266677945852, 0.06534624844789505, 0.03580771014094353, 0.02445366233587265, -0.037357162684202194, 0.0014187274500727654, 0.025211835280060768, 0.019848234951496124, 0.029770271852612495, -0.01527467928826809, 0.05476534366607666, 0.04217072203755379, 0.0052372971549630165, 0.015940379351377487, -0.0029297079890966415 ]
Deep Learning over the Internet: Training Language Models Collaboratively
mryab
July 15, 2021
collaborative-training
research
https://huggingface.co/blog/collaborative-training
Evaluation To evaluate the performance of sahajBERT, we finetuned it on two downstream tasks in Bengali: - Named entity recognition (NER) on the Bengali split of WikiANN. The goal of this task is to classify each token in the input text into one of the following categories: person, organization, location, or none of them. - News Category Classification (NCC) on the Soham articles dataset from IndicGLUE. The goal of this task is to predict the category to which belong the input text. We evaluated it during training on the NER task to check that everything was going well; as you can see on the following plot, this was indeed the case! Evaluation metrics of fine-tuned models on the NER task from different checkpoints of pre-trained models. At the end of training, we compared sahajBERT with three other pretrained language models: XLM-R Large, IndicBert, and bnRoBERTa. In the table below, you can see that our model has results comparable to the best Bengali language models available on HF Hub, even though our model has only ~18M trained parameters, while, for instance, XLM-R (a strong multilingual baseline), has ~559M parameters and was trained on several hundred V100 GPUs. | Model | NER F1 (mean ± std) | NCC Accuracy (mean ± std) | |:-------------:|:-------------:|:-------------:| |sahajBERT | 95.45 ± 0.53| 91.97 ± 0.47| |XLM-R-large | 96.48 ± 0.22| 90.05 ± 0.38| |IndicBert | 92.52 ± 0.45| 74.46 ± 1.91| |bnRoBERTa |82.32 ± 0.67|80.94 ± 0.45| These models are available on the Hub as well. You can test them directly by playing with the Hosted Inference API widget on their Model Cards or by loading them directly in your Python code.
[ -0.03349047899246216, -0.054210223257541656, -0.041808243840932846, -0.0009696445195004344, 0.04578861966729164, 0.07558418065309525, 0.03334609419107437, 0.08656667172908783, -0.08251892775297165, 0.032150134444236755, -0.06414604187011719, 0.021845795214176178, -0.03556215763092041, 0.030328089371323586, 0.01632428728044033, 0.013871231116354465, 0.06910485029220581, -0.029599258676171303, -0.030439557507634163, 0.0016603291733190417, -0.012085669673979282, -0.013816460967063904, 0.03535366803407669, 0.005700283218175173, 0.038824066519737244, -0.030186140909790993, 0.010602873750030994, -0.007039370480924845, -0.06732439994812012, -0.017522044479846954, -0.08110921084880829, -0.028341105207800865, -0.0026349325198680162, 0.015436774119734764, -0.09246212989091873, 0.0013343091122806072, -0.09352759271860123, 0.058266885578632355, -0.018758313730359077, -0.07426711916923523, 0.029019741341471672, -0.0020398064516484737, -0.021321721374988556, 0.07540606707334518, 0.05695393308997154, -0.0140471076592803, -0.06050598993897438, 0.04145585373044014, 0.012070786207914352, -0.011680064722895622, -0.007028702646493912, 0.057392168790102005, -0.017702212557196617, -0.02455219253897667, 0.02751615084707737, -0.024633456021547318, -0.03140363469719887, -0.01012460608035326, 0.027458857744932175, 0.07327397167682648, 0.05432784929871559, -0.0589403435587883, -0.059798844158649445, -0.036114390939474106, -0.02038854919373989, 0.016414258629083633, -0.0222494937479496, 0.03631791099905968, -0.021277036517858505, 0.025780821219086647, 0.025979863479733467, 0.008310537785291672, -0.025591714307665825, 0.04146584868431091, -0.017769543454051018, -0.07081091403961182, 0.0005094719817861915, -0.0015850441996008158, -0.03455648571252823, -0.042026109993457794, -0.05182969942688942, 0.04834791272878647, 0.041856855154037476, 0.03889119625091553, 0.044085871428251266, 0.04155372828245163, 0.03789794072508812, -0.058199960738420486, -0.03536152467131615, 0.001332330284640193, -0.02334556356072426, -0.05031348019838333, 0.007073969580233097, 0.041865892708301544, 0.013699986971914768, -0.05629214644432068, 0.0830124169588089, 0.01692451722919941, -0.0032024485990405083, -0.055610764771699905, 0.031245635822415352, -0.030486207455396652, 0.06454553455114365, -0.03346879035234451, -0.009284425526857376, 0.06321877241134644, -0.0977102592587471, -0.047574982047080994, -0.07996353507041931, 0.034858543425798416, 0.0526631623506546, 0.009967743419110775, -0.045826416462659836, 0.10766209661960602, -0.05409123748540878, -0.02594088390469551, 0.045789849013090134, 0.040593478828668594, -0.007228809408843517, -0.004669645801186562, 0.018101651221513748, 0.05545194819569588, 0.05893811210989952, 0.04112958535552025, 0.026762250810861588, 0.003194028278812766, 0.014136438257992268, 0.07519468665122986, -0.037120603024959564, 0.010558965615928173, 0.040192004293203354, -0.037674594670534134, 0.04581335559487343, -0.009421120397746563, -0.005537020042538643, -0.05551226809620857, -0.06354337185621262, -0.0018296563066542149, 0.0009919859003275633, 0.021563539281487465, -0.10753898322582245, 0.0450950488448143, -0.058028578758239746, 0.03137774020433426, 0.04900806024670601, 0.02723436802625656, -0.012743612751364708, 0.062133900821208954, 0.060146842151880264, -0.05077268183231354, -0.07917570322751999, 0.08265799283981323, -0.07142685353755951, -0.06140250712633133, 0.02126745879650116, 0.056738439947366714, 0.01962956041097641, 0.03612178936600685, -0.04225404933094978, 0.02693978138267994, -0.049812160432338715, 0.02596626803278923, -0.05304360389709473, -0.07926139235496521, -0.07970142364501953, 0.027635151520371437, 0.06039268523454666, -0.04498874768614769, -0.019819652661681175, 0.003882358083501458, 0.04946957156062126, -0.03090609423816204, 0.09994562715291977, -0.04993051290512085, -0.03611734136939049, 0.018971029669046402, 0.004796617664396763, -0.0064097619615495205, -0.04755665734410286, 0.029687512665987015, -0.06164364516735077, 0.07372011244297028, 0.010522712953388691, -0.0016342056915163994, 0.02575976774096489, -0.04949943721294403, 0.02152629755437374, -0.007714657578617334, -0.02065044268965721, 0.030333280563354492, -0.02527756243944168, 0.029901815578341484, 0.07823609560728073, 0.0014467730652540922, 0.015852918848395348, -0.03289181739091873, 0.051668066531419754, 0.13170801103115082, 0.06133732572197914, -0.0029001240618526936, 0.07580854743719101, 0.03151419013738632, 0.012512965127825737, -0.040381014347076416, 0.03058324195444584, 0.00021535971609409899, -0.017778271809220314, 0.005298831034451723, 0.012323862873017788, 0.07032383978366852, 0.04169445112347603, -0.06237797811627388, 0.06601296365261078, -0.06920545548200607, 0.013909410685300827, -0.024861911311745644, 0.02501884661614895, 0.07838664203882217, 0.006619601976126432, -0.035028327256441116, 0.1549350768327713, -0.05210709571838379, -0.014780919067561626, 0.042664796113967896, -0.04975413531064987, 0.07798946648836136, 0.05107052996754646, 0.028928156942129135, 0.07475876808166504, -0.02106478624045849, 0.024427611380815506, 0.03266233205795288, 0.015078569762408733, 0.03598926588892937, -0.10605961084365845, -0.06833713501691818, 0.025165226310491562, 0.008612524718046188, -0.0025741541758179665, 0.004914564546197653, -0.042101580649614334, 0.04279256984591484, -0.07617083191871643, 0.044733352959156036, -0.013364452868700027, 0.041204020380973816, 0.060153473168611526, -0.0026879101060330868, -0.04434097558259964, 0.044979847967624664, -0.03424513339996338, 0.044106245040893555, -0.012404397130012512, -0.03406859561800957, 0.054301660507917404, -0.06559149920940399, 0.013004349544644356, -0.023376340046525, -0.056862298399209976, 0.028482889756560326, -0.03581302985548973, 0.00627583172172308, -0.03861764818429947, -0.03614473715424538, 0.035792455077171326, -0.07254680246114731, 0.03290451690554619, 0.019068365916609764, 0.02651386708021164, 0.009843431413173676, -0.018325133249163628, 0.02576601319015026, 0.008875340223312378, 0.016946855932474136, 0.02797572873532772, 0.09968321025371552, 0.024621596559882164, -0.04257608950138092, -0.01705235429108143, -0.042845286428928375, -0.025346647948026657, -0.060687579214572906, 0.034355081617832184, -0.00917581096291542, 0.02853945642709732, -0.004235639236867428, -0.029800694435834885, -0.014114745892584324, 0.038429610431194305, 0.011099030263721943, 0.01196358259767294, 0.051154520362615585, -0.042967282235622406, -0.03848255053162575, 0.04745658114552498, 0.00061130675021559, -0.006147936452180147, -0.010402850806713104, -0.015798918902873993, -0.017372528091073036, -0.024311572313308716, 0.021185504272580147, -0.010945910587906837, -0.02023046836256981, -0.023316457867622375, 0.018756411969661713, -0.01979062147438526, -0.025184761732816696, -0.07382788509130478, 0.011405495926737785, 0.03205493092536926, -0.0056026047095656395, -0.03735796734690666, 0.03655199706554413, 0.024875693023204803, 0.04355574771761894, -0.027151964604854584, 0.022336797788739204, -0.011000431142747402, -0.026925260201096535, 0.0035761171020567417, -0.042934924364089966, 0.009673072025179863, 0.02491401694715023, -0.018948577344417572, -0.028280772268772125, 0.05343005061149597, 0.010829544626176357, -0.06324869394302368, 0.03731729835271835, -0.0664140060544014, -0.00479389913380146, -0.047566305845975876, -0.007444471586495638, -0.013129265047609806, -0.0038982760161161423, -0.021711908280849457, -0.038506120443344116, -0.02753087319433689, -0.004509735852479935, -0.010981333442032337, 0.035506248474121094, -0.010964873246848583, -0.022128116339445114, -0.04171287268400192, 0.03905488923192024, 0.02077743597328663, 0.06685104221105576, 0.002054631244391203, 0.01983911544084549, 0.01949325203895569, -0.010997728444635868, 0.03253168240189552, -0.04887276515364647, -0.009928490035235882, 0.0014534760266542435, 0.033263176679611206, -0.04264986515045166, -0.03415234759449959, -0.04123992845416069, -0.019809391349554062, 0.09688498079776764, -0.01669897697865963, -0.02181919477880001, 0.024934135377407074, -0.024954207241535187, 0.019969744607806206, -0.045646436512470245, -0.032649215310811996, 0.06310810893774033, -0.008814369328320026, 0.004293914884328842, -0.016205735504627228, 0.016999494284391403, 0.0025055997539311647, 0.004983318503946066, -0.016575351357460022, 0.001211254857480526, 0.010533906519412994, 0.08666037023067474, 0.014105508103966713, -0.0030831205658614635, -0.003316715359687805, -0.010306941345334053, -0.004961762111634016, 0.025720663368701935, -0.002298123436048627, 0.01634141430258751, -0.03743864595890045, -0.02444446086883545, -0.016208317130804062, 0.009971382096409798, -0.012196745723485947, 0.015766974538564682, 0.03606465086340904, -0.06141650304198265, 0.01327039860188961, -0.001666399766691029, 0.036621108651161194, 0.0292156171053648, -0.03004688397049904, 0.05282348394393921, -0.012270725332200527, -0.014721039682626724, 0.01836291514337063, 0.007535579614341259, -0.020913857966661453, -0.034969206899404526, 0.02573658898472786, -0.06879784911870956, 0.015532178804278374, 0.001310824416577816, 0.0418715663254261, 0.04105808585882187, -0.03783249855041504, -0.006711029913276434, 0.02174101024866104, -0.014620457775890827, 0.007045589853078127, 0.010309501551091671, 0.007240488659590483, 0.03592029958963394, 0.029913505539298058, 0.027510013431310654, 0.007225591689348221, -0.01748860999941826, -0.005703475326299667, -0.000016651641999487765, -0.005984798539429903, 0.006965229753404856, -0.005933011416345835, -0.0013099595671519637, -0.0037995907478034496, -0.01830356754362583, -0.022700224071741104, 0.021679967641830444, 0.034150294959545135, -0.018809150904417038, -0.03919278085231781, 0.017399102449417114, 0.001673166174441576, -0.04584769904613495, 0.002739238552749157, 0.007219241000711918, 0.00923106074333191, -0.00630430830642581, -0.006257782690227032, -0.017550453543663025, 0.01665593311190605, 0.010628261603415012, -0.00643135467544198, 0.008766301907598972, 0.01650213450193405, -0.09418021887540817, 0.013818849809467793, -0.036365289241075516, 0.009325102902948856, 0.04282906651496887, -0.013824472203850746, -0.003203062107786536, -0.03947377949953079, 0.050969336181879044, -0.018800774589180946, -0.020021352916955948, 0.01523754745721817, 0.041794855147600174, -0.0065728300251066685, 0.06100849062204361, 0.022658400237560272, -0.024728810414671898, -0.02755744382739067, 0.006749875843524933, 0.020496482029557228, -0.024027131497859955, 0.011680655181407928, -0.016047995537519455, -0.001581060467287898, -0.044983867555856705, -0.03617370128631592, -0.007353807333856821, -0.009876769967377186, -0.04244751110672951, 0.008077345788478851, -0.03680241480469704, -0.00861471239477396, -0.007126099430024624, 0.0029267959762364626, -0.001009521191008389, -0.04915740340948105, -0.06900519132614136, 0.010490859858691692, -0.0025345797184854746, 0.037889204919338226, 0.022404979914426804, 0.04827046021819115, 0.010080830194056034, -0.0069035314954817295, -0.02583198808133602, 0.014387305825948715, -0.013676371425390244, 0.02139681950211525, -0.03747384622693062, -0.0038476656191051006, -0.025584030896425247, 0.006028349511325359, 0.011746847070753574, -0.018041353672742844, -0.02022469788789749, 0.01881883479654789, 0.016828685998916626, -0.023961037397384644, 0.018972309306263924, -0.021927082911133766, 0.016008462756872177, -0.0417306050658226, -0.06184932962059975, -0.021395394578576088, -0.05543993040919304, 0.021770387887954712, 0.039611589163541794, -0.01684393920004368, -0.003585539758205414, 0.027434328570961952, -0.04401342570781708, 0.007112201768904924, 0.03181285411119461, 0.0019325017929077148, 0.03966689854860306, -0.04955022409558296, -0.002517273183912039, -0.000472417043056339, -0.00891131442040205, 0.009422825649380684, -0.049428947269916534, 0.026740917935967445, -0.030498860403895378, 0.010570243000984192, 0.07544881850481033, 0.004451017826795578, -0.03263142332434654, 0.031332071870565414, 0.00515976594761014, -0.028456730768084526, -0.02456563152372837, 0.018772004172205925, -0.012966275215148926, 0.03564359247684479, 0.008761645294725895, 0.01875314489006996, -0.018445467576384544, 0.014314115978777409, -0.021979516372084618, -0.03704535961151123, 0.06324924528598785, 0.016843372955918312, 0.004223238676786423, 0.049323052167892456, 0.005619427654892206, 0.044624462723731995, 0.010209637694060802, -0.021587129682302475, 0.03298620507121086, 0.003671244950965047, 0.03368203341960907, 0.02825021743774414, 0.001526076695881784, -0.00017651535745244473, -0.014130586758255959, -0.006457233335822821, -0.06759288161993027, -0.011280017904937267, 0.0505182184278965, 0.0066139670088887215, -0.00661451555788517, 0.0242791548371315, -0.08042731881141663, 0.006165513768792152, 0.013951918110251427, -0.015427302569150925, -0.020167751237750053, -0.03418055549263954, -0.030019579455256462, -0.035260461270809174, -0.0012846214231103659, -0.013904104940593243, 0.04348127171397209, 0.023880809545516968, -0.014832315035164356, 0.03333586826920509, 0.014023849740624428, 0.05396498739719391, 0.021173350512981415, 0.04054168239235878, -0.001956083346158266, 0.03897085040807724, -0.020853864029049873, 0.009001332335174084, 0.018962930887937546, 0.030655546113848686, 0.028106262907385826, -0.005637848284095526, -0.004557807929813862, 0.006017239298671484, 0.010246450081467628, 0.06435423344373703, 0.028740160167217255, -0.012378189712762833, -0.03332813084125519, 0.028057295829057693, 0.014459147118031979, 0.03556767851114273, -0.015787947922945023, -0.011377873830497265, 0.01493090856820345, 0.002809756202623248, 0.023234346881508827, 0.014918655157089233, -0.01985681988298893, -0.037166528403759, 0.014237971976399422, -0.015292585827410221, 0.02170114777982235, -0.029019786044955254, -0.02327313832938671, -0.015778042376041412, -0.045892320573329926, -0.014926767908036709, 0.02115911990404129, 0.009250078350305557, 0.01039174571633339, 0.018281640484929085, 0.002466098638251424, -0.0040574148297309875, -0.011085635051131248, -0.0028218936640769243, -0.025017300620675087, -0.023581385612487793, -0.02538760006427765, 0.01749076507985592, 0.033351778984069824, -0.04501047357916832, -0.05706516653299332, -0.021215131506323814, 0.0070150732062757015, 0.008039106614887714, 0.030991800129413605, -0.002159726805984974, -0.0348738431930542, -0.03194767236709595, 0.006312121637165546, -0.03144986182451248, 0.0229005366563797, -0.010297123342752457, -0.013725905679166317, 0.009975684806704521, -0.03590644523501396, -0.015661446377635002, 0.02947959303855896, 0.0009510343079455197, 0.024100251495838165, -0.02676466293632984, 0.02320903167128563, 0.001230740686878562, -0.046064551919698715, -0.0006335116922855377, 0.031741708517074585, 0.01479255873709917, 0.021174905821681023, 0.031100813299417496, 0.05381132289767265, 0.06313417106866837, -0.002637919271364808, -0.0007253006333485246, -0.009706267155706882, 0.015616564080119133, -0.011839420534670353, 0.0033930703066289425, 0.017168132588267326, 0.0015949065564200282, -0.01985553279519081, -0.042248062789440155, -0.007747776340693235, -0.025337228551506996, -0.00745213869959116, 0.027619078755378723, 0.015381497330963612, -0.0008338658371940255, -0.024889342486858368, 0.01680176891386509, 0.00726066529750824, 0.04711751639842987, 0.004011227283626795, -0.030858613550662994, 0.027536096051335335, -0.023283349350094795, 0.02091882936656475, -0.03845492750406265, 0.03492582589387894, -0.03893991559743881, -0.05460861697793007, -0.03006628341972828, 0.05388592183589935, -0.02440781332552433, -0.027162116020917892, -0.036782216280698776, -0.019605861976742744, -0.045475784689188004, 0.009500744752585888, -0.032336313277482986, -0.012445790693163872, 0.053945403546094894, 0.03394242748618126, 0.01693052425980568, -0.007274023722857237, 0.001798845361918211, 0.05330200120806694, -0.024514397606253624, 0.010691169649362564, 0.04401114955544472, 0.022665241733193398, -0.016574878245592117, -0.015211505815386772, 0.013259271159768105, -0.018878450617194176, -0.040972962975502014, -0.03022952377796173, 0.05300828441977501, 0.047919150441884995, 0.010136260651051998, 0.009476040489971638, 0.04840010404586792, 0.015261586755514145, 0.02062097191810608, 0.014247078448534012, -0.002293770667165518, -0.002588819246739149, -0.01895461417734623, -0.05640969052910805, 0.029855338856577873, -0.004268714226782322, -0.02571638859808445, 0.0386732816696167, -0.006574057042598724, 0.03252178803086281, 0.011989440768957138, -0.03712974488735199, -0.007509951945394278, -0.005327644757926464, -0.010308426804840565, -0.06407914310693741, 0.05155182629823685, -0.0026218965649604797, -0.030642589554190636, -0.022870194166898727, 0.04805264249444008, 0.04472292959690094, -0.011012033559381962, -0.015707220882177353, -0.013767151162028313, 0.02200690470635891, 0.03146767616271973, 0.017223889008164406, 0.02520960569381714, 0.07952187210321426, 0.013497492298483849, 0.013745354488492012, 0.001771607669070363, -0.013177107088267803 ]
Deep Learning over the Internet: Training Language Models Collaboratively
mryab
July 15, 2021
collaborative-training
research
https://huggingface.co/blog/collaborative-training
Collaborative event The sahajBERT collaborative training event took place from May 12 to May 21. The event brought together 40 participants, 30 of whom were Bengali-speaking volunteers, and 10 were volunteers from one of the authors' organizations. These 40 volunteers joined the Neuropark Discord channel to receive all information regarding the event and participate in discussions. To join the experiment, volunteers were asked to: 1. Send their username to the moderators to be allowlisted; 2. Open the provided notebook locally, on Google Colaboratory, or on Kaggle; 3. Run one code cell and fill in their Hugging Face credentials when requested; 4. Watch the training loss decrease on the shared dashboards! For security purposes, we set up an authorization system so that only members of the Neuropark community could train the model. Sparing you the technical details, our authorization protocol allows us to guarantee that every participant is in the allowlist and to acknowledge the individual contribution of each peer. In the following figure, you can see the activity of each volunteer. Over the experiment, the volunteers logged in 600 different sessions. Participants regularly launched multiple runs in parallel, and many of them spread out the runs they launched over time. The runs of individual participants lasted 4 hours on average, and the maximum length was 21 hours. You can read more about the participation statistics in the paper. Chart showing participants of the sahajBERT experiment. Circle radius is relative to the total number of processed batches, the circle is greyed if the participant is not active. Every purple square represents an active device, darker color corresponds to higher performance Along with the resources provided by participants, we also used 16 preemptible (cheap but frequently interrupted) single-GPU T4 cloud instances to ensure the stability of the run. The cumulative runtime for the experiment was 234 days, and in the figure below you can see parts of the loss curve that each peer contributed to! The final model was uploaded to the Model Hub, so you can download and play with it if you want to: https://hf.co/neuropark/sahajBERT
[ -0.06754577904939651, -0.029339736327528954, 0.018915798515081406, 0.019838625565171242, 0.00901099480688572, -0.008750182576477528, 0.03118366003036499, 0.029523171484470367, -0.06190621107816696, -0.054862894117832184, -0.05065403878688812, 0.01123818289488554, -0.005882570520043373, 0.07601043581962585, -0.09198714047670364, 0.006816786713898182, 0.04787889122962952, -0.07096417993307114, 0.016701528802514076, 0.047167204320430756, -0.00704356050118804, -0.002615025732666254, -0.013141712173819542, 0.03844751790165901, 0.05174988508224487, -0.036178845912218094, 0.029574481770396233, -0.005054493434727192, 0.030537541955709457, 0.011874216608703136, -0.043862633407115936, -0.013299520127475262, 0.08587328344583511, -0.008577446453273296, 0.024278389289975166, 0.016895007342100143, -0.1304628998041153, 0.04892858862876892, 0.07452695816755295, -0.0261198990046978, 0.002601422369480133, -0.01830759458243847, -0.04538562893867493, 0.07087375223636627, 0.0124626774340868, -0.012136547826230526, -0.02634761855006218, 0.037659358233213425, -0.006216842215508223, 0.00003751166150323115, -0.05563990771770477, 0.07037073373794556, 0.010570158250629902, -0.03191516548395157, -0.019470883533358574, -0.0021458854898810387, -0.004263813141733408, -0.011144584976136684, -0.00728678097948432, -0.007225715089589357, 0.07024626433849335, -0.10458260029554367, 0.037756722420454025, 0.032678861171007156, 0.03160390257835388, 0.052422698587179184, 0.05179523304104805, 0.03410845622420311, -0.005680760834366083, -0.03968236595392227, 0.026947859674692154, 0.04800019785761833, -0.026841051876544952, 0.002010791562497616, -0.010036920197308064, -0.03692339360713959, 0.035433463752269745, 0.011880151927471161, 0.03475039079785347, 0.010854622349143028, -0.021626006811857224, 0.03448425233364105, 0.0750831738114357, 0.024371011182665825, -0.03200050815939903, 0.030531391501426697, 0.006026481743901968, -0.065286785364151, -0.039886679500341415, 0.023083539679646492, -0.020286543294787407, -0.013890635222196579, 0.017726989462971687, 0.03918332979083061, 0.01916433684527874, 0.020494572818279266, 0.03683467581868172, -0.040316853672266006, -0.022181201726198196, -0.07959353178739548, -0.016348686069250107, -0.0202473197132349, -0.00898428913205862, -0.026845719665288925, -0.027834774926304817, 0.04418710246682167, -0.1169457957148552, -0.06869236379861832, -0.02440711110830307, 0.022772779688239098, 0.051550913602113724, 0.026802020147442818, -0.00616173492744565, 0.057971738278865814, -0.10072185844182968, 0.0868440791964531, 0.022578736767172813, 0.038803841918706894, 0.024306001141667366, 0.011737588793039322, 0.006589244119822979, 0.014364623464643955, -0.00904014240950346, 0.03314471244812012, -0.0007632409106008708, 0.0496518537402153, -0.03788251429796219, 0.01586941070854664, -0.011599594727158546, -0.009741121903061867, 0.018758084625005722, -0.0990786924958229, 0.02520720846951008, -0.05036403238773346, -0.002690092893317342, -0.06555910408496857, 0.007690653670579195, -0.06918032467365265, -0.017426015809178352, 0.12104761600494385, -0.0345691554248333, 0.06743177026510239, -0.03161688148975372, 0.05109693109989166, 0.04538106545805931, 0.027362678200006485, -0.07455924898386002, 0.019610051065683365, 0.006645150948315859, -0.029862180352211, -0.06875807046890259, 0.0827399492263794, -0.020641090348362923, -0.05687900632619858, 0.0389670766890049, 0.07738690078258514, -0.04229143634438515, -0.00393100967630744, -0.0029015494510531425, -0.02597072906792164, 0.05117851495742798, -0.03210367634892464, -0.08226285129785538, -0.023192722350358963, -0.03378347307443619, 0.0886371061205864, -0.028502918779850006, -0.0624387264251709, -0.003871353343129158, -0.01372445560991764, 0.046396493911743164, 0.005725753027945757, 0.057491857558488846, 0.0024844922591000795, -0.05574028566479683, 0.07110566645860672, 0.02152337320148945, 0.018325557932257652, 0.0020837963093072176, 0.026296237483620644, -0.09010694175958633, 0.0559699572622776, 0.03495650365948677, -0.023064667358994484, 0.07397585362195969, -0.0995643213391304, 0.08775140345096588, 0.03067147359251976, 0.05314687639474869, 0.041148629039525986, -0.012221472337841988, 0.043020591139793396, 0.027311313897371292, -0.028524793684482574, 0.05749882757663727, -0.07992338389158249, 0.007363127078860998, 0.047163378447294235, 0.03885994106531143, 0.05801518261432648, 0.0073612770065665245, -0.014974758960306644, 0.044084858149290085, 0.014085429720580578, 0.023594537749886513, 0.04644256457686424, -0.01973133161664009, -0.02227567695081234, 0.0081410463899374, -0.02813100628554821, -0.04953008145093918, -0.08334137499332428, 0.04403361678123474, -0.00566823361441493, 0.08835702389478683, 0.047884028404951096, 0.01889125443994999, 0.05104116350412369, -0.010238425806164742, 0.008931497111916542, 0.16183733940124512, -0.05891487002372742, -0.013714756816625595, 0.06186818331480026, -0.018530160188674927, 0.027169007807970047, -0.02114063873887062, 0.09352798759937286, 0.12860621511936188, -0.009575066156685352, -0.0013016657903790474, -0.02760009653866291, -0.018774472177028656, 0.03177722543478012, 0.004059663042426109, -0.042252067476511, 0.06809919327497482, 0.000971766363363713, 0.010426787659525871, 0.0035869127605110407, -0.015288623049855232, 0.04873839393258095, -0.04643281176686287, 0.02764737419784069, -0.017278829589486122, 0.02725732885301113, 0.07640936225652695, 0.0423729345202446, -0.03477725014090538, 0.014956345781683922, -0.02883603610098362, 0.006231885403394699, -0.12065958231687546, 0.019152633845806122, 0.07250573486089706, 0.007121201604604721, 0.07638361304998398, -0.03045452944934368, -0.051560841500759125, 0.04762982577085495, 0.016722863540053368, 0.017535146325826645, -0.01856466569006443, -0.002912761177867651, -0.004285411909222603, -0.0421774685382843, 0.07804390043020248, 0.04702920466661453, 0.017549481242895126, -0.023475171998143196, 0.010648353025317192, 0.013472582213580608, 0.02259085513651371, 0.02784424088895321, 0.042029619216918945, 0.014799237251281738, 0.03931400179862976, -0.07309717684984207, 0.038517992943525314, -0.0365428626537323, -0.004531914833933115, -0.048131972551345825, 0.03184471279382706, 0.030078891664743423, 0.03618808835744858, 0.026264464482665062, -0.037455182522535324, -0.0012545218924060464, -0.0403815396130085, 0.021653447300195694, 0.014066362753510475, 0.036475975066423416, 0.017287161201238632, -0.02571280300617218, 0.04218531399965286, 0.014373566955327988, -0.007143424823880196, 0.01602521352469921, -0.015996064990758896, 0.010057156905531883, -0.011059037409722805, -0.03343437239527702, -0.03219842165708542, -0.0009563065832480788, -0.003962646704167128, -0.017428487539291382, -0.024280158802866936, -0.04131491854786873, -0.07875820994377136, 0.008012563921511173, 0.02000890113413334, 0.023262806236743927, -0.0763869434595108, 0.04020851105451584, 0.0707327127456665, 0.02604054845869541, -0.009416602551937103, 0.03204690292477608, -0.053185634315013885, -0.030787942931056023, 0.015547795221209526, -0.011186632327735424, -0.004539065528661013, -0.009814070537686348, 0.016242116689682007, -0.005753830540925264, 0.06069502979516983, 0.08038854598999023, -0.061864905059337616, 0.03805273771286011, 0.003688531694933772, -0.032876256853342056, 0.017266040667891502, 0.041674964129924774, 0.02993096597492695, -0.01584888994693756, 0.0058252522721886635, -0.009612624533474445, -0.029269855469465256, -0.013138883747160435, -0.017272824421525, 0.018851885572075844, -0.01479912456125021, -0.006161547731608152, -0.02590382844209671, -0.030450614169239998, 0.015827370807528496, -0.002210874343290925, 0.021665534004569054, 0.04708878695964813, 0.026769859716296196, -0.01886686310172081, 0.0000026325471935706446, 0.015018558129668236, -0.010844091884791851, 0.02586928941309452, 0.04587584361433983, -0.06331399828195572, 0.019541945308446884, -0.02767038159072399, 0.016831254586577415, 0.045676980167627335, -0.005083329975605011, 0.011682256124913692, 0.004233229905366898, 0.0026643516030162573, 0.02415529079735279, -0.058855198323726654, -0.035602618008852005, 0.032211676239967346, -0.0028738577384501696, -0.04891252890229225, 0.015168409794569016, 0.005132277496159077, -0.000343664811225608, -0.019204115495085716, -0.04306729882955551, -0.00345502607524395, 0.012099293991923332, 0.04813556373119354, -0.02815830521285534, -0.007256626151502132, -0.030384378507733345, 0.007648400496691465, -0.005924412049353123, -0.03190186992287636, 0.003511496353894472, 0.028435200452804565, -0.026193788275122643, 0.014106039889156818, -0.031779564917087555, -0.010920875705778599, 0.04062517359852791, 0.029452189803123474, 0.039557624608278275, -0.03646450862288475, 0.04652131348848343, -0.004101966507732868, 0.027111761271953583, 0.02730712480843067, -0.005760333966463804, -0.00500078359618783, 0.02381407655775547, -0.016366146504878998, 0.006708360742777586, 0.022266803309321404, -0.020263759419322014, -0.03933149576187134, -0.03237057849764824, -0.027422862127423286, 0.015146302990615368, 0.004737919196486473, -0.03509736433625221, 0.05754388868808746, -0.04123998060822487, -0.007796367630362511, 0.02468699775636196, 0.0008786645485088229, 0.020266061648726463, 0.003252135356888175, 0.046736788004636765, 0.015213165432214737, 0.047320879995822906, 0.050768204033374786, -0.014968949370086193, -0.019314348697662354, -0.07188018411397934, 0.013332441449165344, -0.023209840059280396, -0.04033460468053818, 0.0038972122129052877, -0.006651797331869602, -0.004526968579739332, 0.02263881079852581, -0.011792686767876148, -0.010503139346837997, 0.005031083710491657, -0.01632240228354931, -0.09295374155044556, 0.01375219039618969, -0.001711466582491994, -0.004342901520431042, -0.0011159658897668123, -0.028761964291334152, -0.0053858389146625996, -0.001316620851866901, -0.011579788289964199, -0.0291029941290617, 0.010847353376448154, -0.0008427103748545051, 0.03826621174812317, -0.013482443988323212, -0.03327373042702675, -0.01590154320001602, 0.003318697214126587, -0.03577529266476631, -0.02489793673157692, 0.010984541848301888, 0.015327081084251404, -0.021050019189715385, -0.053452879190444946, 0.043564438819885254, -0.018308116123080254, -0.024124229326844215, 0.0021487262565642595, 0.01814393140375614, 0.01795673556625843, 0.052846621721982956, -0.011350389569997787, -0.027922961860895157, -0.043714739382267, 0.0072290305979549885, -0.0004815021238755435, 0.029675882309675217, 0.013759387657046318, -0.01845332607626915, 0.024994168430566788, -0.02592495270073414, -0.05117688328027725, -0.031507182866334915, -0.011478305794298649, -0.00026740276371128857, 0.051064517349004745, -0.010660732164978981, 0.002983484882861376, 0.030551327392458916, -0.018880106508731842, 0.059100791811943054, -0.05334287881851196, 0.017582520842552185, 0.010629342868924141, -0.02409365586936474, 0.04920009896159172, 0.030055444687604904, 0.015209409408271313, 0.03077000565826893, 0.03711747005581856, -0.016172345727682114, 0.011939011514186859, -0.03619597852230072, 0.005671995226293802, -0.056567151099443436, -0.027006683871150017, -0.04527849704027176, -0.00985907856374979, 0.023273883387446404, 0.016627248376607895, -0.0391714982688427, 0.03178631141781807, 0.03773218020796776, -0.05371502786874771, 0.020731087774038315, 0.03122740052640438, 0.03343479335308075, -0.021045982837677002, -0.050789810717105865, 0.030551154166460037, -0.027649959549307823, 0.04561052471399307, 0.00753437913954258, -0.014077883213758469, -0.05482468754053116, 0.012260771356523037, -0.03697057440876961, -0.012476892210543156, 0.0027027095202356577, -0.010860136710107327, 0.07150451093912125, -0.034396011382341385, 0.008752686902880669, -0.009057004936039448, -0.07981549203395844, -0.03395304083824158, -0.03485572338104248, 0.011046352796256542, 0.052012331783771515, -0.004793781787157059, 0.001391225727275014, 0.01627200096845627, 0.008242053911089897, -0.007678631227463484, 0.009825373068451881, -0.029264498502016068, 0.014175521209836006, 0.0160980261862278, 0.0027070818468928337, -0.004914012737572193, 0.034840624779462814, 0.0023000563960522413, -0.043593067675828934, 0.002425659680739045, -0.05721691995859146, -0.01170840859413147, 0.0200935248285532, 0.024390757083892822, -0.025873402133584023, 0.03688791021704674, 0.0042466698214411736, 0.03270934894680977, 0.027831999585032463, -0.02355245128273964, 0.0043988656252622604, 0.017390316352248192, 0.021776337176561356, 0.0026185631286352873, 0.015093183144927025, -0.005373605992645025, -0.03252726420760155, 0.016521045938134193, -0.056473635137081146, -0.014566577970981598, 0.02890593744814396, -0.012077289633452892, 0.0073674763552844524, 0.048220712691545486, -0.027255378663539886, 0.02367536351084709, 0.01282176561653614, 0.046405449509620667, -0.024926932528614998, -0.056721873581409454, -0.03479350358247757, -0.04553467035293579, -0.037387553602457047, 0.024300960823893547, 0.03933338820934296, -0.011137382127344608, -0.002612384734675288, 0.02449967712163925, 0.03369507938623428, -0.03701815381646156, 0.03987094759941101, 0.0020560934208333492, 0.021780120208859444, 0.026385454460978508, 0.02362336590886116, -0.00836148764938116, 0.008827472105622292, -0.004916267469525337, -0.02215956710278988, 0.024528788402676582, -0.008046952076256275, -0.04103503376245499, -0.005779069848358631, 0.0414627380669117, 0.046820513904094696, 0.01782676763832569, -0.007236595265567303, -0.0000694508635206148, 0.050734199583530426, 0.05291520059108734, -0.014659373089671135, 0.011833921074867249, 0.02772512659430504, 0.015518464148044586, 0.042509809136390686, 0.02071438357234001, -0.02180783823132515, -0.007763010915368795, -0.020772282034158707, 0.005460906308144331, 0.01429479569196701, -0.02528388239443302, -0.03513801097869873, -0.022025708109140396, -0.01731986179947853, -0.0249419417232275, 0.018593711778521538, -0.01914551854133606, 0.012239593081176281, -0.010351096279919147, -0.017595598474144936, 0.006943586748093367, 0.04446262866258621, 0.008481875993311405, -0.006619436666369438, 0.013429451733827591, 0.0018425368471071124, -0.016757270321249962, -0.03712902590632439, -0.0012697059428319335, -0.0135204391553998, 0.0332939513027668, 0.020284511148929596, -0.005643332377076149, 0.01485231053084135, -0.05111588537693024, -0.03569802641868591, -0.0452432744204998, 0.0167201217263937, 0.019010474905371666, 0.01073126494884491, -0.05835313722491264, 0.004597140941768885, -0.012341715395450592, -0.01467907428741455, -0.003451879136264324, 0.02903672866523266, 0.03925187513232231, -0.008605115115642548, -0.011604863218963146, -0.02041240595281124, 0.014581459574401379, -0.03262820094823837, 0.030301768332719803, -0.018100308254361153, -0.00040648519643582404, -0.0032945566345006227, 0.0012656819308176637, 0.021859491243958473, 0.015429407358169556, 0.010586951859295368, -0.02218537963926792, 0.007611819542944431, 0.00895930826663971, -0.06894711405038834, 0.02605598233640194, -0.022820770740509033, -0.01762971095740795, -0.027900252491235733, -0.01306804921478033, -0.017241880297660828, -0.021635781973600388, -0.01930384524166584, 0.0240344125777483, -0.0695812776684761, 0.003331023035570979, 0.024388562887907028, 0.01450712326914072, 0.018363093957304955, -0.014007088728249073, 0.0263625830411911, -0.04356081783771515, 0.015291672199964523, -0.046130817383527756, 0.012424825690686703, -0.04013581573963165, 0.004785716999322176, -0.04237078130245209, -0.025377430021762848, -0.047114063054323196, 0.0010420276084914804, -0.0068266261368989944, -0.014981327578425407, -0.04423530399799347, -0.03534339368343353, -0.014606405049562454, 0.0063360948115587234, -0.023882798850536346, 0.03287891671061516, 0.0074689085595309734, 0.030637584626674652, 0.04679769650101662, 0.02329239808022976, -0.025637751445174217, 0.000031248335290001705, -0.018244212493300438, 0.0034474635031074286, 0.051051344722509384, -0.004281539469957352, 0.004761297255754471, 0.027302155271172523, -0.021126799285411835, 0.0038385100197046995, -0.029224194586277008, 0.008076976053416729, -0.05079486593604088, 0.012074386700987816, -0.02747517265379429, -0.015473183244466782, 0.04440256580710411, 0.017274638637900352, 0.020743168890476227, -0.03764531761407852, -0.019138233736157417, 0.010948244482278824, 0.02069852687418461, -0.029513608664274216, 0.0007916055037640035, -0.01136951893568039, 0.010477183386683464, 0.029218297451734543, -0.03381505608558655, -0.06807044893503189, 0.0014446551213040948, -0.04314092546701431, -0.019809801131486893, -0.01867409609258175, -0.060515254735946655, -0.038291625678539276, 0.02649548649787903, -0.02369687147438526, -0.012611630372703075, -0.02245858497917652, 0.015330793336033821, 0.024720879271626472, -0.044047337025403976, -0.03877817094326019, -0.020143182948231697, 0.009828916750848293, 0.019385844469070435, 0.01439677458256483, -0.015943914651870728, 0.0847509428858757, -0.008619063533842564, -0.008196384645998478, -0.034339502453804016, 0.04664689302444458 ]
Deep Learning over the Internet: Training Language Models Collaboratively
mryab
July 15, 2021
collaborative-training
research
https://huggingface.co/blog/collaborative-training
sahajBERT-NER Model card: https://hf.co/neuropark/sahajBERT-NER python from transformers import ( AlbertForTokenClassification, TokenClassificationPipeline, PreTrainedTokenizerFast, ) # Initialize tokenizer tokenizer = PreTrainedTokenizerFast.from_pretrained("neuropark/sahajBERT-NER") # Initialize model model = AlbertForTokenClassification.from_pretrained("neuropark/sahajBERT-NER") # Initialize pipeline pipeline = TokenClassificationPipeline(tokenizer=tokenizer, model=model) raw_text = "এই ইউনিয়নে ৩ টি মৌজা ও ১০ টি গ্রাম আছে ।" # Change me output = pipeline(raw_text)
[ 0.002087210537865758, -0.005230792332440615, -0.04501963406801224, 0.03210481256246567, 0.0475577637553215, 0.05751466006040573, 0.03980658948421478, 0.07115542143583298, -0.043620429933071136, 0.022657833993434906, -0.10363356024026871, 0.02106909640133381, -0.022457096725702286, 0.043067608028650284, 0.012826279737055302, -0.016478782519698143, 0.01997043378651142, -0.0021457523107528687, -0.06908323615789413, 0.012452689930796623, -0.007905333302915096, -0.02168974280357361, 0.09292123466730118, 0.03678971901535988, 0.042288411408662796, -0.0768439918756485, 0.04802308231592178, 0.04311448708176613, -0.043475907295942307, 0.048371199518442154, -0.04132350906729698, 0.0008369910647161305, 0.02518850564956665, 0.05071256309747696, 0.007725575007498264, 0.025662699714303017, -0.10690423101186752, 0.05416345223784447, 0.017373351380228996, -0.06100025027990341, -0.0007581638637930155, 0.04650067910552025, 0.017193429172039032, 0.04205464571714401, 0.04877982661128044, -0.027180127799510956, -0.14728890359401703, 0.051485054194927216, 0.005849930457770824, -0.05443856865167618, -0.02767375111579895, 0.022665349766612053, -0.03677245229482651, -0.025683525949716568, 0.03138561546802521, -0.009027587249875069, -0.03435739874839783, -0.04822339117527008, -0.026043912395834923, 0.0021594942081719637, 0.10694435983896255, -0.007896733470261097, -0.059300247579813004, 0.009259723126888275, 0.057725902646780014, 0.005663771647959948, -0.026585260406136513, 0.08431312441825867, 0.022923918440937996, -0.050022244453430176, 0.033733561635017395, -0.03630739077925682, 0.0009121316252276301, -0.08733844757080078, -0.02500670589506626, -0.07852994650602341, 0.01901710405945778, 0.03900710865855217, -0.03180890157818794, 0.05850979685783386, 0.003004903206601739, -0.000021042484149802476, 0.013782249763607979, 0.05319725722074509, 0.03113919124007225, 0.01954294741153717, 0.04893716797232628, -0.035631436854600906, -0.009303667582571507, 0.009215199388563633, -0.031688492745161057, -0.025044072419404984, -0.08369981497526169, -0.004018735606223345, 0.04235691949725151, 0.03467536345124245, 0.051849860697984695, 0.016540981829166412, -0.03918735682964325, -0.07225661724805832, 0.016193589195609093, -0.03512154519557953, -0.003118310123682022, -0.011376431211829185, 0.01215284038335085, 0.03870755806565285, -0.07261720299720764, -0.07880589365959167, -0.012986259534955025, 0.001420395914465189, 0.014827041886746883, -0.0027459561824798584, -0.03309917077422142, 0.07871101051568985, -0.06890861690044403, 0.013523069210350513, 0.058747079223394394, -0.03702005371451378, -0.027054494246840477, 0.023973219096660614, 0.03469417989253998, 0.038279999047517776, 0.053732823580503464, -0.005075117107480764, 0.026599973440170288, 0.029813308268785477, -0.018047362565994263, 0.06489800661802292, -0.006240536458790302, 0.06755426526069641, 0.022228926420211792, -0.022525275126099586, 0.006704068277031183, 0.018449265509843826, -0.00012068240175722167, -0.07281377166509628, -0.023567339405417442, -0.07677147537469864, -0.016799839213490486, 0.015761971473693848, -0.021886182948946953, 0.0826675072312355, -0.03989554941654205, -0.008101776242256165, 0.026908505707979202, 0.04232002794742584, -0.060904182493686676, 0.08926139026880264, 0.057115186005830765, -0.003813856979832053, -0.07809137552976608, 0.05512872338294983, -0.010217759758234024, -0.05386371165513992, 0.017713449895381927, 0.04574685916304588, -0.006822684314101934, 0.07416736334562302, -0.08482442051172256, -0.026012420654296875, 0.023692501708865166, -0.005889045540243387, -0.04412509500980377, -0.014138219878077507, -0.04104537144303322, -0.08236025273799896, 0.014648988842964172, -0.04756803438067436, 0.027523161843419075, -0.03521236404776573, 0.0391327403485775, -0.07784441113471985, 0.05909385159611702, -0.057529550045728683, 0.004321048501878977, 0.05959238111972809, -0.004257126711308956, 0.01124953106045723, 0.009733287617564201, -0.03379124775528908, -0.03815098851919174, 0.12478365749120712, -0.016704751178622246, 0.032969389110803604, 0.021330829709768295, -0.05167555436491966, 0.031942062079906464, 0.0009223162196576595, -0.03615794703364372, 0.006902520544826984, -0.05017030984163284, -0.029127420857548714, 0.027940450236201286, 0.0021084779873490334, 0.0036208753008395433, -0.051966920495033264, 0.04046729952096939, 0.03264540061354637, 0.023882819339632988, 0.08112986385822296, 0.06822454184293747, -0.028059428557753563, 0.008988742716610432, -0.07208526879549026, 0.042542632669210434, 0.015417518094182014, -0.04939262568950653, -0.05553143844008446, 0.07131722569465637, 0.02395714819431305, 0.0021505127660930157, -0.05826319754123688, 0.09887387603521347, -0.10550426691770554, 0.037274934351444244, -0.0038647358305752277, -0.022252626717090607, 0.05587098374962807, 0.003667578799650073, 0.014948285184800625, 0.1265888214111328, -0.0903090313076973, 0.0028227807488292456, -0.013117019087076187, -0.04619195684790611, 0.07371818274259567, 0.06417607516050339, 0.025354649871587753, 0.00037344303564168513, -0.09972640872001648, 0.002200309420004487, -0.06444810330867767, -0.005865415558218956, -0.003832509508356452, -0.05413762480020523, -0.04653620719909668, 0.05380457267165184, -0.03721805289387703, -0.023687243461608887, -0.012877845205366611, 0.028978047892451286, 0.041770949959754944, -0.07997385412454605, -0.030804095789790154, 0.0482930950820446, 0.06761498749256134, 0.021942248567938805, -0.024595804512500763, 0.032682277262210846, 0.022865960374474525, -0.022206956520676613, 0.021465688943862915, -0.022737987339496613, -0.061364758759737015, 0.05866190046072006, 0.01682460308074951, 0.02415372058749199, 0.005779067054390907, -0.01526675559580326, 0.045009076595306396, -0.014910680241882801, 0.048742279410362244, -0.07987188547849655, -0.0455586202442646, -0.05322730913758278, -0.021328892558813095, 0.06707944720983505, 0.04345322400331497, 0.0004289192729629576, 0.017438916489481926, 0.01173060480505228, -0.007839183323085308, 0.02301008440554142, 0.020413363352417946, 0.042480651289224625, 0.07773536443710327, 0.03496769070625305, -0.015096865594387054, 0.01554019469767809, -0.03310036659240723, -0.0096623245626688, -0.04706456512212753, -0.006340415682643652, 0.05136619508266449, 0.020373957231640816, 0.010361187160015106, -0.01773074083030224, -0.028358161449432373, 0.0037339807022362947, 0.010518024675548077, 0.010733965784311295, 0.08110881596803665, 0.011850743554532528, -0.037222038954496384, 0.0033925569150596857, 0.033562399446964264, -0.017025383189320564, -0.0005223620682954788, -0.006683033891022205, 0.011281851679086685, -0.016238128766417503, 0.014156597666442394, 0.0201412383466959, 0.03599238395690918, -0.024072227999567986, 0.037173304706811905, -0.046027544885873795, -0.03911542519927025, -0.07690785080194473, 0.025880327448248863, 0.013065067119896412, -0.011518976651132107, -0.01551025453954935, 0.020703881978988647, 0.047899048775434494, 0.0262784194201231, -0.03158162906765938, 0.019145412370562553, -0.01631731539964676, 0.024690518155694008, 0.01722399890422821, -0.02987085096538067, 0.017130881547927856, -0.03816736117005348, -0.019674966111779213, -0.024984832853078842, 0.039613988250494, 0.04693206399679184, -0.013331731781363487, -0.0035555751528590918, -0.01491639856249094, 0.038827281445264816, -0.0005898092640563846, -0.025950537994503975, -0.023489952087402344, -0.013429843820631504, -0.001425335998646915, 0.023888856172561646, -0.0020125051960349083, -0.026629535481333733, 0.007761384826153517, 0.02224184386432171, -0.011063499376177788, -0.03415993973612785, -0.027603046968579292, -0.010071364231407642, 0.00945417769253254, 0.025297826156020164, 0.008835531771183014, -0.02667677216231823, -0.013149446807801723, -0.02600627951323986, 0.020347345620393753, -0.04768010601401329, -0.0025442573241889477, 0.026014050468802452, 0.024397335946559906, -0.05106309801340103, -0.005093925632536411, -0.01674230769276619, 0.013513166457414627, 0.03176109120249748, -0.002256484003737569, 0.00002110185414494481, 0.021593408659100533, 0.026831025257706642, 0.02676776796579361, -0.046909160912036896, -0.03525238111615181, 0.0233615729957819, -0.040522560477256775, -0.048449043184518814, -0.025947410613298416, 0.08180216699838638, 0.010910257697105408, 0.04873093590140343, 0.003650049678981304, 0.059805989265441895, -0.02979089878499508, 0.07925167679786682, 0.01340563129633665, -0.002858509076759219, -0.039821647107601166, 0.027964094653725624, -0.025207150727510452, 0.007246500346809626, 0.008253253065049648, 0.011821208521723747, -0.018935533240437508, -0.03082241863012314, -0.07425413280725479, -0.0027105649933218956, 0.0009478065185248852, 0.049366191029548645, 0.04369034245610237, -0.015381827019155025, 0.023836148902773857, -0.02126668207347393, 0.015075300820171833, -0.00019480747869238257, -0.002736960304901004, -0.006057465448975563, -0.008030382916331291, 0.006721713114529848, -0.0037072657141834497, -0.0100827906280756, -0.03835822641849518, -0.023790601640939713, -0.008306381292641163, -0.0419803149998188, -0.016443153843283653, -0.01398665364831686, -0.00222586072050035, 0.012655387632548809, -0.024275707080960274, -0.03243746981024742, 0.03813270106911659, -0.0025238425005227327, -0.009958823211491108, 0.0062146843411028385, 0.028668206185102463, -0.006705895997583866, 0.0009648542618378997, 0.0525556281208992, 0.03600149601697922, -0.03047570213675499, -0.0042043947614729404, 0.03074260801076889, -0.021902702748775482, 0.05491671711206436, 0.009140532463788986, -0.027515389025211334, 0.00940437987446785, 0.0026483505498617887, 0.04987712204456329, 0.020786406472325325, 0.02168685384094715, -0.0036172084510326385, -0.04286385327577591, -0.01135907880961895, 0.008405908942222595, -0.03694809973239899, 0.028387505561113358, 0.012429827824234962, 0.011338034644722939, -0.02249966375529766, 0.04195566102862358, 0.020839855074882507, 0.02640075609087944, -0.017163151875138283, 0.033272989094257355, -0.01900065876543522, 0.0005430799210444093, -0.031068667769432068, 0.016438353806734085, 0.0027705971151590347, -0.007176870480179787, -0.014141907915472984, 0.051754504442214966, -0.01746240071952343, -0.03468174487352371, 0.010821648873388767, 0.006702851504087448, 0.002368881134316325, -0.016794327646493912, 0.006710316985845566, 0.004091973882168531, 0.05029347911477089, 0.005170297343283892, 0.020996706560254097, -0.023911191150546074, 0.012752581387758255, 0.027338622137904167, 0.015136940404772758, 0.0014387702103704214, -0.07610272616147995, -0.012848134152591228, 0.027194106951355934, -0.03255747631192207, -0.03792532533407211, 0.005947601515799761, 0.00943010114133358, -0.0012490102089941502, -0.0008970115450210869, 0.002995070768520236, 0.008686468936502934, -0.03681337833404541, -0.019369537010788918, -0.034691572189331055, -0.0457553006708622, 0.03442800045013428, 0.012791887857019901, -0.050511088222265244, 0.030831288546323776, 0.02047545276582241, 0.03815509378910065, 0.012432903982698917, 0.0009697466157376766, -0.04352200776338577, -0.016345413401722908, -0.002489430131390691, -0.00981928501278162, -0.015185308642685413, -0.05827623978257179, -0.029707733541727066, 0.016613340005278587, -0.008362308144569397, -0.046830255538225174, 0.0028749138582497835, 0.05970396846532822, 0.014449091628193855, -0.013451346196234226, 0.004956422373652458, 0.014244655147194862, -0.03607387840747833, -0.00030755886109545827, -0.01969754695892334, -0.013228759169578552, 0.006711236666887999, 0.040679074823856354, 0.0064741624519228935, -0.03677675127983093, -0.0013910944107919931, 0.00208524102345109, 0.026358501985669136, 0.041703514754772186, 0.004671975504606962, 0.11287294328212738, -0.01599433273077011, -0.001489455928094685, -0.036481063812971115, -0.012469586916267872, 0.04059404879808426, -0.007538559380918741, 0.06502879410982132, 0.03289966285228729, -0.009236998856067657, 0.023480046540498734, -0.02910676784813404, -0.0336252860724926, 0.02780463546514511, 0.01348638255149126, -0.016764219850301743, -0.013087824918329716, -0.05236140266060829, -0.0036452095955610275, 0.03171614184975624, -0.04135102033615112, 0.03432711586356163, -0.05268377065658569, -0.03326268494129181, -0.04166695848107338, -0.026153577491641045, 0.056677430868148804, 0.028689023107290268, -0.003805326297879219, 0.019399194046854973, 0.0685899630188942, 0.02582826279103756, 0.014248806051909924, -0.033141788095235825, 0.03502129018306732, -0.00591049250215292, -0.012336074374616146, 0.024341212585568428, 0.03332214057445526, 0.004515820648521185, -0.013524709269404411, -0.007607191801071167, -0.06678134948015213, -0.0074874465353786945, 0.029314866289496422, 0.025439057499170303, -0.008715667761862278, -0.002856130711734295, -0.05963488668203354, -0.0036373448092490435, 0.007641805801540613, 0.001214682823047042, 0.004168570972979069, -0.04345348849892616, -0.011605867184698582, -0.003748508170247078, 0.005168295465409756, 0.01216674130409956, 0.04145785793662071, -0.04874115437269211, 0.014964098110795021, 0.023436395451426506, 0.018321454524993896, 0.0076710740104317665, 0.016274800524115562, 0.0039086779579520226, -0.0010880626505240798, 0.0298305656760931, 0.010721441358327866, -0.014726532623171806, 0.023480789735913277, -0.0015813320642337203, -0.019410094246268272, -0.01805015094578266, -0.005121429916471243, 0.006238123867660761, 0.02317730337381363, 0.023380286991596222, 0.024833358824253082, 0.019354168325662613, -0.05794374272227287, 0.0511888712644577, 0.014515205286443233, 0.033239658921957016, -0.04170026257634163, 0.00817632582038641, 0.0722188651561737, 0.03150298446416855, 0.04047466441988945, 0.04689566791057587, -0.005235904362052679, -0.019344598054885864, -0.011820624582469463, 0.0129210464656353, -0.0014783228980377316, -0.00518054561689496, -0.008861037902534008, 0.030996173620224, -0.023628413677215576, -0.016510341316461563, -0.00021938362624496222, 0.02789449878036976, -0.0530843660235405, -0.014544337056577206, 0.004022222477942705, -0.06281733512878418, 0.015390024520456791, -0.014259609393775463, -0.035562559962272644, -0.03374416008591652, -0.013409185223281384, 0.0165374968200922, -0.015120738185942173, -0.01040521077811718, -0.027310753241181374, 0.0004668225592467934, 0.03944559022784233, -0.006156918127089739, 0.032136280089616776, 0.032247744500637054, 0.0036406386643648148, -0.02439166232943535, -0.04174552857875824, -0.030427249148488045, -0.006383669096976519, 0.007310227025300264, -0.03448788449168205, 0.018976323306560516, 0.004028039053082466, -0.01443954836577177, 0.014515820890665054, -0.01557404175400734, 0.017175128683447838, -0.029681263491511345, -0.02906189113855362, -0.0145985446870327, -0.034194137901067734, 0.0003581223718356341, -0.0004710723296739161, 0.023554673418402672, 0.01903846301138401, -0.010646741837263107, 0.06430082023143768, 0.04837168753147125, -0.06922315061092377, -0.027240941300988197, 0.034454695880413055, 0.03514787554740906, -0.04515038803219795, 0.033776141703128815, -0.027621284127235413, 0.029186958447098732, -0.01855538785457611, -0.04131576791405678, 0.0306767076253891, 0.013450774364173412, 0.02314397692680359, 0.02724803239107132, 0.015931230038404465, -0.025370605289936066, -0.017128050327301025, 0.01920229010283947, -0.010244381614029408, 0.03797842189669609, 0.019152622669935226, -0.012597273103892803, -0.040579356253147125, -0.05471247807145119, -0.02713623456656933, -0.06938891857862473, -0.000021347070287447423, -0.027262790128588676, -0.043626610189676285, -0.038273561745882034, 0.028284186497330666, 0.006452568341046572, 0.0008505270816385746, -0.07478854060173035, 0.008944898843765259, -0.04497300833463669, 0.006471846252679825, 0.021715372800827026, 0.010296116583049297, 0.09043614566326141, 0.03964655101299286, 0.02373042330145836, 0.026875454932451248, 0.009782012552022934, 0.024498196318745613, -0.014098086394369602, 0.002794802188873291, 0.0322839580476284, 0.030650848522782326, -0.0043342579156160355, -0.03129205480217934, 0.02229268103837967, -0.007559074554592371, -0.05044998228549957, 0.002442734083160758, -0.030849019065499306, 0.009169497527182102, -0.011268166825175285, -0.01264172326773405, 0.03629666194319725, 0.0030801864340901375, 0.020122436806559563, 0.02933666482567787, -0.02080489695072174, 0.017927298322319984, 0.007984506897628307, -0.07030998170375824, 0.019216114655137062, -0.0034610703587532043, -0.00745940487831831, 0.0027121282182633877, -0.015597326681017876, -0.02286035753786564, 0.042492084205150604, -0.028742967173457146, 0.0012475388357415795, 0.03350730240345001, -0.012422703206539154, -0.02616174705326557, 0.009008998051285744, 0.018143273890018463, -0.012288256548345089, -0.017781568691134453, 0.07090962678194046, 0.05327768251299858, -0.03050280548632145, -0.008077946491539478, 0.003914968576282263, -0.0006649915594607592, 0.023809589445590973, 0.013074208050966263, -0.01626128889620304, 0.0248161219060421, 0.0023368489928543568, -0.027485445141792297, -0.006917757447808981, 0.032073285430669785 ]
Deep Learning over the Internet: Training Language Models Collaboratively
mryab
July 15, 2021
collaborative-training
research
https://huggingface.co/blog/collaborative-training
sahajBERT-NCC Model card: https://hf.co/neuropark/sahajBERT-NER python from transformers import ( AlbertForSequenceClassification, TextClassificationPipeline, PreTrainedTokenizerFast, ) # Initialize tokenizer tokenizer = PreTrainedTokenizerFast.from_pretrained("neuropark/sahajBERT-NCC") # Initialize model model = AlbertForSequenceClassification.from_pretrained("neuropark/sahajBERT-NCC") # Initialize pipeline pipeline = TextClassificationPipeline(tokenizer=tokenizer, model=model) raw_text = "এই ইউনিয়নে ৩ টি মৌজা ও ১০ টি গ্রাম আছে ।" # Change me output = pipeline(raw_text)
[ -0.008958213962614536, -0.00787005852907896, -0.03279411420226097, 0.03704141825437546, 0.05624125897884369, 0.04712441563606262, 0.03299423307180405, 0.07929205149412155, -0.05270133167505264, 0.03859725221991539, -0.11213307082653046, 0.022823357954621315, -0.04512591287493706, 0.041458360850811005, 0.02042858675122261, 0.007912487722933292, 0.048943761736154556, 0.0035833409056067467, -0.08038780093193054, -0.004422049503773451, -0.02925647422671318, -0.012660411186516285, 0.07327992469072342, 0.043769095093011856, 0.06581509113311768, -0.07835962623357773, 0.061448317021131516, 0.015203522518277168, -0.044340334832668304, 0.05023163929581642, -0.033809591084718704, 0.027892496436834335, 0.03834054246544838, 0.043780870735645294, 0.003242436796426773, 0.015744544565677643, -0.11185992509126663, 0.07049533724784851, 0.016744574531912804, -0.05184164270758629, -0.017548449337482452, 0.039983998984098434, 0.03813667222857475, 0.03987204656004906, 0.03904339671134949, 0.00015594509022776037, -0.1264594942331314, 0.03497271612286568, -0.01772015541791916, -0.05022687092423439, -0.03755471110343933, 0.03574893996119499, -0.0443609319627285, -0.014360145665705204, 0.03247145190834999, -0.026193315163254738, -0.026678236201405525, -0.02972659282386303, -0.02860225737094879, 0.005476483143866062, 0.09976363182067871, -0.014113779179751873, -0.05097920075058937, 0.035307712852954865, 0.04403305426239967, -0.01339796558022499, -0.019651426002383232, 0.07255344092845917, 0.005492045544087887, -0.03147377818822861, 0.05017686262726784, -0.05599468573927879, 0.013225098140537739, -0.06557723879814148, -0.029071733355522156, -0.06526025384664536, -0.006769145373255014, 0.025580497458577156, -0.00588544737547636, 0.061076417565345764, -0.012597679160535336, 0.009232982061803341, 0.01723928563296795, 0.054620906710624695, 0.03413685783743858, 0.03859163820743561, 0.04889363795518875, -0.026926986873149872, 0.00223529408685863, -0.0002860527019947767, -0.040968313813209534, -0.01838299259543419, -0.07500147074460983, -0.015184844844043255, 0.018537327647209167, 0.036741845309734344, 0.06236260384321213, 0.024692533537745476, -0.04575008898973465, -0.06934892386198044, 0.008865509182214737, -0.032185111194849014, -0.02165708690881729, -0.027096249163150787, -0.00011653398541966453, 0.04042869806289673, -0.09039351344108582, -0.07245088368654251, -0.013201135210692883, -0.006576371844857931, 0.021449744701385498, -0.015075866132974625, -0.03717372566461563, 0.09495944529771805, -0.07075763493776321, 0.023544663563370705, 0.04987451806664467, -0.004375099670141935, -0.00626095337793231, 0.03077828884124756, 0.017400886863470078, 0.03309539332985878, 0.041297562420368195, 0.016772616654634476, 0.02226824127137661, 0.05031052231788635, -0.04930249601602554, 0.05311243608593941, -0.0005142743466421962, 0.05164935812354088, 0.03375014662742615, -0.021447887644171715, 0.026289332658052444, 0.031073998659849167, 0.005529432091861963, -0.07063668221235275, -0.04067766293883324, -0.07092425227165222, -0.014685657806694508, 0.022792840376496315, -0.05236911401152611, 0.07003878802061081, -0.03438923880457878, -0.01777956821024418, 0.03655979782342911, 0.06782934069633484, -0.08561266213655472, 0.08417822420597076, 0.07501497119665146, -0.00045949482591822743, -0.07725431025028229, 0.06574156880378723, -0.012511664070189, -0.059139203280210495, 0.011669930070638657, 0.05866779759526253, -0.011711494997143745, 0.09087824076414108, -0.08113525062799454, -0.02553933672606945, 0.03800349682569504, 0.02534935437142849, -0.03334205225110054, -0.030378198251128197, -0.050025228410959244, -0.0955730453133583, 0.020146077498793602, -0.035911496728658676, 0.03390597179532051, -0.03489358723163605, 0.03039553388953209, -0.08834900707006454, 0.03961217403411865, -0.04198514297604561, -0.01587379164993763, 0.05441586673259735, -0.005610994528979063, 0.015128976665437222, -0.0017674474511295557, -0.05157177895307541, -0.032224610447883606, 0.13626262545585632, -0.023044131696224213, 0.02978065237402916, 0.03713388741016388, -0.043050073087215424, 0.04490942880511284, 0.005751235876232386, -0.04491296038031578, 0.01807020604610443, -0.04018940031528473, -0.015153839252889156, 0.036073919385671616, -0.006611368618905544, -0.0028557218611240387, -0.025902006775140762, 0.03567109256982803, 0.0327712744474411, 0.0139659708365798, 0.07754017412662506, 0.0643765851855278, -0.002125965431332588, 0.0481414832174778, -0.07818935066461563, 0.038231704384088516, 0.024100741371512413, -0.05822216719388962, -0.04137297347187996, 0.06516464799642563, 0.009350921958684921, 0.004707357846200466, -0.05346876382827759, 0.07160157710313797, -0.09734820574522018, 0.0665980726480484, -0.0007836659206077456, -0.035325873643159866, 0.0413968488574028, -0.0037702324334532022, -0.011095431633293629, 0.10652729123830795, -0.0765569806098938, -0.01634514145553112, 0.0021102309692651033, -0.04958868399262428, 0.07599612325429916, 0.029378818348050117, 0.045457009226083755, 0.023318199440836906, -0.09617055952548981, 0.00019894710567314178, -0.04295102506875992, -0.020482439547777176, 0.020636534318327904, -0.048474498093128204, -0.046430084854364395, 0.05921093001961708, -0.02573603019118309, -0.03129539266228676, -0.02369433455169201, 0.017556961625814438, 0.03350478783249855, -0.09409390389919281, -0.04515855014324188, 0.023079486563801765, 0.07382086664438248, 0.012485537678003311, -0.02743491530418396, 0.017906010150909424, 0.04584714397788048, -0.031211234629154205, 0.033940739929676056, -0.018839601427316666, -0.05393366515636444, 0.0401570089161396, 0.02013440430164337, 0.025905881077051163, 0.012307415716350079, -0.023475520312786102, 0.04911548271775246, -0.024547429755330086, 0.038698095828294754, -0.06935723125934601, -0.054165106266736984, -0.05863221734762192, -0.03571084514260292, 0.0546596422791481, 0.031464748084545135, 0.007714726962149143, 0.02481957897543907, 0.001268661580979824, -0.021452711895108223, 0.023181455209851265, 0.013774133287370205, 0.0524241179227829, 0.0887453630566597, 0.058085665106773376, -0.01743656024336815, 0.0003185521927662194, -0.040166229009628296, -0.010820157825946808, -0.04040206968784332, -0.011099547147750854, 0.04383491352200508, 0.04079660028219223, 0.01961613819003105, -0.019435342401266098, -0.02567564882338047, 0.013686204329133034, 0.0014116991078481078, 0.0025563316885381937, 0.07794058322906494, 0.0227156113833189, -0.029408123344182968, 0.007290672976523638, 0.03257862478494644, -0.016077661886811256, 0.002495172433555126, -0.01134361233562231, 0.00410084892064333, -0.023464791476726532, 0.010688990354537964, 0.0019746082834899426, 0.04243204742670059, -0.010007117874920368, 0.03613845631480217, -0.020673420280218124, -0.04078828543424606, -0.07540705800056458, 0.0348912812769413, -0.0009173874277621508, -0.012627428397536278, -0.021010765805840492, 0.014391808770596981, 0.051727574318647385, 0.037013232707977295, -0.03471171110868454, 0.014473138377070427, -0.015382985584437847, 0.01749877817928791, 0.015508722513914108, -0.018027231097221375, 0.021648164838552475, -0.025458941236138344, -0.0249019768089056, -0.015922974795103073, 0.04492972791194916, 0.05428365617990494, -0.013146641664206982, 0.005254794377833605, -0.023781845346093178, 0.026531178504228592, -0.0012278689537197351, -0.026767775416374207, -0.03669358044862747, 0.0016801864840090275, -0.008416789583861828, 0.01181863434612751, -0.017557814717292786, -0.025112509727478027, 0.0007136259810067713, 0.024422956630587578, -0.02281518466770649, -0.04091308265924454, -0.02826906554400921, -0.003682838287204504, 0.013051283545792103, 0.0204737801104784, 0.015013014897704124, -0.018062936142086983, -0.015106694772839546, -0.012172398157417774, 0.019531382247805595, -0.04489586502313614, 0.006553133018314838, 0.026044674217700958, 0.02667594701051712, -0.04556317999958992, -0.01898823492228985, -0.018186593428254128, 0.00845954567193985, 0.03987498581409454, -0.01844351924955845, -0.0071409521624445915, 0.013967485167086124, 0.022037997841835022, 0.015895046293735504, -0.058877695351839066, -0.03599480539560318, 0.017653897404670715, -0.035119038075208664, -0.060730546712875366, -0.019348181784152985, 0.08719202131032944, 0.00637431675568223, 0.04818316549062729, 0.015728868544101715, 0.03705191984772682, -0.028513383120298386, 0.07555777579545975, 0.011888415552675724, 0.0006753773777745664, -0.043450143188238144, 0.02115792967379093, -0.035583481192588806, 0.001986404648050666, 0.014456363394856453, -0.003826218657195568, -0.008268818259239197, -0.036844056099653244, -0.0711454376578331, -0.009020952507853508, -0.0052904835902154446, 0.03824079781770706, 0.05882388353347778, -0.018454372882843018, 0.038807135075330734, -0.010244662873446941, 0.013802592642605305, -0.01091465912759304, -0.009911027736961842, -0.010675733909010887, 0.008509817533195019, 0.001469889422878623, 0.009346227161586285, -0.008491052314639091, -0.029841581359505653, -0.046602219343185425, -0.002515422413125634, -0.03959045186638832, -0.013448644429445267, -0.015185314230620861, 0.00004041032661916688, 0.011346661485731602, -0.023176442831754684, -0.03465251624584198, 0.02650029957294464, -0.023605410009622574, -0.006492179818451405, 0.01095765084028244, 0.034506525844335556, 0.001699269050732255, 0.000004604734840540914, 0.053421057760715485, 0.023152614012360573, -0.033694248646497726, -0.010019459761679173, 0.007273183204233646, -0.041911736130714417, 0.05268050730228424, 0.008714632131159306, -0.02454645000398159, 0.009611655957996845, 0.00179277453571558, 0.031114056706428528, 0.026227697730064392, 0.028744397684931755, -0.008186059072613716, -0.04396931082010269, -0.017416007816791534, 0.025389080867171288, -0.03815750777721405, 0.01990521140396595, 0.00600623432546854, 0.0011653858236968517, -0.026712754741311073, 0.048208706080913544, 0.018255025148391724, 0.039126165211200714, -0.015674512833356857, 0.0085780443623662, -0.014452656731009483, 0.007223989348858595, -0.03649162873625755, 0.01869579404592514, 0.01828286610543728, 0.003342787502333522, -0.011502019129693508, 0.03679464012384415, -0.03507670387625694, -0.017723049968481064, 0.019399717450141907, 0.0023680669255554676, -0.00015344010898843408, -0.02406938001513481, -0.0020407470874488354, 0.004885834641754627, 0.036429066210985184, 0.0021258508786559105, 0.014633183367550373, -0.025870027020573616, 0.010140747763216496, 0.01572205312550068, 0.02710293047130108, 0.006298295687884092, -0.06512822955846786, -0.010479503311216831, 0.020566411316394806, -0.029528172686696053, -0.04145975410938263, 0.01065786648541689, 0.008440694771707058, 0.00428966386243701, -0.0013071163557469845, 0.0063872262835502625, 0.005276164971292019, -0.03596950322389603, -0.021314803510904312, -0.03341069445014, -0.03717075288295746, 0.039403073489665985, 0.016288824379444122, -0.06052533909678459, 0.03113533928990364, 0.011564712971448898, 0.05074749141931534, 0.00525264348834753, 0.0033361564856022596, -0.036499787122011185, -0.01756819151341915, 0.0009321639663539827, -0.0070300935767591, -0.03773888200521469, -0.05877213180065155, -0.0296911783516407, -0.0008277935557998717, 0.004194772802293301, -0.04179689288139343, 0.007211742457002401, 0.06292541325092316, 0.02373143471777439, -0.0034805021714419127, 0.01309899426996708, 0.024678504094481468, -0.043132904917001724, 0.0014614688698202372, -0.0043777041137218475, -0.015612631104886532, 0.0159852784126997, 0.03812984749674797, 0.0074269953183829784, -0.036450427025556564, 0.0023884710390120745, 0.0024719606153666973, 0.018929090350866318, 0.04615887254476547, 0.006482321303337812, 0.10550107806921005, -0.03310159221291542, 0.009044570848345757, -0.021562885493040085, -0.0018883751472458243, 0.03197688236832619, 0.008873327635228634, 0.06551147252321243, 0.01619289070367813, -0.0036654584109783173, 0.0364220105111599, -0.024495763704180717, -0.021868085488677025, 0.013507728464901447, 0.018486710265278816, -0.02225988730788231, -0.004951371345669031, -0.05105388164520264, -0.0041478476487100124, 0.018201878294348717, -0.043799497187137604, 0.025114672258496284, -0.05846557393670082, -0.023324664682149887, -0.05965747311711311, -0.0024611519183963537, 0.04072212427854538, 0.0358806848526001, 0.008829042315483093, 0.027337249368429184, 0.05563446879386902, 0.049785565584897995, 0.0062050847336649895, -0.050699472427368164, 0.020064309239387512, -0.01508396677672863, -0.018081041052937508, 0.018762284889817238, 0.032714977860450745, 0.00428514089435339, -0.009743277914822102, -0.01558156218379736, -0.06486759334802628, -0.010109219700098038, 0.02888842672109604, 0.033590905368328094, -0.0034467699006199837, -0.00434540631249547, -0.06306619197130203, 0.01219090260565281, 0.01392796915024519, 0.013405966572463512, 0.007388121448457241, -0.04621374234557152, -0.003518723649904132, 0.011838199570775032, 0.005930124316364527, 0.01444841455668211, 0.030059656128287315, -0.04243910312652588, 0.02145027369260788, 0.016589244827628136, 0.01474865060299635, -0.0006696710479445755, 0.024802153930068016, -0.022057807072997093, -0.014630303718149662, 0.02756546624004841, 0.021556362509727478, -0.016303787007927895, 0.01758200116455555, -0.0058524468913674355, -0.013953152112662792, -0.009052172303199768, -0.009990362450480461, 0.013255997560918331, 0.02335740439593792, 0.024982143193483353, 0.025236893445253372, 0.019558485597372055, -0.03922707587480545, 0.037467651069164276, 0.020769616588950157, 0.01655270904302597, -0.030736928805708885, -0.000912242685444653, 0.07653924822807312, 0.030682140961289406, 0.0489174909889698, 0.01822274550795555, -0.005643996875733137, -0.03258891776204109, -0.013879313133656979, 0.008737782947719097, 0.0037294926587492228, 0.01385420374572277, -0.005500228609889746, 0.0360114723443985, -0.02358873002231121, -0.013346709311008453, -0.0029013673774898052, 0.02202235348522663, -0.04684126004576683, -0.007146735209971666, 0.007870747707784176, -0.06455466896295547, 0.006459976080805063, -0.012004111893475056, -0.01928297057747841, -0.03918968513607979, -0.00005638206494040787, 0.011626286432147026, -0.02274325117468834, -0.01262605469673872, -0.033490877598524094, 0.0181637741625309, 0.049577079713344574, -0.004609729629009962, 0.02898143231868744, 0.01563958451151848, -0.00045636313734576106, -0.03475119546055794, -0.04211778566241264, -0.020080791786313057, 0.006229380611330271, 0.0028721694834530354, -0.0355851873755455, 0.020292723551392555, 0.0031342441216111183, -0.009193170815706253, 0.0028628723230212927, -0.0005226475768722594, 0.021957315504550934, -0.01258910819888115, -0.021364787593483925, -0.01778850331902504, -0.04148184880614281, 0.020713433623313904, 0.0011064871214330196, 0.016625188291072845, 0.026110826060175896, -0.025770846754312515, 0.07651244848966599, 0.044121772050857544, -0.04592106118798256, -0.015116323716938496, 0.03176436945796013, 0.03936368227005005, -0.04223313555121422, 0.026287181302905083, -0.026893723756074905, 0.02914130873978138, -0.026365438476204872, -0.04521030932664871, 0.014530121348798275, 0.007037575356662273, 0.010191687382757664, 0.015800483524799347, 0.014545493759214878, -0.0245754923671484, -0.023863060399889946, 0.021089449524879456, -0.00723655242472887, 0.023989854380488396, 0.02619435265660286, -0.010995190590620041, -0.042369648814201355, -0.0509311780333519, -0.02566804178059101, -0.06586422771215439, -0.0023110825568437576, -0.0348053053021431, -0.03906649351119995, -0.044774506241083145, 0.03682270273566246, -0.005467064678668976, 0.008912191726267338, -0.07377190887928009, 0.0036725481040775776, -0.04327362775802612, -0.004795195534825325, 0.01987917535007, 0.027914609760046005, 0.08948063850402832, 0.03618340566754341, 0.013717129826545715, 0.022265460342168808, 0.011753154918551445, 0.02008901722729206, -0.0262050349265337, 0.0007187547162175179, 0.028261374682188034, 0.010503750294446945, 0.004365758970379829, -0.03360895439982414, 0.01294702012091875, -0.010141318663954735, -0.0447087287902832, 0.00039190659299492836, -0.02262062206864357, 0.0010653076460584998, -0.024217387661337852, -0.0008539695991203189, 0.03318820893764496, 0.026233430951833725, 0.02652669884264469, 0.029507512226700783, -0.011813261546194553, 0.011523471213877201, -0.0020368623081594706, -0.055668026208877563, 0.002840364584699273, -0.008702532388269901, -0.013106167316436768, -0.003631591098383069, -0.017729323357343674, -0.01636887900531292, 0.062234748154878616, -0.03683340549468994, 0.0074220201931893826, 0.0381229929625988, -0.002128358231857419, -0.03459689021110535, 0.008205000311136246, 0.02785676158964634, -0.005905987229198217, -0.017435302957892418, 0.08919621258974075, 0.05292683467268944, -0.03087584115564823, -0.0026896335184574127, 0.0011388094862923026, 0.0039115045219659805, 0.011618494987487793, 0.008557610213756561, -0.01428293902426958, 0.03798174858093262, 0.0037755335215479136, -0.0378241203725338, -0.011617091484367847, 0.042266178876161575 ]