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
How to train a new language model from scratch using Transformers and Tokenizers
julien-c
February 14, 2020
how-to-train
guide, nlp
https://huggingface.co/blog/how-to-train
5. Fine-tune your LM on a downstream task We now can fine-tune our new Esperanto language model on a downstream task of Part-of-speech tagging. As mentioned before, Esperanto is a highly regular language where word endings typically condition the grammatical part of speech. Using a dataset of annotated Esperanto POS tags formatted in the CoNLL-2003 format (see example below), we can use the run_ner.py script from transformers. > POS tagging is a token classification task just as NER so we can just use the exact same script. Again, here’s the hosted Tensorboard for this fine-tuning. We train for 3 epochs using a batch size of 64 per GPU. Training and eval losses converge to small residual values as the task is rather easy (the language is regular) – it’s still fun to be able to train it end-to-end 😃. This time, let’s use a TokenClassificationPipeline: python from transformers import TokenClassificationPipeline, pipeline MODEL_PATH = "./models/EsperBERTo-small-pos/" nlp = pipeline( "ner", model=MODEL_PATH, tokenizer=MODEL_PATH, ) # or instantiate a TokenClassificationPipeline directly. nlp("Mi estas viro kej estas tago varma.") # {'entity': 'PRON', 'score': 0.9979867339134216, 'word': ' Mi'} # {'entity': 'VERB', 'score': 0.9683094620704651, 'word': ' estas'} # {'entity': 'VERB', 'score': 0.9797462821006775, 'word': ' estas'} # {'entity': 'NOUN', 'score': 0.8509314060211182, 'word': ' tago'} # {'entity': 'ADJ', 'score': 0.9996201395988464, 'word': ' varma'} Looks like it worked! 🔥 For a more challenging dataset for NER, @stefan-it recommended that we could train on the silver standard dataset from WikiANN
[ 0.04526380077004433, -0.09483867138624191, -0.02273421175777912, 0.03288443014025688, 0.003405157942324877, 0.03935791924595833, 0.02155645750463009, 0.03341498225927353, -0.05484903231263161, 0.039321113377809525, -0.06631335616111755, 0.041409071534872055, 0.05469236150383949, 0.06749388575553894, 0.00996932853013277, 0.003890096675604582, 0.025895364582538605, 0.016932182013988495, -0.05455097183585167, -0.0219107698649168, 0.019420310854911804, -0.03325118124485016, 0.11226695030927658, 0.07474730908870697, -0.0015212252037599683, 0.00660736532881856, -0.03984419256448746, -0.023345105350017548, -0.11037860065698624, 0.023151328787207603, -0.06010782718658447, 0.022361021488904953, -0.038391295820474625, 0.05343924090266228, -0.02820380963385105, 0.038057807832956314, -0.059853266924619675, 0.020697910338640213, -0.017425552010536194, -0.0008092930074781179, -0.049042440950870514, 0.042946942150592804, -0.019161611795425415, 0.04476552456617355, 0.05936270207166672, -0.032621514052152634, -0.12204132974147797, -0.0032481225207448006, -0.016139289364218712, -0.04628874734044075, -0.05727452412247658, 0.06410359591245651, 0.06754785776138306, -0.046386297792196274, 0.004250484984368086, -0.0015681463992223144, 0.02736699767410755, -0.08427765220403671, -0.006573610007762909, 0.007103932090103626, 0.0010614162310957909, 0.01928306370973587, -0.060959041118621826, -0.019081871956586838, 0.01965886726975441, 0.010704058222472668, -0.10874523222446442, 0.021296488121151924, -0.061217475682497025, -0.04641370102763176, -0.002210984006524086, 0.006927173119038343, -0.026645855978131294, -0.03658146783709526, -0.03390445560216904, -0.07833194732666016, 0.01285665761679411, 0.020453356206417084, -0.01698085479438305, 0.06416849792003632, -0.009524531662464142, 0.052080921828746796, 0.03400091826915741, 0.06872094422578812, 0.08140718936920166, 0.07203363627195358, 0.07251451909542084, -0.041063860058784485, -0.031525444239377975, -0.019200176000595093, 0.0006903987377882004, -0.04827392101287842, -0.0335739403963089, 0.04425870254635811, 0.10163532197475433, 0.01693984493613243, -0.017979273572564125, 0.04740605875849724, -0.10872366279363632, -0.04736008122563362, 0.0351412408053875, -0.07238270342350006, 0.04907677322626114, -0.05984773486852646, -0.06915318965911865, 0.008157644420862198, 0.01621413417160511, -0.04033862426877022, -0.03639834001660347, 0.007850955240428448, -0.00952953938394785, 0.018353911116719246, 0.00039376100176014006, 0.1008780226111412, -0.05317983776330948, 0.012437359429895878, -0.03753912076354027, 0.03706446290016174, -0.05056991055607796, 0.014012514613568783, 0.0846274346113205, 0.07274290919303894, 0.060869742184877396, 0.007652408443391323, -0.015271766111254692, 0.05144397169351578, 0.03625986725091934, 0.048691459000110626, -0.02866022102534771, -0.0129301892593503, 0.031924840062856674, -0.0524807944893837, 0.0038702008314430714, 0.05782092735171318, -0.02760694921016693, -0.006344847846776247, 0.05488016456365585, -0.028137797489762306, 0.021636398509144783, -0.029750172048807144, -0.04103047028183937, 0.06341930478811264, -0.08981094509363174, -0.012454459443688393, 0.05215771496295929, -0.00821651704609394, 0.009814518503844738, 0.0653548538684845, 0.06947796046733856, 0.0666511058807373, 0.005417410749942064, 0.0768682211637497, -0.016050206497311592, -0.04911668971180916, 0.031143367290496826, 0.05715298652648926, -0.036877524107694626, -0.004159531556069851, -0.07533491402864456, 0.0023925662972033024, 0.003604130819439888, 0.03132030740380287, -0.019906790927052498, -0.003917589783668518, 0.02110673114657402, -0.05422790348529816, -0.01767336204648018, 0.02329169772565365, 0.00011966692545684054, 0.033722374588251114, 0.07547309994697571, -0.0065322439186275005, 0.07581494748592377, -0.027206938713788986, -0.021538179367780685, -0.0028640213422477245, 0.00065427809022367, 0.047989554703235626, -0.029381589964032173, -0.021268252283334732, -0.03819214180111885, 0.06760262697935104, -0.011793617159128189, 0.006636557634919882, 0.0009118503658100963, -0.08198710530996323, 0.03890009596943855, -0.05777357891201973, -0.03250937536358833, -0.013628611341118813, -0.023885296657681465, -0.012265725992619991, 0.07551657408475876, -0.0415593683719635, -0.02257830835878849, -0.032888609915971756, -0.012717495672404766, 0.045038267970085144, 0.03341333568096161, 0.020041657611727715, 0.048605985939502716, 0.0007994439802132547, -0.0064013004302978516, 0.013852446340024471, -0.022780777886509895, 0.020660720765590668, -0.018776927143335342, -0.09761325269937515, 0.021718423813581467, 0.03747706860303879, -0.0728587955236435, -0.08634588867425919, -0.004582579713314772, -0.0836777463555336, 0.0010238316608592868, -0.061896827071905136, -0.025909235700964928, 0.029752293601632118, 0.008990297093987465, -0.03969385847449303, 0.112530916929245, -0.0781489908695221, -0.031170854344964027, 0.011454480700194836, -0.007685475517064333, 0.005559003911912441, 0.06146899610757828, 0.03803527355194092, -0.007683190051466227, -0.05345350131392479, -0.02971985749900341, -0.06397280097007751, 0.02172277867794037, 0.015185040421783924, -0.05993356928229332, -0.05301298573613167, -0.025117196142673492, 0.010353690013289452, 0.02675662748515606, 0.007658056449145079, -0.028987953439354897, 0.0639231950044632, -0.06371202319860458, 0.07748117297887802, 0.015866314992308617, 0.014254122972488403, 0.1332578808069229, 0.0036516296677291393, -0.020495599135756493, 0.032958220690488815, -0.05055585503578186, 0.06575163453817368, 0.02549431100487709, -0.053132325410842896, -0.01958307810127735, -0.027464520186185837, -0.001536171999759972, 0.027934249490499496, 0.00602574460208416, 0.04030183330178261, 0.014745746739208698, 0.01318423543125391, -0.020498227328062057, -0.04826703667640686, 0.034377288073301315, -0.012619810178875923, 0.020416423678398132, -0.0017470918828621507, 0.0005612674867734313, -0.02736065723001957, -0.009912570007145405, -0.013346879743039608, -0.0006568495300598443, -0.0014150325441733003, 0.015581752173602581, 0.037734732031822205, 0.01823265291750431, -0.01163735892623663, -0.02497371844947338, -0.07851769030094147, -0.0001261831057490781, -0.04207736998796463, 0.05627681314945221, 0.04079039394855499, -0.01012365147471428, 0.02007210999727249, -0.03727157041430473, -0.03294205293059349, 0.006358853075653315, -0.004579452332109213, 0.020849650725722313, 0.010867440141737461, -0.03506315127015114, -0.03465196490287781, -0.0016608041478320956, 0.03188126161694527, 0.017594289034605026, -0.01756167970597744, 0.010081478394567966, 0.009116866625845432, -0.0483890026807785, -0.005771527532488108, 0.017110269516706467, -0.026331845670938492, -0.021649399772286415, -0.005332850385457277, 0.019479546695947647, 0.017847198992967606, -0.07683075219392776, -0.022405272349715233, -0.033057138323783875, 0.01840527169406414, 0.023925988003611565, -0.024429315701127052, 0.0021460875868797302, 0.04336189851164818, -0.02712828293442726, 0.016255265101790428, -0.02707860805094242, 0.03506685048341751, 0.026832519099116325, 0.027691541239619255, 0.021770382300019264, -0.04641076177358627, -0.005995872896164656, -0.04686472937464714, -0.006460866890847683, 0.002927997848019004, -0.00880496483296156, 0.040412262082099915, 0.015557389706373215, 0.06306691467761993, 0.008946878835558891, 0.046152811497449875, -0.026118578389286995, -0.00000951712172536645, -0.013296382501721382, 0.0070878262631595135, -0.026317939162254333, -0.015615335665643215, -0.017064379528164864, 0.027253085747361183, -0.01331003662198782, -0.015915514901280403, 0.03511540964245796, 0.00019752189109567553, 0.004203465301543474, 0.05172744393348694, 0.030863773077726364, -0.0010086280526593328, 0.014569425024092197, -0.004753194749355316, 0.0030116743873804808, -0.021710624918341637, -0.008718102239072323, -0.047629520297050476, 0.030352553352713585, -0.032345812767744064, 0.0044964952394366264, 0.006507880985736847, 0.008681206032633781, 0.06883850693702698, 0.002779668429866433, 0.0014720914186909795, 0.0067294202744960785, 0.001906133838929236, 0.020129060372710228, 0.007690914906561375, -0.04952368140220642, 0.03436116874217987, -0.011593624018132687, -0.03349553048610687, -0.039893168956041336, 0.07381253689527512, 0.006623208988457918, 0.033524587750434875, -0.044511131942272186, 0.02575039304792881, -0.002748400904238224, 0.030211523175239563, 0.0010624596616253257, -0.0069321999326348305, -0.02944125607609749, 0.005112620070576668, -0.012128644622862339, 0.029003893956542015, -0.0005205255001783371, 0.013954736292362213, -0.022317735478281975, 0.018318094313144684, -0.009800869040191174, -0.023259621113538742, 0.009112969972193241, -0.00009948754450306296, 0.021537238731980324, -0.032562270760536194, -0.019712720066308975, 0.01221265085041523, 0.019894901663064957, 0.02812672033905983, 0.010204793885350227, -0.01195130031555891, -0.010621906258165836, -0.014148994348943233, -0.020400524139404297, 0.01616540551185608, -0.00009349307219963521, -0.002785427263006568, -0.0043752905912697315, -0.051162704825401306, 0.05346359312534332, 0.01286301575601101, 0.01797730289399624, 0.037770144641399384, -0.01702108606696129, -0.005137606058269739, 0.00874226912856102, -0.02509361505508423, -0.010804124176502228, 0.030984535813331604, -0.014937630854547024, -0.015125110745429993, 0.004353766795247793, 0.04519237205386162, -0.02196834795176983, 0.018940569832921028, 0.030874039977788925, 0.009297634474933147, -0.034848663955926895, -0.020396914333105087, 0.05703679844737053, -0.040943168103694916, 0.060960493981838226, -0.014901416376233101, 0.028952203691005707, 0.05112103745341301, -0.008864146657288074, 0.009358520619571209, -0.03510868549346924, -0.012518324889242649, 0.06626586616039276, -0.0137416310608387, 0.03777550533413887, -0.019898077473044395, 0.006523245945572853, -0.019229194149374962, 0.0212083887308836, -0.00904929731041193, -0.004450744483619928, -0.006437288597226143, 0.019858993589878082, -0.024559056386351585, 0.03260015323758125, -0.009446685202419758, 0.00981760025024414, 0.009527215734124184, 0.015693284571170807, 0.036492038518190384, 0.058603398501873016, 0.009951278567314148, -0.016926605254411697, -0.031278133392333984, 0.014056909829378128, -0.021295325830578804, -0.03491165488958359, 0.0651862621307373, 0.03310307860374451, 0.05744316428899765, 0.013174649327993393, -0.010171527042984962, -0.019020486623048782, 0.02676413580775261, 0.03509160503745079, 0.00024251210561487824, -0.04010813310742378, -0.022381624206900597, -0.003619459457695484, -0.02095131389796734, 0.006395350210368633, 0.01093190349638462, 0.009268241003155708, -0.021108847111463547, -0.0044473265297710896, 0.004871878772974014, -0.02569522149860859, -0.019157202914357185, -0.03961586579680443, -0.0029576250817626715, 0.02614339254796505, 0.0011734804138541222, 0.029178036376833916, 0.022976156324148178, -0.018684202805161476, 0.02554849535226822, 0.012494564987719059, 0.02764039672911167, 0.0004165930731687695, 0.014804601669311523, -0.007142048794776201, -0.0071212477050721645, 0.0002741449570748955, 0.0065321531146764755, -0.007360030431300402, 0.03644980117678642, -0.02407425083220005, 0.021713105961680412, -0.08354343473911285, 0.006800665985792875, 0.021915849298238754, 0.023332813754677773, 0.026176346465945244, -0.02177467942237854, -0.005036219488829374, -0.01402189303189516, -0.01849413849413395, -0.03051835112273693, -0.03678120672702789, -0.06008785218000412, 0.029961224645376205, -0.005182017106562853, -0.015618955716490746, 0.003651154227554798, 0.013555396348237991, -0.0508866012096405, 0.004191738087683916, 0.00808722898364067, 0.01389589998871088, 0.06990648061037064, -0.011657103896141052, -0.03302549198269844, -0.0007789586088620126, 0.002364991931244731, -0.0033499589189887047, -0.044619087129831314, 0.04501746594905853, -0.005163026973605156, 0.00015491990779992193, 0.016509097069501877, -0.013822313398122787, -0.05080992728471756, 0.03211565315723419, 0.01583700254559517, 0.021627206355333328, -0.024450434371829033, -0.07762961089611053, 0.038322582840919495, 0.07549519091844559, 0.004954424686729908, 0.01786239817738533, -0.015449811704456806, -0.061167631298303604, -0.009430620819330215, -0.03319466486573219, 0.09353277087211609, 0.0042228237725794315, -0.009062138386070728, 0.0021583689376711845, 0.007311500608921051, 0.0403924398124218, -0.011789930984377861, -0.05101367458701134, 0.02603285387158394, -0.0014823107048869133, 0.012199698016047478, 0.026811186224222183, 0.019096868112683296, -0.01882730983197689, -0.013873650692403316, -0.008400266058743, -0.06253789365291595, 0.014129500836133957, 0.07054318487644196, -0.02663840726017952, 0.004415570292621851, 0.02015499398112297, -0.0385669581592083, 0.032746098935604095, 0.013434652239084244, 0.0007770180236548185, -0.04993868246674538, 0.0005883999983780086, -0.032315365970134735, 0.03582180291414261, -0.007290231063961983, -0.03089190647006035, 0.03157440572977066, -0.018468866124749184, 0.013257338665425777, 0.00819608848541975, -0.004754090681672096, 0.04708295315504074, 0.0031463601626455784, -0.004155577160418034, -0.00046874649706296623, 0.06293197721242905, 0.001412138226442039, 0.019398551434278488, -0.004909600596874952, -0.013618677854537964, 0.012369922362267971, -0.03356892988085747, -0.022345921024680138, -0.018197979778051376, -0.023563971742987633, 0.06827858090400696, -0.04496011883020401, -0.02531854808330536, -0.020949453115463257, 0.060776486992836, 0.00990345235913992, 0.030026772990822792, 0.002884381450712681, -0.02470322698354721, 0.023997727781534195, 0.04409051686525345, -0.02638653665781021, 0.03063625656068325, -0.00366820115596056, -0.027838027104735374, 0.007628527004271746, 0.005179265514016151, 0.057134851813316345, -0.005503334570676088, -0.019836535677313805, 0.010392733849585056, -0.073552206158638, -0.009188881143927574, 0.042249564081430435, 0.005202206317335367, -0.008253104984760284, 0.030879434198141098, 0.03495023772120476, -0.003227515146136284, 0.015306226909160614, -0.03058437816798687, -0.0037338638212531805, -0.028986286371946335, -0.005772260017693043, -0.04103861376643181, 0.03805117681622505, -0.016889015212655067, -0.06173122301697731, -0.08454413712024689, -0.010954782366752625, 0.035853926092386246, 0.01757274568080902, -0.027379848062992096, -0.012594706378877163, 0.005269356071949005, -0.038022857159376144, 0.011231094598770142, 0.03236355632543564, 0.019267937168478966, -0.05156964808702469, 0.0032808822579681873, 0.004130474291741848, -0.010984884575009346, 0.0312361940741539, -0.004541361704468727, -0.0011790948919951916, -0.05344035103917122, -0.010923569090664387, -0.0063018640503287315, -0.06399848312139511, 0.03236021101474762, -0.037461668252944946, -0.02621733583509922, 0.025585832074284554, -0.007379695773124695, 0.03909783810377121, 0.05952097102999687, -0.0400925911962986, 0.007547880057245493, -0.023785660043358803, 0.03588385507464409, -0.017588092014193535, 0.03938326612114906, 0.012915083207190037, 0.051711201667785645, -0.021436654031276703, -0.006246086675673723, -0.00146400963421911, 0.014104889705777168, 0.0037052587140351534, 0.023362798616290092, 0.025225814431905746, -0.025135565549135208, -0.04924675077199936, 0.0031816884875297546, 0.030245909467339516, 0.03731349855661392, 0.05529981106519699, -0.018455252051353455, -0.043297357857227325, 0.006307636387646198, -0.0251903235912323, -0.007822512648999691, 0.0012987593654543161, -0.02416546456515789, -0.03956056758761406, -0.02210518717765808, 0.02631339803338051, -0.04024644196033478, 0.011442865245044231, -0.059578437358140945, -0.016648966819047928, -0.06854449957609177, -0.0229453444480896, 0.0026307241059839725, 0.03397279977798462, 0.04835851863026619, 0.08399967849254608, 0.03867684304714203, 0.022136569023132324, 0.01723838597536087, -0.002323911990970373, -0.002106486586853862, 0.015241315588355064, 0.07888054847717285, -0.00812299083918333, -0.002082191174849868, -0.03545772656798363, 0.04152386635541916, -0.016767047345638275, -0.038443226367235184, -0.04149440675973892, 0.04078826680779457, 0.011647671461105347, 0.012851356528699398, 0.03513094410300255, 0.046040263026952744, -0.029446428641676903, -0.017272327095270157, 0.0517101064324379, 0.014618477784097195, 0.017547233030200005, 0.008724439889192581, -0.07291042804718018, -0.020986922085285187, -0.012579639442265034, -0.03328448161482811, 0.008791208267211914, 0.011765082366764545, 0.025071440264582634, 0.0036690805573016405, -0.01817493326961994, 0.00018086627824231982, -0.03335859626531601, 0.005011482164263725, -0.029350528493523598, 0.07148834317922592, 0.01601138710975647, 0.0007546854321844876, -0.02398008666932583, 0.06411125510931015, 0.031677305698394775, 0.019877731800079346, -0.025049708783626556, 0.007116083521395922, 0.031467095017433167, 0.005751192569732666, 0.0012251697480678558, 0.017550883814692497, 0.019916504621505737, 0.02456994168460369, -0.031845394521951675, -0.016679301857948303, -0.0049139573238790035 ]
How to train a new language model from scratch using Transformers and Tokenizers
julien-c
February 14, 2020
how-to-train
guide, nlp
https://huggingface.co/blog/how-to-train
# How to train a new language model from scratch using Transformers and Tokenizers Over the past few months, we made several improvements to our transformers and tokenizers libraries, with the goal of making it easier than ever to train a new language model from scratch. In this post we’ll demo how to train a “small” model (84 M parameters = 6 layers, 768 hidden size, 12 attention heads) – that’s the same number of layers & heads as DistilBERT – on Esperanto. We’ll then fine-tune the model on a downstream task of part-of-speech tagging. Esperanto is a constructed language with a goal of being easy to learn. We pick it for this demo for several reasons: - it is a relatively low-resource language (even though it’s spoken by ~2 million people) so this demo is less boring than training one more English model 😁 - its grammar is highly regular (e.g. all common nouns end in -o, all adjectives in -a) so we should get interesting linguistic results even on a small dataset. - finally, the overarching goal at the foundation of the language is to bring people closer (fostering world peace and international understanding) which one could argue is aligned with the goal of the NLP community 💚 > N.B. You won’t need to understand Esperanto to understand this post, but if you do want to learn it, Duolingo has a nice course with 280k active learners. Our model is going to be called… wait for it… EsperBERTo 😂
[ 0.04338841140270233, -0.04796644300222397, -0.038412559777498245, -0.007312643341720104, 0.019081884995102882, 0.08553280681371689, 0.006179140415042639, 0.02577647753059864, -0.03303997218608856, 0.04525212198495865, -0.02702436037361622, 0.09826286882162094, 0.004234003368765116, 0.03750742971897125, 0.038706645369529724, -0.009216772392392159, -0.013942236080765724, -0.016457220539450645, -0.03222062811255455, -0.04014122486114502, -0.04845020920038223, -0.05559512972831726, 0.06847731024026871, -0.027882596477866173, 0.04234683886170387, -0.021873334422707558, 0.07354090362787247, 0.010338564403355122, 0.014579225331544876, 0.04570741206407547, -0.08769015967845917, -0.0056107849813997746, -0.02139890566468239, -0.042838215827941895, -0.07042244076728821, 0.03521055355668068, -0.06313519179821014, 0.025889893993735313, 0.0014579857233911753, -0.032014504075050354, -0.030577650293707848, 0.049633461982011795, -0.026563206687569618, 0.043659958988428116, -0.005414654966443777, 0.004870716016739607, -0.15974287688732147, 0.039426930248737335, -0.06163305044174194, -0.07201141864061356, -0.06241748481988907, 0.01188551727682352, 0.0249446090310812, 0.0054186866618692875, -0.011276383884251118, -0.004168599843978882, 0.031949058175086975, -0.07967504113912582, -0.020656118169426918, 0.027196722105145454, 0.007656360976397991, 0.01289304718375206, -0.009240989573299885, -0.019222615286707878, 0.024312132969498634, -0.011925448663532734, -0.07665831595659256, 0.01910647377371788, -0.04593830555677414, -0.07320250570774078, 0.009292512200772762, -0.04303776100277901, -0.02791789546608925, -0.040446937084198, 0.0010184876155108213, -0.006983447354286909, 0.04967435821890831, 0.0392855741083622, 0.016327792778611183, 0.05951029062271118, -0.003930090926587582, 0.03821698576211929, 0.06178615614771843, 0.005807444918900728, 0.06348489969968796, 0.037640634924173355, 0.008985362015664577, -0.010171682573854923, -0.07935222238302231, 0.026856688782572746, -0.011659977026283741, -0.12965169548988342, -0.04658183082938194, 0.03203631564974785, 0.071725994348526, 0.013331633992493153, -0.0265923161059618, 0.053920261561870575, -0.028216104954481125, -0.03661877289414406, 0.007570162415504456, -0.02848018705844879, 0.0825250893831253, -0.0570971742272377, -0.03373650088906288, 0.003715884406119585, 0.01884135790169239, -0.043651457875967026, -0.012092049233615398, -0.01702364720404148, 0.007728848606348038, -0.06866709887981415, 0.029911665245890617, 0.08128523826599121, -0.095329649746418, 0.01876246929168701, 0.022387854754924774, 0.021274494007229805, -0.053694870322942734, 0.02728934772312641, 0.00550933089107275, 0.07267799973487854, 0.05567982420325279, 0.014533386565744877, -0.04336567968130112, 0.0917348712682724, 0.010043268091976643, 0.08480633050203323, -0.0021389226894825697, -0.00005316092574503273, 0.06481967866420746, -0.08623968064785004, 0.04768052324652672, -0.004701168276369572, 0.024542996659874916, 0.011835056357085705, 0.04659087210893631, -0.014108086936175823, 0.033221397548913956, -0.031255289912223816, -0.05417930334806442, 0.05467456206679344, -0.05851684510707855, -0.05931272730231285, 0.031476713716983795, 0.03233100846409798, -0.06969625502824783, 0.029801687225699425, 0.0611126534640789, 0.0559774674475193, -0.04187827557325363, 0.03075183928012848, -0.005437833722680807, -0.023178579285740852, 0.08629772812128067, 0.06020726263523102, -0.04590367525815964, -0.04541168734431267, -0.04573016241192818, -0.015697145834565163, -0.03648655489087105, 0.0011700077448040247, 0.01105302944779396, 0.05228029564023018, 0.0012325142743065953, -0.050089068710803986, -0.032444290816783905, 0.07437612116336823, 0.002748071448877454, 0.07849611341953278, 0.077915258705616, 0.020495988428592682, 0.037802837789058685, -0.02191435731947422, -0.036611221730709076, -0.026583842933177948, -0.023766351863741875, 0.016022419556975365, 0.027584563940763474, -0.017690513283014297, -0.026544637978076935, 0.050344835966825485, 0.0005948937032371759, 0.044726960361003876, 0.04049183428287506, -0.0821387842297554, 0.011373655870556831, -0.046892765909433365, -0.08223693817853928, 0.003244931111112237, 0.01782473735511303, 0.004311318974941969, 0.0615592822432518, -0.0034094862639904022, 0.018955960869789124, -0.050861287862062454, -0.029030904173851013, 0.08216430246829987, 0.013173084706068039, 0.11135753244161606, 0.030046649277210236, 0.03727461397647858, -0.013145389035344124, 0.011942422948777676, 0.028568411245942116, 0.00790650025010109, -0.016089914366602898, -0.03808611258864403, 0.028757670894265175, 0.00021199093316681683, -0.034086037427186966, -0.06866010278463364, 0.013898799195885658, -0.040485966950654984, 0.015962056815624237, -0.03685903921723366, 0.021982936188578606, 0.047847386449575424, 0.03734013810753822, -0.008847053162753582, 0.15475845336914062, -0.10010366886854172, -0.08703575283288956, 0.01783290132880211, -0.017102910205721855, 0.036835674196481705, 0.058426517993211746, -0.008695507422089577, 0.04442954063415527, -0.06741415709257126, -0.03498547896742821, -0.0750335156917572, -0.010152512229979038, -0.049366146326065063, -0.02960968390107155, -0.035611338913440704, -0.022585012018680573, 0.030390992760658264, 0.008062724024057388, -0.02978452481329441, -0.0419958233833313, 0.0025212792679667473, -0.03536317124962807, -0.0014725164510309696, 0.02108515240252018, 0.08891695737838745, 0.11673422157764435, 0.02769298665225506, 0.01054981630295515, 0.057414401322603226, -0.06723670661449432, 0.08193697780370712, 0.01983405463397503, -0.05928941071033478, 0.004914787597954273, 0.01530626229941845, 0.022393355146050453, -0.019697707146406174, 0.009268980473279953, -0.01361837051808834, -0.02975820191204548, 0.03412959724664688, -0.055080000311136246, -0.056699492037296295, -0.004977280739694834, -0.06668820977210999, -0.04909399524331093, 0.016577964648604393, 0.011017330922186375, -0.042690955102443695, -0.003602688666433096, -0.021761775016784668, 0.013390542939305305, -0.010027359239757061, 0.008433575741946697, 0.02515373006463051, 0.017383279278874397, -0.03325505182147026, -0.036902859807014465, -0.04545360431075096, -0.007035207003355026, -0.032829489558935165, 0.006894209887832403, 0.05079171806573868, -0.0062970626167953014, 0.015543662942945957, -0.024032849818468094, -0.02631400153040886, -0.019431261345744133, -0.0031519399490207434, -0.003919965121895075, 0.017064694315195084, -0.033075787127017975, -0.01387137919664383, -0.004063671920448542, 0.011137782596051693, 0.025584781542420387, -0.017740324139595032, 0.02282489836215973, -0.00026064549456350505, -0.01959500089287758, 0.012084762565791607, -0.010363265872001648, 0.00023396153119392693, -0.025756871327757835, -0.01313407439738512, 0.01713886484503746, 0.012360063381493092, -0.08109685033559799, -0.03113650158047676, -0.023749303072690964, -0.009591110982000828, 0.02567456290125847, -0.043040137737989426, 0.015483196824789047, 0.02138213813304901, -0.01774558052420616, -0.004031756427139044, -0.03506120666861534, -0.006942871492356062, -0.007633101660758257, 0.05817706882953644, -0.0000018813678934748168, -0.0489322803914547, -0.047318898141384125, -0.01658998802304268, 0.041723594069480896, 0.008317646570503712, -0.02368696965277195, 0.027573462575674057, 0.017135242000222206, 0.034902237355709076, 0.007731898687779903, -0.0009409635094925761, 0.029153529554605484, 0.017122311517596245, 0.039710525423288345, 0.02647448517382145, -0.024238046258687973, -0.010137980803847313, 0.005068587139248848, 0.03574593737721443, -0.029486624523997307, -0.0016496715834364295, 0.07031069695949554, 0.02148868329823017, 0.009135191328823566, 0.04062425717711449, 0.004033427219837904, -0.03385794907808304, 0.008762737736105919, -0.011858709156513214, 0.042228810489177704, -0.05078501999378204, -0.016207199543714523, -0.047113120555877686, 0.006429528351873159, -0.04629305377602577, 0.018349649384617805, -0.009244437329471111, 0.009825109504163265, 0.04341869801282883, 0.035881973803043365, -0.021341539919376373, 0.03564042970538139, 0.006069909781217575, 0.021666374057531357, -0.013673882931470871, -0.023875469341874123, 0.025613097473978996, -0.013395103625953197, -0.020990150049328804, -0.07208326458930969, 0.06587543338537216, 0.0019947246182709932, 0.04858095943927765, 0.0010547711281105876, 0.022143026813864708, -0.02494342438876629, 0.019155576825141907, 0.005665046628564596, -0.0034295269288122654, -0.013197572901844978, 0.008452648296952248, -0.006079443730413914, 0.005358402151614428, 0.05037054792046547, 0.04431019723415375, -0.019780054688453674, -0.03383265808224678, -0.03055708110332489, -0.010849134996533394, -0.0017650731606408954, -0.03054245188832283, 0.01966409757733345, -0.034846995025873184, 0.0009321596007794142, 0.009290454909205437, -0.001616933848708868, -0.0012145201908424497, -0.0045598517172038555, -0.004964790772646666, 0.024729110300540924, -0.024493372067809105, 0.000029846123652532697, -0.021026788279414177, 0.013066242448985577, -0.01556748989969492, 0.042360126972198486, -0.03001135215163231, 0.0020465622656047344, 0.025707151740789413, 0.013586233370006084, 0.046715524047613144, -0.02211657725274563, -0.03229004517197609, 0.0018639254849404097, 0.0016606705030426383, 0.011430884711444378, 0.028055179864168167, -0.014140256680548191, 0.010004578158259392, 0.005597265902906656, 0.03238081932067871, -0.018891416490077972, 0.0222234595566988, 0.017071740701794624, -0.01537119410932064, -0.013868576847016811, -0.005444209557026625, 0.03966216742992401, -0.014839604496955872, 0.038378600031137466, -0.021002061665058136, 0.0289206150919199, 0.056396979838609695, -0.008269097656011581, 0.027375908568501472, -0.015624670311808586, 0.004774462431669235, 0.052371904253959656, -0.002797971945255995, 0.0013843688648194075, 0.024526309221982956, -0.061025168746709824, 0.003931066021323204, 0.007544387131929398, 0.015585370361804962, -0.018391543999314308, -0.007343101780861616, 0.04625173285603523, -0.04870673641562462, 0.026285789906978607, -0.016265014186501503, -0.00778823159635067, -0.02955380082130432, 0.007709674071520567, 0.012835207395255566, 0.04131672531366348, 0.015483608469367027, -0.03650607913732529, -0.018473563715815544, -0.009302998892962933, -0.01615159772336483, 0.0051505593582987785, 0.035878170281648636, 0.013538958504796028, 0.015835460275411606, -0.033617351204156876, 0.027554871514439583, -0.032681629061698914, 0.021868081763386726, 0.06806280463933945, -0.016312414780259132, -0.03631415590643883, -0.030362294986844063, -0.012795413844287395, -0.0014784263912588358, -0.007500643841922283, -0.02549007162451744, 0.012965202331542969, 0.006709490902721882, 0.007880293764173985, 0.03318687155842781, 0.00029442249797284603, 0.005068864673376083, -0.053716082125902176, 0.021798904985189438, -0.02883855253458023, 0.005832066293805838, -0.01721186190843582, -0.003949194215238094, -0.0085537014529109, 0.027955172583460808, 0.04437101259827614, 0.036380887031555176, 0.003303159959614277, 0.003848043270409107, -0.024303914979100227, -0.008387258276343346, 0.033541787415742874, 0.02726706676185131, -0.019613493233919144, -0.026835091412067413, -0.03016417659819126, 0.0014207997592166066, -0.07619232684373856, 0.006810122635215521, 0.01366710476577282, 0.03349869325757027, 0.020107705146074295, -0.0019898065365850925, 0.024685971438884735, 0.027036583051085472, -0.01162607129663229, -0.05142849311232567, -0.021879035979509354, -0.06981045752763748, -0.02092667669057846, -0.004862604197114706, 0.004977896343916655, -0.026685362681746483, -0.02302209846675396, -0.047893766313791275, 0.009811876341700554, -0.014014274813234806, 0.0230800099670887, 0.0249883271753788, -0.008050856180489063, -0.027190906926989555, -0.02030562423169613, 0.0010618082014843822, 0.04211178049445152, -0.02962188608944416, 0.018743323162198067, 0.05811294913291931, -0.005994122941046953, -0.011781688779592514, -0.001627109362743795, -0.008301781490445137, 0.021175118163228035, 0.04654667526483536, -0.014893054962158203, -0.049080997705459595, -0.04430529475212097, -0.009310220368206501, 0.06125404313206673, -0.002070216229185462, -0.0008075432269833982, 0.015392179600894451, -0.05601072683930397, 0.01820804551243782, -0.05697285383939743, 0.0575869083404541, 0.025235336273908615, -0.04120353236794472, 0.008446109481155872, 0.017611542716622353, 0.026222918182611465, -0.03244579955935478, -0.021757284179329872, 0.031723752617836, 0.02604888193309307, 0.05382392928004265, 0.029308533295989037, 0.01661306992173195, -0.02612977847456932, 0.008049996569752693, 0.031297553330659866, -0.045830029994249344, 0.05069851130247116, 0.03505377471446991, -0.021949181333184242, -0.008772521279752254, 0.018532611429691315, -0.024707689881324768, -0.004836808890104294, 0.025657543912529945, 0.035424765199422836, -0.017094340175390244, -0.033844299614429474, -0.006446606479585171, -0.028847143054008484, -0.03462885692715645, 0.0158428605645895, 0.07367566972970963, 0.0005728924297727644, 0.06488820910453796, 0.013958204537630081, -0.00617822352796793, 0.06768765300512314, 0.016037341207265854, -0.026687102392315865, 0.039261139929294586, 0.006681183818727732, 0.039299145340919495, -0.005480627063661814, -0.004677462857216597, 0.002263728529214859, -0.02160762809216976, -0.00815785862505436, -0.005301570985466242, -0.03525378555059433, 0.027373064309358597, 0.043197404593229294, -0.04774468392133713, -0.030239665880799294, -0.0035048157442361116, 0.05303461104631424, 0.03371727839112282, 0.05243806168437004, -0.021966267377138138, 0.033993180841207504, 0.04553142562508583, 0.05121490731835365, -0.007328971289098263, 0.058244530111551285, 0.01907414384186268, -0.02387423813343048, 0.003917033784091473, 0.05176369100809097, 0.030380617827177048, 0.004594630561769009, 0.022203419357538223, 0.049381472170352936, -0.06467967480421066, -0.04631248116493225, 0.008210621774196625, -0.009936954826116562, -0.009936126880347729, 0.020659606903791428, 0.007747166324406862, -0.043079160153865814, 0.018698664382100105, -0.04557289183139801, -0.02933838777244091, -0.042627546936273575, -0.04469313472509384, -0.03557625040411949, 0.04533996060490608, -0.025198260322213173, -0.052461132407188416, -0.03715487942099571, -0.011255982331931591, 0.01604742370545864, -0.022196149453520775, -0.000026311696274206042, -0.010554761625826359, 0.005340565927326679, 0.0031620461959391832, -0.00381335592828691, 0.010199091397225857, 0.01874397136271, -0.08293966203927994, 0.0371452271938324, -0.005675094202160835, 0.010917534120380878, 0.029484618455171585, -0.0009385189623571932, 0.010175789706408978, -0.04795914515852928, 0.010435717180371284, -0.010620750486850739, -0.036832597106695175, 0.013648506253957748, -0.054393183439970016, -0.012693527154624462, -0.0006007957272231579, 0.0359816774725914, 0.02518950216472149, 0.09262938797473907, 0.0008330395794473588, -0.039649415761232376, 0.03081611543893814, 0.01598166860640049, 0.013918905518949032, 0.03382066637277603, 0.0008558431873098016, 0.012105661444365978, 0.01037740707397461, -0.017129074782133102, -0.02209349535405636, -0.009840143844485283, 0.022538652643561363, 0.005321193020790815, 0.017385289072990417, -0.03773112595081329, -0.01716548390686512, -0.013644995167851448, 0.02310596965253353, -0.013015829026699066, 0.07008165121078491, 0.017955442890524864, 0.0035392800346016884, -0.0067517017014324665, 0.03443419933319092, -0.0210188627243042, -0.015092563815414906, -0.023906132206320763, -0.0498775988817215, -0.008291543461382389, 0.0338156521320343, 0.009591732174158096, 0.03761858493089676, -0.055032502859830856, -0.023601191118359566, -0.09270285815000534, -0.012065940536558628, -0.008548417128622532, 0.010488823987543583, 0.049200352281332016, 0.0037401493173092604, 0.02789296954870224, 0.01703794114291668, -0.014071058481931686, -0.008030609227716923, -0.0225982628762722, 0.02453485131263733, 0.0860007032752037, -0.015393764711916447, -0.011126412078738213, 0.02034885622560978, -0.010722831822931767, -0.007795029319822788, -0.03147722780704498, -0.03317790478467941, -0.020264409482479095, 0.014996208250522614, 0.005106636323034763, 0.03557968512177467, -0.010916792787611485, -0.019585927948355675, -0.016947804018855095, 0.018597694113850594, 0.014110910706222057, 0.025649873539805412, -0.012329863384366035, -0.04044388234615326, -0.007320327218621969, 0.011013328097760677, 0.010501745156943798, 0.036404386162757874, 0.03281141072511673, 0.027703696861863136, 0.01656048744916916, -0.01499518845230341, 0.01876079849898815, 0.03892005607485771, 0.002556494204327464, -0.023995043709874153, 0.044474419206380844, 0.03699369356036186, 0.0019130390137434006, 0.020522188395261765, 0.04989925026893616, 0.04752805083990097, 0.023466527462005615, -0.039836667478084564, 0.008972314186394215, 0.014722791500389576, 0.016568902879953384, 0.010614664293825626, -0.016450554132461548, 0.01704130321741104, -0.015142728574573994, -0.04432200267910957, -0.045641638338565826, 0.001290410989895463 ]
How to train a new language model from scratch using Transformers and Tokenizers
julien-c
February 14, 2020
how-to-train
guide, nlp
https://huggingface.co/blog/how-to-train
TADA! ➡️ Your model has a page on https://huggingface.co/models and everyone can load it using AutoModel.from_pretrained("username/model_name"). If you want to take a look at models in different languages, check https://huggingface.co/models
[ 0.055580127984285355, -0.022484255954623222, 0.025987068191170692, -0.024185150861740112, 0.07237397879362106, 0.06770715862512589, 0.05365786328911781, 0.060510728508234024, -0.05999663472175598, -0.005906953476369381, -0.09811072051525116, 0.040375933051109314, -0.006699665915220976, 0.03351078927516937, -0.010016709566116333, -0.06214548274874687, 0.02247346006333828, -0.019217848777770996, 0.008079318329691887, 0.008390339091420174, -0.012014434672892094, -0.05594554543495178, 0.0374327078461647, -0.032795511186122894, -0.04772522300481796, -0.05408110097050667, 0.06449185311794281, 0.05214574187994003, -0.001518944394774735, -0.0022633038461208344, -0.10365453362464905, -0.017714036628603935, 0.017978327348828316, -0.02675248123705387, -0.011031990870833397, 0.04363469034433365, -0.11972932517528534, 0.03897429257631302, 0.03149927034974098, -0.056941501796245575, -0.03017113357782364, -0.013571077026426792, -0.050435151904821396, 0.08129856735467911, 0.01052361074835062, -0.04983679577708244, -0.21195779740810394, 0.06902433186769485, 0.002813815837725997, -0.02233099937438965, -0.04841519892215729, 0.03250914067029953, -0.005963105708360672, 0.0011788582196459174, 0.015519428066909313, -0.025296496227383614, -0.008466728031635284, -0.05024648830294609, 0.012514655478298664, -0.05251414328813553, 0.08384085446596146, 0.09973005205392838, -0.012006747536361217, 0.038976553827524185, 0.037617407739162445, 0.04261854663491249, -0.008410275913774967, -0.026204301044344902, -0.020332949236035347, -0.03950807824730873, 0.022319506853818893, -0.06047254055738449, 0.0074270605109632015, -0.0702020525932312, -0.012767990119755268, -0.04457942396402359, -0.026906460523605347, 0.03968115150928497, 0.0212537981569767, 0.026017678901553154, 0.03400944173336029, 0.01690889149904251, 0.021458784118294716, 0.08813035488128662, 0.04514097422361374, 0.02181398682296276, 0.011984343640506268, -0.024263951927423477, -0.021319597959518433, 0.0379316546022892, -0.016015736386179924, -0.12072567641735077, -0.010435410775244236, -0.027134830132126808, 0.07200256735086441, -0.03755083307623863, 0.041836757212877274, 0.043537721037864685, 0.003958906512707472, -0.014875402674078941, -0.03572818264365196, -0.03803640231490135, 0.007685176096856594, -0.04858437925577164, -0.029215501621365547, 0.009658647701144218, -0.016338041052222252, -0.08452592045068741, -0.025716429576277733, -0.000338059791829437, 0.0003496856370475143, -0.05244363471865654, -0.007353258319199085, 0.026445744559168816, -0.08233796060085297, 0.04183705896139145, 0.007939240895211697, -0.009459538385272026, 0.03362838551402092, 0.019157271832227707, 0.01527820061892271, 0.0738847553730011, 0.01288150530308485, 0.023206323385238647, 0.06193171814084053, 0.09123778343200684, 0.006296417210251093, 0.02009275183081627, -0.006758866831660271, -0.04094713181257248, 0.04818875715136528, -0.026142871007323265, 0.07820583134889603, 0.03398339822888374, 0.029462438076734543, -0.02786402218043804, -0.0005223847692832351, -0.05597742274403572, 0.05124753341078758, 0.003319242736324668, -0.05338358134031296, 0.047404903918504715, -0.03491323068737984, 0.04662303999066353, 0.0807456448674202, 0.00762891536578536, -0.06978306919336319, 0.04430816322565079, -0.03374949470162392, 0.04450764134526253, -0.07228667289018631, 0.07935048639774323, 0.01963147334754467, -0.04252006486058235, 0.02016509510576725, 0.07125985622406006, -0.035424623638391495, -0.02120276913046837, -0.040163759142160416, -0.042254794389009476, 0.01806892268359661, 0.008296419866383076, -0.049413759261369705, 0.02745446003973484, 0.0057984041050076485, 0.00999805424362421, -0.03062429651618004, 0.015599406324326992, 0.039181046187877655, -0.06649241596460342, 0.022324200719594955, -0.05649816617369652, 0.08115167170763016, -0.027021009474992752, -0.012479259632527828, 0.04844105616211891, 0.04232005402445793, -0.019266286864876747, -0.013762942515313625, -0.0008010903256945312, -0.04514648765325546, 0.05665511265397072, -0.011888319626450539, 0.008883431553840637, 0.05878652259707451, -0.07279325276613235, 0.00858295802026987, -0.007077778223901987, -0.031036529690027237, 0.032708194106817245, -0.05687713995575905, -0.03585932031273842, 0.07007770240306854, -0.030000830069184303, 0.03641095384955406, -0.08281231671571732, -0.033019423484802246, 0.10126926004886627, 0.007939383387565613, 0.061642710119485855, 0.05547904223203659, -0.020691771060228348, 0.027902482077479362, -0.04995262622833252, -0.01572035253047943, 0.020323676988482475, 0.03707461059093475, -0.05970838665962219, 0.050267137587070465, 0.005692680831998587, 0.03395845368504524, -0.10745789855718613, 0.0601051039993763, -0.0675077810883522, 0.00800949428230524, -0.04385923221707344, -0.037418682128190994, 0.02666889876127243, -0.027980102226138115, 0.0037768955808132887, 0.2113065868616104, -0.01474994421005249, -0.01840846985578537, -0.03741292655467987, -0.06158322095870972, 0.09186708927154541, 0.054850831627845764, 0.06974774599075317, 0.08323350548744202, -0.09796738624572754, -0.050297219306230545, -0.054528627544641495, 0.0009923620382323861, 0.056403059512376785, 0.010048113763332367, -0.013408861123025417, 0.022342054173350334, -0.04508616402745247, 0.009079765528440475, 0.02251031994819641, 0.015077593736350536, -0.020500678569078445, 0.03286368399858475, 0.023810280486941338, -0.03159109875559807, -0.029273033142089844, 0.014775988645851612, 0.034954607486724854, -0.09491167962551117, -0.0028769292403012514, -0.011676423251628876, 0.012593183666467667, 0.02352290041744709, -0.023815665394067764, 0.029546238481998444, 0.008758916519582272, -0.019049247726798058, 0.004918656311929226, -0.02938043512403965, 0.09641057997941971, 0.03748982027173042, -0.004728557541966438, -0.052684567868709564, -0.02502545155584812, -0.04981790482997894, -0.02640705555677414, -0.007071193773299456, 0.0041029625572264194, 0.036002252250909805, 0.0015615127049386501, 0.02219543233513832, -0.016320522874593735, 0.014135378412902355, 0.027817776426672935, 0.016902411356568336, 0.05183292552828789, 0.025578202679753304, -0.011244517751038074, -0.007637319155037403, -0.0023751212283968925, -0.0008128124172799289, -0.014870170503854752, 0.03313954174518585, 0.03238474205136299, 0.015242730267345905, -0.030238591134548187, -0.011392750777304173, -0.03204408288002014, -0.040784865617752075, 0.03183905780315399, 0.015266705304384232, 0.04628869518637657, 0.005463412497192621, -0.016849450767040253, 0.0036920299753546715, -0.027500363066792488, 0.053507573902606964, -0.0032818003091961145, 0.028338881209492683, 0.060032084584236145, -0.011096439324319363, 0.002667309483513236, 0.007949474267661572, 0.0036206599324941635, -0.008020433597266674, 0.036043282598257065, 0.00730204489082098, 0.01035055797547102, -0.12457463890314102, -0.015341944061219692, 0.021182846277952194, -0.00418068515136838, 0.0008095763041637838, -0.015390451066195965, 0.021608686074614525, -0.0001680077548371628, -0.011021028272807598, 0.016418620944023132, -0.018917443230748177, 0.002601063810288906, 0.05305757746100426, 0.003004322526976466, -0.042401425540447235, -0.0029313478153198957, -0.011788091622292995, 0.022369371727108955, 0.045550260692834854, 0.006815973203629255, -0.03896030783653259, 0.02968086116015911, -0.003742009634152055, 0.007507619448006153, -0.018132423982024193, 0.008949818089604378, 0.01830228604376316, 0.005591969937086105, 0.032109335064888, -0.029832182452082634, -0.011455104686319828, -0.005461474414914846, -0.04058508574962616, 0.024488726630806923, -0.024041613563895226, 0.01068928837776184, -0.017934799194335938, -0.003374987281858921, 0.012522054836153984, 0.02496560476720333, -0.020045248791575432, -0.013620087876915932, 0.015119579620659351, -0.010439681820571423, -0.01140559371560812, -0.009212741628289223, -0.015154310502111912, 0.0243149995803833, 0.03247072547674179, -0.02053919993340969, -0.021653415635228157, -0.008547194302082062, 0.0398067869246006, 0.06032633036375046, 0.012740874662995338, -0.025207825005054474, 0.024640394374728203, 0.03526639565825462, 0.017747845500707626, -0.0033101586159318686, -0.0407530702650547, 0.004365116357803345, -0.01632457785308361, -0.046342168003320694, -0.06230326369404793, 0.034398358315229416, -0.0039442796260118484, 0.023258347064256668, -0.02118108980357647, 0.0566694512963295, -0.025120696052908897, 0.02321016974747181, -0.003770145820453763, 0.01960155740380287, -0.021997325122356415, 0.002556271618232131, -0.01819363608956337, -0.04075842350721359, 0.06523463875055313, 0.007998757995665073, -0.01722203753888607, -0.0016519187483936548, -0.03481971472501755, -0.03133136406540871, -0.0047397431917488575, -0.015413357876241207, 0.044217005372047424, 0.0010091050062328577, 0.029466785490512848, 0.04459509626030922, -0.007593173533678055, 0.006236230954527855, 0.03999530151486397, -0.005604865960776806, 0.00010735285468399525, 0.0107987429946661, 0.021098732948303223, 0.0003611113061197102, -0.008246975019574165, 0.0015705630648881197, 0.05922476947307587, -0.013615641742944717, -0.04731089621782303, 0.030867012217640877, 0.009059177711606026, 0.04613114520907402, -0.03939606249332428, -0.07658933848142624, 0.029280371963977814, -0.03548477590084076, -0.014987443573772907, -0.047611117362976074, 0.0018047037301585078, -0.025797339156270027, 0.022217677906155586, 0.04343115910887718, -0.02682306244969368, -0.0008054643403738737, -0.044998809695243835, 0.019917206838726997, -0.04564056918025017, 0.011198612861335278, -0.002325050998479128, -0.02997811883687973, 0.01680830307304859, -0.007802486885339022, 0.02904200181365013, 0.016595566645264626, -0.010708202607929707, -0.026870636269450188, -0.05083877965807915, -0.013474496081471443, 0.01937403902411461, 0.004353940486907959, 0.008275359869003296, 0.0070509216748178005, -0.006351381074637175, 0.01898699440062046, 0.028193071484565735, -0.03991500288248062, -0.01702756993472576, -0.020076515153050423, 0.03277392312884331, -0.009096878580749035, 0.044581979513168335, 0.009112930856645107, -0.05094912648200989, 0.005033099092543125, -0.03971412405371666, 0.005664479453116655, 0.03256098926067352, 0.0022310512140393257, -0.05034933239221573, 0.050811588764190674, 0.034200720489025116, 0.0059630172327160835, -0.013676517643034458, 0.038555797189474106, 0.0022453523706644773, 0.04043162241578102, -0.040377177298069, -0.01035419199615717, -0.0076955645345151424, 0.042309194803237915, -0.00701354444026947, 0.01707819104194641, -0.022125568240880966, -0.07046012580394745, -0.02251209132373333, 0.016367945820093155, -0.010796116665005684, -0.01378512941300869, 0.0032159551046788692, -0.02534753829240799, -0.0068314871750772, 0.03326037898659706, 0.04801846668124199, 0.013918492943048477, 0.000893369666300714, 0.019171059131622314, -0.03513607010245323, 0.026508033275604248, 0.02278710901737213, -0.016245370730757713, -0.017357567325234413, 0.019359098747372627, 0.03829338401556015, 0.06363868713378906, 0.023010211065411568, 0.01975199766457081, -0.009461045265197754, 0.001029900275170803, 0.013382546603679657, -0.03541911393404007, -0.005110403522849083, -0.01380250882357359, 0.0335705541074276, 0.01343412697315216, -0.01194815058261156, -0.019774457439780235, 0.015219707041978836, 0.05791494622826576, -0.034362953156232834, -0.024937670677900314, 0.02884729579091072, 0.010541127994656563, 0.005233748350292444, -0.01579921878874302, 0.035017985850572586, -0.023377712815999985, -0.016919255256652832, -0.02259961888194084, 0.013486679643392563, -0.019481807947158813, 0.0021077534183859825, -0.026020580902695656, -0.0321766696870327, 0.029144998639822006, 0.03073280118405819, 0.05403772369027138, 0.009714186191558838, -0.014468871057033539, -0.03887540102005005, -0.004436985123902559, 0.04480826109647751, -0.05094096437096596, 0.013535810634493828, 0.036572206765413284, -0.0004902526852674782, 0.022381916642189026, 0.019366832450032234, -0.0010994084877893329, 0.013595652766525745, 0.0011497177183628082, 0.02532847598195076, -0.006009179167449474, -0.048900362104177475, 0.008976849727332592, 0.01828630268573761, -0.00827043317258358, 0.024235712364315987, -0.036167409271001816, -0.0362832173705101, 0.0019339644350111485, -0.04108280688524246, 0.032701414078474045, 0.06401196122169495, -0.007791673298925161, 0.030034396797418594, 0.029272980988025665, 0.015935132279992104, 0.009260154329240322, -0.017908379435539246, 0.004447776824235916, 0.008434268645942211, 0.023096684366464615, -0.025836912915110588, 0.0199739933013916, 0.007781088352203369, 0.00361558236181736, 0.03338320553302765, -0.04965750128030777, -0.01714344695210457, 0.019731929525732994, -0.0032896443735808134, 0.011079364456236362, -0.013311251066625118, -0.03201541304588318, -0.012741854414343834, 0.02793612889945507, 0.01091515552252531, 0.03538339212536812, 0.003260569414123893, -0.007068524602800608, 0.0003553453425411135, -0.022079624235630035, 0.01583268493413925, 0.05904991179704666, -0.029070647433400154, 0.07075410336256027, 0.005469988565891981, 0.011086462996900082, 0.017359500750899315, 0.014738389290869236, 0.014195806346833706, -0.01037860382348299, 0.053625818341970444, 0.017837313935160637, 0.04285522177815437, 0.02622409723699093, 0.012041108682751656, -0.027069509029388428, -0.029465971514582634, -0.005210562609136105, -0.00881681963801384, 0.03663061931729317, 0.02296878769993782, -0.024137424305081367, 0.04198051244020462, -0.0440865084528923, 0.04411407187581062, 0.016729213297367096, 0.05130300670862198, -0.010488904081285, 0.006682913284748793, 0.0323854461312294, 0.004603451583534479, 0.012899115681648254, 0.04683876037597656, 0.011801889166235924, -0.004494285210967064, 0.030395863577723503, 0.012239867821335793, 0.015654170885682106, -0.02520875632762909, 0.01350746676325798, 0.035910338163375854, -0.03514387458562851, -0.038412127643823624, 0.0019336299737915397, 0.005203393753618002, -0.01738686114549637, -0.03486540541052818, 0.014298493973910809, -0.04193289950489998, -0.012932423502206802, -0.018498407676815987, 0.019066449254751205, 0.0018109750235453248, -0.017288167029619217, 0.01613539643585682, 0.03379521146416664, 0.03057088330388069, -0.013225767761468887, 0.00849623791873455, 0.01977440156042576, 0.02778312750160694, 0.009782228618860245, 0.010443524457514286, -0.030727054923772812, -0.03903624415397644, -0.03542884439229965, -0.02637162245810032, 0.012947977520525455, 0.0039957198314368725, 0.012241571210324764, 0.015849245712161064, 0.0351872518658638, 0.0054069035686552525, 0.03135156258940697, 0.02321789599955082, -0.009229831397533417, -0.017646627500653267, 0.009129388257861137, -0.0303359255194664, -0.015114122070372105, -0.03320399671792984, -0.03768877685070038, 0.02720329724252224, -0.027906635776162148, -0.007407524157315493, 0.04452349990606308, 0.013565254397690296, -0.032867755740880966, -0.05055167153477669, 0.02094007283449173, -0.03044528141617775, -0.040197305381298065, 0.05868469178676605, 0.009444449096918106, -0.0180825088173151, 0.022364582866430283, -0.0004811922262888402, 0.0026540348771959543, -0.020001275464892387, 0.00020542995480354875, 0.023683536797761917, -0.02577192708849907, -0.010965126566588879, -0.02076292224228382, 0.06499750912189484, 0.017039891332387924, 0.03949524089694023, 0.05141620710492134, 0.01893201842904091, -0.01907898671925068, -0.02334984764456749, 0.02407427690923214, -0.04080517590045929, 0.022022560238838196, -0.02252466045320034, -0.0555567629635334, -0.028935506939888, -0.023180488497018814, -0.013906608335673809, -0.03703926131129265, -0.05326545238494873, -0.03482339531183243, -0.023619072511792183, -0.012294427491724491, -0.030146636068820953, 0.027223801240324974, 0.0656748116016388, 0.013351388275623322, -0.0016668782336637378, 0.029925039038062096, 0.012301581911742687, 0.01866094022989273, -0.022933736443519592, 0.005667242221534252, 0.03214435279369354, 0.024876412004232407, -0.003671275684610009, 0.0020938809029757977, 0.037975214421749115, -0.004600947257131338, -0.06034156307578087, 0.0068686953745782375, 0.015013528987765312, 0.011371933855116367, -0.04598436504602432, -0.025457095354795456, 0.009782591834664345, -0.014543539844453335, 0.048847347497940063, -0.004824032075703144, -0.012173631228506565, -0.02689260058104992, 0.03732660040259361, -0.055992912501096725, 0.017514429986476898, -0.023371636867523193, 0.025307191535830498, 0.06443489342927933, 0.006903537083417177, 0.017893247306346893, 0.01708579622209072, -0.018234029412269592, 0.005068272352218628, 0.022656099870800972, -0.029021091759204865, -0.030393363907933235, -0.007195151876658201, 0.006126766093075275, -0.015020601451396942, -0.03606467694044113, 0.006870255805552006, -0.00010006162483477965, -0.0461251363158226, -0.022061757743358612, 0.0033613136038184166, 0.009626805782318115, 0.0008275542641058564, -0.0023174327798187733, -0.008703866973519325, 0.05524864420294762, 0.01121719554066658, -0.025739923119544983, -0.03285115212202072, 0.028806038200855255 ]
How to train a new language model from scratch using Transformers and Tokenizers
julien-c
February 14, 2020
how-to-train
guide, nlp
https://huggingface.co/blog/how-to-train
3. Train a language model from scratch Update: The associated Colab notebook uses our new Trainer directly, instead of through a script. Feel free to pick the approach you like best. We will now train our language model using the run_language_modeling.py script from transformers (newly renamed from run_lm_finetuning.py as it now supports training from scratch more seamlessly). Just remember to leave --model_name_or_path to None to train from scratch vs. from an existing model or checkpoint. > We’ll train a RoBERTa-like model, which is a BERT-like with a couple of changes (check the documentation for more details). As the model is BERT-like, we’ll train it on a task of Masked language modeling, i.e. the predict how to fill arbitrary tokens that we randomly mask in the dataset. This is taken care of by the example script. We just need to do two things: - implement a simple subclass of Dataset that loads data from our text files - Depending on your use case, you might not even need to write your own subclass of Dataset, if one of the provided examples (TextDataset and LineByLineTextDataset) works – but there are lots of custom tweaks that you might want to add based on what your corpus looks like. - Choose and experiment with different sets of hyperparameters. Here’s a simple version of our EsperantoDataset. python from torch.utils.data import Dataset class EsperantoDataset(Dataset): def __init__(self, evaluate: bool = False): tokenizer = ByteLevelBPETokenizer( "./models/EsperBERTo-small/vocab.json", "./models/EsperBERTo-small/merges.txt", ) tokenizer._tokenizer.post_processor = BertProcessing( ("</s>", tokenizer.token_to_id("</s>")), ("<s>", tokenizer.token_to_id("<s>")), ) tokenizer.enable_truncation(max_length=512) # or use the RobertaTokenizer from `transformers` directly. self.examples = [] src_files = Path("./data/").glob("*-eval.txt") if evaluate else Path("./data/").glob("*-train.txt") for src_file in src_files: print("🔥", src_file) lines = src_file.read_text(encoding="utf-8").splitlines() self.examples += [x.ids for x in tokenizer.encode_batch(lines)] def __len__(self): return len(self.examples) def __getitem__(self, i): # We’ll pad at the batch level. return torch.tensor(self.examples[i]) If your dataset is very large, you can opt to load and tokenize examples on the fly, rather than as a preprocessing step. Here is one specific set of hyper-parameters and arguments we pass to the script: --output_dir ./models/EsperBERTo-small-v1 --model_type roberta --mlm --config_name ./models/EsperBERTo-small --tokenizer_name ./models/EsperBERTo-small --do_train --do_eval --learning_rate 1e-4 --num_train_epochs 5 --save_total_limit 2 --save_steps 2000 --per_gpu_train_batch_size 16 --evaluate_during_training --seed 42 As usual, pick the largest batch size you can fit on your GPU(s). 🔥🔥🔥 Let’s start training!! 🔥🔥🔥 Here you can check our Tensorboard for one particular set of hyper-parameters: > Our example scripts log into the Tensorboard format by default, under runs/. Then to view your board just run tensorboard dev upload --logdir runs – this will set up tensorboard.dev, a Google-managed hosted version that lets you share your ML experiment with anyone.
[ 0.031237203627824783, -0.037789493799209595, -0.04114155471324921, 0.037951283156871796, 0.006213490851223469, 0.0643656924366951, 0.011316786520183086, 0.030382582917809486, 0.01253008283674717, 0.0035449606366455555, -0.07934226095676422, 0.055028147995471954, 0.0010401627514511347, 0.07660318911075592, 0.033848632127046585, -0.033169809728860855, 0.04311578348278999, 0.0016742992447689176, 0.014681546948850155, 0.017206933349370956, -0.028571924194693565, -0.0280024204403162, 0.07385149598121643, 0.01173677109181881, 0.02944355644285679, -0.05556053668260574, 0.04933551698923111, 0.010783634148538113, -0.035837266594171524, 0.030267857015132904, -0.11259040236473083, 0.016223004087805748, 0.0022370663937181234, 0.00702663604170084, -0.0359736792743206, 0.04762088507413864, -0.03727484866976738, 0.007985271513462067, 0.03629319369792938, 0.0020756146404892206, -0.04165968298912048, 0.03587576374411583, 0.00960609782487154, 0.08795956522226334, -0.03846601024270058, -0.023027140647172928, -0.1658138632774353, 0.07169082015752792, -0.03738590329885483, -0.08062146604061127, -0.04484798014163971, 0.07985518127679825, 0.02384115755558014, -0.015995074063539505, -0.025943731889128685, 0.0020365193486213684, 0.03846295550465584, -0.09239078313112259, 0.006803237367421389, 0.007657210808247328, 0.026035765185952187, 0.015107673592865467, 0.003886716440320015, -0.006025414913892746, 0.01610676571726799, 0.004625596571713686, -0.05116524174809456, 0.018506495282053947, -0.06006926670670509, -0.03208431974053383, -0.011563954874873161, -0.03608326241374016, -0.05268193036317825, -0.0323462076485157, -0.014228139072656631, -0.04915250837802887, -0.018323708325624466, 0.019333533942699432, 0.031080661341547966, 0.059192076325416565, 0.004570998717099428, 0.005773273762315512, 0.03709358349442482, 0.029649734497070312, 0.07773183286190033, 0.03749944269657135, 0.022610820829868317, -0.02824086882174015, -0.053128696978092194, 0.042178984731435776, -0.026716038584709167, -0.10894149541854858, -0.025545280426740646, 0.011436398141086102, 0.1022963747382164, -0.008812857791781425, -0.0338984876871109, 0.03492743894457817, -0.01948687620460987, -0.06111718341708183, -0.016435809433460236, -0.08536256849765778, -0.016212843358516693, -0.0343475304543972, -0.0839521735906601, 0.05992020294070244, -0.008972449228167534, -0.0024008508771657944, -0.010179723612964153, -0.01691557466983795, 0.016980649903416634, -0.05706898495554924, -0.05367189645767212, 0.10499662905931473, -0.12311018258333206, -0.010906994342803955, 0.02209329791367054, 0.031062036752700806, -0.03568444028496742, 0.02279643528163433, -0.017154550179839134, 0.044116947799921036, 0.06329550594091415, 0.0023472777102142572, -0.04177117720246315, 0.09606767445802689, -0.024590739980340004, 0.035273477435112, 0.031809404492378235, 0.00908801518380642, 0.06284056603908539, -0.030553093180060387, 0.07347062230110168, -0.0015214629238471389, 0.022303521633148193, 0.014879402704536915, 0.03723016753792763, -0.033867061138153076, 0.01587236486375332, 0.024100402370095253, -0.040910352021455765, 0.07883943617343903, -0.06674908101558685, 0.0251588337123394, 0.03323596715927124, -0.012378118000924587, -0.07588613778352737, 0.10293890535831451, 0.016043297946453094, 0.04866733402013779, -0.10023130476474762, 0.05105360597372055, -0.012603795155882835, -0.04094782471656799, 0.032846324145793915, 0.06799205392599106, -0.06970395147800446, -0.010138402692973614, -0.0461445227265358, -0.02146236225962639, -0.01198427565395832, 0.054070714861154556, -0.09199400991201401, -0.010107486508786678, 0.01605912484228611, -0.03339741379022598, -0.007284615654498339, 0.07442121207714081, 0.03056117706000805, 0.060632042586803436, 0.0679776668548584, -0.007874567061662674, 0.07312066107988358, 0.01614762656390667, 0.018997879698872566, 0.007760696113109589, 0.024970991536974907, 0.029914861544966698, 0.015025590546429157, 0.0037163018714636564, -0.04639919474720955, 0.037859413772821426, 0.005766001529991627, 0.04382077232003212, 0.019884498789906502, -0.06891394406557083, 0.008877668529748917, -0.05467435345053673, -0.0001555156341055408, 0.039196450263261795, 0.014907380566000938, 0.013387355022132397, 0.08214227110147476, -0.0185121838003397, 0.07262511551380157, -0.06950938701629639, 0.015555479563772678, 0.07990362495183945, 0.019830793142318726, 0.0677834078669548, 0.04517947882413864, -0.01612946204841137, -0.00289649935439229, -0.014953237026929855, 0.04626123607158661, -0.01662672869861126, 0.03705079108476639, -0.0725356936454773, 0.04141750931739807, -0.009248758666217327, -0.0194497499614954, -0.0685003250837326, 0.04597487300634384, -0.048911742866039276, 0.01310016680508852, -0.053363390266895294, -0.02549506537616253, 0.01628562994301319, 0.03503917157649994, 0.004593502730131149, 0.16617567837238312, -0.09452113509178162, -0.0028528966940939426, -0.023052917793393135, -0.047143448144197464, 0.02469358593225479, 0.0519067719578743, 0.04020104557275772, 0.08742327988147736, -0.05799887329339981, -0.05100012198090553, -0.09860319644212723, 0.0462314747273922, 0.022393472492694855, -0.06529254466295242, -0.02296573854982853, -0.026962952688336372, 0.006857771426439285, -0.02560182847082615, -0.017956571653485298, 0.016711806878447533, -0.023660430684685707, -0.04149841144680977, 0.015489715151488781, -0.013433939777314663, 0.04638976231217384, 0.07931686192750931, 0.02235409803688526, 0.021454203873872757, 0.01205788180232048, -0.017282739281654358, 0.02557210437953472, -0.009407788515090942, -0.03876395523548126, -0.002939980011433363, 0.0589151494204998, 0.01053844764828682, 0.00022241874830797315, 0.0033941648434847593, 0.04692979156970978, -0.02017349749803543, -0.025008825585246086, -0.05203080177307129, -0.01282286923378706, -0.004646813031286001, -0.05748908966779709, -0.008611193858087063, 0.011420968919992447, -0.010659400373697281, -0.006059540435671806, 0.01585518755018711, -0.0228602085262537, 0.01606624759733677, 0.028968671336770058, 0.007785093504935503, 0.07507412880659103, 0.009216883219778538, -0.03624489903450012, -0.054304324090480804, -0.027835138142108917, -0.008750868029892445, -0.024680236354470253, 0.025068385526537895, 0.047902245074510574, -0.0031214815098792315, 0.019989319145679474, -0.02582598105072975, -0.031319085508584976, 0.01187230460345745, 0.03971346840262413, -0.018936732783913612, 0.03560865297913551, -0.008715745992958546, -0.027289418503642082, -0.027684127911925316, 0.0028103620279580355, 0.009777022525668144, -0.015351745299994946, 0.014413568191230297, 0.017333997413516045, -0.0527954064309597, 0.015099906362593174, -0.002516264794394374, -0.011239519342780113, -0.013332154601812363, 0.0006814123480580747, 0.04878261685371399, 0.01650824397802353, -0.08447958528995514, -0.010502220131456852, 0.007312154397368431, 0.0011075285729020834, 0.014907428994774818, -0.04176982492208481, 0.009231938049197197, -0.01460573635995388, -0.07299422472715378, 0.010357308201491833, -0.009027141146361828, 0.01848718523979187, 0.008305304683744907, 0.019004909321665764, -0.019370002672076225, -0.02429467812180519, -0.04890250787138939, 0.0006978926830925047, 0.006416009273380041, 0.03116871789097786, -0.04556471109390259, 0.02335226535797119, -0.0022778394632041454, 0.033385492861270905, -0.0011242559412494302, 0.007224253378808498, -0.003229799447581172, 0.04612145200371742, 0.011637981049716473, 0.01044072862714529, -0.02446599490940571, -0.016692154109477997, 0.02046143263578415, 0.02136237360537052, -0.03841172903776169, 0.02074519731104374, 0.029204513877630234, 0.044169869273900986, -0.031331028789281845, 0.03425484895706177, -0.0163374375551939, -0.006224543321877718, -0.004365164320915937, -0.0422603040933609, 0.009416217915713787, -0.022473683580756187, -0.022510461509227753, -0.03502795100212097, -0.0013423068448901176, -0.040535613894462585, -0.009374438785016537, 0.004251355770975351, 0.014568120241165161, 0.0514490082859993, 0.01886366680264473, 0.013860736973583698, 0.011143778450787067, 0.03130296245217323, 0.0384470634162426, 0.0017091938061639667, -0.019672244787216187, 0.014433835633099079, -0.039849184453487396, -0.016197901219129562, -0.035359591245651245, 0.03767550364136696, 0.03510291501879692, -0.0008516747620888054, -0.028725698590278625, 0.00984185840934515, -0.01286937203258276, 0.05505182966589928, 0.005527185741811991, 0.0003423857851885259, -0.0072959186509251595, -0.0071973358280956745, -0.027096837759017944, -0.007702578324824572, 0.046263083815574646, 0.02323784865438938, -0.02184555120766163, -0.0017149785999208689, -0.045032888650894165, -0.01697678677737713, 0.00017989570915233344, -0.028785133734345436, -0.013224538415670395, -0.07106699794530869, 0.00004151183748035692, 0.0286378413438797, 0.012805641628801823, -0.008193514309823513, -0.004774169530719519, 0.007979865185916424, 0.0021867260802537203, -0.00406134407967329, -0.014618724584579468, -0.014188981615006924, -0.008692066185176373, -0.016790302470326424, 0.030328337103128433, -0.054589029401540756, 0.02005789987742901, 0.02334294281899929, 0.025344235822558403, 0.05512421205639839, -0.043534018099308014, -0.02507672645151615, -0.005038432311266661, -0.026669399812817574, 0.019433334469795227, 0.045005522668361664, 0.0028950993437319994, 0.018126757815480232, 0.042043287307024, 0.05142057314515114, -0.00904057640582323, -0.024486592039465904, 0.02112908661365509, 0.012483257800340652, -0.04039432853460312, -0.017155803740024567, 0.010903139598667622, 0.0033504869788885117, 0.023594200611114502, -0.022052621468901634, 0.04092495143413544, 0.056545134633779526, -0.014146916568279266, 0.004917223937809467, -0.04320447891950607, -0.04509343206882477, 0.007757829502224922, 0.009079616516828537, 0.015221641398966312, 0.013742746785283089, -0.014063708484172821, -0.012787922285497189, -0.016469353809952736, -0.028999654576182365, -0.04793568328022957, -0.018624484539031982, 0.042989976704120636, -0.04593752324581146, 0.01866304688155651, -0.00046305227442644536, -0.011271627619862556, -0.028663456439971924, -0.004050613380968571, -0.0051058209501206875, 0.039325911551713943, 0.017778584733605385, -0.03579993173480034, 0.00533407274633646, 0.02489531971514225, -0.014838027767837048, 0.009035410359501839, 0.06216372177004814, 0.027681756764650345, 0.05658210813999176, 0.010409326292574406, 0.03143703565001488, -0.016016816720366478, 0.03487003967165947, 0.035921890288591385, -0.010855374857783318, -0.00782802328467369, -0.06755886971950531, 0.011308628134429455, 0.014598493464291096, 0.0005873374757356942, 0.011222912929952145, 0.03273656964302063, -0.024498332291841507, 0.03227541595697403, 0.05042770504951477, 0.03576282784342766, 0.01019694097340107, -0.07168033719062805, 0.016171330586075783, -0.014438658021390438, -0.011361366137862206, -0.0007398112793453038, 0.01935344561934471, -0.004909079521894455, 0.0329011008143425, 0.047624558210372925, 0.04343258962035179, 0.009408070705831051, 0.009209495969116688, -0.011559093371033669, -0.01932082138955593, 0.01571866124868393, -0.03802035376429558, 0.017249228432774544, -0.017554106190800667, -0.06129438802599907, 0.02583332546055317, -0.04252387955784798, -0.012221267446875572, 0.0026529678143560886, 0.022724833339452744, -0.02707306295633316, -0.005261264741420746, 0.07458116859197617, -0.0020008310675621033, -0.04546637460589409, -0.025276565924286842, -0.004593859892338514, -0.024715008214116096, -0.008700492791831493, -0.01890914887189865, 0.0007085484685376287, -0.008339053951203823, -0.0290216077119112, -0.011541672050952911, 0.013150024227797985, -0.008765306323766708, 0.026031138375401497, 0.04976004362106323, -0.009546888992190361, -0.013524270616471767, -0.030677059665322304, -0.012830947525799274, 0.033780574798583984, -0.042772550135850906, 0.014550727792084217, 0.06275449693202972, 0.0013236482627689838, 0.018951846286654472, 0.054501648992300034, 0.004727655090391636, 0.017028531059622765, 0.055192917585372925, -0.024792831391096115, -0.07006710022687912, -0.030635742470622063, 0.0237803403288126, 0.04216876998543739, -0.035698212683200836, -0.019069921225309372, -0.031078200787305832, -0.023366011679172516, -0.0013757447013631463, -0.04181967303156853, 0.03251035138964653, 0.047667380422353745, 0.0007161860121414065, 0.050746481865644455, 0.0188148096203804, -0.0005410159355960786, 0.0005110892234370112, -0.021955307573080063, 0.01911822520196438, 0.028601480647921562, 0.008223148062825203, 0.021924512460827827, -0.0017846187110990286, 0.004433714784681797, 0.011606375686824322, 0.02731945365667343, -0.07858648896217346, 0.03507135808467865, 0.047355230897665024, -0.03134870529174805, 0.004710305016487837, 0.015792736783623695, -0.041018255054950714, -0.025261135771870613, -0.003543868660926819, 0.05787060782313347, 0.01643259823322296, -0.038410257548093796, -0.0007263626903295517, 0.00489283911883831, -0.04129472374916077, 0.0046501378528773785, 0.053469885140657425, -0.03925113007426262, 0.0730295181274414, 0.019107280299067497, -0.015047864988446236, 0.02261737920343876, 0.015902288258075714, -0.004486143589019775, -0.0056107621639966965, 0.040935974568128586, 0.052593689411878586, -0.011815664358437061, 0.010903416201472282, -0.026561494916677475, -0.020132800564169884, -0.03605842590332031, -0.015846865251660347, -0.032815854996442795, -0.010145445354282856, 0.0639529898762703, -0.014056584797799587, -0.029319195076823235, 0.02225944586098194, 0.04842614009976387, 0.058530405163764954, 0.04892057925462723, -0.018202707171440125, 0.048735361546278, 0.046245161443948746, 0.016304289922118187, -0.0016286992467939854, 0.04000835120677948, 0.0014979841653257608, 0.00477225286886096, 0.04351799935102463, 0.03981402888894081, 0.01352537702769041, 0.04177330434322357, 0.0012777450028806925, 0.023489590734243393, -0.019581900909543037, -0.03893400728702545, 0.020771050825715065, -0.002056465018540621, -0.007844050414860249, -0.012620826251804829, 0.007815548218786716, -0.04300650954246521, -0.0012568967649713159, -0.02344839833676815, -0.02900680899620056, -0.031309448182582855, -0.027563897892832756, -0.028392469510436058, 0.019146401435136795, 0.012922218069434166, -0.041718535125255585, -0.002829723758623004, -0.027383003383874893, -0.027066567912697792, -0.011815905570983887, -0.016762910410761833, -0.028563588857650757, -0.024920813739299774, -0.03597060963511467, -0.03802233934402466, 0.0008620754815638065, -0.02591511234641075, -0.030721573159098625, -0.024596303701400757, 0.0015620611375197768, -0.026530183851718903, 0.016276096925139427, 0.008791433647274971, 0.009208871982991695, -0.02771843411028385, 0.01336628757417202, -0.01274939626455307, -0.05581801012158394, 0.0524318628013134, -0.055532392114400864, 0.004958357661962509, 0.0030786858405917883, 0.0353177934885025, 0.03678376227617264, 0.0594167523086071, 0.006846324075013399, -0.05825873464345932, 0.009073515422642231, 0.0283212810754776, -0.047075141221284866, 0.04497300833463669, 0.013260932639241219, 0.024646399542689323, 0.004628293216228485, -0.01647757552564144, -0.0037733360659331083, -0.007995454594492912, -0.018471544608473778, 0.037279415875673294, 0.015149736776947975, -0.041653405874967575, -0.013089941814541817, 0.0208510160446167, -0.00010020494664786384, -0.008500187657773495, 0.05299593135714531, -0.018274011090397835, 0.00699451332911849, -0.019909020513296127, 0.05134199187159538, -0.030054718255996704, -0.0028910476248711348, -0.03935556858778, -0.062134671956300735, -0.0341356135904789, -0.022619785740971565, -0.03080088458955288, 0.03331691026687622, -0.03330347314476967, -0.027048306539654732, -0.06302658468484879, -0.016575144603848457, 0.0000781478374847211, 0.017028972506523132, 0.049993276596069336, 0.026297202333807945, 0.003118139458820224, 0.02758674882352352, -0.021438954398036003, 0.031095169484615326, -0.01528092473745346, -0.014552854001522064, 0.07075881958007812, 0.022975625470280647, -0.009164029732346535, 0.02231595851480961, -0.005913932342082262, 0.004459037445485592, -0.020550992339849472, -0.02034052275121212, -0.03516080230474472, 0.009680300951004028, -0.024326033890247345, 0.02924797683954239, 0.027674149721860886, -0.032468874007463455, -0.0023629621136933565, 0.033550649881362915, -0.011024581268429756, 0.004044988192617893, 0.019873814657330513, -0.06282096356153488, -0.03351442515850067, -0.024288881570100784, -0.045913033187389374, 0.013780687935650349, 0.00460267998278141, 0.0507018119096756, -0.006236565299332142, -0.037597570568323135, -0.00886413361877203, 0.024103641510009766, -0.01820063591003418, -0.029655950143933296, 0.0008996182004921138, 0.024877769872546196, -0.02111496403813362, 0.010605131275951862, 0.03113250434398651, 0.04160277917981148, 0.022973569110035896, -0.014221169985830784, 0.01710015907883644, 0.029606720432639122, 0.0012027384946122766, 0.010665079578757286, -0.021193983033299446, 0.033391647040843964, 0.007115074899047613, -0.002308268565684557, -0.02332119643688202, 0.031201617792248726 ]
How to train a new language model from scratch using Transformers and Tokenizers
julien-c
February 14, 2020
how-to-train
guide, nlp
https://huggingface.co/blog/how-to-train
Thank you!
[ 0.03582184761762619, 0.014917245134711266, 0.1064121276140213, 0.013955991715192795, 0.1340298056602478, 0.042345672845840454, 0.030655426904559135, 0.04903286695480347, -0.032038137316703796, -0.09784821420907974, -0.02339094690978527, 0.03995697572827339, -0.01871742494404316, 0.0024023670703172684, 0.0006893304525874555, 0.0617804229259491, 0.0417938306927681, -0.004533983767032623, 0.01230056956410408, 0.008676229976117611, -0.01241267193108797, -0.040559038519859314, 0.06075572595000267, 0.01683993451297283, 0.005108661018311977, -0.014932291582226753, 0.012357850559055805, -0.014096085913479328, -0.055145129561424255, 0.0543329231441021, -0.008427169173955917, 0.004302592948079109, 0.059741899371147156, -0.008708610199391842, -0.009945407509803772, 0.003799373283982277, -0.06482046097517014, -0.003476005280390382, -0.05609647557139397, -0.04729646071791649, 0.004935006145387888, -0.06463637202978134, -0.007793728727847338, 0.042337629944086075, -0.03129434213042259, -0.0009785478468984365, -0.29562750458717346, 0.07023068517446518, -0.025315143167972565, -0.001674689119681716, -0.02686641737818718, 0.006284052040427923, 0.014243711717426777, -0.009904075413942337, 0.04243120178580284, 0.012484178878366947, 0.029250983148813248, -0.050916437059640884, -0.014655322767794132, -0.08483218401670456, 0.07239583134651184, -0.009143790230154991, 0.0034283034037798643, 0.00941845215857029, 0.041007183492183685, 0.06301959604024887, -0.005770291667431593, 0.05021220073103905, -0.034143559634685516, -0.011885539628565311, 0.03500832989811897, -0.026511922478675842, -0.02473149076104164, -0.02385031059384346, 0.06414429843425751, -0.047303829342126846, -0.06465610861778259, 0.02507847175002098, 0.06394754350185394, 0.08407402783632278, -0.017913062125444412, -0.014791185967624187, 0.10802043974399567, 0.09417229890823364, 0.00023449776927009225, -0.050016555935144424, 0.05866439640522003, -0.048261094838380814, 0.013923556543886662, -0.012416881509125233, -0.04495321586728096, -0.0744595155119896, 0.03316996619105339, 0.044435303658246994, 0.022805558517575264, -0.05245215445756912, 0.0667240172624588, -0.0031489890534430742, 0.04697617515921593, 0.0037226604763418436, -0.03637048974633217, -0.0031272091437131166, -0.019406115636229515, -0.03937055915594101, -0.04289316013455391, -0.007052770350128412, -0.024983223527669907, -0.05621364712715149, -0.048461008816957474, 0.03735025227069855, -0.011579299345612526, 0.05300365388393402, 0.0486593022942543, -0.02725832909345627, -0.04552583396434784, 0.072946697473526, 0.01741175912320614, -0.006442380137741566, 0.008107380010187626, 0.02822970226407051, 0.0029637725092470646, 0.1124928668141365, 0.07217659801244736, 0.038784172385931015, 0.03856651484966278, -0.006402693688869476, 0.02524460293352604, 0.06069929152727127, -0.09286141395568848, -0.03841105476021767, 0.01355647761374712, -0.006142187863588333, 0.029644068330526352, -0.023899998515844345, -0.051160458475351334, -0.050050169229507446, -0.011739067733287811, -0.0021058754064142704, 0.022122908383607864, 0.005026291590183973, -0.002326815389096737, 0.041919611394405365, -0.01462602149695158, 0.06703659147024155, 0.035924363881349564, -0.0369182787835598, -0.023609386757016182, 0.03627453371882439, -0.011771014891564846, -0.014631667174398899, 0.018099837005138397, 0.07838220149278641, -0.029327524825930595, -0.06164199113845825, -0.014446052722632885, 0.04670325666666031, 0.02239629440009594, 0.02085002139210701, -0.10044771432876587, -0.02109968475997448, 0.03815990686416626, 0.017587989568710327, 0.005013604648411274, 0.01053282804787159, 0.046193886548280716, -0.02653166465461254, 0.025425951927900314, -0.00830328743904829, -0.02870338037610054, -0.09198840707540512, -0.02413547784090042, 0.019643625244498253, 0.0570317804813385, -0.018178269267082214, -0.07989450544118881, 0.02891545742750168, 0.07349969446659088, 0.033506229519844055, 0.01200388465076685, 0.00986540224403143, -0.043309397995471954, 0.03559517487883568, 0.0019230105681344867, 0.01934731751680374, 0.022442687302827835, -0.01963353529572487, 0.055426158010959625, -0.021146049723029137, -0.018151363357901573, 0.049007516354322433, -0.14430227875709534, -0.062240052968263626, 0.11569830030202866, -0.01593109779059887, -0.002424286212772131, -0.0743061751127243, -0.0222026314586401, 0.10166456550359726, 0.05785377696156502, 0.061047766357660294, 0.03015666827559471, 0.042044468224048615, 0.09240956604480743, -0.03366287425160408, -0.04850507527589798, 0.03674739971756935, 0.06902584433555603, -0.019860263913869858, 0.004290353506803513, 0.01077384501695633, -0.05652894452214241, -0.07234175503253937, 0.0568414069712162, -0.05724729597568512, -0.02094268426299095, -0.007383502554148436, -0.005549504421651363, -0.033594463020563126, 0.022338151931762695, -0.06408701837062836, 0.06695074588060379, 0.019857235252857208, -0.03113418258726597, 0.03934876248240471, -0.030552569776773453, 0.10304394364356995, 0.07441404461860657, -0.0029631892684847116, 0.07109291851520538, -0.07545079290866852, -0.027203772217035294, -0.01022458914667368, -0.014724415726959705, 0.08769144862890244, 0.017062945291399956, 0.05422892048954964, 0.005131077952682972, -0.06382536143064499, 0.029395489022135735, -0.008082274347543716, 0.012783602811396122, 0.010784941725432873, -0.01719078980386257, 0.0426718145608902, -0.03554153814911842, -0.05092940479516983, 0.03630925342440605, 0.037792228162288666, -0.06894110143184662, -0.029184993356466293, -0.053064484149217606, 0.0854339525103569, 0.023517822846770287, -0.02022898755967617, 0.08616814762353897, -0.0298664141446352, -0.006199604831635952, -0.016284804791212082, -0.005292976275086403, 0.01914425566792488, 0.0002092768409056589, -0.007959465496242046, 0.02031477354466915, -0.060598839074373245, -0.010732888244092464, -0.00803186185657978, 0.018404079601168633, 0.0018689308781176805, -0.0010656126542016864, 0.051397427916526794, -0.013739547692239285, -0.023374764248728752, 0.030547956004738808, 0.016541743651032448, -0.007031685207039118, 0.004113170318305492, 0.04703886806964874, -0.010832558386027813, -0.008775264956057072, -0.021056272089481354, -0.011420954018831253, -0.03577436879277229, 0.006604224909096956, 0.014893999323248863, 0.046988215297460556, -0.026934975758194923, 0.03863273933529854, -0.0014075865037739277, -0.01839590072631836, 0.021529296413064003, 0.010666626505553722, 0.028133215382695198, 0.001927840057760477, -0.05171404406428337, 0.03180554881691933, -0.021399013698101044, -0.01645619049668312, 0.031716056168079376, -0.04292991757392883, 0.008192203007638454, 0.03875147923827171, -0.0017178085399791598, 0.002369930734857917, 0.023741604760289192, -0.043949950486421585, 0.0424952358007431, -0.005027335602790117, 0.004449354484677315, -0.16950488090515137, -0.02917049638926983, 0.03110516630113125, 0.036664094775915146, -0.029732855036854744, -0.0170260202139616, 0.037651799619197845, -0.04075097665190697, -0.03375532850623131, -0.015966871753335, 0.029702985659241676, 0.02211766690015793, 0.021261904388666153, -0.03176764398813248, -0.013054179027676582, -0.004100761376321316, -0.019189439713954926, -0.00027508186758495867, 0.008113649673759937, -0.011875336058437824, -0.006286374293267727, 0.05008791759610176, -0.010285546071827412, -0.018715279176831245, -0.021541744470596313, 0.059658877551555634, 0.029982127249240875, 0.017086094245314598, 0.010330037213861942, -0.022919025272130966, -0.02306893654167652, 0.03593936562538147, -0.021971765905618668, 0.027628403156995773, -0.012071539647877216, 0.00025805807672441006, -0.0012022448936477304, -0.027419498190283775, -0.01654146797955036, 0.04278917983174324, 0.030468754470348358, 0.012810674495995045, 0.036064017564058304, 0.04083459451794624, -0.03792219236493111, 0.004536918364465237, 0.010552775114774704, 0.0003056453133467585, 0.056059978902339935, -0.02941523864865303, -0.04795883968472481, -0.007983710616827011, -0.005280863493680954, 0.04341895878314972, -0.014446142129600048, -0.002493445295840502, -0.032737910747528076, 0.010558261536061764, 0.06505643576383591, -0.027242055162787437, -0.0038921828381717205, 0.017469534650444984, 0.012320537120103836, 0.01149656716734171, -0.0225201528519392, 0.05348007008433342, -0.04023681581020355, 0.019367363303899765, -0.042448993772268295, 0.054383911192417145, 0.020596740767359734, -0.004423342179507017, -0.018997767940163612, 0.01676657423377037, 0.0062933266162872314, 0.020826613530516624, -0.009401045739650726, -0.013376615010201931, 0.035369567573070526, -0.004556143190711737, 0.010933133773505688, -0.012842286378145218, -0.01641780510544777, -0.010858830064535141, -0.008690047077834606, 0.029222410172224045, 0.0015761980321258307, 0.029517006129026413, -0.011816379614174366, 0.040445826947689056, 0.021417634561657906, 0.009842832572758198, -0.019646231085062027, -0.007831694558262825, -0.0030747258570045233, 0.018883220851421356, 0.059196241199970245, -0.021468468010425568, 0.008883651345968246, 0.0017140267882496119, 0.005566417705267668, -0.004694868344813585, -0.017840249463915825, 0.023264147341251373, 0.007874027825891972, 0.03016381897032261, -0.010315352119505405, -0.035325706005096436, -0.013275917619466782, 0.022212281823158264, 0.010324681177735329, -0.04944348707795143, -0.0007516755140386522, -0.0327327735722065, -0.02252816967666149, 0.018049070611596107, -0.018035707995295525, -0.042529527097940445, -0.035045355558395386, 0.01756337843835354, -0.026875656098127365, 0.02004122920334339, 0.022113574668765068, -0.035193413496017456, -0.010192418470978737, 0.0020658797584474087, 0.0044273752719163895, -0.002663596998900175, 0.018075071275234222, 0.003223104402422905, -0.028881361708045006, -0.04197750985622406, 0.03690379858016968, -0.008963172324001789, 0.027296364307403564, 0.004638420883566141, -0.008288268931210041, 0.04241782799363136, -0.012560578063130379, -0.058773767203092575, 0.013624581508338451, 0.0017954943468794227, 0.003488530870527029, -0.02547241747379303, 0.013310101814568043, -0.012609526515007019, 0.0020879325456917286, 0.00884877610951662, -0.006766055710613728, 0.021099520847201347, 0.04181639105081558, -0.049204081296920776, -0.022262804210186005, -0.0025544404052197933, -0.009850287809967995, 0.0161641463637352, 0.01927011087536812, -0.020509811118245125, -0.02378622256219387, 0.06101968139410019, -0.0057489313185215, -0.01233746949583292, -0.07312779873609543, 0.03270307555794716, -0.04514234885573387, -0.00637868233025074, -0.0044298372231423855, 0.008695988915860653, -0.010842828080058098, -0.013973083347082138, -0.01640784554183483, -0.01471512857824564, 0.042721301317214966, -0.015391276217997074, 0.01578410528600216, 0.023694677278399467, 0.020164960995316505, 0.013118368573486805, 0.022719837725162506, 0.02418244257569313, -0.005504109431058168, 0.0020851516164839268, 0.041314467787742615, 0.01119512040168047, -0.008873989805579185, -0.026918403804302216, 0.02796662226319313, -0.0015426933532580733, 0.002973745344206691, 0.05894489213824272, -0.059522271156311035, -0.029048850759863853, -0.01174286287277937, -0.028633616864681244, -0.0025262522976845503, 0.0012569321552291512, 0.012392304837703705, -0.013092519715428352, -0.009316825307905674, -0.0034208418801426888, 0.021591641008853912, 0.02839174121618271, -0.00905181560665369, -0.014542858116328716, 0.001688131713308394, 0.03813757374882698, 0.012203555554151535, -0.011556966230273247, -0.00827887374907732, -0.00878655631095171, -0.006078267004340887, 0.023331359028816223, -0.01282221358269453, -0.014795664697885513, -0.024064067751169205, -0.051774412393569946, -0.039824407547712326, 0.020548023283481598, 0.01560380682349205, 0.023867812007665634, 0.02578163519501686, 0.007643633056432009, -0.02164357155561447, 0.04787847027182579, 0.053414031863212585, -0.010625854134559631, 0.007398422807455063, 0.03965878486633301, -0.018471436575055122, 0.03396550193428993, 0.020918164402246475, 0.01792977564036846, -0.02356158196926117, 0.026828918606042862, 0.0299287810921669, 0.023884231224656105, -0.07452455163002014, 0.017491871491074562, -0.01180950179696083, 0.010182106867432594, 0.011290980502963066, -0.013212263584136963, -0.00616818480193615, -0.02593117393553257, -0.039023980498313904, 0.02644515596330166, 0.030501458793878555, -0.020909661427140236, 0.030199017375707626, 0.0024780372623354197, 0.024579932913184166, 0.0006694445619359612, 0.0050532519817352295, -0.025466641411185265, -0.0007795717101544142, 0.005152358207851648, -0.0061842091381549835, -0.01608729362487793, 0.017736488953232765, -0.017698587849736214, -0.007414317689836025, 0.005310223437845707, 0.02912868745625019, 0.035780955106019974, -0.01756075583398342, 0.017987947911024094, 0.007785458117723465, -0.017648564651608467, 0.014238578267395496, 0.026562068611383438, -0.026261309161782265, 0.009997205808758736, 0.045717015862464905, -0.04033854603767395, 0.017999941483139992, -0.019431693479418755, 0.04149176552891731, 0.012597964145243168, 0.013564459048211575, -0.012938208878040314, 0.005832276772707701, 0.011982128024101257, 0.006372643169015646, 0.006283801048994064, -0.024014310911297798, 0.02564837969839573, 0.01266750693321228, 0.000627373403403908, 0.029331747442483902, 0.020597834140062332, 0.01622885838150978, 0.0164114311337471, -0.016062026843428612, 0.022791653871536255, -0.014616714790463448, -0.0011197885032743216, 0.01430816575884819, -0.033594027161598206, 0.028421275317668915, -0.03140915185213089, 0.031796250492334366, 0.001726192538626492, -0.010205883532762527, 0.014513506554067135, -0.031003661453723907, 0.009488307870924473, 0.028740890324115753, -0.006731302011758089, -0.016614975407719612, -0.048149943351745605, 0.020596416667103767, 0.05826834216713905, -0.028922295197844505, -0.01582292653620243, -0.015946069732308388, -0.05592527613043785, 0.048102982342243195, -0.012911968864500523, -0.03017519973218441, 0.0008717830060049891, 0.04187149181962013, -0.006466080900281668, -0.014331490732729435, -0.012699885293841362, -0.046984441578388214, -0.0764581561088562, 0.012542002834379673, 0.02958308346569538, -0.0112617714330554, 0.001018193201161921, 0.004982439335435629, 0.02990536019206047, -0.013825245201587677, -0.0035037158522754908, -0.006682390347123146, 0.05364855006337166, 0.023040540516376495, 0.04112439230084419, -0.022223003208637238, -0.02401520311832428, -0.021146632730960846, 0.0005078830290585756, 0.0016095041064545512, -0.004527922719717026, 0.0046087466180324554, -0.007066614925861359, -0.020714597776532173, 0.0019050106639042497, 0.004520771559327841, 0.02421308495104313, 0.03224116563796997, 0.014277043752372265, -0.01915091648697853, 0.04016444459557533, -0.03227568045258522, -0.01928640343248844, -0.02062993496656418, -0.0212908536195755, -0.0004075980687048286, -0.0005746483220718801, -0.008262635208666325, 0.021281911060214043, 0.012796109542250633, -0.01581766828894615, -0.044119007885456085, -0.008850198239088058, -0.018408408388495445, 0.011509589850902557, 0.016512563452124596, 0.010760542936623096, -0.02123982459306717, -0.03759017586708069, 0.023254716768860817, 0.014863019809126854, -0.04394179955124855, 0.0004829931422136724, -0.03497970104217529, -0.032068882137537, -0.013737697154283524, 0.004712791182100773, 0.07118083536624908, 0.02259041741490364, 0.012116672471165657, 0.0273303110152483, 0.03456234186887741, -0.00046777274110354483, -0.022944841533899307, 0.022981779649853706, 0.01909037120640278, 0.02714485488831997, -0.019625550135970116, -0.022807737812399864, -0.024255862459540367, -0.06082854047417641, 0.0021969482768326998, -0.002418047981336713, -0.06004129350185394, -0.01669485680758953, 0.0008370992727577686, 0.009537667967379093, -0.040538206696510315, 0.03392400965094566, 0.03818489611148834, 0.0061010029166936874, 0.02319456823170185, -0.009521735832095146, -0.00006451027002185583, -0.008037195540964603, 0.022330226376652718, 0.0012515350244939327, 0.03955741599202156, 0.034602850675582886, -0.0075980848632752895, -0.05560057610273361, 0.04401763901114464, -0.031373560428619385, -0.04679428040981293, -0.00015281660307664424, 0.05890542268753052, -0.019112519919872284, -0.02808789722621441, 0.0020764812361449003, 0.016497071832418442, 0.005267312750220299, -0.003595433197915554, 0.023836949840188026, -0.021230479702353477, 0.01112350169569254, 0.010532228276133537, -0.038822077214717865, 0.013578096404671669, -0.004223907366394997, 0.01284179650247097, 0.03110506758093834, 0.020146889612078667, -0.0218161940574646, -0.0036042851861566305, -0.053407344967126846, 0.011450049467384815, 0.002359141130000353, 0.01161665003746748, -0.0023263029288500547, 0.021768206730484962, -0.041764289140701294, -0.01374275702983141, -0.041195761412382126, 0.04455313831567764, 0.015789031982421875, -0.037275832146406174, -0.02694115787744522, -0.025024933740496635, 0.007649821229279041, 0.011421049945056438, 0.029408251866698265, 0.008746393024921417, 0.06094074249267578, 0.028947891667485237, -0.028218397870659828, 0.005383246578276157, 0.026133481413125992 ]
How to train a new language model from scratch using Transformers and Tokenizers
julien-c
February 14, 2020
how-to-train
guide, nlp
https://huggingface.co/blog/how-to-train
6. Share your model 🎉 Finally, when you have a nice model, please think about sharing it with the community: - upload your model using the CLI: transformers-cli upload - write a README.md model card and add it to the repository under model_cards/. Your model card should ideally include: - a model description, - training params (dataset, preprocessing, hyperparameters), - evaluation results, - intended uses & limitations - whatever else is helpful! 🤓
[ 0.03290002420544624, -0.023994656279683113, 0.030820699408650398, 0.04428759217262268, 0.09049855917692184, 0.016455039381980896, -0.007614787667989731, 0.046422626823186874, -0.011227457784116268, -0.006832692306488752, -0.05399039760231972, 0.03721701353788376, 0.02508559264242649, 0.06200612336397171, -0.041073027998209, -0.02146114408969879, -0.018264954909682274, 0.024973412975668907, 0.00040845092735253274, 0.017711155116558075, 0.009755177423357964, -0.13632798194885254, 0.07305905967950821, -0.025404399260878563, 0.047768957912921906, -0.044771939516067505, 0.07814093679189682, 0.017182733863592148, -0.025338809937238693, 0.04825795069336891, -0.0826396495103836, -0.019048433750867844, 0.009378544986248016, -0.05056450143456459, -0.027447590604424477, 0.056256186217069626, -0.06724456697702408, 0.041470564901828766, 0.03546050563454628, -0.055454954504966736, 0.01813911460340023, -0.012801705859601498, -0.06964454054832458, 0.0418134443461895, 0.03506619483232498, -0.028531229123473167, -0.15838734805583954, 0.04673943296074867, -0.03826424106955528, 0.02525842934846878, -0.008485478349030018, 0.04325975477695465, -0.024149786680936813, 0.025847721844911575, 0.04863205924630165, 0.03462018072605133, -0.012448861263692379, -0.07721017301082611, -0.04370342195034027, 0.044786375015974045, 0.049806881695985794, 0.03854399174451828, 0.04940519481897354, 0.06568022072315216, 0.013765394687652588, 0.0037167693953961134, -0.028512433171272278, -0.016537176445126534, -0.04960986599326134, -0.04870445281267166, 0.029833951964974403, -0.029034672304987907, -0.00966665893793106, -0.10170166194438934, -0.012610088102519512, -0.04571474343538284, 0.04183494672179222, 0.035165831446647644, 0.09308478236198425, 0.06643321365118027, 0.03610343113541603, 0.009295902214944363, 0.02668694779276848, 0.042669232934713364, 0.02512379176914692, -0.008984921500086784, 0.02630387246608734, -0.016339192166924477, -0.08000743389129639, 0.01630420796573162, 0.009373597800731659, -0.09796738624572754, -0.036233194172382355, 0.04021107405424118, 0.10785151273012161, 0.017703022807836533, -0.01824965886771679, -0.02186886966228485, -0.0822119489312172, 0.0011515789665281773, -0.05750865116715431, 0.03382439538836479, 0.013194011524319649, -0.02565363235771656, -0.04053801670670509, 0.003570470493286848, 0.004077065270394087, -0.1442405730485916, -0.02706466056406498, 0.04289316013455391, -0.05947844684123993, -0.02660335600376129, 0.0013491531135514379, 0.02341577783226967, -0.024333110079169273, 0.04096315801143646, 0.0314120389521122, -0.0611959844827652, -0.004184613469988108, 0.02894316427409649, 0.010773912072181702, 0.08231855928897858, 0.0004057584155816585, 0.010334476828575134, 0.006328384857624769, 0.07367414236068726, 0.05267254263162613, -0.008242228999733925, -0.022220101207494736, -0.047152455896139145, 0.06818078458309174, -0.037601348012685776, 0.012690612114965916, -0.008602405898272991, 0.004608543124049902, -0.1287025660276413, 0.017940785735845566, -0.027696799486875534, 0.06205647811293602, 0.0351603701710701, -0.012941638007760048, 0.06107074022293091, -0.008088640868663788, -0.022425342351198196, 0.031397268176078796, -0.008950305171310902, -0.04826679080724716, 0.053048085421323776, 0.04286219924688339, 0.03522399067878723, -0.01806318573653698, 0.08354025334119797, 0.010966419242322445, -0.04835304617881775, 0.0037329525221139193, 0.056163039058446884, -0.04866710677742958, 0.04751237481832504, -0.06117578595876694, 0.009217556565999985, -0.008772600442171097, -0.02785666100680828, -0.047048021107912064, 0.030435362830758095, 0.003637440735474229, -0.04671984910964966, -0.025020547211170197, -0.030134184285998344, 0.053466252982616425, -0.005505270324647427, 0.0007922659278847277, -0.05591190978884697, 0.057856425642967224, -0.021100260317325592, 0.02588760107755661, 0.1045575812458992, 0.022462038323283195, 0.047895368188619614, 0.028511015698313713, -0.03410707414150238, -0.011886515654623508, 0.03995296731591225, -0.03475445881485939, 0.03209461644291878, 0.05042807385325432, -0.10544708371162415, -0.01095738634467125, -0.03834155201911926, -0.028978485614061356, 0.012640648521482944, -0.047757238149642944, -0.03963518142700195, 0.09418046474456787, -0.00836800318211317, 0.025582846254110336, -0.0310148186981678, -0.04218434914946556, 0.0868702158331871, 0.0016794116236269474, 0.049168284982442856, 0.017283763736486435, 0.007191406097263098, 0.012159593403339386, -0.02715972252190113, 0.004474031738936901, 0.020762428641319275, 0.03341378644108772, -0.06194773316383362, 0.03886279836297035, -0.004931911360472441, -0.00038201460847631097, -0.10960645228624344, 0.03279038146138191, -0.09268469363451004, 0.007776451297104359, -0.05475449562072754, -0.024639559909701347, 0.008422894403338432, -0.02020828239619732, 0.03255317732691765, 0.17141257226467133, 0.02399817295372486, -0.04931337386369705, -0.006643874105066061, -0.02367962896823883, 0.04697217047214508, 0.059313129633665085, 0.0653168335556984, 0.0950632244348526, -0.049214959144592285, -0.0018536709249019623, -0.03968850523233414, -0.06459406763315201, 0.08227955549955368, -0.013217384926974773, -0.0020486596040427685, -0.034676048904657364, -0.019026927649974823, -0.014840989373624325, -0.031124593690037727, -0.007425490766763687, 0.010268150828778744, 0.01829024776816368, -0.000008896120561985299, 0.022454921156167984, 0.025016048923134804, 0.06569919735193253, 0.04303488880395889, -0.03223539516329765, -0.019459767267107964, -0.0907188206911087, 0.061116937547922134, 0.02415960654616356, -0.0717511922121048, 0.046897388994693756, -0.032812803983688354, 0.0009554654825478792, -0.009283722378313541, -0.012989870272576809, 0.028479794040322304, 0.013662354089319706, 0.024693794548511505, -0.03556494414806366, -0.048963431268930435, 0.0289518553763628, -0.027295971289277077, 0.006935198325663805, -0.0078001003712415695, 0.005084942560642958, -0.01369620393961668, 0.022098759189248085, -0.02540842816233635, 0.011601188220083714, 0.015371429733932018, -0.005544896237552166, 0.01081022433936596, 0.007292408496141434, -0.014288016594946384, -0.027133477851748466, -0.015471036545932293, 0.002152909990400076, -0.01957741007208824, 0.00905027985572815, 0.02125966176390648, -0.008464349433779716, 0.012616605497896671, -0.01061666663736105, -0.05796661972999573, -0.024126356467604637, -0.001458743936382234, 0.01171085238456726, 0.04555730149149895, -0.017431875690817833, -0.005276123061776161, -0.01487401220947504, -0.012140865437686443, 0.002128438325598836, -0.01988879218697548, 0.0019599071238189936, 0.022016823291778564, 0.0019775377586483955, 0.020962737500667572, 0.03810565546154976, -0.008215882815420628, -0.04101124405860901, 0.009742935188114643, 0.0033456545788794756, -0.008776654489338398, -0.1092521920800209, -0.05595969781279564, -0.001059619477018714, 0.062145281583070755, 0.006961694452911615, -0.001552710309624672, 0.003163304878398776, -0.0191819928586483, -0.005451676435768604, 0.00669188192114234, 0.01598365604877472, 0.007511920761317015, 0.015936000272631645, 0.046111464500427246, -0.025072719901800156, 0.0011602299055084586, -0.02091001719236374, 0.021145589649677277, 0.047779276967048645, 0.046535100787878036, -0.024789029732346535, 0.023843230679631233, -0.012274324893951416, -0.01161258202046156, -0.01094148587435484, 0.02201903611421585, 0.05447585880756378, 0.040444716811180115, -0.02259841002523899, -0.032637812197208405, 0.006647184025496244, 0.01621313951909542, -0.0254193302243948, 0.014228119514882565, -0.006958799436688423, 0.007785426918417215, -0.011054917238652706, -0.001433779951184988, 0.014361021108925343, 0.027520185336470604, -0.0024736188352108, -0.018542109057307243, 0.035294294357299805, -0.008400097489356995, 0.022775644436478615, 0.00895334966480732, 0.03492492809891701, 0.00010232391650788486, 0.004834790248423815, -0.050351861864328384, -0.0011077240342274308, -0.012491816654801369, 0.04611131548881531, -0.0033015378285199404, -0.012846235185861588, -0.009448806755244732, 0.00976384337991476, 0.03313140943646431, 0.0005732577992603183, -0.015095187351107597, -0.05082663148641586, 0.004925941117107868, -0.022416524589061737, -0.02609710581600666, -0.02853856235742569, 0.09054550528526306, 0.00046719328383915126, 0.00020034167391713709, -0.018620287999510765, 0.050226300954818726, 0.008370259776711464, 0.040046434849500656, -0.006683918181806803, 0.009523666463792324, -0.015543825924396515, 0.025032727047801018, -0.02648991532623768, -0.027998559176921844, 0.057376183569431305, 0.0149832209572196, -0.022812705487012863, -0.027716590091586113, -0.03322374448180199, -0.013334638439118862, -0.009921636432409286, 0.013305175118148327, 0.0639423355460167, -0.025617310777306557, 0.02803622931241989, 0.026237545534968376, 0.009603822603821754, -0.033354680985212326, 0.03732128441333771, -0.024804916232824326, -0.007943973876535892, -0.045482002198696136, -0.0014714215649291873, 0.014276678673923016, -0.00940162967890501, -0.007687482051551342, 0.020516807213425636, -0.010168171487748623, 0.02492743358016014, 0.031862594187259674, -0.00793419498950243, 0.03554018959403038, -0.025304123759269714, -0.04371865466237068, 0.01612030155956745, -0.017920073121786118, 0.006720234639942646, -0.009753036312758923, -0.03439725935459137, -0.025746438652276993, 0.0038855529855936766, 0.03824764862656593, -0.026874635368585587, -0.003519756020978093, -0.004486924968659878, 0.05929143354296684, -0.036388784646987915, -0.009815629571676254, 0.009359416551887989, -0.03825501725077629, 0.017500367015600204, 0.0061564319767057896, 0.027738096192479134, 0.026269180700182915, -0.04281578212976456, 0.0018210414564236999, -0.038704533129930496, -0.014902517199516296, 0.048252400010824203, -0.008805208839476109, -0.01342909038066864, 0.05044034868478775, -0.0657634362578392, 0.06430342048406601, 0.03198344632983208, -0.005479314364492893, 0.008075998164713383, -0.0013093585148453712, 0.04548323526978493, -0.03198542445898056, 0.0370098352432251, -0.015599671751260757, -0.042102959007024765, -0.007506887894123793, -0.028872637078166008, -0.0017443880205973983, 0.028048066422343254, 0.0457017719745636, -0.014766791835427284, 0.021748464554548264, 0.03472669795155525, 0.01407186221331358, -0.012904857285320759, 0.018631797283887863, 0.007315553724765778, 0.026954183354973793, -0.03622262552380562, 0.006180043797940016, -0.04694707691669464, 0.0103810029104352, -0.005192429292947054, 0.04373486712574959, -0.003303459845483303, -0.08471313118934631, 0.026403632014989853, 0.004616276361048222, -0.030170314013957977, -0.012331141158938408, 0.02718920260667801, -0.06106256693601608, -0.019502710551023483, 0.031149812042713165, 0.0014577771071344614, 0.041963621973991394, 0.0025156692136079073, -0.006014678161591291, -0.027742836624383926, -0.019198449328541756, 0.0027605462819337845, -0.020373737439513206, -0.0008643966866657138, 0.026837920770049095, 0.06767810881137848, 0.0939384326338768, -0.0037690899334847927, -0.002945635700598359, 0.0013902763603255153, -0.0007673588115721941, -0.016630927100777626, -0.030094914138317108, -0.025728657841682434, -0.03208574280142784, 0.030364373698830605, 0.032446227967739105, -0.007450835779309273, 0.0178107637912035, 0.05194076895713806, 0.06872139871120453, -0.03594352677464485, 0.020824849605560303, 0.03137888386845589, -0.012734264135360718, -0.027103662490844727, 0.014898009598255157, 0.008073371835052967, -0.0325290709733963, -0.00024341001699212939, 0.005797553341835737, 0.013096475042402744, -0.019268617033958435, -0.04663019999861717, -0.015244667418301105, -0.05334889516234398, 0.006992586422711611, 0.009386132471263409, 0.06395206600427628, -0.00011377567716408521, -0.02685912698507309, -0.009147481992840767, 0.03694762662053108, 0.036198582500219345, -0.020709959790110588, 0.003942910116165876, -0.0075934580527246, 0.0021420232951641083, -0.003868150757625699, 0.019393885508179665, -0.008654913865029812, 0.0025175607297569513, 0.023453718051314354, 0.0008126376196742058, 0.014695671387016773, -0.06510009616613388, 0.040143419057130814, 0.008947250433266163, -0.031170684844255447, -0.020268654450774193, -0.03927239775657654, -0.06838230043649673, 0.02423717826604843, -0.0571693480014801, 0.01980113796889782, 0.07783990353345871, -0.015580848790705204, -0.017637260258197784, 0.001697647268883884, 0.01861201599240303, 0.0018798038363456726, 0.015083188191056252, 0.041682735085487366, -0.03080279380083084, 0.01183267217129469, -0.004113778937608004, 0.03410426527261734, -0.01951673813164234, 0.011856845580041409, 0.028792187571525574, -0.04401508718729019, -0.0039510163478553295, 0.03809000551700592, -0.02296321466565132, 0.01604357920587063, -0.0023332498967647552, -0.019686957821249962, 0.02449984848499298, -0.007316133007407188, 0.019806597381830215, 0.020329046994447708, 0.027231723070144653, 0.02685587666928768, -0.015440271236002445, 0.022735191509127617, 0.06493932008743286, 0.01936369761824608, -0.014951311983168125, 0.0519125759601593, -0.003520150203257799, 0.04351687431335449, 0.04696694761514664, -0.011534817516803741, -0.0023708923254162073, 0.027215326204895973, 0.0492381677031517, -0.008699364960193634, -0.009580748155713081, 0.02457457035779953, 0.024648919701576233, -0.04193243756890297, 0.003324381075799465, -0.00010503115481697023, -0.029218608513474464, 0.05106354504823685, 0.00422793859615922, -0.015116855502128601, -0.01739257574081421, 0.0007435735315084457, 0.047583915293216705, 0.017088713124394417, 0.02364082634449005, -0.026121683418750763, 0.04290763661265373, 0.06396327167749405, 0.01559505145996809, 0.04382947459816933, 0.018259797245264053, 0.02515685185790062, -0.03452915698289871, 0.035798050463199615, -0.01295068021863699, -0.005388188175857067, 0.0151212802156806, -0.009515272453427315, 0.009748199954628944, -0.023809585720300674, -0.00926342885941267, -0.02111511491239071, 0.047717440873384476, -0.003264225088059902, -0.03670146316289902, 0.05922279879450798, -0.03766029700636864, 0.017917128279805183, -0.013469187542796135, -0.023624224588274956, -0.005269903689622879, -0.03708485886454582, -0.005914710462093353, 0.04032967984676361, 0.016204727813601494, 0.027649100869894028, -0.007598884403705597, 0.03645889833569527, 0.008692814037203789, 0.05008665472269058, -0.006263246759772301, -0.03267107531428337, -0.06016923114657402, -0.004562443122267723, 0.0066879731602966785, 0.015520655550062656, 0.007999883964657784, -0.0016648732125759125, 0.007889565080404282, 0.02251718007028103, 0.007407577708363533, 0.03132760152220726, 0.0010892020072788, -0.009471679106354713, -0.03816468268632889, -0.01652717962861061, -0.02519039623439312, -0.05885792523622513, 0.0018424494192004204, -0.02619018778204918, 0.016742456704378128, -0.014608421362936497, 0.0008778295014053583, 0.021713662892580032, 0.016454169526696205, -0.04635486751794815, -0.04002493992447853, 0.012009339407086372, -0.0059962463565170765, -0.015676040202379227, 0.01599816046655178, -0.021427055820822716, -0.012811430729925632, 0.03018081746995449, 0.011233619414269924, 0.029108017683029175, 0.0005834063049405813, 0.023366620764136314, 0.040043171495199203, -0.028970975428819656, 0.009252375923097134, 0.0006608875119127333, 0.06296899169683456, 0.03531757742166519, 0.01705198548734188, 0.03513391315937042, 0.039860207587480545, -0.010374198667705059, -0.016790106892585754, -0.0023339493200182915, 0.013438232243061066, 0.012483164668083191, -0.015262003056704998, -0.03642812371253967, -0.02950715273618698, 0.0032313053961843252, 0.006841051392257214, 0.02536974474787712, -0.08510205894708633, -0.021226761862635612, -0.013892185874283314, -0.04305544123053551, -0.04688897728919983, 0.002798974048346281, 0.05578102916479111, 0.028447777032852173, 0.005658793728798628, -0.00441016536206007, -0.03854960575699806, 0.002995056565850973, -0.006946682929992676, 0.036077868193387985, 0.03118148259818554, -0.008063770830631256, -0.01275777630507946, -0.011399243958294392, 0.024341240525245667, -0.02962726354598999, -0.07126134634017944, -0.013696856796741486, 0.02183682844042778, -0.012384004890918732, -0.023229043930768967, -0.03958772495388985, 0.04891062155365944, -0.0010656374506652355, 0.012198843993246555, -0.030569808557629585, 0.005204701330512762, 0.0016719512641429901, 0.0010612583719193935, -0.05846545472741127, 0.032896656543016434, -0.03410854563117027, -0.014302672818303108, 0.03329487144947052, 0.0226450078189373, -0.013695086352527142, 0.018700674176216125, -0.038780294358730316, 0.02058078721165657, -0.012075508013367653, -0.021791262552142143, -0.05920575186610222, -0.009604456834495068, -0.008656884543597698, -0.03849933296442032, -0.04738793894648552, 0.011988471262156963, -0.005815573967993259, -0.015794729813933372, -0.00960452388972044, 0.01734713278710842, 0.0014386697439476848, 0.015582391992211342, -0.0006007908959873021, -0.04386713355779648, 0.00048204121412709355, 0.024984195828437805, -0.035533349961042404, -0.04692264273762703, 0.0010554059408605099 ]
How to train a new language model from scratch using Transformers and Tokenizers
julien-c
February 14, 2020
how-to-train
guide, nlp
https://huggingface.co/blog/how-to-train
2. Train a tokenizer We choose to train a byte-level Byte-pair encoding tokenizer (the same as GPT-2), with the same special tokens as RoBERTa. Let’s arbitrarily pick its size to be 52,000. We recommend training a byte-level BPE (rather than let’s say, a WordPiece tokenizer like BERT) because it will start building its vocabulary from an alphabet of single bytes, so all words will be decomposable into tokens (no more <unk> tokens!). python #! pip install tokenizers from pathlib import Path from tokenizers import ByteLevelBPETokenizer paths = [str(x) for x in Path("./eo_data/").glob("**/*.txt")] # Initialize a tokenizer tokenizer = ByteLevelBPETokenizer() # Customize training tokenizer.train(files=paths, vocab_size=52_000, min_frequency=2, special_tokens=[ "<s>", "<pad>", "</s>", "<unk>", "<mask>", ]) # Save files to disk tokenizer.save_model(".", "esperberto") And here’s a slightly accelerated capture of the output: On our dataset, training took about ~5 minutes. 🔥🔥 Wow, that was fast! ⚡️🔥 We now have both a vocab.json, which is a list of the most frequent tokens ranked by frequency, and a merges.txt list of merges. json { "<s>": 0, "<pad>": 1, "</s>": 2, "<unk>": 3, "<mask>": 4, "!": 5, "\"": 6, "#": 7, "$": 8, "%": 9, "&": 10, "'": 11, "(": 12, ")": 13, # ... } # merges.txt l a Ġ k o n Ġ la t a Ġ e Ġ d Ġ p # ... What is great is that our tokenizer is optimized for Esperanto. Compared to a generic tokenizer trained for English, more native words are represented by a single, unsplit token. Diacritics, i.e. accented characters used in Esperanto – ĉ, ĝ, ĥ, ĵ, ŝ, and ŭ – are encoded natively. We also represent sequences in a more efficient manner. Here on this corpus, the average length of encoded sequences is ~30% smaller as when using the pretrained GPT-2 tokenizer. Here’s how you can use it in tokenizers, including handling the RoBERTa special tokens – of course, you’ll also be able to use it directly from transformers. python from tokenizers.implementations import ByteLevelBPETokenizer from tokenizers.processors import BertProcessing tokenizer = ByteLevelBPETokenizer( "./models/EsperBERTo-small/vocab.json", "./models/EsperBERTo-small/merges.txt", ) tokenizer._tokenizer.post_processor = BertProcessing( ("</s>", tokenizer.token_to_id("</s>")), ("<s>", tokenizer.token_to_id("<s>")), ) tokenizer.enable_truncation(max_length=512) print( tokenizer.encode("Mi estas Julien.") ) # Encoding(num_tokens=7, ...) # tokens: ['<s>', 'Mi', 'Ġestas', 'ĠJuli', 'en', '.', '</s>']
[ 0.05093905329704285, -0.02071400173008442, 0.027971306815743446, 0.0011301814811304212, 0.057313695549964905, 0.07343178987503052, 0.032247256487607956, 0.049172356724739075, -0.04948524013161659, -0.029394881799817085, -0.08027844876050949, 0.05025390908122063, -0.026455692946910858, 0.04165637493133545, 0.021419426426291466, -0.03994966298341751, 0.042444173246622086, -0.03787270188331604, 0.004705488681793213, -0.05901097133755684, -0.03022402711212635, -0.018872635439038277, 0.10242405533790588, 0.006372462492436171, 0.025083858519792557, -0.04846636578440666, -0.027129510417580605, -0.010281804949045181, -0.009575426578521729, -0.012749784626066685, -0.11904408782720566, 0.014805994927883148, 0.018046380952000618, 0.014096014201641083, 0.03223501518368721, 0.05542304739356041, -0.12127507477998734, 0.04135768115520477, 0.05791320651769638, 0.003044773591682315, -0.0009735848871059716, 0.004699996206909418, -0.049235280603170395, 0.06751415878534317, -0.027452772483229637, 0.0010946464026346803, -0.16815289855003357, 0.10546678304672241, 0.011286349035799503, -0.09067085385322571, -0.062182702124118805, 0.08001372963190079, -0.02549351006746292, 0.049070216715335846, 0.014892878010869026, -0.0018299074145033956, -0.027156485244631767, -0.08915792405605316, 0.007964969612658024, 0.016392970457673073, 0.059491582214832306, -0.015056338161230087, -0.0031955258455127478, 0.026548901572823524, 0.05361160635948181, 0.009311141446232796, -0.09736581891775131, 0.062300778925418854, -0.06205330044031143, -0.06111018359661102, 0.03655458986759186, -0.03342922776937485, -0.04721449688076973, -0.012825953774154186, -0.038617074489593506, -0.04981740191578865, 0.034412931650877, -0.030314749106764793, 0.05075597018003464, 0.07295927405357361, 0.002824614755809307, 0.0465267039835453, 0.008012774400413036, 0.0075122700072824955, 0.080298513174057, 0.009646418504416943, 0.045542195439338684, -0.04303852468729019, -0.08350632339715958, 0.05750082805752754, -0.03382185846567154, -0.10104891657829285, -0.00500538619235158, 0.026898428797721863, 0.045153457671403885, 0.01758420281112194, -0.044935453683137894, 0.002879600739106536, 0.011734742671251297, 0.04188922047615051, -0.044974666088819504, -0.06459259241819382, 0.007292992435395718, -0.055837616324424744, -0.06968721747398376, 0.07184305787086487, 0.004121420904994011, -0.02364211529493332, -0.00944269634783268, 0.010490762069821358, 0.0027611262630671263, -0.02330915257334709, -0.03642403706908226, 0.060461219400167465, -0.05903766304254532, 0.04253506287932396, -0.016107255592942238, 0.028032764792442322, -0.06341058015823364, 0.07315228134393692, 0.04258041828870773, 0.06549075245857239, 0.08239027112722397, -0.030079016461968422, -0.0308093074709177, 0.0434299111366272, 0.02091185376048088, 0.05627552419900894, 0.0007595385541208088, -0.0022889841347932816, -0.00480214087292552, 0.003021468175575137, 0.03242873772978783, 0.007721663452684879, 0.001153404824435711, 0.019598618149757385, -0.006811866071075201, 0.0011145168682560325, 0.00007388862286461517, 0.009843958541750908, -0.08988559246063232, 0.06288682669401169, -0.04901571571826935, -0.028602590784430504, -0.0051555149257183075, 0.04971317574381828, -0.0953134074807167, 0.069790780544281, -0.001852962770499289, 0.0028185879345983267, -0.08337770402431488, 0.06345600634813309, 0.01597520336508751, -0.019496485590934753, 0.03732369467616081, 0.03519897535443306, -0.03419990465044975, -0.04809426888823509, -0.026122411713004112, -0.020903076976537704, -0.003599878866225481, -0.02447681874036789, -0.016536522656679153, 0.030721072107553482, -0.01853313110768795, -0.052230365574359894, 0.021421784535050392, 0.07766768336296082, -0.021003754809498787, 0.039365943521261215, 0.04074098542332649, 0.03829248249530792, 0.07711441814899445, 0.027589790523052216, -0.039264097809791565, 0.00935473944991827, 0.04215006157755852, 0.019751375541090965, 0.01865042746067047, -0.03902152180671692, -0.035543717443943024, 0.04223470762372017, -0.0248978640884161, 0.02142486907541752, 0.007613735273480415, -0.14421647787094116, -0.000816540268715471, -0.031766995787620544, 0.03682667016983032, 0.030974268913269043, -0.024938803166151047, -0.06463441252708435, 0.10988248139619827, 0.011344322934746742, 0.00036948861088603735, -0.048603273928165436, 0.03407502919435501, 0.1134515255689621, -0.006305895280092955, 0.023609016090631485, 0.03320744261145592, -0.006205020006746054, 0.025827335193753242, 0.000570018426515162, -0.008737960830330849, -0.04649033397436142, -0.04613601043820381, -0.05647509917616844, 0.04852354899048805, -0.021053355187177658, -0.013960304670035839, -0.05573860555887222, 0.022496135905385017, -0.0919121652841568, -0.01915583200752735, -0.0005627631326206028, 0.014562712050974369, 0.04896955192089081, 0.013624853454530239, -0.06359204649925232, 0.09627307206392288, -0.08199628442525864, -0.008214235305786133, -0.021562062203884125, -0.02195843681693077, 0.07658226788043976, 0.03578413650393486, -0.03099919483065605, 0.07827907800674438, -0.07441206276416779, -0.039107900112867355, -0.12494607269763947, 0.03152529150247574, 0.03073728084564209, -0.039416227489709854, -0.00247962842695415, 0.008169426582753658, -0.03147997334599495, 0.018288280814886093, -0.0514083132147789, -0.03747473657131195, -0.0179451797157526, -0.007413296028971672, 0.014112932607531548, -0.014458241872489452, 0.02933136560022831, 0.0957140177488327, 0.03549633547663689, -0.02625449188053608, -0.022644132375717163, -0.011451823636889458, 0.10331954807043076, -0.04076389595866203, -0.02245955914258957, 0.04409461095929146, 0.0015413217479363084, -0.01600341498851776, -0.017367849126458168, 0.010533704422414303, 0.03988027572631836, -0.0007727332995273173, 0.02606569416821003, -0.03933033347129822, 0.002258831635117531, 0.006307337898761034, -0.03366665914654732, -0.0005106372409500182, -0.003942341543734074, 0.015802357345819473, 0.012571397237479687, 0.012712113559246063, 0.00783257745206356, 0.034185539931058884, 0.016639817506074905, 0.0022417018190026283, 0.01494808029383421, 0.019818676635622978, -0.02426254190504551, -0.020533844828605652, -0.011838988400995731, 0.009598101489245892, -0.028572628274559975, 0.004707762971520424, 0.04396543279290199, -0.002707541221752763, 0.04478524252772331, 0.0017889206064864993, -0.0324622318148613, -0.011523591354489326, 0.037761837244033813, 0.00004704588354798034, 0.044694364070892334, -0.012683764100074768, -0.05240063741803169, -0.010510697029531002, 0.00406618369743228, -0.04529570788145065, 0.023253047838807106, 0.0251050665974617, 0.046283021569252014, 0.000903029867913574, 0.001979749882593751, -0.01959761418402195, -0.010243967175483704, -0.04232608526945114, 0.004250279627740383, -0.011514931917190552, 0.03784502297639847, -0.09403949975967407, -0.010900955647230148, -0.018147384747862816, 0.025039546191692352, 0.0011003118706867099, -0.022852368652820587, 0.03900708630681038, -0.010845331475138664, -0.020636145025491714, -0.008104744367301464, 0.02229120396077633, 0.01965099759399891, 0.009360019117593765, 0.01717316173017025, -0.032574765384197235, -0.005033704452216625, -0.013722377829253674, 0.005452493671327829, 0.02858935296535492, 0.043926138430833817, -0.010008564218878746, 0.03411468118429184, -0.0024864256847649813, 0.014870820567011833, -0.018176520243287086, -0.028257394209504128, -0.005008561071008444, 0.001246873871423304, 0.04894702136516571, -0.025451891124248505, -0.0353502556681633, -0.019033968448638916, 0.015747735276818275, 0.038213152438402176, -0.023791082203388214, 0.0371926948428154, 0.03008313663303852, 0.01902604289352894, -0.015281317755579948, 0.03337235376238823, -0.008898742496967316, -0.01909351348876953, 0.007574109360575676, -0.01779828779399395, 0.008410709910094738, -0.03395650535821915, 0.006220498122274876, -0.05734194442629814, 0.038432762026786804, -0.0183099415153265, -0.0062157344073057175, -0.030294939875602722, 0.018813975155353546, 0.038277264684438705, 0.004650424234569073, 0.025836292654275894, -0.019855501130223274, 0.03714490681886673, 0.03461496904492378, -0.0013529948191717267, -0.018043378368020058, 0.013314015232026577, 0.0017920283135026693, 0.00008975147648015991, -0.016944022849202156, 0.040247756987810135, -0.030982501804828644, -0.030956484377384186, -0.0108023164793849, 0.05940192565321922, -0.02157239429652691, 0.03493954986333847, -0.0018042776500806212, 0.0026754376012831926, -0.012290168553590775, 0.01817559450864792, -0.05073205754160881, 0.01953752338886261, 0.06519629806280136, 0.024620775133371353, -0.008694118820130825, -0.0015696329064667225, -0.050730329006910324, -0.006742075551301241, 0.02753104269504547, 0.0006735536153428257, 0.01082073338329792, -0.07225547730922699, -0.004477155394852161, 0.03492266684770584, -0.016824377700686455, -0.025037448853254318, -0.005238649435341358, 0.03146200254559517, -0.01596829481422901, 0.005040613003075123, 0.043451495468616486, 0.002508900361135602, -0.004341167397797108, 0.008060052990913391, 0.06128079444169998, -0.05046314001083374, 0.027511069551110268, -0.011579490266740322, 0.023425385355949402, 0.023609396070241928, -0.02585032396018505, -0.03651449829339981, 0.03570558875799179, 0.025350185111165047, 0.02170395478606224, 0.029548928141593933, -0.005422606132924557, -0.04162343218922615, 0.049313098192214966, 0.013724538497626781, -0.017290722578763962, 0.006317933090031147, 0.010277818888425827, 0.0099524250254035, -0.01721157133579254, 0.0054727285169065, 0.005441978573799133, -0.0029869331046938896, 0.042262908071279526, 0.028924087062478065, 0.0507378876209259, 0.008322572335600853, -0.0016478522447869182, 0.014824904501438141, -0.027063662186264992, -0.0013513584854081273, -0.022563720121979713, -0.019760988652706146, 0.03802002593874931, 0.008586759679019451, -0.02136652171611786, -0.02844088524580002, 0.01937064714729786, -0.039476048201322556, -0.0185234397649765, 0.0012295265914872289, 0.04488305002450943, -0.03588828817009926, 0.0009704093681648374, -0.015483953058719635, -0.0057969121262431145, -0.039375901222229004, -0.02144027128815651, -0.031602971255779266, 0.04399658739566803, -0.01035628654062748, -0.02945058047771454, -0.0034124325029551983, 0.03875889256596565, -0.04140699654817581, -0.0020963798742741346, 0.025046830996870995, 0.051914457231760025, 0.03794876113533974, 0.05041868984699249, 0.005271764472126961, -0.023132234811782837, 0.007197024300694466, 0.007044699043035507, -0.029762987047433853, 0.017997751012444496, -0.04353419691324234, 0.007804541848599911, 0.022055895999073982, -0.0003089343081228435, 0.02545485831797123, 0.030643031001091003, 0.005753738339990377, 0.04452591761946678, 0.04442155733704567, -0.020525135099887848, 0.042973220348358154, -0.05607165768742561, 0.036541618406772614, -0.029975978657603264, -0.012635873630642891, -0.009501008316874504, -0.016054043546319008, -0.0370965451002121, 0.04729732498526573, 0.04758016765117645, 0.052256785333156586, -0.018202077597379684, 0.04116110876202583, -0.03482886403799057, -0.026722174137830734, 0.014268970116972923, -0.01632380671799183, 0.009269995614886284, -0.018015949055552483, -0.045947425067424774, 0.02934993989765644, -0.029387755319476128, 0.00412138644605875, 0.008866315707564354, 0.0349862240254879, -0.004838587716221809, -0.033870480954647064, 0.03350403159856796, 0.016537467017769814, -0.008320963010191917, -0.027748487889766693, 0.013173092156648636, -0.004617593251168728, -0.020089754834771156, -0.005082465708255768, -0.01959805004298687, -0.00647574570029974, 0.007448452524840832, 0.004847323056310415, -0.006666719447821379, 0.06271360069513321, -0.004541889298707247, 0.05731829255819321, -0.07019536942243576, -0.004786087200045586, -0.0316024124622345, -0.00012715652701444924, 0.02926640585064888, -0.04242481663823128, -0.007379470393061638, 0.02001609280705452, 0.01033799909055233, 0.014125948771834373, 0.014348480850458145, -0.017118098214268684, 0.003159184940159321, 0.06362389028072357, 0.010880175046622753, -0.05545375496149063, -0.012820395641028881, 0.01977206952869892, 0.07675781100988388, 0.013600978069007397, 0.020274458453059196, -0.006926049944013357, -0.03550794720649719, -0.014071819372475147, -0.03317907080054283, 0.021590961143374443, 0.03643214702606201, -0.002719394164159894, 0.00022849264496471733, 0.02390730008482933, 0.044006045907735825, -0.0029912455938756466, -0.01287943497300148, 0.02044885978102684, 0.05027994140982628, 0.014670808799564838, 0.018007362261414528, -0.011396560817956924, 0.005279615055769682, 0.005664434749633074, 0.017424898222088814, -0.0695192962884903, 0.03273535147309303, 0.038267072290182114, 0.007742488756775856, 0.005278031807392836, 0.01276432815939188, -0.037026211619377136, 0.005602284334599972, 0.022705335170030594, 0.01355550903826952, 0.012869295664131641, -0.025127658620476723, -0.000013320448488229886, -0.015645436942577362, -0.013124697841703892, 0.013663815334439278, 0.04216435179114342, -0.00898802187293768, 0.05373266339302063, 0.010865363292396069, 0.006453349255025387, 0.04372183978557587, -0.015137136913836002, -0.01224132813513279, 0.0022968873381614685, 0.02670619636774063, 0.010085719637572765, 0.03823336586356163, 0.02028866671025753, -0.004562211688607931, -0.02096295915544033, -0.04428936913609505, 0.009830988012254238, -0.022036923095583916, -0.014053530991077423, 0.04468362033367157, -0.03505800664424896, 0.00561312073841691, -0.021411355584859848, 0.021652905270457268, 0.03171259164810181, 0.03798716887831688, -0.04353776574134827, 0.026467885822057724, 0.014855336397886276, 0.027042249217629433, 0.018389316275715828, 0.012460875324904919, 0.045248739421367645, -0.024973848834633827, 0.04020338132977486, 0.02234700880944729, 0.042042043060064316, 0.05090468376874924, -0.005111582111567259, 0.03987980633974075, -0.04542570561170578, -0.015211937017738819, 0.012220093049108982, 0.01953227072954178, -0.0032856096513569355, -0.010702388361096382, 0.0011613003443926573, -0.047822337597608566, 0.0028354679234325886, -0.02394477091729641, -0.006265413947403431, -0.023169565945863724, -0.0014729266986250877, 0.036845866590738297, 0.049092452973127365, 0.03820585086941719, -0.03868035972118378, 0.004038988146930933, -0.01949935592710972, -0.00041133342892862856, 0.014225595630705357, -0.025285771116614342, -0.0325980968773365, 0.003040285548195243, -0.03182681277394295, -0.015794847160577774, 0.016766691580414772, -0.04593495652079582, -0.031052187085151672, -0.01997731626033783, 0.004812626633793116, -0.037215523421764374, -0.002685388084501028, 0.007119797170162201, 0.020069148391485214, -0.029796777293086052, 0.004636184778064489, 0.021946318447589874, -0.03576939180493355, 0.02532622590661049, -0.051024023443460464, -0.00844019465148449, -0.02566196396946907, 0.04373876750469208, 0.03563021123409271, 0.038282498717308044, -0.003346492303535342, -0.06227346882224083, -0.029997892677783966, -0.014538394287228584, -0.0277789868414402, 0.02941361628472805, 0.023352833464741707, -0.01503923162817955, -0.026631828397512436, -0.044309332966804504, -0.02556612342596054, -0.022897429764270782, -0.01218874566257, 0.002723354147747159, -0.034615881741046906, -0.016434630379080772, -0.03182259574532509, 0.019904524087905884, 0.022633500397205353, 0.00004436524977791123, 0.0366688035428524, -0.008431370370090008, 0.011760532855987549, -0.006219984497874975, -0.004362252540886402, -0.07022762298583984, -0.0006143784848973155, -0.03422836586833, -0.03340078145265579, -0.03632747381925583, 0.0012986580841243267, -0.01647401973605156, 0.01528574712574482, -0.05629930645227432, 0.0009235418401658535, -0.05293884500861168, 0.024583425372838974, 0.01326063647866249, -0.020442374050617218, 0.03228287398815155, -0.005642286967486143, -0.0030162131879478693, 0.050840239971876144, -0.002813163213431835, -0.009667783975601196, 0.02759796939790249, -0.0005897182272747159, 0.08187631517648697, 0.04107408970594406, -0.03300217166543007, -0.05346012860536575, -0.0006090854876674712, 0.0037625215481966734, -0.031638242304325104, -0.008482658304274082, -0.024718528613448143, 0.007130712736397982, 0.008300764486193657, 0.022690583020448685, -0.014482115395367146, -0.0083564892411232, 0.029073333367705345, 0.007508752401918173, -0.004602562636137009, 0.020360583439469337, 0.021784169599413872, -0.08240194618701935, 0.0038645740132778883, -0.009020345285534859, -0.004969736561179161, 0.027174264192581177, 0.01618671976029873, 0.02087879367172718, 0.02062012441456318, -0.042960166931152344, -0.00418469263240695, 0.02631022222340107, -0.02713913656771183, -0.011259184218943119, 0.03783293068408966, 0.023981673642992973, -0.04381588473916054, -0.02453700825572014, 0.07118373364210129, 0.020071187987923622, -0.06119215115904808, -0.02071209065616131, -0.043905265629291534, 0.03955617547035217, -0.005209065042436123, 0.034455519169569016, 0.0012982786865904927, 0.048709042370319366, 0.03340417891740799, 0.005829147063195705, 0.005405339878052473, 0.017074622213840485 ]
How to train a new language model from scratch using Transformers and Tokenizers
julien-c
February 14, 2020
how-to-train
guide, nlp
https://huggingface.co/blog/how-to-train
1. Find a dataset First, let us find a corpus of text in Esperanto. Here we’ll use the Esperanto portion of the OSCAR corpus from INRIA. OSCAR is a huge multilingual corpus obtained by language classification and filtering of Common Crawl dumps of the Web. The Esperanto portion of the dataset is only 299M, so we’ll concatenate with the Esperanto sub-corpus of the Leipzig Corpora Collection, which is comprised of text from diverse sources like news, literature, and wikipedia. The final training corpus has a size of 3 GB, which is still small – for your model, you will get better results the more data you can get to pretrain on.
[ -0.002777343848720193, -0.02532578818500042, 0.011824551038444042, 0.023398565128445625, 0.05580642446875572, 0.03158360347151756, 0.03352586179971695, 0.01190439984202385, -0.05229681357741356, 0.011564459651708603, -0.06763749569654465, 0.0338510163128376, 0.005564113613218069, 0.015180225484073162, 0.08657747507095337, -0.051040925085544586, 0.03815640136599541, 0.03718758746981621, 0.0010909378761425614, -0.011291100643575191, -0.05481184273958206, 0.017733529210090637, 0.06911177933216095, 0.009066395461559296, 0.03811083734035492, -0.03932041674852371, 0.03438239172101021, 0.08151248842477798, -0.03765566274523735, 0.0045792837627232075, -0.11217910796403885, -0.025116074830293655, 0.008911602199077606, -0.011283347383141518, -0.09357325732707977, 0.06748909503221512, -0.0855209082365036, 0.0697130560874939, 0.0033392144832760096, -0.031911060214042664, -0.03388528525829315, 0.018443772569298744, -0.03823418915271759, 0.0807972177863121, 0.002728882012888789, -0.027812551707029343, -0.13813096284866333, 0.05023316293954849, -0.03586554899811745, -0.03133110702037811, -0.0577772855758667, 0.012388988398015499, -0.04442187026143074, 0.04694618657231331, 0.014226439408957958, 0.008317932486534119, 0.03611987829208374, -0.08228783309459686, 0.014497148804366589, 0.006039333995431662, 0.005091964732855558, 0.03966231644153595, -0.004963725805282593, 0.04446689411997795, 0.018537841737270355, 0.017680726945400238, -0.04530361667275429, -0.008715186268091202, -0.03805244714021683, -0.04000521078705788, 0.050743043422698975, -0.011458029970526695, -0.02412818744778633, -0.03209639713168144, -0.0013276104582473636, -0.09327463805675507, -0.0026202592998743057, 0.028723422437906265, 0.001679863897152245, -0.0021713273599743843, -0.006409156136214733, 0.04534322768449783, 0.04107275605201721, 0.04408101364970207, 0.10792019218206406, 0.00915074534714222, 0.01746724732220173, -0.013436875306069851, -0.06263262033462524, 0.006722285877913237, 0.025953931733965874, -0.07267379760742188, 0.011089351959526539, 0.04477992653846741, 0.05010285601019859, -0.04462314397096634, 0.037000611424446106, 0.05476963147521019, -0.03791211172938347, 0.0501793809235096, -0.05625369772315025, -0.027244972065091133, 0.029353616759181023, -0.11807888001203537, -0.10707033425569534, 0.008495285175740719, 0.012691842392086983, -0.02106909267604351, -0.001958407461643219, 0.026855947449803352, 0.030974287539720535, -0.003303835866972804, -0.04067832604050636, 0.0074451761320233345, -0.11380141228437424, -0.004779459442943335, 0.07182478159666061, 0.03858328238129616, -0.039769817143678665, 0.06479897350072861, 0.005130593664944172, 0.0975286141037941, 0.047663118690252304, 0.0700279250741005, -0.036146845668554306, 0.0657893642783165, 0.024111073464155197, 0.003719949396327138, 0.02092069946229458, 0.013938984833657742, 0.0350809171795845, -0.07136623561382294, 0.08331094682216644, -0.02852792851626873, -0.0239181499928236, 0.02372962050139904, -0.00279519846662879, 0.01899111643433571, 0.06086665764451027, -0.015537247993052006, -0.05182170495390892, 0.010684771463274956, -0.10371778905391693, 0.006427395157516003, 0.056287817656993866, 0.000326408859109506, -0.08306793123483658, 0.035512130707502365, -0.003048111917451024, 0.03187916427850723, -0.07063020020723343, 0.08017577230930328, -0.022009406238794327, -0.04833881929516792, 0.05909764766693115, 0.009143947623670101, 0.009195790626108646, -0.059769369661808014, -0.06425808370113373, 0.011154180392622948, 0.01256238017231226, 0.005315358284860849, -0.020462898537516594, 0.04312780126929283, 0.008401349186897278, -0.09378407895565033, -0.012525615282356739, 0.0787540003657341, -0.026140626519918442, 0.0034872007090598345, -0.01705501414835453, -0.042504001408815384, 0.10906589776277542, -0.018440138548612595, -0.04731682315468788, 0.003329142462462187, 0.014128599315881729, 0.005789313465356827, -0.001473025418817997, -0.014908617362380028, 0.02402443252503872, 0.012375139631330967, -0.048607710748910904, 0.03219442442059517, 0.00775888841599226, -0.06880898773670197, 0.06393203884363174, -0.007281402125954628, -0.01899687945842743, -0.029696809127926826, 0.01434143353253603, -0.05659780651330948, 0.043364331126213074, -0.009562301449477673, -0.017300479114055634, -0.043184857815504074, 0.029255827888846397, 0.08838478475809097, 0.07068801671266556, 0.08313276618719101, 0.0017991934437304735, -0.005554282106459141, 0.04405738785862923, 0.01676000840961933, -0.024598298594355583, -0.050596725195646286, -0.007663463242352009, -0.03049572929739952, 0.0018465719185769558, -0.03975581005215645, -0.0029527703300118446, -0.0664435476064682, 0.031604066491127014, -0.1006806269288063, -0.0152858542278409, -0.018619172275066376, 0.017788182944059372, 0.05698409304022789, 0.00506317475810647, -0.040633656084537506, 0.16147680580615997, -0.053934499621391296, -0.04531973972916603, 0.06674742698669434, -0.05238324776291847, 0.0546974241733551, 0.04969271272420883, 0.061635810881853104, 0.02899758890271187, -0.07397767156362534, 0.005131414160132408, 0.002051340416073799, 0.04867153242230415, 0.03682243451476097, -0.03262418136000633, -0.05935923755168915, 0.01405720878392458, 0.0036796494387090206, 0.019105449318885803, 0.02715911902487278, -0.011113893240690231, -0.038439638912677765, -0.03924534469842911, 0.04466947168111801, 0.009902196936309338, 0.015537506900727749, 0.11584769189357758, 0.007749148644506931, -0.04116478189826012, 0.019106734544038773, 0.002387681510299444, 0.006767054088413715, -0.023039763793349266, -0.08702821284532547, -0.048092857003211975, 0.002066272310912609, 0.025948455557227135, -0.023907268419861794, -0.026578370481729507, 0.012194034643471241, 0.003585967468097806, 0.0014068403979763389, -0.00818571262061596, -0.027660077437758446, 0.03771581873297691, -0.023456105962395668, 0.0022923131473362446, 0.004785425029695034, 0.012557738460600376, -0.008881445042788982, 0.027455268427729607, -0.005394811276346445, 0.03768329322338104, -0.010162010788917542, -0.012522069737315178, 0.02477179653942585, 0.0040900264866650105, -0.03845175355672836, -0.02073686383664608, -0.0038595586083829403, -0.03592965379357338, -0.05308354273438454, 0.0297903623431921, 0.015309302136301994, 0.005159204825758934, -0.019544800743460655, 0.011701184324920177, -0.03846949338912964, 0.008827698417007923, 0.02682623825967312, -0.005588202271610498, 0.023559831082820892, -0.0017345813103020191, -0.026829548180103302, 0.006074038799852133, -0.016446806490421295, 0.0037854008842259645, -0.0066076177172362804, -0.018451141193509102, 0.02734193578362465, -0.05541304871439934, -0.005741105414927006, 0.018080102279782295, 0.00047239300329238176, -0.03108956851065159, 0.024404743686318398, -0.016203753650188446, 0.03493289649486542, -0.09544239193201065, 0.03408467024564743, 0.0032158885151147842, 0.023130763322114944, -0.004412900656461716, -0.019368626177310944, -0.002505103824660182, 0.019621742889285088, -0.0264130849391222, -0.0048944964073598385, 0.023596985265612602, -0.013709788210690022, 0.04521726444363594, 0.05449816957116127, -0.021549394354224205, 0.021717822179198265, -0.04889495298266411, 0.016509301960468292, 0.04404619708657265, 0.03538024052977562, -0.029192686080932617, 0.0319695770740509, 0.02132679894566536, 0.053666990250349045, -0.015207905322313309, 0.018148217350244522, 0.0029963962733745575, 0.00808214582502842, 0.031868621706962585, -0.0007933195447549224, 0.003754155244678259, -0.01828678324818611, -0.036872055381536484, 0.023505857214331627, -0.03262251242995262, 0.017219386994838715, 0.00011552005162229761, 0.050372686237096786, -0.003048927756026387, 0.05905502289533615, -0.007100551389157772, -0.05162319168448448, 0.044005248695611954, -0.006607145071029663, 0.0013483266811817884, -0.02621336653828621, -0.02498030662536621, 0.001683899899944663, -0.01649530604481697, -0.04894189164042473, -0.022876372560858727, -0.036559075117111206, 0.02768922969698906, 0.0894363671541214, -0.00925888866186142, 0.00800693966448307, 0.06976078450679779, -0.0130414217710495, 0.03404261916875839, -0.023474015295505524, -0.01115858182311058, 0.040155079215765, 0.01530391350388527, -0.041269585490226746, -0.04679250717163086, 0.04142927750945091, 0.01302734762430191, 0.02620796300470829, -0.04728148877620697, 0.0661446824669838, -0.012326791882514954, 0.03693190962076187, 0.06698364019393921, -0.007355017121881247, -0.02905532717704773, 0.007132767699658871, 0.02805262804031372, 0.005415207240730524, 0.00812762975692749, 0.03466402366757393, -0.038337863981723785, 0.026293445378541946, -0.054203249514102936, -0.04687324911355972, 0.005877668038010597, -0.031147683039307594, 0.01714298501610756, -0.06678862869739532, 0.034062646329402924, 0.03490667790174484, 0.011752644553780556, -0.030770916491746902, 0.0013708570040762424, -0.002602061489596963, 0.00013379857409745455, 0.008236320689320564, -0.012807267718017101, -0.018988775089383125, -0.0006670436123386025, -0.008449756540358067, 0.021775199100375175, -0.01046705711632967, -0.006664054002612829, -0.01604561321437359, 0.05587855726480484, 0.0014248376246541739, -0.033660948276519775, -0.016539985314011574, 0.01882612518966198, -0.02325379103422165, 0.02005585841834545, -0.0305208470672369, 0.02466966025531292, 0.013937490060925484, 0.015222068876028061, 0.00266628572717309, -0.0567663311958313, -0.01672121323645115, -0.040556445717811584, -0.0019796115811914206, -0.022467074915766716, -0.005447261035442352, -0.0066545153968036175, 0.012333976104855537, 0.016954807564616203, -0.012414513155817986, 0.005341976415365934, 0.030286844819784164, 0.001461840351112187, -0.030498748645186424, -0.031395215541124344, 0.0186280757188797, 0.043896980583667755, 0.01589978300035, -0.0067733461037278175, -0.003939975518733263, -0.0531548373401165, -0.01696722023189068, 0.009364981204271317, -0.03820418193936348, -0.012071151286363602, -0.044726140797138214, 0.014640722423791885, -0.010865523479878902, -0.008439727127552032, -0.03366834297776222, -0.002032212447375059, -0.04950299486517906, -0.014971104450523853, -0.006190319079905748, 0.012316369451582432, 0.014507961459457874, -0.03520220145583153, 0.022573105990886688, 0.01606479287147522, -0.040015194565057755, 0.009339041076600552, 0.033354297280311584, 0.0106024956330657, 0.04168127104640007, -0.02175312303006649, -0.030149394646286964, -0.04834164306521416, 0.014559874311089516, 0.005857713520526886, -0.03662228211760521, 0.03973369672894478, -0.031007979065179825, -0.009148240089416504, 0.015719905495643616, 0.0136073874309659, 0.032991886138916016, -0.004465346224606037, -0.009298591874539852, 0.024409078061580658, 0.019039038568735123, -0.0030172138940542936, 0.06471305340528488, -0.023457249626517296, -0.009564419277012348, -0.0550304539501667, 0.0042435829527676105, 0.0005851018358953297, 0.006876006722450256, -0.04109213501214981, 0.041933342814445496, 0.03810492157936096, 0.050358451902866364, 0.028370629996061325, 0.025404592975974083, -0.02145414426922798, 0.035129427909851074, 0.017158104106783867, -0.027682997286319733, -0.014604831114411354, -0.013246272690594196, -0.008776545524597168, -0.009267470799386501, -0.04113338142633438, -0.00927539449185133, 0.026303961873054504, 0.006038259249180555, -0.012035662308335304, 0.005365349352359772, 0.005158326122909784, 0.0031138614285737276, -0.018030982464551926, -0.024743802845478058, -0.002292809309437871, -0.012036307714879513, -0.04482036456465721, 0.009095883928239346, -0.029787296429276466, 0.03309764713048935, -0.020155765116214752, -0.06830677390098572, -0.012319238856434822, 0.024964116513729095, 0.021182242780923843, 0.05324013531208038, 0.00247407634742558, -0.045625343918800354, -0.02690865285694599, 0.05936668813228607, 0.011713105253875256, -0.056220561265945435, 0.04490790143609047, 0.0017316393787041306, 0.013056629337370396, -0.009135975502431393, 0.03250274434685707, -0.02277158387005329, 0.0270504429936409, 0.04582704231142998, 0.01233750768005848, -0.012812509201467037, 0.002619092585518956, 0.013566447421908379, 0.051860421895980835, 0.0317370630800724, -0.005726474802941084, -0.02685297466814518, -0.038057684898376465, 0.012319587171077728, 0.023678019642829895, 0.050604116171598434, 0.012774092145264149, 0.007673276588320732, 0.050180140882730484, -0.005938604939728975, 0.04320058971643448, -0.0006201352225616574, -0.014807472936809063, 0.03365259990096092, -0.008652311749756336, 0.04236958548426628, 0.01192812342196703, -0.008347408846020699, -0.012628735974431038, 0.038965772837400436, 0.011448300443589687, -0.05364444479346275, 0.0279603973031044, 0.018170323222875595, -0.03281554952263832, -0.00884893350303173, 0.02219810150563717, -0.07678578048944473, 0.019195787608623505, 0.055818259716033936, 0.02482016384601593, 0.028172843158245087, -0.016581326723098755, -0.004552491940557957, -0.022389264777302742, -0.015506281517446041, -0.012897120788693428, 0.021299757063388824, -0.01743566431105137, 0.07222827523946762, -0.020794721320271492, 0.01979355700314045, 0.014429133385419846, -0.027451898902654648, -0.03824562206864357, 0.015271486714482307, 0.027394212782382965, 0.04428655654191971, 0.04819140210747719, -0.012631946243345737, -0.023405490443110466, -0.012884199619293213, -0.01655714586377144, 0.01318837609142065, -0.037766117602586746, -0.012444894760847092, 0.04019186645746231, -0.06651733070611954, -0.04014795646071434, -0.050970204174518585, 0.043825775384902954, 0.016289973631501198, 0.010828674770891666, -0.04462574049830437, 0.037748683243989944, 0.001635957625694573, 0.015342127531766891, 0.07208213955163956, 0.028823137283325195, 0.011636544950306416, -0.011072437278926373, 0.009792216122150421, 0.06588482856750488, 0.05848751962184906, 0.028488321229815483, -0.0045824237167835236, 0.04033153876662254, -0.038651179522275925, -0.020616116002202034, -0.007628771476447582, -0.008066088892519474, -0.03245319426059723, 0.011440902948379517, 0.04562235251069069, -0.04783956706523895, 0.014858700335025787, -0.03878924250602722, 0.02650730311870575, 0.008789029903709888, -0.010361382737755775, -0.007721719332039356, 0.0382806770503521, -0.020808303728699684, -0.001573653076775372, -0.054042648524045944, 0.012925141490995884, 0.03970599174499512, -0.0020774637814611197, -0.021170884370803833, -0.030597444623708725, -0.007738697808235884, -0.028775695711374283, 0.008334816433489323, 0.021114544942975044, 0.03485802188515663, -0.061282094568014145, 0.0028195518534630537, 0.0001267230254597962, 0.011088186874985695, 0.011448124423623085, 0.01633518561720848, 0.021575473248958588, -0.009557299315929413, 0.014971330761909485, 0.002057519508525729, -0.04902457818388939, -0.031245360150933266, -0.04262514039874077, -0.0009218117920681834, 0.014613213948905468, -0.019962333142757416, 0.046085670590400696, 0.05316827818751335, 0.030845295637845993, -0.06217096373438835, 0.02216370403766632, -0.02609473280608654, -0.01049270760267973, 0.04286722093820572, -0.012914194725453854, -0.01379744429141283, -0.022510264068841934, -0.02144174836575985, -0.020498601719737053, -0.03303738310933113, -0.037735868245363235, 0.028587257489562035, -0.031845252960920334, -0.033818308264017105, -0.025526268407702446, -0.01407101284712553, 0.009916762821376324, -0.01930498518049717, 0.0689048245549202, 0.011561952531337738, 0.02234593965113163, -0.01588241197168827, 0.04160767421126366, -0.0038221036083996296, 0.04678865149617195, -0.03380042314529419, -0.03903941810131073, -0.02657264471054077, -0.001366844866424799, -0.033094462007284164, -0.04212705418467522, -0.05098829045891762, -0.025022253394126892, -0.040423523634672165, 0.006791689898818731, -0.028984002768993378, 0.03318718075752258, 0.037019651383161545, 0.020208539441227913, 0.03510979935526848, 0.03573869541287422, 0.029071731492877007, 0.044236380606889725, -0.02380412258207798, -0.007075691595673561, 0.03371953219175339, 0.0022156937047839165, -0.004005047492682934, 0.015231349505484104, 0.00023963034618645906, -0.02009756863117218, -0.03977267071604729, -0.024149654433131218, 0.02818015031516552, 0.04293958470225334, -0.012368852272629738, -0.004850163124501705, -0.01950390823185444, 0.020104175433516502, 0.020856931805610657, 0.01473580114543438, -0.02890758030116558, 0.036815375089645386, 0.010575562715530396, -0.034813426434993744, 0.007226528599858284, 0.012644554488360882, -0.014660445041954517, 0.047906581312417984, 0.003228484420105815, 0.017668917775154114, 0.01564211957156658, -0.007262914441525936, 0.007431886158883572, 0.00863447692245245, -0.006685289554297924, -0.020388390868902206, 0.04819266125559807, 0.032804880291223526, -0.023665398359298706, 0.014468405395746231, 0.04672447592020035, 0.02655351348221302, -0.0025656595826148987, -0.034907907247543335, -0.015724847093224525, 0.04484209045767784, 0.01611838862299919, 0.0018680213252082467, -0.014838334172964096, 0.019999999552965164, 0.011012990958988667, 0.0266452357172966, -0.0071352762170135975, 0.009965639561414719 ]
How to train a new language model from scratch using Transformers and Tokenizers
julien-c
February 14, 2020
how-to-train
guide, nlp
https://huggingface.co/blog/how-to-train
4. Check that the LM actually trained Aside from looking at the training and eval losses going down, the easiest way to check whether our language model is learning anything interesting is via the FillMaskPipeline. Pipelines are simple wrappers around tokenizers and models, and the 'fill-mask' one will let you input a sequence containing a masked token (here, <mask>) and return a list of the most probable filled sequences, with their probabilities. python from transformers import pipeline fill_mask = pipeline( "fill-mask", model="./models/EsperBERTo-small", tokenizer="./models/EsperBERTo-small" ) # The sun <mask>. # => result = fill_mask("La suno <mask>.") # {'score': 0.2526160776615143, 'sequence': '<s> La suno brilis.</s>', 'token': 10820} # {'score': 0.0999930202960968, 'sequence': '<s> La suno lumis.</s>', 'token': 23833} # {'score': 0.04382849484682083, 'sequence': '<s> La suno brilas.</s>', 'token': 15006} # {'score': 0.026011141017079353, 'sequence': '<s> La suno falas.</s>', 'token': 7392} # {'score': 0.016859788447618484, 'sequence': '<s> La suno pasis.</s>', 'token': 4552} Ok, simple syntax/grammar works. Let’s try a slightly more interesting prompt: python fill_mask("Jen la komenco de bela <mask>.") # This is the beginning of a beautiful <mask>. # => # { # 'score':0.06502299010753632 # 'sequence':'<s> Jen la komenco de bela vivo.</s>' # 'token':1099 # } # { # 'score':0.0421181358397007 # 'sequence':'<s> Jen la komenco de bela vespero.</s>' # 'token':5100 # } # { # 'score':0.024884626269340515 # 'sequence':'<s> Jen la komenco de bela laboro.</s>' # 'token':1570 # } # { # 'score':0.02324388362467289 # 'sequence':'<s> Jen la komenco de bela tago.</s>' # 'token':1688 # } # { # 'score':0.020378097891807556 # 'sequence':'<s> Jen la komenco de bela festo.</s>' # 'token':4580 # } > “Jen la komenco de bela tago”, indeed! With more complex prompts, you can probe whether your language model captured more semantic knowledge or even some sort of (statistical) common sense reasoning.
[ 0.07899538427591324, -0.04066430777311325, 0.011012708768248558, -0.0335247777402401, 0.04120038077235222, 0.044754620641469955, 0.05697348341345787, 0.0530204214155674, -0.05088852718472481, 0.03892305865883827, -0.04258105158805847, 0.09202717244625092, 0.07789108902215958, 0.0617528036236763, -0.001470831804908812, -0.010496214032173157, 0.03630558401346207, 0.0016617235960438848, 0.010492450557649136, 0.004678561817854643, -0.0253139715641737, -0.06078602746129036, 0.0899982750415802, -0.02459460310637951, 0.02732986956834793, -0.051346153020858765, 0.02407267689704895, -0.010110268369317055, -0.07196851819753647, 0.008882853202521801, -0.10189902782440186, 0.03953391686081886, 0.0017366856336593628, -0.023659342899918556, -0.03744637221097946, 0.07737786322832108, -0.10751642286777496, 0.0491986982524395, 0.048282090574502945, 0.009769671596586704, 0.02642051689326763, -0.026702312752604485, -0.014512729831039906, 0.009420848451554775, -0.030614033341407776, -0.060403939336538315, -0.16022345423698425, 0.005498428829014301, -0.04233192279934883, -0.050077296793460846, -0.05410638451576233, 0.050633493810892105, -0.021640906110405922, -0.01921854168176651, -0.009591133333742619, -0.04251343756914139, 0.0015019240090623498, -0.05451340600848198, 0.007015049923211336, 0.010775831528007984, -0.007789173163473606, 0.0455051064491272, -0.01342506892979145, 0.015469979494810104, 0.007031349930912256, -0.009997230023145676, -0.004012192599475384, 0.050230976194143295, -0.061807647347450256, -0.0645008385181427, -0.011087938211858273, 0.014264659024775028, -0.0002666598011273891, 0.004767348058521748, 0.0444810725748539, -0.04349895566701889, -0.01183905079960823, 0.08023904263973236, -0.029239509254693985, 0.04744817689061165, 0.013992488384246826, 0.02509947307407856, 0.020973049104213715, 0.02009514346718788, 0.028911951929330826, 0.019711937755346298, 0.07965000718832016, -0.03460746631026268, -0.009789329022169113, 0.03151577338576317, -0.010751551948487759, -0.12256573140621185, -0.04126514494419098, 0.010075105354189873, 0.04749889299273491, -0.042833101004362106, 0.010888742282986641, 0.02555053122341633, -0.09836890548467636, -0.08525064587593079, -0.01259193941950798, -0.10665755718946457, 0.01366739347577095, -0.06171790137887001, -0.09683433920145035, 0.01545505691319704, -0.00784250907599926, 0.016816554591059685, -0.049500722438097, -0.011788442730903625, -0.0012777792289853096, 0.023976212367415428, -0.023344358429312706, 0.05036621913313866, -0.06340308487415314, 0.016165778040885925, -0.04509793594479561, 0.041860297322273254, -0.012735752388834953, 0.06289400160312653, -0.005907139740884304, 0.06266416609287262, 0.08858072012662888, 0.008058716543018818, 0.0027320890221744776, 0.07649998366832733, -0.013943688943982124, 0.08873298764228821, 0.011965730227530003, -0.004656320437788963, 0.04470653459429741, 0.007613072637468576, 0.033750344067811966, 0.076478511095047, 0.024855561554431915, -0.010970892384648323, 0.06105219945311546, -0.020752111449837685, 0.0050504463724792, 0.008832938969135284, -0.0697999820113182, 0.03167159482836723, -0.07628156989812851, -0.0027987512294203043, 0.06672921031713486, 0.00321556837297976, -0.03205586224794388, 0.03616418316960335, 0.03701860457658768, 0.029690595343708992, 0.0017716349102556705, 0.05168650671839714, -0.033094167709350586, -0.030665993690490723, 0.040123362094163895, 0.08471869677305222, -0.05081215873360634, -0.03044169209897518, -0.06487502157688141, -0.010838855989277363, -0.0055034467950463295, 0.04416559264063835, 0.004887157119810581, -0.0017802888760343194, 0.04729202017188072, -0.022066332399845123, -0.013862750492990017, 0.007430303376168013, 0.03878627344965935, 0.06626111268997192, 0.025399336591362953, -0.0001674466475378722, 0.09183330833911896, -0.037984300404787064, -0.03427993878722191, 0.017491666600108147, 0.019118063151836395, -0.004257811699062586, 0.02913540229201317, 0.012180326506495476, -0.0671844407916069, 0.030082326382398605, -0.04190719127655029, 0.0354108102619648, 0.01964305341243744, -0.07344063371419907, 0.03612489625811577, -0.05229206383228302, 0.0220055989921093, -0.0039808680303394794, -0.03683069348335266, 0.02693932130932808, 0.045983657240867615, -0.047217801213264465, -0.020317237824201584, -0.04220741614699364, -0.017680980265140533, 0.03315863758325577, 0.040767911821603775, -0.006467558443546295, -0.006754160393029451, 0.016442518681287766, 0.04880617558956146, -0.07971364259719849, 0.030451640486717224, 0.027416547760367393, -0.026520218700170517, -0.11294975876808167, 0.011623230762779713, 0.035197194665670395, 0.03632699325680733, -0.09726108610630035, 0.029502637684345245, -0.05201362818479538, -0.04960360750555992, -0.02983582764863968, -0.03171181678771973, -0.016880493611097336, 0.0019862675108015537, 0.012252520769834518, 0.14910562336444855, -0.017151523381471634, -0.04576500877737999, -0.04749070480465889, -0.024996349588036537, 0.006944253575056791, 0.041597288101911545, 0.06110730022192001, 0.06186912953853607, -0.08414238691329956, -0.0706898421049118, -0.05767785757780075, 0.008359048515558243, 0.08322667330503464, -0.0532376691699028, -0.028928404673933983, -0.03493502363562584, 0.017364580184221268, -0.03502724692225456, 0.009912929497659206, 0.006092045456171036, -0.018551768735051155, -0.007232177071273327, 0.11861861497163773, -0.030702006071805954, 0.0126565583050251, 0.09600654244422913, -0.005895460024476051, -0.02698158286511898, 0.017402788624167442, -0.05260134115815163, 0.01877933368086815, -0.032005324959754944, -0.01232809480279684, -0.026639632880687714, -0.02543608285486698, -0.006896350998431444, 0.013880666345357895, -0.025070205330848694, 0.050821978598833084, 0.011605039238929749, 0.0028076001908630133, -0.004162726923823357, -0.011794398538768291, 0.005654127802699804, -0.022673211991786957, 0.022354107350111008, -0.028401674702763557, 0.0017679433804005384, 0.02979004755616188, 0.02404221147298813, -0.006609336007386446, 0.015392174012959003, 0.005839412100613117, 0.01496612373739481, 0.02258101850748062, 0.007869506254792213, -0.016583576798439026, -0.023578299209475517, -0.025809282436966896, -0.0475136861205101, -0.019922692328691483, 0.03740791603922844, 0.025229666382074356, -0.019390540197491646, 0.004769791848957539, -0.00577129703015089, 0.013699249364435673, -0.02847158908843994, 0.004258019849658012, -0.003101320005953312, 0.0582849495112896, -0.014833910390734673, -0.01822711154818535, -0.05602410435676575, -0.010373049415647984, 0.01873820833861828, -0.01764461025595665, 0.003054796950891614, 0.02315261960029602, -0.042319055646657944, 0.018195772543549538, 0.018656453117728233, -0.017771007493138313, -0.02693459577858448, 0.013466526754200459, 0.014162817038595676, 0.01566103845834732, -0.09672816842794418, 0.004435638897120953, 0.04443798586726189, -0.06839323788881302, 0.025361064821481705, -0.02465946599841118, 0.07397241145372391, 0.04751107469201088, -0.0077413953840732574, 0.017047835513949394, -0.0328955352306366, 0.0056700194254517555, -0.0023113484494388103, 0.06496884673833847, 0.008363253436982632, -0.013977921567857265, -0.044939279556274414, 0.008360393345355988, 0.04473185911774635, 0.010657801292836666, 0.027259161695837975, -0.002404026221483946, -0.007985067553818226, 0.015624210238456726, -0.0168659258633852, 0.03363862261176109, 0.03223690018057823, 0.0683290958404541, 0.019591884687542915, -0.040434420108795166, -0.021836601197719574, -0.009223012253642082, -0.024388480931520462, 0.013097010552883148, -0.050032224506139755, 0.023159092292189598, 0.008895783685147762, -0.01921064220368862, -0.0022641043178737164, 0.02343672513961792, -0.02332681231200695, 0.016432395204901695, -0.0050519309006631374, -0.009002172388136387, -0.020519288256764412, -0.01217686478048563, -0.023208918049931526, -0.07035119831562042, 0.038316935300827026, -0.05169367045164108, -0.018276948481798172, -0.04742344841361046, 0.008867956697940826, 0.013604046776890755, -0.00016447019879706204, 0.04988943040370941, 0.008266349323093891, 0.0017241300083696842, 0.07132399827241898, 0.04202406853437424, -0.028810786083340645, 0.023125136271119118, -0.004959683865308762, -0.03410914167761803, -0.02246948890388012, 0.04992038011550903, 0.024782823398709297, 0.018886351957917213, -0.01870689168572426, 0.032400380820035934, -0.0018022196600213647, 0.05093291029334068, -0.012588098645210266, 0.005150186829268932, -0.034525685012340546, -0.023371204733848572, -0.02362963743507862, -0.02394253760576248, 0.05851071700453758, 0.01430793572217226, -0.01000216044485569, 0.009662872180342674, -0.060059960931539536, -0.011581039987504482, -0.01508555468171835, 0.008600510656833649, 0.041121311485767365, -0.028579194098711014, 0.049271371215581894, 0.025730999186635017, 0.010839313268661499, -0.013532965444028378, -0.009781945496797562, 0.02100159041583538, -0.007489906623959541, -0.03273214027285576, 0.025642121210694313, 0.0006549597601406276, -0.02927732653915882, 0.014096066355705261, 0.00963048916310072, -0.05113492161035538, 0.04477721452713013, 0.01594816893339157, -0.014125755988061428, 0.012400561012327671, -0.06354600191116333, -0.03464149311184883, 0.03181591257452965, -0.049339715391397476, -0.011233024299144745, 0.0019857599399983883, -0.032842569053173065, -0.014346557669341564, 0.025916216894984245, 0.03895197808742523, -0.007546776439994574, 0.00834015291184187, 0.012743850238621235, -0.0052805435843765736, -0.060385867953300476, 0.008459821343421936, -0.012297403998672962, 0.005348804406821728, 0.014657826162874699, -0.025361374020576477, 0.01906426064670086, -0.0010222827550023794, -0.006840219255536795, 0.0019611427560448647, -0.02153552509844303, 0.020502254366874695, 0.051466960459947586, -0.006609068717807531, -0.005076196976006031, 0.01750730350613594, -0.013516465201973915, 0.0027509473729878664, 0.01415875181555748, -0.025270462036132812, -0.022563718259334564, -0.006521472241729498, -0.006741287652403116, -0.04424118995666504, 0.03332160413265228, -0.05455126240849495, -0.031004523858428, -0.039288341999053955, -0.004851962439715862, 0.006097128614783287, 0.07200942933559418, 0.03489387035369873, -0.05755056068301201, -0.03844938054680824, 0.04507112503051758, -0.024675607681274414, -0.03046746924519539, -0.0022484951186925173, 0.009934834204614162, 0.021568477153778076, -0.012912836857140064, 0.007300389464944601, -0.006331650540232658, 0.058823224157094955, -0.003814220894128084, -0.03005901351571083, -0.016907498240470886, -0.07196817547082901, 0.009755563922226429, -0.004185318946838379, 0.019090784713625908, -0.008911730721592903, 0.019789543002843857, 0.008380534127354622, 0.00835670530796051, 0.029566412791609764, -0.01318038534373045, -0.00949392095208168, -0.007606508210301399, -0.03736009821295738, -0.000533816812094301, -0.02604043483734131, 0.05276570841670036, 0.008001047186553478, -0.02177625149488449, 0.002442873315885663, 0.002058559563010931, 0.03822620213031769, -0.008757879957556725, 0.03456753119826317, 0.018091224133968353, -0.014856534078717232, -0.004944749642163515, -0.019981663674116135, 0.010363989509642124, 0.009104902856051922, -0.011591247282922268, 0.02260311134159565, -0.060368336737155914, -0.009883763268589973, 0.047005798667669296, -0.0000815434759715572, 0.00012400098785292357, -0.0066864886321127415, 0.008321094326674938, 0.0020753326825797558, -0.031763624399900436, -0.00667544873431325, -0.012850223109126091, -0.031750649213790894, 0.02115635573863983, -0.027555612847208977, -0.03359607607126236, 0.03903885930776596, 0.04869573190808296, -0.03853367641568184, 0.024864178150892258, -0.005095289088785648, -0.0007446689996868372, 0.05653621628880501, 0.006928520742803812, 0.029462475329637527, -0.036346472799777985, -0.0256853885948658, 0.04584934189915657, -0.05707385390996933, -0.027688127011060715, 0.0461026206612587, 0.0053415000438690186, 0.04870426282286644, 0.047121014446020126, -0.00836817268282175, 0.038422174751758575, 0.026863841339945793, 0.0362493172287941, 0.00031874666456133127, 0.01908951811492443, 0.011521474458277225, 0.03071369230747223, -0.03768017515540123, 0.01924336701631546, 0.02570965327322483, -0.04662787541747093, 0.012128777801990509, -0.038656044751405716, 0.04223534092307091, 0.02779274247586727, -0.016028232872486115, -0.0011959896655753255, -0.02261483110487461, 0.006198978517204523, 0.068428635597229, -0.019408972933888435, 0.04034009948372841, 0.010981258936226368, 0.032281145453453064, 0.014553889632225037, -0.007964507676661015, -0.02886483632028103, 0.008997833356261253, -0.017037322744727135, -0.06891695410013199, 0.0048275357112288475, 0.08928553014993668, 0.0074476636946201324, 0.02482200413942337, 0.02053954266011715, -0.03980449587106705, 0.02682853676378727, 0.042437341064214706, 0.03159932419657707, -0.010225345380604267, -0.006159799173474312, 0.006038946099579334, 0.04409047216176987, -0.06359165161848068, 0.0027671423740684986, 0.05456053465604782, -0.02255854196846485, 0.04967628791928291, -0.021034708246588707, -0.003109112847596407, 0.01647987775504589, 0.009651286527514458, 0.01870366744697094, -0.0011367491679266095, 0.05136367306113243, 0.057707104831933975, 0.010686035268008709, -0.0050257667899131775, -0.00995948538184166, -0.018092302605509758, -0.0369752012193203, -0.02495691552758217, -0.008289527148008347, 0.018932407721877098, 0.04565511643886566, 0.0056206719018518925, 0.01947471871972084, -0.02797710709273815, 0.05837554112076759, -0.016722161322832108, 0.018325766548514366, -0.0018381234258413315, 0.020263873040676117, 0.027599656954407692, 0.009063931182026863, -0.025584794580936432, 0.043054260313510895, -0.014265881851315498, 0.018949244171380997, 0.06612986326217651, 0.013613899238407612, 0.011428149417042732, 0.03921012580394745, 0.026022661477327347, 0.026048805564641953, -0.027455640956759453, -0.02417571283876896, 0.04164585471153259, 0.0019630282185971737, -0.02915327250957489, -0.0020755883306264877, 0.018703853711485863, -0.010350020602345467, -0.03593389689922333, -0.04549901932477951, -0.007492590229958296, -0.0005971924401819706, -0.013115501962602139, -0.03731250762939453, 0.019296227023005486, 0.01326711755245924, -0.03342685103416443, -0.022216375917196274, 0.007443962153047323, 0.006819724105298519, 0.007127933204174042, -0.04762636125087738, -0.024839455261826515, -0.028159480541944504, -0.021898632869124413, -0.022509213536977768, 0.03454266116023064, -0.005847092252224684, -0.02930932119488716, 0.009780550375580788, 0.018827680498361588, -0.02273321896791458, 0.06809613108634949, -0.0008697546436451375, -0.002669001230970025, 0.004058476537466049, 0.007612163200974464, -0.021813103929162025, -0.05127205699682236, 0.07065141201019287, -0.017610054463148117, -0.017218273133039474, 0.0009475959232077003, 0.021010901778936386, 0.010323560796678066, 0.0362582728266716, 0.005543510429561138, -0.018646785989403725, -0.023548560217022896, 0.035281721502542496, -0.030068183317780495, 0.03062559850513935, -0.01577610708773136, 0.0324002280831337, -0.03685983270406723, 0.005124386865645647, -0.02245502732694149, 0.0006602198700420558, 0.007307031191885471, 0.038602087646722794, -0.012611011043190956, -0.02762460894882679, 0.027458159253001213, 0.003044388722628355, 0.025046484544873238, 0.03444975987076759, 0.04613208770751953, 0.004467997699975967, -0.019462648779153824, 0.006190724205225706, 0.01190913189202547, -0.027535518631339073, 0.013179607689380646, -0.019384387880563736, -0.04161597415804863, -0.04693140834569931, 0.023684147745370865, -0.03411559388041496, 0.039293769747018814, -0.05773242935538292, 0.002616096055135131, -0.040472909808158875, -0.005818629637360573, 0.04133995994925499, 0.011063292622566223, 0.08115782588720322, 0.016458626836538315, 0.01318596675992012, -0.02882789634168148, -0.021545061841607094, -0.007812025025486946, -0.03363850340247154, 0.02067836932837963, 0.043463222682476044, 0.06376110762357712, -0.0032319570891559124, 0.0018758336082100868, 0.0023911166936159134, -0.037382256239652634, -0.048409245908260345, -0.03647129610180855, 0.024012373760342598, 0.0032768165692687035, -0.02562764100730419, 0.0017978381365537643, 0.0508594736456871, -0.03147156536579132, 0.032087892293930054, 0.034827399998903275, 0.000519271066877991, 0.00758006889373064, 0.03220353275537491, -0.0486530102789402, -0.012175815179944038, 0.03206349536776543, 0.01030050776898861, 0.035432688891887665, 0.04168228060007095, 0.03780828043818474, 0.050098542124032974, -0.001091523328796029, -0.019393401220440865, 0.015231628902256489, -0.024156179279088974, -0.05302409455180168, 0.0220523439347744, 0.020090796053409576, -0.005050553008913994, -0.03279709070920944, 0.05085411295294762, 0.012860552407801151, -0.0032691119704395533, -0.035462651401758194, 0.0016212925547733903, 0.013104301877319813, 0.004765974823385477, 0.006105434615164995, -0.03006022609770298, 0.014138497412204742, 0.004331658128648996, -0.032650407403707504, -0.04693200811743736, 0.03566548973321915 ]
How to generate text: using different decoding methods for language generation with Transformers
patrickvonplaten
March, 2020
how-to-generate
guide, nlp
https://huggingface.co/blog/how-to-generate
Greedy Search Greedy search is the simplest decoding method. It selects the word with the highest probability as its next word: \(w_t = argmax_{w}P(w | w_{1:t-1})\) at each timestep \(t\). The following sketch shows greedy search. Starting from the word \(\text{"The"},\) the algorithm greedily chooses the next word of highest probability \(\text{"nice"}\) and so on, so that the final generated word sequence is \((\text{"The"}, \text{"nice"}, \text{"woman"})\) having an overall probability of \(0.5 \times 0.4 = 0.2\) . In the following we will generate word sequences using GPT2 on the context \((\text{"I"}, \text{"enjoy"}, \text{"walking"}, \text{"with"}, \text{"my"}, \text{"cute"}, \text{"dog"})\). Let's see how greedy search can be used in transformers: python # encode context the generation is conditioned on model_inputs = tokenizer('I enjoy walking with my cute dog', return_tensors='pt').to(torch_device) # generate 40 new tokens greedy_output = model.generate(**model_inputs, max_new_tokens=40) print("Output:\n" + 100 * '-') print(tokenizer.decode(greedy_output[0], skip_special_tokens=True)) Output: ---------------------------------------------------------------------------------------------------- I enjoy walking with my cute dog, but I'm not sure if I'll ever be able to walk with my dog. I'm not sure if I'll ever be able to walk with my dog. I'm not sure Alright! We have generated our first short text with GPT2 😊. The generated words following the context are reasonable, but the model quickly starts repeating itself! This is a very common problem in language generation in general and seems to be even more so in greedy and beam search - check out Vijayakumar et al., 2016 and Shao et al., 2017. The major drawback of greedy search though is that it misses high probability words hidden behind a low probability word as can be seen in our sketch above: The word \(\text{"has"}\) with its high conditional probability of \(0.9\) is hidden behind the word \(\text{"dog"}\), which has only the second-highest conditional probability, so that greedy search misses the word sequence \(\text{"The"}, \text{"dog"}, \text{"has"}\) . Thankfully, we have beam search to alleviate this problem!
[ 0.023698970675468445, 0.013929763808846474, 0.028692476451396942, -0.024171141907572746, 0.04355953261256218, 0.046674031764268875, 0.041918352246284485, 0.02269076742231846, -0.0452243909239769, -0.0062102642841637135, -0.11697018146514893, 0.07446299493312836, -0.013841290958225727, 0.048959605395793915, -0.0003192711155861616, -0.010427872650325298, 0.06931756436824799, -0.04897070676088333, 0.024616098031401634, -0.0388171412050724, -0.012956039048731327, -0.03412584960460663, 0.05752916261553764, -0.013039661571383476, 0.057780999690294266, -0.03213274106383324, -0.011341897770762444, 0.010128868743777275, -0.004289984703063965, 0.0292638149112463, -0.09586536139249802, -0.015663523226976395, 0.03826207295060158, -0.04881199449300766, 0.04397621005773544, 0.025061003863811493, -0.16088847815990448, 0.04551338404417038, 0.030658183619379997, -0.020552126690745354, -0.047885749489068985, -0.02848425880074501, -0.03090112842619419, 0.043296460062265396, 0.0006813919171690941, -0.024132980033755302, -0.15087132155895233, 0.09373151510953903, -0.1164439246058464, -0.11736030876636505, -0.04162848740816116, 0.026280805468559265, -0.05007714033126831, 0.06728053838014603, -0.026509106159210205, -0.02546318620443344, 0.0014994501834735274, -0.10885518789291382, 0.026693856343626976, -0.0023361225612461567, 0.03787819668650627, 0.023746920749545097, 0.015564347617328167, 0.07554282993078232, 0.034150008112192154, -0.027058983221650124, -0.01453676912933588, 0.03545225039124489, -0.02266055904328823, -0.04427202418446541, 0.05464055389165878, -0.004023709800094366, -0.05911949649453163, 0.029840514063835144, -0.03035934828221798, 0.0059009725227952, -0.04499344900250435, -0.021107142791152, -0.025629952549934387, 0.09182757139205933, 0.01413669716566801, 0.000876898760907352, 0.0579393096268177, 0.04862475395202637, 0.10940522700548172, 0.022171908989548683, 0.008819405920803547, -0.018628239631652832, -0.03238201141357422, 0.061022404581308365, -0.03614446148276329, -0.14405927062034607, 0.008350505493581295, -0.01697082631289959, 0.023745736107230186, -0.014389732852578163, -0.0017629986396059394, 0.026712918654084206, -0.014629949815571308, 0.011437322944402695, 0.004613774828612804, -0.06448575854301453, 0.016207696869969368, -0.038078416138887405, -0.06707899272441864, 0.049524690955877304, -0.019437549635767937, -0.04328576475381851, -0.018126145005226135, 0.006044900976121426, 0.010599962435662746, 0.02862144634127617, 0.009294446557760239, 0.009400514885783195, -0.0025726770982146263, 0.03748554736375809, 0.018712244927883148, -0.0064703309908509254, -0.0888972282409668, -0.0534512996673584, -0.04498814046382904, 0.0778362974524498, 0.05882729962468147, -0.005897821858525276, -0.0015899291029199958, 0.003619918366894126, -0.014875607565045357, 0.033207982778549194, 0.00046972939162515104, -0.0043547083623707294, 0.08498924970626831, 0.01950753852725029, -0.02852047048509121, -0.010751868598163128, 0.0277455635368824, 0.021192453801631927, 0.04697003960609436, -0.004084973130375147, -0.05286146700382233, -0.04778483882546425, -0.0007627138402312994, 0.019762039184570312, -0.05073168873786926, 0.04037319868803024, -0.010692241601645947, -0.012751802802085876, -0.05901920795440674, 0.09119134396314621, 0.013287816196680069, 0.04278895631432533, -0.007711353711783886, 0.0017072343034669757, 0.0602225735783577, -0.06680256873369217, 0.012629943899810314, 0.058814868330955505, -0.009522377513349056, -0.013570906594395638, -0.08515945822000504, -0.016808880493044853, 0.0024877344258129597, -0.023043012246489525, 0.021354271098971367, -0.007360539399087429, 0.04435763508081436, -0.06961493194103241, 0.03335513174533844, 0.043771758675575256, -0.05639205127954483, 0.0712461918592453, 0.0016525426181033254, 0.029361935332417488, 0.06045679375529289, 0.027722040191292763, 0.006125970743596554, 0.05005999654531479, -0.016636816784739494, 0.011014951393008232, -0.014809206128120422, -0.04130169749259949, -0.012338978238403797, 0.02347087673842907, -0.008218604139983654, -0.011912918649613857, 0.04196176677942276, -0.08528946340084076, 0.002890444127842784, 0.047660138458013535, 0.05701195076107979, 0.0031580172944813967, -0.07941851764917374, -0.07155546545982361, 0.06645841151475906, -0.017833851277828217, -0.01917612925171852, -0.04854007437825203, -0.02712882310152054, 0.03464854136109352, 0.035089269280433655, 0.027502868324518204, 0.0661894902586937, 0.004948655143380165, 0.022361954674124718, -0.010059167630970478, -0.038110990077257156, -0.0645781010389328, -0.017115185037255287, -0.03528934717178345, 0.009383024647831917, 0.06554850935935974, -0.007856964133679867, -0.05696159973740578, -0.010986515320837498, -0.15566451847553253, 0.002174130640923977, -0.05755298212170601, 0.005619230680167675, 0.0618634931743145, 0.019394192844629288, 0.0070832702331244946, 0.10151670128107071, -0.09578437358140945, -0.03249247372150421, -0.005492093972861767, -0.006817357614636421, 0.07425570487976074, 0.02423315867781639, 0.03748117759823799, -0.0012891340302303433, -0.05360669270157814, -0.03264545276761055, -0.04689919948577881, 0.02147715538740158, 0.03460066020488739, -0.026891717687249184, -0.12038102000951767, 0.018611712381243706, 0.05420290678739548, 0.05898327752947807, -0.010158374905586243, -0.017638225108385086, -0.003734016325324774, -0.0751020535826683, 0.05089668929576874, 0.004782291129231453, -0.0382775254547596, 0.08033610880374908, -0.046850524842739105, -0.050031665712594986, -0.012253684923052788, -0.027399273589253426, 0.041497573256492615, -0.06295307725667953, -0.05174683779478073, -0.0008900839020498097, 0.09128841012716293, 0.008546950295567513, -0.019599096849560738, 0.015838103368878365, 0.04515562579035759, -0.027881445363163948, -0.019809726625680923, 0.01316733006387949, -0.029903611168265343, -0.02476789429783821, 0.017948253080248833, 0.03679655119776726, 0.02724798023700714, -0.002004367997869849, 0.007761569228023291, -0.029874563217163086, -0.002395986346527934, -0.009661163203418255, -0.02444520965218544, 0.030592966824769974, 0.023175783455371857, 0.007942021824419498, 0.013247942551970482, -0.04223373159766197, -0.02695371024310589, -0.02619555965065956, -0.01582794450223446, 0.05756760388612747, 0.01947467215359211, -0.0024672995787113905, -0.002455824287608266, -0.010212364606559277, 0.024480704218149185, -0.01250979583710432, 0.04373468458652496, -0.03635454922914505, 0.02065557800233364, -0.017876215279102325, -0.023413188755512238, 0.003735302947461605, -0.014480448327958584, -0.010192913934588432, 0.006970172747969627, -0.05421983823180199, 0.0380476750433445, -0.026275068521499634, 0.00965174287557602, -0.0007331191445700824, -0.016680540516972542, -0.026173407211899757, -0.011738195084035397, 0.01785488985478878, 0.043085068464279175, -0.09167594462633133, -0.01483835093677044, 0.021192528307437897, -0.02338779717683792, -0.011401977390050888, -0.016725528985261917, 0.015847958624362946, 0.0098843639716506, -0.013039122335612774, -0.031109033152461052, 0.0002797039342112839, 0.017336895689368248, -0.013507257215678692, 0.009319276548922062, 0.011832267977297306, -0.0067726727575063705, -0.020121518522500992, 0.019128838554024696, -0.006975746713578701, 0.011200263164937496, 0.06466837972402573, 0.04357083514332771, 0.005003368016332388, 0.004422707483172417, -0.059527575969696045, -0.02621135488152504, 0.01280918624252081, -0.0049143205396831036, 0.0368218757212162, 0.0044041648507118225, -0.0033254502341151237, -0.01922224834561348, -0.007894689217209816, 0.006863628048449755, -0.017544914036989212, -0.009586512111127377, 0.009710163809359074, 0.001057066605426371, -0.022633802145719528, 0.02760685607790947, -0.0016874975990504026, -0.015421206131577492, 0.013763920404016972, -0.0006326579605229199, 0.010732611641287804, 0.013062053360044956, -0.03167126327753067, 0.00317195663228631, 0.03083507902920246, -0.0589110292494297, -0.04560002684593201, -0.020897438749670982, -0.04161752760410309, 0.010969606228172779, 0.006073655094951391, 0.05556264519691467, -0.004328135401010513, 0.03245139867067337, 0.03944064676761627, 0.03624844178557396, -0.044019829481840134, 0.01018057856708765, 0.0187978632748127, -0.05614546686410904, 0.005603153258562088, 0.052966468036174774, -0.004963043611496687, 0.018805760890245438, -0.013893858529627323, 0.04493676498532295, 0.011596191674470901, -0.018289413303136826, -0.007258303929120302, 0.0034385037142783403, -0.02886301279067993, 0.03734176978468895, -0.019361723214387894, -0.04166998341679573, 0.08569081127643585, -0.0020051696337759495, -0.013048673048615456, -0.019369782879948616, -0.07416296005249023, -0.002338321879506111, 0.017679888755083084, -0.03620200231671333, 0.03570833057165146, -0.01292042713612318, -0.00907166302204132, 0.0031808281783014536, -0.012696641497313976, -0.008517124690115452, -0.011662498116493225, -0.011528626084327698, -0.047789379954338074, 0.025540906935930252, -0.004814358428120613, -0.005271109752357006, 0.028211800381541252, 0.0033221933990716934, 0.028879381716251373, -0.0603611096739769, 0.005837737582623959, 0.0032572203781455755, -0.02579405903816223, -0.006377125158905983, -0.039223894476890564, -0.024181609973311424, 0.05274961516261101, 0.019706811755895615, -0.002499533584341407, 0.016171995550394058, 0.015368257649242878, -0.003658528905361891, 0.028777258470654488, 0.021392537280917168, 0.006569028366357088, -0.029067009687423706, -0.026564814150333405, 0.005157330073416233, -0.03380008414387703, 0.03505175560712814, -0.014687800779938698, 0.001835775445215404, 0.019551696255803108, -0.01473073847591877, 0.045224908739328384, 0.01851769909262657, -0.011771682649850845, -0.02089310996234417, -0.024667512625455856, -0.009569929912686348, 0.048399344086647034, -0.019312094897031784, 0.018063537776470184, 0.029509419575333595, 0.010724950581789017, -0.008082224987447262, 0.006269169971346855, -0.06348267942667007, -0.0094460379332304, -0.003725329414010048, 0.029790498316287994, -0.06618837267160416, 0.021689441055059433, 0.016096124425530434, 0.004341010004281998, 0.0031851651147007942, 0.029665593057870865, -0.0015447515761479735, 0.045470163226127625, 0.009810059331357479, -0.04010118916630745, 0.0040757916867733, 0.028916651383042336, -0.026061486452817917, -0.029839705675840378, 0.0183895044028759, -0.008775347843766212, 0.040482308715581894, 0.006642356514930725, -0.02138807252049446, -0.034939445555210114, 0.0043504368513822556, 0.007894672453403473, -0.02117125876247883, -0.0405581071972847, -0.035316236317157745, 0.003249019617214799, -0.016265904530882835, 0.003540859092026949, -0.0076439762488007545, 0.04787105321884155, -0.004633642267435789, -0.012350313365459442, 0.018264465034008026, 0.001959775108844042, 0.031736109405756, -0.04750610142946243, 0.013372602872550488, -0.04197230190038681, -0.0030421819537878036, -0.0014657450374215841, 0.02193335071206093, 0.010411180555820465, 0.04243924096226692, 0.03446635976433754, 0.03591935709118843, -0.009345407597720623, 0.031691085547208786, 0.026172418147325516, -0.03778228163719177, 0.03942369297146797, -0.01672140695154667, -0.007684065494686365, 0.012351561337709427, -0.013861930929124355, 0.03126029670238495, 0.02836051769554615, -0.007127602584660053, 0.05189426243305206, 0.013676717877388, -0.0007914057350717485, -0.020246682688593864, 0.013899209909141064, -0.002523592207580805, 0.004588793963193893, 0.003934287000447512, -0.027725322172045708, -0.034776341170072556, 0.018391991034150124, -0.0069419206120073795, -0.028064152225852013, 0.0003744068380910903, -0.029719334095716476, -0.011373677290976048, -0.017061421647667885, 0.009085378609597683, -0.0013984241522848606, 0.08813854306936264, 0.03621217608451843, 0.0064245727844536304, 0.0028545628301799297, 0.02856774628162384, 0.05329705774784088, -0.03409794345498085, 0.012737286277115345, 0.02061932347714901, 0.03354818746447563, -0.02157951332628727, 0.04328770563006401, -0.041442304849624634, -0.00193471007514745, 0.03717665746808052, 0.001472027855925262, -0.03312866762280464, -0.0049114772118628025, 0.049781184643507004, 0.02359590493142605, 0.0316925048828125, 0.023324796929955482, -0.027887757867574692, 0.006368368398398161, 0.03381997346878052, -0.01650242879986763, 0.03259023651480675, 0.04445931687951088, -0.012775959447026253, -0.007428618147969246, 0.005256175063550472, 0.04868113994598389, 0.0210587065666914, -0.07397321611642838, 0.007306925021111965, 0.005848609376698732, -0.009703930467367172, 0.03650974854826927, -0.011399962939321995, 0.0031715668737888336, 0.045583225786685944, 0.011998520232737064, -0.06536849588155746, 0.00007864450890338048, 0.04519062489271164, -0.04344053566455841, -0.0007049854029901326, -0.021461788564920425, -0.021344881504774094, -0.033604346215724945, -0.011564294807612896, 0.025485845282673836, 0.029450779780745506, -0.013033575378358364, 0.04123226925730705, -0.009533955715596676, 0.03757491707801819, 0.00649933610111475, 0.06291606277227402, -0.023939020931720734, 0.05154997482895851, 0.009843368083238602, 0.024270659312605858, -0.02153027430176735, 0.02635601907968521, -0.006022111512720585, 0.07867226749658585, 0.06397765129804611, 0.00745133962482214, 0.037674956023693085, -0.026212796568870544, -0.011453601531684399, 0.019219305366277695, -0.0414905846118927, -0.03810121864080429, -0.0009827694157138467, 0.0035373943392187357, 0.047356706112623215, -0.04520435258746147, 0.031022299081087112, -0.05614275112748146, 0.023195700719952583, 0.043996505439281464, 0.027461586520075798, -0.041147273033857346, 0.0057335891760885715, 0.016746243461966515, 0.020084194839000702, 0.04282088950276375, 0.05749138072133064, 0.03151868283748627, -0.01587597094476223, 0.03535906597971916, 0.013381089083850384, 0.05777334049344063, 0.06164192408323288, -0.01917254365980625, -0.008087928406894207, -0.03323245793581009, -0.0020702783949673176, 0.005085720680654049, 0.00695772934705019, -0.01889120787382126, 0.029311178252100945, 0.027104590088129044, -0.02232091873884201, 0.009619094431400299, -0.02392713911831379, 0.00366069283336401, 0.019327139481902122, -0.016481386497616768, -0.002171618863940239, 0.02956785075366497, -0.031193973496556282, -0.019479943439364433, -0.020373575389385223, 0.013669083826243877, 0.022289404645562172, 0.021328208968043327, -0.047457922250032425, -0.03476635739207268, -0.012068435549736023, -0.025145066902041435, -0.012249952182173729, -0.02835695818066597, -0.014612938277423382, 0.0025886783841997385, 0.03720749169588089, 0.03241186589002609, -0.005414869170635939, 0.02074233442544937, 0.029306024312973022, 0.014188873581588268, -0.0322025790810585, 0.01508302427828312, 0.0029818089678883553, 0.018360266461968422, 0.034736812114715576, -0.03114469163119793, -0.008657044731080532, -0.005651882849633694, 0.04705020412802696, 0.008847175166010857, 0.030443618074059486, -0.025720376521348953, -0.047546837478876114, 0.0026121388655155897, -0.04185688868165016, -0.01128779910504818, -0.0013085039099678397, 0.016379669308662415, -0.006340201944112778, 0.027112871408462524, -0.03800337761640549, -0.01756402477622032, -0.009890630841255188, -0.00909141730517149, 0.022789455950260162, -0.013864980079233646, -0.05147666856646538, -0.0077642835676670074, 0.030446764081716537, -0.019376734271645546, -0.02250381000339985, 0.03955284506082535, 0.010012753307819366, 0.019859187304973602, 0.002629890339449048, 0.01622692123055458, -0.032079316675662994, -0.04076136276125908, -0.030213378369808197, -0.04320533946156502, 0.02126353792846203, -0.0027913113590329885, -0.04603002965450287, 0.0005930350162088871, -0.046120427548885345, 0.04752855375409126, -0.014201560989022255, 0.026111485436558723, -0.014262477867305279, 0.003146521048620343, 0.0480068065226078, 0.012569839134812355, 0.09060824662446976, 0.004452168941497803, 0.013764690607786179, -0.05444939434528351, 0.00750143313780427, 0.011779597960412502, 0.046337444335222244, 0.013431977480649948, 0.016092300415039062, -0.04844825342297554, -0.009342309087514877, 0.01757960021495819, -0.0027372713666409254, 0.0341484509408474, 0.02172286994755268, -0.02225233055651188, -0.01829802244901657, 0.018349695950746536, 0.028650805354118347, -0.014305803924798965, -0.0442347526550293, 0.000053035902965348214, 0.01844635233283043, 0.007293557748198509, 0.03186255693435669, -0.031559087336063385, 0.0026861790101975203, 0.014334257692098618, 0.025661643594503403, 0.03252217173576355, 0.01730445958673954, 0.03521488979458809, 0.01523289643228054, 0.014555874280631542, -0.032324742525815964, 0.03019167296588421, 0.03181047365069389, -0.03357953950762749, 0.009334270842373371, 0.039315495640039444, -0.048881083726882935, -0.03725612908601761, 0.031889643520116806, 0.027086051180958748, -0.034984443336725235, 0.038599491119384766, 0.004914718680083752, 0.05253686010837555, 0.0343385674059391, 0.012224054895341396, 0.0022254602517932653, 0.084102563560009, -0.017517615109682083, 0.029692191630601883, 0.009524259716272354, 0.0033791051246225834 ]
README.md exists but content is empty.
Downloads last month
19